OnItemAddedToContainer
OxideCarbonItemCalled when item added to container occurs.
void OnItemAddedToContainer(ItemContainer itemContainer, Item item, BasePlayer sourcePlayer)Works — the game method in this build is the one the hook was written for.
Parameters
- itemContainer
- ItemContainer
- item
- Item
- sourcePlayer
- BasePlayer
Return value
voidThe return value is ignored — the hook only notifies.
Example
private void OnItemAddedToContainer(ItemContainer itemContainer, Item item, BasePlayer sourcePlayer)
{
Puts("OnItemAddedToContainer");
}Works in both Oxide and Carbon: Carbon loads Oxide plugins as is.
Injection point
Rust.opj (Oxide)
bool ItemContainer.Insert(Item, BasePlayer)
Passes: ItemContainer itemContainer, Item item, BasePlayer sourcePlayer
WorksReturnBehavior: ContinueArgumentBehavior: AllAssembly-CSharp.dll
Where it is called (this branch's game code)
// …
}
itemsWithOnCycle.Add(item);
}
ItemContainer itemContainer = parent?.parent;
if (itemContainer != null && itemContainer.onItemContentsChanged != null)
{
itemContainer.onItemContentsChanged(item, arg2: true, sourcePlayer);
}
Interface.CallHook("OnItemAddedToContainer", this, item, sourcePlayer);
return true;
}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.