Rethink damage data type, work on damage sensors
This commit is contained in:
@@ -28,12 +28,12 @@ door = defaultRoom
|
||||
,uncurry inLink (V2 20 5,pi)
|
||||
]
|
||||
|
||||
switchDoorRoom :: Int -> Room
|
||||
switchDoorRoom inplid = defaultRoom
|
||||
{ _rmPolys = [rectNSWE 40 0 0 40]
|
||||
, _rmLinks = init lnks++ [last lnks]
|
||||
, _rmPath = [(V2 20 35,V2 20 5)]
|
||||
, _rmInPmnt = [InPlacement f inplid]
|
||||
triggerDoorRoom :: Int -> Room
|
||||
triggerDoorRoom inplid = defaultRoom
|
||||
{ _rmPolys = [rectNSWE 40 0 0 40]
|
||||
, _rmLinks = init lnks++ [last lnks]
|
||||
, _rmPath = [(V2 20 35,V2 20 5)]
|
||||
, _rmInPmnt = [InPlacement f inplid]
|
||||
-- door extends into side walls (for shadows as rendered 12/03/21)
|
||||
-- note no bounds
|
||||
}
|
||||
|
||||
@@ -33,8 +33,8 @@ import System.Random
|
||||
cenLasTur :: Room
|
||||
cenLasTur = roomNgon 8 200 & rmPmnts .~
|
||||
[ putLasTurret 0.02
|
||||
, heightWallPS (roomPosRoomBoolShift (\rp _ -> isInLnk rp) (shiftInBy 100)) 30 covershape
|
||||
, mntLightLnkCond unusedLnkToPS
|
||||
, heightWallPS (resetPLUse $ rprBoolShift (const . isInLnk) (shiftInBy 100)) 30 covershape
|
||||
, mntLightLnkCond $ rpBool isInLnk
|
||||
]
|
||||
where
|
||||
covershape = rectNSEW 10 (-10) 20 (-20)
|
||||
@@ -53,7 +53,7 @@ lasSensLightAboveDoor wth ps = extTrigLitPos
|
||||
(atFstLnkOutShiftBy (\(p,a) -> (p +.+ rotateV a (V2 18.5 (-2.5)), a)))
|
||||
( \tp -> Just $ lightSensor wth (upf $ fromJust $ _plMID tp) ps )
|
||||
where
|
||||
upf trid mc w | _mcSensor mc > 900 = w & triggers . ix trid .~ const True
|
||||
upf trid mc w | _mcSensorAmount mc > 900 = w & triggers . ix trid .~ const True
|
||||
| otherwise = w
|
||||
|
||||
lightSensByDoor :: Int -> Room -> Room
|
||||
@@ -72,13 +72,13 @@ lightSensByDoor outplid rm = rm
|
||||
lasSensorTurretTest :: RandomGen g => Int -> State g (SubCompTree Room)
|
||||
lasSensorTurretTest n = do
|
||||
cenroom <- shuffleLinks $ lightSensInsideDoor n cenLasTur
|
||||
let doorroom = switchDoorRoom n
|
||||
let doorroom = triggerDoorRoom n
|
||||
return $ treeFromPost [PassDown door,PassDown cenroom,PassDown doorroom] (UseAll door)
|
||||
|
||||
lasCenSensEdge :: RandomGen g => Int -> State g (SubCompTree Room)
|
||||
lasCenSensEdge n = do
|
||||
cenroom <- shuffleLinks $ lightSensByDoor n cenLasTur
|
||||
let doorroom = switchDoorRoom n
|
||||
let doorroom = triggerDoorRoom n
|
||||
return $ treeFromTrunk [PassDown door] $ Node (PassDown cenroom)
|
||||
[ treeFromPost [PassDown doorroom] (UseAll door)
|
||||
, treeFromPost [PassDown door] (UseLabel 0 corridor)
|
||||
|
||||
@@ -101,7 +101,7 @@ roomRectAutoLinks :: Float -> Float -> Room
|
||||
roomRectAutoLinks x y = (roomRect x y (f x) (f y)) {_rmPmnts = plmnts}
|
||||
where
|
||||
f z = max 1 $ (ceiling z - 40) `div` 60
|
||||
plmnts = replicate 3 . mntLightLnkCond $ useRoomPosCond isUsedLnkUnplaced
|
||||
plmnts = [mntLightLnkCond $ resetPLUse $ rpBool isInLnk]
|
||||
{- Combines two rooms into one room.
|
||||
- will have to work out exactly what to do with combining links
|
||||
Mostly involves concatenation. -}
|
||||
|
||||
@@ -156,8 +156,8 @@ roomCenterPillar = randomiseAllLinks . restrictInLinks ((\p -> dist p (V2 120 0)
|
||||
, blockLine (V2 125 115) (V2 125 125)
|
||||
--, sPS (V2 40 120) 0 putLamp
|
||||
--, sPS (V2 200 120) 0 putLamp
|
||||
, mntLightLnkCond unusedLnkToPS
|
||||
, mntLightLnkCond unusedLnkToPS
|
||||
, mntLightLnkCond useUnusedLnk
|
||||
, mntLightLnkCond useUnusedLnk
|
||||
]
|
||||
|
||||
roomOctogon :: Room
|
||||
@@ -187,7 +187,7 @@ roomNgon n x = defaultRoom
|
||||
{ _rmPolys = [poly]
|
||||
, _rmLinks = muout (init lnks) ++ muin[last lnks]
|
||||
, _rmPath = [] -- TODO
|
||||
, _rmPmnts = []
|
||||
, _rmPmnts = [mntLightLnkCond $ resetPLUse $ rpBool isInLnk]
|
||||
, _rmBound = [poly]
|
||||
, _rmFloor = Tiled [makeTileFromPoly poly 9]
|
||||
, _rmName = show n ++ "gon"
|
||||
@@ -225,7 +225,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 unusedLnkToPS
|
||||
,mntLightLnkCond useUnusedLnk
|
||||
]
|
||||
f (V2 x y,a) = (a == pi && x > 25 && x < w - 25) || (a /= 0 && y > w - 30)
|
||||
rm <- shuffleLinks $ restrictRMInLinksPD f (roomRect w h 2 2 & rmPmnts .~ plmnts)
|
||||
@@ -396,7 +396,7 @@ pillarGrid = do
|
||||
-- cornerRestrict (V2 x y,_)
|
||||
-- = (x > 40 && x < h - 40)
|
||||
-- || (y > 40 && y < h - 40)
|
||||
let plmnts = replicate 8 (mntLightLnkCond unusedLnkToPS)
|
||||
let plmnts = replicate 8 (mntLightLnkCond useUnusedLnk)
|
||||
++
|
||||
concat [f x y | x<-xs,y<-ys]
|
||||
return $ roomRect w h (max i 2) (max i 2)
|
||||
|
||||
@@ -60,7 +60,7 @@ runPastRoom i = do
|
||||
{_rmOutPmnt = [OutPlacement (putLitButOnPosExtTrig red useUnusedLnk) i]
|
||||
,_rmPmnts = []
|
||||
}
|
||||
switchdoor = switchDoorRoom i
|
||||
switchdoor = triggerDoorRoom i
|
||||
n = length $ filter theedgetest $ map lnkPosDir $ _rmLinks cenroom
|
||||
controom = treeFromPost [PassDown switchdoor,PassDown linkcor] (UseAll door)
|
||||
critrooms :: [SubCompTree Room]
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
module Dodge.Room.SensorDoor where
|
||||
import Dodge.LevelGen.Data
|
||||
import Dodge.PlacementSpot
|
||||
import Dodge.Data
|
||||
import Dodge.Tree
|
||||
--import Dodge.RoomLink
|
||||
import Dodge.Room.Door
|
||||
import Dodge.Room.Procedural
|
||||
import Dodge.Room.Room
|
||||
--import Dodge.Room.Corridor
|
||||
import Dodge.Room.Link
|
||||
--import Dodge.Room.Procedural
|
||||
import Dodge.Room.Foreground
|
||||
--import Dodge.Room.RoadBlock
|
||||
import Dodge.Placement.Instance
|
||||
--import Dodge.Default.Room
|
||||
--import Dodge.Item.Weapon.BulletGuns
|
||||
--import Dodge.Item.Weapon.Utility
|
||||
--import Dodge.LevelGen.Data
|
||||
--import Geometry.Data
|
||||
import Geometry
|
||||
--import Padding
|
||||
import Color
|
||||
import Shape
|
||||
import LensHelp
|
||||
import Dodge.RandomHelp
|
||||
|
||||
--import qualified Data.Set as S
|
||||
import Data.Maybe
|
||||
--import Data.Tree
|
||||
import Control.Monad.State
|
||||
import System.Random
|
||||
|
||||
sensorRoom :: RandomGen g => DamageType -> Int -> State g (SubCompTree Room)
|
||||
sensorRoom senseType n = do
|
||||
rm <- takeOne [roomNgon 8 200, roomRectAutoLinks 200 200]
|
||||
cenroom <- shuffleLinks $ sensInsideDoor senseType n rm
|
||||
let doorroom = triggerDoorRoom n
|
||||
return $ treeFromPost [PassDown door,PassDown cenroom,PassDown doorroom] (UseAll door)
|
||||
|
||||
|
||||
sensAboveDoor :: DamageType -> Float -> PlacementSpot -> Placement
|
||||
sensAboveDoor sensetype wth ps = extTrigLitPos
|
||||
(atFstLnkOutShiftBy (\(p,a) -> (p +.+ rotateV a (V2 18.5 (-2.5)), a)))
|
||||
( \tp -> Just $ damageSensor sensetype wth (upf $ fromJust $ _plMID tp) ps )
|
||||
where
|
||||
upf trid mc w | _mcSensorAmount mc > 900 = w & triggers . ix trid .~ const True
|
||||
| otherwise = w
|
||||
|
||||
sensInsideDoor :: DamageType -> Int -> Room -> Room
|
||||
sensInsideDoor senseType outplid rm = rm
|
||||
& rmPmnts .:~ psPt atFstLnkOut
|
||||
(PutShape $ colorSH yellow $
|
||||
thinHighBar 0 (V2 20 (-1)) (V2 20 (-100))
|
||||
<> thinHighBar 0 (V2 0 (-100)) (V2 20 (-100))
|
||||
<> barPP 1.5 (V3 20 (-1) 0) (V3 20 (-1) 80))
|
||||
& rmOutPmnt .~ [OutPlacement (sensAboveDoor senseType 10 (atFstLnkOutShiftInward 100)) outplid]
|
||||
Reference in New Issue
Block a user