Make use hammers and item positions slightly more logical
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user