Fix #225 and some other uses of a.IsInWorld / a.IsDead()

This commit is contained in:
Paul Chote
2010-10-08 10:28:09 +13:00
parent ad6481c8e8
commit fd34f2ba99
8 changed files with 20 additions and 9 deletions

View File

@@ -237,9 +237,16 @@ namespace OpenRA.Mods.RA
return a.TraitsImplementing<IDisable>().Any(d => d.Disabled);
}
// Builds a unit from the actor that holds this queue (1 queue per building)
protected virtual void BuildUnit( string name )
{
// queue lives on actor; is produced at same actor
// Cannot produce if i'm dead
if (!self.IsInWorld || self.IsDead())
{
CancelProduction(name, 1);
return;
}
var sp = self.TraitsImplementing<Production>().Where(p => p.Info.Produces.Contains(Info.Type)).FirstOrDefault();
if (sp != null && !IsDisabledBuilding(self) && sp.Produce(self, Rules.Info[ name ]))
FinishProduction();