wired up Explodes again; categories != targettypes
This commit is contained in:
@@ -109,15 +109,15 @@ namespace OpenRA
|
||||
|
||||
public static bool WeaponValidForTarget(WeaponInfo weapon, Actor target)
|
||||
{
|
||||
var unit = target.traits.GetOrDefault<Unit>();
|
||||
var ownedInfo = target.Info.Traits.GetOrDefault<OwnedActorInfo>();
|
||||
|
||||
if (!weapon.ValidTargets.Contains(target.Info.Category))
|
||||
if (!weapon.ValidTargets.Contains(ownedInfo.TargetType))
|
||||
return false;
|
||||
|
||||
if (weapon.Warheads.All( w => w.EffectivenessAgainst(target.Info.Traits.Get<OwnedActorInfo>().Armor) <= 0))
|
||||
if (weapon.Warheads.All( w => w.EffectivenessAgainst(ownedInfo.Armor) <= 0))
|
||||
return false;
|
||||
|
||||
if (weapon.Underwater && !target.Info.Traits.Get<OwnedActorInfo>().WaterBound)
|
||||
if (weapon.Underwater && !ownedInfo.WaterBound)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
||||
@@ -34,6 +34,7 @@ namespace OpenRA.Traits
|
||||
public readonly bool Crewed = false; // replace with trait?
|
||||
public readonly int Sight = 0;
|
||||
public readonly bool WaterBound = false;
|
||||
public readonly string TargetType = "Ground";
|
||||
}
|
||||
|
||||
public class BuildingInfo : OwnedActorInfo, ITraitInfo
|
||||
|
||||
@@ -32,12 +32,7 @@ namespace OpenRA.Traits
|
||||
{
|
||||
var unit = self.traits.GetOrDefault<Unit>();
|
||||
var altitude = unit != null ? unit.Altitude : 0;
|
||||
|
||||
// self.World.AddFrameEndTask(
|
||||
// w => w.Add(new Bullet(
|
||||
// "UnitExplode", e.Attacker.Owner, e.Attacker,
|
||||
// self.CenterLocation.ToInt2(), self.CenterLocation.ToInt2(),
|
||||
// altitude, altitude)));
|
||||
Combat.DoExplosion(e.Attacker, "UnitExplode", self.CenterLocation.ToInt2(), altitude);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user