fix(gs/xanthous): Don't gen dupe tutorial messages

Don't generate tutorial messages on levels other than the first.

Change-Id: I7681377461b92f5d5015931b0088bef9d358d2e4
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3804
Reviewed-by: grfn <grfn@gws.fyi>
Tested-by: BuildkiteCI
This commit is contained in:
Griffin Smith 2021-11-06 12:24:10 -04:00 committed by grfn
parent 580e37ff64
commit eeafd0fa0e
2 changed files with 13 additions and 7 deletions

View file

@ -568,12 +568,14 @@ showPanel panel = do
genLevel
:: Word -- ^ Level number, starting at 0
-> AppM Level
genLevel _num = do
genLevel num = do
let dims = Dimensions 80 80
generator <- choose $ CaveAutomata :| [Dungeon]
level <- case generator of
CaveAutomata -> generateLevel SCaveAutomata CaveAutomata.defaultParams dims
Dungeon -> generateLevel SDungeon Dungeon.defaultParams dims
let
doGen = case generator of
CaveAutomata -> generateLevel SCaveAutomata CaveAutomata.defaultParams
Dungeon -> generateLevel SDungeon Dungeon.defaultParams
level <- doGen dims num
pure $!! level
levelToGameLevel :: Level -> GameLevel

View file

@ -85,7 +85,7 @@ parseGeneratorInput = Opt.subparser
generatorCommand sgen name desc parseParams =
Opt.command name
(Opt.info
(GeneratorInput <$> pure sgen <*> parseParams)
(GeneratorInput sgen <$> parseParams)
(Opt.progDesc desc)
)
@ -132,8 +132,9 @@ generateLevel
=> SGenerator gen
-> Params gen
-> Dimensions
-> Word -- ^ Level number, starting at 0
-> m Level
generateLevel gen ps dims = do
generateLevel gen ps dims num = do
rand <- mkStdGen <$> getRandom
let cells = generate gen ps dims rand
_levelWalls = cellsToWalls cells
@ -146,7 +147,10 @@ generateLevel gen ps dims = do
let upStaircase = _EntityMap # [(_levelCharacterPosition, UpStaircase)]
downStaircase <- placeDownStaircase cells
let _levelStaircases = upStaircase <> downStaircase
_levelTutorialMessage <- tutorialMessage cells _levelCharacterPosition
_levelTutorialMessage <-
if num == 0
then tutorialMessage cells _levelCharacterPosition
else pure mempty
pure Level {..}
levelToEntityMap :: Level -> EntityMap SomeEntity