-
Notifications
You must be signed in to change notification settings - Fork 127
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
Store action-specific state in ActionState
#60
Comments
Blocks #50. |
We can eliminate the This may make #68 harder, but this feature is significantly more important, and serves related goals. |
ActionState
ActionState
We may be able to workaround this by generating an internal type to match those of each variant, and then requesting those in |
This is fundamentally wrong-headed, and not our responsibility. |
Changed my mind again. This is a common and interesting pattern, we should try to see if we can think up a design 😂 |
#151 has some related mechanisms, we should figure out how to steal from the approach used to store gamepad axis values. |
Closing this out because we can now store action state values. |
@alice-i-cecile could you (or someone else) point to an example of how to store action state value? Or at least to the feature you mean. I want to do something similar to the example in the issue description: pass additional data with an Actionlike enum variant. |
The feature that I've been using is the I'm not fully satisfied with the design here either/ |
I don't think that's enough for my use case, but to be fair, I'm trying to do a pretty weird thing. I move the mouse cursor on a tile grid and wanted to model this as an action, something like: enum Action {
MoveTileCursor(GridCoords),
Move, // to the tile cursor
Shoot, // to the place under the tile cursor
} Shoot and Move would map to mouse keys, but for Why would I want to do this? To simplify AI. The AI opponent would do something like:
Am I completely off with my thinking? |
Nope, this is a very natural pattern, and something I'd considered before. Reopening this so we remember to chew on additional designs. |
Many actions are only meaningful in association with non-enumerable data.
A very useful pattern here is to store information in the enum variant, and then update that appropriately.
We want to be able to express:
Unfortunately, a reasonable API for the last step seems to be completely blocked on rust-lang/rfcs#2593, which, unsurprisingly, is postponed indefinitely 🙃
The text was updated successfully, but these errors were encountered: