Page MenuHomeWildfire Games

Lower number of setdefaultanimation calls in gathering state
ClosedPublic

Authored by Angen on Jan 13 2020, 6:26 PM.

Details

Test Plan

Check that animations are not blinking one over another.

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Angen created this revision.Jan 13 2020, 6:26 PM

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/1026/display/redirect

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/122/display/redirect

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 782| 782| 					this.FinishOrder();
| 783| 783| 					return;
| 784| 784| 				}
| 785|    |-				else
| 786|    |-				{
|    | 785|+				
| 787| 786| 					this.SetNextState("GARRISON.APPROACHING");
| 788| 787| 					return;
| 789|    |-				}
|    | 788|+				
| 790| 789| 			}
| 791| 790| 
| 792| 791| 			this.SetNextState("GARRISON.GARRISONING");
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'GARRISON'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1054|1054| 			},
|1055|1055| 		},
|1056|1056| 
|1057|    |-		"GARRISON":{
|    |1057|+		"GARRISON": {
|1058|1058| 			"APPROACHING": {
|1059|1059| 				"enter": function() {
|1060|1060| 					if (!this.MoveToGarrisonRange(this.order.data.target))
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2032|2032| 
|2033|2033| 				"Attacked": function(msg) {
|2034|2034| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2035|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2036|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2035|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2036|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2037|2037| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2038|2038| 				},
|2039|2039| 			},
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2769|2769| 					{
|2770|2770| 						// The building was already finished/fully repaired before we arrived;
|2771|2771| 						// let the ConstructionFinished handler handle this.
|2772|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2772|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2773|2773| 						return true;
|2774|2774| 					}
|2775|2775| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2769|2769| 					{
|2770|2770| 						// The building was already finished/fully repaired before we arrived;
|2771|2771| 						// let the ConstructionFinished handler handle this.
|2772|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2772|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2773|2773| 						return true;
|2774|2774| 					}
|2775|2775| 
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3067|3067| 				this.StopTimer();
|3068|3068| 				this.ResetAnimation();
|3069|3069| 				if (this.formationAnimationVariant)
|3070|    |-					this.SetAnimationVariant(this.formationAnimationVariant)
|    |3070|+					this.SetAnimationVariant(this.formationAnimationVariant);
|3071|3071| 				else
|3072|3072| 					this.SetDefaultAnimationVariant();
|3073|3073| 				var cmpResistance = Engine.QueryInterface(this.entity, IID_Resistance);
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 7.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3293|3293| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3294|3294| 
|3295|3295| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3296|    |-							// only used for domestic animals
|    |3296|+		// only used for domestic animals
|3297|3297| 	},
|3298|3298| };
|3299|3299| 
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3352|3352| 
|3353|3353| UnitAI.prototype.IsAnimal = function()
|3354|3354| {
|3355|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3355|+	return (!!this.template.NaturalBehaviour);
|3356|3356| };
|3357|3357| 
|3358|3358| UnitAI.prototype.IsDangerousAnimal = function()
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3468|3468| 		{
|3469|3469| 			let index = this.GetCurrentState().indexOf(".");
|3470|3470| 			if (index != -1)
|3471|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3471|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3472|3472| 			this.Stop(false);
|3473|3473| 		}
|3474|3474| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3524|3524| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3525|3525| 			continue;
|3526|3526| 		if (i == 0)
|3527|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3527|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3528|3528| 		else
|3529|3529| 			this.orderQueue.splice(i, 1);
|3530|3530| 		Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3524|3524| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3525|3525| 			continue;
|3526|3526| 		if (i == 0)
|3527|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3527|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3528|3528| 		else
|3529|3529| 			this.orderQueue.splice(i, 1);
|3530|3530| 		Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3608|3608| };
|3609|3609| 
|3610|3610| 
|3611|    |-//// FSM linkage functions ////
|    |3611|+// // FSM linkage functions ////
|3612|3612| 
|3613|3613| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3614|3614| UnitAI.prototype.SetNextState = function(state)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3779|3779| 				continue;
|3780|3780| 			if (this.orderQueue[i].type == type)
|3781|3781| 				continue;
|3782|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3782|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3783|3783| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3784|3784| 			return;
|3785|3785| 		}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3779|3779| 				continue;
|3780|3780| 			if (this.orderQueue[i].type == type)
|3781|3781| 				continue;
|3782|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3782|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3783|3783| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3784|3784| 			return;
|3785|3785| 		}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4021|4021| 	if (data.timerRepeat === undefined)
|4022|4022| 		this.timer = undefined;
|4023|4023| 
|4024|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4024|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4025|4025| };
|4026|4026| 
|4027|4027| /**
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4021|4021| 	if (data.timerRepeat === undefined)
|4022|4022| 		this.timer = undefined;
|4023|4023| 
|4024|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4024|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4025|4025| };
|4026|4026| 
|4027|4027| /**
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4066|4066| 	// TODO: This is a bit inefficient since every unit listens to every
|4067|4067| 	// construction message - ideally we could scope it to only the one we're building
|4068|4068| 
|4069|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4069|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4070|4070| };
|4071|4071| 
|4072|4072| UnitAI.prototype.OnGlobalEntityRenamed = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4066|4066| 	// TODO: This is a bit inefficient since every unit listens to every
|4067|4067| 	// construction message - ideally we could scope it to only the one we're building
|4068|4068| 
|4069|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4069|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4070|4070| };
|4071|4071| 
|4072|4072| UnitAI.prototype.OnGlobalEntityRenamed = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4091|4091| 
|4092|4092| UnitAI.prototype.OnAttacked = function(msg)
|4093|4093| {
|4094|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4094|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4095|4095| };
|4096|4096| 
|4097|4097| UnitAI.prototype.OnGuardedAttacked = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4091|4091| 
|4092|4092| UnitAI.prototype.OnAttacked = function(msg)
|4093|4093| {
|4094|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4094|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4095|4095| };
|4096|4096| 
|4097|4097| UnitAI.prototype.OnGuardedAttacked = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4096|4096| 
|4097|4097| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4098|4098| {
|4099|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4099|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4100|4100| };
|4101|4101| 
|4102|4102| UnitAI.prototype.OnHealthChanged = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4096|4096| 
|4097|4097| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4098|4098| {
|4099|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4099|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4100|4100| };
|4101|4101| 
|4102|4102| UnitAI.prototype.OnHealthChanged = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4101|4101| 
|4102|4102| UnitAI.prototype.OnHealthChanged = function(msg)
|4103|4103| {
|4104|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4104|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4105|4105| };
|4106|4106| 
|4107|4107| UnitAI.prototype.OnRangeUpdate = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4101|4101| 
|4102|4102| UnitAI.prototype.OnHealthChanged = function(msg)
|4103|4103| {
|4104|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4104|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4105|4105| };
|4106|4106| 
|4107|4107| UnitAI.prototype.OnRangeUpdate = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4107|4107| UnitAI.prototype.OnRangeUpdate = function(msg)
|4108|4108| {
|4109|4109| 	if (msg.tag == this.losRangeQuery)
|4110|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4110|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4111|4111| 	else if (msg.tag == this.losHealRangeQuery)
|4112|4112| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4113|4113| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4107|4107| UnitAI.prototype.OnRangeUpdate = function(msg)
|4108|4108| {
|4109|4109| 	if (msg.tag == this.losRangeQuery)
|4110|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4110|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4111|4111| 	else if (msg.tag == this.losHealRangeQuery)
|4112|4112| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4113|4113| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4109|4109| 	if (msg.tag == this.losRangeQuery)
|4110|4110| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4111|4111| 	else if (msg.tag == this.losHealRangeQuery)
|4112|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4112|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4113|4113| };
|4114|4114| 
|4115|4115| UnitAI.prototype.OnPackFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4109|4109| 	if (msg.tag == this.losRangeQuery)
|4110|4110| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4111|4111| 	else if (msg.tag == this.losHealRangeQuery)
|4112|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4112|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4113|4113| };
|4114|4114| 
|4115|4115| UnitAI.prototype.OnPackFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4114|4114| 
|4115|4115| UnitAI.prototype.OnPackFinished = function(msg)
|4116|4116| {
|4117|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4117|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4118|4118| };
|4119|4119| 
|4120|4120| //// Helper functions to be called by the FSM ////
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4114|4114| 
|4115|4115| UnitAI.prototype.OnPackFinished = function(msg)
|4116|4116| {
|4117|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4117|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4118|4118| };
|4119|4119| 
|4120|4120| //// Helper functions to be called by the FSM ////
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4117|4117| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4118|4118| };
|4119|4119| 
|4120|    |-//// Helper functions to be called by the FSM ////
|    |4120|+// // Helper functions to be called by the FSM ////
|4121|4121| 
|4122|4122| UnitAI.prototype.GetWalkSpeed = function()
|4123|4123| {
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4782|4782| UnitAI.prototype.AttackEntityInZone = function(ents)
|4783|4783| {
|4784|4784| 	var target = ents.find(target =>
|4785|    |-		this.CanAttack(target)
|4786|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4785|+		this.CanAttack(target) &&
|    |4786|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4787|4787| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4788|4788| 	);
|4789|4789| 	if (!target)
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4783|4783| {
|4784|4784| 	var target = ents.find(target =>
|4785|4785| 		this.CanAttack(target)
|4786|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4787|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4786|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4787|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4788|4788| 	);
|4789|4789| 	if (!target)
|4790|4790| 		return false;
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before 'Engine'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4847|4847| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4848|4848| 	if (this.isGuardOf)
|4849|4849| 	{
|4850|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4850|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4851|4851| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4852|4852| 		if (cmpUnitAI && cmpAttack &&
|4853|4853| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 4.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4851|4851| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4852|4852| 		if (cmpUnitAI && cmpAttack &&
|4853|4853| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4854|    |-				return false;
|    |4854|+			return false;
|4855|4855| 	}
|4856|4856| 
|4857|4857| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before 'Engine'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4889|4889| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4890|4890| 	if (this.isGuardOf)
|4891|4891| 	{
|4892|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4892|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4893|4893| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4894|4894| 		if (cmpUnitAI && cmpAttack &&
|4895|4895| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4902|4902| 	return false;
|4903|4903| };
|4904|4904| 
|4905|    |-//// External interface functions ////
|    |4905|+// // External interface functions ////
|4906|4906| 
|4907|4907| UnitAI.prototype.SetFormationController = function(ent)
|4908|4908| {
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5058|5058| 	{
|5059|5059| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5060|5060| 			return;
|5061|    |-		else
|5062|    |-			this.RemoveGuard();
|    |5061|+		this.RemoveGuard();
|5063|5062| 	}
|5064|5063| 
|5065|5064| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|    | [NORMAL] ESLintBear (no-trailing-spaces):
|    | Trailing spaces not allowed.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5400|5400| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5401|5401| 	{
|5402|5402| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5403|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5403|+		if (cmpTrader.HasBothMarkets() &&
|5404|5404| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5405|5405| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5406|5406| 		{
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5681|5681| 				{
|5682|5682| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5683|5683| 					var targetClasses = this.order.data.targetClasses;
|5684|    |-					if (targetClasses.attack && cmpIdentity
|5685|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5684|+					if (targetClasses.attack && cmpIdentity &&
|    |5685|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5686|5686| 						continue;
|5687|5687| 					if (targetClasses.avoid && cmpIdentity
|5688|5688| 						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5684|5684| 					if (targetClasses.attack && cmpIdentity
|5685|5685| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5686|5686| 						continue;
|5687|    |-					if (targetClasses.avoid && cmpIdentity
|5688|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5687|+					if (targetClasses.avoid && cmpIdentity &&
|    |5688|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5689|5689| 						continue;
|5690|5690| 					// Only used by the AIs to prevent some choices of targets
|5691|5691| 					if (targetClasses.vetoEntities && targetClasses.vetoEntities[targ])
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5707|5707| 		{
|5708|5708| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5709|5709| 			var targetClasses = this.order.data.targetClasses;
|5710|    |-			if (cmpIdentity && targetClasses.attack
|5711|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5710|+			if (cmpIdentity && targetClasses.attack &&
|    |5711|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5712|5712| 				continue;
|5713|5713| 			if (cmpIdentity && targetClasses.avoid
|5714|5714| 				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5710|5710| 			if (cmpIdentity && targetClasses.attack
|5711|5711| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5712|5712| 				continue;
|5713|    |-			if (cmpIdentity && targetClasses.avoid
|5714|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5713|+			if (cmpIdentity && targetClasses.avoid &&
|    |5714|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5715|5715| 				continue;
|5716|5716| 			// Only used by the AIs to prevent some choices of targets
|5717|5717| 			if (targetClasses.vetoEntities && targetClasses.vetoEntities[targ])
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5867|5867| 
|5868|5868| UnitAI.prototype.SetHeldPosition = function(x, z)
|5869|5869| {
|5870|    |-	this.heldPosition = {"x": x, "z": z};
|    |5870|+	this.heldPosition = { "x": x, "z": z};
|5871|5871| };
|5872|5872| 
|5873|5873| UnitAI.prototype.SetHeldPositionOnEntity = function(entity)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5867|5867| 
|5868|5868| UnitAI.prototype.SetHeldPosition = function(x, z)
|5869|5869| {
|5870|    |-	this.heldPosition = {"x": x, "z": z};
|    |5870|+	this.heldPosition = {"x": x, "z": z };
|5871|5871| };
|5872|5872| 
|5873|5873| UnitAI.prototype.SetHeldPositionOnEntity = function(entity)
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5894|5894| 	return false;
|5895|5895| };
|5896|5896| 
|5897|    |-//// Helper functions ////
|    |5897|+// // Helper functions ////
|5898|5898| 
|5899|5899| UnitAI.prototype.CanAttack = function(target)
|5900|5900| {
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|6098|6098| 	return cmpPack && cmpPack.IsPacking();
|6099|6099| };
|6100|6100| 
|6101|    |-//// Formation specific functions ////
|    |6101|+// // Formation specific functions ////
|6102|6102| 
|6103|6103| UnitAI.prototype.IsAttackingAsFormation = function()
|6104|6104| {
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|6103|6103| UnitAI.prototype.IsAttackingAsFormation = function()
|6104|6104| {
|6105|6105| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6106|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6107|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6106|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6107|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6108|6108| };
|6109|6109| 
|6110|6110| //// Animal specific functions ////
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|6107|6107| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6108|6108| };
|6109|6109| 
|6110|    |-//// Animal specific functions ////
|    |6110|+// // Animal specific functions ////
|6111|6111| 
|6112|6112| UnitAI.prototype.MoveRandomly = function(distance)
|6113|6113| {

binaries/data/mods/public/simulation/components/UnitAI.js
| 338| »   »   »   return·true;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'Order.WalkToTarget' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
|1242| »   »   »   »   return·false;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'Timer' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
|3926| »   var·isWorkType·=·type·=>·type·==·"Gather"·||·type·==·"Trade"·||·type·==·"Repair"·||·type·==·"ReturnResource";
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'type' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|4769| »   var·target·=·ents.find(target·=>·this.CanAttack(target));
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'target' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|4784| »   var·target·=·ents.find(target·=>
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'target' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|4830| »   var·ent·=·ents.find(ent·=>·this.CanHeal(ent));
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'ent' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|4853| »   »   ····cmpAttack.GetAttackTypes().some(type·=>·cmpUnitAI.CheckTargetAttackRange(this.isGuardOf,·type)))
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'type' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|2036| »   »   »   »   »   »   &&·this.order.data.target·!=·msg.data.attacker·&&·this.GetBestAttackAgainst(msg.data.attacker,·true)·!=·"Capture")
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
|3070| »   »   »   »   »   this.SetAnimationVariant(this.formationAnimationVariant)
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

binaries/data/mods/public/simulation/components/UnitAI.js
|3873| »   »   var·order·=·{·"type":·type,·"data":·data·};
|    | [NORMAL] JSHintBear:
|    | 'order' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|3957| »   for·(var·i·=·0;·i·<·this.orderQueue.length;·++i)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|4786| »   »   &&·this.CheckTargetDistanceFromHeldPosition(target,·IID_Attack,·this.GetBestAttackAgainst(target,·true))
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
|4787| »   »   &&·(this.GetStance().respondChaseBeyondVision·||·this.CheckTargetIsInVisionRange(target))
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
|5685| »   »   »   »   »   »   &&·!MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.attack))
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
|5688| »   »   »   »   »   »   &&·MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.avoid))
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
|5701| »   var·targets·=·this.GetTargetsFromUnit();
|    | [NORMAL] JSHintBear:
|    | 'targets' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|5702| »   for·(var·targ·of·targets)
|    | [NORMAL] JSHintBear:
|    | 'targ' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|5708| »   »   »   var·cmpIdentity·=·Engine.QueryInterface(targ,·IID_Identity);
|    | [NORMAL] JSHintBear:
|    | 'cmpIdentity' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|5709| »   »   »   var·targetClasses·=·this.order.data.targetClasses;
|    | [NORMAL] JSHintBear:
|    | 'targetClasses' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|5711| »   »   »   »   &&·!MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.attack))
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
|5714| »   »   »   »   &&·MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.avoid))
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
|5789| »   »   var·cmpVision·=·Engine.QueryInterface(this.entity,·IID_Vision);
|    | [NORMAL] JSHintBear:
|    | 'cmpVision' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|5792| »   »   var·range·=·cmpVision.GetRange();
|    | [NORMAL] JSHintBear:
|    | 'range' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|5797| »   »   var·cmpRanged·=·Engine.QueryInterface(this.entity,·iid);
|    | [NORMAL] JSHintBear:
|    | 'cmpRanged' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|5800| »   »   var·range·=·iid·!==·IID_Attack·?·cmpRanged.GetRange()·:·cmpRanged.GetFullAttackRange();
|    | [NORMAL] JSHintBear:
|    | 'range' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|5801| »   »   var·cmpVision·=·Engine.QueryInterface(this.entity,·IID_Vision);
|    | [NORMAL] JSHintBear:
|    | 'cmpVision' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|5811| »   »   var·cmpVision·=·Engine.QueryInterface(this.entity,·IID_Vision);
|    | [NORMAL] JSHintBear:
|    | 'cmpVision' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|5814| »   »   var·range·=·cmpVision.GetRange();
|    | [NORMAL] JSHintBear:
|    | 'range' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|6107| »   »   &&·this.GetCurrentState()·==·"FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1544/display/redirect

Angen updated this revision to Diff 11243.Sat, Feb 1, 1:57 PM

rebase

Vulcan added a comment.Sat, Feb 1, 1:59 PM

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1691/display/redirect

This revision was not accepted when it landed; it landed in state Needs Review.Sat, Feb 1, 2:47 PM
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.