Index: binaries/data/mods/public/simulation/components/UnitAI.js =================================================================== --- binaries/data/mods/public/simulation/components/UnitAI.js +++ binaries/data/mods/public/simulation/components/UnitAI.js @@ -601,8 +601,10 @@ this.PushOrderFront("Pack", { "force": true }); return; } - - this.SetNextState("INDIVIDUAL.GARRISON.APPROACHING"); + if (this.IsAnimal()) + this.SetNextState("ANIMAL.GARRISON"); + else + this.SetNextState("INDIVIDUAL.GARRISON.APPROACHING"); }, "Order.Ungarrison": function() { @@ -2750,7 +2752,10 @@ }, "MoveCompleted": function() { - this.SetNextState("GARRISONED"); + if (this.IsAnimal()) + this.SetNextState("ANIMAL.GARRISONED"); + else + this.SetNextState("GARRISONED"); }, }, @@ -2841,7 +2846,10 @@ } if (!this.CheckTargetRangeExplicit(target, 0, 0) && this.MoveToTarget(target)) { - this.SetNextState("APPROACHING"); + if (this.IsAnimal()) + this.SetNextState("ANIMAL.GARRISON"); + else + this.SetNextState("APPROACHING"); return false; } } @@ -3094,6 +3102,10 @@ "WALKING": "INDIVIDUAL.WALKING", // reuse the same walking behaviour for animals // only used for domestic animals + + "GARRISON": "INDIVIDUAL.GARRISON.APPROACHING", // reuse the same garrison behaviour for animals + + "GARRISONED": "INDIVIDUAL.GARRISON.GARRISONED", // reuse the same garrisoned behaviour for animals }, }; @@ -5570,12 +5582,6 @@ if (!cmpOwnership || !(IsOwnedByPlayer(cmpOwnership.GetOwner(), target) || IsOwnedByMutualAllyOfPlayer(cmpOwnership.GetOwner(), target))) return false; - // Don't let animals garrison for now - // (If we want to support that, we'll need to change Order.Garrison so it - // doesn't move the animal into an INVIDIDUAL.* state) - if (this.IsAnimal()) - return false; - return true; };