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) {
|
void BTState::_update(double p_delta) {
|
||||||
VCALL_ARGS(_update, p_delta);
|
VCALL_ARGS(_update, p_delta);
|
||||||
if (!active) {
|
if (!is_active()) {
|
||||||
// Bail out if a transition happened in the meantime.
|
// Bail out if a transition happened in the meantime.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -185,8 +185,8 @@ void LimboState::_notification(int p_what) {
|
||||||
_update_blackboard_plan();
|
_update_blackboard_plan();
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_EXIT_TREE: {
|
case NOTIFICATION_PREDELETE: {
|
||||||
if (active) {
|
if (is_active()) {
|
||||||
_exit();
|
_exit();
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
|
@ -32,6 +32,7 @@ class LimboState : public Node {
|
||||||
GDCLASS(LimboState, Node);
|
GDCLASS(LimboState, Node);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool active;
|
||||||
Ref<BlackboardPlan> blackboard_plan;
|
Ref<BlackboardPlan> blackboard_plan;
|
||||||
Node *agent;
|
Node *agent;
|
||||||
Ref<Blackboard> blackboard;
|
Ref<Blackboard> blackboard;
|
||||||
|
@ -43,8 +44,6 @@ private:
|
||||||
protected:
|
protected:
|
||||||
friend LimboHSM;
|
friend LimboHSM;
|
||||||
|
|
||||||
bool active;
|
|
||||||
|
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
|
|
||||||
void _notification(int p_what);
|
void _notification(int p_what);
|
||||||
|
@ -87,7 +86,7 @@ public:
|
||||||
_FORCE_INLINE_ StringName event_finished() const { return LW_NAME(EVENT_FINISHED); }
|
_FORCE_INLINE_ StringName event_finished() const { return LW_NAME(EVENT_FINISHED); }
|
||||||
LimboState *get_root() const;
|
LimboState *get_root() const;
|
||||||
_FORCE_INLINE_ bool is_root() const { return !(get_parent() && IS_CLASS(get_parent(), LimboState)); }
|
_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 set_guard(const Callable &p_guard_callable);
|
||||||
void clear_guard();
|
void clear_guard();
|
||||||
|
|
Loading…
Reference in New Issue