Skip to content

OnDispenserGather

Usage

  • Return a non-null value to override default behavior

Example Autogenerated

csharp
private object OnDispenserGather( ResourceDispenser instance, BasePlayer entity, Item item )
{
    Puts( "OnDispenserGather works!" );
    return null;
}

Location

  • ResourceDispenser::GiveResourceFromItem(BasePlayer entity, ItemAmount itemAmt, float gatherDamage, float destroyFraction, AttackEntity attackWeapon)
csharp
//---
		return;
	}
	int num5 = CalculateGatherBonus(entity, itemAmt, f);
	int iAmount = Mathf.FloorToInt(f) + num5;
	Item item = ItemManager.CreateByItemID(itemAmt.itemid, iAmount, 0uL);
	if (Interface.CallHook("OnDispenserGather", this, entity, item) == null && item != null)
	{
		ApplyItemOwnership(entity, item);
		OverrideOwnership(item, attackWeapon);
		Facepunch.Rust.Analytics.Azure.OnGatherItem(item.info.shortname, item.amount, base.baseEntity, entity, attackWeapon);
		Interface.CallHook("OnDispenserGathered", this, entity, item);
//---

Released under the MIT License.