7b6a141767
Move the 40-odd root-level scripts and scenes into a tree that groups by role,
per the approved roadmap (WS2/WS3): actors/{player,matador,bear}, systems/{combat,
fx,input,debug,render,crowd,config}, ui/, props/ (was tscn_s/). Rename the shell
scene.tscn -> levels/game_shell.tscn and every PascalCase scene to snake_case
(Player.tscn -> player.tscn, MainMenu.tscn -> main_menu.tscn, etc.) so the
case-insensitive web/macOS filesystems can't alias two files together.
Done as a scripted move: each file travels with its .uid; every quoted res:// path
across scenes, scripts, .tres, and project.godot's 9 autoloads is rewritten; the
.godot uid/class cache is rebuilt from scratch. Scenes still resolve by uid, so the
rewrite is belt-and-suspenders. Lint globs (run_tests.sh + both CI workflows) now
walk the new dirs; an orphan animation_tree.gd.uid and 7 pre-existing trailing-
whitespace lints (barrel/torch, never covered by the old root-only glob) are cleaned.
Full suite green on both sides. Asset consolidation (Assets/Animations/fonts ->
art/) is deferred — moving imported .glb/.png/.ttf is safer done in the editor.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017KoYBYQgRyY1zDHXMsXY3V
43 lines
1.8 KiB
GDScript
43 lines
1.8 KiB
GDScript
extends Node3D
|
|
## The reusable game shell: player, camera, HUD and the PS1 filter — everything that
|
|
## outlives a single level. On load it instances the active level's module (geometry,
|
|
## spawners, lighting, colliders) into LevelRoot. Switching levels frees the whole
|
|
## previous module first, so no old mesh or collider can survive into the next fight.
|
|
|
|
const PhysicsLayers = preload("res://systems/combat/physics_layers.gd")
|
|
|
|
@onready var _level_root: Node3D = $LevelRoot
|
|
@onready var _camera: IsoCamera = $Player/Camera3D
|
|
|
|
|
|
func _ready() -> void:
|
|
Run.ensure_run()
|
|
load_active_level()
|
|
|
|
|
|
## Tear down the current level module and build the run's active one. Freeing the whole
|
|
## subtree (not hiding it) is the point: a level's colliders and spawners cease to exist
|
|
## before the next level's are created.
|
|
func load_active_level() -> void:
|
|
for child: Node in _level_root.get_children():
|
|
_level_root.remove_child(child)
|
|
child.queue_free()
|
|
var level := Run.active_level()
|
|
if level == null or level.level_scene == null:
|
|
push_warning("game_shell: active level has no level_scene")
|
|
return
|
|
_camera.set_framing_scale(level.camera_zoom)
|
|
var module := level.level_scene.instantiate()
|
|
_tag_environment_for_corpses(module)
|
|
_level_root.add_child(module)
|
|
|
|
|
|
## Ground and walls stay on WORLD so the bull and live matadors collide with them; here
|
|
## we add CORPSE too. A killed matador's ragdoll is masked to CORPSE alone, so it rests
|
|
## on the arena while the bull — which only collides with WORLD — passes through the body
|
|
## instead of spazzing out on it. Done at load so it also reaches colliders baked into
|
|
## the instanced GLB arenas, not just the level module's own floor box.
|
|
func _tag_environment_for_corpses(module: Node) -> void:
|
|
for body: StaticBody3D in module.find_children("*", "StaticBody3D", true, false):
|
|
body.collision_layer |= PhysicsLayers.CORPSE
|