OnClothingItemChanged
OxideCarbonPlayerCalled when a clothing item is changed.
void OnClothingItemChanged(PlayerInventory playerInventory, Item item, bool bAdded)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
- playerInventory
- PlayerInventory
- item
- Item
- bAdded
- bool
Return value
voidThe return value is ignored — the hook only notifies.
Example
private void OnClothingItemChanged(PlayerInventory playerInventory, Item item, bool bAdded)
{
Puts("OnClothingItemChanged");
}Works in both Oxide and Carbon: Carbon loads Oxide plugins as is.
Injection point
Rust.opj (Oxide)
void PlayerInventory.OnClothingChanged(Item, bool, BasePlayer)
Passes: PlayerInventory playerInventory, Item item, bool bAdded
Method changed — checkReturnBehavior: ContinueArgumentBehavior: UseArgumentString (this, a0, a1)Assembly-CSharp.dll
Where it is called (this branch's game code)
// …
item.RecalulateParentEntity(children: true);
if (_updatedVisibleHolsteredItemsCallback == null)
{
_updatedVisibleHolsteredItemsCallback = UpdatedVisibleHolsteredItems;
}
baseEntity.Invoke(_updatedVisibleHolsteredItemsCallback, 0.1f);
item?.contents?.onItemAddedRemoved?.Invoke(item, bAdded, sourcePlayer);
}
Interface.CallHook("OnClothingItemChanged", this, item, bAdded);
baseEntity.ProcessMissionEvent(BaseMission.MissionEventType.CLOTHINGCHANGED, 0, 0f);
}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.