Add fix bug in terminal destruction effects

This commit is contained in:
2022-06-07 01:25:36 +01:00
parent 1fe41889fe
commit d42538e3c0
13 changed files with 111 additions and 93 deletions
+1 -1
View File
@@ -48,7 +48,7 @@ analyser
analyser upf pslight psmc = extTrigLitPos pslight $ \tp ->
Just $ plSpot .~ psmc $ putTerminal' aquamarine tparams (termupdate tp)
where
tparams = defaultTermParams & tmScrollCommands .:~ sensorCommand
tparams = basicTerminal & tmScrollCommands .:~ sensorCommand
termupdate tp _ mc = upf mc . (triggers . ix (fromJust $ _plMID tp) .~ const (_sensToggle $ _mcSensor mc))
analyserTest :: (World -> Bool) -> Machine -> World -> World
+12 -8
View File
@@ -31,9 +31,9 @@ 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))
& mcDeath %~ (\fd mc' -> mcKillTerm mc . (buttons . at (fromJust (_plMID btpl)) .~ Nothing) . fd mc')
& mcDeath %~ (\fd mc' -> mcKillTerm mc' . (buttons . at (fromJust (_plMID btpl)) .~ Nothing) . fd mc')
) )
$ \mcpl -> Just $ sps0 $ PutWorldUpdate (const $ setids tmpl btpl mcpl)
$ \mcpl -> Just $ sps0 $ PutWorldUpdate $ const (setids tmpl btpl mcpl)
where
setids tmpl btpl mcpl w = w
& terminals . ix tmid . tmButtonID .~ btid
@@ -77,7 +77,7 @@ termButton = Button
{ _btPict = const mempty
, _btPos = 0
, _btRot = 0
, _btEvent = bootTerminal . _btTermMID
, _btEvent = accessTerminal . _btTermMID
, _btID = 0
, _btText = "TERMINAL"
, _btState = BtOff
@@ -104,14 +104,18 @@ terminalShape mc = colorSH col (prismPoly
where
col = _mcColor mc
bootTerminal :: Maybe Int -> World -> World
bootTerminal mtmid w = case mtmid of
accessTerminal :: Maybe Int -> World -> World
accessTerminal mtmid w = case mtmid of
Nothing -> w
Just tmid -> w & hud . hudElement .~ DisplayInventory (DisplayTerminal tmid)
& terminals . ix tmid . tmFutureLines ++.~ _tmProgram tm tm w
& terminals . ix tmid . tmStatus .~ Connected
& terminals . ix tmid . tmInput . tiFocus .~ True
& terminals . ix tmid %~ tryToBoot
where
tm = w ^?! terminals . ix tmid
tryToBoot tm = case _tmStatus tm of
Connected -> tm
Disconnected -> tm
& tmFutureLines ++.~ _tmProgram tm tm w
& tmStatus .~ Connected
simpleTermMessage :: [String] -> Terminal
simpleTermMessage strs = defaultTerminal & tmFutureLines .~ map makeTermLine strs