예제 #1
0
    /// <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));
        }
    }
예제 #2
0
    /// <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)));
        }
    }
예제 #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)));
 }
예제 #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)));
 }