Merge pull request #131 from limbonaut/fix-reparenting-issue
Fix reparenting an agent deactivates its HSM
This commit is contained in:
commit
adff6bd08c
|
@ -74,7 +74,7 @@ void BTState::_exit() {
|
|||
|
||||
void BTState::_update(double p_delta) {
|
||||
VCALL_ARGS(_update, p_delta);
|
||||
if (!active) {
|
||||
if (!is_active()) {
|
||||
// Bail out if a transition happened in the meantime.
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -185,8 +185,8 @@ void LimboState::_notification(int p_what) {
|
|||
_update_blackboard_plan();
|
||||
}
|
||||
} break;
|
||||
case NOTIFICATION_EXIT_TREE: {
|
||||
if (active) {
|
||||
case NOTIFICATION_PREDELETE: {
|
||||
if (is_active()) {
|
||||
_exit();
|
||||
}
|
||||
} break;
|
||||
|
|
|
@ -32,6 +32,7 @@ class LimboState : public Node {
|
|||
GDCLASS(LimboState, Node);
|
||||
|
||||
private:
|
||||
bool active;
|
||||
Ref<BlackboardPlan> blackboard_plan;
|
||||
Node *agent;
|
||||
Ref<Blackboard> blackboard;
|
||||
|
@ -43,8 +44,6 @@ private:
|
|||
protected:
|
||||
friend LimboHSM;
|
||||
|
||||
bool active;
|
||||
|
||||
static void _bind_methods();
|
||||
|
||||
void _notification(int p_what);
|
||||
|
@ -87,7 +86,7 @@ public:
|
|||
_FORCE_INLINE_ StringName event_finished() const { return LW_NAME(EVENT_FINISHED); }
|
||||
LimboState *get_root() const;
|
||||
_FORCE_INLINE_ bool is_root() const { return !(get_parent() && IS_CLASS(get_parent(), LimboState)); }
|
||||
bool is_active() const { return active; }
|
||||
_FORCE_INLINE_ bool is_active() const { return active; }
|
||||
|
||||
void set_guard(const Callable &p_guard_callable);
|
||||
void clear_guard();
|
||||
|
|
Loading…
Reference in New Issue