private void Update() { // If the configurable hotkey is pressed while hovering an item in inventory, move the item to crafting table Inventory3DManager inventory = Inventory3DManager.Get(); CraftingManager craftingTable = CraftingManager.Get(); if (inventory && craftingTable && !HUDItem.Get().m_Active&& // Make sure RMB menu isn't open for any item right now TriggerController.Get().GetBestTrigger() && // Make sure there is a highlighted item !InputsManager.Get().m_TextInputActive&& // Make sure chat isn't active GetButtonDown(hotkey)) // Make sure hotkey is pressed { bool forceOpenedInventory = false; if (!inventory.IsActive() && openInventoryIfNotOpen) { // Force open inventory Item triggerItem = TriggerController.Get().GetBestTrigger().GetComponent <Item>(); if (triggerItem) { inventory.Activate(); if (inventory.IsActive()) { forceOpenedInventory = true; inventory.m_FocusedItem = triggerItem; if (!triggerItem.GetWasTriggered()) { triggerItem.SetWasTriggered(true); } } } } if (inventory.IsActive() && // Make sure inventory is currently open inventory.m_FocusedItem && !inventory.m_FocusedItem.m_OnCraftingTable && // Make sure the highlighted item isn't already on crafting table !inventory.m_CarriedItem && inventory.CanSetCarriedItem(true) && // Make sure we aren't drag & dropping any items at the moment TriggerController.Get().GetBestTrigger().gameObject == inventory.m_FocusedItem.gameObject) // Make sure the highlighted item is the item that the cursor is on { craftingTable.Activate(); inventory.StartCarryItem(inventory.m_FocusedItem, false); craftingTable.AddItem(inventory.m_CarriedItem, true); if (inventory.m_StackItems != null) { for (int i = 0; i < inventory.m_StackItems.Count; i++) { craftingTable.AddItem(inventory.m_StackItems[i], true); } } inventory.SetCarriedItem(null, true); if (dropItemToTableClip) { inventory.GetComponent <AudioSource>().PlayOneShot(dropItemToTableClip); } } else if (forceOpenedInventory) { inventory.Deactivate(); } } }