Fix #611 - prereqs handled by traits. Make both cnc power plants valid for prereqs.

This commit is contained in:
Paul Chote
2011-03-17 19:31:56 +13:00
parent 6d1defc53e
commit 86e8c3974f
8 changed files with 91 additions and 54 deletions

View File

@@ -33,8 +33,8 @@ namespace OpenRA.Mods.RA.Buildings
public object Create(ActorInitializer init) { return new Building(init, this); }
public bool IsCloseEnoughToBase(World world, Player p, string buildingName, int2 topLeft)
{
if (p.PlayerActor.Trait<DeveloperMode>().BuildAnywhere)
{
if (p.PlayerActor.Trait<DeveloperMode>().BuildAnywhere)
return true;
var buildingMaxBounds = Dimensions;
@@ -63,7 +63,7 @@ namespace OpenRA.Mods.RA.Buildings
}
}
public class Building : INotifyDamage, IOccupySpace, INotifyCapture, ISync
public class Building : INotifyDamage, IOccupySpace, INotifyCapture, ISync, ITechTreePrerequisite
{
readonly Actor self;
public readonly BuildingInfo Info;
@@ -73,7 +73,9 @@ namespace OpenRA.Mods.RA.Buildings
PowerManager PlayerPower;
public int2 PxPosition { get { return ( 2 * topLeft + Info.Dimensions ) * Game.CellSize / 2; } }
public IEnumerable<string> ProvidesPrerequisites { get { yield return self.Info.Name; } }
public Building(ActorInitializer init, BuildingInfo info)
{
this.self = init.self;