OnCollectiblePickedup
OxideCarbonResourceCalled when collectible pickedup occurs.
void OnCollectiblePickedup(CollectibleEntity collectibleEntity, BasePlayer reciever, Item local9)Works — the game method in this build is the one the hook was written for.
Parameters
- collectibleEntity
- CollectibleEntity
- reciever
- BasePlayer
- local9
- Item
Return value
voidThe return value is ignored — the hook only notifies.
Example
private void OnCollectiblePickedup(CollectibleEntity collectibleEntity, BasePlayer reciever, Item local9)
{
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, Item local9
WorksReturnBehavior: ContinueArgumentBehavior: UseArgumentString (this, a0, l9)Assembly-CSharp.dll
Where it is called (this branch's game code)
// …
}
if ((bool)reciever)
{
Analytics.Azure.OnGatherItem(item.info.shortname, item.amount, this, reciever);
reciever.GiveItem(item, GiveItemReason.ResourceHarvested, GiveItemOptions.BackpackOverflow);
}
else
{
Interface.CallHook("OnCollectiblePickedup", this, reciever, item);
item.Drop(transform.position + Vector3.up * 0.5f, Vector3.up);
}
}
itemList = null;
if (pickupEffect.isValid)
{
Effect.server.Run(pickupEffect.resourcePath, transform.position, transform.up);
}
// …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.