From ec808ddc54eb8c915d7cb08439e61f443b9b5712 Mon Sep 17 00:00:00 2001 From: Taryn Hill Date: Sat, 2 Jul 2016 11:05:33 -0500 Subject: [PATCH] GivesExperience: Replace FriendlyFire with ValidStances --- OpenRA.Mods.Common/Traits/GivesExperience.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/GivesExperience.cs b/OpenRA.Mods.Common/Traits/GivesExperience.cs index 670060b339..c08d066387 100644 --- a/OpenRA.Mods.Common/Traits/GivesExperience.cs +++ b/OpenRA.Mods.Common/Traits/GivesExperience.cs @@ -19,8 +19,8 @@ namespace OpenRA.Mods.Common.Traits [Desc("If -1, use the value of the unit cost.")] public readonly int Experience = -1; - [Desc("Grant experience for team-kills.")] - public readonly bool FriendlyFire = false; + [Desc("Stance the attacking player needs to receive the experience.")] + public readonly Stance ValidStances = Stance.Neutral | Stance.Enemy; public object Create(ActorInitializer init) { return new GivesExperience(init.Self, this); } } @@ -36,8 +36,10 @@ namespace OpenRA.Mods.Common.Traits public void Killed(Actor self, AttackInfo e) { - // Prevent TK from giving exp - if (e.Attacker == null || e.Attacker.Disposed || (!info.FriendlyFire && e.Attacker.Owner.Stances[self.Owner] == Stance.Ally)) + if (e.Attacker == null || e.Attacker.Disposed) + return; + + if (!info.ValidStances.HasStance(e.Attacker.Owner.Stances[self.Owner])) return; var valued = self.Info.TraitInfoOrDefault();