Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Towards #1238
This is the first step in implementing a more general replacement for the
drill
command, which leavesdrill
as is and adopts its implementation under a new command. In contrast with drilling,act
does not return a value. Compare:vs.
Equipping an
"agency card"
grants theact
capability.Design rationale
The
use
command (#1287) does not require any particular device to grant a "use" capability; rather, the ability touse
items is exclusively defined by the existing recipes.In contrast, the
act
command offers a convenience atopuse
; 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 theact
capability.Demo
Remaining work
In this PR, the
act
command shares the code implementation ofdrill
exactly other than substituting the returned value withunit
. There may be value in terms ofgit blame
to commit this PR to themain
branch with its unchanged implementation ofdoDrill
, 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 adrill
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 theStep.hs
logic of thedrill
command. The current implementation ofdrill
arguably conflates Swarm's notion of "Capabilities" that enable certain command execution with inputs of a recipe. In thedrill
implementation, therequired
entity need not also beequipped
.For this new
act
command, we should eliminate the redundancy with a recipe'srequired
list. Theagency card
is the singledevice
that enablesact
to be executed with any recipe.