Rename Stance to PlayerRelationship
This commit is contained in:
@@ -229,11 +229,11 @@ namespace OpenRA
|
||||
return "{0} ({1})".F(PlayerName, ClientIndex);
|
||||
}
|
||||
|
||||
public Dictionary<Player, Stance> Stances = new Dictionary<Player, Stance>();
|
||||
public Dictionary<Player, PlayerRelationship> Stances = new Dictionary<Player, PlayerRelationship>();
|
||||
public bool IsAlliedWith(Player p)
|
||||
{
|
||||
// Observers are considered allies to active combatants
|
||||
return p == null || Stances[p] == Stance.Ally || (p.Spectating && !NonCombatant);
|
||||
return p == null || Stances[p] == PlayerRelationship.Ally || (p.Spectating && !NonCombatant);
|
||||
}
|
||||
|
||||
public Color PlayerStanceColor(Actor a)
|
||||
|
||||
@@ -38,9 +38,9 @@ namespace OpenRA.Traits
|
||||
|
||||
switch (viewer.Stances[a.Owner])
|
||||
{
|
||||
case Stance.Ally: return basePriority - PriorityRange;
|
||||
case Stance.Neutral: return basePriority - 2 * PriorityRange;
|
||||
case Stance.Enemy: return basePriority - 3 * PriorityRange;
|
||||
case PlayerRelationship.Ally: return basePriority - PriorityRange;
|
||||
case PlayerRelationship.Neutral: return basePriority - 2 * PriorityRange;
|
||||
case PlayerRelationship.Enemy: return basePriority - 3 * PriorityRange;
|
||||
|
||||
default:
|
||||
throw new InvalidOperationException();
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace OpenRA.Traits
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum Stance
|
||||
public enum PlayerRelationship
|
||||
{
|
||||
None = 0,
|
||||
Enemy = 1,
|
||||
@@ -78,7 +78,7 @@ namespace OpenRA.Traits
|
||||
|
||||
public static class StanceExts
|
||||
{
|
||||
public static bool HasStance(this Stance s, Stance stance)
|
||||
public static bool HasStance(this PlayerRelationship s, PlayerRelationship stance)
|
||||
{
|
||||
// PERF: Enum.HasFlag is slower and requires allocations.
|
||||
return (s & stance) == stance;
|
||||
@@ -196,7 +196,7 @@ namespace OpenRA.Traits
|
||||
|
||||
public interface ITooltipInfo : ITraitInfoInterface
|
||||
{
|
||||
string TooltipForPlayerStance(Stance stance);
|
||||
string TooltipForPlayerStance(PlayerRelationship stance);
|
||||
bool IsOwnerRowVisible { get; }
|
||||
}
|
||||
|
||||
|
||||
@@ -227,7 +227,7 @@ namespace OpenRA
|
||||
SetUpPlayerMask(p, q);
|
||||
|
||||
if (!p.Stances.ContainsKey(q))
|
||||
p.Stances[q] = Stance.Neutral;
|
||||
p.Stances[q] = PlayerRelationship.Neutral;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -254,11 +254,11 @@ namespace OpenRA
|
||||
|
||||
switch (p.Stances[q])
|
||||
{
|
||||
case Stance.Enemy:
|
||||
case Stance.Neutral:
|
||||
case PlayerRelationship.Enemy:
|
||||
case PlayerRelationship.Neutral:
|
||||
p.EnemyPlayersMask = p.EnemyPlayersMask.Union(bitSet);
|
||||
break;
|
||||
case Stance.Ally:
|
||||
case PlayerRelationship.Ally:
|
||||
p.AlliedPlayersMask = p.AlliedPlayersMask.Union(bitSet);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -90,8 +90,8 @@ namespace OpenRA
|
||||
|
||||
public static bool AreMutualAllies(Player a, Player b)
|
||||
{
|
||||
return a.Stances[b] == Stance.Ally &&
|
||||
b.Stances[a] == Stance.Ally;
|
||||
return a.Stances[b] == PlayerRelationship.Ally &&
|
||||
b.Stances[a] == PlayerRelationship.Ally;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace OpenRA.Mods.Cnc.Activities
|
||||
if (rearmableInfo != null && ammoPools.Any(p => p.Info.Name == minelayer.Info.AmmoPoolName && !p.HasAmmo))
|
||||
{
|
||||
// Rearm (and possibly repair) at rearm building, then back out here to refill the minefield some more
|
||||
rearmTarget = self.World.Actors.Where(a => self.Owner.Stances[a.Owner] == Stance.Ally && rearmableInfo.RearmActors.Contains(a.Info.Name))
|
||||
rearmTarget = self.World.Actors.Where(a => self.Owner.Stances[a.Owner] == PlayerRelationship.Ally && rearmableInfo.RearmActors.Contains(a.Info.Name))
|
||||
.ClosestTo(self);
|
||||
|
||||
if (rearmTarget == null)
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
public readonly string DisguisedCondition = null;
|
||||
|
||||
[Desc("What diplomatic stances can this actor disguise as.")]
|
||||
public readonly Stance ValidStances = Stance.Ally | Stance.Neutral | Stance.Enemy;
|
||||
public readonly PlayerRelationship ValidStances = PlayerRelationship.Ally | PlayerRelationship.Neutral | PlayerRelationship.Enemy;
|
||||
|
||||
[Desc("Target types of actors that this actor disguise as.")]
|
||||
public readonly BitSet<TargetableType> TargetTypes = new BitSet<TargetableType>("Disguise");
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
public readonly string Voice = "Action";
|
||||
|
||||
[Desc("What diplomatic stances can be infiltrated by this actor.")]
|
||||
public readonly Stance ValidStances = Stance.Neutral | Stance.Enemy;
|
||||
public readonly PlayerRelationship ValidStances = PlayerRelationship.Neutral | PlayerRelationship.Enemy;
|
||||
|
||||
[Desc("Behaviour when entering the target.",
|
||||
"Possible values are Exit, Suicide, Dispose.")]
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
if (!info.CrushClasses.Overlaps(crushClasses))
|
||||
return;
|
||||
|
||||
if (crusher.Info.HasTraitInfo<MineImmuneInfo>() || (self.Owner.Stances[crusher.Owner] == Stance.Ally && info.AvoidFriendly))
|
||||
if (crusher.Info.HasTraitInfo<MineImmuneInfo>() || (self.Owner.Stances[crusher.Owner] == PlayerRelationship.Ally && info.AvoidFriendly))
|
||||
return;
|
||||
|
||||
var mobile = crusher.TraitOrDefault<Mobile>();
|
||||
@@ -53,7 +53,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
|
||||
bool ICrushable.CrushableBy(Actor self, Actor crusher, BitSet<CrushClass> crushClasses)
|
||||
{
|
||||
if (info.BlockFriendly && !crusher.Info.HasTraitInfo<MineImmuneInfo>() && self.Owner.Stances[crusher.Owner] == Stance.Ally)
|
||||
if (info.BlockFriendly && !crusher.Info.HasTraitInfo<MineImmuneInfo>() && self.Owner.Stances[crusher.Owner] == PlayerRelationship.Ally)
|
||||
return false;
|
||||
|
||||
return info.CrushClasses.Overlaps(crushClasses);
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace OpenRA.Mods.Common
|
||||
|
||||
public static List<Actor> FindEnemiesByCommonName(HashSet<string> commonNames, Player player)
|
||||
{
|
||||
return player.World.Actors.Where(a => !a.IsDead && player.Stances[a.Owner] == Stance.Enemy &&
|
||||
return player.World.Actors.Where(a => !a.IsDead && player.Stances[a.Owner] == PlayerRelationship.Enemy &&
|
||||
commonNames.Contains(a.Info.Name)).ToList();
|
||||
}
|
||||
|
||||
|
||||
@@ -37,11 +37,11 @@ namespace OpenRA.Mods.Common
|
||||
public static bool AppearsFriendlyTo(this Actor self, Actor toActor)
|
||||
{
|
||||
var stance = toActor.Owner.Stances[self.Owner];
|
||||
if (stance == Stance.Ally)
|
||||
if (stance == PlayerRelationship.Ally)
|
||||
return true;
|
||||
|
||||
if (self.EffectiveOwner != null && self.EffectiveOwner.Disguised && !toActor.Info.HasTraitInfo<IgnoresDisguiseInfo>())
|
||||
return toActor.Owner.Stances[self.EffectiveOwner.Owner] == Stance.Ally;
|
||||
return toActor.Owner.Stances[self.EffectiveOwner.Owner] == PlayerRelationship.Ally;
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -49,13 +49,13 @@ namespace OpenRA.Mods.Common
|
||||
public static bool AppearsHostileTo(this Actor self, Actor toActor)
|
||||
{
|
||||
var stance = toActor.Owner.Stances[self.Owner];
|
||||
if (stance == Stance.Ally)
|
||||
if (stance == PlayerRelationship.Ally)
|
||||
return false; /* otherwise, we'll hate friendly disguised spies */
|
||||
|
||||
if (self.EffectiveOwner != null && self.EffectiveOwner.Disguised && !toActor.Info.HasTraitInfo<IgnoresDisguiseInfo>())
|
||||
return toActor.Owner.Stances[self.EffectiveOwner.Owner] == Stance.Enemy;
|
||||
return toActor.Owner.Stances[self.EffectiveOwner.Owner] == PlayerRelationship.Enemy;
|
||||
|
||||
return stance == Stance.Enemy;
|
||||
return stance == PlayerRelationship.Enemy;
|
||||
}
|
||||
|
||||
public static void NotifyBlocker(this Actor self, IEnumerable<Actor> blockers)
|
||||
|
||||
@@ -25,12 +25,12 @@ namespace OpenRA.Mods.Common.Effects
|
||||
readonly Player player;
|
||||
readonly Shroud.SourceType sourceType;
|
||||
readonly WDist revealRadius;
|
||||
readonly Stance validStances;
|
||||
readonly PlayerRelationship validStances;
|
||||
readonly int duration;
|
||||
|
||||
int ticks;
|
||||
|
||||
public RevealShroudEffect(WPos pos, WDist radius, Shroud.SourceType type, Player forPlayer, Stance stances, int delay = 0, int duration = 50)
|
||||
public RevealShroudEffect(WPos pos, WDist radius, Shroud.SourceType type, Player forPlayer, PlayerRelationship stances, int delay = 0, int duration = 50)
|
||||
{
|
||||
this.pos = pos;
|
||||
player = forPlayer;
|
||||
|
||||
@@ -52,10 +52,10 @@ namespace OpenRA.Mods.Common.Orders
|
||||
var owner = type == TargetType.FrozenActor ? target.FrozenActor.Owner : target.Actor.Owner;
|
||||
var playerRelationship = self.Owner.Stances[owner];
|
||||
|
||||
if (!modifiers.HasModifier(TargetModifiers.ForceAttack) && playerRelationship == Stance.Ally && !targetAllyUnits)
|
||||
if (!modifiers.HasModifier(TargetModifiers.ForceAttack) && playerRelationship == PlayerRelationship.Ally && !targetAllyUnits)
|
||||
return false;
|
||||
|
||||
if (!modifiers.HasModifier(TargetModifiers.ForceAttack) && playerRelationship == Stance.Enemy && !targetEnemyUnits)
|
||||
if (!modifiers.HasModifier(TargetModifiers.ForceAttack) && playerRelationship == PlayerRelationship.Enemy && !targetEnemyUnits)
|
||||
return false;
|
||||
|
||||
return type == TargetType.FrozenActor ?
|
||||
|
||||
@@ -97,7 +97,7 @@ namespace OpenRA.Mods.Common.Projectiles
|
||||
public readonly HashSet<string> InvalidBounceTerrain = new HashSet<string>();
|
||||
|
||||
[Desc("If projectile touches an actor with one of these stances during or after the first bounce, trigger explosion.")]
|
||||
public readonly Stance ValidBounceBlockerStances = Stance.Enemy | Stance.Neutral;
|
||||
public readonly PlayerRelationship ValidBounceBlockerStances = PlayerRelationship.Enemy | PlayerRelationship.Neutral;
|
||||
|
||||
[Desc("Altitude above terrain below which to explode. Zero effectively deactivates airburst.")]
|
||||
public readonly WDist AirburstAltitude = WDist.Zero;
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public readonly HashSet<string> ValidTypes = new HashSet<string>();
|
||||
|
||||
[Desc("Stance the delivering actor needs to enter.")]
|
||||
public readonly Stance ValidStances = Stance.Ally;
|
||||
public readonly PlayerRelationship ValidStances = PlayerRelationship.Ally;
|
||||
|
||||
[Desc("Play a randomly selected sound from this list when accepting cash.")]
|
||||
public readonly string[] Sounds = { };
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public readonly HashSet<string> ValidTypes = new HashSet<string>();
|
||||
|
||||
[Desc("Stance the delivering actor needs to enter.")]
|
||||
public readonly Stance ValidStances = Stance.Ally;
|
||||
public readonly PlayerRelationship ValidStances = PlayerRelationship.Ally;
|
||||
|
||||
public override object Create(ActorInitializer init) { return new AcceptsDeliveredExperience(init.Self, this); }
|
||||
}
|
||||
|
||||
@@ -670,7 +670,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
// We are not blocked by actors we can nudge out of the way
|
||||
// TODO: Generalize blocker checks and handling here and in Locomotor
|
||||
if (!blockedByMobile && self.Owner.Stances[otherActor.Owner] == Stance.Ally &&
|
||||
if (!blockedByMobile && self.Owner.Stances[otherActor.Owner] == PlayerRelationship.Ally &&
|
||||
otherActor.TraitOrDefault<Mobile>() != null && otherActor.CurrentActivity == null)
|
||||
return false;
|
||||
|
||||
|
||||
@@ -68,8 +68,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public WeaponInfo WeaponInfo { get; private set; }
|
||||
public WDist ModifiedRange { get; private set; }
|
||||
|
||||
public readonly Stance TargetStances = Stance.Enemy;
|
||||
public readonly Stance ForceTargetStances = Stance.Enemy | Stance.Neutral | Stance.Ally;
|
||||
public readonly PlayerRelationship TargetStances = PlayerRelationship.Enemy;
|
||||
public readonly PlayerRelationship ForceTargetStances = PlayerRelationship.Enemy | PlayerRelationship.Neutral | PlayerRelationship.Ally;
|
||||
|
||||
// TODO: instead of having multiple Armaments and unique AttackBase,
|
||||
// an actor should be able to have multiple AttackBases with
|
||||
|
||||
@@ -403,10 +403,10 @@ namespace OpenRA.Mods.Common.Traits
|
||||
&& (target.IsInRange(self.CenterPosition, GetMaximumRangeVersusTarget(target)) || (allowMove && self.Info.HasTraitInfo<IMoveInfo>()));
|
||||
}
|
||||
|
||||
public Stance UnforcedAttackTargetStances()
|
||||
public PlayerRelationship UnforcedAttackTargetStances()
|
||||
{
|
||||
// PERF: Avoid LINQ.
|
||||
var stances = Stance.None;
|
||||
var stances = PlayerRelationship.None;
|
||||
foreach (var armament in Armaments)
|
||||
if (!armament.IsTraitDisabled)
|
||||
stances |= armament.Info.TargetStances;
|
||||
@@ -444,7 +444,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
// targeting and attacking logic (which should be logically separate)
|
||||
// to use the same code
|
||||
if (target.Type == TargetType.Actor && target.Actor.EffectiveOwner != null &&
|
||||
target.Actor.EffectiveOwner.Disguised && self.Owner.Stances[target.Actor.Owner] == Stance.Enemy)
|
||||
target.Actor.EffectiveOwner.Disguised && self.Owner.Stances[target.Actor.Owner] == PlayerRelationship.Enemy)
|
||||
modifiers |= TargetModifiers.ForceAttack;
|
||||
|
||||
var forceAttack = modifiers.HasModifier(TargetModifiers.ForceAttack);
|
||||
|
||||
@@ -294,7 +294,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
// If we can't attack right now, there's no need to try and find a target.
|
||||
var attackStances = ab.UnforcedAttackTargetStances();
|
||||
if (attackStances != OpenRA.Traits.Stance.None)
|
||||
if (attackStances != OpenRA.Traits.PlayerRelationship.None)
|
||||
{
|
||||
var range = Info.ScanRadius > 0 ? WDist.FromCells(Info.ScanRadius) : ab.GetMaximumRange();
|
||||
return ChooseTarget(self, ab, attackStances, range, allowMove, allowTurn);
|
||||
@@ -337,7 +337,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
});
|
||||
}
|
||||
|
||||
Target ChooseTarget(Actor self, AttackBase ab, Stance attackStances, WDist scanRange, bool allowMove, bool allowTurn)
|
||||
Target ChooseTarget(Actor self, AttackBase ab, PlayerRelationship attackStances, WDist scanRange, bool allowMove, bool allowTurn)
|
||||
{
|
||||
var chosenTarget = Target.Invalid;
|
||||
var chosenTargetPriority = int.MinValue;
|
||||
@@ -362,7 +362,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
// can bail early and avoid the more expensive targeting checks and armament selection. For groups of
|
||||
// allied units, this helps significantly reduce the cost of auto target scans. This is important as
|
||||
// these groups will continuously rescan their allies until an enemy finally comes into range.
|
||||
if (attackStances == OpenRA.Traits.Stance.Enemy && !target.Actor.AppearsHostileTo(self))
|
||||
if (attackStances == OpenRA.Traits.PlayerRelationship.Enemy && !target.Actor.AppearsHostileTo(self))
|
||||
continue;
|
||||
|
||||
// Check whether we can auto-target this actor
|
||||
@@ -375,7 +375,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
else if (target.Type == TargetType.FrozenActor)
|
||||
{
|
||||
if (attackStances == OpenRA.Traits.Stance.Enemy && self.Owner.Stances[target.FrozenActor.Owner] == OpenRA.Traits.Stance.Ally)
|
||||
if (attackStances == OpenRA.Traits.PlayerRelationship.Enemy && self.Owner.Stances[target.FrozenActor.Owner] == OpenRA.Traits.PlayerRelationship.Ally)
|
||||
continue;
|
||||
|
||||
targetTypes = target.FrozenActor.TargetTypes;
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public readonly BitSet<TargetableType> InvalidTargets;
|
||||
|
||||
[Desc("Stances between actor's and target's owner which can be AutoTargeted.")]
|
||||
public readonly Stance ValidStances = Stance.Ally | Stance.Neutral | Stance.Enemy;
|
||||
public readonly PlayerRelationship ValidStances = PlayerRelationship.Ally | PlayerRelationship.Neutral | PlayerRelationship.Enemy;
|
||||
|
||||
[Desc("ValidTargets with larger priorities will be AutoTargeted before lower priorities.")]
|
||||
public readonly int Priority = 1;
|
||||
|
||||
@@ -212,7 +212,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (e.Attacker == null || e.Attacker.Disposed)
|
||||
return;
|
||||
|
||||
if (e.Attacker.Owner.Stances[self.Owner] != Stance.Enemy)
|
||||
if (e.Attacker.Owner.Stances[self.Owner] != PlayerRelationship.Enemy)
|
||||
return;
|
||||
|
||||
if (!e.Attacker.Info.HasTraitInfo<ITargetableInfo>())
|
||||
|
||||
@@ -409,7 +409,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
case BuildingType.Defense:
|
||||
|
||||
// Build near the closest enemy structure
|
||||
var closestEnemy = world.ActorsHavingTrait<Building>().Where(a => !a.Disposed && player.Stances[a.Owner] == Stance.Enemy)
|
||||
var closestEnemy = world.ActorsHavingTrait<Building>().Where(a => !a.Disposed && player.Stances[a.Owner] == PlayerRelationship.Enemy)
|
||||
.ClosestTo(world.Map.CenterOfCell(baseBuilder.DefenseCenter));
|
||||
|
||||
var targetCell = closestEnemy != null ? closestEnemy.Location : baseCenter;
|
||||
|
||||
@@ -118,7 +118,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public enum DecisionMetric { Health, Value, None }
|
||||
|
||||
[Desc("Against whom should this power be used?", "Allowed keywords: Ally, Neutral, Enemy")]
|
||||
public readonly Stance Against = Stance.Enemy;
|
||||
public readonly PlayerRelationship Against = PlayerRelationship.Enemy;
|
||||
|
||||
[Desc("What types should the desired targets of this power be?")]
|
||||
public readonly BitSet<TargetableType> Types = new BitSet<TargetableType>("Air", "Ground", "Water");
|
||||
@@ -138,7 +138,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
|
||||
/// <summary>Evaluates a single actor according to the rules defined in this consideration</summary>
|
||||
public int GetAttractiveness(Actor a, Stance stance, Player firedBy)
|
||||
public int GetAttractiveness(Actor a, PlayerRelationship stance, Player firedBy)
|
||||
{
|
||||
if (stance != Against)
|
||||
return 0;
|
||||
@@ -174,7 +174,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int GetAttractiveness(FrozenActor fa, Stance stance, Player firedBy)
|
||||
public int GetAttractiveness(FrozenActor fa, PlayerRelationship stance, Player firedBy)
|
||||
{
|
||||
if (stance != Against)
|
||||
return 0;
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
// HACK: We don't want D2k bots to repair all their buildings on placement
|
||||
// where half their HP is removed via neutral terrain damage.
|
||||
// TODO: Implement concrete placement for D2k bots and remove this hack.
|
||||
if (e.Attacker.Owner.Stances[self.Owner] == Stance.Neutral)
|
||||
if (e.Attacker.Owner.Stances[self.Owner] == PlayerRelationship.Neutral)
|
||||
return;
|
||||
|
||||
var rb = self.TraitOrDefault<RepairableBuilding>();
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public readonly bool CheckCaptureTargetsForVisibility = true;
|
||||
|
||||
[Desc("Player stances that capturers should attempt to target.")]
|
||||
public readonly Stance CapturableStances = Stance.Enemy | Stance.Neutral;
|
||||
public readonly PlayerRelationship CapturableStances = PlayerRelationship.Enemy | PlayerRelationship.Neutral;
|
||||
|
||||
public override object Create(ActorInitializer init) { return new CaptureManagerBotModule(init.Self, this); }
|
||||
}
|
||||
@@ -65,7 +65,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return;
|
||||
|
||||
isEnemyUnit = unit =>
|
||||
player.Stances[unit.Owner] == Stance.Enemy
|
||||
player.Stances[unit.Owner] == PlayerRelationship.Enemy
|
||||
&& !unit.Info.HasTraitInfo<HuskInfo>()
|
||||
&& unit.Info.HasTraitInfo<ITargetableInfo>();
|
||||
|
||||
|
||||
@@ -152,7 +152,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
var path = pathfinder.FindPath(
|
||||
PathSearch.Search(world, harv.Locomotor, actor, BlockedByActor.Stationary, isValidResource)
|
||||
.WithCustomCost(loc => world.FindActorsInCircle(world.Map.CenterOfCell(loc), Info.HarvesterEnemyAvoidanceRadius)
|
||||
.Where(u => !u.IsDead && actor.Owner.Stances[u.Owner] == Stance.Enemy)
|
||||
.Where(u => !u.IsDead && actor.Owner.Stances[u.Owner] == PlayerRelationship.Enemy)
|
||||
.Sum(u => Math.Max(WDist.Zero.Length, Info.HarvesterEnemyAvoidanceRadius.Length - (world.Map.CenterOfCell(loc) - u.CenterPosition).Length)))
|
||||
.FromPoint(actor.Location));
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
// Use for proactive targeting.
|
||||
public bool IsPreferredEnemyUnit(Actor a)
|
||||
{
|
||||
if (a == null || a.IsDead || Player.Stances[a.Owner] != Stance.Enemy || a.Info.HasTraitInfo<HuskInfo>())
|
||||
if (a == null || a.IsDead || Player.Stances[a.Owner] != PlayerRelationship.Enemy || a.Info.HasTraitInfo<HuskInfo>())
|
||||
return false;
|
||||
|
||||
var targetTypes = a.GetEnabledTargetTypes();
|
||||
|
||||
@@ -167,7 +167,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
foreach (var bp in world.ActorsWithTrait<BaseProvider>())
|
||||
{
|
||||
var validOwner = bp.Actor.Owner == p || (allyBuildEnabled && bp.Actor.Owner.Stances[p] == Stance.Ally);
|
||||
var validOwner = bp.Actor.Owner == p || (allyBuildEnabled && bp.Actor.Owner.Stances[p] == PlayerRelationship.Ally);
|
||||
if (!validOwner || !bp.Trait.Ready())
|
||||
continue;
|
||||
|
||||
@@ -217,7 +217,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (!a.IsInWorld)
|
||||
continue;
|
||||
|
||||
if (a.Owner != p && (!allyBuildEnabled || a.Owner.Stances[p] != Stance.Ally))
|
||||
if (a.Owner != p && (!allyBuildEnabled || a.Owner.Stances[p] != PlayerRelationship.Ally))
|
||||
continue;
|
||||
|
||||
if (ActorGrantsValidArea(a, requiresBuildableArea))
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
: base(info)
|
||||
{
|
||||
health = self.Trait<IHealth>();
|
||||
isNotActiveAlly = player => player.WinState != WinState.Undefined || player.Stances[self.Owner] != Stance.Ally;
|
||||
isNotActiveAlly = player => player.WinState != WinState.Undefined || player.Stances[self.Owner] != PlayerRelationship.Ally;
|
||||
}
|
||||
|
||||
[Sync]
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public readonly BitSet<CaptureType> Types = default(BitSet<CaptureType>);
|
||||
|
||||
[Desc("What diplomatic stances can be captured by this actor.")]
|
||||
public readonly Stance ValidStances = Stance.Neutral | Stance.Enemy;
|
||||
public readonly PlayerRelationship ValidStances = PlayerRelationship.Neutral | PlayerRelationship.Enemy;
|
||||
|
||||
[Desc("Cancel the actor's current activity when getting captured.")]
|
||||
public readonly bool CancelActivity = false;
|
||||
|
||||
@@ -109,13 +109,13 @@ namespace OpenRA.Mods.Common.Traits
|
||||
allyCapturableTypes = neutralCapturableTypes = enemyCapturableTypes = default(BitSet<CaptureType>);
|
||||
foreach (var c in enabledCapturable)
|
||||
{
|
||||
if (c.Info.ValidStances.HasStance(Stance.Ally))
|
||||
if (c.Info.ValidStances.HasStance(PlayerRelationship.Ally))
|
||||
allyCapturableTypes = allyCapturableTypes.Union(c.Info.Types);
|
||||
|
||||
if (c.Info.ValidStances.HasStance(Stance.Neutral))
|
||||
if (c.Info.ValidStances.HasStance(PlayerRelationship.Neutral))
|
||||
neutralCapturableTypes = neutralCapturableTypes.Union(c.Info.Types);
|
||||
|
||||
if (c.Info.ValidStances.HasStance(Stance.Enemy))
|
||||
if (c.Info.ValidStances.HasStance(PlayerRelationship.Enemy))
|
||||
enemyCapturableTypes = enemyCapturableTypes.Union(c.Info.Types);
|
||||
}
|
||||
}
|
||||
@@ -130,13 +130,13 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public bool CanBeTargetedBy(Actor self, Actor captor, CaptureManager captorManager)
|
||||
{
|
||||
var stance = self.Owner.Stances[captor.Owner];
|
||||
if (stance.HasStance(Stance.Enemy))
|
||||
if (stance.HasStance(PlayerRelationship.Enemy))
|
||||
return captorManager.capturesTypes.Overlaps(enemyCapturableTypes);
|
||||
|
||||
if (stance.HasStance(Stance.Neutral))
|
||||
if (stance.HasStance(PlayerRelationship.Neutral))
|
||||
return captorManager.capturesTypes.Overlaps(neutralCapturableTypes);
|
||||
|
||||
if (stance.HasStance(Stance.Ally))
|
||||
if (stance.HasStance(PlayerRelationship.Ally))
|
||||
return captorManager.capturesTypes.Overlaps(allyCapturableTypes);
|
||||
|
||||
return false;
|
||||
@@ -148,13 +148,13 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return false;
|
||||
|
||||
var stance = self.Owner.Stances[captor.Owner];
|
||||
if (stance.HasStance(Stance.Enemy))
|
||||
if (stance.HasStance(PlayerRelationship.Enemy))
|
||||
return captures.Info.CaptureTypes.Overlaps(enemyCapturableTypes);
|
||||
|
||||
if (stance.HasStance(Stance.Neutral))
|
||||
if (stance.HasStance(PlayerRelationship.Neutral))
|
||||
return captures.Info.CaptureTypes.Overlaps(neutralCapturableTypes);
|
||||
|
||||
if (stance.HasStance(Stance.Ally))
|
||||
if (stance.HasStance(PlayerRelationship.Ally))
|
||||
return captures.Info.CaptureTypes.Overlaps(allyCapturableTypes);
|
||||
|
||||
return false;
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public readonly int PlayerExperience = 0;
|
||||
|
||||
[Desc("Stance that the structure's previous owner needs to have for the capturing player to receive Experience.")]
|
||||
public readonly Stance PlayerExperienceStances = Stance.Enemy;
|
||||
public readonly PlayerRelationship PlayerExperienceStances = PlayerRelationship.Enemy;
|
||||
|
||||
[Desc("Cursor to display when the health of the target actor is above the sabotage threshold.")]
|
||||
public readonly string SabotageCursor = "capture";
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public readonly WDist MaximumVerticalOffset = WDist.Zero;
|
||||
|
||||
[Desc("What diplomatic stances are affected.")]
|
||||
public readonly Stance ValidStances = Stance.Ally;
|
||||
public readonly PlayerRelationship ValidStances = PlayerRelationship.Ally;
|
||||
|
||||
[Desc("Condition is applied permanently to this actor.")]
|
||||
public readonly bool AffectsParent = false;
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public class CreatesShroudInfo : AffectsShroudInfo
|
||||
{
|
||||
[Desc("Stance the watching player needs to see the generated shroud.")]
|
||||
public readonly Stance ValidStances = Stance.Neutral | Stance.Enemy;
|
||||
public readonly PlayerRelationship ValidStances = PlayerRelationship.Neutral | PlayerRelationship.Enemy;
|
||||
|
||||
public override object Create(ActorInitializer init) { return new CreatesShroud(init.Self, this); }
|
||||
}
|
||||
|
||||
@@ -44,8 +44,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Voice string when planting explosive charges.")]
|
||||
public readonly string Voice = "Action";
|
||||
|
||||
public readonly Stance TargetStances = Stance.Enemy | Stance.Neutral;
|
||||
public readonly Stance ForceTargetStances = Stance.Enemy | Stance.Neutral | Stance.Ally;
|
||||
public readonly PlayerRelationship TargetStances = PlayerRelationship.Enemy | PlayerRelationship.Neutral;
|
||||
public readonly PlayerRelationship ForceTargetStances = PlayerRelationship.Enemy | PlayerRelationship.Neutral | PlayerRelationship.Ally;
|
||||
|
||||
[Desc("Cursor to display when hovering over a demolishable target.")]
|
||||
public readonly string Cursor = "c4";
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public readonly EnterBehaviour EnterBehaviour = EnterBehaviour.Dispose;
|
||||
|
||||
[Desc("What diplomatic stances allow target to be repaired by this actor.")]
|
||||
public readonly Stance ValidStances = Stance.Ally;
|
||||
public readonly PlayerRelationship ValidStances = PlayerRelationship.Ally;
|
||||
|
||||
[Desc("Sound to play when repairing is done.")]
|
||||
public readonly string RepairSound = null;
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public readonly int Percentage = 10;
|
||||
|
||||
[Desc("Stance the attacking player needs to receive the bounty.")]
|
||||
public readonly Stance ValidStances = Stance.Neutral | Stance.Enemy;
|
||||
public readonly PlayerRelationship ValidStances = PlayerRelationship.Neutral | PlayerRelationship.Enemy;
|
||||
|
||||
[Desc("Whether to show a floating text announcing the won bounty.")]
|
||||
public readonly bool ShowBounty = true;
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public readonly int Experience = -1;
|
||||
|
||||
[Desc("Stance the attacking player needs to receive the experience.")]
|
||||
public readonly Stance ValidStances = Stance.Neutral | Stance.Enemy;
|
||||
public readonly PlayerRelationship ValidStances = PlayerRelationship.Neutral | PlayerRelationship.Enemy;
|
||||
|
||||
[Desc("Percentage of the `Experience` value that is being granted to the killing actor.")]
|
||||
public readonly int ActorExperienceModifier = 10000;
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public readonly WDist Range = WDist.Zero;
|
||||
|
||||
[Desc("What diplomatic stances are affected.")]
|
||||
public readonly Stance DeflectionStances = Stance.Ally | Stance.Neutral | Stance.Enemy;
|
||||
public readonly PlayerRelationship DeflectionStances = PlayerRelationship.Ally | PlayerRelationship.Neutral | PlayerRelationship.Enemy;
|
||||
|
||||
[Desc("Chance of deflecting missiles.")]
|
||||
public readonly int Chance = 100;
|
||||
@@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public class JamsMissiles : ConditionalTrait<JamsMissilesInfo>
|
||||
{
|
||||
public WDist Range { get { return IsTraitDisabled ? WDist.Zero : Info.Range; } }
|
||||
public Stance DeflectionStances { get { return Info.DeflectionStances; } }
|
||||
public PlayerRelationship DeflectionStances { get { return Info.DeflectionStances; } }
|
||||
public int Chance { get { return Info.Chance; } }
|
||||
|
||||
public JamsMissiles(JamsMissilesInfo info)
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public class FrozenUnderFogInfo : TraitInfo, Requires<BuildingInfo>, IDefaultVisibilityInfo
|
||||
{
|
||||
[Desc("Players with these stances can always see the actor.")]
|
||||
public readonly Stance AlwaysVisibleStances = Stance.Ally;
|
||||
public readonly PlayerRelationship AlwaysVisibleStances = PlayerRelationship.Ally;
|
||||
|
||||
public override object Create(ActorInitializer init) { return new FrozenUnderFog(init, this); }
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public class HiddenUnderShroudInfo : TraitInfo, IDefaultVisibilityInfo
|
||||
{
|
||||
[Desc("Players with these stances can always see the actor.")]
|
||||
public readonly Stance AlwaysVisibleStances = Stance.Ally;
|
||||
public readonly PlayerRelationship AlwaysVisibleStances = PlayerRelationship.Ally;
|
||||
|
||||
[Desc("Possible values are CenterPosition (reveal when the center is visible) and ",
|
||||
"Footprint (reveal when any footprint cell is visible).")]
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Traits.Radar
|
||||
public readonly bool UseLocation = false;
|
||||
|
||||
[Desc("Player stances who can view this actor on radar.")]
|
||||
public readonly Stance ValidStances = Stance.Ally | Stance.Neutral | Stance.Enemy;
|
||||
public readonly PlayerRelationship ValidStances = PlayerRelationship.Ally | PlayerRelationship.Neutral | PlayerRelationship.Enemy;
|
||||
|
||||
public override object Create(ActorInitializer init) { return new AppearsOnRadar(this); }
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
class CashTricklerBarInfo : TraitInfo, Requires<CashTricklerInfo>
|
||||
{
|
||||
[Desc("Defines to which players the bar is to be shown.")]
|
||||
public readonly Stance DisplayStances = Stance.Ally;
|
||||
public readonly PlayerRelationship DisplayStances = PlayerRelationship.Ally;
|
||||
|
||||
public readonly Color Color = Color.Magenta;
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
class SupportPowerChargeBarInfo : ConditionalTraitInfo
|
||||
{
|
||||
[Desc("Defines to which players the bar is to be shown.")]
|
||||
public readonly Stance DisplayStances = Stance.Ally;
|
||||
public readonly PlayerRelationship DisplayStances = PlayerRelationship.Ally;
|
||||
|
||||
public readonly Color Color = Color.Magenta;
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
public readonly string Position = "TopLeft";
|
||||
|
||||
[Desc("Player stances who can view the decoration.")]
|
||||
public readonly Stance ValidStances = Stance.Ally;
|
||||
public readonly PlayerRelationship ValidStances = PlayerRelationship.Ally;
|
||||
|
||||
[Desc("Should this be visible only when selected?")]
|
||||
public readonly bool RequiresSelection = false;
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
|
||||
[Desc("Stances of players which will be able to see the circle.",
|
||||
"Valid values are combinations of `None`, `Ally`, `Enemy` and `Neutral`.")]
|
||||
public readonly Stance ValidStances = Stance.Ally;
|
||||
public readonly PlayerRelationship ValidStances = PlayerRelationship.Ally;
|
||||
|
||||
[Desc("When to show the range circle. Valid values are `Always`, and `WhenSelected`")]
|
||||
public readonly RangeCircleVisibility Visible = RangeCircleVisibility.WhenSelected;
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public class RevealOnDeathInfo : ConditionalTraitInfo
|
||||
{
|
||||
[Desc("Stances relative to the actors' owner that shroud will be revealed for.")]
|
||||
public readonly Stance RevealForStances = Stance.Ally;
|
||||
public readonly PlayerRelationship RevealForStances = PlayerRelationship.Ally;
|
||||
|
||||
[Desc("Duration of the reveal.")]
|
||||
public readonly int Duration = 25;
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public readonly string[] ArmamentNames = { "primary", "secondary" };
|
||||
|
||||
[Desc("Stances relative to the target player this actor will be revealed to during firing.")]
|
||||
public readonly Stance RevealForStancesRelativeToTarget = Stance.Ally;
|
||||
public readonly PlayerRelationship RevealForStancesRelativeToTarget = PlayerRelationship.Ally;
|
||||
|
||||
[Desc("Duration of the reveal.")]
|
||||
public readonly int Duration = 25;
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public class RevealsMapInfo : ConditionalTraitInfo
|
||||
{
|
||||
[Desc("Stance the watching player needs to see the shroud removed.")]
|
||||
public readonly Stance ValidStances = Stance.Ally;
|
||||
public readonly PlayerRelationship ValidStances = PlayerRelationship.Ally;
|
||||
|
||||
[Desc("Can this actor reveal shroud generated by the `GeneratesShroud` trait?")]
|
||||
public readonly bool RevealGeneratedShroud = true;
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public class RevealsShroudInfo : AffectsShroudInfo
|
||||
{
|
||||
[Desc("Stance the watching player needs to see the shroud removed.")]
|
||||
public readonly Stance ValidStances = Stance.Ally;
|
||||
public readonly PlayerRelationship ValidStances = PlayerRelationship.Ally;
|
||||
|
||||
[Desc("Can this actor reveal shroud generated by the GeneratesShroud trait?")]
|
||||
public readonly bool RevealGeneratedShroud = true;
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.Traits.Sound
|
||||
public readonly string Voice = null;
|
||||
|
||||
[Desc("Player stances who can hear this voice.")]
|
||||
public readonly Stance ValidStances = Stance.Ally | Stance.Neutral | Stance.Enemy;
|
||||
public readonly PlayerRelationship ValidStances = PlayerRelationship.Ally | PlayerRelationship.Neutral | PlayerRelationship.Enemy;
|
||||
|
||||
[Desc("Play the voice to the owning player even if Stance.Ally is not included in ValidStances.")]
|
||||
public readonly bool PlayToOwner = true;
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public readonly string OnFireSound = null;
|
||||
|
||||
[Desc("Player stances which condition can be applied to.")]
|
||||
public readonly Stance ValidStances = Stance.Ally;
|
||||
public readonly PlayerRelationship ValidStances = PlayerRelationship.Ally;
|
||||
|
||||
[SequenceReference]
|
||||
[Desc("Sequence to play for granting actor when activated.",
|
||||
|
||||
@@ -95,7 +95,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public readonly bool RevealGeneratedShroud = true;
|
||||
|
||||
[Desc("Reveal cells to players with these stances only.")]
|
||||
public readonly Stance CameraStances = Stance.Ally;
|
||||
public readonly PlayerRelationship CameraStances = PlayerRelationship.Ally;
|
||||
|
||||
[Desc("Amount of time before detonation to spawn the camera.")]
|
||||
public readonly int CameraSpawnAdvance = 25;
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public readonly string IncomingSpeechNotification = null;
|
||||
|
||||
[Desc("Defines to which players the timer is shown.")]
|
||||
public readonly Stance DisplayTimerStances = Stance.None;
|
||||
public readonly PlayerRelationship DisplayTimerStances = PlayerRelationship.None;
|
||||
|
||||
[Desc("Beacons are only supported on the Airstrike, Paratroopers, and Nuke powers")]
|
||||
public readonly bool DisplayBeacon = false;
|
||||
|
||||
@@ -49,25 +49,25 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public readonly string EnemyPrefix = "Enemy";
|
||||
|
||||
[Desc("Player stances that the generic name should be shown to.")]
|
||||
public readonly Stance GenericVisibility = Stance.None;
|
||||
public readonly PlayerRelationship GenericVisibility = PlayerRelationship.None;
|
||||
|
||||
[Desc("Show the actor's owner and their faction flag")]
|
||||
public readonly bool ShowOwnerRow = true;
|
||||
|
||||
public override object Create(ActorInitializer init) { return new Tooltip(init.Self, this); }
|
||||
|
||||
public string TooltipForPlayerStance(Stance stance)
|
||||
public string TooltipForPlayerStance(PlayerRelationship stance)
|
||||
{
|
||||
if (stance == Stance.None || !GenericVisibility.HasStance(stance))
|
||||
if (stance == PlayerRelationship.None || !GenericVisibility.HasStance(stance))
|
||||
return Name;
|
||||
|
||||
if (GenericStancePrefix && !string.IsNullOrEmpty(AllyPrefix) && stance == Stance.Ally)
|
||||
if (GenericStancePrefix && !string.IsNullOrEmpty(AllyPrefix) && stance == PlayerRelationship.Ally)
|
||||
return AllyPrefix + " " + GenericName;
|
||||
|
||||
if (GenericStancePrefix && !string.IsNullOrEmpty(NeutralPrefix) && stance == Stance.Neutral)
|
||||
if (GenericStancePrefix && !string.IsNullOrEmpty(NeutralPrefix) && stance == PlayerRelationship.Neutral)
|
||||
return NeutralPrefix + " " + GenericName;
|
||||
|
||||
if (GenericStancePrefix && !string.IsNullOrEmpty(EnemyPrefix) && stance == Stance.Enemy)
|
||||
if (GenericStancePrefix && !string.IsNullOrEmpty(EnemyPrefix) && stance == PlayerRelationship.Enemy)
|
||||
return EnemyPrefix + " " + GenericName;
|
||||
|
||||
return GenericName;
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public readonly string Description = "";
|
||||
|
||||
[Desc("Player stances who can view the description.")]
|
||||
public readonly Stance ValidStances = Stance.Ally | Stance.Neutral | Stance.Enemy;
|
||||
public readonly PlayerRelationship ValidStances = PlayerRelationship.Ally | PlayerRelationship.Neutral | PlayerRelationship.Enemy;
|
||||
|
||||
public override object Create(ActorInitializer init) { return new TooltipDescription(init.Self, this); }
|
||||
}
|
||||
|
||||
@@ -136,19 +136,19 @@ namespace OpenRA.Mods.Common.Traits
|
||||
p.Stances[q] = ChooseInitialStance(p, q);
|
||||
}
|
||||
|
||||
static Stance ChooseInitialStance(Player p, Player q)
|
||||
static PlayerRelationship ChooseInitialStance(Player p, Player q)
|
||||
{
|
||||
if (p == q)
|
||||
return Stance.Ally;
|
||||
return PlayerRelationship.Ally;
|
||||
|
||||
if (q.Spectating && !p.NonCombatant && p.Playable)
|
||||
return Stance.Ally;
|
||||
return PlayerRelationship.Ally;
|
||||
|
||||
// Stances set via PlayerReference
|
||||
if (p.PlayerReference.Allies.Contains(q.InternalName))
|
||||
return Stance.Ally;
|
||||
return PlayerRelationship.Ally;
|
||||
if (p.PlayerReference.Enemies.Contains(q.InternalName))
|
||||
return Stance.Enemy;
|
||||
return PlayerRelationship.Enemy;
|
||||
|
||||
// HACK: Map players share a ClientID with the host, so would
|
||||
// otherwise take the host's team stance instead of being neutral
|
||||
@@ -159,11 +159,11 @@ namespace OpenRA.Mods.Common.Traits
|
||||
var qc = GetClientForPlayer(q);
|
||||
if (pc != null && qc != null)
|
||||
return pc.Team != 0 && pc.Team == qc.Team
|
||||
? Stance.Ally : Stance.Enemy;
|
||||
? PlayerRelationship.Ally : PlayerRelationship.Enemy;
|
||||
}
|
||||
|
||||
// Otherwise, default to neutral
|
||||
return Stance.Neutral;
|
||||
return PlayerRelationship.Neutral;
|
||||
}
|
||||
|
||||
static Session.Client GetClientForPlayer(Player p)
|
||||
|
||||
@@ -301,7 +301,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
// If the check allows: We are not blocked by units that we can force to move out of the way.
|
||||
if (check <= BlockedByActor.Immovable && cellFlag.HasCellFlag(CellFlag.HasMovableActor) &&
|
||||
actor.Owner.Stances[otherActor.Owner] == Stance.Ally)
|
||||
actor.Owner.Stances[otherActor.Owner] == PlayerRelationship.Ally)
|
||||
{
|
||||
var mobile = otherActor.OccupiesSpace as Mobile;
|
||||
if (mobile != null && !mobile.IsTraitDisabled && !mobile.IsTraitPaused && !mobile.IsImmovable)
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Common.Warheads
|
||||
public readonly BitSet<TargetableType> InvalidTargets;
|
||||
|
||||
[Desc("What diplomatic stances are affected.")]
|
||||
public readonly Stance ValidStances = Stance.Ally | Stance.Neutral | Stance.Enemy;
|
||||
public readonly PlayerRelationship ValidStances = PlayerRelationship.Ally | PlayerRelationship.Neutral | PlayerRelationship.Enemy;
|
||||
|
||||
[Desc("Can this warhead affect the actor that fired it.")]
|
||||
public readonly bool AffectsParent = false;
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
|
||||
var flag = item.Get<ImageWidget>("FACTIONFLAG");
|
||||
flag.GetImageCollection = () => "flags";
|
||||
if (player == null || player.Stances[pp] == Stance.Ally || player.WinState != WinState.Undefined)
|
||||
if (player == null || player.Stances[pp] == PlayerRelationship.Ally || player.WinState != WinState.Undefined)
|
||||
{
|
||||
flag.GetImageName = () => pp.Faction.InternalName;
|
||||
item.Get<LabelWidget>("FACTION").GetText = () => pp.Faction.Name;
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
o = viewport.ActorTooltip.Owner;
|
||||
showOwner = o != null && !o.NonCombatant && viewport.ActorTooltip.TooltipInfo.IsOwnerRowVisible;
|
||||
|
||||
var stance = o == null || world.RenderPlayer == null ? Stance.None : o.Stances[world.RenderPlayer];
|
||||
var stance = o == null || world.RenderPlayer == null ? PlayerRelationship.None : o.Stances[world.RenderPlayer];
|
||||
labelText = viewport.ActorTooltip.TooltipInfo.TooltipForPlayerStance(stance);
|
||||
break;
|
||||
}
|
||||
@@ -74,7 +74,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
o = viewport.FrozenActorTooltip.TooltipOwner;
|
||||
showOwner = o != null && !o.NonCombatant && viewport.FrozenActorTooltip.TooltipInfo.IsOwnerRowVisible;
|
||||
|
||||
var stance = o == null || world.RenderPlayer == null ? Stance.None : o.Stances[world.RenderPlayer];
|
||||
var stance = o == null || world.RenderPlayer == null ? PlayerRelationship.None : o.Stances[world.RenderPlayer];
|
||||
labelText = viewport.FrozenActorTooltip.TooltipInfo.TooltipForPlayerStance(stance);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
powers = world.ActorsWithTrait<SupportPowerManager>()
|
||||
.Where(p => !p.Actor.IsDead && !p.Actor.Owner.NonCombatant)
|
||||
.SelectMany(s => s.Trait.Powers.Values)
|
||||
.Where(p => p.Instances.Any() && p.Info.DisplayTimerStances != Stance.None && !p.Disabled);
|
||||
.Where(p => p.Instances.Any() && p.Info.DisplayTimerStances != PlayerRelationship.None && !p.Disabled);
|
||||
|
||||
// Timers in replays should be synced to the effective game time, not the playback time.
|
||||
timestep = world.Timestep;
|
||||
|
||||
Reference in New Issue
Block a user