/// <summary>
    /// Called when a player retrieves a hacking device from the panel.
    /// </summary>
    /// <param name="playerScript"></param>
    /// <param name="hackDevice"></param>
    public virtual void ServerPlayerRemoveHackingDevice(PlayerScript playerScript, HackingDevice hackDevice)
    {
        Pickupable item     = hackDevice.GetComponent <Pickupable>();
        ItemSlot   handSlot = playerScript.Equipment.ItemStorage.GetActiveHandSlot();
        Pickupable handItem = handSlot.Item;

        if (handItem == null)
        {
            Inventory.ServerPerform(InventoryMove.Transfer(item.ItemSlot, handSlot));
        }
    }
    /// <summary>
    /// Called when we want to store a device in the hacking panel.
    /// </summary>
    /// <param name="hackDevice"></param>
    public virtual void ServerStoreHackingDevice(HackingDevice hackDevice)
    {
        Pickupable item = hackDevice.GetComponent <Pickupable>();

        if (item.ItemSlot != null)
        {
            Inventory.ServerPerform(InventoryMove.Transfer(item.ItemSlot, itemStorage.GetBestSlotFor(item)));
        }
        else
        {
            Inventory.ServerPerform(InventoryMove.Add(item, itemStorage.GetBestSlotFor(item)));
        }
    }
Example #3
0
 /// <summary>
 /// Inventory move in which the object in one slot is transferred directly to another
 /// </summary>
 /// <param name="fromSlot"></param>
 /// <param name="toSlot"></param>
 /// <param name="replacementStrategy">what to do if toSlot is already occupied</param>
 /// <returns>true if successful</returns>
 public static bool ServerTransfer(ItemSlot fromSlot, ItemSlot toSlot, ReplacementStrategy replacementStrategy = ReplacementStrategy.Cancel, bool IgnoreRestraints = false)
 {
     return(ServerPerform(InventoryMove.Transfer(fromSlot, toSlot, replacementStrategy, IgnoreRestraints)));
 }
Example #4
0
 /// <summary>
 /// Inventory move in which the object in one slot is transferred directly to another
 /// </summary>
 /// <param name="fromSlot"></param>
 /// <param name="toSlot"></param>
 /// <param name="replacementStrategy">what to do if toSlot is already occupied</param>
 /// <returns>true if successful</returns>
 public static bool ServerTransfer(ItemSlot fromSlot, ItemSlot toSlot, ReplacementStrategy replacementStrategy = ReplacementStrategy.Cancel)
 {
     return(ServerPerform(InventoryMove.Transfer(fromSlot, toSlot, replacementStrategy)));
 }