OnCollectiblePickedup
OxideCarbonResourceCalled when collectible pickedup occurs.
void OnCollectiblePickedup(CollectibleEntity collectibleEntity, BasePlayer reciever, ItemModConsume itemModConsume)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
- collectibleEntity
- CollectibleEntity
- reciever
- BasePlayer
- itemModConsume
- ItemModConsume
Return value
voidThe return value is ignored — the hook only notifies.
Example
private void OnCollectiblePickedup(CollectibleEntity collectibleEntity, BasePlayer reciever, ItemModConsume itemModConsume)
{
Puts("OnCollectiblePickedup");
}Works in both Oxide and Carbon: Carbon loads Oxide plugins as is.
Injection point
Rust.opj (Oxide)
void CollectibleEntity.DoPickup(BasePlayer, bool)
Passes: CollectibleEntity collectibleEntity, BasePlayer reciever, ItemModConsume itemModConsume
Method changed — checkReturnBehavior: ContinueArgumentBehavior: UseArgumentString (this, a0, l9)Assembly-CSharp.dll
Where it is called (this branch's game code)
// …
Analytics.Azure.OnGatherItem(item.info.shortname, item.amount, this, reciever);
reciever.GiveItem(item, GiveItemReason.ResourceHarvested, GiveItemOptions.BackpackOverflow);
}
else
{
item.Drop(transform.position + Vector3.up * 0.5f, Vector3.up);
}
}
Interface.CallHook("OnCollectiblePickedup", this, reciever, component);
itemList = null;
if (pickupEffect.isValid)
{
Effect.server.Run(pickupEffect.resourcePath, transform.position, transform.up);
}
RandomItemDispenser randomItemDispenser = PrefabAttribute.server.Find<RandomItemDispenser>(prefabID);
if (randomItemDispenser != null)
{
// …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.