Merge pull request #8760 from atlimit8/RangeMultiplier
Added [I]RangeMultiplier & made UpgradeMultiplierTraitInfo implement ITraitInfo
This commit is contained in:
@@ -12,6 +12,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.GameRules;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA
|
||||
{
|
||||
@@ -41,6 +42,10 @@ namespace OpenRA
|
||||
Music = new ReadOnlyDictionary<string, MusicInfo>(music);
|
||||
TileSets = new ReadOnlyDictionary<string, TileSet>(tileSets);
|
||||
Sequences = new ReadOnlyDictionary<string, SequenceProvider>(sequences);
|
||||
|
||||
foreach (var a in Actors.Values)
|
||||
foreach (var t in a.TraitInfos<IRulesetLoaded>())
|
||||
t.RulesetLoaded(this, a);
|
||||
}
|
||||
|
||||
public IEnumerable<KeyValuePair<string, MusicInfo>> InstalledMusic { get { return Music.Where(m => m.Value.Exists); } }
|
||||
|
||||
@@ -21,6 +21,7 @@ namespace OpenRA.GameRules
|
||||
public WeaponInfo Weapon;
|
||||
public int[] DamageModifiers;
|
||||
public int[] InaccuracyModifiers;
|
||||
public int[] RangeModifiers;
|
||||
public int Facing;
|
||||
public WPos Source;
|
||||
public Actor SourceActor;
|
||||
|
||||
@@ -218,6 +218,8 @@ namespace OpenRA.Traits
|
||||
public interface IFirepowerModifier { int GetFirepowerModifier(); }
|
||||
public interface IReloadModifier { int GetReloadModifier(); }
|
||||
public interface IInaccuracyModifier { int GetInaccuracyModifier(); }
|
||||
public interface IRangeModifier { int GetRangeModifier(); }
|
||||
public interface IRangeModifierInfo : ITraitInfo { int GetRangeModifierDefault(); }
|
||||
public interface IPowerModifier { int GetPowerModifier(); }
|
||||
public interface ILoadsPalettes { void LoadPalettes(WorldRenderer wr); }
|
||||
public interface ILoadsPlayerPalettes { void LoadPlayerPalettes(WorldRenderer wr, string playerName, HSLColor playerColor, bool replaceExisting); }
|
||||
@@ -368,4 +370,6 @@ namespace OpenRA.Traits
|
||||
{
|
||||
bool RemoveActor(Actor self, Player owner);
|
||||
}
|
||||
|
||||
public interface IRulesetLoaded : ITraitInfo { void RulesetLoaded(Ruleset rules, ActorInfo ai); }
|
||||
}
|
||||
|
||||
@@ -21,15 +21,15 @@ namespace OpenRA.Mods.Common.Activities
|
||||
readonly AttackBase attack;
|
||||
readonly IMove move;
|
||||
readonly IFacing facing;
|
||||
readonly Armament armament;
|
||||
readonly WDist minRange;
|
||||
readonly WDist maxRange;
|
||||
readonly IPositionable positionable;
|
||||
|
||||
public Attack(Actor self, Target target, WDist minRange, WDist maxRange, bool allowMovement)
|
||||
public Attack(Actor self, Target target, Armament armament, bool allowMovement)
|
||||
{
|
||||
Target = target;
|
||||
this.minRange = minRange;
|
||||
this.maxRange = maxRange;
|
||||
this.minRange = armament.Weapon.MinRange;
|
||||
this.armament = armament;
|
||||
|
||||
attack = self.Trait<AttackBase>();
|
||||
facing = self.Trait<IFacing>();
|
||||
@@ -65,6 +65,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
return NextActivity;
|
||||
|
||||
// Try to move within range
|
||||
var maxRange = armament.MaxRange();
|
||||
if (move != null && (!Target.IsInRange(self.CenterPosition, maxRange) || Target.IsInRange(self.CenterPosition, minRange)))
|
||||
return Util.SequenceActivities(move.MoveWithinRange(Target, minRange, maxRange), this);
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@ namespace OpenRA.Mods.Common.Activities
|
||||
{
|
||||
public class Heal : Attack
|
||||
{
|
||||
public Heal(Actor self, Target target, WDist minRange, WDist maxRange, bool allowMovement)
|
||||
: base(self, target, minRange, maxRange, allowMovement) { }
|
||||
public Heal(Actor self, Target target, Armament armament, bool allowMovement)
|
||||
: base(self, target, armament, allowMovement) { }
|
||||
|
||||
protected override Activity InnerTick(Actor self, AttackBase attack)
|
||||
{
|
||||
|
||||
@@ -108,7 +108,8 @@ namespace OpenRA.Mods.Common.Effects
|
||||
if (info.Inaccuracy.Length > 0)
|
||||
{
|
||||
var inaccuracy = OpenRA.Traits.Util.ApplyPercentageModifiers(info.Inaccuracy.Length, args.InaccuracyModifiers);
|
||||
var maxOffset = inaccuracy * (target - pos).Length / args.Weapon.Range.Length;
|
||||
var range = OpenRA.Traits.Util.ApplyPercentageModifiers(args.Weapon.Range.Length, args.RangeModifiers);
|
||||
var maxOffset = inaccuracy * (target - pos).Length / range;
|
||||
target += WVec.FromPDF(world.SharedRandom, 2) * maxOffset / 1024;
|
||||
}
|
||||
|
||||
|
||||
@@ -365,6 +365,7 @@
|
||||
<Compile Include="Traits\Multipliers\ReloadDelayMultiplier.cs" />
|
||||
<Compile Include="Traits\Multipliers\SpeedMultiplier.cs" />
|
||||
<Compile Include="Traits\Multipliers\PowerMultiplier.cs" />
|
||||
<Compile Include="Traits\Multipliers\RangeMultiplier.cs" />
|
||||
<Compile Include="Traits\PaletteEffects\CloakPaletteEffect.cs" />
|
||||
<Compile Include="Traits\PaletteEffects\GlobalLightingPaletteEffect.cs" />
|
||||
<Compile Include="Traits\PaletteEffects\FlashPaletteEffect.cs" />
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
// Bombs drop anywhere in range
|
||||
foreach (var a in Armaments.Where(a => a.Info.Name == info.Bombs))
|
||||
{
|
||||
if (!target.IsInRange(self.CenterPosition, a.Weapon.Range))
|
||||
if (!target.IsInRange(self.CenterPosition, a.MaxRange()))
|
||||
continue;
|
||||
|
||||
inAttackRange = true;
|
||||
@@ -72,10 +72,10 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
foreach (var a in Armaments.Where(a => a.Info.Name == info.Guns))
|
||||
{
|
||||
if (!target.IsInRange(self.CenterPosition, a.Weapon.Range))
|
||||
if (!target.IsInRange(self.CenterPosition, a.MaxRange()))
|
||||
continue;
|
||||
|
||||
var t = Target.FromPos(cp - new WVec(0, a.Weapon.Range.Length / 2, cp.Z).Rotate(WRot.FromFacing(f)));
|
||||
var t = Target.FromPos(cp - new WVec(0, a.MaxRange().Length / 2, cp.Z).Rotate(WRot.FromFacing(f)));
|
||||
inAttackRange = true;
|
||||
a.CheckFire(self, facing.Value, t);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
|
||||
[Desc("Allows you to attach weapons to the unit (use @IdentifierSuffix for > 1)")]
|
||||
public class ArmamentInfo : UpgradableTraitInfo, Requires<AttackBaseInfo>
|
||||
public class ArmamentInfo : UpgradableTraitInfo, IRulesetLoaded, Requires<AttackBaseInfo>
|
||||
{
|
||||
public readonly string Name = "primary";
|
||||
|
||||
@@ -62,7 +62,18 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Use multiple muzzle images if non-zero")]
|
||||
public readonly int MuzzleSplitFacings = 0;
|
||||
|
||||
public WeaponInfo WeaponInfo { get; private set; }
|
||||
public WDist ModifiedRange { get; private set; }
|
||||
|
||||
public override object Create(ActorInitializer init) { return new Armament(init.Self, this); }
|
||||
|
||||
public void RulesetLoaded(Ruleset rules, ActorInfo ai)
|
||||
{
|
||||
WeaponInfo = rules.Weapons[Weapon.ToLowerInvariant()];
|
||||
ModifiedRange = new WDist(Util.ApplyPercentageModifiers(
|
||||
WeaponInfo.Range.Length,
|
||||
ai.TraitInfos<IRangeModifierInfo>().Select(m => m.GetRangeModifierDefault())));
|
||||
}
|
||||
}
|
||||
|
||||
public class Armament : UpgradableTrait<ArmamentInfo>, ITick, IExplodeModifier
|
||||
@@ -75,6 +86,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
Lazy<BodyOrientation> coords;
|
||||
Lazy<AmmoPool> ammoPool;
|
||||
List<Pair<int, Action>> delayedActions = new List<Pair<int, Action>>();
|
||||
Lazy<IEnumerable<int>> rangeModifiers;
|
||||
|
||||
public WDist Recoil;
|
||||
public int FireDelay { get; private set; }
|
||||
@@ -89,8 +101,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
turret = Exts.Lazy(() => self.TraitsImplementing<Turreted>().FirstOrDefault(t => t.Name == info.Turret));
|
||||
coords = Exts.Lazy(() => self.Trait<BodyOrientation>());
|
||||
ammoPool = Exts.Lazy(() => self.TraitsImplementing<AmmoPool>().FirstOrDefault(la => la.Info.Name == info.AmmoPoolName));
|
||||
rangeModifiers = Exts.Lazy(() => self.TraitsImplementing<IRangeModifier>().ToArray().Select(m => m.GetRangeModifier()));
|
||||
|
||||
Weapon = self.World.Map.Rules.Weapons[info.Weapon.ToLowerInvariant()];
|
||||
Weapon = info.WeaponInfo;
|
||||
Burst = Weapon.Burst;
|
||||
|
||||
var barrels = new List<Barrel>();
|
||||
@@ -109,6 +122,11 @@ namespace OpenRA.Mods.Common.Traits
|
||||
Barrels = barrels.ToArray();
|
||||
}
|
||||
|
||||
public WDist MaxRange()
|
||||
{
|
||||
return new WDist(Util.ApplyPercentageModifiers(Weapon.Range.Length, rangeModifiers.Value));
|
||||
}
|
||||
|
||||
public void Tick(Actor self)
|
||||
{
|
||||
if (IsTraitDisabled)
|
||||
@@ -148,7 +166,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (ammoPool.Value != null && !ammoPool.Value.HasAmmo())
|
||||
return null;
|
||||
|
||||
if (!target.IsInRange(self.CenterPosition, Weapon.Range))
|
||||
if (!target.IsInRange(self.CenterPosition, MaxRange()))
|
||||
return null;
|
||||
|
||||
if (Weapon.MinRange != WDist.Zero && target.IsInRange(self.CenterPosition, Weapon.MinRange))
|
||||
@@ -172,6 +190,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
InaccuracyModifiers = self.TraitsImplementing<IInaccuracyModifier>()
|
||||
.Select(a => a.GetInaccuracyModifier()).ToArray(),
|
||||
|
||||
RangeModifiers = self.TraitsImplementing<IRangeModifier>()
|
||||
.Select(a => a.GetRangeModifier()).ToArray(),
|
||||
|
||||
Source = muzzlePosition,
|
||||
SourceActor = self,
|
||||
PassiveTarget = target.CenterPosition,
|
||||
|
||||
@@ -179,7 +179,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return WDist.Zero;
|
||||
|
||||
return Armaments.Where(a => !a.IsTraitDisabled)
|
||||
.Select(a => a.Weapon.Range)
|
||||
.Select(a => a.MaxRange())
|
||||
.Append(WDist.Zero).Max();
|
||||
}
|
||||
|
||||
@@ -227,7 +227,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
IsQueued = modifiers.HasModifier(TargetModifiers.ForceQueue);
|
||||
|
||||
var a = ab.ChooseArmamentForTarget(target);
|
||||
cursor = a != null && !target.IsInRange(self.CenterPosition, a.Weapon.Range)
|
||||
cursor = a != null && !target.IsInRange(self.CenterPosition, a.MaxRange())
|
||||
? ab.Info.OutsideRangeCursor
|
||||
: ab.Info.Cursor;
|
||||
|
||||
|
||||
@@ -85,8 +85,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|| (target.Type == TargetType.FrozenActor && target.FrozenActor.Info.HasTraitInfo<IMoveInfo>());
|
||||
|
||||
// Try and sit at least one cell closer than the max range to give some leeway if the target starts moving.
|
||||
var maxRange = targetIsMobile ? new WDist(Math.Max(weapon.Weapon.MinRange.Length, weapon.Weapon.Range.Length - 1024))
|
||||
: weapon.Weapon.Range;
|
||||
var modifiedRange = weapon.MaxRange();
|
||||
var maxRange = targetIsMobile ? new WDist(Math.Max(weapon.Weapon.MinRange.Length, modifiedRange.Length - 1024))
|
||||
: modifiedRange;
|
||||
|
||||
attack.Target = target;
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (a == null)
|
||||
return null;
|
||||
|
||||
return new Activities.Attack(self, newTarget, a.Weapon.MinRange, a.Weapon.Range, allowMove);
|
||||
return new Activities.Attack(self, newTarget, a, allowMove);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (a == null)
|
||||
return null;
|
||||
|
||||
return new Activities.Heal(self, newTarget, a.Weapon.MinRange, a.Weapon.Range, allowMove);
|
||||
return new Activities.Heal(self, newTarget, a, allowMove);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,9 +16,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Damage taken by this actor is multiplied based on upgrade level.",
|
||||
"Decrease to increase actor's apparent strength.",
|
||||
"Use 0 to make actor invulnerable.")]
|
||||
public class DamageMultiplierInfo : UpgradeMultiplierTraitInfo, ITraitInfo
|
||||
public class DamageMultiplierInfo : UpgradeMultiplierTraitInfo
|
||||
{
|
||||
public object Create(ActorInitializer init) { return new DamageMultiplier(this, init.Self.Info.Name); }
|
||||
public override object Create(ActorInitializer init) { return new DamageMultiplier(this, init.Self.Info.Name); }
|
||||
}
|
||||
|
||||
public class DamageMultiplier : UpgradeMultiplierTrait, IDamageModifier
|
||||
|
||||
@@ -13,9 +13,9 @@ using OpenRA.Traits;
|
||||
namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
[Desc("The firepower of this actor is multiplied based on upgrade level if specified.")]
|
||||
public class FirepowerMultiplierInfo : UpgradeMultiplierTraitInfo, ITraitInfo
|
||||
public class FirepowerMultiplierInfo : UpgradeMultiplierTraitInfo
|
||||
{
|
||||
public object Create(ActorInitializer init) { return new FirepowerMultiplier(this, init.Self.Info.Name); }
|
||||
public override object Create(ActorInitializer init) { return new FirepowerMultiplier(this, init.Self.Info.Name); }
|
||||
}
|
||||
|
||||
public class FirepowerMultiplier : UpgradeMultiplierTrait, IFirepowerModifier
|
||||
|
||||
@@ -13,9 +13,9 @@ using OpenRA.Traits;
|
||||
namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
[Desc("The inaccuracy of this actor is multipled based on upgrade level if specified.")]
|
||||
public class InaccuracyMultiplierInfo : UpgradeMultiplierTraitInfo, ITraitInfo
|
||||
public class InaccuracyMultiplierInfo : UpgradeMultiplierTraitInfo
|
||||
{
|
||||
public object Create(ActorInitializer init) { return new InaccuracyMultiplier(this, init.Self.Info.Name); }
|
||||
public override object Create(ActorInitializer init) { return new InaccuracyMultiplier(this, init.Self.Info.Name); }
|
||||
}
|
||||
|
||||
public class InaccuracyMultiplier : UpgradeMultiplierTrait, IInaccuracyModifier
|
||||
|
||||
@@ -14,9 +14,9 @@ using OpenRA.Traits;
|
||||
namespace OpenRA.Mods.Common
|
||||
{
|
||||
[Desc("The power usage/output of this actor is multiplied based on upgrade level if specified.")]
|
||||
public class PowerMultiplierInfo : UpgradeMultiplierTraitInfo, ITraitInfo
|
||||
public class PowerMultiplierInfo : UpgradeMultiplierTraitInfo
|
||||
{
|
||||
public object Create(ActorInitializer init) { return new PowerMultiplier(init.Self, this); }
|
||||
public override object Create(ActorInitializer init) { return new PowerMultiplier(init.Self, this); }
|
||||
}
|
||||
|
||||
public class PowerMultiplier : UpgradeMultiplierTrait, IPowerModifier, INotifyOwnerChanged
|
||||
|
||||
37
OpenRA.Mods.Common/Traits/Multipliers/RangeMultiplier.cs
Normal file
37
OpenRA.Mods.Common/Traits/Multipliers/RangeMultiplier.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2015 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using OpenRA;
|
||||
using OpenRA.GameRules;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
[Desc("Range of this actor is multiplied based on upgrade level.")]
|
||||
public class RangeMultiplierInfo : UpgradeMultiplierTraitInfo, IRangeModifierInfo
|
||||
{
|
||||
public override object Create(ActorInitializer init) { return new RangeMultiplier(this, init.Self.Info.Name); }
|
||||
|
||||
public int GetRangeModifierDefault()
|
||||
{
|
||||
return BaseLevel > 0 || UpgradeTypes.Length == 0 ? 100 : Modifier[0];
|
||||
}
|
||||
}
|
||||
|
||||
public class RangeMultiplier : UpgradeMultiplierTrait, IRangeModifier
|
||||
{
|
||||
public RangeMultiplier(RangeMultiplierInfo info, string actorType)
|
||||
: base(info, "RangeMultiplier", actorType) { }
|
||||
|
||||
public int GetRangeModifier() { return GetModifier(); }
|
||||
}
|
||||
}
|
||||
@@ -13,9 +13,9 @@ using OpenRA.Traits;
|
||||
namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
[Desc("The reloading time of this actor is multiplied based on upgrade level if specified.")]
|
||||
public class ReloadDelayMultiplierInfo : UpgradeMultiplierTraitInfo, ITraitInfo
|
||||
public class ReloadDelayMultiplierInfo : UpgradeMultiplierTraitInfo
|
||||
{
|
||||
public object Create(ActorInitializer init) { return new ReloadDelayMultiplier(this, init.Self.Info.Name); }
|
||||
public override object Create(ActorInitializer init) { return new ReloadDelayMultiplier(this, init.Self.Info.Name); }
|
||||
}
|
||||
|
||||
public class ReloadDelayMultiplier : UpgradeMultiplierTrait, IReloadModifier
|
||||
|
||||
@@ -13,9 +13,9 @@ using OpenRA.Traits;
|
||||
namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
[Desc("The speed of this actor is multiplied based on upgrade level if specified.")]
|
||||
public class SpeedMultiplierInfo : UpgradeMultiplierTraitInfo, ITraitInfo
|
||||
public class SpeedMultiplierInfo : UpgradeMultiplierTraitInfo
|
||||
{
|
||||
public object Create(ActorInitializer init) { return new SpeedMultiplier(this, init.Self.Info.Name); }
|
||||
public override object Create(ActorInitializer init) { return new SpeedMultiplier(this, init.Self.Info.Name); }
|
||||
}
|
||||
|
||||
public class SpeedMultiplier : UpgradeMultiplierTrait, ISpeedModifier
|
||||
|
||||
@@ -15,7 +15,7 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
public abstract class UpgradeMultiplierTraitInfo
|
||||
public abstract class UpgradeMultiplierTraitInfo : ITraitInfo
|
||||
{
|
||||
[UpgradeUsedReference]
|
||||
[Desc("Accepted upgrade types.")]
|
||||
@@ -29,6 +29,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
"Repeat last entry to accept time extensions.",
|
||||
"If no upgrade types are specified, then the first/only modifier is always applied.")]
|
||||
public readonly int[] Modifier = { };
|
||||
|
||||
public abstract object Create(ActorInitializer init);
|
||||
}
|
||||
|
||||
public abstract class UpgradeMultiplierTrait : IUpgradable, IDisabledTrait, ISync
|
||||
|
||||
@@ -18,22 +18,18 @@ using OpenRA.Traits;
|
||||
namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
[Desc("Draw a circle indicating my weapon's range.")]
|
||||
class RenderRangeCircleInfo : ITraitInfo, IPlaceBuildingDecorationInfo, Requires<AttackBaseInfo>
|
||||
class RenderRangeCircleInfo : ITraitInfo, IPlaceBuildingDecorationInfo, IRulesetLoaded, Requires<AttackBaseInfo>
|
||||
{
|
||||
public readonly string RangeCircleType = null;
|
||||
|
||||
[Desc("Range to draw if no armaments are available")]
|
||||
public readonly WDist FallbackRange = WDist.Zero;
|
||||
|
||||
// Computed range
|
||||
WDist range;
|
||||
|
||||
public IEnumerable<IRenderable> Render(WorldRenderer wr, World w, ActorInfo ai, WPos centerPosition)
|
||||
{
|
||||
var armaments = ai.TraitInfos<ArmamentInfo>()
|
||||
.Where(a => a.UpgradeMinEnabledLevel == 0);
|
||||
var range = FallbackRange;
|
||||
|
||||
if (armaments.Any())
|
||||
range = armaments.Select(a => w.Map.Rules.Weapons[a.Weapon.ToLowerInvariant()].Range).Max();
|
||||
|
||||
if (range == WDist.Zero)
|
||||
yield break;
|
||||
|
||||
@@ -52,6 +48,15 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
|
||||
public object Create(ActorInitializer init) { return new RenderRangeCircle(init.Self); }
|
||||
public void RulesetLoaded(Ruleset rules, ActorInfo ai)
|
||||
{
|
||||
var armaments = ai.TraitInfos<ArmamentInfo>().Where(a => a.UpgradeMinEnabledLevel == 0);
|
||||
|
||||
if (armaments.Any())
|
||||
range = armaments.Select(a => a.ModifiedRange).Max();
|
||||
else
|
||||
range = FallbackRange;
|
||||
}
|
||||
}
|
||||
|
||||
class RenderRangeCircle : IPostRenderSelection
|
||||
|
||||
@@ -55,6 +55,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
InaccuracyModifiers = self.TraitsImplementing<IInaccuracyModifier>()
|
||||
.Select(a => a.GetInaccuracyModifier()).ToArray(),
|
||||
|
||||
RangeModifiers = self.TraitsImplementing<IRangeModifier>()
|
||||
.Select(a => a.GetRangeModifier()).ToArray(),
|
||||
|
||||
Source = self.CenterPosition,
|
||||
SourceActor = self,
|
||||
PassiveTarget = self.CenterPosition + new WVec(range, 0, 0).Rotate(rotation)
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace OpenRA.Mods.D2k.Traits
|
||||
if (a == null)
|
||||
return;
|
||||
|
||||
if (!target.IsInRange(self.CenterPosition, a.Weapon.Range))
|
||||
if (!target.IsInRange(self.CenterPosition, a.MaxRange()))
|
||||
return;
|
||||
|
||||
self.CancelActivity();
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace OpenRA.Mods.RA.Traits
|
||||
if (a == null)
|
||||
return;
|
||||
|
||||
if (!target.IsInRange(self.CenterPosition, a.Weapon.Range))
|
||||
if (!target.IsInRange(self.CenterPosition, a.MaxRange()))
|
||||
return;
|
||||
|
||||
self.CancelActivity();
|
||||
|
||||
Reference in New Issue
Block a user