/// <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))); } }
/// <summary> /// Instantiates prefab then add it to inventory /// </summary> /// <param name="addedObject"></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 ServerSpawnPrefab(GameObject addedObject, ItemSlot toSlot, ReplacementStrategy replacementStrategy = ReplacementStrategy.Cancel, bool IgnoreRestraints = false) { var spawn = Spawn.ServerPrefab(addedObject); return(ServerPerform(InventoryMove.Add(spawn.GameObject.GetComponent <Pickupable>(), toSlot, replacementStrategy, IgnoreRestraints))); }
/// <summary> /// Inventory move in which the object was not previously in the inventory system (not in any ItemSlot) /// and now is. /// </summary> /// <param name="addedObject"></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 ServerAdd(GameObject addedObject, ItemSlot toSlot, ReplacementStrategy replacementStrategy = ReplacementStrategy.Cancel, bool IgnoreRestraints = false) { return(ServerPerform(InventoryMove.Add(addedObject, toSlot, replacementStrategy, IgnoreRestraints))); }
/// <summary> /// Inventory move in which the object was not previously in the inventory system (not in any ItemSlot) /// and now is. /// </summary> /// <param name="addedObject"></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 ServerAdd(GameObject addedObject, ItemSlot toSlot, ReplacementStrategy replacementStrategy = ReplacementStrategy.Cancel) { return(ServerPerform(InventoryMove.Add(addedObject, toSlot, replacementStrategy))); }