mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 03:25:23 +09:00
Fixed more breaking changes
This commit is contained in:
@@ -60,7 +60,8 @@ Permission_Groups.new_group("Standard")
|
||||
"admin_action", -- trusted
|
||||
"change_programmable_speaker_alert_parameters", -- standard
|
||||
"drop_item",
|
||||
"change_rocket_silo_mode",
|
||||
"open_new_platform_button_from_rocket_silo",
|
||||
"set_rocket_silo_send_to_orbit_automated_mode",
|
||||
}
|
||||
|
||||
Permission_Groups.new_group("Guest")
|
||||
@@ -81,7 +82,8 @@ Permission_Groups.new_group("Guest")
|
||||
"admin_action", -- trusted
|
||||
"change_programmable_speaker_alert_parameters", -- standard
|
||||
"drop_item",
|
||||
"change_rocket_silo_mode",
|
||||
"open_new_platform_button_from_rocket_silo",
|
||||
"set_rocket_silo_send_to_orbit_automated_mode",
|
||||
"change_programmable_speaker_parameters", -- guest
|
||||
"change_train_stop_station",
|
||||
-- 'deconstruct',
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
--- This file contains all the different settings for the autofill system and gui
|
||||
-- @config Autofill
|
||||
|
||||
local table = require("modules.exp_legacy.overrides.table") -- @dep overrides.table
|
||||
|
||||
local config = {
|
||||
-- General config
|
||||
icon = "item/piercing-rounds-magazine", -- @setting icon that will be used for the toolbar
|
||||
|
||||
@@ -33,6 +33,7 @@ local function error_handler(err)
|
||||
log("[ERROR] Failed to load: " .. currently_loading)
|
||||
errors[error_count] = debug.traceback(error_format:format(currently_loading, err))
|
||||
end
|
||||
return err
|
||||
end
|
||||
|
||||
-- Loads all files from the config and logs that they are loaded
|
||||
|
||||
@@ -11,11 +11,11 @@ local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore
|
||||
local interface_modules = {
|
||||
["Commands"] = Commands,
|
||||
["output"] = Commands.print,
|
||||
["Group"] = "expcore.permission_groups",
|
||||
["Roles"] = "expcore.roles",
|
||||
["Gui"] = "expcore.gui",
|
||||
["Datastore"] = "expcore.datastore",
|
||||
["External"] = "expcore.external",
|
||||
["Group"] = "modules.exp_legacy.expcore.permission_groups",
|
||||
["Roles"] = "modules.exp_legacy.expcore.roles",
|
||||
["Gui"] = "modules.exp_legacy.expcore.gui",
|
||||
["Datastore"] = "modules.exp_legacy.expcore.datastore",
|
||||
["External"] = "modules.exp_legacy.expcore.external",
|
||||
}
|
||||
|
||||
-- loads all the modules given in the above table
|
||||
|
||||
@@ -10,7 +10,6 @@ local Roles = require("modules.exp_legacy.expcore.roles") -- @dep expcore.gui
|
||||
local Storage = require("modules/exp_util/storage") -- @dep utils.global
|
||||
local config = require("modules.exp_legacy.config.gui.autofill") -- @dep config.gui.autofill
|
||||
local Event = require("modules/exp_legacy/utils/event") -- @dep utils.event
|
||||
local table = require("modules.exp_legacy.overrides.table") -- @dep overrides.table
|
||||
|
||||
--- Table that stores if autofill is enabled or not
|
||||
local autofill_player_settings = {}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
local Event = require("modules/exp_legacy/utils/event")
|
||||
local table = require("modules.exp_legacy.overrides.table")
|
||||
local Gui = require("modules.exp_legacy.utils.gui")
|
||||
local Model = require("modules.exp_legacy.modules.gui.debug.model")
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
local Gui = require("modules.exp_legacy.utils.gui") --- @dep utils.gui
|
||||
local table = require("modules.exp_legacy.overrides.table") --- @dep overrides.table
|
||||
|
||||
local gui_names = Gui.names
|
||||
local type = type
|
||||
|
||||
@@ -245,13 +245,17 @@ end
|
||||
--- Status Returns.
|
||||
-- Return values used by async functions
|
||||
|
||||
--- @alias Async.Status (fun(...: any): Async.Status, any[]) | (fun(...: any): Async.Status, number, any[])
|
||||
|
||||
local empty_table = setmetatable({}, {
|
||||
__index = function() error("Field 'Returned' is Immutable") end,
|
||||
__newindex = function() error("Field 'Returned' is Immutable") end,
|
||||
})
|
||||
|
||||
--- Default status, will raise on_function_complete
|
||||
-- @param ... The return value of the async call
|
||||
--- @param ... any The return value of the async call
|
||||
--- @return Async.Status, any[]
|
||||
--- @type Async.Status
|
||||
function Async.status.complete(...)
|
||||
if ... == nil then
|
||||
return Async.status.complete, empty_table
|
||||
@@ -260,7 +264,9 @@ function Async.status.complete(...)
|
||||
end
|
||||
|
||||
--- Will queue the function to be called again on the next tick using the new arguments
|
||||
-- @param ... The arguments to call the function with
|
||||
--- @param ... any The arguments to call the function with
|
||||
--- @return Async.Status, any[]
|
||||
--- @type Async.Status
|
||||
function Async.status.continue(...)
|
||||
if ... == nil then
|
||||
return Async.status.continue, empty_table
|
||||
@@ -269,7 +275,10 @@ function Async.status.continue(...)
|
||||
end
|
||||
|
||||
--- Will queue the function to be called again on a later tick using the new arguments
|
||||
-- @param ... The arguments to call the function with
|
||||
--- @param ticks number The number of ticks to delay for
|
||||
--- @param ... any The arguments to call the function with
|
||||
--- @return Async.Status, number, any[]
|
||||
--- @type Async.Status
|
||||
function Async.status.delay(ticks, ...)
|
||||
ExpUtil.assert_argument_type(ticks, "number", 1, "ticks")
|
||||
assert(ticks > 0, "Ticks must be a positive number")
|
||||
@@ -285,9 +294,12 @@ end
|
||||
local new_next, new_queue = {}, {} -- File scope to allow for reuse
|
||||
|
||||
--- Executes an async function and processes the return value
|
||||
--- @param pending Async.AsyncReturn
|
||||
--- @param tick number
|
||||
local function exec(pending, tick)
|
||||
if pending.cancelled then return end
|
||||
local status, rtn1, rtn2 = Async._functions[pending.id](table.unpack(pending.args))
|
||||
local async_func = Async._functions[pending.func_id]
|
||||
if pending.canceled or async_func == nil then return end
|
||||
local status, rtn1, rtn2 = async_func(table.unpack(pending.args))
|
||||
if status == Async.status.continue then
|
||||
resolve_next[#resolve_next + 1] = pending
|
||||
pending.tick = nil
|
||||
@@ -298,7 +310,7 @@ local function exec(pending, tick)
|
||||
pending.args = rtn2
|
||||
elseif status == Async.status.complete or status == nil then
|
||||
-- The function has finished execution, raise the custom event
|
||||
Async._queue_pressure[pending.id] = Async._queue_pressure[pending.id] - 1
|
||||
Async._queue_pressure[pending.func_id] = Async._queue_pressure[pending.func_id] - 1
|
||||
pending.returned = rtn1
|
||||
if pending.next_id then
|
||||
resolve_next[#resolve_next + 1] = setmetatable({
|
||||
@@ -307,7 +319,7 @@ local function exec(pending, tick)
|
||||
}, Async._return_metatable)
|
||||
end
|
||||
else
|
||||
error("Async function " .. pending.id .. " returned an invalid status: " .. table.inspect(status))
|
||||
error("Async function " .. pending.func_id .. " returned an invalid status: " .. table.inspect(status))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -358,22 +370,20 @@ function Async.on_load()
|
||||
|
||||
-- Rebuild the queue pressure table
|
||||
for _, pending in ipairs(resolve_next) do
|
||||
local count = Async._queue_pressure[pending.id]
|
||||
local count = Async._queue_pressure[pending.func_id]
|
||||
if count then
|
||||
Async._queue_pressure[pending.id] = count + 1
|
||||
Async._queue_pressure[pending.func_id] = count + 1
|
||||
else
|
||||
log("Warning: Pending async function missing after load: " .. pending.id)
|
||||
pending.canceled = true
|
||||
log("Warning: Pending async function missing after load: " .. pending.func_id)
|
||||
end
|
||||
end
|
||||
|
||||
for _, pending in ipairs(resolve_queue) do
|
||||
local count = Async._queue_pressure[pending.id]
|
||||
local count = Async._queue_pressure[pending.func_id]
|
||||
if count then
|
||||
Async._queue_pressure[pending.id] = count + 1
|
||||
Async._queue_pressure[pending.func_id] = count + 1
|
||||
else
|
||||
log("Warning: Pending async function missing after load: " .. pending.id)
|
||||
pending.canceled = true
|
||||
log("Warning: Pending async function missing after load: " .. pending.func_id)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -381,7 +391,9 @@ end
|
||||
--- On init and server startup initialise the storage data
|
||||
function Async.on_init()
|
||||
if storage.exp_async_next == nil then
|
||||
--- @type Async.AsyncReturn[]
|
||||
storage.exp_async_next = {}
|
||||
--- @type Async.AsyncReturn[]
|
||||
storage.exp_async_queue = {}
|
||||
end
|
||||
Async.on_load()
|
||||
|
||||
@@ -136,7 +136,7 @@ end
|
||||
function Common.optional_require(module_path)
|
||||
local success, rtn = xpcall(require, traceback, module_path)
|
||||
if success then return rtn end
|
||||
if not rtn:find("not found; no such file", 0, true) then
|
||||
if not rtn:find("no such file", 0, true) then
|
||||
error(rtn, 2)
|
||||
end
|
||||
end
|
||||
@@ -382,7 +382,7 @@ end
|
||||
--- @param options Common.format_time_factory_param
|
||||
--- @return fun(ticks: number|nil): LocalisedString
|
||||
function Common.format_time_factory_locale(options)
|
||||
local formatter, format, coefficient = Common.format_local_time, options.format, options.coefficient
|
||||
local formatter, format, coefficient = Common.format_time_locale, options.format, options.coefficient
|
||||
if coefficient then
|
||||
return function(ticks) return formatter(ticks and ticks * coefficient or nil, format, options) end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user