RustTip

OnEntityDismounted

OxideCarbonEntity

Called to validate a player's dismount position before exiting a mount or vehicle.

void OnEntityDismounted(BaseMountable baseMountable, BasePlayer player)
Works — the game method in this build is the one the hook was written for.

Parameters

baseMountable
BaseMountable
player
BasePlayer

Return value

voidThe return value is ignored — the hook only notifies.

Example

private void OnEntityDismounted(BaseMountable baseMountable, BasePlayer player)
{
    Puts("OnEntityDismounted");
}

Works in both Oxide and Carbon: Carbon loads Oxide plugins as is.

Injection point 1

Rust.opj (Oxide)
void BaseMountable.DismountPlayer(BasePlayer, bool)

Passes: BaseMountable baseMountable, BasePlayer player

WorksReturnBehavior: ContinueArgumentBehavior: UseArgumentString (this, a0)Assembly-CSharp.dll

Injection point 2

Rust.opj (Oxide)
void BaseMountable.DismountPlayer(BasePlayer, bool)

Passes: BaseMountable baseMountable, BasePlayer player

WorksReturnBehavior: ContinueArgumentBehavior: UseArgumentString (this, a0)Assembly-CSharp.dll

Where it is called (this branch's game code)

// …
	_mounted = null;
	if (baseVehicle != null)
	{
		baseVehicle.PlayerDismounted(player, this);
	}
	OnPlayerDismounted(player);
	return;
}
Interface.CallHook("OnEntityDismounted", this, player);
if (!GetDismountPosition(player, out var res) || Distance(res) > 10f)
{
	if (baseVehicle != null)
	{
		baseVehicle.PrePlayerDismount(player, this);
	}
	res = player.transform.position;
	_mounted.DismountObject();
// …

Sources: Rust.opj from OxideMod/Oxide.Rust (MIT) and hook metadata of the Carbon documentation (MIT). Method code is decompiled from this branch's server.