give RepairableNear access to its info

This commit is contained in:
Chris Forbes
2012-03-03 18:01:50 +13:00
parent be1fdbdd56
commit 469a393585

View File

@@ -23,14 +23,15 @@ namespace OpenRA.Mods.RA
{
[ActorReference] public readonly string[] Buildings = { "spen", "syrd" };
public object Create( ActorInitializer init ) { return new RepairableNear( init.self ); }
public object Create( ActorInitializer init ) { return new RepairableNear( init.self, this ); }
}
class RepairableNear : IIssueOrder, IResolveOrder
{
readonly Actor self;
readonly RepairableNearInfo info;
public RepairableNear( Actor self ) { this.self = self; }
public RepairableNear( Actor self, RepairableNearInfo info ) { this.self = self; this.info = info; }
public IEnumerable<IOrderTargeter> Orders
{
@@ -51,7 +52,7 @@ namespace OpenRA.Mods.RA
bool CanRepairAt( Actor target )
{
return self.Info.Traits.Get<RepairableNearInfo>().Buildings.Contains( target.Info.Name );
return info.Buildings.Contains( target.Info.Name );
}
bool ShouldRepair()