-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Currently, it is impossible to unregister commands because:
A. no obvious good means of implementation was thought of during development,
B. doing so was not necessary in my own uses of the addon.
However, unregistering commands may be necessary if:
- Command
Arguments orCallback()(s) references a freed object - The game is in a state where certain commands makes no sense to execute
Case 2 has multiple ways solutions (commands all error, prefixed Condition(s), unregister the commands), none of which feel "most correct". For those situations, I will leave the choice to the developer. Case 1, however, has no solution without this addition. Limiting the context from a vague "allow command unregistration" to this specific problem case, a system involving ownership seems best.
Argument nodes in ArgumentGraph should have a list of owners, that are objects that have registered commands that involve them. A node can have multiple owners. CommandServer can be given an object reference, and remove its ownership of any nodes it owns, then separately (and probably not automatically) be told to prune the ArgumentGraph of nodes which have no owners.