Remove IPreventsTeleport interface.

MadTank is changed to use conditions instead.
This has a side-benefit of disabling the move
cursor while deployed.
This commit is contained in:
Paul Chote
2018-08-12 21:30:41 +01:00
parent e6d552eee7
commit 6f864b055d
4 changed files with 19 additions and 9 deletions

View File

@@ -50,6 +50,10 @@ namespace OpenRA.Mods.Cnc.Traits
[VoiceReference] public readonly string Voice = "Action";
[GrantedConditionReference]
[Desc("The condition to grant to self while deployed.")]
public readonly string DeployedCondition = null;
public WeaponInfo ThumpDamageWeaponInfo { get; private set; }
public WeaponInfo DetonationWeaponInfo { get; private set; }
@@ -75,12 +79,13 @@ namespace OpenRA.Mods.Cnc.Traits
}
}
class MadTank : IIssueOrder, IResolveOrder, IOrderVoice, ITick, IPreventsTeleport, IIssueDeployOrder
class MadTank : INotifyCreated, IIssueOrder, IResolveOrder, IOrderVoice, ITick, IIssueDeployOrder
{
readonly Actor self;
readonly MadTankInfo info;
readonly WithFacingSpriteBody wfsb;
readonly ScreenShaker screenShaker;
ConditionManager conditionManager;
bool deployed;
int tick;
@@ -92,6 +97,11 @@ namespace OpenRA.Mods.Cnc.Traits
screenShaker = self.World.WorldActor.Trait<ScreenShaker>();
}
void INotifyCreated.Created(Actor self)
{
conditionManager = self.TraitOrDefault<ConditionManager>();
}
void ITick.Tick(Actor self)
{
if (!deployed)
@@ -172,6 +182,9 @@ namespace OpenRA.Mods.Cnc.Traits
if (deployed)
return;
if (conditionManager != null && !string.IsNullOrEmpty(info.DeployedCondition))
conditionManager.GrantCondition(self, info.DeployedCondition);
self.World.AddFrameEndTask(w => EjectDriver());
if (info.ThumpSequence != null)
wfsb.PlayCustomAnimationRepeating(self, info.ThumpSequence);