Index: source/simulation2/components/ICmpUnitMotion.cpp
===================================================================
--- source/simulation2/components/ICmpUnitMotion.cpp	(révision 13872)
+++ source/simulation2/components/ICmpUnitMotion.cpp	(copie de travail)
@@ -35,6 +35,7 @@
 DEFINE_INTERFACE_METHOD_0("IsMoving", bool, ICmpUnitMotion, IsMoving)
 DEFINE_INTERFACE_METHOD_0("GetWalkSpeed", fixed, ICmpUnitMotion, GetWalkSpeed)
 DEFINE_INTERFACE_METHOD_0("GetRunSpeed", fixed, ICmpUnitMotion, GetRunSpeed)
+DEFINE_INTERFACE_METHOD_1("SetFacePointAfterMove", void, ICmpUnitMotion, SetFacePointAfterMove, bool)
 DEFINE_INTERFACE_METHOD_1("SetUnitRadius", void, ICmpUnitMotion, SetUnitRadius, fixed)
 DEFINE_INTERFACE_METHOD_1("SetDebugOverlay", void, ICmpUnitMotion, SetDebugOverlay, bool)
 END_INTERFACE_WRAPPER(UnitMotion)
@@ -104,6 +105,11 @@
 		return m_Script.Call<fixed>("GetRunSpeed");
 	}
 
+	virtual void SetFacePointAfterMove(bool facePointAfterMove)
+	{
+		m_Script.CallVoid("SetFacePointAfterMove", facePointAfterMove);
+	}
+
 	virtual ICmpPathfinder::pass_class_t GetPassabilityClass()
 	{
 		return m_Script.Call<ICmpPathfinder::pass_class_t>("GetPassabilityClass");
Index: source/simulation2/components/CCmpUnitMotion.cpp
===================================================================
--- source/simulation2/components/CCmpUnitMotion.cpp	(révision 13872)
+++ source/simulation2/components/CCmpUnitMotion.cpp	(copie de travail)
@@ -129,6 +129,7 @@
 
 	entity_pos_t m_Radius;
 	bool m_Moving;
+	bool m_FacePointAfterMove;
 
 	enum State
 	{
@@ -281,6 +282,8 @@
 		m_FormationController = paramNode.GetChild("FormationController").ToBool();
 
 		m_Moving = false;
+		m_FacePointAfterMove = true;
+
 		m_WalkSpeed = paramNode.GetChild("WalkSpeed").ToFixed();
 		m_Speed = m_WalkSpeed;
 		m_CurSpeed = fixed::Zero();
@@ -342,6 +345,7 @@
 		serialize.NumberFixed_Unbounded("speed", m_Speed);
 
 		serialize.Bool("moving", m_Moving);
+		serialize.Bool("facePointAfterMove", m_FacePointAfterMove);
 
 		SerializeVector<SerializeWaypoint>()(serialize, "long path", m_LongPath.m_Waypoints);
 		SerializeVector<SerializeWaypoint>()(serialize, "short path", m_ShortPath.m_Waypoints);
@@ -428,6 +432,11 @@
 		m_Speed = speed;
 	}
 
+	virtual void SetFacePointAfterMove(bool facePointAfterMove)
+	{
+		m_FacePointAfterMove = facePointAfterMove;
+	}
+
 	virtual void SetDebugOverlay(bool enabled)
 	{
 		m_DebugOverlayEnabled = enabled;
@@ -963,7 +972,9 @@
 
 							StopMoving();
 
-							FaceTowardsPointFromPos(pos, m_FinalGoal.x, m_FinalGoal.z);
+
+							if (m_FacePointAfterMove)
+								FaceTowardsPointFromPos(pos, m_FinalGoal.x, m_FinalGoal.z);
 							// TODO: if the goal was a square building, we ought to point towards the
 							// nearest point on the square, not towards its center
 						}
@@ -1312,7 +1323,8 @@
 		else
 		{
 			// We're already in range - no need to move anywhere
-			FaceTowardsPointFromPos(pos, x, z);
+			if (m_FacePointAfterMove)
+				FaceTowardsPointFromPos(pos, x, z);
 			return false;
 		}
 
@@ -1474,7 +1486,8 @@
 		else if (maxRange < entity_pos_t::Zero() || distance < maxRange)
 		{
 			// We're already in range - no need to move anywhere
-			FaceTowardsPointFromPos(pos, goal.x, goal.z);
+			if (m_FacePointAfterMove)
+				FaceTowardsPointFromPos(pos, goal.x, goal.z);
 			return false;
 		}
 		else
@@ -1496,7 +1509,8 @@
 				if (circleDistance < maxRange)
 				{
 					// We're already in range - no need to move anywhere
-					FaceTowardsPointFromPos(pos, goal.x, goal.z);
+					if (m_FacePointAfterMove)
+						FaceTowardsPointFromPos(pos, goal.x, goal.z);
 					return false;
 				}
 
Index: source/simulation2/components/ICmpUnitMotion.h
===================================================================
--- source/simulation2/components/ICmpUnitMotion.h	(révision 13872)
+++ source/simulation2/components/ICmpUnitMotion.h	(copie de travail)
@@ -110,6 +110,11 @@
 	virtual fixed GetRunSpeed() = 0;
 
 	/**
+	 * Set the FaceTowardsPoint after the move
+	 */
+	virtual void SetFacePointAfterMove(bool facePointAfterMove) = 0;
+
+	/**
 	 * Get the unit's passability class.
 	 */
 	virtual ICmpPathfinder::pass_class_t GetPassabilityClass() = 0;
Index: binaries/data/mods/public/simulation/components/UnitAI.js
===================================================================
--- binaries/data/mods/public/simulation/components/UnitAI.js	(révision 13872)
+++ binaries/data/mods/public/simulation/components/UnitAI.js	(copie de travail)
@@ -2431,10 +2431,12 @@
 				this.MoveRandomly(+this.template.RoamDistance);
 				// Set a random timer to switch to feeding state
 				this.StartTimer(RandomInt(+this.template.RoamTimeMin, +this.template.RoamTimeMax));
+				this.SetFacePointAfterMove(false);
 			},
 
 			"leave": function() {
 				this.StopTimer();
+				this.SetFacePointAfterMove(true);
 			},
 
 			"LosRangeUpdate": function(msg) {
@@ -4583,6 +4585,13 @@
 	cmpMotion.MoveToPointRange(tx, tz, distance, distance);
 };
 
+UnitAI.prototype.SetFacePointAfterMove = function(val)
+{
+	var cmpMotion = Engine.QueryInterface(this.entity, IID_UnitMotion);
+	if (cmpMotion)
+		cmpMotion.SetFacePointAfterMove(val);
+};
+
 UnitAI.prototype.AttackEntitiesByPreference = function(ents)
 {
 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
