fix: use Variant assignment for _try_get_resource_target return type

This commit is contained in:
2026-07-03 18:26:50 +02:00
parent 9cd38a1adb
commit 8049c52e0f
+4 -4
View File
@@ -83,12 +83,12 @@ func update_npc_targets() -> void:
continue continue
var visual = active_npc_visuals[npc.id] var visual = active_npc_visuals[npc.id]
var resource_pos := _try_get_resource_target(npc, npc.current_task) var resource_pos = _try_get_resource_target(npc, npc.current_task)
if resource_pos != null: if resource_pos != null:
visual.set_target_position(resource_pos) visual.set_target_position(resource_pos)
continue continue
var target := get_target_for_task(npc.current_task) var target = get_target_for_task(npc.current_task)
if target == null: if target == null:
debug_log("No target for task: %s" % npc.current_task) debug_log("No target for task: %s" % npc.current_task)
@@ -113,7 +113,7 @@ func get_target_for_task(task: String) -> Marker3D:
_: _:
return rest_zone return rest_zone
func _try_get_resource_target(npc: SimNPC, task: String): func _try_get_resource_target(npc: SimNPC, task: String) -> Variant:
var action_map := { var action_map := {
"gather_food": &"gather_food", "gather_food": &"gather_food",
"gather_wood": &"gather_wood" "gather_wood": &"gather_wood"
@@ -147,7 +147,7 @@ func _on_npc_task_changed(npc: SimNPC, old_task: String, new_task: String) -> vo
return return
var visual = active_npc_visuals[npc.id] var visual = active_npc_visuals[npc.id]
var resource_pos := _try_get_resource_target(npc, new_task) var resource_pos = _try_get_resource_target(npc, new_task)
if resource_pos != null: if resource_pos != null:
visual.set_target_position(resource_pos) visual.set_target_position(resource_pos)
return return