Files
tekton/scripts/bot_behavior.gd
T
2025-01-31 12:13:03 +08:00

25 lines
508 B
GDScript

extends BeehaveTree
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 = parent.is_multiplayer_authority() and parent.is_bot