diff --git a/OpenRA.Mods.RA/Transforms.cs b/OpenRA.Mods.RA/Transforms.cs index 229db3eea4..2cc411ae33 100644 --- a/OpenRA.Mods.RA/Transforms.cs +++ b/OpenRA.Mods.RA/Transforms.cs @@ -68,29 +68,31 @@ namespace OpenRA.Mods.RA return null; } + public void DeployTransform() + { + var b = self.TraitOrDefault(); + + if (!CanDeploy() || (b != null && !b.Lock())) + { + foreach (var s in Info.NoTransformSounds) + Sound.PlayToPlayer(self.Owner, s); + return; + } + + if (self.HasTrait()) + self.QueueActivity(new Turn(Info.Facing)); + + var rb = self.TraitOrDefault(); + if (rb != null && self.Info.Traits.Get().HasMakeAnimation) + self.QueueActivity(new MakeAnimation(self, true, () => rb.PlayCustomAnim(self, "make"))); + + self.QueueActivity(new Transform(self, Info.IntoActor) { Offset = (CVec)Info.Offset, Facing = Info.Facing, Sounds = Info.TransformSounds }); + } + public void ResolveOrder( Actor self, Order order ) { if (order.OrderString == "DeployTransform") - { - var b = self.TraitOrDefault(); - - if (!CanDeploy() || (b != null && !b.Lock())) - { - foreach (var s in Info.NoTransformSounds) - Sound.PlayToPlayer(self.Owner, s); - return; - } - self.CancelActivity(); - - if (self.HasTrait()) - self.QueueActivity(new Turn(Info.Facing)); - - var rb = self.TraitOrDefault(); - if (rb != null && self.Info.Traits.Get().HasMakeAnimation) - self.QueueActivity(new MakeAnimation(self, true, () => rb.PlayCustomAnim(self, "make"))); - - self.QueueActivity(new Transform(self, Info.IntoActor) { Offset = (CVec)Info.Offset, Facing = Info.Facing, Sounds = Info.TransformSounds }); - } + DeployTransform(); } } }