Blackboard: Assigning variables via code might have no effect if done before initialization

This commit is contained in:
Serhii Snitsaruk 2024-03-13 22:00:50 +01:00
parent 088ef008a6
commit cbd467f97f
No known key found for this signature in database
GPG Key ID: A965EF8799FFEC2D
1 changed files with 2 additions and 6 deletions

View File

@ -328,12 +328,8 @@ Ref<Blackboard> BlackboardPlan::create_blackboard(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);
for (const Pair<StringName, BBVariable> &p : var_list) {
if (p_blackboard->has_var(p.first)) {
if (overwrite) {
p_blackboard->erase_var(p.first);
} else {
continue;
}
if (p_blackboard->has_var(p.first) && !overwrite) {
continue;
}
bb_add_var_dup_with_prefetch(p_blackboard, p.first, p.second, prefetch_nodepath_vars, p_node);
}