Skip to content

OnInventoryAmmoItemFind

Usage

  • Return a non-null value to override default behavior

Example Autogenerated

csharp
private void OnInventoryAmmoItemFind( PlayerInventory inventory, ItemDefinition fuelType )
{
    Puts( "OnInventoryAmmoItemFind works!" );
}
csharp
private void OnInventoryAmmoItemFind( PlayerInventory instance, AmmoTypes ammoType )
{
    Puts( "OnInventoryAmmoItemFind works!" );
}

Location

  • Chainsaw::GetAmmo()
  • FlameThrower::GetAmmo()
  • PlayerInventory::FindAmmo(Rust.AmmoTypes ammoType)
csharp
//---
	BasePlayer ownerPlayer = base.GetOwnerPlayer();
	if (!ownerPlayer)
	{
		return null;
	}
	object returnvar = Interface.CallHook("OnInventoryAmmoItemFind", ownerPlayer.inventory, this.fuelType);
	if (returnvar is Item)
	{
		return (Item)returnvar;
	}
	return ownerPlayer.inventory.FindItemByItemName(this.fuelType.shortname);
//---
csharp
//---
	BasePlayer ownerPlayer = base.GetOwnerPlayer();
	if (!ownerPlayer)
	{
		return null;
	}
	object returnvar = Interface.CallHook("OnInventoryAmmoItemFind", ownerPlayer.inventory, this.fuelType);
	if (returnvar is Item)
	{
		return (Item)returnvar;
	}
	return ownerPlayer.inventory.FindItemByItemName(this.fuelType.shortname);
//---
csharp
public Item FindAmmo(AmmoTypes ammoType)
{
	object returnvar = Interface.CallHook("OnInventoryAmmoItemFind", this, ammoType);
	if (returnvar is Item)
	{
		return (Item)returnvar;
	}
	ItemContainer expr_28 = this.containerMain;
//---

Released under the MIT License.