Cleanup, merge modules

This commit is contained in:
2025-09-18 08:28:09 +01:00
parent f12ae3533c
commit 1564b1c721
23 changed files with 166 additions and 540 deletions
+1 -1
View File
@@ -5,7 +5,7 @@
module Dodge.Data.GenParams where
import Dodge.Data.Machine.Sensor.Type
import Dodge.Data.Machine.Sensor
import Color
import Control.Lens
import Data.Aeson
+9 -14
View File
@@ -76,15 +76,12 @@ data PlacementSpot
}
-- TODO attempt to unify/simplify this union type
data Placement
= Placement
{ _plOrder :: Int
, _plSpot :: PlacementSpot
, _plType :: PSType
, _plMID :: Maybe Int
, _plIDCont :: World -> Placement -> Maybe Placement
}
-- | RandomPlacement {_unRandomPlacement :: State StdGen Placement}
data Placement = Placement
{ _plSpot :: PlacementSpot
, _plType :: PSType
, _plMID :: Maybe Int
, _plIDCont :: World -> Placement -> Maybe Placement
}
{- The '_rmPolys' lists which polygons should be cut out to form the indestructible walls of the room.
Link pairs contain a position and rotation to attach to another room;
@@ -107,9 +104,9 @@ data Room = Room
, _rmPos :: [RoomPos]
, _rmPath :: S.Set (Point2, Point2)
, _rmPmnts :: [Placement]
, _rmInPmnt :: [InPlacement]
-- note that in placements form a list: multiple InPlacements can use the same id
, _rmOutPmnt :: IM.IntMap Placement
, _rmInPmnt :: [InPlacement]
, -- note that in placements form a list: multiple InPlacements can use the same id
_rmOutPmnt :: IM.IntMap Placement
, _rmBound :: [[Point2]]
, _rmFloor :: Floor
, _rmName :: String
@@ -126,8 +123,6 @@ data Room = Room
, _rmClusterStatus :: ClusterStatus
}
--data OutPlacement = OutPlacement { _opPlacement :: Placement }
data InPlacement = InPlacement
{ _ipPlacement :: World -> [Placement] -> Placement
, _ipPlacementID :: Int
+22 -8
View File
@@ -3,18 +3,22 @@
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Machine.Sensor (
module Dodge.Data.Machine.Sensor,
module Dodge.Data.Machine.Sensor.Type,
) where
module Dodge.Data.Machine.Sensor (module Dodge.Data.Machine.Sensor) where
import Control.Lens
import Data.Aeson
import Data.Aeson.TH
import Dodge.Data.Item.Combine
import Dodge.Data.Machine.Sensor.Type
import Geometry.Data
data SensorType
= LaserSensor
| ElectricSensor
| ThermalSensor
| PhysicalSensor
deriving (Eq, Ord, Show, Read, Bounded, Enum)
data DamageSensor = DamSensor
{ _sensAmount :: Int
, _sensType :: SensorType
@@ -22,19 +26,29 @@ data DamageSensor = DamSensor
}
data ProximitySensor = ProxSensor
{ _proxRequirement :: ProximityRequirement
{ _proxSensorType :: ProximitySensorType
, _proxToggle :: Bool
}
data ProximitySensorType
= SensorWithRequirement ProximityRequirement
| NoItemZone [Point2]
data ProximityRequirement
= RequireHealth {_proxReqMinHealth :: Int}
| RequireEquipment {_proxReqEquipment :: ItemType}
| RequireNoItems {_proxNoItems :: [Point2]}
deriving (Show)
makeLenses ''DamageSensor
makeLenses ''ProximitySensor
makeLenses ''ProximityRequirement
makeLenses ''ProximitySensorType
makePrisms ''ProximityRequirement
deriveJSON defaultOptions ''SensorType
deriveJSON defaultOptions ''ProximityRequirement
deriveJSON defaultOptions ''ProximitySensorType
deriveJSON defaultOptions ''ProximitySensor
deriveJSON defaultOptions ''DamageSensor
instance ToJSONKey SensorType
instance FromJSONKey SensorType
-22
View File
@@ -1,22 +0,0 @@
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.Machine.Sensor.Type where
import Data.Aeson
import Data.Aeson.TH
data SensorType
= LaserSensor
| ElectricSensor
| ThermalSensor
| PhysicalSensor
deriving (Eq, Ord, Show, Read, Bounded, Enum)
deriveJSON defaultOptions ''SensorType
instance ToJSONKey SensorType
instance FromJSONKey SensorType