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
+3 -3
View File
@@ -114,10 +114,10 @@ addButtonSlowDoor x h rm = do
openDoorBound = rectNSEW (h + 5) (h - 5) (-x/2) (3*x/2)
belowH y = (sndV2 . fst) y < h - 40
aboveH y = (sndV2 . fst) y > h + 40
butDoor _ _ = putLitButtonID' col butPosCond
--butDoor bpos brot = putLitButtonID col bpos brot
butDoor _ _ = putLitButOnPos col butPosCond
$ \btid -> Just $ putDoubleDoor False col (cond' btid) (V2 0 h) (V2 x h) 2
butPosCond (V2 _ y,_) = y < h
butPosCond (UnusedLink (V2 x' y') a') | y' < 0.5 * h = Just $ PS (V2 x' y') a'
butPosCond _ = Nothing
--butPosCond _ = True -- y < h
col = dim $ light red
cond' btid w = w ^? buttons . ix btid . btState /= Just BtOff
+1 -1
View File
@@ -71,7 +71,7 @@ roomRectAutoLinks x y = (roomRect x y ((ceiling x - 40) `div` 60) ((ceiling y -
{_rmPmnts = plmnts}
where
plmnts =
[mntLightLnkCond (const True)
[mntLightLnkCond unusedLnkToPS
-- ,sps0 $ PutForeground $ thinHighBarChain 50 $ rectNSWE y 0 0 x
]
{- Combines two rooms into one room.
+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)
+2 -2
View File
@@ -40,6 +40,6 @@ startRoom = do
<$> randomiseOutLinks
(shiftRoomBy (V2 (-20) (-20),0)
$ roomRectAutoLinks w h & rmPmnts %~ (plmnts ++)
& rmStartWires .~ IM.fromList [(0,RoomWire (V2 0 0) 0)]
& rmEndWires .~ IM.fromList [(0,RoomWire (V2 (500) 500) 0)]
& rmStartWires .~ IM.fromList [(0,RoomWire (V2 0 0) 0)]
& rmEndWires .~ IM.fromList [(0,RoomWire (V2 500 500) 0)]
)