unhack that a bit; delayed damage works
This commit is contained in:
@@ -69,6 +69,19 @@ namespace OpenRA
|
||||
(int)GetDamageToInflict(victim, args, warhead, firepowerModifier), warhead);
|
||||
}
|
||||
|
||||
public static void DoImpacts(ProjectileArgs args, int2 visualLocation)
|
||||
{
|
||||
foreach (var warhead in args.weapon.Warheads)
|
||||
{
|
||||
Action a = () => DoImpact(warhead, args, visualLocation);
|
||||
if (warhead.Delay > 0)
|
||||
args.firedBy.World.AddFrameEndTask(
|
||||
w => w.Add(new DelayedAction(warhead.Delay, a)));
|
||||
else
|
||||
a();
|
||||
}
|
||||
}
|
||||
|
||||
static float GetMaximumSpread(WeaponInfo weapon, WarheadInfo warhead, float modifier)
|
||||
{
|
||||
return (int)(warhead.Spread * Math.Log(Math.Abs(weapon.Damage * modifier), 2));
|
||||
|
||||
@@ -78,11 +78,7 @@ namespace OpenRA.Effects
|
||||
{
|
||||
t += 40;
|
||||
|
||||
if (t > TotalTime()) /* remove finished bullets */
|
||||
{
|
||||
world.AddFrameEndTask(w => w.Remove(this));
|
||||
Combat.DoImpact(Args.weapon.Warheads[0], Args, VisualDest - new int2(0, Args.destAltitude));
|
||||
}
|
||||
if (t > TotalTime()) Explode( world );
|
||||
|
||||
if (Info.Trail != null)
|
||||
{
|
||||
@@ -126,5 +122,11 @@ namespace OpenRA.Effects
|
||||
Info.UnderWater ? "shadow" : Args.firedBy.Owner.Palette);
|
||||
}
|
||||
}
|
||||
|
||||
void Explode( World world )
|
||||
{
|
||||
world.AddFrameEndTask(w => w.Remove(this));
|
||||
Combat.DoImpacts(Args, VisualDest - new int2(0, Args.destAltitude));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ namespace OpenRA.GameRules
|
||||
public readonly string ImpactSound = null;
|
||||
public readonly string WaterImpactSound = null;
|
||||
public readonly int Damage = 0; // for new weapons infrastructure
|
||||
public readonly int Delay = 0; // delay in ticks before dealing the damage. 0=instant
|
||||
|
||||
public float EffectivenessAgainst(ArmorType at) { return Verses[ (int)at ]; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user