2024-12-09 21:05:09 +01:00
|
|
|
@tool
|
|
|
|
extends BTAction
|
|
|
|
|
|
|
|
@export var target_name: String = ""
|
2024-12-28 18:30:23 +01:00
|
|
|
@export var output_var: StringName = &"target_node"
|
2024-12-09 21:05:09 +01:00
|
|
|
|
|
|
|
func _generate_name() -> String:
|
2024-12-28 18:30:23 +01:00
|
|
|
return "FindTargetByName(\"%s\") ➜ %s" % [
|
2024-12-09 21:05:09 +01:00
|
|
|
target_name,
|
|
|
|
LimboUtility.decorate_var(output_var)
|
|
|
|
]
|
|
|
|
|
|
|
|
func _tick(_delta: float) -> Status:
|
|
|
|
var node:Node3D = agent.get_tree().root.find_child(target_name, true, false) as Node3D
|
|
|
|
|
|
|
|
if node == null:
|
|
|
|
return FAILURE
|
|
|
|
|
|
|
|
blackboard.set_var(output_var, node)
|
|
|
|
|
|
|
|
return SUCCESS
|