Skip to content

OnDispenserBonus

Usage

  • Return TYPE to prevent default behavior

Example Autogenerated

csharp
private void OnDispenserBonus( ResourceDispenser instance, BasePlayer player, Item item )
{
    Puts( "OnDispenserBonus works!" );
}

Location

  • ResourceDispenser::AssignFinishBonus(BasePlayer player, float fraction, AttackEntity weapon)
csharp
//---
			int num = Mathf.CeilToInt((float)((int)current.amount) * Mathf.Clamp01(fraction));
			int num2 = this.CalculateGatherBonus(player, current, (float)num);
			Item item = ItemManager.Create(current.itemDef, num + num2, 0uL, true);
			if (item != null)
			{
				object returnvar = Interface.CallHook("OnDispenserBonus", this, player, item);
				if (returnvar is Item)
				{
					item = (Item)returnvar;
				}
				Facepunch.Rust.Analytics.Azure.OnGatherItem(item.info.shortname, item.amount, base.baseEntity, player, weapon);
//---

Released under the MIT License.