P7.9: fix headless export — resolve Resource class_name ordering + duplicate RoundManager + simulation stub API
- Fix dead code in server_main.gd (unreachable lag compensation print) - Remove WeaponData type hints from weapon_server.gd (Resource class_name in Node scripts = headless fail) - Use preload() instead of WeaponData class_name in weapon_definitions.gd for const refs - Lazy-init WEAPONS dict (const can't reference preload members) - Remove duplicate class_name RoundManager from server/scripts/round/round_manager.gd - Remove DamageProcessor type hints from round/round_manager.gd and bomb_objective.gd - Add start()/stop()/can_tick()/tick()/spawn_entity()/despawn_entity() to simulation_server_stub.gd - Fix get_world_3d() → get_tree().root.world_3d in weapon_server.gd Node context - Fix var data := → var data = for untyped WeaponDefinitions.get_weapon() returns - Clean export cache and verify server starts with zero parse errors
This commit is contained in:
@@ -31,6 +31,8 @@ var _weapon_config: Dictionary = {}
|
||||
var _history_depth: int = 64
|
||||
var _next_entity_id: int = 1
|
||||
var _entities: Dictionary = {} # entity_id → StubEntity
|
||||
var _running: bool = false
|
||||
var _last_hit_result: Dictionary = {}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# SimulationServer API
|
||||
@@ -50,6 +52,28 @@ func set_weapon_config(cfg: Dictionary) -> void:
|
||||
func set_history_depth(depth: int) -> void:
|
||||
_history_depth = depth
|
||||
|
||||
func start() -> void:
|
||||
_running = true
|
||||
|
||||
func stop() -> void:
|
||||
_running = false
|
||||
|
||||
func can_tick(delta: float) -> bool:
|
||||
return _running
|
||||
|
||||
func tick() -> PackedByteArray:
|
||||
# Stub: returns empty snapshot
|
||||
return PackedByteArray()
|
||||
|
||||
func get_stats() -> Dictionary:
|
||||
return {
|
||||
"tick_count": 0,
|
||||
"entity_count": _entities.size(),
|
||||
}
|
||||
|
||||
func get_last_hit_result() -> Dictionary:
|
||||
return _last_hit_result
|
||||
|
||||
func apply_input(entity_id: int, input_dict: Dictionary) -> void:
|
||||
var e: StubEntity = _entities.get(entity_id)
|
||||
if e == null:
|
||||
@@ -75,10 +99,9 @@ func fire_weapon(entity_id: int) -> void:
|
||||
func get_entity(entity_id: int) -> StubEntity:
|
||||
return _entities.get(entity_id)
|
||||
|
||||
func spawn_player_entity(peer_id: int, pos: Vector3) -> int:
|
||||
func spawn_entity(pos: Vector3) -> int:
|
||||
var e = StubEntity.new()
|
||||
e.id = _next_entity_id
|
||||
e.peer_id = peer_id
|
||||
e.position = pos
|
||||
e.alive = true
|
||||
e.health = 100.0
|
||||
@@ -86,12 +109,15 @@ func spawn_player_entity(peer_id: int, pos: Vector3) -> int:
|
||||
_next_entity_id += 1
|
||||
return e.id
|
||||
|
||||
func despawn_player_entity(entity_id: int) -> void:
|
||||
_entities.erase(entity_id)
|
||||
func spawn_player_entity(peer_id: int, pos: Vector3) -> int:
|
||||
var entity_id = spawn_entity(pos)
|
||||
var e: StubEntity = _entities.get(entity_id)
|
||||
if e:
|
||||
e.peer_id = peer_id
|
||||
return entity_id
|
||||
|
||||
func tick(delta: float) -> void:
|
||||
# Stub: in the real C++ SimulationServer this runs the 128Hz simulation
|
||||
pass
|
||||
func despawn_entity(entity_id: int) -> void:
|
||||
_entities.erase(entity_id)
|
||||
|
||||
func get_entity_count() -> int:
|
||||
return _entities.size()
|
||||
|
||||
Reference in New Issue
Block a user