Make use hammers and item positions slightly more logical

This commit is contained in:
2022-07-07 08:27:56 +01:00
parent c2e7fcc897
commit 3759434d92
16 changed files with 48 additions and 48 deletions
+2 -2
View File
@@ -277,11 +277,11 @@ youDropItem' w = case yourItem w ^? _Just . itCurseStatus of
where
cr = you w
{- | Copy an inventory item to the floor. -}
{- | Copy an inventory item to the floor. -}
copyInvItemToFloor :: Creature -> Int -> World -> World
copyInvItemToFloor cr i = copyItemToFloor (_crPos cr)
$ _crInv cr IM.! i
& itInvPos .~ Nothing
& itPos .~ VoidItm
& itIsHeld .~ False
sizeSelf :: Float -> Creature -> World -> Maybe World
+4 -1
View File
@@ -5,6 +5,7 @@ module Dodge.Creature.Impulse.UseItem
import Dodge.Data
import Dodge.Inventory
import Dodge.Reloading
import Dodge.Item.Location
import qualified Data.IntMap.Strict as IM
import qualified Data.Map.Strict as M
@@ -43,7 +44,9 @@ tryClickReload :: Creature -> Item -> World -> (World -> World) -> World -> Worl
tryClickReload cr it w f
| _crID cr == _yourID w && itNeedsLoading it && _mouseButtons w M.!? SDL.ButtonLeft == Just False
= crToggleReloading cr
| otherwise = f
| otherwise =
(runIdentity . pointToItem (_itPos it) (return . (itUse . useHammer' .~ HammerDown)))
. f
itNeedsLoading :: Item -> Bool
itNeedsLoading it = _laLoaded ic == 0 || not (_laPrimed ic)
+4 -2
View File
@@ -195,7 +195,7 @@ movementSideEff cr w
(randAng,_) = randomR (0,2*pi) $ _randGen w
useUpdate :: ItemUse -> ItemUse
useUpdate = (useHammer . hammerPosition %~ moveHammerUp)
useUpdate = (useHammer' %~ moveHammerUp)
. (useDelay . warmTime %~ decreaseToZero)
. (useDelay . rateTime %~ decreaseToZero)
@@ -220,7 +220,9 @@ itemUpdate cr i
| i == crSel cr = baseupdate True
| otherwise = baseupdate False
where
baseupdate bool = updateAutoRecharge . (itUse %~ useUpdate) . (itInvPos ?~ i) . (itIsHeld .~ bool)
baseupdate bool = updateAutoRecharge . (itUse %~ useUpdate)
. (itPos .~ InInv (_crID cr) i)
. (itIsHeld .~ bool)
updateAutoRecharge :: Item -> Item
updateAutoRecharge it = case _itConsumption it of
AutoRecharging l m t p