Add new targeting datatypes
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user