refactor: move resource authority into simulation

This commit is contained in:
2026-07-05 13:26:19 +02:00
parent f83d2c7704
commit 363620b731
10 changed files with 480 additions and 174 deletions
+8 -5
View File
@@ -139,15 +139,18 @@ func _try_get_resource_target(npc: SimNPC, task: String) -> Variant:
if visual == null:
return null
var node := ResourceNode.find_available(action_id, npc.id, visual.global_position)
if not simulation_manager.has_method("acquire_resource_target"):
push_error("WorldViewManager: SimulationManager cannot acquire resources")
return null
var node: ResourceNode = simulation_manager.acquire_resource_target(
action_id,
npc.id,
visual.global_position
)
if node == null:
debug_log("No available resource node for %s" % task)
return null
if not node.reserve(npc.id):
debug_log("Failed to reserve %s for %s" % [node.node_id, npc.npc_name])
return null
npc.target_id = node.node_id
debug_log("%s reserved %s for %s" % [npc.npc_name, node.node_id, task])
return node.interaction_point.global_position