Remove (INotify)BuildComplete from Attack*

This commit is contained in:
Paul Chote
2018-10-27 17:20:06 +00:00
committed by abcdefg30
parent e57087cb5b
commit e77aaa1a47
9 changed files with 42 additions and 25 deletions

View File

@@ -43,7 +43,7 @@ namespace OpenRA.Mods.Cnc.Traits
public override object Create(ActorInitializer init) { return new AttackPopupTurreted(init, this); }
}
class AttackPopupTurreted : AttackTurreted, INotifyBuildComplete, INotifyIdle, IDamageModifier
class AttackPopupTurreted : AttackTurreted, INotifyIdle, IDamageModifier
{
enum PopupState { Open, Rotating, Transitioning, Closed }
@@ -64,9 +64,22 @@ namespace OpenRA.Mods.Cnc.Traits
skippedMakeAnimation = init.Contains<SkipMakeAnimsInit>();
}
protected override void Created(Actor self)
{
base.Created(self);
// Map placed actors are created in the closed state
if (skippedMakeAnimation)
{
state = PopupState.Closed;
wsb.PlayCustomAnimationRepeating(self, info.ClosedIdleSequence);
turret.DesiredFacing = null;
}
}
protected override bool CanAttack(Actor self, Target target)
{
if (state == PopupState.Transitioning || !building.BuildComplete)
if (state == PopupState.Transitioning)
return false;
if (!base.CanAttack(self, target))
@@ -106,16 +119,6 @@ namespace OpenRA.Mods.Cnc.Traits
}
}
void INotifyBuildComplete.BuildingComplete(Actor self)
{
if (skippedMakeAnimation)
{
state = PopupState.Closed;
wsb.PlayCustomAnimationRepeating(self, info.ClosedIdleSequence);
turret.DesiredFacing = null;
}
}
int IDamageModifier.GetDamageModifier(Actor attacker, Damage damage)
{
return state == PopupState.Closed ? info.ClosedDamageMultiplier : 100;