feat: add completition of work only after work is done
This commit is contained in:
@@ -61,8 +61,12 @@ func spawn_npc_visual(npc: SimNPC) -> void:
|
||||
visual.global_position = npc.position
|
||||
visual.setup_from_sim(npc)
|
||||
|
||||
active_npc_visuals[npc.id] = visual
|
||||
if visual.has_signal("arrived_at_target"):
|
||||
visual.arrived_at_target.connect(_on_npc_visual_arrived)
|
||||
else:
|
||||
push_error("WorldViewManager: NPCVisual has no arrived_at_target signal")
|
||||
|
||||
active_npc_visuals[npc.id] = visual
|
||||
debug_log("Spawned visual for %s at %s" % [npc.npc_name, npc.position])
|
||||
|
||||
func update_npc_targets() -> void:
|
||||
@@ -111,3 +115,15 @@ func _on_npc_task_changed(npc: SimNPC, old_task: String, new_task: String) -> vo
|
||||
|
||||
if target != null:
|
||||
visual.set_target_position(target.global_position)
|
||||
|
||||
func _on_npc_visual_arrived(sim_id: int) -> void:
|
||||
debug_log("NPC visual arrived. sim_id=%s" % sim_id)
|
||||
|
||||
if simulation_manager == null:
|
||||
push_error("WorldViewManager: simulation_manager missing during arrival report")
|
||||
return
|
||||
|
||||
if simulation_manager.has_method("notify_npc_arrived"):
|
||||
simulation_manager.notify_npc_arrived(sim_id)
|
||||
else:
|
||||
push_error("WorldViewManager: SimulationManager has no notify_npc_arrived method")
|
||||
|
||||
Reference in New Issue
Block a user