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.
This commit is contained in:
roundowl
2016-11-01 23:09:47 +03:00
committed by roundowl
parent 6b29d70520
commit 194caa0163

View File

@@ -19,6 +19,7 @@ namespace OpenRA.Mods.RA.Traits
{
public readonly HashSet<string> CrushClasses = new HashSet<string>();
public readonly bool AvoidFriendly = true;
public readonly bool BlockFriendly = true;
public readonly HashSet<string> DetonateClasses = new HashSet<string>();
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<string> crushClasses)
{
if (info.BlockFriendly && !crusher.Info.HasTraitInfo<MineImmuneInfo>() && self.Owner.Stances[crusher.Owner] == Stance.Ally)
return false;
return info.CrushClasses.Overlaps(crushClasses);
}
}