Move towards simplifying terminal lines/effects

This commit is contained in:
2025-08-15 11:55:56 +01:00
parent 91d19e7c42
commit 56f4670493
12 changed files with 175 additions and 145 deletions
+6 -4
View File
@@ -17,6 +17,8 @@ module Dodge.Terminal (
terminalReturnEffect,
) where
import Dodge.Data.WorldEffect
import Dodge.Data.Terminal.Status
import Color
--import Control.Monad
import Data.Char
@@ -51,7 +53,7 @@ connectionBlurbLines tls =
]
++ tls
++ [ TerminalLineDisplay 10 (TerminalLineConst "READY FOR INPUT" termTextColor)]
++ [TerminalLineTerminalEffect 0 (TmTmSetStatus (TerminalTextInput ""))]
++ [TerminalLineEffect 0 (TmTmSetStatus (TerminalTextInput ""))]
quitCommand :: TerminalCommand
quitCommand =
@@ -212,7 +214,7 @@ disconnectTerminal tm =
(cWorld . lWorld . terminals . ix (_tmID tm) . tmStatus .~ TerminalOff)
. exitTerminalSubInv
. ( cWorld . lWorld . terminals . ix (_tmID tm) . tmFutureLines
.~ [TerminalLineTerminalEffect 0 TmTmClearDisplayedLines]
.~ [TerminalLineEffect 0 TmTmClearDisplayedLines]
)
exitTerminalSubInv :: World -> World
@@ -255,10 +257,10 @@ commandFutureLines s tm w = fromMaybe [errline "^ Invalid command"] $ do
OneArgument argtype m ->
let setpartial
| null (_tmPartialCommand tm) =
TerminalLineTerminalEffect 0 (TmTmSetPartialCommand (Just command)) :
TerminalLineEffect 0 (TmTmSetPartialCommand (Just command)) :
makeTermPara ("Expects " ++ argtype ++ " as an argument")
| otherwise =
TerminalLineTerminalEffect 0 (TmTmSetPartialCommand Nothing) :
TerminalLineEffect 0 (TmTmSetPartialCommand Nothing) :
makeTermPara "No argument input, cancelling"
in Just $
fromMaybe setpartial $