Add looping sound, add sound to terminals

This commit is contained in:
2022-03-16 09:23:17 +00:00
parent 5623747b01
commit 5aeb04ba05
24 changed files with 156 additions and 133 deletions
+16 -24
View File
@@ -46,30 +46,16 @@ triggerSwitch col ps = psPtCont ps (PutTrigger (const False))
oneff tid = triggers . ix tid .~ const True
offeff tid = triggers . ix tid .~ const False
putLitButtonID :: Color -> Point2 -> Float -> (Int -> Maybe Placement) -> Placement
putLitButtonID col p a subpl = mntLSOn aShape (Just col) ls p'' (addZ 40 p')
$ contToIDCont
$ \lsid -> jps0 (PutButton (makeButton col (changeLight lsid)) {_btPos = p, _btRot = a})
subpl
where
p' = p -.- 30 *.* vNormal (unitVectorAtAngle a)
p'' = p +.+ 10 *.* vNormal (unitVectorAtAngle a)
changeLight lsid = lightSources . ix lsid . lsParam . lsCol .~ V3 0 0.5 0
ls = lsRadCol 75 (V3 0.5 0 0)
putLitButOnPos :: Color
-> (RoomPos -> Room -> Maybe (PlacementSpot,RoomPos))
-> (Int -> Maybe Placement) -> Placement
putLitButOnPos col f subpl
= plSpot .~ thePS $ mntLSOn aShape (Just col) ls 0 (V3 0 (-40) 40)
$ \plmnt -> let lsid = fromJust $ _plMID plmnt
in jps0 (PutButton (makeButton col (changeLight lsid)) {_btPos = V2 0 (-1), _btRot = pi})
-> PlacementSpot
-> (Placement -> Maybe Placement) -> Placement
putLitButOnPos col theps subpl
= plSpot .~ theps $ mntLSOn aShape (Just col) ls 0 (V3 0 (-40) 40)
$ \plmnt -> jps0' (PutButton (makeButton col (changeLight . fromJust $ _plMID plmnt)) {_btPos = V2 0 (-1), _btRot = pi})
subpl <&> plSpot .~ _plSpot plmnt
where
changeLight lsid = lightSources . ix lsid . lsParam . lsCol .~ V3 0 0.5 0
ls = lsRadCol 75 (V3 0.5 0 0)
thePS = PSPos f (const id) Nothing
-- creates a lit external trigger, passes the trigger placement forward
extTrigLitPos :: PlacementSpot -> (Placement -> Maybe Placement) -> Placement
@@ -92,13 +78,19 @@ extTrigLitPos ps f = psPtCont ps (PutTrigger (const False))
putLitButOnPosExtTrig :: Color
-> PlacementSpot
-> Placement
putLitButOnPosExtTrig col thePS
putLitButOnPosExtTrig col thePS = putLitButOnPosExtTrig' col thePS (const . const . const Nothing)
putLitButOnPosExtTrig' :: Color
-> PlacementSpot
-> (Placement -> Placement -> Placement -> Maybe Placement)
-> Placement
putLitButOnPosExtTrig' col thePS cnt
= psPtCont thePS (PutTrigger (const False))
$ \tp -> Just $ plSpot .~ _plSpot tp $ mntLSOn aShape (Just col) ls 0 (V3 0 (-40) 40)
$ \plmnt -> let lsid = fromJust $ _plMID plmnt
in jps0 (PutButton (makeButton col (changeLight lsid . oneff (trigid tp)))
{_btPos = V2 0 (-1), _btRot = pi})
(const Nothing) <&> plSpot .~ _plSpot plmnt
$ \plmnt -> jps0' (PutButton
(makeButton col (changeLight (fromJust $ _plMID plmnt) . oneff (trigid tp)))
{_btPos = V2 0 (-1), _btRot = pi})
(cnt tp plmnt) <&> plSpot .~ _plSpot plmnt
where
trigid tp = fromJust $ _plMID tp
oneff tid = triggers . ix tid .~ const True
+3 -3
View File
@@ -53,8 +53,8 @@ damageUsing dt dm
| otherwise = Right 0
sensorSPic :: Float -> (PaletteColor,DecorationShape) -> Machine -> SPic
sensorSPic wdth (pc,ds) _ = ( (colorSH yellow $ upperPrismPoly 25 (square wdth))
<> decorationToShape ds wdth wdth 25 col col
, mempty )
sensorSPic wdth (pc,ds) _ = noPic
$ colorSH yellow (upperPrismPoly 25 (square wdth))
<> decorationToShape ds wdth wdth 25 col col
where
col = paletteToColor pc
+2 -2
View File
@@ -1,4 +1,4 @@
{-# LANGUAGE TupleSections #-}
--{-# LANGUAGE TupleSections #-}
module Dodge.Placement.Instance.Terminal
( putTerminal
) where
@@ -17,7 +17,7 @@ import Shape
import Data.Maybe
putTerminal :: (GenParams -> TerminalParams) -> Placement
putTerminal f = PlacementGenUpdate g $ ps0PushPS (PutButton $ thebutton)
putTerminal f = PlacementGenUpdate g $ ps0PushPS (PutButton thebutton)
$ \pl -> Just $ pt0 (PutMachine terminalColor (reverse $ square 10) defaultMachine
{ _mcDraw = drawTerminal
, _mcHP = 100