From f41fbbbb8d895319306dc694d015b53433840c8e Mon Sep 17 00:00:00 2001 From: justin Date: Sat, 11 Jun 2022 13:07:56 +0100 Subject: [PATCH] Fix terminal distance bug --- src/Dodge/Inventory.hs | 5 +++-- src/Dodge/Terminal.hs | 9 ++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Dodge/Inventory.hs b/src/Dodge/Inventory.hs index 73840a809..71fc2e816 100644 --- a/src/Dodge/Inventory.hs +++ b/src/Dodge/Inventory.hs @@ -150,8 +150,9 @@ updateTerminal = checkTermDist checkTermDist :: World -> World checkTermDist w = case w ^? hud . hudElement . subInventory . termID of - Just btid -> fromMaybe (w & hud . hudElement .~ DisplayInventory NoSubInventory) $ do - btpos <- w ^? buttons . ix btid . btPos + Just tmid -> fromMaybe (w & hud . hudElement .~ DisplayInventory NoSubInventory) $ do + btid <- w ^? terminals . ix tmid . tmButtonID + btpos <- w ^? buttons . ix btid . btPos if dist btpos (_crPos $ you w) < 40 then Just w else Nothing Nothing -> w diff --git a/src/Dodge/Terminal.hs b/src/Dodge/Terminal.hs index aceaacd6a..6a2e0003e 100644 --- a/src/Dodge/Terminal.hs +++ b/src/Dodge/Terminal.hs @@ -228,7 +228,7 @@ basicTerminal = defaultTerminal ,_tmInput = defaultTerminalInput ,_tmScrollCommands = [quitCommand] ,_tmWriteCommands = [helpCommand,commandsCommand] - ,_tmProgram = \_ _ -> connectionBlurb1 + ,_tmProgram = \_ _ -> connectionBlurb , _tmDeathEffect = doDeathTriggers } @@ -240,11 +240,10 @@ doDeathTriggers tm w = w doDeathToggle :: TerminalToggle -> IM.IntMap (World -> Bool) -> IM.IntMap (World -> Bool) doDeathToggle (TerminalToggle trid f) = ix trid %~ f -connectionBlurb1 :: [TerminalLine] -connectionBlurb1 = +connectionBlurb :: [TerminalLine] +connectionBlurb = [termSoundLine computerBeepingS ,TerminalLineDisplay 0 (const ("CONNECTING",termTextColor)) ,TerminalLineDisplay 10 (const ("...",termTextColor)) ,TerminalLineDisplay 10 (const ("CONNECTED",termTextColor)) - ] ++ map (TerminalLineDisplay 10 . const . (,white) . show) [(1::Int)..50] ++ - [TerminalLineTerminalEffect 0 (tmStatus .~ TerminalReady)] + ,TerminalLineTerminalEffect 0 (tmStatus .~ TerminalReady)]