/* behavior_tree_data.cpp */ #include "behavior_tree_data.h" #include "core/templates/list.h" //// BehaviorTreeData BehaviorTreeData::BehaviorTreeData(const Ref &p_instance, const NodePath &p_player_path) { bt_player_path = p_player_path; // Flatten tree into list depth first List> stack; stack.push_back(p_instance); int id = 0; while (stack.size()) { Ref task = stack[0]; stack.pop_front(); int num_children = task->get_child_count(); for (int i = 0; i < num_children; i++) { stack.push_front(task->get_child(num_children - 1 - i)); } String script_path; if (task->get_script()) { Ref