feat: Introduce an action system and command language #138
No reviewers
Labels
No labels
bug
design
duplicate
engine
enhancement
maintenance
prospective
question
regression
stub
todo
ui
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
StudioInfinity/dyna3!138
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "Vectornaut/dyna3:actions"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The branch to be merged introduces actions: trait objects representing things a user can do. It also introduces a command language for describing actions.
One purpose of the action system is to ensure consistency between different user affordances for doing the same thing. On the branch to be merged, as a proof of concept, the element and regulator creation buttons work by creating and executing actions, rather than by acting directly on the application state. A newly introduced keyboard shortcut system provides a different way to trigger each of these actions (addressing issue #132). You can also carry out actions by describing them in the command language and entering those descriptions into the newly introduced command prompt component (addressing issue #133).
subject_array_from_vecless generic a485dd0ee0@glen I've moved the
Actortrait into its own module, as we discussed during the meeting, so the pull request is ready for review! I think this move is an all-around improvement: it reduces clutter in theactionmodule, and it improves the organization of action and actor imports.actormodulefeat: Introduce an action system and command languageto WIP: feat: Introduce an action system and command languageI just noticed that regulators created by descendant actions aren't actually being resolved correctly. The command
doesn't set the regulator of the newly created sphere, because we end up looking for the half-curvature regulator in a clone of the sphere creation action rather than in the original sphere creation action. The cloned sphere creation action creates a different sphere, with a different default half-curvature regulator.
I didn't notice this before because the sphere created by the cloned action has the same curvature has the sphere created by the original action. The command
HalfCurvature Spheretherefore prints the expected measurement, even though it's not reading from the expected regulator.I've put the pull request in draft mode while I work on a fix.
Selftype moreI've drafted a fix for the bug discussed in this comment. The draft includes a strengthened
descendant_regulator_resolution_testthat's able to catch the bug, using the technique described in the comment.The fix works by introducing an environment that keeps track of all the elements and regulators that can be referenced within a command. We carry the environment through the whole interpretation process, updating it whenever the thing we're interpreting creates a regulator.
The current implementation of the environment is a little rough around the edges. For example:
elements_by_idindex from the state into the environment for convenience, even though we could've saved a clone by passing the application state and using theelements_by_idindex from there.The implementation is decent enough, though, that I'd feel okay including it in this first pass. Shall I go ahead and push it to the branch to be merged, or would you like to discuss it at a check-in meeting first?
@Vectornaut wrote in #138 (comment):
Yes, I am keen to move this along and in to the main branch. Thanks!
WIP: feat: Introduce an action system and command languageto feat: Introduce an action system and command languageOkay, I've pushed the fix and reactivated the pull request! Commit
1405329does a reorganization that I'm finding helpful for implementing the "details" or "attributes" syntax we'll use to avoid repetition in the engine block and elsewhere in our save files.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.