Automatically determine automatic doors
This commit is contained in:
@@ -3,12 +3,10 @@ module Dodge.Placement.PlaceSpot.TriggerDoor (
|
||||
plSlideDoor,
|
||||
) where
|
||||
|
||||
--import Data.List
|
||||
import Dodge.Data.GenWorld
|
||||
import Dodge.Default.Door
|
||||
import Dodge.Default.Wall
|
||||
import Dodge.LevelGen.DoorPane
|
||||
--import Dodge.Path
|
||||
import Dodge.Placement.PlaceSpot.Block
|
||||
import Dodge.ShiftPoint
|
||||
import Geometry
|
||||
@@ -17,8 +15,6 @@ import LensHelp
|
||||
import Linear
|
||||
|
||||
plDoor ::
|
||||
-- | Is door automatic?
|
||||
Bool ->
|
||||
-- | Opening condition
|
||||
WdBl ->
|
||||
-- | Door positions, closed to open.
|
||||
@@ -28,12 +24,15 @@ plDoor ::
|
||||
Point2A ->
|
||||
GenWorld ->
|
||||
(Int, GenWorld)
|
||||
plDoor isauto cond l p1 p2 gw =
|
||||
plDoor cond l p1 p2 gw =
|
||||
( drid
|
||||
, over gwWorld addWalls $ gw & gwWorld . cWorld . lWorld . doors . at drid ?~ addDoor
|
||||
-- carefull with the ordering of addWalls
|
||||
)
|
||||
where
|
||||
isauto = case cond of
|
||||
WdBlCrFilterNearPoint{} -> True
|
||||
_ -> False
|
||||
drid = IM.newKey $ _doors (_lWorld (_cWorld $ _gwWorld gw))
|
||||
addDoor =
|
||||
defaultDoor
|
||||
@@ -83,7 +82,6 @@ plDoor isauto cond l p1 p2 gw =
|
||||
-- w' = uncurry (obstructPathsCrossing eo) wlps w
|
||||
|
||||
plSlideDoor ::
|
||||
Bool ->
|
||||
Door ->
|
||||
Wall ->
|
||||
Float ->
|
||||
@@ -91,10 +89,13 @@ plSlideDoor ::
|
||||
Point2 ->
|
||||
GenWorld ->
|
||||
(Int, GenWorld)
|
||||
plSlideDoor isauto dr wl shiftOffset a b gw =
|
||||
plSlideDoor dr wl shiftOffset a b gw =
|
||||
--(drid, over gwWorld addDoorWalls $ gw & gwWorld . cWorld . lWorld . doors %~ addDoor)
|
||||
(drid, over gwWorld addWalls $ gw & gwWorld . cWorld . lWorld . doors %~ addDoor)
|
||||
where
|
||||
isauto = case dr ^. drTrigger of
|
||||
WdBlCrFilterNearPoint{} -> True
|
||||
_ -> False
|
||||
drid = IM.newKey $ _doors (_lWorld (_cWorld $ _gwWorld gw))
|
||||
addDoor =
|
||||
IM.insert drid $
|
||||
|
||||
Reference in New Issue
Block a user