Fixes #7764, #7780 and other potential regressions introduced by #7671.

This commit is contained in:
reaperrr
2015-03-29 18:26:55 +02:00
parent 0b4ec5a815
commit 83b702343e
7 changed files with 13 additions and 18 deletions

View File

@@ -30,8 +30,6 @@ namespace OpenRA.Mods.Common.Traits
readonly Actor self;
readonly Lazy<Health> health;
readonly SellableInfo info;
readonly Building building;
readonly WithMakeAnimation makeAnimation;
public Sellable(Actor self, SellableInfo info)
: base(info)
@@ -39,8 +37,6 @@ namespace OpenRA.Mods.Common.Traits
this.self = self;
this.info = info;
health = Exts.Lazy(() => self.TraitOrDefault<Health>());
building = self.TraitOrDefault<Building>();
makeAnimation = self.TraitOrDefault<WithMakeAnimation>();
}
public void ResolveOrder(Actor self, Order order)
@@ -54,6 +50,7 @@ namespace OpenRA.Mods.Common.Traits
if (IsTraitDisabled)
return;
var building = self.TraitOrDefault<Building>();
if (building != null && !building.Lock())
return;
@@ -65,6 +62,7 @@ namespace OpenRA.Mods.Common.Traits
foreach (var ns in self.TraitsImplementing<INotifySold>())
ns.Selling(self);
var makeAnimation = self.TraitOrDefault<WithMakeAnimation>();
if (makeAnimation != null)
makeAnimation.Reverse(self, new Sell(self), false);
else