Automatically determine automatic doors

This commit is contained in:
2025-10-24 21:08:41 +01:00
parent f94b914ceb
commit 6457f00ba7
8 changed files with 100 additions and 105 deletions
+8 -7
View File
@@ -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 $