Rename Actor.Destroy/Destroyed to Dispose/Disposed.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -140,7 +140,7 @@ namespace OpenRA.Graphics
|
||||
|
||||
// added for contrails
|
||||
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);
|
||||
|
||||
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<IPostRenderSelection>())
|
||||
.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<Selectable>()
|
||||
&& !World.FogObscures(a)
|
||||
&& !World.Selection.Actors.Contains(a)))
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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<ExposedForDestroyedActors>());
|
||||
|
||||
var args = new object[] { Context, actor };
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace OpenRA.Traits
|
||||
|
||||
self.World.AddFrameEndTask(w =>
|
||||
{
|
||||
if (self.Destroyed)
|
||||
if (self.Disposed)
|
||||
return;
|
||||
|
||||
var line = self.TraitOrDefault<DrawLineToTarget>();
|
||||
@@ -120,7 +120,7 @@ namespace OpenRA.Traits
|
||||
|
||||
self.World.AddFrameEndTask(w =>
|
||||
{
|
||||
if (self.Destroyed)
|
||||
if (self.Disposed)
|
||||
return;
|
||||
|
||||
target.Flash();
|
||||
|
||||
@@ -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<Health>();
|
||||
@@ -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<Health>();
|
||||
if (health == null) return;
|
||||
health.InflictDamage(self, attacker, damage, warhead, false);
|
||||
|
||||
@@ -100,7 +100,7 @@ namespace OpenRA.Traits
|
||||
if (NeedRenderables)
|
||||
{
|
||||
NeedRenderables = false;
|
||||
if (!actor.Destroyed)
|
||||
if (!actor.Disposed)
|
||||
{
|
||||
IsRendering = true;
|
||||
renderables = actor.Render(wr).ToArray();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace OpenRA
|
||||
continue;
|
||||
|
||||
var orderSubject = o.Subject;
|
||||
if (orderSubject.Destroyed)
|
||||
if (orderSubject.Disposed)
|
||||
continue;
|
||||
|
||||
foreach (var voice in orderSubject.TraitsImplementing<IVoiced>())
|
||||
|
||||
Reference in New Issue
Block a user