Skip to content

Commit 5d612f2

Browse files
authored
Grant achievement for unequipping a welder (#2564)
Closes #2288.
1 parent 4956499 commit 5d612f2

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

src/swarm-engine/Swarm/Game/Achievement/Description.hs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,13 @@ describe = \case
110110
"`equip` all craftable devices simultaneously."
111111
Gruelling
112112
True
113+
GameplayAchievement UnequippedWelder ->
114+
AchievementInfo
115+
"Put That Back!"
116+
(Just $ Freeform "Maybe... you should have thought that one through first.")
117+
"`unequip` a welder."
118+
Easy
119+
True
113120

114121
-- | Validity conditions are required if-and-only-if the achievement
115122
-- category is 'GameplayAchievement'.
@@ -124,3 +131,4 @@ getValidityRequirements = \case
124131
SwapSame -> ValidityConditions OnlyPlayerRobot ExcludesCreativeMode
125132
GaveToSelf -> ValidityConditions OnlyPlayerRobot ExcludesCreativeMode
126133
EquippedAllDevices -> ValidityConditions OnlyPlayerRobot ExcludesCreativeMode
134+
UnequippedWelder -> ValidityConditions OnlyPlayerRobot ExcludesCreativeMode

src/swarm-engine/Swarm/Game/Step/Const.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,9 @@ execConst runChildProg c vs s k = do
461461
loc <- use robotLocation
462462
addAsphyxiateBot createdAt loc
463463

464+
-- Grant an achievement for unequipping a welder.
465+
when (itemName == "welder") $ grantAchievementForRobot UnequippedWelder
466+
464467
-- Now check whether being on the current cell would still be
465468
-- allowed.
466469
loc <- use robotLocation

src/swarm-scenario/Swarm/Game/Achievement/Definitions.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ data GameplayAchievement
127127
| SwapSame
128128
| GaveToSelf
129129
| EquippedAllDevices
130+
| UnequippedWelder
130131
deriving (Eq, Ord, Show, Bounded, Enum, Generic)
131132

132133
instance FromJSON GameplayAchievement

0 commit comments

Comments
 (0)