wired up Explodes again; categories != targettypes

This commit is contained in:
Chris Forbes
2010-04-01 22:25:15 +13:00
parent 268c714ac2
commit 10e7afc10c
7 changed files with 20 additions and 20 deletions

View File

@@ -109,15 +109,15 @@ namespace OpenRA
public static bool WeaponValidForTarget(WeaponInfo weapon, Actor target) 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; 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; return false;
if (weapon.Underwater && !target.Info.Traits.Get<OwnedActorInfo>().WaterBound) if (weapon.Underwater && !ownedInfo.WaterBound)
return false; return false;
return true; return true;

View File

@@ -34,6 +34,7 @@ namespace OpenRA.Traits
public readonly bool Crewed = false; // replace with trait? public readonly bool Crewed = false; // replace with trait?
public readonly int Sight = 0; public readonly int Sight = 0;
public readonly bool WaterBound = false; public readonly bool WaterBound = false;
public readonly string TargetType = "Ground";
} }
public class BuildingInfo : OwnedActorInfo, ITraitInfo public class BuildingInfo : OwnedActorInfo, ITraitInfo

View File

@@ -32,12 +32,7 @@ namespace OpenRA.Traits
{ {
var unit = self.traits.GetOrDefault<Unit>(); var unit = self.traits.GetOrDefault<Unit>();
var altitude = unit != null ? unit.Altitude : 0; var altitude = unit != null ? unit.Altitude : 0;
Combat.DoExplosion(e.Attacker, "UnitExplode", self.CenterLocation.ToInt2(), altitude);
// self.World.AddFrameEndTask(
// w => w.Add(new Bullet(
// "UnitExplode", e.Attacker.Owner, e.Attacker,
// self.CenterLocation.ToInt2(), self.CenterLocation.ToInt2(),
// altitude, altitude)));
} }
} }
} }

View File

@@ -34,6 +34,7 @@
^Plane: ^Plane:
Category: Plane Category: Plane
Unit: Unit:
TargetType: Air
Selectable: Selectable:
^Building: ^Building:

View File

@@ -1012,6 +1012,7 @@ SS:
Sight: 6 Sight: 6
Speed: 6 Speed: 6
WaterBound: yes WaterBound: yes
TargetType: Sub
RenderUnit: RenderUnit:
Submarine: Submarine:
AttackBase: AttackBase:

View File

@@ -15,7 +15,7 @@ ZSU-23:
ROF: 10 ROF: 10
Range: 6 Range: 6
Report: AACANON3 Report: AACANON3
ValidTargets: Plane ValidTargets: Air
Bullet: Bullet:
Speed: 100 Speed: 100
Warhead: Warhead:
@@ -41,7 +41,7 @@ Maverick:
ROF: 3 ROF: 3
Range: 6 Range: 6
Report: MISSILE7 Report: MISSILE7
ValidTargets: Vehicle, Infantry, Plane, Building, Defense, Ship ValidTargets: Ground, Air
Missile: Missile:
Speed: 30 Speed: 30
Arm: 2 Arm: 2
@@ -140,7 +140,7 @@ Dragon:
ROF: 50 ROF: 50
Range: 5 Range: 5
Report: MISSILE6 Report: MISSILE6
ValidTargets: Vehicle, Infantry, Plane, Building, Defense, Ship ValidTargets: Ground, Air
Missile: Missile:
Speed: 25 Speed: 25
Arm: 2 Arm: 2
@@ -166,7 +166,7 @@ Hellfire:
ROF: 60 ROF: 60
Range: 4 Range: 4
Report: MISSILE6 Report: MISSILE6
ValidTargets: Vehicle, Infantry, Plane, Building, Defense, Ship ValidTargets: Ground, Air
Missile: Missile:
Speed: 30 Speed: 30
Arm: 2 Arm: 2
@@ -298,7 +298,7 @@ MammothTusk:
Range: 5 Range: 5
Report: MISSILE6 Report: MISSILE6
Burst: 2 Burst: 2
ValidTargets: Vehicle, Infantry, Plane, Building, Defense, Ship ValidTargets: Ground, Air
Missile: Missile:
Speed: 30 Speed: 30
Arm: 2 Arm: 2
@@ -409,7 +409,7 @@ Nike:
ROF: 20 ROF: 20
Range: 7.5 Range: 7.5
Report: MISSILE1 Report: MISSILE1
ValidTargets: Plane ValidTargets: Air
Missile: Missile:
Arm: 3 Arm: 3
High: true High: true
@@ -433,7 +433,7 @@ RedEye:
ROF: 50 ROF: 50
Range: 7.5 Range: 7.5
Report: MISSILE1 Report: MISSILE1
ValidTargets: Plane ValidTargets: Air
Missile: Missile:
Arm: 3 Arm: 3
High: true High: true
@@ -477,7 +477,7 @@ Stinger:
ROF: 60 ROF: 60
Range: 9 Range: 9
Report: MISSILE6 Report: MISSILE6
ValidTargets: Vehicle, Infantry, Plane, Building, Defense, Ship ValidTargets: Ground, Air
Missile: Missile:
Arm: 3 Arm: 3
High: true High: true
@@ -503,7 +503,7 @@ TorpTube:
ROF: 60 ROF: 60
Range: 9 Range: 9
Report: TORPEDO1 Report: TORPEDO1
ValidTargets: Ship, Building ValidTargets: Ground, Sub
Underwater: yes Underwater: yes
Bullet: Bullet:
Image: MISSILE Image: MISSILE
@@ -538,7 +538,7 @@ TorpTube:
DepthCharge: DepthCharge:
ROF: 60 ROF: 60
Range: 5 Range: 5
ValidTargets: Ship ValidTargets: Sub
Bullet: Bullet:
Speed: 5 Speed: 5
Image: BOMB Image: BOMB

View File

@@ -11,6 +11,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ra", "ra", "{59F0734D-2F86-
mods\ra\rules.ini = mods\ra\rules.ini mods\ra\rules.ini = mods\ra\rules.ini
mods\ra\rules.yaml = mods\ra\rules.yaml mods\ra\rules.yaml = mods\ra\rules.yaml
mods\ra\sequences.xml = mods\ra\sequences.xml mods\ra\sequences.xml = mods\ra\sequences.xml
mods\ra\voices.yaml = mods\ra\voices.yaml
mods\ra\weapons.yaml = mods\ra\weapons.yaml
EndProjectSection EndProjectSection
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "aftermath", "aftermath", "{8DA16338-FA8F-4CCD-8731-CBFCF5E31A78}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "aftermath", "aftermath", "{8DA16338-FA8F-4CCD-8731-CBFCF5E31A78}"