Allow the missile to snap at the target at reach.
This commit is contained in:
@@ -136,6 +136,10 @@ namespace OpenRA.Mods.Common.Projectiles
|
|||||||
[Desc("Explodes when leaving the following terrain type, e.g., Water for torpedoes.")]
|
[Desc("Explodes when leaving the following terrain type, e.g., Water for torpedoes.")]
|
||||||
public readonly string BoundToTerrainType = "";
|
public readonly string BoundToTerrainType = "";
|
||||||
|
|
||||||
|
[Desc("Allow the missile to snap to the target, meaning jumping to the target immediately when",
|
||||||
|
"the missile enters the radius of the current speed around the target.")]
|
||||||
|
public readonly bool AllowSnapping = false;
|
||||||
|
|
||||||
[Desc("Explodes when inside this proximity radius to target.",
|
[Desc("Explodes when inside this proximity radius to target.",
|
||||||
"Note: If this value is lower than the missile speed, this check might",
|
"Note: If this value is lower than the missile speed, this check might",
|
||||||
"not trigger fast enough, causing the missile to fly past the target.")]
|
"not trigger fast enough, causing the missile to fly past the target.")]
|
||||||
@@ -813,6 +817,9 @@ namespace OpenRA.Mods.Common.Projectiles
|
|||||||
|
|
||||||
// Move the missile
|
// Move the missile
|
||||||
var lastPos = pos;
|
var lastPos = pos;
|
||||||
|
if (info.AllowSnapping && state != States.Freefall && relTarDist < move.Length)
|
||||||
|
pos = targetPosition + offset;
|
||||||
|
else
|
||||||
pos += move;
|
pos += move;
|
||||||
|
|
||||||
// Check for walls or other blocking obstacles
|
// Check for walls or other blocking obstacles
|
||||||
|
|||||||
Reference in New Issue
Block a user