Fix StationMovement in Multiplayer, still works singleplayer

This commit is contained in:
JonShard
2026-08-10 13:02:19 +02:00
parent dbaad35e50
commit bf31f85b02
5 changed files with 144 additions and 42 deletions
+19
View File
@@ -0,0 +1,19 @@
extends Node
func _ready() -> void:
if OS.has_feature("editor"):
# Force subwindows to be native OS windows instead of embedded viewports
get_tree().root.gui_embed_subwindows = false
get_tree().create_timer(0.05).timeout.connect(_position_window)
func _position_window() -> void:
var is_server: bool = OS.get_cmdline_args().has("--server")
var screen_rect: Rect2i = DisplayServer.screen_get_usable_rect(DisplayServer.window_get_current_screen())
var window_width: int = screen_rect.size.x / 2
var window_height: int = int(screen_rect.size.y * (2.0 / 3.0))
DisplayServer.window_set_size(Vector2i(window_width - 10, window_height))
var x_pos: int = screen_rect.position.x + window_width if is_server else screen_rect.position.x
DisplayServer.window_set_position(Vector2i(x_pos, screen_rect.position.y))
+1
View File
@@ -0,0 +1 @@
uid://de8j52uus1pbv
+5 -1
View File
@@ -2,7 +2,7 @@ extends Node
func _unhandled_input(event: InputEvent) -> void:
if event.is_action_pressed("quit_game"):
get_tree().quit()
all_quit_game.rpc()
if event.is_action_pressed("satisfy_table_orders"):
satisfy_table_orders()
if event.is_action_pressed("set_building_mode"):
@@ -12,6 +12,10 @@ func _unhandled_input(event: InputEvent) -> void:
if event.is_action_pressed("set_game_over"):
set_game_over()
# Kill all clients
@rpc("any_peer", "call_local", "reliable")
func all_quit_game():
get_tree().quit()
# Finds any node of class/type Table and calls satisfyAllOrders()
func satisfy_table_orders() -> void: