RustTip

OnExplosiveThrown

OxideCarbonWeapon

Called when explosive thrown occurs.

void OnExplosiveThrown(BasePlayer player, BaseEntity local4, ThrownWeapon thrownWeapon)
Works — the game method in this build is the one the hook was written for.

Parameters

player
BasePlayer
local4
BaseEntity
thrownWeapon
ThrownWeapon

Return value

voidThe return value is ignored — the hook only notifies.

Example

private void OnExplosiveThrown(BasePlayer player, BaseEntity local4, ThrownWeapon thrownWeapon)
{
    Puts("OnExplosiveThrown");
}

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

Injection point

Rust.opj (Oxide)
void ThrownWeapon.DoThrow(BaseEntity.RPCMessage)

Passes: BasePlayer player, BaseEntity local4, ThrownWeapon thrownWeapon

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

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

// …
{
	SendThrowResult(msg.player, num, null);
	return;
}
Vector3 eyePos2 = eyePos;
BasePlayer player = msg.player;
uint throwID = num;
DoThrowImpl(eyePos2, normalized, player, out var thrownEntity, throwScale, default, null, throwID);
Interface.CallHook("OnExplosiveThrown", msg.player, thrownEntity, this);
if (thrownEntity == null)
{
	SendThrowResult(msg.player, num, null);
}
else
{
	UseItemAmount(1, reduceItemOwnership: false);
}
// …

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.