Separate out concrete part of world

This commit is contained in:
2022-07-25 12:10:50 +01:00
parent 3354d108be
commit b2efbd2b3e
134 changed files with 933 additions and 930 deletions
+7 -7
View File
@@ -152,7 +152,7 @@ guardDisconnected tm w w' = case _tmStatus tm of
TerminalBusy -> w
TerminalReady -> w'
getDamageCoding :: World -> M.Map String [TerminalLine]
getDamageCoding = decodedtmap . _sensorCoding . _genParams
getDamageCoding = decodedtmap . _sensorCoding . _genParams . _cWorld
sensorInfoMap :: Terminal -> World -> M.Map String [TerminalLine]
sensorInfoMap tm w = M.fromList
@@ -163,7 +163,7 @@ sensorInfoMap tm w = M.fromList
]
getSensor :: Show a => (Sensor -> a) -> Terminal -> World -> [TerminalLine]
getSensor f tm w = maybe [] (makeTermPara . map toUpper . show . f)
(w ^? machines . ix (_tmMachineID tm) . mcSensor)
(w ^? cWorld . machines . ix (_tmMachineID tm) . mcSensor)
toggleCommand :: TerminalCommand
toggleCommand = TerminalCommand
@@ -185,14 +185,14 @@ sensorCommand = TerminalCommand
disconnectTerminal :: Terminal -> World -> World
disconnectTerminal tm w = w
& terminals . ix (_tmID tm) . tmStatus .~ TerminalOff
& cWorld . terminals . ix (_tmID tm) . tmStatus .~ TerminalOff
& exitTerminalSubInv
& terminals . ix (_tmID tm) . tmFutureLines .~
& cWorld . terminals . ix (_tmID tm) . tmFutureLines .~
[ TerminalLineTerminalEffect 0 TmTmClearDisplayedLines ]
exitTerminalSubInv :: World -> World
exitTerminalSubInv w = case w ^? hud . hudElement . subInventory . termID of
Just _ -> w & hud . hudElement . subInventory .~ NoSubInventory
exitTerminalSubInv w = case w ^? cWorld . hud . hudElement . subInventory . termID of
Just _ -> w & cWorld . hud . hudElement . subInventory .~ NoSubInventory
_ -> w
damageCodeCommand :: TerminalCommand
@@ -205,7 +205,7 @@ damageCodeCommand = TerminalCommand
infoClearInput :: Terminal -> [TerminalLine] -> World -> World
infoClearInput tm tls = terminals . ix (_tmID tm) %~
infoClearInput tm tls = cWorld . terminals . ix (_tmID tm) %~
( (tmInput .~ TerminalInput T.empty True (0,0))
. (tmFutureLines ++.~ tls)
)