Refactor machines

This commit is contained in:
2022-07-24 20:55:44 +01:00
parent d6a94ec4bc
commit 24531b75a1
10 changed files with 110 additions and 59 deletions
+1 -1
View File
@@ -53,7 +53,7 @@ analyser proxreq pslight psmc = extTrigLitPos pslight $ \tp ->
-- = triggers . ix (fromJust $ _plMID tp) .~ const (_sensToggle $ _mcSensor mc)
themachine = defaultMachine & mcColor .~ aquamarine
-- & mcUpdate .~ mcProximitySensorUpdate
& mcDraw .~ terminalSPic
& mcDraw .~ MachineDrawTerminal
& mcHP .~ 100
& mcSensor .~ defaultProximitySensor {_proxRequirement = proxreq}
+2 -1
View File
@@ -1,6 +1,7 @@
module Dodge.Placement.Instance.Sensor
( lightSensor
, damageSensor
, sensorSPic -- this should be moved
) where
import Color
import Dodge.LightSource
@@ -28,7 +29,7 @@ damageSensor dt wdth mtrid ps = pContID ps (PutLS $ lsPosCol (V3 0 0 30) 0.1)
& mcColor .~ yellow
& mcMounts . at ObTrigger .~ mtrid
& mcMounts . at ObLightSource ?~ lsid
& mcDraw .~ sensorSPic wdth (_sensorCoding (_genParams gw) M.! dt)
& mcDraw .~ MachineDrawDamageSensor wdth (_sensorCoding (_genParams gw) M.! dt)
& mcSensor .~ DamageSensor False 0 dt
)
defaultSensorWall
+1 -18
View File
@@ -4,7 +4,6 @@ module Dodge.Placement.Instance.Terminal
, putTerminal
, simpleTermMessage
, terminalColor
, terminalSPic
, accessTerminal
) where
import Dodge.Data
@@ -48,7 +47,7 @@ putTerminal mc tm
putMessageTerminal :: Color -> Terminal -> Placement
putMessageTerminal col = putTerminal $ defaultMachine
& mcColor .~ col
& mcDraw .~ terminalSPic
& mcDraw .~ MachineDrawTerminal --terminalSPic
& mcHP .~ 100
termButton :: Button
@@ -68,22 +67,6 @@ termButton = Button
terminalColor :: Color
terminalColor = dark magenta
terminalSPic :: Machine -> SPic
terminalSPic = noPic . terminalShape
terminalShape :: Machine -> Shape
terminalShape mc = colorSH col (prismPoly
[V3 10 10 20, V3 (-10) 10 20, V3 (-10) (-10) 10, V3 10 (-10) 10]
[V3 10 10 0, V3 (-10) 10 0, V3 (-10) (-10) 0, V3 10 (-10) 0]
)
<> colorSH black (prismPoly
[V3 8 8 20, V3 (-8) 8 20, V3 0 (-8) 10]
[V3 8 8 19, V3 (-8) 8 19, V3 0 (-8) 9]
--[V3 8 8 20, V3 (-8) 8 20, V3 (-8) (-8) 10, V3 8 (-8) 10]
--[V3 8 8 19, V3 (-8) 8 19, V3 (-8) (-8) 9, V3 8 (-8) 9]
)
where
col = _mcColor mc
accessTerminal :: Maybe Int -> World -> World
accessTerminal mtmid w = case mtmid of
+1 -1
View File
@@ -22,7 +22,7 @@ putLasTurret :: Float -> Placement
putLasTurret rotSpeed = sps0 $ PutMachine (reverse $ square wdth)
(defaultMachine
& mcColor .~ blue
& mcDraw .~ drawTurret
& mcDraw .~ MachineDrawTurret
& mcType .~ (lasTurret & tuTurnSpeed .~ rotSpeed)
& mcHP .~ 50000
)