Refactor doors

This commit is contained in:
2021-09-28 01:48:03 +01:00
parent 743c1c878d
commit 1990558985
13 changed files with 105 additions and 51 deletions
+13 -1
View File
@@ -59,6 +59,7 @@ data World = World
, _props :: IM.IntMap Prop
, _particles :: ![Particle]
, _walls :: !(IM.IntMap Wall)
, _doors :: IM.IntMap Door'
, _wallsZone :: Zone (IM.IntMap Wall)
, _forceFields :: IM.IntMap ForceField
, _floorItems :: IM.IntMap FloorItem
@@ -237,6 +238,7 @@ data CrMvType
}
data WorldState
= DoorNumOpen Int
| DoorNumOpening Int
| CrNumAlive Int
deriving (Eq,Ord)
data Button = Button
@@ -529,7 +531,15 @@ data Prop
, _pjTimer :: Int
}
data Either3 a b c = E3x1 a | E3x2 b | E3x3 c
data Door' = Door'
{ _drID :: Int
, _drWallIDs :: [Int]
, _drStatus :: DoorStatus
, _drTrigger :: World -> Bool
, _drMech :: Door' -> World -> World
}
data DoorStatus = DoorOpen | DoorClosed | DoorHalfway
deriving (Eq, Ord, Show)
data Wall
= Wall
{ _wlLine :: (Point2,Point2)
@@ -537,6 +547,7 @@ data Wall
, _wlColor :: Color
, _wlSeen :: Bool
, _wlIsSeeThrough :: Bool
, _wlPathable :: Bool
}
| BlockAutoDoor
{ _wlLine :: (Point2,Point2)
@@ -761,6 +772,7 @@ makeLenses ''Action
makeLenses ''CrGroupParams
makeLenses ''CrMvType
makeLenses ''Intention
makeLenses ''Door'
numColor :: Int -> Color
numColor 0 = toV4 (1,0,0,1)
numColor 1 = toV4 (0,1,0,1)