44 lines
1.2 KiB
Haskell
44 lines
1.2 KiB
Haskell
module Dodge.Placement.Instance.Sensor (
|
|
lightSensor,
|
|
damageSensor,
|
|
) where
|
|
|
|
import Color
|
|
import Control.Lens
|
|
import qualified Data.Map.Strict as M
|
|
import Dodge.Data.GenWorld
|
|
import Dodge.Default
|
|
import Dodge.LevelGen.Data
|
|
import Dodge.LightSource
|
|
import Geometry
|
|
|
|
damageSensor ::
|
|
DamageType ->
|
|
Float ->
|
|
Maybe Int ->
|
|
PlacementSpot ->
|
|
Placement
|
|
damageSensor dt wdth mtrid ps = pContID ps (PutLS $ lsPosCol (V3 0 0 30) 0.1) $
|
|
\lsid -> Just $
|
|
spNoID ps $
|
|
PutUsingGenParams $
|
|
\gw ->
|
|
(,) gw $
|
|
PutMachine
|
|
(reverse $ square wdth)
|
|
( defaultMachine
|
|
& mcColor .~ yellow
|
|
& mcMounts . at ObTrigger .~ mtrid
|
|
& mcMounts . at ObLightSource ?~ lsid
|
|
& mcType . _McSensor .~ DamageSensor False 0 dt (_sensorCoding (_genParams (_cWorld gw)) M.! dt)
|
|
)
|
|
defaultSensorWall
|
|
|
|
lightSensor ::
|
|
Float ->
|
|
Maybe Int ->
|
|
PlacementSpot ->
|
|
Placement
|
|
lightSensor = damageSensor LASERING
|
|
|