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 1/4] :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 From 74bca08eb43f1bfc3dda5c9f7650ee004bae6930 Mon Sep 17 00:00:00 2001 From: oof2win2 <23482862+oof2win2@users.noreply.github.com> Date: Sat, 13 Feb 2021 13:50:32 +0000 Subject: [PATCH 2/4] :sparkles: Command to remove greeting --- config/expcore/roles.lua | 3 ++- locale/en/data.cfg | 1 + modules/data/greetings.lua | 7 +++++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/config/expcore/roles.lua b/config/expcore/roles.lua index 00ee0439..54950b5a 100644 --- a/config/expcore/roles.lua +++ b/config/expcore/roles.lua @@ -154,7 +154,8 @@ Roles.new_role('Supporter','Sup') 'command/tag-color', 'command/jail', 'command/unjail', - 'command/join-message' + 'command/join-message', + 'command/join-message-clear' } Roles.new_role('Partner','Part') diff --git a/locale/en/data.cfg b/locale/en/data.cfg index fea0aabe..e98c73da 100644 --- a/locale/en/data.cfg +++ b/locale/en/data.cfg @@ -1,6 +1,7 @@ [join-message] greet=[color=0,1,0] Welcome to explosive gaming community server! If you like the server join our discord: __1__ [/color] message-set=Your join message has been updated. +message-cleared=Your join message has been cleared. [quickbar] saved=Your quickbar filters have been saved. diff --git a/modules/data/greetings.lua b/modules/data/greetings.lua index 1c885eab..31280f7b 100644 --- a/modules/data/greetings.lua +++ b/modules/data/greetings.lua @@ -33,4 +33,11 @@ Commands.new_command('join-message', 'Sets your custom join message') if not player then return end CustomMessages:set(player, message) return {'join-message.message-set'} +end) + +Commands.new_command('join-message-clear', 'Clear your join message') +:register(function(player, message) + if not player then return end + CustomMessages:remove(player) + return {'join-message.message-cleared'} end) \ No newline at end of file From 98a1a67804efed50ff7916d7eeaa3e66629c43b4 Mon Sep 17 00:00:00 2001 From: oof2win2 <23482862+oof2win2@users.noreply.github.com> Date: Sat, 13 Feb 2021 14:10:21 +0000 Subject: [PATCH 3/4] Fixing unnecessary argument --- modules/data/greetings.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/data/greetings.lua b/modules/data/greetings.lua index 31280f7b..0d2d0393 100644 --- a/modules/data/greetings.lua +++ b/modules/data/greetings.lua @@ -36,7 +36,7 @@ Commands.new_command('join-message', 'Sets your custom join message') end) Commands.new_command('join-message-clear', 'Clear your join message') -:register(function(player, message) +:register(function(player) if not player then return end CustomMessages:remove(player) return {'join-message.message-cleared'} From ded0d48c75936b452af5b0cb5cc84f9af4f14214 Mon Sep 17 00:00:00 2001 From: oof2win2 <23482862+oof2win2@users.noreply.github.com> Date: Sat, 13 Feb 2021 16:35:23 +0000 Subject: [PATCH 4/4] :horse: Performance upgrades --- modules/data/quickbar.lua | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/modules/data/quickbar.lua b/modules/data/quickbar.lua index 0b109b25..5d2bbbcd 100644 --- a/modules/data/quickbar.lua +++ b/modules/data/quickbar.lua @@ -31,32 +31,27 @@ PlayerFilters:on_load(function(player_name, filters) end end) +local ignoredItems = { + ["blueprint"] = true, + ["blueprint-book"] = true, + ["deconstruction-planner"] = true, + ["spidertron-remote"] = true, + ["upgrade-planner"] = true +} + --- Saves your quickbar preset to the script-output folder -- @command save-quickbar 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 then - local ignored = contains(ignoredItems, slot.name) - if ignored == false then + local ignored = ignoredItems[slot.name] + if ignored ~= true then filters[i] = slot.name end end