diff --git a/OpenRA.Game/Actor.cs b/OpenRA.Game/Actor.cs index 4d8247ae43..308caa85b0 100644 --- a/OpenRA.Game/Actor.cs +++ b/OpenRA.Game/Actor.cs @@ -33,7 +33,7 @@ namespace OpenRA [Sync] public Player Owner { get; set; } public bool IsInWorld { get; internal set; } - public bool Destroyed { get; private set; } + public bool Disposed { get; private set; } Activity currentActivity; @@ -51,7 +51,7 @@ namespace OpenRA public IEffectiveOwner EffectiveOwner { get { return effectiveOwner.Value; } } 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 WPos CenterPosition { get { return occupySpace.Value.CenterPosition; } } @@ -215,18 +215,18 @@ namespace OpenRA World.TraitDict.AddTrait(this, trait); } - public void Destroy() + public void Dispose() { World.AddFrameEndTask(w => { - if (Destroyed) + if (Disposed) return; if (IsInWorld) World.Remove(this); World.TraitDict.RemoveActor(this); - Destroyed = true; + Disposed = true; if (luaInterface != null) luaInterface.Value.OnActorDestroyed(); @@ -238,7 +238,7 @@ namespace OpenRA { World.AddFrameEndTask(w => { - if (Destroyed) + if (Disposed) return; var oldOwner = Owner; diff --git a/OpenRA.Game/Graphics/WorldRenderer.cs b/OpenRA.Game/Graphics/WorldRenderer.cs index 9f81ade452..0d3c496404 100644 --- a/OpenRA.Game/Graphics/WorldRenderer.cs +++ b/OpenRA.Game/Graphics/WorldRenderer.cs @@ -140,7 +140,7 @@ namespace OpenRA.Graphics // added for contrails foreach (var a in World.ActorsWithTrait()) - if (a.Actor.IsInWorld && !a.Actor.Destroyed) + if (a.Actor.IsInWorld && !a.Actor.Disposed) a.Trait.RenderAfterWorld(this, a.Actor); var renderShroud = World.RenderPlayer != null ? World.RenderPlayer.Shroud : null; @@ -154,7 +154,7 @@ namespace OpenRA.Graphics 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()) .SelectMany(t => t.RenderAfterWorld(this)); @@ -174,7 +174,7 @@ namespace OpenRA.Graphics 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() && !World.FogObscures(a) && !World.Selection.Actors.Contains(a))) diff --git a/OpenRA.Game/Orders/UnitOrderGenerator.cs b/OpenRA.Game/Orders/UnitOrderGenerator.cs index 6095444fec..bcd2af174c 100644 --- a/OpenRA.Game/Orders/UnitOrderGenerator.cs +++ b/OpenRA.Game/Orders/UnitOrderGenerator.cs @@ -107,7 +107,7 @@ namespace OpenRA.Orders if (self.Owner != self.World.LocalPlayer) return null; - if (self.Destroyed || !target.IsValidFor(self)) + if (self.Disposed || !target.IsValidFor(self)) return null; if (mi.Button == Game.Settings.Game.MouseButtonPreference.Action) diff --git a/OpenRA.Game/Scripting/ScriptActorInterface.cs b/OpenRA.Game/Scripting/ScriptActorInterface.cs index a06ee6b891..fac44ea7a4 100644 --- a/OpenRA.Game/Scripting/ScriptActorInterface.cs +++ b/OpenRA.Game/Scripting/ScriptActorInterface.cs @@ -41,7 +41,7 @@ namespace OpenRA.Scripting var commandClasses = Context.ActorCommands[actor.Info].AsEnumerable(); // Destroyed actors cannot have their traits queried - if (actor.Destroyed) + if (actor.Disposed) commandClasses = commandClasses.Where(c => c.HasAttribute()); var args = new object[] { Context, actor }; diff --git a/OpenRA.Game/Selection.cs b/OpenRA.Game/Selection.cs index 2700aee20a..a3aefed01a 100644 --- a/OpenRA.Game/Selection.cs +++ b/OpenRA.Game/Selection.cs @@ -78,7 +78,7 @@ namespace OpenRA foreach (var cg in controlGroups.Values) { // 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); } } diff --git a/OpenRA.Game/TraitDictionary.cs b/OpenRA.Game/TraitDictionary.cs index 2d7e546c13..62210f4a59 100755 --- a/OpenRA.Game/TraitDictionary.cs +++ b/OpenRA.Game/TraitDictionary.cs @@ -80,7 +80,7 @@ namespace OpenRA static void CheckDestroyed(Actor actor) { - if (actor.Destroyed) + if (actor.Disposed) throw new InvalidOperationException("Attempted to get trait from destroyed object ({0})".F(actor)); } diff --git a/OpenRA.Game/Traits/DrawLineToTarget.cs b/OpenRA.Game/Traits/DrawLineToTarget.cs index 4cfe8b4b13..e0923acede 100644 --- a/OpenRA.Game/Traits/DrawLineToTarget.cs +++ b/OpenRA.Game/Traits/DrawLineToTarget.cs @@ -104,7 +104,7 @@ namespace OpenRA.Traits self.World.AddFrameEndTask(w => { - if (self.Destroyed) + if (self.Disposed) return; var line = self.TraitOrDefault(); @@ -120,7 +120,7 @@ namespace OpenRA.Traits self.World.AddFrameEndTask(w => { - if (self.Destroyed) + if (self.Disposed) return; target.Flash(); diff --git a/OpenRA.Game/Traits/Health.cs b/OpenRA.Game/Traits/Health.cs index e7f268bc84..d2468eb20c 100755 --- a/OpenRA.Game/Traits/Health.cs +++ b/OpenRA.Game/Traits/Health.cs @@ -155,7 +155,7 @@ namespace OpenRA.Traits nd.Killed(self, ai); 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); } @@ -195,7 +195,7 @@ namespace OpenRA.Traits { public static DamageState GetDamageState(this Actor self) { - if (self.Destroyed) + if (self.Disposed) return DamageState.Dead; var health = self.TraitOrDefault(); @@ -204,7 +204,7 @@ namespace OpenRA.Traits 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(); if (health == null) return; health.InflictDamage(self, attacker, damage, warhead, false); diff --git a/OpenRA.Game/Traits/Player/FrozenActorLayer.cs b/OpenRA.Game/Traits/Player/FrozenActorLayer.cs index bf0a331fe8..20bbc54487 100644 --- a/OpenRA.Game/Traits/Player/FrozenActorLayer.cs +++ b/OpenRA.Game/Traits/Player/FrozenActorLayer.cs @@ -100,7 +100,7 @@ namespace OpenRA.Traits if (NeedRenderables) { NeedRenderables = false; - if (!actor.Destroyed) + if (!actor.Disposed) { IsRendering = true; renderables = actor.Render(wr).ToArray(); diff --git a/OpenRA.Game/Traits/World/ActorMap.cs b/OpenRA.Game/Traits/World/ActorMap.cs index 0572725cc5..9e3e79cb4b 100644 --- a/OpenRA.Game/Traits/World/ActorMap.cs +++ b/OpenRA.Game/Traits/World/ActorMap.cs @@ -198,7 +198,7 @@ namespace OpenRA.Traits yield break; for (var i = influence[a]; i != null; i = i.Next) - if (!i.Actor.Destroyed) + if (!i.Actor.Disposed) yield return i.Actor; } @@ -208,7 +208,7 @@ namespace OpenRA.Traits yield break; 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; } @@ -285,7 +285,7 @@ namespace OpenRA.Traits var always = sub == SubCell.FullCell || sub == SubCell.Any; 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 false; diff --git a/OpenRA.Game/VoiceExts.cs b/OpenRA.Game/VoiceExts.cs index c63d7a4d69..e0bbe3c69d 100644 --- a/OpenRA.Game/VoiceExts.cs +++ b/OpenRA.Game/VoiceExts.cs @@ -59,7 +59,7 @@ namespace OpenRA continue; var orderSubject = o.Subject; - if (orderSubject.Destroyed) + if (orderSubject.Disposed) continue; foreach (var voice in orderSubject.TraitsImplementing()) diff --git a/OpenRA.Mods.Common/AI/HackyAI.cs b/OpenRA.Mods.Common/AI/HackyAI.cs index 1de4747a55..cd7066dc0c 100644 --- a/OpenRA.Mods.Common/AI/HackyAI.cs +++ b/OpenRA.Mods.Common/AI/HackyAI.cs @@ -382,7 +382,7 @@ namespace OpenRA.Mods.Common.AI case BuildingType.Defense: // Build near the closest enemy structure - var closestEnemy = World.Actors.Where(a => !a.Destroyed && a.HasTrait() && Player.Stances[a.Owner] == Stance.Enemy) + var closestEnemy = World.Actors.Where(a => !a.Disposed && a.HasTrait() && Player.Stances[a.Owner] == Stance.Enemy) .ClosestTo(World.Map.CenterOfCell(defenseCenter)); 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; if (!e.Attacker.HasTrait()) diff --git a/OpenRA.Mods.Common/AI/States/GroundStates.cs b/OpenRA.Mods.Common/AI/States/GroundStates.cs index 3837cc59e6..853a911da4 100644 --- a/OpenRA.Mods.Common/AI/States/GroundStates.cs +++ b/OpenRA.Mods.Common/AI/States/GroundStates.cs @@ -94,7 +94,7 @@ namespace OpenRA.Mods.Common.AI else { 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() && leader.Owner.Stances[a1.Owner] == Stance.Enemy); var target = enemynearby.ClosestTo(leader.CenterPosition); if (target != null) diff --git a/OpenRA.Mods.Common/Activities/Air/FallToEarth.cs b/OpenRA.Mods.Common/Activities/Air/FallToEarth.cs index ee9c2274b3..b5d0811458 100644 --- a/OpenRA.Mods.Common/Activities/Air/FallToEarth.cs +++ b/OpenRA.Mods.Common/Activities/Air/FallToEarth.cs @@ -43,7 +43,7 @@ namespace OpenRA.Mods.Common.Activities weapon.Impact(Target.FromPos(self.CenterPosition), self, Enumerable.Empty()); } - self.Destroy(); + self.Dispose(); return null; } diff --git a/OpenRA.Mods.Common/Activities/CaptureActor.cs b/OpenRA.Mods.Common/Activities/CaptureActor.cs index a8bec859a4..970cc707ae 100644 --- a/OpenRA.Mods.Common/Activities/CaptureActor.cs +++ b/OpenRA.Mods.Common/Activities/CaptureActor.cs @@ -71,7 +71,7 @@ namespace OpenRA.Mods.Common.Activities actor.InflictDamage(self, damage, null); } - self.Destroy(); + self.Dispose(); }); } } diff --git a/OpenRA.Mods.Common/Activities/DonateSupplies.cs b/OpenRA.Mods.Common/Activities/DonateSupplies.cs index 6231480d53..c6cd5c4c16 100644 --- a/OpenRA.Mods.Common/Activities/DonateSupplies.cs +++ b/OpenRA.Mods.Common/Activities/DonateSupplies.cs @@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Activities return; target.Owner.PlayerActor.Trait().GiveCash(payload); - self.Destroy(); + self.Dispose(); 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))); diff --git a/OpenRA.Mods.Common/Activities/ExternalCaptureActor.cs b/OpenRA.Mods.Common/Activities/ExternalCaptureActor.cs index ae290c3d96..059f53fb5d 100644 --- a/OpenRA.Mods.Common/Activities/ExternalCaptureActor.cs +++ b/OpenRA.Mods.Common/Activities/ExternalCaptureActor.cs @@ -77,7 +77,7 @@ namespace OpenRA.Mods.Common.Activities capturable.EndCapture(); if (capturesInfo != null && capturesInfo.ConsumeActor) - self.Destroy(); + self.Dispose(); }); } } diff --git a/OpenRA.Mods.Common/Activities/RemoveSelf.cs b/OpenRA.Mods.Common/Activities/RemoveSelf.cs index 37a2eb3003..bdd3fedf64 100644 --- a/OpenRA.Mods.Common/Activities/RemoveSelf.cs +++ b/OpenRA.Mods.Common/Activities/RemoveSelf.cs @@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.Activities public override Activity Tick(Actor self) { if (IsCanceled) return NextActivity; - self.Destroy(); + self.Dispose(); return null; } } diff --git a/OpenRA.Mods.Common/Activities/RepairBridge.cs b/OpenRA.Mods.Common/Activities/RepairBridge.cs index f2be9db852..1b02b81644 100644 --- a/OpenRA.Mods.Common/Activities/RepairBridge.cs +++ b/OpenRA.Mods.Common/Activities/RepairBridge.cs @@ -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) return; hut.Repair(self); - self.Destroy(); + self.Dispose(); } } } diff --git a/OpenRA.Mods.Common/Activities/RepairBuilding.cs b/OpenRA.Mods.Common/Activities/RepairBuilding.cs index a57ee7b476..8117127678 100644 --- a/OpenRA.Mods.Common/Activities/RepairBuilding.cs +++ b/OpenRA.Mods.Common/Activities/RepairBuilding.cs @@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.Activities if (health.DamageState == DamageState.Undamaged) return; target.InflictDamage(self, -health.MaxHP, null); - self.Destroy(); + self.Dispose(); } } } diff --git a/OpenRA.Mods.Common/Activities/Sell.cs b/OpenRA.Mods.Common/Activities/Sell.cs index edfafa3a72..7397b0f7e2 100644 --- a/OpenRA.Mods.Common/Activities/Sell.cs +++ b/OpenRA.Mods.Common/Activities/Sell.cs @@ -41,7 +41,7 @@ namespace OpenRA.Mods.Common.Activities 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.Destroy(); + self.Dispose(); return this; } diff --git a/OpenRA.Mods.Common/Activities/Transform.cs b/OpenRA.Mods.Common/Activities/Transform.cs index c4cb2c8e34..2a673d98ab 100644 --- a/OpenRA.Mods.Common/Activities/Transform.cs +++ b/OpenRA.Mods.Common/Activities/Transform.cs @@ -48,7 +48,7 @@ namespace OpenRA.Mods.Common.Activities var selected = w.Selection.Contains(self); var controlgroup = w.Selection.GetControlGroupForActor(self); - self.Destroy(); + self.Dispose(); foreach (var s in Sounds) Sound.PlayToPlayer(self.Owner, s, self.CenterPosition); diff --git a/OpenRA.Mods.Common/Activities/UnloadCargo.cs b/OpenRA.Mods.Common/Activities/UnloadCargo.cs index 54a348d148..a7807c832f 100644 --- a/OpenRA.Mods.Common/Activities/UnloadCargo.cs +++ b/OpenRA.Mods.Common/Activities/UnloadCargo.cs @@ -76,7 +76,7 @@ namespace OpenRA.Mods.Common.Activities cargo.Unload(self); self.World.AddFrameEndTask(w => { - if (actor.Destroyed) + if (actor.Disposed) return; var move = actor.Trait(); diff --git a/OpenRA.Mods.Common/Commands/DevCommands.cs b/OpenRA.Mods.Common/Commands/DevCommands.cs index 70ab0dc94d..cec6255daf 100644 --- a/OpenRA.Mods.Common/Commands/DevCommands.cs +++ b/OpenRA.Mods.Common/Commands/DevCommands.cs @@ -106,7 +106,7 @@ namespace OpenRA.Mods.Common.Commands foreach (var actor in world.Selection.Actors) { - if (actor.IsDead || actor.Destroyed) + if (actor.IsDead || actor.Disposed) continue; var leveluporder = new Order("DevLevelUp", actor, false); diff --git a/OpenRA.Mods.Common/Effects/PowerdownIndicator.cs b/OpenRA.Mods.Common/Effects/PowerdownIndicator.cs index 735c9aa3c2..ce51d48595 100644 --- a/OpenRA.Mods.Common/Effects/PowerdownIndicator.cs +++ b/OpenRA.Mods.Common/Effects/PowerdownIndicator.cs @@ -40,7 +40,7 @@ namespace OpenRA.Mods.Common.Effects public IEnumerable Render(WorldRenderer wr) { - if (a.Destroyed || wr.World.FogObscures(a)) + if (a.Disposed || wr.World.FogObscures(a)) return SpriteRenderable.None; return anim.Render(a.CenterPosition, wr.Palette(canPowerDown.Info.IndicatorPalette)); diff --git a/OpenRA.Mods.Common/Effects/RepairIndicator.cs b/OpenRA.Mods.Common/Effects/RepairIndicator.cs index 8ec8092ac5..dd48c81ba3 100644 --- a/OpenRA.Mods.Common/Effects/RepairIndicator.cs +++ b/OpenRA.Mods.Common/Effects/RepairIndicator.cs @@ -45,7 +45,7 @@ namespace OpenRA.Mods.Common.Effects public IEnumerable 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; PaletteReference palette; diff --git a/OpenRA.Mods.Common/Scripting/Global/MapGlobal.cs b/OpenRA.Mods.Common/Scripting/Global/MapGlobal.cs index 8082aeb25d..8fc7794f37 100644 --- a/OpenRA.Mods.Common/Scripting/Global/MapGlobal.cs +++ b/OpenRA.Mods.Common/Scripting/Global/MapGlobal.cs @@ -112,7 +112,7 @@ namespace OpenRA.Mods.Common.Scripting if (!sma.Actors.TryGetValue(actorName, out ret)) return null; - if (ret.Destroyed) + if (ret.Disposed) return null; return ret; diff --git a/OpenRA.Mods.Common/Traits/AutoTarget.cs b/OpenRA.Mods.Common/Traits/AutoTarget.cs index e7d90754d8..ba962231fa 100644 --- a/OpenRA.Mods.Common/Traits/AutoTarget.cs +++ b/OpenRA.Mods.Common/Traits/AutoTarget.cs @@ -75,10 +75,10 @@ namespace OpenRA.Mods.Common.Traits return; var attacker = e.Attacker; - if (attacker.Destroyed || Stance < UnitStance.ReturnFire) + if (attacker.Disposed || Stance < UnitStance.ReturnFire) return; - if (!attacker.IsInWorld && !attacker.Destroyed) + if (!attacker.IsInWorld && !attacker.Disposed) { // If the aggressor is in a transport, then attack the transport instead var passenger = attacker.TraitOrDefault(); diff --git a/OpenRA.Mods.Common/Traits/Crates/Crate.cs b/OpenRA.Mods.Common/Traits/Crates/Crate.cs index aef7c0ff83..cdf0bea797 100644 --- a/OpenRA.Mods.Common/Traits/Crates/Crate.cs +++ b/OpenRA.Mods.Common/Traits/Crates/Crate.cs @@ -65,7 +65,7 @@ namespace OpenRA.Mods.Common.Traits var crateActions = self.TraitsImplementing(); - self.Destroy(); + self.Dispose(); collected = true; if (crateActions.Any()) @@ -112,13 +112,13 @@ namespace OpenRA.Mods.Common.Traits if (collector != null) OnCrush(collector); else - self.Destroy(); + self.Dispose(); } public void Tick(Actor self) { if (info.Lifetime != 0 && ++ticks >= info.Lifetime * 25) - self.Destroy(); + self.Dispose(); } public CPos TopLeft { get { return Location; } } diff --git a/OpenRA.Mods.Common/Traits/EjectOnDeath.cs b/OpenRA.Mods.Common/Traits/EjectOnDeath.cs index 78500bf61b..9d756a732a 100644 --- a/OpenRA.Mods.Common/Traits/EjectOnDeath.cs +++ b/OpenRA.Mods.Common/Traits/EjectOnDeath.cs @@ -78,7 +78,7 @@ namespace OpenRA.Mods.Common.Traits } } else - pilot.Destroy(); + pilot.Dispose(); } static bool IsSuitableCell(Actor self, Actor actorToDrop) diff --git a/OpenRA.Mods.Common/Traits/GivesBounty.cs b/OpenRA.Mods.Common/Traits/GivesBounty.cs index 40f3332e7e..efce9fb063 100644 --- a/OpenRA.Mods.Common/Traits/GivesBounty.cs +++ b/OpenRA.Mods.Common/Traits/GivesBounty.cs @@ -44,7 +44,7 @@ namespace OpenRA.Mods.Common.Traits { var info = self.Info.Traits.Get(); - 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; diff --git a/OpenRA.Mods.Common/Traits/GivesExperience.cs b/OpenRA.Mods.Common/Traits/GivesExperience.cs index 1a811e4325..5d77d45655 100644 --- a/OpenRA.Mods.Common/Traits/GivesExperience.cs +++ b/OpenRA.Mods.Common/Traits/GivesExperience.cs @@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Traits public void Killed(Actor self, AttackInfo e) { // 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; var valued = self.Info.Traits.GetOrDefault(); diff --git a/OpenRA.Mods.Common/Traits/Harvester.cs b/OpenRA.Mods.Common/Traits/Harvester.cs index bfccd4ba7c..a923ddce0c 100644 --- a/OpenRA.Mods.Common/Traits/Harvester.cs +++ b/OpenRA.Mods.Common/Traits/Harvester.cs @@ -67,7 +67,7 @@ namespace OpenRA.Mods.Common.Traits public void SetProcLines(Actor proc) { if (proc == null) return; - if (proc.Destroyed) return; + if (proc.Disposed) return; var linkedHarvs = proc.World.ActorsWithTrait() .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): var lastproc = LastLinkedProc ?? LinkedProc; - if (lastproc != null && !lastproc.Destroyed) + if (lastproc != null && !lastproc.Disposed) { var deliveryLoc = lastproc.Location + lastproc.Trait().DeliveryOffset; if (self.Location == deliveryLoc) diff --git a/OpenRA.Mods.Common/Traits/KillsSelf.cs b/OpenRA.Mods.Common/Traits/KillsSelf.cs index 5bbae6ad2e..3b5e6b6b6a 100644 --- a/OpenRA.Mods.Common/Traits/KillsSelf.cs +++ b/OpenRA.Mods.Common/Traits/KillsSelf.cs @@ -37,7 +37,7 @@ namespace OpenRA.Mods.Common.Traits return; if (Info.RemoveInstead || !self.HasTrait()) - self.Destroy(); + self.Dispose(); else self.Kill(self); } diff --git a/OpenRA.Mods.Common/Traits/Modifiers/FrozenUnderFog.cs b/OpenRA.Mods.Common/Traits/Modifiers/FrozenUnderFog.cs index 15d26c3bb4..64fedb9817 100644 --- a/OpenRA.Mods.Common/Traits/Modifiers/FrozenUnderFog.cs +++ b/OpenRA.Mods.Common/Traits/Modifiers/FrozenUnderFog.cs @@ -61,7 +61,7 @@ namespace OpenRA.Mods.Common.Traits public void Tick(Actor self) { - if (self.Destroyed) + if (self.Disposed) return; VisibilityHash = 0; diff --git a/OpenRA.Mods.Common/Traits/ProximityCapturable.cs b/OpenRA.Mods.Common/Traits/ProximityCapturable.cs index e0bab8a55a..aeb82f5927 100644 --- a/OpenRA.Mods.Common/Traits/ProximityCapturable.cs +++ b/OpenRA.Mods.Common/Traits/ProximityCapturable.cs @@ -86,7 +86,7 @@ namespace OpenRA.Mods.Common.Traits { self.World.AddFrameEndTask(w => { - if (self.Destroyed || captor.Destroyed) return; + if (self.Disposed || captor.Disposed) return; var previousOwner = self.Owner; @@ -112,7 +112,7 @@ namespace OpenRA.Mods.Common.Traits IEnumerable UnitsInRange() { 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) diff --git a/OpenRA.Mods.Common/Traits/Render/WithDeathAnimation.cs b/OpenRA.Mods.Common/Traits/Render/WithDeathAnimation.cs index 58d8142a10..2b5943620c 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithDeathAnimation.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithDeathAnimation.cs @@ -97,7 +97,7 @@ namespace OpenRA.Mods.Common.Traits { self.World.AddFrameEndTask(w => { - if (!self.Destroyed) + if (!self.Disposed) w.Add(new Corpse(w, self.CenterPosition, rs.GetImage(self), sequence, palette)); }); } diff --git a/OpenRA.Mods.Common/Traits/Upgrades/UpgradeActorsNear.cs b/OpenRA.Mods.Common/Traits/Upgrades/UpgradeActorsNear.cs index 7ff4abf0ff..fc4eed7ef3 100644 --- a/OpenRA.Mods.Common/Traits/Upgrades/UpgradeActorsNear.cs +++ b/OpenRA.Mods.Common/Traits/Upgrades/UpgradeActorsNear.cs @@ -87,7 +87,7 @@ namespace OpenRA.Mods.Common.Traits void ActorEntered(Actor a) { - if (a.Destroyed) + if (a.Disposed) return; if (a == self && !info.AffectsParent) @@ -122,7 +122,7 @@ namespace OpenRA.Mods.Common.Traits void ActorExited(Actor a) { - if (a == self || a.Destroyed) + if (a == self || a.Disposed) return; var stance = self.Owner.Stances[a.Owner]; diff --git a/OpenRA.Mods.Common/Traits/World/ResourceClaimLayer.cs b/OpenRA.Mods.Common/Traits/World/ResourceClaimLayer.cs index 654c90ccff..e846ee48bb 100644 --- a/OpenRA.Mods.Common/Traits/World/ResourceClaimLayer.cs +++ b/OpenRA.Mods.Common/Traits/World/ResourceClaimLayer.cs @@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Traits { 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.IsDead) return; diff --git a/OpenRA.Mods.Common/Widgets/WorldCommandWidget.cs b/OpenRA.Mods.Common/Widgets/WorldCommandWidget.cs index a854713dff..0f5486baaa 100644 --- a/OpenRA.Mods.Common/Widgets/WorldCommandWidget.cs +++ b/OpenRA.Mods.Common/Widgets/WorldCommandWidget.cs @@ -106,7 +106,7 @@ namespace OpenRA.Mods.Common.Widgets void PerformKeyboardOrderOnSelection(Func f) { var orders = world.Selection.Actors - .Where(a => a.Owner == world.LocalPlayer && !a.Destroyed) + .Where(a => a.Owner == world.LocalPlayer && !a.Disposed) .Select(f) .ToArray(); @@ -142,7 +142,7 @@ namespace OpenRA.Mods.Common.Widgets bool PerformStanceCycle() { 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())) .FirstOrDefault(a => a.Second != null); @@ -176,7 +176,7 @@ namespace OpenRA.Mods.Common.Widgets bool PerformGuard() { var actors = world.Selection.Actors - .Where(a => !a.Destroyed && a.Owner == world.LocalPlayer && a.HasTrait()); + .Where(a => !a.Disposed && a.Owner == world.LocalPlayer && a.HasTrait()); if (actors.Any()) world.OrderGenerator = new GuardOrderGenerator(actors); diff --git a/OpenRA.Mods.D2k/Activities/SwallowActor.cs b/OpenRA.Mods.D2k/Activities/SwallowActor.cs index 4f219adc3f..0701fff2e6 100644 --- a/OpenRA.Mods.D2k/Activities/SwallowActor.cs +++ b/OpenRA.Mods.D2k/Activities/SwallowActor.cs @@ -76,7 +76,7 @@ namespace OpenRA.Mods.D2k.Activities actor.World.AddFrameEndTask(_ => { - actor1.Destroy(); + actor1.Dispose(); // Harvester insurance if (!actor1.HasTrait()) diff --git a/OpenRA.Mods.RA/Activities/Infiltrate.cs b/OpenRA.Mods.RA/Activities/Infiltrate.cs index f3b8ed6047..325eff1903 100644 --- a/OpenRA.Mods.RA/Activities/Infiltrate.cs +++ b/OpenRA.Mods.RA/Activities/Infiltrate.cs @@ -39,7 +39,7 @@ namespace OpenRA.Mods.RA.Activities foreach (var t in target.TraitsImplementing()) t.Infiltrated(target, self); - self.Destroy(); + self.Dispose(); if (target.HasTrait()) Sound.PlayToPlayer(self.Owner, "bldginf1.aud"); diff --git a/OpenRA.Mods.RA/Activities/Teleport.cs b/OpenRA.Mods.RA/Activities/Teleport.cs index 980ca6654a..958b791013 100755 --- a/OpenRA.Mods.RA/Activities/Teleport.cs +++ b/OpenRA.Mods.RA/Activities/Teleport.cs @@ -90,7 +90,7 @@ namespace OpenRA.Mods.RA.Activities foreach (var a in self.World.ActorsWithTrait()) a.Trait.Enable(); - if (teleporter != null && self != teleporter && !teleporter.Destroyed) + if (teleporter != null && self != teleporter && !teleporter.Disposed) { var building = teleporter.TraitOrDefault(); if (building != null) diff --git a/OpenRA.Mods.RA/Effects/GpsDot.cs b/OpenRA.Mods.RA/Effects/GpsDot.cs index 6162708c28..ded339f9ef 100644 --- a/OpenRA.Mods.RA/Effects/GpsDot.cs +++ b/OpenRA.Mods.RA/Effects/GpsDot.cs @@ -89,7 +89,7 @@ namespace OpenRA.Mods.RA.Effects public void Tick(World world) { - if (self.Destroyed) + if (self.Disposed) world.AddFrameEndTask(w => w.Remove(this)); show = false; @@ -102,7 +102,7 @@ namespace OpenRA.Mods.RA.Effects public IEnumerable Render(WorldRenderer wr) { - if (!show || self.Destroyed) + if (!show || self.Disposed) return SpriteRenderable.None; var palette = wr.Palette(info.IndicatorPalettePrefix + self.Owner.InternalName); diff --git a/OpenRA.Mods.RA/Traits/Chronoshiftable.cs b/OpenRA.Mods.RA/Traits/Chronoshiftable.cs index b3322a6a5b..82b0ddc097 100644 --- a/OpenRA.Mods.RA/Traits/Chronoshiftable.cs +++ b/OpenRA.Mods.RA/Traits/Chronoshiftable.cs @@ -73,7 +73,7 @@ namespace OpenRA.Mods.RA.Traits self.World.AddFrameEndTask(w => { // damage is inflicted by the chronosphere - if (!self.Destroyed) + if (!self.Disposed) self.InflictDamage(chronosphere, int.MaxValue, null); }); return true;