Merge pull request #9987 from pchote/transforms
Check deploy location at the time of transform.
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using OpenRA.Activities;
|
||||||
using OpenRA.Mods.Common.Activities;
|
using OpenRA.Mods.Common.Activities;
|
||||||
using OpenRA.Mods.Common.Orders;
|
using OpenRA.Mods.Common.Orders;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
@@ -95,9 +96,10 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public void DeployTransform(bool queued)
|
public void DeployTransform(bool queued)
|
||||||
{
|
{
|
||||||
var building = self.TraitOrDefault<Building>();
|
if (!queued && !CanDeploy())
|
||||||
if (!CanDeploy() || (building != null && !building.Lock()))
|
|
||||||
{
|
{
|
||||||
|
// Only play the "Cannot deploy here" audio
|
||||||
|
// for non-queued orders
|
||||||
foreach (var s in info.NoTransformSounds)
|
foreach (var s in info.NoTransformSounds)
|
||||||
Game.Sound.PlayToPlayer(self.Owner, s);
|
Game.Sound.PlayToPlayer(self.Owner, s);
|
||||||
|
|
||||||
@@ -115,6 +117,13 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (self.Info.HasTraitInfo<AircraftInfo>())
|
if (self.Info.HasTraitInfo<AircraftInfo>())
|
||||||
self.QueueActivity(new HeliLand(self, true));
|
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>())
|
foreach (var nt in self.TraitsImplementing<INotifyTransform>())
|
||||||
nt.BeforeTransform(self);
|
nt.BeforeTransform(self);
|
||||||
|
|
||||||
@@ -132,6 +141,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
makeAnimation.Reverse(self, transform);
|
makeAnimation.Reverse(self, transform);
|
||||||
else
|
else
|
||||||
self.QueueActivity(transform);
|
self.QueueActivity(transform);
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ResolveOrder(Actor self, Order order)
|
public void ResolveOrder(Actor self, Order order)
|
||||||
|
|||||||
Reference in New Issue
Block a user