OnRackedWeaponSwap
Usage
- Return a non-null value to override default behavior
Example Autogenerated
csharp
private object OnRackedWeaponSwap( Item item, WeaponRackSlot weaponAtIndex, BasePlayer player, WeaponRack instance )
{
Puts( "OnRackedWeaponSwap works!" );
return null;
}Location
- WeaponRack::SwapPlayerWeapon(BasePlayer player, int gridCellIndex, int takeFromBeltIndex, int rotation)
csharp
//---
if (CustomRackType != SpecialRackType.None)
{
gridCellIndex = 0;
}
int bestPlacementCellIndex = GetBestPlacementCellIndex(GetXYForIndex(gridCellIndex), forItemDef, rotation, weaponAtIndex);
if (bestPlacementCellIndex != -1 && Interface.CallHook("OnRackedWeaponSwap", item, weaponAtIndex, player, this) == null)
{
item.RemoveFromContainer();
GivePlayerWeapon(player, mountSlotIndex, takeFromBeltIndex, tryHold: false);
MountWeapon(item, player, bestPlacementCellIndex, rotation, sendUpdate: false);
ItemManager.DoRemoves();
//---