Simplify terminal boot program

This commit is contained in:
2025-08-14 19:46:07 +01:00
parent 198b7acc78
commit 5b720cb82c
6 changed files with 17 additions and 13 deletions
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -31,7 +31,7 @@ data TerminalBootProgram
data Terminal = Terminal
{ _tmID :: Int
, _tmBootProgram :: TerminalBootProgram
, _tmBootLines :: [TerminalLine]
, _tmButtonID :: Int
, _tmMachineID :: Int
, _tmName :: String
+1 -1
View File
@@ -10,7 +10,7 @@ defaultTerminal :: Terminal
defaultTerminal =
Terminal
{ _tmID = 0
, _tmBootProgram = TerminalBootMempty
, _tmBootLines = []
, _tmButtonID = 0
, _tmMachineID = 0
, _tmName = "TESTTERMINAL"
+5 -1
View File
@@ -1,5 +1,6 @@
module Dodge.Room.RezBox where
import Dodge.Terminal
import Control.Monad
import qualified Data.Set as S
import Dodge.Cleat
@@ -23,7 +24,10 @@ import RandomHelp
rezBox :: LightSource -> Room
rezBox ls =
roomRect 40 60 1 1
& rmPmnts .~ [sPS (V2 20 1) 0 $ PutLS ls]
& rmPmnts .~ [sPS (V2 20 1) 0 $ PutLS ls
, putMessageTerminal terminalColor (simpleTermMessage ["HELLOW","THIS"])
& plSpot .~ PS (V2 20 0) 0
]
& restrictInLinks (\(V2 _ h, _) -> h < 1)
& restrictOutLinks (\(V2 _ h, _) -> h > 59)
& rmName .~ "rezBox"
+3 -3
View File
@@ -40,7 +40,7 @@ basicTerminal =
, _tmTitle = "TERMINAL"
, _tmScrollCommands = [quitCommand]
, _tmWriteCommands = [helpCommand, commandsCommand]
, _tmBootProgram = TerminalBootLines connectionBlurb
, _tmBootLines = connectionBlurb
, _tmDeathEffect = TmWdWdDoDeathTriggers
}
@@ -127,7 +127,7 @@ makeColorTermPara :: Color -> String -> [TerminalLine]
makeColorTermPara col = map (makeColorTermLine col) . makeParagraph 55
makeColorTermLine :: Color -> String -> TerminalLine
makeColorTermLine col str = TerminalLineDisplay 0 $ TerminalLineConst str col
makeColorTermLine col str = TerminalLineDisplay 1 $ TerminalLineConst str col
commandColor :: Color
commandColor = yellow
@@ -251,7 +251,7 @@ togglesToEffects = fmap f . _tmToggles
f tt = [TerminalLineEffect 0 $ TmWdWdfromWdWd $ WdWdNegateTrig (_ttTriggerID tt)]
simpleTermMessage :: [String] -> Terminal
simpleTermMessage strs = defaultTerminal & tmFutureLines .~ map makeTermLine strs
simpleTermMessage strs = defaultTerminal & tmBootLines .~ map makeTermLine strs
commandFutureLines :: String -> Terminal -> World -> [TerminalLine]
commandFutureLines s tm w = fromMaybe [errline "^ Invalid command"] $ do
+6 -6
View File
@@ -61,7 +61,7 @@ accessTerminal mtmid w = fromMaybe w $ do
TerminalBusy -> tm
TerminalOff ->
tm
& tmFutureLines .~ doTerminalBootProgram (_tmBootProgram tm) tm w
& tmFutureLines .~ _tmBootLines tm
& tmStatus .~ TerminalBusy
torqueCr :: Float -> Int -> World -> World
@@ -79,7 +79,7 @@ lineOutputTerminal tls =
, _tmTitle = "TERMINAL"
, _tmScrollCommands = [quitCommand]
, _tmWriteCommands = [helpCommand, commandsCommand]
, _tmBootProgram = TerminalBootLines $ connectionBlurbLines tls
, _tmBootLines = connectionBlurbLines tls
, _tmDeathEffect = TmWdWdDoDeathTriggers
}
@@ -91,10 +91,10 @@ doDeathTriggers tm = cWorld . lWorld . triggers %~ flip (foldl' $ flip doDeathTo
doDeathToggle :: TerminalToggle -> IM.IntMap Bool -> IM.IntMap Bool
doDeathToggle (TerminalToggle trid f) = ix trid %~ doBlBl f
doTerminalBootProgram :: TerminalBootProgram -> Terminal -> World -> [TerminalLine]
doTerminalBootProgram tbp = case tbp of
TerminalBootMempty -> \_ _ -> []
TerminalBootLines ls -> \_ _ -> ls
--doTerminalBootProgram :: TerminalBootProgram -> Terminal -> World -> [TerminalLine]
--doTerminalBootProgram tbp = case tbp of
-- TerminalBootMempty -> \_ _ -> []
-- TerminalBootLines ls -> \_ _ -> ls
doTmWdWd :: TmWdWd -> Terminal -> World -> World
doTmWdWd tmwdwd = case tmwdwd of