Some days ago I had a particular issue implementing NPCs with many behavior facets which required live processing. As you see, my NPCs had to follow my character around the map and some of them had to apply some damage per second to end up killing him. For this reason I ended up having several tasks that required live processing and my code become messy due to a bunch of flags regulating whether I should turn live processing off or on. In order to kill this spaghetti code and replace it with something readable I decided to implement a tag-based multi-lock for Godot Engine’s per-node processing.
With this script you can add multiple tags referring a behavior you are executing and needs processing. When first tag is added, processing tasks will be launched. When last tag is removed, processing tasks will end. Rather simple, but really necessary for some games featuring NPCs with several behaviors like I do have.