Move generating item combinations graph from load to menu log
This commit is contained in:
Binary file not shown.
+1
-11
@@ -5,8 +5,6 @@ import Data.Preload.Render
|
||||
import Control.Lens
|
||||
import Control.Monad.State
|
||||
import Data.Foldable
|
||||
import qualified Data.Text.IO as TIO
|
||||
import Dodge.Combine.Graph
|
||||
import Dodge.Data.GenWorld
|
||||
import Dodge.Floor
|
||||
import Dodge.Initialisation
|
||||
@@ -19,18 +17,15 @@ import System.Random
|
||||
generateWorldFromSeed :: RenderData -> Int -> IO World
|
||||
generateWorldFromSeed rdata i = do
|
||||
createDirectoryIfMissing True "generated/log"
|
||||
createDirectoryIfMissing True "generated/graph"
|
||||
-- createDirectoryIfMissing True "generated/graph"
|
||||
writeFile "generated/log/attemptedSeeds" ""
|
||||
writeFile "generated/log/treeCluster" ""
|
||||
writeFile "generated/log/aGeneratedRoomLayout" ""
|
||||
generateGraphs
|
||||
(roomList, bounds) <- layoutLevelFromSeed 0 i
|
||||
postGenerationProcessing rdata
|
||||
$! generateLevelFromRoomList roomList $ initialWorld{_randGen = mkStdGen i}
|
||||
& cWorld . cwGen . cwgRoomClipping .~ bounds
|
||||
& cWorld . cwGen . cwgSeed .~ i
|
||||
-- & gwWorld . cWorld . cwGen . cwgRoomClipping .~ bounds
|
||||
-- & gwWorld . cWorld . cwGen . cwgSeed .~ i
|
||||
|
||||
postGenerationProcessing :: RenderData -> GenWorld -> IO World
|
||||
postGenerationProcessing _ gw = do
|
||||
@@ -38,11 +33,6 @@ postGenerationProcessing _ gw = do
|
||||
let w = w' & cWorld . cwTiles .~ (tilesFromRooms . IM.elems $ _genRooms gw)
|
||||
return $ foldl' assignPushDoors w (w ^. cWorld . lWorld . doors)
|
||||
|
||||
generateGraphs :: IO ()
|
||||
generateGraphs = do
|
||||
createDirectoryIfMissing True "generated/graph"
|
||||
TIO.writeFile "generaged/graph/itemCombinations.gv" combinationsDotGraph
|
||||
|
||||
assignPushDoors :: World -> Door -> World
|
||||
assignPushDoors w dr = case dr ^?! drPushedBy of
|
||||
PushedBy i -> w & cWorld . lWorld . doors . ix i . drPushes ?~ _drID dr
|
||||
|
||||
+21
-2
@@ -4,6 +4,9 @@ module Dodge.Menu (
|
||||
splashMenu,
|
||||
) where
|
||||
|
||||
import Dodge.Combine.Graph
|
||||
import System.Directory
|
||||
import qualified Data.Text.IO as TIO
|
||||
import Control.Monad
|
||||
import qualified Data.Aeson.Encode.Pretty as AEP
|
||||
import Data.ByteString.Lazy.Char8 (unpack)
|
||||
@@ -115,11 +118,15 @@ optionsOptions =
|
||||
[ makeSubmenuOption soundMenu $ MODString "VOLUME"
|
||||
, makeSubmenuOption graphicsMenu $ MODString "GRAPHICS"
|
||||
, makeSubmenuOption gameplayMenu $ MODString "GAMEPLAY"
|
||||
, makeSubmenuOption debugMenu $ MODString "DEBUG OPTIONS"
|
||||
, makeSubmenuOption debugMenu $ MODString "DEBUG"
|
||||
, makeSubmenuOption logMenu $ MODString "LOG"
|
||||
]
|
||||
|
||||
debugMenu :: Universe -> ScreenLayer
|
||||
debugMenu = titleOptionsMenu "OPTIONS:GAMEPLAY" debugMenuOptions
|
||||
debugMenu = titleOptionsMenu "OPTIONS:DEBUG" debugMenuOptions
|
||||
|
||||
logMenu :: Universe -> ScreenLayer
|
||||
logMenu = titleOptionsMenu "OPTIONS:LOG" logOptions
|
||||
|
||||
debugMenuOptions :: [MenuOption]
|
||||
debugMenuOptions =
|
||||
@@ -133,6 +140,18 @@ debugMenuOptions =
|
||||
g bd Nothing = (show bd, "False")
|
||||
g bd _ = (show bd, "True")
|
||||
|
||||
logOptions :: [MenuOption]
|
||||
logOptions =
|
||||
[ Toggle (uvIOEffects %~ \f u -> generateGraphs >> f u)
|
||||
(const $ MODString "Create item combination graph")
|
||||
]
|
||||
|
||||
generateGraphs :: IO ()
|
||||
generateGraphs = do
|
||||
createDirectoryIfMissing True "generated/graph"
|
||||
TIO.writeFile "generated/graph/itemCombinations.gv" combinationsDotGraph
|
||||
|
||||
|
||||
gameplayMenu :: Universe -> ScreenLayer
|
||||
gameplayMenu = titleOptionsMenu "OPTIONS:GAMEPLAY" gameplayMenuOptions
|
||||
|
||||
|
||||
Reference in New Issue
Block a user