Add some logging to see what is going on.
This commit is contained in:
@@ -51,6 +51,7 @@ namespace OpenRA.Mods.RA
|
||||
Actor currentTarget;
|
||||
public void TickIdle( Actor self )
|
||||
{
|
||||
System.Console.WriteLine("AutoHeal:TickIdle");
|
||||
var attack = self.Trait<AttackBase>();
|
||||
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<AttackBase>().GetAttackActivity(self, Target.FromActor( currentTarget ), false ));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,13 +39,17 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
public void TickIdle( Actor self )
|
||||
{
|
||||
System.Console.WriteLine("AutoTarget:TickIdle");
|
||||
var attack = self.Trait<AttackBase>();
|
||||
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<AutoTargetInfo>().AllowMovement
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ using OpenRA.Mods.RA.Render;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
class IdleAnimationInfo : ITraitInfo
|
||||
class IdleAnimationInfo : ITraitInfo, ITraitPrerequisite<RenderInfantryInfo>
|
||||
{
|
||||
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);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<IFacing>().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");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace OpenRA.Mods.RA
|
||||
class TakeCoverInfo : TraitInfo<TakeCover> { }
|
||||
|
||||
// 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<RenderSimple>().anim.PlayFetchIndex("crawl", () => 0);
|
||||
}
|
||||
}
|
||||
|
||||
public float GetDamageModifier(Actor attacker, WarheadInfo warhead )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user