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
+33
View File
@@ -0,0 +1,33 @@
module Dodge.Machine.Draw
where
import Dodge.Placement.Instance.Sensor
import Dodge.Placement.Instance.Turret
import Shape
import Picture
import Geometry
import Dodge.Data.Machine
import ShapePicture
drawMachine :: MachineDraw -> Machine -> SPic
drawMachine md = case md of
MachineDrawMempty -> const mempty
MachineDrawTerminal -> terminalSPic
MachineDrawTurret -> drawTurret
MachineDrawDamageSensor w pcds -> sensorSPic w pcds
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