Merge branch 'vs-fix'
This commit is contained in:
commit
22819be2ea
|
@ -26,7 +26,7 @@ int BTParallel::_tick(double p_delta) {
|
||||||
for (int i = 0; i < get_child_count(); i++) {
|
for (int i = 0; i < get_child_count(); i++) {
|
||||||
int status = 0;
|
int status = 0;
|
||||||
Ref<BTTask> child = get_child(i);
|
Ref<BTTask> child = get_child(i);
|
||||||
if (!repeat && (child->get_status() == FAILURE or child->get_status() == SUCCESS)) {
|
if (!repeat && (child->get_status() == FAILURE || child->get_status() == SUCCESS)) {
|
||||||
status = child->get_status();
|
status = child->get_status();
|
||||||
} else {
|
} else {
|
||||||
status = child->execute(p_delta);
|
status = child->execute(p_delta);
|
||||||
|
|
|
@ -19,7 +19,7 @@ String BTProbability::_generate_name() const {
|
||||||
|
|
||||||
int BTProbability::_tick(double p_delta) {
|
int BTProbability::_tick(double p_delta) {
|
||||||
ERR_FAIL_COND_V_MSG(get_child_count() == 0, FAILURE, "BT decorator has no child.");
|
ERR_FAIL_COND_V_MSG(get_child_count() == 0, FAILURE, "BT decorator has no child.");
|
||||||
if (get_child(0)->get_status() == RUNNING or Math::randf() <= run_chance) {
|
if (get_child(0)->get_status() == RUNNING || Math::randf() <= run_chance) {
|
||||||
return get_child(0)->execute(p_delta);
|
return get_child(0)->execute(p_delta);
|
||||||
}
|
}
|
||||||
return FAILURE;
|
return FAILURE;
|
||||||
|
|
|
@ -20,7 +20,7 @@ String BTTimeLimit::_generate_name() const {
|
||||||
int BTTimeLimit::_tick(double p_delta) {
|
int BTTimeLimit::_tick(double p_delta) {
|
||||||
ERR_FAIL_COND_V_MSG(get_child_count() == 0, FAILURE, "BT decorator has no child.");
|
ERR_FAIL_COND_V_MSG(get_child_count() == 0, FAILURE, "BT decorator has no child.");
|
||||||
int status = get_child(0)->execute(p_delta);
|
int status = get_child(0)->execute(p_delta);
|
||||||
if (status == RUNNING and get_elapsed_time() >= time_limit) {
|
if (status == RUNNING && get_elapsed_time() >= time_limit) {
|
||||||
get_child(0)->cancel();
|
get_child(0)->cancel();
|
||||||
return FAILURE;
|
return FAILURE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -182,7 +182,7 @@ void TaskTree::load_bt(const Ref<BehaviorTree> &p_behavior_tree) {
|
||||||
ERR_FAIL_COND_MSG(p_behavior_tree.is_null(), "Tried to load a null tree.");
|
ERR_FAIL_COND_MSG(p_behavior_tree.is_null(), "Tried to load a null tree.");
|
||||||
|
|
||||||
Callable on_task_changed = callable_mp(this, &TaskTree::_on_task_changed);
|
Callable on_task_changed = callable_mp(this, &TaskTree::_on_task_changed);
|
||||||
if (last_selected.is_valid() and last_selected->is_connected("changed", on_task_changed)) {
|
if (last_selected.is_valid() && last_selected->is_connected("changed", on_task_changed)) {
|
||||||
last_selected->disconnect("changed", on_task_changed);
|
last_selected->disconnect("changed", on_task_changed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,7 +195,7 @@ void TaskTree::load_bt(const Ref<BehaviorTree> &p_behavior_tree) {
|
||||||
|
|
||||||
void TaskTree::unload() {
|
void TaskTree::unload() {
|
||||||
Callable on_task_changed = callable_mp(this, &TaskTree::_on_task_changed);
|
Callable on_task_changed = callable_mp(this, &TaskTree::_on_task_changed);
|
||||||
if (last_selected.is_valid() and last_selected->is_connected("changed", on_task_changed)) {
|
if (last_selected.is_valid() && last_selected->is_connected("changed", on_task_changed)) {
|
||||||
last_selected->disconnect("changed", on_task_changed);
|
last_selected->disconnect("changed", on_task_changed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -314,7 +314,7 @@ TaskTree::TaskTree() {
|
||||||
|
|
||||||
TaskTree::~TaskTree() {
|
TaskTree::~TaskTree() {
|
||||||
Callable on_task_changed = callable_mp(this, &TaskTree::_on_task_changed);
|
Callable on_task_changed = callable_mp(this, &TaskTree::_on_task_changed);
|
||||||
if (last_selected.is_valid() and last_selected->is_connected("changed", on_task_changed)) {
|
if (last_selected.is_valid() && last_selected->is_connected("changed", on_task_changed)) {
|
||||||
last_selected->disconnect("changed", on_task_changed);
|
last_selected->disconnect("changed", on_task_changed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ LimboUtility *LimboUtility::get_singleton() {
|
||||||
|
|
||||||
String LimboUtility::decorate_var(String p_variable) const {
|
String LimboUtility::decorate_var(String p_variable) const {
|
||||||
String var = p_variable.trim_prefix("$").trim_prefix("\"").trim_suffix("\"");
|
String var = p_variable.trim_prefix("$").trim_prefix("\"").trim_suffix("\"");
|
||||||
if (var.find(" ") == -1 and not var.is_empty()) {
|
if (var.find(" ") == -1 && !var.is_empty()) {
|
||||||
return vformat("$%s", var);
|
return vformat("$%s", var);
|
||||||
} else {
|
} else {
|
||||||
return vformat("$\"%s\"", var);
|
return vformat("$\"%s\"", var);
|
||||||
|
|
Loading…
Reference in New Issue