diff --git a/blackboard/bb_param/bb_param.cpp b/blackboard/bb_param/bb_param.cpp index 465e374..340e89b 100644 --- a/blackboard/bb_param/bb_param.cpp +++ b/blackboard/bb_param/bb_param.cpp @@ -1,7 +1,7 @@ /** * bb_param.cpp * ============================================================================= - * Copyright 2021-2023 Serhii Snitsaruk + * Copyright 2021-2024 Serhii Snitsaruk * * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file or at @@ -49,8 +49,8 @@ void BBParam::set_saved_value(Variant p_value) { emit_changed(); } -void BBParam::set_variable(const String &p_value) { - variable = p_value; +void BBParam::set_variable(const StringName &p_variable) { + variable = p_variable; _update_name(); emit_changed(); } @@ -96,7 +96,7 @@ void BBParam::_get_property_list(List *p_list) const { if (value_source == ValueSource::SAVED_VALUE) { p_list->push_back(PropertyInfo(get_type(), "saved_value")); } else { - p_list->push_back(PropertyInfo(Variant::STRING, "variable")); + p_list->push_back(PropertyInfo(Variant::STRING_NAME, "variable")); } } @@ -111,7 +111,7 @@ void BBParam::_bind_methods() { ClassDB::bind_method(D_METHOD("get_value", "p_agent", "p_blackboard", "p_default"), &BBParam::get_value, Variant()); ADD_PROPERTY(PropertyInfo(Variant::INT, "value_source", PROPERTY_HINT_ENUM, "Saved Value,Blackboard Var"), "set_value_source", "get_value_source"); - ADD_PROPERTY(PropertyInfo(Variant::STRING, "variable", PROPERTY_HINT_NONE, "", 0), "set_variable", "get_variable"); + ADD_PROPERTY(PropertyInfo(Variant::STRING_NAME, "variable", PROPERTY_HINT_NONE, "", 0), "set_variable", "get_variable"); ADD_PROPERTY(PropertyInfo(Variant::NIL, "saved_value", PROPERTY_HINT_NONE, "", 0), "set_saved_value", "get_saved_value"); BIND_ENUM_CONSTANT(SAVED_VALUE); @@ -120,7 +120,6 @@ void BBParam::_bind_methods() { BBParam::BBParam() { value_source = SAVED_VALUE; - variable = ""; _assign_default_value(); } diff --git a/blackboard/bb_param/bb_param.h b/blackboard/bb_param/bb_param.h index ba35623..5d5627b 100644 --- a/blackboard/bb_param/bb_param.h +++ b/blackboard/bb_param/bb_param.h @@ -41,7 +41,7 @@ public: private: ValueSource value_source; Variant saved_value; - String variable; + StringName variable; _FORCE_INLINE_ void _update_name() { set_name((value_source == SAVED_VALUE) ? String(saved_value) : LimboUtility::get_singleton()->decorate_var(variable)); @@ -70,8 +70,8 @@ public: void set_saved_value(Variant p_value); Variant get_saved_value(); - void set_variable(const String &p_value); - String get_variable() const { return variable; } + void set_variable(const StringName &p_variable); + StringName get_variable() const { return variable; } #ifdef LIMBOAI_MODULE virtual String to_string() override; diff --git a/blackboard/bb_variable.h b/blackboard/bb_variable.h index b4a5225..02cdd30 100644 --- a/blackboard/bb_variable.h +++ b/blackboard/bb_variable.h @@ -63,8 +63,8 @@ public: void copy_prop_info(const BBVariable &p_other); // * Editor binding methods - String get_binding_path() const { return data->binding_path; } - void set_binding_path(const String &p_binding_path) { data->binding_path = p_binding_path; } + NodePath get_binding_path() const { return data->binding_path; } + void set_binding_path(const NodePath &p_binding_path) { data->binding_path = p_binding_path; } bool has_binding() { return data->binding_path.is_empty(); } // * Runtime binding methods diff --git a/blackboard/blackboard.cpp b/blackboard/blackboard.cpp index 5826866..78159fd 100644 --- a/blackboard/blackboard.cpp +++ b/blackboard/blackboard.cpp @@ -1,7 +1,7 @@ /** * blackboard.cpp * ============================================================================= - * Copyright 2021-2023 Serhii Snitsaruk + * Copyright 2021-2024 Serhii Snitsaruk * * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file or at @@ -32,7 +32,7 @@ Ref Blackboard::top() const { return bb; } -Variant Blackboard::get_var(const String &p_name, const Variant &p_default, bool p_complain) const { +Variant Blackboard::get_var(const StringName &p_name, const Variant &p_default, bool p_complain) const { if (data.has(p_name)) { return data.get(p_name).get_value(); } else if (parent.is_valid()) { @@ -45,7 +45,7 @@ Variant Blackboard::get_var(const String &p_name, const Variant &p_default, bool } } -void Blackboard::set_var(const String &p_name, const Variant &p_value) { +void Blackboard::set_var(const StringName &p_name, const Variant &p_value) { if (data.has(p_name)) { // Not checking type - allowing duck-typing. data[p_name].set_value(p_value); @@ -56,32 +56,32 @@ void Blackboard::set_var(const String &p_name, const Variant &p_value) { } } -bool Blackboard::has_var(const String &p_name) const { +bool Blackboard::has_var(const StringName &p_name) const { return data.has(p_name) || (parent.is_valid() && parent->has_var(p_name)); } -void Blackboard::erase_var(const String &p_name) { +void Blackboard::erase_var(const StringName &p_name) { data.erase(p_name); } -void Blackboard::bind_var_to_property(const String &p_name, Object *p_object, const StringName &p_property) { +void Blackboard::bind_var_to_property(const StringName &p_name, Object *p_object, const StringName &p_property) { ERR_FAIL_COND_MSG(!data.has(p_name), "Blackboard: Binding failed - can't bind variable that doesn't exist."); data[p_name].bind(p_object, p_property); } -void Blackboard::unbind_var(const String &p_name) { +void Blackboard::unbind_var(const StringName &p_name) { ERR_FAIL_COND_MSG(data.has(p_name), "Blackboard: Can't unbind variable that doesn't exist."); data[p_name].unbind(); } -void Blackboard::add_var(const String &p_name, const BBVariable &p_var) { +void Blackboard::add_var(const StringName &p_name, const BBVariable &p_var) { ERR_FAIL_COND(data.has(p_name)); data.insert(p_name, p_var); } void Blackboard::prefetch_nodepath_vars(Node *p_node) { ERR_FAIL_COND(p_node == nullptr); - for (const KeyValue &kv : data) { + for (const KeyValue &kv : data) { BBVariable var = kv.value; if (var.get_value().get_type() == Variant::NODE_PATH) { Node *fetched_node = p_node->get_node_or_null(var.get_value()); diff --git a/blackboard/blackboard.h b/blackboard/blackboard.h index ee0987e..074e132 100644 --- a/blackboard/blackboard.h +++ b/blackboard/blackboard.h @@ -1,7 +1,7 @@ /** * blackboard.h * ============================================================================= - * Copyright 2021-2023 Serhii Snitsaruk + * Copyright 2021-2024 Serhii Snitsaruk * * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file or at @@ -34,7 +34,7 @@ class Blackboard : public RefCounted { GDCLASS(Blackboard, RefCounted); private: - HashMap data; + HashMap data; Ref parent; protected: @@ -46,15 +46,15 @@ public: Ref top() const; - Variant get_var(const String &p_name, const Variant &p_default, bool p_complain = true) const; - void set_var(const String &p_name, const Variant &p_value); - bool has_var(const String &p_name) const; - void erase_var(const String &p_name); + Variant get_var(const StringName &p_name, const Variant &p_default, bool p_complain = true) const; + void set_var(const StringName &p_name, const Variant &p_value); + bool has_var(const StringName &p_name) const; + void erase_var(const StringName &p_name); - void bind_var_to_property(const String &p_name, Object *p_object, const StringName &p_property); - void unbind_var(const String &p_name); + void bind_var_to_property(const StringName &p_name, Object *p_object, const StringName &p_property); + void unbind_var(const StringName &p_name); - void add_var(const String &p_name, const BBVariable &p_var); + void add_var(const StringName &p_name, const BBVariable &p_var); void prefetch_nodepath_vars(Node *p_node); diff --git a/blackboard/blackboard_plan.cpp b/blackboard/blackboard_plan.cpp index b6375f5..87dcf99 100644 --- a/blackboard/blackboard_plan.cpp +++ b/blackboard/blackboard_plan.cpp @@ -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 *p_list) const { - for (const Pair &p : var_list) { + for (const Pair &p : var_list) { String var_name = p.first; BBVariable var = p.second; @@ -119,58 +119,59 @@ void BlackboardPlan::set_base_plan(const Ref &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(p_name, p_var)); + var_list.push_back(Pair(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(p_name, var_map[p_name])); + var_list.erase(Pair(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 BlackboardPlan::get_var_by_index(int p_index) { - Pair ret; +Pair BlackboardPlan::get_var_by_index(int p_index) { + Pair 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 &p : var_list) { + for (const Pair &p : var_list) { ret.append(p.first); } return ret; } -String BlackboardPlan::get_var_name(const BBVariable &p_var) const { - for (const Pair &p : var_list) { +StringName BlackboardPlan::get_var_name(const BBVariable &p_var) const { + for (const Pair &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 new_entry(p_new_name, var); - Pair old_entry(p_name, var); + Pair new_entry(p_new_name, var); + Pair 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>::Element *E = var_list.front(); + List>::Element *E = var_list.front(); for (int i = 0; i < p_index; i++) { E = E->next(); } - List>::Element *E2 = var_list.front(); + List>::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 &p : base->var_list) { - const String &base_name = p.first; + for (const Pair &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 &p : var_list) { + for (const Pair &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 BlackboardPlan::create_blackboard() { Ref bb = memnew(Blackboard); - for (const Pair &p : var_list) { + for (const Pair &p : var_list) { bb->add_var(p.first, p.second.duplicate()); } return bb; } void BlackboardPlan::populate_blackboard(const Ref &p_blackboard, bool overwrite) { - for (const Pair &p : var_list) { + for (const Pair &p : var_list) { if (p_blackboard->has_var(p.first)) { if (overwrite) { p_blackboard->erase_var(p.first); diff --git a/blackboard/blackboard_plan.h b/blackboard/blackboard_plan.h index b3281f8..25599dd 100644 --- a/blackboard/blackboard_plan.h +++ b/blackboard/blackboard_plan.h @@ -28,8 +28,8 @@ class BlackboardPlan : public Resource { GDCLASS(BlackboardPlan, Resource); private: - List> var_list; - HashMap var_map; + List> var_list; + HashMap 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 &p_base); Ref 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 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 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(); diff --git a/bt/bt_state.cpp b/bt/bt_state.cpp index 4fd25e3..0c379e7 100644 --- a/bt/bt_state.cpp +++ b/bt/bt_state.cpp @@ -1,7 +1,7 @@ /** * bt_state.cpp * ============================================================================= - * Copyright 2021-2023 Serhii Snitsaruk + * Copyright 2021-2024 Serhii Snitsaruk * * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file or at @@ -113,11 +113,11 @@ void BTState::_bind_methods() { ClassDB::bind_method(D_METHOD("get_failure_event"), &BTState::get_failure_event); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "behavior_tree", PROPERTY_HINT_RESOURCE_TYPE, "BehaviorTree"), "set_behavior_tree", "get_behavior_tree"); - ADD_PROPERTY(PropertyInfo(Variant::STRING, "success_event"), "set_success_event", "get_success_event"); - ADD_PROPERTY(PropertyInfo(Variant::STRING, "failure_event"), "set_failure_event", "get_failure_event"); + ADD_PROPERTY(PropertyInfo(Variant::STRING_NAME, "success_event"), "set_success_event", "get_success_event"); + ADD_PROPERTY(PropertyInfo(Variant::STRING_NAME, "failure_event"), "set_failure_event", "get_failure_event"); } BTState::BTState() { - success_event = "success"; - failure_event = "failure"; + success_event = LW_NAME(EVENT_SUCCESS); + failure_event = LW_NAME(EVENT_FAILURE); } diff --git a/bt/bt_state.h b/bt/bt_state.h index 62ee8f9..07f79f8 100644 --- a/bt/bt_state.h +++ b/bt/bt_state.h @@ -1,7 +1,7 @@ /** * bt_state.h * ============================================================================= - * Copyright 2021-2023 Serhii Snitsaruk + * Copyright 2021-2024 Serhii Snitsaruk * * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file or at @@ -23,14 +23,16 @@ class BTState : public LimboState { private: Ref behavior_tree; Ref tree_instance; - String success_event; - String failure_event; + StringName success_event; + StringName failure_event; void _update_blackboard_plan(); protected: static void _bind_methods(); + void _notification(int p_notification); + virtual void _setup() override; virtual void _exit() override; virtual void _update(double p_delta) override; @@ -41,16 +43,13 @@ public: Ref get_tree_instance() const { return tree_instance; } - void set_success_event(String p_success_event) { success_event = p_success_event; } - String get_success_event() const { return success_event; } + void set_success_event(const StringName &p_success_event) { success_event = p_success_event; } + StringName get_success_event() const { return success_event; } - void set_failure_event(String p_failure_event) { failure_event = p_failure_event; } - String get_failure_event() const { return failure_event; } + void set_failure_event(const StringName &p_failure_event) { failure_event = p_failure_event; } + StringName get_failure_event() const { return failure_event; } BTState(); - -protected: - void _notification(int p_notification); }; #endif // BT_STATE_H diff --git a/bt/tasks/blackboard/bt_check_trigger.cpp b/bt/tasks/blackboard/bt_check_trigger.cpp index d50c5f2..991e92f 100644 --- a/bt/tasks/blackboard/bt_check_trigger.cpp +++ b/bt/tasks/blackboard/bt_check_trigger.cpp @@ -1,7 +1,7 @@ /** * bt_check_trigger.cpp * ============================================================================= - * Copyright 2021-2023 Serhii Snitsaruk + * Copyright 2021-2024 Serhii Snitsaruk * * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file or at @@ -13,28 +13,28 @@ #include "../../../util/limbo_utility.h" -void BTCheckTrigger::set_variable(String p_variable) { +void BTCheckTrigger::set_variable(const StringName &p_variable) { variable = p_variable; emit_changed(); } PackedStringArray BTCheckTrigger::get_configuration_warnings() { PackedStringArray warnings = BTCondition::get_configuration_warnings(); - if (variable.is_empty()) { + if (variable == StringName()) { warnings.append("Variable is not set."); } return warnings; } String BTCheckTrigger::_generate_name() { - if (variable.is_empty()) { + if (variable == StringName()) { return "CheckTrigger ???"; } return "CheckTrigger " + LimboUtility::get_singleton()->decorate_var(variable); } BT::Status BTCheckTrigger::_tick(double p_delta) { - ERR_FAIL_COND_V_MSG(variable.is_empty(), FAILURE, "BBCheckVar: `variable` is not set."); + ERR_FAIL_COND_V_MSG(variable == StringName(), FAILURE, "BBCheckVar: `variable` is not set."); Variant trigger_value = get_blackboard()->get_var(variable, false); if (trigger_value == Variant(true)) { get_blackboard()->set_var(variable, false); @@ -47,5 +47,5 @@ void BTCheckTrigger::_bind_methods() { ClassDB::bind_method(D_METHOD("set_variable", "p_variable"), &BTCheckTrigger::set_variable); ClassDB::bind_method(D_METHOD("get_variable"), &BTCheckTrigger::get_variable); - ADD_PROPERTY(PropertyInfo(Variant::STRING, "variable"), "set_variable", "get_variable"); + ADD_PROPERTY(PropertyInfo(Variant::STRING_NAME, "variable"), "set_variable", "get_variable"); } diff --git a/bt/tasks/blackboard/bt_check_trigger.h b/bt/tasks/blackboard/bt_check_trigger.h index 6f8a01a..79feeef 100644 --- a/bt/tasks/blackboard/bt_check_trigger.h +++ b/bt/tasks/blackboard/bt_check_trigger.h @@ -1,7 +1,7 @@ /** * bt_check_trigger.h * ============================================================================= - * Copyright 2021-2023 Serhii Snitsaruk + * Copyright 2021-2024 Serhii Snitsaruk * * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file or at @@ -19,7 +19,7 @@ class BTCheckTrigger : public BTCondition { TASK_CATEGORY(Blackboard); private: - String variable; + StringName variable; protected: static void _bind_methods(); @@ -28,10 +28,10 @@ protected: virtual Status _tick(double p_delta) override; public: - void set_variable(String p_variable); - String get_variable() const { return variable; } + void set_variable(const StringName &p_variable); + StringName get_variable() const { return variable; } virtual PackedStringArray get_configuration_warnings() override; }; -#endif // BT_CHECK_TRIGGER \ No newline at end of file +#endif // BT_CHECK_TRIGGER diff --git a/bt/tasks/blackboard/bt_check_var.cpp b/bt/tasks/blackboard/bt_check_var.cpp index 5415312..99b027b 100644 --- a/bt/tasks/blackboard/bt_check_var.cpp +++ b/bt/tasks/blackboard/bt_check_var.cpp @@ -1,7 +1,7 @@ /** * bt_check_var.cpp * ============================================================================= - * Copyright 2021-2023 Serhii Snitsaruk + * Copyright 2021-2024 Serhii Snitsaruk * * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file or at @@ -11,7 +11,7 @@ #include "bt_check_var.h" -void BTCheckVar::set_variable(String p_variable) { +void BTCheckVar::set_variable(const StringName &p_variable) { variable = p_variable; emit_changed(); } @@ -21,7 +21,7 @@ void BTCheckVar::set_check_type(LimboUtility::CheckType p_check_type) { emit_changed(); } -void BTCheckVar::set_value(Ref p_value) { +void BTCheckVar::set_value(const Ref &p_value) { value = p_value; emit_changed(); if (Engine::get_singleton()->is_editor_hint() && value.is_valid()) { @@ -31,7 +31,7 @@ void BTCheckVar::set_value(Ref p_value) { PackedStringArray BTCheckVar::get_configuration_warnings() { PackedStringArray warnings = BTCondition::get_configuration_warnings(); - if (variable.is_empty()) { + if (variable == StringName()) { warnings.append("`variable` should be assigned."); } if (!value.is_valid()) { @@ -41,7 +41,7 @@ PackedStringArray BTCheckVar::get_configuration_warnings() { } String BTCheckVar::_generate_name() { - if (variable.is_empty()) { + if (variable == StringName()) { return "CheckVar ???"; } @@ -51,7 +51,7 @@ String BTCheckVar::_generate_name() { } BT::Status BTCheckVar::_tick(double p_delta) { - ERR_FAIL_COND_V_MSG(variable.is_empty(), FAILURE, "BTCheckVar: `variable` is not set."); + ERR_FAIL_COND_V_MSG(variable == StringName(), FAILURE, "BTCheckVar: `variable` is not set."); ERR_FAIL_COND_V_MSG(!value.is_valid(), FAILURE, "BTCheckVar: `value` is not set."); ERR_FAIL_COND_V_MSG(!get_blackboard()->has_var(variable), FAILURE, vformat("BTCheckVar: Blackboard variable doesn't exist: \"%s\". Returning FAILURE.", variable)); @@ -70,7 +70,7 @@ void BTCheckVar::_bind_methods() { ClassDB::bind_method(D_METHOD("set_value", "p_value"), &BTCheckVar::set_value); ClassDB::bind_method(D_METHOD("get_value"), &BTCheckVar::get_value); - ADD_PROPERTY(PropertyInfo(Variant::STRING, "variable"), "set_variable", "get_variable"); + ADD_PROPERTY(PropertyInfo(Variant::STRING_NAME, "variable"), "set_variable", "get_variable"); ADD_PROPERTY(PropertyInfo(Variant::INT, "check_type", PROPERTY_HINT_ENUM, "Equal,Less Than,Less Than Or Equal,Greater Than,Greater Than Or Equal,Not Equal"), "set_check_type", "get_check_type"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "value", PROPERTY_HINT_RESOURCE_TYPE, "BBVariant"), "set_value", "get_value"); } diff --git a/bt/tasks/blackboard/bt_check_var.h b/bt/tasks/blackboard/bt_check_var.h index 2809ee3..ce61b32 100644 --- a/bt/tasks/blackboard/bt_check_var.h +++ b/bt/tasks/blackboard/bt_check_var.h @@ -1,7 +1,7 @@ /** * bt_check_var.h * ============================================================================= - * Copyright 2021-2023 Serhii Snitsaruk + * Copyright 2021-2024 Serhii Snitsaruk * * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file or at @@ -22,7 +22,7 @@ class BTCheckVar : public BTCondition { TASK_CATEGORY(Blackboard); private: - String variable; + StringName variable; LimboUtility::CheckType check_type = LimboUtility::CheckType::CHECK_EQUAL; Ref value; @@ -35,14 +35,14 @@ protected: public: virtual PackedStringArray get_configuration_warnings() override; - void set_variable(String p_variable); - String get_variable() const { return variable; } + void set_variable(const StringName &p_variable); + StringName get_variable() const { return variable; } void set_check_type(LimboUtility::CheckType p_check_type); LimboUtility::CheckType get_check_type() const { return check_type; } - void set_value(Ref p_value); + void set_value(const Ref &p_value); Ref get_value() const { return value; } }; -#endif // BT_CHECK_VAR_H \ No newline at end of file +#endif // BT_CHECK_VAR_H diff --git a/bt/tasks/blackboard/bt_set_var.cpp b/bt/tasks/blackboard/bt_set_var.cpp index 9c165b9..c74ac9a 100644 --- a/bt/tasks/blackboard/bt_set_var.cpp +++ b/bt/tasks/blackboard/bt_set_var.cpp @@ -1,7 +1,7 @@ /** * bt_set_var.cpp * ============================================================================= - * Copyright 2021-2023 Serhii Snitsaruk + * Copyright 2021-2024 Serhii Snitsaruk * * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file or at @@ -12,7 +12,7 @@ #include "bt_set_var.h" String BTSetVar::_generate_name() { - if (variable.is_empty()) { + if (variable == StringName()) { return "SetVar ???"; } return vformat("Set %s %s= %s", @@ -22,7 +22,7 @@ String BTSetVar::_generate_name() { } BT::Status BTSetVar::_tick(double p_delta) { - ERR_FAIL_COND_V_MSG(variable.is_empty(), FAILURE, "BTSetVar: `variable` is not set."); + ERR_FAIL_COND_V_MSG(variable == StringName(), FAILURE, "BTSetVar: `variable` is not set."); ERR_FAIL_COND_V_MSG(!value.is_valid(), FAILURE, "BTSetVar: `value` is not set."); Variant result; Variant error_result = LW_NAME(error_value); @@ -40,12 +40,12 @@ BT::Status BTSetVar::_tick(double p_delta) { return SUCCESS; }; -void BTSetVar::set_variable(const String &p_variable) { +void BTSetVar::set_variable(const StringName &p_variable) { variable = p_variable; emit_changed(); } -void BTSetVar::set_value(Ref p_value) { +void BTSetVar::set_value(const Ref &p_value) { value = p_value; emit_changed(); if (Engine::get_singleton()->is_editor_hint() && value.is_valid()) { @@ -60,7 +60,7 @@ void BTSetVar::set_operation(LimboUtility::Operation p_operation) { PackedStringArray BTSetVar::get_configuration_warnings() { PackedStringArray warnings = BTAction::get_configuration_warnings(); - if (variable.is_empty()) { + if (variable == StringName()) { warnings.append("`variable` should be assigned."); } if (!value.is_valid()) { @@ -77,7 +77,7 @@ void BTSetVar::_bind_methods() { ClassDB::bind_method(D_METHOD("get_operation"), &BTSetVar::get_operation); ClassDB::bind_method(D_METHOD("set_operation", "p_operation"), &BTSetVar::set_operation); - ADD_PROPERTY(PropertyInfo(Variant::STRING, "variable"), "set_variable", "get_variable"); + ADD_PROPERTY(PropertyInfo(Variant::STRING_NAME, "variable"), "set_variable", "get_variable"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "value", PROPERTY_HINT_RESOURCE_TYPE, "BBVariant"), "set_value", "get_value"); ADD_PROPERTY(PropertyInfo(Variant::INT, "operation", PROPERTY_HINT_ENUM, "None,Addition,Subtraction,Multiplication,Division,Modulo,Power,Bitwise Shift Left,Bitwise Shift Right,Bitwise AND,Bitwise OR,Bitwise XOR"), "set_operation", "get_operation"); } diff --git a/bt/tasks/blackboard/bt_set_var.h b/bt/tasks/blackboard/bt_set_var.h index a8c61e4..029bf90 100644 --- a/bt/tasks/blackboard/bt_set_var.h +++ b/bt/tasks/blackboard/bt_set_var.h @@ -1,7 +1,7 @@ /** * bt_set_var.h * ============================================================================= - * Copyright 2021-2023 Serhii Snitsaruk + * Copyright 2021-2024 Serhii Snitsaruk * * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file or at @@ -22,7 +22,7 @@ class BTSetVar : public BTAction { TASK_CATEGORY(Blackboard); private: - String variable; + StringName variable; Ref value; LimboUtility::Operation operation = LimboUtility::OPERATION_NONE; @@ -35,14 +35,14 @@ protected: public: virtual PackedStringArray get_configuration_warnings() override; - void set_variable(const String &p_variable); - String get_variable() const { return variable; } + void set_variable(const StringName &p_variable); + StringName get_variable() const { return variable; } - void set_value(Ref p_value); + void set_value(const Ref &p_value); Ref get_value() const { return value; } void set_operation(LimboUtility::Operation p_operation); LimboUtility::Operation get_operation() const { return operation; } }; -#endif // BT_SET_VAR \ No newline at end of file +#endif // BT_SET_VAR diff --git a/bt/tasks/decorators/bt_cooldown.cpp b/bt/tasks/decorators/bt_cooldown.cpp index 2f74298..ae3ed4f 100644 --- a/bt/tasks/decorators/bt_cooldown.cpp +++ b/bt/tasks/decorators/bt_cooldown.cpp @@ -1,7 +1,7 @@ /** * bt_cooldown.cpp * ============================================================================= - * Copyright 2021-2023 Serhii Snitsaruk + * Copyright 2021-2024 Serhii Snitsaruk * * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file or at @@ -41,7 +41,7 @@ void BTCooldown::set_trigger_on_failure(bool p_value) { emit_changed(); } -void BTCooldown::set_cooldown_state_var(String p_value) { +void BTCooldown::set_cooldown_state_var(const StringName &p_value) { cooldown_state_var = p_value; emit_changed(); } @@ -53,7 +53,7 @@ String BTCooldown::_generate_name() { } void BTCooldown::_setup() { - if (cooldown_state_var.is_empty()) { + if (cooldown_state_var == StringName()) { cooldown_state_var = vformat("cooldown_%d", rand()); } get_blackboard()->set_var(cooldown_state_var, false); @@ -109,5 +109,5 @@ void BTCooldown::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL, "process_pause"), "set_process_pause", "get_process_pause"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "start_cooled"), "set_start_cooled", "get_start_cooled"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "trigger_on_failure"), "set_trigger_on_failure", "get_trigger_on_failure"); - ADD_PROPERTY(PropertyInfo(Variant::STRING, "cooldown_state_var"), "set_cooldown_state_var", "get_cooldown_state_var"); + ADD_PROPERTY(PropertyInfo(Variant::STRING_NAME, "cooldown_state_var"), "set_cooldown_state_var", "get_cooldown_state_var"); } diff --git a/bt/tasks/decorators/bt_cooldown.h b/bt/tasks/decorators/bt_cooldown.h index 06b4d77..443f25c 100644 --- a/bt/tasks/decorators/bt_cooldown.h +++ b/bt/tasks/decorators/bt_cooldown.h @@ -1,7 +1,7 @@ /** * bt_cooldown.h * ============================================================================= - * Copyright 2021-2023 Serhii Snitsaruk + * Copyright 2021-2024 Serhii Snitsaruk * * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file or at @@ -31,7 +31,7 @@ private: bool process_pause = false; bool start_cooled = false; bool trigger_on_failure = false; - String cooldown_state_var = ""; + StringName cooldown_state_var = ""; Ref timer = nullptr; @@ -58,8 +58,8 @@ public: void set_trigger_on_failure(bool p_value); bool get_trigger_on_failure() const { return trigger_on_failure; } - void set_cooldown_state_var(String p_value); - String get_cooldown_state_var() const { return cooldown_state_var; } + void set_cooldown_state_var(const StringName &p_value); + StringName get_cooldown_state_var() const { return cooldown_state_var; } }; #endif // BT_COOLDOWN_H diff --git a/bt/tasks/decorators/bt_for_each.cpp b/bt/tasks/decorators/bt_for_each.cpp index 0c0e94a..7ec3f0f 100644 --- a/bt/tasks/decorators/bt_for_each.cpp +++ b/bt/tasks/decorators/bt_for_each.cpp @@ -1,7 +1,7 @@ /** * bt_for_each.cpp * ============================================================================= - * Copyright 2021-2023 Serhii Snitsaruk + * Copyright 2021-2024 Serhii Snitsaruk * * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file or at @@ -20,12 +20,12 @@ //**** Setters / Getters -void BTForEach::set_array_var(String p_value) { +void BTForEach::set_array_var(const StringName &p_value) { array_var = p_value; emit_changed(); } -void BTForEach::set_save_var(String p_value) { +void BTForEach::set_save_var(const StringName &p_value) { save_var = p_value; emit_changed(); } @@ -44,8 +44,8 @@ void BTForEach::_enter() { BT::Status BTForEach::_tick(double p_delta) { ERR_FAIL_COND_V_MSG(get_child_count() == 0, FAILURE, "ForEach decorator has no child."); - ERR_FAIL_COND_V_MSG(save_var.is_empty(), FAILURE, "ForEach save variable is not set."); - ERR_FAIL_COND_V_MSG(array_var.is_empty(), FAILURE, "ForEach array variable is not set."); + ERR_FAIL_COND_V_MSG(save_var == StringName(), FAILURE, "ForEach save variable is not set."); + ERR_FAIL_COND_V_MSG(array_var == StringName(), FAILURE, "ForEach array variable is not set."); Array arr = get_blackboard()->get_var(array_var, Variant()); if (arr.size() == 0) { @@ -75,6 +75,6 @@ void BTForEach::_bind_methods() { ClassDB::bind_method(D_METHOD("set_save_var", "p_variable"), &BTForEach::set_save_var); ClassDB::bind_method(D_METHOD("get_save_var"), &BTForEach::get_save_var); - ADD_PROPERTY(PropertyInfo(Variant::STRING, "array_var"), "set_array_var", "get_array_var"); - ADD_PROPERTY(PropertyInfo(Variant::STRING, "save_var"), "set_save_var", "get_save_var"); + ADD_PROPERTY(PropertyInfo(Variant::STRING_NAME, "array_var"), "set_array_var", "get_array_var"); + ADD_PROPERTY(PropertyInfo(Variant::STRING_NAME, "save_var"), "set_save_var", "get_save_var"); } diff --git a/bt/tasks/decorators/bt_for_each.h b/bt/tasks/decorators/bt_for_each.h index b9da49f..fc74f96 100644 --- a/bt/tasks/decorators/bt_for_each.h +++ b/bt/tasks/decorators/bt_for_each.h @@ -1,7 +1,7 @@ /** * bt_for_each.h * ============================================================================= - * Copyright 2021-2023 Serhii Snitsaruk + * Copyright 2021-2024 Serhii Snitsaruk * * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file or at @@ -19,8 +19,8 @@ class BTForEach : public BTDecorator { TASK_CATEGORY(Decorators); private: - String array_var; - String save_var; + StringName array_var; + StringName save_var; int current_idx; @@ -32,11 +32,11 @@ protected: virtual Status _tick(double p_delta) override; public: - void set_array_var(String p_value); - String get_array_var() const { return array_var; } + void set_array_var(const StringName &p_value); + StringName get_array_var() const { return array_var; } - void set_save_var(String p_value); - String get_save_var() const { return save_var; } + void set_save_var(const StringName &p_value); + StringName get_save_var() const { return save_var; } }; #endif // BT_FOR_EACH_H diff --git a/bt/tasks/scene/bt_await_animation.cpp b/bt/tasks/scene/bt_await_animation.cpp index c67d0e1..d36e710 100644 --- a/bt/tasks/scene/bt_await_animation.cpp +++ b/bt/tasks/scene/bt_await_animation.cpp @@ -21,7 +21,7 @@ void BTAwaitAnimation::set_animation_player(Ref p_animation_player) { } } -void BTAwaitAnimation::set_animation_name(StringName p_animation_name) { +void BTAwaitAnimation::set_animation_name(const StringName &p_animation_name) { animation_name = p_animation_name; emit_changed(); } @@ -40,7 +40,7 @@ PackedStringArray BTAwaitAnimation::get_configuration_warnings() { } else { if (animation_player_param->get_value_source() == BBParam::SAVED_VALUE && animation_player_param->get_saved_value() == Variant()) { warnings.append("Path to AnimationPlayer node is not set."); - } else if (animation_player_param->get_value_source() == BBParam::BLACKBOARD_VAR && animation_player_param->get_variable().is_empty()) { + } else if (animation_player_param->get_value_source() == BBParam::BLACKBOARD_VAR && animation_player_param->get_variable() == StringName()) { warnings.append("AnimationPlayer blackboard variable is not set."); } } diff --git a/bt/tasks/scene/bt_await_animation.h b/bt/tasks/scene/bt_await_animation.h index db1d274..e21291d 100644 --- a/bt/tasks/scene/bt_await_animation.h +++ b/bt/tasks/scene/bt_await_animation.h @@ -47,7 +47,7 @@ public: void set_animation_player(Ref p_animation_player); Ref get_animation_player() const { return animation_player_param; } - void set_animation_name(StringName p_animation_name); + void set_animation_name(const StringName &p_animation_name); StringName get_animation_name() const { return animation_name; } void set_max_time(double p_max_time); diff --git a/bt/tasks/scene/bt_pause_animation.cpp b/bt/tasks/scene/bt_pause_animation.cpp index 4dc482c..66509c0 100644 --- a/bt/tasks/scene/bt_pause_animation.cpp +++ b/bt/tasks/scene/bt_pause_animation.cpp @@ -30,7 +30,7 @@ PackedStringArray BTPauseAnimation::get_configuration_warnings() { } else { if (animation_player_param->get_value_source() == BBParam::SAVED_VALUE && animation_player_param->get_saved_value() == Variant()) { warnings.append("Path to AnimationPlayer node is not set."); - } else if (animation_player_param->get_value_source() == BBParam::BLACKBOARD_VAR && animation_player_param->get_variable().is_empty()) { + } else if (animation_player_param->get_value_source() == BBParam::BLACKBOARD_VAR && animation_player_param->get_variable() == StringName()) { warnings.append("AnimationPlayer blackboard variable is not set."); } } diff --git a/bt/tasks/scene/bt_play_animation.cpp b/bt/tasks/scene/bt_play_animation.cpp index 6d66628..3f8961e 100644 --- a/bt/tasks/scene/bt_play_animation.cpp +++ b/bt/tasks/scene/bt_play_animation.cpp @@ -55,7 +55,7 @@ PackedStringArray BTPlayAnimation::get_configuration_warnings() { } else { if (animation_player_param->get_value_source() == BBParam::SAVED_VALUE && animation_player_param->get_saved_value() == Variant()) { warnings.append("Path to AnimationPlayer node is not set."); - } else if (animation_player_param->get_value_source() == BBParam::BLACKBOARD_VAR && animation_player_param->get_variable().is_empty()) { + } else if (animation_player_param->get_value_source() == BBParam::BLACKBOARD_VAR && animation_player_param->get_variable() == StringName()) { warnings.append("AnimationPlayer blackboard variable is not set."); } } diff --git a/bt/tasks/scene/bt_stop_animation.cpp b/bt/tasks/scene/bt_stop_animation.cpp index 32dc7a7..8a9dc39 100644 --- a/bt/tasks/scene/bt_stop_animation.cpp +++ b/bt/tasks/scene/bt_stop_animation.cpp @@ -40,7 +40,7 @@ PackedStringArray BTStopAnimation::get_configuration_warnings() { } else { if (animation_player_param->get_value_source() == BBParam::SAVED_VALUE && animation_player_param->get_saved_value() == Variant()) { warnings.append("Path to AnimationPlayer node is not set."); - } else if (animation_player_param->get_value_source() == BBParam::BLACKBOARD_VAR && animation_player_param->get_variable().is_empty()) { + } else if (animation_player_param->get_value_source() == BBParam::BLACKBOARD_VAR && animation_player_param->get_variable() == StringName()) { warnings.append("AnimationPlayer blackboard variable is not set."); } } diff --git a/bt/tasks/utility/bt_call_method.cpp b/bt/tasks/utility/bt_call_method.cpp index 0477a85..6a59e6c 100644 --- a/bt/tasks/utility/bt_call_method.cpp +++ b/bt/tasks/utility/bt_call_method.cpp @@ -1,7 +1,7 @@ /** * bt_call_method.cpp * ============================================================================= - * Copyright 2021-2023 Serhii Snitsaruk + * Copyright 2021-2024 Serhii Snitsaruk * * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file or at @@ -20,12 +20,12 @@ //**** Setters / Getters -void BTCallMethod::set_method(StringName p_method_name) { +void BTCallMethod::set_method(const StringName &p_method_name) { method = p_method_name; emit_changed(); } -void BTCallMethod::set_node_param(Ref p_object) { +void BTCallMethod::set_node_param(const Ref &p_object) { node_param = p_object; emit_changed(); if (Engine::get_singleton()->is_editor_hint() && node_param.is_valid()) { @@ -43,7 +43,7 @@ void BTCallMethod::set_args(TypedArray p_args) { emit_changed(); } -void BTCallMethod::set_result_var(const String &p_result_var) { +void BTCallMethod::set_result_var(const StringName &p_result_var) { result_var = p_result_var; emit_changed(); } @@ -77,7 +77,7 @@ String BTCallMethod::_generate_name() { method != StringName() ? method : "???", args_str, node_param.is_valid() && !node_param->to_string().is_empty() ? node_param->to_string() : "???", - result_var.is_empty() ? "" : LimboUtility::get_singleton()->decorate_output_var(result_var)); + result_var == StringName() ? "" : LimboUtility::get_singleton()->decorate_output_var(result_var)); } BT::Status BTCallMethod::_tick(double p_delta) { @@ -124,7 +124,7 @@ BT::Status BTCallMethod::_tick(double p_delta) { result = obj->callv(method, call_args); #endif // LIMBOAI_MODULE & LIMBOAI_GDEXTENSION - if (!result_var.is_empty()) { + if (result_var != StringName()) { get_blackboard()->set_var(result_var, result); } @@ -147,7 +147,7 @@ void BTCallMethod::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "node", PROPERTY_HINT_RESOURCE_TYPE, "BBNode"), "set_node_param", "get_node_param"); ADD_PROPERTY(PropertyInfo(Variant::STRING_NAME, "method"), "set_method", "get_method"); - ADD_PROPERTY(PropertyInfo(Variant::STRING, "result_var"), "set_result_var", "get_result_var"); + ADD_PROPERTY(PropertyInfo(Variant::STRING_NAME, "result_var"), "set_result_var", "get_result_var"); ADD_GROUP("Arguments", "args_"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "args_include_delta"), "set_include_delta", "is_delta_included"); ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "args", PROPERTY_HINT_ARRAY_TYPE, RESOURCE_TYPE_HINT("BBVariant")), "set_args", "get_args"); diff --git a/bt/tasks/utility/bt_call_method.h b/bt/tasks/utility/bt_call_method.h index 99912b3..3dd7de7 100644 --- a/bt/tasks/utility/bt_call_method.h +++ b/bt/tasks/utility/bt_call_method.h @@ -1,7 +1,7 @@ /** * bt_call_method.h * ============================================================================= - * Copyright 2021-2023 Serhii Snitsaruk + * Copyright 2021-2024 Serhii Snitsaruk * * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file or at @@ -26,7 +26,7 @@ private: Ref node_param; TypedArray args; bool include_delta = false; - String result_var; + StringName result_var; protected: static void _bind_methods(); @@ -35,10 +35,10 @@ protected: virtual Status _tick(double p_delta) override; public: - void set_method(StringName p_method_name); + void set_method(const StringName &p_method_name); StringName get_method() const { return method; } - void set_node_param(Ref p_object); + void set_node_param(const Ref &p_object); Ref get_node_param() const { return node_param; } void set_args(TypedArray p_args); @@ -47,8 +47,8 @@ public: void set_include_delta(bool p_include_delta); bool is_delta_included() const { return include_delta; } - void set_result_var(const String &p_result_var); - String get_result_var() const { return result_var; } + void set_result_var(const StringName &p_result_var); + StringName get_result_var() const { return result_var; } virtual PackedStringArray get_configuration_warnings() override; diff --git a/bt/tasks/utility/bt_evaluate_expression.cpp b/bt/tasks/utility/bt_evaluate_expression.cpp index ad5ce58..5a7a09c 100644 --- a/bt/tasks/utility/bt_evaluate_expression.cpp +++ b/bt/tasks/utility/bt_evaluate_expression.cpp @@ -1,7 +1,7 @@ /** * bt_evaluate_expression.cpp * ============================================================================= - * Copyright 2021-2023 Serhii Snitsaruk + * Copyright 2021-2024 Serhii Snitsaruk * Copyright 2024 Wilson E. Alvarez * * Use of this source code is governed by an MIT-style @@ -55,7 +55,7 @@ void BTEvaluateExpression::set_input_values(const TypedArray &p_input emit_changed(); } -void BTEvaluateExpression::set_result_var(const String &p_result_var) { +void BTEvaluateExpression::set_result_var(const StringName &p_result_var) { result_var = p_result_var; emit_changed(); } @@ -101,7 +101,7 @@ String BTEvaluateExpression::_generate_name() { return vformat("EvaluateExpression %s node: %s %s", !expression_string.is_empty() ? expression_string : "???", node_param.is_valid() && !node_param->to_string().is_empty() ? node_param->to_string() : "???", - result_var.is_empty() ? "" : LimboUtility::get_singleton()->decorate_output_var(result_var)); + result_var == StringName() ? "" : LimboUtility::get_singleton()->decorate_output_var(result_var)); } BT::Status BTEvaluateExpression::_tick(double p_delta) { @@ -122,7 +122,7 @@ BT::Status BTEvaluateExpression::_tick(double p_delta) { Variant result = expression.execute(processed_input_values, obj, false); ERR_FAIL_COND_V_MSG(expression.has_execute_failed(), FAILURE, "BTEvaluateExpression: Failed to execute: " + expression.get_error_text()); - if (!result_var.is_empty()) { + if (result_var != StringName()) { get_blackboard()->set_var(result_var, result); } @@ -148,7 +148,7 @@ void BTEvaluateExpression::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "node", PROPERTY_HINT_RESOURCE_TYPE, "BBNode"), "set_node_param", "get_node_param"); ADD_PROPERTY(PropertyInfo(Variant::STRING, "expression_string"), "set_expression_string", "get_expression_string"); - ADD_PROPERTY(PropertyInfo(Variant::STRING, "result_var"), "set_result_var", "get_result_var"); + ADD_PROPERTY(PropertyInfo(Variant::STRING_NAME, "result_var"), "set_result_var", "get_result_var"); ADD_GROUP("Inputs", "input_"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "input_include_delta"), "set_input_include_delta", "is_input_delta_included"); ADD_PROPERTY(PropertyInfo(Variant::PACKED_STRING_ARRAY, "input_names", PROPERTY_HINT_ARRAY_TYPE, "String"), "set_input_names", "get_input_names"); diff --git a/bt/tasks/utility/bt_evaluate_expression.h b/bt/tasks/utility/bt_evaluate_expression.h index 024a8ba..36f3776 100644 --- a/bt/tasks/utility/bt_evaluate_expression.h +++ b/bt/tasks/utility/bt_evaluate_expression.h @@ -1,7 +1,7 @@ /** * bt_evaluate_expression.h * ============================================================================= - * Copyright 2021-2023 Serhii Snitsaruk + * Copyright 2021-2024 Serhii Snitsaruk * Copyright 2024 Wilson E. Alvarez * * Use of this source code is governed by an MIT-style @@ -39,7 +39,7 @@ private: TypedArray input_values; bool input_include_delta = false; Array processed_input_values; - String result_var; + StringName result_var; protected: static void _bind_methods(); @@ -66,8 +66,8 @@ public: void set_input_include_delta(bool p_input_include_delta); bool is_input_delta_included() const { return input_include_delta; } - void set_result_var(const String &p_result_var); - String get_result_var() const { return result_var; } + void set_result_var(const StringName &p_result_var); + StringName get_result_var() const { return result_var; } virtual PackedStringArray get_configuration_warnings() override; diff --git a/demo/demo/agents/tutorial/tutorial_01_welcome.tscn b/demo/demo/agents/tutorial/tutorial_01_welcome.tscn index f69aa7d..776c241 100644 --- a/demo/demo/agents/tutorial/tutorial_01_welcome.tscn +++ b/demo/demo/agents/tutorial/tutorial_01_welcome.tscn @@ -2,7 +2,7 @@ [ext_resource type="PackedScene" uid="uid://ooigbfhfy4wa" path="res://demo/agents/agent_base.tscn" id="1_2vrmp"] [ext_resource type="Texture2D" uid="uid://b0oeqsc0xksto" path="res://demo/assets/agent_junior_pieces.png" id="2_3h4dj"] -[ext_resource type="BehaviorTree" uid="uid://b1mfh8yad7rmw" path="res://demo/ai/tutorial_trees/tutorial_01_welcome.tres" id="3_ilmgw"] +[ext_resource type="BehaviorTree" uid="uid://b1mfh8yad7rmw" path="res://demo/ai/trees/tutorial/tutorial_01_welcome.tres" id="3_ilmgw"] [sub_resource type="BlackboardPlan" id="BlackboardPlan_52mdk"] var/speed/name = "speed" diff --git a/demo/demo/agents/tutorial/tutorial_02_introduction.tscn b/demo/demo/agents/tutorial/tutorial_02_introduction.tscn index 910f982..819fbf6 100644 --- a/demo/demo/agents/tutorial/tutorial_02_introduction.tscn +++ b/demo/demo/agents/tutorial/tutorial_02_introduction.tscn @@ -2,7 +2,7 @@ [ext_resource type="PackedScene" uid="uid://ooigbfhfy4wa" path="res://demo/agents/agent_base.tscn" id="1_lia2k"] [ext_resource type="Texture2D" uid="uid://b0oeqsc0xksto" path="res://demo/assets/agent_junior_pieces.png" id="2_4x2l4"] -[ext_resource type="BehaviorTree" uid="uid://b1i0xo0o676va" path="res://demo/ai/tutorial_trees/tutorial_02_introduction.tres" id="3_3esuy"] +[ext_resource type="BehaviorTree" uid="uid://b1i0xo0o676va" path="res://demo/ai/trees/tutorial/tutorial_02_introduction.tres" id="3_3esuy"] [sub_resource type="BlackboardPlan" id="BlackboardPlan_52mdk"] var/speed/name = "speed" diff --git a/demo/demo/agents/tutorial/tutorial_03_types.tscn b/demo/demo/agents/tutorial/tutorial_03_types.tscn index ccb13d3..c54cba6 100644 --- a/demo/demo/agents/tutorial/tutorial_03_types.tscn +++ b/demo/demo/agents/tutorial/tutorial_03_types.tscn @@ -2,7 +2,7 @@ [ext_resource type="PackedScene" uid="uid://ooigbfhfy4wa" path="res://demo/agents/agent_base.tscn" id="1_p8nwq"] [ext_resource type="Texture2D" uid="uid://b0oeqsc0xksto" path="res://demo/assets/agent_junior_pieces.png" id="2_hnwhw"] -[ext_resource type="BehaviorTree" uid="uid://cb0ybf24ahnc3" path="res://demo/ai/tutorial_trees/tutorial_03_types.tres" id="3_a31ka"] +[ext_resource type="BehaviorTree" uid="uid://cb0ybf24ahnc3" path="res://demo/ai/trees/tutorial/tutorial_03_types.tres" id="3_a31ka"] [sub_resource type="BlackboardPlan" id="BlackboardPlan_52mdk"] var/speed/name = "speed" diff --git a/demo/demo/agents/tutorial/tutorial_04_sequence.tscn b/demo/demo/agents/tutorial/tutorial_04_sequence.tscn index e8059c7..1044444 100644 --- a/demo/demo/agents/tutorial/tutorial_04_sequence.tscn +++ b/demo/demo/agents/tutorial/tutorial_04_sequence.tscn @@ -2,7 +2,7 @@ [ext_resource type="PackedScene" uid="uid://ooigbfhfy4wa" path="res://demo/agents/agent_base.tscn" id="1_oibr1"] [ext_resource type="Texture2D" uid="uid://b0oeqsc0xksto" path="res://demo/assets/agent_junior_pieces.png" id="2_j52yc"] -[ext_resource type="BehaviorTree" uid="uid://dln8ywvtqedt7" path="res://demo/ai/tutorial_trees/tutorial_04_sequence.tres" id="3_feewj"] +[ext_resource type="BehaviorTree" uid="uid://dln8ywvtqedt7" path="res://demo/ai/trees/tutorial/tutorial_04_sequence.tres" id="3_feewj"] [sub_resource type="BlackboardPlan" id="BlackboardPlan_52mdk"] var/speed/name = "speed" diff --git a/demo/demo/agents/tutorial/tutorial_05_selector.tscn b/demo/demo/agents/tutorial/tutorial_05_selector.tscn index 7f4f799..ee63224 100644 --- a/demo/demo/agents/tutorial/tutorial_05_selector.tscn +++ b/demo/demo/agents/tutorial/tutorial_05_selector.tscn @@ -2,7 +2,7 @@ [ext_resource type="PackedScene" uid="uid://ooigbfhfy4wa" path="res://demo/agents/agent_base.tscn" id="1_62fs7"] [ext_resource type="Texture2D" uid="uid://b0oeqsc0xksto" path="res://demo/assets/agent_junior_pieces.png" id="2_gdg2c"] -[ext_resource type="BehaviorTree" uid="uid://bf4r652fv5kwi" path="res://demo/ai/tutorial_trees/tutorial_05_selector.tres" id="3_pm5ep"] +[ext_resource type="BehaviorTree" uid="uid://bf4r652fv5kwi" path="res://demo/ai/trees/tutorial/tutorial_05_selector.tres" id="3_pm5ep"] [sub_resource type="BlackboardPlan" id="BlackboardPlan_52mdk"] var/speed/name = "speed" diff --git a/demo/demo/agents/tutorial/tutorial_06_decorators.tscn b/demo/demo/agents/tutorial/tutorial_06_decorators.tscn index b934f78..a6f4a83 100644 --- a/demo/demo/agents/tutorial/tutorial_06_decorators.tscn +++ b/demo/demo/agents/tutorial/tutorial_06_decorators.tscn @@ -2,7 +2,7 @@ [ext_resource type="PackedScene" uid="uid://ooigbfhfy4wa" path="res://demo/agents/agent_base.tscn" id="1_mbrnd"] [ext_resource type="Texture2D" uid="uid://b0oeqsc0xksto" path="res://demo/assets/agent_junior_pieces.png" id="2_ttkri"] -[ext_resource type="BehaviorTree" uid="uid://beiki511huxb8" path="res://demo/ai/tutorial_trees/tutorial_06_decorators.tres" id="3_tpgll"] +[ext_resource type="BehaviorTree" uid="uid://beiki511huxb8" path="res://demo/ai/trees/tutorial/tutorial_06_decorators.tres" id="3_tpgll"] [sub_resource type="BlackboardPlan" id="BlackboardPlan_52mdk"] var/speed/name = "speed" diff --git a/demo/demo/agents/tutorial/tutorial_07_more_decorators.tscn b/demo/demo/agents/tutorial/tutorial_07_more_decorators.tscn index 354f8be..943a8b2 100644 --- a/demo/demo/agents/tutorial/tutorial_07_more_decorators.tscn +++ b/demo/demo/agents/tutorial/tutorial_07_more_decorators.tscn @@ -2,7 +2,7 @@ [ext_resource type="PackedScene" uid="uid://ooigbfhfy4wa" path="res://demo/agents/agent_base.tscn" id="1_k4qfc"] [ext_resource type="Texture2D" uid="uid://b0oeqsc0xksto" path="res://demo/assets/agent_junior_pieces.png" id="2_q4r1n"] -[ext_resource type="BehaviorTree" uid="uid://tep50j4d6kgp" path="res://demo/ai/tutorial_trees/tutorial_07_more_decorators.tres" id="3_ta3g6"] +[ext_resource type="BehaviorTree" uid="uid://tep50j4d6kgp" path="res://demo/ai/trees/tutorial/tutorial_07_more_decorators.tres" id="3_ta3g6"] [sub_resource type="BlackboardPlan" id="BlackboardPlan_52mdk"] var/speed/name = "speed" diff --git a/demo/demo/agents/tutorial/tutorial_08_final_touch.tscn b/demo/demo/agents/tutorial/tutorial_08_final_touch.tscn index 0817df7..7bae088 100644 --- a/demo/demo/agents/tutorial/tutorial_08_final_touch.tscn +++ b/demo/demo/agents/tutorial/tutorial_08_final_touch.tscn @@ -2,7 +2,7 @@ [ext_resource type="PackedScene" uid="uid://ooigbfhfy4wa" path="res://demo/agents/agent_base.tscn" id="1_bjdsc"] [ext_resource type="Texture2D" uid="uid://b0oeqsc0xksto" path="res://demo/assets/agent_junior_pieces.png" id="2_onjfd"] -[ext_resource type="BehaviorTree" uid="uid://dp0cglcytwcj5" path="res://demo/ai/tutorial_trees/tutorial_08_final_touch.tres" id="3_c5qx4"] +[ext_resource type="BehaviorTree" uid="uid://dp0cglcytwcj5" path="res://demo/ai/trees/tutorial/tutorial_08_final_touch.tres" id="3_c5qx4"] [sub_resource type="BlackboardPlan" id="BlackboardPlan_52mdk"] var/speed/name = "speed" diff --git a/demo/demo/ai/tasks/arrive_pos.gd b/demo/demo/ai/tasks/arrive_pos.gd index 0cd016c..0c266cb 100644 --- a/demo/demo/ai/tasks/arrive_pos.gd +++ b/demo/demo/ai/tasks/arrive_pos.gd @@ -15,17 +15,17 @@ extends BTAction ## otherwise returns RUNNING. ## Blackboard variable that stores the target position (Vector2) -@export var target_position_var := "pos" +@export var target_position_var := &"pos" ## Variable that stores desired speed (float) -@export var speed_var := "speed" +@export var speed_var := &"speed" ## How close should the agent be to the target position to return SUCCESS. @export var tolerance := 50.0 ## Specifies the node to avoid (valid Node2D is expected). ## If not empty, agent will circle around the node while moving into position. -@export var avoid_var: String +@export var avoid_var: StringName func _generate_name() -> String: diff --git a/demo/demo/ai/tasks/back_away.gd b/demo/demo/ai/tasks/back_away.gd index d0d1a08..1bab356 100644 --- a/demo/demo/ai/tasks/back_away.gd +++ b/demo/demo/ai/tasks/back_away.gd @@ -14,7 +14,7 @@ extends BTAction ## Returns RUNNING always. ## Blackboard variable that stores desired speed. -@export var speed_var: String = "speed" +@export var speed_var: StringName = &"speed" ## How much can we deviate from the "away" direction (in radians). @export var max_angle_deviation: float = 0.7 diff --git a/demo/demo/ai/tasks/face_target.gd b/demo/demo/ai/tasks/face_target.gd index a1f69a2..86551b8 100644 --- a/demo/demo/ai/tasks/face_target.gd +++ b/demo/demo/ai/tasks/face_target.gd @@ -14,7 +14,7 @@ extends BTAction ## Returns FAILURE if target is not a valid Node2D instance. ## Blackboard variable that stores our target (expecting Node2D). -@export var target_var: String = "target" +@export var target_var: StringName = &"target" # Display a customized name (requires @tool). func _generate_name() -> String: diff --git a/demo/demo/ai/tasks/get_first_in_group.gd b/demo/demo/ai/tasks/get_first_in_group.gd index d4e17bc..6d2ed59 100644 --- a/demo/demo/ai/tasks/get_first_in_group.gd +++ b/demo/demo/ai/tasks/get_first_in_group.gd @@ -17,7 +17,7 @@ extends BTAction @export var group: StringName ## Blackboard variable in which the task will store the acquired node. -@export var output_var: String = "target" +@export var output_var: StringName = &"target" func _generate_name() -> String: diff --git a/demo/demo/ai/tasks/in_range.gd b/demo/demo/ai/tasks/in_range.gd index 0a9f106..c6a6a30 100644 --- a/demo/demo/ai/tasks/in_range.gd +++ b/demo/demo/ai/tasks/in_range.gd @@ -23,7 +23,7 @@ extends BTCondition @export var distance_max: float ## Blackboard variable that holds the target (expecting Node2D). -@export var target_var := "target" +@export var target_var: StringName = &"target" var _min_distance_squared: float var _max_distance_squared: float diff --git a/demo/demo/ai/tasks/is_aligned_with_target.gd b/demo/demo/ai/tasks/is_aligned_with_target.gd index c8c4e3d..8bbbcf5 100644 --- a/demo/demo/ai/tasks/is_aligned_with_target.gd +++ b/demo/demo/ai/tasks/is_aligned_with_target.gd @@ -15,7 +15,7 @@ extends BTCondition ## Returns FAILURE if not aligned or if target is not a valid node instance. -@export var target_var: String = "target" +@export var target_var: StringName = &"target" @export var tolerance: float = 30.0 diff --git a/demo/demo/ai/tasks/move_forward.gd b/demo/demo/ai/tasks/move_forward.gd index fe923cc..47c8a65 100644 --- a/demo/demo/ai/tasks/move_forward.gd +++ b/demo/demo/ai/tasks/move_forward.gd @@ -15,7 +15,7 @@ extends BTAction ## Returns RUNNING if elapsed time didn't exceed duration. ## Blackboard variable that stores desired speed. -@export var speed_var: String = "speed" +@export var speed_var: StringName = &"speed" ## How long to perform this task (in seconds). @export var duration: float = 0.1 diff --git a/demo/demo/ai/tasks/pursue.gd b/demo/demo/ai/tasks/pursue.gd index ac050d5..d3062ae 100644 --- a/demo/demo/ai/tasks/pursue.gd +++ b/demo/demo/ai/tasks/pursue.gd @@ -20,10 +20,10 @@ extends BTAction const TOLERANCE := 30.0 ## Blackboard variable that stores our target (expecting Node2D). -@export var target_var: String = "target" +@export var target_var: StringName = &"target" ## Blackboard variable that stores desired speed. -@export var speed_var: String = "speed" +@export var speed_var: StringName = &"speed" ## Desired distance from target. @export var approach_distance: float = 100.0 diff --git a/demo/demo/ai/tasks/select_flanking_pos.gd b/demo/demo/ai/tasks/select_flanking_pos.gd index 204fe68..1f54871 100644 --- a/demo/demo/ai/tasks/select_flanking_pos.gd +++ b/demo/demo/ai/tasks/select_flanking_pos.gd @@ -21,7 +21,7 @@ enum AgentSide { } ## Blackboard variable that holds current target (should be a Node2D instance). -@export var target_var: String = "target" +@export var target_var: StringName = &"target" ## Which agent's side should we flank? @export var flank_side: AgentSide = AgentSide.CLOSEST @@ -33,7 +33,7 @@ enum AgentSide { @export var range_max: int = 400 ## Blackboard variable that will be used to store selected position. -@export var position_var: String = "pos" +@export var position_var: StringName = &"pos" # Display a customized name (requires @tool). diff --git a/demo/demo/ai/tasks/select_random_nearby_pos.gd b/demo/demo/ai/tasks/select_random_nearby_pos.gd index 8dd792c..0b0e38f 100644 --- a/demo/demo/ai/tasks/select_random_nearby_pos.gd +++ b/demo/demo/ai/tasks/select_random_nearby_pos.gd @@ -10,7 +10,7 @@ extends BTAction @export var range_max: float = 500.0 ## Blackboard variable that will be used to store the desired position. -@export var position_var: String = "pos" +@export var position_var: StringName = &"pos" # Display a customized name (requires @tool). diff --git a/demo/demo/ai/trees/01_agent_melee_simple.tres b/demo/demo/ai/trees/01_agent_melee_simple.tres index d746640..b4430f6 100644 --- a/demo/demo/ai/trees/01_agent_melee_simple.tres +++ b/demo/demo/ai/trees/01_agent_melee_simple.tres @@ -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 @@ -40,12 +40,12 @@ blend = 0.1 [sub_resource type="BTAction" id="BTAction_ulbrf"] script = ExtResource("1_2jpsu") group = &"player" -output_var = "target" +output_var = &"target" [sub_resource type="BTAction" id="BTAction_a4jqi"] script = ExtResource("2_h5db5") -target_var = "target" -speed_var = "speed" +target_var = &"target" +speed_var = &"speed" approach_distance = 100.0 [sub_resource type="BTTimeLimit" id="BTTimeLimit_xek5v"] @@ -58,7 +58,7 @@ children = [SubResource("BTPlayAnimation_olf37"), SubResource("BTAction_ulbrf"), [sub_resource type="BTAction" id="BTAction_kidxn"] script = ExtResource("3_bpmfp") -target_var = "target" +target_var = &"target" [sub_resource type="BTWait" id="BTWait_tadkc"] duration = 0.1 diff --git a/demo/demo/ai/trees/02_agent_charger.tres b/demo/demo/ai/trees/02_agent_charger.tres index f05e03e..85e2534 100644 --- a/demo/demo/ai/trees/02_agent_charger.tres +++ b/demo/demo/ai/trees/02_agent_charger.tres @@ -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 @@ -37,15 +37,15 @@ children = [SubResource("BTPlayAnimation_ha2ag"), SubResource("BTRandomWait_cedq [sub_resource type="BTAction" id="BTAction_pp23y"] script = ExtResource("1_657p6") group = &"player" -output_var = "target" +output_var = &"target" [sub_resource type="BTAction" id="BTAction_pmvd0"] script = ExtResource("2_t3udh") -target_var = "target" +target_var = &"target" flank_side = 0 range_min = 500 range_max = 600 -position_var = "flank_pos" +position_var = &"flank_pos" [sub_resource type="BBNode" id="BBNode_xh3wr"] resource_name = "AnimationPlayer" @@ -58,10 +58,10 @@ blend = 0.1 [sub_resource type="BTAction" id="BTAction_87mi0"] script = ExtResource("3_u2ra5") -target_position_var = "flank_pos" -speed_var = "speed" +target_position_var = &"flank_pos" +speed_var = &"speed" tolerance = 50.0 -avoid_var = "" +avoid_var = &"" [sub_resource type="BTTimeLimit" id="BTTimeLimit_is5ag"] children = [SubResource("BTAction_87mi0")] @@ -73,7 +73,7 @@ children = [SubResource("BTAction_pp23y"), SubResource("BTAction_pmvd0"), SubRes [sub_resource type="BTAction" id="BTAction_q5g4a"] script = ExtResource("4_xwjl7") -target_var = "target" +target_var = &"target" [sub_resource type="BBNode" id="BBNode_bfijg"] resource_name = "AnimationPlayer" @@ -103,7 +103,7 @@ blend = 0.05 [sub_resource type="BTAction" id="BTAction_o18uk"] script = ExtResource("5_ucvak") -speed_var = "charge_speed" +speed_var = &"charge_speed" duration = 1.5 [sub_resource type="BTSequence" id="BTSequence_8lur1"] diff --git a/demo/demo/ai/trees/03_agent_imp.tres b/demo/demo/ai/trees/03_agent_imp.tres index 22215d7..b56832a 100644 --- a/demo/demo/ai/trees/03_agent_imp.tres +++ b/demo/demo/ai/trees/03_agent_imp.tres @@ -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 @@ -26,14 +26,14 @@ blend = 0.1 script = ExtResource("1_cdtqu") range_min = 200.0 range_max = 500.0 -position_var = "pos" +position_var = &"pos" [sub_resource type="BTAction" id="BTAction_5kivl"] script = ExtResource("2_31fsn") -target_position_var = "pos" -speed_var = "speed" +target_position_var = &"pos" +speed_var = &"speed" tolerance = 50.0 -avoid_var = "" +avoid_var = &"" [sub_resource type="BTSequence" id="BTSequence_k184c"] custom_name = "Chaotic Walk" @@ -71,12 +71,12 @@ blend = 0.1 [sub_resource type="BTAction" id="BTAction_ulbrf"] script = ExtResource("3_y1r1a") group = &"player" -output_var = "target" +output_var = &"target" [sub_resource type="BTAction" id="BTAction_a4jqi"] script = ExtResource("4_jlgat") -target_var = "target" -speed_var = "speed" +target_var = &"target" +speed_var = &"speed" approach_distance = 100.0 [sub_resource type="BTTimeLimit" id="BTTimeLimit_xek5v"] @@ -89,7 +89,7 @@ children = [SubResource("BTPlayAnimation_olf37"), SubResource("BTAction_ulbrf"), [sub_resource type="BTAction" id="BTAction_kidxn"] script = ExtResource("5_o4ggh") -target_var = "target" +target_var = &"target" [sub_resource type="BTWait" id="BTWait_tadkc"] duration = 0.1 diff --git a/demo/demo/ai/trees/04_agent_skirmisher.tres b/demo/demo/ai/trees/04_agent_skirmisher.tres index 24d8625..49af249 100644 --- a/demo/demo/ai/trees/04_agent_skirmisher.tres +++ b/demo/demo/ai/trees/04_agent_skirmisher.tres @@ -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 @@ -28,7 +28,7 @@ var/slow_speed/hint_string = "10,1000,10" [sub_resource type="BTAction" id="BTAction_ulbrf"] script = ExtResource("1_2883n") group = &"player" -output_var = "target" +output_var = &"target" [sub_resource type="BBNode" id="BBNode_nrd4b"] resource_name = "AnimationPlayer" @@ -54,7 +54,7 @@ children = [SubResource("BTSequence_yhjh1")] script = ExtResource("5_p5dih") distance_min = 0.0 distance_max = 300.0 -target_var = "target" +target_var = &"target" [sub_resource type="BBNode" id="BBNode_7c0g0"] resource_name = "AnimationPlayer" @@ -68,8 +68,8 @@ speed = 1.2 [sub_resource type="BTAction" id="BTAction_jryg6"] script = ExtResource("2_lpckh") -target_var = "target" -speed_var = "speed" +target_var = &"target" +speed_var = &"speed" approach_distance = 100.0 [sub_resource type="BTTimeLimit" id="BTTimeLimit_lkphr"] @@ -78,7 +78,7 @@ time_limit = 1.0 [sub_resource type="BTAction" id="BTAction_kidxn"] script = ExtResource("4_57x51") -target_var = "target" +target_var = &"target" [sub_resource type="BTWait" id="BTWait_tadkc"] duration = 0.2 @@ -107,7 +107,7 @@ duration = 2.0 script = ExtResource("5_p5dih") distance_min = 0.0 distance_max = 300.0 -target_var = "target" +target_var = &"target" [sub_resource type="BBNode" id="BBNode_3iqcf"] resource_name = "AnimationPlayer" @@ -121,7 +121,7 @@ speed = -0.7 [sub_resource type="BTAction" id="BTAction_4ye2y"] script = ExtResource("6_fkv0k") -speed_var = "slow_speed" +speed_var = &"slow_speed" max_angle_deviation = 0.7 [sub_resource type="BTTimeLimit" id="BTTimeLimit_cns1i"] @@ -158,18 +158,18 @@ speed = 1.2 [sub_resource type="BTAction" id="BTAction_g5ayy"] script = ExtResource("2_cjso2") -target_var = "target" +target_var = &"target" flank_side = 2 range_min = 90 range_max = 90 -position_var = "flank_pos" +position_var = &"flank_pos" [sub_resource type="BTAction" id="BTAction_tv4lt"] script = ExtResource("3_treio") -target_position_var = "flank_pos" -speed_var = "fast_speed" +target_position_var = &"flank_pos" +speed_var = &"fast_speed" tolerance = 50.0 -avoid_var = "target" +avoid_var = &"target" [sub_resource type="BTTimeLimit" id="BTTimeLimit_xek5v"] children = [SubResource("BTAction_tv4lt")] diff --git a/demo/demo/ai/trees/05_agent_ranged.tres b/demo/demo/ai/trees/05_agent_ranged.tres index 8333a7c..a17d9ab 100644 --- a/demo/demo/ai/trees/05_agent_ranged.tres +++ b/demo/demo/ai/trees/05_agent_ranged.tres @@ -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 @@ -34,7 +34,7 @@ max_duration = 1.5 [sub_resource type="BTAction" id="BTAction_c4cxo"] script = ExtResource("1_4xk1i") group = &"player" -output_var = "target" +output_var = &"target" [sub_resource type="BTSequence" id="BTSequence_yhjh1"] custom_name = "Take a break" @@ -52,18 +52,18 @@ speed = 1.5 [sub_resource type="BTAction" id="BTAction_op6l6"] script = ExtResource("4_53hao") -target_var = "target" +target_var = &"target" flank_side = 1 range_min = 400 range_max = 1000 -position_var = "pos" +position_var = &"pos" [sub_resource type="BTAction" id="BTAction_ycjun"] script = ExtResource("3_q4r2p") -target_position_var = "pos" -speed_var = "run_speed" +target_position_var = &"pos" +speed_var = &"run_speed" tolerance = 50.0 -avoid_var = "target" +avoid_var = &"target" [sub_resource type="BTTimeLimit" id="BTTimeLimit_gadc6"] children = [SubResource("BTAction_ycjun")] @@ -71,7 +71,7 @@ time_limit = 7.0 [sub_resource type="BTAction" id="BTAction_poqpu"] script = ExtResource("5_aexyq") -target_var = "target" +target_var = &"target" [sub_resource type="BTSequence" id="BTSequence_0gdqn"] custom_name = "Change flank" @@ -87,11 +87,11 @@ run_chance = 0.3 [sub_resource type="BTAction" id="BTAction_kuuw2"] script = ExtResource("4_53hao") -target_var = "target" +target_var = &"target" flank_side = 0 range_min = 400 range_max = 1000 -position_var = "shoot_pos" +position_var = &"shoot_pos" [sub_resource type="BBNode" id="BBNode_kc64r"] resource_name = "AnimationPlayer" @@ -104,21 +104,21 @@ blend = 0.1 [sub_resource type="BTAction" id="BTAction_66hsk"] script = ExtResource("3_q4r2p") -target_position_var = "shoot_pos" -speed_var = "speed" +target_position_var = &"shoot_pos" +speed_var = &"speed" tolerance = 50.0 -avoid_var = "" +avoid_var = &"" [sub_resource type="BTTimeLimit" id="BTTimeLimit_24ath"] children = [SubResource("BTAction_66hsk")] [sub_resource type="BTAction" id="BTAction_enw2m"] script = ExtResource("5_aexyq") -target_var = "target" +target_var = &"target" [sub_resource type="BTCondition" id="BTCondition_1fnyc"] script = ExtResource("2_a8qex") -target_var = "target" +target_var = &"target" tolerance = 150.0 [sub_resource type="BBNode" id="BBNode_s6vt4"] diff --git a/demo/demo/ai/trees/06_agent_melee_combo.tres b/demo/demo/ai/trees/06_agent_melee_combo.tres index c939ea4..9f7d5c5 100644 --- a/demo/demo/ai/trees/06_agent_melee_combo.tres +++ b/demo/demo/ai/trees/06_agent_melee_combo.tres @@ -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 @@ -34,7 +34,7 @@ max_duration = 1.5 [sub_resource type="BTAction" id="BTAction_ulbrf"] script = ExtResource("1_sf4l8") group = &"player" -output_var = "target" +output_var = &"target" [sub_resource type="BTSequence" id="BTSequence_yhjh1"] custom_name = "Pause before action" @@ -42,11 +42,11 @@ children = [SubResource("BTPlayAnimation_qiw21"), SubResource("BTRandomWait_xlud [sub_resource type="BTAction" id="BTAction_85keo"] script = ExtResource("2_5nwkp") -target_var = "target" +target_var = &"target" flank_side = 0 range_min = 300 range_max = 400 -position_var = "pos" +position_var = &"pos" [sub_resource type="BBNode" id="BBNode_wpj6d"] resource_name = "AnimationPlayer" @@ -59,10 +59,10 @@ blend = 0.1 [sub_resource type="BTAction" id="BTAction_ygjnc"] script = ExtResource("3_3tom2") -target_position_var = "pos" -speed_var = "speed" +target_position_var = &"pos" +speed_var = &"speed" tolerance = 50.0 -avoid_var = "" +avoid_var = &"" [sub_resource type="BTTimeLimit" id="BTTimeLimit_xek5v"] children = [SubResource("BTAction_ygjnc")] @@ -73,7 +73,7 @@ children = [SubResource("BTAction_85keo"), SubResource("BTPlayAnimation_olf37"), [sub_resource type="BTAction" id="BTAction_kidxn"] script = ExtResource("4_hi228") -target_var = "target" +target_var = &"target" [sub_resource type="BBNode" id="BBNode_giv5l"] resource_name = "AnimationPlayer" @@ -98,7 +98,7 @@ animation_name = &"attack_1" [sub_resource type="BTAction" id="BTAction_u22bc"] script = ExtResource("5_au5yc") -speed_var = "charge_speed" +speed_var = &"charge_speed" duration = 0.1 [sub_resource type="BTParallel" id="BTParallel_ec2e3"] @@ -119,7 +119,7 @@ animation_name = &"attack_2" [sub_resource type="BTAction" id="BTAction_yuxl3"] script = ExtResource("5_au5yc") -speed_var = "charge_speed" +speed_var = &"charge_speed" duration = 0.1 [sub_resource type="BTParallel" id="BTParallel_thojy"] @@ -140,7 +140,7 @@ animation_name = &"attack_3" [sub_resource type="BTAction" id="BTAction_rwp18"] script = ExtResource("5_au5yc") -speed_var = "charge_speed" +speed_var = &"charge_speed" duration = 0.1 [sub_resource type="BTParallel" id="BTParallel_qmdfb"] diff --git a/demo/demo/ai/trees/07_agent_melee_nuanced.tres b/demo/demo/ai/trees/07_agent_melee_nuanced.tres index ff7b80e..58c7ddc 100644 --- a/demo/demo/ai/trees/07_agent_melee_nuanced.tres +++ b/demo/demo/ai/trees/07_agent_melee_nuanced.tres @@ -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 @@ -34,7 +34,7 @@ max_duration = 1.5 [sub_resource type="BTAction" id="BTAction_c4cxo"] script = ExtResource("1_08fik") group = &"player" -output_var = "target" +output_var = &"target" [sub_resource type="BTSequence" id="BTSequence_yhjh1"] custom_name = "Pause before action" @@ -52,25 +52,25 @@ speed = 1.5 [sub_resource type="BTAction" id="BTAction_6e48s"] script = ExtResource("2_te3yo") -target_var = "target" +target_var = &"target" flank_side = 1 range_min = 400 range_max = 600 -position_var = "flank_pos" +position_var = &"flank_pos" [sub_resource type="BTAction" id="BTAction_66hsk"] script = ExtResource("3_svwk8") -target_position_var = "flank_pos" -speed_var = "flank_speed" +target_position_var = &"flank_pos" +speed_var = &"flank_speed" tolerance = 50.0 -avoid_var = "target" +avoid_var = &"target" [sub_resource type="BTTimeLimit" id="BTTimeLimit_24ath"] children = [SubResource("BTAction_66hsk")] [sub_resource type="BTAction" id="BTAction_enw2m"] script = ExtResource("4_mvsyw") -target_var = "target" +target_var = &"target" [sub_resource type="BTSequence" id="BTSequence_lhg7f"] custom_name = "Flank player" @@ -93,8 +93,8 @@ blend = 0.1 [sub_resource type="BTAction" id="BTAction_a4jqi"] script = ExtResource("5_r1ou0") -target_var = "target" -speed_var = "speed" +target_var = &"target" +speed_var = &"speed" approach_distance = 100.0 [sub_resource type="BTTimeLimit" id="BTTimeLimit_xek5v"] @@ -103,7 +103,7 @@ time_limit = 2.0 [sub_resource type="BTAction" id="BTAction_kidxn"] script = ExtResource("4_mvsyw") -target_var = "target" +target_var = &"target" [sub_resource type="BTWait" id="BTWait_tadkc"] duration = 0.1 @@ -136,11 +136,11 @@ metadata/_weight_ = 4.0 [sub_resource type="BTAction" id="BTAction_mf87t"] script = ExtResource("2_te3yo") -target_var = "target" +target_var = &"target" flank_side = 0 range_min = 350 range_max = 600 -position_var = "pos" +position_var = &"pos" [sub_resource type="BBNode" id="BBNode_cx111"] resource_name = "AnimationPlayer" @@ -153,10 +153,10 @@ blend = 0.1 [sub_resource type="BTAction" id="BTAction_6nx58"] script = ExtResource("3_svwk8") -target_position_var = "pos" -speed_var = "speed" +target_position_var = &"pos" +speed_var = &"speed" tolerance = 50.0 -avoid_var = "" +avoid_var = &"" [sub_resource type="BTTimeLimit" id="BTTimeLimit_tidwl"] children = [SubResource("BTAction_6nx58")] @@ -164,7 +164,7 @@ time_limit = 3.0 [sub_resource type="BTAction" id="BTAction_8q20y"] script = ExtResource("4_mvsyw") -target_var = "target" +target_var = &"target" [sub_resource type="BBNode" id="BBNode_s6vt4"] resource_name = "AnimationPlayer" diff --git a/demo/demo/ai/trees/08_agent_demon.tres b/demo/demo/ai/trees/08_agent_demon.tres index 9825e5f..3333fe8 100644 --- a/demo/demo/ai/trees/08_agent_demon.tres +++ b/demo/demo/ai/trees/08_agent_demon.tres @@ -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 @@ -38,17 +38,17 @@ trigger_on_failure = true [sub_resource type="BTAction" id="BTAction_ohfp7"] script = ExtResource("1_ce4la") group = &"player" -output_var = "target" +output_var = &"target" [sub_resource type="BTCondition" id="BTCondition_7a5nv"] script = ExtResource("2_atyuj") distance_min = 0.0 distance_max = 150.0 -target_var = "target" +target_var = &"target" [sub_resource type="BTAction" id="BTAction_ddvrs"] script = ExtResource("3_3mw7l") -target_var = "target" +target_var = &"target" [sub_resource type="BBNode" id="BBNode_c4nfu"] resource_name = "AnimationPlayer" @@ -72,11 +72,11 @@ children = [SubResource("BTAction_ohfp7"), SubResource("BTCondition_7a5nv"), Sub script = ExtResource("2_atyuj") distance_min = 0.0 distance_max = 300.0 -target_var = "target" +target_var = &"target" [sub_resource type="BTAction" id="BTAction_wpt7j"] script = ExtResource("3_3mw7l") -target_var = "target" +target_var = &"target" [sub_resource type="BBNode" id="BBNode_iv62h"] resource_name = "AnimationPlayer" @@ -90,7 +90,7 @@ speed = -1.0 [sub_resource type="BTAction" id="BTAction_h2efl"] script = ExtResource("4_6dr32") -speed_var = "speed" +speed_var = &"speed" max_angle_deviation = 0.7 [sub_resource type="BTTimeLimit" id="BTTimeLimit_wm5g2"] @@ -115,18 +115,18 @@ blend = 0.1 [sub_resource type="BTAction" id="BTAction_4mmh0"] script = ExtResource("5_dho0d") -target_var = "target" +target_var = &"target" flank_side = 0 range_min = 300 range_max = 700 -position_var = "pos" +position_var = &"pos" [sub_resource type="BTAction" id="BTAction_vb5c3"] script = ExtResource("6_0pfsl") -target_position_var = "pos" -speed_var = "speed" +target_position_var = &"pos" +speed_var = &"speed" tolerance = 50.0 -avoid_var = "" +avoid_var = &"" [sub_resource type="BTTimeLimit" id="BTTimeLimit_jyks2"] children = [SubResource("BTAction_vb5c3")] @@ -136,7 +136,7 @@ custom_name = "Short break before action" [sub_resource type="BTAction" id="BTAction_fkevy"] script = ExtResource("3_3mw7l") -target_var = "target" +target_var = &"target" [sub_resource type="BBNode" id="BBNode_lh25u"] resource_name = "AnimationPlayer" diff --git a/demo/demo/ai/trees/09_agent_summoner.tres b/demo/demo/ai/trees/09_agent_summoner.tres index 199a70d..6ab0a17 100644 --- a/demo/demo/ai/trees/09_agent_summoner.tres +++ b/demo/demo/ai/trees/09_agent_summoner.tres @@ -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"] @@ -72,12 +72,12 @@ duration = 0.5 script = ExtResource("1_sgn0p") range_min = 300.0 range_max = 500.0 -position_var = "minion_pos" +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"] @@ -104,7 +104,7 @@ children = [SubResource("BTCheckAgentProperty_olmdj"), SubResource("BTCheckVar_h script = ExtResource("1_sgn0p") range_min = 300.0 range_max = 700.0 -position_var = "pos" +position_var = &"pos" [sub_resource type="BBNode" id="BBNode_w5fh2"] resource_name = "AnimationPlayer" @@ -117,10 +117,10 @@ blend = 0.1 [sub_resource type="BTAction" id="BTAction_dfifw"] script = ExtResource("2_pshl2") -target_position_var = "pos" -speed_var = "speed" +target_position_var = &"pos" +speed_var = &"speed" tolerance = 50.0 -avoid_var = "" +avoid_var = &"" [sub_resource type="BTTimeLimit" id="BTTimeLimit_i05cm"] children = [SubResource("BTAction_dfifw")] diff --git a/demo/demo/ai/tutorial_trees/tutorial_01_welcome.tres b/demo/demo/ai/trees/tutorial/tutorial_01_welcome.tres similarity index 97% rename from demo/demo/ai/tutorial_trees/tutorial_01_welcome.tres rename to demo/demo/ai/trees/tutorial/tutorial_01_welcome.tres index 1e4a849..84f1d04 100644 --- a/demo/demo/ai/tutorial_trees/tutorial_01_welcome.tres +++ b/demo/demo/ai/trees/tutorial/tutorial_01_welcome.tres @@ -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") diff --git a/demo/demo/ai/tutorial_trees/tutorial_02_introduction.tres b/demo/demo/ai/trees/tutorial/tutorial_02_introduction.tres similarity index 97% rename from demo/demo/ai/tutorial_trees/tutorial_02_introduction.tres rename to demo/demo/ai/trees/tutorial/tutorial_02_introduction.tres index a8d5f40..985582b 100644 --- a/demo/demo/ai/tutorial_trees/tutorial_02_introduction.tres +++ b/demo/demo/ai/trees/tutorial/tutorial_02_introduction.tres @@ -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") diff --git a/demo/demo/ai/tutorial_trees/tutorial_03_types.tres b/demo/demo/ai/trees/tutorial/tutorial_03_types.tres similarity index 99% rename from demo/demo/ai/tutorial_trees/tutorial_03_types.tres rename to demo/demo/ai/trees/tutorial/tutorial_03_types.tres index b25c02d..6450d0e 100644 --- a/demo/demo/ai/tutorial_trees/tutorial_03_types.tres +++ b/demo/demo/ai/trees/tutorial/tutorial_03_types.tres @@ -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") diff --git a/demo/demo/ai/tutorial_trees/tutorial_04_sequence.tres b/demo/demo/ai/trees/tutorial/tutorial_04_sequence.tres similarity index 99% rename from demo/demo/ai/tutorial_trees/tutorial_04_sequence.tres rename to demo/demo/ai/trees/tutorial/tutorial_04_sequence.tres index 232a7a2..ea62214 100644 --- a/demo/demo/ai/tutorial_trees/tutorial_04_sequence.tres +++ b/demo/demo/ai/trees/tutorial/tutorial_04_sequence.tres @@ -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") diff --git a/demo/demo/ai/tutorial_trees/tutorial_05_selector.tres b/demo/demo/ai/trees/tutorial/tutorial_05_selector.tres similarity index 99% rename from demo/demo/ai/tutorial_trees/tutorial_05_selector.tres rename to demo/demo/ai/trees/tutorial/tutorial_05_selector.tres index 25a6a1b..52c494a 100644 --- a/demo/demo/ai/tutorial_trees/tutorial_05_selector.tres +++ b/demo/demo/ai/trees/tutorial/tutorial_05_selector.tres @@ -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") diff --git a/demo/demo/ai/tutorial_trees/tutorial_06_decorators.tres b/demo/demo/ai/trees/tutorial/tutorial_06_decorators.tres similarity index 99% rename from demo/demo/ai/tutorial_trees/tutorial_06_decorators.tres rename to demo/demo/ai/trees/tutorial/tutorial_06_decorators.tres index bac3d83..1b4f820 100644 --- a/demo/demo/ai/tutorial_trees/tutorial_06_decorators.tres +++ b/demo/demo/ai/trees/tutorial/tutorial_06_decorators.tres @@ -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") diff --git a/demo/demo/ai/tutorial_trees/tutorial_07_more_decorators.tres b/demo/demo/ai/trees/tutorial/tutorial_07_more_decorators.tres similarity index 99% rename from demo/demo/ai/tutorial_trees/tutorial_07_more_decorators.tres rename to demo/demo/ai/trees/tutorial/tutorial_07_more_decorators.tres index d186a82..abd8ad9 100644 --- a/demo/demo/ai/tutorial_trees/tutorial_07_more_decorators.tres +++ b/demo/demo/ai/trees/tutorial/tutorial_07_more_decorators.tres @@ -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") diff --git a/demo/demo/ai/tutorial_trees/tutorial_08_final_touch.tres b/demo/demo/ai/trees/tutorial/tutorial_08_final_touch.tres similarity index 99% rename from demo/demo/ai/tutorial_trees/tutorial_08_final_touch.tres rename to demo/demo/ai/trees/tutorial/tutorial_08_final_touch.tres index 07d251c..23b0fad 100644 --- a/demo/demo/ai/tutorial_trees/tutorial_08_final_touch.tres +++ b/demo/demo/ai/trees/tutorial/tutorial_08_final_touch.tres @@ -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") diff --git a/doc/source/classes/class_bbparam.rst b/doc/source/classes/class_bbparam.rst index 04ba624..b9c3f04 100644 --- a/doc/source/classes/class_bbparam.rst +++ b/doc/source/classes/class_bbparam.rst @@ -38,7 +38,7 @@ Properties +----------------------------------------------+----------------------------------------------------------+----------+ | :ref:`ValueSource` | :ref:`value_source` | ``0`` | +----------------------------------------------+----------------------------------------------------------+----------+ - | String | :ref:`variable` | | + | StringName | :ref:`variable` | | +----------------------------------------------+----------------------------------------------------------+----------+ .. rst-class:: classref-reftable-group @@ -133,12 +133,12 @@ Specifies the source of the value for BBParam. See :ref:`ValueSource` variable when :ref:`value_source` is set to :ref:`BLACKBOARD_VAR`. diff --git a/doc/source/classes/class_blackboard.rst b/doc/source/classes/class_blackboard.rst index c9c2358..c026a54 100644 --- a/doc/source/classes/class_blackboard.rst +++ b/doc/source/classes/class_blackboard.rst @@ -33,27 +33,27 @@ Methods .. table:: :widths: auto - +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+ - | void | :ref:`bind_var_to_property` **(** String p_name, Object p_object, StringName p_property **)** | - +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+ - | void | :ref:`erase_var` **(** String p_name **)** | - +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+ - | :ref:`Blackboard` | :ref:`get_parent` **(** **)** |const| | - +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+ - | Variant | :ref:`get_var` **(** String p_name, Variant p_default=null, bool p_complain=true **)** |const| | - +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+ - | bool | :ref:`has_var` **(** String p_name **)** |const| | - +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+ - | void | :ref:`prefetch_nodepath_vars` **(** Node p_node **)** | - +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+ - | void | :ref:`set_parent` **(** :ref:`Blackboard` p_blackboard **)** | - +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+ - | void | :ref:`set_var` **(** String p_name, Variant p_value **)** | - +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+ - | :ref:`Blackboard` | :ref:`top` **(** **)** |const| | - +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+ - | void | :ref:`unbind_var` **(** String p_name **)** | - +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+ + +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+ + | void | :ref:`bind_var_to_property` **(** StringName p_name, Object p_object, StringName p_property **)** | + +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+ + | void | :ref:`erase_var` **(** StringName p_name **)** | + +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`Blackboard` | :ref:`get_parent` **(** **)** |const| | + +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+ + | Variant | :ref:`get_var` **(** StringName p_name, Variant p_default=null, bool p_complain=true **)** |const| | + +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+ + | bool | :ref:`has_var` **(** StringName p_name **)** |const| | + +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+ + | void | :ref:`prefetch_nodepath_vars` **(** Node p_node **)** | + +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+ + | void | :ref:`set_parent` **(** :ref:`Blackboard` p_blackboard **)** | + +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+ + | void | :ref:`set_var` **(** StringName p_name, Variant p_value **)** | + +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`Blackboard` | :ref:`top` **(** **)** |const| | + +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+ + | void | :ref:`unbind_var` **(** StringName p_name **)** | + +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+ .. rst-class:: classref-section-separator @@ -68,7 +68,7 @@ Method Descriptions .. rst-class:: classref-method -void **bind_var_to_property** **(** String p_name, Object p_object, StringName p_property **)** +void **bind_var_to_property** **(** StringName p_name, Object p_object, StringName p_property **)** Establish a binding between a variable and the object's property specified by ``p_property`` and ``p_object``. Changes to the variable update the property, and vice versa. @@ -80,7 +80,7 @@ Establish a binding between a variable and the object's property specified by `` .. rst-class:: classref-method -void **erase_var** **(** String p_name **)** +void **erase_var** **(** StringName p_name **)** Removes a variable by its name. @@ -104,7 +104,7 @@ Returns a Blackboard that serves as the parent scope for this instance. .. rst-class:: classref-method -Variant **get_var** **(** String p_name, Variant p_default=null, bool p_complain=true **)** |const| +Variant **get_var** **(** StringName p_name, Variant p_default=null, bool p_complain=true **)** |const| Returns variable value or ``p_default`` if variable doesn't exist. If ``p_complain`` is ``true``, an error will be printed if variable doesn't exist. @@ -116,7 +116,7 @@ Returns variable value or ``p_default`` if variable doesn't exist. If ``p_compla .. rst-class:: classref-method -bool **has_var** **(** String p_name **)** |const| +bool **has_var** **(** StringName p_name **)** |const| Returns ``true`` if the Blackboard contains the ``p_name`` variable, including the parent scopes. @@ -152,7 +152,7 @@ Assigns the parent scope. If a value isn't in the current Blackboard scope, it w .. rst-class:: classref-method -void **set_var** **(** String p_name, Variant p_value **)** +void **set_var** **(** StringName p_name, Variant p_value **)** Assigns a value to a Blackboard variable. @@ -176,7 +176,7 @@ Returns the topmost **Blackboard** in the scope chain. .. rst-class:: classref-method -void **unbind_var** **(** String p_name **)** +void **unbind_var** **(** StringName p_name **)** Remove binding from a variable. diff --git a/doc/source/classes/class_blackboardplan.rst b/doc/source/classes/class_blackboardplan.rst index d08ac4a..2c967d6 100644 --- a/doc/source/classes/class_blackboardplan.rst +++ b/doc/source/classes/class_blackboardplan.rst @@ -55,7 +55,7 @@ Constructs a new instance of a :ref:`Blackboard` using this pl void **populate_blackboard** **(** :ref:`Blackboard` p_blackboard, bool p_overwrite **)** -Populates ``p_blackboard`` with the variables from this plan. If ``p_override`` is ``true``, existing variables with the same names will be overwritten. +Populates ``p_blackboard`` with the variables from this plan. If ``p_overwrite`` is ``true``, existing variables with the same names will be overwritten. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` diff --git a/doc/source/classes/class_btcallmethod.rst b/doc/source/classes/class_btcallmethod.rst index 231f27f..c9d75b9 100644 --- a/doc/source/classes/class_btcallmethod.rst +++ b/doc/source/classes/class_btcallmethod.rst @@ -40,7 +40,7 @@ Properties +-------------------------------------+---------------------------------------------------------------------------+-----------+ | :ref:`BBNode` | :ref:`node` | | +-------------------------------------+---------------------------------------------------------------------------+-----------+ - | String | :ref:`result_var` | ``""`` | + | StringName | :ref:`result_var` | ``&""`` | +-------------------------------------+---------------------------------------------------------------------------+-----------+ .. rst-class:: classref-section-separator @@ -124,12 +124,12 @@ Specifies the ``Node`` or ``Object`` instance containing the method to be called .. rst-class:: classref-property -String **result_var** = ``""`` +StringName **result_var** = ``&""`` .. rst-class:: classref-property-setget -- void **set_result_var** **(** String value **)** -- String **get_result_var** **(** **)** +- void **set_result_var** **(** StringName value **)** +- StringName **get_result_var** **(** **)** if non-empty, assign the result of the method call to the blackboard variable specified by this property. diff --git a/doc/source/classes/class_btchecktrigger.rst b/doc/source/classes/class_btchecktrigger.rst index 24efade..11c322c 100644 --- a/doc/source/classes/class_btchecktrigger.rst +++ b/doc/source/classes/class_btchecktrigger.rst @@ -31,9 +31,9 @@ Properties .. table:: :widths: auto - +--------+---------------------------------------------------------+--------+ - | String | :ref:`variable` | ``""`` | - +--------+---------------------------------------------------------+--------+ + +------------+---------------------------------------------------------+---------+ + | StringName | :ref:`variable` | ``&""`` | + +------------+---------------------------------------------------------+---------+ .. rst-class:: classref-section-separator @@ -48,12 +48,12 @@ Property Descriptions .. rst-class:: classref-property -String **variable** = ``""`` +StringName **variable** = ``&""`` .. rst-class:: classref-property-setget -- void **set_variable** **(** String value **)** -- String **get_variable** **(** **)** +- void **set_variable** **(** StringName value **)** +- StringName **get_variable** **(** **)** A boolean variable on the blackboard used as a trigger. See also :ref:`BTTask.blackboard`. diff --git a/doc/source/classes/class_btcheckvar.rst b/doc/source/classes/class_btcheckvar.rst index 17ec6f6..7720350 100644 --- a/doc/source/classes/class_btcheckvar.rst +++ b/doc/source/classes/class_btcheckvar.rst @@ -29,13 +29,13 @@ Properties .. table:: :widths: auto - +-----------------------------------------------+---------------------------------------------------------+--------+ - | :ref:`CheckType` | :ref:`check_type` | ``0`` | - +-----------------------------------------------+---------------------------------------------------------+--------+ - | :ref:`BBVariant` | :ref:`value` | | - +-----------------------------------------------+---------------------------------------------------------+--------+ - | String | :ref:`variable` | ``""`` | - +-----------------------------------------------+---------------------------------------------------------+--------+ + +-----------------------------------------------+---------------------------------------------------------+---------+ + | :ref:`CheckType` | :ref:`check_type` | ``0`` | + +-----------------------------------------------+---------------------------------------------------------+---------+ + | :ref:`BBVariant` | :ref:`value` | | + +-----------------------------------------------+---------------------------------------------------------+---------+ + | StringName | :ref:`variable` | ``&""`` | + +-----------------------------------------------+---------------------------------------------------------+---------+ .. rst-class:: classref-section-separator @@ -84,12 +84,12 @@ A parameter that specifies the value against which the :ref:`variable` | ``""`` | - +--------+-------------------------------------------------------------------------+-----------+ - | float | :ref:`duration` | ``10.0`` | - +--------+-------------------------------------------------------------------------+-----------+ - | bool | :ref:`process_pause` | ``false`` | - +--------+-------------------------------------------------------------------------+-----------+ - | bool | :ref:`start_cooled` | ``false`` | - +--------+-------------------------------------------------------------------------+-----------+ - | bool | :ref:`trigger_on_failure` | ``false`` | - +--------+-------------------------------------------------------------------------+-----------+ + +------------+-------------------------------------------------------------------------+-----------+ + | StringName | :ref:`cooldown_state_var` | ``&""`` | + +------------+-------------------------------------------------------------------------+-----------+ + | float | :ref:`duration` | ``10.0`` | + +------------+-------------------------------------------------------------------------+-----------+ + | bool | :ref:`process_pause` | ``false`` | + +------------+-------------------------------------------------------------------------+-----------+ + | bool | :ref:`start_cooled` | ``false`` | + +------------+-------------------------------------------------------------------------+-----------+ + | bool | :ref:`trigger_on_failure` | ``false`` | + +------------+-------------------------------------------------------------------------+-----------+ .. rst-class:: classref-section-separator @@ -60,12 +60,12 @@ Property Descriptions .. rst-class:: classref-property -String **cooldown_state_var** = ``""`` +StringName **cooldown_state_var** = ``&""`` .. rst-class:: classref-property-setget -- void **set_cooldown_state_var** **(** String value **)** -- String **get_cooldown_state_var** **(** **)** +- void **set_cooldown_state_var** **(** StringName value **)** +- StringName **get_cooldown_state_var** **(** **)** A boolean variable used to store the cooldown state in the :ref:`Blackboard`. If left empty, the variable will be automatically generated and assigned. diff --git a/doc/source/classes/class_btevaluateexpression.rst b/doc/source/classes/class_btevaluateexpression.rst index 422c43f..2151893 100644 --- a/doc/source/classes/class_btevaluateexpression.rst +++ b/doc/source/classes/class_btevaluateexpression.rst @@ -42,7 +42,7 @@ Properties +-------------------------------------+-------------------------------------------------------------------------------------+-------------------------+ | :ref:`BBNode` | :ref:`node` | | +-------------------------------------+-------------------------------------------------------------------------------------+-------------------------+ - | String | :ref:`result_var` | ``""`` | + | StringName | :ref:`result_var` | ``&""`` | +-------------------------------------+-------------------------------------------------------------------------------------+-------------------------+ .. rst-class:: classref-reftable-group @@ -161,12 +161,12 @@ Specifies the ``Node`` or ``Object`` instance containing the method to be called .. rst-class:: classref-property -String **result_var** = ``""`` +StringName **result_var** = ``&""`` .. rst-class:: classref-property-setget -- void **set_result_var** **(** String value **)** -- String **get_result_var** **(** **)** +- void **set_result_var** **(** StringName value **)** +- StringName **get_result_var** **(** **)** if non-empty, assign the result of the method call to the blackboard variable specified by this property. diff --git a/doc/source/classes/class_btforeach.rst b/doc/source/classes/class_btforeach.rst index f04bab6..af9c2d7 100644 --- a/doc/source/classes/class_btforeach.rst +++ b/doc/source/classes/class_btforeach.rst @@ -35,11 +35,11 @@ Properties .. table:: :widths: auto - +--------+------------------------------------------------------+--------+ - | String | :ref:`array_var` | ``""`` | - +--------+------------------------------------------------------+--------+ - | String | :ref:`save_var` | ``""`` | - +--------+------------------------------------------------------+--------+ + +------------+------------------------------------------------------+---------+ + | StringName | :ref:`array_var` | ``&""`` | + +------------+------------------------------------------------------+---------+ + | StringName | :ref:`save_var` | ``&""`` | + +------------+------------------------------------------------------+---------+ .. rst-class:: classref-section-separator @@ -54,12 +54,12 @@ Property Descriptions .. rst-class:: classref-property -String **array_var** = ``""`` +StringName **array_var** = ``&""`` .. rst-class:: classref-property-setget -- void **set_array_var** **(** String value **)** -- String **get_array_var** **(** **)** +- void **set_array_var** **(** StringName value **)** +- StringName **get_array_var** **(** **)** A variable within the :ref:`Blackboard` that holds an ``Array``, which is used for the iteration process. @@ -71,12 +71,12 @@ A variable within the :ref:`Blackboard` that holds an ``Array` .. rst-class:: classref-property -String **save_var** = ``""`` +StringName **save_var** = ``&""`` .. rst-class:: classref-property-setget -- void **set_save_var** **(** String value **)** -- String **get_save_var** **(** **)** +- void **set_save_var** **(** StringName value **)** +- StringName **get_save_var** **(** **)** A :ref:`Blackboard` variable used to store an element of the array referenced by :ref:`array_var`. diff --git a/doc/source/classes/class_btsetvar.rst b/doc/source/classes/class_btsetvar.rst index 7b27305..219f93f 100644 --- a/doc/source/classes/class_btsetvar.rst +++ b/doc/source/classes/class_btsetvar.rst @@ -31,13 +31,13 @@ Properties .. table:: :widths: auto - +-----------------------------------------------+-----------------------------------------------------+--------+ - | :ref:`Operation` | :ref:`operation` | ``0`` | - +-----------------------------------------------+-----------------------------------------------------+--------+ - | :ref:`BBVariant` | :ref:`value` | | - +-----------------------------------------------+-----------------------------------------------------+--------+ - | String | :ref:`variable` | ``""`` | - +-----------------------------------------------+-----------------------------------------------------+--------+ + +-----------------------------------------------+-----------------------------------------------------+---------+ + | :ref:`Operation` | :ref:`operation` | ``0`` | + +-----------------------------------------------+-----------------------------------------------------+---------+ + | :ref:`BBVariant` | :ref:`value` | | + +-----------------------------------------------+-----------------------------------------------------+---------+ + | StringName | :ref:`variable` | ``&""`` | + +-----------------------------------------------+-----------------------------------------------------+---------+ .. rst-class:: classref-section-separator @@ -88,12 +88,12 @@ Parameter that specifies the value to be assigned to the variable. .. rst-class:: classref-property -String **variable** = ``""`` +StringName **variable** = ``&""`` .. rst-class:: classref-property-setget -- void **set_variable** **(** String value **)** -- String **get_variable** **(** **)** +- void **set_variable** **(** StringName value **)** +- StringName **get_variable** **(** **)** Name of the variable to which the value will be assigned. diff --git a/doc/source/classes/class_btstate.rst b/doc/source/classes/class_btstate.rst index cfe4e6e..2d501bb 100644 --- a/doc/source/classes/class_btstate.rst +++ b/doc/source/classes/class_btstate.rst @@ -29,13 +29,13 @@ Properties .. table:: :widths: auto - +-----------------------------------------+------------------------------------------------------------+---------------+ - | :ref:`BehaviorTree` | :ref:`behavior_tree` | | - +-----------------------------------------+------------------------------------------------------------+---------------+ - | String | :ref:`failure_event` | ``"failure"`` | - +-----------------------------------------+------------------------------------------------------------+---------------+ - | String | :ref:`success_event` | ``"success"`` | - +-----------------------------------------+------------------------------------------------------------+---------------+ + +-----------------------------------------+------------------------------------------------------------+----------------+ + | :ref:`BehaviorTree` | :ref:`behavior_tree` | | + +-----------------------------------------+------------------------------------------------------------+----------------+ + | StringName | :ref:`failure_event` | ``&"failure"`` | + +-----------------------------------------+------------------------------------------------------------+----------------+ + | StringName | :ref:`success_event` | ``&"success"`` | + +-----------------------------------------+------------------------------------------------------------+----------------+ .. rst-class:: classref-reftable-group @@ -79,12 +79,12 @@ A :ref:`BehaviorTree` resource that defines state behavior. .. rst-class:: classref-property -String **failure_event** = ``"failure"`` +StringName **failure_event** = ``&"failure"`` .. rst-class:: classref-property-setget -- void **set_failure_event** **(** String value **)** -- String **get_failure_event** **(** **)** +- void **set_failure_event** **(** StringName value **)** +- StringName **get_failure_event** **(** **)** HSM event that will be dispatched when the behavior tree results in ``FAILURE``. See :ref:`LimboState.dispatch`. @@ -96,12 +96,12 @@ HSM event that will be dispatched when the behavior tree results in ``FAILURE``. .. rst-class:: classref-property -String **success_event** = ``"success"`` +StringName **success_event** = ``&"success"`` .. rst-class:: classref-property-setget -- void **set_success_event** **(** String value **)** -- String **get_success_event** **(** **)** +- void **set_success_event** **(** StringName value **)** +- StringName **get_success_event** **(** **)** HSM event that will be dispatched when the behavior tree results in ``SUCCESS``. See :ref:`LimboState.dispatch`. diff --git a/doc/source/classes/class_limbohsm.rst b/doc/source/classes/class_limbohsm.rst index ada74a1..6766ca4 100644 --- a/doc/source/classes/class_limbohsm.rst +++ b/doc/source/classes/class_limbohsm.rst @@ -45,19 +45,19 @@ Methods .. table:: :widths: auto - +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | void | :ref:`add_transition` **(** :ref:`LimboState` p_from_state, :ref:`LimboState` p_to_state, String p_event **)** | - +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | :ref:`LimboState` | :ref:`get_active_state` **(** **)** |const| | - +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | :ref:`LimboState` | :ref:`get_leaf_state` **(** **)** |const| | - +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | void | :ref:`initialize` **(** Node p_agent, :ref:`Blackboard` p_parent_scope=null **)** | - +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | void | :ref:`set_active` **(** bool p_active **)** | - +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | void | :ref:`update` **(** float p_delta **)** | - +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + +-------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | void | :ref:`add_transition` **(** :ref:`LimboState` p_from_state, :ref:`LimboState` p_to_state, StringName p_event **)** | + +-------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`LimboState` | :ref:`get_active_state` **(** **)** |const| | + +-------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`LimboState` | :ref:`get_leaf_state` **(** **)** |const| | + +-------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | void | :ref:`initialize` **(** Node p_agent, :ref:`Blackboard` p_parent_scope=null **)** | + +-------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | void | :ref:`set_active` **(** bool p_active **)** | + +-------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | void | :ref:`update` **(** float p_delta **)** | + +-------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ .. rst-class:: classref-section-separator @@ -183,7 +183,7 @@ Method Descriptions .. rst-class:: classref-method -void **add_transition** **(** :ref:`LimboState` p_from_state, :ref:`LimboState` p_to_state, String p_event **)** +void **add_transition** **(** :ref:`LimboState` p_from_state, :ref:`LimboState` p_to_state, StringName p_event **)** Establishes a transition from one state to another when ``p_event`` is dispatched. Both ``p_from_state`` and ``p_to_state`` must be immediate children of this state. diff --git a/doc/source/classes/class_limbostate.rst b/doc/source/classes/class_limbostate.rst index baa51ce..8b9bdbb 100644 --- a/doc/source/classes/class_limbostate.rst +++ b/doc/source/classes/class_limbostate.rst @@ -36,7 +36,7 @@ Properties :widths: auto +---------------------------------------------+-------------------------------------------------------------------+ - | String | :ref:`EVENT_FINISHED` | + | StringName | :ref:`EVENT_FINISHED` | +---------------------------------------------+-------------------------------------------------------------------+ | Node | :ref:`agent` | +---------------------------------------------+-------------------------------------------------------------------+ @@ -53,35 +53,35 @@ Methods .. table:: :widths: auto - +-------------------------------------+--------------------------------------------------------------------------------------------------------------------+ - | void | :ref:`_enter` **(** **)** |virtual| | - +-------------------------------------+--------------------------------------------------------------------------------------------------------------------+ - | void | :ref:`_exit` **(** **)** |virtual| | - +-------------------------------------+--------------------------------------------------------------------------------------------------------------------+ - | void | :ref:`_setup` **(** **)** |virtual| | - +-------------------------------------+--------------------------------------------------------------------------------------------------------------------+ - | void | :ref:`_update` **(** float p_delta **)** |virtual| | - +-------------------------------------+--------------------------------------------------------------------------------------------------------------------+ - | void | :ref:`add_event_handler` **(** String p_event, Callable p_handler **)** | - +-------------------------------------+--------------------------------------------------------------------------------------------------------------------+ - | :ref:`LimboState` | :ref:`call_on_enter` **(** Callable p_callable **)** | - +-------------------------------------+--------------------------------------------------------------------------------------------------------------------+ - | :ref:`LimboState` | :ref:`call_on_exit` **(** Callable p_callable **)** | - +-------------------------------------+--------------------------------------------------------------------------------------------------------------------+ - | :ref:`LimboState` | :ref:`call_on_update` **(** Callable p_callable **)** | - +-------------------------------------+--------------------------------------------------------------------------------------------------------------------+ - | void | :ref:`clear_guard` **(** **)** | - +-------------------------------------+--------------------------------------------------------------------------------------------------------------------+ - | bool | :ref:`dispatch` **(** String p_event, Variant p_cargo=null **)** | - +-------------------------------------+--------------------------------------------------------------------------------------------------------------------+ - | :ref:`LimboState` | :ref:`get_root` **(** **)** |const| | - +-------------------------------------+--------------------------------------------------------------------------------------------------------------------+ - | bool | :ref:`is_active` **(** **)** |const| | - +-------------------------------------+--------------------------------------------------------------------------------------------------------------------+ - | :ref:`LimboState` | :ref:`named` **(** String p_name **)** | - +-------------------------------------+--------------------------------------------------------------------------------------------------------------------+ - | void | :ref:`set_guard` **(** Callable p_guard_callable **)** | - +-------------------------------------+--------------------------------------------------------------------------------------------------------------------+ + +-------------------------------------+------------------------------------------------------------------------------------------------------------------------+ + | void | :ref:`_enter` **(** **)** |virtual| | + +-------------------------------------+------------------------------------------------------------------------------------------------------------------------+ + | void | :ref:`_exit` **(** **)** |virtual| | + +-------------------------------------+------------------------------------------------------------------------------------------------------------------------+ + | void | :ref:`_setup` **(** **)** |virtual| | + +-------------------------------------+------------------------------------------------------------------------------------------------------------------------+ + | void | :ref:`_update` **(** float p_delta **)** |virtual| | + +-------------------------------------+------------------------------------------------------------------------------------------------------------------------+ + | void | :ref:`add_event_handler` **(** StringName p_event, Callable p_handler **)** | + +-------------------------------------+------------------------------------------------------------------------------------------------------------------------+ + | :ref:`LimboState` | :ref:`call_on_enter` **(** Callable p_callable **)** | + +-------------------------------------+------------------------------------------------------------------------------------------------------------------------+ + | :ref:`LimboState` | :ref:`call_on_exit` **(** Callable p_callable **)** | + +-------------------------------------+------------------------------------------------------------------------------------------------------------------------+ + | :ref:`LimboState` | :ref:`call_on_update` **(** Callable p_callable **)** | + +-------------------------------------+------------------------------------------------------------------------------------------------------------------------+ + | void | :ref:`clear_guard` **(** **)** | + +-------------------------------------+------------------------------------------------------------------------------------------------------------------------+ + | bool | :ref:`dispatch` **(** StringName p_event, Variant p_cargo=null **)** | + +-------------------------------------+------------------------------------------------------------------------------------------------------------------------+ + | :ref:`LimboState` | :ref:`get_root` **(** **)** |const| | + +-------------------------------------+------------------------------------------------------------------------------------------------------------------------+ + | bool | :ref:`is_active` **(** **)** |const| | + +-------------------------------------+------------------------------------------------------------------------------------------------------------------------+ + | :ref:`LimboState` | :ref:`named` **(** String p_name **)** | + +-------------------------------------+------------------------------------------------------------------------------------------------------------------------+ + | void | :ref:`set_guard` **(** Callable p_guard_callable **)** | + +-------------------------------------+------------------------------------------------------------------------------------------------------------------------+ .. rst-class:: classref-section-separator @@ -149,11 +149,11 @@ Property Descriptions .. rst-class:: classref-property -String **EVENT_FINISHED** +StringName **EVENT_FINISHED** .. rst-class:: classref-property-setget -- String **event_finished** **(** **)** +- StringName **event_finished** **(** **)** A commonly used event that indicates that the state has finished its work. @@ -268,7 +268,7 @@ Called during the update. Implement your state's behavior with this method. .. rst-class:: classref-method -void **add_event_handler** **(** String p_event, Callable p_handler **)** +void **add_event_handler** **(** StringName p_event, Callable p_handler **)** Registers a ``p_handler`` to be called when ``p_event`` is dispatched. @@ -328,7 +328,7 @@ Clears the guard function, removing the ``Callable`` previously set by :ref:`set .. rst-class:: classref-method -bool **dispatch** **(** String p_event, Variant p_cargo=null **)** +bool **dispatch** **(** StringName p_event, Variant p_cargo=null **)** Recursively dispatches a state machine event named ``p_event`` with an optional argument ``p_cargo``. Returns ``true`` if the event was consumed. diff --git a/doc/source/getting-started/accessing-nodes.rst b/doc/source/getting-started/accessing-nodes.rst index 6774f93..11d8f00 100644 --- a/doc/source/getting-started/accessing-nodes.rst +++ b/doc/source/getting-started/accessing-nodes.rst @@ -40,7 +40,7 @@ and point it to the proper node in the :ref:`BTPlayer` blackboar extends BTCondition - @export var shape_var: String = "shape_cast" + @export var shape_var: StringName = &"shape_cast" func _tick(delta) -> Status: var shape_cast: ShapeCast3D = blackboard.get_var(shape_var) diff --git a/doc/source/getting-started/custom-tasks.rst b/doc/source/getting-started/custom-tasks.rst index 77b3fb1..ba3a9c6 100644 --- a/doc/source/getting-started/custom-tasks.rst +++ b/doc/source/getting-started/custom-tasks.rst @@ -110,7 +110,7 @@ Example 2: InRange condition @export var distance_min: float @export var distance_max: float - @export var target_var := "target" + @export var target_var: StringName = &"target" var _min_distance_squared: float var _max_distance_squared: float diff --git a/doc/source/getting-started/hsm.rst b/doc/source/getting-started/hsm.rst index 8edcec9..107e73e 100644 --- a/doc/source/getting-started/hsm.rst +++ b/doc/source/getting-started/hsm.rst @@ -76,7 +76,7 @@ To register a transition and associate it with a specific event, you can use the .. code:: gdscript - hsm.add_transition(idle_state, move_state, "movement_started") + hsm.add_transition(idle_state, move_state, &"movement_started") In this example, we're registering a transition from the ``idle_state`` to the ``move_state`` when the ``movement_started`` event is dispatched. @@ -85,7 +85,7 @@ A transition can be also associated with no particular starting state: .. code:: gdscript - hsm.add_transition(hsm.ANYSTATE, move_state, "movement_started") + hsm.add_transition(hsm.ANYSTATE, move_state, &"movement_started") **Events are dispatched** with the :ref:`LimboState.dispatch` method. It's important to note that this method can be called from anywhere in the state machine hierarchy and outside of it. @@ -187,8 +187,8 @@ Let's illustrate this with a practical code example: hsm.add_child(idle_state) hsm.add_child(move_state) - hsm.add_transition(idle_state, move_state, "movement_started") - hsm.add_transition(move_state, idle_state, "movement_ended") + hsm.add_transition(idle_state, move_state, &"movement_started") + hsm.add_transition(move_state, idle_state, &"movement_ended") hsm.initialize(self) hsm.set_active(true) @@ -198,7 +198,7 @@ Let's illustrate this with a practical code example: var dir: Vector2 = Input.get_vector( &"ui_left", &"ui_right", &"ui_up", &"ui_down") if dir.is_zero_approx(): - hsm.dispatch("movement_started") + hsm.dispatch(&"movement_started") func _move_update(delta: float) -> void: @@ -208,4 +208,4 @@ Let's illustrate this with a practical code example: velocity = desired_velocity move_and_slide() if desired_velocity.is_zero_approx(): - hsm.dispatch("movement_ended") + hsm.dispatch(&"movement_ended") diff --git a/doc/source/getting-started/using-blackboard.rst b/doc/source/getting-started/using-blackboard.rst index cb3665b..8ffa205 100644 --- a/doc/source/getting-started/using-blackboard.rst +++ b/doc/source/getting-started/using-blackboard.rst @@ -19,7 +19,7 @@ Here's an example of how you can interact with the :ref:`Blackboard Status: # Set the value of the "speed" variable: @@ -114,7 +114,7 @@ In the following example, we have a group of agents, and we want to share a comm extends BTAction - @export var group_target_var: String = "group_target" + @export var group_target_var: StringName = &"group_target" func _tick(delta: float) -> Status: if not blackboard.has_var(group_target_var): diff --git a/doc_classes/BBParam.xml b/doc_classes/BBParam.xml index 61b6cf7..e96ba7c 100644 --- a/doc_classes/BBParam.xml +++ b/doc_classes/BBParam.xml @@ -33,7 +33,7 @@ Specifies the source of the value for BBParam. See [enum ValueSource]. - + Stores the name of a [Blackboard] variable when [member value_source] is set to [constant BLACKBOARD_VAR]. diff --git a/doc_classes/BTCallMethod.xml b/doc_classes/BTCallMethod.xml index 66e8656..ca5a1a9 100644 --- a/doc_classes/BTCallMethod.xml +++ b/doc_classes/BTCallMethod.xml @@ -22,7 +22,7 @@ Specifies the [Node] or [Object] instance containing the method to be called. - + if non-empty, assign the result of the method call to the blackboard variable specified by this property. diff --git a/doc_classes/BTCheckTrigger.xml b/doc_classes/BTCheckTrigger.xml index 0239b1e..6bfa8cd 100644 --- a/doc_classes/BTCheckTrigger.xml +++ b/doc_classes/BTCheckTrigger.xml @@ -10,7 +10,7 @@ - + A boolean variable on the blackboard used as a trigger. See also [member BTTask.blackboard]. If variable's value is [code]true[/code], [BTCheckTrigger] will switch it to [code]false[/code] and return [code]SUCCESS[/code]. If variable's value is [code]false[/code], [BTCheckTrigger] will return [code]FAILURE[/code]. diff --git a/doc_classes/BTCheckVar.xml b/doc_classes/BTCheckVar.xml index 1a37389..16ba47d 100644 --- a/doc_classes/BTCheckVar.xml +++ b/doc_classes/BTCheckVar.xml @@ -15,7 +15,7 @@ A parameter that specifies the value against which the [member variable] will be compared. - + The name of the variable to check its value. diff --git a/doc_classes/BTCooldown.xml b/doc_classes/BTCooldown.xml index 1f84cbd..fb04958 100644 --- a/doc_classes/BTCooldown.xml +++ b/doc_classes/BTCooldown.xml @@ -12,7 +12,7 @@ - + A boolean variable used to store the cooldown state in the [Blackboard]. If left empty, the variable will be automatically generated and assigned. If the variable's value is set to [code]true[/code], it indicates that the cooldown is activated. This feature is useful for checking the cooldown state from other parts of the tree or sharing it among different sections of the [BehaviorTree]. diff --git a/doc_classes/BTEvaluateExpression.xml b/doc_classes/BTEvaluateExpression.xml index 36593a9..e2ee74a 100644 --- a/doc_classes/BTEvaluateExpression.xml +++ b/doc_classes/BTEvaluateExpression.xml @@ -36,7 +36,7 @@ Specifies the [Node] or [Object] instance containing the method to be called. - + if non-empty, assign the result of the method call to the blackboard variable specified by this property. diff --git a/doc_classes/BTForEach.xml b/doc_classes/BTForEach.xml index 2fbe450..7bbd10f 100644 --- a/doc_classes/BTForEach.xml +++ b/doc_classes/BTForEach.xml @@ -12,10 +12,10 @@ - + A variable within the [Blackboard] that holds an [Array], which is used for the iteration process. - + A [Blackboard] variable used to store an element of the array referenced by [member array_var]. diff --git a/doc_classes/BTSetVar.xml b/doc_classes/BTSetVar.xml index dc461ed..dffa89a 100644 --- a/doc_classes/BTSetVar.xml +++ b/doc_classes/BTSetVar.xml @@ -17,7 +17,7 @@ Parameter that specifies the value to be assigned to the variable. - + Name of the variable to which the value will be assigned. diff --git a/doc_classes/BTState.xml b/doc_classes/BTState.xml index 80a490e..d7d5d1a 100644 --- a/doc_classes/BTState.xml +++ b/doc_classes/BTState.xml @@ -20,10 +20,10 @@ A [BehaviorTree] resource that defines state behavior. - + HSM event that will be dispatched when the behavior tree results in [code]FAILURE[/code]. See [method LimboState.dispatch]. - + HSM event that will be dispatched when the behavior tree results in [code]SUCCESS[/code]. See [method LimboState.dispatch]. diff --git a/doc_classes/Blackboard.xml b/doc_classes/Blackboard.xml index e6748a0..9ad8bf0 100644 --- a/doc_classes/Blackboard.xml +++ b/doc_classes/Blackboard.xml @@ -13,7 +13,7 @@ - + @@ -22,7 +22,7 @@ - + Removes a variable by its name. @@ -35,7 +35,7 @@ - + @@ -44,7 +44,7 @@ - + Returns [code]true[/code] if the Blackboard contains the [param p_name] variable, including the parent scopes. @@ -65,7 +65,7 @@ - + Assigns a value to a Blackboard variable. @@ -79,7 +79,7 @@ - + Remove binding from a variable. diff --git a/doc_classes/BlackboardPlan.xml b/doc_classes/BlackboardPlan.xml index 0b39b81..44036d1 100644 --- a/doc_classes/BlackboardPlan.xml +++ b/doc_classes/BlackboardPlan.xml @@ -19,7 +19,7 @@ - Populates [param p_blackboard] with the variables from this plan. If [param p_override] is [code]true[/code], existing variables with the same names will be overwritten. + Populates [param p_blackboard] with the variables from this plan. If [param p_overwrite] is [code]true[/code], existing variables with the same names will be overwritten. diff --git a/doc_classes/LimboHSM.xml b/doc_classes/LimboHSM.xml index 53033be..7928f1d 100644 --- a/doc_classes/LimboHSM.xml +++ b/doc_classes/LimboHSM.xml @@ -13,7 +13,7 @@ - + Establishes a transition from one state to another when [param p_event] is dispatched. Both [param p_from_state] and [param p_to_state] must be immediate children of this state. diff --git a/doc_classes/LimboState.xml b/doc_classes/LimboState.xml index 26eb61f..1994fe1 100644 --- a/doc_classes/LimboState.xml +++ b/doc_classes/LimboState.xml @@ -38,7 +38,7 @@ - + Registers a [param p_handler] to be called when [param p_event] is dispatched. @@ -73,7 +73,7 @@ - + Recursively dispatches a state machine event named [param p_event] with an optional argument [param p_cargo]. Returns [code]true[/code] if the event was consumed. @@ -108,7 +108,7 @@ - + A commonly used event that indicates that the state has finished its work. diff --git a/editor/blackboard_plan_editor.cpp b/editor/blackboard_plan_editor.cpp index f02f6f7..7372fc7 100644 --- a/editor/blackboard_plan_editor.cpp +++ b/editor/blackboard_plan_editor.cpp @@ -48,25 +48,25 @@ void BlackboardPlanEditor::_add_var() { ERR_FAIL_NULL(plan); int suffix = 1; - String name = default_var_name; - while (plan->has_var(name)) { + StringName var_name = default_var_name; + while (plan->has_var(var_name)) { suffix += 1; - name = default_var_name + itos(suffix); + var_name = String(default_var_name) + itos(suffix); } BBVariable var(Variant::Type::FLOAT); - plan->add_var(name, var); + plan->add_var(var_name, var); _refresh(); } void BlackboardPlanEditor::_trash_var(int p_index) { ERR_FAIL_NULL(plan); - String var_name = plan->get_var_by_index(p_index).first; + StringName var_name = plan->get_var_by_index(p_index).first; plan->remove_var(var_name); _refresh(); } -void BlackboardPlanEditor::_rename_var(const String &p_new_name, int p_index) { +void BlackboardPlanEditor::_rename_var(const StringName &p_new_name, int p_index) { ERR_FAIL_NULL(plan); LineEdit *name_edit = _get_name_edit(p_index); @@ -127,8 +127,8 @@ void BlackboardPlanEditor::edit_plan(const Ref &p_plan) { _refresh(); } -void BlackboardPlanEditor::set_next_var_name(const String &p_name) { - if (p_name.is_valid_identifier()) { +void BlackboardPlanEditor::set_next_var_name(const StringName &p_name) { + if (String(p_name).is_valid_identifier()) { default_var_name = p_name; } } diff --git a/editor/blackboard_plan_editor.h b/editor/blackboard_plan_editor.h index 1c00276..882ac41 100644 --- a/editor/blackboard_plan_editor.h +++ b/editor/blackboard_plan_editor.h @@ -56,7 +56,7 @@ private: int drag_index = -1; Ref plan; - String default_var_name; + StringName default_var_name; VBoxContainer *rows_vbox; Button *add_var_tool; @@ -69,7 +69,7 @@ private: void _add_var(); void _trash_var(int p_index); - void _rename_var(const String &p_new_name, int p_index); + void _rename_var(const StringName &p_new_name, int p_index); void _change_var_type(Variant::Type p_new_type, int p_index); void _change_var_hint(PropertyHint p_new_hint, int p_index); void _change_var_hint_string(const String &p_new_hint_string, int p_index); @@ -95,7 +95,7 @@ public: _FORCE_INLINE_ static BlackboardPlanEditor *get_singleton() { return singleton; } void edit_plan(const Ref &p_plan); - void set_next_var_name(const String &p_name); + void set_next_var_name(const StringName &p_name); BlackboardPlanEditor(); }; diff --git a/editor/editor_property_variable_name.cpp b/editor/editor_property_variable_name.cpp index ed51c18..4a8190f 100644 --- a/editor/editor_property_variable_name.cpp +++ b/editor/editor_property_variable_name.cpp @@ -200,7 +200,7 @@ bool EditorInspectorPluginVariableName::parse_property(Object *p_object, const V #elif LIMBOAI_GDEXTENSION bool EditorInspectorPluginVariableName::_parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const BitField p_usage, const bool p_wide) { #endif - if (p_type != Variant::Type::STRING || !(p_path.ends_with("_var") || p_path.ends_with("variable"))) { + if (!(p_type == Variant::Type::STRING_NAME || p_type == Variant::Type::STRING) || !(p_path.ends_with("_var") || p_path.ends_with("variable"))) { return false; } diff --git a/hsm/limbo_hsm.cpp b/hsm/limbo_hsm.cpp index 54e95f2..2ee188a 100644 --- a/hsm/limbo_hsm.cpp +++ b/hsm/limbo_hsm.cpp @@ -1,7 +1,7 @@ /** * limbo_hsm.cpp * ============================================================================= - * Copyright 2021-2023 Serhii Snitsaruk + * Copyright 2021-2024 Serhii Snitsaruk * * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file or at @@ -100,11 +100,11 @@ void LimboHSM::update(double p_delta) { _update(p_delta); } -void LimboHSM::add_transition(LimboState *p_from_state, LimboState *p_to_state, const String &p_event) { +void LimboHSM::add_transition(LimboState *p_from_state, LimboState *p_to_state, const StringName &p_event) { ERR_FAIL_COND_MSG(p_from_state != nullptr && p_from_state->get_parent() != this, "LimboHSM: Unable to add a transition from a state that is not an immediate child of mine."); ERR_FAIL_COND_MSG(p_to_state == nullptr, "LimboHSM: Unable to add a transition to a null state."); ERR_FAIL_COND_MSG(p_to_state->get_parent() != this, "LimboHSM: Unable to add a transition to a state that is not an immediate child of mine."); - ERR_FAIL_COND_MSG(p_event.is_empty(), "LimboHSM: Failed to add transition due to empty event string."); + ERR_FAIL_COND_MSG(p_event == StringName(), "LimboHSM: Failed to add transition due to empty event string."); uint64_t key = _get_transition_key(p_from_state, p_event); transitions[key] = Object::cast_to(p_to_state); @@ -127,8 +127,8 @@ void LimboHSM::set_initial_state(LimboState *p_state) { initial_state = Object::cast_to(p_state); } -bool LimboHSM::_dispatch(const String &p_event, const Variant &p_cargo) { - ERR_FAIL_COND_V(p_event.is_empty(), false); +bool LimboHSM::_dispatch(const StringName &p_event, const Variant &p_cargo) { + ERR_FAIL_COND_V(p_event == StringName(), false); bool event_consumed = false; diff --git a/hsm/limbo_hsm.h b/hsm/limbo_hsm.h index f92857c..41d7f96 100644 --- a/hsm/limbo_hsm.h +++ b/hsm/limbo_hsm.h @@ -1,7 +1,7 @@ /** * limbo_hsm.h * ============================================================================= - * Copyright 2021-2023 Serhii Snitsaruk + * Copyright 2021-2024 Serhii Snitsaruk * * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file or at @@ -30,9 +30,11 @@ private: LimboState *active_state; HashMap transitions; - _FORCE_INLINE_ uint64_t _get_transition_key(LimboState *p_from_state, const String &p_event) { + _FORCE_INLINE_ uint64_t _get_transition_key(LimboState *p_from_state, const StringName &p_event) { uint64_t key = hash_djb2_one_64(Variant::OBJECT); - key = hash_djb2_one_64(Variant(p_from_state).hash(), key); + if (p_from_state != nullptr) { + key = hash_djb2_one_64(hash_one_uint64(hash_make_uint64_t(p_from_state)), key); + } key = hash_djb2_one_64(p_event.hash(), key); return key; } @@ -43,7 +45,7 @@ protected: void _notification(int p_what); virtual void _initialize(Node *p_agent, const Ref &p_blackboard) override; - virtual bool _dispatch(const String &p_event, const Variant &p_cargo = Variant()) override; + virtual bool _dispatch(const StringName &p_event, const Variant &p_cargo = Variant()) override; virtual void _enter() override; virtual void _exit() override; @@ -65,7 +67,7 @@ public: virtual void initialize(Node *p_agent, const Ref &p_parent_scope = nullptr); void update(double p_delta); - void add_transition(LimboState *p_from_state, LimboState *p_to_state, const String &p_event); + void add_transition(LimboState *p_from_state, LimboState *p_to_state, const StringName &p_event); LimboState *anystate() const { return nullptr; } LimboHSM(); diff --git a/hsm/limbo_state.cpp b/hsm/limbo_state.cpp index 6e00396..085e998 100644 --- a/hsm/limbo_state.cpp +++ b/hsm/limbo_state.cpp @@ -1,7 +1,7 @@ /** * limbo_state.cpp * ============================================================================= - * Copyright 2021-2023 Serhii Snitsaruk + * Copyright 2021-2024 Serhii Snitsaruk * * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file or at @@ -34,7 +34,7 @@ LimboState *LimboState::get_root() const { return const_cast(state); } -LimboState *LimboState::named(String p_name) { +LimboState *LimboState::named(const String &p_name) { set_name(p_name); return this; } @@ -80,8 +80,8 @@ void LimboState::_initialize(Node *p_agent, const Ref &p_blackboard) _setup(); } -bool LimboState::_dispatch(const String &p_event, const Variant &p_cargo) { - ERR_FAIL_COND_V(p_event.is_empty(), false); +bool LimboState::_dispatch(const StringName &p_event, const Variant &p_cargo) { + ERR_FAIL_COND_V(p_event == StringName(), false); if (handlers.size() > 0 && handlers.has(p_event)) { Variant ret; @@ -120,13 +120,13 @@ bool LimboState::_dispatch(const String &p_event, const Variant &p_cargo) { return false; } -void LimboState::add_event_handler(const String &p_event, const Callable &p_handler) { - ERR_FAIL_COND(p_event.is_empty()); +void LimboState::add_event_handler(const StringName &p_event, const Callable &p_handler) { + ERR_FAIL_COND(p_event == StringName()); ERR_FAIL_COND(!p_handler.is_valid()); handlers.insert(p_event, p_handler); } -bool LimboState::dispatch(const String &p_event, const Variant &p_cargo) { +bool LimboState::dispatch(const StringName &p_event, const Variant &p_cargo) { return get_root()->_dispatch(p_event, p_cargo); } @@ -196,7 +196,7 @@ void LimboState::_bind_methods() { // TODO: Registering virtual functions is not available in godot-cpp... #endif - ADD_PROPERTY(PropertyInfo(Variant::STRING, "EVENT_FINISHED", PROPERTY_HINT_NONE, "", 0), "", "event_finished"); + ADD_PROPERTY(PropertyInfo(Variant::STRING_NAME, "EVENT_FINISHED", PROPERTY_HINT_NONE, "", 0), "", "event_finished"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "agent", PROPERTY_HINT_RESOURCE_TYPE, "Node", 0), "set_agent", "get_agent"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "blackboard", PROPERTY_HINT_RESOURCE_TYPE, "Blackboard", 0), "", "get_blackboard"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "blackboard_plan", PROPERTY_HINT_RESOURCE_TYPE, "BlackboardPlan", PROPERTY_USAGE_DEFAULT), "set_blackboard_plan", "get_blackboard_plan"); diff --git a/hsm/limbo_state.h b/hsm/limbo_state.h index 291be8c..47b6d75 100644 --- a/hsm/limbo_state.h +++ b/hsm/limbo_state.h @@ -1,7 +1,7 @@ /** * limbo_state.h * ============================================================================= - * Copyright 2021-2023 Serhii Snitsaruk + * Copyright 2021-2024 Serhii Snitsaruk * * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file or at @@ -41,7 +41,7 @@ private: Ref blackboard_plan; Node *agent; Ref blackboard; - HashMap handlers; + HashMap handlers; Callable guard_callable; protected: @@ -54,7 +54,7 @@ protected: void _notification(int p_what); virtual void _initialize(Node *p_agent, const Ref &p_blackboard); - virtual bool _dispatch(const String &p_event, const Variant &p_cargo = Variant()); + virtual bool _dispatch(const StringName &p_event, const Variant &p_cargo = Variant()); virtual void _setup(); virtual void _enter(); @@ -69,7 +69,7 @@ protected: #endif // LIMBOAI_MODULE public: - void set_blackboard_plan(const Ref p_plan) { blackboard_plan = p_plan; } + void set_blackboard_plan(const Ref &p_plan) { blackboard_plan = p_plan; } Ref get_blackboard_plan() const { return blackboard_plan; } Ref get_blackboard() const { return blackboard; } @@ -77,15 +77,15 @@ public: Node *get_agent() const { return agent; } void set_agent(Node *p_agent) { agent = p_agent; } - LimboState *named(String p_name); + LimboState *named(const String &p_name); LimboState *call_on_enter(const Callable &p_callable); LimboState *call_on_exit(const Callable &p_callable); LimboState *call_on_update(const Callable &p_callable); - void add_event_handler(const String &p_event, const Callable &p_handler); - bool dispatch(const String &p_event, const Variant &p_cargo = Variant()); + void add_event_handler(const StringName &p_event, const Callable &p_handler); + bool dispatch(const StringName &p_event, const Variant &p_cargo = Variant()); - _FORCE_INLINE_ String event_finished() const { return LW_NAME(EVENT_FINISHED); } + _FORCE_INLINE_ StringName event_finished() const { return LW_NAME(EVENT_FINISHED); } LimboState *get_root() const; bool is_active() const { return active; } diff --git a/util/limbo_string_names.cpp b/util/limbo_string_names.cpp index 6dd6092..f621c23 100644 --- a/util/limbo_string_names.cpp +++ b/util/limbo_string_names.cpp @@ -78,6 +78,9 @@ LimboStringNames::LimboStringNames() { emit_changed = SN("emit_changed"); entered = SN("entered"); error_value = SN("error_value"); + EVENT_FAILURE = SN("failure"); + EVENT_FINISHED = SN("finished"); + EVENT_SUCCESS = SN("success"); exited = SN("exited"); favorite_tasks_changed = SN("favorite_tasks_changed"); Favorites = SN("Favorites"); @@ -160,7 +163,6 @@ LimboStringNames::LimboStringNames() { visibility_changed = SN("visibility_changed"); window_visibility_changed = SN("window_visibility_changed"); - EVENT_FINISHED = "finished"; repeat_forever.parse_utf8("Repeat ∞"); output_var_prefix.parse_utf8("➜"); } diff --git a/util/limbo_string_names.h b/util/limbo_string_names.h index 6111c0a..7e5c7e8 100644 --- a/util/limbo_string_names.h +++ b/util/limbo_string_names.h @@ -92,6 +92,9 @@ public: StringName emit_changed; StringName entered; StringName error_value; + StringName EVENT_FAILURE; + StringName EVENT_FINISHED; + StringName EVENT_SUCCESS; StringName exited; StringName favorite_tasks_changed; StringName Favorites; @@ -175,7 +178,6 @@ public: StringName visibility_changed; StringName window_visibility_changed; - String EVENT_FINISHED; String repeat_forever; String output_var_prefix; };