Index: ps/trunk/binaries/data/mods/public/simulation/components/UnitAI.js =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/components/UnitAI.js +++ ps/trunk/binaries/data/mods/public/simulation/components/UnitAI.js @@ -1634,6 +1634,7 @@ this.StartTimer(1000, 1000); this.SetHeldPositionOnEntity(this.entity); this.SetAnimationVariant("combat"); + this.FaceTowardsTarget(this.order.data.target); return false; }, @@ -1657,6 +1658,7 @@ this.SetNextState("ESCORTING"); else { + this.FaceTowardsTarget(this.order.data.target); // if nothing better to do, check if the guarded needs to be healed or repaired var cmpHealth = Engine.QueryInterface(this.isGuardOf, IID_Health); if (cmpHealth && cmpHealth.IsInjured()) @@ -2145,8 +2147,8 @@ { this.StopMoving(); this.SetDefaultAnimationVariant(); - var typename = "gather_" + this.order.data.type.specific; - this.SelectAnimation(typename); + this.FaceTowardsTarget(this.order.data.target); + this.SelectAnimation("gather_" + this.order.data.type.specific); } return false; }, @@ -2192,6 +2194,8 @@ if (cmpResourceGatherer.IsCarryingAnythingExcept(resourceType.generic)) cmpResourceGatherer.DropResources(); + this.FaceTowardsTarget(this.order.data.target); + // Collect from the target let status = cmpResourceGatherer.PerformGather(this.gatheringTarget); @@ -2597,6 +2601,8 @@ if (cmpBuilderList) cmpBuilderList.AddBuilder(this.entity); + this.FaceTowardsTarget(this.order.data.target); + this.SelectAnimation("build"); this.StartTimer(1000, 1000); return false; @@ -2620,7 +2626,9 @@ return; } - var cmpBuilder = Engine.QueryInterface(this.entity, IID_Builder); + this.FaceTowardsTarget(this.order.data.target); + + let cmpBuilder = Engine.QueryInterface(this.entity, IID_Builder); cmpBuilder.PerformBuilding(this.repairTarget); // if the building is completed, the leave() function will be called // by the ConstructionFinished message