Add burst fire, tentative inventory locking

This commit is contained in:
2021-12-04 16:05:46 +00:00
parent 30abc318ae
commit cb670bdfd8
16 changed files with 108 additions and 18 deletions
+7 -2
View File
@@ -210,9 +210,14 @@ dropItem cr invid = rmInvItem cid invid . copyInvItemToFloor cr invid . mayberem
Just i | i == invid -> creatures . ix cid . crLeftInvSel .~ Nothing
_ -> id
{- | Get your creature to drop the item under the cursor. -}
youDropItem :: World -> World
youDropItem w = case yourItem w ^? _Just . itCurseStatus of
youDropItem w
| _crInvLock (you w) = w
| otherwise = youDropItem' w
{- | Get your creature to drop the item under the cursor. -}
youDropItem' :: World -> World
youDropItem' w = case yourItem w ^? _Just . itCurseStatus of
Just Uncursed -> w
& dropItem cr (_crInvSel cr)
& soundStart (CrSound (_crID cr)) (_crPos cr) whiteNoiseFadeOutS Nothing
+5 -1
View File
@@ -38,7 +38,11 @@ itemEffect cr it w = case it ^? itUse of
--this is ugly
useLeftItem :: Int -> World -> World
useLeftItem cid w = case cr ^? crInv . ix crinvsel . itUse . lUse of
useLeftItem cid w | _crInvLock $ _creatures w IM.! cid = w
| otherwise = useLeftItem' cid w
useLeftItem' :: Int -> World -> World
useLeftItem' cid w = case cr ^? crInv . ix crinvsel . itUse . lUse of
Just f -> f cr crinvsel (w & creatures . ix cid . crLeftInvSel ?~ crinvsel)
Nothing -> case _crLeftInvSel cr of
Just invid -> case _itUse $ _crInv cr IM.! invid of