Move towards allowing partial destruction of doors

This commit is contained in:
2022-06-23 14:52:25 +01:00
parent 4c8c82b55c
commit 0f01e422f6
11 changed files with 73 additions and 28 deletions
+4 -6
View File
@@ -15,6 +15,7 @@ import qualified IntMapHelp as IM
import Dodge.SoundLogic
--import Dodge.LevelGen.LevelStructure
--import Data.Maybe
import Data.List
import Control.Lens
--import Data.Graph.Inductive hiding ((&))
@@ -106,27 +107,24 @@ doorMechanism dr w = case mvDir of
plSlideDoor
:: Bool
-> Color
-> (World -> Bool)
-> Door
-> Float
-> Point2
-> Point2
-> Float
-> World
-> (Int, World)
plSlideDoor isPathable col cond shiftOffset a b speed gw
plSlideDoor isPathable col dr shiftOffset a b gw
= (drid, addDoorWalls gw & doors %~ addDoor)
where
drid = IM.newKey $ _doors gw
addDoor = IM.insert drid $ defaultDoor
addDoor = IM.insert drid $ dr
{ _drID = drid
, _drWallIDs = IS.fromList wlids
, _drStatus = DoorClosed
, _drTrigger = cond
, _drMech = doorMechanism
, _drPos = (a,b)
, _drOpenPos = (shiftLeft a,shiftLeft b)
, _drClosePos = (a,b)
, _drSpeed = speed
}
addDoorWalls w' = foldl' (addDoorWall drid col isPathable) w' $ zip wlids pairs
pairs = rectanglePairs 9 a b