Refactor code for initial mouse click in game

This commit is contained in:
2024-11-18 11:00:41 +00:00
parent afddcae6d1
commit 3c5e5b92b1
5 changed files with 217 additions and 139 deletions
+10 -6
View File
@@ -294,9 +294,13 @@ runTerminalString s tm w =
)
doTerminalEffectLB :: Terminal -> World -> World
doTerminalEffectLB tm w = fromMaybe w $ do
guard (_tmStatus tm == TerminalReady)
s <- w ^? cWorld . lWorld . terminals . ix (_tmID tm) . tmInput . tiText
return $ if null (words s) && null (_tmPartialCommand tm)
then w
else terminalReturnEffect tm w
doTerminalEffectLB tm w = case w ^. input . mouseContext of
OverTerminalReturn -> fromMaybe w $ do
guard (_tmStatus tm == TerminalReady)
s <- w ^? cWorld . lWorld . terminals . ix (_tmID tm) . tmInput . tiText
return $ if null (words s) && null (_tmPartialCommand tm)
then w
else terminalReturnEffect tm w
OverTerminalEscape -> w
& hud . hudElement . subInventory .~ NoSubInventory MouseInvNothing
_ -> w