Fix button not updating bug

This commit is contained in:
2022-06-14 18:47:11 +01:00
parent dafbd8a2da
commit 0957c79e58
10 changed files with 51 additions and 67 deletions
+5 -2
View File
@@ -158,7 +158,8 @@ checkTermDist w = case w ^? hud . hudElement . subInventory . termID of
-- this looks ugly...
updateCloseObjects :: World -> World
updateCloseObjects w = w & closeObjects .~ unionBy closeObjEq oldCloseFiltered currentClose
updateCloseObjects w = w
& closeObjects .~ unionBy closeObjEq oldCloseFiltered currentClose
& creatures . ix (_yourID w) . crInvSel %~ updateinvsel
where
updateinvsel curinvsel
@@ -171,8 +172,10 @@ updateCloseObjects w = w & closeObjects .~ unionBy closeObjEq oldCloseFiltered c
. IM.elems
$ _buttons w
currentClose = filt $ map Left (IM.elems $ _floorItems w) ++ activeButtons
oldClose = filt $ _closeObjects w
oldClose = filt $ mapMaybe updatebyid $ _closeObjects w
oldCloseFiltered = intersectBy closeObjEq oldClose currentClose
updatebyid (Left flid) = fmap Left $ w ^? floorItems . ix (_flItID flid)
updatebyid (Right btid) = fmap Right $ w ^? buttons . ix (_btID btid)
updateRBList :: World -> World
updateRBList w