Files
tekton/scripts/bot_behavior.gd
T
2025-01-28 16:34:46 +08:00

25 lines
481 B
GDScript

extends BeehaveTree
# In bot_behavior.gd
func _ready():
if Engine.is_editor_hint():
return
# Get parent node safely
var parent = get_parent()
if not parent:
push_error("BehaviorTree: No parent node found")
return
# Only setup for bots
if not parent.is_in_group("Bots"):
queue_free() # Remove tree if not a bot
return
# Set this tree's actor
actor = parent
# Wait a frame to ensure all nodes are ready
await get_tree().process_frame
enabled = true