Add margin to CreateEffectWarhead isAir check

This commit is contained in:
reaperrr
2015-08-11 14:10:02 +02:00
parent 4bc8a60fb9
commit 0b9fb4420b

View File

@@ -39,8 +39,13 @@ namespace OpenRA.Mods.Common.Warheads
public static ImpactType GetImpactType(World world, CPos cell, WPos pos)
{
// Missiles need a margin because they sometimes explode a little above ground
// due to their explosion check triggering slightly too early (because of CloseEnough).
// TODO: Base ImpactType on target altitude instead of explosion altitude.
var airMargin = new WDist(128);
var dat = world.Map.DistanceAboveTerrain(pos);
var isAir = dat.Length > 0;
var isAir = dat.Length > airMargin.Length;
var isWater = dat.Length <= 0 && world.Map.GetTerrainInfo(cell).IsWater;
var isDirectHit = GetDirectHit(world, cell, pos);