Start to make wall flags/pathing interaction more sensible

This commit is contained in:
2025-10-23 11:35:24 +01:00
parent 9e6534b8f4
commit fc7c4d6468
18 changed files with 167 additions and 145 deletions
+9 -6
View File
@@ -5,6 +5,7 @@ module Dodge.Placement.Instance.Door (
switchDoor, -- not used 9/3/22
) where
import qualified Data.Set as S
import Color
import Control.Lens
import Dodge.Data.CreatureEffect
@@ -14,12 +15,13 @@ import Dodge.LevelGen.PlacementHelper
import Dodge.LevelGen.Switch
import Geometry
putDoubleDoor :: EdgeObstacle -> Wall -> WdBl -> Point2 -> Point2 -> Float -> Placement
putDoubleDoor :: S.Set EdgeObstacle
-> Wall -> WdBl -> Point2 -> Point2 -> Float -> Placement
putDoubleDoor eo wl cond a b speed =
putDoubleDoorThen eo wl cond 1 a b speed (const $ const Nothing)
putDoubleDoorThen ::
EdgeObstacle ->
S.Set EdgeObstacle ->
Wall ->
WdBl ->
Float ->
@@ -37,7 +39,7 @@ putDoubleDoorThen eo wl cond soff a b speed cont =
half = 0.5 *.* (a +.+ b)
doorBetween ::
EdgeObstacle ->
S.Set EdgeObstacle ->
Wall ->
WdBl ->
Float ->
@@ -70,7 +72,7 @@ divideDoorPane mid wl cond soff speed ppairs g = case ppairs of
(p : ps) -> ptCont (adoor p) $ \pl -> Just $ divideDoorPane (_plMID pl) wl cond soff speed ps g
_ -> undefined
where
adoor (x, y) = PutSlideDr thedoor wl DoorObstacle soff x y
adoor (x, y) = PutSlideDr thedoor wl mempty soff x y
thedoor =
defaultDoor & drSpeed .~ speed & drTrigger .~ cond
& drPushedBy .~ maybe PushesItself PushedBy mid
@@ -81,7 +83,7 @@ putAutoDoor a b = Placement (PS 0 0) (PutCoord a) Nothing Nothing $ \_ apl ->
let x = w ^?! gwWorld . coordinates . ix (apl ^?! plMID . _Just)
y = w ^?! gwWorld . coordinates . ix (bpl ^?! plMID . _Just)
in Just $ putDoubleDoor
AutoDoorObstacle
(S.fromList [WallObstacle WallBlockVisibility])
defaultAutoWall
(WdBlCrFilterNearPoint 40 (0.5 *.* (x + y)) CrIsAnimate)
a
@@ -109,7 +111,8 @@ switchDoor btpos btrot dra drb col = pContID
jsps0J (doorbetween btid dra drc) $
sps0 (doorbetween btid drb drc)
where
doorbetween btid a b = PutSlideDr thedoor (switchWallCol col) DoorObstacle 1 a b
doorbetween btid a b = PutSlideDr thedoor (switchWallCol col)
(S.fromList (WallObstacle <$> [WallNotAutoOpen,WallBlockVisibility])) 1 a b
where
thedoor =
defaultDoor