Skip to content

OnRackedWeaponSwap

Usage

  • Return a non-null value to override default behavior

Example Autogenerated

csharp
private void OnRackedWeaponSwap( Item expr_06, WeaponRackSlot forItemDef, BasePlayer player, WeaponRack instance )
{
    Puts( "OnRackedWeaponSwap works!" );
}

Location

  • WeaponRack::SwapPlayerWeapon(BasePlayer player, int gridCellIndex, int takeFromBeltIndex, int rotation)
csharp
//---
	int bestPlacementCellIndex = this.GetBestPlacementCellIndex(this.GetXYForIndex(gridCellIndex), forItemDef, rotation, weaponAtIndex);
	if (bestPlacementCellIndex == -1)
	{
		return;
	}
	if (Interface.CallHook("OnRackedWeaponSwap", item, weaponAtIndex, player, this) != null)
	{
		return;
	}
	item.RemoveFromContainer();
	this.GivePlayerWeapon(player, mountSlotIndex, takeFromBeltIndex, false, true);
//---

Released under the MIT License.