Reorganize the codebase into role-based folders (snake_case)
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
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
extends StaticBody3D
|
||||
## A smashable lobby barrel. Joins the &"barrel" group so the HUD can tally how many
|
||||
## remain and fire the "cleared the lobby" reward once the last one bursts.
|
||||
|
||||
signal destroyed
|
||||
|
||||
# Preload the broken barrel scene
|
||||
const BARREL_BROKEN_SCENE = preload("res://props/barrel_broken.tscn")
|
||||
|
||||
var _destroyed := false
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
add_to_group(&"barrel")
|
||||
|
||||
|
||||
func destroy_barrel():
|
||||
# Guard against a double hit in the same frame counting the same barrel twice.
|
||||
if _destroyed:
|
||||
return
|
||||
_destroyed = true
|
||||
|
||||
# 1. Instantiate the broken pieces
|
||||
var broken_instance = BARREL_BROKEN_SCENE.instantiate()
|
||||
|
||||
# 2. Place the fragments exactly where the intact barrel currently is
|
||||
broken_instance.global_transform = self.global_transform
|
||||
|
||||
# 3. Add the fragments to the main game tree
|
||||
get_parent().add_child(broken_instance)
|
||||
|
||||
# 4. (Optional) Apply a physics push to the fragments if you want an explosive effect
|
||||
for child in broken_instance.get_children():
|
||||
if child is RigidBody3D:
|
||||
# Pushes pieces slightly outward and upward
|
||||
var random_direction = Vector3(randf_range(-1, 1), randf_range(0.5, 1.5), randf_range(-1, 1)).normalized()
|
||||
child.apply_central_impulse(random_direction * 5.0)
|
||||
|
||||
# 5. Announce the smash (the HUD counts down remaining barrels) and remove the barrel
|
||||
destroyed.emit()
|
||||
queue_free()
|
||||
Reference in New Issue
Block a user