Allow movement when viewing terminals
This commit is contained in:
@@ -62,10 +62,9 @@ updateUseInputInGame u = updateFunctionKeys $ case u ^. uvWorld . hud of
|
||||
& tohud %~ dodisplayregexinput diCloseFilter diCloseFilter 2
|
||||
& uvWorld . worldEventFlags . at InventoryChange ?~ ()
|
||||
& uvWorld %~ setInvPosFromSS
|
||||
_ -> M.foldlWithKey' updateKeyInGame u pkeys
|
||||
_ -> updateKeysInGame u
|
||||
where
|
||||
tohud = uvWorld . hud
|
||||
pkeys = u ^. uvWorld . input . pressedKeys
|
||||
dodisplayregexinput filterprism filterlens x di = fromMaybe di $ do
|
||||
sss <- di ^? diSections
|
||||
msel <- di ^? diSelection
|
||||
@@ -83,6 +82,9 @@ updateUseInputInGame u = updateFunctionKeys $ case u ^. uvWorld . hud of
|
||||
& ciSelection .~ msel'
|
||||
& ciFilter .~ filts'
|
||||
|
||||
updateKeysInGame :: Universe -> Universe
|
||||
updateKeysInGame u = M.foldlWithKey' updateKeyInGame u (u ^. uvWorld . input . pressedKeys)
|
||||
|
||||
updateMouseInGame :: Config -> World -> World
|
||||
updateMouseInGame cfig w
|
||||
| Just 0 <- lbpress = updateMouseClickInGame cfig w
|
||||
@@ -378,19 +380,21 @@ updateFunctionKey uv ScancodeF3 _ = doDebugTest uv
|
||||
updateFunctionKey uv ScancodeF4 _ = doDebugTest2 uv
|
||||
updateFunctionKey uv _ _ = uv
|
||||
|
||||
-- look also at yourControl
|
||||
updateKeysInTerminal :: Int -> Universe -> Universe
|
||||
updateKeysInTerminal tmid u = fromMaybe u $ do
|
||||
updateKeysInTerminal tmid u = fromMaybe deactivate $ 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
|
||||
case tm ^. tmStatus of
|
||||
_
|
||||
| dist x y > 40 || not (hasButtonLOS x y (u ^. uvWorld)) ->
|
||||
u & uvWorld . hud . subInventory .~ NoSubInventory
|
||||
TerminalDeactivated -> u & uvWorld . hud . subInventory .~ NoSubInventory
|
||||
TerminalTextInput{} -> updateKeysTextInputTerminal tmid u
|
||||
TerminalPressTo{} -> updateKeyContinueTerminal tmid u
|
||||
_ -> u
|
||||
| dist x y > 40 || not (hasButtonLOS x y (u ^. uvWorld)) -> Nothing
|
||||
TerminalDeactivated -> Nothing
|
||||
TerminalTextInput{} -> Just $ updateKeysTextInputTerminal tmid u
|
||||
TerminalPressTo{} -> Just $ updateKeyContinueTerminal tmid u
|
||||
_ -> Just $ updateKeysInGame u
|
||||
where
|
||||
deactivate = u & uvWorld . hud . subInventory .~ NoSubInventory
|
||||
|
||||
updateKeyContinueTerminal :: Int -> Universe -> Universe
|
||||
updateKeyContinueTerminal tmid u
|
||||
|
||||
Reference in New Issue
Block a user