-
Notifications
You must be signed in to change notification settings - Fork 89
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
Add support for variables acting on Blitz Lives #1214
Conversation
Make number an expression supporting variables, adds alot more play |
3ba5616
to
de13461
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides what i pointed out, i have doubts about the whole add/remove/set thing.
In the original draft for variables (#881) i had a similar system, but that eventually went out the window in favor of formulas with variables.
Want to add 5? Use <set var="thing" value="thing + 5"/>
Want to halve it? Use <set var"thing" value="thing / 2">
Want to multiply it by the cos of another variable? Use <set var"thing" value="thing * cos(other)">
Its much more flexible than hard-coded allowed operations.
The biggest roadblock is lack of a way to reference lives left within that. I mentioned somewhere that it'd be nice to have more variable types, so you could define a: <variable id="lives" type="blitz-lives">
or similar. Some other candidates would be player curr and max health, or team score. What that allows is to directly operate on blitz lives as if it was just another variable. You can arbitratily <set var="lives" value="lives + 5">
which automatically gets you this behavior, plus you can now operate on so much more (eg: set player max heath based on amount of lives, so last live you have less max hp). Also there's a consideration for potentially read-only variable types, maybe health should be read-only and can be set via a kit if you wish, etc.
I'm fully aware that much of what i mentioned here is well out of scope for this pr, but i'm just trying to give my long-term vision on the matter, in hopes that we can get some middle ground that both aligns this towards that but doesn't necessarily mean a full rewrite
core/src/main/java/tc/oc/pgm/action/actions/BlitzLivesAction.java
Outdated
Show resolved
Hide resolved
I also would prefer to use variables directly for things like this, and I'm willing to go with that approach if we can come up with a suitable design. My main sticking point for why I didn't originally go with that approach is that it seemed like I'd have to create default variables for those things and update them every time the underlying value was changed, while also adding an update for every time the variable changed to change the underlying value. |
de13461
to
bca3408
Compare
ed48c01
to
7413605
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The one last thing i see missing is preventing variable filters for non-dummy variable types being created. If you made a blitz variable and filtered on it, it wouldn't work dynamically
7413605
to
713e53b
Compare
Signed-off-by: Christopher White <[email protected]>
713e53b
to
62fb585
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work
Please note, given recent changes, this should be merged alongside #1220. Syntax has changed. |
New Description:
So decided to go with a different approach for this. This now adds support for different types of variables. Specifically, this adds a blitz lives variable type that directly sets or gets blitz lives for a player.
Example Usage:
With this, the type can be either
dummy
orlives
.dummy
being the original variable type, andlives
getting or writing blitz lives.type
is optional and defaults todummy
.Original description
Adds a
modify-lives
action. At @zzufx's requestYou can add, subtract, or set lives.
Usage would be as follows:
show-title
is optional and can be left outThe action will act on all players in a given scope, so for example you could have a team scoped set lives to 1 that would set the lives remaining for all players to 1 after an objective is completed.
Edit:
amount now supports variables and expressions