diff --git a/binaries/data/mods/public/simulation/components/UnitAI.js b/binaries/data/mods/public/simulation/components/UnitAI.js
index 06cf9d8398..2ab594f7c4 100644
--- a/binaries/data/mods/public/simulation/components/UnitAI.js
+++ b/binaries/data/mods/public/simulation/components/UnitAI.js
@@ -24,6 +24,11 @@ UnitAI.prototype.Schema =
"" +
"" +
"" +
+ "" +
+ "" +
+ "" +
+ "" +
+ "" +
"" +
"" +
"" +
@@ -1433,7 +1438,12 @@ UnitAI.prototype.UnitFsmSpec = {
"IDLE": {
"Order.Cheer": function() {
+ // Do not cheer if there is no cheering time.
+ if (!this.cheeringTime)
+ return { "discardOrder": true };
+
this.SetNextState("CHEERING");
+ return false;
},
"enter": function() {
@@ -1930,7 +1940,9 @@ UnitAI.prototype.UnitFsmSpec = {
}
let cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
- this.shouldCheer = cmpUnitAI && (!cmpUnitAI.IsAnimal() || cmpUnitAI.IsDangerousAnimal());
+
+ // Units with no cheering time do not cheer.
+ this.shouldCheer = cmpUnitAI && (!cmpUnitAI.IsAnimal() || cmpUnitAI.IsDangerousAnimal()) && this.cheeringTime > 0;
return false;
},
@@ -2013,7 +2025,11 @@ UnitAI.prototype.UnitFsmSpec = {
"FINDINGNEWTARGET": {
"Order.Cheer": function() {
+ if (!this.cheeringTime)
+ return { "discardOrder": true };
+
this.SetNextState("CHEERING");
+ return false;
},
"enter": function() {
@@ -3043,7 +3059,7 @@ UnitAI.prototype.UnitFsmSpec = {
"CHEERING": {
"enter": function() {
this.SelectAnimation("promotion");
- this.StartTimer(2800);
+ this.StartTimer(this.cheeringTime);
return false;
},
@@ -3279,7 +3295,7 @@ UnitAI.prototype.UnitFsmSpec = {
"CHEERING": {
"enter": function() {
this.SelectAnimation("promotion");
- this.StartTimer(2800);
+ this.StartTimer(this.cheeringTime);
return false;
},
@@ -3328,7 +3344,7 @@ UnitAI.prototype.Init = function()
this.lastHealed = undefined;
this.formationAnimationVariant = undefined;
-
+ this.cheeringTime = +(this.template.CheeringTime || 0);
this.SetStance(this.template.DefaultStance);
};
diff --git a/binaries/data/mods/public/simulation/templates/template_unit.xml b/binaries/data/mods/public/simulation/templates/template_unit.xml
index 9b0ade452e..847f996d93 100644
--- a/binaries/data/mods/public/simulation/templates/template_unit.xml
+++ b/binaries/data/mods/public/simulation/templates/template_unit.xml
@@ -126,6 +126,7 @@
false
true
true
+ 2800
false