Add plumbing for customizable vertical ProximityTrigger range

And check DistanceAboveTerrain instead of just vertical distance to upgrade
source.
This is necessary to avoid situations where an actor is technically on the right
vertical distance above/below ground, but not upgraded because it is located on a lower/higher terrain level than the upgrade source.
This commit is contained in:
reaperrr
2016-01-28 23:13:29 +01:00
parent b254d5fa88
commit b0e90989a6
4 changed files with 20 additions and 15 deletions

View File

@@ -67,7 +67,7 @@ namespace OpenRA.Mods.Common.Traits
return;
// TODO: Eventually support CellTriggers as well
proximityTrigger = self.World.ActorMap.AddProximityTrigger(self.CenterPosition, Info.Range, ActorEntered, ActorLeft);
proximityTrigger = self.World.ActorMap.AddProximityTrigger(self.CenterPosition, Info.Range, WDist.Zero, ActorEntered, ActorLeft);
}
void INotifyRemovedFromWorld.RemovedFromWorld(Actor self)
@@ -84,7 +84,7 @@ namespace OpenRA.Mods.Common.Traits
if (!self.IsInWorld || self.CenterPosition == prevPosition)
return;
self.World.ActorMap.UpdateProximityTrigger(proximityTrigger, self.CenterPosition, Info.Range);
self.World.ActorMap.UpdateProximityTrigger(proximityTrigger, self.CenterPosition, Info.Range, WDist.Zero);
prevPosition = self.CenterPosition;
}