Split item consumables from item use

This commit is contained in:
2024-12-18 19:35:39 +00:00
parent db8e26b99d
commit 5600b29714
8 changed files with 63 additions and 59 deletions
+12 -12
View File
@@ -201,7 +201,7 @@ trySynthBullet loc w = fromMaybe w $ do
then do
bat <- loc ^? locLDT . ldtLeft . ix 0 . _2 . ldtValue . _1
j <- bat ^? itLocation . ilInvID
y <- bat ^? itUse . amagLoadStatus . iaLoaded
y <- bat ^? itConsumables . magLoadStatus . iaLoaded
guard $ y > 0
return $
w
@@ -217,15 +217,15 @@ trySynthBullet loc w = fromMaybe w $ do
. ix 0
. crInv
. ix j
. itUse
. amagLoadStatus
. itConsumables
. magLoadStatus
. iaLoaded
-~ 1
else do
mag <- loc ^? locLdtContext . cldtParent . _1
j <- mag ^? itLocation . ilInvID
y <- mag ^? itUse . amagLoadStatus . iaLoaded
ymax <- mag ^? itUse . amagLoadStatus . iaMax
y <- mag ^? itConsumables . magLoadStatus . iaLoaded
ymax <- mag ^? itConsumables . magLoadStatus . iaMax
guard $ y < ymax
return $
w
@@ -241,8 +241,8 @@ trySynthBullet loc w = fromMaybe w $ do
. ix 0
. crInv
. ix j
. itUse
. amagLoadStatus
. itConsumables
. magLoadStatus
. iaLoaded
+~ 1
where
@@ -306,7 +306,7 @@ shineTargetLaser ::
shineTargetLaser cr itmtree (p, q) w = fromMaybe (w & pointittarg . itTgPos .~ Nothing) $ do
guard (crIsAiming cr)
(_, mag) <- find (isammolink . _iatType . fst) (itmtree ^. ldtLeft)
i <- mag ^? ldtValue . _1 . itUse . amagLoadStatus . iaLoaded
i <- mag ^? ldtValue . _1 . itConsumables . magLoadStatus . iaLoaded
guard $ i >= x
maginvid <- mag ^? ldtValue . _1 . itLocation . ilInvID
return $
@@ -315,8 +315,8 @@ shineTargetLaser cr itmtree (p, q) w = fromMaybe (w & pointittarg . itTgPos .~ N
& cWorld . lWorld . creatures . ix (_crID cr)
. crInv
. ix maginvid
. itUse
. amagLoadStatus
. itConsumables
. magLoadStatus
. iaLoaded
-~ x
& cWorld . lWorld . lasers
@@ -347,14 +347,14 @@ shineTorch ::
World
shineTorch cr itmtree (p, q) = fromMaybe id $ do
(_, mag) <- find (isammolink . _iatType . fst) (itmtree ^. ldtLeft)
i <- mag ^? ldtValue . _1 . itUse . amagLoadStatus . iaLoaded
i <- mag ^? ldtValue . _1 . itConsumables . magLoadStatus . iaLoaded
guard $ crIsAiming cr
guard $ i >= x
invid <- mag ^? ldtValue . _1 . itLocation . ilInvID
return $
--(cWorld . lWorld . tempLightSources .:~ tlsTimeRadColPos 1 250 0.7 pos'')
(cWorld . lWorld . lights .:~ LSParam pos'' 250 0.7)
. (cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix invid . itUse . amagLoadStatus . iaLoaded -~ x)
. (cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix invid . itConsumables . magLoadStatus . iaLoaded -~ x)
where
x = 10
isammolink AmmoInLink{} = True