Unify PutDoor PSType
This commit is contained in:
@@ -52,9 +52,9 @@ data PSType
|
||||
, _putEndPoint :: Point2
|
||||
}
|
||||
| PutWall {_pwPoly :: [Point2], _pwWall :: Wall}
|
||||
| PutSlideDr Door Wall Float Point2 Point2
|
||||
-- | PutSlideDr Door Wall Float Point2 Point2
|
||||
| PutDoor' Door Wall
|
||||
| PutDoor WdBl Float Point2A Point2A
|
||||
-- | PutDoor WdBl Float Point2A Point2A
|
||||
| RandPS (State StdGen PSType)
|
||||
| PutForeground ForegroundShape
|
||||
| PutWorldUpdate (Int -> PlacementSpot -> GenWorld -> GenWorld)
|
||||
@@ -79,8 +79,8 @@ instance ShortShow PSType where
|
||||
shortShow PutTrigger {} = "PutTrigger"
|
||||
shortShow PutLineBlock {} = "PutLineBlock"
|
||||
shortShow PutWall {} = "PutWall"
|
||||
shortShow PutSlideDr {} = "PutSlideDr"
|
||||
shortShow PutDoor {} = "PutDoor"
|
||||
-- shortShow PutSlideDr {} = "PutSlideDr"
|
||||
-- shortShow PutDoor {} = "PutDoor"
|
||||
shortShow PutDoor' {} = "PutDoor'"
|
||||
shortShow RandPS {} = "RandPS"
|
||||
shortShow PutForeground {} = "PutForeground"
|
||||
|
||||
@@ -4,7 +4,7 @@ module Dodge.Placement.Instance.Door (
|
||||
putDoubleDoorThen,
|
||||
) where
|
||||
|
||||
import Linear
|
||||
import Dodge.Door.PutSlideDoor
|
||||
import Control.Lens
|
||||
import Dodge.Data.CreatureEffect
|
||||
import Dodge.Data.GenWorld
|
||||
@@ -12,6 +12,7 @@ import Dodge.Default.Door
|
||||
import Dodge.Default.Wall
|
||||
import Dodge.LevelGen.PlacementHelper
|
||||
import Geometry
|
||||
import Linear
|
||||
|
||||
putDoubleDoor ::
|
||||
Bool ->
|
||||
@@ -53,15 +54,16 @@ doorBetween ::
|
||||
(Placement -> Maybe Placement) ->
|
||||
Placement
|
||||
doorBetween isauto wl cond soff pa pb speed g = case divideLine 40 pa pb of
|
||||
[x, y] -> ptCont (PutSlideDr adoor wl soff x y) g
|
||||
[x, y] -> ptCont (putSlideDr adoor wl soff x y) g
|
||||
(x : y : zs) -> divideDoorPane isauto Nothing wl cond (soff - dist y pb) speed (zip (x : y : zs) (y : zs)) g
|
||||
_ -> undefined
|
||||
_ -> error "tried to create doorBetween with too few points"
|
||||
where
|
||||
adoor =
|
||||
defaultDoor
|
||||
& drTrigger .~ cond
|
||||
& drUpdate . drLerpSpeed .~ speed
|
||||
|
||||
|
||||
divideDoorPane ::
|
||||
Bool ->
|
||||
Maybe Int ->
|
||||
@@ -77,7 +79,7 @@ divideDoorPane isauto mid wl cond soff speed ppairs g = case ppairs of
|
||||
(p : ps) -> ptCont (adoor p) $ \pl -> Just $ divideDoorPane isauto (_plMID pl) wl cond soff speed ps g
|
||||
_ -> undefined
|
||||
where
|
||||
adoor (x, y) = PutSlideDr thedoor wl soff x y
|
||||
adoor (x, y) = putSlideDr thedoor wl soff x y
|
||||
thedoor =
|
||||
defaultDoor & drUpdate . drLerpSpeed .~ speed & drTrigger .~ cond
|
||||
& drPushedBy .~ maybe PushesItself PushedBy mid
|
||||
|
||||
@@ -134,9 +134,9 @@ placeSpotID rid ps pt w = case pt of
|
||||
PutMachine pps mc mitm -> plMachine (map doShift pps) mc mitm p rot w
|
||||
PutLS ls -> plNewUpID (gwWorld . cWorld . lWorld . lightSources) lsID (mvLS p' rot ls) w
|
||||
RandPS _ -> error "RandPS should not be reachable here" --evaluateRandPS rid rgn ps w
|
||||
PutDoor f l p1 p2 -> plDoor f l (pashift p1) (pashift p2) w
|
||||
-- PutDoor f l p1 p2 -> plDoor f l (pashift p1) (pashift p2) w
|
||||
PutDoor' dr wl -> plDoor' (dr & drZeroPos %~ pashift & drOnePos %~ pashift) wl w
|
||||
PutSlideDr wl dr off a b -> plSlideDoor wl dr off (doShift a) (doShift b) w
|
||||
-- PutSlideDr wl dr off a b -> plSlideDoor wl dr off (doShift a) (doShift b) w
|
||||
PutCoord cp -> plNewID (gwWorld . coordinates) (doShift cp) w
|
||||
PutBlock bl wl ps' ->
|
||||
plBlock
|
||||
|
||||
@@ -229,7 +229,7 @@ airlock90 =
|
||||
[ pContID
|
||||
(PS (V2 120 120) (3 * pi / 4))
|
||||
(PutButton $ makeSwitch col red NoWorldEffect NoWorldEffect)
|
||||
$ \btid -> jsps (V2 5 5) 0 $ PutDoor (WdBlBtOn btid) l1 x1 y1
|
||||
$ \btid -> jsps (V2 5 5) 0 $ putDoor (WdBlBtOn btid) l1 x1 y1
|
||||
, mntLS vShape (V2 35 35) (V3 70 70 50)
|
||||
]
|
||||
, _rmBound =
|
||||
@@ -263,7 +263,7 @@ airlockCrystal =
|
||||
[ pContID
|
||||
(PS (V2 145 70) (pi / 2))
|
||||
(PutButton $ makeSwitch col red NoWorldEffect NoWorldEffect)
|
||||
$ \btid -> jsps (V2 40 70) 0 $ PutDoor (WdBlBtOn btid) l1 x1 y1
|
||||
$ \btid -> jsps (V2 40 70) 0 $ putDoor (WdBlBtOn btid) l1 x1 y1
|
||||
, crystalLine (V2 0 70) (V2 40 70)
|
||||
, mntLS vShape (V2 150 70) (V3 110 70 70)
|
||||
]
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
-- | Rooms containing long doors, probably with a big reveal behind them.
|
||||
module Dodge.Room.LongDoor where
|
||||
|
||||
import Dodge.Door.PutSlideDoor
|
||||
import Dodge.Default.Wall
|
||||
import Control.Monad
|
||||
import Dodge.LevelGen.Switch
|
||||
@@ -48,8 +49,8 @@ twinSlowDoorRoom w h x =
|
||||
, _rmPath = mempty
|
||||
, _rmPmnts =
|
||||
[ pContID (PS (V2 0 (h -5)) pi) (PutButton $ makeButton col NoWorldEffect) $
|
||||
\btid -> jsps0J (PutSlideDr (thedoor btid) thewall 1 (V2 x 1) (V2 x h)) $
|
||||
ps0 (PutSlideDr (thedoor btid) thewall 1 (V2 (- x) 1) (V2 (- x) h)) $
|
||||
\btid -> jsps0J (putSlideDr (thedoor btid) thewall 1 (V2 x 1) (V2 x h)) $
|
||||
ps0 (putSlideDr (thedoor btid) thewall 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 (WdBlDoorMoving did) (V2 0 (h -1)) lampheight
|
||||
]
|
||||
|
||||
@@ -10,6 +10,7 @@ module Dodge.Room.Procedural (
|
||||
makeGrid,
|
||||
) where
|
||||
|
||||
import Dodge.Door.PutSlideDoor
|
||||
import Dodge.Default.Wall
|
||||
import Control.Monad
|
||||
import Tile
|
||||
@@ -328,8 +329,8 @@ centerVaultRoom w h d =
|
||||
theDoor =
|
||||
[ pContID (PS (V2 35 (d + 4)) 0) (PutButton $ makeSwitch col red NoWorldEffect NoWorldEffect) $
|
||||
\btid ->
|
||||
jspsJ (V2 0 (d -10)) 0 (PutSlideDr (thedoor btid) thewall 1 (V2 (-21) 0) (V2 0 0)) $
|
||||
sPS (V2 0 (d -10)) 0 (PutSlideDr (thedoor btid) thewall 1 (V2 21 0) (V2 0 0))
|
||||
jspsJ (V2 0 (d -10)) 0 (putSlideDr (thedoor btid) thewall 1 (V2 (-21) 0) (V2 0 0)) $
|
||||
sPS (V2 0 (d -10)) 0 (putSlideDr (thedoor btid) thewall 1 (V2 21 0) (V2 0 0))
|
||||
]
|
||||
--thewall = switchWallCol col
|
||||
thewall = defaultDoorWall
|
||||
|
||||
Reference in New Issue
Block a user