Fix simulation_server_stub Entity class conflict + ServerConfig load timing

- Renamed inner class Entity→StubEntity (Godot has native Entity class)
- Added await ServerConfig.config_loaded before reading map_list in server_main.gd
- Config loads via call_deferred, so _ready() must wait for signal
This commit is contained in:
2026-07-02 10:24:32 -04:00
parent 4a5264c5b0
commit db477b4c48
4 changed files with 59 additions and 6 deletions
@@ -0,0 +1 @@
uid://5mvg6r8pob2u
+6 -6
View File
@@ -7,9 +7,9 @@
extends RefCounted
# ---------------------------------------------------------------------------
# Nested: Entity state data
# Nested: StubEntity state data
# ---------------------------------------------------------------------------
class Entity:
class StubEntity:
var id: int = -1
var peer_id: int = -1
var position: Vector3 = Vector3.ZERO
@@ -30,7 +30,7 @@ var _movement_config: Dictionary = {}
var _weapon_config: Dictionary = {}
var _history_depth: int = 64
var _next_entity_id: int = 1
var _entities: Dictionary = {} # entity_id → Entity
var _entities: Dictionary = {} # entity_id → StubEntity
# ---------------------------------------------------------------------------
# SimulationServer API
@@ -51,7 +51,7 @@ func set_history_depth(depth: int) -> void:
_history_depth = depth
func apply_input(entity_id: int, input_dict: Dictionary) -> void:
var e: Entity = _entities.get(entity_id)
var e: StubEntity = _entities.get(entity_id)
if e == null:
return
# Apply movement from input (simplified)
@@ -72,11 +72,11 @@ func fire_weapon(entity_id: int) -> void:
# Stub: log the event
pass
func get_entity(entity_id: int) -> Entity:
func get_entity(entity_id: int) -> StubEntity:
return _entities.get(entity_id)
func spawn_player_entity(peer_id: int, pos: Vector3) -> int:
var e = Entity.new()
var e = StubEntity.new()
e.id = _next_entity_id
e.peer_id = peer_id
e.position = pos