Add isempty : cmd bool
to check whether current cell has an entity
#968
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.
As I've been playing around in classic mode I've found it a bit annoying/unbalanced that although you can use
ishere : text -> cmd bool
to check for the presence of a specific entity, the only way to check whether a cell is empty is to write something likeHowever, this requires having a
comparator
and anADT calculator
--- the latter in particular is quite difficult to construct. So, I propose adding a primitiveisempty : cmd bool
. Note this doesn't makescan
useless --- it's more powerful still since it lets you find out the name of anything (even stuff not in the current cell).An alternative might be to get rid of
ishere
as well (since it can also be programmed in terms ofscan
), but tons of obvious early-game automation (e.g. harvesting a tree plantation) depends on being able to have conditionals based on the presence or absence of certain entities, and it would be unreasonable to have that depend on making anADT calculator
.The
scanner
now provides quite a few commands; I think that's OK but chime in if you think we ought to split it into multiple devices. I think it makes sense to havescan
,ishere
, andisempty
all provided byscanner
since it's just providing several interfaces to the same "service", one general and several simpler but easier-to-use versions. If we split anything out it could make sense to split outblocked
(laser range finder
, perhaps?) and/orupload
.