RustTip

OnMeleeThrown

OxideCarbonWeapon

Called when melee thrown occurs.

void OnMeleeThrown(BasePlayer local0, Item local1)
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
local1
Item

Return value

voidThe return value is ignored — the hook only notifies.

Example

private void OnMeleeThrown(BasePlayer local0, Item local1)
{
    Puts("OnMeleeThrown");
}

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

Injection point

Rust.opj (Oxide)
void BaseMelee.CLProject(BaseEntity.RPCMessage)

Passes: BasePlayer local0, Item local1

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

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

// …
			{
				item.SetParent(null);
			}
			else
			{
				item.UseItem();
				if (item.amount == 0)
				{
					Interface.CallHook("OnMeleeThrown", player, item);
					item.SetParent(null);
				}
			}
			SingletonComponent<NpcNoiseManager>.Instance.OnWeaponThrown(player, this, canAiHearIt);
		}
		return;
	}
}
// …

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.