This commit is contained in:
2023-05-01 22:35:33 +01:00
parent 7b8b8750a9
commit 61f88aeb4a
9 changed files with 120 additions and 121 deletions
+15 -10
View File
@@ -10,7 +10,7 @@ module Dodge.Inventory (
rmInvItem,
updateCloseObjects,
updateRBList,
updateTerminal,
checkTermDist,
closeObjScrollDir,
changeSwapSel,
scrollAugInvSel,
@@ -21,6 +21,7 @@ module Dodge.Inventory (
setInvPosFromSS,
) where
import Control.Monad
import Color
import Control.Applicative
import qualified Data.Map.Strict as M
@@ -155,16 +156,20 @@ selNumEndMidHeight cfig ldp sss i j = do
selSecSelCol :: Int -> Int -> SelectionSections a -> Maybe Color
selSecSelCol i j sss = sss ^? sssSections . ix i . ssItems . ix j . siColor
updateTerminal :: World -> World
updateTerminal = checkTermDist
checkTermDist :: World -> World
checkTermDist w = case w ^? hud . hudElement . subInventory . termID of
Just tmid -> fromMaybe (w & hud . hudElement . subInventory .~ NoSubInventory) $ do
btid <- w ^? cWorld . lWorld . terminals . ix tmid . tmButtonID
btpos <- w ^? cWorld . lWorld . buttons . ix btid . btPos
if dist btpos (_crPos $ you w) < 40 then Just w else Nothing
Nothing -> w
--checkTermDist w = case w ^? hud . hudElement . subInventory . termID of
-- Just tmid -> fromMaybe (w & hud . hudElement . subInventory .~ NoSubInventory) $ do
-- btid <- w ^? cWorld . lWorld . terminals . ix tmid . tmButtonID
-- btpos <- w ^? cWorld . lWorld . buttons . ix btid . btPos
-- guard $ dist btpos (_crPos $ you w) < 40
-- return w
-- Nothing -> w
checkTermDist w = fromMaybe w $ do
tmid <- w ^? hud . hudElement . subInventory . termID
btid <- w ^? cWorld . lWorld . terminals . ix tmid . tmButtonID
btpos <- w ^? cWorld . lWorld . buttons . ix btid . btPos
guard $ dist btpos (_crPos $ you w) > 40
return (w & hud . hudElement . subInventory .~ NoSubInventory)
-- this looks ugly...
updateCloseObjects :: World -> World