Remove internal ammo

This commit is contained in:
2024-06-21 12:48:41 +01:00
parent d41604fcde
commit 0a1b0386b9
33 changed files with 838 additions and 789 deletions
+18 -16
View File
@@ -32,7 +32,8 @@ useE eo = case eo of
EonWristShield -> onEquipWristShield
EoffWristShield -> onRemoveWristShield
EFuelSource 0 _ -> const . const id
EFuelSource{} -> trySiphonFuel
--EFuelSource{} -> trySiphonFuel
EFuelSource{} -> const . const id
EBatterySource{} -> tryChargeBattery
EAmmoSource{} -> tryAttachBulletBelt
@@ -43,21 +44,22 @@ tryChargeBattery :: Item -> Creature -> World -> World
tryChargeBattery _ _ w = w
trySiphonFuel :: Item -> Creature -> World -> World
trySiphonFuel itm cr w = fromMaybe w $ do
eix <- itm ^? itLocation . ipInvID
hix <- cr ^? crManipulation . manObject . inInventory . ispItem
guard (cr ^? crManipulation . manObject . inInventory . iselAction == Just NoInvSelAction)
la <- cr ^? crInv . ix hix . itUse . heldConsumption
atype <- la ^? laAmmoType
guard (isGas atype)
amax <- la ^? laSource . _InternalSource . iaMax
acur <- la ^? laSource . _InternalSource . iaLoaded
guard (amax > acur)
return $
w & cWorld . lWorld . creatures . ix (_crID cr) . crInv
%~ ( (ix hix . itUse . heldConsumption . laSource . _InternalSource . iaLoaded +~ 1)
. (ix eix . itUse . equipEffect . eeUse . euseFuelAmount -~ 1)
)
trySiphonFuel itm cr = id
--trySiphonFuel itm cr w = fromMaybe w $ do
-- eix <- itm ^? itLocation . ipInvID
-- hix <- cr ^? crManipulation . manObject . inInventory . ispItem
-- guard (cr ^? crManipulation . manObject . inInventory . iselAction == Just NoInvSelAction)
-- la <- cr ^? crInv . ix hix . itUse . heldConsumption
-- atype <- la ^? laAmmoType
-- guard (isGas atype)
-- amax <- la ^? laSource . _InternalSource . iaMax
-- acur <- la ^? laSource . _InternalSource . iaLoaded
-- guard (amax > acur)
-- return $
-- w & cWorld . lWorld . creatures . ix (_crID cr) . crInv
-- %~ ( (ix hix . itUse . heldConsumption . laSource . _InternalSource . iaLoaded +~ 1)
-- . (ix eix . itUse . equipEffect . eeUse . euseFuelAmount -~ 1)
-- )
isGas :: AmmoType -> Bool
isGas a = case a of