Prop reification/splitting

This commit is contained in:
2022-07-24 13:45:05 +01:00
parent 5a2f529182
commit ac069d08f6
31 changed files with 585 additions and 458 deletions
+5 -12
View File
@@ -6,7 +6,6 @@ import Dodge.Data
import Dodge.Default.Door
import Dodge.Cleat
import Dodge.RoomLink
import Dodge.Base
import Dodge.Tree
import Dodge.Default.Room
import Dodge.LevelGen.Data
@@ -49,7 +48,7 @@ twinSlowDoorRoom w h x = defaultRoom
$ \btid -> jsps0J (PutSlideDr (thedoor btid) thewall DoorObstacle 1 (V2 x 1) (V2 x h))
$ ps0 (PutSlideDr (thedoor btid) thewall DoorObstacle 1 (V2 (-x) 1) (V2 (-x) h))
$ \did -> jps0' (PutLS (lsColPos (V3 0.75 0 0) (V3 0 (h-1) lampheight)))
$ \lspl -> jsps0 $ PutProp $ addColorChange (fromJust $ _plMID lspl) did $ lampCoverWhen (drmoving did) (V2 0 (h-1)) lampheight
$ \lspl -> jsps0 $ PutProp $ addColorChange (fromJust $ _plMID lspl) did $ lampCoverWhen (WdBlDoorMoving did) (V2 0 (h-1)) lampheight
]
, _rmBound = ps
, _rmName = "twinSlowDoorRoom"
@@ -58,13 +57,9 @@ twinSlowDoorRoom w h x = defaultRoom
where
thewall = switchWallCol red
wlSpeed = 0.5
addColorChange lsid drid = over pjUpdate $ dbArgChain $ const f
where
f u | _drStatus (_doors u IM.! drid) == DoorHalfway
= u & updatelscol (V3 8 0 0)
| otherwise = u & updatelscol 0.7
updatelscol c = lightSources . ix lsid . lsParam . lsCol .~ c
drmoving i w' = DoorHalfway == _drStatus (_doors w' IM.! i)
addColorChange lsid drid = over prUpdate $ PropUpdateAnd $ PropUpdateIf (WdBlDoorMoving drid)
(PropUpdateLS lsid (PrWdLsSetColor (V3 8 0 0)))
(PropUpdateLS lsid (PrWdLsSetColor 0.7))
lampheight = 41
ps =
[rectNSWE h 0 (-w) w
@@ -107,7 +102,7 @@ addButtonSlowDoor x h rm = do
openDoorBound = reverse $ rectNSWE (h + 5) (h - 5) (3*x/2) (-x/2)
belowH y = (sndV2 . fst) y < h - 40
aboveH y = (sndV2 . fst) y > h + 40
amountedlight dr xoff mpl = Just . moveLSThen (getdoorpos (fromJust $ _plMID dr))
amountedlight dr xoff mpl = Just . moveLSThen (WdP2fDoorPosition (fromJust $ _plMID dr))
(V3 15 xoff 89) (aShape (V2 15 0) (V3 15 xoff 90))
$ \plls plpr -> Just $ ptCont (PutWorldUpdate (const $ setmount dr plls plpr))
$ const mpl
@@ -126,8 +121,6 @@ addButtonSlowDoor x h rm = do
$ amountedlight dr2 50
$ amountedlight dr2 (-50)
Nothing
getdoorpos drid w = let Just (a,b) = w ^? doors . ix drid . drPos
in (b, argV (a-.-b))
col = dim $ light red
cond' btid w = w ^? buttons . ix btid . btState /= Just BtOff