Improved cnc proc/harv docking.

This commit is contained in:
Paul Chote
2011-01-02 14:34:55 +13:00
parent 9ffdce7957
commit 3674accd0c
6 changed files with 195 additions and 50 deletions

View File

@@ -80,7 +80,22 @@ namespace OpenRA.Mods.RA
if (!contents.ContainsKey(type.info)) contents[type.info] = 1;
else contents[type.info]++;
}
// TODO: N-tick harvester unload.
// Currently unloads everything in one go
// Returns true when unloading is complete
public bool TickUnload(Actor self, Actor proc)
{
if (!proc.IsInWorld)
return false; // fail to deliver if there is no proc.
// TODO: Unload part of the load. Return false if the proc is full.
proc.Trait<IAcceptOre>().GiveOre(contents.Sum(kv => kv.Key.ValuePerUnit * kv.Value));
contents.Clear();
return true;
}
public void Deliver(Actor self, Actor proc)
{
if (!proc.IsInWorld)

View File

@@ -90,6 +90,11 @@ namespace OpenRA.Mods.RA.Render
() => { anim.PlayRepeating(NormalizeSequence(self, "idle")); a(); });
}
public void CancelCustomAnim(Actor self)
{
anim.PlayRepeating( NormalizeSequence(self, "idle") );
}
public virtual void Damaged(Actor self, AttackInfo e)
{
if (!e.DamageStateChanged)