Merge pull request #8226 from pchote/actor-disposal

Dispose traits when destroying an actor.
This commit is contained in:
Oliver Brakmann
2015-06-02 19:33:22 +02:00
54 changed files with 138 additions and 81 deletions

View File

@@ -155,7 +155,7 @@ namespace OpenRA.Traits
nd.Killed(self, ai);
if (RemoveOnDeath)
self.Destroy();
self.Dispose();
if (attacker == null)
Log.Write("debug", "{0} #{1} was killed.", self.Info.Name, self.ActorID);
@@ -198,7 +198,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>();
@@ -207,7 +207,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);