Fix terminal distance bug

This commit is contained in:
2022-06-11 13:07:56 +01:00
parent 7b00867f6d
commit f41fbbbb8d
2 changed files with 7 additions and 7 deletions
+3 -2
View File
@@ -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
+4 -5
View File
@@ -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)]