define torpedoes in a more generic way

fixes #3252 and closes #2097
This commit is contained in:
Matthias Mailänder
2014-01-02 19:21:46 +01:00
parent 4b43bb1cad
commit 027a281ae3
4 changed files with 19 additions and 14 deletions

View File

@@ -179,13 +179,7 @@ namespace OpenRA.GameRules
if (!world.Map.IsInMap(cell)) if (!world.Map.IsInMap(cell))
return false; return false;
if (ValidTargets.Contains("Ground") && world.GetTerrainType(cell) != "Water") return true;
return true;
if (ValidTargets.Contains("Water") && world.GetTerrainType(cell) == "Water")
return true;
return false;
} }
return false; return false;

View File

@@ -42,6 +42,8 @@ namespace OpenRA.Mods.RA.Effects
public readonly bool ContrailUsePlayerColor = false; public readonly bool ContrailUsePlayerColor = false;
public readonly int ContrailDelay = 1; public readonly int ContrailDelay = 1;
public readonly bool Jammable = true; public readonly bool Jammable = true;
[Desc("Explodes when leaving the following terrain type, e.g., Water for torpedoes.")]
public readonly string BoundToTerrainType = "";
public IEffect Create(ProjectileArgs args) { return new Missile(this, args); } public IEffect Create(ProjectileArgs args) { return new Missile(this, args); }
} }
@@ -153,11 +155,14 @@ namespace OpenRA.Mods.RA.Effects
if (info.ContrailLength > 0) if (info.ContrailLength > 0)
trail.Update(pos); trail.Update(pos);
var cell = pos.ToCPos();
var shouldExplode = (pos.Z < 0) // Hit the ground var shouldExplode = (pos.Z < 0) // Hit the ground
|| (dist.LengthSquared < MissileCloseEnough.Range * MissileCloseEnough.Range) // Within range || (dist.LengthSquared < MissileCloseEnough.Range * MissileCloseEnough.Range) // Within range
|| (info.RangeLimit != 0 && ticks > info.RangeLimit) // Ran out of fuel || (info.RangeLimit != 0 && ticks > info.RangeLimit) // Ran out of fuel
|| (!info.High && world.ActorMap.GetUnitsAt(pos.ToCPos()) || (!info.High && world.ActorMap.GetUnitsAt(cell)
.Any(a => a.HasTrait<IBlocksBullets>())); // Hit a wall .Any(a => a.HasTrait<IBlocksBullets>())) // Hit a wall
|| (!string.IsNullOrEmpty(info.BoundToTerrainType) && world.GetTerrainType(cell) != info.BoundToTerrainType); // Hit incompatible terrain
if (shouldExplode) if (shouldExplode)
Explode(world); Explode(world);

View File

@@ -459,6 +459,8 @@
HP: 1000 HP: 1000
ProximityCaptor: ProximityCaptor:
Types: Bridge Types: Bridge
Armor:
Type: Concrete
AutoTargetIgnore: AutoTargetIgnore:
BodyOrientation: BodyOrientation:
LuaScriptEvents: LuaScriptEvents:

View File

@@ -508,7 +508,7 @@ MammothTusk:
Range: 8c0 Range: 8c0
Report: MISSILE6.AUD Report: MISSILE6.AUD
Burst: 2 Burst: 2
ValidTargets: Ground, Air ValidTargets: Air, Ground, Water
Projectile: Missile Projectile: Missile
Speed: 341 Speed: 341
Arm: 2 Arm: 2
@@ -789,7 +789,7 @@ Stinger:
Report: MISSILE6.AUD Report: MISSILE6.AUD
Burst: 2 Burst: 2
BurstDelay: 0 BurstDelay: 0
ValidTargets: Ground, Air ValidTargets: Air, Ground, Water
Projectile: Missile Projectile: Missile
Arm: 3 Arm: 3
High: true High: true
@@ -830,15 +830,18 @@ TorpTube:
Trail: bubbles Trail: bubbles
ROT: 1 ROT: 1
RangeLimit: 160 RangeLimit: 160
BoundToTerrainType: Water
Warhead: Warhead:
Spread: 128 Spread: 426
Versus: Versus:
None: 30% None: 30%
Wood: 75% Wood: 75%
Light: 75% Light: 75%
Concrete: 50% Concrete: 500%
WaterExplosion: large_splash WaterExplosion: large_splash
WaterImpactSound: splash9.aud WaterImpactSound: splash9.aud
Explosion: large_explosion
ImpactSound: kaboom12.aud
InfDeath: 4 InfDeath: 4
SmudgeType: Crater SmudgeType: Crater
Damage: 180 Damage: 180
@@ -1207,7 +1210,7 @@ FLAK-23:
ROF: 10 ROF: 10
Range: 8c0 Range: 8c0
Report: AACANON3.AUD Report: AACANON3.AUD
ValidTargets: Air,Ground ValidTargets: Air, Ground, Water
Projectile: Bullet Projectile: Bullet
Speed: 1c682 Speed: 1c682
High: true High: true
@@ -1220,6 +1223,7 @@ FLAK-23:
Heavy: 10% Heavy: 10%
Concrete: 20% Concrete: 20%
Explosion: small_explosion_air Explosion: small_explosion_air
WaterExplosion: small_splash
Damage: 20 Damage: 20
Sniper: Sniper: