This commit is contained in:
2022-07-14 21:32:19 +01:00
parent 893a3d5f17
commit 7d7ed6689d
10 changed files with 173 additions and 188 deletions
+1 -1
View File
@@ -44,7 +44,7 @@ analyser
-> PlacementSpot
-> Placement
analyser proxreq pslight psmc = extTrigLitPos pslight $ \tp ->
Just $ plSpot .~ psmc $ putTerminal''
Just $ plSpot .~ psmc $ putTerminal
(themachine & mcMounts . at ObTrigger .~ _plMID tp)
tparams -- (linksensortotrigger tp)
where
+14 -35
View File
@@ -1,8 +1,7 @@
--{-# LANGUAGE TupleSections #-}
module Dodge.Placement.Instance.Terminal
( putTerminal
, putTerminal'
, putTerminal''
( putMessageTerminal
, putTerminal
, simpleTermMessage
, terminalColor
, terminalSPic
@@ -23,19 +22,15 @@ import Shape
import Data.Maybe
putTerminal''
:: Machine
-> Terminal
-- -> (Int -> Machine -> World -> World) -- | machine update, takes button id as input
-> Placement
putTerminal'' mc tm --mcf
putTerminal :: Machine -> Terminal -> Placement
putTerminal mc tm
= ps0PushPS (PutTerminal tm)
$ \tmpl -> Just $ ps0PushPS (PutButton termButton)
$ \btpl -> Just $ pt0 (PutMachine (reverse $ square 10)
(mc -- & mcUpdate %~ (\fmu mc' -> mcf (fromJust $ _plMID btpl) mc' . fmu mc') . machineAddSound fridgeHumS
& mcMounts . at ObButton ?~ fromJust (_plMID btpl)
& mcCloseSound ?~ fridgeHumS
) )
$ \btpl -> Just $ pt0
(PutMachine (reverse $ square 10)
(mc & mcMounts . at ObButton ?~ fromJust (_plMID btpl)
& mcCloseSound ?~ fridgeHumS)
)
$ \mcpl -> Just $ sps0 $ PutWorldUpdate $ const (setids tmpl btpl mcpl)
where
setids tmpl btpl mcpl w = w
@@ -48,25 +43,11 @@ putTerminal'' mc tm --mcf
btid = fromJust (_plMID btpl)
mcid = fromJust (_plMID mcpl)
putTerminal'
:: Color
-> Terminal
-- -> (Int -> Machine -> World -> World) -- | machine update, takes button id as input
-> Placement
putTerminal' col = putTerminal'' (defaultMachine
& mcColor .~ col)
{ _mcDraw = noPic . terminalShape
, _mcHP = 100
, _mcSensor = defaultProximitySensor
}
putTerminal :: Color -> Terminal -> Placement
putTerminal col f = putTerminal'' (mc & mcColor .~ col) f -- (\_ -> basicMachineUpdate $ const id)
where
mc = defaultMachine
{ _mcDraw = terminalSPic
, _mcHP = 100
}
putMessageTerminal :: Color -> Terminal -> Placement
putMessageTerminal col = putTerminal $ defaultMachine
& mcColor .~ col
& mcDraw .~ terminalSPic
& mcHP .~ 100
termButton :: Button
termButton = Button
@@ -86,11 +67,9 @@ 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
[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]