Slightly broken placements

This commit is contained in:
2021-11-14 19:56:22 +00:00
parent affdde0f21
commit 2a28967cd3
9 changed files with 166 additions and 114 deletions
+13 -10
View File
@@ -104,10 +104,11 @@ glassSwitchBack = do
hgt <- state $ randomR (400,600)
wllen <- state $ randomR (60,wth/2-40)
let hf = hgt/5
con1 (V2 _ y,_) = y < 0.5*hgt
con1 cond (UnusedLink (V2 x y) a) | cond y = Just $ PS (V2 x y) a
con1 _ _ = Nothing
plmnts =
[ mntLightLnkCond con1
, mntLightLnkCond (not . con1)
[ mntLightLnkCond $ con1 (< 0.5 * hgt)
, mntLightLnkCond $ con1 (> 0.5 * hgt)
,windowLine (V2 (wth-60 ) hf ) (V2 wllen hf )
,windowLine (V2 (wth-wllen) (2*hf)) (V2 60 (2*hf))
,windowLine (V2 (wth-60 ) (3*hf)) (V2 wllen (3*hf))
@@ -199,8 +200,8 @@ roomCenterPillar = changeLinkTo ((\p -> dist p (V2 120 0) < 10) . fst)
, blockLine (V2 125 115) (V2 125 125)
--, sPS (V2 40 120) 0 putLamp
--, sPS (V2 200 120) 0 putLamp
, mntLightLnkCond (const True)
, mntLightLnkCond (const True)
, mntLightLnkCond unusedLnkToPS
, mntLightLnkCond unusedLnkToPS
]
roomOctogon :: Room
@@ -249,7 +250,7 @@ weaponEmptyRoom = do
,sPS (V2 20 20) (pi/2) randC1
,sPS (V2 (w-20) 20) (pi/2) randC1
--,sPS (V2 (w/2) (h/2)) 0 putLamp
,mntLightLnkCond (const True)
,mntLightLnkCond unusedLnkToPS
]
(fmap connectRoom . randomiseOutLinks) =<<
changeLinkTo ((\p -> dist p (V2 (w/2) 0) < 10) . fst) (set rmPmnts plmnts $ roomRect w h 2 2)
@@ -441,10 +442,12 @@ pillarGrid = do
y <- takeOne ys
a <- state $ randomR (0,2*pi)
return (V2 (x+gap) y,a)
cornerRestrict (V2 x y,_)
= (x > 40 && x < h - 40)
|| (y > 40 && y < h - 40)
let plmnts = replicate 8 (mntLightLnkCond cornerRestrict)
-- the following was used to stop lights from being mounted in corners and
-- potentially overlapping, might want to redo
-- cornerRestrict (V2 x y,_)
-- = (x > 40 && x < h - 40)
-- || (y > 40 && y < h - 40)
let plmnts = replicate 8 (mntLightLnkCond unusedLnkToPS)
++
concat [f x y | x<-xs,y<-ys]
return $ roomRect w h (max i 2) (max i 2)