OnItemRemovedFromContainer
OxideCarbonItemCalled when item removed from container occurs.
void OnItemRemovedFromContainer(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 OnItemRemovedFromContainer(ItemContainer itemContainer, Item item, BasePlayer sourcePlayer)
{
Puts("OnItemRemovedFromContainer");
}Works in both Oxide and Carbon: Carbon loads Oxide plugins as is.
Injection point
Rust.opj (Oxide)
bool ItemContainer.Remove(Item, BasePlayer)
Passes: ItemContainer itemContainer, Item item, BasePlayer sourcePlayer
WorksReturnBehavior: ContinueArgumentBehavior: AllAssembly-CSharp.dll
Where it is called (this branch's game code)
// …
}
}
ItemContainer itemContainer = parent?.parent;
if (itemContainer != null && itemContainer.onItemContentsChanged != null)
{
itemContainer.onItemContentsChanged(item, arg2: false, sourcePlayer);
}
MarkDirty();
Interface.CallHook("OnItemRemovedFromContainer", 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.