RustTip

OnLootItem

OxideCarbonPlayer

Called when loot item occurs.

void OnLootItem(PlayerLoot playerLoot, Item item)
Works — the game method in this build is the one the hook was written for.

Parameters

playerLoot
PlayerLoot
item
Item

Return value

voidThe return value is ignored — the hook only notifies.

Example

private void OnLootItem(PlayerLoot playerLoot, Item item)
{
    Puts("OnLootItem");
}

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

Injection point

Rust.opj (Oxide)
void PlayerLoot.StartLootingItem(Item)

Passes: PlayerLoot playerLoot, Item item

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

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

// …
		containers.Add(item.contents);
		if (_markDirtyCallback == null)
		{
			_markDirtyCallback = MarkDirty;
		}
		item.contents.onDirty += _markDirtyCallback;
		itemSource = item;
		entitySource = item.GetWorldEntity();
		Interface.CallHook("OnLootItem", this, item);
		MarkDirty();
	}
}

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.