From f5d21e26695bc12a343616b85c5a8ca677fe2789 Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Sat, 2 Mar 2024 20:19:38 +0100 Subject: [PATCH] Fix BTState not honoring API virtual methods --- bt/bt_state.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bt/bt_state.cpp b/bt/bt_state.cpp index 72fe994..4fd25e3 100644 --- a/bt/bt_state.cpp +++ b/bt/bt_state.cpp @@ -46,6 +46,7 @@ void BTState::_update_blackboard_plan() { } void BTState::_setup() { + LimboState::_setup(); ERR_FAIL_COND_MSG(behavior_tree.is_null(), "BTState: BehaviorTree is not assigned."); tree_instance = behavior_tree->instantiate(get_agent(), get_blackboard()); @@ -57,19 +58,21 @@ void BTState::_setup() { } void BTState::_exit() { - ERR_FAIL_COND(tree_instance == nullptr); + LimboState::_exit(); + ERR_FAIL_NULL(tree_instance); tree_instance->abort(); } void BTState::_update(double p_delta) { - ERR_FAIL_COND(tree_instance == nullptr); + VCALL_ARGS(_update, p_delta); + ERR_FAIL_NULL(tree_instance); int status = tree_instance->execute(p_delta); - emit_signal(LimboStringNames::get_singleton()->updated, p_delta); if (status == BTTask::SUCCESS) { get_root()->dispatch(success_event, Variant()); } else if (status == BTTask::FAILURE) { get_root()->dispatch(failure_event, Variant()); } + emit_signal(LW_NAME(updated), p_delta); } void BTState::_notification(int p_notification) {