Ticket #3444: UnitAI_animal_behavior_with_Itms_suggestion.diff

File UnitAI_animal_behavior_with_Itms_suggestion.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                    {
     1704                        // come on, no animal approaches intruders in a
     1705                        // walking pace
     1706                        var speed = this.GetRunSpeed();
     1707                        this.SetMoveSpeed(speed);
     1708                    }
     1709
    17021710                    this.StartTimer(1000, 1000);
    17031711                },
    17041712
     1713                "HealthChanged": function() {
     1714                    if (this.IsAnimal())
     1715                    {
     1716                        var speed = this.GetRunSpeed();
     1717                        this.SetMoveSpeed(speed);
     1718                    }
     1719                },
     1720
    17051721                "leave": function() {
    17061722                    // Show carried resources when walking.
    17071723                    this.SetGathererAnimationOverride();
    17081724
     1725                    if (this.IsAnimal())
     1726                    {
     1727                        var speed = this.GetWalkSpeed();
     1728                        this.SetMoveSpeed(speed);
     1729                    }
     1730
    17091731                    this.StopTimer();
    17101732                },
    17111733
     
    19852007
    19862008                    this.SelectAnimation("move");
    19872009                    var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
    1988                     if (cmpUnitAI && cmpUnitAI.IsFleeing())
     2010                    if ((cmpUnitAI && cmpUnitAI.IsFleeing()) || this.IsAnimal())
    19892011                    {
    19902012                        // Run after a fleeing target
    19912013                        var speed = this.GetRunSpeed();