Sync harvester contents. Add ISync to ProductionQueue.

This commit is contained in:
Paul Chote
2011-02-03 08:27:35 +13:00
parent bf2f3cacd9
commit 451e06190f
2 changed files with 8 additions and 5 deletions

View File

@@ -43,6 +43,12 @@ namespace OpenRA.Mods.RA
[Sync] [Sync]
public int2 LastHarvestedCell = int2.Zero; public int2 LastHarvestedCell = int2.Zero;
[Sync]
public int ContentValue { get { return contents.Sum(c => c.Key.ValuePerUnit*c.Value); } }
[Sync]
int currentUnloadTicks;
readonly HarvesterInfo Info; readonly HarvesterInfo Info;
public Harvester(Actor self, HarvesterInfo info) public Harvester(Actor self, HarvesterInfo info)
@@ -82,9 +88,7 @@ namespace OpenRA.Mods.RA
else contents[type.info]++; else contents[type.info]++;
} }
// TODO: N-tick harvester unload.
// Returns true when unloading is complete // Returns true when unloading is complete
int currentUnloadTicks;
public bool TickUnload(Actor self, Actor proc) public bool TickUnload(Actor self, Actor proc)
{ {
if (!proc.IsInWorld) if (!proc.IsInWorld)

View File

@@ -31,7 +31,7 @@ namespace OpenRA.Mods.RA
public virtual object Create(ActorInitializer init) { return new ProductionQueue(init.self, init.self.Owner.PlayerActor, this); } public virtual object Create(ActorInitializer init) { return new ProductionQueue(init.self, init.self.Owner.PlayerActor, this); }
} }
public class ProductionQueue : IResolveOrder, ITick, ITechTreeElement, INotifyCapture public class ProductionQueue : IResolveOrder, ITick, ITechTreeElement, INotifyCapture, ISync
{ {
public readonly Actor self; public readonly Actor self;
public ProductionQueueInfo Info; public ProductionQueueInfo Info;
@@ -40,8 +40,7 @@ namespace OpenRA.Mods.RA
// A list of things we are currently building // A list of things we are currently building
public List<ProductionItem> Queue = new List<ProductionItem>(); public List<ProductionItem> Queue = new List<ProductionItem>();
[Sync] [Sync]
public int QueueLength { get { return Queue.Count; } } public int QueueLength { get { return Queue.Count; } }
[Sync] [Sync]