Fix Bullet to consider DistanceAboveTerrain

This commit is contained in:
reaperrr
2015-09-11 19:28:42 +02:00
parent 74da2a2c72
commit 33dc50d29c

View File

@@ -164,8 +164,14 @@ namespace OpenRA.Mods.Common.Effects
if (info.ContrailLength > 0)
contrail.Update(pos);
if (ticks++ >= length || (info.Blockable && world.ActorMap
.GetUnitsAt(world.Map.CellContaining(pos)).Any(a => a.Info.HasTraitInfo<IBlocksProjectilesInfo>())))
var cell = world.Map.CellContaining(pos);
var height = world.Map.DistanceAboveTerrain(pos);
var shouldExplode = height.Length <= 0 // Hit the ground
|| ticks++ >= length // Flight length reached/exceeded
|| (info.Blockable && world.ActorMap.GetUnitsAt(cell).Any(a => a.Info.HasTraitInfo<IBlocksProjectilesInfo>())); // Hit a wall or other blocking obstacle
if (shouldExplode)
Explode(world);
}