Merge pull request #8911 from reaperrr/random-wbe

Allowed WithBuildingExplosion to randomly select from multiple sequences
This commit is contained in:
abcdefg30
2015-08-03 17:02:00 +02:00
3 changed files with 12 additions and 4 deletions

View File

@@ -18,11 +18,11 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Display explosions over the building footprint when it is destroyed.")] [Desc("Display explosions over the building footprint when it is destroyed.")]
class WithBuildingExplosionInfo : ITraitInfo, Requires<BuildingInfo> class WithBuildingExplosionInfo : ITraitInfo, Requires<BuildingInfo>
{ {
[Desc("Group where Sequence is looked up.")] [Desc("Group where Sequences are looked up.")]
public readonly string SequenceCollection = "explosion"; public readonly string SequenceCollection = "explosion";
[Desc("Explosion sequence name to use")] [Desc("Explosion sequence names to use")]
[SequenceReference("SequenceCollection")] public readonly string Sequence = "building"; [SequenceReference("SequenceCollection")] public readonly string[] Sequences = { "building" };
[Desc("Delay the explosions by this many ticks.")] [Desc("Delay the explosions by this many ticks.")]
public readonly int Delay = 0; public readonly int Delay = 0;
@@ -57,7 +57,7 @@ namespace OpenRA.Mods.Common.Traits
void SpawnExplosions(World world, IEnumerable<CPos> cells) void SpawnExplosions(World world, IEnumerable<CPos> cells)
{ {
foreach (var c in cells) foreach (var c in cells)
world.AddFrameEndTask(w => w.Add(new Explosion(w, w.Map.CenterOfCell(c), info.Sequence, info.Palette))); world.AddFrameEndTask(w => w.Add(new Explosion(w, w.Map.CenterOfCell(c), info.Sequences.Random(w.SharedRandom), info.Palette)));
} }
} }
} }

View File

@@ -1680,6 +1680,13 @@ namespace OpenRA.Mods.Common.UtilityCommands
} }
} }
// WithBuildingExplosion received support for sequence randomization
if (engineVersion < 20150803)
{
if (depth == 2 && parentKey == "WithBuildingExplosion" && node.Key == "Sequence")
node.Key = "Sequences";
}
UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1); UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1);
} }
} }

View File

@@ -64,6 +64,7 @@
DestroyedSounds: crmble2.aud DestroyedSounds: crmble2.aud
RenderBuilding: RenderBuilding:
WithBuildingExplosion: WithBuildingExplosion:
Sequences: building, large_bang, large_brnl, verylarge_clsn, large_tumu
EngineerRepairable: EngineerRepairable:
ShakeOnDeath: ShakeOnDeath:
AcceptsSupplies: AcceptsSupplies: