diff --git a/blackboard/bb_param/bb_param.h b/blackboard/bb_param/bb_param.h index 6e7fb08f..066bb00c 100644 --- a/blackboard/bb_param/bb_param.h +++ b/blackboard/bb_param/bb_param.h @@ -12,10 +12,10 @@ #ifndef BB_PARAM_H #define BB_PARAM_H -#ifdef LIMBOAI_MODULE -#include "modules/limboai/blackboard/blackboard.h" -#include "modules/limboai/util/limbo_utility.h" +#include "../../blackboard/blackboard.h" +#include "../../util/limbo_utility.h" +#ifdef LIMBOAI_MODULE #include "core/io/resource.h" #include "core/object/object.h" #include "core/typedefs.h" @@ -23,9 +23,6 @@ #endif // LIMBOAI_MODULE #ifdef LIMBOAI_GDEXTENSION -#include "blackboard/blackboard.h" -#include "util/limbo_utility.h" - #include #include #include diff --git a/bt/tasks/blackboard/bt_check_var.h b/bt/tasks/blackboard/bt_check_var.h index bb215ec2..2809ee31 100644 --- a/bt/tasks/blackboard/bt_check_var.h +++ b/bt/tasks/blackboard/bt_check_var.h @@ -15,7 +15,7 @@ #include "../bt_condition.h" #include "../../../blackboard/bb_param/bb_variant.h" -#include "../../../limboai/util/limbo_utility.h" +#include "../../../util/limbo_utility.h" class BTCheckVar : public BTCondition { GDCLASS(BTCheckVar, BTCondition); diff --git a/bt/tasks/blackboard/bt_set_var.h b/bt/tasks/blackboard/bt_set_var.h index 8b7d5ee9..a8c61e4c 100644 --- a/bt/tasks/blackboard/bt_set_var.h +++ b/bt/tasks/blackboard/bt_set_var.h @@ -15,7 +15,7 @@ #include "../bt_action.h" #include "../../../blackboard/bb_param/bb_variant.h" -#include "../../../limboai/util/limbo_utility.h" +#include "../../../util/limbo_utility.h" class BTSetVar : public BTAction { GDCLASS(BTSetVar, BTAction); diff --git a/bt/tasks/utility/bt_call_method.h b/bt/tasks/utility/bt_call_method.h index 5c3cae33..3994ef07 100644 --- a/bt/tasks/utility/bt_call_method.h +++ b/bt/tasks/utility/bt_call_method.h @@ -14,7 +14,7 @@ #include "../bt_action.h" -#include "../../../limboai/blackboard/bb_param/bb_node.h" +#include "../../../blackboard/bb_param/bb_node.h" class BTCallMethod : public BTAction { GDCLASS(BTCallMethod, BTAction); diff --git a/editor/debugger/limbo_debugger.cpp b/editor/debugger/limbo_debugger.cpp index bfad1cc1..6ef5102b 100644 --- a/editor/debugger/limbo_debugger.cpp +++ b/editor/debugger/limbo_debugger.cpp @@ -64,11 +64,14 @@ void LimboDebugger::deinitialize() { } void LimboDebugger::_bind_methods() { +#ifdef DEBUG_ENABLED + #ifdef LIMBOAI_GDEXTENSION ClassDB::bind_method(D_METHOD("parse_message_gdext"), &LimboDebugger::parse_message_gdext); #endif ClassDB::bind_method(D_METHOD("_on_bt_updated", "p_status", "p_path"), &LimboDebugger::_on_bt_updated); ClassDB::bind_method(D_METHOD("_on_state_updated", "p_delta", "p_path"), &LimboDebugger::_on_state_updated); +#endif // ! DEBUG_ENABLED } #ifdef DEBUG_ENABLED diff --git a/editor/debugger/limbo_debugger.h b/editor/debugger/limbo_debugger.h index ef87916e..c502b464 100644 --- a/editor/debugger/limbo_debugger.h +++ b/editor/debugger/limbo_debugger.h @@ -67,6 +67,6 @@ class LimboDebugger : public Object { void register_bt_instance(Ref p_instance, NodePath p_player_path); void unregister_bt_instance(Ref p_instance, NodePath p_player_path); -#endif // DEBUG_ENABLED +#endif // ! DEBUG_ENABLED }; -#endif // LIMBO_DEBUGGER \ No newline at end of file +#endif // ! LIMBO_DEBUGGER diff --git a/hsm/limbo_state.h b/hsm/limbo_state.h index e1df0463..ff6bc47b 100644 --- a/hsm/limbo_state.h +++ b/hsm/limbo_state.h @@ -71,6 +71,8 @@ class LimboState : public Node { void add_event_handler(const String &p_event, const Callable &p_handler); public: + static String EVENT_FINISHED() { return LW_NAME(EVENT_FINISHED); } + Ref get_blackboard() const { return blackboard; } Node *get_agent() const { return agent; } diff --git a/tests/limbo_test.h b/tests/limbo_test.h index d5b1cad3..655a533c 100644 --- a/tests/limbo_test.h +++ b/tests/limbo_test.h @@ -12,6 +12,8 @@ #ifndef LIMBO_TEST_H #define LIMBO_TEST_H +#define LIMBOAI_MODULE + #include "core/object/ref_counted.h" #include "tests/test_macros.h" diff --git a/tests/test_await_animation.h b/tests/test_await_animation.h index 00831dbc..ee083474 100644 --- a/tests/test_await_animation.h +++ b/tests/test_await_animation.h @@ -12,13 +12,13 @@ #ifndef TEST_AWAIT_ANIMATION_H #define TEST_AWAIT_ANIMATION_H -#include "core/os/memory.h" #include "limbo_test.h" #include "modules/limboai/blackboard/blackboard.h" #include "modules/limboai/bt/tasks/bt_task.h" #include "modules/limboai/bt/tasks/scene/bt_await_animation.h" +#include "core/os/memory.h" #include "scene/animation/animation_player.h" #include "scene/main/window.h" #include "scene/resources/animation.h" diff --git a/tests/test_bb_param.h b/tests/test_bb_param.h index 853203a6..7afd8d56 100644 --- a/tests/test_bb_param.h +++ b/tests/test_bb_param.h @@ -12,11 +12,11 @@ #ifndef TEST_BB_PARAM_H #define TEST_BB_PARAM_H +#include "limbo_test.h" + #include "core/object/ref_counted.h" #include "core/string/node_path.h" #include "core/variant/variant.h" -#include "limbo_test.h" - #include "modules/limboai/blackboard/bb_param/bb_node.h" #include "modules/limboai/blackboard/bb_param/bb_param.h" #include "modules/limboai/blackboard/blackboard.h" diff --git a/tests/test_hsm.h b/tests/test_hsm.h index bc981f55..733b9e9c 100644 --- a/tests/test_hsm.h +++ b/tests/test_hsm.h @@ -136,7 +136,7 @@ TEST_CASE("[Modules][LimboAI] HSM") { CHECK(beta_updates->num_callbacks == 2); CHECK(beta_exits->num_callbacks == 1); - hsm->dispatch(LimboState::EVENT_FINISHED); + hsm->dispatch(LimboState::EVENT_FINISHED()); CHECK(alpha_entries->num_callbacks == 2); CHECK(alpha_updates->num_callbacks == 3); CHECK(alpha_exits->num_callbacks == 2); // * exited diff --git a/util/limbo_compat.cpp b/util/limbo_compat.cpp index 2fbb11e3..42a95f5e 100644 --- a/util/limbo_compat.cpp +++ b/util/limbo_compat.cpp @@ -13,9 +13,11 @@ #ifdef LIMBOAI_MODULE +#ifdef TOOLS_ENABLED #include "core/io/resource.h" #include "editor/editor_node.h" #include "editor/plugins/script_editor_plugin.h" +#endif // ! TOOLS_ENABLED #endif // ! LIMBOAI_MODULE @@ -48,9 +50,6 @@ String TTR(const String &p_text, const String &p_context) { return p_text; } -void EDIT_SCRIPT(const String &p_path) { -} - Variant _GLOBAL_DEF(const String &p_var, const Variant &p_default, bool p_restart_if_changed, bool p_ignore_value_in_docs, bool p_basic, bool p_internal) { Variant ret; if (!ProjectSettings::get_singleton()->has_setting(p_var)) { @@ -86,6 +85,8 @@ Variant _GLOBAL_DEF(const PropertyInfo &p_info, const Variant &p_default, bool p // **** Shared +#ifdef TOOLS_ENABLED + void SHOW_DOC(const String &p_topic) { #ifdef LIMBOAI_MODULE ScriptEditor::get_singleton()->goto_help(p_topic); @@ -113,3 +114,5 @@ void EDIT_SCRIPT(const String &p_path) { EditorInterface::get_singleton()->set_main_screen_editor("Script"); #endif // LIMBOAI_GDEXTENSION } + +#endif // ! TOOLS_ENABLED diff --git a/util/limbo_compat.h b/util/limbo_compat.h index c2dc0fa5..87b74a8a 100644 --- a/util/limbo_compat.h +++ b/util/limbo_compat.h @@ -152,7 +152,11 @@ inline void VARIANT_DELETE_IF_OBJECT(Variant m_variant) { #define PROJECT_CONFIG_FILE() GET_PROJECT_SETTINGS_DIR().path_join("limbo_ai.cfg") #define IS_RESOURCE_FILE(m_path) (m_path.begins_with("res://") && m_path.find("::") == -1) +#ifdef TOOLS_ENABLED + void SHOW_DOC(const String &p_topic); void EDIT_SCRIPT(const String &p_path); +#endif // ! TOOLS_ENABLED + #endif // LIMBO_COMPAT_H diff --git a/util/limbo_utility.cpp b/util/limbo_utility.cpp index 065b312a..b504967d 100644 --- a/util/limbo_utility.cpp +++ b/util/limbo_utility.cpp @@ -262,9 +262,13 @@ Variant LimboUtility::perform_operation(Operation p_operation, const Variant &le VARIANT_EVALUATE(Variant::OP_MODULE, left_value, right_value, ret); } break; case OPERATION_POWER: { - // TODO: Fix when godot-cpp https://github.com/godotengine/godot-cpp/issues/1348 is resolved. - // Variant::evaluate(Variant::OP_POWER, left_value, right_value, ret, valid); +// TODO: Fix when godot-cpp https://github.com/godotengine/godot-cpp/issues/1348 is resolved. +#ifdef LIMBOAI_MODULE + VARIANT_EVALUATE(Variant::OP_POWER, left_value, right_value, ret); +#else // LIMBOAI_GDEXTENSION ERR_PRINT("LimboUtility: Operation POWER is not available due to https://github.com/godotengine/godot-cpp/issues/1348"); + ret = left_value; +#endif // LIMBOAI_MODULE } break; case OPERATION_BIT_SHIFT_LEFT: { VARIANT_EVALUATE(Variant::OP_SHIFT_LEFT, left_value, right_value, ret); @@ -282,7 +286,7 @@ Variant LimboUtility::perform_operation(Operation p_operation, const Variant &le VARIANT_EVALUATE(Variant::OP_BIT_XOR, left_value, right_value, ret); } break; } - return Variant(); + return ret; } Ref LimboUtility::add_shortcut(const String &p_path, const String &p_name, Key p_keycode) {