Make buttons without labels inactive

This commit is contained in:
jgk
2021-03-08 17:03:58 +01:00
parent 70f8914767
commit 9f58066dba
4 changed files with 52 additions and 89 deletions
+1 -9
View File
@@ -4,6 +4,7 @@ import Dodge.Data
import Dodge.Base
import Dodge.CreatureActions
import Dodge.SoundLogic
import Dodge.Inventory
import Geometry
@@ -170,15 +171,6 @@ mouseActionsWorld keys w
---theItem = _crInv (you w) IM.! _crInvSel (you w)
rotation = angleBetween (_mousePos w) (_lbClickMousePos w)
-- for now, left are floor items, right are buttons
closestActiveObject :: World -> Maybe (Either FloorItem Button)
closestActiveObject w = listToMaybe $ sortBy (compare `on` dist ypos . pos) $ actObjs
where ypos = _crPos $ you w
actObjs = filter (\obj -> dist ypos (pos obj) < 40 && hasLOS ypos (pos obj) w)
$ map Left (IM.elems $ _floorItems w) ++ map Right (IM.elems $ _buttons w)
pos (Right x) = _btPos x
pos (Left x) = _flItPos x
spaceAction :: World -> World
spaceAction w = case closestActiveObject w of
Just (Left flit) -> pickUpItem' flit w