From 71eb23cb8cbb7ef4ddfb72cc81b5bc67cdd994ec Mon Sep 17 00:00:00 2001 From: MewMew Date: Thu, 10 Oct 2019 03:18:59 +0200 Subject: [PATCH] exclude quickbar items --- modules/autostash.lua | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/modules/autostash.lua b/modules/autostash.lua index 90b7c3ce..968e30ee 100644 --- a/modules/autostash.lua +++ b/modules/autostash.lua @@ -165,16 +165,24 @@ local function auto_stash(player) chest_floating_text_y_offsets = {} + local hotbar_items = {} + for i = 1, 100, 1 do + local prototype = player.get_quick_bar_slot(i) + if prototype then + hotbar_items[prototype.name] = true + end + end + for name, count in pairs(inventory.get_contents()) do - if not inventory.find_item_stack(name).grid then - insert_item_into_chest(inventory, chests, filtered_chests, name, count) + if not inventory.find_item_stack(name).grid and not hotbar_items[name] then + insert_item_into_chest(inventory, chests, filtered_chests, name, count) end end end local function create_gui_button(player) if player.gui.top.auto_stash then return end - local b = player.gui.top.add({type = "sprite-button", sprite = "item/wooden-chest", name = "auto_stash", tooltip = "Sort your inventory into nearby chests."}) + local b = player.gui.top.add({type = "sprite-button", sprite = "item/wooden-chest", name = "auto_stash", tooltip = "Sort your inventory into nearby chests,\nexcluding quickbar items."}) b.style.font_color = {r=0.11, g=0.8, b=0.44} b.style.font = "heading-1" b.style.minimal_height = 38