diff --git a/OpenRA.Mods.Sp/Projectiles/ProjetcileHusk.cs b/OpenRA.Mods.Sp/Projectiles/ProjetcileHusk.cs index 6b24db17a..d6dd66ea6 100644 --- a/OpenRA.Mods.Sp/Projectiles/ProjetcileHusk.cs +++ b/OpenRA.Mods.Sp/Projectiles/ProjetcileHusk.cs @@ -46,15 +46,18 @@ public class ProjetcileHuskInfo : IProjectileInfo [Desc("Projectile movement vector per tick (forward, right, up), use negative values for opposite directions.")] public readonly WVec Velocity = WVec.Zero; + [Desc("The X of the speed becomes dead actor speed by using range modifier, coop with " + nameof(SpawnHuskEffectOnDeath) + ".")] + public readonly bool UseRangeModifierAsVelocityX = true; + + [Desc("Movement random factor on Velocity.")] + public readonly WVec? VelocityRandomFactor = null; + [Desc("Value added to Velocity every tick when spin is activated.")] public readonly WVec AccelerationWhenSpin = new(0, 0, -10); [Desc("Value added to Velocity every tickwhen spin is NOT activated.")] public readonly WVec Acceleration = new(0, 0, -10); - [Desc("The X of the speed becomes dead actor speed by using range modifier, coop with " + nameof(SpawnHuskEffectOnDeath) + ".")] - public readonly bool UseRangeModifierAsVelocityX = true; - [Desc("Chance of Spin. Activate Spin.")] public readonly int SpinChance = 100; @@ -68,7 +71,7 @@ public class ProjetcileHuskInfo : IProjectileInfo [Desc("begin spin speed.")] public readonly int Spin = 0; - [Desc("Revert the Y of the speed, spin and horizongtal acceleration at 50% randomness.")] + [Desc("Revert the Y of the speed, and X, Y of acceleration at 50% randomness.")] public readonly bool HorizontalRevert = false; [Desc("Trail animation.")] @@ -124,10 +127,11 @@ public ProjetcileHusk(ProjetcileHuskInfo info, ProjectileArgs args) var world = args.SourceActor.World; var vx = info.UseRangeModifierAsVelocityX && args.RangeModifiers.Length > 0 ? args.RangeModifiers[0] : info.Velocity.X; + var vec = info.VelocityRandomFactor != null ? new WVec(vx + world.SharedRandom.Next(info.VelocityRandomFactor.Value.X), info.Velocity.Y + world.SharedRandom.Next(info.VelocityRandomFactor.Value.Y), info.Velocity.Z + world.SharedRandom.Next(info.VelocityRandomFactor.Value.Z)) : new WVec(vx, info.Velocity.Y, info.Velocity.Z); if (info.HorizontalRevert && world.SharedRandom.Next(2) == 0) { - velocity = new WVec(-info.Velocity.Y, -vx, info.Velocity.Z); + velocity = new WVec(-vec.Y, -vec.X, vec.Z); if (info.MaximumSpinSpeed > 0 && world.SharedRandom.Next(1, 101) <= info.SpinChance) { acceleration = new WVec(-info.AccelerationWhenSpin.Y, info.AccelerationWhenSpin.X, info.AccelerationWhenSpin.Z); @@ -140,7 +144,7 @@ public ProjetcileHusk(ProjetcileHuskInfo info, ProjectileArgs args) } else { - velocity = new WVec(info.Velocity.Y, -vx, info.Velocity.Z); + velocity = new WVec(vec.Y, -vec.X, vec.Z); if (info.MaximumSpinSpeed > 0 && world.SharedRandom.Next(1, 101) <= info.SpinChance) { acceleration = new WVec(info.AccelerationWhenSpin.Y, -info.AccelerationWhenSpin.X, info.AccelerationWhenSpin.Z); @@ -174,13 +178,18 @@ public void Tick(World world) { lastPos = pos; pos += velocity; - var spinAngle = new WAngle(spin); - facing += spinAngle; - acceleration = acceleration.Rotate(WRot.FromYaw(spinAngle)); - velocity += acceleration; - spin = Math.Abs(spin) < Math.Abs(maxSpin) ? spin + spinAcc : maxSpin; + if (maxSpin != 0) + { + var spinAngle = new WAngle(spin); + facing += spinAngle; + acceleration = acceleration.Rotate(WRot.FromYaw(spinAngle)); + spin = Math.Abs(spin) < Math.Abs(maxSpin) ? spin + spinAcc : maxSpin; + } + + velocity += acceleration; + // Explodes if (pos.Z <= args.PassiveTarget.Z) { pos += new WVec(0, 0, args.PassiveTarget.Z - pos.Z); diff --git a/OpenRA.Mods.Sp/Traits/SpawnSparks.cs b/OpenRA.Mods.Sp/Traits/SpawnSparks.cs index 96171ffef..21f5ad983 100644 --- a/OpenRA.Mods.Sp/Traits/SpawnSparks.cs +++ b/OpenRA.Mods.Sp/Traits/SpawnSparks.cs @@ -120,15 +120,16 @@ void ITick.Tick(Actor self) var offset = 1024 / amount; for (var i = 0; i < amount; i++) { - var rotation = WRot.FromYaw(new WAngle(i * offset)); + var facing = new WAngle(i * offset); + var rotation = WRot.FromYaw(facing); var targetpos = epicenter + new WVec(weapon.Range.Length, 0, 0).Rotate(rotation); var radiusTarget = Target.FromPos(new WPos(targetpos.X, targetpos.Y, Info.ForceToGround ? map.CenterOfCell(map.CellContaining(targetpos)).Z : targetpos.Z)); var projectileArgs = new ProjectileArgs { Weapon = weapon, - Facing = default, - CurrentMuzzleFacing = () => default, + Facing = facing, + CurrentMuzzleFacing = () => facing, DamageModifiers = Array.Empty(), diff --git a/mods/sp/rules/vehicles.yaml b/mods/sp/rules/vehicles.yaml index f653ca138..b4959eef6 100644 --- a/mods/sp/rules/vehicles.yaml +++ b/mods/sp/rules/vehicles.yaml @@ -274,7 +274,7 @@ APC: Weapon: ApcVulcanLine PauseOnCondition: empdisable || !Attacking || attack-air LocalOffset: 350,0,700 - CasingWeapon: CasingDebris + CasingWeapon: CasingDebrisLong CasingSpawnLocalOffset: 350,0,700 CasingTargetOffset: -1024,0, 0 RequiresCondition: !apammo @@ -283,7 +283,7 @@ APC: Weapon: ApcVulcanLineAP PauseOnCondition: empdisable || !Attacking || attack-air LocalOffset: 350,0,700 - CasingWeapon: CasingDebris + CasingWeapon: CasingDebrisLong CasingSpawnLocalOffset: 350,0,700 CasingTargetOffset: -1024,0, 0 RequiresCondition: apammo @@ -292,7 +292,7 @@ APC: Weapon: ApcVulcanLineAA PauseOnCondition: empdisable || !Attacking || attack-ground LocalOffset: 290,0,1020 - CasingWeapon: CasingDebris + CasingWeapon: CasingDebrisLong CasingSpawnLocalOffset: 290,0,1020 CasingTargetOffset: -1024,0, 0 RequiresCondition: !apammo @@ -301,7 +301,7 @@ APC: Weapon: ApcVulcanLineAPAA PauseOnCondition: empdisable || !Attacking || attack-ground LocalOffset: 290,0,1020 - CasingWeapon: CasingDebris + CasingWeapon: CasingDebrisLong CasingSpawnLocalOffset: 290,0,1020 CasingTargetOffset: -1024,0, 0 RequiresCondition: apammo @@ -701,7 +701,7 @@ HMEC: Weapon: MKIIVulcanLine LocalOffset: 1638,0,800, 1638,0,800 Name: tertiary - CasingWeapon: CasingDebris + CasingWeapon: CasingDebrisLong CasingSpawnLocalOffset: 1638,0,800, 1638,0,800 CasingTargetOffset: 620, 512, 0, 620, -512, 0 PauseOnCondition: empdisable @@ -710,7 +710,7 @@ HMEC: Weapon: MKIIVulcanLineAP LocalOffset: 1638,0,800, 1638,0,800 Name: tertiary - CasingWeapon: CasingDebris + CasingWeapon: CasingDebrisLong CasingSpawnLocalOffset: 1638,0,800, 1638,0,800 CasingTargetOffset: 620, 512, 0, 620, -512, 0 PauseOnCondition: empdisable @@ -1967,7 +1967,7 @@ MUTQUAD: Armament@Fakebullet: Weapon: QuadFireLine LocalOffset: 800,90,370, 800,-90,370 - CasingWeapon: CasingDebris + CasingWeapon: CasingDebrisLong CasingSpawnLocalOffset: 100,20,400, 100,-20,400 CasingTargetOffset: -256, 512, 0, -256, -512, 0 PauseOnCondition: empdisable || attack-air @@ -1977,7 +1977,7 @@ MUTQUAD: Weapon: QuadFireLineAA Name: secondary LocalOffset: 500,90,1000, 500,-90,1000 - CasingWeapon: CasingDebris + CasingWeapon: CasingDebrisLong CasingSpawnLocalOffset: 100,20,600, 100,-20,600 CasingTargetOffset: -256, 512, 0, -256, -512, 0 PauseOnCondition: empdisable || attack-ground diff --git a/mods/sp/weapons/explosionweapons.yaml b/mods/sp/weapons/explosionweapons.yaml index 64889126d..b0a52a3fb 100644 --- a/mods/sp/weapons/explosionweapons.yaml +++ b/mods/sp/weapons/explosionweapons.yaml @@ -363,21 +363,23 @@ AmmoCrateExplo: SparkDebris: Range: 1c00 ReloadDelay: 100 - Projectile: Bullet - Speed: 50, 125 - Inaccuracy: 256 - InaccuracyType: PerCellIncrement - LaunchAngle: 200, 250 + Projectile: ProjetcileHusk Image: sparkprojectile + Velocity: 30, 0, 200 + VelocityRandomFactor: 50, 50, 200 + Acceleration: 0, 0, -30 + HorizontalRevert: true + UseRangeModifierAsVelocityX: false LightningSparkDebris: Range: 1c00 - Projectile: Bullet - Speed: 55, 90 - Inaccuracy: 4c0 - InaccuracyType: PerCellIncrement - LaunchAngle: 150, 250 + Projectile: ProjetcileHusk Image: sparkprojectile + Velocity: 30, 0, 300 + VelocityRandomFactor: 50, 50, 400 + Acceleration: 0, 0, -30 + HorizontalRevert: true + UseRangeModifierAsVelocityX: false Warhead@2Eff: CreateEffect Explosions: marnflash7 ExplosionPalette: MarnAlphaAlpha @@ -386,14 +388,14 @@ CasingDebris: ReloadDelay: 60 Range: 0c1 ValidTargets: Infantry, Vehicle, Building, Wall, Ground, Water, Air - Projectile: Bullet - Speed: 150 - Inaccuracy: 0c256 - InaccuracyType: Absolute - LaunchAngle: 164 + Projectile: ProjetcileHusk + Velocity: 50, 0, 100 + VelocityRandomFactor: 0, 15, 30 + Acceleration: 0, 0, -30 + HorizontalRevert: true Image: casing Sequences: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 - Shadow: true + UseRangeModifierAsVelocityX: false Warhead@: CreateEffect Explosions: casingscorch, casingscorch2, casingscorch3, casingscorch4, casingscorch5, casingscorch6, casingscorch7 ExplosionPalette: effect @@ -409,40 +411,47 @@ CasingDebris: AirThreshold: 8c0 ImpactActors: false +CasingDebrisLong: + Inherits: CasingDebris + Projectile: ProjetcileHusk + Velocity: 100, 0, 100 + VelocityRandomFactor: 0, 25, 30 + ShellCasingDebris: Inherits: CasingDebris MinRange: 0c512 Range: 1c764 - Projectile: Bullet - Speed: 100 - Inaccuracy: 128 - LaunchAngle: 164 + Projectile: ProjetcileHusk + Velocity: 90, 0, 100 + VelocityRandomFactor: 0, 30, 30 Image: shellcasing + Shadow: true Warhead@: CreateEffect Explosions: shellcasingscorch, shellcasingscorch2, shellcasingscorch3, shellcasingscorch4, shellcasingscorch5, shellcasingscorch6, shellcasingscorch7 WoodDebris: - Inherits: CasingDebris ReloadDelay: 60 Range: 1c0 - Projectile: Bullet - Speed: 50, 125 - Inaccuracy: 256 - LaunchAngle: 91, 255 - Image: wooddebris + Projectile: ProjetcileHusk + Velocity: 25, 0, 80 + VelocityRandomFactor: 0, 25, 150 + Acceleration: 0, 0, -15 + HorizontalRevert: true Shadow: true + UseRangeModifierAsVelocityX: false + Image: wooddebris + Sequences: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 Warhead@: CreateEffect Explosions: woodbits, woodbits2, woodbits3, woodbits4, woodbits5, woodbits6, woodbits7 WoodDebrisBig: + Inherits: WoodDebris ReloadDelay: 60 Range: 2c0 - Projectile: Bullet - Speed: 25, 60 - Inaccuracy: 256 - LaunchAngle: 180, 255 + Projectile: ProjetcileHusk + Velocity: 15, 0, 20 + VelocityRandomFactor: 0, 15, 90 Image: wooddebrisbig - Sequences: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 Shadow: true Warhead@: CreateEffect Explosions: woodbitsbig, woodbitsbig2, woodbitsbig3, woodbitsbig4, woodbitsbig5, woodbitsbig6, woodbitsbig7 @@ -453,11 +462,12 @@ SmallDebris: ReloadDelay: 60 Range: 4c0 Report: - Projectile: Bullet - Speed: 50, 125 - Inaccuracy: 4c0 - InaccuracyType: PerCellIncrement - LaunchAngle: 91, 255 + Projectile: ProjetcileHusk + Velocity: 30, 0, 300 + VelocityRandomFactor: 50, 50, 400 + Acceleration: 0, 0, -15 + HorizontalRevert: true + UseRangeModifierAsVelocityX: false Image: dbrissm Sequences: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 Shadow: true @@ -470,9 +480,12 @@ LargeDebris: ReloadDelay: 60 Range: 4c0 Report: - Projectile: BulletAS - Speed: 50, 125 - LaunchAngle: 91, 255 + Projectile: ProjetcileHusk + Velocity: 20, 0, 300 + VelocityRandomFactor: 40, 40, 300 + Acceleration: 0, 0, -15 + HorizontalRevert: true + UseRangeModifierAsVelocityX: false Image: dbrislg Sequences: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 Shadow: true @@ -484,7 +497,7 @@ LargeDebris: SmallDebrisScrin: Inherits: SmallDebris - Projectile: BulletAS + Projectile: ProjetcileHusk Palette: jascblue Warhead@2: SpawnSmokeParticle Sequences: scrinfire3, scrinfire4 @@ -493,7 +506,7 @@ SmallDebrisScrin: LargeDebrisScrin: Inherits: LargeDebris - Projectile: BulletAS + Projectile: ProjetcileHusk Palette: jascblue Warhead@2: SpawnSmokeParticle Sequences: scrinfire2, scrinfire3 @@ -504,7 +517,7 @@ LargeDebrisScrin: TSmallDebris: Inherits: SmallDebris - Projectile: BulletAS + Projectile: ProjetcileHusk Palette: greentibpal -Warhead@2: Warhead@2Eff: CreateEffect @@ -516,7 +529,7 @@ TSmallDebris: TLargeDebris: Inherits: LargeDebris - Projectile: BulletAS + Projectile: ProjetcileHusk Palette: greentibpal -Warhead@2: Warhead@2Eff: CreateEffect @@ -533,7 +546,6 @@ QuickSmoke: Warhead@smoke: CreateEffect Delay: 0 - QuickTibSmoke: Inherits: ^DelayedSmokeEffect Range: 2c0 diff --git a/mods/sp/weapons/mutweapons.yaml b/mods/sp/weapons/mutweapons.yaml index 4d779c7ce..0f0fef261 100644 --- a/mods/sp/weapons/mutweapons.yaml +++ b/mods/sp/weapons/mutweapons.yaml @@ -1133,7 +1133,7 @@ MutSWLightningCharge: Warhead@5op: FireRadius Weapon: LightningSparkDebris ImpactActors: false - Amount: 1 + Amount: 2 ValidTargets: Infantry, Vehicle, Building, Wall, Ground, Water, Air AirThreshold: 8c0 -Warhead@6Eff: