Merge pull request #12606 from reaperrr/forward-bombs2
Add forward movement support to GravityBomb
This commit is contained in:
@@ -34,10 +34,11 @@ namespace OpenRA.Mods.Common.Projectiles
|
|||||||
|
|
||||||
[PaletteReference] public readonly string ShadowPalette = "shadow";
|
[PaletteReference] public readonly string ShadowPalette = "shadow";
|
||||||
|
|
||||||
public readonly WDist Speed = WDist.Zero;
|
[Desc("Projectile movement vector per tick (forward, right, up), use negative values for opposite directions.")]
|
||||||
|
public readonly WVec Velocity = WVec.Zero;
|
||||||
|
|
||||||
[Desc("Value added to speed every tick.")]
|
[Desc("Value added to Velocity every tick.")]
|
||||||
public readonly WDist Acceleration = new WDist(15);
|
public readonly WVec Acceleration = new WVec(0, 0, -15);
|
||||||
|
|
||||||
public IProjectile Create(ProjectileArgs args) { return new GravityBomb(this, args); }
|
public IProjectile Create(ProjectileArgs args) { return new GravityBomb(this, args); }
|
||||||
}
|
}
|
||||||
@@ -47,17 +48,18 @@ namespace OpenRA.Mods.Common.Projectiles
|
|||||||
readonly GravityBombInfo info;
|
readonly GravityBombInfo info;
|
||||||
readonly Animation anim;
|
readonly Animation anim;
|
||||||
readonly ProjectileArgs args;
|
readonly ProjectileArgs args;
|
||||||
|
readonly WVec acceleration;
|
||||||
[Sync] WVec velocity;
|
[Sync] WVec velocity;
|
||||||
[Sync] WPos pos;
|
[Sync] WPos pos;
|
||||||
[Sync] WVec acceleration;
|
|
||||||
|
|
||||||
public GravityBomb(GravityBombInfo info, ProjectileArgs args)
|
public GravityBomb(GravityBombInfo info, ProjectileArgs args)
|
||||||
{
|
{
|
||||||
this.info = info;
|
this.info = info;
|
||||||
this.args = args;
|
this.args = args;
|
||||||
pos = args.Source;
|
pos = args.Source;
|
||||||
velocity = new WVec(WDist.Zero, WDist.Zero, -info.Speed);
|
var convertedVelocity = new WVec(info.Velocity.Y, -info.Velocity.X, info.Velocity.Z);
|
||||||
acceleration = new WVec(WDist.Zero, WDist.Zero, info.Acceleration);
|
velocity = convertedVelocity.Rotate(WRot.FromFacing(args.Facing));
|
||||||
|
acceleration = new WVec(info.Acceleration.Y, -info.Acceleration.X, info.Acceleration.Z);
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(info.Image))
|
if (!string.IsNullOrEmpty(info.Image))
|
||||||
{
|
{
|
||||||
@@ -72,8 +74,8 @@ namespace OpenRA.Mods.Common.Projectiles
|
|||||||
|
|
||||||
public void Tick(World world)
|
public void Tick(World world)
|
||||||
{
|
{
|
||||||
velocity -= acceleration;
|
|
||||||
pos += velocity;
|
pos += velocity;
|
||||||
|
velocity += acceleration;
|
||||||
|
|
||||||
if (pos.Z <= args.PassiveTarget.Z)
|
if (pos.Z <= args.PassiveTarget.Z)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -624,6 +624,29 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
|||||||
node.Key = "TrackTarget";
|
node.Key = "TrackTarget";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Refactor GravityBomb Speed WDist to Velocity WVec and Acceleration from vertical WDist to vector
|
||||||
|
if (engineVersion < 20170329)
|
||||||
|
{
|
||||||
|
var projectile = node.Value.Nodes.FirstOrDefault(n => n.Key == "Projectile");
|
||||||
|
if (projectile != null && projectile.Value.Value == "GravityBomb")
|
||||||
|
{
|
||||||
|
var speedNode = projectile.Value.Nodes.FirstOrDefault(x => x.Key == "Speed");
|
||||||
|
if (speedNode != null)
|
||||||
|
{
|
||||||
|
var oldWDistSpeed = FieldLoader.GetValue<string>("Speed", speedNode.Value.Value);
|
||||||
|
speedNode.Value.Value = "0, 0, -" + oldWDistSpeed;
|
||||||
|
speedNode.Key = "Velocity";
|
||||||
|
}
|
||||||
|
|
||||||
|
var accelNode = projectile.Value.Nodes.FirstOrDefault(x => x.Key == "Acceleration");
|
||||||
|
if (accelNode != null)
|
||||||
|
{
|
||||||
|
var oldWDistAccel = FieldLoader.GetValue<string>("Acceleration", accelNode.Value.Value);
|
||||||
|
accelNode.Value.Value = "0, 0, -" + oldWDistAccel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
UpgradeWeaponRules(modData, engineVersion, ref node.Value.Nodes, node, depth + 1);
|
UpgradeWeaponRules(modData, engineVersion, ref node.Value.Nodes, node, depth + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,8 +55,8 @@ OrniBomb:
|
|||||||
Range: 2c0
|
Range: 2c0
|
||||||
Projectile: GravityBomb
|
Projectile: GravityBomb
|
||||||
Image: BOMBS
|
Image: BOMBS
|
||||||
Speed: 64
|
Velocity: 0, 0, -64
|
||||||
Acceleration: 0
|
Acceleration: 0, 0, 0
|
||||||
Shadow: true
|
Shadow: true
|
||||||
Warhead@1Dam: SpreadDamage
|
Warhead@1Dam: SpreadDamage
|
||||||
Spread: 320
|
Spread: 320
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ ParaBomb:
|
|||||||
Projectile: GravityBomb
|
Projectile: GravityBomb
|
||||||
Image: PARABOMB
|
Image: PARABOMB
|
||||||
OpenSequence: open
|
OpenSequence: open
|
||||||
Speed: 86
|
Velocity: 0, 0, -86
|
||||||
Acceleration: 0
|
Acceleration: 0, 0, 0
|
||||||
Warhead@1Dam: SpreadDamage
|
Warhead@1Dam: SpreadDamage
|
||||||
Spread: 768
|
Spread: 768
|
||||||
Damage: 300
|
Damage: 300
|
||||||
|
|||||||
@@ -26,10 +26,11 @@ FireballLauncher:
|
|||||||
Bomb:
|
Bomb:
|
||||||
ReloadDelay: 60
|
ReloadDelay: 60
|
||||||
Burst: 5
|
Burst: 5
|
||||||
BurstDelay: 5
|
BurstDelay: 6
|
||||||
Range: 2c0
|
Range: 2c512
|
||||||
Projectile: GravityBomb
|
Projectile: GravityBomb
|
||||||
Speed: 170
|
Velocity: 72, 0, -90
|
||||||
|
Acceleration: 0, 0, -8
|
||||||
Image: 120mm
|
Image: 120mm
|
||||||
Shadow: true
|
Shadow: true
|
||||||
Palette: ra
|
Palette: ra
|
||||||
|
|||||||
Reference in New Issue
Block a user