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))
return false;
if (ValidTargets.Contains("Ground") && world.GetTerrainType(cell) != "Water")
return true;
if (ValidTargets.Contains("Water") && world.GetTerrainType(cell) == "Water")
return true;
return false;
}
return false;

View File

@@ -42,6 +42,8 @@ namespace OpenRA.Mods.RA.Effects
public readonly bool ContrailUsePlayerColor = false;
public readonly int ContrailDelay = 1;
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); }
}
@@ -153,11 +155,14 @@ namespace OpenRA.Mods.RA.Effects
if (info.ContrailLength > 0)
trail.Update(pos);
var cell = pos.ToCPos();
var shouldExplode = (pos.Z < 0) // Hit the ground
|| (dist.LengthSquared < MissileCloseEnough.Range * MissileCloseEnough.Range) // Within range
|| (info.RangeLimit != 0 && ticks > info.RangeLimit) // Ran out of fuel
|| (!info.High && world.ActorMap.GetUnitsAt(pos.ToCPos())
.Any(a => a.HasTrait<IBlocksBullets>())); // Hit a wall
|| (!info.High && world.ActorMap.GetUnitsAt(cell)
.Any(a => a.HasTrait<IBlocksBullets>())) // Hit a wall
|| (!string.IsNullOrEmpty(info.BoundToTerrainType) && world.GetTerrainType(cell) != info.BoundToTerrainType); // Hit incompatible terrain
if (shouldExplode)
Explode(world);

View File

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

View File

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