Oxide.Rust
Oxide.Rust copied to clipboard
Add OnInventoryItemFind and OnInventoryAmmoItemFind hooks
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 causesPlayerInventory.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 causesPlayerInventory.FindAmmo(AmmoTypes ammoType)
to return that value - This hook already exists for
Chainsaw
andFlameThrower
types with the same signature - This is different from
OnInventoryAmmoFind
in that it returns a single item instead of populating a list