Tweak switch doors
This commit is contained in:
+23
-21
@@ -26,12 +26,13 @@ checkInvSlotsYou' it w = fmap fst $ find cond invListSelFirst
|
||||
|
||||
checkInvSlotsYou :: Item -> World -> Maybe Int
|
||||
checkInvSlotsYou it w = fmap fst $ find cond invListSelFirst
|
||||
where cond (_,NoItem) = True
|
||||
cond (_,it' ) = itNotFull it' && _itName it == _itName it'
|
||||
youCr = you w
|
||||
youSel = _crInvSel youCr
|
||||
invList = _crInv youCr
|
||||
invListSelFirst = (youSel , invList IM.! youSel) : IM.toList invList
|
||||
where
|
||||
cond (_,NoItem) = True
|
||||
cond (_,it' ) = itNotFull it' && _itName it == _itName it'
|
||||
youCr = you w
|
||||
youSel = _crInvSel youCr
|
||||
invList = _crInv youCr
|
||||
invListSelFirst = (youSel , invList IM.! youSel) : IM.toList invList
|
||||
|
||||
checkInvSlots :: Item -> IM.IntMap Item -> Maybe Int
|
||||
checkInvSlots it its = fmap fst $ find cond $ IM.toList its
|
||||
@@ -79,21 +80,22 @@ closestActiveObject w = listToMaybe $ sortBy (compare `on` dist ypos . pos) $ ac
|
||||
|
||||
updateCloseObjects :: World -> World
|
||||
updateCloseObjects w = w & closeActiveObjects .~ unionBy eTest oldCloseFiltered currentClose
|
||||
where filt = filter $ \obj -> dist ypos (pos obj) < 40 && hasLOS ypos (pos obj) w
|
||||
ypos = _crPos $ you w
|
||||
objs = map Left (IM.elems $ _floorItems w) ++ activeButtons
|
||||
activeButtons = map Right
|
||||
. filter ( (/=) BtNoLabel . _btState)
|
||||
. IM.elems
|
||||
$ _buttons w
|
||||
pos (Right x) = _btPos x
|
||||
pos (Left x) = _flItPos x
|
||||
eTest (Right x) (Right y) = _btID x == _btID y
|
||||
eTest (Left x) (Left y) = _flItID x == _flItID y
|
||||
eTest _ _ = False
|
||||
currentClose = filt objs
|
||||
oldClose = filt $ _closeActiveObjects w
|
||||
oldCloseFiltered = intersectBy eTest oldClose currentClose
|
||||
where
|
||||
filt = filter $ \obj -> dist ypos (pos obj) < 40 && hasLOS ypos (pos obj) w
|
||||
ypos = _crPos $ you w
|
||||
objs = map Left (IM.elems $ _floorItems w) ++ activeButtons
|
||||
activeButtons = map Right
|
||||
. filter ( (/=) BtNoLabel . _btState)
|
||||
. IM.elems
|
||||
$ _buttons w
|
||||
pos (Right x) = _btPos x
|
||||
pos (Left x) = _flItPos x
|
||||
eTest (Right x) (Right y) = _btID x == _btID y
|
||||
eTest (Left x) (Left y) = _flItID x == _flItID y
|
||||
eTest _ _ = False
|
||||
currentClose = filt objs
|
||||
oldClose = filt $ _closeActiveObjects w
|
||||
oldCloseFiltered = intersectBy eTest oldClose currentClose
|
||||
|
||||
closeObjScrollUp :: World -> World
|
||||
closeObjScrollUp = over closeActiveObjects rotU
|
||||
|
||||
Reference in New Issue
Block a user