Remove internal ammo
This commit is contained in:
@@ -100,7 +100,7 @@ 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) %~ crUpdateLoadSource)
|
||||
HeldUse{} -> return $ hammerTest (cWorld . lWorld . creatures . ix (_crID cr) %~ crReload)
|
||||
ConsumeUse{} -> return $ useItemRightClick cr w
|
||||
EquipUse{} -> return $ useItemRightClick cr w
|
||||
LeftUse{} -> return $ useItemRightClick cr w
|
||||
|
||||
@@ -174,7 +174,7 @@ reloadOverride :: Creature -> Creature
|
||||
reloadOverride cr = fromMaybe cr $ do
|
||||
guard $ cr ^. crStance . posture == Aiming
|
||||
itRef <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||
guard $ cr ^? crInv . ix itRef . itUse . heldConsumption . laSource . _InternalSource . iaLoaded == Just 0
|
||||
guard $ cr ^? crInv . ix (itRef + 1) . itUse . attachParams . ammoAttachParams . iaLoaded == Just 0
|
||||
return $ cr & crActionPlan . apStrategy .~ StrategyActions Reload reloadActions
|
||||
where
|
||||
reloadActions =
|
||||
|
||||
@@ -38,24 +38,12 @@ crIsReloading cr = case cr ^? crManipulation . manObject . inInventory . iselAct
|
||||
Just ReloadAction{} -> True
|
||||
_ -> False
|
||||
|
||||
-- Assumes the ammotype below the selected item is correct
|
||||
crWeaponReady :: Creature -> Bool
|
||||
crWeaponReady cr = fromMaybe False $ do
|
||||
i <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||
asource <- cr ^? crInv . ix i . itUse . heldConsumption . laSource
|
||||
case asource of
|
||||
InternalSource ia -> return (_iaLoaded ia > 0 && _iaPrimed ia)
|
||||
AboveSource -> do
|
||||
x <- cr ^? crInv . ix (i - 1) . itUse . equipEffect . eeUse . euseAmmoAmount
|
||||
return (x > 0)
|
||||
BelowSource -> do
|
||||
x <- cr ^? crInv . ix (i + 1) . itUse . equipEffect . eeUse . euseAmmoAmount
|
||||
return (x > 0)
|
||||
EitherSource -> return $
|
||||
justIsPositive (cr ^? crInv . ix (i - 1) . itUse . equipEffect . eeUse . euseAmmoAmount)
|
||||
|| justIsPositive (cr ^? crInv . ix (i + 1) . itUse . equipEffect . eeUse . euseAmmoAmount)
|
||||
where
|
||||
justIsPositive Nothing = False
|
||||
justIsPositive (Just x) = x > 0
|
||||
x <- cr ^? crInv . ix (i + 1) . itUse . attachParams . ammoAttachParams . iaLoaded
|
||||
return (x > 0)
|
||||
|
||||
crCanSeeCr :: Creature -> (World, Creature) -> Bool
|
||||
crCanSeeCr tcr (w, cr) = hasLOS (_crPos cr) (_crPos tcr) w
|
||||
|
||||
Reference in New Issue
Block a user