Merge pull request #61 from limbonaut/refactor-use-stringname
Refactor: Use `StringName` for variables and event names
This commit is contained in:
commit
ae718ab00c
|
@ -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<PropertyInfo> *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();
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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> 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<String, BBVariable> &kv : data) {
|
||||
for (const KeyValue<StringName, BBVariable> &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());
|
||||
|
|
|
@ -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<String, BBVariable> data;
|
||||
HashMap<StringName, BBVariable> data;
|
||||
Ref<Blackboard> parent;
|
||||
|
||||
protected:
|
||||
|
@ -46,15 +46,15 @@ public:
|
|||
|
||||
Ref<Blackboard> 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);
|
||||
|
||||
|
|
|
@ -12,22 +12,22 @@
|
|||
#include "blackboard_plan.h"
|
||||
|
||||
bool BlackboardPlan::_set(const StringName &p_name, const Variant &p_value) {
|
||||
String prop_name = p_name;
|
||||
String name_str = p_name;
|
||||
|
||||
// * Editor
|
||||
if (var_map.has(prop_name)) {
|
||||
var_map[prop_name].set_value(p_value);
|
||||
if (base.is_valid() && p_value == base->get_var(prop_name).get_value()) {
|
||||
if (var_map.has(p_name)) {
|
||||
var_map[p_name].set_value(p_value);
|
||||
if (base.is_valid() && p_value == base->get_var(p_name).get_value()) {
|
||||
// When user pressed reset property button in inspector...
|
||||
var_map[prop_name].reset_value_changed();
|
||||
var_map[p_name].reset_value_changed();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// * Storage
|
||||
if (prop_name.begins_with("var/")) {
|
||||
String var_name = prop_name.get_slicec('/', 1);
|
||||
String what = prop_name.get_slicec('/', 2);
|
||||
if (name_str.begins_with("var/")) {
|
||||
StringName var_name = name_str.get_slicec('/', 1);
|
||||
String what = name_str.get_slicec('/', 2);
|
||||
if (!var_map.has(var_name) && what == "name") {
|
||||
add_var(var_name, BBVariable());
|
||||
}
|
||||
|
@ -51,21 +51,21 @@ bool BlackboardPlan::_set(const StringName &p_name, const Variant &p_value) {
|
|||
}
|
||||
|
||||
bool BlackboardPlan::_get(const StringName &p_name, Variant &r_ret) const {
|
||||
String prop_name = p_name;
|
||||
String name_str = p_name;
|
||||
|
||||
// * Editor
|
||||
if (var_map.has(prop_name)) {
|
||||
r_ret = var_map[prop_name].get_value();
|
||||
if (var_map.has(p_name)) {
|
||||
r_ret = var_map[p_name].get_value();
|
||||
return true;
|
||||
}
|
||||
|
||||
// * Storage
|
||||
if (!prop_name.begins_with("var/")) {
|
||||
if (!name_str.begins_with("var/")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String var_name = prop_name.get_slicec('/', 1);
|
||||
String what = prop_name.get_slicec('/', 2);
|
||||
StringName var_name = name_str.get_slicec('/', 1);
|
||||
String what = name_str.get_slicec('/', 2);
|
||||
ERR_FAIL_COND_V(!var_map.has(var_name), false);
|
||||
|
||||
if (what == "name") {
|
||||
|
@ -83,7 +83,7 @@ bool BlackboardPlan::_get(const StringName &p_name, Variant &r_ret) const {
|
|||
}
|
||||
|
||||
void BlackboardPlan::_get_property_list(List<PropertyInfo> *p_list) const {
|
||||
for (const Pair<String, BBVariable> &p : var_list) {
|
||||
for (const Pair<StringName, BBVariable> &p : var_list) {
|
||||
String var_name = p.first;
|
||||
BBVariable var = p.second;
|
||||
|
||||
|
@ -119,58 +119,59 @@ void BlackboardPlan::set_base_plan(const Ref<BlackboardPlan> &p_base) {
|
|||
notify_property_list_changed();
|
||||
}
|
||||
|
||||
void BlackboardPlan::add_var(const String &p_name, const BBVariable &p_var) {
|
||||
void BlackboardPlan::add_var(const StringName &p_name, const BBVariable &p_var) {
|
||||
ERR_FAIL_COND(var_map.has(p_name));
|
||||
var_map.insert(p_name, p_var);
|
||||
var_list.push_back(Pair<String, BBVariable>(p_name, p_var));
|
||||
var_list.push_back(Pair<StringName, BBVariable>(p_name, p_var));
|
||||
notify_property_list_changed();
|
||||
emit_changed();
|
||||
}
|
||||
|
||||
void BlackboardPlan::remove_var(const String &p_name) {
|
||||
void BlackboardPlan::remove_var(const StringName &p_name) {
|
||||
ERR_FAIL_COND(!var_map.has(p_name));
|
||||
var_list.erase(Pair<String, BBVariable>(p_name, var_map[p_name]));
|
||||
var_list.erase(Pair<StringName, BBVariable>(p_name, var_map[p_name]));
|
||||
var_map.erase(p_name);
|
||||
notify_property_list_changed();
|
||||
emit_changed();
|
||||
}
|
||||
|
||||
BBVariable BlackboardPlan::get_var(const String &p_name) {
|
||||
BBVariable BlackboardPlan::get_var(const StringName &p_name) {
|
||||
ERR_FAIL_COND_V(!var_map.has(p_name), BBVariable());
|
||||
return var_map.get(p_name);
|
||||
}
|
||||
|
||||
Pair<String, BBVariable> BlackboardPlan::get_var_by_index(int p_index) {
|
||||
Pair<String, BBVariable> ret;
|
||||
Pair<StringName, BBVariable> BlackboardPlan::get_var_by_index(int p_index) {
|
||||
Pair<StringName, BBVariable> ret;
|
||||
ERR_FAIL_INDEX_V(p_index, (int)var_map.size(), ret);
|
||||
return var_list[p_index];
|
||||
}
|
||||
|
||||
PackedStringArray BlackboardPlan::list_vars() const {
|
||||
PackedStringArray ret;
|
||||
for (const Pair<String, BBVariable> &p : var_list) {
|
||||
for (const Pair<StringName, BBVariable> &p : var_list) {
|
||||
ret.append(p.first);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
String BlackboardPlan::get_var_name(const BBVariable &p_var) const {
|
||||
for (const Pair<String, BBVariable> &p : var_list) {
|
||||
StringName BlackboardPlan::get_var_name(const BBVariable &p_var) const {
|
||||
for (const Pair<StringName, BBVariable> &p : var_list) {
|
||||
if (p.second == p_var) {
|
||||
return p.first;
|
||||
}
|
||||
}
|
||||
return String();
|
||||
return StringName();
|
||||
}
|
||||
|
||||
bool BlackboardPlan::is_valid_var_name(const String &p_name) const {
|
||||
if (p_name.begins_with("resource_")) {
|
||||
bool BlackboardPlan::is_valid_var_name(const StringName &p_name) const {
|
||||
String name_str = p_name;
|
||||
if (name_str.begins_with("resource_")) {
|
||||
return false;
|
||||
}
|
||||
return p_name.is_valid_identifier() && !var_map.has(p_name);
|
||||
return name_str.is_valid_identifier() && !var_map.has(p_name);
|
||||
}
|
||||
|
||||
void BlackboardPlan::rename_var(const String &p_name, const String &p_new_name) {
|
||||
void BlackboardPlan::rename_var(const StringName &p_name, const StringName &p_new_name) {
|
||||
if (p_name == p_new_name) {
|
||||
return;
|
||||
}
|
||||
|
@ -179,8 +180,8 @@ void BlackboardPlan::rename_var(const String &p_name, const String &p_new_name)
|
|||
ERR_FAIL_COND(!var_map.has(p_name));
|
||||
|
||||
BBVariable var = var_map[p_name];
|
||||
Pair<String, BBVariable> new_entry(p_new_name, var);
|
||||
Pair<String, BBVariable> old_entry(p_name, var);
|
||||
Pair<StringName, BBVariable> new_entry(p_new_name, var);
|
||||
Pair<StringName, BBVariable> old_entry(p_name, var);
|
||||
var_list.find(old_entry)->set(new_entry);
|
||||
|
||||
var_map.erase(p_name);
|
||||
|
@ -198,11 +199,11 @@ void BlackboardPlan::move_var(int p_index, int p_new_index) {
|
|||
return;
|
||||
}
|
||||
|
||||
List<Pair<String, BBVariable>>::Element *E = var_list.front();
|
||||
List<Pair<StringName, BBVariable>>::Element *E = var_list.front();
|
||||
for (int i = 0; i < p_index; i++) {
|
||||
E = E->next();
|
||||
}
|
||||
List<Pair<String, BBVariable>>::Element *E2 = var_list.front();
|
||||
List<Pair<StringName, BBVariable>>::Element *E2 = var_list.front();
|
||||
for (int i = 0; i < p_new_index; i++) {
|
||||
E2 = E2->next();
|
||||
}
|
||||
|
@ -224,8 +225,8 @@ void BlackboardPlan::sync_with_base_plan() {
|
|||
bool changed = false;
|
||||
|
||||
// Sync variables with the base plan.
|
||||
for (const Pair<String, BBVariable> &p : base->var_list) {
|
||||
const String &base_name = p.first;
|
||||
for (const Pair<StringName, BBVariable> &p : base->var_list) {
|
||||
const StringName &base_name = p.first;
|
||||
const BBVariable &base_var = p.second;
|
||||
|
||||
if (!var_map.has(base_name)) {
|
||||
|
@ -249,7 +250,7 @@ void BlackboardPlan::sync_with_base_plan() {
|
|||
}
|
||||
|
||||
// Erase variables that do not exist in the base plan.
|
||||
for (const Pair<String, BBVariable> &p : var_list) {
|
||||
for (const Pair<StringName, BBVariable> &p : var_list) {
|
||||
if (!base->has_var(p.first)) {
|
||||
remove_var(p.first);
|
||||
changed = true;
|
||||
|
@ -264,14 +265,14 @@ void BlackboardPlan::sync_with_base_plan() {
|
|||
|
||||
Ref<Blackboard> BlackboardPlan::create_blackboard() {
|
||||
Ref<Blackboard> bb = memnew(Blackboard);
|
||||
for (const Pair<String, BBVariable> &p : var_list) {
|
||||
for (const Pair<StringName, BBVariable> &p : var_list) {
|
||||
bb->add_var(p.first, p.second.duplicate());
|
||||
}
|
||||
return bb;
|
||||
}
|
||||
|
||||
void BlackboardPlan::populate_blackboard(const Ref<Blackboard> &p_blackboard, bool overwrite) {
|
||||
for (const Pair<String, BBVariable> &p : var_list) {
|
||||
for (const Pair<StringName, BBVariable> &p : var_list) {
|
||||
if (p_blackboard->has_var(p.first)) {
|
||||
if (overwrite) {
|
||||
p_blackboard->erase_var(p.first);
|
||||
|
|
|
@ -28,8 +28,8 @@ class BlackboardPlan : public Resource {
|
|||
GDCLASS(BlackboardPlan, Resource);
|
||||
|
||||
private:
|
||||
List<Pair<String, BBVariable>> var_list;
|
||||
HashMap<String, BBVariable> var_map;
|
||||
List<Pair<StringName, BBVariable>> var_list;
|
||||
HashMap<StringName, BBVariable> var_map;
|
||||
|
||||
// When base is not null, the plan is considered to be derived from the base plan.
|
||||
// A derived plan can only have variables that exist in the base plan,
|
||||
|
@ -49,18 +49,18 @@ public:
|
|||
void set_base_plan(const Ref<BlackboardPlan> &p_base);
|
||||
Ref<BlackboardPlan> get_base_plan() const { return base; }
|
||||
|
||||
void add_var(const String &p_name, const BBVariable &p_var);
|
||||
void remove_var(const String &p_name);
|
||||
BBVariable get_var(const String &p_name);
|
||||
Pair<String, BBVariable> get_var_by_index(int p_index);
|
||||
bool has_var(const String &p_name) { return var_map.has(p_name); }
|
||||
void add_var(const StringName &p_name, const BBVariable &p_var);
|
||||
void remove_var(const StringName &p_name);
|
||||
BBVariable get_var(const StringName &p_name);
|
||||
Pair<StringName, BBVariable> get_var_by_index(int p_index);
|
||||
bool has_var(const StringName &p_name) { return var_map.has(p_name); }
|
||||
bool is_empty() const { return var_map.is_empty(); }
|
||||
int get_var_count() const { return var_map.size(); }
|
||||
|
||||
PackedStringArray list_vars() const;
|
||||
String get_var_name(const BBVariable &p_var) const;
|
||||
bool is_valid_var_name(const String &p_name) const;
|
||||
void rename_var(const String &p_name, const String &p_new_name);
|
||||
StringName get_var_name(const BBVariable &p_var) const;
|
||||
bool is_valid_var_name(const StringName &p_name) const;
|
||||
void rename_var(const StringName &p_name, const StringName &p_new_name);
|
||||
void move_var(int p_index, int p_new_index);
|
||||
|
||||
void sync_with_base_plan();
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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<BehaviorTree> behavior_tree;
|
||||
Ref<BTTask> 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<BTTask> 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
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -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
|
||||
#endif // BT_CHECK_TRIGGER
|
||||
|
|
|
@ -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<BBVariant> p_value) {
|
||||
void BTCheckVar::set_value(const Ref<BBVariant> &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<BBVariant> 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");
|
||||
}
|
||||
|
|
|
@ -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<BBVariant> 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<BBVariant> p_value);
|
||||
void set_value(const Ref<BBVariant> &p_value);
|
||||
Ref<BBVariant> get_value() const { return value; }
|
||||
};
|
||||
|
||||
#endif // BT_CHECK_VAR_H
|
||||
#endif // BT_CHECK_VAR_H
|
||||
|
|
|
@ -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<BBVariant> p_value) {
|
||||
void BTSetVar::set_value(const Ref<BBVariant> &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");
|
||||
}
|
||||
|
|
|
@ -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<BBVariant> 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<BBVariant> p_value);
|
||||
void set_value(const Ref<BBVariant> &p_value);
|
||||
Ref<BBVariant> get_value() const { return value; }
|
||||
|
||||
void set_operation(LimboUtility::Operation p_operation);
|
||||
LimboUtility::Operation get_operation() const { return operation; }
|
||||
};
|
||||
|
||||
#endif // BT_SET_VAR
|
||||
#endif // BT_SET_VAR
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -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<SceneTreeTimer> 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
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -21,7 +21,7 @@ void BTAwaitAnimation::set_animation_player(Ref<BBNode> 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.");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ public:
|
|||
void set_animation_player(Ref<BBNode> p_animation_player);
|
||||
Ref<BBNode> 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);
|
||||
|
|
|
@ -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.");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<BBNode> p_object) {
|
||||
void BTCallMethod::set_node_param(const Ref<BBNode> &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<BBVariant> 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");
|
||||
|
|
|
@ -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<BBNode> node_param;
|
||||
TypedArray<BBVariant> 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<BBNode> p_object);
|
||||
void set_node_param(const Ref<BBNode> &p_object);
|
||||
Ref<BBNode> get_node_param() const { return node_param; }
|
||||
|
||||
void set_args(TypedArray<BBVariant> 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;
|
||||
|
||||
|
|
|
@ -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<BBVariant> &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");
|
||||
|
|
|
@ -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<BBVariant> 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;
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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).
|
||||
|
|
|
@ -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).
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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")]
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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")]
|
||||
|
|
|
@ -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")
|
|
@ -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")
|
|
@ -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")
|
|
@ -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")
|
|
@ -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")
|
|
@ -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")
|
|
@ -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")
|
|
@ -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")
|
|
@ -38,7 +38,7 @@ Properties
|
|||
+----------------------------------------------+----------------------------------------------------------+----------+
|
||||
| :ref:`ValueSource<enum_BBParam_ValueSource>` | :ref:`value_source<class_BBParam_property_value_source>` | ``0`` |
|
||||
+----------------------------------------------+----------------------------------------------------------+----------+
|
||||
| String | :ref:`variable<class_BBParam_property_variable>` | |
|
||||
| StringName | :ref:`variable<class_BBParam_property_variable>` | |
|
||||
+----------------------------------------------+----------------------------------------------------------+----------+
|
||||
|
||||
.. rst-class:: classref-reftable-group
|
||||
|
@ -133,12 +133,12 @@ Specifies the source of the value for BBParam. See :ref:`ValueSource<enum_BBPara
|
|||
|
||||
.. 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** **(** **)**
|
||||
|
||||
Stores the name of a :ref:`Blackboard<class_Blackboard>` variable when :ref:`value_source<class_BBParam_property_value_source>` is set to :ref:`BLACKBOARD_VAR<class_BBParam_constant_BLACKBOARD_VAR>`.
|
||||
|
||||
|
|
|
@ -33,27 +33,27 @@ Methods
|
|||
.. table::
|
||||
:widths: auto
|
||||
|
||||
+-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`bind_var_to_property<class_Blackboard_method_bind_var_to_property>` **(** String p_name, Object p_object, StringName p_property **)** |
|
||||
+-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`erase_var<class_Blackboard_method_erase_var>` **(** String p_name **)** |
|
||||
+-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`Blackboard<class_Blackboard>` | :ref:`get_parent<class_Blackboard_method_get_parent>` **(** **)** |const| |
|
||||
+-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| Variant | :ref:`get_var<class_Blackboard_method_get_var>` **(** String p_name, Variant p_default=null, bool p_complain=true **)** |const| |
|
||||
+-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| bool | :ref:`has_var<class_Blackboard_method_has_var>` **(** String p_name **)** |const| |
|
||||
+-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`prefetch_nodepath_vars<class_Blackboard_method_prefetch_nodepath_vars>` **(** Node p_node **)** |
|
||||
+-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`set_parent<class_Blackboard_method_set_parent>` **(** :ref:`Blackboard<class_Blackboard>` p_blackboard **)** |
|
||||
+-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`set_var<class_Blackboard_method_set_var>` **(** String p_name, Variant p_value **)** |
|
||||
+-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`Blackboard<class_Blackboard>` | :ref:`top<class_Blackboard_method_top>` **(** **)** |const| |
|
||||
+-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`unbind_var<class_Blackboard_method_unbind_var>` **(** String p_name **)** |
|
||||
+-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
+-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`bind_var_to_property<class_Blackboard_method_bind_var_to_property>` **(** StringName p_name, Object p_object, StringName p_property **)** |
|
||||
+-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`erase_var<class_Blackboard_method_erase_var>` **(** StringName p_name **)** |
|
||||
+-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`Blackboard<class_Blackboard>` | :ref:`get_parent<class_Blackboard_method_get_parent>` **(** **)** |const| |
|
||||
+-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| Variant | :ref:`get_var<class_Blackboard_method_get_var>` **(** StringName p_name, Variant p_default=null, bool p_complain=true **)** |const| |
|
||||
+-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| bool | :ref:`has_var<class_Blackboard_method_has_var>` **(** StringName p_name **)** |const| |
|
||||
+-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`prefetch_nodepath_vars<class_Blackboard_method_prefetch_nodepath_vars>` **(** Node p_node **)** |
|
||||
+-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`set_parent<class_Blackboard_method_set_parent>` **(** :ref:`Blackboard<class_Blackboard>` p_blackboard **)** |
|
||||
+-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`set_var<class_Blackboard_method_set_var>` **(** StringName p_name, Variant p_value **)** |
|
||||
+-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`Blackboard<class_Blackboard>` | :ref:`top<class_Blackboard_method_top>` **(** **)** |const| |
|
||||
+-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`unbind_var<class_Blackboard_method_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.
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ Constructs a new instance of a :ref:`Blackboard<class_Blackboard>` using this pl
|
|||
|
||||
void **populate_blackboard** **(** :ref:`Blackboard<class_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.)`
|
||||
|
|
|
@ -40,7 +40,7 @@ Properties
|
|||
+-------------------------------------+---------------------------------------------------------------------------+-----------+
|
||||
| :ref:`BBNode<class_BBNode>` | :ref:`node<class_BTCallMethod_property_node>` | |
|
||||
+-------------------------------------+---------------------------------------------------------------------------+-----------+
|
||||
| String | :ref:`result_var<class_BTCallMethod_property_result_var>` | ``""`` |
|
||||
| StringName | :ref:`result_var<class_BTCallMethod_property_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.
|
||||
|
||||
|
|
|
@ -31,9 +31,9 @@ Properties
|
|||
.. table::
|
||||
:widths: auto
|
||||
|
||||
+--------+---------------------------------------------------------+--------+
|
||||
| String | :ref:`variable<class_BTCheckTrigger_property_variable>` | ``""`` |
|
||||
+--------+---------------------------------------------------------+--------+
|
||||
+------------+---------------------------------------------------------+---------+
|
||||
| StringName | :ref:`variable<class_BTCheckTrigger_property_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<class_BTTask_property_blackboard>`.
|
||||
|
||||
|
|
|
@ -29,13 +29,13 @@ Properties
|
|||
.. table::
|
||||
:widths: auto
|
||||
|
||||
+-----------------------------------------------+---------------------------------------------------------+--------+
|
||||
| :ref:`CheckType<enum_LimboUtility_CheckType>` | :ref:`check_type<class_BTCheckVar_property_check_type>` | ``0`` |
|
||||
+-----------------------------------------------+---------------------------------------------------------+--------+
|
||||
| :ref:`BBVariant<class_BBVariant>` | :ref:`value<class_BTCheckVar_property_value>` | |
|
||||
+-----------------------------------------------+---------------------------------------------------------+--------+
|
||||
| String | :ref:`variable<class_BTCheckVar_property_variable>` | ``""`` |
|
||||
+-----------------------------------------------+---------------------------------------------------------+--------+
|
||||
+-----------------------------------------------+---------------------------------------------------------+---------+
|
||||
| :ref:`CheckType<enum_LimboUtility_CheckType>` | :ref:`check_type<class_BTCheckVar_property_check_type>` | ``0`` |
|
||||
+-----------------------------------------------+---------------------------------------------------------+---------+
|
||||
| :ref:`BBVariant<class_BBVariant>` | :ref:`value<class_BTCheckVar_property_value>` | |
|
||||
+-----------------------------------------------+---------------------------------------------------------+---------+
|
||||
| StringName | :ref:`variable<class_BTCheckVar_property_variable>` | ``&""`` |
|
||||
+-----------------------------------------------+---------------------------------------------------------+---------+
|
||||
|
||||
.. rst-class:: classref-section-separator
|
||||
|
||||
|
@ -84,12 +84,12 @@ A parameter that specifies the value against which the :ref:`variable<class_BTCh
|
|||
|
||||
.. 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** **(** **)**
|
||||
|
||||
The name of the variable to check its value.
|
||||
|
||||
|
|
|
@ -35,17 +35,17 @@ Properties
|
|||
.. table::
|
||||
:widths: auto
|
||||
|
||||
+--------+-------------------------------------------------------------------------+-----------+
|
||||
| String | :ref:`cooldown_state_var<class_BTCooldown_property_cooldown_state_var>` | ``""`` |
|
||||
+--------+-------------------------------------------------------------------------+-----------+
|
||||
| float | :ref:`duration<class_BTCooldown_property_duration>` | ``10.0`` |
|
||||
+--------+-------------------------------------------------------------------------+-----------+
|
||||
| bool | :ref:`process_pause<class_BTCooldown_property_process_pause>` | ``false`` |
|
||||
+--------+-------------------------------------------------------------------------+-----------+
|
||||
| bool | :ref:`start_cooled<class_BTCooldown_property_start_cooled>` | ``false`` |
|
||||
+--------+-------------------------------------------------------------------------+-----------+
|
||||
| bool | :ref:`trigger_on_failure<class_BTCooldown_property_trigger_on_failure>` | ``false`` |
|
||||
+--------+-------------------------------------------------------------------------+-----------+
|
||||
+------------+-------------------------------------------------------------------------+-----------+
|
||||
| StringName | :ref:`cooldown_state_var<class_BTCooldown_property_cooldown_state_var>` | ``&""`` |
|
||||
+------------+-------------------------------------------------------------------------+-----------+
|
||||
| float | :ref:`duration<class_BTCooldown_property_duration>` | ``10.0`` |
|
||||
+------------+-------------------------------------------------------------------------+-----------+
|
||||
| bool | :ref:`process_pause<class_BTCooldown_property_process_pause>` | ``false`` |
|
||||
+------------+-------------------------------------------------------------------------+-----------+
|
||||
| bool | :ref:`start_cooled<class_BTCooldown_property_start_cooled>` | ``false`` |
|
||||
+------------+-------------------------------------------------------------------------+-----------+
|
||||
| bool | :ref:`trigger_on_failure<class_BTCooldown_property_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<class_Blackboard>`. If left empty, the variable will be automatically generated and assigned.
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ Properties
|
|||
+-------------------------------------+-------------------------------------------------------------------------------------+-------------------------+
|
||||
| :ref:`BBNode<class_BBNode>` | :ref:`node<class_BTEvaluateExpression_property_node>` | |
|
||||
+-------------------------------------+-------------------------------------------------------------------------------------+-------------------------+
|
||||
| String | :ref:`result_var<class_BTEvaluateExpression_property_result_var>` | ``""`` |
|
||||
| StringName | :ref:`result_var<class_BTEvaluateExpression_property_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.
|
||||
|
||||
|
|
|
@ -35,11 +35,11 @@ Properties
|
|||
.. table::
|
||||
:widths: auto
|
||||
|
||||
+--------+------------------------------------------------------+--------+
|
||||
| String | :ref:`array_var<class_BTForEach_property_array_var>` | ``""`` |
|
||||
+--------+------------------------------------------------------+--------+
|
||||
| String | :ref:`save_var<class_BTForEach_property_save_var>` | ``""`` |
|
||||
+--------+------------------------------------------------------+--------+
|
||||
+------------+------------------------------------------------------+---------+
|
||||
| StringName | :ref:`array_var<class_BTForEach_property_array_var>` | ``&""`` |
|
||||
+------------+------------------------------------------------------+---------+
|
||||
| StringName | :ref:`save_var<class_BTForEach_property_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<class_Blackboard>` that holds an ``Array``, which is used for the iteration process.
|
||||
|
||||
|
@ -71,12 +71,12 @@ A variable within the :ref:`Blackboard<class_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<class_Blackboard>` variable used to store an element of the array referenced by :ref:`array_var<class_BTForEach_property_array_var>`.
|
||||
|
||||
|
|
|
@ -31,13 +31,13 @@ Properties
|
|||
.. table::
|
||||
:widths: auto
|
||||
|
||||
+-----------------------------------------------+-----------------------------------------------------+--------+
|
||||
| :ref:`Operation<enum_LimboUtility_Operation>` | :ref:`operation<class_BTSetVar_property_operation>` | ``0`` |
|
||||
+-----------------------------------------------+-----------------------------------------------------+--------+
|
||||
| :ref:`BBVariant<class_BBVariant>` | :ref:`value<class_BTSetVar_property_value>` | |
|
||||
+-----------------------------------------------+-----------------------------------------------------+--------+
|
||||
| String | :ref:`variable<class_BTSetVar_property_variable>` | ``""`` |
|
||||
+-----------------------------------------------+-----------------------------------------------------+--------+
|
||||
+-----------------------------------------------+-----------------------------------------------------+---------+
|
||||
| :ref:`Operation<enum_LimboUtility_Operation>` | :ref:`operation<class_BTSetVar_property_operation>` | ``0`` |
|
||||
+-----------------------------------------------+-----------------------------------------------------+---------+
|
||||
| :ref:`BBVariant<class_BBVariant>` | :ref:`value<class_BTSetVar_property_value>` | |
|
||||
+-----------------------------------------------+-----------------------------------------------------+---------+
|
||||
| StringName | :ref:`variable<class_BTSetVar_property_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.
|
||||
|
||||
|
|
|
@ -29,13 +29,13 @@ Properties
|
|||
.. table::
|
||||
:widths: auto
|
||||
|
||||
+-----------------------------------------+------------------------------------------------------------+---------------+
|
||||
| :ref:`BehaviorTree<class_BehaviorTree>` | :ref:`behavior_tree<class_BTState_property_behavior_tree>` | |
|
||||
+-----------------------------------------+------------------------------------------------------------+---------------+
|
||||
| String | :ref:`failure_event<class_BTState_property_failure_event>` | ``"failure"`` |
|
||||
+-----------------------------------------+------------------------------------------------------------+---------------+
|
||||
| String | :ref:`success_event<class_BTState_property_success_event>` | ``"success"`` |
|
||||
+-----------------------------------------+------------------------------------------------------------+---------------+
|
||||
+-----------------------------------------+------------------------------------------------------------+----------------+
|
||||
| :ref:`BehaviorTree<class_BehaviorTree>` | :ref:`behavior_tree<class_BTState_property_behavior_tree>` | |
|
||||
+-----------------------------------------+------------------------------------------------------------+----------------+
|
||||
| StringName | :ref:`failure_event<class_BTState_property_failure_event>` | ``&"failure"`` |
|
||||
+-----------------------------------------+------------------------------------------------------------+----------------+
|
||||
| StringName | :ref:`success_event<class_BTState_property_success_event>` | ``&"success"`` |
|
||||
+-----------------------------------------+------------------------------------------------------------+----------------+
|
||||
|
||||
.. rst-class:: classref-reftable-group
|
||||
|
||||
|
@ -79,12 +79,12 @@ A :ref:`BehaviorTree<class_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<class_LimboState_method_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<class_LimboState_method_dispatch>`.
|
||||
|
||||
|
|
|
@ -45,19 +45,19 @@ Methods
|
|||
.. table::
|
||||
:widths: auto
|
||||
|
||||
+-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`add_transition<class_LimboHSM_method_add_transition>` **(** :ref:`LimboState<class_LimboState>` p_from_state, :ref:`LimboState<class_LimboState>` p_to_state, String p_event **)** |
|
||||
+-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`LimboState<class_LimboState>` | :ref:`get_active_state<class_LimboHSM_method_get_active_state>` **(** **)** |const| |
|
||||
+-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`LimboState<class_LimboState>` | :ref:`get_leaf_state<class_LimboHSM_method_get_leaf_state>` **(** **)** |const| |
|
||||
+-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`initialize<class_LimboHSM_method_initialize>` **(** Node p_agent, :ref:`Blackboard<class_Blackboard>` p_parent_scope=null **)** |
|
||||
+-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`set_active<class_LimboHSM_method_set_active>` **(** bool p_active **)** |
|
||||
+-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`update<class_LimboHSM_method_update>` **(** float p_delta **)** |
|
||||
+-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
+-------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`add_transition<class_LimboHSM_method_add_transition>` **(** :ref:`LimboState<class_LimboState>` p_from_state, :ref:`LimboState<class_LimboState>` p_to_state, StringName p_event **)** |
|
||||
+-------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`LimboState<class_LimboState>` | :ref:`get_active_state<class_LimboHSM_method_get_active_state>` **(** **)** |const| |
|
||||
+-------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`LimboState<class_LimboState>` | :ref:`get_leaf_state<class_LimboHSM_method_get_leaf_state>` **(** **)** |const| |
|
||||
+-------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`initialize<class_LimboHSM_method_initialize>` **(** Node p_agent, :ref:`Blackboard<class_Blackboard>` p_parent_scope=null **)** |
|
||||
+-------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`set_active<class_LimboHSM_method_set_active>` **(** bool p_active **)** |
|
||||
+-------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`update<class_LimboHSM_method_update>` **(** float p_delta **)** |
|
||||
+-------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
.. rst-class:: classref-section-separator
|
||||
|
||||
|
@ -183,7 +183,7 @@ Method Descriptions
|
|||
|
||||
.. rst-class:: classref-method
|
||||
|
||||
void **add_transition** **(** :ref:`LimboState<class_LimboState>` p_from_state, :ref:`LimboState<class_LimboState>` p_to_state, String p_event **)**
|
||||
void **add_transition** **(** :ref:`LimboState<class_LimboState>` p_from_state, :ref:`LimboState<class_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.
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ Properties
|
|||
:widths: auto
|
||||
|
||||
+---------------------------------------------+-------------------------------------------------------------------+
|
||||
| String | :ref:`EVENT_FINISHED<class_LimboState_property_EVENT_FINISHED>` |
|
||||
| StringName | :ref:`EVENT_FINISHED<class_LimboState_property_EVENT_FINISHED>` |
|
||||
+---------------------------------------------+-------------------------------------------------------------------+
|
||||
| Node | :ref:`agent<class_LimboState_property_agent>` |
|
||||
+---------------------------------------------+-------------------------------------------------------------------+
|
||||
|
@ -53,35 +53,35 @@ Methods
|
|||
.. table::
|
||||
:widths: auto
|
||||
|
||||
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`_enter<class_LimboState_private_method__enter>` **(** **)** |virtual| |
|
||||
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`_exit<class_LimboState_private_method__exit>` **(** **)** |virtual| |
|
||||
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`_setup<class_LimboState_private_method__setup>` **(** **)** |virtual| |
|
||||
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`_update<class_LimboState_private_method__update>` **(** float p_delta **)** |virtual| |
|
||||
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`add_event_handler<class_LimboState_method_add_event_handler>` **(** String p_event, Callable p_handler **)** |
|
||||
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`LimboState<class_LimboState>` | :ref:`call_on_enter<class_LimboState_method_call_on_enter>` **(** Callable p_callable **)** |
|
||||
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`LimboState<class_LimboState>` | :ref:`call_on_exit<class_LimboState_method_call_on_exit>` **(** Callable p_callable **)** |
|
||||
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`LimboState<class_LimboState>` | :ref:`call_on_update<class_LimboState_method_call_on_update>` **(** Callable p_callable **)** |
|
||||
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`clear_guard<class_LimboState_method_clear_guard>` **(** **)** |
|
||||
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------+
|
||||
| bool | :ref:`dispatch<class_LimboState_method_dispatch>` **(** String p_event, Variant p_cargo=null **)** |
|
||||
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`LimboState<class_LimboState>` | :ref:`get_root<class_LimboState_method_get_root>` **(** **)** |const| |
|
||||
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------+
|
||||
| bool | :ref:`is_active<class_LimboState_method_is_active>` **(** **)** |const| |
|
||||
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`LimboState<class_LimboState>` | :ref:`named<class_LimboState_method_named>` **(** String p_name **)** |
|
||||
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`set_guard<class_LimboState_method_set_guard>` **(** Callable p_guard_callable **)** |
|
||||
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------+
|
||||
+-------------------------------------+------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`_enter<class_LimboState_private_method__enter>` **(** **)** |virtual| |
|
||||
+-------------------------------------+------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`_exit<class_LimboState_private_method__exit>` **(** **)** |virtual| |
|
||||
+-------------------------------------+------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`_setup<class_LimboState_private_method__setup>` **(** **)** |virtual| |
|
||||
+-------------------------------------+------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`_update<class_LimboState_private_method__update>` **(** float p_delta **)** |virtual| |
|
||||
+-------------------------------------+------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`add_event_handler<class_LimboState_method_add_event_handler>` **(** StringName p_event, Callable p_handler **)** |
|
||||
+-------------------------------------+------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`LimboState<class_LimboState>` | :ref:`call_on_enter<class_LimboState_method_call_on_enter>` **(** Callable p_callable **)** |
|
||||
+-------------------------------------+------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`LimboState<class_LimboState>` | :ref:`call_on_exit<class_LimboState_method_call_on_exit>` **(** Callable p_callable **)** |
|
||||
+-------------------------------------+------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`LimboState<class_LimboState>` | :ref:`call_on_update<class_LimboState_method_call_on_update>` **(** Callable p_callable **)** |
|
||||
+-------------------------------------+------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`clear_guard<class_LimboState_method_clear_guard>` **(** **)** |
|
||||
+-------------------------------------+------------------------------------------------------------------------------------------------------------------------+
|
||||
| bool | :ref:`dispatch<class_LimboState_method_dispatch>` **(** StringName p_event, Variant p_cargo=null **)** |
|
||||
+-------------------------------------+------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`LimboState<class_LimboState>` | :ref:`get_root<class_LimboState_method_get_root>` **(** **)** |const| |
|
||||
+-------------------------------------+------------------------------------------------------------------------------------------------------------------------+
|
||||
| bool | :ref:`is_active<class_LimboState_method_is_active>` **(** **)** |const| |
|
||||
+-------------------------------------+------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`LimboState<class_LimboState>` | :ref:`named<class_LimboState_method_named>` **(** String p_name **)** |
|
||||
+-------------------------------------+------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`set_guard<class_LimboState_method_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.
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ and point it to the proper node in the :ref:`BTPlayer<class_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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<class_LimboState_method_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")
|
||||
|
|
|
@ -19,7 +19,7 @@ Here's an example of how you can interact with the :ref:`Blackboard<class_Blackb
|
|||
|
||||
.. code:: gdscript
|
||||
|
||||
@export var speed_var: String = "speed"
|
||||
@export var speed_var: StringName = &"speed"
|
||||
|
||||
func _tick(delta: float) -> 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):
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
<member name="value_source" type="int" setter="set_value_source" getter="get_value_source" enum="BBParam.ValueSource" default="0">
|
||||
Specifies the source of the value for BBParam. See [enum ValueSource].
|
||||
</member>
|
||||
<member name="variable" type="String" setter="set_variable" getter="get_variable">
|
||||
<member name="variable" type="StringName" setter="set_variable" getter="get_variable">
|
||||
Stores the name of a [Blackboard] variable when [member value_source] is set to [constant BLACKBOARD_VAR].
|
||||
</member>
|
||||
</members>
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
<member name="node" type="BBNode" setter="set_node_param" getter="get_node_param">
|
||||
Specifies the [Node] or [Object] instance containing the method to be called.
|
||||
</member>
|
||||
<member name="result_var" type="String" setter="set_result_var" getter="get_result_var" default="""">
|
||||
<member name="result_var" type="StringName" setter="set_result_var" getter="get_result_var" default="&""">
|
||||
if non-empty, assign the result of the method call to the blackboard variable specified by this property.
|
||||
</member>
|
||||
</members>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<tutorials>
|
||||
</tutorials>
|
||||
<members>
|
||||
<member name="variable" type="String" setter="set_variable" getter="get_variable" default="""">
|
||||
<member name="variable" type="StringName" setter="set_variable" getter="get_variable" default="&""">
|
||||
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].
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<member name="value" type="BBVariant" setter="set_value" getter="get_value">
|
||||
A parameter that specifies the value against which the [member variable] will be compared.
|
||||
</member>
|
||||
<member name="variable" type="String" setter="set_variable" getter="get_variable" default="""">
|
||||
<member name="variable" type="StringName" setter="set_variable" getter="get_variable" default="&""">
|
||||
The name of the variable to check its value.
|
||||
</member>
|
||||
</members>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<tutorials>
|
||||
</tutorials>
|
||||
<members>
|
||||
<member name="cooldown_state_var" type="String" setter="set_cooldown_state_var" getter="get_cooldown_state_var" default="""">
|
||||
<member name="cooldown_state_var" type="StringName" setter="set_cooldown_state_var" getter="get_cooldown_state_var" default="&""">
|
||||
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].
|
||||
</member>
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
<member name="node" type="BBNode" setter="set_node_param" getter="get_node_param">
|
||||
Specifies the [Node] or [Object] instance containing the method to be called.
|
||||
</member>
|
||||
<member name="result_var" type="String" setter="set_result_var" getter="get_result_var" default="""">
|
||||
<member name="result_var" type="StringName" setter="set_result_var" getter="get_result_var" default="&""">
|
||||
if non-empty, assign the result of the method call to the blackboard variable specified by this property.
|
||||
</member>
|
||||
</members>
|
||||
|
|
|
@ -12,10 +12,10 @@
|
|||
<tutorials>
|
||||
</tutorials>
|
||||
<members>
|
||||
<member name="array_var" type="String" setter="set_array_var" getter="get_array_var" default="""">
|
||||
<member name="array_var" type="StringName" setter="set_array_var" getter="get_array_var" default="&""">
|
||||
A variable within the [Blackboard] that holds an [Array], which is used for the iteration process.
|
||||
</member>
|
||||
<member name="save_var" type="String" setter="set_save_var" getter="get_save_var" default="""">
|
||||
<member name="save_var" type="StringName" setter="set_save_var" getter="get_save_var" default="&""">
|
||||
A [Blackboard] variable used to store an element of the array referenced by [member array_var].
|
||||
</member>
|
||||
</members>
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<member name="value" type="BBVariant" setter="set_value" getter="get_value">
|
||||
Parameter that specifies the value to be assigned to the variable.
|
||||
</member>
|
||||
<member name="variable" type="String" setter="set_variable" getter="get_variable" default="""">
|
||||
<member name="variable" type="StringName" setter="set_variable" getter="get_variable" default="&""">
|
||||
Name of the variable to which the value will be assigned.
|
||||
</member>
|
||||
</members>
|
||||
|
|
|
@ -20,10 +20,10 @@
|
|||
<member name="behavior_tree" type="BehaviorTree" setter="set_behavior_tree" getter="get_behavior_tree">
|
||||
A [BehaviorTree] resource that defines state behavior.
|
||||
</member>
|
||||
<member name="failure_event" type="String" setter="set_failure_event" getter="get_failure_event" default=""failure"">
|
||||
<member name="failure_event" type="StringName" setter="set_failure_event" getter="get_failure_event" default="&"failure"">
|
||||
HSM event that will be dispatched when the behavior tree results in [code]FAILURE[/code]. See [method LimboState.dispatch].
|
||||
</member>
|
||||
<member name="success_event" type="String" setter="set_success_event" getter="get_success_event" default=""success"">
|
||||
<member name="success_event" type="StringName" setter="set_success_event" getter="get_success_event" default="&"success"">
|
||||
HSM event that will be dispatched when the behavior tree results in [code]SUCCESS[/code]. See [method LimboState.dispatch].
|
||||
</member>
|
||||
</members>
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<methods>
|
||||
<method name="bind_var_to_property">
|
||||
<return type="void" />
|
||||
<param index="0" name="p_name" type="String" />
|
||||
<param index="0" name="p_name" type="StringName" />
|
||||
<param index="1" name="p_object" type="Object" />
|
||||
<param index="2" name="p_property" type="StringName" />
|
||||
<description>
|
||||
|
@ -22,7 +22,7 @@
|
|||
</method>
|
||||
<method name="erase_var">
|
||||
<return type="void" />
|
||||
<param index="0" name="p_name" type="String" />
|
||||
<param index="0" name="p_name" type="StringName" />
|
||||
<description>
|
||||
Removes a variable by its name.
|
||||
</description>
|
||||
|
@ -35,7 +35,7 @@
|
|||
</method>
|
||||
<method name="get_var" qualifiers="const">
|
||||
<return type="Variant" />
|
||||
<param index="0" name="p_name" type="String" />
|
||||
<param index="0" name="p_name" type="StringName" />
|
||||
<param index="1" name="p_default" type="Variant" default="null" />
|
||||
<param index="2" name="p_complain" type="bool" default="true" />
|
||||
<description>
|
||||
|
@ -44,7 +44,7 @@
|
|||
</method>
|
||||
<method name="has_var" qualifiers="const">
|
||||
<return type="bool" />
|
||||
<param index="0" name="p_name" type="String" />
|
||||
<param index="0" name="p_name" type="StringName" />
|
||||
<description>
|
||||
Returns [code]true[/code] if the Blackboard contains the [param p_name] variable, including the parent scopes.
|
||||
</description>
|
||||
|
@ -65,7 +65,7 @@
|
|||
</method>
|
||||
<method name="set_var">
|
||||
<return type="void" />
|
||||
<param index="0" name="p_name" type="String" />
|
||||
<param index="0" name="p_name" type="StringName" />
|
||||
<param index="1" name="p_value" type="Variant" />
|
||||
<description>
|
||||
Assigns a value to a Blackboard variable.
|
||||
|
@ -79,7 +79,7 @@
|
|||
</method>
|
||||
<method name="unbind_var">
|
||||
<return type="void" />
|
||||
<param index="0" name="p_name" type="String" />
|
||||
<param index="0" name="p_name" type="StringName" />
|
||||
<description>
|
||||
Remove binding from a variable.
|
||||
</description>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<param index="0" name="p_blackboard" type="Blackboard" />
|
||||
<param index="1" name="p_overwrite" type="bool" />
|
||||
<description>
|
||||
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.
|
||||
</description>
|
||||
</method>
|
||||
</methods>
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<return type="void" />
|
||||
<param index="0" name="p_from_state" type="LimboState" />
|
||||
<param index="1" name="p_to_state" type="LimboState" />
|
||||
<param index="2" name="p_event" type="String" />
|
||||
<param index="2" name="p_event" type="StringName" />
|
||||
<description>
|
||||
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.
|
||||
</description>
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
</method>
|
||||
<method name="add_event_handler">
|
||||
<return type="void" />
|
||||
<param index="0" name="p_event" type="String" />
|
||||
<param index="0" name="p_event" type="StringName" />
|
||||
<param index="1" name="p_handler" type="Callable" />
|
||||
<description>
|
||||
Registers a [param p_handler] to be called when [param p_event] is dispatched.
|
||||
|
@ -73,7 +73,7 @@
|
|||
</method>
|
||||
<method name="dispatch">
|
||||
<return type="bool" />
|
||||
<param index="0" name="p_event" type="String" />
|
||||
<param index="0" name="p_event" type="StringName" />
|
||||
<param index="1" name="p_cargo" type="Variant" default="null" />
|
||||
<description>
|
||||
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 @@
|
|||
</method>
|
||||
</methods>
|
||||
<members>
|
||||
<member name="EVENT_FINISHED" type="String" setter="" getter="event_finished">
|
||||
<member name="EVENT_FINISHED" type="StringName" setter="" getter="event_finished">
|
||||
A commonly used event that indicates that the state has finished its work.
|
||||
</member>
|
||||
<member name="agent" type="Node" setter="set_agent" getter="get_agent">
|
||||
|
|
|
@ -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<BlackboardPlan> &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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ private:
|
|||
int drag_index = -1;
|
||||
|
||||
Ref<BlackboardPlan> 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<BlackboardPlan> &p_plan);
|
||||
void set_next_var_name(const String &p_name);
|
||||
void set_next_var_name(const StringName &p_name);
|
||||
|
||||
BlackboardPlanEditor();
|
||||
};
|
||||
|
|
|
@ -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<PropertyUsageFlags> 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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<LimboState>(p_to_state);
|
||||
|
@ -127,8 +127,8 @@ void LimboHSM::set_initial_state(LimboState *p_state) {
|
|||
initial_state = Object::cast_to<LimboState>(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;
|
||||
|
||||
|
|
|
@ -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<uint64_t, LimboState *> 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<Blackboard> &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<Blackboard> &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();
|
||||
|
|
|
@ -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<LimboState *>(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<Blackboard> &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");
|
||||
|
|
|
@ -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<BlackboardPlan> blackboard_plan;
|
||||
Node *agent;
|
||||
Ref<Blackboard> blackboard;
|
||||
HashMap<String, Callable> handlers;
|
||||
HashMap<StringName, Callable> handlers;
|
||||
Callable guard_callable;
|
||||
|
||||
protected:
|
||||
|
@ -54,7 +54,7 @@ protected:
|
|||
void _notification(int p_what);
|
||||
|
||||
virtual void _initialize(Node *p_agent, const Ref<Blackboard> &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<BlackboardPlan> p_plan) { blackboard_plan = p_plan; }
|
||||
void set_blackboard_plan(const Ref<BlackboardPlan> &p_plan) { blackboard_plan = p_plan; }
|
||||
Ref<BlackboardPlan> get_blackboard_plan() const { return blackboard_plan; }
|
||||
|
||||
Ref<Blackboard> 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; }
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue