Ticket #3444: UnitAI_animal_behavior.diff
File UnitAI_animal_behavior.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 // so animals will reset their speed 1726 var speed = this.GetWalkSpeed(); 1727 this.SetMoveSpeed(speed); 1728 1709 1729 this.StopTimer(); 1710 1730 }, 1711 1731 … … 1985 2005 1986 2006 this.SelectAnimation("move"); 1987 2007 var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI); 1988 if ( cmpUnitAI && cmpUnitAI.IsFleeing())2008 if ((cmpUnitAI && cmpUnitAI.IsFleeing()) || this.IsAnimal()) 1989 2009 { 1990 2010 // Run after a fleeing target 1991 2011 var speed = this.GetRunSpeed();