Move production icon sequence from Tooltip to Buildable

This commit is contained in:
reaperrr
2016-10-18 21:57:23 +02:00
parent cba704dbcc
commit 5b5b064981
8 changed files with 37 additions and 35 deletions

View File

@@ -34,6 +34,9 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Force a specific faction variant, overriding the faction of the producing actor.")] [Desc("Force a specific faction variant, overriding the faction of the producing actor.")]
public readonly string ForceFaction = null; 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.")] [Desc("Palette used for the production icon.")]
[PaletteReference] public readonly string IconPalette = "chrome"; [PaletteReference] public readonly string IconPalette = "chrome";

View File

@@ -42,9 +42,6 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Show the actor's owner and their faction flag")] [Desc("Show the actor's owner and their faction flag")]
public readonly bool ShowOwnerRow = true; 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 override object Create(ActorInitializer init) { return new Tooltip(init.Self, this); }
public string TooltipForPlayerStance(Stance stance) public string TooltipForPlayerStance(Stance stance)

View File

@@ -400,8 +400,8 @@ namespace OpenRA.Mods.Common.UtilityCommands
// Move production description from Tooltip to Buildable // Move production description from Tooltip to Buildable
if (engineVersion < 20161016) if (engineVersion < 20161016)
{ {
var tooltipChild = node.Value.Nodes.FirstOrDefault(n => n.Key == "Tooltip"); var tooltipChild = node.Value.Nodes.FirstOrDefault(n => n.Key == "Tooltip" || n.Key == "DisguiseToolTip");
if (tooltipChild != null || (tooltipChild = node.Value.Nodes.FirstOrDefault(n => n.Key == "DisguiseToolTip")) != null) if (tooltipChild != null)
{ {
var descNode = tooltipChild.Value.Nodes.FirstOrDefault(n => n.Key == "Description"); var descNode = tooltipChild.Value.Nodes.FirstOrDefault(n => n.Key == "Description");
if (descNode != null) 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); UpgradeActorRules(modData, engineVersion, ref node.Value.Nodes, node, depth + 1);
} }

View File

@@ -91,8 +91,8 @@ namespace OpenRA.Mods.Common.Widgets
var rsi = actor.TraitInfo<RenderSpritesInfo>(); var rsi = actor.TraitInfo<RenderSpritesInfo>();
var icon = new Animation(world, rsi.GetImage(actor, world.Map.Rules.Sequences, faction)); var icon = new Animation(world, rsi.GetImage(actor, world.Map.Rules.Sequences, faction));
icon.Play(actor.TraitInfo<TooltipInfo>().Icon);
var bi = actor.TraitInfo<BuildableInfo>(); var bi = actor.TraitInfo<BuildableInfo>();
icon.Play(bi.Icon);
var location = new float2(RenderBounds.Location) + new float2(queue.i * (IconWidth + IconSpacing), 0); 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); WidgetUtils.DrawSHPCentered(icon.Image, location + 0.5f * iconSize, worldRenderer.Palette(bi.IconPalette), 0.5f);

View File

