Beispiel #1
0
 public static void Prefix(InventoryItem ____heldItem)
 {
     if (____heldItem != null && ____heldItem.item) //____heldItem.item can be null on game quitting
     {
         Pickupable pickupable          = ____heldItem.item;
         NitroxId   itemId              = NitroxEntity.GetId(pickupable.gameObject);
         PlayerTool component           = pickupable.GetComponent <PlayerTool>();
         PlayerHeldItemChangedType type = component ? PlayerHeldItemChangedType.HOLSTER_AS_TOOL : PlayerHeldItemChangedType.HOLSTER_AS_ITEM;
         player.BroadcastHeldItemChanged(itemId, type, null);
     }
 }
        public static void Postfix(InventoryItem ____heldItem, NitroxTechType __state)
        {
            if (____heldItem == null)
            {
                return;
            }
            Pickupable pickupable = ____heldItem.item;
            NitroxId   itemId     = NitroxEntity.GetId(pickupable.gameObject);
            PlayerTool component  = pickupable.GetComponent <PlayerTool>();

            PlayerHeldItemChanged.ChangeType type = component ? PlayerHeldItemChanged.ChangeType.DRAW_AS_TOOL : PlayerHeldItemChanged.ChangeType.DRAW_AS_ITEM;
            player.BroadcastHeldItemChanged(itemId, type, __state);
        }