Allow for door destruction

This commit is contained in:
2022-06-19 20:50:03 +01:00
parent 9e311cccf4
commit 08e5df07e2
14 changed files with 82 additions and 42 deletions
+9 -4
View File
@@ -101,21 +101,26 @@ handlePressedMouseButton but w = case (_hudElement (_hud w), but) of
| inTermFocus w -> doTerminalEffectLB (w ^?! terminals . ix tmid) w
| otherwise -> w & terminals . ix tmid . tmInput . tiFocus %~ const True
( DisplayInventory (CombineInventory mi) , ButtonLeft)
-> maybe (hud . hudElement .~ DisplayInventory NoSubInventory) doCombine mi w
-> maybeexitcombine $ maybe id doCombine mi w
_ -> w
where
maybeexitcombine
| ButtonRight `S.member` _mouseButtons w = id
| otherwise = hud . hudElement .~ DisplayInventory NoSubInventory
-- note "sort" on the inventory indices; otherwise
-- lower items may be shifted up and items below these removed instead
doCombine :: Int -> World -> World
doCombine i w = case combineItemListYou w !? i of
Nothing -> w
Just (is,it) -> enterCombineInv
Just (is,it) -> -- set (hud . hudElement) (DisplayInventory NoSubInventory)
selectinv --enterCombineInv
. createPutItem it
-- . uncurry (putItemInInvID yid)
-- . copyItemToFloorID (_crPos $ you w) (applyModules it)
$ foldr (rmInvItem yid) w (sort is)
where
yid = _yourID w
selectinv (Just i', w') = w' & creatures . ix yid . crInvSel .~ i'
selectinv (Nothing, w') = w'
handleMouseWheelEvent :: MouseWheelEventData -> Universe -> Maybe Universe