Partially successful change of terminals to external entities

This commit is contained in:
2022-06-06 12:49:14 +01:00
parent 597336499c
commit eb38874102
12 changed files with 141 additions and 167 deletions
+1 -20
View File
@@ -146,7 +146,7 @@ invSelPos w = splitgap + (foldl' (+) 0 . fst $ IM.split invsel (augmentedInvSize
| otherwise = 1
updateTerminal :: World -> World
updateTerminal = checkTermDist . updateTerminalLine
updateTerminal = checkTermDist
checkTermDist :: World -> World
checkTermDist w = case w ^? hud . hudElement . subInventory . termID of
@@ -155,25 +155,6 @@ checkTermDist w = case w ^? hud . hudElement . subInventory . termID of
if dist btpos (_crPos $ you w) < 40 then Just w else Nothing
Nothing -> w
updateTerminalLine :: World -> World
updateTerminalLine w = case w ^? hud . hudElement . subInventory . termParams . termFutureLines . ix 0 of
Nothing -> w
Just tl | _tlPause tl > 0 -> w & pointTermParams . termFutureLines . ix 0 . tlPause -~ 1
Just (TerminalLineDisplay _ f) -> w & pointTermParams %~
( ( termFutureLines %~ tail )
. ( termDisplayedLines .:~ f )
)
Just (TerminalLineEffect _ eff) -> w
& pointTermParams . termFutureLines %~ tail
& eff (_subInventory . _hudElement $ _hud w)
Just (TerminalLineInput _) -> w & pointTermParams %~
( ( termFutureLines %~ tail )
-- . ( termScrollCommands .~ scrollc )
-- . ( termWriteCommands .~ writec )
. ( termInput ?~ T.empty ) )
where
pointTermParams = hud . hudElement . subInventory . termParams
-- this looks ugly...
updateCloseObjects :: World -> World
updateCloseObjects w = w & closeObjects .~ unionBy closeObjEq oldCloseFiltered currentClose