Skip to content

Commit

Permalink
rename 'Pickable' property to 'Portable' in code
Browse files Browse the repository at this point in the history
  • Loading branch information
kostmo committed Jan 4, 2024
1 parent 4805888 commit 86d5628
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions app/doc/Swarm/Doc/Wiki/Cheatsheet.hs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ capabilityPage a em = capabilityTable a em listEnums
-- ** Entities

entityHeader :: [Text]
entityHeader = ["?", "Name", "Capabilities", "Properties*", "Portable"]
entityHeader = ["?", "Name", "Capabilities", "Properties*", "Pickable"]

entityToList :: Entity -> [Text]
entityToList e =
Expand All @@ -193,8 +193,8 @@ entityToList e =
[ codeQuote . T.singleton $ e ^. entityDisplay . to displayChar
, addLink ("#" <> linkID) $ view entityName e
, T.intercalate ", " $ Capability.capabilityName <$> Set.toList (view E.entityCapabilities e)
, T.intercalate ", " . map tshow . filter (/= E.Portable) $ toList props
, if E.Portable `elem` props
, T.intercalate ", " . map tshow . filter (/= E.Pickable) $ toList props
, if E.Pickable `elem` props
then ":heavy_check_mark:"
else ":negative_squared_cross_mark:"
]
Expand Down Expand Up @@ -229,7 +229,7 @@ entitiesPage _a es =
T.intercalate "\n\n" $
[ "# Entities"
, "This is a quick-overview table of entities - click the name for detailed description."
, "*) As a note, most entities have the Portable property, so we show it in a separate column."
, "*) As a note, most entities have the Pickable property, so we show it in a separate column."
, entityTable es
]
<> map entityToSection es
Expand Down
2 changes: 1 addition & 1 deletion src/Swarm/Game/Entity.hs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ data EntityProperty
= -- | Robots can't move onto a cell containing this entity.
Unwalkable
| -- | Robots can pick this up (via 'Swarm.Language.Syntax.Grab' or 'Swarm.Language.Syntax.Harvest').
Portable
Pickable
| -- | Robots can 'Swarm.Language.Syntax.Push' this
Pushable
| -- | Obstructs the view of robots that attempt to "scout"
Expand Down
6 changes: 3 additions & 3 deletions src/Swarm/Game/Step/Const.hs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ execConst runChildProg c vs s k = do
let verbed = verbedGrabbingCmd Push'
-- Ensure it can be pushed.
omni <- isPrivilegedBot
(omni || e `hasProperty` Pushable || e `hasProperty` Portable && not (e `hasProperty` Liquid))
(omni || e `hasProperty` Pushable || e `hasProperty` Pickable && not (e `hasProperty` Liquid))
`holdsOrFail` ["The", e ^. entityName, "here can't be", verbed <> "."]

-- Place the entity and remove it from previous loc
Expand Down Expand Up @@ -1238,7 +1238,7 @@ execConst runChildProg c vs s k = do
chosenRecipe
`isJustOrFail` ["You don't have the ingredients to", verbPhrase, indefinite (nextE ^. entityName) <> "."]

let (out, down) = L.partition ((`hasProperty` Portable) . snd) outs
let (out, down) = L.partition ((`hasProperty` Pickable) . snd) outs
learn = map (LearnEntity . snd) down
gain = map (uncurry AddEntity) out

Expand Down Expand Up @@ -1659,7 +1659,7 @@ execConst runChildProg c vs s k = do

-- Ensure it can be picked up.
omni <- isPrivilegedBot
(omni || e `hasProperty` Portable)
(omni || e `hasProperty` Pickable)
`holdsOrFail` ["The", e ^. entityName, "here can't be", verbed <> "."]

-- Remove the entity from the world.
Expand Down
2 changes: 1 addition & 1 deletion src/Swarm/TUI/View.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1195,7 +1195,7 @@ displayProperties = displayList . mapMaybe showProperty
showProperty Unwalkable = Just "blocking"
showProperty Opaque = Just "opaque"
-- Most things are portable so we don't show that.
showProperty Portable = Nothing
showProperty Pickable = Nothing
-- 'Known' is just a technical detail of how we handle some entities
-- in challenge scenarios and not really something the player needs
-- to know.
Expand Down

0 comments on commit 86d5628

Please sign in to comment.