RustTip

OnRocketLaunched

OxideCarbonWeapon

Called when a rocket is launched.

void OnRocketLaunched(BasePlayer local0, BaseEntity local8)
Method changed — check — the game method differs from the one the hook is recorded for in Oxide. The hook is still called, but its place may have shifted — worth checking after an update.

Parameters

local0
BasePlayer
local8
BaseEntity

Return value

voidThe return value is ignored — the hook only notifies.

Example

private void OnRocketLaunched(BasePlayer local0, BaseEntity local8)
{
    Puts("OnRocketLaunched");
}

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

Injection point

Rust.opj (Oxide)
void BaseLauncher.SV_Launch(BaseEntity.RPCMessage)

Passes: BasePlayer local0, BaseEntity local8

Method changed — checkReturnBehavior: ContinueArgumentBehavior: UseArgumentString (l0, l8)Assembly-CSharp.dll

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

// …
ServerProjectile component2 = baseEntity.GetComponent<ServerProjectile>();
if ((bool)component2)
{
	component2.InitializeVelocity(GetInheritedVelocity(player, vector2) + vector2 * component2.speed * initialSpeedMultiplier);
}
baseEntity.Spawn();
ProjectileLaunched_Server(component2);
Analytics.Azure.OnExplosiveLaunched(player, baseEntity, this);
Interface.CallHook("OnRocketLaunched", player, baseEntity);
StartAttackCooldown(ScaleRepeatDelay(repeatDelay));
Item ownerItem = GetOwnerItem();
if (ownerItem != null)
{
	if (!UsingInfiniteAmmoCheat)
	{
		ownerItem.LoseCondition(Random.Range(1f, 2f));
	}
// …

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.