Add new targeting datatypes

This commit is contained in:
2022-02-22 11:07:19 +00:00
parent 69490bb984
commit 055fcf4cce
4 changed files with 16 additions and 4 deletions
+7
View File
@@ -136,6 +136,7 @@ invItemUpdate = itUse %~ useupdate
invSideEff :: Creature -> World -> World
invSideEff cr w = weaponReloadSounds cr
. flip (IS.foldr useeq) (_crInvEquipped cr)
. doHeldItemTargeting cr
$ IM.foldrWithKey f w (_crInv cr)
where
useeq i = _eqUse (_itUse $ _crInv cr IM.! i) cr i
@@ -148,6 +149,12 @@ invSideEff cr w = weaponReloadSounds cr
| otherwise = itpointer %~ invItemUpdate
itpointer = creatures . ix (_crID cr) . crInv . ix i
doHeldItemTargeting :: Creature -> World -> World
doHeldItemTargeting cr w = case cr ^? crInv . ix (_crInvSel cr) . itTargeting' . tgHeldUpdate of
Nothing -> w
Just f -> w & creatures . ix (_crID cr) . crInv . ix (_crInvSel cr) . itTargeting'
%~ f (_crInv cr IM.! _crInvSel cr) cr w
weaponReloadSounds :: Creature -> World -> World
weaponReloadSounds cr w = case cr ^? crInv . ix (_crInvSel cr) . itConsumption of
Just am@LoadableAmmo{} -> case _reloadType am of