Fix headless class_name dependencies

- Replaced TeamData.Team type hints with int in all scripts
- Added explicit preloads for headless mode class resolution
- Created stub LagCompensation and DamageProcessor scripts
- Fixed PluginManager, SpawnManager, EconomyManager, BuyZone,
  RoundManager, BuyMenuHandler, BombObjective class_name references
- Updated server config to match ServerConfig.gd format

Gray screen root cause: server scripts failed to parse in headless
mode due to Godot 4 class_name loading order (Resource after Node),
leaving server_main.gd non-functional — accepted connections but
never spawned players.
This commit is contained in:
2026-07-02 10:09:28 -04:00
parent ad48f38ca5
commit 4a5264c5b0
14 changed files with 202 additions and 284 deletions
+12 -8
View File
@@ -24,6 +24,10 @@ extends Node
## Duplicate class_name removed — already registered as autoload singleton.
## class_name PluginManager
# Force dependency scripts to load (headless compat)
const _pm_manifest_ref = preload("res://server/scripts/plugin_api/plugin_manifest.gd")
const _pm_base_ref = preload("res://server/scripts/plugin_api/plugin_base.gd")
# ---------------------------------------------------------------------------
# Signals
# ---------------------------------------------------------------------------
@@ -140,7 +144,7 @@ func rescan() -> int:
# Auto-load newly discovered enabled plugins that aren't already loaded.
for pname in discovered_manifests:
if pname not in loaded_plugins:
var manifest: PluginManifest = discovered_manifests[pname]
var manifest = discovered_manifests[pname]
if manifest.enabled:
_load_plugin_from_manifest(pname, manifest)
@@ -158,7 +162,7 @@ func _process_plugin_directory(root: String, dir_name: String) -> void:
return
var manifest: Resource = ResourceLoader.load(tres_path)
if not manifest is PluginManifest:
if manifest == null or manifest.get_script() == null or not manifest.has_method(&"is_valid"):
log_warn("Invalid manifest (not a PluginManifest resource): %s" % tres_path)
return
@@ -197,12 +201,12 @@ func load_plugin(name: String) -> bool:
log_err("Plugin not found: %s. Use 'plugin rescan' to scan for new plugins." % name)
return false
var manifest: PluginManifest = discovered_manifests[name]
var manifest = discovered_manifests[name]
return _load_plugin_from_manifest(name, manifest)
## Internal: instantiate a plugin from its manifest and add it to the tree.
## Handles resource loading, instance creation, and metadata injection.
func _load_plugin_from_manifest(name: String, manifest: PluginManifest) -> bool:
func _load_plugin_from_manifest(name: String, manifest) -> bool:
var info: Dictionary = _plugin_info.get(name, {})
var plugin_dir: String = info.get("path", plugins_root + "/" + name + "/")
var script_path: String = plugin_dir + manifest.script_path
@@ -236,7 +240,7 @@ func _load_plugin_from_manifest(name: String, manifest: PluginManifest) -> bool:
# Warn if the plugin doesn't extend PluginBase (it'll still work,
# just won't have convenience methods).
if not instance is PluginBase:
if instance == null or not instance.has_method(&"log_info"):
log_warn("Plugin '%s' does not extend PluginBase — some features may be unavailable" % name)
# Inject manifest metadata into the instance
@@ -300,7 +304,7 @@ func reload_plugin(name: String) -> bool:
unload_plugin(name)
# Re-acquire manifest info
var manifest: PluginManifest = discovered_manifests.get(name)
var manifest = discovered_manifests.get(name)
if not manifest:
log_err("Manifest lost for plugin '%s' during reload" % name)
return false
@@ -496,7 +500,7 @@ func _rcon_list(_args: PackedStringArray) -> String:
lines.append(" No plugins discovered. Use 'plugin rescan' to scan.")
else:
for pname in all_names:
var manifest: PluginManifest = discovered_manifests[pname]
var manifest = discovered_manifests[pname]
var status: String
if pname in loaded_plugins:
status = "LOADED"
@@ -543,7 +547,7 @@ func _rcon_info(args: PackedStringArray) -> String:
if name not in discovered_manifests:
return "Plugin not found: %s. Use 'plugin list' to see available plugins.\\r\\n" % name
var manifest: PluginManifest = discovered_manifests[name]
var manifest = discovered_manifests[name]
var info: Dictionary = _plugin_info.get(name, {})
var full_script_path: String = info.get("path", "") + manifest.script_path
var lines: PackedStringArray = []