Skip to content

OnWildlifeTrap

Usage

  • Return a non-null value to override default behavior

Example Autogenerated

csharp
private void OnWildlifeTrap( SurvivalFishTrap instance, ItemDefinition itemDefinition )
{
    Puts( "OnWildlifeTrap works!" );
}
csharp
private void OnWildlifeTrap( WildlifeTrap instance, TrappableWildlife trapped )
{
    Puts( "OnWildlifeTrap works!" );
}

Location

  • SurvivalFishTrap::TrapThink()
  • WildlifeTrap::TrapWildlife(TrappableWildlife trapped)
csharp
//---
	if (itemDefinition != null)
	{
		try
		{
			this.bypassItemFilter = true;
			if (Interface.CallHook("OnWildlifeTrap", this, itemDefinition) != null)
			{
				return;
			}
			Item item2 = ItemManager.Create(itemDefinition, 1, 0uL, true);
			if (!item2.MoveToContainer(base.inventory, -1, true, false, null, true))
//---
csharp
public void TrapWildlife(TrappableWildlife trapped)
{
	if (Interface.CallHook("OnWildlifeTrap", this, trapped) != null)
	{
		return;
	}
	Item item = ItemManager.Create(trapped.inventoryObject, UnityEngine.Random.Range(trapped.minToCatch, trapped.maxToCatch + 1), 0uL, true);
	if (!item.MoveToContainer(base.inventory, -1, true, false, null, true))
//---

Released under the MIT License.