35 lines
1.0 KiB
Haskell
35 lines
1.0 KiB
Haskell
module Dodge.Placement.Instance.Sensor (
|
|
lightSensor,
|
|
damageSensor,
|
|
) where
|
|
|
|
import Control.Lens
|
|
import Dodge.Data.GenWorld
|
|
import Dodge.Default
|
|
import Dodge.LevelGen.PlacementHelper
|
|
import Dodge.LightSource
|
|
import Geometry
|
|
|
|
damageSensor :: SensorType -> Float -> Maybe Int -> PlacementSpot -> Placement
|
|
damageSensor dt wdth mtrid ps = pContID ps (PutLS $ lsPosCol (V3 0 0 30) 0.1) $
|
|
\lsid ->
|
|
psPtJpl ps $
|
|
PutMachine
|
|
(reverse $ square wdth)
|
|
( defaultMachine
|
|
& mcSkin .~ mattype
|
|
& mcMounts . at OTTrigger .~ mtrid
|
|
& mcMounts . at OTLightSource ?~ lsid
|
|
& mcType .~ McDamSensor (DamSensor 0 dt)
|
|
)
|
|
Nothing
|
|
where
|
|
mattype = case dt of
|
|
LaserSensor -> Photovoltaic
|
|
ElectricSensor -> LightningRod
|
|
ThermalSensor -> Pyroelectric
|
|
PhysicalSensor -> Piezoelectric
|
|
|
|
lightSensor :: Float -> Maybe Int -> PlacementSpot -> Placement
|
|
lightSensor = damageSensor LaserSensor
|