Modify analyser sounds

This commit is contained in:
2022-03-22 18:42:48 +00:00
parent 7b842bca4f
commit 72a1399da0
10 changed files with 176 additions and 160 deletions
+4 -5
View File
@@ -61,7 +61,7 @@ analyser' starts sucs fails afters upf pslight psmc = extTrigLitPos pslight $ \t
TerminalParams
{ _termDisplayedLines = []
, _termFutureLines =
map simpleline topflush
map simpleline (topFlushStrings allstrings)
++ map simpleline starts
++ [testline' (_mcID mc)]
++ map simpleline afters
@@ -72,7 +72,6 @@ analyser' starts sucs fails afters upf pslight psmc = extTrigLitPos pslight $ \t
(\mc -> upf mc . (triggers . ix (fromJust $ _plMID tp) .~ const (_sensToggle $ _mcSensor mc))
)
allstrings = sucs : fails : afters ++ starts
topflush = [replicate i ' ' ++ "*" | i <- [0,3 .. maximum (map length allstrings)]]
simpleline str = TerminalLineDisplay {_tlPause = 0, _tlString = const (str,white)}
testline' mcid = TerminalLineDisplay 0 (testline mcid)
testline mcid w = case w ^? machines . ix mcid . mcSensor . sensToggle of
@@ -124,9 +123,9 @@ analyserTest t mc w = case
(_,True,_,_) -> w
(_,False,True,True) -> w
& machines . ix (_mcID mc) . mcSensor . sensToggle .~ True
& playsound dededaS
& playsound dedaS
& machines . ix (_mcID mc) . mcSensor . sensCloseToggle .~ IsClose
(NotClose,_,False,True) -> w & playsound dededumS
(NotClose,_,False,True) -> w & playsound dedumS
& machines . ix (_mcID mc) . mcSensor . sensCloseToggle .~ IsClose
(_,_,_,False) -> w & machines . ix (_mcID mc) . mcSensor . sensCloseToggle .~ NotClose
_ -> w
@@ -136,7 +135,7 @@ analyserTest t mc w = case
sens = _mcSensor mc
testYouHave :: CombineType -> Machine -> World -> World
testYouHave ct = analyserTest (\w -> any (\itm -> _itType itm == ct) (_crInv (you w)))
testYouHave ct = analyserTest (any (\itm -> _itType itm == ct) . _crInv . you )
testYourHealth :: Int -> Machine -> World -> World
testYourHealth hp = analyserTest (\w -> _crHP (you w) >= hp)