Merge pull request #9987 from pchote/transforms

Check deploy location at the time of transform.
This commit is contained in:
Oliver Brakmann
2015-11-14 16:41:44 +01:00

View File

@@ -9,6 +9,7 @@
#endregion
using System.Collections.Generic;
using OpenRA.Activities;
using OpenRA.Mods.Common.Activities;
using OpenRA.Mods.Common.Orders;
using OpenRA.Traits;
@@ -95,9 +96,10 @@ namespace OpenRA.Mods.Common.Traits
public void DeployTransform(bool queued)
{
var building = self.TraitOrDefault<Building>();
if (!CanDeploy() || (building != null && !building.Lock()))
if (!queued && !CanDeploy())
{
// Only play the "Cannot deploy here" audio
// for non-queued orders
foreach (var s in info.NoTransformSounds)
Game.Sound.PlayToPlayer(self.Owner, s);
@@ -115,6 +117,13 @@ namespace OpenRA.Mods.Common.Traits
if (self.Info.HasTraitInfo<AircraftInfo>())
self.QueueActivity(new HeliLand(self, true));
self.QueueActivity(new CallFunc(() =>
{
// Prevent deployment in bogus locations
var building = self.TraitOrDefault<Building>();
if (!CanDeploy() || (building != null && !building.Lock()))
return;
foreach (var nt in self.TraitsImplementing<INotifyTransform>())
nt.BeforeTransform(self);
@@ -132,6 +141,7 @@ namespace OpenRA.Mods.Common.Traits
makeAnimation.Reverse(self, transform);
else
self.QueueActivity(transform);
}));
}
public void ResolveOrder(Actor self, Order order)