Phase 14 - Organized directories.

This commit is contained in:
2026-10-03 19:13:39 -04:00
parent 6666173c4f
commit d950fd9d9a
307 changed files with 1452 additions and 1110 deletions
+18 -18
View File
@@ -19,15 +19,15 @@
extends SceneTree
const STICKMAN_LIBRARY := preload("res://scripts/stickman_library.gd")
const PROP_LIBRARY := preload("res://scripts/prop_library.gd")
const THUMBNAIL_CACHE := preload("res://scripts/thumbnails/thumbnail_cache.gd")
const ASSET_SELECTOR := preload("res://scripts/asset_selector.gd")
const STAGE_SPAWNER := preload("res://scripts/stage_spawner.gd")
const PROP_BLOCK := preload("res://scripts/prop_block.gd")
const RIG := preload("res://scripts/stickman_rig.gd")
const STAGE_SCENE := preload("res://scenes/sandbox_stage.tscn")
const ASSET_SELECTOR_SCENE := preload("res://scenes/asset_selector.tscn")
const STICKMAN_LIBRARY := preload("res://scripts/characters/stickman/stickman_library.gd")
const PROP_LIBRARY := preload("res://scripts/props/prop_library.gd")
const THUMBNAIL_CACHE := preload("res://scripts/shared/thumbnails/thumbnail_cache.gd")
const ASSET_SELECTOR := preload("res://scripts/shared/ui/asset_selector.gd")
const STAGE_SPAWNER := preload("res://scripts/stage/stage_spawner.gd")
const PROP_BLOCK := preload("res://scripts/props/prop_block.gd")
const RIG := preload("res://scripts/characters/stickman/stickman_rig.gd")
const STAGE_SCENE := preload("res://scenes/stage/sandbox_stage.tscn")
const ASSET_SELECTOR_SCENE := preload("res://scenes/stage/asset_selector.tscn")
const TEST_DIR := "user://phase3b_test"
@@ -83,7 +83,7 @@ func _test_scan() -> void:
_check(String(_by_path(entries, "break.stk")["name"]) == "break",
"break.stk falls back to filename basename")
_check(not _by_path(entries, "basic.stk").is_empty(), "basic.stk entry has data")
var found: Dictionary = lib.find_by_path("res://stickmen/basic.stk")
var found: Dictionary = lib.find_by_path("res://content/stickmen/basic.stk")
_check(not found.is_empty() and String(found["name"]) == "Basic",
"find_by_path resolves basic.stk")
@@ -109,11 +109,11 @@ func _test_make_entry() -> void:
print("")
print("--- make_entry() ---")
var lib = STICKMAN_LIBRARY.new()
var entry := lib.make_entry("res://stickmen/basic.stk")
var entry := lib.make_entry("res://content/stickmen/basic.stk")
_check(not entry.is_empty(), "make_entry on valid path returns an entry")
_check(String(entry["name"]) == "Basic", "make_entry name == 'Basic'")
_check(not (entry["data"] as Dictionary).is_empty(), "make_entry carries parsed data")
_check(lib.make_entry("res://stickmen/does_not_exist.stk").is_empty(),
_check(lib.make_entry("res://content/stickmen/does_not_exist.stk").is_empty(),
"make_entry on missing path returns {}")
_ensure_test_dir()
_write_file(TEST_DIR + "/bad.stk", "nope nope")
@@ -153,7 +153,7 @@ func _test_spawner_registry() -> void:
_check(not ids.has("crate") and not ids.has("ball"),
"crate/ball registry entries removed")
_check(spawner.get_selected_prop_id() == "crate", "default selected_prop_id == 'crate'")
_check(spawner.get_selected_stickman_path() == "res://stickmen/test.stk",
_check(spawner.get_selected_stickman_path() == "res://content/stickmen/test.stk",
"default selected_stickman_path == test.stk")
world.queue_free()
@@ -183,7 +183,7 @@ func _test_spawn_stickman() -> void:
var world := Node2D.new()
root.add_child(world)
var spawner = STAGE_SPAWNER.new(world)
spawner.selected_stickman_path = "res://stickmen/basic.stk"
spawner.selected_stickman_path = "res://content/stickmen/basic.stk"
var rig: Node2D = spawner.spawn("stickman", Vector2.ZERO)
_check(rig != null, "stickman spawns from basic.stk")
_check(rig is RIG, "basic.stk spawns a StickmanRig")
@@ -194,8 +194,8 @@ func _test_thumbnail_cache() -> void:
print("")
print("--- ThumbnailCache key/png formatting ---")
var cache = THUMBNAIL_CACHE.new()
var mtime: int = FileAccess.get_modified_time("res://stickmen/test.stk")
var key := cache.stickman_key("res://stickmen/test.stk")
var mtime: int = FileAccess.get_modified_time("res://content/stickmen/test.stk")
var key := cache.stickman_key("res://content/stickmen/test.stk")
_check(key == "test_%d" % mtime, "stickman_key embeds basename + mtime (got '%s')" % key)
_check(cache.stickman_png(key) == "user://thumbnails/stickmen/" + key + ".png",
"stickman_png path formatting (got '%s')" % cache.stickman_png(key))
@@ -226,8 +226,8 @@ func _test_pagination() -> void:
func _test_scene_loads() -> void:
print("")
print("--- Scene load checks ---")
_check(load("res://scenes/sandbox_stage.tscn") != null, "sandbox_stage.tscn loads")
_check(load("res://scenes/asset_selector.tscn") != null, "asset_selector.tscn loads")
_check(load("res://scenes/stage/sandbox_stage.tscn") != null, "sandbox_stage.tscn loads")
_check(load("res://scenes/stage/asset_selector.tscn") != null, "asset_selector.tscn loads")
var selector: AssetSelector = ASSET_SELECTOR_SCENE.instantiate() as AssetSelector
_check(selector != null, "asset_selector.tscn instantiates as AssetSelector")
root.add_child(selector)