Implement "tab" button in terminal

This commit is contained in:
2025-08-17 00:12:05 +01:00
parent 76b6cda19b
commit 24027367dc
7 changed files with 43 additions and 29 deletions
+21 -21
View File
@@ -5,19 +5,17 @@ module Dodge.WorldEffect (
lineOutputTerminal,
) where
import qualified Data.ListTrie.Patricia.Map.Enum as PTE
--import Dodge.DoubleTree
import Dodge.Data.Terminal.Status
import Dodge.Item.Grammar
import Dodge.Creature.Impulse.UseItem
import Dodge.BlBl
import Dodge.HeldUse
import Data.Foldable
import qualified Data.Map.Strict as M
import Data.Maybe
import Dodge.BlBl
import Dodge.Creature.Impulse.UseItem
import Dodge.Data.Terminal.Status
import Dodge.Data.World
import Dodge.Default
import Dodge.HeldUse
import Dodge.Inventory.Lock
import Dodge.Item.Grammar
--import Dodge.Item.Location
import Dodge.SoundLogic
import Dodge.Terminal
@@ -38,12 +36,13 @@ doWdWd we = case we of
TorqueCr x cid -> torqueCr x cid
SoundStart so p sid mi -> soundStart so p sid mi
WdWdNegateTrig trid -> cWorld . lWorld . triggers . ix trid %~ not
-- WdWdFromItCrixWdWd it crid f -> \w -> fromMaybe w $ do
-- cr <- w ^? cWorld . lWorld . creatures . ix crid
-- return $ doItCrWdWd f it cr w
-- WdWdFromItCrixWdWd it crid f -> \w -> fromMaybe w $ do
-- cr <- w ^? cWorld . lWorld . creatures . ix crid
-- return $ doItCrWdWd f it cr w
MakeTempLight _ 0 -> id
MakeTempLight x t -> (cWorld . lWorld . lights .:~ x)
. (cWorld . lWorld . worldEvents .:~ MakeTempLight x (t-1))
MakeTempLight x t ->
(cWorld . lWorld . lights .:~ x)
. (cWorld . lWorld . worldEvents .:~ MakeTempLight x (t -1))
UseInvItem invid pt -> \w -> fromMaybe w (useItem invid pt w)
WdWdBurstFireRepetition cid invid -> \w -> fromMaybe w $ do
cr <- w ^? cWorld . lWorld . creatures . ix cid
@@ -59,9 +58,9 @@ accessTerminal mtmid w = fromMaybe w $ do
& cWorld . lWorld . terminals . ix tmid %~ tryToBoot
where
tryToBoot tm = case _tmStatus tm of
TerminalTextInput {} -> tm
TerminalTextInput{} -> tm
TerminalBusy -> tm
TerminalPressTo {} -> tm
TerminalPressTo{} -> tm
TerminalOff ->
tm
& tmFutureLines .~ _tmBootLines tm
@@ -99,14 +98,15 @@ doTmWdWd tmwdwd = case tmwdwd of
TmTmSetStatus x -> \tm -> fromMaybe id $ do
tid <- tm ^? tmID
return $ cWorld . lWorld . terminals . ix tid . tmStatus .~ x
TmDisplayCommands -> \tm -> fromMaybe id $ do
tid <- tm ^? tmID
return $ cWorld . lWorld . terminals . ix tid . tmFutureLines .~
makeColorTermPara commandColor
(unwords (map fst (PTE.toList $ getCommands tm)))
-- TmTmSetPartialCommand x -> \tm -> fromMaybe id $ do
-- TmDisplayCommands -> \tm -> fromMaybe id $ do
-- tid <- tm ^? tmID
-- return $ cWorld . lWorld . terminals . ix tid . tmPartialCommand .~ x
-- return $ cWorld . lWorld . terminals . ix tid %~ tabComplete ""
--return $ cWorld . lWorld . terminals . ix tid . tmFutureLines .~
-- makeColorTermPara commandColor
-- (unwords (map fst (PTE.toList $ getCommands tm)))
-- TmTmSetPartialCommand x -> \tm -> fromMaybe id $ do
-- tid <- tm ^? tmID
-- return $ cWorld . lWorld . terminals . ix tid . tmPartialCommand .~ x
TmWdId -> const id
TmWdWdDisconnectTerminal -> disconnectTerminal
TmWdWdTermSound sid -> \tm w ->