Allow for inventory item bolding

This commit is contained in:
2025-12-09 22:46:57 +00:00
parent bf8c538491
commit 851b26262a
18 changed files with 274 additions and 225 deletions
+18 -3
View File
@@ -1,4 +1,4 @@
--{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE LambdaCase #-}
module Dodge.WorldEffect (
doWdWd,
@@ -6,6 +6,7 @@ module Dodge.WorldEffect (
doTmWdWd,
) where
import Color
import Dodge.Terminal
import NewInt
import Control.Monad
@@ -26,7 +27,7 @@ import LensHelp
import System.Random
doWdWd :: WdWd -> World -> World
doWdWd we = case we of
doWdWd = \case
NoWorldEffect -> id
SetTrigger bool tid -> cWorld . lWorld . triggers . ix tid .~ bool
SetLSCol col lsid -> cWorld . lWorld . lightSources . ix lsid . lsParam . lsCol .~ col
@@ -93,7 +94,7 @@ doDeathToggle :: TerminalToggle -> IM.IntMap Bool -> IM.IntMap Bool
doDeathToggle (TerminalToggle trid f) = ix trid %~ doBlBl f
doTmWdWd :: TmWdWd -> Terminal -> World -> World
doTmWdWd tmwdwd = case tmwdwd of
doTmWdWd = \case
TmTmClearDisplayedLines -> \tm ->
cWorld . lWorld . terminals . ix (tm ^. tmID) . tmDisplayedLines .~ []
TmTmSetStatus x -> \tm -> cWorld . lWorld . terminals . ix (tm ^. tmID) . tmStatus .~ x
@@ -106,6 +107,20 @@ doTmWdWd tmwdwd = case tmwdwd of
return $ soundStart TerminalSound tpos sid Nothing w
TmWdWdDoDeathTriggers -> doDeathTriggers
TmWdWdfromWdWd f -> \_ -> doWdWd f
TmDistributeAmmo -> tmDistributeAmmo
tmDistributeAmmo :: Terminal -> World -> World
tmDistributeAmmo tm w = fromMaybe w $ do
let mid = tm ^. tmMachineID
sid <- w ^? cWorld . lWorld . machines . ix mid
. mcType . mcdStorageMachine . _Just
McStorage atype aamount <- w ^? cWorld . lWorld . machines . ix sid . mcType
return $ w & cWorld . lWorld . terminals . ix (tm ^. tmID) . tmStatus
.~ TerminalPressTo ""
& cWorld . lWorld . terminals . ix (tm ^. tmID) . tmFutureLines .~
[TLine 1 [TerminalLineConst "" yellow] (TmTmSetStatus (TerminalPressTo "RETRY"))
,TLine 1 [TerminalLineConst "" white] TmWdWdPowerDownTerminal
]
resetTerminal :: TerminalStatus -> Terminal -> World -> World
resetTerminal x tm =