Call both native and script _enter/_exit in BTTask

This commit is contained in:
Serhii Snitsaruk 2024-11-01 13:50:08 +01:00
parent 632e26c922
commit 7feff38d6b
No known key found for this signature in database
GPG Key ID: A965EF8799FFEC2D
1 changed files with 9 additions and 9 deletions

View File

@ -234,9 +234,9 @@ BT::Status BTTask::execute(double p_delta) {
data.children.get(i)->abort();
}
}
if (!GDVIRTUAL_CALL(_enter)) {
// First native, then script.
_enter();
}
GDVIRTUAL_CALL(_enter);
} else {
data.elapsed += p_delta;
}
@ -246,9 +246,9 @@ BT::Status BTTask::execute(double p_delta) {
}
if (data.status != RUNNING) {
if (!GDVIRTUAL_CALL(_exit)) {
// First script, then native.
GDVIRTUAL_CALL(_exit);
_exit();
}
data.elapsed = 0.0;
}
return data.status;
@ -259,10 +259,10 @@ void BTTask::abort() {
get_child(i)->abort();
}
if (data.status == RUNNING) {
if (!GDVIRTUAL_CALL(_exit)) {
// First script, then native.
GDVIRTUAL_CALL(_exit);
_exit();
}
}
data.status = FRESH;
data.elapsed = 0.0;
}