fix infantry anims
This commit is contained in:
@@ -34,8 +34,11 @@ namespace OpenRA.Traits.Activities
|
||||
Log.Write("debug", "drag #{0} {1} {2}", self.ActorID, ticks, self.CenterLocation);
|
||||
|
||||
if (++ticks >= length)
|
||||
return NextActivity;
|
||||
|
||||
{
|
||||
self.Trait<Mobile>().IsMoving = false;
|
||||
return NextActivity;
|
||||
}
|
||||
self.Trait<Mobile>().IsMoving = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -294,19 +294,27 @@ namespace OpenRA.Traits.Activities
|
||||
public IActivity Tick( Actor self )
|
||||
{
|
||||
var mobile = self.Trait<Mobile>();
|
||||
moveFraction += (int)mobile.MovementSpeedForCell(self, mobile.toCell);
|
||||
if( moveFraction >= moveFractionTotal )
|
||||
var ret = InnerTick( self, mobile );
|
||||
mobile.IsMoving = ( ret is MovePart );
|
||||
|
||||
if( moveFraction > moveFractionTotal )
|
||||
moveFraction = moveFractionTotal;
|
||||
UpdateCenterLocation( self, mobile );
|
||||
if( moveFraction >= moveFractionTotal )
|
||||
{
|
||||
var next = OnComplete( self, mobile, move );
|
||||
if( next != null )
|
||||
return next;
|
||||
UpdateCenterLocation( self, mobile );
|
||||
return move;
|
||||
}
|
||||
return this;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
IActivity InnerTick( Actor self, Mobile mobile )
|
||||
{
|
||||
moveFraction += (int)mobile.MovementSpeedForCell(self, mobile.toCell);
|
||||
if( moveFraction <= moveFractionTotal )
|
||||
return this;
|
||||
|
||||
var next = OnComplete( self, mobile, move );
|
||||
if( next != null )
|
||||
return next;
|
||||
|
||||
return move;
|
||||
}
|
||||
|
||||
void UpdateCenterLocation( Actor self, Mobile mobile )
|
||||
|
||||
@@ -57,6 +57,7 @@ namespace OpenRA.Traits
|
||||
{
|
||||
public readonly Actor self;
|
||||
public readonly MobileInfo Info;
|
||||
public bool IsMoving { get; internal set; }
|
||||
|
||||
int __facing;
|
||||
int2 __fromCell, __toCell;
|
||||
|
||||
@@ -30,10 +30,9 @@ namespace OpenRA.Mods.RA.Render
|
||||
|
||||
bool ChooseMoveAnim(Actor self)
|
||||
{
|
||||
if (!(self.GetCurrentActivity() is Move) && !(self.GetCurrentActivity() is Drag)) // A bit of a hack
|
||||
return false;
|
||||
|
||||
var mobile = self.Trait<Mobile>();
|
||||
if( !mobile.IsMoving ) return false;
|
||||
|
||||
if (float2.WithinEpsilon(self.CenterLocation, Util.CenterOfCell(mobile.toCell), 2)) return false;
|
||||
|
||||
var seq = IsProne(self) ? "crawl" : "run";
|
||||
|
||||
Reference in New Issue
Block a user