diff --git a/cybersyn/constants.lua b/cybersyn/constants.lua index 98f9d75..086de2b 100644 --- a/cybersyn/constants.lua +++ b/cybersyn/constants.lua @@ -85,14 +85,14 @@ constants.gui_content_frame_height = 744 constants.gui_inventory_table_height = 40 * 18 constants.gui_translations = { - delivering_to = { "gui.ltnm-delivering-to" }, - fetching_from = { "gui.ltnm-fetching-from" }, - loading_at = { "gui.ltnm-loading-at" }, - not_available = { "gui.ltnm-not-available" }, - parked_at_depot_with_residue = { "gui.ltnm-parked-at-depot-with-residue" }, - parked_at_depot = { "gui.ltnm-parked-at-depot" }, - returning_to_depot = { "gui.ltnm-returning-to-depot" }, - unloading_at = { "gui.ltnm-unloading-at" }, + delivering_to = { "cybersyn-gui.delivering-to" }, + fetching_from = { "cybersyn-gui.fetching-from" }, + loading_at = { "cybersyn-gui.loading-at" }, + not_available = { "cybersyn-gui.not-available" }, + parked_at_depot_with_residue = { "cybersyn-gui.parked-at-depot-with-residue" }, + parked_at_depot = { "cybersyn-gui.parked-at-depot" }, + returning_to_depot = { "cybersyn-gui.returning-to-depot" }, + unloading_at = { "cybersyn-gui.unloading-at" }, } constants.input_sanitizers = { @@ -144,8 +144,8 @@ constants.ltn_event_names = { if script then constants.open_station_gui_tooltip = { "", - { "gui.ltnm-open-station-gui" }, - remote.interfaces["ltn-combinator"] and { "", "\n", { "gui.ltnm-open-ltn-combinator-gui" } } or nil, + { "cybersyn-gui.open-station-gui" }, + remote.interfaces["ltn-combinator"] and { "", "\n", { "cybersyn-gui.open-ltn-combinator-gui" } } or nil, } end diff --git a/cybersyn/data.lua b/cybersyn/data.lua index 7cfd739..3d57f68 100644 --- a/cybersyn/data.lua +++ b/cybersyn/data.lua @@ -26,14 +26,14 @@ data:extend({ --{ -- type = "shortcut", - -- name = "ltnm-toggle-gui", + -- name = "cybersyn-toggle-gui", -- icon = data_util.build_sprite(nil, { 0, 0 }, util.paths.shortcut_icons, 32, 2), -- disabled_icon = data_util.build_sprite(nil, { 48, 0 }, util.paths.shortcut_icons, 32, 2), -- small_icon = data_util.build_sprite(nil, { 0, 32 }, util.paths.shortcut_icons, 24, 2), -- disabled_small_icon = data_util.build_sprite(nil, { 36, 32 }, util.paths.shortcut_icons, 24, 2), -- toggleable = true, -- action = "lua", - -- associated_control_input = "ltnm-toggle-gui", + -- associated_control_input = "cybersyn-toggle-gui", -- technology_to_unlock = "logistic-train-network", --}, }) diff --git a/cybersyn/info.json b/cybersyn/info.json index e1a036f..9bb2ecc 100644 --- a/cybersyn/info.json +++ b/cybersyn/info.json @@ -11,6 +11,7 @@ "? space-exploration >= 0.6.94", "? miniloader", "? nullius", - "? pypostprocessing" + "? pypostprocessing", + "! LtnManager" ] } diff --git a/cybersyn/locale/en/manager.cfg b/cybersyn/locale/en/manager.cfg index fadaa5a..a9d46af 100644 --- a/cybersyn/locale/en/manager.cfg +++ b/cybersyn/locale/en/manager.cfg @@ -1,5 +1,8 @@ +[mod-name] +cybersyn=Cybersyn GUI + [controls] -cybersyn-toggle-gui=Toggle LTN Manager +cybersyn-toggle-gui=Toggle Cybersyn Manager [cybersyn-gui] alert-delivery-failed=Delivery failed @@ -60,7 +63,7 @@ shipment=Shipment shipments=Shipments stations=Stations status-description=[img=flib_indicator_green]1 = normal status\n[img=flib_indicator_blue]n = LTN Controlled Train parked at stop, n = number of trains\n[img=flib_indicator_yellow]n = Stop is part of a scheduled delivery, n = number of trains\n[img=flib_indicator_white]1 = Error - not initialized\n[img=flib_indicator_red]1 = Error - short circuit\n[img=flib_indicator_red]2 = Error - deactivated stop -status=Status +status=Network Signal surface-label=Surface: time=Time train-id=Train ID @@ -81,4 +84,4 @@ history-length=History length iterations-per-tick=Iterations per tick [img=info] [shortcut-name] -cybersyn-toggle-gui=Toggle LTN Manager +cybersyn-toggle-gui=Toggle Cybersyn Manager diff --git a/cybersyn/prototypes/gui-style.lua b/cybersyn/prototypes/gui-style.lua index b4ce7da..e0657da 100644 --- a/cybersyn/prototypes/gui-style.lua +++ b/cybersyn/prototypes/gui-style.lua @@ -364,7 +364,7 @@ data:extend({ -- custom inputs --{ -- type = "custom-input", - -- name = "ltnm-toggle-gui", + -- name = "cybersyn-toggle-gui", -- key_sequence = "CONTROL + T", --}, --{ @@ -376,14 +376,14 @@ data:extend({ -- shortcuts { type = "shortcut", - name = "ltnm-toggle-gui", + name = "cybersyn-toggle-gui", icon = data_util.build_sprite(nil, { 0, 0 }, util.paths.shortcut_icons, 32, 2), disabled_icon = data_util.build_sprite(nil, { 48, 0 }, util.paths.shortcut_icons, 32, 2), small_icon = data_util.build_sprite(nil, { 0, 32 }, util.paths.shortcut_icons, 24, 2), disabled_small_icon = data_util.build_sprite(nil, { 36, 32 }, util.paths.shortcut_icons, 24, 2), toggleable = true, action = "lua", - --associated_control_input = "ltnm-toggle-gui", + --associated_control_input = "cybersyn-toggle-gui", technology_to_unlock = "cybersyn-train-network", }, }) diff --git a/cybersyn/scripts/gui/alerts.lua b/cybersyn/scripts/gui/alerts.lua index 1e915a5..46840f3 100644 --- a/cybersyn/scripts/gui/alerts.lua +++ b/cybersyn/scripts/gui/alerts.lua @@ -12,7 +12,7 @@ function alerts_tab.build(widths) return { tab = { type = "tab", - caption = { "gui.ltnm-alerts" }, + caption = { "cybersyn-gui.alerts" }, ref = { "alerts", "tab" }, actions = { on_click = { gui = "main", action = "change_tab", tab = "alerts" }, @@ -36,7 +36,7 @@ function alerts_tab.build(widths) type = "sprite-button", style = "tool_button_red", sprite = "utility/trash", - tooltip = { "gui.ltnm-delete-all-alerts" }, + tooltip = { "cybersyn-gui.delete-all-alerts" }, ref = { "alerts", "delete_all_button" }, actions = { on_click = { gui = "main", action = "delete_all_alerts" }, @@ -52,7 +52,7 @@ function alerts_tab.build(widths) { type = "label", style = "ltnm_semibold_label", - caption = { "gui.ltnm-no-alerts" }, + caption = { "cybersyn-gui.no-alerts" }, ref = { "alerts", "warning_label" }, }, }, @@ -121,7 +121,7 @@ function alerts_tab.update(self) type = "label", style = "ltnm_clickable_semibold_label", style_mods = { width = widths.alerts.train_id, horizontal_align = "center" }, - tooltip = { "gui.ltnm-open-train-gui" }, + tooltip = { "cybersyn-gui.open-train-gui" }, }, { type = "flow", @@ -153,7 +153,7 @@ function alerts_tab.update(self) type = "sprite-button", style = "tool_button_red", sprite = "utility/trash", - tooltip = { "gui.ltnm-delete-alert" }, + tooltip = { "cybersyn-gui.delete-alert" }, }, }) end @@ -185,8 +185,8 @@ function alerts_tab.update(self) { elem_mods = { caption = util.signed_int32(alerts_entry.train.network_id) } }, { elem_mods = { - caption = { "gui.ltnm-alert-" .. string.gsub(alerts_entry.type, "_", "-") }, - tooltip = { "gui.ltnm-alert-" .. string.gsub(alerts_entry.type, "_", "-") .. "-description" }, + caption = { "cybersyn-gui.alert-" .. string.gsub(alerts_entry.type, "_", "-") }, + tooltip = { "cybersyn-gui.alert-" .. string.gsub(alerts_entry.type, "_", "-") .. "-description" }, }, }, {}, diff --git a/cybersyn/scripts/gui/constants.lua b/cybersyn/scripts/gui/constants.lua index 98f9d75..086de2b 100644 --- a/cybersyn/scripts/gui/constants.lua +++ b/cybersyn/scripts/gui/constants.lua @@ -85,14 +85,14 @@ constants.gui_content_frame_height = 744 constants.gui_inventory_table_height = 40 * 18 constants.gui_translations = { - delivering_to = { "gui.ltnm-delivering-to" }, - fetching_from = { "gui.ltnm-fetching-from" }, - loading_at = { "gui.ltnm-loading-at" }, - not_available = { "gui.ltnm-not-available" }, - parked_at_depot_with_residue = { "gui.ltnm-parked-at-depot-with-residue" }, - parked_at_depot = { "gui.ltnm-parked-at-depot" }, - returning_to_depot = { "gui.ltnm-returning-to-depot" }, - unloading_at = { "gui.ltnm-unloading-at" }, + delivering_to = { "cybersyn-gui.delivering-to" }, + fetching_from = { "cybersyn-gui.fetching-from" }, + loading_at = { "cybersyn-gui.loading-at" }, + not_available = { "cybersyn-gui.not-available" }, + parked_at_depot_with_residue = { "cybersyn-gui.parked-at-depot-with-residue" }, + parked_at_depot = { "cybersyn-gui.parked-at-depot" }, + returning_to_depot = { "cybersyn-gui.returning-to-depot" }, + unloading_at = { "cybersyn-gui.unloading-at" }, } constants.input_sanitizers = { @@ -144,8 +144,8 @@ constants.ltn_event_names = { if script then constants.open_station_gui_tooltip = { "", - { "gui.ltnm-open-station-gui" }, - remote.interfaces["ltn-combinator"] and { "", "\n", { "gui.ltnm-open-ltn-combinator-gui" } } or nil, + { "cybersyn-gui.open-station-gui" }, + remote.interfaces["ltn-combinator"] and { "", "\n", { "cybersyn-gui.open-ltn-combinator-gui" } } or nil, } end diff --git a/cybersyn/scripts/gui/depots.lua b/cybersyn/scripts/gui/depots.lua index 5dfa81a..4520bcc 100644 --- a/cybersyn/scripts/gui/depots.lua +++ b/cybersyn/scripts/gui/depots.lua @@ -8,7 +8,7 @@ function depots_tab.build(widths) return { tab = { type = "tab", - caption = { "gui.ltnm-depots" }, + caption = { "cybersyn-gui.depots" }, ref = { "depots", "tab" }, actions = { on_click = { gui = "main", action = "change_tab", tab = "depots" }, @@ -25,7 +25,7 @@ function depots_tab.build(widths) style_mods = { right_padding = 4 }, templates.sort_checkbox(widths, "depots", "name", true, nil, true), templates.sort_checkbox(widths, "depots", "network_id", false), - templates.sort_checkbox(widths, "depots", "status", false, { "gui.ltnm-status-description" }), + templates.sort_checkbox(widths, "depots", "status", false, { "cybersyn-gui.status-description" }), templates.sort_checkbox(widths, "depots", "trains", false), }, { type = "scroll-pane", style = "ltnm_table_scroll_pane", ref = { "depots", "scroll_pane" } }, @@ -37,7 +37,7 @@ function depots_tab.build(widths) { type = "label", style = "ltnm_semibold_label", - caption = { "gui.ltnm-no-depots" }, + caption = { "cybersyn-gui.no-depots" }, ref = { "depots", "warning_label" }, }, }, diff --git a/cybersyn/scripts/gui/history.lua b/cybersyn/scripts/gui/history.lua index fa57171..d2277f0 100644 --- a/cybersyn/scripts/gui/history.lua +++ b/cybersyn/scripts/gui/history.lua @@ -12,7 +12,7 @@ function history_tab.build(widths) return { tab = { type = "tab", - caption = { "gui.ltnm-history" }, + caption = { "cybersyn-gui.history" }, ref = { "history", "tab" }, actions = { on_click = { gui = "main", action = "change_tab", tab = "history" }, @@ -38,7 +38,7 @@ function history_tab.build(widths) type = "sprite-button", style = "tool_button_red", sprite = "utility/trash", - tooltip = { "gui.ltnm-clear-history" }, + tooltip = { "cybersyn-gui.clear-history" }, ref = { "history", "clear_button" }, actions = { on_click = { gui = "main", action = "clear_history" }, @@ -54,7 +54,7 @@ function history_tab.build(widths) { type = "label", style = "ltnm_semibold_label", - caption = { "gui.ltnm-no-history" }, + caption = { "cybersyn-gui.no-history" }, ref = { "history", "warning_label" }, }, }, diff --git a/cybersyn/scripts/gui/inventory.lua b/cybersyn/scripts/gui/inventory.lua index ea9a17a..cffc5b2 100644 --- a/cybersyn/scripts/gui/inventory.lua +++ b/cybersyn/scripts/gui/inventory.lua @@ -2,7 +2,7 @@ local gui = require("__flib__.gui-lite") local util = require("scripts.gui.util") local templates = require("scripts.gui.templates") -local misc = require("__flib__.misc") +local format = require("__flib__.format") local inventory_tab = {} @@ -11,7 +11,7 @@ function inventory_tab.create() tab = { name = "manager_inventory_tab", type = "tab", - caption = { "gui.ltnm-inventory" }, + caption = { "cybersyn-gui.inventory" }, ref = { "inventory", "tab" }, actions = { on_click = { gui = "main", action = "change_tab", tab = "inventory" }, @@ -149,7 +149,7 @@ function inventory_tab.build(map_data, player_data) local i = 0 for item, count in pairs(inventory_provided) do i = i + 1 - local sprite = util.build_sprite_path(item) + local sprite, img_path, item_string = util.generate_item_references(item) if game.is_valid_sprite_path(sprite) then provided_children[#provided_children+1] = { type = "sprite-button", @@ -157,12 +157,13 @@ function inventory_tab.build(map_data, player_data) enabled = false, sprite = sprite, number = count, - tooltip = "[img=" - .. string.gsub(item, ",", "/") - .. "] [font=default-semibold]" - .. item - .. "[/font]\n" - .. misc.delineate_number(count)} + tooltip = { "", + img_path, + " [font=default-semibold]", + { item_string }, + "[/font]\n"..format.number(count), + }, + } end end @@ -172,7 +173,7 @@ function inventory_tab.build(map_data, player_data) local i = 0 for item, count in pairs(inventory_requested) do i = i + 1 - local sprite = util.build_sprite_path(item) + local sprite, img_path, item_string = util.generate_item_references(item) if game.is_valid_sprite_path(sprite) then requested_children[#requested_children+1] = { type = "sprite-button", @@ -180,12 +181,13 @@ function inventory_tab.build(map_data, player_data) enabled = false, sprite = sprite, number = count, - tooltip = "[img=" - .. string.gsub(item, ",", "/") - .. "] [font=default-semibold]" - .. item - .. "[/font]\n" - .. misc.delineate_number(count)} + tooltip = { "", + img_path, + " [font=default-semibold]", + { item_string }, + "[/font]\n"..format.number(count), + }, + } end end @@ -195,7 +197,7 @@ function inventory_tab.build(map_data, player_data) local i = 0 for item, count in pairs(inventory_in_transit) do i = i + 1 - local sprite = util.build_sprite_path(item) + local sprite, img_path, item_string = util.generate_item_references(item) if game.is_valid_sprite_path(sprite) then in_transit_children[#in_transit_children+1] = { type = "sprite-button", @@ -203,12 +205,13 @@ function inventory_tab.build(map_data, player_data) enabled = false, sprite = sprite, number = count, - tooltip = "[img=" - .. string.gsub(item, ",", "/") - .. "] [font=default-semibold]" - .. item - .. "[/font]\n" - .. misc.delineate_number(count)} + tooltip = { "", + img_path, + " [font=default-semibold]", + { item_string }, + "[/font]\n"..format.number(count), + }, + } end end diff --git a/cybersyn/scripts/gui/main.lua b/cybersyn/scripts/gui/main.lua index 9712b23..8443678 100644 --- a/cybersyn/scripts/gui/main.lua +++ b/cybersyn/scripts/gui/main.lua @@ -46,7 +46,7 @@ end local manager_gui = {} function manager_gui.on_lua_shortcut(e) - if e.prototype_name == "ltnm-toggle-gui" then + if e.prototype_name == "cybersyn-toggle-gui" then manager.wrapper(e, manager.handle.manager_toggle) end end diff --git a/cybersyn/scripts/gui/manager.lua b/cybersyn/scripts/gui/manager.lua index 2473c4f..5386c51 100644 --- a/cybersyn/scripts/gui/manager.lua +++ b/cybersyn/scripts/gui/manager.lua @@ -36,19 +36,19 @@ function manager.create(player) style = "flib_titlebar_flow", handler = manager.handle.manager_titlebar_click, children = { - { type = "label", style = "frame_title", caption = { "mod-name.LtnManager" }, ignored_by_interaction = true }, + { type = "label", style = "frame_title", caption = { "mod-name.cybersyn" }, ignored_by_interaction = true }, { type = "empty-widget", style = "flib_titlebar_drag_handle", ignored_by_interaction = true }, { name = "manager_dispatcher_status_label", type = "label", style = "bold_label", style_mods = { font_color = constants.colors.red.tbl, left_margin = -4, top_margin = 1 }, - caption = { "gui.ltnm-dispatcher-disabled" }, - tooltip = { "gui.ltnm-dispatcher-disabled-description" }, + caption = { "cybersyn-gui.dispatcher-disabled" }, + tooltip = { "cybersyn-gui.dispatcher-disabled-description" }, visible = not settings.global["cybersyn-enable-planner"].value, }, - templates.frame_action_button("manager_pin_button", "ltnm_pin", { "gui.ltnm-keep-open" }, manager.handle.manager_pin),--on_gui_clicked - templates.frame_action_button("manager_refresh_button", "ltnm_refresh", { "gui.ltnm-refresh-tooltip" }, manager.handle.manager_refresh_click),--on_gui_clicked + templates.frame_action_button("manager_pin_button", "ltnm_pin", { "cybersyn-gui.keep-open" }, manager.handle.manager_pin),--on_gui_clicked + templates.frame_action_button("manager_refresh_button", "ltnm_refresh", { "cybersyn-gui.refresh-tooltip" }, manager.handle.manager_refresh_click),--on_gui_clicked templates.frame_action_button(nil, "utility/close", { "gui.close-instruction" }, manager.handle.manager_close),--on_gui_clicked }, }, @@ -61,7 +61,7 @@ function manager.create(player) type = "frame", style = "ltnm_main_toolbar_frame", children = { - { type = "label", style = "subheader_caption_label", caption = { "gui.ltnm-search-label" } }, + { type = "label", style = "subheader_caption_label", caption = { "cybersyn-gui.search-label" } }, { name = "manager_text_search_field", type = "textfield", @@ -69,7 +69,7 @@ function manager.create(player) handler = manager.handle.manager_update_text_search, --on_gui_text_changed }, { type = "empty-widget", style = "flib_horizontal_pusher" }, - { type = "label", style = "caption_label", caption = { "gui.ltnm-network-id-label" } }, + { type = "label", style = "caption_label", caption = { "cybersyn-gui.network-id-label" } }, { name = "manager_network_mask_field", type = "textfield", @@ -80,7 +80,7 @@ function manager.create(player) text = "-1", handler = manager.handle.manager_update_network_mask, --on_gui_text_changed }, - { type = "label", style = "caption_label", caption = { "gui.ltnm-surface-label" } }, + { type = "label", style = "caption_label", caption = { "cybersyn-gui.surface-label" } }, { name = "manager_surface_dropdown", type = "drop-down", @@ -155,7 +155,7 @@ function manager.handle.manager_open(player, player_data, refs) end player_data.is_manager_open = true - player.set_shortcut_toggled("ltnm-toggle-gui", true) + player.set_shortcut_toggled("cybersyn-toggle-gui", true) end @@ -175,7 +175,7 @@ function manager.handle.manager_close(player, player_data, refs) end player_data.is_manager_open = false - player.set_shortcut_toggled("ltnm-toggle-gui", false) + player.set_shortcut_toggled("cybersyn-toggle-gui", false) player_data.refs.manager_window.destroy() diff --git a/cybersyn/scripts/gui/stations.lua b/cybersyn/scripts/gui/stations.lua index 494f35f..ac2746c 100644 --- a/cybersyn/scripts/gui/stations.lua +++ b/cybersyn/scripts/gui/stations.lua @@ -11,7 +11,7 @@ function stations_tab.create(widths) tab = { name = "manager_stations_tab", type = "tab", - caption = { "gui.ltnm-stations" }, + caption = { "cybersyn-gui.stations" }, ref = { "stations", "tab" }, actions = { on_click = { gui = "main", action = "change_tab", tab = "stations" }, @@ -27,16 +27,16 @@ function stations_tab.create(widths) type = "frame", style = "ltnm_table_toolbar_frame", templates.sort_checkbox(widths, "stations", "name", true), - templates.sort_checkbox(widths, "stations", "status", false, { "gui.ltnm-status-description" }), + templates.sort_checkbox(widths, "stations", "status", false), --repurposed status column, description no longer necessary templates.sort_checkbox(widths, "stations", "network_id", false), templates.sort_checkbox( widths, "stations", "provided_requested", false, - { "gui.ltnm-provided-requested-description" } + { "cybersyn-gui-provided-requested-description" } ), - templates.sort_checkbox(widths, "stations", "shipments", false, { "gui.ltnm-shipments-description" }), + templates.sort_checkbox(widths, "stations", "shipments", false, { "cybersyn-gui-shipments-description" }), templates.sort_checkbox(widths, "stations", "control_signals", false), }, { name = "manager_stations_tab_scroll_pane", type = "scroll-pane", style = "ltnm_table_scroll_pane", ref = { "stations", "scroll_pane" } }, @@ -48,7 +48,7 @@ function stations_tab.create(widths) { type = "label", style = "ltnm_semibold_label", - caption = { "gui.ltnm-no-stations" }, + caption = { "cybersyn-gui-no-stations" }, ref = { "stations", "warning_label" }, }, }, diff --git a/cybersyn/scripts/gui/templates.lua b/cybersyn/scripts/gui/templates.lua index 22c70c8..3490c32 100644 --- a/cybersyn/scripts/gui/templates.lua +++ b/cybersyn/scripts/gui/templates.lua @@ -30,7 +30,7 @@ function templates.inventory_slot_table(name, columns) return { type = "flow", direction = "vertical", - { type = "label", style = "bold_label", caption = { "gui.ltnm-" .. string.gsub(name, "_", "-") } }, + { type = "label", style = "bold_label", caption = { "cybersyn-gui." .. string.gsub(name, "_", "-") } }, { type = "frame", style = "deep_frame_in_shallow_frame", @@ -77,7 +77,7 @@ function templates.sort_checkbox(widths, tab, column, selected, tooltip, state) type = "checkbox", style = selected and "ltnm_selected_sort_checkbox" or "ltnm_sort_checkbox", style_mods = { width = widths and widths[tab][column] or nil, horizontally_stretchable = not widths }, - caption = { "gui.ltnm-" .. string.gsub(column, "_", "-") }, + caption = { "cybersyn-gui." .. string.gsub(column, "_", "-") }, tooltip = tooltip, state = state, ref = { tab, "toolbar", column .. "_checkbox" }, diff --git a/cybersyn/scripts/gui/trains.lua b/cybersyn/scripts/gui/trains.lua index 05fd9c8..91498b6 100644 --- a/cybersyn/scripts/gui/trains.lua +++ b/cybersyn/scripts/gui/trains.lua @@ -133,7 +133,7 @@ function trains_tab.build(map_data, player_data) train_list[1] = { type = "label", style = "ltnm_semibold_label", - caption = { "gui.ltnm-no-trains" }, + caption = { "cybersyn-gui.no-trains" }, } else for idx, train_id in ipairs(trains_sorted) do @@ -156,7 +156,7 @@ function trains_tab.build(map_data, player_data) { type = "button", style = "ltnm_train_minimap_button", - tooltip = { "gui.ltnm-open-train-gui" }, + tooltip = { "cybersyn-gui.open-train-gui" }, elem_mods = { entity = get_any_train_entity(train.entity) }, handler = trains_tab.handle.open_train_gui, --on_click tags = { train_id = train_id }, @@ -197,7 +197,7 @@ function trains_tab.build(map_data, player_data) tab = { name = "trains_tab", type = "tab", - caption = #trains_sorted == 0 and { "gui.ltnm-trains" } or { "gui.ltnm-trains", #train_list }, + caption = #trains_sorted == 0 and { "cybersyn-gui.trains" } or { "cybersyn-gui.trains", #train_list }, --badge_text = format.number(#ltn_data.sorted_trains.composition), handler = trains_tab.handle.change_tab, --on_click tags = { tab = "trains_tab" }, @@ -212,7 +212,7 @@ function trains_tab.build(map_data, player_data) type = "frame", style = "ltnm_table_toolbar_frame", templates.sort_checkbox(widths, "trains", "status", false), - templates.sort_checkbox(widths, "trains", "layout", false, { "gui.ltnm-composition-description" }), + templates.sort_checkbox(widths, "trains", "layout", false, { "cybersyn-gui.composition-description" }), templates.sort_checkbox(widths, "trains", "depot", false), templates.sort_checkbox(widths, "trains", "shipment", false), }, diff --git a/cybersyn/scripts/gui/util.lua b/cybersyn/scripts/gui/util.lua index 9187e8c..1b154e1 100644 --- a/cybersyn/scripts/gui/util.lua +++ b/cybersyn/scripts/gui/util.lua @@ -35,15 +35,21 @@ end --- Builds a valid sprite path or returns nil --- @param item string ---- @return string -function util.build_sprite_path(item) +--- @return string, string, string +function util.generate_item_references(item) local sprite = nil + local image_path = "" + local item_name = "" if game.is_valid_sprite_path("item/" .. item) then sprite = "item/" .. item + image_path = "[img=item." .. item .. "]" + item_name = "item-name." .. item elseif game.is_valid_sprite_path("fluid/" .. item) then sprite = "fluid/" .. item + image_path = "[img=fluid." .. item .. "]" + item_name = "fluid-name." .. item end - return sprite + return sprite, image_path, item_name end @@ -92,7 +98,7 @@ function util.slot_table_build_from_station(station) local item = v.signal local count = v.count local name = item.name - local sprite = util.build_sprite_path(name) + local sprite, img_path, item_string = util.generate_item_references(name) if sprite ~= nil then local color if count > 0 then @@ -108,8 +114,8 @@ function util.slot_table_build_from_station(station) sprite = sprite, tooltip = { "", - "[img=" .. sprite .. "]", - { "item-name." .. name }, + img_path, + { item_string }, "\n"..format.number(count), }, number = count @@ -128,7 +134,7 @@ function util.slot_table_build_from_deliveries(station) for item, count in pairs(deliveries) do - local sprite = util.build_sprite_path(item) + local sprite, img_path, item_string = util.generate_item_references(item) if sprite ~= nil then local color if count > 0 then @@ -144,8 +150,8 @@ function util.slot_table_build_from_deliveries(station) sprite = sprite, tooltip = { "", - "[img=" .. sprite .. "]", - { item }, + img_path, + { item_string }, "\n"..format.number(count), }, number = count @@ -182,8 +188,8 @@ function util.slot_table_build_from_control_signals(station) sprite = sprite, tooltip = { "", - "[img=" .. sprite .. "]", - { "item-name." .. name }, + "[img=virtual-signal." .. name .. "]", + { "virtual-signal-name." .. name }, "\n"..format.number(count), }, number = count