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

@@ -46,18 +46,14 @@ namespace OpenRA.Mods.Common.Traits
{
readonly Actor self;
readonly TransformsInfo info;
readonly Building building;
readonly BuildingInfo buildingInfo;
readonly string race;
readonly WithMakeAnimation makeAnimation;
public Transforms(ActorInitializer init, TransformsInfo info)
{
self = init.Self;
this.info = info;
buildingInfo = self.World.Map.Rules.Actors[info.IntoActor].Traits.GetOrDefault<BuildingInfo>();
building = self.TraitOrDefault<Building>();
makeAnimation = self.TraitOrDefault<WithMakeAnimation>();
race = init.Contains<RaceInit>() ? init.Get<RaceInit, string>() : self.Owner.Country.Race;
}
@@ -68,6 +64,7 @@ namespace OpenRA.Mods.Common.Traits
bool CanDeploy()
{
var building = self.TraitOrDefault<Building>();
if (building != null && building.Locked)
return false;
@@ -89,6 +86,7 @@ namespace OpenRA.Mods.Common.Traits
public void DeployTransform(bool queued)
{
var building = self.TraitOrDefault<Building>();
if (!CanDeploy() || (building != null && !building.Lock()))
{
foreach (var s in info.NoTransformSounds)
@@ -117,6 +115,7 @@ namespace OpenRA.Mods.Common.Traits
Race = race
};
var makeAnimation = self.TraitOrDefault<WithMakeAnimation>();
if (makeAnimation != null)
makeAnimation.Reverse(self, transform);
else