diff --git a/SCsub b/SCsub new file mode 100644 index 0000000..38df91a --- /dev/null +++ b/SCsub @@ -0,0 +1,10 @@ +# SCsub + +Import('env') + +env.add_source_files(env.modules_sources, "*.cpp") +env.add_source_files(env.modules_sources, "bt/*.cpp") +env.add_source_files(env.modules_sources, "bt/composites/*.cpp") +env.add_source_files(env.modules_sources, "bt/actions/*.cpp") +env.add_source_files(env.modules_sources, "bt/decorators/*.cpp") +env.add_source_files(env.modules_sources, "bt/conditions/*.cpp") diff --git a/limboai/bt/bt_action.cpp b/bt/actions/bt_action.cpp similarity index 100% rename from limboai/bt/bt_action.cpp rename to bt/actions/bt_action.cpp diff --git a/limboai/bt/bt_action.h b/bt/actions/bt_action.h similarity index 82% rename from limboai/bt/bt_action.h rename to bt/actions/bt_action.h index 648cf3e..57bfd97 100644 --- a/limboai/bt/bt_action.h +++ b/bt/actions/bt_action.h @@ -3,7 +3,7 @@ #ifndef BT_ACTION_H #define BT_ACTION_H -#include "bt_task.h" +#include "../bt_task.h" #include "core/object.h" class BTAction : public BTTask { diff --git a/limboai/bt/bt_fail.cpp b/bt/actions/bt_fail.cpp similarity index 100% rename from limboai/bt/bt_fail.cpp rename to bt/actions/bt_fail.cpp diff --git a/limboai/bt/bt_fail.h b/bt/actions/bt_fail.h similarity index 100% rename from limboai/bt/bt_fail.h rename to bt/actions/bt_fail.h diff --git a/limboai/bt/bt_random_wait.cpp b/bt/actions/bt_random_wait.cpp similarity index 100% rename from limboai/bt/bt_random_wait.cpp rename to bt/actions/bt_random_wait.cpp diff --git a/limboai/bt/bt_random_wait.h b/bt/actions/bt_random_wait.h similarity index 100% rename from limboai/bt/bt_random_wait.h rename to bt/actions/bt_random_wait.h diff --git a/limboai/bt/bt_wait.cpp b/bt/actions/bt_wait.cpp similarity index 100% rename from limboai/bt/bt_wait.cpp rename to bt/actions/bt_wait.cpp diff --git a/limboai/bt/bt_wait.h b/bt/actions/bt_wait.h similarity index 100% rename from limboai/bt/bt_wait.h rename to bt/actions/bt_wait.h diff --git a/limboai/bt/bt_wait_ticks.cpp b/bt/actions/bt_wait_ticks.cpp similarity index 100% rename from limboai/bt/bt_wait_ticks.cpp rename to bt/actions/bt_wait_ticks.cpp diff --git a/limboai/bt/bt_wait_ticks.h b/bt/actions/bt_wait_ticks.h similarity index 100% rename from limboai/bt/bt_wait_ticks.h rename to bt/actions/bt_wait_ticks.h diff --git a/limboai/bt/behavior_tree.cpp b/bt/behavior_tree.cpp similarity index 97% rename from limboai/bt/behavior_tree.cpp rename to bt/behavior_tree.cpp index c89252b..fd6db51 100644 --- a/limboai/bt/behavior_tree.cpp +++ b/bt/behavior_tree.cpp @@ -12,7 +12,7 @@ void BehaviorTree::init() { BTTask *task = root_task.ptr(); while (task != nullptr) { for (int i = 0; i < task->get_child_count(); i++) { - task->get_child(i)->_parent = task; + task->get_child(i)->parent = task; stack.push_back(task->get_child(i).ptr()); } task = nullptr; diff --git a/limboai/bt/behavior_tree.h b/bt/behavior_tree.h similarity index 100% rename from limboai/bt/behavior_tree.h rename to bt/behavior_tree.h diff --git a/limboai/bt/bt_player.cpp b/bt/bt_player.cpp similarity index 100% rename from limboai/bt/bt_player.cpp rename to bt/bt_player.cpp diff --git a/limboai/bt/bt_player.h b/bt/bt_player.h similarity index 100% rename from limboai/bt/bt_player.h rename to bt/bt_player.h diff --git a/limboai/bt/bt_task.cpp b/bt/bt_task.cpp similarity index 82% rename from limboai/bt/bt_task.cpp rename to bt/bt_task.cpp index 3fc7cb7..655de67 100644 --- a/limboai/bt/bt_task.cpp +++ b/bt/bt_task.cpp @@ -2,14 +2,13 @@ #include "bt_task.h" -#include "../limbo_string_names.h" -#include "../limbo_utility.h" #include "core/class_db.h" #include "core/object.h" #include "core/script_language.h" #include "core/variant.h" #include "editor/editor_node.h" -#include +#include "modules/limboai/limbo_string_names.h" +#include "modules/limboai/limbo_utility.h" String BTTask::_generate_name() const { if (get_script_instance()) { @@ -38,42 +37,42 @@ Array BTTask::_get_children() const { } void BTTask::_set_children(Array p_children) { - _children.clear(); + children.clear(); const int num_children = p_children.size(); - _children.resize(num_children); + children.resize(num_children); for (int i = 0; i < num_children; i++) { Variant task_var = p_children[i]; const Ref task_ref = task_var; - _children.set(i, task_var); + children.set(i, task_var); } } String BTTask::get_task_name() const { - if (_custom_name.empty()) { + if (custom_name.empty()) { return _generate_name(); } - return _custom_name; + return custom_name; } Ref BTTask::get_root() const { const BTTask *task = this; while (!task->is_root()) { - task = task->_parent; + task = task->parent; } return Ref(task); } void BTTask::set_custom_name(const String &p_name) { - if (_custom_name != p_name) { - _custom_name = p_name; + if (custom_name != p_name) { + custom_name = p_name; emit_changed(); } }; void BTTask::initialize(Object *p_agent, Dictionary p_blackboard) { - _agent = p_agent; - _blackboard = p_blackboard; - for (int i = 0; i < _children.size(); i++) { + agent = p_agent; + blackboard = p_blackboard; + for (int i = 0; i < children.size(); i++) { get_child(i)->initialize(p_agent, p_blackboard); } if (get_script_instance() && @@ -86,18 +85,18 @@ void BTTask::initialize(Object *p_agent, Dictionary p_blackboard) { Ref BTTask::clone() const { Ref inst = duplicate(true); - inst->_parent = nullptr; + inst->parent = nullptr; CRASH_COND(inst->get_parent().is_valid()); - for (int i = 0; i < _children.size(); i++) { + for (int i = 0; i < children.size(); i++) { Ref c = get_child(i)->clone(); - c->_parent = inst.ptr(); - inst->_children.set(i, c); + c->parent = inst.ptr(); + inst->children.set(i, c); } return inst; } int BTTask::execute(float p_delta) { - if (_status == RUNNING) { + if (status != RUNNING) { if (get_script_instance() && // get_script_instance()->get_script()->is_valid() && get_script_instance()->has_method(LimboStringNames::get_singleton()->_enter)) { @@ -106,15 +105,16 @@ int BTTask::execute(float p_delta) { _enter(); } } + if (get_script_instance() && // get_script_instance()->get_script()->is_valid() && get_script_instance()->has_method(LimboStringNames::get_singleton()->_tick)) { - _status = get_script_instance()->call(LimboStringNames::get_singleton()->_tick, Variant(p_delta)); + status = get_script_instance()->call(LimboStringNames::get_singleton()->_tick, Variant(p_delta)); } else { - _status = _tick(p_delta); + status = _tick(p_delta); } - if (_status != RUNNING) { + if (status != RUNNING) { if (get_script_instance() && // get_script_instance()->get_script()->is_valid() && get_script_instance()->has_method(LimboStringNames::get_singleton()->_exit)) { @@ -123,14 +123,14 @@ int BTTask::execute(float p_delta) { _exit(); } } - return _status; + return status; } void BTTask::cancel() { - for (int i = 0; i < _children.size(); i++) { + for (int i = 0; i < children.size(); i++) { get_child(i)->cancel(); } - if (_status == RUNNING) { + if (status == RUNNING) { if (get_script_instance() && // get_script_instance()->get_script()->is_valid() && get_script_instance()->has_method(LimboStringNames::get_singleton()->_exit)) { @@ -139,59 +139,59 @@ void BTTask::cancel() { _exit(); } } - _status = FRESH; + status = FRESH; } Ref BTTask::get_child(int p_idx) const { - ERR_FAIL_INDEX_V(p_idx, _children.size(), nullptr); - return _children.get(p_idx); + ERR_FAIL_INDEX_V(p_idx, children.size(), nullptr); + return children.get(p_idx); } int BTTask::get_child_count() const { - return _children.size(); + return children.size(); } void BTTask::add_child(Ref p_child) { ERR_FAIL_COND_MSG(p_child->get_parent().is_valid(), "p_child already has a parent!"); - p_child->_parent = this; - _children.push_back(p_child); + p_child->parent = this; + children.push_back(p_child); emit_changed(); } void BTTask::add_child_at_index(Ref p_child, int p_idx) { ERR_FAIL_COND_MSG(p_child->get_parent().is_valid(), "p_child already has a parent!"); - if (p_idx < 0 || p_idx > _children.size()) { - p_idx = _children.size(); + if (p_idx < 0 || p_idx > children.size()) { + p_idx = children.size(); } - _children.insert(p_idx, p_child); - p_child->_parent = this; + children.insert(p_idx, p_child); + p_child->parent = this; emit_changed(); } void BTTask::remove_child(Ref p_child) { - int idx = _children.find(p_child); + int idx = children.find(p_child); if (idx == -1) { ERR_FAIL_MSG("p_child not found!"); } else { - _children.remove(idx); - p_child->_parent = nullptr; + children.remove(idx); + p_child->parent = nullptr; emit_changed(); } } bool BTTask::has_child(const Ref &p_child) const { - return _children.find(p_child) != -1; + return children.find(p_child) != -1; } int BTTask::get_child_index(const Ref &p_child) const { - return _children.find(p_child); + return children.find(p_child); } Ref BTTask::next_sibling() const { - if (_parent != nullptr) { - int idx = _parent->get_child_index(Ref(this)); - if (idx != -1 && _parent->get_child_count() > (idx + 1)) { - return _parent->get_child(idx + 1); + if (parent != nullptr) { + int idx = parent->get_child_index(Ref(this)); + if (idx != -1 && parent->get_child_count() > (idx + 1)) { + return parent->get_child(idx + 1); } } return Ref(); @@ -202,7 +202,7 @@ String BTTask::get_configuration_warning() const { } Ref BTTask::get_icon() const { - return EditorNode::get_singleton()->get_class_icon("BTAction", "Object"); + return EditorNode::get_singleton()->get_class_icon(_class_name, "Object"); } void BTTask::print_tree(int p_initial_tabs) const { @@ -274,18 +274,18 @@ void BTTask::_bind_methods() { } BTTask::BTTask() { - _custom_name = String(); - _agent = nullptr; - _parent = nullptr; - _blackboard = Dictionary(); - _children = Vector>(); - _status = FRESH; + custom_name = String(); + agent = nullptr; + parent = nullptr; + blackboard = Dictionary(); + children = Vector>(); + status = FRESH; } BTTask::~BTTask() { for (int i = 0; i < get_child_count(); i++) { ERR_FAIL_COND(!get_child(i).is_valid()); - get_child(i)->_parent = nullptr; + get_child(i)->parent = nullptr; get_child(i).unref(); } } \ No newline at end of file diff --git a/limboai/bt/bt_task.h b/bt/bt_task.h similarity index 68% rename from limboai/bt/bt_task.h rename to bt/bt_task.h index 07441a1..f33e7fd 100644 --- a/limboai/bt/bt_task.h +++ b/bt/bt_task.h @@ -5,12 +5,12 @@ #include "core/array.h" #include "core/dictionary.h" +#include "core/object.h" #include "core/reference.h" #include "core/resource.h" #include "core/ustring.h" #include "core/vector.h" #include "scene/resources/texture.h" -#include class BTTask : public Resource { GDCLASS(BTTask, Resource); @@ -26,12 +26,12 @@ public: private: friend class BehaviorTree; - String _custom_name; - Object *_agent; - Dictionary _blackboard; - BTTask *_parent; - Vector> _children; - int _status; + String custom_name; + Object *agent; + Dictionary blackboard; + BTTask *parent; + Vector> children; + int status; Array _get_children() const; void _set_children(Array children); @@ -40,19 +40,19 @@ protected: static void _bind_methods(); virtual String _generate_name() const; - virtual void _setup(){}; - virtual void _enter(){}; - virtual void _exit(){}; - virtual int _tick(float p_delta) { return FAILURE; }; + virtual void _setup() {} + virtual void _enter() {} + virtual void _exit() {} + virtual int _tick(float p_delta) { return FAILURE; } public: - Object *get_agent() const { return _agent; }; - Dictionary get_blackboard() const { return _blackboard; }; - Ref get_parent() const { return Ref(_parent); }; - bool is_root() const { return _parent == nullptr; }; + Object *get_agent() const { return agent; } + Dictionary get_blackboard() const { return blackboard; } + Ref get_parent() const { return Ref(parent); } + bool is_root() const { return parent == nullptr; } Ref get_root() const; - int get_status() const { return _status; }; - String get_custom_name() const { return _custom_name; }; + int get_status() const { return status; } + String get_custom_name() const { return custom_name; } void set_custom_name(const String &p_name); String get_task_name() const; diff --git a/limboai/bt/bt_composite.cpp b/bt/composites/bt_composite.cpp similarity index 100% rename from limboai/bt/bt_composite.cpp rename to bt/composites/bt_composite.cpp diff --git a/limboai/bt/bt_composite.h b/bt/composites/bt_composite.h similarity index 82% rename from limboai/bt/bt_composite.h rename to bt/composites/bt_composite.h index 35c901f..d892223 100644 --- a/limboai/bt/bt_composite.h +++ b/bt/composites/bt_composite.h @@ -3,7 +3,7 @@ #ifndef BT_COMPOSITE_H #define BT_COMPOSITE_H -#include "bt_task.h" +#include "../bt_task.h" #include "core/object.h" class BTComposite : public BTTask { diff --git a/limboai/bt/bt_dynamic_selector.cpp b/bt/composites/bt_dynamic_selector.cpp similarity index 100% rename from limboai/bt/bt_dynamic_selector.cpp rename to bt/composites/bt_dynamic_selector.cpp diff --git a/limboai/bt/bt_dynamic_selector.h b/bt/composites/bt_dynamic_selector.h similarity index 100% rename from limboai/bt/bt_dynamic_selector.h rename to bt/composites/bt_dynamic_selector.h diff --git a/limboai/bt/bt_dynamic_sequence.cpp b/bt/composites/bt_dynamic_sequence.cpp similarity index 100% rename from limboai/bt/bt_dynamic_sequence.cpp rename to bt/composites/bt_dynamic_sequence.cpp diff --git a/limboai/bt/bt_dynamic_sequence.h b/bt/composites/bt_dynamic_sequence.h similarity index 100% rename from limboai/bt/bt_dynamic_sequence.h rename to bt/composites/bt_dynamic_sequence.h diff --git a/limboai/bt/bt_parallel.cpp b/bt/composites/bt_parallel.cpp similarity index 100% rename from limboai/bt/bt_parallel.cpp rename to bt/composites/bt_parallel.cpp diff --git a/limboai/bt/bt_parallel.h b/bt/composites/bt_parallel.h similarity index 59% rename from limboai/bt/bt_parallel.h rename to bt/composites/bt_parallel.h index c3966c7..1fa2ed8 100644 --- a/limboai/bt/bt_parallel.h +++ b/bt/composites/bt_parallel.h @@ -21,12 +21,21 @@ protected: virtual int _tick(float p_delta); public: - int get_num_successes_required() const { return num_successes_required; }; - void set_num_successes_required(int p_value) { num_successes_required = p_value; }; - int get_num_failures_required() const { return num_failures_required; }; - void set_num_failures_required(int p_value) { num_failures_required = p_value; }; - bool get_repeat() const { return repeat; }; - void set_repeat(bool p_value) { repeat = p_value; }; + int get_num_successes_required() const { return num_successes_required; } + void set_num_successes_required(int p_value) { + num_successes_required = p_value; + emit_changed(); + } + int get_num_failures_required() const { return num_failures_required; } + void set_num_failures_required(int p_value) { + num_failures_required = p_value; + emit_changed(); + } + bool get_repeat() const { return repeat; } + void set_repeat(bool p_value) { + repeat = p_value; + emit_changed(); + } }; #endif // BT_PARALLEL_H \ No newline at end of file diff --git a/limboai/bt/bt_random_selector.cpp b/bt/composites/bt_random_selector.cpp similarity index 100% rename from limboai/bt/bt_random_selector.cpp rename to bt/composites/bt_random_selector.cpp diff --git a/limboai/bt/bt_random_selector.h b/bt/composites/bt_random_selector.h similarity index 100% rename from limboai/bt/bt_random_selector.h rename to bt/composites/bt_random_selector.h diff --git a/limboai/bt/bt_random_sequence.cpp b/bt/composites/bt_random_sequence.cpp similarity index 100% rename from limboai/bt/bt_random_sequence.cpp rename to bt/composites/bt_random_sequence.cpp diff --git a/limboai/bt/bt_random_sequence.h b/bt/composites/bt_random_sequence.h similarity index 100% rename from limboai/bt/bt_random_sequence.h rename to bt/composites/bt_random_sequence.h diff --git a/limboai/bt/bt_selector.cpp b/bt/composites/bt_selector.cpp similarity index 100% rename from limboai/bt/bt_selector.cpp rename to bt/composites/bt_selector.cpp diff --git a/limboai/bt/bt_selector.h b/bt/composites/bt_selector.h similarity index 100% rename from limboai/bt/bt_selector.h rename to bt/composites/bt_selector.h diff --git a/limboai/bt/bt_sequence.cpp b/bt/composites/bt_sequence.cpp similarity index 100% rename from limboai/bt/bt_sequence.cpp rename to bt/composites/bt_sequence.cpp diff --git a/limboai/bt/bt_sequence.h b/bt/composites/bt_sequence.h similarity index 100% rename from limboai/bt/bt_sequence.h rename to bt/composites/bt_sequence.h diff --git a/limboai/bt/bt_condition.cpp b/bt/conditions/bt_condition.cpp similarity index 100% rename from limboai/bt/bt_condition.cpp rename to bt/conditions/bt_condition.cpp diff --git a/limboai/bt/bt_condition.h b/bt/conditions/bt_condition.h similarity index 82% rename from limboai/bt/bt_condition.h rename to bt/conditions/bt_condition.h index 83142b9..9cb60db 100644 --- a/limboai/bt/bt_condition.h +++ b/bt/conditions/bt_condition.h @@ -3,7 +3,7 @@ #ifndef BT_CONDITION_H #define BT_CONDITION_H -#include "bt_task.h" +#include "../bt_task.h" #include "core/object.h" class BTCondition : public BTTask { diff --git a/limboai/bt/bt_always_fail.cpp b/bt/decorators/bt_always_fail.cpp similarity index 100% rename from limboai/bt/bt_always_fail.cpp rename to bt/decorators/bt_always_fail.cpp diff --git a/limboai/bt/bt_always_fail.h b/bt/decorators/bt_always_fail.h similarity index 100% rename from limboai/bt/bt_always_fail.h rename to bt/decorators/bt_always_fail.h diff --git a/limboai/bt/bt_always_succeed.cpp b/bt/decorators/bt_always_succeed.cpp similarity index 100% rename from limboai/bt/bt_always_succeed.cpp rename to bt/decorators/bt_always_succeed.cpp diff --git a/limboai/bt/bt_always_succeed.h b/bt/decorators/bt_always_succeed.h similarity index 100% rename from limboai/bt/bt_always_succeed.h rename to bt/decorators/bt_always_succeed.h diff --git a/limboai/bt/bt_cooldown.cpp b/bt/decorators/bt_cooldown.cpp similarity index 100% rename from limboai/bt/bt_cooldown.cpp rename to bt/decorators/bt_cooldown.cpp diff --git a/limboai/bt/bt_cooldown.h b/bt/decorators/bt_cooldown.h similarity index 100% rename from limboai/bt/bt_cooldown.h rename to bt/decorators/bt_cooldown.h diff --git a/limboai/bt/bt_decorator.cpp b/bt/decorators/bt_decorator.cpp similarity index 100% rename from limboai/bt/bt_decorator.cpp rename to bt/decorators/bt_decorator.cpp diff --git a/limboai/bt/bt_decorator.h b/bt/decorators/bt_decorator.h similarity index 82% rename from limboai/bt/bt_decorator.h rename to bt/decorators/bt_decorator.h index ce531e0..75f6aa7 100644 --- a/limboai/bt/bt_decorator.h +++ b/bt/decorators/bt_decorator.h @@ -3,7 +3,7 @@ #ifndef BT_DECORATOR_H #define BT_DECORATOR_H -#include "bt_task.h" +#include "../bt_task.h" #include "core/object.h" class BTDecorator : public BTTask { diff --git a/limboai/bt/bt_delay.cpp b/bt/decorators/bt_delay.cpp similarity index 100% rename from limboai/bt/bt_delay.cpp rename to bt/decorators/bt_delay.cpp diff --git a/limboai/bt/bt_delay.h b/bt/decorators/bt_delay.h similarity index 86% rename from limboai/bt/bt_delay.h rename to bt/decorators/bt_delay.h index cb07065..d0c5b9f 100644 --- a/limboai/bt/bt_delay.h +++ b/bt/decorators/bt_delay.h @@ -24,8 +24,8 @@ public: void set_seconds(float p_value) { seconds = p_value; emit_changed(); - }; - float get_seconds() const { return seconds; }; + } + float get_seconds() const { return seconds; } }; #endif // BT_DELAY_H \ No newline at end of file diff --git a/limboai/bt/bt_invert.cpp b/bt/decorators/bt_invert.cpp similarity index 100% rename from limboai/bt/bt_invert.cpp rename to bt/decorators/bt_invert.cpp diff --git a/limboai/bt/bt_invert.h b/bt/decorators/bt_invert.h similarity index 100% rename from limboai/bt/bt_invert.h rename to bt/decorators/bt_invert.h diff --git a/limboai/bt/bt_probability.cpp b/bt/decorators/bt_probability.cpp similarity index 100% rename from limboai/bt/bt_probability.cpp rename to bt/decorators/bt_probability.cpp diff --git a/limboai/bt/bt_probability.h b/bt/decorators/bt_probability.h similarity index 100% rename from limboai/bt/bt_probability.h rename to bt/decorators/bt_probability.h diff --git a/limboai/bt/bt_repeat.cpp b/bt/decorators/bt_repeat.cpp similarity index 100% rename from limboai/bt/bt_repeat.cpp rename to bt/decorators/bt_repeat.cpp diff --git a/limboai/bt/bt_repeat.h b/bt/decorators/bt_repeat.h similarity index 81% rename from limboai/bt/bt_repeat.h rename to bt/decorators/bt_repeat.h index 92322b2..e56dfaf 100644 --- a/limboai/bt/bt_repeat.h +++ b/bt/decorators/bt_repeat.h @@ -25,13 +25,13 @@ public: void set_times(int p_value) { times = p_value; emit_changed(); - }; - int get_times() const { return times; }; + } + int get_times() const { return times; } void set_abort_on_failure(bool p_value) { abort_on_failure = p_value; emit_changed(); - }; - bool get_abort_on_failure() const { return abort_on_failure; }; + } + bool get_abort_on_failure() const { return abort_on_failure; } }; #endif // BT_REPEAT_H \ No newline at end of file diff --git a/limboai/bt/bt_repeat_until_failure.cpp b/bt/decorators/bt_repeat_until_failure.cpp similarity index 100% rename from limboai/bt/bt_repeat_until_failure.cpp rename to bt/decorators/bt_repeat_until_failure.cpp diff --git a/limboai/bt/bt_repeat_until_failure.h b/bt/decorators/bt_repeat_until_failure.h similarity index 100% rename from limboai/bt/bt_repeat_until_failure.h rename to bt/decorators/bt_repeat_until_failure.h diff --git a/limboai/bt/bt_repeat_until_success.cpp b/bt/decorators/bt_repeat_until_success.cpp similarity index 100% rename from limboai/bt/bt_repeat_until_success.cpp rename to bt/decorators/bt_repeat_until_success.cpp diff --git a/limboai/bt/bt_repeat_until_success.h b/bt/decorators/bt_repeat_until_success.h similarity index 100% rename from limboai/bt/bt_repeat_until_success.h rename to bt/decorators/bt_repeat_until_success.h diff --git a/limboai/bt/bt_run_limit.cpp b/bt/decorators/bt_run_limit.cpp similarity index 100% rename from limboai/bt/bt_run_limit.cpp rename to bt/decorators/bt_run_limit.cpp diff --git a/limboai/bt/bt_run_limit.h b/bt/decorators/bt_run_limit.h similarity index 85% rename from limboai/bt/bt_run_limit.h rename to bt/decorators/bt_run_limit.h index b3c4ed9..313d358 100644 --- a/limboai/bt/bt_run_limit.h +++ b/bt/decorators/bt_run_limit.h @@ -23,8 +23,8 @@ public: void set_run_limit(int p_value) { run_limit = p_value; emit_changed(); - }; - int get_run_limit() const { return run_limit; }; + } + int get_run_limit() const { return run_limit; } }; #endif // BT_RUN_LIMIT_H \ No newline at end of file diff --git a/limboai/bt/bt_time_limit.cpp b/bt/decorators/bt_time_limit.cpp similarity index 100% rename from limboai/bt/bt_time_limit.cpp rename to bt/decorators/bt_time_limit.cpp diff --git a/limboai/bt/bt_time_limit.h b/bt/decorators/bt_time_limit.h similarity index 85% rename from limboai/bt/bt_time_limit.h rename to bt/decorators/bt_time_limit.h index 125557b..ef2dd25 100644 --- a/limboai/bt/bt_time_limit.h +++ b/bt/decorators/bt_time_limit.h @@ -24,8 +24,8 @@ public: void set_time_limit(float p_value) { time_limit = p_value; emit_changed(); - }; - float get_time_limit() const { return time_limit; }; + } + float get_time_limit() const { return time_limit; } }; #endif // BT_TIME_LIMIT_H \ No newline at end of file diff --git a/limboai/config.py b/config.py similarity index 100% rename from limboai/config.py rename to config.py diff --git a/limboai/icons/icon_b_t_action.svg b/icons/icon_b_t_action.svg similarity index 100% rename from limboai/icons/icon_b_t_action.svg rename to icons/icon_b_t_action.svg diff --git a/limboai/icons/icon_b_t_always_fail.svg b/icons/icon_b_t_always_fail.svg similarity index 100% rename from limboai/icons/icon_b_t_always_fail.svg rename to icons/icon_b_t_always_fail.svg diff --git a/limboai/icons/icon_b_t_always_succeed.svg b/icons/icon_b_t_always_succeed.svg similarity index 100% rename from limboai/icons/icon_b_t_always_succeed.svg rename to icons/icon_b_t_always_succeed.svg diff --git a/limboai/icons/icon_b_t_condition.svg b/icons/icon_b_t_condition.svg similarity index 100% rename from limboai/icons/icon_b_t_condition.svg rename to icons/icon_b_t_condition.svg diff --git a/limboai/icons/icon_b_t_cooldown.svg b/icons/icon_b_t_cooldown.svg similarity index 100% rename from limboai/icons/icon_b_t_cooldown.svg rename to icons/icon_b_t_cooldown.svg diff --git a/limboai/icons/icon_b_t_decorator.svg b/icons/icon_b_t_decorator.svg similarity index 100% rename from limboai/icons/icon_b_t_decorator.svg rename to icons/icon_b_t_decorator.svg diff --git a/limboai/icons/icon_b_t_delay.svg b/icons/icon_b_t_delay.svg similarity index 100% rename from limboai/icons/icon_b_t_delay.svg rename to icons/icon_b_t_delay.svg diff --git a/limboai/icons/icon_b_t_dynamic_selector.svg b/icons/icon_b_t_dynamic_selector.svg similarity index 100% rename from limboai/icons/icon_b_t_dynamic_selector.svg rename to icons/icon_b_t_dynamic_selector.svg diff --git a/limboai/icons/icon_b_t_dynamic_sequence.svg b/icons/icon_b_t_dynamic_sequence.svg similarity index 100% rename from limboai/icons/icon_b_t_dynamic_sequence.svg rename to icons/icon_b_t_dynamic_sequence.svg diff --git a/limboai/icons/icon_b_t_fail.svg b/icons/icon_b_t_fail.svg similarity index 100% rename from limboai/icons/icon_b_t_fail.svg rename to icons/icon_b_t_fail.svg diff --git a/limboai/icons/icon_b_t_invert.svg b/icons/icon_b_t_invert.svg similarity index 100% rename from limboai/icons/icon_b_t_invert.svg rename to icons/icon_b_t_invert.svg diff --git a/limboai/icons/icon_b_t_parallel.svg b/icons/icon_b_t_parallel.svg similarity index 100% rename from limboai/icons/icon_b_t_parallel.svg rename to icons/icon_b_t_parallel.svg diff --git a/limboai/icons/icon_b_t_player.svg b/icons/icon_b_t_player.svg similarity index 100% rename from limboai/icons/icon_b_t_player.svg rename to icons/icon_b_t_player.svg diff --git a/limboai/icons/icon_b_t_probability.svg b/icons/icon_b_t_probability.svg similarity index 100% rename from limboai/icons/icon_b_t_probability.svg rename to icons/icon_b_t_probability.svg diff --git a/limboai/icons/icon_b_t_probability_selector.svg b/icons/icon_b_t_probability_selector.svg similarity index 100% rename from limboai/icons/icon_b_t_probability_selector.svg rename to icons/icon_b_t_probability_selector.svg diff --git a/limboai/icons/icon_b_t_random_selector.svg b/icons/icon_b_t_random_selector.svg similarity index 100% rename from limboai/icons/icon_b_t_random_selector.svg rename to icons/icon_b_t_random_selector.svg diff --git a/limboai/icons/icon_b_t_random_sequence.svg b/icons/icon_b_t_random_sequence.svg similarity index 100% rename from limboai/icons/icon_b_t_random_sequence.svg rename to icons/icon_b_t_random_sequence.svg diff --git a/limboai/icons/icon_b_t_random_wait.svg b/icons/icon_b_t_random_wait.svg similarity index 100% rename from limboai/icons/icon_b_t_random_wait.svg rename to icons/icon_b_t_random_wait.svg diff --git a/limboai/icons/icon_b_t_repeat.svg b/icons/icon_b_t_repeat.svg similarity index 100% rename from limboai/icons/icon_b_t_repeat.svg rename to icons/icon_b_t_repeat.svg diff --git a/limboai/icons/icon_b_t_repeat_until_failure.svg b/icons/icon_b_t_repeat_until_failure.svg similarity index 100% rename from limboai/icons/icon_b_t_repeat_until_failure.svg rename to icons/icon_b_t_repeat_until_failure.svg diff --git a/limboai/icons/icon_b_t_repeat_until_success.svg b/icons/icon_b_t_repeat_until_success.svg similarity index 100% rename from limboai/icons/icon_b_t_repeat_until_success.svg rename to icons/icon_b_t_repeat_until_success.svg diff --git a/limboai/icons/icon_b_t_run_limit.svg b/icons/icon_b_t_run_limit.svg similarity index 100% rename from limboai/icons/icon_b_t_run_limit.svg rename to icons/icon_b_t_run_limit.svg diff --git a/limboai/icons/icon_b_t_selector.svg b/icons/icon_b_t_selector.svg similarity index 100% rename from limboai/icons/icon_b_t_selector.svg rename to icons/icon_b_t_selector.svg diff --git a/limboai/icons/icon_b_t_sequence.svg b/icons/icon_b_t_sequence.svg similarity index 100% rename from limboai/icons/icon_b_t_sequence.svg rename to icons/icon_b_t_sequence.svg diff --git a/limboai/icons/icon_b_t_time_limit.svg b/icons/icon_b_t_time_limit.svg similarity index 100% rename from limboai/icons/icon_b_t_time_limit.svg rename to icons/icon_b_t_time_limit.svg diff --git a/limboai/icons/icon_b_t_wait.svg b/icons/icon_b_t_wait.svg similarity index 100% rename from limboai/icons/icon_b_t_wait.svg rename to icons/icon_b_t_wait.svg diff --git a/limboai/icons/icon_b_t_wait_ticks.svg b/icons/icon_b_t_wait_ticks.svg similarity index 100% rename from limboai/icons/icon_b_t_wait_ticks.svg rename to icons/icon_b_t_wait_ticks.svg diff --git a/limboai/icons/icon_behavior_tree.svg b/icons/icon_behavior_tree.svg similarity index 100% rename from limboai/icons/icon_behavior_tree.svg rename to icons/icon_behavior_tree.svg diff --git a/limboai/icons/unused/icons_blackboard.svg b/icons/unused/icons_blackboard.svg similarity index 100% rename from limboai/icons/unused/icons_blackboard.svg rename to icons/unused/icons_blackboard.svg diff --git a/limboai/icons/unused/icons_main_screen.svg b/icons/unused/icons_main_screen.svg similarity index 100% rename from limboai/icons/unused/icons_main_screen.svg rename to icons/unused/icons_main_screen.svg diff --git a/limboai/icons/unused/icons_selector_state.svg b/icons/unused/icons_selector_state.svg similarity index 100% rename from limboai/icons/unused/icons_selector_state.svg rename to icons/unused/icons_selector_state.svg diff --git a/limboai/icons/unused/icons_selector_state_contra.svg b/icons/unused/icons_selector_state_contra.svg similarity index 100% rename from limboai/icons/unused/icons_selector_state_contra.svg rename to icons/unused/icons_selector_state_contra.svg diff --git a/limboai/icons/unused/icons_sequence_state.svg b/icons/unused/icons_sequence_state.svg similarity index 100% rename from limboai/icons/unused/icons_sequence_state.svg rename to icons/unused/icons_sequence_state.svg diff --git a/limboai/icons/unused/icons_sequence_state_conta.svg b/icons/unused/icons_sequence_state_conta.svg similarity index 100% rename from limboai/icons/unused/icons_sequence_state_conta.svg rename to icons/unused/icons_sequence_state_conta.svg diff --git a/limboai/icons/unused/icons_state.svg b/icons/unused/icons_state.svg similarity index 100% rename from limboai/icons/unused/icons_state.svg rename to icons/unused/icons_state.svg diff --git a/limboai/icons/unused/icons_state_machine.svg b/icons/unused/icons_state_machine.svg similarity index 100% rename from limboai/icons/unused/icons_state_machine.svg rename to icons/unused/icons_state_machine.svg diff --git a/limboai/icons/unused/icons_subtree.svg b/icons/unused/icons_subtree.svg similarity index 100% rename from limboai/icons/unused/icons_subtree.svg rename to icons/unused/icons_subtree.svg diff --git a/limboai/icons/unused/icons_terminal.svg b/icons/unused/icons_terminal.svg similarity index 100% rename from limboai/icons/unused/icons_terminal.svg rename to icons/unused/icons_terminal.svg diff --git a/limboai/icons/unused/icons_tree.svg b/icons/unused/icons_tree.svg similarity index 100% rename from limboai/icons/unused/icons_tree.svg rename to icons/unused/icons_tree.svg diff --git a/limboai/icons/unused/icons_variable.svg b/icons/unused/icons_variable.svg similarity index 100% rename from limboai/icons/unused/icons_variable.svg rename to icons/unused/icons_variable.svg diff --git a/limboai/limbo_string_names.cpp b/limbo_string_names.cpp similarity index 100% rename from limboai/limbo_string_names.cpp rename to limbo_string_names.cpp diff --git a/limboai/limbo_string_names.h b/limbo_string_names.h similarity index 100% rename from limboai/limbo_string_names.h rename to limbo_string_names.h diff --git a/limboai/limbo_utility.cpp b/limbo_utility.cpp similarity index 100% rename from limboai/limbo_utility.cpp rename to limbo_utility.cpp diff --git a/limboai/limbo_utility.h b/limbo_utility.h similarity index 100% rename from limboai/limbo_utility.h rename to limbo_utility.h diff --git a/limboai/SCsub b/limboai/SCsub deleted file mode 100644 index f332202..0000000 --- a/limboai/SCsub +++ /dev/null @@ -1,6 +0,0 @@ -# SCsub - -Import('env') - -env.add_source_files(env.modules_sources, "*.cpp") -env.add_source_files(env.modules_sources, "bt/*.cpp") diff --git a/limboai/register_types.cpp b/register_types.cpp similarity index 60% rename from limboai/register_types.cpp rename to register_types.cpp index 13f2be5..85ce121 100644 --- a/limboai/register_types.cpp +++ b/register_types.cpp @@ -4,35 +4,35 @@ #include "core/class_db.h" +#include "bt/actions/bt_action.h" +#include "bt/actions/bt_fail.h" +#include "bt/actions/bt_random_wait.h" +#include "bt/actions/bt_wait.h" +#include "bt/actions/bt_wait_ticks.h" #include "bt/behavior_tree.h" -#include "bt/bt_action.h" -#include "bt/bt_always_fail.h" -#include "bt/bt_always_succeed.h" -#include "bt/bt_composite.h" -#include "bt/bt_condition.h" -#include "bt/bt_cooldown.h" -#include "bt/bt_decorator.h" -#include "bt/bt_delay.h" -#include "bt/bt_dynamic_selector.h" -#include "bt/bt_dynamic_sequence.h" -#include "bt/bt_fail.h" -#include "bt/bt_invert.h" -#include "bt/bt_parallel.h" #include "bt/bt_player.h" -#include "bt/bt_probability.h" -#include "bt/bt_random_selector.h" -#include "bt/bt_random_sequence.h" -#include "bt/bt_random_wait.h" -#include "bt/bt_repeat.h" -#include "bt/bt_repeat_until_failure.h" -#include "bt/bt_repeat_until_success.h" -#include "bt/bt_run_limit.h" -#include "bt/bt_selector.h" -#include "bt/bt_sequence.h" #include "bt/bt_task.h" -#include "bt/bt_time_limit.h" -#include "bt/bt_wait.h" -#include "bt/bt_wait_ticks.h" +#include "bt/composites/bt_composite.h" +#include "bt/composites/bt_dynamic_selector.h" +#include "bt/composites/bt_dynamic_sequence.h" +#include "bt/composites/bt_parallel.h" +#include "bt/composites/bt_random_selector.h" +#include "bt/composites/bt_random_sequence.h" +#include "bt/composites/bt_selector.h" +#include "bt/composites/bt_sequence.h" +#include "bt/conditions/bt_condition.h" +#include "bt/decorators/bt_always_fail.h" +#include "bt/decorators/bt_always_succeed.h" +#include "bt/decorators/bt_cooldown.h" +#include "bt/decorators/bt_decorator.h" +#include "bt/decorators/bt_delay.h" +#include "bt/decorators/bt_invert.h" +#include "bt/decorators/bt_probability.h" +#include "bt/decorators/bt_repeat.h" +#include "bt/decorators/bt_repeat_until_failure.h" +#include "bt/decorators/bt_repeat_until_success.h" +#include "bt/decorators/bt_run_limit.h" +#include "bt/decorators/bt_time_limit.h" #include "limbo_string_names.h" #include "limbo_utility.h" @@ -42,10 +42,6 @@ void register_limboai_types() { ClassDB::register_class(); ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); - ClassDB::register_class(); ClassDB::register_class(); ClassDB::register_class(); @@ -55,6 +51,7 @@ void register_limboai_types() { ClassDB::register_class(); ClassDB::register_class(); + ClassDB::register_class(); ClassDB::register_class(); ClassDB::register_class(); ClassDB::register_class(); @@ -67,11 +64,14 @@ void register_limboai_types() { ClassDB::register_class(); ClassDB::register_class(); + ClassDB::register_class(); ClassDB::register_class(); ClassDB::register_class(); ClassDB::register_class(); ClassDB::register_class(); + ClassDB::register_class(); + LimboStringNames::create(); } diff --git a/limboai/register_types.h b/register_types.h similarity index 100% rename from limboai/register_types.h rename to register_types.h