feat: add typed pantry storage site

This commit is contained in:
2026-07-07 12:57:47 +02:00
parent 33b9c1bdfb
commit e5bd93d705
16 changed files with 304 additions and 69 deletions
+18 -2
View File
@@ -47,8 +47,17 @@ func _run() -> void:
var fixed_origins := [Vector3(-6.0, 0.0, -4.0), Vector3(0.0, 0.0, 0.0), Vector3(6.0, 0.0, 4.0)]
var destinations: Array[Vector3] = []
_check(
main_scene.has_node("JajceWorld/WorldObjects/StorageSites/VillagePantry"),
"Runtime should expose a typed VillagePantry StorageNode"
)
_check(
not main_scene.has_node("JajceWorld/LegacyActivityMarkers/PantryMarker"),
"Runtime should not keep the pantry as a legacy activity marker"
)
var pantry := main_scene.get_node("JajceWorld/WorldObjects/StorageSites/VillagePantry") as StorageNode
destinations.append(pantry.get_interaction_position())
for marker_path in [
"JajceWorld/LegacyActivityMarkers/PantryMarker",
"JajceWorld/LegacyActivityMarkers/GuardZone",
"JajceWorld/LegacyActivityMarkers/StudyZone",
"JajceWorld/LegacyActivityMarkers/RestZone"
@@ -81,8 +90,15 @@ func _run() -> void:
executor.advance_npc(starving, village)
_check(starving.is_dead, "Starvation threshold should still kill an NPC")
var adapter := main_scene.get_node("ActiveWorldAdapter") as ActiveWorldAdapter
var storage_target := adapter.get_activity_target(SimulationIds.ACTION_DEPOSIT_FOOD)
_check(
storage_target.get("target_id", "") == String(SimulationIds.STORAGE_VILLAGE_PANTRY),
"Runtime adapter should route storage actions to village_pantry"
)
if failures.is_empty():
print("[TEST] Jajce runtime passed: 6 NPCs, 4 resources, 24 navigation routes")
print("[TEST] Jajce runtime passed: 6 NPCs, 4 resources, typed pantry route")
quit(0)
return
+24 -1
View File
@@ -116,6 +116,17 @@ func _run() -> void:
ids == ["berry_bush_01", "berry_bush_02", "tree_01", "tree_02"],
"Jajce resources should preserve all stable IDs"
)
_check(world.has_node("WorldObjects/StorageSites"), "JajceWorld should expose StorageSites")
var pantry := world.get_node("WorldObjects/StorageSites/VillagePantry") as StorageNode
_check(pantry != null, "JajceWorld should include a typed VillagePantry StorageNode")
_check(
pantry.storage_id == SimulationIds.STORAGE_VILLAGE_PANTRY,
"VillagePantry should preserve the stable storage ID"
)
_check(
not world.has_node("LegacyActivityMarkers/PantryMarker"),
"Pantry should no longer be a legacy activity marker"
)
var navigation_region := world.get_node("NavigationRegion3D") as NavigationRegion3D
var navigation_map: RID = NavigationServer3D.region_get_map(navigation_region.get_rid())
@@ -131,6 +142,7 @@ func _run() -> void:
var destinations: Array[Vector3] = []
for resource in resources:
destinations.append((resource as ResourceNode).interaction_point.global_position)
destinations.append(pantry.get_interaction_position())
for marker in world.get_node("LegacyActivityMarkers").get_children():
destinations.append((marker as Marker3D).global_position)
@@ -143,6 +155,7 @@ func _run() -> void:
)
var adapter := ActiveWorldAdapter.new()
adapter.pantry_storage = pantry
root.add_child(adapter)
var manager: Node = load("res://simulation/SimulationManager.gd").new()
manager.debug_logs = false
@@ -164,10 +177,20 @@ func _run() -> void:
"Selected Jajce resource should be authoritatively reserved"
)
manager.release_resource(selected.node_id, npc.id)
var storage_target := adapter.get_activity_target(SimulationIds.ACTION_WITHDRAW_FOOD)
_check(
storage_target.get("target_id", "") == String(SimulationIds.STORAGE_VILLAGE_PANTRY),
"Storage actions should target the typed pantry's stable ID"
)
var storage_target_position: Vector3 = storage_target.get("position", Vector3(9999, 9999, 9999))
_check(
storage_target_position.distance_to(pantry.get_interaction_position()) < 0.01,
"Storage actions should use the pantry StorageNode interaction point"
)
if failures.is_empty():
print(
"[TEST] Jajce scaffold passed: Terrain3D, 6 textures, shader water, building blockouts, chimney smoke"
"[TEST] Jajce scaffold passed: Terrain3D, storage site, shader water, building blockouts"
)
quit(0)
return
+12
View File
@@ -57,6 +57,18 @@ func _run() -> void:
"Village should receive exactly the extracted wood"
)
var pantry := main_scene.get_node("JajceWorld/WorldObjects/StorageSites/VillagePantry") as StorageNode
var pantry_state: StorageStateRecord = simulation_manager.get_pantry()
pantry_state.deposit(SimulationIds.RESOURCE_FOOD, 3.0)
simulation_manager._sync_village_food()
var pantry_food_before := pantry_state.get_amount(SimulationIds.RESOURCE_FOOD)
player.global_position = pantry.get_interaction_position()
player.try_interact()
_check(
pantry_state.get_amount(SimulationIds.RESOURCE_FOOD) < pantry_food_before,
"Player should eat from the typed pantry StorageNode"
)
if failures.is_empty():
print("[TEST] ResourceNode player parity passed")
quit(0)