diff --git a/cybersyn/locale/en/base.cfg b/cybersyn/locale/en/base.cfg index 42d7217..247a08c 100644 --- a/cybersyn/locale/en/base.cfg +++ b/cybersyn/locale/en/base.cfg @@ -12,7 +12,7 @@ cybersyn-warmup-time=Station warmup time (sec) cybersyn-stuck-train-time=Stuck train timeout (sec) cybersyn-allow-cargo-in-depot=Allow cargo in depots cybersyn-invert-sign=Invert combinator output (deprecated) -cybersyn-manager-enabled=Enable the Cybersyn GUI. +cybersyn-manager-enabled=Preview the Indev Cybersyn Manager. cybersyn-manager-update-rate=Manager refresh tick interval cybersyn-manager-result-limit=Max entities displayed on GUI pages. @@ -30,6 +30,8 @@ cybersyn-warmup-time=How many seconds a cybernetic combinator will wait before c cybersyn-stuck-train-time=After this many seconds from a train's dispatch, an alert will be sent to let you know a train is probably stuck and has not completed its delivery. The player will likely have to debug their network to get the train unstuck. 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-manager-enabled=Allows viewing of all trains and stations connected to the Cybersyn network. This GUI is currently in development and is likely to have many crash. +cybersyn-manager-update-rate=Controls how frequently the Cybersyn manager gui refreshes. The Cybersyn manager must be set to active for this setting to have an effect. cybersyn-manager-result-limit=Caps the number of matching enitities (e.g. stations, trains) to limit the amount of update time consumed when the list is refreshed.\n-1 means return all results. [item-name] diff --git a/cybersyn/scripts/factorio-api.lua b/cybersyn/scripts/factorio-api.lua index 7809154..b053e19 100644 --- a/cybersyn/scripts/factorio-api.lua +++ b/cybersyn/scripts/factorio-api.lua @@ -63,10 +63,10 @@ function se_get_space_elevator_name(cache, surface) cache.se_get_space_elevator_name[cache_idx - 1] = entity cache.se_get_space_elevator_name[cache_idx] = name return name + else + return nil end end - - return nil end ---@param cache PerfCache ---@param surface_index uint @@ -78,7 +78,8 @@ local function se_get_zone_from_surface_index(cache, surface_index) local cache_idx = 2*surface_index if cache.se_get_zone_from_surface_index then zone_index = cache.se_get_zone_from_surface_index[cache_idx - 1]--[[@as uint]] - zone_orbit_index = cache.se_get_zone_from_surface_index[cache_idx]--[[@as uint]] + --zones may not have an orbit_index + zone_orbit_index = cache.se_get_zone_from_surface_index[cache_idx]--[[@as uint?]] else cache.se_get_zone_from_surface_index = {} end @@ -86,9 +87,9 @@ local function se_get_zone_from_surface_index(cache, surface_index) if not zone_index then zone = remote.call("space-exploration", "get_zone_from_surface_index", {surface_index = surface_index}) - if type(zone.index) == "number" and type(zone.orbit_index) == "number" then + if zone and type(zone.index) == "number" then zone_index = zone.index--[[@as uint]] - zone_orbit_index = zone.orbit_index--[[@as uint]] + zone_orbit_index = zone.orbit_index--[[@as uint?]] --NOTE: caching these indices could be a problem if SE is not deterministic in choosing them cache.se_get_zone_from_surface_index[cache_idx - 1] = zone_index cache.se_get_zone_from_surface_index[cache_idx] = zone_orbit_index diff --git a/cybersyn/scripts/gui/main.lua b/cybersyn/scripts/gui/main.lua index ae7d033..78ffa0b 100644 --- a/cybersyn/scripts/gui/main.lua +++ b/cybersyn/scripts/gui/main.lua @@ -47,7 +47,7 @@ end local manager_gui = {} function manager_gui.on_lua_shortcut(e) - if e.prototype_name == "cybersyn-toggle-gui" or e.input_name == "cybersyn-toggle-gui" or e.element.name == "manager_window" then + if e.prototype_name == "cybersyn-toggle-gui" or e.input_name == "cybersyn-toggle-gui" or (e.element and e.element.name == "manager_window") then manager.wrapper(e, manager.handle.manager_toggle) end end