Fix Move windows script

This commit is contained in:
JonShard
2026-08-20 12:57:45 +02:00
parent 59bd3d1d66
commit 5c4baa272a
4 changed files with 15 additions and 12 deletions
+2
View File
@@ -431,6 +431,8 @@ func request_join(ip: String) -> void:
pending_ip = ip pending_ip = ip
func consume_pending_session() -> void: func consume_pending_session() -> void:
if is_online():
return
if pending_action == "host": if pending_action == "host":
pending_action = "" pending_action = ""
host() host()
+2 -1
View File
@@ -9,7 +9,8 @@ var customers_served: int = 0
func _ready() -> void: func _ready() -> void:
GameManager.set_game_state(GameManager.GameState.BUILDING) if NetworkManager.owns_world():
GameManager.set_game_state(GameManager.GameState.BUILDING)
Signals.game_state_changed.connect(_on_game_state_changed) Signals.game_state_changed.connect(_on_game_state_changed)
Signals.table_satisfied.connect(_on_table_statisfied) Signals.table_satisfied.connect(_on_table_statisfied)
+9 -9
View File
@@ -1,20 +1,20 @@
extends Node extends Node
## Nudge down from the screen top so the window's title bar/menu stays visible.
const SERVER_Y_OFFSET := 45
func _ready() -> void: func _ready() -> void:
if OS.has_feature("editor"): # Only the (non-VR) server window needs positioning; the VR instance's
# Force subwindows to be native OS windows instead of embedded viewports # window is left wherever the OS/editor puts it.
if OS.has_feature("editor") and OS.get_cmdline_args().has("--server"):
get_tree().root.gui_embed_subwindows = false get_tree().root.gui_embed_subwindows = false
get_tree().create_timer(0.05).timeout.connect(_position_window) get_tree().create_timer(0.05).timeout.connect(_position_window)
func _position_window() -> void: 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 screen_rect: Rect2i = DisplayServer.screen_get_usable_rect(DisplayServer.window_get_current_screen())
@warning_ignore("integer_division") @warning_ignore("integer_division")
var window_width: int = screen_rect.size.x / 2 var window_width: int = screen_rect.size.x / 2
var window_height: int = int(screen_rect.size.y * (2.0 / 3.0)) var x_pos: int = screen_rect.position.x + window_width
var y_pos: int = screen_rect.position.y + SERVER_Y_OFFSET
DisplayServer.window_set_size(Vector2i(window_width - 10, window_height)) DisplayServer.window_set_position(Vector2i(x_pos, y_pos))
if is_server:
var x_pos: int = screen_rect.position.x + window_width
DisplayServer.window_set_position(Vector2i(x_pos, screen_rect.position.y))
+1 -1
View File
@@ -12,7 +12,7 @@ var _camera: Camera3D
func _ready() -> void: func _ready() -> void:
var xr_interface := XRServer.find_interface("OpenXR") var xr_interface := XRServer.find_interface("OpenXR")
if xr_interface and xr_interface.is_initialized(): if xr_interface and xr_interface.is_initialized():
SweetLogger.warning("{0} disabled - this instance is the VR client", [name]) SweetLogger.debug("{0} disabled - this instance is the VR client", [name])
return return
if not _players: if not _players:
SweetLogger.warning("{0} could not resolve players_path {1}", [name, players_path]) SweetLogger.warning("{0} could not resolve players_path {1}", [name, players_path])