Properly clean up traits that used to hook only death.
This commit is contained in:
@@ -54,7 +54,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public object Create(ActorInitializer init) { return new Cargo(init, this); }
|
||||
}
|
||||
|
||||
public class Cargo : IPips, IIssueOrder, IResolveOrder, IOrderVoice, INotifyCreated, INotifyKilled, INotifyOwnerChanged, INotifyAddedToWorld, ITick, INotifySold, IDisableMove
|
||||
public class Cargo : IPips, IIssueOrder, IResolveOrder, IOrderVoice, INotifyCreated, INotifyKilled,
|
||||
INotifyOwnerChanged, INotifyAddedToWorld, ITick, INotifySold, IDisableMove, INotifyActorDisposing
|
||||
{
|
||||
public readonly CargoInfo Info;
|
||||
readonly Actor self;
|
||||
@@ -305,6 +306,14 @@ namespace OpenRA.Mods.Common.Traits
|
||||
cargo.Clear();
|
||||
}
|
||||
|
||||
public void Disposing(Actor self)
|
||||
{
|
||||
foreach (var c in cargo)
|
||||
c.Dispose();
|
||||
|
||||
cargo.Clear();
|
||||
}
|
||||
|
||||
public void Selling(Actor self) { }
|
||||
public void Sold(Actor self)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user