Properly clean up traits that used to hook only death.
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Activities;
|
||||
@@ -42,7 +43,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public virtual object Create(ActorInitializer init) { return new Refinery(init.Self, this); }
|
||||
}
|
||||
|
||||
public class Refinery : ITick, IAcceptResources, INotifyKilled, INotifySold, INotifyCapture, INotifyOwnerChanged, IExplodeModifier, ISync
|
||||
public class Refinery : ITick, IAcceptResources, INotifySold, INotifyCapture, INotifyOwnerChanged, IExplodeModifier, ISync, INotifyActorDisposing
|
||||
{
|
||||
readonly Actor self;
|
||||
readonly RefineryInfo info;
|
||||
@@ -118,7 +119,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
}
|
||||
|
||||
public void Killed(Actor self, AttackInfo e)
|
||||
public void Disposing(Actor self)
|
||||
{
|
||||
CancelDock(self);
|
||||
foreach (var harv in GetLinkedHarvesters())
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Reserve landing places for aircraft.")]
|
||||
class ReservableInfo : TraitInfo<Reservable> { }
|
||||
|
||||
public class Reservable : ITick, INotifyKilled, INotifyOwnerChanged, INotifySold
|
||||
public class Reservable : ITick, INotifyOwnerChanged, INotifySold, INotifyActorDisposing
|
||||
{
|
||||
Actor reservedFor;
|
||||
Aircraft reservedForAircraft;
|
||||
@@ -55,7 +55,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return res != null && res.reservedFor != null;
|
||||
}
|
||||
|
||||
public void Killed(Actor self, AttackInfo e)
|
||||
public void Disposing(Actor self)
|
||||
{
|
||||
if (reservedForAircraft != null)
|
||||
reservedForAircraft.UnReserve();
|
||||
|
||||
Reference in New Issue
Block a user