@@ -51,6 +51,7 @@ module Swarm.Game.State (
51
51
entityMap ,
52
52
recipesOut ,
53
53
recipesIn ,
54
+ recipesReq ,
54
55
scenarios ,
55
56
knownEntities ,
56
57
world ,
@@ -135,6 +136,7 @@ import Swarm.Game.Recipe (
135
136
inRecipeMap ,
136
137
loadRecipes ,
137
138
outRecipeMap ,
139
+ reqRecipeMap ,
138
140
)
139
141
import Swarm.Game.Robot
140
142
import Swarm.Game.Scenario
@@ -270,6 +272,7 @@ data GameState = GameState
270
272
, _entityMap :: EntityMap
271
273
, _recipesOut :: IntMap [Recipe Entity ]
272
274
, _recipesIn :: IntMap [Recipe Entity ]
275
+ , _recipesReq :: IntMap [Recipe Entity ]
273
276
, _scenarios :: ScenarioCollection
274
277
, _knownEntities :: [Text ]
275
278
, _world :: W. World Int Entity
@@ -399,6 +402,9 @@ recipesOut :: Lens' GameState (IntMap [Recipe Entity])
399
402
-- | All recipes the game knows about, indexed by inputs.
400
403
recipesIn :: Lens' GameState (IntMap [Recipe Entity ])
401
404
405
+ -- | All recipes the game knows about, indexed by requirement/catalyst.
406
+ recipesReq :: Lens' GameState (IntMap [Recipe Entity ])
407
+
402
408
-- | The collection of scenarios that comes with the game.
403
409
scenarios :: Lens' GameState ScenarioCollection
404
410
@@ -679,6 +685,7 @@ initGameState = do
679
685
, _entityMap = entities
680
686
, _recipesOut = outRecipeMap recipes
681
687
, _recipesIn = inRecipeMap recipes
688
+ , _recipesReq = reqRecipeMap recipes
682
689
, _scenarios = loadedScenarios
683
690
, _knownEntities = []
684
691
, _world = W. emptyWorld (fromEnum StoneT )
@@ -726,6 +733,7 @@ scenarioToGameState scenario userSeed toRun g = do
726
733
, _entityMap = em
727
734
, _recipesOut = addRecipesWith outRecipeMap recipesOut
728
735
, _recipesIn = addRecipesWith inRecipeMap recipesIn
736
+ , _recipesReq = addRecipesWith reqRecipeMap recipesReq
729
737
, _knownEntities = scenario ^. scenarioKnown
730
738
, _world = theWorld theSeed
731
739
, _viewCenterRule = VCRobot baseID
0 commit comments