Blackboard: Assigning variables via code might have no effect if done before initialization
This commit is contained in:
parent
088ef008a6
commit
cbd467f97f
|
@ -328,13 +328,9 @@ Ref<Blackboard> BlackboardPlan::create_blackboard(Node *p_node) {
|
||||||
void BlackboardPlan::populate_blackboard(const Ref<Blackboard> &p_blackboard, bool overwrite, Node *p_node) {
|
void BlackboardPlan::populate_blackboard(const Ref<Blackboard> &p_blackboard, bool overwrite, Node *p_node) {
|
||||||
ERR_FAIL_COND(p_node == nullptr && prefetch_nodepath_vars);
|
ERR_FAIL_COND(p_node == nullptr && prefetch_nodepath_vars);
|
||||||
for (const Pair<StringName, BBVariable> &p : var_list) {
|
for (const Pair<StringName, BBVariable> &p : var_list) {
|
||||||
if (p_blackboard->has_var(p.first)) {
|
if (p_blackboard->has_var(p.first) && !overwrite) {
|
||||||
if (overwrite) {
|
|
||||||
p_blackboard->erase_var(p.first);
|
|
||||||
} else {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
bb_add_var_dup_with_prefetch(p_blackboard, p.first, p.second, prefetch_nodepath_vars, p_node);
|
bb_add_var_dup_with_prefetch(p_blackboard, p.first, p.second, prefetch_nodepath_vars, p_node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue