diff --git a/OpenRA.Game/GameRules/WarheadInfo.cs b/OpenRA.Game/GameRules/WarheadInfo.cs index dc41fd0064..ef101666ba 100644 --- a/OpenRA.Game/GameRules/WarheadInfo.cs +++ b/OpenRA.Game/GameRules/WarheadInfo.cs @@ -28,6 +28,8 @@ namespace OpenRA.GameRules public readonly bool Wood = false; public readonly bool Ore = false; public readonly int Explosion = 0; + public readonly SmudgeType SmudgeType = SmudgeType.None; + public readonly int[] SmudgeSize = { 0,0 }; public readonly int InfDeath = 0; public readonly string ImpactSound = null; public readonly string WaterImpactSound = null; @@ -43,4 +45,11 @@ namespace OpenRA.GameRules heavy = 3, concrete = 4, } + + public enum SmudgeType + { + None = 0, + Crater = 1, + Scorch = 2, + } } diff --git a/OpenRA.Game/Smudge.cs b/OpenRA.Game/Smudge.cs index 952b18a864..3b2cf24e2c 100644 --- a/OpenRA.Game/Smudge.cs +++ b/OpenRA.Game/Smudge.cs @@ -47,18 +47,13 @@ namespace OpenRA public static void AddSmudge(this Map map, int2 targetTile, WarheadInfo warhead) { - switch (warhead.Explosion) /* todo: push the scorch/crater behavior into data */ - { - case 4: - case 5: - map.AddSmudge(true, targetTile.X, targetTile.Y); - break; - - case 3: - case 6: - map.AddSmudge(false, targetTile.X, targetTile.Y); - break; - } + if (warhead.SmudgeType == SmudgeType.None) return; + if (warhead.SmudgeSize[0] == 0 && warhead.SmudgeSize[1] == 0) + map.AddSmudge(warhead.SmudgeType == SmudgeType.Crater, targetTile.X, targetTile.Y); + else + foreach (var t in Game.world.FindTilesInCircle(targetTile, warhead.SmudgeSize[0])) + if ((t - targetTile).LengthSquared >= warhead.SmudgeSize[1] * warhead.SmudgeSize[1]) + map.AddSmudge(warhead.SmudgeType == SmudgeType.Crater, t.X, t.Y); } static int lastSmudge = 0; diff --git a/mods/ra/rules.ini b/mods/ra/rules.ini index 5258c70d6b..460cf293ba 100644 --- a/mods/ra/rules.ini +++ b/mods/ra/rules.ini @@ -648,6 +648,7 @@ Wood=yes Verses=90%,75%,60%,25%,100% Explosion=5 InfDeath=2 +SmudgeType=Crater ; armor piercing (discarding sabot, narrow effect) [AP] @@ -657,6 +658,7 @@ Wood=yes Verses=30%,75%,75%,100%,50% Explosion=4 InfDeath=3 +SmudgeType=Crater ; napalm and fire in general [Fire] @@ -665,6 +667,7 @@ Wood=yes Verses=90%,100%,60%,25%,50% Explosion=3 InfDeath=4 +SmudgeType=Scorch ; anti-infantry rifle bullet (single shot -- very effective verses infantry) [HollowPoint] @@ -694,6 +697,8 @@ Ore=yes Verses=90%,100%,60%,25%,50% Explosion=6 InfDeath=4 +SmudgeType=Scorch +SmudgeSize=5,4 ; ******* Land Characteristics *******