diff --git a/OpenRa.Game/Chrome.cs b/OpenRa.Game/Chrome.cs index 52ac6de270..3bf0f5c137 100644 --- a/OpenRa.Game/Chrome.cs +++ b/OpenRa.Game/Chrome.cs @@ -751,9 +751,7 @@ namespace OpenRa.Game if (!Rules.TechTree.CanBuild(info, Game.LocalPlayer, buildings)) { var prereqs = buildable.Prerequisites - .Select(a => Rules.NewUnitInfo[a.ToLowerInvariant()].Traits.Get()) - .Where( u => u.Owner.Any( o => o == Game.LocalPlayer.Race ) ) - .Select( a => a.Description ); + .Select( a => Description( a ) ); renderer.DrawText("Requires {0}".F( string.Join( ", ", prereqs.ToArray() ) ), p.ToInt2(), Color.White); } @@ -765,6 +763,14 @@ namespace OpenRa.Game } } + private static string Description( string a ) + { + if( a[ 0 ] == '@' ) + return "any " + a.Substring( 1 ); + else + return Rules.NewUnitInfo[ a.ToLowerInvariant() ].Traits.Get().Description; + } + void DrawSupportPowers() { var numPowers = Game.LocalPlayer.SupportPowers.Values diff --git a/OpenRa.Game/GameRules/TechTree.cs b/OpenRa.Game/GameRules/TechTree.cs index 80bb04b47b..080eff3913 100755 --- a/OpenRa.Game/GameRules/TechTree.cs +++ b/OpenRa.Game/GameRules/TechTree.cs @@ -25,7 +25,13 @@ namespace OpenRa.Game.GameRules { var ret = new Cache>( x => new List() ); foreach( var b in Game.world.Actors.Where( x => x.Owner == player && x.Info != null && x.Info.Traits.Contains() ) ) + { ret[ b.Info.Name ].Add( b ); + var buildable = b.Info.Traits.GetOrDefault(); + if( buildable != null ) + foreach( var alt in buildable.AlternateName ) + ret[ alt ].Add( b ); + } return ret; } diff --git a/OpenRa.Game/Traits/Buildable.cs b/OpenRa.Game/Traits/Buildable.cs index 5a420533e6..8a15e43b8e 100755 --- a/OpenRa.Game/Traits/Buildable.cs +++ b/OpenRa.Game/Traits/Buildable.cs @@ -16,6 +16,7 @@ namespace OpenRa.Game.Traits public readonly string Description = ""; public readonly string LongDesc = ""; public readonly string Icon = null; + public readonly string[] AlternateName = { }; } class Buildable { } diff --git a/RulesConverter/Program.cs b/RulesConverter/Program.cs index 56eceaed5b..abfef1565a 100644 --- a/RulesConverter/Program.cs +++ b/RulesConverter/Program.cs @@ -81,7 +81,8 @@ namespace RulesConverter { "Cost", "Cost" }, { "Icon", "Icon" }, { "Description", "Description" }, - { "LongDesc", "LongDesc" } } + { "LongDesc", "LongDesc" }, + { "AlternateName", "AlternateName" } } }, { "Cargo", new PL { diff --git a/ra.yaml b/ra.yaml index ff7e9b5b79..4aee273e10 100644 --- a/ra.yaml +++ b/ra.yaml @@ -879,7 +879,7 @@ MSLO: Buildable: TechLevel: 13 Tab: Defense - Prerequisites: stek,atek + Prerequisites: @Tech Center Owner: soviet,allies Cost: 2500 Description: Missile Silo @@ -907,6 +907,7 @@ ATEK: Cost: 1500 Description: Allied Tech Center LongDesc: Provides Allied advanced technologies.\n Special Ability: GPS Satellite + AlternateName: @Tech Center Selectable: Priority: 3 Building: @@ -1226,6 +1227,7 @@ STEK: Cost: 1500 Description: Soviet Tech Center LongDesc: Provides Soviet advanced technologies + AlternateName: @Tech Center Selectable: Priority: 3 Building: @@ -2317,7 +2319,7 @@ E7: Buildable: TechLevel: 11 Tab: Infantry - Prerequisites: atek,stek + Prerequisites: @Tech Center Owner: allies,soviet Cost: 1200 Description: Tanya diff --git a/rules.ini b/rules.ini index 8b753341e0..13a31613ec 100644 --- a/rules.ini +++ b/rules.ini @@ -601,7 +601,7 @@ Infiltrate=yes ; Tanya [E7] -Prerequisite=atek,stek +Prerequisite=@Tech Center Primary=Colt45 Secondary=Colt45 Strength=100 @@ -1228,7 +1228,7 @@ ROT=30 ; big missile silo [MSLO] -Prerequisite=stek,atek +Prerequisite=@Tech Center Primary=none Strength=400 Armor=heavy diff --git a/units.ini b/units.ini index 0386e52630..c05a71a66b 100644 --- a/units.ini +++ b/units.ini @@ -353,6 +353,7 @@ Dimensions=2,2 Footprint=xx xx SelectionPriority=3 LongDesc=Provides Allied advanced technologies.\n Special Ability: GPS Satellite +AlternateName=@Tech Center [WEAP] Description=War Factory Traits=Building, RenderBuilding, RenderWarFactory, RallyPoint, Production, IronCurtainable @@ -448,6 +449,7 @@ Dimensions=3,2 Footprint=xxx xxx SelectionPriority=3 LongDesc=Provides Soviet advanced technologies +AlternateName=@Tech Center [BARR] Description=Soviet Barracks Traits=Building, RenderBuilding, RallyPoint, Production, IronCurtainable