Move production icon sequence from Tooltip to Buildable
This commit is contained in:
@@ -34,6 +34,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Force a specific faction variant, overriding the faction of the producing actor.")]
|
||||
public readonly string ForceFaction = null;
|
||||
|
||||
[Desc("Sequence of the actor that contains the icon.")]
|
||||
[SequenceReference] public readonly string Icon = "icon";
|
||||
|
||||
[Desc("Palette used for the production icon.")]
|
||||
[PaletteReference] public readonly string IconPalette = "chrome";
|
||||
|
||||
|
||||
@@ -42,9 +42,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Show the actor's owner and their faction flag")]
|
||||
public readonly bool ShowOwnerRow = true;
|
||||
|
||||
[Desc("Sequence of the actor that contains the cameo.")]
|
||||
public readonly string Icon = "icon";
|
||||
|
||||
public override object Create(ActorInitializer init) { return new Tooltip(init.Self, this); }
|
||||
|
||||
public string TooltipForPlayerStance(Stance stance)
|
||||
|
||||
@@ -400,8 +400,8 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
// Move production description from Tooltip to Buildable
|
||||
if (engineVersion < 20161016)
|
||||
{
|
||||
var tooltipChild = node.Value.Nodes.FirstOrDefault(n => n.Key == "Tooltip");
|
||||
if (tooltipChild != null || (tooltipChild = node.Value.Nodes.FirstOrDefault(n => n.Key == "DisguiseToolTip")) != null)
|
||||
var tooltipChild = node.Value.Nodes.FirstOrDefault(n => n.Key == "Tooltip" || n.Key == "DisguiseToolTip");
|
||||
if (tooltipChild != null)
|
||||
{
|
||||
var descNode = tooltipChild.Value.Nodes.FirstOrDefault(n => n.Key == "Description");
|
||||
if (descNode != null)
|
||||
@@ -416,6 +416,25 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
}
|
||||
}
|
||||
|
||||
// Move production icon sequence from Tooltip to Buildable
|
||||
if (engineVersion < 20161022)
|
||||
{
|
||||
var tooltipChild = node.Value.Nodes.FirstOrDefault(n => n.Key == "Tooltip" || n.Key == "DisguiseToolTip");
|
||||
if (tooltipChild != null)
|
||||
{
|
||||
var iconNode = tooltipChild.Value.Nodes.FirstOrDefault(n => n.Key == "Icon");
|
||||
if (iconNode != null)
|
||||
{
|
||||
var buildableNode = node.Value.Nodes.FirstOrDefault(n => n.Key == "Buildable");
|
||||
if (buildableNode == null)
|
||||
node.Value.Nodes.Add(buildableNode = new MiniYamlNode("Buildable", ""));
|
||||
|
||||
buildableNode.Value.Nodes.Add(iconNode);
|
||||
tooltipChild.Value.Nodes.Remove(iconNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UpgradeActorRules(modData, engineVersion, ref node.Value.Nodes, node, depth + 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -91,8 +91,8 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
|
||||
var rsi = actor.TraitInfo<RenderSpritesInfo>();
|
||||
var icon = new Animation(world, rsi.GetImage(actor, world.Map.Rules.Sequences, faction));
|
||||
icon.Play(actor.TraitInfo<TooltipInfo>().Icon);
|
||||
var bi = actor.TraitInfo<BuildableInfo>();
|
||||
icon.Play(bi.Icon);
|
||||
var location = new float2(RenderBounds.Location) + new float2(queue.i * (IconWidth + IconSpacing), 0);
|
||||
WidgetUtils.DrawSHPCentered(icon.Image, location + 0.5f * iconSize, worldRenderer.Palette(bi.IconPalette), 0.5f);
|
||||
|
||||
|
||||
@@ -338,9 +338,8 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
|
||||
var rsi = item.TraitInfo<RenderSpritesInfo>();
|
||||
var icon = new Animation(World, rsi.GetImage(item, World.Map.Rules.Sequences, faction));
|
||||
icon.Play(item.TraitInfo<TooltipInfo>().Icon);
|
||||
|
||||
var bi = item.TraitInfo<BuildableInfo>();
|
||||
icon.Play(bi.Icon);
|
||||
|
||||
var pi = new ProductionIcon()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user