Refactor, try to limit dependencies

This commit is contained in:
2022-07-28 00:59:56 +01:00
parent 8aa5c17ab9
commit 160560af5f
418 changed files with 15104 additions and 13342 deletions
+44 -37
View File
@@ -1,48 +1,55 @@
module Dodge.Placement.Instance.Sensor
( lightSensor
, damageSensor
, sensorSPic -- this should be moved
) where
module Dodge.Placement.Instance.Sensor (
lightSensor,
damageSensor,
sensorSPic, -- this should be moved
) where
import Color
import Dodge.LightSource
import Dodge.Data
import Dodge.LevelGen.Data
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 Dodge.Placement.TopDecoration
import Geometry
import ShapePicture
import Shape
import ShapePicture
import qualified Data.Map.Strict as M
import Control.Lens
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
& mcDraw .~ MachineDrawDamageSensor wdth (_sensorCoding (_genParams (_cWorld gw)) M.! dt)
& mcSensor .~ DamageSensor False 0 dt
)
defaultSensorWall
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
& mcDraw .~ MachineDrawDamageSensor wdth (_sensorCoding (_genParams (_cWorld gw)) M.! dt)
& mcSensor .~ DamageSensor False 0 dt
)
defaultSensorWall
lightSensor :: Float
-> Maybe Int
-> PlacementSpot
-> Placement
lightSensor ::
Float ->
Maybe Int ->
PlacementSpot ->
Placement
lightSensor = damageSensor LASERING
sensorSPic :: Float -> (PaletteColor,DecorationShape) -> Machine -> SPic
sensorSPic wdth (pc,ds) mc = noPic
$ colorSH (_mcColor mc) (upperPrismPoly 25 (square wdth))
<> decorationToShape ds wdth wdth 25 col col
sensorSPic :: Float -> (PaletteColor, DecorationShape) -> Machine -> SPic
sensorSPic wdth (pc, ds) mc =
noPic $
colorSH (_mcColor mc) (upperPrismPoly 25 (square wdth))
<> decorationToShape ds wdth wdth 25 col col
where
col = paletteToColor pc