diff options
author | Griffin Smith <grfn@gws.fyi> | 2021-11-06T16·24-0400 |
---|---|---|
committer | grfn <grfn@gws.fyi> | 2021-11-06T17·34+0000 |
commit | eeafd0fa0ed85957f0609863d1d06b570c55341b (patch) | |
tree | 2f00ad265dd31f4d1d0f4a2ea418aed8f70071c1 /users/grfn | |
parent | 580e37ff64b47f46cbafe39e448847320295f591 (diff) |
fix(gs/xanthous): Don't gen dupe tutorial messages r/3011
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
Diffstat (limited to 'users/grfn')
-rw-r--r-- | users/grfn/xanthous/src/Xanthous/App.hs | 10 | ||||
-rw-r--r-- | users/grfn/xanthous/src/Xanthous/Generators/Level.hs | 10 |
2 files changed, 13 insertions, 7 deletions
diff --git a/users/grfn/xanthous/src/Xanthous/App.hs b/users/grfn/xanthous/src/Xanthous/App.hs index bf6a63e086ce..9318c713478b 100644 --- a/users/grfn/xanthous/src/Xanthous/App.hs +++ b/users/grfn/xanthous/src/Xanthous/App.hs @@ -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 diff --git a/users/grfn/xanthous/src/Xanthous/Generators/Level.hs b/users/grfn/xanthous/src/Xanthous/Generators/Level.hs index 81f21f55ff00..ac97159f422c 100644 --- a/users/grfn/xanthous/src/Xanthous/Generators/Level.hs +++ b/users/grfn/xanthous/src/Xanthous/Generators/Level.hs @@ -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 |