Successfully push proximity sensor parameters into data

This commit is contained in:
2022-06-07 10:34:59 +01:00
parent 14acd2ee6a
commit 5117fb2a1a
5 changed files with 42 additions and 39 deletions
+11 -2
View File
@@ -2,9 +2,11 @@
module Dodge.Placement.Instance.Terminal
( putTerminal
, putTerminal'
, putTerminal''
, simpleTermMessage
, topFlushStrings
, terminalColor
, terminalSPic
) where
import Dodge.Data
import Dodge.LevelGen.Data
@@ -18,6 +20,7 @@ import Geometry
import ShapePicture
import LensHelp
import Shape
import ShapePicture
--import Sound.Data
import Data.Maybe
@@ -30,7 +33,7 @@ putTerminal''
putTerminal'' mc tm mcf = ps0PushPS (PutTerminal tm)
$ \tmpl -> Just $ ps0PushPS (PutButton termButton)
$ \btpl -> Just $ pt0 (PutMachine (reverse $ square 10)
(mc & mcUpdate .~ machineAddSound fridgeHumS (mcf (fromJust $ _plMID btpl))
(mc & mcUpdate %~ (\fmu mc' -> (mcf (fromJust $ _plMID btpl) mc' . fmu mc'))
& mcDeath %~ (\fd mc' -> mcKillTerm mc' . (buttons . at (fromJust (_plMID btpl)) .~ Nothing) . fd mc')
) )
$ \mcpl -> Just $ sps0 $ PutWorldUpdate $ const (setids tmpl btpl mcpl)
@@ -45,6 +48,8 @@ putTerminal'' mc tm mcf = ps0PushPS (PutTerminal tm)
btid = fromJust (_plMID btpl)
mcid = fromJust (_plMID mcpl)
-- machineAddSound fridgeHumS
mcKillTerm :: Machine -> World -> World
mcKillTerm mc w = fromMaybe w $ do
tmid <- _mcTermMID mc
@@ -67,7 +72,7 @@ putTerminal :: Color -> Terminal -> Placement
putTerminal col f = putTerminal'' (mc & mcColor .~ col) f (\_ -> basicMachineUpdate $ const id)
where
mc = defaultMachine
{ _mcDraw = noPic . terminalShape
{ _mcDraw = terminalSPic
, _mcHP = 100
, _mcDeath = makeExplosionAt . _mcPos
}
@@ -89,6 +94,10 @@ termButton = Button
terminalColor :: Color
terminalColor = dark magenta
terminalSPic :: Machine -> SPic
--terminalShape _ = upperPrismPoly 15 $ square 10
terminalSPic = noPic . terminalShape
terminalShape :: Machine -> Shape
--terminalShape _ = upperPrismPoly 15 $ square 10
terminalShape mc = colorSH col (prismPoly