From 778ba71079a5b3cadd150ff86b00a51805311fe4 Mon Sep 17 00:00:00 2001 From: Brent Yorgey Date: Sat, 13 Jan 2024 16:43:52 -0600 Subject: [PATCH] Grant achievement for crafting a bitcoin (#1688) Grant `CraftedBitcoin` achievement when using the `make` command to craft a `bitcoin`, not in creative mode, and not a system robot. Towards #1435 . --- src/swarm-engine/Swarm/Game/Step/Const.hs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/swarm-engine/Swarm/Game/Step/Const.hs b/src/swarm-engine/Swarm/Game/Step/Const.hs index 27dad350..65799b99 100644 --- a/src/swarm-engine/Swarm/Game/Step/Const.hs +++ b/src/swarm-engine/Swarm/Game/Step/Const.hs @@ -382,6 +382,7 @@ execConst runChildProg c vs s k = do [VText name] -> do inv <- use robotInventory ins <- use equippedDevices + sys <- use systemRobot em <- use $ landscape . entityMap e <- lookupEntityName name em @@ -423,6 +424,9 @@ execConst runChildProg c vs s k = do -- take recipe inputs from inventory and add outputs after recipeTime robotInventory .= invTaken traverse_ (updateDiscoveredEntities . snd) (recipe ^. recipeOutputs) + -- Grant CraftedBitcoin achievement + when (name == "bitcoin" && not creative && not sys) $ grantAchievement CraftedBitcoin + finishCookingRecipe recipe VUnit [] (map (uncurry AddEntity) changeInv) _ -> badConst Has -> case vs of