BlackboardPlan: Avoid circular references in derived mode

If the same plan resource is assigned in BehaviorTree and in BTPlayer, simply use the resource as is. Using the same resource for `BehaviorTree` and `BTPlayer` will disable derived mode, and allow managing from `BTPlayer` . There is a risk of using `NodePath` variables with different scenes: the path may actually be different if node structure is not the same. It will lead to fetching breaking for some of those scenes.
This commit is contained in:
Serhii Snitsaruk 2024-04-01 01:45:40 +02:00
parent 5ff42e29e4
commit d48daf2135
No known key found for this signature in database
GPG Key ID: A965EF8799FFEC2D
1 changed files with 5 additions and 1 deletions

View File

@ -121,7 +121,11 @@ bool BlackboardPlan::_property_get_revert(const StringName &p_name, Variant &r_p
} }
void BlackboardPlan::set_base_plan(const Ref<BlackboardPlan> &p_base) { void BlackboardPlan::set_base_plan(const Ref<BlackboardPlan> &p_base) {
if (p_base == this) {
base.unref();
} else {
base = p_base; base = p_base;
}
sync_with_base_plan(); sync_with_base_plan();
notify_property_list_changed(); notify_property_list_changed();
} }