Remove the hardcoded cloak reference from activities

This commit is contained in:
abcdefg30
2017-07-13 23:45:48 +02:00
committed by reaperrr
parent 049ed086f9
commit 71f2026b32
6 changed files with 57 additions and 21 deletions

View File

@@ -23,14 +23,14 @@ namespace OpenRA.Mods.Common.Activities
{
readonly Actor self;
readonly Cargo cargo;
readonly Cloak[] cloaks;
readonly INotifyUnload[] notifiers;
readonly bool unloadAll;
public UnloadCargo(Actor self, bool unloadAll)
{
this.self = self;
cargo = self.Trait<Cargo>();
cloaks = self.TraitsImplementing<Cloak>().ToArray();
notifiers = self.TraitsImplementing<INotifyUnload>().ToArray();
this.unloadAll = unloadAll;
}
@@ -60,9 +60,8 @@ namespace OpenRA.Mods.Common.Activities
if (IsCanceled || cargo.IsEmpty(self))
return NextActivity;
foreach (var cloak in cloaks)
if (cloak.Info.UncloakOn.HasFlag(UncloakType.Unload))
cloak.Uncloak();
foreach (var inu in notifiers)
inu.Unloading(self);
var actor = cargo.Peek(self);
var spawn = self.CenterPosition;