Merge pull request #10365 from reaperrr/fix-missile-effects

Misc Missile and CreateEffectWarhead tweaks
This commit is contained in:
Matthias Mailänder
2016-01-02 17:08:52 +01:00
2 changed files with 8 additions and 5 deletions

View File

@@ -76,6 +76,9 @@ namespace OpenRA.Mods.Common.Effects
[Desc("Vertical rate of turn.")]
public readonly int VerticalRateOfTurn = 6;
[Desc("Gravity applied while in free fall.")]
public readonly int Gravity = 10;
[Desc("Run out of fuel after being activated this many ticks. Zero for unlimited fuel.")]
public readonly int RangeLimit = 0;
@@ -152,8 +155,7 @@ namespace OpenRA.Mods.Common.Effects
readonly ProjectileArgs args;
readonly Animation anim;
// NOTE: Might be desirable to unhardcode the number -10
readonly WVec gravity = new WVec(0, 0, -10);
readonly WVec gravity;
int ticks;
@@ -191,6 +193,7 @@ namespace OpenRA.Mods.Common.Effects
pos = args.Source;
hFacing = args.Facing;
gravity = new WVec(0, 0, -info.Gravity);
targetPosition = args.PassiveTarget;
var world = args.SourceActor.World;

View File

@@ -52,7 +52,7 @@ namespace OpenRA.Mods.Common.Warheads
if (dat.Length > airMargin.Length)
return isDirectHit ? ImpactType.AirHit : ImpactType.Air;
if (dat.Length <= 0 && world.Map.GetTerrainInfo(cell).IsWater)
if (dat.Length <= airMargin.Length && world.Map.GetTerrainInfo(cell).IsWater)
return isDirectHit ? ImpactType.WaterHit : ImpactType.Water;
if (isDirectHit)
@@ -77,8 +77,8 @@ namespace OpenRA.Mods.Common.Warheads
if (healthInfo == null)
continue;
// If the impact position is within any actor's health radius, we have a direct hit
if ((unit.CenterPosition - pos).LengthSquared <= healthInfo.Shape.OuterRadius.LengthSquared)
// If the impact position is within any actor's HitShape, we have a direct hit
if ((unit.CenterPosition - pos).LengthSquared <= healthInfo.Shape.DistanceFromEdge(pos, unit).LengthSquared)
return true;
}