@@ -338,9 +338,8 @@ namespace OpenRA.Mods.Common.Widgets
var rsi = item.TraitInfo<RenderSpritesInfo>(); var rsi = item.TraitInfo<RenderSpritesInfo>();
var icon = new Animation(World, rsi.GetImage(item, World.Map.Rules.Sequences, faction)); var icon = new Animation(World, rsi.GetImage(item, World.Map.Rules.Sequences, faction));
icon.Play(item.TraitInfo<TooltipInfo>().Icon);
var bi = item.TraitInfo<BuildableInfo>(); var bi = item.TraitInfo<BuildableInfo>();
icon.Play(bi.Icon);
var pi = new ProductionIcon() var pi = new ProductionIcon()
{ {

View File

@@ -353,7 +353,6 @@ BARB:
Type: Light Type: Light
Tooltip: Tooltip:
Name: Barbwire Fence Name: Barbwire Fence
Icon: barbicnh
LineBuild: LineBuild:
NodeTypes: barbwire NodeTypes: barbwire
LineBuildNode: LineBuildNode:
@@ -367,7 +366,6 @@ WOOD:
Type: Wood Type: Wood
Tooltip: Tooltip:
Name: Wooden Fence Name: Wooden Fence
Icon: woodicnh
LineBuild: LineBuild:
NodeTypes: woodfence NodeTypes: woodfence
LineBuildNode: LineBuildNode:

View File

@@ -2,7 +2,6 @@ MCV.Husk:
Inherits: ^Husk Inherits: ^Husk
Tooltip: Tooltip:
Name: Mobile Construction Vehicle (Destroyed) Name: Mobile Construction Vehicle (Destroyed)
Icon: mcvicnh
TransformOnCapture: TransformOnCapture:
IntoActor: mcv IntoActor: mcv
RenderSprites: RenderSprites:
@@ -12,7 +11,6 @@ HARV.Husk:
Inherits: ^Husk Inherits: ^Husk
Tooltip: Tooltip:
Name: Harvester (Destroyed) Name: Harvester (Destroyed)
Icon: harvicnh
TransformOnCapture: TransformOnCapture:
IntoActor: harv IntoActor: harv
RenderSprites: RenderSprites:
@@ -22,7 +20,6 @@ APC.Husk:
Inherits: ^Husk Inherits: ^Husk
Tooltip: Tooltip:
Name: APC (Destroyed) Name: APC (Destroyed)
Icon: apcicnh
TransformOnCapture: TransformOnCapture:
IntoActor: apc IntoActor: apc
RenderSprites: RenderSprites:
@@ -32,7 +29,6 @@ FTNK.Husk:
Inherits: ^Husk Inherits: ^Husk
Tooltip: Tooltip:
Name: Flame Tank (Destroyed) Name: Flame Tank (Destroyed)
Icon: ftnkicnh
TransformOnCapture: TransformOnCapture:
IntoActor: ftnk IntoActor: ftnk
RenderSprites: RenderSprites:
@@ -42,7 +38,6 @@ ARTY.Husk:
Inherits: ^Husk Inherits: ^Husk
Tooltip: Tooltip:
Name: Artillery (Destroyed) Name: Artillery (Destroyed)
Icon: artyicnh
TransformOnCapture: TransformOnCapture:
IntoActor: arty IntoActor: arty
RenderSprites: RenderSprites:
@@ -52,7 +47,6 @@ BGGY.Husk:
Inherits: ^Husk Inherits: ^Husk
Tooltip: Tooltip:
Name: Nod Buggy (Destroyed) Name: Nod Buggy (Destroyed)
Icon: bggyicnh
TransformOnCapture: TransformOnCapture:
IntoActor: bggy IntoActor: bggy
RenderSprites: RenderSprites:
@@ -62,7 +56,6 @@ BIKE.Husk:
Inherits: ^Husk Inherits: ^Husk
Tooltip: Tooltip:
Name: Recon Bike (Destroyed) Name: Recon Bike (Destroyed)
Icon: bikeicnh
TransformOnCapture: TransformOnCapture:
IntoActor: bike IntoActor: bike
RenderSprites: RenderSprites:
@@ -72,7 +65,6 @@ JEEP.Husk:
Inherits: ^Husk Inherits: ^Husk
Tooltip: Tooltip:
Name: Hum-Vee (Destroyed) Name: Hum-Vee (Destroyed)
Icon: jeepicnh
TransformOnCapture: TransformOnCapture:
IntoActor: jeep IntoActor: jeep
RenderSprites: RenderSprites:
@@ -82,7 +74,6 @@ LTNK.Husk:
Inherits: ^Husk Inherits: ^Husk
Tooltip: Tooltip:
Name: Light Tank (Destroyed) Name: Light Tank (Destroyed)
Icon: ltnkicnh
ThrowsParticle@turret: ThrowsParticle@turret:
Anim: turret Anim: turret
TransformOnCapture: TransformOnCapture:
@@ -94,7 +85,6 @@ MTNK.Husk:
Inherits: ^Husk Inherits: ^Husk
Tooltip: Tooltip:
Name: Medium Tank (Destroyed) Name: Medium Tank (Destroyed)
Icon: mtnkicnh
ThrowsParticle@turret: ThrowsParticle@turret:
Anim: turret Anim: turret
TransformOnCapture: TransformOnCapture:
@@ -106,7 +96,6 @@ HTNK.Husk:
Inherits: ^Husk Inherits: ^Husk
Tooltip: Tooltip:
Name: Mammoth Tank (Destroyed) Name: Mammoth Tank (Destroyed)
Icon: htnkicnh
ThrowsParticle@turret: ThrowsParticle@turret:
Anim: turret Anim: turret
TransformOnCapture: TransformOnCapture:
@@ -118,7 +107,6 @@ MSAM.Husk:
Inherits: ^Husk Inherits: ^Husk
Tooltip: Tooltip:
Name: Rocket Launcher (Destroyed) Name: Rocket Launcher (Destroyed)
Icon: msamicnh
ThrowsParticle@turret: ThrowsParticle@turret:
Anim: turret Anim: turret
TransformOnCapture: TransformOnCapture:
@@ -130,7 +118,6 @@ MLRS.Husk:
Inherits: ^Husk Inherits: ^Husk
Tooltip: Tooltip:
Name: Mobile S.A.M. (Destroyed) Name: Mobile S.A.M. (Destroyed)
Icon: mlrsicnh
ThrowsParticle@turret: ThrowsParticle@turret:
Anim: turret Anim: turret
TransformOnCapture: TransformOnCapture:
@@ -142,7 +129,6 @@ STNK.Husk:
Inherits: ^Husk Inherits: ^Husk
Tooltip: Tooltip:
Name: Stealth Tank (Destroyed) Name: Stealth Tank (Destroyed)
Icon: stnkicnh
TransformOnCapture: TransformOnCapture:
IntoActor: stnk IntoActor: stnk
RenderSprites: RenderSprites:

View File

@@ -6,8 +6,8 @@ FPWR:
Queue: Defense Queue: Defense
Prerequisites: ~structures.france, ~techlevel.infonly Prerequisites: ~structures.france, ~techlevel.infonly
Description: Looks like a Power Plant. Description: Looks like a Power Plant.
Tooltip:
Icon: fake-icon Icon: fake-icon
Tooltip:
Name: Fake Power Plant Name: Fake Power Plant
GenericName: Power Plant GenericName: Power Plant
GenericVisibility: Enemy GenericVisibility: Enemy
@@ -33,8 +33,8 @@ SYRF:
Queue: Defense Queue: Defense
Prerequisites: ~structures.france, ~techlevel.medium Prerequisites: ~structures.france, ~techlevel.medium
Description: Looks like a Shipyard. Description: Looks like a Shipyard.
Tooltip:
Icon: fake-icon Icon: fake-icon
Tooltip:
Name: Fake Shipyard Name: Fake Shipyard
GenericName: Shipyard GenericName: Shipyard
GenericVisibility: Enemy GenericVisibility: Enemy
@@ -67,8 +67,8 @@ SPEF:
Queue: Defense Queue: Defense
Prerequisites: ~disabled Prerequisites: ~disabled
Description: Looks like a Sub Pen. Description: Looks like a Sub Pen.
Tooltip:
Icon: fake-icon Icon: fake-icon
Tooltip:
Name: Fake Sub Pen Name: Fake Sub Pen
GenericName: Sub Pen GenericName: Sub Pen
GenericVisibility: Enemy GenericVisibility: Enemy
@@ -97,8 +97,8 @@ WEAF:
Prerequisites: ~structures.france, ~techlevel.medium Prerequisites: ~structures.france, ~techlevel.medium
Queue: Defense Queue: Defense
Description: Looks like a War Factory. Description: Looks like a War Factory.
Tooltip:
Icon: fake-icon Icon: fake-icon
Tooltip:
Name: Fake War Factory Name: Fake War Factory
GenericName: War Factory GenericName: War Factory
GenericVisibility: Enemy GenericVisibility: Enemy
@@ -122,7 +122,6 @@ DOMF:
Inherits: ^FakeBuilding Inherits: ^FakeBuilding
Inherits@infiltrate: ^InfiltratableFake Inherits@infiltrate: ^InfiltratableFake
Tooltip: Tooltip:
Icon: fake-icon
Name: Fake Radar Dome Name: Fake Radar Dome
GenericName: Radar Dome GenericName: Radar Dome
GenericVisibility: Enemy GenericVisibility: Enemy
@@ -132,6 +131,7 @@ DOMF:
Queue: Defense Queue: Defense
Prerequisites: ~structures.france, ~techlevel.medium Prerequisites: ~structures.france, ~techlevel.medium
Description: Looks like a Radar Dome. Description: Looks like a Radar Dome.
Icon: fake-icon
Building: Building:
Footprint: xx xx Footprint: xx xx
Dimensions: 2,2 Dimensions: 2,2
@@ -154,8 +154,8 @@ FIXF:
Queue: Defense Queue: Defense
Prerequisites: ~structures.france, ~techlevel.medium Prerequisites: ~structures.france, ~techlevel.medium
Description: Looks like a Service Depot. Description: Looks like a Service Depot.
Tooltip:
Icon: fake-icon Icon: fake-icon
Tooltip:
Name: Fake Service Depot Name: Fake Service Depot
GenericName: Service Depot GenericName: Service Depot
GenericVisibility: Enemy GenericVisibility: Enemy
@@ -182,8 +182,8 @@ FAPW:
Queue: Defense Queue: Defense
Prerequisites: ~structures.france, ~techlevel.medium Prerequisites: ~structures.france, ~techlevel.medium
Description: Looks like an Advanced Power Plant. Description: Looks like an Advanced Power Plant.
Tooltip:
Icon: fake-icon Icon: fake-icon
Tooltip:
Name: Fake Advanced Power Plant Name: Fake Advanced Power Plant
GenericName: Advanced Power Plant GenericName: Advanced Power Plant
GenericVisibility: Enemy GenericVisibility: Enemy
@@ -208,7 +208,6 @@ FAPW:
ATEF: ATEF:
Inherits: ^FakeBuilding Inherits: ^FakeBuilding
Tooltip: Tooltip:
Icon: fake-icon
Name: Fake Allied Tech Center Name: Fake Allied Tech Center
GenericName: Allied Tech Center GenericName: Allied Tech Center
GenericVisibility: Enemy GenericVisibility: Enemy
@@ -218,6 +217,7 @@ ATEF:
Queue: Defense Queue: Defense
Prerequisites: ~structures.france, ~techlevel.high Prerequisites: ~structures.france, ~techlevel.high
Description: Looks like an Allied Tech Center. Description: Looks like an Allied Tech Center.
Icon: fake-icon
Building: Building:
Footprint: xx xx Footprint: xx xx
Dimensions: 2,2 Dimensions: 2,2
@@ -236,7 +236,6 @@ ATEF:
PDOF: PDOF:
Inherits: ^FakeBuilding Inherits: ^FakeBuilding
Tooltip: Tooltip:
Icon: fake-icon
Name: Fake Chronosphere Name: Fake Chronosphere
GenericName: Chronosphere GenericName: Chronosphere
GenericVisibility: Enemy GenericVisibility: Enemy
@@ -247,6 +246,7 @@ PDOF:
Prerequisites: ~structures.france, ~techlevel.unrestricted Prerequisites: ~structures.france, ~techlevel.unrestricted
BuildLimit: 1 BuildLimit: 1
Description: Looks like a Chronosphere. Description: Looks like a Chronosphere.
Icon: fake-icon
Building: Building:
Footprint: xx xx Footprint: xx xx
Dimensions: 2,2 Dimensions: 2,2
@@ -268,7 +268,6 @@ PDOF:
MSLF: MSLF:
Inherits: ^FakeBuilding Inherits: ^FakeBuilding
Tooltip: Tooltip:
Icon: fake-icon
Name: Fake Missile Silo Name: Fake Missile Silo
GenericName: Missile Silo GenericName: Missile Silo
GenericVisibility: Enemy GenericVisibility: Enemy
@@ -279,6 +278,7 @@ MSLF:
Prerequisites: ~structures.france, ~techlevel.unrestricted Prerequisites: ~structures.france, ~techlevel.unrestricted
BuildLimit: 1 BuildLimit: 1
Description: Looks like a Missile Silo. Description: Looks like a Missile Silo.
Icon: fake-icon
Building: Building:
Footprint: xx Footprint: xx
Dimensions: 2,1 Dimensions: 2,1
@@ -302,8 +302,8 @@ FACF:
Queue: Defense Queue: Defense
Prerequisites: ~structures.france, ~techlevel.medium Prerequisites: ~structures.france, ~techlevel.medium
Description: Looks like a Construction Yard. Description: Looks like a Construction Yard.
Tooltip:
Icon: fake-icon Icon: fake-icon
Tooltip:
Name: Fake Construction Yard Name: Fake Construction Yard
GenericName: Construction Yard GenericName: Construction Yard
GenericVisibility: Enemy GenericVisibility: Enemy