Make item use mods an external function

This commit is contained in:
2022-07-20 17:06:45 +01:00
parent 795c4c1987
commit 12246462fe
22 changed files with 232 additions and 297 deletions
+1 -1
View File
@@ -12,7 +12,7 @@ import Control.Lens
autoCrit :: Creature
autoCrit = defaultCreature
{ _crInv = IM.fromList [(0,autoGun),(1,medkit 100)]
{ _crInv = IM.fromList [(0,autoRifle),(1,medkit 100)]
, _crRad = 10
, _crHP = 300
, _crMvType = defaultAimMvType
+1 -1
View File
@@ -26,7 +26,7 @@ useItem cr' w = fromMaybe (f w) $ do
itemEffect :: Creature -> Item -> World -> World
itemEffect cr it w = case it ^? itUse of
Just RightUse {_rUse = eff,_useMods = usemods}
-> hammerTest $ tryReload cr it w $ foldr ($) (useHeld eff) usemods it cr
-> hammerTest $ tryReload cr it w $ foldr ($) (useHeld eff) (useMod usemods) it cr
Just LeftUse {} -> doequipmentchange
Just EquipUse{} -> doequipmentchange
-- ConsumeUse will cause problems if the item is not selected