Add a CanDeploy check to Transform at FrameEndTask
This commit is contained in:
committed by
Matthias Mailänder
parent
43bb9e4302
commit
8a18c2e4b6
@@ -66,15 +66,15 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
// Wait forever
|
||||
QueueChild(new WaitFor(() => false));
|
||||
makeAnimation.Reverse(self, () => DoTransform(self));
|
||||
makeAnimation.Reverse(self, () => DoTransform(self, transforms, makeAnimation));
|
||||
return false;
|
||||
}
|
||||
|
||||
DoTransform(self);
|
||||
DoTransform(self, transforms, null);
|
||||
return true;
|
||||
}
|
||||
|
||||
void DoTransform(Actor self)
|
||||
void DoTransform(Actor self, Transforms transforms, WithMakeAnimation makeAnimation)
|
||||
{
|
||||
// This activity may be buried as a child within one or more parents
|
||||
// We need to consider the top-level activities when transferring orders to the new actor!
|
||||
@@ -85,6 +85,20 @@ namespace OpenRA.Mods.Common.Activities
|
||||
if (self.IsDead || self.WillDispose)
|
||||
return;
|
||||
|
||||
// Prevent deployment in bogus locations
|
||||
if (transforms != null && !transforms.CanDeploy())
|
||||
{
|
||||
if (!SkipMakeAnims && makeAnimation != null)
|
||||
makeAnimation.Forward(self, () => { IsInterruptible = true; Cancel(self, true); });
|
||||
else
|
||||
{
|
||||
IsInterruptible = true;
|
||||
Cancel(self, true);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var nt in self.TraitsImplementing<INotifyTransform>())
|
||||
nt.OnTransform(self);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user