RustTip

OnMeleeThrown

OxideCarbonWeapon

Called when melee thrown occurs.

void OnMeleeThrown(BasePlayer local0, Item local1)
Works — the game method in this build is the one the hook was written for.

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

WorksReturnBehavior: ContinueArgumentBehavior: UseArgumentString (l0, l1)Assembly-CSharp.dll

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

// …
				else
				{
					item.UseItem();
					if (item.amount == 0)
					{
						item.SetParent(null);
					}
				}
				Interface.CallHook("OnMeleeThrown", player, item);
				SingletonComponent<NpcNoiseManager>.Instance.OnWeaponThrown(player, this, canAiHearIt);
			}
			return;
		}
	}
	AntiHack.Log(player, AntiHackType.ProjectileHack, "Item mod not found (" + ShortPrefabName + ")");
	player.stats.combat.LogInvalid(player, this, "mod_missing");
}
// …

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.