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

'act' command #1286

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

'act' command #1286

wants to merge 1 commit into from

Conversation

kostmo
Copy link
Member

@kostmo kostmo commented May 29, 2023

Towards #1238

This is the first step in implementing a more general replacement for the drill command, which leaves drill as is and adopts its implementation under a new command. In contrast with drilling, act does not return a value. Compare:

act : dir -> cmd unit

vs.

drill : dir -> cmd (unit + text)

Equipping an "agency card" grants the act capability.

Design rationale

The use command (#1287) does not require any particular device to grant a "use" capability; rather, the ability to use items is exclusively defined by the existing recipes.

In contrast, the act command offers a convenience atop use; it does not require the player to specify which device to use upon a given target entity. For this convenience, an extra device (agency card) must be equipped to grant the act capability.

Demo

scripts/play.sh --scenario data/scenarios/Testing/1238-act-command.yaml --autoplay

Remaining work

In this PR, the act command shares the code implementation of drill exactly other than substituting the returned value with unit. There may be value in terms of git blame to commit this PR to the main branch with its unchanged implementation of doDrill, then modify/refactor that code in a follow-up PR.

One awkward consequence of this currently shared code is that executing the act command still requires a drill to be "equipped".

Another aspect for consideration is that in many "canonical" recipes, a "drill" is both included in the "required" list in the recipe and is also implicitly (and redundantly) required to be "equipped" in the Step.hs logic of the drill command. The current implementation of drill arguably conflates Swarm's notion of "Capabilities" that enable certain command execution with inputs of a recipe. In the drill implementation, the required entity need not also be equipped.

For this new act command, we should eliminate the redundancy with a recipe's required list. The agency card is the single device that enables act to be executed with any recipe.

@kostmo kostmo force-pushed the feature/act branch 3 times, most recently from 8e0066c to 07ef5f2 Compare May 29, 2023 01:31
'act' command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant