Allow firing of different muzzles on different frames after use
This commit is contained in:
@@ -93,12 +93,14 @@ heldEffectMuzzles t cr w =
|
||||
-- need to be careful about inventory lock or item ids here
|
||||
doWeaponRepetitions :: LabelDoubleTree ComposeLinkType Item -> Creature -> World -> World
|
||||
doWeaponRepetitions itm cr = case itm ^? ldtValue . itUse . heldParams . weaponRepeat of
|
||||
Just (x : xs) -> cWorld . lWorld . delayedEvents .++~ ((x : xs) <&> (,WdWdFromItCrixWdWd upitm (_crID cr) ItCrWdItemHeldEffect))
|
||||
Just xs -> cWorld . lWorld . delayedEvents .++~ map f xs
|
||||
_ -> id
|
||||
where
|
||||
upitm =
|
||||
f x = (x,WdWdFromItCrixWdWd (upitm x) (_crID cr) ItCrWdItemHeldEffect)
|
||||
upitm x =
|
||||
itm & ldtValue . itUse . heldParams . weaponRepeat .~ []
|
||||
& ldtValue . itUse . heldTriggerType .~ AutoTrigger
|
||||
& ldtValue . itUse . heldFrame .~ x
|
||||
|
||||
applyCME :: Item -> Creature -> CumulativeMuzzleEffect -> World -> World
|
||||
applyCME itm cr cme
|
||||
@@ -174,6 +176,7 @@ loadMuzzle ::
|
||||
Muzzle ->
|
||||
(LabelDoubleTree ComposeLinkType Item, Maybe (Muzzle, Int, LabelDoubleTree ComposeLinkType Item))
|
||||
loadMuzzle t@(LDT _ l _) mz = fromMaybe (t, Nothing) $ do
|
||||
guard $ mz ^? mzFrame == t ^? ldtValue . itUse . heldFrame
|
||||
let as = _mzAmmoSlot mz
|
||||
amamount = _mzAmmoPerShot mz
|
||||
(i, (_, mag)) <- findWithIx (isAmmoIntLink as . fst) l
|
||||
|
||||
Reference in New Issue
Block a user