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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user