Ticket #3444: UnitAI.diff

File UnitAI.diff, 1.5 KB (added by erraunt, 8 years ago)
  • UnitAI.js

     
    16991699                    this.SetGathererAnimationOverride(true);
    17001700
    17011701                    this.SelectAnimation("move");
     1702                    if (this.IsAnimal())
     1703                        this.SetMoveSpeed(this.GetRunSpeed());
     1704
    17021705                    this.StartTimer(1000, 1000);
    17031706                },
    17041707
     1708                "HealthChanged": function() {
     1709                    if (this.IsAnimal())
     1710                        this.SetMoveSpeed(this.GetRunSpeed());
     1711                },
     1712
    17051713                "leave": function() {
    17061714                    // Show carried resources when walking.
    17071715                    this.SetGathererAnimationOverride();
    17081716
     1717                    this.SetMoveSpeed(this.GetWalkSpeed());
     1718
    17091719                    this.StopTimer();
    17101720                },
    17111721
     
    19851995
    19861996                    this.SelectAnimation("move");
    19871997                    var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
    1988                     if (cmpUnitAI && cmpUnitAI.IsFleeing())
    1989                     {
    1990                         // Run after a fleeing target
    1991                         var speed = this.GetRunSpeed();
    1992                         this.SetMoveSpeed(speed);
    1993                     }
     1998                    if (cmpUnitAI && cmpUnitAI.IsFleeing() || this.IsAnimal())
     1999                        this.SetMoveSpeed(this.GetRunSpeed());
     2000
    19942001                    this.StartTimer(1000, 1000);
    19952002                },
    19962003
     
    19982005                    var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
    19992006                    if (!cmpUnitAI || !cmpUnitAI.IsFleeing())
    20002007                        return;
    2001                     var speed = this.GetRunSpeed();
    2002                     this.SetMoveSpeed(speed);
     2008                    if (this.IsAnimal())
     2009                        this.SetMoveSpeed(this.GetRunSpeed());
    20032010                },
    20042011
    20052012                "leave": function() {