Oxide.Rust icon indicating copy to clipboard operation
Oxide.Rust copied to clipboard

Add OnInventoryItemFind and OnInventoryAmmoItemFind hooks

Open WheteThunger opened this issue 4 months ago • 0 comments

Item OnInventoryItemFind(PlayerInventory inventory, int itemid)
  • Called when the PlayerInventory.FindItemByItemID(int itemid) method is called. For example, when switching ammo types with the currently held weapon, when finding armor to attach to a hot air balloon, when finding a saddle to purchase a horse, and when finding a hood to cover a player's head.
  • Returning an Item value cancels the default behavior, and causes PlayerInventory.FindItemByItemID(int itemid) to return that value
  • Works like the List<Item> OnInventoryItemsFind(PlayerInventory inventory, int itemid) hook but for when Rust is searching for only one item instead of a list of items.
Item OnInventoryAmmoItemFind(PlayerInventory inventory, AmmoTypes ammoType)
  • Called when the PlayerInventory.FindAmmo(AmmoTypes ammoType) method is called. For example, when automatically switching ammo types if the currently selected ammo type is unavailable.
  • Returning an Item value cancels the default behavior, and causes PlayerInventory.FindAmmo(AmmoTypes ammoType) to return that value
  • This hook already exists for Chainsaw and FlameThrower types with the same signature
  • This is different from OnInventoryAmmoFind in that it returns a single item instead of populating a list

WheteThunger avatar Oct 05 '24 20:10 WheteThunger