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
+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)