Take ownership into account when determining crushability. Fixes the important half of #951 (tanks crushing your own walls).

This commit is contained in:
Paul Chote
2011-07-10 17:16:22 +12:00
parent 64b88819a9
commit 98ae8c7630
5 changed files with 26 additions and 11 deletions

View File

@@ -9,6 +9,7 @@
#endregion
using System.Collections.Generic;
using System.Linq;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Buildings
@@ -31,7 +32,14 @@ namespace OpenRA.Mods.RA.Buildings
this.info = info;
}
public IEnumerable<string> CrushClasses { get { return info.CrushClasses; } }
public bool CrushableBy(string[] crushClasses, Player crushOwner)
{
if (crushOwner.Stances[self.Owner] == Stance.Ally)
return false;
return info.CrushClasses.Intersect(crushClasses).Any();
}
public void OnCrush(Actor crusher)
{
self.Kill(crusher);