Allow firing of different muzzles on different frames after use
This commit is contained in:
@@ -123,7 +123,14 @@ inventoryX c = case c of
|
||||
'B' ->
|
||||
[ wristArmour
|
||||
, wristArmour
|
||||
, autoRifle
|
||||
, volleyGun 5
|
||||
, tinMag
|
||||
, tinMag
|
||||
, tinMag
|
||||
, tinMag
|
||||
, tinMag
|
||||
, burstRifle
|
||||
, bangCone
|
||||
, tinMag
|
||||
, smg
|
||||
, tinMag
|
||||
|
||||
@@ -39,6 +39,7 @@ data ItemUse
|
||||
, _heldAim :: AimParams
|
||||
, _heldParams :: HeldParams
|
||||
, _heldTriggerType :: TriggerType
|
||||
, _heldFrame :: Int
|
||||
}
|
||||
| UseEquip { _uequipEffect :: EquipEffect }
|
||||
| UseAttach {_uaParams :: AttachParams}
|
||||
@@ -163,6 +164,7 @@ data Muzzle = Muzzle
|
||||
, _mzFlareType :: FlareType
|
||||
, _mzEffect :: MuzzleEffect
|
||||
, _mzAmmoPerShot :: AmmoPerShot
|
||||
, _mzFrame :: Int
|
||||
-- , _mzChargeRequirement :: Maybe Int
|
||||
-- , _mzRecoil :: Float
|
||||
-- , _mzTorque :: Float
|
||||
|
||||
@@ -42,7 +42,8 @@ defaultBulletWeapon :: Item
|
||||
defaultBulletWeapon =
|
||||
defaultHeldItem
|
||||
& itAmmoSlots .~ singleAmmo BulletAmmo
|
||||
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 15 0) 0 0.01 0 PistolFlare MuzzleShootBullet (UseExactly 1)]
|
||||
& itUse . heldAim . aimMuzzles .~
|
||||
[Muzzle (V2 15 0) 0 0.01 0 PistolFlare MuzzleShootBullet (UseExactly 1) 0]
|
||||
|
||||
defaultItEffect :: ItEffect
|
||||
defaultItEffect =
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
module Dodge.Default.Item.Use (
|
||||
module Dodge.Default.Item.Use,
|
||||
module Dodge.Default.Item.Use.AimParams,
|
||||
module Dodge.Default.Item.Use.Consumption,
|
||||
module Dodge.Default.Item.Use.Equipment,
|
||||
) where
|
||||
|
||||
import Dodge.SoundLogic.ExternallyGeneratedSounds
|
||||
import Dodge.Data.Item.Use
|
||||
import Dodge.Default.Item.Use.AimParams
|
||||
import Dodge.Default.Item.Use.Consumption
|
||||
import Dodge.Default.Item.Use.Equipment
|
||||
|
||||
--defaultLeftUse :: ItemUse
|
||||
@@ -42,4 +40,5 @@ defaultHeldUse = UseHeld
|
||||
, _weaponRepeat = []
|
||||
}
|
||||
, _heldTriggerType = HammerTrigger
|
||||
, _heldFrame = 0
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ defaultAimParams =
|
||||
, _mzFlareType = DefaultFlareType
|
||||
, _mzEffect = MuzzleShootBullet
|
||||
, _mzAmmoPerShot = UseExactly 1
|
||||
, _mzFrame = 0
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
module Dodge.Default.Item.Use.Consumption where
|
||||
|
||||
--import Control.Lens
|
||||
import Dodge.Data.Item.Use.Consumption
|
||||
--import Dodge.Item.Weapon.Bullet
|
||||
--import Dodge.Reloading.Action
|
||||
|
||||
defaultLeftLoadable :: LeftConsumption
|
||||
defaultLeftLoadable = AutoRecharging 10 10 100 100
|
||||
@@ -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
|
||||
|
||||
@@ -41,11 +41,16 @@ volleyGun i =
|
||||
<*> pure PistolFlare
|
||||
<*> pure MuzzleShootBullet
|
||||
<*> pure (UseExactly 1)
|
||||
<*> ZipList [0..i-1]
|
||||
)
|
||||
& itUse . heldParams . torqueAfter .~ 0.15 + 0.05 * fromIntegral i
|
||||
& itUse . heldParams . recoil .~ 20 + 10 * fromIntegral i
|
||||
& itUse . heldParams . weaponInvLock .~ i + 1
|
||||
-- & itUse . heldParams . torqueAfter .~ 0.15 + 0.05 * fromIntegral i
|
||||
-- & itUse . heldParams . recoil .~ 20 + 10 * fromIntegral i
|
||||
& itUse . heldParams . torqueAfter .~ 0
|
||||
& itUse . heldParams . recoil .~ 0
|
||||
& itType .~ HELD (VOLLEYGUN i)
|
||||
& itAmmoSlots .~ IM.fromList (zip [0..i-1] $ repeat BulletAmmo)
|
||||
& itUse . heldParams . weaponRepeat .~ [1..i-1]
|
||||
|
||||
rifle :: Item
|
||||
rifle =
|
||||
@@ -90,7 +95,7 @@ miniGunX i =
|
||||
& itUse . heldAim . aimTurnSpeed .~ 0.5
|
||||
& itUse . heldAim . aimMuzzles
|
||||
.~ replicate i
|
||||
(Muzzle (V2 30 0) 0 0.05 0 MiniGunFlare MuzzleShootBullet (UseExactly 1))
|
||||
(Muzzle (V2 30 0) 0 0.05 0 MiniGunFlare MuzzleShootBullet (UseExactly 1) 0)
|
||||
& itUse . heldParams . recoil .~ 10 * fromIntegral i
|
||||
& itUse . heldParams . torqueAfter .~ 0.04 + 0.02 * fromIntegral i
|
||||
& itUse . heldParams . sidePush .~ 10 * fromIntegral i
|
||||
|
||||
@@ -14,7 +14,7 @@ bangCone =
|
||||
& itUse . heldDelay . rateMax .~ 20
|
||||
& itUse . heldAim . aimMuzzles
|
||||
.~ replicate 15
|
||||
(Muzzle (V2 15 0) 0 0.5 0 DefaultFlareType MuzzleShootBullet (UseExactly 1))
|
||||
(Muzzle (V2 15 0) 0 0.5 0 DefaultFlareType MuzzleShootBullet (UseExactly 1) 0)
|
||||
& itUse . heldParams . muzVel .~ UniRandFloat 0.5 0.8
|
||||
& itUse . heldParams . rifling .~ UniRandFloat 0.3 0.8
|
||||
& itUse . heldParams . recoil .~ 150
|
||||
|
||||
@@ -36,6 +36,7 @@ launcherX i =
|
||||
<*> pure DefaultFlareType
|
||||
<*> pure MuzzleLauncher
|
||||
<*> pure (UseExactly 1)
|
||||
<*> pure 0
|
||||
)
|
||||
& itAmmoSlots .~ IM.fromList [(j,LauncherAmmo) | j <- [0..i-1]]
|
||||
where
|
||||
|
||||
@@ -85,6 +85,7 @@ flameThrower =
|
||||
, _nzCurrentWalkAngle = 0
|
||||
}
|
||||
(UseExactly 1)
|
||||
0
|
||||
]
|
||||
& itAmmoSlots .~ singleAmmo GasAmmo
|
||||
& itType .~ HELD FLAMETHROWER
|
||||
|
||||
@@ -22,7 +22,7 @@ bangStick i =
|
||||
& itType .~ HELD (BANGSTICK i)
|
||||
& itUse . heldDelay . rateMax .~ 8
|
||||
& itUse . heldAim . aimMuzzles
|
||||
.~ [Muzzle (V2 10 0) a 0.01 0 DefaultFlareType MuzzleShootBullet (UseExactly 1)
|
||||
.~ [Muzzle (V2 10 0) a 0.01 0 DefaultFlareType MuzzleShootBullet (UseExactly 1) 0
|
||||
| a <- spreadAroundCenter i baseStickSpread]
|
||||
|
||||
baseStickSpread :: Float
|
||||
|
||||
@@ -2,8 +2,6 @@ module Dodge.Item.InventoryColor (
|
||||
itemInvColor,
|
||||
) where
|
||||
|
||||
--import Dodge.Data.Item.Use.Consumption.Ammo
|
||||
|
||||
import Color
|
||||
import Control.Lens
|
||||
import Dodge.Data.ComposedItem
|
||||
|
||||
Reference in New Issue
Block a user