Add laser central room, using new placement/roompos functionality
This commit is contained in:
@@ -27,6 +27,7 @@ import System.Random
|
||||
import Data.Maybe
|
||||
import Data.Tree
|
||||
import Data.Bifunctor
|
||||
import Data.List
|
||||
|
||||
roomC :: RandomGen g => Float -> Float -> State g Room
|
||||
roomC w h = do
|
||||
@@ -104,7 +105,7 @@ glassSwitchBack = do
|
||||
hgt <- state $ randomR (400,600)
|
||||
wllen <- state $ randomR (60,wth/2-40)
|
||||
let hf = hgt/5
|
||||
con1 cond (UnusedLink (V2 x y) a) | cond y = Just $ PS (V2 x y) a
|
||||
con1 cond (UnusedLink (V2 x y) a) | cond y = Just (PS (V2 x y) a , PosPl (V2 x y) a)
|
||||
con1 _ _ = Nothing
|
||||
plmnts =
|
||||
[ mntLightLnkCond $ con1 (< 0.5 * hgt)
|
||||
@@ -226,8 +227,8 @@ roomOctogon = defaultRoom
|
||||
,( (0,40),pi)
|
||||
]
|
||||
|
||||
roomNgon :: Int -> Room
|
||||
roomNgon n = defaultRoom
|
||||
roomNgon :: Int -> Float -> Room
|
||||
roomNgon n x = defaultRoom
|
||||
{ _rmPolys = [poly]
|
||||
, _rmLinks = lnks
|
||||
, _rmPath = [] -- TODO
|
||||
@@ -241,9 +242,9 @@ roomNgon n = defaultRoom
|
||||
poly = mapMaybe
|
||||
(\(ra,rb) -> intersectLineLine' (rotateV ra bl) (rotateV ra br) (rotateV rb bl) (rotateV rb br))
|
||||
$ loopPairs rots
|
||||
bl = V2 100 100
|
||||
br = V2 (-100) 100
|
||||
lnks = map (\r -> (rotateV r (V2 0 100),r)) rots
|
||||
bl = V2 x x
|
||||
br = V2 (-x) x
|
||||
lnks = sortOn ((\(V2 a b) -> (negate b,a)) . fst) $ map (\r -> (rotateV r (V2 0 x),r)) rots
|
||||
|
||||
allPairs :: Eq a => [a] -> [(a,a)]
|
||||
allPairs xs = [(x,y) | x <- xs, y <- xs, x /= y]
|
||||
|
||||
Reference in New Issue
Block a user