mirror of
https://github.com/Xevion/project-cybersyn.git
synced 2025-12-08 04:08:07 -06:00
Prevent crash for attempting to move camera to a surface different than the camera is currently on
This commit is contained in:
@@ -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-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-station-is-invalid=Station is invalid, please refresh the GUI.
|
||||||
error-train-is-invalid=Train 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]
|
[cybersyn-mod-setting-description]
|
||||||
iterations-per-tick=Decrease this number if you're having performance issues.
|
iterations-per-tick=Decrease this number if you're having performance issues.
|
||||||
|
|||||||
@@ -272,6 +272,7 @@ function stations_tab.wrapper(e, handler)
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- @param e GuiEventData
|
--- @param e GuiEventData
|
||||||
|
--- @param player LuaPlayer
|
||||||
--- @param player_data PlayerData
|
--- @param player_data PlayerData
|
||||||
function stations_tab.handle.open_station_gui(player, player_data, refs, e)
|
function stations_tab.handle.open_station_gui(player, player_data, refs, e)
|
||||||
local station_id = e.element.tags.station_id
|
local station_id = e.element.tags.station_id
|
||||||
@@ -287,6 +288,9 @@ function stations_tab.handle.open_station_gui(player, player_data, refs, e)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if e.shift then
|
if e.shift then
|
||||||
|
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)
|
player.zoom_to_world(station_entity.position, 1, station_entity)
|
||||||
|
|
||||||
rendering.draw_circle({
|
rendering.draw_circle({
|
||||||
@@ -301,6 +305,7 @@ function stations_tab.handle.open_station_gui(player, player_data, refs, e)
|
|||||||
})
|
})
|
||||||
|
|
||||||
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
|
elseif e.control then
|
||||||
if station_comb1 ~= nil and station_comb1.valid then
|
if station_comb1 ~= nil and station_comb1.valid then
|
||||||
player.opened = station_comb1
|
player.opened = station_comb1
|
||||||
|
|||||||
Reference in New Issue
Block a user