Partial removal of reloading

This commit is contained in:
2024-09-08 10:21:35 +01:00
parent 581d2494dc
commit e03c8dd830
16 changed files with 256 additions and 187 deletions
+4 -2
View File
@@ -106,11 +106,13 @@ useItemLeftClick cr w = fromMaybe w $ do
invid <- cr ^? crManipulation . manObject . inInventory . ispItem
ituse <- cr ^? crInv . ix invid . itUse
case ituse of
HeldUse{} -> return $ hammerTest (cWorld . lWorld . creatures . ix (_crID cr) %~ crReloadToggle)
--HeldUse{} -> return $ hammerTest (cWorld . lWorld . creatures . ix (_crID cr) %~ crReloadToggle)
HeldUse{} -> return w
ConsumeUse{} -> return $ useItemRightClick cr w
EquipUse{} -> return $ useItemRightClick cr w
LeftUse{} -> return $ useItemRightClick cr w
AmmoMagUse{} -> return $ hammerTest (cWorld . lWorld . creatures . ix (_crID cr) %~ crReloadToggle)
AmmoMagUse{} -> return w
--AmmoMagUse{} -> return $ hammerTest (cWorld . lWorld . creatures . ix (_crID cr) %~ crReloadToggle)
_ -> Nothing
where
hammerTest f = case _crHammerPosition cr of
+14 -14
View File
@@ -145,7 +145,7 @@ internalHammerUpdate :: Creature -> World -> World
internalHammerUpdate cr =
cWorld . lWorld . creatures . ix (_crID cr)
%~ ( (crHammerPosition %~ moveHammerUp)
. stepReloading
-- . stepReloading
. updateMovement
)
@@ -233,7 +233,7 @@ equipmentEffects cr = flip (foldl' $ flip $ useEquipment cr) (IM.keys $ _crInvEq
invSideEff :: Creature -> World -> World
invSideEff cr w =
updateTargeting (crGetTargeting cr) cr $
weaponReloadSounds cr $
-- weaponReloadSounds cr $
IM.foldl' f w (_crInv cr)
where
-- be careful with side effects that affect creature targeting
@@ -288,18 +288,18 @@ crGetTargeting cr = do
guard (canAttachTargeting tt itm)
return tt
weaponReloadSounds :: Creature -> World -> World
weaponReloadSounds cr w = case cr ^? crManipulation . manObject . inInventory . iselAction of
Just ReloadAction{_reloadAction = la} ->
soundContinue
(CrReloadSound cid)
(_crPos cr)
(_actionSound la)
(Just 1)
w
_ -> w
where
cid = _crID cr
--weaponReloadSounds :: Creature -> World -> World
--weaponReloadSounds cr w = case cr ^? crManipulation . manObject . inInventory . iselAction of
-- Just ReloadAction{_reloadAction = la} ->
-- soundContinue
-- (CrReloadSound cid)
-- (_crPos cr)
-- (_actionSound la)
-- (Just 1)
-- w
-- _ -> w
-- where
-- cid = _crID cr
updateMovement :: Creature -> Creature
updateMovement cr
+2 -1
View File
@@ -36,7 +36,8 @@ crCurrentEquipment cr =
strFromHeldItem :: Creature -> Int
strFromHeldItem cr
| _posture (_crStance cr) == Aiming || crIsReloading cr = negate $ fromMaybe 0 $ do
--x--- | _posture (_crStance cr) == Aiming || crIsReloading cr = negate $ fromMaybe 0 $ do
| _posture (_crStance cr) == Aiming = negate $ fromMaybe 0 $ do
i <- cr ^? crManipulation . manObject . inInventory . ispItem
cr ^? crInv . ix i . itUse . heldAim . aimWeight
| otherwise = 0
+5 -5
View File
@@ -7,7 +7,7 @@ in fact a creature with that id need not exist.
-}
module Dodge.Creature.Test (
crIsAiming,
crIsReloading,
-- crIsReloading,
crIsArmouredFrom,
oneH,
twists,
@@ -33,10 +33,10 @@ import Dodge.Base.Collide
import Dodge.Data.World
import Geometry
crIsReloading :: Creature -> Bool
crIsReloading cr = case cr ^? crManipulation . manObject . inInventory . iselAction of
Just ReloadAction{} -> True
_ -> False
--crIsReloading :: Creature -> Bool
--crIsReloading cr = case cr ^? crManipulation . manObject . inInventory . iselAction of
-- Just ReloadAction{} -> True
-- _ -> False
-- Assumes the ammotype below the selected item is correct
crWeaponReady :: Creature -> Bool