Held item rclick use, tweak reload on lclick

This commit is contained in:
2023-05-28 10:17:32 +01:00
parent ec8317c14e
commit 10c9e2261f
9 changed files with 68 additions and 65 deletions
+4 -2
View File
@@ -5,8 +5,6 @@ module Dodge.Creature.Impulse.UseItem (
useItemHotkey,
) where
import Dodge.Inventory.RBList
import Dodge.Hotkey
import Control.Lens
import Control.Monad
import Data.Foldable
@@ -15,7 +13,9 @@ import Dodge.Cuse
import Dodge.Data.World
import Dodge.Euse
import Dodge.HeldUse
import Dodge.Hotkey
import Dodge.Inventory
import Dodge.Item.Location
import Dodge.Luse
import Dodge.Reloading
import qualified IntMapHelp as IM
@@ -28,6 +28,7 @@ useItemRightClick cr' w = fromMaybe (f w) $ do
return $
itemEffect cr it w
& worldEventFlags . at InventoryChange ?~ ()
& f
where
f = cWorld . lWorld . creatures . ix (_crID cr') . crHammerPosition .~ HammerDown
@@ -35,6 +36,7 @@ itemEffect :: Creature -> Item -> World -> World
itemEffect cr it w = case it ^. itUse of
HeldUse{_heldUse = eff, _heldMods = usemods} ->
foldl' (&) (useHeld eff) (useMod usemods) it cr w
& pointerToItem it . itUse . heldHammer .~ HammerDown
LeftUse{} -> doequipmentchange
EquipUse{} -> doequipmentchange
-- ConsumeUse will cause problems if the item is not selected