Support writing to multiple aspects at a time
josephcsible opened this issue ยท 6 comments
We should let you put variable cards in more than one slot in an aspect writer at a time. Here's how I think these should work:
- Audio Writer: it will play multiple sounds, just as if you had one writer for each aspect
- Effect Writer: it will produce multiple effects, just as if you had one writer for each aspect
- Inventory Writer: it will trigger/cancel crafting of everything specified, just as if you had one writer for each aspect
- Redstone Writer: it will output the highest level of all of its aspects
- Importer/Exporter from Integrated Tunnels: it will import/export each aspect in a round-robin fashion each tick (skipping ones that are currently false/don't match anything)
- Player Simulator from Integrated Tunnels: it will click with each matching aspect in a round-robin fashion each tick (skipping ones that are currently false/don't match anything). This will be exceptionally useful to let the same player simulator sometimes click with an empty hand, and sometimes click with an item.
The idea with all of these is that as long as only one aspect is "on" at a time, it behaves just as it would as if it were the one aspect you were using today. When more than one is "on" at a time, I tried to pick the most reasonable solution possible.
Regarding the IT parts, I was also thinking of two other possibilities:
- For aspects that do 'similar' things, the conjunction or disjunction of them could be taken. For example, when transfering an item, the boolean aspect and the item aspect must apply on the transferred item.
- Instead of round-robin, it might also make sense to just let them work at the same time.
Just an idea: aspects could be grouped in 'functionality groups', in which a certain behaviour can be defined what should happen when multiple aspects in this group are active. Possibly, this behaviour could even be configured by the player.
I like the disjunction idea, following the theme that a writer with multiple aspects will act like multiple independent writers. As for being simultaneous instead of round-robin, I was trying to maintain some semblance of balance with only moving one stack per tick, but if you don't care about that, I'm happy to do it that way.
The more I think about this, the more I don't think we need any kind of interaction between aspects at all. I think the simplest and best option is just for each aspect to be completely independent, as if each one were in its own writer.
Actually, taking that line of thought to its logical conclusion, maybe we should abandon this completely in favor of #278, and explicitly support more than one of the same kind of writer in the same space.
I wouldn't throw this idea off the table completely just yet, but for now, we can indeed let this idea rest for a bit in favor of other more urgent issues.
Ok, so before implementation of this starts, we need a good abstraction in order to support these different interaction behaviours.
I suggest adding something to the aspect builder that allows you to set an 'aspect functionality group'. Each group could have a certain mediator that is responsible for choosing which (active) aspect is allowed to be evaluated, or how different aspects can be combined.
Internally, this could be implemented by simply delegating the aspect evaluation to the mediator of its group.