Make mines targetable and removable.

Let AP mines do damage against vehicles.
Let all mines do damage against friendly units.
This commit is contained in:
Scott_NZ
2013-05-10 13:05:49 +12:00
parent 8fe7f3f874
commit 48010197f4
3 changed files with 24 additions and 16 deletions

View File

@@ -20,7 +20,6 @@ namespace OpenRA.Mods.RA
class MineInfo : ITraitInfo class MineInfo : ITraitInfo
{ {
public readonly string[] CrushClasses = { }; public readonly string[] CrushClasses = { };
[WeaponReference] public readonly string Weapon = "ATMine";
public readonly bool AvoidFriendly = true; public readonly bool AvoidFriendly = true;
public readonly string[] DetonateClasses = { }; public readonly string[] DetonateClasses = { };
@@ -44,15 +43,14 @@ namespace OpenRA.Mods.RA
public void OnCrush(Actor crusher) public void OnCrush(Actor crusher)
{ {
if (crusher.HasTrait<MineImmune>() || self.Owner.Stances[crusher.Owner] == Stance.Ally) if (crusher.HasTrait<MineImmune>() || (self.Owner.Stances[crusher.Owner] == Stance.Ally && info.AvoidFriendly))
return; return;
var mobile = crusher.TraitOrDefault<Mobile>(); var mobile = crusher.TraitOrDefault<Mobile>();
if (mobile != null && !info.DetonateClasses.Intersect(mobile.Info.Crushes).Any()) if (mobile != null && !info.DetonateClasses.Intersect(mobile.Info.Crushes).Any())
return; return;
Combat.DoExplosion(self, info.Weapon, crusher.CenterLocation, 0); self.Kill(crusher);
self.QueueActivity(new RemoveSelf());
} }
public bool CrushableBy(string[] crushClasses, Player owner) public bool CrushableBy(string[] crushClasses, Player owner)

View File

@@ -651,12 +651,15 @@ World:
MINP: MINP:
Mine: Mine:
Weapon: APMine
CrushClasses: apmine,atmine CrushClasses: apmine,atmine
DetonateClasses: apmine DetonateClasses: apmine,atmine
AvoidFriendly: yes AvoidFriendly: no
Explodes:
Weapon: APMine
Health: Health:
HP: 1 HP: 50
Armor:
Type: Light
RenderSimple: RenderSimple:
BelowUnits: BelowUnits:
Cloak: Cloak:
@@ -667,16 +670,21 @@ MINP:
Name: Anti-Personnel Mine Name: Anti-Personnel Mine
Icon: jmin Icon: jmin
ProximityCaptor: ProximityCaptor:
Types:Mine Types: Mine
TargetableUnit:
TargetTypes: Ground
MINV: MINV:
Mine: Mine:
Weapon: ATMine
CrushClasses: atmine,apmine CrushClasses: atmine,apmine
DetonateClasses: atmine DetonateClasses: atmine
AvoidFriendly: yes AvoidFriendly: no
Explodes:
Weapon: ATMine
Health: Health:
HP: 1 HP: 50
Armor:
Type: Light
RenderSimple: RenderSimple:
BelowUnits: BelowUnits:
Cloak: Cloak:
@@ -687,7 +695,9 @@ MINV:
Name: Anti-Tank Mine Name: Anti-Tank Mine
Icon: jmin Icon: jmin
ProximityCaptor: ProximityCaptor:
Types:Mine Types: Mine
TargetableUnit:
TargetTypes: Ground
CRATE: CRATE:
Tooltip: Tooltip:

View File

@@ -1161,11 +1161,11 @@ ATMine:
APMine: APMine:
Warhead: Warhead:
Damage: 700 Damage: 500
Versus: Versus:
Wood: 0% Wood: 0%
Light: 0% Light: 10%
Heavy: 0% Heavy: 10%
Concrete: 0% Concrete: 0%
ImpactSound: mine1 ImpactSound: mine1
InfDeath: 3 InfDeath: 3