Implement moving mounted lights

This commit is contained in:
2022-03-10 14:43:41 +00:00
parent c583d33b57
commit 907cca0ef0
8 changed files with 80 additions and 21 deletions
+12 -3
View File
@@ -98,9 +98,18 @@ doorMechanism drid speed wlidOpCps dr w
doClose w' (wlid,_ ,clp) = moveWallIDToward wlid speed clp w'
-- TODO cut pathing if not pathable, reset when opened
plSlideDoor :: Bool -> Color -> (World -> Bool) -> Point2 -> Point2 -> Float -> GenWorld
plSlideDoor
:: Bool
-> Color
-> (World -> Bool)
-> Float
-> Point2
-> Point2
-> Float
-> GenWorld
-> (Int, GenWorld)
plSlideDoor isPathable col cond a b speed gw = (drid, gw & gWorld .~ (addWalls w & doors %~ addDoor))
plSlideDoor isPathable col cond shiftOffset a b speed gw
= (drid, gw & gWorld .~ (addWalls w & doors %~ addDoor))
where
w = _gWorld gw
drid = IM.newKey $ _doors w
@@ -117,7 +126,7 @@ plSlideDoor isPathable col cond a b speed gw = (drid, gw & gWorld .~ (addWalls w
addWalls w' = foldl' (addDoorWall col isPathable) w' $ zip wlids pairs
pairs = rectanglePairs 9 a b
shiftedPairs = map (bimap shiftLeft shiftLeft) pairs
shiftLeft = (+.+ (a -.- b +.+ normalizeV (b -.- a)))
shiftLeft = (+.+ (a -.- b +.+ shiftOffset *.* normalizeV (b -.- a)))
wlids = take 4 [IM.newKey $ _walls w ..]
-- old code that may help with pathing
--import Dodge.LevelGen.Pathing