Skip to content

Commit

Permalink
make custom entities override built-in entities
Browse files Browse the repository at this point in the history
  • Loading branch information
byorgey committed Dec 28, 2024
1 parent 20fd908 commit fcd64ba
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 3 deletions.
4 changes: 2 additions & 2 deletions data/scenarios/Challenges/Ranching/pied-piper.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ entities:
char: 'k'
description:
- Used by an `unlocker`{=entity} to open a a `locked door`{=entity}
properties: [known]
properties: [known, pickable]
- name: unlocker
display:
char: 'u'
Expand All @@ -190,7 +190,7 @@ entities:
attr: wood
description:
- wall
properties: [known, unwalkable]
properties: [known, unwalkable, boundary]
- name: oats
display:
attr: oats
Expand Down
1 change: 1 addition & 0 deletions data/scenarios/Testing/00-ORDER.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,4 @@ Achievements
231-requirements
2085-toplevel-mask.yaml
2086-structure-palette.yaml
2239-custom-entity.yaml
42 changes: 42 additions & 0 deletions data/scenarios/Testing/2239-custom-entity.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
version: 1
name: Custom entity
description: |
Custom entity overriding standard entity
creative: false
objectives:
- goal:
- Move to (1,0)
condition: |
as base {
loc <- whereami;
return $ loc == (1,0)
};
entities:
- name: rock
display:
char: '$'
attr: gold
description:
- Not your average rock!
properties: [pickable]
capabilities: [move]
robots:
- name: base
dir: east
devices:
- logger
- grabber
- welder
solution: |
grab;
equip "rock";
move
known: [rock]
world:
dsl: |
{grass}
palette:
'B': [grass, rock, base]
upperleft: [0, 0]
map: |
B
2 changes: 1 addition & 1 deletion src/swarm-scenario/Swarm/Game/Entity.hs
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ data EntityMap = EntityMap
instance Semigroup EntityMap where
EntityMap n1 c1 d1 <> EntityMap n2 c2 d2 =
EntityMap
(n1 <> n2)
(n2 <> n1)
(c1 <> c2)
(filter ((`M.notMember` n2) . view entityName) d1 <> d2)

Expand Down

0 comments on commit fcd64ba

Please sign in to comment.