Refactor BlackboardPlan to use StringName

Also update demo BTs.
This commit is contained in:
Serhii Snitsaruk 2024-03-04 16:55:08 +01:00
parent 923587e6e2
commit d66f1e83fd
20 changed files with 119 additions and 118 deletions

View File

@ -12,22 +12,22 @@
#include "blackboard_plan.h"
bool BlackboardPlan::_set(const StringName &p_name, const Variant &p_value) {
String prop_name = p_name;
String name_str = p_name;
// * Editor
if (var_map.has(prop_name)) {
var_map[prop_name].set_value(p_value);
if (base.is_valid() && p_value == base->get_var(prop_name).get_value()) {
if (var_map.has(p_name)) {
var_map[p_name].set_value(p_value);
if (base.is_valid() && p_value == base->get_var(p_name).get_value()) {
// When user pressed reset property button in inspector...
var_map[prop_name].reset_value_changed();
var_map[p_name].reset_value_changed();
}
return true;
}
// * Storage
if (prop_name.begins_with("var/")) {
String var_name = prop_name.get_slicec('/', 1);
String what = prop_name.get_slicec('/', 2);
if (name_str.begins_with("var/")) {
StringName var_name = name_str.get_slicec('/', 1);
String what = name_str.get_slicec('/', 2);
if (!var_map.has(var_name) && what == "name") {
add_var(var_name, BBVariable());
}
@ -51,21 +51,21 @@ bool BlackboardPlan::_set(const StringName &p_name, const Variant &p_value) {
}
bool BlackboardPlan::_get(const StringName &p_name, Variant &r_ret) const {
String prop_name = p_name;
String name_str = p_name;
// * Editor
if (var_map.has(prop_name)) {
r_ret = var_map[prop_name].get_value();
if (var_map.has(p_name)) {
r_ret = var_map[p_name].get_value();
return true;
}
// * Storage
if (!prop_name.begins_with("var/")) {
if (!name_str.begins_with("var/")) {
return false;
}
String var_name = prop_name.get_slicec('/', 1);
String what = prop_name.get_slicec('/', 2);
StringName var_name = name_str.get_slicec('/', 1);
String what = name_str.get_slicec('/', 2);
ERR_FAIL_COND_V(!var_map.has(var_name), false);
if (what == "name") {
@ -83,7 +83,7 @@ bool BlackboardPlan::_get(const StringName &p_name, Variant &r_ret) const {
}
void BlackboardPlan::_get_property_list(List<PropertyInfo> *p_list) const {
for (const Pair<String, BBVariable> &p : var_list) {
for (const Pair<StringName, BBVariable> &p : var_list) {
String var_name = p.first;
BBVariable var = p.second;
@ -119,58 +119,59 @@ void BlackboardPlan::set_base_plan(const Ref<BlackboardPlan> &p_base) {
notify_property_list_changed();
}
void BlackboardPlan::add_var(const String &p_name, const BBVariable &p_var) {
void BlackboardPlan::add_var(const StringName &p_name, const BBVariable &p_var) {
ERR_FAIL_COND(var_map.has(p_name));
var_map.insert(p_name, p_var);
var_list.push_back(Pair<String, BBVariable>(p_name, p_var));
var_list.push_back(Pair<StringName, BBVariable>(p_name, p_var));
notify_property_list_changed();
emit_changed();
}
void BlackboardPlan::remove_var(const String &p_name) {
void BlackboardPlan::remove_var(const StringName &p_name) {
ERR_FAIL_COND(!var_map.has(p_name));
var_list.erase(Pair<String, BBVariable>(p_name, var_map[p_name]));
var_list.erase(Pair<StringName, BBVariable>(p_name, var_map[p_name]));
var_map.erase(p_name);
notify_property_list_changed();
emit_changed();
}
BBVariable BlackboardPlan::get_var(const String &p_name) {
BBVariable BlackboardPlan::get_var(const StringName &p_name) {
ERR_FAIL_COND_V(!var_map.has(p_name), BBVariable());
return var_map.get(p_name);
}
Pair<String, BBVariable> BlackboardPlan::get_var_by_index(int p_index) {
Pair<String, BBVariable> ret;
Pair<StringName, BBVariable> BlackboardPlan::get_var_by_index(int p_index) {
Pair<StringName, BBVariable> ret;
ERR_FAIL_INDEX_V(p_index, (int)var_map.size(), ret);
return var_list[p_index];
}
PackedStringArray BlackboardPlan::list_vars() const {
PackedStringArray ret;
for (const Pair<String, BBVariable> &p : var_list) {
for (const Pair<StringName, BBVariable> &p : var_list) {
ret.append(p.first);
}
return ret;
}
String BlackboardPlan::get_var_name(const BBVariable &p_var) const {
for (const Pair<String, BBVariable> &p : var_list) {
StringName BlackboardPlan::get_var_name(const BBVariable &p_var) const {
for (const Pair<StringName, BBVariable> &p : var_list) {
if (p.second == p_var) {
return p.first;
}
}
return String();
return StringName();
}
bool BlackboardPlan::is_valid_var_name(const String &p_name) const {
if (p_name.begins_with("resource_")) {
bool BlackboardPlan::is_valid_var_name(const StringName &p_name) const {
String name_str = p_name;
if (name_str.begins_with("resource_")) {
return false;
}
return p_name.is_valid_identifier() && !var_map.has(p_name);
return name_str.is_valid_identifier() && !var_map.has(p_name);
}
void BlackboardPlan::rename_var(const String &p_name, const String &p_new_name) {
void BlackboardPlan::rename_var(const StringName &p_name, const StringName &p_new_name) {
if (p_name == p_new_name) {
return;
}
@ -179,8 +180,8 @@ void BlackboardPlan::rename_var(const String &p_name, const String &p_new_name)
ERR_FAIL_COND(!var_map.has(p_name));
BBVariable var = var_map[p_name];
Pair<String, BBVariable> new_entry(p_new_name, var);
Pair<String, BBVariable> old_entry(p_name, var);
Pair<StringName, BBVariable> new_entry(p_new_name, var);
Pair<StringName, BBVariable> old_entry(p_name, var);
var_list.find(old_entry)->set(new_entry);
var_map.erase(p_name);
@ -198,11 +199,11 @@ void BlackboardPlan::move_var(int p_index, int p_new_index) {
return;
}
List<Pair<String, BBVariable>>::Element *E = var_list.front();
List<Pair<StringName, BBVariable>>::Element *E = var_list.front();
for (int i = 0; i < p_index; i++) {
E = E->next();
}
List<Pair<String, BBVariable>>::Element *E2 = var_list.front();
List<Pair<StringName, BBVariable>>::Element *E2 = var_list.front();
for (int i = 0; i < p_new_index; i++) {
E2 = E2->next();
}
@ -224,8 +225,8 @@ void BlackboardPlan::sync_with_base_plan() {
bool changed = false;
// Sync variables with the base plan.
for (const Pair<String, BBVariable> &p : base->var_list) {
const String &base_name = p.first;
for (const Pair<StringName, BBVariable> &p : base->var_list) {
const StringName &base_name = p.first;
const BBVariable &base_var = p.second;
if (!var_map.has(base_name)) {
@ -249,7 +250,7 @@ void BlackboardPlan::sync_with_base_plan() {
}
// Erase variables that do not exist in the base plan.
for (const Pair<String, BBVariable> &p : var_list) {
for (const Pair<StringName, BBVariable> &p : var_list) {
if (!base->has_var(p.first)) {
remove_var(p.first);
changed = true;
@ -264,14 +265,14 @@ void BlackboardPlan::sync_with_base_plan() {
Ref<Blackboard> BlackboardPlan::create_blackboard() {
Ref<Blackboard> bb = memnew(Blackboard);
for (const Pair<String, BBVariable> &p : var_list) {
for (const Pair<StringName, BBVariable> &p : var_list) {
bb->add_var(p.first, p.second.duplicate());
}
return bb;
}
void BlackboardPlan::populate_blackboard(const Ref<Blackboard> &p_blackboard, bool overwrite) {
for (const Pair<String, BBVariable> &p : var_list) {
for (const Pair<StringName, BBVariable> &p : var_list) {
if (p_blackboard->has_var(p.first)) {
if (overwrite) {
p_blackboard->erase_var(p.first);

View File

@ -28,8 +28,8 @@ class BlackboardPlan : public Resource {
GDCLASS(BlackboardPlan, Resource);
private:
List<Pair<String, BBVariable>> var_list;
HashMap<String, BBVariable> var_map;
List<Pair<StringName, BBVariable>> var_list;
HashMap<StringName, BBVariable> var_map;
// When base is not null, the plan is considered to be derived from the base plan.
// A derived plan can only have variables that exist in the base plan,
@ -49,18 +49,18 @@ public:
void set_base_plan(const Ref<BlackboardPlan> &p_base);
Ref<BlackboardPlan> get_base_plan() const { return base; }
void add_var(const String &p_name, const BBVariable &p_var);
void remove_var(const String &p_name);
BBVariable get_var(const String &p_name);
Pair<String, BBVariable> get_var_by_index(int p_index);
bool has_var(const String &p_name) { return var_map.has(p_name); }
void add_var(const StringName &p_name, const BBVariable &p_var);
void remove_var(const StringName &p_name);
BBVariable get_var(const StringName &p_name);
Pair<StringName, BBVariable> get_var_by_index(int p_index);
bool has_var(const StringName &p_name) { return var_map.has(p_name); }
bool is_empty() const { return var_map.is_empty(); }
int get_var_count() const { return var_map.size(); }
PackedStringArray list_vars() const;
String get_var_name(const BBVariable &p_var) const;
bool is_valid_var_name(const String &p_name) const;
void rename_var(const String &p_name, const String &p_new_name);
StringName get_var_name(const BBVariable &p_var) const;
bool is_valid_var_name(const StringName &p_name) const;
void rename_var(const StringName &p_name, const StringName &p_new_name);
void move_var(int p_index, int p_new_index);
void sync_with_base_plan();

View File

@ -5,7 +5,7 @@
[ext_resource type="Script" path="res://demo/ai/tasks/face_target.gd" id="3_bpmfp"]
[sub_resource type="BlackboardPlan" id="BlackboardPlan_46tbn"]
var/speed/name = "speed"
var/speed/name = &"speed"
var/speed/type = 3
var/speed/value = 400.0
var/speed/hint = 1

View File

@ -7,12 +7,12 @@
[ext_resource type="Script" path="res://demo/ai/tasks/move_forward.gd" id="5_ucvak"]
[sub_resource type="BlackboardPlan" id="BlackboardPlan_qd806"]
var/speed/name = "speed"
var/speed/name = &"speed"
var/speed/type = 3
var/speed/value = 400.0
var/speed/hint = 1
var/speed/hint_string = "10,1000,10"
var/charge_speed/name = "charge_speed"
var/charge_speed/name = &"charge_speed"
var/charge_speed/type = 3
var/charge_speed/value = 1000.0
var/charge_speed/hint = 1

View File

@ -7,7 +7,7 @@
[ext_resource type="Script" path="res://demo/ai/tasks/face_target.gd" id="5_o4ggh"]
[sub_resource type="BlackboardPlan" id="BlackboardPlan_46tbn"]
var/speed/name = "speed"
var/speed/name = &"speed"
var/speed/type = 3
var/speed/value = 400.0
var/speed/hint = 1

View File

@ -9,17 +9,17 @@
[ext_resource type="Script" path="res://demo/ai/tasks/back_away.gd" id="6_fkv0k"]
[sub_resource type="BlackboardPlan" id="BlackboardPlan_46tbn"]
var/speed/name = "speed"
var/speed/name = &"speed"
var/speed/type = 3
var/speed/value = 400.0
var/speed/hint = 1
var/speed/hint_string = "10,1000,10"
var/fast_speed/name = "fast_speed"
var/fast_speed/name = &"fast_speed"
var/fast_speed/type = 3
var/fast_speed/value = 600.0
var/fast_speed/hint = 1
var/fast_speed/hint_string = "10,1000,10"
var/slow_speed/name = "slow_speed"
var/slow_speed/name = &"slow_speed"
var/slow_speed/type = 3
var/slow_speed/value = 300.0
var/slow_speed/hint = 1

View File

@ -7,12 +7,12 @@
[ext_resource type="Script" path="res://demo/ai/tasks/face_target.gd" id="5_aexyq"]
[sub_resource type="BlackboardPlan" id="BlackboardPlan_46tbn"]
var/speed/name = "speed"
var/speed/name = &"speed"
var/speed/type = 3
var/speed/value = 400.0
var/speed/hint = 1
var/speed/hint_string = "10,1000,10"
var/run_speed/name = "run_speed"
var/run_speed/name = &"run_speed"
var/run_speed/type = 3
var/run_speed/value = 600.0
var/run_speed/hint = 1

View File

@ -7,12 +7,12 @@
[ext_resource type="Script" path="res://demo/ai/tasks/move_forward.gd" id="5_au5yc"]
[sub_resource type="BlackboardPlan" id="BlackboardPlan_46tbn"]
var/speed/name = "speed"
var/speed/name = &"speed"
var/speed/type = 3
var/speed/value = 400.0
var/speed/hint = 1
var/speed/hint_string = "10,1000,10"
var/charge_speed/name = "charge_speed"
var/charge_speed/name = &"charge_speed"
var/charge_speed/type = 3
var/charge_speed/value = 1000.0
var/charge_speed/hint = 0

View File

@ -7,12 +7,12 @@
[ext_resource type="Script" path="res://demo/ai/tasks/pursue.gd" id="5_r1ou0"]
[sub_resource type="BlackboardPlan" id="BlackboardPlan_46tbn"]
var/speed/name = "speed"
var/speed/name = &"speed"
var/speed/type = 3
var/speed/value = 400.0
var/speed/hint = 1
var/speed/hint_string = "10,1000,10"
var/flank_speed/name = "flank_speed"
var/flank_speed/name = &"flank_speed"
var/flank_speed/type = 3
var/flank_speed/value = 600.0
var/flank_speed/hint = 1

View File

@ -8,7 +8,7 @@
[ext_resource type="Script" path="res://demo/ai/tasks/arrive_pos.gd" id="6_0pfsl"]
[sub_resource type="BlackboardPlan" id="BlackboardPlan_8ay3j"]
var/speed/name = "speed"
var/speed/name = &"speed"
var/speed/type = 3
var/speed/value = 400.0
var/speed/hint = 1

View File

@ -4,12 +4,12 @@
[ext_resource type="Script" path="res://demo/ai/tasks/arrive_pos.gd" id="2_pshl2"]
[sub_resource type="BlackboardPlan" id="BlackboardPlan_58oq1"]
var/speed/name = "speed"
var/speed/name = &"speed"
var/speed/type = 3
var/speed/value = 300.0
var/speed/hint = 1
var/speed/hint_string = "10,1000,10"
var/summon_cooldown/name = "summon_cooldown"
var/summon_cooldown/name = &"summon_cooldown"
var/summon_cooldown/type = 1
var/summon_cooldown/value = false
var/summon_cooldown/hint = 0
@ -53,7 +53,7 @@ type = 1
[sub_resource type="BTCheckVar" id="BTCheckVar_hc3o3"]
children = [SubResource("BTComment_ef6y0")]
variable = "summon_cooldown"
variable = &"summon_cooldown"
value = SubResource("BBVariant_hgde2")
[sub_resource type="BBNode" id="BBNode_q8bei"]
@ -77,7 +77,7 @@ position_var = "minion_pos"
[sub_resource type="BBVariant" id="BBVariant_wfjwy"]
resource_name = "$minion_pos"
value_source = 1
variable = "minion_pos"
variable = &"minion_pos"
type = 5
[sub_resource type="BBNode" id="BBNode_v271m"]
@ -92,7 +92,7 @@ args = Array[BBVariant]([SubResource("BBVariant_wfjwy")])
[sub_resource type="BTCooldown" id="BTCooldown_25f70"]
children = [SubResource("BTCallMethod_4ath5")]
duration = 6.0
cooldown_state_var = "summon_cooldown"
cooldown_state_var = &"summon_cooldown"
[sub_resource type="BTWait" id="BTWait_tdhfn"]

View File

@ -1,15 +1,15 @@
[gd_resource type="BehaviorTree" load_steps=5 format=3 uid="uid://b1mfh8yad7rmw"]
[sub_resource type="BlackboardPlan" id="BlackboardPlan_ewfwq"]
var/speed/name = "speed"
var/speed/name = &"speed"
var/speed/type = 3
var/speed/value = 400.0
var/speed/hint = 1
var/speed/hint_string = "10,1000,10"
[sub_resource type="BBNode" id="BBNode_fq0jf"]
saved_value = NodePath("AnimationPlayer")
resource_name = "AnimationPlayer"
saved_value = NodePath("AnimationPlayer")
[sub_resource type="BTPlayAnimation" id="BTPlayAnimation_rsejo"]
animation_player = SubResource("BBNode_fq0jf")

View File

@ -1,20 +1,20 @@
[gd_resource type="BehaviorTree" load_steps=9 format=3 uid="uid://b1i0xo0o676va"]
[sub_resource type="BlackboardPlan" id="BlackboardPlan_ewfwq"]
var/speed/name = "speed"
var/speed/name = &"speed"
var/speed/type = 3
var/speed/value = 400.0
var/speed/hint = 1
var/speed/hint_string = "10,1000,10"
var/flank_speed/name = "flank_speed"
var/flank_speed/name = &"flank_speed"
var/flank_speed/type = 3
var/flank_speed/value = 600.0
var/flank_speed/hint = 1
var/flank_speed/hint_string = "10,1000,10"
[sub_resource type="BBNode" id="BBNode_wu06u"]
saved_value = NodePath("AnimationPlayer")
resource_name = "AnimationPlayer"
saved_value = NodePath("AnimationPlayer")
[sub_resource type="BTPlayAnimation" id="BTPlayAnimation_dubaq"]
animation_player = SubResource("BBNode_wu06u")
@ -24,8 +24,8 @@ animation_name = &"idle"
duration = 5.0
[sub_resource type="BBNode" id="BBNode_mgehh"]
saved_value = NodePath("AnimationPlayer")
resource_name = "AnimationPlayer"
saved_value = NodePath("AnimationPlayer")
[sub_resource type="BTPlayAnimation" id="BTPlayAnimation_0fqno"]
animation_player = SubResource("BBNode_mgehh")

View File

@ -7,15 +7,15 @@
[ext_resource type="Script" path="res://demo/ai/tasks/face_target.gd" id="5_thvy5"]
[sub_resource type="BlackboardPlan" id="BlackboardPlan_ewfwq"]
var/speed/name = "speed"
var/speed/name = &"speed"
var/speed/type = 3
var/speed/value = 400.0
var/speed/hint = 1
var/speed/hint_string = "10,1000,10"
[sub_resource type="BBNode" id="BBNode_20ku0"]
saved_value = NodePath("AnimationPlayer")
resource_name = "AnimationPlayer"
saved_value = NodePath("AnimationPlayer")
[sub_resource type="BTPlayAnimation" id="BTPlayAnimation_57u80"]
animation_player = SubResource("BBNode_20ku0")
@ -56,8 +56,8 @@ script = ExtResource("5_thvy5")
target_var = "target"
[sub_resource type="BBNode" id="BBNode_ilr2h"]
saved_value = NodePath("AnimationPlayer")
resource_name = "AnimationPlayer"
saved_value = NodePath("AnimationPlayer")
[sub_resource type="BTPlayAnimation" id="BTPlayAnimation_mrsu3"]
animation_player = SubResource("BBNode_ilr2h")
@ -67,8 +67,8 @@ animation_name = &"attack_1"
children = [SubResource("BTAction_124bm"), SubResource("BTCondition_n25o8"), SubResource("BTAction_1hfgr"), SubResource("BTPlayAnimation_mrsu3")]
[sub_resource type="BBNode" id="BBNode_fq0jf"]
saved_value = NodePath("AnimationPlayer")
resource_name = "AnimationPlayer"
saved_value = NodePath("AnimationPlayer")
[sub_resource type="BTPlayAnimation" id="BTPlayAnimation_rsejo"]
animation_player = SubResource("BBNode_fq0jf")

View File

@ -4,15 +4,15 @@
[ext_resource type="Script" path="res://demo/ai/tasks/arrive_pos.gd" id="2_v5eou"]
[sub_resource type="BlackboardPlan" id="BlackboardPlan_ewfwq"]
var/speed/name = "speed"
var/speed/name = &"speed"
var/speed/type = 3
var/speed/value = 400.0
var/speed/hint = 1
var/speed/hint_string = "10,1000,10"
[sub_resource type="BBNode" id="BBNode_fq0jf"]
saved_value = NodePath("AnimationPlayer")
resource_name = "AnimationPlayer"
saved_value = NodePath("AnimationPlayer")
[sub_resource type="BTPlayAnimation" id="BTPlayAnimation_rsejo"]
animation_player = SubResource("BBNode_fq0jf")
@ -22,8 +22,8 @@ animation_name = &"idle"
duration = 3.0
[sub_resource type="BBNode" id="BBNode_6d0yy"]
saved_value = NodePath("AnimationPlayer")
resource_name = "AnimationPlayer"
saved_value = NodePath("AnimationPlayer")
[sub_resource type="BTPlayAnimation" id="BTPlayAnimation_wsspf"]
animation_player = SubResource("BBNode_6d0yy")

View File

@ -7,7 +7,7 @@
[ext_resource type="Script" path="res://demo/ai/tasks/arrive_pos.gd" id="2_t62a0"]
[sub_resource type="BlackboardPlan" id="BlackboardPlan_ewfwq"]
var/speed/name = "speed"
var/speed/name = &"speed"
var/speed/type = 3
var/speed/value = 400.0
var/speed/hint = 1
@ -20,8 +20,8 @@ distance_max = 200.0
target_var = "target"
[sub_resource type="BBNode" id="BBNode_icf24"]
saved_value = NodePath("AnimationPlayer")
resource_name = "AnimationPlayer"
saved_value = NodePath("AnimationPlayer")
[sub_resource type="BTPlayAnimation" id="BTPlayAnimation_iiei3"]
animation_player = SubResource("BBNode_icf24")
@ -41,8 +41,8 @@ tolerance = 50.0
avoid_var = ""
[sub_resource type="BBNode" id="BBNode_ayt56"]
saved_value = NodePath("AnimationPlayer")
resource_name = "AnimationPlayer"
saved_value = NodePath("AnimationPlayer")
[sub_resource type="BTPlayAnimation" id="BTPlayAnimation_l1tdg"]
animation_player = SubResource("BBNode_ayt56")
@ -61,8 +61,8 @@ distance_max = 10000.0
target_var = "target"
[sub_resource type="BBNode" id="BBNode_6d0yy"]
saved_value = NodePath("AnimationPlayer")
resource_name = "AnimationPlayer"
saved_value = NodePath("AnimationPlayer")
[sub_resource type="BTPlayAnimation" id="BTPlayAnimation_wsspf"]
animation_player = SubResource("BBNode_6d0yy")
@ -75,8 +75,8 @@ speed_var = "speed"
approach_distance = 100.0
[sub_resource type="BBNode" id="BBNode_aw5jj"]
saved_value = NodePath("AnimationPlayer")
resource_name = "AnimationPlayer"
saved_value = NodePath("AnimationPlayer")
[sub_resource type="BTPlayAnimation" id="BTPlayAnimation_3aihc"]
animation_player = SubResource("BBNode_aw5jj")

View File

@ -8,7 +8,7 @@
[ext_resource type="Script" path="res://demo/ai/tasks/pursue.gd" id="6_rpn40"]
[sub_resource type="BlackboardPlan" id="BlackboardPlan_ewfwq"]
var/speed/name = "speed"
var/speed/name = &"speed"
var/speed/type = 3
var/speed/value = 400.0
var/speed/hint = 1
@ -33,8 +33,8 @@ script = ExtResource("3_orhnl")
target_var = "target"
[sub_resource type="BBNode" id="BBNode_6d0yy"]
saved_value = NodePath("AnimationPlayer")
resource_name = "AnimationPlayer"
saved_value = NodePath("AnimationPlayer")
[sub_resource type="BTPlayAnimation" id="BTPlayAnimation_wsspf"]
await_completion = 5.0
@ -45,8 +45,8 @@ animation_name = &"attack_1"
children = [SubResource("BTCondition_m15aa"), SubResource("BTAction_oc76s"), SubResource("BTPlayAnimation_wsspf")]
[sub_resource type="BTCooldown" id="BTCooldown_3tvjt"]
duration = 5.0
children = [SubResource("BTSequence_e0f8v")]
duration = 5.0
[sub_resource type="BTCondition" id="BTCondition_x0uu7"]
script = ExtResource("2_08b67")
@ -55,8 +55,8 @@ distance_max = 200.0
target_var = "target"
[sub_resource type="BBNode" id="BBNode_icf24"]
saved_value = NodePath("AnimationPlayer")
resource_name = "AnimationPlayer"
saved_value = NodePath("AnimationPlayer")
[sub_resource type="BTPlayAnimation" id="BTPlayAnimation_iiei3"]
animation_player = SubResource("BBNode_icf24")
@ -76,8 +76,8 @@ tolerance = 50.0
avoid_var = ""
[sub_resource type="BBNode" id="BBNode_ayt56"]
saved_value = NodePath("AnimationPlayer")
resource_name = "AnimationPlayer"
saved_value = NodePath("AnimationPlayer")
[sub_resource type="BTPlayAnimation" id="BTPlayAnimation_l1tdg"]
animation_player = SubResource("BBNode_ayt56")
@ -96,8 +96,8 @@ distance_max = 10000.0
target_var = "target"
[sub_resource type="BBNode" id="BBNode_rpwld"]
saved_value = NodePath("AnimationPlayer")
resource_name = "AnimationPlayer"
saved_value = NodePath("AnimationPlayer")
[sub_resource type="BTPlayAnimation" id="BTPlayAnimation_dug2k"]
animation_player = SubResource("BBNode_rpwld")
@ -110,8 +110,8 @@ speed_var = "speed"
approach_distance = 100.0
[sub_resource type="BBNode" id="BBNode_aw5jj"]
saved_value = NodePath("AnimationPlayer")
resource_name = "AnimationPlayer"
saved_value = NodePath("AnimationPlayer")
[sub_resource type="BTPlayAnimation" id="BTPlayAnimation_3aihc"]
animation_player = SubResource("BBNode_aw5jj")

View File

@ -7,7 +7,7 @@
[ext_resource type="Script" path="res://demo/ai/tasks/pursue.gd" id="6_1yikm"]
[sub_resource type="BlackboardPlan" id="BlackboardPlan_ewfwq"]
var/speed/name = "speed"
var/speed/name = &"speed"
var/speed/type = 3
var/speed/value = 400.0
var/speed/hint = 1
@ -32,8 +32,8 @@ script = ExtResource("3_86p0r")
target_var = "target"
[sub_resource type="BBNode" id="BBNode_6d0yy"]
saved_value = NodePath("AnimationPlayer")
resource_name = "AnimationPlayer"
saved_value = NodePath("AnimationPlayer")
[sub_resource type="BTPlayAnimation" id="BTPlayAnimation_wsspf"]
await_completion = 5.0
@ -41,8 +41,8 @@ animation_player = SubResource("BBNode_6d0yy")
animation_name = &"attack_1"
[sub_resource type="BBNode" id="BBNode_w45kn"]
saved_value = NodePath("AnimationPlayer")
resource_name = "AnimationPlayer"
saved_value = NodePath("AnimationPlayer")
[sub_resource type="BTPlayAnimation" id="BTPlayAnimation_d2lad"]
await_completion = 5.0
@ -53,8 +53,8 @@ animation_name = &"attack_2"
children = [SubResource("BTCondition_m15aa"), SubResource("BTAction_oc76s"), SubResource("BTPlayAnimation_wsspf"), SubResource("BTPlayAnimation_d2lad")]
[sub_resource type="BTCooldown" id="BTCooldown_3tvjt"]
duration = 5.0
children = [SubResource("BTSequence_e0f8v")]
duration = 5.0
[sub_resource type="BTCondition" id="BTCondition_x0uu7"]
script = ExtResource("2_mj1cj")
@ -63,8 +63,8 @@ distance_max = 200.0
target_var = "target"
[sub_resource type="BBNode" id="BBNode_wksgd"]
saved_value = NodePath("AnimationPlayer")
resource_name = "AnimationPlayer"
saved_value = NodePath("AnimationPlayer")
[sub_resource type="BTPlayAnimation" id="BTPlayAnimation_umlwj"]
animation_player = SubResource("BBNode_wksgd")
@ -76,15 +76,15 @@ speed_var = "speed"
max_angle_deviation = 0.7
[sub_resource type="BTTimeLimit" id="BTTimeLimit_6eii7"]
time_limit = 2.0
children = [SubResource("BTAction_6q0k4")]
time_limit = 2.0
[sub_resource type="BTAlwaysSucceed" id="BTAlwaysSucceed_ieord"]
children = [SubResource("BTTimeLimit_6eii7")]
[sub_resource type="BBNode" id="BBNode_ayt56"]
saved_value = NodePath("AnimationPlayer")
resource_name = "AnimationPlayer"
saved_value = NodePath("AnimationPlayer")
[sub_resource type="BTPlayAnimation" id="BTPlayAnimation_l1tdg"]
animation_player = SubResource("BBNode_ayt56")
@ -103,8 +103,8 @@ distance_max = 10000.0
target_var = "target"
[sub_resource type="BBNode" id="BBNode_rpwld"]
saved_value = NodePath("AnimationPlayer")
resource_name = "AnimationPlayer"
saved_value = NodePath("AnimationPlayer")
[sub_resource type="BTPlayAnimation" id="BTPlayAnimation_dug2k"]
animation_player = SubResource("BBNode_rpwld")
@ -117,8 +117,8 @@ speed_var = "speed"
approach_distance = 100.0
[sub_resource type="BBNode" id="BBNode_aw5jj"]
saved_value = NodePath("AnimationPlayer")
resource_name = "AnimationPlayer"
saved_value = NodePath("AnimationPlayer")
[sub_resource type="BTPlayAnimation" id="BTPlayAnimation_3aihc"]
animation_player = SubResource("BBNode_aw5jj")

View File

@ -9,7 +9,7 @@
[ext_resource type="Script" path="res://demo/ai/tasks/pursue.gd" id="7_ekws5"]
[sub_resource type="BlackboardPlan" id="BlackboardPlan_ewfwq"]
var/speed/name = "speed"
var/speed/name = &"speed"
var/speed/type = 3
var/speed/value = 400.0
var/speed/hint = 1
@ -34,8 +34,8 @@ script = ExtResource("4_128ei")
target_var = "target"
[sub_resource type="BBNode" id="BBNode_6d0yy"]
saved_value = NodePath("AnimationPlayer")
resource_name = "AnimationPlayer"
saved_value = NodePath("AnimationPlayer")
[sub_resource type="BTPlayAnimation" id="BTPlayAnimation_wsspf"]
await_completion = 5.0
@ -43,8 +43,8 @@ animation_player = SubResource("BBNode_6d0yy")
animation_name = &"attack_1"
[sub_resource type="BBNode" id="BBNode_w45kn"]
saved_value = NodePath("AnimationPlayer")
resource_name = "AnimationPlayer"
saved_value = NodePath("AnimationPlayer")
[sub_resource type="BTPlayAnimation" id="BTPlayAnimation_d2lad"]
await_completion = 5.0
@ -55,8 +55,8 @@ animation_name = &"attack_2"
children = [SubResource("BTCondition_m15aa"), SubResource("BTAction_oc76s"), SubResource("BTPlayAnimation_wsspf"), SubResource("BTPlayAnimation_d2lad")]
[sub_resource type="BTCooldown" id="BTCooldown_3tvjt"]
duration = 5.0
children = [SubResource("BTSequence_e0f8v")]
duration = 5.0
[sub_resource type="BTCondition" id="BTCondition_x0uu7"]
script = ExtResource("5_er18b")
@ -65,8 +65,8 @@ distance_max = 200.0
target_var = "target"
[sub_resource type="BBNode" id="BBNode_wksgd"]
saved_value = NodePath("AnimationPlayer")
resource_name = "AnimationPlayer"
saved_value = NodePath("AnimationPlayer")
[sub_resource type="BTPlayAnimation" id="BTPlayAnimation_umlwj"]
animation_player = SubResource("BBNode_wksgd")
@ -78,15 +78,15 @@ speed_var = "speed"
max_angle_deviation = 0.7
[sub_resource type="BTTimeLimit" id="BTTimeLimit_6eii7"]
time_limit = 2.0
children = [SubResource("BTAction_6q0k4")]
time_limit = 2.0
[sub_resource type="BTAlwaysSucceed" id="BTAlwaysSucceed_ieord"]
children = [SubResource("BTTimeLimit_6eii7")]
[sub_resource type="BBNode" id="BBNode_ayt56"]
saved_value = NodePath("AnimationPlayer")
resource_name = "AnimationPlayer"
saved_value = NodePath("AnimationPlayer")
[sub_resource type="BTPlayAnimation" id="BTPlayAnimation_l1tdg"]
animation_player = SubResource("BBNode_ayt56")
@ -107,8 +107,8 @@ range_max = 500
position_var = "pos"
[sub_resource type="BBNode" id="BBNode_icf24"]
saved_value = NodePath("AnimationPlayer")
resource_name = "AnimationPlayer"
saved_value = NodePath("AnimationPlayer")
[sub_resource type="BTPlayAnimation" id="BTPlayAnimation_iiei3"]
animation_player = SubResource("BBNode_icf24")
@ -126,8 +126,8 @@ script = ExtResource("4_128ei")
target_var = "target"
[sub_resource type="BBNode" id="BBNode_h4k80"]
saved_value = NodePath("AnimationPlayer")
resource_name = "AnimationPlayer"
saved_value = NodePath("AnimationPlayer")
[sub_resource type="BTPlayAnimation" id="BTPlayAnimation_40yja"]
animation_player = SubResource("BBNode_h4k80")
@ -136,8 +136,8 @@ animation_name = &"throw_prepare"
[sub_resource type="BTWait" id="BTWait_2dc1v"]
[sub_resource type="BBNode" id="BBNode_slipn"]
saved_value = NodePath("AnimationPlayer")
resource_name = "AnimationPlayer"
saved_value = NodePath("AnimationPlayer")
[sub_resource type="BTPlayAnimation" id="BTPlayAnimation_qnpjq"]
await_completion = 5.0
@ -145,8 +145,8 @@ animation_player = SubResource("BBNode_slipn")
animation_name = &"throw"
[sub_resource type="BBNode" id="BBNode_qaqnn"]
saved_value = NodePath(".")
resource_name = "."
saved_value = NodePath(".")
[sub_resource type="BTCallMethod" id="BTCallMethod_yd0fn"]
node = SubResource("BBNode_qaqnn")
@ -156,8 +156,8 @@ method = &"throw_ninja_star"
children = [SubResource("BTAction_n0rxm"), SubResource("BTPlayAnimation_iiei3"), SubResource("BTAction_g2up4"), SubResource("BTAction_d5lkr"), SubResource("BTPlayAnimation_40yja"), SubResource("BTWait_2dc1v"), SubResource("BTPlayAnimation_qnpjq"), SubResource("BTCallMethod_yd0fn")]
[sub_resource type="BTProbability" id="BTProbability_omklt"]
run_chance = 0.25
children = [SubResource("BTSequence_ws7nq")]
run_chance = 0.25
[sub_resource type="BTCondition" id="BTCondition_d6aub"]
script = ExtResource("5_er18b")
@ -166,8 +166,8 @@ distance_max = 10000.0
target_var = "target"
[sub_resource type="BBNode" id="BBNode_rpwld"]
saved_value = NodePath("AnimationPlayer")
resource_name = "AnimationPlayer"
saved_value = NodePath("AnimationPlayer")
[sub_resource type="BTPlayAnimation" id="BTPlayAnimation_dug2k"]
animation_player = SubResource("BBNode_rpwld")
@ -180,8 +180,8 @@ speed_var = "speed"
approach_distance = 100.0
[sub_resource type="BBNode" id="BBNode_aw5jj"]
saved_value = NodePath("AnimationPlayer")
resource_name = "AnimationPlayer"
saved_value = NodePath("AnimationPlayer")
[sub_resource type="BTPlayAnimation" id="BTPlayAnimation_3aihc"]
animation_player = SubResource("BBNode_aw5jj")

View File

@ -257,8 +257,8 @@ anchor_right = 1.0
anchor_bottom = 1.0
offset_left = 4.0
offset_top = 4.0
offset_right = -4.0
offset_bottom = -4.0
offset_right = 1020.0
offset_bottom = 704.0
grow_horizontal = 2
grow_vertical = 2
gutters_draw_line_numbers = true