Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Multi-lock for process tasks. 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 finish.
# Tag Process
var _node
var _locks = {}
var _mode
func _init(node, mode='fixed_process'):
_node = node
_mode = mode
func add(tag):
_locks[tag] = true
update()
func remove(tag):
_locks.erase(tag)
update()
func update():
_node.call('set_' + _mode, _locks.size() > 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment