## Entry — Smart entry point.
## Loads the server scene if running headless (dedicated server),
## or the client scene if running with a display (Windows client).
extends Node

@export var server_host: String = "68.202.6.107"
@export var server_port: int = 34197

func _ready() -> void:
	var is_headless := DisplayServer.get_name() == "headless"
	
	if is_headless:
		# Dedicated server mode
		var server_tscn = load("res://scenes/server/server_main.tscn")
		if server_tscn == null:
			push_error("[Entry] Failed to load server scene")
			return
		add_child(server_tscn.instantiate())
		print("[Entry] Starting in SERVER mode (headless)")
	else:
		# Client mode (Windows, etc.)
		var client_tscn = load("res://scenes/client/client_main.tscn")
		if client_tscn == null:
			push_error("[Entry] Failed to load client scene")
			return
		var client = client_tscn.instantiate()
		add_child(client)
		print("[Entry] Starting in CLIENT mode (display available)")
