Ticket #3444: UnitAI_animal_behavior_with_Itms_suggestion.diff
File UnitAI_animal_behavior_with_Itms_suggestion.diff, 1.5 KB (added by , 8 years ago) |
---|
-
UnitAI.js
1699 1699 this.SetGathererAnimationOverride(true); 1700 1700 1701 1701 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 1702 1710 this.StartTimer(1000, 1000); 1703 1711 }, 1704 1712 1713 "HealthChanged": function() { 1714 if (this.IsAnimal()) 1715 { 1716 var speed = this.GetRunSpeed(); 1717 this.SetMoveSpeed(speed); 1718 } 1719 }, 1720 1705 1721 "leave": function() { 1706 1722 // Show carried resources when walking. 1707 1723 this.SetGathererAnimationOverride(); 1708 1724 1725 if (this.IsAnimal()) 1726 { 1727 var speed = this.GetWalkSpeed(); 1728 this.SetMoveSpeed(speed); 1729 } 1730 1709 1731 this.StopTimer(); 1710 1732 }, 1711 1733 … … 1985 2007 1986 2008 this.SelectAnimation("move"); 1987 2009 var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI); 1988 if ( cmpUnitAI && cmpUnitAI.IsFleeing())2010 if ((cmpUnitAI && cmpUnitAI.IsFleeing()) || this.IsAnimal()) 1989 2011 { 1990 2012 // Run after a fleeing target 1991 2013 var speed = this.GetRunSpeed();