48 lines
1.3 KiB
Haskell
48 lines
1.3 KiB
Haskell
{-# LANGUAGE DeriveGeneric #-}
|
|
{-# LANGUAGE DeriveAnyClass #-}
|
|
{-# LANGUAGE StrictData #-}
|
|
{-# LANGUAGE TemplateHaskell #-}
|
|
|
|
module Dodge.Data.Machine.Sensor where
|
|
|
|
import Flat
|
|
import LinearHelp ()
|
|
import Dodge.Data.GenParams
|
|
import Color
|
|
import Control.Lens
|
|
import Data.Aeson
|
|
import Data.Aeson.TH
|
|
import Dodge.Data.Item.Combine
|
|
import Dodge.Data.Damage.Type
|
|
|
|
data Sensor
|
|
= DamageSensor
|
|
{ _sensToggle :: Bool
|
|
, _sensAmount :: Int
|
|
, _sensType :: DamageType
|
|
, _sensDraw :: (PaletteColor, DecorationShape)
|
|
, _sensThreshold :: Int
|
|
}
|
|
| ProximitySensor
|
|
{ _proxStatus :: CloseToggle
|
|
, _proxDist :: Float
|
|
, _proxRequirement :: ProximityRequirement
|
|
, _sensToggle :: Bool
|
|
}
|
|
deriving (Eq, Ord, Show, Read, Generic, Flat)
|
|
|
|
data ProximityRequirement
|
|
= RequireHealth {_proxReqMinHealth :: Int}
|
|
| RequireEquipment {_proxReqEquipment :: ItemBaseType}
|
|
| RequireImpossible
|
|
deriving (Eq, Ord, Show, Read, Generic, Flat)
|
|
|
|
data CloseToggle = NotClose | IsClose
|
|
deriving (Eq, Ord, Show, Read, Generic, Flat)
|
|
|
|
makeLenses ''Sensor
|
|
makeLenses ''ProximityRequirement
|
|
deriveJSON defaultOptions ''Sensor
|
|
deriveJSON defaultOptions ''ProximityRequirement
|
|
deriveJSON defaultOptions ''CloseToggle
|