RustTip

OnDieselEngineToggled

OxideEntity
void OnDieselEngineToggled(DieselEngine dieselEngine)
Works — the game method in this build is the one the hook was written for.

Parameters

dieselEngine
DieselEngine

Return value

voidThe return value is ignored — the hook only notifies.

Example

private void OnDieselEngineToggled(DieselEngine dieselEngine)
{
    Puts("OnDieselEngineToggled");
}

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

Injection point 1

Rust.opj (Oxide)
void DieselEngine.EngineOff()

Passes: DieselEngine dieselEngine

WorksReturnBehavior: ContinueArgumentBehavior: JustThisAssembly-CSharp.dll

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

public void EngineOff()
{
	using (FlagsUpdateScope flagsUpdateScope = StartSetFlags(FlagsUpdateMode.SendNetworkUpdate))
	{
		flagsUpdateScope.Set(Flags.On, b: false);
	}
	BroadcastEntityMessage("DieselEngineOff");
Interface.CallHook("OnDieselEngineToggled", this);
}

Injection point 2

Rust.opj (Oxide)
void DieselEngine.EngineOn()

Passes: DieselEngine dieselEngine

WorksReturnBehavior: ContinueArgumentBehavior: JustThisAssembly-CSharp.dll

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

public void EngineOn()
{
	using (FlagsUpdateScope flagsUpdateScope = StartSetFlags(FlagsUpdateMode.SendNetworkUpdate))
	{
		flagsUpdateScope.Set(Flags.On, b: true);
	}
	BroadcastEntityMessage("DieselEngineOn");
Interface.CallHook("OnDieselEngineToggled", this);
}

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.