"Alternate Names" aka pseudo-prerequisites. E7 and MSLO can be built again.
This commit is contained in:
@@ -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<BuildableInfo>())
|
||||
.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<BuildableInfo>().Description;
|
||||
}
|
||||
|
||||
void DrawSupportPowers()
|
||||
{
|
||||
var numPowers = Game.LocalPlayer.SupportPowers.Values
|
||||
|
||||
@@ -25,7 +25,13 @@ namespace OpenRa.Game.GameRules
|
||||
{
|
||||
var ret = new Cache<string, List<Actor>>( x => new List<Actor>() );
|
||||
foreach( var b in Game.world.Actors.Where( x => x.Owner == player && x.Info != null && x.Info.Traits.Contains<BuildingInfo>() ) )
|
||||
{
|
||||
ret[ b.Info.Name ].Add( b );
|
||||
var buildable = b.Info.Traits.GetOrDefault<BuildableInfo>();
|
||||
if( buildable != null )
|
||||
foreach( var alt in buildable.AlternateName )
|
||||
ret[ alt ].Add( b );
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 { }
|
||||
|
||||
Reference in New Issue
Block a user