Add support for pool-specific ammo pips decoration
This commit is contained in:
@@ -38,6 +38,9 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
[PaletteReference]
|
[PaletteReference]
|
||||||
public readonly string Palette = "chrome";
|
public readonly string Palette = "chrome";
|
||||||
|
|
||||||
|
[Desc("Name(s) of AmmoPool(s) that use this decoration. Leave empty to include all pools.")]
|
||||||
|
public readonly string[] AmmoPools = { };
|
||||||
|
|
||||||
public override object Create(ActorInitializer init) { return new WithAmmoPipsDecoration(init.Self, this); }
|
public override object Create(ActorInitializer init) { return new WithAmmoPipsDecoration(init.Self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,7 +52,13 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
public WithAmmoPipsDecoration(Actor self, WithAmmoPipsDecorationInfo info)
|
public WithAmmoPipsDecoration(Actor self, WithAmmoPipsDecorationInfo info)
|
||||||
: base(self, info)
|
: base(self, info)
|
||||||
{
|
{
|
||||||
|
if (info.AmmoPools.Any())
|
||||||
|
ammo = self.TraitsImplementing<AmmoPool>()
|
||||||
|
.Where(ap => info.AmmoPools.Contains(ap.Info.Name))
|
||||||
|
.ToArray();
|
||||||
|
else
|
||||||
ammo = self.TraitsImplementing<AmmoPool>().ToArray();
|
ammo = self.TraitsImplementing<AmmoPool>().ToArray();
|
||||||
|
|
||||||
pips = new Animation(self.World, info.Image);
|
pips = new Animation(self.World, info.Image);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user