pushable property (#1683)

Closes #1681
This commit is contained in:
Karl Ostmo 2023-12-13 13:32:55 -08:00 committed by GitHub
parent 13ae996306
commit b158251a20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 63 additions and 1 deletions

View File

@ -53,3 +53,4 @@ Achievements
1575-structure-recognizer
1631-tags.yaml
1634-message-colors.yaml
1681-pushable-entity.yaml

View File

@ -0,0 +1,57 @@
version: 1
name: Push test
creative: false
description: Push item
objectives:
- goal:
- Push a crate onto the stone pad
condition: |
j <- robotnamed "judge";
as j {ishere "crate"}
solution: |
move;
push;
robots:
- name: base
dir: [1, 0]
display:
char: Ω
attr: robot
devices:
- branch predictor
- calculator
- compass
- dictionary
- grabber
- logger
- net
- scanner
- treads
- dozer blade
- name: judge
dir: [0, 1]
system: true
display:
char: j
attr: robot
invisible: true
entities:
- name: crate
display:
attr: wood
char: 'c'
description:
- Pushable crate
properties: [known, pushable]
known: [water]
world:
dsl: |
{water}
palette:
'Ω': [grass, erase, base]
'j': [stone, erase, judge]
'.': [grass, erase]
'x': [grass, crate]
upperleft: [0, 0]
map: |
Ωxxj

View File

@ -141,6 +141,8 @@ data EntityProperty
Unwalkable
| -- | Robots can pick this up (via 'Swarm.Language.Syntax.Grab' or 'Swarm.Language.Syntax.Harvest').
Portable
| -- | Robots can 'Swarm.Language.Syntax.Push' this
Pushable
| -- | Obstructs the view of robots that attempt to "scout"
Opaque
| -- | Regrows from a seed after it is harvested.

View File

@ -187,7 +187,7 @@ execConst runChildProg c vs s k = do
let verbed = verbedGrabbingCmd Push'
-- Ensure it can be pushed.
omni <- isPrivilegedBot
(omni || e `hasProperty` Portable && not (e `hasProperty` Liquid))
(omni || e `hasProperty` Pushable || e `hasProperty` Portable && not (e `hasProperty` Liquid))
`holdsOrFail` ["The", e ^. entityName, "here can't be", verbed <> "."]
-- Place the entity and remove it from previous loc

View File

@ -1188,6 +1188,7 @@ displayProperties :: [EntityProperty] -> Widget Name
displayProperties = displayList . mapMaybe showProperty
where
showProperty Growable = Just "growing"
showProperty Pushable = Just "pushable"
showProperty Combustible = Just "combustible"
showProperty Infinite = Just "infinite"
showProperty Liquid = Just "liquid"

View File

@ -339,6 +339,7 @@ testScenarioSolutions rs ui =
, testSolution Default "Testing/1207-scout-command"
, testSolution Default "Testing/1218-stride-command"
, testSolution Default "Testing/1234-push-command"
, testSolution Default "Testing/1681-pushable-entity"
, testSolution Default "Testing/1256-halt-command"
, testSolution Default "Testing/1295-density-command"
, testSolution Default "Testing/1356-portals/portals-flip-and-rotate"