RustTip

OnExplosiveFuseSet

OxideCarbonWeapon

Called when explosive fuse set occurs.

object OnExplosiveFuseSet(TimedExplosive timedExplosive, object a0 => a0)
Works — the game method in this build is the one the hook was written for.

Parameters

timedExplosive
TimedExplosive
a0 => a0
object

Return value

objectThe returned value modifies the result, the game continues.

Example

object — you can affect the game: return a value to change or cancel the action.

private object OnExplosiveFuseSet(TimedExplosive timedExplosive, object a0 => a0)
{
    Puts("OnExplosiveFuseSet");

    // change nothing — the game continues as usual
    return null;

    // to affect the game:
    // return default(float); // your value instead of the game result
}

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

Injection point

Rust.opj (Oxide)
void TimedExplosive.SetFuse(float)

Passes: TimedExplosive timedExplosive, object a0 => a0

WorksReturnBehavior: UseArgumentStringArgumentBehavior: UseArgumentString (this, a0 => a0)Assembly-CSharp.dll

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

public virtual void SetFuse(float fuseLength)
{
	if (isServer)
	{
		Interface.CallHook("OnExplosiveFuseSet", this, a0 => a0);
		Invoke(Explode, fuseLength);
		using FlagsUpdateScope flagsUpdateScope = StartSetFlags(FlagsUpdateMode.SendNetworkUpdate);
		flagsUpdateScope.Set(Flags.Reserved2, b: true);
	}
}

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.