Rewrite GravityBomb with world coords and gravity.
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
#region Copyright & License Information
|
#region Copyright & License Information
|
||||||
/*
|
/*
|
||||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
* Copyright 2007-2013 The OpenRA Developers (see AUTHORS)
|
||||||
* This file is part of OpenRA, which is free software. It is made
|
* This file is part of OpenRA, which is free software. It is made
|
||||||
* available to you under the terms of the GNU General Public License
|
* available to you under the terms of the GNU General Public License
|
||||||
* as published by the Free Software Foundation. For more information,
|
* as published by the Free Software Foundation. For more information,
|
||||||
@@ -19,22 +19,26 @@ namespace OpenRA.Mods.RA.Effects
|
|||||||
public class GravityBombInfo : IProjectileInfo
|
public class GravityBombInfo : IProjectileInfo
|
||||||
{
|
{
|
||||||
public readonly string Image = null;
|
public readonly string Image = null;
|
||||||
|
public readonly WRange Velocity = WRange.Zero;
|
||||||
|
public readonly WRange Acceleration = new WRange(15);
|
||||||
|
|
||||||
public IEffect Create(ProjectileArgs args) { return new GravityBomb(this, args); }
|
public IEffect Create(ProjectileArgs args) { return new GravityBomb(this, args); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class GravityBomb : IEffect
|
public class GravityBomb : IEffect
|
||||||
{
|
{
|
||||||
|
GravityBombInfo info;
|
||||||
Animation anim;
|
Animation anim;
|
||||||
int2 dest;
|
ProjectileArgs args;
|
||||||
int altitude, destAltitude;
|
WVec velocity;
|
||||||
ProjectileArgs Args;
|
WPos pos;
|
||||||
|
|
||||||
public GravityBomb(GravityBombInfo info, ProjectileArgs args)
|
public GravityBomb(GravityBombInfo info, ProjectileArgs args)
|
||||||
{
|
{
|
||||||
Args = args;
|
this.info = info;
|
||||||
altitude = args.source.Z * Game.CellSize / 1024;
|
this.args = args;
|
||||||
destAltitude = args.passiveTarget.Z * Game.CellSize / 1024;
|
pos = args.source;
|
||||||
dest = PPos.FromWPos(args.passiveTarget).ToInt2();
|
velocity = new WVec(WRange.Zero, WRange.Zero, -info.Velocity);
|
||||||
|
|
||||||
anim = new Animation(info.Image);
|
anim = new Animation(info.Image);
|
||||||
if (anim.HasSequence("open"))
|
if (anim.HasSequence("open"))
|
||||||
@@ -45,10 +49,13 @@ namespace OpenRA.Mods.RA.Effects
|
|||||||
|
|
||||||
public void Tick(World world)
|
public void Tick(World world)
|
||||||
{
|
{
|
||||||
if (--altitude <= destAltitude)
|
velocity -= new WVec(WRange.Zero, WRange.Zero, info.Acceleration);
|
||||||
|
pos += velocity;
|
||||||
|
|
||||||
|
if (pos.Z <= args.passiveTarget.Z)
|
||||||
{
|
{
|
||||||
world.AddFrameEndTask(w => w.Remove(this));
|
world.AddFrameEndTask(w => w.Remove(this));
|
||||||
Combat.DoImpacts(Args.passiveTarget, Args.sourceActor, Args.weapon, Args.firepowerModifier);
|
Combat.DoImpacts(args.passiveTarget, args.sourceActor, args.weapon, args.firepowerModifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
anim.Tick();
|
anim.Tick();
|
||||||
@@ -56,8 +63,7 @@ namespace OpenRA.Mods.RA.Effects
|
|||||||
|
|
||||||
public IEnumerable<IRenderable> Render(WorldRenderer wr)
|
public IEnumerable<IRenderable> Render(WorldRenderer wr)
|
||||||
{
|
{
|
||||||
var pos = dest - new int2(0, altitude) - .5f * anim.Image.size;
|
return anim.Render(pos, wr.Palette("effect"));
|
||||||
yield return new SpriteRenderable(anim.Image, pos, wr.Palette("effect"), dest.Y);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -865,6 +865,8 @@ ParaBomb:
|
|||||||
Report: CHUTE1.AUD
|
Report: CHUTE1.AUD
|
||||||
Projectile: GravityBomb
|
Projectile: GravityBomb
|
||||||
Image: PARABOMB
|
Image: PARABOMB
|
||||||
|
Velocity: 43
|
||||||
|
Acceleration: 0
|
||||||
Warhead:
|
Warhead:
|
||||||
Spread: 6
|
Spread: 6
|
||||||
Versus:
|
Versus:
|
||||||
@@ -1284,4 +1286,4 @@ Mandible:
|
|||||||
Heavy: 10%
|
Heavy: 10%
|
||||||
Concrete: 10%
|
Concrete: 10%
|
||||||
InfDeath: 1
|
InfDeath: 1
|
||||||
Damage: 60
|
Damage: 60
|
||||||
|
|||||||
Reference in New Issue
Block a user