Improve terminal update/display

This commit is contained in:
2025-08-19 19:37:36 +01:00
parent 1cfb581e15
commit a373b31152
6 changed files with 27 additions and 24 deletions
+6
View File
@@ -5,6 +5,8 @@ module Dodge.Update.Input.InGame (
updateMouseInGame,
) where
import Dodge.Base.Collide
import Geometry.Vector
import Dodge.Data.Terminal.Status
import Control.Applicative
import Control.Monad
@@ -384,7 +386,11 @@ updateFunctionKey uv _ _ = uv
updateKeysInTerminal :: Int -> Universe -> Universe
updateKeysInTerminal tmid u = fromMaybe u $ do
tm <- u ^? uvWorld . cWorld . lWorld . terminals . ix tmid
x <- u ^? uvWorld . cWorld . lWorld . buttons . ix (tm ^. tmButtonID) . btPos
y <- u ^? uvWorld . cWorld . lWorld . creatures . ix 0 . crPos
return $ case tm ^. tmStatus of
_ | dist x y > 40 || not (hasButtonLOS x y (u ^. uvWorld))
-> u & uvWorld . hud . hudElement . subInventory .~ NoSubInventory
TerminalDeactivated -> u & uvWorld . hud . hudElement . subInventory .~ NoSubInventory
TerminalTextInput{} -> updateKeysTextInputTerminal tmid u
TerminalPressTo{} -> updateKeyContinueTerminal tmid u