Remove parameters from machine damage sensors

This commit is contained in:
2025-09-17 17:33:26 +01:00
parent 103f1e7e99
commit 8721b31811
12 changed files with 497 additions and 175 deletions
+18 -10
View File
@@ -1,9 +1,9 @@
module Dodge.Machine.Draw ( drawMachine) where
module Dodge.Machine.Draw (drawMachine) where
import Dodge.Data.CWorld
import Dodge.Terminal.Color
import Control.Lens
import Data.Maybe
import Dodge.Data.LWorld
import Dodge.Item.Draw.SPic
import Dodge.Item.HeldOffset
import Dodge.Placement.TopDecoration
@@ -11,18 +11,27 @@ import Geometry
import Picture
import Shape
import ShapePicture
import qualified Data.Map.Strict as M
drawMachine :: LWorld -> Machine -> SPic
drawMachine lw mc = case _mcType mc of
drawMachine :: CWorld -> Machine -> SPic
drawMachine cw mc = case _mcType mc of
McStatic -> mempty
McTerminal -> terminalSPic lw mc
McTurret tu -> drawBaseMachine 20 mc <> drawTurret lw tu mc
McDamSensor se -> drawBaseMachine 25 mc <> drawDamSensor se mc
McDamSensor se -> drawBaseMachine 25 mc <> drawDamSensor gp se mc
McProxSensor se -> drawBaseMachine 25 mc <> drawProxSensor se mc
where
lw = cw ^. lWorld
gp = cw ^. cwGen . cwgParams . sensorCoding
drawDamSensor :: DamageSensor -> Machine -> SPic
drawDamSensor sens = case sens of
DamSensor{_sensDraw = pcds} -> sensorSPic pcds
drawDamSensor :: M.Map SensorType (PaletteColor, DecorationShape)
-> DamageSensor -> Machine -> SPic
drawDamSensor gp sens mc = --case sens of
--DamSensor{_sensDraw = pcds} -> sensorSPic pcds
fold $ do
let st = sens ^. sensType
x <- gp ^? ix st
return $ sensorSPic x mc
drawProxSensor :: ProximitySensor -> Machine -> SPic
drawProxSensor sens = case sens of
@@ -70,8 +79,7 @@ drawTurret lw tu mc = fold $ do
return $ overPosSP (turretItemOffset itm tu mc) (itemSPic itm)
sensorSPic :: (PaletteColor, DecorationShape) -> Machine -> SPic
sensorSPic (pc, ds) mc =
noPic $ decorationToShape ds w w 25 col col
sensorSPic (pc, ds) mc = noPic $ decorationToShape ds w w 25 col col
where
col = paletteToColor pc
w = _mcWidth mc