PC3 Phase 1.1: game boots clean from a bare clone

Root cause: a stale .godot/global_script_class_cache.cfg was force-committed
to the repo (last regenerated before the avatar system merged), and Godot
does not rebuild the global class registry on a plain headless scene run --
only an editor scan / `--import` does. So every cross-file `class_name`
reference in the avatar module failed to resolve from a fresh clone, and the
AvatarSystem autoload failed to instantiate entirely.

- Untrack .godot/ and sandbox_probe/.godot/ (already in .gitignore; were
  force-added during old WIP checkpoints)
- Reference sibling avatar scripts via preload() constants instead of their
  global class_name, so the module parses independent of scan order. Keeps
  the class_name declarations for editor/tooling use.
- avatar_loadout.gd's static from_json() factory self-references via a
  preload const too (a script can't resolve its own class_name mid-compile
  on a cold cache).
- smoke_test_avatar_system.gd: same preload treatment so it runs from a bare
  `--script` invocation.

Verified from a wiped .godot/: main_menu.tscn and game.tscn boot with zero
script errors; smoke_test_avatar_system 10/10, smoke_test_player 15/15,
smoke_test_main_menu_ui 13/13, smoke_test_test_level PASS.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015jtxAiu5dAW4WxCNdGkrkJ
This commit is contained in:
2026-09-05 21:27:57 +00:00
parent 3596922696
commit f51c49fcfa
15 changed files with 42 additions and 206 deletions
+10
View File
@@ -10,6 +10,16 @@
extends Node
# Sibling avatar scripts are referenced via preload rather than by their global
# class_name so this autoload parses correctly from a bare clone -- a headless
# `godot <scene>` run does not rebuild the global class registry (only an editor
# scan / `--import` does), and this script is parsed at startup before any such
# scan could have happened. See docs/architecture/avatar.md.
const AvatarCatalog := preload("res://scripts/avatar/avatar_catalog.gd")
const AvatarLoader := preload("res://scripts/avatar/avatar_loader.gd")
const AvatarLoadout := preload("res://scripts/avatar/avatar_loadout.gd")
const AvatarSlotRegistry := preload("res://scripts/avatar/avatar_slot_registry.gd")
# ---------------------------------------------------------------------------
# Signals