diff --git a/OpenRA.Game/Player.cs b/OpenRA.Game/Player.cs index 1938382181..7b08b01857 100644 --- a/OpenRA.Game/Player.cs +++ b/OpenRA.Game/Player.cs @@ -229,11 +229,11 @@ namespace OpenRA return "{0} ({1})".F(PlayerName, ClientIndex); } - public Dictionary Stances = new Dictionary(); + public Dictionary Stances = new Dictionary(); 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) diff --git a/OpenRA.Game/SelectableExts.cs b/OpenRA.Game/SelectableExts.cs index 511920fbc0..0b6cfbbdb5 100644 --- a/OpenRA.Game/SelectableExts.cs +++ b/OpenRA.Game/SelectableExts.cs @@ -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(); diff --git a/OpenRA.Game/Traits/TraitsInterfaces.cs b/OpenRA.Game/Traits/TraitsInterfaces.cs index e539f4b410..de44b97cd5 100644 --- a/OpenRA.Game/Traits/TraitsInterfaces.cs +++ b/OpenRA.Game/Traits/TraitsInterfaces.cs @@ -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; } } diff --git a/OpenRA.Game/World.cs b/OpenRA.Game/World.cs index eb6f01e12a..ebae869dba 100644 --- a/OpenRA.Game/World.cs +++ b/OpenRA.Game/World.cs @@ -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; } diff --git a/OpenRA.Game/WorldUtils.cs b/OpenRA.Game/WorldUtils.cs index 819b08adbb..b8f547f797 100644 --- a/OpenRA.Game/WorldUtils.cs +++ b/OpenRA.Game/WorldUtils.cs @@ -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; } } } diff --git a/OpenRA.Mods.Cnc/Activities/LayMines.cs b/OpenRA.Mods.Cnc/Activities/LayMines.cs index 8d8736c3fa..4efc0fe297 100644 --- a/OpenRA.Mods.Cnc/Activities/LayMines.cs +++ b/OpenRA.Mods.Cnc/Activities/LayMines.cs @@ -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) diff --git a/OpenRA.Mods.Cnc/Traits/Disguise.cs b/OpenRA.Mods.Cnc/Traits/Disguise.cs index f943efe763..9150028811 100644 --- a/OpenRA.Mods.Cnc/Traits/Disguise.cs +++ b/OpenRA.Mods.Cnc/Traits/Disguise.cs @@ -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 TargetTypes = new BitSet("Disguise"); diff --git a/OpenRA.Mods.Cnc/Traits/Infiltration/Infiltrates.cs b/OpenRA.Mods.Cnc/Traits/Infiltration/Infiltrates.cs index 2742f1e16b..1392309c64 100644 --- a/OpenRA.Mods.Cnc/Traits/Infiltration/Infiltrates.cs +++ b/OpenRA.Mods.Cnc/Traits/Infiltration/Infiltrates.cs @@ -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.")] diff --git a/OpenRA.Mods.Cnc/Traits/Mine.cs b/OpenRA.Mods.Cnc/Traits/Mine.cs index 71bf1ba840..38b04ff5f9 100644 --- a/OpenRA.Mods.Cnc/Traits/Mine.cs +++ b/OpenRA.Mods.Cnc/Traits/Mine.cs @@ -41,7 +41,7 @@ namespace OpenRA.Mods.Cnc.Traits if (!info.CrushClasses.Overlaps(crushClasses)) return; - if (crusher.Info.HasTraitInfo() || (self.Owner.Stances[crusher.Owner] == Stance.Ally && info.AvoidFriendly)) + if (crusher.Info.HasTraitInfo() || (self.Owner.Stances[crusher.Owner] == PlayerRelationship.Ally && info.AvoidFriendly)) return; var mobile = crusher.TraitOrDefault(); @@ -53,7 +53,7 @@ namespace OpenRA.Mods.Cnc.Traits bool ICrushable.CrushableBy(Actor self, Actor crusher, BitSet crushClasses) { - if (info.BlockFriendly && !crusher.Info.HasTraitInfo() && self.Owner.Stances[crusher.Owner] == Stance.Ally) + if (info.BlockFriendly && !crusher.Info.HasTraitInfo() && self.Owner.Stances[crusher.Owner] == PlayerRelationship.Ally) return false; return info.CrushClasses.Overlaps(crushClasses); diff --git a/OpenRA.Mods.Common/AIUtils.cs b/OpenRA.Mods.Common/AIUtils.cs index 4546cafe36..768c8171d7 100644 --- a/OpenRA.Mods.Common/AIUtils.cs +++ b/OpenRA.Mods.Common/AIUtils.cs @@ -65,7 +65,7 @@ namespace OpenRA.Mods.Common public static List FindEnemiesByCommonName(HashSet 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(); } diff --git a/OpenRA.Mods.Common/ActorExts.cs b/OpenRA.Mods.Common/ActorExts.cs index 0503ad1ae6..1237a5d075 100644 --- a/OpenRA.Mods.Common/ActorExts.cs +++ b/OpenRA.Mods.Common/ActorExts.cs @@ -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()) - 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()) - 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 blockers) diff --git a/OpenRA.Mods.Common/Effects/RevealShroudEffect.cs b/OpenRA.Mods.Common/Effects/RevealShroudEffect.cs index f8c2e935fb..633f054c5c 100644 --- a/OpenRA.Mods.Common/Effects/RevealShroudEffect.cs +++ b/OpenRA.Mods.Common/Effects/RevealShroudEffect.cs @@ -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; diff --git a/OpenRA.Mods.Common/Orders/UnitOrderTargeter.cs b/OpenRA.Mods.Common/Orders/UnitOrderTargeter.cs index fa8f4a6e9b..14b50b4491 100644 --- a/OpenRA.Mods.Common/Orders/UnitOrderTargeter.cs +++ b/OpenRA.Mods.Common/Orders/UnitOrderTargeter.cs @@ -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 ? diff --git a/OpenRA.Mods.Common/Projectiles/Bullet.cs b/OpenRA.Mods.Common/Projectiles/Bullet.cs index 4482e3083a..3b9caf6ee4 100644 --- a/OpenRA.Mods.Common/Projectiles/Bullet.cs +++ b/OpenRA.Mods.Common/Projectiles/Bullet.cs @@ -97,7 +97,7 @@ namespace OpenRA.Mods.Common.Projectiles public readonly HashSet InvalidBounceTerrain = new HashSet(); [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; diff --git a/OpenRA.Mods.Common/Traits/AcceptsDeliveredCash.cs b/OpenRA.Mods.Common/Traits/AcceptsDeliveredCash.cs index c83d535432..4926570345 100644 --- a/OpenRA.Mods.Common/Traits/AcceptsDeliveredCash.cs +++ b/OpenRA.Mods.Common/Traits/AcceptsDeliveredCash.cs @@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Traits public readonly HashSet ValidTypes = new HashSet(); [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 = { }; diff --git a/OpenRA.Mods.Common/Traits/AcceptsDeliveredExperience.cs b/OpenRA.Mods.Common/Traits/AcceptsDeliveredExperience.cs index a00ce40c11..4db51a7ed0 100644 --- a/OpenRA.Mods.Common/Traits/AcceptsDeliveredExperience.cs +++ b/OpenRA.Mods.Common/Traits/AcceptsDeliveredExperience.cs @@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Traits public readonly HashSet ValidTypes = new HashSet(); [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); } } diff --git a/OpenRA.Mods.Common/Traits/Air/Aircraft.cs b/OpenRA.Mods.Common/Traits/Air/Aircraft.cs index 17a5ebae08..f4c1ddd536 100644 --- a/OpenRA.Mods.Common/Traits/Air/Aircraft.cs +++ b/OpenRA.Mods.Common/Traits/Air/Aircraft.cs @@ -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() != null && otherActor.CurrentActivity == null) return false; diff --git a/OpenRA.Mods.Common/Traits/Armament.cs b/OpenRA.Mods.Common/Traits/Armament.cs index 5a96050db7..8014d864ea 100644 --- a/OpenRA.Mods.Common/Traits/Armament.cs +++ b/OpenRA.Mods.Common/Traits/Armament.cs @@ -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 diff --git a/OpenRA.Mods.Common/Traits/Attack/AttackBase.cs b/OpenRA.Mods.Common/Traits/Attack/AttackBase.cs index 430fefcd95..6dac7f68e8 100644 --- a/OpenRA.Mods.Common/Traits/Attack/AttackBase.cs +++ b/OpenRA.Mods.Common/Traits/Attack/AttackBase.cs @@ -403,10 +403,10 @@ namespace OpenRA.Mods.Common.Traits && (target.IsInRange(self.CenterPosition, GetMaximumRangeVersusTarget(target)) || (allowMove && self.Info.HasTraitInfo())); } - 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); diff --git a/OpenRA.Mods.Common/Traits/AutoTarget.cs b/OpenRA.Mods.Common/Traits/AutoTarget.cs index 5e05b22f8a..c17cee3d7c 100644 --- a/OpenRA.Mods.Common/Traits/AutoTarget.cs +++ b/OpenRA.Mods.Common/Traits/AutoTarget.cs @@ -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; diff --git a/OpenRA.Mods.Common/Traits/AutoTargetPriority.cs b/OpenRA.Mods.Common/Traits/AutoTargetPriority.cs index cc3805a787..4af813a759 100644 --- a/OpenRA.Mods.Common/Traits/AutoTargetPriority.cs +++ b/OpenRA.Mods.Common/Traits/AutoTargetPriority.cs @@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.Traits public readonly BitSet 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; diff --git a/OpenRA.Mods.Common/Traits/BotModules/BaseBuilderBotModule.cs b/OpenRA.Mods.Common/Traits/BotModules/BaseBuilderBotModule.cs index 1772389d09..6ecd7c0314 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/BaseBuilderBotModule.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/BaseBuilderBotModule.cs @@ -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()) diff --git a/OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/BaseBuilderQueueManager.cs b/OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/BaseBuilderQueueManager.cs index 6cee35ba7b..4b3736f21e 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/BaseBuilderQueueManager.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/BaseBuilderQueueManager.cs @@ -409,7 +409,7 @@ namespace OpenRA.Mods.Common.Traits case BuildingType.Defense: // Build near the closest enemy structure - var closestEnemy = world.ActorsHavingTrait().Where(a => !a.Disposed && player.Stances[a.Owner] == Stance.Enemy) + var closestEnemy = world.ActorsHavingTrait().Where(a => !a.Disposed && player.Stances[a.Owner] == PlayerRelationship.Enemy) .ClosestTo(world.Map.CenterOfCell(baseBuilder.DefenseCenter)); var targetCell = closestEnemy != null ? closestEnemy.Location : baseCenter; diff --git a/OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/SupportPowerDecision.cs b/OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/SupportPowerDecision.cs index d6157fae36..044c7ff16f 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/SupportPowerDecision.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/BotModuleLogic/SupportPowerDecision.cs @@ -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 Types = new BitSet("Air", "Ground", "Water"); @@ -138,7 +138,7 @@ namespace OpenRA.Mods.Common.Traits } /// Evaluates a single actor according to the rules defined in this consideration - 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; diff --git a/OpenRA.Mods.Common/Traits/BotModules/BuildingRepairBotModule.cs b/OpenRA.Mods.Common/Traits/BotModules/BuildingRepairBotModule.cs index c174439c25..5d886a933c 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/BuildingRepairBotModule.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/BuildingRepairBotModule.cs @@ -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(); diff --git a/OpenRA.Mods.Common/Traits/BotModules/CaptureManagerBotModule.cs b/OpenRA.Mods.Common/Traits/BotModules/CaptureManagerBotModule.cs index f4d74b7281..b960b3a079 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/CaptureManagerBotModule.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/CaptureManagerBotModule.cs @@ -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() && unit.Info.HasTraitInfo(); diff --git a/OpenRA.Mods.Common/Traits/BotModules/HarvesterBotModule.cs b/OpenRA.Mods.Common/Traits/BotModules/HarvesterBotModule.cs index 902d78ac0e..8121580ede 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/HarvesterBotModule.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/HarvesterBotModule.cs @@ -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)); diff --git a/OpenRA.Mods.Common/Traits/BotModules/SquadManagerBotModule.cs b/OpenRA.Mods.Common/Traits/BotModules/SquadManagerBotModule.cs index 3fa0a72716..ca2c0139d7 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/SquadManagerBotModule.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/SquadManagerBotModule.cs @@ -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()) + if (a == null || a.IsDead || Player.Stances[a.Owner] != PlayerRelationship.Enemy || a.Info.HasTraitInfo()) return false; var targetTypes = a.GetEnabledTargetTypes(); diff --git a/OpenRA.Mods.Common/Traits/Buildings/Building.cs b/OpenRA.Mods.Common/Traits/Buildings/Building.cs index 5263411e11..9f1900131f 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/Building.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/Building.cs @@ -167,7 +167,7 @@ namespace OpenRA.Mods.Common.Traits foreach (var bp in world.ActorsWithTrait()) { - 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)) diff --git a/OpenRA.Mods.Common/Traits/Buildings/RepairableBuilding.cs b/OpenRA.Mods.Common/Traits/Buildings/RepairableBuilding.cs index 4a979c10a7..93caaa8d09 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/RepairableBuilding.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/RepairableBuilding.cs @@ -66,7 +66,7 @@ namespace OpenRA.Mods.Common.Traits : base(info) { health = self.Trait(); - 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] diff --git a/OpenRA.Mods.Common/Traits/Capturable.cs b/OpenRA.Mods.Common/Traits/Capturable.cs index bc00ca06db..0a18a4050b 100644 --- a/OpenRA.Mods.Common/Traits/Capturable.cs +++ b/OpenRA.Mods.Common/Traits/Capturable.cs @@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Traits public readonly BitSet Types = default(BitSet); [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; diff --git a/OpenRA.Mods.Common/Traits/CaptureManager.cs b/OpenRA.Mods.Common/Traits/CaptureManager.cs index c1e44cc1fe..2fac0f25fb 100644 --- a/OpenRA.Mods.Common/Traits/CaptureManager.cs +++ b/OpenRA.Mods.Common/Traits/CaptureManager.cs @@ -109,13 +109,13 @@ namespace OpenRA.Mods.Common.Traits allyCapturableTypes = neutralCapturableTypes = enemyCapturableTypes = default(BitSet); 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; diff --git a/OpenRA.Mods.Common/Traits/Captures.cs b/OpenRA.Mods.Common/Traits/Captures.cs index ac1d30d212..45c5e41b38 100644 --- a/OpenRA.Mods.Common/Traits/Captures.cs +++ b/OpenRA.Mods.Common/Traits/Captures.cs @@ -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"; diff --git a/OpenRA.Mods.Common/Traits/Conditions/ProximityExternalCondition.cs b/OpenRA.Mods.Common/Traits/Conditions/ProximityExternalCondition.cs index 6bdb5391a1..0f6f801afd 100644 --- a/OpenRA.Mods.Common/Traits/Conditions/ProximityExternalCondition.cs +++ b/OpenRA.Mods.Common/Traits/Conditions/ProximityExternalCondition.cs @@ -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; diff --git a/OpenRA.Mods.Common/Traits/CreatesShroud.cs b/OpenRA.Mods.Common/Traits/CreatesShroud.cs index 00527332cb..3e60f9cd28 100644 --- a/OpenRA.Mods.Common/Traits/CreatesShroud.cs +++ b/OpenRA.Mods.Common/Traits/CreatesShroud.cs @@ -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); } } diff --git a/OpenRA.Mods.Common/Traits/Demolition.cs b/OpenRA.Mods.Common/Traits/Demolition.cs index 173f06580b..edae6555ee 100644 --- a/OpenRA.Mods.Common/Traits/Demolition.cs +++ b/OpenRA.Mods.Common/Traits/Demolition.cs @@ -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"; diff --git a/OpenRA.Mods.Common/Traits/EngineerRepair.cs b/OpenRA.Mods.Common/Traits/EngineerRepair.cs index 45e73ba7fa..6c34e486e6 100644 --- a/OpenRA.Mods.Common/Traits/EngineerRepair.cs +++ b/OpenRA.Mods.Common/Traits/EngineerRepair.cs @@ -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; diff --git a/OpenRA.Mods.Common/Traits/GivesBounty.cs b/OpenRA.Mods.Common/Traits/GivesBounty.cs index 2b9c63c107..895df9fddf 100644 --- a/OpenRA.Mods.Common/Traits/GivesBounty.cs +++ b/OpenRA.Mods.Common/Traits/GivesBounty.cs @@ -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; diff --git a/OpenRA.Mods.Common/Traits/GivesExperience.cs b/OpenRA.Mods.Common/Traits/GivesExperience.cs index 22bef8a0d3..17bec58ecb 100644 --- a/OpenRA.Mods.Common/Traits/GivesExperience.cs +++ b/OpenRA.Mods.Common/Traits/GivesExperience.cs @@ -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; diff --git a/OpenRA.Mods.Common/Traits/JamsMissiles.cs b/OpenRA.Mods.Common/Traits/JamsMissiles.cs index 9f9b274902..3c564093e6 100644 --- a/OpenRA.Mods.Common/Traits/JamsMissiles.cs +++ b/OpenRA.Mods.Common/Traits/JamsMissiles.cs @@ -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 { 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) diff --git a/OpenRA.Mods.Common/Traits/Modifiers/FrozenUnderFog.cs b/OpenRA.Mods.Common/Traits/Modifiers/FrozenUnderFog.cs index c993317b8e..d5f48611d8 100644 --- a/OpenRA.Mods.Common/Traits/Modifiers/FrozenUnderFog.cs +++ b/OpenRA.Mods.Common/Traits/Modifiers/FrozenUnderFog.cs @@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Traits public class FrozenUnderFogInfo : TraitInfo, Requires, 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); } } diff --git a/OpenRA.Mods.Common/Traits/Modifiers/HiddenUnderShroud.cs b/OpenRA.Mods.Common/Traits/Modifiers/HiddenUnderShroud.cs index 79fda78dcb..7b4853e3fb 100644 --- a/OpenRA.Mods.Common/Traits/Modifiers/HiddenUnderShroud.cs +++ b/OpenRA.Mods.Common/Traits/Modifiers/HiddenUnderShroud.cs @@ -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).")] diff --git a/OpenRA.Mods.Common/Traits/Radar/AppearsOnRadar.cs b/OpenRA.Mods.Common/Traits/Radar/AppearsOnRadar.cs index 0e62dc732e..e7f5305dc2 100644 --- a/OpenRA.Mods.Common/Traits/Radar/AppearsOnRadar.cs +++ b/OpenRA.Mods.Common/Traits/Radar/AppearsOnRadar.cs @@ -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); } } diff --git a/OpenRA.Mods.Common/Traits/Render/CashTricklerBar.cs b/OpenRA.Mods.Common/Traits/Render/CashTricklerBar.cs index c863ee89a7..20a262e3b7 100644 --- a/OpenRA.Mods.Common/Traits/Render/CashTricklerBar.cs +++ b/OpenRA.Mods.Common/Traits/Render/CashTricklerBar.cs @@ -20,7 +20,7 @@ namespace OpenRA.Mods.Common.Traits.Render class CashTricklerBarInfo : TraitInfo, Requires { [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; diff --git a/OpenRA.Mods.Common/Traits/Render/SupportPowerChargeBar.cs b/OpenRA.Mods.Common/Traits/Render/SupportPowerChargeBar.cs index 95491d4604..ae71dd553b 100644 --- a/OpenRA.Mods.Common/Traits/Render/SupportPowerChargeBar.cs +++ b/OpenRA.Mods.Common/Traits/Render/SupportPowerChargeBar.cs @@ -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; diff --git a/OpenRA.Mods.Common/Traits/Render/WithDecorationBase.cs b/OpenRA.Mods.Common/Traits/Render/WithDecorationBase.cs index cf3fe8b76c..db8eb84b25 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithDecorationBase.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithDecorationBase.cs @@ -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; diff --git a/OpenRA.Mods.Common/Traits/Render/WithRangeCircle.cs b/OpenRA.Mods.Common/Traits/Render/WithRangeCircle.cs index 31531643f3..0e80d370ad 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithRangeCircle.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithRangeCircle.cs @@ -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; diff --git a/OpenRA.Mods.Common/Traits/RevealOnDeath.cs b/OpenRA.Mods.Common/Traits/RevealOnDeath.cs index 4ac5d1c771..aa1ccb920b 100644 --- a/OpenRA.Mods.Common/Traits/RevealOnDeath.cs +++ b/OpenRA.Mods.Common/Traits/RevealOnDeath.cs @@ -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; diff --git a/OpenRA.Mods.Common/Traits/RevealOnFire.cs b/OpenRA.Mods.Common/Traits/RevealOnFire.cs index 38dfb7d89c..1c57a9d761 100644 --- a/OpenRA.Mods.Common/Traits/RevealOnFire.cs +++ b/OpenRA.Mods.Common/Traits/RevealOnFire.cs @@ -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; diff --git a/OpenRA.Mods.Common/Traits/RevealsMap.cs b/OpenRA.Mods.Common/Traits/RevealsMap.cs index 29e5298c7a..28cbc0109b 100644 --- a/OpenRA.Mods.Common/Traits/RevealsMap.cs +++ b/OpenRA.Mods.Common/Traits/RevealsMap.cs @@ -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; diff --git a/OpenRA.Mods.Common/Traits/RevealsShroud.cs b/OpenRA.Mods.Common/Traits/RevealsShroud.cs index b86dc3ad56..e9147959bc 100644 --- a/OpenRA.Mods.Common/Traits/RevealsShroud.cs +++ b/OpenRA.Mods.Common/Traits/RevealsShroud.cs @@ -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; diff --git a/OpenRA.Mods.Common/Traits/Sound/VoiceAnnouncement.cs b/OpenRA.Mods.Common/Traits/Sound/VoiceAnnouncement.cs index 6a1ff6b4c1..fad8e1aa5e 100644 --- a/OpenRA.Mods.Common/Traits/Sound/VoiceAnnouncement.cs +++ b/OpenRA.Mods.Common/Traits/Sound/VoiceAnnouncement.cs @@ -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; diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/GrantExternalConditionPower.cs b/OpenRA.Mods.Common/Traits/SupportPowers/GrantExternalConditionPower.cs index c1eaf62b3f..587a9ad3bc 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/GrantExternalConditionPower.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/GrantExternalConditionPower.cs @@ -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.", diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/NukePower.cs b/OpenRA.Mods.Common/Traits/SupportPowers/NukePower.cs index 5aa137fb50..9f5f03610d 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/NukePower.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/NukePower.cs @@ -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; diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs b/OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs index b1e11b57b0..001c7a567a 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs @@ -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; diff --git a/OpenRA.Mods.Common/Traits/Tooltip.cs b/OpenRA.Mods.Common/Traits/Tooltip.cs index 2f741032c9..fc470980ca 100644 --- a/OpenRA.Mods.Common/Traits/Tooltip.cs +++ b/OpenRA.Mods.Common/Traits/Tooltip.cs @@ -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; diff --git a/OpenRA.Mods.Common/Traits/TooltipDescription.cs b/OpenRA.Mods.Common/Traits/TooltipDescription.cs index 9dc7ce093a..17fe92e7bc 100644 --- a/OpenRA.Mods.Common/Traits/TooltipDescription.cs +++ b/OpenRA.Mods.Common/Traits/TooltipDescription.cs @@ -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); } } diff --git a/OpenRA.Mods.Common/Traits/World/CreateMPPlayers.cs b/OpenRA.Mods.Common/Traits/World/CreateMPPlayers.cs index 06906180fc..f1ea9fa4d7 100644 --- a/OpenRA.Mods.Common/Traits/World/CreateMPPlayers.cs +++ b/OpenRA.Mods.Common/Traits/World/CreateMPPlayers.cs @@ -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) diff --git a/OpenRA.Mods.Common/Traits/World/Locomotor.cs b/OpenRA.Mods.Common/Traits/World/Locomotor.cs index 0fdab33f13..7aed696e5f 100644 --- a/OpenRA.Mods.Common/Traits/World/Locomotor.cs +++ b/OpenRA.Mods.Common/Traits/World/Locomotor.cs @@ -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) diff --git a/OpenRA.Mods.Common/Warheads/Warhead.cs b/OpenRA.Mods.Common/Warheads/Warhead.cs index 6b8b9a313d..7ab7b7f15d 100644 --- a/OpenRA.Mods.Common/Warheads/Warhead.cs +++ b/OpenRA.Mods.Common/Warheads/Warhead.cs @@ -32,7 +32,7 @@ namespace OpenRA.Mods.Common.Warheads public readonly BitSet 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; diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameInfoStatsLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameInfoStatsLogic.cs index 06aa96e841..b8aad20016 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameInfoStatsLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameInfoStatsLogic.cs @@ -98,7 +98,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic var flag = item.Get("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("FACTION").GetText = () => pp.Faction.Name; diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/WorldTooltipLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/WorldTooltipLogic.cs index 52e2b2cc72..7637436538 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/WorldTooltipLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/WorldTooltipLogic.cs @@ -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; } diff --git a/OpenRA.Mods.Common/Widgets/SupportPowerTimerWidget.cs b/OpenRA.Mods.Common/Widgets/SupportPowerTimerWidget.cs index c75aef8c55..580b89060f 100644 --- a/OpenRA.Mods.Common/Widgets/SupportPowerTimerWidget.cs +++ b/OpenRA.Mods.Common/Widgets/SupportPowerTimerWidget.cs @@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Widgets powers = world.ActorsWithTrait() .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;