Improvements to rooms and view distances

This commit is contained in:
2022-03-07 09:16:16 +00:00
parent 1364e7c8c8
commit 81830d87a3
12 changed files with 140 additions and 100 deletions
+8 -9
View File
@@ -25,6 +25,7 @@ import Dodge.Item.Random
--import Geometry.Data
import Geometry
import Padding
import LensHelp
--import Color
--import Shape
@@ -32,7 +33,6 @@ import qualified Data.Set as S
--import Data.Maybe
import Data.Tree
import Control.Monad.State
import Control.Lens
import System.Random
rezBox :: LightSource -> Room
@@ -90,24 +90,23 @@ rezBoxesWpCrit = do
adddoor rm = treeFromPost [PassDown $ door & rmConnectsTo .~ S.singleton (OnEdge North)] (PassDown rm)
crAdd :: Room -> Room
crAdd = rmPmnts %~ (sPS (V2 20 10) (0.5*pi) randC1 :)
crAdd = rmPmnts .:~ sPS (V2 20 10) (0.5*pi) randC1
rezBoxes :: RandomGen g => State g (SubCompTree Room)
rezBoxes = do
w <- state $ randomR (100,400)
h <- state $ randomR (40,40)
thecol <- rezColor
let bottomEdgeTest (V2 _ y,_) = y < 1
dbox = treeFromPost [PassDown door] (PassDown $ rezInvBox thecol)
centralRoom <- shuffleLinks $ setInLinksPD bottomEdgeTest
((roomRectAutoLinks w h) {_rmPmnts = []})
let n = length $ filter bottomEdgeTest $ map lnkPosDir $_rmLinks centralRoom
-- let centralRoom' = restrictOutLinks bottomEdgeTest centralRoom
let bottomEdgeTest = S.member (OnEdge South) . _rlType
dbox = treeFromPost [PassDown $ door & rmConnectsTo .~ S.singleton (OnEdge South)]
(PassDown $ rezInvBox thecol)
centralRoom <- shuffleLinks $ (roomRectAutoLinks w h) {_rmPmnts = []}
& rmLinks %~ setInLinks bottomEdgeTest
let n = length $ filter bottomEdgeTest $_rmLinks centralRoom
return $ treeFromTrunk [PassDown $ rezBox thecol
, PassDown door
]
(Node (PassDown centralRoom) (replicate (n-1) dbox ++ [Node (UseAll door) []]))
rezColor :: RandomGen g => State g LightSource
rezColor = do