Add ImpactOrientation to WarheadArgs
Allows to pass the horizontal facing/yaw and vertical angle/pitch of the carrier projectile to warheads for further use. Add ImpactPosition to WarheadArgs InflictDamage doesn't pass the impact pos directly, and the very point of WarheadArgs is to avoid adding more and more arguments to the warhead methods.
This commit is contained in:
@@ -122,7 +122,7 @@ namespace OpenRA.Mods.Common.Projectiles
|
||||
ContrailRenderable contrail;
|
||||
|
||||
[Sync]
|
||||
WPos pos, target, source;
|
||||
WPos pos, lastPos, target, source;
|
||||
|
||||
int length;
|
||||
int ticks, smokeTicks;
|
||||
@@ -200,7 +200,7 @@ namespace OpenRA.Mods.Common.Projectiles
|
||||
if (anim != null)
|
||||
anim.Tick();
|
||||
|
||||
var lastPos = pos;
|
||||
lastPos = pos;
|
||||
pos = WPos.LerpQuadratic(source, target, angle, ticks, length);
|
||||
|
||||
// Check for walls or other blocking obstacles
|
||||
@@ -287,7 +287,13 @@ namespace OpenRA.Mods.Common.Projectiles
|
||||
|
||||
world.AddFrameEndTask(w => w.Remove(this));
|
||||
|
||||
args.Weapon.Impact(Target.FromPos(pos), new WarheadArgs(args));
|
||||
var warheadArgs = new WarheadArgs(args)
|
||||
{
|
||||
ImpactOrientation = new WRot(WAngle.Zero, Util.GetVerticalAngle(lastPos, pos), args.Facing),
|
||||
ImpactPosition = pos,
|
||||
};
|
||||
|
||||
args.Weapon.Impact(Target.FromPos(pos), warheadArgs);
|
||||
}
|
||||
|
||||
bool AnyValidTargetsInRadius(World world, WPos pos, WDist radius, Actor firedBy, bool checkTargetType)
|
||||
|
||||
Reference in New Issue
Block a user