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