feat: add physical animal care delivery

This commit is contained in:
Rijad Zuzo
2026-07-31 00:19:41 +02:00
parent 7d410d8193
commit ead75fca68
25 changed files with 1469 additions and 191 deletions
@@ -227,9 +227,48 @@ func _resolve_animal(
var target_id := StringName(best["target_id"])
if not simulation_manager.animal_care.reserve(target_id, npc.id):
return {}
if simulation_manager.animal_care.requires_feed_pickup(npc):
var pantry_target := resolve_storage_target(
SimulationIds.STORAGE_VILLAGE_PANTRY, active_world_adapter
)
if pantry_target.is_empty():
simulation_manager.animal_care.release(target_id, npc.id)
return {}
best["position"] = pantry_target["position"]
return best
func resolve_storage_target(storage_id: StringName, active_world_adapter: Node) -> Dictionary:
if active_world_adapter == null or not active_world_adapter.has_method("get_storage_target"):
return {}
return active_world_adapter.get_storage_target(storage_id)
func resolve_claimed_animal(
npc: SimNPC, simulation_manager: Node, active_world_adapter: Node
) -> Dictionary:
if (
npc == null
or npc.target_id.is_empty()
or not active_world_adapter.has_method("get_animal_candidates")
):
return {}
var animal_state: AnimalStateRecord = simulation_manager.animal_care.get_state(npc.target_id)
if (
animal_state == null
or not animal_state.needs_feed()
or animal_state.get_reserved_by() != npc.id
):
return {}
var candidates: Array[Dictionary] = active_world_adapter.get_animal_candidates(
SimulationIds.ACTION_FEED_ANIMAL
)
for candidate in candidates:
if StringName(candidate["target_id"]) == npc.target_id:
return candidate
return {}
func score_resource_candidate(
npc: SimNPC, origin: Vector3, position: Vector3, state: ResourceStateRecord
) -> float: