Rename Actor.Destroy/Destroyed to Dispose/Disposed.

This commit is contained in:
Paul Chote
2015-05-23 19:50:30 +01:00
parent 4c72b0066c
commit 585a43fd8f
45 changed files with 67 additions and 67 deletions

View File

@@ -33,7 +33,7 @@ namespace OpenRA
[Sync] public Player Owner { get; set; } [Sync] public Player Owner { get; set; }
public bool IsInWorld { get; internal set; } public bool IsInWorld { get; internal set; }
public bool Destroyed { get; private set; } public bool Disposed { get; private set; }
Activity currentActivity; Activity currentActivity;
@@ -51,7 +51,7 @@ namespace OpenRA
public IEffectiveOwner EffectiveOwner { get { return effectiveOwner.Value; } } public IEffectiveOwner EffectiveOwner { get { return effectiveOwner.Value; } }
public bool IsIdle { get { return currentActivity == null; } } public bool IsIdle { get { return currentActivity == null; } }
public bool IsDead { get { return Destroyed || (health.Value == null ? false : health.Value.IsDead); } } public bool IsDead { get { return Disposed || (health.Value == null ? false : health.Value.IsDead); } }
public CPos Location { get { return occupySpace.Value.TopLeft; } } public CPos Location { get { return occupySpace.Value.TopLeft; } }
public WPos CenterPosition { get { return occupySpace.Value.CenterPosition; } } public WPos CenterPosition { get { return occupySpace.Value.CenterPosition; } }
@@ -215,18 +215,18 @@ namespace OpenRA
World.TraitDict.AddTrait(this, trait); World.TraitDict.AddTrait(this, trait);
} }
public void Destroy() public void Dispose()
{ {
World.AddFrameEndTask(w => World.AddFrameEndTask(w =>
{ {
if (Destroyed) if (Disposed)
return; return;
if (IsInWorld) if (IsInWorld)
World.Remove(this); World.Remove(this);
World.TraitDict.RemoveActor(this); World.TraitDict.RemoveActor(this);
Destroyed = true; Disposed = true;
if (luaInterface != null) if (luaInterface != null)
luaInterface.Value.OnActorDestroyed(); luaInterface.Value.OnActorDestroyed();
@@ -238,7 +238,7 @@ namespace OpenRA
{ {
World.AddFrameEndTask(w => World.AddFrameEndTask(w =>
{ {
if (Destroyed) if (Disposed)
return; return;
var oldOwner = Owner; var oldOwner = Owner;

View File

@@ -140,7 +140,7 @@ namespace OpenRA.Graphics
// added for contrails // added for contrails
foreach (var a in World.ActorsWithTrait<IPostRender>()) foreach (var a in World.ActorsWithTrait<IPostRender>())
if (a.Actor.IsInWorld && !a.Actor.Destroyed) if (a.Actor.IsInWorld && !a.Actor.Disposed)
a.Trait.RenderAfterWorld(this, a.Actor); a.Trait.RenderAfterWorld(this, a.Actor);
var renderShroud = World.RenderPlayer != null ? World.RenderPlayer.Shroud : null; var renderShroud = World.RenderPlayer != null ? World.RenderPlayer.Shroud : null;
@@ -154,7 +154,7 @@ namespace OpenRA.Graphics
Game.Renderer.DisableScissor(); Game.Renderer.DisableScissor();
var overlayRenderables = World.Selection.Actors.Where(a => !a.Destroyed) var overlayRenderables = World.Selection.Actors.Where(a => !a.Disposed)
.SelectMany(a => a.TraitsImplementing<IPostRenderSelection>()) .SelectMany(a => a.TraitsImplementing<IPostRenderSelection>())
.SelectMany(t => t.RenderAfterWorld(this)); .SelectMany(t => t.RenderAfterWorld(this));
@@ -174,7 +174,7 @@ namespace OpenRA.Graphics
if (World.Type == WorldType.Regular && Game.Settings.Game.AlwaysShowStatusBars) if (World.Type == WorldType.Regular && Game.Settings.Game.AlwaysShowStatusBars)
{ {
foreach (var g in World.Actors.Where(a => !a.Destroyed foreach (var g in World.Actors.Where(a => !a.Disposed
&& a.HasTrait<Selectable>() && a.HasTrait<Selectable>()
&& !World.FogObscures(a) && !World.FogObscures(a)
&& !World.Selection.Actors.Contains(a))) && !World.Selection.Actors.Contains(a)))

View File

@@ -107,7 +107,7 @@ namespace OpenRA.Orders
if (self.Owner != self.World.LocalPlayer) if (self.Owner != self.World.LocalPlayer)
return null; return null;
if (self.Destroyed || !target.IsValidFor(self)) if (self.Disposed || !target.IsValidFor(self))
return null; return null;
if (mi.Button == Game.Settings.Game.MouseButtonPreference.Action) if (mi.Button == Game.Settings.Game.MouseButtonPreference.Action)

View File

@@ -41,7 +41,7 @@ namespace OpenRA.Scripting
var commandClasses = Context.ActorCommands[actor.Info].AsEnumerable(); var commandClasses = Context.ActorCommands[actor.Info].AsEnumerable();
// Destroyed actors cannot have their traits queried // Destroyed actors cannot have their traits queried
if (actor.Destroyed) if (actor.Disposed)
commandClasses = commandClasses.Where(c => c.HasAttribute<ExposedForDestroyedActors>()); commandClasses = commandClasses.Where(c => c.HasAttribute<ExposedForDestroyedActors>());
var args = new object[] { Context, actor }; var args = new object[] { Context, actor };

View File

@@ -78,7 +78,7 @@ namespace OpenRA
foreach (var cg in controlGroups.Values) foreach (var cg in controlGroups.Values)
{ {
// note: NOT `!a.IsInWorld`, since that would remove things that are in transports. // note: NOT `!a.IsInWorld`, since that would remove things that are in transports.
cg.RemoveAll(a => a.Destroyed || a.Owner != world.LocalPlayer); cg.RemoveAll(a => a.Disposed || a.Owner != world.LocalPlayer);
} }
} }

View File

@@ -80,7 +80,7 @@ namespace OpenRA
static void CheckDestroyed(Actor actor) static void CheckDestroyed(Actor actor)
{ {
if (actor.Destroyed) if (actor.Disposed)
throw new InvalidOperationException("Attempted to get trait from destroyed object ({0})".F(actor)); throw new InvalidOperationException("Attempted to get trait from destroyed object ({0})".F(actor));
} }

View File

@@ -104,7 +104,7 @@ namespace OpenRA.Traits
self.World.AddFrameEndTask(w => self.World.AddFrameEndTask(w =>
{ {
if (self.Destroyed) if (self.Disposed)
return; return;
var line = self.TraitOrDefault<DrawLineToTarget>(); var line = self.TraitOrDefault<DrawLineToTarget>();
@@ -120,7 +120,7 @@ namespace OpenRA.Traits
self.World.AddFrameEndTask(w => self.World.AddFrameEndTask(w =>
{ {
if (self.Destroyed) if (self.Disposed)
return; return;
target.Flash(); target.Flash();

View File

@@ -155,7 +155,7 @@ namespace OpenRA.Traits
nd.Killed(self, ai); nd.Killed(self, ai);
if (RemoveOnDeath) if (RemoveOnDeath)
self.Destroy(); self.Dispose();
Log.Write("debug", "{0} #{1} killed by {2} #{3}", self.Info.Name, self.ActorID, attacker.Info.Name, attacker.ActorID); Log.Write("debug", "{0} #{1} killed by {2} #{3}", self.Info.Name, self.ActorID, attacker.Info.Name, attacker.ActorID);
} }
@@ -195,7 +195,7 @@ namespace OpenRA.Traits
{ {
public static DamageState GetDamageState(this Actor self) public static DamageState GetDamageState(this Actor self)
{ {
if (self.Destroyed) if (self.Disposed)
return DamageState.Dead; return DamageState.Dead;
var health = self.TraitOrDefault<Health>(); var health = self.TraitOrDefault<Health>();
@@ -204,7 +204,7 @@ namespace OpenRA.Traits
public static void InflictDamage(this Actor self, Actor attacker, int damage, DamageWarhead warhead) public static void InflictDamage(this Actor self, Actor attacker, int damage, DamageWarhead warhead)
{ {
if (self.Destroyed) return; if (self.Disposed) return;
var health = self.TraitOrDefault<Health>(); var health = self.TraitOrDefault<Health>();
if (health == null) return; if (health == null) return;
health.InflictDamage(self, attacker, damage, warhead, false); health.InflictDamage(self, attacker, damage, warhead, false);

View File

@@ -100,7 +100,7 @@ namespace OpenRA.Traits
if (NeedRenderables) if (NeedRenderables)
{ {
NeedRenderables = false; NeedRenderables = false;
if (!actor.Destroyed) if (!actor.Disposed)
{ {
IsRendering = true; IsRendering = true;
renderables = actor.Render(wr).ToArray(); renderables = actor.Render(wr).ToArray();

View File

@@ -198,7 +198,7 @@ namespace OpenRA.Traits
yield break; yield break;
for (var i = influence[a]; i != null; i = i.Next) for (var i = influence[a]; i != null; i = i.Next)
if (!i.Actor.Destroyed) if (!i.Actor.Disposed)
yield return i.Actor; yield return i.Actor;
} }
@@ -208,7 +208,7 @@ namespace OpenRA.Traits
yield break; yield break;
for (var i = influence[a]; i != null; i = i.Next) for (var i = influence[a]; i != null; i = i.Next)
if (!i.Actor.Destroyed && (i.SubCell == sub || i.SubCell == SubCell.FullCell)) if (!i.Actor.Disposed && (i.SubCell == sub || i.SubCell == SubCell.FullCell))
yield return i.Actor; yield return i.Actor;
} }
@@ -285,7 +285,7 @@ namespace OpenRA.Traits
var always = sub == SubCell.FullCell || sub == SubCell.Any; var always = sub == SubCell.FullCell || sub == SubCell.Any;
for (var i = influence[a]; i != null; i = i.Next) for (var i = influence[a]; i != null; i = i.Next)
if ((always || i.SubCell == sub || i.SubCell == SubCell.FullCell) && !i.Actor.Destroyed && withCondition(i.Actor)) if ((always || i.SubCell == sub || i.SubCell == SubCell.FullCell) && !i.Actor.Disposed && withCondition(i.Actor))
return true; return true;
return false; return false;

View File

@@ -59,7 +59,7 @@ namespace OpenRA
continue; continue;
var orderSubject = o.Subject; var orderSubject = o.Subject;
if (orderSubject.Destroyed) if (orderSubject.Disposed)
continue; continue;
foreach (var voice in orderSubject.TraitsImplementing<IVoiced>()) foreach (var voice in orderSubject.TraitsImplementing<IVoiced>())

View File

@@ -382,7 +382,7 @@ namespace OpenRA.Mods.Common.AI
case BuildingType.Defense: case BuildingType.Defense:
// Build near the closest enemy structure // Build near the closest enemy structure
var closestEnemy = World.Actors.Where(a => !a.Destroyed && a.HasTrait<Building>() && Player.Stances[a.Owner] == Stance.Enemy) var closestEnemy = World.Actors.Where(a => !a.Disposed && a.HasTrait<Building>() && Player.Stances[a.Owner] == Stance.Enemy)
.ClosestTo(World.Map.CenterOfCell(defenseCenter)); .ClosestTo(World.Map.CenterOfCell(defenseCenter));
var targetCell = closestEnemy != null ? closestEnemy.Location : baseCenter; var targetCell = closestEnemy != null ? closestEnemy.Location : baseCenter;
@@ -944,7 +944,7 @@ namespace OpenRA.Mods.Common.AI
} }
} }
if (e.Attacker.Destroyed) if (e.Attacker.Disposed)
return; return;
if (!e.Attacker.HasTrait<ITargetable>()) if (!e.Attacker.HasTrait<ITargetable>())

View File

@@ -94,7 +94,7 @@ namespace OpenRA.Mods.Common.AI
else else
{ {
var enemies = owner.World.FindActorsInCircle(leader.CenterPosition, WRange.FromCells(12)) var enemies = owner.World.FindActorsInCircle(leader.CenterPosition, WRange.FromCells(12))
.Where(a1 => !a1.Destroyed && !a1.IsDead); .Where(a1 => !a1.Disposed && !a1.IsDead);
var enemynearby = enemies.Where(a1 => a1.HasTrait<ITargetable>() && leader.Owner.Stances[a1.Owner] == Stance.Enemy); var enemynearby = enemies.Where(a1 => a1.HasTrait<ITargetable>() && leader.Owner.Stances[a1.Owner] == Stance.Enemy);
var target = enemynearby.ClosestTo(leader.CenterPosition); var target = enemynearby.ClosestTo(leader.CenterPosition);
if (target != null) if (target != null)

View File

@@ -43,7 +43,7 @@ namespace OpenRA.Mods.Common.Activities
weapon.Impact(Target.FromPos(self.CenterPosition), self, Enumerable.Empty<int>()); weapon.Impact(Target.FromPos(self.CenterPosition), self, Enumerable.Empty<int>());
} }
self.Destroy(); self.Dispose();
return null; return null;
} }

View File

@@ -71,7 +71,7 @@ namespace OpenRA.Mods.Common.Activities
actor.InflictDamage(self, damage, null); actor.InflictDamage(self, damage, null);
} }
self.Destroy(); self.Dispose();
}); });
} }
} }

View File

@@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Activities
return; return;
target.Owner.PlayerActor.Trait<PlayerResources>().GiveCash(payload); target.Owner.PlayerActor.Trait<PlayerResources>().GiveCash(payload);
self.Destroy(); self.Dispose();
if (self.Owner.IsAlliedWith(self.World.RenderPlayer)) if (self.Owner.IsAlliedWith(self.World.RenderPlayer))
self.World.AddFrameEndTask(w => w.Add(new FloatingText(target.CenterPosition, target.Owner.Color.RGB, FloatingText.FormatCashTick(payload), 30))); self.World.AddFrameEndTask(w => w.Add(new FloatingText(target.CenterPosition, target.Owner.Color.RGB, FloatingText.FormatCashTick(payload), 30)));

View File

@@ -77,7 +77,7 @@ namespace OpenRA.Mods.Common.Activities
capturable.EndCapture(); capturable.EndCapture();
if (capturesInfo != null && capturesInfo.ConsumeActor) if (capturesInfo != null && capturesInfo.ConsumeActor)
self.Destroy(); self.Dispose();
}); });
} }
} }

View File

@@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.Activities
public override Activity Tick(Actor self) public override Activity Tick(Actor self)
{ {
if (IsCanceled) return NextActivity; if (IsCanceled) return NextActivity;
self.Destroy(); self.Dispose();
return null; return null;
} }
} }

View File

@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Activities
if (hut.BridgeDamageState == DamageState.Undamaged || hut.Repairing || hut.Bridge.GetHut(0) == null || hut.Bridge.GetHut(1) == null) if (hut.BridgeDamageState == DamageState.Undamaged || hut.Repairing || hut.Bridge.GetHut(0) == null || hut.Bridge.GetHut(1) == null)
return; return;
hut.Repair(self); hut.Repair(self);
self.Destroy(); self.Dispose();
} }
} }
} }

View File

@@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.Activities
if (health.DamageState == DamageState.Undamaged) if (health.DamageState == DamageState.Undamaged)
return; return;
target.InflictDamage(self, -health.MaxHP, null); target.InflictDamage(self, -health.MaxHP, null);
self.Destroy(); self.Dispose();
} }
} }
} }

View File

@@ -41,7 +41,7 @@ namespace OpenRA.Mods.Common.Activities
if (refund > 0 && self.Owner.IsAlliedWith(self.World.RenderPlayer)) if (refund > 0 && self.Owner.IsAlliedWith(self.World.RenderPlayer))
self.World.AddFrameEndTask(w => w.Add(new FloatingText(self.CenterPosition, self.Owner.Color.RGB, FloatingText.FormatCashTick(refund), 30))); self.World.AddFrameEndTask(w => w.Add(new FloatingText(self.CenterPosition, self.Owner.Color.RGB, FloatingText.FormatCashTick(refund), 30)));
self.Destroy(); self.Dispose();
return this; return this;
} }

View File

@@ -48,7 +48,7 @@ namespace OpenRA.Mods.Common.Activities
var selected = w.Selection.Contains(self); var selected = w.Selection.Contains(self);
var controlgroup = w.Selection.GetControlGroupForActor(self); var controlgroup = w.Selection.GetControlGroupForActor(self);
self.Destroy(); self.Dispose();
foreach (var s in Sounds) foreach (var s in Sounds)
Sound.PlayToPlayer(self.Owner, s, self.CenterPosition); Sound.PlayToPlayer(self.Owner, s, self.CenterPosition);

View File

@@ -76,7 +76,7 @@ namespace OpenRA.Mods.Common.Activities
cargo.Unload(self); cargo.Unload(self);
self.World.AddFrameEndTask(w => self.World.AddFrameEndTask(w =>
{ {
if (actor.Destroyed) if (actor.Disposed)
return; return;
var move = actor.Trait<IMove>(); var move = actor.Trait<IMove>();

View File

@@ -106,7 +106,7 @@ namespace OpenRA.Mods.Common.Commands
foreach (var actor in world.Selection.Actors) foreach (var actor in world.Selection.Actors)
{ {
if (actor.IsDead || actor.Destroyed) if (actor.IsDead || actor.Disposed)
continue; continue;
var leveluporder = new Order("DevLevelUp", actor, false); var leveluporder = new Order("DevLevelUp", actor, false);

View File

@@ -40,7 +40,7 @@ namespace OpenRA.Mods.Common.Effects
public IEnumerable<IRenderable> Render(WorldRenderer wr) public IEnumerable<IRenderable> Render(WorldRenderer wr)
{ {
if (a.Destroyed || wr.World.FogObscures(a)) if (a.Disposed || wr.World.FogObscures(a))
return SpriteRenderable.None; return SpriteRenderable.None;
return anim.Render(a.CenterPosition, wr.Palette(canPowerDown.Info.IndicatorPalette)); return anim.Render(a.CenterPosition, wr.Palette(canPowerDown.Info.IndicatorPalette));

View File

@@ -45,7 +45,7 @@ namespace OpenRA.Mods.Common.Effects
public IEnumerable<IRenderable> Render(WorldRenderer wr) public IEnumerable<IRenderable> Render(WorldRenderer wr)
{ {
if (building.Destroyed || wr.World.FogObscures(building) || rb.Repairers.Count == 0) if (building.Disposed || wr.World.FogObscures(building) || rb.Repairers.Count == 0)
return SpriteRenderable.None; return SpriteRenderable.None;
PaletteReference palette; PaletteReference palette;

View File

@@ -112,7 +112,7 @@ namespace OpenRA.Mods.Common.Scripting
if (!sma.Actors.TryGetValue(actorName, out ret)) if (!sma.Actors.TryGetValue(actorName, out ret))
return null; return null;
if (ret.Destroyed) if (ret.Disposed)
return null; return null;
return ret; return ret;

View File

@@ -75,10 +75,10 @@ namespace OpenRA.Mods.Common.Traits
return; return;
var attacker = e.Attacker; var attacker = e.Attacker;
if (attacker.Destroyed || Stance < UnitStance.ReturnFire) if (attacker.Disposed || Stance < UnitStance.ReturnFire)
return; return;
if (!attacker.IsInWorld && !attacker.Destroyed) if (!attacker.IsInWorld && !attacker.Disposed)
{ {
// If the aggressor is in a transport, then attack the transport instead // If the aggressor is in a transport, then attack the transport instead
var passenger = attacker.TraitOrDefault<Passenger>(); var passenger = attacker.TraitOrDefault<Passenger>();

View File

@@ -65,7 +65,7 @@ namespace OpenRA.Mods.Common.Traits
var crateActions = self.TraitsImplementing<CrateAction>(); var crateActions = self.TraitsImplementing<CrateAction>();
self.Destroy(); self.Dispose();
collected = true; collected = true;
if (crateActions.Any()) if (crateActions.Any())
@@ -112,13 +112,13 @@ namespace OpenRA.Mods.Common.Traits
if (collector != null) if (collector != null)
OnCrush(collector); OnCrush(collector);
else else
self.Destroy(); self.Dispose();
} }
public void Tick(Actor self) public void Tick(Actor self)
{ {
if (info.Lifetime != 0 && ++ticks >= info.Lifetime * 25) if (info.Lifetime != 0 && ++ticks >= info.Lifetime * 25)
self.Destroy(); self.Dispose();
} }
public CPos TopLeft { get { return Location; } } public CPos TopLeft { get { return Location; } }

View File

@@ -78,7 +78,7 @@ namespace OpenRA.Mods.Common.Traits
} }
} }
else else
pilot.Destroy(); pilot.Dispose();
} }
static bool IsSuitableCell(Actor self, Actor actorToDrop) static bool IsSuitableCell(Actor self, Actor actorToDrop)

View File

@@ -44,7 +44,7 @@ namespace OpenRA.Mods.Common.Traits
{ {
var info = self.Info.Traits.Get<GivesBountyInfo>(); var info = self.Info.Traits.Get<GivesBountyInfo>();
if (e.Attacker == null || e.Attacker.Destroyed) return; if (e.Attacker == null || e.Attacker.Disposed) return;
if (!info.Stances.Contains(e.Attacker.Owner.Stances[self.Owner])) return; if (!info.Stances.Contains(e.Attacker.Owner.Stances[self.Owner])) return;

View File

@@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Traits
public void Killed(Actor self, AttackInfo e) public void Killed(Actor self, AttackInfo e)
{ {
// Prevent TK from giving exp // Prevent TK from giving exp
if (e.Attacker == null || e.Attacker.Destroyed || (!info.FriendlyFire && e.Attacker.Owner.Stances[self.Owner] == Stance.Ally)) if (e.Attacker == null || e.Attacker.Disposed || (!info.FriendlyFire && e.Attacker.Owner.Stances[self.Owner] == Stance.Ally))
return; return;
var valued = self.Info.Traits.GetOrDefault<ValuedInfo>(); var valued = self.Info.Traits.GetOrDefault<ValuedInfo>();

View File

@@ -67,7 +67,7 @@ namespace OpenRA.Mods.Common.Traits
public void SetProcLines(Actor proc) public void SetProcLines(Actor proc)
{ {
if (proc == null) return; if (proc == null) return;
if (proc.Destroyed) return; if (proc.Disposed) return;
var linkedHarvs = proc.World.ActorsWithTrait<Harvester>() var linkedHarvs = proc.World.ActorsWithTrait<Harvester>()
.Where(a => a.Trait.LinkedProc == proc) .Where(a => a.Trait.LinkedProc == proc)
@@ -156,7 +156,7 @@ namespace OpenRA.Mods.Common.Traits
{ {
// Check that we're not in a critical location and being useless (refinery drop-off): // Check that we're not in a critical location and being useless (refinery drop-off):
var lastproc = LastLinkedProc ?? LinkedProc; var lastproc = LastLinkedProc ?? LinkedProc;
if (lastproc != null && !lastproc.Destroyed) if (lastproc != null && !lastproc.Disposed)
{ {
var deliveryLoc = lastproc.Location + lastproc.Trait<IAcceptResources>().DeliveryOffset; var deliveryLoc = lastproc.Location + lastproc.Trait<IAcceptResources>().DeliveryOffset;
if (self.Location == deliveryLoc) if (self.Location == deliveryLoc)

View File

@@ -37,7 +37,7 @@ namespace OpenRA.Mods.Common.Traits
return; return;
if (Info.RemoveInstead || !self.HasTrait<Health>()) if (Info.RemoveInstead || !self.HasTrait<Health>())
self.Destroy(); self.Dispose();
else else
self.Kill(self); self.Kill(self);
} }

View File

@@ -61,7 +61,7 @@ namespace OpenRA.Mods.Common.Traits
public void Tick(Actor self) public void Tick(Actor self)
{ {
if (self.Destroyed) if (self.Disposed)
return; return;
VisibilityHash = 0; VisibilityHash = 0;

View File

@@ -86,7 +86,7 @@ namespace OpenRA.Mods.Common.Traits
{ {
self.World.AddFrameEndTask(w => self.World.AddFrameEndTask(w =>
{ {
if (self.Destroyed || captor.Destroyed) return; if (self.Disposed || captor.Disposed) return;
var previousOwner = self.Owner; var previousOwner = self.Owner;
@@ -112,7 +112,7 @@ namespace OpenRA.Mods.Common.Traits
IEnumerable<Actor> UnitsInRange() IEnumerable<Actor> UnitsInRange()
{ {
return Self.World.FindActorsInCircle(Self.CenterPosition, WRange.FromCells(Info.Range)) return Self.World.FindActorsInCircle(Self.CenterPosition, WRange.FromCells(Info.Range))
.Where(a => a.IsInWorld && a != Self && !a.Destroyed && !a.Owner.NonCombatant); .Where(a => a.IsInWorld && a != Self && !a.Disposed && !a.Owner.NonCombatant);
} }
bool IsClear(Actor self, Player currentOwner, Player originalOwner) bool IsClear(Actor self, Player currentOwner, Player originalOwner)

View File

@@ -97,7 +97,7 @@ namespace OpenRA.Mods.Common.Traits
{ {
self.World.AddFrameEndTask(w => self.World.AddFrameEndTask(w =>
{ {
if (!self.Destroyed) if (!self.Disposed)
w.Add(new Corpse(w, self.CenterPosition, rs.GetImage(self), sequence, palette)); w.Add(new Corpse(w, self.CenterPosition, rs.GetImage(self), sequence, palette));
}); });
} }

View File

@@ -87,7 +87,7 @@ namespace OpenRA.Mods.Common.Traits
void ActorEntered(Actor a) void ActorEntered(Actor a)
{ {
if (a.Destroyed) if (a.Disposed)
return; return;
if (a == self && !info.AffectsParent) if (a == self && !info.AffectsParent)
@@ -122,7 +122,7 @@ namespace OpenRA.Mods.Common.Traits
void ActorExited(Actor a) void ActorExited(Actor a)
{ {
if (a == self || a.Destroyed) if (a == self || a.Disposed)
return; return;
var stance = self.Owner.Stances[a.Owner]; var stance = self.Owner.Stances[a.Owner];

View File

@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Traits
{ {
if (claimByActor.Remove(claim.Claimer) & claimByCell.Remove(claim.Cell)) if (claimByActor.Remove(claim.Claimer) & claimByCell.Remove(claim.Cell))
{ {
if (claim.Claimer.Destroyed) return; if (claim.Claimer.Disposed) return;
if (!claim.Claimer.IsInWorld) return; if (!claim.Claimer.IsInWorld) return;
if (claim.Claimer.IsDead) return; if (claim.Claimer.IsDead) return;

View File

@@ -106,7 +106,7 @@ namespace OpenRA.Mods.Common.Widgets
void PerformKeyboardOrderOnSelection(Func<Actor, Order> f) void PerformKeyboardOrderOnSelection(Func<Actor, Order> f)
{ {
var orders = world.Selection.Actors var orders = world.Selection.Actors
.Where(a => a.Owner == world.LocalPlayer && !a.Destroyed) .Where(a => a.Owner == world.LocalPlayer && !a.Disposed)
.Select(f) .Select(f)
.ToArray(); .ToArray();
@@ -142,7 +142,7 @@ namespace OpenRA.Mods.Common.Widgets
bool PerformStanceCycle() bool PerformStanceCycle()
{ {
var actor = world.Selection.Actors var actor = world.Selection.Actors
.Where(a => a.Owner == world.LocalPlayer && !a.Destroyed) .Where(a => a.Owner == world.LocalPlayer && !a.Disposed)
.Select(a => Pair.New(a, a.TraitOrDefault<AutoTarget>())) .Select(a => Pair.New(a, a.TraitOrDefault<AutoTarget>()))
.FirstOrDefault(a => a.Second != null); .FirstOrDefault(a => a.Second != null);
@@ -176,7 +176,7 @@ namespace OpenRA.Mods.Common.Widgets
bool PerformGuard() bool PerformGuard()
{ {
var actors = world.Selection.Actors var actors = world.Selection.Actors
.Where(a => !a.Destroyed && a.Owner == world.LocalPlayer && a.HasTrait<Guard>()); .Where(a => !a.Disposed && a.Owner == world.LocalPlayer && a.HasTrait<Guard>());
if (actors.Any()) if (actors.Any())
world.OrderGenerator = new GuardOrderGenerator(actors); world.OrderGenerator = new GuardOrderGenerator(actors);

View File

@@ -76,7 +76,7 @@ namespace OpenRA.Mods.D2k.Activities
actor.World.AddFrameEndTask(_ => actor.World.AddFrameEndTask(_ =>
{ {
actor1.Destroy(); actor1.Dispose();
// Harvester insurance // Harvester insurance
if (!actor1.HasTrait<Harvester>()) if (!actor1.HasTrait<Harvester>())

View File

@@ -39,7 +39,7 @@ namespace OpenRA.Mods.RA.Activities
foreach (var t in target.TraitsImplementing<INotifyInfiltrated>()) foreach (var t in target.TraitsImplementing<INotifyInfiltrated>())
t.Infiltrated(target, self); t.Infiltrated(target, self);
self.Destroy(); self.Dispose();
if (target.HasTrait<Building>()) if (target.HasTrait<Building>())
Sound.PlayToPlayer(self.Owner, "bldginf1.aud"); Sound.PlayToPlayer(self.Owner, "bldginf1.aud");

View File

@@ -90,7 +90,7 @@ namespace OpenRA.Mods.RA.Activities
foreach (var a in self.World.ActorsWithTrait<ChronoshiftPaletteEffect>()) foreach (var a in self.World.ActorsWithTrait<ChronoshiftPaletteEffect>())
a.Trait.Enable(); a.Trait.Enable();
if (teleporter != null && self != teleporter && !teleporter.Destroyed) if (teleporter != null && self != teleporter && !teleporter.Disposed)
{ {
var building = teleporter.TraitOrDefault<RenderBuilding>(); var building = teleporter.TraitOrDefault<RenderBuilding>();
if (building != null) if (building != null)

View File

@@ -89,7 +89,7 @@ namespace OpenRA.Mods.RA.Effects
public void Tick(World world) public void Tick(World world)
{ {
if (self.Destroyed) if (self.Disposed)
world.AddFrameEndTask(w => w.Remove(this)); world.AddFrameEndTask(w => w.Remove(this));
show = false; show = false;
@@ -102,7 +102,7 @@ namespace OpenRA.Mods.RA.Effects
public IEnumerable<IRenderable> Render(WorldRenderer wr) public IEnumerable<IRenderable> Render(WorldRenderer wr)
{ {
if (!show || self.Destroyed) if (!show || self.Disposed)
return SpriteRenderable.None; return SpriteRenderable.None;
var palette = wr.Palette(info.IndicatorPalettePrefix + self.Owner.InternalName); var palette = wr.Palette(info.IndicatorPalettePrefix + self.Owner.InternalName);

View File

@@ -73,7 +73,7 @@ namespace OpenRA.Mods.RA.Traits
self.World.AddFrameEndTask(w => self.World.AddFrameEndTask(w =>
{ {
// damage is inflicted by the chronosphere // damage is inflicted by the chronosphere
if (!self.Destroyed) if (!self.Disposed)
self.InflictDamage(chronosphere, int.MaxValue, null); self.InflictDamage(chronosphere, int.MaxValue, null);
}); });
return true; return true;