diff --git a/locale/en/caravan.cfg b/locale/en/caravan.cfg index 522c66ff..e195a45d 100644 --- a/locale/en/caravan.cfg +++ b/locale/en/caravan.cfg @@ -20,6 +20,7 @@ idle=Idle [caravan-global-gui] caption=Caravan organizer +empty=No caravans found [caravan-gui] add-outpost=+ Add destination diff --git a/scripts/caravan/caravan-connected-gui.lua b/scripts/caravan/caravan-connected-gui.lua index 7582a9cb..99a87339 100644 --- a/scripts/caravan/caravan-connected-gui.lua +++ b/scripts/caravan/caravan-connected-gui.lua @@ -10,7 +10,7 @@ local function guess(event) return defines.relative_gui_type.transport_belt_gui end --game.print('Using fallback for ' .. name) - -- there are other types needed as well, but i am lazy + -- there are other types needed as well, but i am lazy (and who does that anyway...) return defines.relative_gui_type.container_gui end @@ -24,17 +24,16 @@ local function instantiate_main_frame(gui, anchor) direction = 'vertical', anchor = anchor } - else - if not gui.relative.caravan_flow then - return - end - return gui.relative.caravan_flow.add { - type = 'frame', - name = 'connected_caravan_gui', - caption = { 'caravan-global-gui.caption' }, - direction = 'vertical', - } end + if not gui.relative.caravan_flow then + return + end + return gui.relative.caravan_flow.add { + type = 'frame', + name = 'connected_caravan_gui', + caption = { 'caravan-global-gui.caption' }, + direction = 'vertical', + } end --anchor is optional diff --git a/scripts/caravan/caravan-global-gui.lua b/scripts/caravan/caravan-global-gui.lua index 578fabff..517c5bfa 100644 --- a/scripts/caravan/caravan-global-gui.lua +++ b/scripts/caravan/caravan-global-gui.lua @@ -1,7 +1,7 @@ require 'caravan-gui-shared' local Table = require('__stdlib__/stdlib/utils/table') -function add_titlebar(gui, caption, close_button_name) +local function add_titlebar(gui, caption, close_button_name) local titlebar = gui.add{type = "flow"} titlebar.drag_target = gui titlebar.add{ @@ -60,7 +60,7 @@ Caravan.events.on_open_global_gui = function(event) type = 'scroll-pane', } if not Caravan.has_any_caravan_at_all() then - scroll_pane.add{type= 'label', caption='No caravans found'} + scroll_pane.add{type= 'label', caption={'caravan-global-gui.empty'}} return end local table = scroll_pane.add {