From b6056544aec733c2850b46f0df719c5487073174 Mon Sep 17 00:00:00 2001 From: oof2win2 <23482862+oof2win2@users.noreply.github.com> Date: Sat, 13 Feb 2021 13:50:16 +0000 Subject: [PATCH] :bug: Additional items will not be saved into quickbar sync --- modules/data/quickbar.lua | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/modules/data/quickbar.lua b/modules/data/quickbar.lua index 8d163866..0b109b25 100644 --- a/modules/data/quickbar.lua +++ b/modules/data/quickbar.lua @@ -37,11 +37,28 @@ Commands.new_command('save-quickbar', 'Saves your Quickbar preset items to file' :add_alias('save-toolbar') :register(function(player) local filters = {} + local ignoredItems = { + "blueprint", + "blueprint-book", + "deconstruction-planner", + "spidertron-remote", + "upgrade-planner" + } + local function contains(list, x) + for _, v in pairs(list) do + if v == x then return true end + end + return false + end + for i = 1, 100 do local slot = player.get_quick_bar_slot(i) -- Need to filter out blueprint and blueprint books because the slot is a LuaItemPrototype and does not contain a way to export blueprint data - if slot ~= nil and slot.name ~= "blueprint" and slot.name ~= "blueprint-book" then - filters[i] = slot.name + if slot ~= nil then + local ignored = contains(ignoredItems, slot.name) + if ignored == false then + filters[i] = slot.name + end end end