Add in "linear" lWorld to separate time reversable worlds
This commit is contained in:
@@ -9,7 +9,7 @@ import LensHelp
|
||||
doTerminalEffectLB :: Terminal -> World -> World
|
||||
doTerminalEffectLB tm w = guardDisconnected tm w $
|
||||
fromMaybe w $ do
|
||||
s <- fmap T.unpack $ w ^? cWorld . terminals . ix (_tmID tm) . tmInput . tiText
|
||||
s <- fmap T.unpack $ w ^? cWorld . lWorld . terminals . ix (_tmID tm) . tmInput . tiText
|
||||
if null (words s)
|
||||
then Just $ defocusTerminalInput w
|
||||
else return $ terminalReturnEffect tm w
|
||||
@@ -17,20 +17,20 @@ doTerminalEffectLB tm w = guardDisconnected tm w $
|
||||
terminalReturnEffect :: Terminal -> World -> World
|
||||
terminalReturnEffect tm w = guardDisconnected tm w $
|
||||
fromMaybe w $ do
|
||||
s <- fmap T.unpack $ w ^? cWorld . terminals . ix (_tmID tm) . tmInput . tiText
|
||||
s <- fmap T.unpack $ w ^? cWorld . lWorld . terminals . ix (_tmID tm) . tmInput . tiText
|
||||
return $
|
||||
runTerminalString s tm $
|
||||
w
|
||||
& cWorld . terminals . ix (_tmID tm) . tmFutureLines .~ [makeTermLine ('>' : s)]
|
||||
& cWorld . lWorld . terminals . ix (_tmID tm) . tmFutureLines .~ [makeTermLine ('>' : s)]
|
||||
|
||||
defocusTerminalInput :: World -> World
|
||||
defocusTerminalInput w = fromMaybe w $ do
|
||||
tmid <- w ^? cWorld . hud . hudElement . subInventory . termID
|
||||
return $ w & cWorld . terminals . ix tmid . tmInput . tiFocus %~ const False
|
||||
tmid <- w ^? cWorld . lWorld . hud . hudElement . subInventory . termID
|
||||
return $ w & cWorld . lWorld . terminals . ix tmid . tmInput . tiFocus %~ const False
|
||||
|
||||
runTerminalString :: String -> Terminal -> World -> World
|
||||
runTerminalString s tm w =
|
||||
w & cWorld . terminals . ix (_tmID tm)
|
||||
w & cWorld . lWorld . terminals . ix (_tmID tm)
|
||||
%~ ( (tmInput .~ TerminalInput T.empty True (0, 0))
|
||||
. (tmFutureLines ++.~ commandFutureLines s tm w)
|
||||
. (tmCommandHistory %~ take 10 . (s :))
|
||||
|
||||
Reference in New Issue
Block a user