diff --git a/cybersyn/locale/en/manager.cfg b/cybersyn/locale/en/manager.cfg index 7730cb9..5d5040e 100644 --- a/cybersyn/locale/en/manager.cfg +++ b/cybersyn/locale/en/manager.cfg @@ -77,6 +77,7 @@ error-cybernetic-combinator-not-found=Could not find a cybernetic combinator for error-station-control-combinator-not-found=Could not find a station control cybernetic combinator for this station. error-station-is-invalid=Station is invalid, please refresh the GUI. error-train-is-invalid=Train is invalid, please refresh the GUI. +error-cross-surface-camera-invalid=Cannot move the camera to an entity on a different surface! [cybersyn-mod-setting-description] iterations-per-tick=Decrease this number if you're having performance issues. diff --git a/cybersyn/scripts/gui/stations.lua b/cybersyn/scripts/gui/stations.lua index f8b1106..b93ef45 100644 --- a/cybersyn/scripts/gui/stations.lua +++ b/cybersyn/scripts/gui/stations.lua @@ -272,6 +272,7 @@ function stations_tab.wrapper(e, handler) end --- @param e GuiEventData +--- @param player LuaPlayer --- @param player_data PlayerData function stations_tab.handle.open_station_gui(player, player_data, refs, e) local station_id = e.element.tags.station_id @@ -287,20 +288,24 @@ function stations_tab.handle.open_station_gui(player, player_data, refs, e) end if e.shift then - player.zoom_to_world(station_entity.position, 1, station_entity) + if station_entity.surface ~= player.surface then + util.error_flying_text(gui.player, { "cybersyn-message.error-cross-surface-camera-invalid" }) + else + player.zoom_to_world(station_entity.position, 1, station_entity) + + rendering.draw_circle({ + color = constants.colors.red.tbl, + target = station_entity.position, + surface = station_entity.surface, + radius = 0.5, + filled = false, + width = 5, + time_to_live = 60 * 3, + players = { player }, + }) - rendering.draw_circle({ - color = constants.colors.red.tbl, - target = station_entity.position, - surface = station_entity.surface, - radius = 0.5, - filled = false, - width = 5, - time_to_live = 60 * 3, - players = { player }, - }) - - if not player_data.pinning then util.close_manager_window(player, player_data, refs) end + if not player_data.pinning then util.close_manager_window(player, player_data, refs) end + end elseif e.control then if station_comb1 ~= nil and station_comb1.valid then player.opened = station_comb1