Allow for random composition of trees

This commit is contained in:
2022-06-09 11:24:13 +01:00
parent 1f05c74abc
commit 1789a3785d
17 changed files with 103 additions and 88 deletions
+2 -3
View File
@@ -30,7 +30,6 @@ import qualified Data.Set as S
import Control.Monad.State
--import Control.Monad.Loops
import System.Random
import Data.Tree
import Data.Bifunctor
roomC :: RandomGen g => Float -> Float -> State g Room
@@ -278,7 +277,7 @@ weaponBetweenPillars = do
weaponLongCorridor :: RandomGen g => State g (SubCompTree Room)
weaponLongCorridor = do
root <- takeOne [tEast, tWest]
rt <- takeOne [tEast, tWest]
connectingRoom <- takeOne
[tEast & rmPmnts .~ [spanLightI (V2 (-30) 40) (V2 (-30) 80)]
]
@@ -286,7 +285,7 @@ weaponLongCorridor = do
i2 <- state $ randomR (2,5)
let branch1 = treeFromTrunk (replicate i1 $ PassDown corridorN) (singleUseAll $ putCrs connectingRoom)
let branch2 = treeFromTrunk (replicate i2 $ PassDown corridorN) (singleUseNone $ putWp corridor)
return $ Node (PassDown root) [branch1,branch2]
return $ Node (PassDown rt) [branch1,branch2]
where
putCrs = over rmPmnts (++ [sPS (V2 10 40) (-pi/2) randC1 ,sPS (V2 (-10) 40) (-pi/2) randC1 ])
putWp = set rmPmnts [sPS (V2 20 60) 0 $ RandPS randFirstWeapon ,spanLightI (V2 0 40) (V2 40 40)]