fixed #800 - infantry can walk on AT mines
This commit is contained in:
@@ -11,6 +11,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRA.Mods.RA.Activities;
|
using OpenRA.Mods.RA.Activities;
|
||||||
|
using OpenRA.Mods.RA.Move;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
using OpenRA.FileFormats;
|
using OpenRA.FileFormats;
|
||||||
|
|
||||||
@@ -19,9 +20,9 @@ namespace OpenRA.Mods.RA
|
|||||||
class MineInfo : ITraitInfo
|
class MineInfo : ITraitInfo
|
||||||
{
|
{
|
||||||
public readonly string[] CrushClasses = { };
|
public readonly string[] CrushClasses = { };
|
||||||
[WeaponReference]
|
[WeaponReference] public readonly string Weapon = "ATMine";
|
||||||
public readonly string Weapon = "ATMine";
|
|
||||||
public readonly bool AvoidFriendly = true;
|
public readonly bool AvoidFriendly = true;
|
||||||
|
public readonly string[] DetonateClasses = { };
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new Mine(init, this); }
|
public object Create(ActorInitializer init) { return new Mine(init, this); }
|
||||||
}
|
}
|
||||||
@@ -30,8 +31,7 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
readonly Actor self;
|
readonly Actor self;
|
||||||
readonly MineInfo info;
|
readonly MineInfo info;
|
||||||
[Sync]
|
[Sync] readonly int2 location;
|
||||||
readonly int2 location;
|
|
||||||
|
|
||||||
public Mine(ActorInitializer init, MineInfo info)
|
public Mine(ActorInitializer init, MineInfo info)
|
||||||
{
|
{
|
||||||
@@ -47,12 +47,14 @@ namespace OpenRA.Mods.RA
|
|||||||
if (crusher.HasTrait<MineImmune>() || self.Owner.Stances[crusher.Owner] == Stance.Ally)
|
if (crusher.HasTrait<MineImmune>() || self.Owner.Stances[crusher.Owner] == Stance.Ally)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var info = self.Info.Traits.Get<MineInfo>();
|
var mobile = crusher.TraitOrDefault<Mobile>();
|
||||||
|
if (mobile != null && !info.DetonateClasses.Intersect(mobile.Info.Crushes).Any())
|
||||||
|
return;
|
||||||
|
|
||||||
Combat.DoExplosion(self, info.Weapon, crusher.CenterLocation, 0);
|
Combat.DoExplosion(self, info.Weapon, crusher.CenterLocation, 0);
|
||||||
self.QueueActivity(new RemoveSelf());
|
self.QueueActivity(new RemoveSelf());
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Re-implement friendly-mine avoidance
|
|
||||||
public bool CrushableBy(string[] crushClasses, Player owner)
|
public bool CrushableBy(string[] crushClasses, Player owner)
|
||||||
{
|
{
|
||||||
return info.CrushClasses.Intersect(crushClasses).Any();
|
return info.CrushClasses.Intersect(crushClasses).Any();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
^Vehicle:
|
^Vehicle:
|
||||||
AppearsOnRadar:
|
AppearsOnRadar:
|
||||||
Mobile:
|
Mobile:
|
||||||
Crushes: atmine, crate
|
Crushes: atmine, crate, apmine
|
||||||
TerrainSpeeds:
|
TerrainSpeeds:
|
||||||
Clear: 80
|
Clear: 80
|
||||||
Rough: 40
|
Rough: 40
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
^Tank:
|
^Tank:
|
||||||
AppearsOnRadar:
|
AppearsOnRadar:
|
||||||
Mobile:
|
Mobile:
|
||||||
Crushes: wall, atmine, crate
|
Crushes: wall, atmine, crate, apmine
|
||||||
TerrainSpeeds:
|
TerrainSpeeds:
|
||||||
Clear: 80
|
Clear: 80
|
||||||
Rough: 70
|
Rough: 70
|
||||||
|
|||||||
@@ -240,7 +240,8 @@ World:
|
|||||||
MINP:
|
MINP:
|
||||||
Mine:
|
Mine:
|
||||||
Weapon: APMine
|
Weapon: APMine
|
||||||
CrushClasses: apmine
|
CrushClasses: apmine,atmine
|
||||||
|
DetonateClasses: apmine
|
||||||
AvoidFriendly: yes
|
AvoidFriendly: yes
|
||||||
Health:
|
Health:
|
||||||
HP: 1
|
HP: 1
|
||||||
@@ -255,7 +256,8 @@ MINP:
|
|||||||
MINV:
|
MINV:
|
||||||
Mine:
|
Mine:
|
||||||
Weapon: ATMine
|
Weapon: ATMine
|
||||||
CrushClasses: atmine
|
CrushClasses: atmine,apmine
|
||||||
|
DetonateClasses: atmine
|
||||||
AvoidFriendly: yes
|
AvoidFriendly: yes
|
||||||
Health:
|
Health:
|
||||||
HP: 1
|
HP: 1
|
||||||
|
|||||||
Reference in New Issue
Block a user