Update all code styles

This commit is contained in:
Cooldude2606
2024-09-28 01:56:54 +01:00
parent 5e2a62ab27
commit 292c1a1b68
194 changed files with 9817 additions and 9703 deletions

View File

@@ -8,15 +8,16 @@ local config = require("modules.exp_legacy.config.preset_player_quickbar") --- @
--- Stores the quickbar filters for a player
local PlayerData = require("modules.exp_legacy.expcore.player_data") --- @dep expcore.player_data
local PlayerFilters = PlayerData.Settings:combine('QuickbarFilters')
local PlayerFilters = PlayerData.Settings:combine("QuickbarFilters")
PlayerFilters:set_metadata{
permission = 'command/save-quickbar',
permission = "command/save-quickbar",
stringify = function(value)
if not value then return 'No filters set' end
if not value then return "No filters set" end
local count = 0
for _ in pairs(value) do count = count + 1 end
return count..' filters set'
end
return count .. " filters set"
end,
}
--- Loads your quickbar preset
@@ -25,7 +26,7 @@ PlayerFilters:on_load(function(player_name, filters)
if not filters then return end
local player = game.players[player_name]
for i, item_name in pairs(filters) do
if item_name ~= nil and item_name ~= '' then
if item_name ~= nil and item_name ~= "" then
player.set_quick_bar_slot(i, item_name)
end
end
@@ -36,32 +37,32 @@ local ignoredItems = {
["blueprint-book"] = true,
["deconstruction-planner"] = true,
["spidertron-remote"] = true,
["upgrade-planner"] = 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 = {}
Commands.new_command("save-quickbar", "Saves your Quickbar preset items to file")
:add_alias("save-toolbar")
:register(function(player)
local filters = {}
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 = ignoredItems[slot.name]
if ignored ~= true then
filters[i] = slot.name
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 = ignoredItems[slot.name]
if ignored ~= true then
filters[i] = slot.name
end
end
end
end
if next(filters) then
PlayerFilters:set(player, filters)
else
PlayerFilters:remove(player)
end
if next(filters) then
PlayerFilters:set(player, filters)
else
PlayerFilters:remove(player)
end
return {'quickbar.saved'}
end)
return { "quickbar.saved" }
end)