Cleanup
This commit is contained in:
+15
-10
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user