Merge pull request #8765 from reaperrr/arty-expl
Improved Explodes trait and how artillery explodes
This commit is contained in:
@@ -14,14 +14,22 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
|
[Desc("This actor explodes when killed.")]
|
||||||
public class ExplodesInfo : ITraitInfo
|
public class ExplodesInfo : ITraitInfo
|
||||||
{
|
{
|
||||||
[WeaponReference]
|
[WeaponReference, Desc("Weapon to use for explosion if ammo/payload is loaded.")]
|
||||||
public readonly string Weapon = "UnitExplode";
|
public readonly string Weapon = "UnitExplode";
|
||||||
[WeaponReference]
|
|
||||||
|
[WeaponReference, Desc("Weapon to use for explosion if no ammo/payload is loaded.")]
|
||||||
public readonly string EmptyWeapon = "UnitExplode";
|
public readonly string EmptyWeapon = "UnitExplode";
|
||||||
|
|
||||||
|
[Desc("Chance that the explosion will use Weapon if the actor has ammo/payload.")]
|
||||||
|
public readonly int LoadedChance = 100;
|
||||||
|
|
||||||
|
[Desc("Chance that this actor will explode at all.")]
|
||||||
public readonly int Chance = 100;
|
public readonly int Chance = 100;
|
||||||
|
|
||||||
|
[Desc("DeathType(s) to apply upon explosion.")]
|
||||||
public readonly string[] DeathType = null;
|
public readonly string[] DeathType = null;
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new Explodes(this); }
|
public object Create(ActorInitializer init) { return new Explodes(this); }
|
||||||
@@ -60,7 +68,8 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
string ChooseWeaponForExplosion(Actor self)
|
string ChooseWeaponForExplosion(Actor self)
|
||||||
{
|
{
|
||||||
var shouldExplode = self.TraitsImplementing<IExplodeModifier>().All(a => a.ShouldExplode(self));
|
var shouldExplode = self.TraitsImplementing<IExplodeModifier>().All(a => a.ShouldExplode(self));
|
||||||
return shouldExplode ? info.Weapon : info.EmptyWeapon;
|
var useFullExplosion = self.World.SharedRandom.Next(100) <= info.LoadedChance;
|
||||||
|
return (shouldExplode && useFullExplosion) ? info.Weapon : info.EmptyWeapon;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -153,6 +153,10 @@ ARTY:
|
|||||||
InitialStance: Defend
|
InitialStance: Defend
|
||||||
LeavesHusk:
|
LeavesHusk:
|
||||||
HuskActor: ARTY.Husk
|
HuskActor: ARTY.Husk
|
||||||
|
Explodes:
|
||||||
|
Weapon: ArtilleryShell
|
||||||
|
EmptyWeapon: UnitExplode
|
||||||
|
LoadedChance: 75
|
||||||
|
|
||||||
FTNK:
|
FTNK:
|
||||||
Inherits: ^Tank
|
Inherits: ^Tank
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ UnitExplode:
|
|||||||
Warhead@1Dam: SpreadDamage
|
Warhead@1Dam: SpreadDamage
|
||||||
Spread: 426
|
Spread: 426
|
||||||
Damage: 50
|
Damage: 50
|
||||||
Falloff: 1000, 368, 135, 50, 18, 7, 0
|
|
||||||
Versus:
|
Versus:
|
||||||
None: 90
|
None: 90
|
||||||
Wood: 75
|
Wood: 75
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ V2RL:
|
|||||||
AutoTarget:
|
AutoTarget:
|
||||||
Explodes:
|
Explodes:
|
||||||
Weapon: SCUD
|
Weapon: SCUD
|
||||||
EmptyWeapon: UnitExplodeSmall
|
|
||||||
WithAttackAnimation:
|
WithAttackAnimation:
|
||||||
AimSequence: aim
|
AimSequence: aim
|
||||||
ReloadPrefix: empty-
|
ReloadPrefix: empty-
|
||||||
@@ -64,9 +63,6 @@ V2RL:
|
|||||||
WithMuzzleFlash:
|
WithMuzzleFlash:
|
||||||
WithTurret:
|
WithTurret:
|
||||||
AutoTarget:
|
AutoTarget:
|
||||||
Explodes:
|
|
||||||
Weapon: UnitExplodeSmall
|
|
||||||
EmptyWeapon: UnitExplodeSmall
|
|
||||||
LeavesHusk:
|
LeavesHusk:
|
||||||
HuskActor: 1TNK.Husk
|
HuskActor: 1TNK.Husk
|
||||||
ProducibleWithLevel:
|
ProducibleWithLevel:
|
||||||
@@ -104,9 +100,6 @@ V2RL:
|
|||||||
WithMuzzleFlash:
|
WithMuzzleFlash:
|
||||||
WithTurret:
|
WithTurret:
|
||||||
AutoTarget:
|
AutoTarget:
|
||||||
Explodes:
|
|
||||||
Weapon: UnitExplodeSmall
|
|
||||||
EmptyWeapon: UnitExplodeSmall
|
|
||||||
LeavesHusk:
|
LeavesHusk:
|
||||||
HuskActor: 2TNK.Husk
|
HuskActor: 2TNK.Husk
|
||||||
SelectionDecorations:
|
SelectionDecorations:
|
||||||
@@ -146,9 +139,6 @@ V2RL:
|
|||||||
WithMuzzleFlash:
|
WithMuzzleFlash:
|
||||||
WithTurret:
|
WithTurret:
|
||||||
AutoTarget:
|
AutoTarget:
|
||||||
Explodes:
|
|
||||||
Weapon: UnitExplodeSmall
|
|
||||||
EmptyWeapon: UnitExplodeSmall
|
|
||||||
LeavesHusk:
|
LeavesHusk:
|
||||||
HuskActor: 3TNK.Husk
|
HuskActor: 3TNK.Husk
|
||||||
SelectionDecorations:
|
SelectionDecorations:
|
||||||
@@ -197,9 +187,6 @@ V2RL:
|
|||||||
WithMuzzleFlash:
|
WithMuzzleFlash:
|
||||||
WithTurret:
|
WithTurret:
|
||||||
AutoTarget:
|
AutoTarget:
|
||||||
Explodes:
|
|
||||||
Weapon: UnitExplodeSmall
|
|
||||||
EmptyWeapon: UnitExplodeSmall
|
|
||||||
LeavesHusk:
|
LeavesHusk:
|
||||||
HuskActor: 4TNK.Husk
|
HuskActor: 4TNK.Husk
|
||||||
SelfHealing:
|
SelfHealing:
|
||||||
@@ -239,8 +226,9 @@ ARTY:
|
|||||||
AttackFrontal:
|
AttackFrontal:
|
||||||
WithMuzzleFlash:
|
WithMuzzleFlash:
|
||||||
Explodes:
|
Explodes:
|
||||||
Weapon: UnitExplode
|
Weapon: ArtilleryExplode
|
||||||
Chance: 75
|
EmptyWeapon: UnitExplodeSmall
|
||||||
|
LoadedChance: 75
|
||||||
AutoTarget:
|
AutoTarget:
|
||||||
ProducibleWithLevel:
|
ProducibleWithLevel:
|
||||||
Prerequisites: vehicles.upgraded
|
Prerequisites: vehicles.upgraded
|
||||||
@@ -289,7 +277,6 @@ HARV:
|
|||||||
FullnessThreshold: 50
|
FullnessThreshold: 50
|
||||||
Explodes:
|
Explodes:
|
||||||
Weapon: OreExplosion
|
Weapon: OreExplosion
|
||||||
EmptyWeapon: UnitExplodeSmall
|
|
||||||
|
|
||||||
MCV:
|
MCV:
|
||||||
Inherits: ^Vehicle
|
Inherits: ^Vehicle
|
||||||
@@ -328,9 +315,6 @@ MCV:
|
|||||||
BaseBuilding:
|
BaseBuilding:
|
||||||
LeavesHusk:
|
LeavesHusk:
|
||||||
HuskActor: MCV.Husk
|
HuskActor: MCV.Husk
|
||||||
Explodes:
|
|
||||||
Weapon: UnitExplodeSmall
|
|
||||||
EmptyWeapon: UnitExplodeSmall
|
|
||||||
|
|
||||||
JEEP:
|
JEEP:
|
||||||
Inherits: ^Vehicle
|
Inherits: ^Vehicle
|
||||||
|
|||||||
@@ -197,6 +197,25 @@ UnitExplodeSmall:
|
|||||||
ImpactSound: splash9.aud
|
ImpactSound: splash9.aud
|
||||||
ValidImpactTypes: Water
|
ValidImpactTypes: Water
|
||||||
|
|
||||||
|
ArtilleryExplode:
|
||||||
|
Warhead@1Dam: SpreadDamage
|
||||||
|
Spread: 426
|
||||||
|
Damage: 150
|
||||||
|
Versus:
|
||||||
|
None: 90
|
||||||
|
Wood: 75
|
||||||
|
Light: 60
|
||||||
|
Heavy: 25
|
||||||
|
DamageTypes: Prone50Percent, TriggerProne, ExplosionDeath
|
||||||
|
Warhead@2Eff: CreateEffect
|
||||||
|
Explosion: self_destruct
|
||||||
|
ImpactSound: kaboom22.aud
|
||||||
|
InvalidImpactTypes: Water
|
||||||
|
Warhead@3EffWater: CreateEffect
|
||||||
|
Explosion: large_splash
|
||||||
|
ImpactSound: splash9.aud
|
||||||
|
ValidImpactTypes: Water
|
||||||
|
|
||||||
BarrelExplode:
|
BarrelExplode:
|
||||||
Warhead@1Dam: SpreadDamage
|
Warhead@1Dam: SpreadDamage
|
||||||
Spread: 426
|
Spread: 426
|
||||||
|
|||||||
Reference in New Issue
Block a user