Fix room bugs

This commit is contained in:
2022-06-14 12:27:21 +01:00
parent 88e5f40f06
commit 79aab975c8
4 changed files with 14 additions and 48 deletions
+7 -36
View File
@@ -6,6 +6,7 @@ module Dodge.Room.Room
, roomCCrits
, doubleCorridorBarrels
, pistolerRoom
, spawnerRoom
) where
import Dodge.UseAll
import Dodge.Data
@@ -298,44 +299,14 @@ shootersRoom1 = shootersRoom' <&> rmPmnts %~
) :)
shootersRoom :: RandomGen g => State g Room
shootersRoom = shootersRoom' <&> rmPmnts %~
( map (\i -> spNoID (PSRoomRand i (uncurry PS)) (PutCrit autoCrit))
[0,1,2]
++ )
shootersRoom = shootersRoom' <&> rmPmnts .++~
map (\i -> spNoID (PSRoomRand i (uncurry PS)) (PutCrit autoCrit)) [0,1,2]
pillarGrid :: RandomGen g => State g Room
pillarGrid = do
let f2 x y = singleBlock (V2 x y)
f <- takeOne [f2]
h <- state $ randomR (200,400)
let w = h
i <- takeOne [3,4,5]
let j = fromIntegral i
-- the 20+etc here is to correct for the pathfinding grid, which matches up to
-- edges based on the size of doors (i.e. the line next to the wall is 20
-- away from it)
xs = take i [20+0.5*(w-40)/j,20+1.5*(w-40)/j..]
ys = take i [20+0.5*(h-40)/j,20+1.5*(h-40)/j..]
gap = 0.5 * h / (j+1)
rps = do
x <- takeOne xs
y <- takeOne ys
a <- state $ randomR (0,2*pi)
return (V2 (x+gap) y,a)
-- 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 useUnusedLnk) ++ concat [f x y | x<-xs,y<-ys]
return $ roomRect w h (max i 2) (max i 2)
& rmPmnts .~ plmnts
& rmRandPSs .~ [rps]
-- TODO remove possible identical draws on random PSs
-- TODO stop from spawning on inlinks fromedge
pistolerRoom :: RandomGen g => State g Room
pistolerRoom = pillarGrid <&> rmPmnts .++~
replicate 3
pistolerRoom = do
(w,wn) <- takeOne [(200,3),(255,4)]
roomPillars 10 w 200 wn 3 <&> rmPmnts .++~ replicate 3
(spNoID (rprBool $ \rp _ -> _rpPlacementUse rp == 0 && RoomPosOnPath `S.member` _rpType rp)
(PutCrit pistolCrit))