Added startup mod setting to disable/enable manager in the event it causes crashes or UPS issues so that it can be "optional"

This commit is contained in:
Will Berry
2023-03-09 14:47:50 -05:00
parent c178555343
commit 118f8c9eb2
4 changed files with 12 additions and 2 deletions

View File

@@ -12,6 +12,8 @@ cybersyn-warmup-time=Station warmup time (sec)
cybersyn-stuck-train-time=Stuck train timeout (sec) cybersyn-stuck-train-time=Stuck train timeout (sec)
cybersyn-allow-cargo-in-depot=Allow cargo in depots cybersyn-allow-cargo-in-depot=Allow cargo in depots
cybersyn-invert-sign=Invert combinator output (deprecated) cybersyn-invert-sign=Invert combinator output (deprecated)
cybersyn-manager-enabled=Enable the Cybersyn GUI.
cybersyn-manager-update-rate=Manager refresh tick interval
[mod-setting-description] [mod-setting-description]
cybersyn-enable-planner=Enable or disable the central planning algorithm. If disabled no new trains will be dispatched. cybersyn-enable-planner=Enable or disable the central planning algorithm. If disabled no new trains will be dispatched.
@@ -28,6 +30,7 @@ cybersyn-stuck-train-time=After this many seconds from a train's dispatch, an al
cybersyn-allow-cargo-in-depot=If checked, trains will be allowed to have cargo in depots; no alerts will be generated and the train will not be held. In addition, trains with orders to visit requester stations with "Inactivity condition" checked will wait for inactivity instead of waiting for empty cargo. Useful for creating train systems where depots handle excess cargo. For advanced users only. cybersyn-allow-cargo-in-depot=If checked, trains will be allowed to have cargo in depots; no alerts will be generated and the train will not be held. In addition, trains with orders to visit requester stations with "Inactivity condition" checked will wait for inactivity instead of waiting for empty cargo. Useful for creating train systems where depots handle excess cargo. For advanced users only.
cybersyn-invert-sign=Flip the sign of the output of cybernetic combinators to be the same as it is in LTN or in earlier versions of Project Cybersyn. cybersyn-invert-sign=Flip the sign of the output of cybernetic combinators to be the same as it is in LTN or in earlier versions of Project Cybersyn.
[item-name] [item-name]
cybersyn-combinator=Cybernetic combinator cybersyn-combinator=Cybernetic combinator

View File

@@ -84,7 +84,6 @@ iterations-per-tick=Decrease this number if you're having performance issues.
[cybersyn-mod-setting-name] [cybersyn-mod-setting-name]
history-length=History length history-length=History length
iterations-per-tick=Iterations per tick [img=info] iterations-per-tick=Iterations per tick [img=info]
cybersyn-manager-update-rate=Manager refresh tick interval
[shortcut-name] [shortcut-name]
cybersyn-toggle-gui=Toggle Cybersyn Manager cybersyn-toggle-gui=Toggle Cybersyn Manager

View File

@@ -825,6 +825,7 @@ local function grab_all_settings()
mod_settings.stuck_train_time = settings.global["cybersyn-stuck-train-time"].value--[[@as double]] mod_settings.stuck_train_time = settings.global["cybersyn-stuck-train-time"].value--[[@as double]]
mod_settings.allow_cargo_in_depot = settings.global["cybersyn-allow-cargo-in-depot"].value--[[@as boolean]] mod_settings.allow_cargo_in_depot = settings.global["cybersyn-allow-cargo-in-depot"].value--[[@as boolean]]
mod_settings.invert_sign = settings.global["cybersyn-invert-sign"].value--[[@as boolean]] mod_settings.invert_sign = settings.global["cybersyn-invert-sign"].value--[[@as boolean]]
mod_settings.manager_enabled = settings.startup["cybersyn-manager-enabled"].value--[[@as boolean]]
mod_settings.manager_update_rate = settings.startup["cybersyn-manager-update-rate"].value--[[@as int]] mod_settings.manager_update_rate = settings.startup["cybersyn-manager-update-rate"].value--[[@as int]]
end end
local function on_settings_changed(event) local function on_settings_changed(event)
@@ -904,7 +905,7 @@ local function main()
end end
local MANAGER_ENABLED = true --convert to mod setting? local MANAGER_ENABLED = mod_settings.manager_enabled
script.on_init(function() script.on_init(function()
local setting = settings.global["cybersyn-invert-sign"] local setting = settings.global["cybersyn-invert-sign"]

View File

@@ -111,6 +111,13 @@ data:extend({
minimum_value = 1, minimum_value = 1,
maximum_value = 2147483647, maximum_value = 2147483647,
}, },
{
type = "bool-setting",
name = "cybersyn-manager-enabled",
order = "aa",
setting_type = "startup",
default_value = true,
},
--{ --{
-- type = "bool-setting", -- type = "bool-setting",
-- name = "cybersyn-disable-top-left-button", -- name = "cybersyn-disable-top-left-button",