From 194caa0163d1d77d55ec21d508e22422b8ee356b Mon Sep 17 00:00:00 2001 From: roundowl Date: Tue, 1 Nov 2016 23:09:47 +0300 Subject: [PATCH] Makes friendly units aware of mines Added BlockFriendly boolean into Mine trait parameters. If set to true, friendly units vulnerable to mines will route around tiles with friendly mines in them. --- OpenRA.Mods.RA/Traits/Mine.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/OpenRA.Mods.RA/Traits/Mine.cs b/OpenRA.Mods.RA/Traits/Mine.cs index 8cf2e56aaa..3b1ba5488e 100644 --- a/OpenRA.Mods.RA/Traits/Mine.cs +++ b/OpenRA.Mods.RA/Traits/Mine.cs @@ -19,6 +19,7 @@ namespace OpenRA.Mods.RA.Traits { public readonly HashSet CrushClasses = new HashSet(); public readonly bool AvoidFriendly = true; + public readonly bool BlockFriendly = true; public readonly HashSet DetonateClasses = new HashSet(); public object Create(ActorInitializer init) { return new Mine(this); } @@ -52,6 +53,9 @@ namespace OpenRA.Mods.RA.Traits bool ICrushable.CrushableBy(Actor self, Actor crusher, HashSet crushClasses) { + if (info.BlockFriendly && !crusher.Info.HasTraitInfo() && self.Owner.Stances[crusher.Owner] == Stance.Ally) + return false; + return info.CrushClasses.Overlaps(crushClasses); } }