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:
2026-07-02 17:57:09 -04:00
parent 926446e5cf
commit e70ce76207
14 changed files with 356 additions and 305 deletions
+10 -10
View File
@@ -83,8 +83,8 @@ var buy_menu_handler = null
## BombObjective — server-authoritative bomb plant/defuse logic.
var bomb_objective = null
## TeamData reference — cached with load() to avoid class_name resolution in headless.
var _td = null
## TeamData reference — cached reference, populated at runtime if needed.
var _team_data_ref = null
## Current server tick counter, incremented each time tick() is called.
var _current_tick: int = 0
@@ -130,34 +130,34 @@ func _ready() -> void:
# Create and wire the WeaponServer with LagCompensation and DamageProcessor.
# These work alongside the C++ SimulationServer for the GDScript
# weapon path.
weapon_server = _ws.new()
weapon_server = load("res://server/scripts/weapons/weapon_server.gd").new()
weapon_server.physics_world = get_viewport().get_world_3d()
add_child(weapon_server)
lag_compensation = _lc.new()
lag_compensation = load("res://server/scripts/combat/lag_compensation.gd").new()
add_child(lag_compensation)
damage_processor = _dp.new()
damage_processor = load("res://server/scripts/combat/damage_processor.gd").new()
add_child(damage_processor)
# --- Round / Match lifecycle ---
round_manager = _rm.new()
round_manager = load("res://server/scripts/round/round_manager.gd").new()
add_child(round_manager)
# Wire up TeamManager reference (find it in the tree or create it)
team_manager = get_node_or_null("/root/TeamManager")
if not team_manager:
team_manager = _tm.new()
team_manager = load("res://scripts/teams/team_manager.gd").new()
add_child(team_manager)
round_manager.team_manager = team_manager
round_manager.damage_processor = damage_processor
# --- Economy system ---
economy_manager = _em.new()
economy_manager = load("res://server/scripts/economy/economy_manager.gd").new()
add_child(economy_manager)
buy_menu_handler = _bm.new()
buy_menu_handler = load("res://server/scripts/economy/buy_menu_handler.gd").new()
add_child(buy_menu_handler)
buy_menu_handler.initialise(economy_manager, weapon_server, team_manager)
@@ -189,7 +189,7 @@ func _ready() -> void:
Engine.register_singleton("SimulationServer", simulation_server)
# --- Bomb / Defuse Objective ---
bomb_objective = _bo.new()
bomb_objective = load("res://server/scripts/objectives/bomb_objective.gd").new()
add_child(bomb_objective)
bomb_objective.round_manager = round_manager
bomb_objective.team_manager = team_manager