nyan
nyan copied to clipboard
Allow undefined set member to require a minimum number of objects
Currently all sets can be initialized as empty which is not always desirable. It should be possible to require a minimum number of elements that have to be defined by the non-abstract set. This could proof useful for cases where at least one object is expected to be present. For example, a set is supposed to contain a number of animations of which the engine selects one randomly. If the set is initiliazed with no animations present, the mechanic doesn't work.
Possible solution:
AnimatedAbility(Ability):
animations : set(Animation, 1)
The 1
denotes that at least one object is required on the set's initilization. Also set(Animation, 0)
would be the same as set(Animation)
. The requirement would only be relevant for the initilization. Patches could still make the set be empty.
Makes sense, although I'd go for something like set(type, min_size=123)
so it's more future-proof and extensible.