fix interaction between autoattack and idleanimation
This commit is contained in:
@@ -68,12 +68,11 @@ namespace OpenRA
|
|||||||
|
|
||||||
public void Tick()
|
public void Tick()
|
||||||
{
|
{
|
||||||
var wasIdle = currentActivity is Idle;
|
if (currentActivity == null)
|
||||||
currentActivity = Util.RunActivity( this, currentActivity ) ?? new Idle();
|
|
||||||
|
|
||||||
if (currentActivity is Idle && !wasIdle)
|
|
||||||
foreach (var ni in TraitsImplementing<INotifyIdle>())
|
foreach (var ni in TraitsImplementing<INotifyIdle>())
|
||||||
ni.Idle(this);
|
ni.TickIdle(this);
|
||||||
|
|
||||||
|
currentActivity = Util.RunActivity( this, currentActivity );
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsIdle
|
public bool IsIdle
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ namespace OpenRA.Traits
|
|||||||
}
|
}
|
||||||
|
|
||||||
public interface IRenderOverlay { void Render( WorldRenderer wr ); }
|
public interface IRenderOverlay { void Render( WorldRenderer wr ); }
|
||||||
public interface INotifyIdle { void Idle(Actor self); }
|
public interface INotifyIdle { void TickIdle(Actor self); }
|
||||||
|
|
||||||
public interface IBlocksBullets { }
|
public interface IBlocksBullets { }
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ namespace OpenRA.Mods.RA.Air
|
|||||||
|
|
||||||
class ReturnOnIdle : INotifyIdle
|
class ReturnOnIdle : INotifyIdle
|
||||||
{
|
{
|
||||||
public void Idle(Actor self)
|
public void TickIdle(Actor self)
|
||||||
{
|
{
|
||||||
var altitude = self.Trait<Aircraft>().Altitude;
|
var altitude = self.Trait<Aircraft>().Altitude;
|
||||||
if (altitude == 0) return; // we're on the ground, let's stay there.
|
if (altitude == 0) return; // we're on the ground, let's stay there.
|
||||||
@@ -44,7 +44,7 @@ namespace OpenRA.Mods.RA.Air
|
|||||||
|
|
||||||
class FlyAwayOnIdle : INotifyIdle
|
class FlyAwayOnIdle : INotifyIdle
|
||||||
{
|
{
|
||||||
public void Idle(Actor self)
|
public void TickIdle(Actor self)
|
||||||
{
|
{
|
||||||
self.QueueActivity(new FlyOffMap());
|
self.QueueActivity(new FlyOffMap());
|
||||||
self.QueueActivity(new RemoveSelf());
|
self.QueueActivity(new RemoveSelf());
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace OpenRA.Mods.RA
|
|||||||
|
|
||||||
class AutoHeal : INotifyIdle
|
class AutoHeal : INotifyIdle
|
||||||
{
|
{
|
||||||
public void Idle( Actor self )
|
public void TickIdle( Actor self )
|
||||||
{
|
{
|
||||||
self.QueueActivity( new IdleHealActivity() );
|
self.QueueActivity( new IdleHealActivity() );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ namespace OpenRA.Mods.RA
|
|||||||
self.Trait<AttackBase>().AttackTarget(Target.FromActor(e.Attacker), false, self.Info.Traits.Get<AutoTargetInfo>().AllowMovement);
|
self.Trait<AttackBase>().AttackTarget(Target.FromActor(e.Attacker), false, self.Info.Traits.Get<AutoTargetInfo>().AllowMovement);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Idle( Actor self )
|
public void TickIdle( Actor self )
|
||||||
{
|
{
|
||||||
self.QueueActivity( new IdleAttackActivity() );
|
self.QueueActivity( new IdleAttackActivity() );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ namespace OpenRA.Mods.RA
|
|||||||
self.CancelActivity();
|
self.CancelActivity();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Idle(Actor self)
|
public void TickIdle(Actor self)
|
||||||
{
|
{
|
||||||
self.QueueActivity(new Activities.IdleAnimation(Info.Animations.Random(self.World.SharedRandom),
|
self.QueueActivity(new Activities.IdleAnimation(Info.Animations.Random(self.World.SharedRandom),
|
||||||
Info.IdleWaitTicks));
|
Info.IdleWaitTicks));
|
||||||
|
|||||||
Reference in New Issue
Block a user