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