Improve sensor terminal messages

This commit is contained in:
2025-09-18 10:18:53 +01:00
parent 1564b1c721
commit 4494e47b43
9 changed files with 176 additions and 156 deletions
+8
View File
@@ -6,6 +6,7 @@ module Dodge.WorldEffect (
doTmWdWd,
) where
import Dodge.Terminal
import NewInt
import Control.Monad
import Data.Foldable
@@ -93,6 +94,7 @@ doTmWdWd tmwdwd = case tmwdwd of
TmWdId -> const id
TmWdWdPowerDownTerminal -> resetTerminal TerminalOff
TmWdWdDeactivateTerminal -> resetTerminal TerminalDeactivated
TmWdWdLeaveTerminal -> leaveResetQuitTerminal
TmWdWdTermSound sid -> \tm w -> fromMaybe w $ do
tpos <- w ^? cWorld . lWorld . buttons . ix (_tmButtonID tm) . btPos
return $ soundStart TerminalSound tpos sid Nothing w
@@ -105,6 +107,12 @@ resetTerminal x tm =
. (cWorld . lWorld . terminals . ix (_tmID tm) . tmDisplayedLines .~ [])
. exitTerminalSubInv
leaveResetQuitTerminal :: Terminal -> World -> World
leaveResetQuitTerminal tm =
(cWorld . lWorld . terminals . ix (_tmID tm) . tmFutureLines
.~ (tlSetStatus (TerminalPressTo "QUIT")) <> tlDoEffect TmWdWdLeaveTerminal)
. exitTerminalSubInv
exitTerminalSubInv :: World -> World
exitTerminalSubInv w = case w ^? hud . subInventory . termID of
Just _ -> w & hud . subInventory .~ NoSubInventory