25 lines
481 B
GDScript
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
|