Commit before tweaking item id/locations

This commit is contained in:
2024-09-22 13:58:00 +01:00
parent efd3e17cbf
commit 236f7c7750
9 changed files with 28 additions and 19 deletions
+4 -6
View File
@@ -5,6 +5,7 @@ module Dodge.Creature.Impulse.UseItem (
useItemHotkey,
) where
import Dodge.SelectUse
import Dodge.Item.Grammar
import Dodge.Data.ComposedItem
import Dodge.Data.DoubleTree
@@ -40,17 +41,14 @@ itemEffect cr it w = case it ^. ldtValue . itUse of
EquipUse{} -> doequipmentchange
(ConsumeUse eff) -> useC eff (_ldtValue it) cr w
CraftUse{} -> w
AttachUse{} -> w
AttachUse{} -> selectUse it cr w
AmmoMagUse{} -> w
where
itm = it ^. ldtValue
hammerTest f = case _crHammerPosition cr of
HammerUp -> f w -- & setuhamdown
_ -> w -- & setuhamdown
-- setuhamdown = cWorld . lWorld . creatures . ix (_crID cr) . crHammerPosition .~ HammerDown
doequipmentchange = fromMaybe w $ do
guard (_crHammerPosition cr == HammerUp)
invid <- itm ^? itLocation . ipInvID
return $ hammerTest $ toggleEquipmentAt invid cr
return $ toggleEquipmentAt invid cr w
toggleEquipmentAt :: Int -> Creature -> World -> World
toggleEquipmentAt invid cr w = case getEquipmentAllocation w of
+2 -3
View File
@@ -215,9 +215,8 @@ pressedMBEffectsTopInventory pkeys w
DisplayInventory{_subInventory = NoSubInventory} -> True
_ -> False
isDown but = but `M.member` pkeys
theinput = w ^. input
rotation =
maybe
0
(angleBetween (theinput ^. mousePos))
(theinput ^. heldPos . at SDL.ButtonMiddle)
(angleBetween $ w ^. input . mousePos)
(w ^. input . heldPos . at SDL.ButtonMiddle)