Unhardcode Explosion "Image"
Add ExplosionCollection property to CreateEffectWarhead
This commit is contained in:
@@ -20,15 +20,15 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("If we land on invalid terrain for my actor type should we be killed?")]
|
||||
public readonly bool KilledOnImpassableTerrain = true;
|
||||
|
||||
[Desc("Group where Ground/WaterCorpseSequence is looked up.")]
|
||||
public readonly string CorpseSequenceCollection = "explosion";
|
||||
[Desc("Image where Ground/WaterCorpseSequence is looked up.")]
|
||||
public readonly string Image = "explosion";
|
||||
|
||||
public readonly string GroundImpactSound = null;
|
||||
[SequenceReference("CorpseSequenceCollection")] public readonly string GroundCorpseSequence = "corpse";
|
||||
[SequenceReference("Image")] public readonly string GroundCorpseSequence = "corpse";
|
||||
[PaletteReference] public readonly string GroundCorpsePalette = "effect";
|
||||
|
||||
public readonly string WaterImpactSound = null;
|
||||
[SequenceReference("CorpseSequenceCollection")] public readonly string WaterCorpseSequence = null;
|
||||
[SequenceReference("Image")] public readonly string WaterCorpseSequence = null;
|
||||
[PaletteReference] public readonly string WaterCorpsePalette = "effect";
|
||||
|
||||
public readonly int FallRate = 13;
|
||||
@@ -70,7 +70,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
var sequence = terrain.IsWater ? info.WaterCorpseSequence : info.GroundCorpseSequence;
|
||||
var palette = terrain.IsWater ? info.WaterCorpsePalette : info.GroundCorpsePalette;
|
||||
if (sequence != null && palette != null)
|
||||
self.World.AddFrameEndTask(w => w.Add(new Explosion(w, self.OccupiesSpace.CenterPosition, sequence, palette)));
|
||||
self.World.AddFrameEndTask(w => w.Add(new Explosion(w, self.OccupiesSpace.CenterPosition, info.Image, sequence, palette)));
|
||||
|
||||
self.Kill(self);
|
||||
}
|
||||
|
||||
@@ -19,16 +19,16 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Display explosions over the building footprint when it is destroyed.")]
|
||||
class WithBuildingExplosionInfo : ITraitInfo, Requires<BuildingInfo>
|
||||
{
|
||||
[Desc("Group where Sequences are looked up.")]
|
||||
public readonly string SequenceCollection = "explosion";
|
||||
[Desc("'Image' where Sequences are looked up.")]
|
||||
public readonly string Image = "explosion";
|
||||
|
||||
[Desc("Explosion sequence names to use")]
|
||||
[SequenceReference("SequenceCollection")] public readonly string[] Sequences = { "building" };
|
||||
[Desc("Explosion sequence names to use.")]
|
||||
[SequenceReference("Image")] public readonly string[] Sequences = { "building" };
|
||||
|
||||
[Desc("Delay the explosions by this many ticks.")]
|
||||
public readonly int Delay = 0;
|
||||
|
||||
[Desc("Custom palette name")]
|
||||
[Desc("Custom palette name.")]
|
||||
[PaletteReference] public readonly string Palette = "effect";
|
||||
|
||||
public object Create(ActorInitializer init) { return new WithBuildingExplosion(init.Self, this); }
|
||||
@@ -58,7 +58,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
void SpawnExplosions(World world, IEnumerable<CPos> cells)
|
||||
{
|
||||
foreach (var c in cells)
|
||||
world.AddFrameEndTask(w => w.Add(new Explosion(w, w.Map.CenterOfCell(c), info.Sequences.Random(w.SharedRandom), info.Palette)));
|
||||
world.AddFrameEndTask(w => w.Add(new Explosion(w, w.Map.CenterOfCell(c), info.Image, info.Sequences.Random(w.SharedRandom), info.Palette)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user