godot-extended-libraries / godot-next

Godot Node Extensions - Basic Node Extensions for Godot Engine
MIT License
960 stars 61 forks source link

Implement simpler, editable initialization order for CallbackDelegator's Behaviors. #23

Open willnationsdev opened 5 years ago

willnationsdev commented 5 years ago

Users may need Behaviors associated with a CallbackDelegator to initialize in a particular order. Right now, it is initialized based on whatever order the internal Dictionary provides them. Since that may be different depending on how they've been inserted and isn't easily controlled by the user, we need to come up with a method of assigning a priority order to the behaviors.

We should probably expose a priority API for a CBD's behaviors. One option would be to store them in an Array as well as the Dictionary. Its simpler, and guarantees that the priority range is composed of exclusively the allowable order. Alternatively, we could use a priority map Dictionary to assign priorities to them. This makes the process of initialization more complicated though as there isn't a specific ordered list of behaviors to initialize.