diff --git a/OpenRA.Mods.RA/AutoHeal.cs b/OpenRA.Mods.RA/AutoHeal.cs index 0d3a1d56b9..69508f38fb 100644 --- a/OpenRA.Mods.RA/AutoHeal.cs +++ b/OpenRA.Mods.RA/AutoHeal.cs @@ -51,6 +51,7 @@ namespace OpenRA.Mods.RA Actor currentTarget; public void TickIdle( Actor self ) { + System.Console.WriteLine("AutoHeal:TickIdle"); var attack = self.Trait(); var range = attack.GetMaximumRange(); @@ -58,7 +59,10 @@ namespace OpenRA.Mods.RA { var currentTarget = ChooseTarget(self, range); if( currentTarget != null ) + { + System.Console.WriteLine("AutoHeal: Queing heal activity"); self.QueueActivity(self.Trait().GetAttackActivity(self, Target.FromActor( currentTarget ), false )); + } } } } diff --git a/OpenRA.Mods.RA/AutoTarget.cs b/OpenRA.Mods.RA/AutoTarget.cs index 12f743a5fa..e8497add2c 100644 --- a/OpenRA.Mods.RA/AutoTarget.cs +++ b/OpenRA.Mods.RA/AutoTarget.cs @@ -39,13 +39,17 @@ namespace OpenRA.Mods.RA public void TickIdle( Actor self ) { + System.Console.WriteLine("AutoTarget:TickIdle"); var attack = self.Trait(); var currentTarget = attack.ScanForTarget(self, null); if( currentTarget != null ) + { + System.Console.WriteLine("AutoTarget: Queing attack activity"); self.QueueActivity(attack.GetAttackActivity( self, Target.FromActor(currentTarget), self.Info.Traits.Get().AllowMovement )); + } } } } diff --git a/OpenRA.Mods.RA/IdleAnimation.cs b/OpenRA.Mods.RA/IdleAnimation.cs index bea9a164c2..98d28de512 100644 --- a/OpenRA.Mods.RA/IdleAnimation.cs +++ b/OpenRA.Mods.RA/IdleAnimation.cs @@ -13,7 +13,7 @@ using OpenRA.Mods.RA.Render; namespace OpenRA.Mods.RA { - class IdleAnimationInfo : ITraitInfo + class IdleAnimationInfo : ITraitInfo, ITraitPrerequisite { public readonly int IdleWaitTicks = 50; public readonly string[] Animations = {}; @@ -63,6 +63,8 @@ namespace OpenRA.Mods.RA public void TickIdle(Actor self) { + System.Console.WriteLine("IdleAnimation:TickIdle"); + //if (active) // System.Console.WriteLine("idleactive: {0} ({1}) ",self.Info.Name, self.ActorID); @@ -74,7 +76,7 @@ namespace OpenRA.Mods.RA waiting = true; sequence = Info.Animations.Random(self.World.SharedRandom); delay = Info.IdleWaitTicks; - //System.Console.WriteLine("TickIdle: {2} ({3}) set {0} {1}",sequence,delay, self.Info.Name, self.ActorID); + System.Console.WriteLine("IdleAnimation: setting anim to {0} delay {1}", sequence, delay); } } diff --git a/OpenRA.Mods.RA/Render/RenderInfantry.cs b/OpenRA.Mods.RA/Render/RenderInfantry.cs index 60eaf3a802..3158222d99 100644 --- a/OpenRA.Mods.RA/Render/RenderInfantry.cs +++ b/OpenRA.Mods.RA/Render/RenderInfantry.cs @@ -21,7 +21,7 @@ namespace OpenRA.Mods.RA.Render public override object Create(ActorInitializer init) { return new RenderInfantry(init.self); } } - public class RenderInfantry : RenderSimple, INotifyAttack, INotifyDamage + public class RenderInfantry : RenderSimple, INotifyAttack, INotifyDamage, INotifyIdle { public RenderInfantry(Actor self) : base(self, () => self.Trait().Facing) @@ -66,15 +66,15 @@ namespace OpenRA.Mods.RA.Render public override void Tick(Actor self) { base.Tick(self); - if (inAttack) return; - if (self.IsIdle) return; - if (ChooseMoveAnim(self)) return; - - // TODO: Pick new animation only on damage or idle notifications - //if (IsProne(self)) - // anim.PlayFetchIndex("crawl", () => 0); /* what a hack. */ - //else - // anim.Play("stand"); + if (self.IsIdle || inAttack) return; + ChooseMoveAnim(self); + } + + public void TickIdle(Actor self) + { + System.Console.WriteLine("RenderInfantry:TickIdle"); + System.Console.WriteLine("RenderInfantry: setting anim to stand"); + anim.Play("stand"); } diff --git a/OpenRA.Mods.RA/TakeCover.cs b/OpenRA.Mods.RA/TakeCover.cs index 900bed912d..10309b9152 100644 --- a/OpenRA.Mods.RA/TakeCover.cs +++ b/OpenRA.Mods.RA/TakeCover.cs @@ -16,7 +16,7 @@ namespace OpenRA.Mods.RA class TakeCoverInfo : TraitInfo { } // infantry prone behavior - class TakeCover : ITick, INotifyDamage, IDamageModifier, ISpeedModifier + class TakeCover : ITick, INotifyDamage, IDamageModifier, ISpeedModifier, INotifyIdle { const int defaultProneTime = 100; /* ticks, =4s */ const float proneDamage = .5f; @@ -30,8 +30,11 @@ namespace OpenRA.Mods.RA public void Damaged(Actor self, AttackInfo e) { if (e.Damage > 0) /* fix to allow healing via `damage` */ + { if (e.Warhead == null || !e.Warhead.PreventProne) remainingProneTime = defaultProneTime; + + } } public void Tick(Actor self) @@ -39,6 +42,16 @@ namespace OpenRA.Mods.RA if (IsProne) --remainingProneTime; } + + public void TickIdle(Actor self) + { + System.Console.WriteLine("TakeCover:TickIdle"); + if (remainingProneTime > 0) + { + System.Console.WriteLine("TakeCover: set anim to crawl"); + self.Trait().anim.PlayFetchIndex("crawl", () => 0); + } + } public float GetDamageModifier(Actor attacker, WarheadInfo warhead ) {