Fix #225 and some other uses of a.IsInWorld / a.IsDead()
This commit is contained in:
@@ -20,7 +20,7 @@ namespace OpenRA.Mods.RA.Activities
|
||||
public override IActivity Tick(Actor self)
|
||||
{
|
||||
if (IsCanceled) return NextActivity;
|
||||
if (target == null || target.IsDead()) return NextActivity;
|
||||
if (target == null || !target.IsInWorld || target.IsDead()) return NextActivity;
|
||||
if (target.Owner == self.Owner) return NextActivity;
|
||||
|
||||
foreach (var t in target.TraitsImplementing<IAcceptSpy>())
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
return inRange
|
||||
.Where(a => a != self && self.Owner.Stances[a.Owner] == Stance.Ally)
|
||||
.Where(a => !a.IsDead())
|
||||
.Where(a => a.IsInWorld && !a.IsDead())
|
||||
.Where(a => a.HasTrait<Health>() && a.GetDamageState() > DamageState.Undamaged)
|
||||
.Where(a => attack.HasAnyValidWeapons(Target.FromActor(a)))
|
||||
.OrderBy(a => (a.Location - self.Location).LengthSquared)
|
||||
|
||||
@@ -139,7 +139,7 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
bool IsIntact(Bridge b)
|
||||
{
|
||||
return b != null && b.self.IsInWorld && !b.self.IsDead();
|
||||
return b != null && !b.self.IsDead();
|
||||
}
|
||||
|
||||
void KillUnitsOnBridge()
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user