Ticket #3444: UnitAI_animal_behavior_with_elexis_suggestion.diff

File UnitAI_animal_behavior_with_elexis_suggestion.diff, 1.2 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                    if (this.IsAnimal())
     1718                        this.SetMoveSpeed(this.GetRunSpeed());
     1719
    17091720                    this.StopTimer();
    17101721                },
    17111722
     
    19851996
    19861997                    this.SelectAnimation("move");
    19871998                    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                     }
     1999                    if (cmpUnitAI && cmpUnitAI.IsFleeing() || this.IsAnimal())
     2000                        this.SetMoveSpeed(this.GetRunSpeed());
     2001
    19942002                    this.StartTimer(1000, 1000);
    19952003                },
    19962004