Introduce WarheadArgs
- Passes additional arguments to warheads on impact - Uses that to reduce parameter count of DoImpact by 1
This commit is contained in:
@@ -45,9 +45,18 @@ namespace OpenRA.Mods.Cnc.Effects
|
||||
public void Tick(World world)
|
||||
{
|
||||
anim.Tick();
|
||||
|
||||
if (!impacted && weaponDelay-- <= 0)
|
||||
{
|
||||
weapon.Impact(target, firedBy.PlayerActor, Enumerable.Empty<int>());
|
||||
var warheadArgs = new WarheadArgs
|
||||
{
|
||||
Weapon = weapon,
|
||||
Source = target.CenterPosition,
|
||||
SourceActor = firedBy.PlayerActor,
|
||||
WeaponTarget = target
|
||||
};
|
||||
|
||||
weapon.Impact(target, warheadArgs);
|
||||
impacted = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace OpenRA.Mods.Cnc.Projectiles
|
||||
target = args.Weapon.TargetActorCenter ? args.GuidedTarget.CenterPosition : args.GuidedTarget.Positions.PositionClosestTo(args.Source);
|
||||
|
||||
if (damageDuration-- > 0)
|
||||
args.Weapon.Impact(Target.FromPos(target), args.SourceActor, args.DamageModifiers);
|
||||
args.Weapon.Impact(Target.FromPos(target), new WarheadArgs(args));
|
||||
}
|
||||
|
||||
public IEnumerable<IRenderable> Render(WorldRenderer wr)
|
||||
|
||||
@@ -90,7 +90,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
{
|
||||
var blockers = self.World.ActorMap.GetActorsAt(loc).Where(a => !a.IsDead && a != self);
|
||||
foreach (var blocker in blockers)
|
||||
info.WeaponInfo.Impact(Target.FromActor(blocker), self, Enumerable.Empty<int>());
|
||||
info.WeaponInfo.Impact(Target.FromActor(blocker), self);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -217,7 +217,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
if (mad.info.ThumpDamageWeapon != null)
|
||||
{
|
||||
// Use .FromPos since this weapon needs to affect more than just the MadTank actor
|
||||
mad.info.ThumpDamageWeaponInfo.Impact(Target.FromPos(self.CenterPosition), self, Enumerable.Empty<int>());
|
||||
mad.info.ThumpDamageWeaponInfo.Impact(Target.FromPos(self.CenterPosition), self);
|
||||
}
|
||||
|
||||
screenShaker.AddEffect(mad.info.ThumpShakeTime, self.CenterPosition, mad.info.ThumpShakeIntensity, mad.info.ThumpShakeMultiplier);
|
||||
@@ -241,7 +241,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
if (mad.info.DetonationWeapon != null)
|
||||
{
|
||||
// Use .FromPos since this actor is killed. Cannot use Target.FromActor
|
||||
mad.info.DetonationWeaponInfo.Impact(Target.FromPos(self.CenterPosition), self, Enumerable.Empty<int>());
|
||||
mad.info.DetonationWeaponInfo.Impact(Target.FromPos(self.CenterPosition), self);
|
||||
}
|
||||
|
||||
self.Kill(self, mad.info.DamageTypes);
|
||||
|
||||
Reference in New Issue
Block a user