Single source of truth for wall pathing

This commit is contained in:
2025-10-24 14:25:19 +01:00
parent 0eeae7e6bc
commit 488428b1ef
19 changed files with 156 additions and 121 deletions
+2 -2
View File
@@ -52,9 +52,9 @@ data PSType
, _putEndPoint :: Point2
}
| PutWall {_pwPoly :: [Point2], _pwWall :: Wall}
| PutSlideDr Door Wall (S.Set EdgeObstacle) Float Point2 Point2
| PutSlideDr Bool Door Wall (S.Set EdgeObstacle) Float Point2 Point2
-- | PutDoor Color EdgeObstacle WdBl [(Point2, Point2)]
| PutDoor (S.Set EdgeObstacle) WdBl Float Point2A Point2A -- [(Point2, Point2)]
| PutDoor Bool (S.Set EdgeObstacle) WdBl Float Point2A Point2A -- [(Point2, Point2)]
| RandPS (State StdGen PSType)
| PutForeground ForegroundShape
| PutWorldUpdate (Int -> PlacementSpot -> GenWorld -> GenWorld)
+1 -1
View File
@@ -19,7 +19,7 @@ data Wall = Wall
{ _wlLine :: (Point2, Point2)
, _wlID :: Int
, _wlOpacity :: Opacity
, _wlPathFlag :: S.Set WallFlag
-- , _wlPathFlag :: S.Set WallFlag
, _wlTouchThrough :: Bool
, _wlUnshadowed :: Bool
, _wlRotateTo :: Bool
+1 -1
View File
@@ -9,7 +9,7 @@ import Data.Aeson.TH
data WallStructure
= StandaloneWall
| DoorPart {_wsDoor :: Int}
| DoorPart {_wsDoor :: Int, _wsIsAutoDoor :: Bool}
| MachinePart {_wsMachine :: Int}
| BlockPart {_wsBlock :: Int}
| CreaturePart {_wlStCreature :: Int}
+10 -10
View File
@@ -19,8 +19,8 @@ defaultWall =
Wall
{ _wlLine = (V2 0 0, V2 50 0)
, _wlID = 0
, _wlPathFlag =
S.fromList [minBound .. maxBound]
-- , _wlPathFlag =
-- S.fromList [minBound .. maxBound]
, _wlOpacity = Opaque 11
, _wlUnshadowed = True
, _wlRotateTo = True
@@ -33,7 +33,7 @@ defaultWall =
defaultDoorWall :: Wall
defaultDoorWall =
defaultWall
& wlPathFlag . at WallNotDestrucable .~ Nothing
-- & wlPathFlag . at WallNotDestrucable .~ Nothing
& wlMaterial .~ Metal
& wlOpacity .~ Opaque 0
@@ -41,13 +41,13 @@ defaultAutoWall :: Wall
defaultAutoWall =
defaultDoorWall
& wlOpacity .~ Opaque 9
& wlPathFlag . at WallNotAutoOpen .~ Nothing
-- & wlPathFlag . at WallNotAutoOpen .~ Nothing
{- Indestructible see-through wall. -}
defaultCrystalWall :: Wall
defaultCrystalWall =
defaultWall & wlOpacity .~ SeeThrough & wlMaterial .~ Crystal
& wlPathFlag . at WallBlockVisibility .~ Nothing
-- & wlPathFlag . at WallBlockVisibility .~ Nothing
defaultMachineWall :: Wall
defaultMachineWall =
@@ -58,8 +58,8 @@ defaultMachineWall =
, _wlMaterial = Metal
, _wlTouchThrough = True
}
& wlPathFlag . at WallBlockVisibility .~ Nothing
& wlPathFlag . at WallNotDestrucable .~ Nothing
-- & wlPathFlag . at WallBlockVisibility .~ Nothing
-- & wlPathFlag . at WallNotDestrucable .~ Nothing
defaultDirtWall :: Wall
defaultDirtWall =
@@ -70,7 +70,7 @@ defaultDirtWall =
, _wlRotateTo = False
, _wlMaterial = Dirt
}
& wlPathFlag . at WallNotDestrucable .~ Nothing
-- & wlPathFlag . at WallNotDestrucable .~ Nothing
defaultWindow :: Wall
defaultWindow =
@@ -80,5 +80,5 @@ defaultWindow =
, _wlOpacity = SeeThrough
, _wlMaterial = Glass
}
& wlPathFlag . at WallNotDestrucable .~ Nothing
& wlPathFlag . at WallBlockVisibility .~ Nothing
-- & wlPathFlag . at WallNotDestrucable .~ Nothing
-- & wlPathFlag . at WallBlockVisibility .~ Nothing
+2 -2
View File
@@ -82,6 +82,6 @@ shieldWall crid =
, _wlMaterial = Metal
, _wlRotateTo = False
, _wlStructure = CreaturePart crid -- shieldWallDamage
, _wlPathFlag = mempty
-- , _wlPathFlag = mempty
}
& wlPathFlag .~ mempty
-- & wlPathFlag .~ mempty
+2 -2
View File
@@ -16,8 +16,8 @@ decoratedBlock decf mat col h ps = PutBlock bl wl $ reverse ps
& blHeight .~ h
wl =
defaultWall
& wlPathFlag . at WallNotDestrucable .~ Nothing
& wlPathFlag . at WallBlockVisibility .~ Nothing
-- & wlPathFlag . at WallNotDestrucable .~ Nothing
-- & wlPathFlag . at WallBlockVisibility .~ Nothing
& wlRotateTo .~ False
& wlOpacity .~ SeeAbove
& wlMaterial .~ mat
+48 -29
View File
@@ -5,23 +5,31 @@ module Dodge.Placement.Instance.Door (
switchDoor, -- not used 9/3/22
) where
import Dodge.Default.Wall
import Dodge.Default.Door
import qualified Data.Set as S
import Color
import Control.Lens
import qualified Data.Set as S
import Dodge.Data.CreatureEffect
import Dodge.Data.GenWorld
import Dodge.Default.Door
import Dodge.Default.Wall
import Dodge.LevelGen.PlacementHelper
import Dodge.LevelGen.Switch
import Geometry
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)
putDoubleDoor ::
Bool ->
S.Set EdgeObstacle ->
Wall ->
WdBl ->
Point2 ->
Point2 ->
Float ->
Placement
putDoubleDoor isauto eo wl cond a b speed =
putDoubleDoorThen isauto eo wl cond 1 a b speed (const $ const Nothing)
putDoubleDoorThen ::
Bool ->
S.Set EdgeObstacle ->
Wall ->
WdBl ->
@@ -31,15 +39,16 @@ putDoubleDoorThen ::
Float ->
(Placement -> Placement -> Maybe Placement) ->
Placement
putDoubleDoorThen eo wl cond soff a b speed cont =
doorBetween eo wl cond soff a half speed $
putDoubleDoorThen isauto eo wl cond soff a b speed cont =
doorBetween isauto eo wl cond soff a half speed $
\pl1 -> Just $
doorBetween eo wl cond soff b half speed $
doorBetween isauto eo wl cond soff b half speed $
\pl2 -> cont pl1 pl2
where
half = 0.5 *.* (a +.+ b)
doorBetween ::
Bool ->
S.Set EdgeObstacle ->
Wall ->
WdBl ->
@@ -49,9 +58,9 @@ doorBetween ::
Float ->
(Placement -> Maybe Placement) ->
Placement
doorBetween eo wl cond soff pa pb speed g = case divideLine 40 pa pb of
[x, y] -> ptCont (PutSlideDr adoor wl eo soff x y) g
(x : y : zs) -> divideDoorPane Nothing wl cond (soff - dist y pb) speed (zip (x : y : zs) (y : zs)) g
doorBetween isauto eo wl cond soff pa pb speed g = case divideLine 40 pa pb of
[x, y] -> ptCont (PutSlideDr isauto adoor wl eo 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
where
adoor =
@@ -60,6 +69,7 @@ doorBetween eo wl cond soff pa pb speed g = case divideLine 40 pa pb of
& drUpdate . drLerpSpeed .~ speed
divideDoorPane ::
Bool ->
Maybe Int ->
Wall ->
WdBl ->
@@ -68,28 +78,31 @@ divideDoorPane ::
[(Point2, Point2)] ->
(Placement -> Maybe Placement) ->
Placement
divideDoorPane mid wl cond soff speed ppairs g = case ppairs of
divideDoorPane isauto mid wl cond soff speed ppairs g = case ppairs of
[p] -> ptCont (adoor p) g
(p : ps) -> ptCont (adoor p) $ \pl -> Just $ divideDoorPane (_plMID pl) wl cond soff speed ps g
(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 mempty soff x y
adoor (x, y) = PutSlideDr isauto thedoor wl mempty soff x y
thedoor =
defaultDoor & drUpdate . drLerpSpeed .~ speed & drTrigger .~ cond
& drPushedBy .~ maybe PushesItself PushedBy mid
putAutoDoor :: Point2 -> Point2 -> Placement
putAutoDoor a b = Placement (PS 0 0) (PutCoord a) Nothing Nothing $ \_ apl ->
Just $ Placement (PS 0 0) (PutCoord b) Nothing Nothing $ \w bpl ->
let x = w ^?! gwWorld . coordinates . ix (apl ^?! plMID . _Just)
y = w ^?! gwWorld . coordinates . ix (bpl ^?! plMID . _Just)
in Just $ putDoubleDoor
(S.fromList [WallObstacle WallBlockVisibility])
defaultAutoWall
(WdBlCrFilterNearPoint 40 (0.5 *.* (x + y)) CrIsAnimate)
a
b
3
Just $
Placement (PS 0 0) (PutCoord b) Nothing Nothing $ \w bpl ->
let x = w ^?! gwWorld . coordinates . ix (apl ^?! plMID . _Just)
y = w ^?! gwWorld . coordinates . ix (bpl ^?! plMID . _Just)
in Just $
putDoubleDoor True
(S.fromList [WallObstacle WallBlockVisibility])
defaultAutoWall
(WdBlCrFilterNearPoint 40 (0.5 *.* (x + y)) CrIsAnimate)
a
b
3
--putAutoDoor :: Point2 -> Point2 -> Placement
--putAutoDoor a b = PlacementUsingPos (addZ 0 a) $
-- \az -> PlacementUsingPos (addZ 0 b) $
@@ -112,9 +125,15 @@ 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)
doorbetween btid a b = PutSlideDr thedoor defaultDoorWall
(S.fromList (WallObstacle <$> [WallNotAutoOpen,WallBlockVisibility])) 1 a b
--doorbetween btid a b = PutSlideDr thedoor (switchWallCol col)
doorbetween btid a b =
PutSlideDr False
thedoor
defaultDoorWall
(S.fromList (WallObstacle <$> [WallNotAutoOpen, WallBlockVisibility]))
1
a
b
where
thedoor =
defaultDoor
+1 -1
View File
@@ -95,7 +95,7 @@ crystalLine a b = sps0 $ PutLineBlock defaultCrystalWall 7 a b
baseBlockPane :: Wall
baseBlockPane = defaultWall & wlOpacity .~ Opaque 17
& wlPathFlag .~ S.fromList [WallBlockVisibility, WallNotAutoOpen]
-- & wlPathFlag .~ S.fromList [WallBlockVisibility, WallNotAutoOpen]
-- TODO find home for this
{- Replaces instances of a given 'PutID' with 'PSType's drawn from a list. -}
+3 -3
View File
@@ -134,10 +134,10 @@ 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 eo f l p1 p2 -> plDoor eo f l (pashift p1) (pashift p2) w
PutDoor isauto eo f l p1 p2 -> plDoor isauto eo f l (pashift p1) (pashift p2) w
PutCoord cp -> plNewID (gwWorld . coordinates) (doShift cp) w
PutSlideDr wl dr eo off a b ->
plSlideDoor wl dr eo off (doShift a) (doShift b) w
PutSlideDr isauto wl dr eo off a b ->
plSlideDoor isauto wl dr eo off (doShift a) (doShift b) w
PutBlock bl wl ps' ->
plBlock
(map doShift ps')
+2 -1
View File
@@ -4,6 +4,7 @@ module Dodge.Placement.PlaceSpot.Block (
plLineBlock,
) where
import Dodge.Wall.Pathing
import qualified Data.Set as S
import Control.Lens
import qualified Data.IntSet as IS
@@ -115,6 +116,6 @@ insertWalls wls w = foldl' (flip insertWall) w wls
insertWall :: Wall -> World -> World
insertWall wl =
uncurry (obstructPathsCrossing (S.map WallObstacle $ wl ^. wlPathFlag))
uncurry (obstructPathsCrossing (S.map WallObstacle $ getWallPathing wl))
(_wlLine wl)
. (cWorld . lWorld . walls . at (_wlID wl) ?~ wl)
+28 -17
View File
@@ -4,20 +4,21 @@ module Dodge.Placement.PlaceSpot.TriggerDoor (
updateDoorEdges,
) where
import Dodge.Default.Wall
import qualified Data.Set as S
import Dodge.ShiftPoint
import Linear
import Dodge.Data.GenWorld
import Data.List
import qualified Data.Set as S
import Dodge.Data.GenWorld
import Dodge.Default.Door
import Dodge.Default.Wall
import Dodge.LevelGen.DoorPane
import Dodge.Path
import Dodge.ShiftPoint
import Geometry
import qualified IntMapHelp as IM
import LensHelp
import Linear
plDoor ::
Bool ->
S.Set EdgeObstacle ->
-- | Opening condition
WdBl ->
@@ -28,7 +29,7 @@ plDoor ::
Point2A ->
GenWorld ->
(Int, GenWorld)
plDoor eo cond l p1 p2 gw = (drid, over gwWorld addWalls $ gw & gwWorld . cWorld . lWorld . doors %~ addDoor) -- carefull with the ordering of addWalls
plDoor isauto eo cond l p1 p2 gw = (drid, over gwWorld addWalls $ gw & gwWorld . cWorld . lWorld . doors %~ addDoor) -- carefull with the ordering of addWalls
where
drid = IM.newKey $ _doors (_lWorld (_cWorld $ _gwWorld gw))
addDoor =
@@ -45,12 +46,20 @@ plDoor eo cond l p1 p2 gw = (drid, over gwWorld addWalls $ gw & gwWorld . cWorld
wlids = take 4 [IM.newKey $ _walls (_lWorld (_cWorld $ _gwWorld gw)) ..]
wlps' = rectanglePairs 9 0 (V2 l 0)
--addWalls w' = foldl' (addDoorWall eo drid $ switchWallCol col) w' $ zip wlids
addWalls w' = foldl' (addDoorWall eo drid defaultDoorWall) w' $ zip wlids
$ wlps' & each . each %~ shiftPointBy p1
addWalls w' =
foldl' (addDoorWall isauto eo drid defaultDoorWall) w' $
zip wlids $
wlps' & each . each %~ shiftPointBy p1
addDoorWall :: S.Set EdgeObstacle
-> Int -> Wall -> World -> (Int, (Point2, Point2)) -> World
addDoorWall eo drid wl w (wlid, wlps) =
addDoorWall ::
Bool ->
S.Set EdgeObstacle ->
Int ->
Wall ->
World ->
(Int, (Point2, Point2)) ->
World
addDoorWall isauto eo drid wl w (wlid, wlps) =
w'
& cWorld . lWorld . walls
%~ IM.insert
@@ -58,23 +67,25 @@ addDoorWall eo drid wl w (wlid, wlps) =
wl
{ _wlLine = wlps
, _wlID = wlid
, _wlStructure = DoorPart drid
, _wlStructure = DoorPart drid isauto
}
where
w' = uncurry (obstructPathsCrossing eo) wlps w
updateDoorEdges :: EdgeObstacle -> [(Int,Int)] -> World -> World
updateDoorEdges :: EdgeObstacle -> [(Int, Int)] -> World -> World
updateDoorEdges eo es w = foldl' (updateDoorEdge eo) w es
updateDoorEdge :: EdgeObstacle -> World -> (Int,Int) -> World
updateDoorEdge :: EdgeObstacle -> World -> (Int, Int) -> World
--updateDoorEdge eo w (i,j) = w
updateDoorEdge _ w _ = w
-- | not . null $ overlapSegWalls (_peStart pe) (_peEnd pe) $ wlsNearSeg (_peStart pe) (_peEnd pe) w =
-- w & cWorld . pathGraph %~ FGL.insEdge (x, y, pe & peObstacles . at eo ?~ ()) . FGL.delEdge (x, y)
-- | otherwise =
-- w & cWorld . pathGraph %~ FGL.insEdge (x, y, pe & peObstacles . at eo .~ Nothing) . FGL.delEdge (x, y)
plSlideDoor ::
Bool ->
Door ->
Wall ->
S.Set EdgeObstacle ->
@@ -83,7 +94,7 @@ plSlideDoor ::
Point2 ->
GenWorld ->
(Int, GenWorld)
plSlideDoor dr wl eo shiftOffset a b gw =
plSlideDoor isauto dr wl eo shiftOffset a b gw =
(drid, over gwWorld addDoorWalls $ gw & gwWorld . cWorld . lWorld . doors %~ addDoor)
where
drid = IM.newKey $ _doors (_lWorld (_cWorld $ _gwWorld gw))
@@ -95,9 +106,9 @@ plSlideDoor dr wl eo shiftOffset a b gw =
, _drZeroPos = (a, 0)
, _drOnePos = (shiftLeft a, 0)
, _drLerp = 0
, _drFootPrint = IM.fromList $ zip wlids $ rectanglePairs 9 0 (b-a)
, _drFootPrint = IM.fromList $ zip wlids $ rectanglePairs 9 0 (b - a)
}
addDoorWalls w' = foldl' (addDoorWall eo drid wl) w' $ zip wlids pairs
addDoorWalls w' = foldl' (addDoorWall isauto eo drid wl) w' $ zip wlids pairs
pairs = rectanglePairs 9 a b
shiftLeft = (+.+ (a -.- b +.+ shiftOffset *.* normalizeV (b -.- a)))
wlids = take 4 [IM.newKey $ _walls (_lWorld (_cWorld $ _gwWorld gw)) ..]
+6 -6
View File
@@ -35,8 +35,8 @@ decontamRoom i =
& rmPmnts
.~ [ pContID (PS (V2 (-35) 50) (negate $ pi / 2)) (PutButton $ makeSwitch col red NoWorldEffect NoWorldEffect) $
\btid -> Just $
putDoubleDoorThen switchWallObs thewall (WdBlNegate $ WdBlBtOn btid) 1 (V2 0 20) (V2 40 20) 2 $
\_ _ -> Just $ putDoubleDoor switchWallObs thewall (WdBlBtOn btid) (V2 0 80) (V2 40 80) 2
putDoubleDoorThen False switchWallObs thewall (WdBlNegate $ WdBlBtOn btid) 1 (V2 0 20) (V2 40 20) 2 $
\_ _ -> Just $ putDoubleDoor False switchWallObs thewall (WdBlBtOn btid) (V2 0 80) (V2 40 80) 2
, invisibleWall $ rectNSWE 60 40 (-40) (-30)
, spanLightI (V2 (-20) 30) (V2 (-20) 70)
, analyser (NoItemZone ps) (PS 50 0) (PS mcpos 0) & plExternalID ?~ i
@@ -49,7 +49,7 @@ decontamRoom i =
f gw = fromMaybe (error "tried to put a door using an empty placement list") $ do
pmnt <- gw ^? genPmnt . ix i
return $
putDoubleDoor
putDoubleDoor False
switchWallObs
defaultDoorWall
(cond pmnt)
@@ -79,8 +79,8 @@ airlock0 =
, _rmPmnts =
[ pContID (PS (V2 (-35) 50) (negate $ pi / 2)) (PutButton $ makeSwitch col red NoWorldEffect NoWorldEffect) $
\btid -> Just $
putDoubleDoorThen switchWallObs thewall (WdBlNegate $ WdBlBtOn btid) 1 (V2 0 20) (V2 40 20) 2 $
\_ _ -> Just $ putDoubleDoor switchWallObs thewall (WdBlBtOn btid) (V2 0 80) (V2 40 80) 2
putDoubleDoorThen False switchWallObs thewall (WdBlNegate $ WdBlBtOn btid) 1 (V2 0 20) (V2 40 20) 2 $
\_ _ -> Just $ putDoubleDoor False switchWallObs thewall (WdBlBtOn btid) (V2 0 80) (V2 40 80) 2
, invisibleWall $ rectNSWE 60 40 (-40) (-30)
, spanLightI (V2 (-2) 30) (V2 (-2) 70)
, sps0 $ putShape $ thinHighBar 75 (V2 40 50) (V2 (-1) 50)
@@ -98,7 +98,7 @@ airlock0 =
--airlockDoor :: Color -> WdBl -> [(Point2, Point2)] -> PSType
airlockDoor :: WdBl -> Float -> Point2A -> Point2A -> PSType
airlockDoor = PutDoor switchWallObs
airlockDoor = PutDoor False switchWallObs
airlockDoubleDoor ::
Point2 ->
+1 -1
View File
@@ -41,6 +41,6 @@ triggerDoorRoom i =
where
f gw = fromMaybe (error "tried to put a door using an empty placement list") $ do
pmnt <- gw ^? genPmnt . ix i
return $ putDoubleDoor
return $ putDoubleDoor False
switchWallObs defaultDoorWall (cond pmnt) (V2 0 20) (V2 40 20) 2
cond pmnt = WdTrig $ fromJust (_plMID pmnt)
+3 -3
View File
@@ -48,8 +48,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 switchWallObs 1 (V2 x 1) (V2 x h)) $
ps0 (PutSlideDr (thedoor btid) thewall switchWallObs 1 (V2 (- x) 1) (V2 (- x) h)) $
\btid -> jsps0J (PutSlideDr False (thedoor btid) thewall switchWallObs 1 (V2 x 1) (V2 x h)) $
ps0 (PutSlideDr False (thedoor btid) thewall switchWallObs 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
]
@@ -137,7 +137,7 @@ addButtonSlowDoor x h rm = do
col
(rprBool (isUnusedLnkType InLink))
$ \btplmnt -> Just $
putDoubleDoorThen
putDoubleDoorThen False
switchWallObs
thewall
(WdBlBtOn $ fromJust $ _plMID btplmnt)
+2 -2
View File
@@ -328,8 +328,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 switchWallObs 1 (V2 (-21) 0) (V2 0 0)) $
sPS (V2 0 (d -10)) 0 (PutSlideDr (thedoor btid) thewall switchWallObs 1 (V2 21 0) (V2 0 0))
jspsJ (V2 0 (d -10)) 0 (PutSlideDr False (thedoor btid) thewall switchWallObs 1 (V2 (-21) 0) (V2 0 0)) $
sPS (V2 0 (d -10)) 0 (PutSlideDr False (thedoor btid) thewall switchWallObs 1 (V2 21 0) (V2 0 0))
]
--thewall = switchWallCol col
thewall = defaultDoorWall
+3 -1
View File
@@ -1,5 +1,6 @@
module Dodge.Update.WallDamage (updateWallDamages, updateEdgesWall) where
import Dodge.Wall.Pathing
import Geometry.Data
import Control.Lens
import Data.Foldable
@@ -35,7 +36,8 @@ updateEdgeWallObs :: World -> (Int, Int) -> World
updateEdgeWallObs w (i, j) = fromMaybe w $ do
s <- getNodePos i w
e <- getNodePos j w
let wlflags = foldMap (^. _2 . wlPathFlag) $ wlsHitUnsorted s e w
--let wlflags = foldMap (^. _2 . wlPathFlag) $ wlsHitUnsorted s e w
let wlflags = foldMap (getWallPathing . (^. _2)) $ wlsHitUnsorted s e w
return $ w & cWorld . incGraph %~ updateEdge (f wlflags) (i, j)
where
f x _ = S.map WallObstacle x
+1 -1
View File
@@ -17,7 +17,7 @@ damageWall dt wl (is,w) = case _wlStructure wl of
BlockPart blid ->
w' & cWorld . lWorld . blocks . ix blid . blHP -~ dmam
& maybeDestroyBlock is blid
DoorPart drid ->
DoorPart drid _ ->
f $ w' & cWorld . lWorld . doors . ix drid . drHP -~ dmam
-- & maybeDestroyDoor drid
_ -> f w'
+2 -1
View File
@@ -17,6 +17,7 @@ module Dodge.WorldEvent.ThingsHit (
isWalkable,
) where
import Dodge.Wall.Pathing
import Data.Monoid
import qualified Data.Set as S
import Linear
@@ -163,7 +164,7 @@ isFlyable :: Point2 -> Point2 -> World -> Bool
{-# INLINE isFlyable #-}
isFlyable p1 p2 =
not . (WallNotAutoOpen `S.member`)
. foldMap (^. _2 . wlPathFlag)
. foldMap (getWallPathing . (^. _2))
. wlsHitUnsorted p1 p2
isWalkable :: Point2 -> Point2 -> World -> Bool
+38 -37
View File
@@ -2456,7 +2456,6 @@ _wlID src/Dodge/Data/Wall.hs 20;" f
_wlLine src/Dodge/Data/Wall.hs 19;" f
_wlMaterial src/Dodge/Data/Wall.hs 28;" f
_wlOpacity src/Dodge/Data/Wall.hs 21;" f
_wlPathFlag src/Dodge/Data/Wall.hs 22;" f
_wlRotateTo src/Dodge/Data/Wall.hs 25;" f
_wlStCreature src/Dodge/Data/Wall/Structure.hs 15;" f
_wlStructure src/Dodge/Data/Wall.hs 26;" f
@@ -2467,6 +2466,7 @@ _worldEventFlags src/Dodge/Data/World.hs 45;" f
_worldEvents src/Dodge/Data/LWorld.hs 127;" f
_wsBlock src/Dodge/Data/Wall/Structure.hs 14;" f
_wsDoor src/Dodge/Data/Wall/Structure.hs 12;" f
_wsIsAutoDoor src/Dodge/Data/Wall/Structure.hs 12;" f
_wsMachine src/Dodge/Data/Wall/Structure.hs 13;" f
_xNum src/Dodge/Data/Item/Combine.hs 139;" f
_xNum src/Dodge/Data/Item/Combine.hs 149;" f
@@ -2482,12 +2482,12 @@ activateDetonator src/Dodge/Creature/Impulse/UseItem.hs 62;" f
activeTargetCursorPic src/Dodge/Targeting/Draw.hs 31;" f
addArmour src/Dodge/Creature.hs 84;" f
addBranchAt src/Dodge/Tree/GenerateStructure.hs 18;" f
addButtonSlowDoor src/Dodge/Room/LongDoor.hs 99;" f
addButtonSlowDoor src/Dodge/Room/LongDoor.hs 100;" f
addCrGibs src/Dodge/Prop/Gib.hs 17;" f
addDepth src/Picture/Base.hs 133;" f
addDoorAtNthLinkToggleTerminal src/Dodge/Room/Warning.hs 40;" f
addDoorToggleTerminal src/Dodge/Room/Warning.hs 37;" f
addDoorWall src/Dodge/Placement/PlaceSpot/TriggerDoor.hs 50;" f
addDoorWall src/Dodge/Placement/PlaceSpot/TriggerDoor.hs 54;" f
addGib4 src/Dodge/Prop/Gib.hs 52;" f
addGibAt src/Dodge/Prop/Gib.hs 63;" f
addGibAtDir src/Dodge/Prop/Gib.hs 69;" f
@@ -2510,7 +2510,7 @@ addPolyWalls src/Dodge/LevelGen/StaticWalls.hs 129;" f
addRandomGirderEW src/Dodge/Room/Girder.hs 9;" f
addRandomGirderFrom src/Dodge/Room/Girder.hs 16;" f
addSideEffect src/Dodge/Concurrent.hs 29;" f
addSouthPillars src/Dodge/Room/LongDoor.hs 91;" f
addSouthPillars src/Dodge/Room/LongDoor.hs 92;" f
addTermSignal src/Dodge/Event/Input.hs 31;" f
addToTrunk src/TreeHelp.hs 157;" f
addWarningTerminal src/Dodge/Room/Warning.hs 61;" f
@@ -2744,7 +2744,7 @@ cdtPropagateFold src/Dodge/DoubleTree.hs 407;" f
cenLasTur src/Dodge/Room/LasTurret.hs 25;" f
centerText src/Picture/Base.hs 184;" f
centerVaultExplosiveExit src/Dodge/Room/NoNeedWeapon.hs 20;" f
centerVaultRoom src/Dodge/Room/Procedural.hs 291;" f
centerVaultRoom src/Dodge/Room/Procedural.hs 292;" f
centroid src/Geometry/Polygon.hs 168;" f
centroidNum src/Geometry/Polygon.hs 171;" f
chainCreatureUpdates src/Dodge/Creature/ChainUpdates.hs 6;" f
@@ -2800,7 +2800,7 @@ clAlt src/Dodge/Cloud.hs 5;" f
clClSpringVel src/Dodge/Update.hs 841;" f
clColor src/Shader/Poke/Cloud.hs 35;" f
clZoneSize src/Dodge/Zoning/Cloud.hs 21;" f
clampPath src/Dodge/Room/Procedural.hs 168;" f
clampPath src/Dodge/Room/Procedural.hs 169;" f
clang1S src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 560;" f
clang2S src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 676;" f
clangS src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 542;" f
@@ -2857,11 +2857,11 @@ combinationsGraph src/Dodge/Combine/Graph.hs 72;" f
combinationsOf src/Multiset.hs 46;" f
combinationsTrie src/Dodge/Combine.hs 43;" f
combineAwareness src/Dodge/Creature/Perception.hs 109;" f
combineFloors src/Dodge/Room/Procedural.hs 174;" f
combineFloors src/Dodge/Room/Procedural.hs 175;" f
combineInventoryExtra src/Dodge/Render/HUD.hs 337;" f
combineItemListYouX src/Dodge/Combine.hs 35;" f
combineList src/Dodge/Combine.hs 21;" f
combineRooms src/Dodge/Room/Procedural.hs 154;" f
combineRooms src/Dodge/Room/Procedural.hs 155;" f
combineS src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 480;" f
combineTree src/Dodge/Tree/Compose.hs 67;" f
commandColor src/Dodge/Terminal.hs 114;" f
@@ -3063,7 +3063,7 @@ defSPic src/Dodge/Item/Draw/SPic.hs 309;" f
defaultAimMvType src/Dodge/Creature/MoveType.hs 16;" f
defaultAimingCrit src/Dodge/Default/Creature.hs 107;" f
defaultAudition src/Dodge/Default/Creature.hs 92;" f
defaultAutoWall src/Dodge/Default/Wall.hs 43;" f
defaultAutoWall src/Dodge/Default/Wall.hs 40;" f
defaultBlock src/Dodge/Default/Block.hs 5;" f
defaultBounds src/Dodge/Data/Bounds.hs 18;" f
defaultBullet src/Dodge/Item/Weapon/Bullet.hs 10;" f
@@ -3077,11 +3077,11 @@ defaultConfig src/Dodge/Data/Config.hs 128;" f
defaultCraftItem src/Dodge/Default/Item.hs 25;" f
defaultCreature src/Dodge/Default/Creature.hs 12;" f
defaultCreatureMemory src/Dodge/Default/Creature.hs 65;" f
defaultCrystalWall src/Dodge/Default/Wall.hs 51;" f
defaultCrystalWall src/Dodge/Default/Wall.hs 47;" f
defaultDirtBlock src/Dodge/Default/Block.hs 17;" f
defaultDirtWall src/Dodge/Default/Wall.hs 64;" f
defaultDoor src/Dodge/Default/Door.hs 7;" f
defaultDoorWall src/Dodge/Default/Wall.hs 37;" f
defaultDoor src/Dodge/Default/Door.hs 5;" f
defaultDoorWall src/Dodge/Default/Wall.hs 33;" f
defaultDrawButton src/Dodge/Button/Draw.hs 29;" f
defaultEquipment src/Dodge/Default.hs 24;" f
defaultFlIt src/Dodge/Default.hs 27;" f
@@ -3095,7 +3095,7 @@ defaultInvSize src/Dodge/Default/Creature.hs 72;" f
defaultLWorld src/Dodge/Default/World.hs 100;" f
defaultListDisplayParams src/Dodge/ListDisplayParams.hs 18;" f
defaultMachine src/Dodge/Default.hs 30;" f
defaultMachineWall src/Dodge/Default/Wall.hs 54;" f
defaultMachineWall src/Dodge/Default/Wall.hs 52;" f
defaultPerceptionState src/Dodge/Default/Creature.hs 75;" f
defaultProp src/Dodge/Default/Prop.hs 6;" f
defaultProximitySensor src/Dodge/Default.hs 54;" f
@@ -3150,7 +3150,7 @@ dist src/Geometry/Vector.hs 185;" f
dist3 src/Geometry/Vector3D.hs 101;" f
divTo src/Geometry/Zone.hs 6;" f
divideCircle src/Geometry.hs 321;" f
divideDoorPane src/Dodge/Placement/Instance/Door.hs 63;" f
divideDoorPane src/Dodge/Placement/Instance/Door.hs 71;" f
divideLine src/Geometry.hs 248;" f
divideLineExact src/Geometry.hs 276;" f
divideLineOddNumPoints src/Geometry.hs 261;" f
@@ -3223,7 +3223,7 @@ doWdWd src/Dodge/WorldEffect.hs 28;" f
doWorldEvents src/Dodge/Update.hs 428;" f
doWorldPos src/Dodge/WorldPos.hs 10;" f
door src/Dodge/Room/Door.hs 13;" f
doorBetween src/Dodge/Placement/Instance/Door.hs 43;" f
doorBetween src/Dodge/Placement/Instance/Door.hs 50;" f
doorLerp src/Dodge/DrWdWd.hs 26;" f
dotV src/Geometry/Vector.hs 76;" f
dotV3 src/Geometry/Vector3D.hs 119;" f
@@ -3596,6 +3596,7 @@ getSplitString src/Dodge/Debug/Terminal.hs 129;" f
getTiles src/Dodge/Layout.hs 199;" f
getViewpoints src/Dodge/Viewpoints.hs 29;" f
getVolleyBurst src/Dodge/HeldUse.hs 126;" f
getWallPathing src/Dodge/Wall/Pathing.hs 7;" f
getWallSPic src/Dodge/Render/Walls.hs 53;" f
getWindowSize src/Dodge/WindowSize.hs 5;" f
gimbal src/Dodge/Item/Scope.hs 153;" f
@@ -3971,7 +3972,7 @@ listGuard src/Dodge/Creature/ReaderUpdate.hs 195;" f
listSelectionColorPicture src/Dodge/DisplayInventory.hs 302;" f
litCorridor90 src/Dodge/Room/RoadBlock.hs 26;" f
lmt src/MatrixHelper.hs 43;" f
lnkBothAnd src/Dodge/Room/Procedural.hs 124;" f
lnkBothAnd src/Dodge/Room/Procedural.hs 125;" f
lnkMidPosInvSelsCol src/Dodge/Render/HUD.hs 387;" f
loadDodgeConfig src/Dodge/Config.hs 30;" f
loadMusic src/Dodge/SoundLogic/LoadSound.hs 30;" f
@@ -4014,7 +4015,7 @@ lookupTrie src/SimpleTrie.hs 30;" f
loopPairs src/ListHelp.hs 30;" f
lootRoom src/Dodge/Room/Treasure.hs 58;" f
lorem src/Lorem.hs 3;" f
lowBlock src/Dodge/Placement/Instance/Block.hs 24;" f
lowBlock src/Dodge/Placement/Instance/Block.hs 26;" f
lsColPos src/Dodge/LightSource.hs 23;" f
lsColPosID src/Dodge/LightSource.hs 20;" f
lsColPosRad src/Dodge/LightSource.hs 29;" f
@@ -4356,7 +4357,7 @@ pistol src/Dodge/Item/Held/Stick.hs 40;" f
pistolerRoom src/Dodge/Room/Room.hs 330;" f
pjRemoteSetDirection src/Dodge/Projectile/Update.hs 172;" f
plBlock src/Dodge/Placement/PlaceSpot/Block.hs 17;" f
plDoor src/Dodge/Placement/PlaceSpot/TriggerDoor.hs 19;" f
plDoor src/Dodge/Placement/PlaceSpot/TriggerDoor.hs 20;" f
plLineBlock src/Dodge/Placement/PlaceSpot/Block.hs 49;" f
plMachine src/Dodge/Placement/PlaceSpot.hs 206;" f
plNew src/Dodge/Base/NewID.hs 19;" f
@@ -4364,7 +4365,7 @@ plNewID src/Dodge/Base/NewID.hs 7;" f
plNewUpID src/Dodge/Base/NewID.hs 13;" f
plNewUsing src/Dodge/Base/NewID.hs 27;" f
plRRpt src/Dodge/LevelGen/PlacementHelper.hs 33;" f
plSlideDoor src/Dodge/Placement/PlaceSpot/TriggerDoor.hs 76;" f
plSlideDoor src/Dodge/Placement/PlaceSpot/TriggerDoor.hs 87;" f
placeChasm src/Dodge/Placement/PlaceSpot.hs 161;" f
placeMachineWalls src/Dodge/Placement/PlaceSpot.hs 234;" f
placePlainPSSpot src/Dodge/Placement/PlaceSpot.hs 43;" f
@@ -4524,12 +4525,12 @@ pushOutFromWall src/Dodge/WallCreatureCollisions.hs 101;" f
pushOutFromWalls src/Dodge/WallCreatureCollisions.hs 64;" f
pushR src/DoubleStack.hs 24;" f
pushScreen src/Dodge/Menu/PushPop.hs 9;" f
putAutoDoor src/Dodge/Placement/Instance/Door.hs 82;" f
putAutoDoor src/Dodge/Placement/Instance/Door.hs 91;" f
putBlockN src/Dodge/Placement/Instance/Wall.hs 166;" f
putBlockRect src/Dodge/Placement/Instance/Wall.hs 145;" f
putBlockV src/Dodge/Placement/Instance/Wall.hs 153;" f
putDoubleDoor src/Dodge/Placement/Instance/Door.hs 20;" f
putDoubleDoorThen src/Dodge/Placement/Instance/Door.hs 25;" f
putDoubleDoor src/Dodge/Placement/Instance/Door.hs 19;" f
putDoubleDoorThen src/Dodge/Placement/Instance/Door.hs 31;" f
putImmediateMessageTerminal src/Dodge/Placement/Instance/Terminal.hs 65;" f
putLamp src/Dodge/Placement/Instance/LightSource.hs 222;" f
putLasTurret src/Dodge/Placement/Instance/Turret.hs 23;" f
@@ -4549,8 +4550,8 @@ qID src/Quaternion.hs 58;" f
qToAng src/Quaternion.hs 55;" f
qToV2 src/Quaternion.hs 52;" f
qToV3 src/Quaternion.hs 49;" f
quarterRoomSquare src/Dodge/Room/Procedural.hs 215;" f
quarterRoomTri src/Dodge/Room/Procedural.hs 179;" f
quarterRoomSquare src/Dodge/Room/Procedural.hs 216;" f
quarterRoomTri src/Dodge/Room/Procedural.hs 180;" f
quitCommand src/Dodge/Terminal.hs 93;" f
qz src/Quaternion.hs 67;" f
rLauncher src/Dodge/Item/Held/Launcher.hs 14;" f
@@ -4582,8 +4583,8 @@ randSparkExtraVel src/Dodge/Spark.hs 92;" f
randWallReflect src/Dodge/Update.hs 643;" f
randomChallenges src/Dodge/Room/Start.hs 63;" f
randomCompass src/Dodge/Layout.hs 60;" f
randomFourCornerRoom src/Dodge/Room/Procedural.hs 268;" f
randomFourCornerRoomCrsIts src/Dodge/Room/Procedural.hs 280;" f
randomFourCornerRoom src/Dodge/Room/Procedural.hs 269;" f
randomFourCornerRoomCrsIts src/Dodge/Room/Procedural.hs 281;" f
randomLightPositions src/Dodge/Room/Modify/Girder.hs 152;" f
randomMediumRoom src/Dodge/Room/Boss.hs 76;" f
randomPath src/TreeHelp.hs 145;" f
@@ -4696,8 +4697,8 @@ roomPillars src/Dodge/Room/Pillar.hs 106;" f
roomPillarsContaining src/Dodge/Room/Containing.hs 39;" f
roomPillarsPassage src/Dodge/Room/Pillar.hs 93;" f
roomPillarsSquare src/Dodge/Room/Pillar.hs 49;" f
roomRect src/Dodge/Room/Procedural.hs 38;" f
roomRectAutoLinks src/Dodge/Room/Procedural.hs 141;" f
roomRect src/Dodge/Room/Procedural.hs 39;" f
roomRectAutoLinks src/Dodge/Room/Procedural.hs 142;" f
roomShuriken src/Dodge/Room/Boss.hs 123;" f
roomTwistCross src/Dodge/Room/Boss.hs 154;" f
roomsContaining src/Dodge/Room/Containing.hs 20;" f
@@ -4956,8 +4957,8 @@ slap1S src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 670;" f
slapS src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 604;" f
slideDoorS src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 688;" f
slideWindow src/ListHelp.hs 80;" f
slowDoorRoom src/Dodge/Room/LongDoor.hs 157;" f
slowDoorRoomRunPast src/Dodge/Room/LongDoor.hs 174;" f
slowDoorRoom src/Dodge/Room/LongDoor.hs 158;" f
slowDoorRoomRunPast src/Dodge/Room/LongDoor.hs 175;" f
smallBattery src/Dodge/Item/Ammo.hs 60;" f
smallBranch src/Dodge/Tree/GenerateStructure.hs 32;" f
smallChaseCrit src/Dodge/Creature/ChaseCrit.hs 14;" f
@@ -4992,7 +4993,7 @@ soundToOnomato src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 150;" f
soundToVol src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 4;" f
soundWithStatus src/Dodge/SoundLogic.hs 104;" f
soundWithStatusVolume src/Dodge/SoundLogic.hs 54;" f
southPillarsRoom src/Dodge/Room/LongDoor.hs 88;" f
southPillarsRoom src/Dodge/Room/LongDoor.hs 89;" f
spaceAction src/Dodge/Update/Input/InGame.hs 528;" f
spanColLightBlackI src/Dodge/Placement/Instance/LightSource.hs 206;" f
spanColLightI src/Dodge/Placement/Instance/LightSource.hs 199;" f
@@ -5085,7 +5086,7 @@ swapInvItems src/Dodge/Inventory/Swap.hs 22;" f
swapItemWith src/Dodge/Inventory.hs 164;" f
swarmCrit src/Dodge/Creature/SwarmCrit.hs 10;" f
swarmUsingCenter src/Dodge/Creature/Boid.hs 174;" f
switchDoor src/Dodge/Placement/Instance/Door.hs 108;" f
switchDoor src/Dodge/Placement/Instance/Door.hs 120;" f
switchWallObs src/Dodge/Data/PathGraph.hs 54;" f
t src/ShortShow.hs 48;" f
tEast src/Dodge/Room/Corridor.hs 90;" f
@@ -5287,8 +5288,8 @@ tutRezBox src/Dodge/Room/Tutorial.hs 369;" f
tutRoomTree src/Dodge/Floor.hs 21;" f
tutorialMessage1 src/Dodge/Room/Tutorial.hs 393;" f
tweenAngles src/Geometry/Vector.hs 190;" f
twinSlowDoorChasers src/Dodge/Room/LongDoor.hs 82;" f
twinSlowDoorRoom src/Dodge/Room/LongDoor.hs 29;" f
twinSlowDoorChasers src/Dodge/Room/LongDoor.hs 83;" f
twinSlowDoorRoom src/Dodge/Room/LongDoor.hs 30;" f
twists src/Dodge/Creature/Test.hs 102;" f
twoFlat src/Dodge/Creature/Test.hs 99;" f
twoFlatHRot src/Dodge/Item/HeldOffset.hs 80;" f
@@ -5345,8 +5346,8 @@ updateDisplaySections src/Dodge/DisplayInventory.hs 116;" f
updateDistortion src/Dodge/Distortion.hs 5;" f
updateDistortions src/Dodge/Update.hs 558;" f
updateDoor src/Dodge/DrWdWd.hs 20;" f
updateDoorEdge src/Dodge/Placement/PlaceSpot/TriggerDoor.hs 68;" f
updateDoorEdges src/Dodge/Placement/PlaceSpot/TriggerDoor.hs 65;" f
updateDoorEdge src/Dodge/Placement/PlaceSpot/TriggerDoor.hs 78;" f
updateDoorEdges src/Dodge/Placement/PlaceSpot/TriggerDoor.hs 75;" f
updateDoors src/Dodge/Update.hs 310;" f
updateDust src/Dodge/Update.hs 822;" f
updateDusts src/Dodge/Update.hs 672;" f
@@ -5608,7 +5609,7 @@ zConnectColMidX src/Dodge/Render/Connectors.hs 31;" f
zeroZ src/Geometry/Vector.hs 9;" f
zipArcs src/Dodge/Tesla.hs 52;" f
zipCount src/Dodge/Tree/Shift.hs 136;" f
zipCountDown src/Dodge/Room/Procedural.hs 121;" f
zipCountDown src/Dodge/Room/Procedural.hs 122;" f
zoneCloud src/Dodge/Zoning/Cloud.hs 27;" f
zoneClouds src/Dodge/Update.hs 476;" f
zoneCreature src/Dodge/Zoning/Creature.hs 55;" f