Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Allow Multiple OR Conditions in Aspects #648

Open
spencerflem opened this issue Oct 17, 2021 · 0 comments
Open

[FEATURE] Allow Multiple OR Conditions in Aspects #648

spencerflem opened this issue Oct 17, 2021 · 0 comments

Comments

@spencerflem
Copy link

spencerflem commented Oct 17, 2021

In general, Aspects are very restrictive in the logic they specify. It's not possible to, for example, ask for systems that have

One of {
ComponentA,
ComponentB
} and also One of {
ComponentC
ComponentD
}

This would be handy for me, since I have several equivalent components. For example, if the component has either a BoxBody or a Pos component I would be able to figure out its position. Similarly with BoxBody and Rotation components.

Currently, if something needs both a Pos-Like component and a Rotation-Like component there is no way to specify this with Aspects and I have to check at runtime. I have WIP plugin that adds InterfaceMappers that allow retrieving an Interface rather than a concrete Component. Not being able to specify what a valid Aspect is makes using it difficult.

There's other boolean logic that seems like it should be possible with aspects that currently aren't, such as:

One of {
All of { A, B, C },
All of { D, Exactly One of {E, F, G}} ,
H
}

For my use case, only the multiple ORs are important, but the nested logic seemed worth mentioning.

If this seems like a useful change, I'd be happy to try making a Pull Request for it. I've looked into doing it as a plugin, but Aspects are pretty integrated into Artemis and it seemed gross to need replacement versions for EntityLinkManager, ComponentMappers, and all the other classes that at some point indirectly use Aspects.

Alternatively, possibly Aspect could be modified to be extendable, which would allow ExtendedAspects to be a plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant