File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
addons/yet_another_behavior_tree/src/Nodes Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -29,12 +29,12 @@ var _children:Array[BTNode] = []
29
29
func _init () -> void :
30
30
super ._init ()
31
31
if _is_in_editor :
32
- child_entered_tree . connect ( _update_configuration_warnings_1 )
33
- child_exiting_tree . connect ( _update_configuration_warnings_1 )
34
- tree_entered . connect ( _update_configuration_warnings_0 )
35
- tree_exited . connect ( _update_configuration_warnings_0 )
36
- child_entered_tree . connect ( _update_cached_children )
37
- child_exiting_tree . connect ( _update_cached_children )
32
+ _connect_signal_if_needed ( child_entered_tree , _update_configuration_warnings_1 )
33
+ _connect_signal_if_needed ( child_exiting_tree , _update_configuration_warnings_1 )
34
+ _connect_signal_if_needed ( tree_entered , _update_configuration_warnings_0 )
35
+ _connect_signal_if_needed ( tree_exited , _update_configuration_warnings_0 )
36
+ _connect_signal_if_needed ( child_entered_tree , _update_cached_children )
37
+ _connect_signal_if_needed ( child_exiting_tree , _update_cached_children )
38
38
39
39
func _ready () -> void :
40
40
if _is_in_editor :
@@ -116,3 +116,6 @@ func _stop(actor:Node2D, blackboard:BTBlackboard) -> void:
116
116
func _exit (blackboard :BTBlackboard ) -> void :
117
117
pass
118
118
119
+ func _connect_signal_if_needed (sig :Signal , callable :Callable ) -> void :
120
+ if not sig .is_connected (callable ):
121
+ sig .connect (callable )
You can’t perform that action at this time.
0 commit comments