Properly remove worms from the world
This commit is contained in:
@@ -75,6 +75,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|| self.Owner.Stances[actor.Actor.Owner] != Stance.Enemy)
|
||||
continue;
|
||||
|
||||
if (actor.Actor.IsDead || !actor.Actor.IsInWorld)
|
||||
continue;
|
||||
|
||||
// The actor is not currently visible
|
||||
if (!self.Owner.Shroud.IsVisible(actor.Actor))
|
||||
continue;
|
||||
|
||||
@@ -115,11 +115,7 @@ namespace OpenRA.Mods.D2k.Activities
|
||||
if (self.World.SharedRandom.Next() % 100 <= sandworm.Info.ChanceToDisappear)
|
||||
{
|
||||
self.CancelActivity();
|
||||
self.World.AddFrameEndTask(w => w.Remove(self));
|
||||
|
||||
var wormManager = self.World.WorldActor.TraitOrDefault<WormManager>();
|
||||
if (wormManager != null)
|
||||
wormManager.DecreaseWormCount();
|
||||
self.World.AddFrameEndTask(w => self.Kill(self));
|
||||
}
|
||||
else
|
||||
renderUnit.DefaultAnimation.ReplaceAnim("idle");
|
||||
|
||||
Reference in New Issue
Block a user