Remove "Primary" tag.
This commit is contained in:
@@ -35,7 +35,7 @@ namespace OpenRA.Traits
|
||||
|
||||
// depends on the order of pips in WorldRenderer.cs!
|
||||
public enum PipType { Transparent, Green, Yellow, Red, Gray, Blue, Ammo, AmmoEmpty }
|
||||
public enum TagType { None, Primary }
|
||||
public enum TagType { None }
|
||||
|
||||
[Flags]
|
||||
public enum Stance
|
||||
|
||||
@@ -25,16 +25,25 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
|
||||
[Desc("Used together with ClassicProductionQueue.")]
|
||||
public class PrimaryBuildingInfo : TraitInfo<PrimaryBuilding> { }
|
||||
|
||||
public class PrimaryBuilding : IIssueOrder, IResolveOrder, ITags
|
||||
public class PrimaryBuildingInfo : ITraitInfo, Requires<UpgradeManagerInfo>
|
||||
{
|
||||
bool isPrimary = false;
|
||||
public bool IsPrimary { get { return isPrimary; } }
|
||||
[UpgradeGrantedReference, Desc("The upgrades to grant while the primary building.")]
|
||||
public readonly string[] Upgrades = { "primary" };
|
||||
|
||||
public IEnumerable<TagType> GetTags()
|
||||
public object Create(ActorInitializer init) { return new PrimaryBuilding(init.Self, this); }
|
||||
}
|
||||
|
||||
public class PrimaryBuilding : IIssueOrder, IResolveOrder
|
||||
{
|
||||
readonly PrimaryBuildingInfo info;
|
||||
readonly UpgradeManager manager;
|
||||
|
||||
public bool IsPrimary { get; private set; }
|
||||
|
||||
public PrimaryBuilding(Actor self, PrimaryBuildingInfo info)
|
||||
{
|
||||
yield return isPrimary ? TagType.Primary : TagType.None;
|
||||
this.info = info;
|
||||
manager = self.Trait<UpgradeManager>();
|
||||
}
|
||||
|
||||
public IEnumerable<IOrderTargeter> Orders
|
||||
@@ -53,14 +62,16 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public void ResolveOrder(Actor self, Order order)
|
||||
{
|
||||
if (order.OrderString == "PrimaryProducer")
|
||||
SetPrimaryProducer(self, !isPrimary);
|
||||
SetPrimaryProducer(self, !IsPrimary);
|
||||
}
|
||||
|
||||
public void SetPrimaryProducer(Actor self, bool state)
|
||||
{
|
||||
if (state == false)
|
||||
{
|
||||
isPrimary = false;
|
||||
IsPrimary = false;
|
||||
foreach (var up in info.Upgrades)
|
||||
manager.RevokeUpgrade(self, up, this);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -78,7 +89,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
b.Trait.SetPrimaryProducer(b.Actor, false);
|
||||
}
|
||||
|
||||
isPrimary = true;
|
||||
IsPrimary = true;
|
||||
foreach (var up in info.Upgrades)
|
||||
manager.GrantUpgrade(self, up, this);
|
||||
|
||||
Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", "PrimaryBuildingSelected", self.Owner.Faction.InternalName);
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
// depends on the order of pips in TraitsInterfaces.cs!
|
||||
static readonly string[] PipStrings = { "pip-empty", "pip-green", "pip-yellow", "pip-red", "pip-gray", "pip-blue", "pip-ammo", "pip-ammoempty" };
|
||||
static readonly string[] TagStrings = { "", "tag-primary" };
|
||||
static readonly string[] TagStrings = { "" };
|
||||
|
||||
public readonly SelectionDecorationsInfo Info;
|
||||
readonly Actor self;
|
||||
|
||||
@@ -2749,6 +2749,19 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
node.Value.Nodes.Add(new MiniYamlNode("ReferencePoint", "Top"));
|
||||
node.Value.Nodes.Add(new MiniYamlNode("ZOffset", "256"));
|
||||
}
|
||||
|
||||
if (depth == 0 && node.Value.Nodes.Any(n => n.Key.StartsWith("PrimaryBuilding")))
|
||||
{
|
||||
var decNodes = new List<MiniYamlNode>();
|
||||
decNodes.Add(new MiniYamlNode("RequiresSelection", "true"));
|
||||
decNodes.Add(new MiniYamlNode("Image", "pips"));
|
||||
decNodes.Add(new MiniYamlNode("Sequence", "tag-primary"));
|
||||
decNodes.Add(new MiniYamlNode("ReferencePoint", "Top"));
|
||||
decNodes.Add(new MiniYamlNode("ZOffset", "256"));
|
||||
decNodes.Add(new MiniYamlNode("UpgradeTypes", "primary"));
|
||||
decNodes.Add(new MiniYamlNode("UpgradeMinEnabledLevel", "1"));
|
||||
node.Value.Nodes.Add(new MiniYamlNode("WithDecoration@primary", new MiniYaml("", decNodes)));
|
||||
}
|
||||
}
|
||||
|
||||
UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1);
|
||||
|
||||
@@ -95,6 +95,14 @@ construction_yard:
|
||||
ZOffset: 256
|
||||
UpgradeTypes: stardecoration
|
||||
UpgradeMinEnabledLevel: 1
|
||||
WithDecoration@primary:
|
||||
RequiresSelection: true
|
||||
Image: pips
|
||||
Sequence: tag-primary
|
||||
ReferencePoint: Top
|
||||
ZOffset: 256
|
||||
UpgradeTypes: primary
|
||||
UpgradeMinEnabledLevel: 1
|
||||
|
||||
wind_trap:
|
||||
Inherits: ^Building
|
||||
@@ -198,6 +206,14 @@ barracks:
|
||||
ZOffset: 256
|
||||
UpgradeTypes: stardecoration
|
||||
UpgradeMinEnabledLevel: 1
|
||||
WithDecoration@primary:
|
||||
RequiresSelection: true
|
||||
Image: pips
|
||||
Sequence: tag-primary
|
||||
ReferencePoint: Top
|
||||
ZOffset: 256
|
||||
UpgradeTypes: primary
|
||||
UpgradeMinEnabledLevel: 1
|
||||
|
||||
refinery:
|
||||
Inherits: ^Building
|
||||
@@ -366,6 +382,14 @@ light_factory:
|
||||
ZOffset: 256
|
||||
UpgradeTypes: stardecoration
|
||||
UpgradeMinEnabledLevel: 1
|
||||
WithDecoration@primary:
|
||||
RequiresSelection: true
|
||||
Image: pips
|
||||
Sequence: tag-primary
|
||||
ReferencePoint: Top
|
||||
ZOffset: 256
|
||||
UpgradeTypes: primary
|
||||
UpgradeMinEnabledLevel: 1
|
||||
|
||||
heavy_factory:
|
||||
Inherits: ^Building
|
||||
@@ -439,6 +463,14 @@ heavy_factory:
|
||||
ZOffset: 256
|
||||
UpgradeTypes: stardecoration
|
||||
UpgradeMinEnabledLevel: 1
|
||||
WithDecoration@primary:
|
||||
RequiresSelection: true
|
||||
Image: pips
|
||||
Sequence: tag-primary
|
||||
ReferencePoint: Top
|
||||
ZOffset: 256
|
||||
UpgradeTypes: primary
|
||||
UpgradeMinEnabledLevel: 1
|
||||
|
||||
outpost:
|
||||
Inherits: ^Building
|
||||
@@ -541,6 +573,14 @@ starport:
|
||||
Power:
|
||||
Amount: -150
|
||||
ProvidesPrerequisite@buildingname:
|
||||
WithDecoration@primary:
|
||||
RequiresSelection: true
|
||||
Image: pips
|
||||
Sequence: tag-primary
|
||||
ReferencePoint: Top
|
||||
ZOffset: 256
|
||||
UpgradeTypes: primary
|
||||
UpgradeMinEnabledLevel: 1
|
||||
|
||||
wall:
|
||||
Inherits@1: ^SpriteActor
|
||||
|
||||
@@ -107,6 +107,7 @@ pips:
|
||||
pickup-indicator: DATA.R8
|
||||
Start: 112
|
||||
tag-primary: primary.shp
|
||||
Offset: 0, 2
|
||||
pip-empty: DATA.R8
|
||||
Start: 15
|
||||
pip-green: DATA.R8
|
||||
|
||||
@@ -169,6 +169,14 @@ SPEN:
|
||||
ProvidesPrerequisite@buildingname:
|
||||
EditorTilesetFilter:
|
||||
ExcludeTilesets: INTERIOR
|
||||
WithDecoration@primary:
|
||||
RequiresSelection: true
|
||||
Image: pips
|
||||
Sequence: tag-primary
|
||||
ReferencePoint: Top
|
||||
ZOffset: 256
|
||||
UpgradeTypes: primary
|
||||
UpgradeMinEnabledLevel: 1
|
||||
|
||||
SYRD:
|
||||
Inherits: ^Building
|
||||
@@ -256,6 +264,14 @@ SYRD:
|
||||
ProvidesPrerequisite@buildingname:
|
||||
EditorTilesetFilter:
|
||||
ExcludeTilesets: INTERIOR
|
||||
WithDecoration@primary:
|
||||
RequiresSelection: true
|
||||
Image: pips
|
||||
Sequence: tag-primary
|
||||
ReferencePoint: Top
|
||||
ZOffset: 256
|
||||
UpgradeTypes: primary
|
||||
UpgradeMinEnabledLevel: 1
|
||||
|
||||
IRON:
|
||||
Inherits: ^ScienceBuilding
|
||||
@@ -845,6 +861,14 @@ WEAP:
|
||||
TargetTypes: Ground, C4, DetonateAttack, Structure, SpyInfiltrate
|
||||
InfiltrateForSupportPower:
|
||||
Proxy: vehicles.upgraded
|
||||
WithDecoration@primary:
|
||||
RequiresSelection: true
|
||||
Image: pips
|
||||
Sequence: tag-primary
|
||||
ReferencePoint: Top
|
||||
ZOffset: 256
|
||||
UpgradeTypes: primary
|
||||
UpgradeMinEnabledLevel: 1
|
||||
|
||||
FACT:
|
||||
Inherits: ^Building
|
||||
@@ -1074,6 +1098,14 @@ HPAD:
|
||||
TargetTypes: Ground, C4, DetonateAttack, Structure, SpyInfiltrate
|
||||
InfiltrateForSupportPower:
|
||||
Proxy: aircraft.upgraded
|
||||
WithDecoration@primary:
|
||||
RequiresSelection: true
|
||||
Image: pips
|
||||
Sequence: tag-primary
|
||||
ReferencePoint: Top
|
||||
ZOffset: 256
|
||||
UpgradeTypes: primary
|
||||
UpgradeMinEnabledLevel: 1
|
||||
|
||||
AFLD:
|
||||
Inherits: ^Building
|
||||
@@ -1183,6 +1215,14 @@ AFLD:
|
||||
TargetTypes: Ground, C4, DetonateAttack, Structure, SpyInfiltrate
|
||||
InfiltrateForSupportPower:
|
||||
Proxy: aircraft.upgraded
|
||||
WithDecoration@primary:
|
||||
RequiresSelection: true
|
||||
Image: pips
|
||||
Sequence: tag-primary
|
||||
ReferencePoint: Top
|
||||
ZOffset: 256
|
||||
UpgradeTypes: primary
|
||||
UpgradeMinEnabledLevel: 1
|
||||
|
||||
POWR:
|
||||
Inherits: ^Building
|
||||
@@ -1354,6 +1394,14 @@ BARR:
|
||||
Proxy: barracks.upgraded
|
||||
Targetable:
|
||||
TargetTypes: Ground, C4, DetonateAttack, Structure, SpyInfiltrate
|
||||
WithDecoration@primary:
|
||||
RequiresSelection: true
|
||||
Image: pips
|
||||
Sequence: tag-primary
|
||||
ReferencePoint: Top
|
||||
ZOffset: 256
|
||||
UpgradeTypes: primary
|
||||
UpgradeMinEnabledLevel: 1
|
||||
|
||||
KENN:
|
||||
Inherits: ^Building
|
||||
@@ -1394,6 +1442,14 @@ KENN:
|
||||
ProvidesPrerequisite@buildingname:
|
||||
WithBuildingExplosion:
|
||||
Sequences: building, building_napalm, large_explosion, self_destruct
|
||||
WithDecoration@primary:
|
||||
RequiresSelection: true
|
||||
Image: pips
|
||||
Sequence: tag-primary
|
||||
ReferencePoint: Top
|
||||
ZOffset: 256
|
||||
UpgradeTypes: primary
|
||||
UpgradeMinEnabledLevel: 1
|
||||
|
||||
TENT:
|
||||
Inherits: ^Building
|
||||
@@ -1466,6 +1522,14 @@ TENT:
|
||||
Proxy: barracks.upgraded
|
||||
Targetable:
|
||||
TargetTypes: Ground, C4, DetonateAttack, Structure, SpyInfiltrate
|
||||
WithDecoration@primary:
|
||||
RequiresSelection: true
|
||||
Image: pips
|
||||
Sequence: tag-primary
|
||||
ReferencePoint: Top
|
||||
ZOffset: 256
|
||||
UpgradeTypes: primary
|
||||
UpgradeMinEnabledLevel: 1
|
||||
|
||||
FIX:
|
||||
Inherits: ^Building
|
||||
|
||||
@@ -60,6 +60,7 @@ pips:
|
||||
Offset: 0, 2
|
||||
tag-primary:
|
||||
Start: 2
|
||||
Offset: 0, 2
|
||||
pip-empty: pips2
|
||||
pip-green: pips2
|
||||
Start: 1
|
||||
|
||||
@@ -108,6 +108,15 @@ GAPILE:
|
||||
ProvidesPrerequisite@buildingname:
|
||||
SelectionDecorations:
|
||||
VisualBounds: 88, 56, 0, -8
|
||||
WithDecoration@primary:
|
||||
RequiresSelection: true
|
||||
Image: pips
|
||||
Sequence: tag-primary
|
||||
Palette: ra
|
||||
ReferencePoint: Top
|
||||
ZOffset: 256
|
||||
UpgradeTypes: primary
|
||||
UpgradeMinEnabledLevel: 1
|
||||
|
||||
GAWEAP:
|
||||
Inherits: ^Building
|
||||
@@ -159,6 +168,15 @@ GAWEAP:
|
||||
ProvidesPrerequisite@buildingname:
|
||||
SelectionDecorations:
|
||||
VisualBounds: 154, 100, -2, -12
|
||||
WithDecoration@primary:
|
||||
RequiresSelection: true
|
||||
Image: pips
|
||||
Sequence: tag-primary
|
||||
Palette: ra
|
||||
ReferencePoint: Top
|
||||
ZOffset: 256
|
||||
UpgradeTypes: primary
|
||||
UpgradeMinEnabledLevel: 1
|
||||
|
||||
GAHPAD:
|
||||
Inherits: ^Building
|
||||
@@ -203,6 +221,15 @@ GAHPAD:
|
||||
ProvidesPrerequisite@buildingname:
|
||||
SelectionDecorations:
|
||||
VisualBounds: 88, 66, 0, -5
|
||||
WithDecoration@primary:
|
||||
RequiresSelection: true
|
||||
Image: pips
|
||||
Sequence: tag-primary
|
||||
Palette: ra
|
||||
ReferencePoint: Top
|
||||
ZOffset: 256
|
||||
UpgradeTypes: primary
|
||||
UpgradeMinEnabledLevel: 1
|
||||
|
||||
GADEPT:
|
||||
Inherits: ^Building
|
||||
|
||||
@@ -116,6 +116,15 @@ NAHAND:
|
||||
ProvidesPrerequisite@buildingname:
|
||||
SelectionDecorations:
|
||||
VisualBounds: 116, 78, 3, -8
|
||||
WithDecoration@primary:
|
||||
RequiresSelection: true
|
||||
Image: pips
|
||||
Sequence: tag-primary
|
||||
Palette: ra
|
||||
ReferencePoint: Top
|
||||
ZOffset: 256
|
||||
UpgradeTypes: primary
|
||||
UpgradeMinEnabledLevel: 1
|
||||
|
||||
NAWEAP:
|
||||
Inherits: ^Building
|
||||
@@ -163,6 +172,15 @@ NAWEAP:
|
||||
ProvidesPrerequisite@buildingname:
|
||||
SelectionDecorations:
|
||||
VisualBounds: 149, 116, -3, -20
|
||||
WithDecoration@primary:
|
||||
RequiresSelection: true
|
||||
Image: pips
|
||||
Sequence: tag-primary
|
||||
Palette: ra
|
||||
ReferencePoint: Top
|
||||
ZOffset: 256
|
||||
UpgradeTypes: primary
|
||||
UpgradeMinEnabledLevel: 1
|
||||
|
||||
NAHPAD:
|
||||
Inherits: ^Building
|
||||
@@ -207,6 +225,15 @@ NAHPAD:
|
||||
ProvidesPrerequisite@buildingname:
|
||||
SelectionDecorations:
|
||||
VisualBounds: 78, 54, 0, -8
|
||||
WithDecoration@primary:
|
||||
RequiresSelection: true
|
||||
Image: pips
|
||||
Sequence: tag-primary
|
||||
Palette: ra
|
||||
ReferencePoint: Top
|
||||
ZOffset: 256
|
||||
UpgradeTypes: primary
|
||||
UpgradeMinEnabledLevel: 1
|
||||
|
||||
NARADR:
|
||||
Inherits: ^Building
|
||||
@@ -406,3 +433,4 @@ NAWAST:
|
||||
SelectionDecorations:
|
||||
VisualBounds: 100, 60, 5, -5
|
||||
RenderSprites:
|
||||
|
||||
|
||||
@@ -90,6 +90,7 @@ pips:
|
||||
Length: 10
|
||||
tag-primary: pipsra #TODO: backfall to RA asset
|
||||
Start: 2
|
||||
Offset: 0, 2
|
||||
pip-empty: pips2
|
||||
pip-green: pips2
|
||||
Start: 1
|
||||
|
||||
Reference in New Issue
Block a user