Add objects based on walls, called machines

This commit is contained in:
2021-10-31 22:55:02 +00:00
parent 08fa84c1fd
commit 86fdfd260e
23 changed files with 183 additions and 90 deletions
+33 -9
View File
@@ -57,6 +57,7 @@ data World = World
, _particles :: ![Particle]
, _walls :: !(IM.IntMap Wall)
, _doors :: IM.IntMap Door
, _machines :: IM.IntMap Machine
, _blocks :: IM.IntMap Block
, _wallsZone :: Zone (IM.IntMap Wall)
, _floorItems :: IM.IntMap FloorItem
@@ -549,6 +550,16 @@ data Block = Block
, _blHPs :: [Int]
, _blShadows :: [Int]
}
data Machine = Machine
{ _mcID :: Int
, _mcWallIDs :: [Int]
, _mcUpdate :: Machine -> World -> World
, _mcDraw :: Machine -> SPic
, _mcPos :: Point2
, _mcDir :: Float
, _mcHP :: Int
, _mcSensor :: Int
}
data Door = Door
{ _drID :: Int
, _drWallIDs :: [Int]
@@ -559,16 +570,27 @@ data Door = Door
data DoorStatus = DoorOpen | DoorClosed | DoorHalfway | DoorInt Int
deriving (Eq, Ord, Show)
data Wall = Wall
{ _wlLine :: (Point2,Point2)
, _wlID :: Int
, _wlColor :: Color
, _wlSeen :: Bool
, _wlIsSeeThrough :: Bool
, _wlPathable :: Bool
, _wlDraw :: Bool
, _wlRotateTo :: Bool
, _wlBlockID :: Maybe' Int
{ _wlLine :: (Point2,Point2)
, _wlID :: Int
, _wlColor :: Color
, _wlSeen :: Bool
, _wlOpacity :: Opacity
, _wlPathable :: Bool
, _wlFireThrough :: Bool
, _wlDraw :: Bool
, _wlRotateTo :: Bool
, _wlStructure :: WallStructure
}
data Opacity
= SeeThrough
| SeeAbove
| Opaque
deriving (Eq,Ord,Show)
data WallStructure
= StandaloneWall
| DoorPart { _wlStDoor :: Int }
| MachinePart { _wlStMachine :: Int }
| BlockPart { _wlStBlock :: Int }
-- | Strict maybe
data Maybe' a = Just' a | Nothing'
@@ -749,6 +771,7 @@ makeLenses ''PjParam
makeLenses ''Prop
makeLenses ''Particle
makeLenses ''Wall
makeLenses ''WallStructure
makeLenses ''PressPlate
makeLenses ''Button
makeLenses ''ActionPlan
@@ -759,5 +782,6 @@ makeLenses ''CrMvType
makeLenses ''Intention
makeLenses ''Door
makeLenses ''Block
makeLenses ''Machine
makeLenses ''Zone
makeLenses ''ItemDimension