Page MenuHomeWildfire Games

Abort formation-walking on any message from UnitMotion
ClosedPublic

Authored by wraitii on Jul 12 2020, 10:41 AM.

Details

Summary

Formation members occasionally get an unreachable offset position. They will then try going there repeatedly, stopping only when the formation controller has stopped moving and they have (following rP23806) exhausted the regular fail-and-try-pattern.

However, with formations, this can lead to many units running short paths in short succession, which is laggy. Since formations units remain in formation, it's OK to stop as soon as it looks like the unit is failing to reach its offset (iff the controller has stopped, this is handled by unitMotion not reporting messages then, see rP22464/rP23496).

So, in FORMATIONMEMBER.WALKING, it's better to FinishOrder on any MovementUpdate. This mirrors pre-rP23806 behaviour, since the code was buggy before.
This is arguably a hack, but it's now documented.


Reported by Freagarach on rP23806.
Follows rP22464 & rP23496.

Related to #5624 in that the max-short-path range is the source of the lag.

Test Plan

Run the following replays: and compare lag & behaviour.

Also notice that moving formation members get stuck temporarily but remover once the offset has again become available.

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

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
| 794| 794| 					this.FinishOrder();
| 795| 795| 					return;
| 796| 796| 				}
| 797|    |-				else
| 798|    |-				{
|    | 797|+				
| 799| 798| 					this.SetNextState("GARRISON.APPROACHING");
| 800| 799| 					return;
| 801|    |-				}
|    | 800|+				
| 802| 801| 			}
| 803| 802| 
| 804| 803| 			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
|1058|1058| 			},
|1059|1059| 		},
|1060|1060| 
|1061|    |-		"GARRISON":{
|    |1061|+		"GARRISON": {
|1062|1062| 			"APPROACHING": {
|1063|1063| 				"enter": function() {
|1064|1064| 					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
|2050|2050| 
|2051|2051| 				"Attacked": function(msg) {
|2052|2052| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2053|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2054|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2053|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2054|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2055|2055| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2056|2056| 				},
|2057|2057| 			},
|    | [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
|2209|2209| 					"MovementUpdate": function(msg) {
|2210|2210| 						// If it looks like the path is failing, and we are close enough (3 tiles) from wanted range
|2211|2211| 						// stop anyways. This avoids pathing for an unreachable goal and reduces lag considerably.
|2212|    |-						if (msg.likelyFailure || 
|    |2212|+						if (msg.likelyFailure ||
|2213|2213| 							msg.obstructed && this.RelaxedMaxRangeCheck(this.order.data, this.order.data.max + this.DefaultRelaxedMaxRange) ||
|2214|2214| 							!msg.obstructed && this.CheckRange(this.order.data))
|2215|2215| 							this.FinishOrder();
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 7 tabs but found 6.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2512|2512| 
|2513|2513| 								return type.specific == resourceType.specific &&
|2514|2514| 								    (type.specific != "meat" || resourceTemplate == template);
|2515|    |-						});
|    |2515|+							});
|2516|2516| 
|2517|2517| 						if (nearbyResource)
|2518|2518| 						{
|    | [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
|2844|2844| 					{
|2845|2845| 						// The building was already finished/fully repaired before we arrived;
|2846|2846| 						// let the ConstructionFinished handler handle this.
|2847|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2847|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2848|2848| 						return true;
|2849|2849| 					}
|2850|2850| 
|    | [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
|2844|2844| 					{
|2845|2845| 						// The building was already finished/fully repaired before we arrived;
|2846|2846| 						// let the ConstructionFinished handler handle this.
|2847|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2847|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2848|2848| 						return true;
|2849|2849| 					}
|2850|2850| 
|    | [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
|3134|3134| 				this.StopTimer();
|3135|3135| 				this.ResetAnimation();
|3136|3136| 				if (this.formationAnimationVariant)
|3137|    |-					this.SetAnimationVariant(this.formationAnimationVariant)
|    |3137|+					this.SetAnimationVariant(this.formationAnimationVariant);
|3138|3138| 				else
|3139|3139| 					this.SetDefaultAnimationVariant();
|3140|3140| 				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
|3360|3360| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3361|3361| 
|3362|3362| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3363|    |-							// only used for domestic animals
|    |3363|+		// only used for domestic animals
|3364|3364| 
|3365|3365| 		// Reuse the same garrison behaviour for animals.
|3366|3366| 		"GARRISON": "INDIVIDUAL.GARRISON",
|    | [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
|3412|3412| 
|3413|3413| UnitAI.prototype.IsAnimal = function()
|3414|3414| {
|3415|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3415|+	return (!!this.template.NaturalBehaviour);
|3416|3416| };
|3417|3417| 
|3418|3418| 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
|3552|3552| 		{
|3553|3553| 			let index = this.GetCurrentState().indexOf(".");
|3554|3554| 			if (index != -1)
|3555|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3555|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3556|3556| 			this.Stop(false);
|3557|3557| 		}
|3558|3558| 
|    | [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
|3608|3608| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3609|3609| 			continue;
|3610|3610| 		if (i == 0)
|3611|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3611|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3612|3612| 		else
|3613|3613| 			this.orderQueue.splice(i, 1);
|3614|3614| 		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
|3608|3608| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3609|3609| 			continue;
|3610|3610| 		if (i == 0)
|3611|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3611|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3612|3612| 		else
|3613|3613| 			this.orderQueue.splice(i, 1);
|3614|3614| 		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
|3695|3695| };
|3696|3696| 
|3697|3697| 
|3698|    |-//// FSM linkage functions ////
|    |3698|+// // FSM linkage functions ////
|3699|3699| 
|3700|3700| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3701|3701| 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
|3868|3868| 				continue;
|3869|3869| 			if (this.orderQueue[i].type == type)
|3870|3870| 				continue;
|3871|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3871|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3872|3872| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3873|3873| 			return;
|3874|3874| 		}
|    | [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
|3868|3868| 				continue;
|3869|3869| 			if (this.orderQueue[i].type == type)
|3870|3870| 				continue;
|3871|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3871|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3872|3872| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3873|3873| 			return;
|3874|3874| 		}
|    | [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 (data.timerRepeat === undefined)
|4110|4110| 		this.timer = undefined;
|4111|4111| 
|4112|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4112|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4113|4113| };
|4114|4114| 
|4115|4115| /**
|    | [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 (data.timerRepeat === undefined)
|4110|4110| 		this.timer = undefined;
|4111|4111| 
|4112|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4112|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4113|4113| };
|4114|4114| 
|4115|4115| /**
|    | [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
|4154|4154| 	// TODO: This is a bit inefficient since every unit listens to every
|4155|4155| 	// construction message - ideally we could scope it to only the one we're building
|4156|4156| 
|4157|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4157|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4158|4158| };
|4159|4159| 
|4160|4160| 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
|4154|4154| 	// TODO: This is a bit inefficient since every unit listens to every
|4155|4155| 	// construction message - ideally we could scope it to only the one we're building
|4156|4156| 
|4157|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4157|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4158|4158| };
|4159|4159| 
|4160|4160| 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
|4193|4193| 	if (msg.fromStatusEffect)
|4194|4194| 		return;
|4195|4195| 
|4196|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4196|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4197|4197| };
|4198|4198| 
|4199|4199| 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
|4193|4193| 	if (msg.fromStatusEffect)
|4194|4194| 		return;
|4195|4195| 
|4196|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4196|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4197|4197| };
|4198|4198| 
|4199|4199| 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
|4198|4198| 
|4199|4199| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4200|4200| {
|4201|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4201|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4202|4202| };
|4203|4203| 
|4204|4204| 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
|4198|4198| 
|4199|4199| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4200|4200| {
|4201|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4201|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4202|4202| };
|4203|4203| 
|4204|4204| 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
|4203|4203| 
|4204|4204| UnitAI.prototype.OnHealthChanged = function(msg)
|4205|4205| {
|4206|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4206|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4207|4207| };
|4208|4208| 
|4209|4209| 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
|4203|4203| 
|4204|4204| UnitAI.prototype.OnHealthChanged = function(msg)
|4205|4205| {
|4206|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4206|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4207|4207| };
|4208|4208| 
|4209|4209| 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
|4209|4209| UnitAI.prototype.OnRangeUpdate = function(msg)
|4210|4210| {
|4211|4211| 	if (msg.tag == this.losRangeQuery)
|4212|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4212|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4213|4213| 	else if (msg.tag == this.losHealRangeQuery)
|4214|4214| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4215|4215| };
|    | [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
|4209|4209| UnitAI.prototype.OnRangeUpdate = function(msg)
|4210|4210| {
|4211|4211| 	if (msg.tag == this.losRangeQuery)
|4212|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4212|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4213|4213| 	else if (msg.tag == this.losHealRangeQuery)
|4214|4214| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4215|4215| };
|    | [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
|4211|4211| 	if (msg.tag == this.losRangeQuery)
|4212|4212| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4213|4213| 	else if (msg.tag == this.losHealRangeQuery)
|4214|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4214|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4215|4215| };
|4216|4216| 
|4217|4217| 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
|4211|4211| 	if (msg.tag == this.losRangeQuery)
|4212|4212| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4213|4213| 	else if (msg.tag == this.losHealRangeQuery)
|4214|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4214|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4215|4215| };
|4216|4216| 
|4217|4217| 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
|4216|4216| 
|4217|4217| UnitAI.prototype.OnPackFinished = function(msg)
|4218|4218| {
|4219|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4219|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4220|4220| };
|4221|4221| 
|4222|4222| //// 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
|4216|4216| 
|4217|4217| UnitAI.prototype.OnPackFinished = function(msg)
|4218|4218| {
|4219|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4219|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4220|4220| };
|4221|4221| 
|4222|4222| //// 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
|4219|4219| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4220|4220| };
|4221|4221| 
|4222|    |-//// Helper functions to be called by the FSM ////
|    |4222|+// // Helper functions to be called by the FSM ////
|4223|4223| 
|4224|4224| UnitAI.prototype.GetWalkSpeed = function()
|4225|4225| {
|    | [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
|4949|4949| UnitAI.prototype.AttackEntityInZone = function(ents)
|4950|4950| {
|4951|4951| 	var target = ents.find(target =>
|4952|    |-		this.CanAttack(target)
|4953|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4952|+		this.CanAttack(target) &&
|    |4953|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4954|4954| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4955|4955| 	);
|4956|4956| 	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
|4950|4950| {
|4951|4951| 	var target = ents.find(target =>
|4952|4952| 		this.CanAttack(target)
|4953|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4954|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4953|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4954|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4955|4955| 	);
|4956|4956| 	if (!target)
|4957|4957| 		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
|5016|5016| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|5017|5017| 	if (this.isGuardOf)
|5018|5018| 	{
|5019|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |5019|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|5020|5020| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|5021|5021| 		if (cmpUnitAI && cmpAttack &&
|5022|5022| 		    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
|5020|5020| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|5021|5021| 		if (cmpUnitAI && cmpAttack &&
|5022|5022| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|5023|    |-				return false;
|    |5023|+			return false;
|5024|5024| 	}
|5025|5025| 
|5026|5026| 	// 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
|5058|5058| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|5059|5059| 	if (this.isGuardOf)
|5060|5060| 	{
|5061|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |5061|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|5062|5062| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|5063|5063| 		if (cmpUnitAI && cmpAttack &&
|5064|5064| 		    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
|5071|5071| 	return false;
|5072|5072| };
|5073|5073| 
|5074|    |-//// External interface functions ////
|    |5074|+// // External interface functions ////
|5075|5075| 
|5076|5076| UnitAI.prototype.SetFormationController = function(ent)
|5077|5077| {
|    | [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
|5227|5227| 	{
|5228|5228| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5229|5229| 			return;
|5230|    |-		else
|5231|    |-			this.RemoveGuard();
|    |5230|+		this.RemoveGuard();
|5232|5231| 	}
|5233|5232| 
|5234|5233| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|    | [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
|5561|5561| 
|5562|5562| 	if (this.IsFormationController())
|5563|5563| 		this.CallMemberFunction("CancelSetupTradeRoute", [target]);
|5564|    |-}
|    |5564|+};
|5565|5565| /**
|5566|5566|  * Adds trade order to the queue. Either walk to the first market, or
|5567|5567|  * start a new route. Not forced, so it can be interrupted by attacks.
|    | [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
|5582|5582| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5583|5583| 	{
|5584|5584| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5585|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5585|+		if (cmpTrader.HasBothMarkets() &&
|5586|5586| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5587|5587| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5588|5588| 		{
|    | [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
|5863|5863| 				{
|5864|5864| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5865|5865| 					var targetClasses = this.order.data.targetClasses;
|5866|    |-					if (targetClasses.attack && cmpIdentity
|5867|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5866|+					if (targetClasses.attack && cmpIdentity &&
|    |5867|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5868|5868| 						continue;
|5869|5869| 					if (targetClasses.avoid && cmpIdentity
|5870|5870| 						&& 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
|5866|5866| 					if (targetClasses.attack && cmpIdentity
|5867|5867| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5868|5868| 						continue;
|5869|    |-					if (targetClasses.avoid && cmpIdentity
|5870|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5869|+					if (targetClasses.avoid && cmpIdentity &&
|    |5870|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5871|5871| 						continue;
|5872|5872| 					// Only used by the AIs to prevent some choices of targets
|5873|5873| 					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
|5889|5889| 		{
|5890|5890| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5891|5891| 			var targetClasses = this.order.data.targetClasses;
|5892|    |-			if (cmpIdentity && targetClasses.attack
|5893|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5892|+			if (cmpIdentity && targetClasses.attack &&
|    |5893|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5894|5894| 				continue;
|5895|5895| 			if (cmpIdentity && targetClasses.avoid
|5896|5896| 				&& 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
|5892|5892| 			if (cmpIdentity && targetClasses.attack
|5893|5893| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5894|5894| 				continue;
|5895|    |-			if (cmpIdentity && targetClasses.avoid
|5896|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5895|+			if (cmpIdentity && targetClasses.avoid &&
|    |5896|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5897|5897| 				continue;
|5898|5898| 			// Only used by the AIs to prevent some choices of targets
|5899|5899| 			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
|6052|6052| 
|6053|6053| UnitAI.prototype.SetHeldPosition = function(x, z)
|6054|6054| {
|6055|    |-	this.heldPosition = {"x": x, "z": z};
|    |6055|+	this.heldPosition = { "x": x, "z": z};
|6056|6056| };
|6057|6057| 
|6058|6058| 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
|6052|6052| 
|6053|6053| UnitAI.prototype.SetHeldPosition = function(x, z)
|6054|6054| {
|6055|    |-	this.heldPosition = {"x": x, "z": z};
|    |6055|+	this.heldPosition = {"x": x, "z": z };
|6056|6056| };
|6057|6057| 
|6058|6058| 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
|6079|6079| 	return false;
|6080|6080| };
|6081|6081| 
|6082|    |-//// Helper functions ////
|    |6082|+// // Helper functions ////
|6083|6083| 
|6084|6084| /**
|6085|6085|  * General getter for ranges.
|    | [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
|6098|6098| 		return undefined;
|6099|6099| 
|6100|6100| 	return component.GetRange(type);
|6101|    |-}
|    |6101|+};
|6102|6102| 
|6103|6103| UnitAI.prototype.CanAttack = function(target)
|6104|6104| {
|    | [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
|6274|6274| 	return cmpPack && cmpPack.IsPacking();
|6275|6275| };
|6276|6276| 
|6277|    |-//// Formation specific functions ////
|    |6277|+// // Formation specific functions ////
|6278|6278| 
|6279|6279| UnitAI.prototype.IsAttackingAsFormation = function()
|6280|6280| {
|    | [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
|6279|6279| UnitAI.prototype.IsAttackingAsFormation = function()
|6280|6280| {
|6281|6281| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6282|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6283|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6282|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6283|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6284|6284| };
|6285|6285| 
|6286|6286| //// 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
|6283|6283| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6284|6284| };
|6285|6285| 
|6286|    |-//// Animal specific functions ////
|    |6286|+// // Animal specific functions ////
|6287|6287| 
|6288|6288| UnitAI.prototype.MoveRandomly = function(distance)
|6289|6289| {

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4014| »   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
|4936| »   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
|4951| »   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
|4999| »   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
|5022| »   »   ····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
|2054| »   »   »   »   »   »   &&·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
|3137| »   »   »   »   »   this.SetAnimationVariant(this.formationAnimationVariant)
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4953| »   »   &&·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
|4954| »   »   &&·(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
|5564| }
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

binaries/data/mods/public/simulation/components/UnitAI.js
|5867| »   »   »   »   »   »   &&·!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
|5870| »   »   »   »   »   »   &&·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
|5883| »   var·targets·=·this.GetTargetsFromUnit();
|    | [NORMAL] JSHintBear:
|    | 'targets' is already defined.

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|5893| »   »   »   »   &&·!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
|5896| »   »   »   »   &&·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
|6101| }
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

binaries/data/mods/public/simulation/components/UnitAI.js
|6283| »   »   &&·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/2619/display/redirect

Freagarach added subscribers: Silier, Freagarach.

This indeed removes the lag :)

(Adding @Angen as a reviewer because formations.)

Silier added inline comments.Jul 17 2020, 3:20 PM
binaries/data/mods/public/simulation/components/UnitAI.js
1382 ↗(On Diff #12633)

do not we get notified when "obstructed" as well ?

wraitii added inline comments.Jul 17 2020, 3:24 PM
binaries/data/mods/public/simulation/components/UnitAI.js
1382 ↗(On Diff #12633)

Mh, you appear to be correct, but I guess we should fix that in UnitMotion, as an oversight of rP23496

wraitii updated this revision to Diff 12756.Jul 17 2020, 4:11 PM

Don't message on obstruction either.

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
| 794| 794| 					this.FinishOrder();
| 795| 795| 					return;
| 796| 796| 				}
| 797|    |-				else
| 798|    |-				{
|    | 797|+				
| 799| 798| 					this.SetNextState("GARRISON.APPROACHING");
| 800| 799| 					return;
| 801|    |-				}
|    | 800|+				
| 802| 801| 			}
| 803| 802| 
| 804| 803| 			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
|1058|1058| 			},
|1059|1059| 		},
|1060|1060| 
|1061|    |-		"GARRISON":{
|    |1061|+		"GARRISON": {
|1062|1062| 			"APPROACHING": {
|1063|1063| 				"enter": function() {
|1064|1064| 					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
|2050|2050| 
|2051|2051| 				"Attacked": function(msg) {
|2052|2052| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2053|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2054|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2053|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2054|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2055|2055| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2056|2056| 				},
|2057|2057| 			},
|    | [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
|2209|2209| 					"MovementUpdate": function(msg) {
|2210|2210| 						// If it looks like the path is failing, and we are close enough (3 tiles) from wanted range
|2211|2211| 						// stop anyways. This avoids pathing for an unreachable goal and reduces lag considerably.
|2212|    |-						if (msg.likelyFailure || 
|    |2212|+						if (msg.likelyFailure ||
|2213|2213| 							msg.obstructed && this.RelaxedMaxRangeCheck(this.order.data, this.order.data.max + this.DefaultRelaxedMaxRange) ||
|2214|2214| 							!msg.obstructed && this.CheckRange(this.order.data))
|2215|2215| 							this.FinishOrder();
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 7 tabs but found 6.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2512|2512| 
|2513|2513| 								return type.specific == resourceType.specific &&
|2514|2514| 								    (type.specific != "meat" || resourceTemplate == template);
|2515|    |-						});
|    |2515|+							});
|2516|2516| 
|2517|2517| 						if (nearbyResource)
|2518|2518| 						{
|    | [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
|2844|2844| 					{
|2845|2845| 						// The building was already finished/fully repaired before we arrived;
|2846|2846| 						// let the ConstructionFinished handler handle this.
|2847|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2847|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2848|2848| 						return true;
|2849|2849| 					}
|2850|2850| 
|    | [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
|2844|2844| 					{
|2845|2845| 						// The building was already finished/fully repaired before we arrived;
|2846|2846| 						// let the ConstructionFinished handler handle this.
|2847|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2847|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2848|2848| 						return true;
|2849|2849| 					}
|2850|2850| 
|    | [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
|3134|3134| 				this.StopTimer();
|3135|3135| 				this.ResetAnimation();
|3136|3136| 				if (this.formationAnimationVariant)
|3137|    |-					this.SetAnimationVariant(this.formationAnimationVariant)
|    |3137|+					this.SetAnimationVariant(this.formationAnimationVariant);
|3138|3138| 				else
|3139|3139| 					this.SetDefaultAnimationVariant();
|3140|3140| 				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
|3360|3360| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3361|3361| 
|3362|3362| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3363|    |-							// only used for domestic animals
|    |3363|+		// only used for domestic animals
|3364|3364| 
|3365|3365| 		// Reuse the same garrison behaviour for animals.
|3366|3366| 		"GARRISON": "INDIVIDUAL.GARRISON",
|    | [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
|3412|3412| 
|3413|3413| UnitAI.prototype.IsAnimal = function()
|3414|3414| {
|3415|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3415|+	return (!!this.template.NaturalBehaviour);
|3416|3416| };
|3417|3417| 
|3418|3418| 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
|3552|3552| 		{
|3553|3553| 			let index = this.GetCurrentState().indexOf(".");
|3554|3554| 			if (index != -1)
|3555|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3555|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3556|3556| 			this.Stop(false);
|3557|3557| 		}
|3558|3558| 
|    | [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
|3608|3608| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3609|3609| 			continue;
|3610|3610| 		if (i == 0)
|3611|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3611|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3612|3612| 		else
|3613|3613| 			this.orderQueue.splice(i, 1);
|3614|3614| 		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
|3608|3608| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3609|3609| 			continue;
|3610|3610| 		if (i == 0)
|3611|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3611|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3612|3612| 		else
|3613|3613| 			this.orderQueue.splice(i, 1);
|3614|3614| 		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
|3695|3695| };
|3696|3696| 
|3697|3697| 
|3698|    |-//// FSM linkage functions ////
|    |3698|+// // FSM linkage functions ////
|3699|3699| 
|3700|3700| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3701|3701| 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
|3868|3868| 				continue;
|3869|3869| 			if (this.orderQueue[i].type == type)
|3870|3870| 				continue;
|3871|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3871|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3872|3872| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3873|3873| 			return;
|3874|3874| 		}
|    | [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
|3868|3868| 				continue;
|3869|3869| 			if (this.orderQueue[i].type == type)
|3870|3870| 				continue;
|3871|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3871|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3872|3872| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3873|3873| 			return;
|3874|3874| 		}
|    | [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 (data.timerRepeat === undefined)
|4110|4110| 		this.timer = undefined;
|4111|4111| 
|4112|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4112|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4113|4113| };
|4114|4114| 
|4115|4115| /**
|    | [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 (data.timerRepeat === undefined)
|4110|4110| 		this.timer = undefined;
|4111|4111| 
|4112|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4112|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4113|4113| };
|4114|4114| 
|4115|4115| /**
|    | [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
|4154|4154| 	// TODO: This is a bit inefficient since every unit listens to every
|4155|4155| 	// construction message - ideally we could scope it to only the one we're building
|4156|4156| 
|4157|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4157|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4158|4158| };
|4159|4159| 
|4160|4160| 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
|4154|4154| 	// TODO: This is a bit inefficient since every unit listens to every
|4155|4155| 	// construction message - ideally we could scope it to only the one we're building
|4156|4156| 
|4157|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4157|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4158|4158| };
|4159|4159| 
|4160|4160| 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
|4193|4193| 	if (msg.fromStatusEffect)
|4194|4194| 		return;
|4195|4195| 
|4196|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4196|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4197|4197| };
|4198|4198| 
|4199|4199| 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
|4193|4193| 	if (msg.fromStatusEffect)
|4194|4194| 		return;
|4195|4195| 
|4196|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4196|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4197|4197| };
|4198|4198| 
|4199|4199| 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
|4198|4198| 
|4199|4199| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4200|4200| {
|4201|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4201|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4202|4202| };
|4203|4203| 
|4204|4204| 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
|4198|4198| 
|4199|4199| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4200|4200| {
|4201|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4201|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4202|4202| };
|4203|4203| 
|4204|4204| 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
|4203|4203| 
|4204|4204| UnitAI.prototype.OnHealthChanged = function(msg)
|4205|4205| {
|4206|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4206|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4207|4207| };
|4208|4208| 
|4209|4209| 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
|4203|4203| 
|4204|4204| UnitAI.prototype.OnHealthChanged = function(msg)
|4205|4205| {
|4206|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4206|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4207|4207| };
|4208|4208| 
|4209|4209| 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
|4209|4209| UnitAI.prototype.OnRangeUpdate = function(msg)
|4210|4210| {
|4211|4211| 	if (msg.tag == this.losRangeQuery)
|4212|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4212|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4213|4213| 	else if (msg.tag == this.losHealRangeQuery)
|4214|4214| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4215|4215| };
|    | [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
|4209|4209| UnitAI.prototype.OnRangeUpdate = function(msg)
|4210|4210| {
|4211|4211| 	if (msg.tag == this.losRangeQuery)
|4212|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4212|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4213|4213| 	else if (msg.tag == this.losHealRangeQuery)
|4214|4214| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4215|4215| };
|    | [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
|4211|4211| 	if (msg.tag == this.losRangeQuery)
|4212|4212| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4213|4213| 	else if (msg.tag == this.losHealRangeQuery)
|4214|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4214|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4215|4215| };
|4216|4216| 
|4217|4217| 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
|4211|4211| 	if (msg.tag == this.losRangeQuery)
|4212|4212| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4213|4213| 	else if (msg.tag == this.losHealRangeQuery)
|4214|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4214|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4215|4215| };
|4216|4216| 
|4217|4217| 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
|4216|4216| 
|4217|4217| UnitAI.prototype.OnPackFinished = function(msg)
|4218|4218| {
|4219|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4219|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4220|4220| };
|4221|4221| 
|4222|4222| //// 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
|4216|4216| 
|4217|4217| UnitAI.prototype.OnPackFinished = function(msg)
|4218|4218| {
|4219|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4219|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4220|4220| };
|4221|4221| 
|4222|4222| //// 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
|4219|4219| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4220|4220| };
|4221|4221| 
|4222|    |-//// Helper functions to be called by the FSM ////
|    |4222|+// // Helper functions to be called by the FSM ////
|4223|4223| 
|4224|4224| UnitAI.prototype.GetWalkSpeed = function()
|4225|4225| {
|    | [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
|4949|4949| UnitAI.prototype.AttackEntityInZone = function(ents)
|4950|4950| {
|4951|4951| 	var target = ents.find(target =>
|4952|    |-		this.CanAttack(target)
|4953|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4952|+		this.CanAttack(target) &&
|    |4953|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4954|4954| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4955|4955| 	);
|4956|4956| 	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
|4950|4950| {
|4951|4951| 	var target = ents.find(target =>
|4952|4952| 		this.CanAttack(target)
|4953|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4954|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4953|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4954|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4955|4955| 	);
|4956|4956| 	if (!target)
|4957|4957| 		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
|5016|5016| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|5017|5017| 	if (this.isGuardOf)
|5018|5018| 	{
|5019|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |5019|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|5020|5020| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|5021|5021| 		if (cmpUnitAI && cmpAttack &&
|5022|5022| 		    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
|5020|5020| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|5021|5021| 		if (cmpUnitAI && cmpAttack &&
|5022|5022| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|5023|    |-				return false;
|    |5023|+			return false;
|5024|5024| 	}
|5025|5025| 
|5026|5026| 	// 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
|5058|5058| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|5059|5059| 	if (this.isGuardOf)
|5060|5060| 	{
|5061|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |5061|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|5062|5062| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|5063|5063| 		if (cmpUnitAI && cmpAttack &&
|5064|5064| 		    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
|5071|5071| 	return false;
|5072|5072| };
|5073|5073| 
|5074|    |-//// External interface functions ////
|    |5074|+// // External interface functions ////
|5075|5075| 
|5076|5076| UnitAI.prototype.SetFormationController = function(ent)
|5077|5077| {
|    | [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
|5227|5227| 	{
|5228|5228| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5229|5229| 			return;
|5230|    |-		else
|5231|    |-			this.RemoveGuard();
|    |5230|+		this.RemoveGuard();
|5232|5231| 	}
|5233|5232| 
|5234|5233| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|    | [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
|5561|5561| 
|5562|5562| 	if (this.IsFormationController())
|5563|5563| 		this.CallMemberFunction("CancelSetupTradeRoute", [target]);
|5564|    |-}
|    |5564|+};
|5565|5565| /**
|5566|5566|  * Adds trade order to the queue. Either walk to the first market, or
|5567|5567|  * start a new route. Not forced, so it can be interrupted by attacks.
|    | [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
|5582|5582| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5583|5583| 	{
|5584|5584| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5585|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5585|+		if (cmpTrader.HasBothMarkets() &&
|5586|5586| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5587|5587| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5588|5588| 		{
|    | [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
|5863|5863| 				{
|5864|5864| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5865|5865| 					var targetClasses = this.order.data.targetClasses;
|5866|    |-					if (targetClasses.attack && cmpIdentity
|5867|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5866|+					if (targetClasses.attack && cmpIdentity &&
|    |5867|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5868|5868| 						continue;
|5869|5869| 					if (targetClasses.avoid && cmpIdentity
|5870|5870| 						&& 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
|5866|5866| 					if (targetClasses.attack && cmpIdentity
|5867|5867| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5868|5868| 						continue;
|5869|    |-					if (targetClasses.avoid && cmpIdentity
|5870|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5869|+					if (targetClasses.avoid && cmpIdentity &&
|    |5870|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5871|5871| 						continue;
|5872|5872| 					// Only used by the AIs to prevent some choices of targets
|5873|5873| 					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
|5889|5889| 		{
|5890|5890| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5891|5891| 			var targetClasses = this.order.data.targetClasses;
|5892|    |-			if (cmpIdentity && targetClasses.attack
|5893|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5892|+			if (cmpIdentity && targetClasses.attack &&
|    |5893|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5894|5894| 				continue;
|5895|5895| 			if (cmpIdentity && targetClasses.avoid
|5896|5896| 				&& 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
|5892|5892| 			if (cmpIdentity && targetClasses.attack
|5893|5893| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5894|5894| 				continue;
|5895|    |-			if (cmpIdentity && targetClasses.avoid
|5896|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5895|+			if (cmpIdentity && targetClasses.avoid &&
|    |5896|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5897|5897| 				continue;
|5898|5898| 			// Only used by the AIs to prevent some choices of targets
|5899|5899| 			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
|6052|6052| 
|6053|6053| UnitAI.prototype.SetHeldPosition = function(x, z)
|6054|6054| {
|6055|    |-	this.heldPosition = {"x": x, "z": z};
|    |6055|+	this.heldPosition = { "x": x, "z": z};
|6056|6056| };
|6057|6057| 
|6058|6058| 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
|6052|6052| 
|6053|6053| UnitAI.prototype.SetHeldPosition = function(x, z)
|6054|6054| {
|6055|    |-	this.heldPosition = {"x": x, "z": z};
|    |6055|+	this.heldPosition = {"x": x, "z": z };
|6056|6056| };
|6057|6057| 
|6058|6058| 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
|6079|6079| 	return false;
|6080|6080| };
|6081|6081| 
|6082|    |-//// Helper functions ////
|    |6082|+// // Helper functions ////
|6083|6083| 
|6084|6084| /**
|6085|6085|  * General getter for ranges.
|    | [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
|6098|6098| 		return undefined;
|6099|6099| 
|6100|6100| 	return component.GetRange(type);
|6101|    |-}
|    |6101|+};
|6102|6102| 
|6103|6103| UnitAI.prototype.CanAttack = function(target)
|6104|6104| {
|    | [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
|6274|6274| 	return cmpPack && cmpPack.IsPacking();
|6275|6275| };
|6276|6276| 
|6277|    |-//// Formation specific functions ////
|    |6277|+// // Formation specific functions ////
|6278|6278| 
|6279|6279| UnitAI.prototype.IsAttackingAsFormation = function()
|6280|6280| {
|    | [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
|6279|6279| UnitAI.prototype.IsAttackingAsFormation = function()
|6280|6280| {
|6281|6281| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6282|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6283|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6282|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6283|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6284|6284| };
|6285|6285| 
|6286|6286| //// 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
|6283|6283| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6284|6284| };
|6285|6285| 
|6286|    |-//// Animal specific functions ////
|    |6286|+// // Animal specific functions ////
|6287|6287| 
|6288|6288| UnitAI.prototype.MoveRandomly = function(distance)
|6289|6289| {

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4014| »   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
|4936| »   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
|4951| »   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
|4999| »   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
|5022| »   »   ····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
|2054| »   »   »   »   »   »   &&·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
|3137| »   »   »   »   »   this.SetAnimationVariant(this.formationAnimationVariant)
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4953| »   »   &&·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
|4954| »   »   &&·(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
|5564| }
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

binaries/data/mods/public/simulation/components/UnitAI.js
|5867| »   »   »   »   »   »   &&·!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
|5870| »   »   »   »   »   »   &&·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
|5883| »   var·targets·=·this.GetTargetsFromUnit();
|    | [NORMAL] JSHintBear:
|    | 'targets' is already defined.

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|5893| »   »   »   »   &&·!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
|5896| »   »   »   »   &&·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
|6101| }
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

binaries/data/mods/public/simulation/components/UnitAI.js
|6283| »   »   &&·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/2687/display/redirect

I did not find broken formation behaviour.
After discussion on irc, this is reasonable behaviour.
Since while formation is moving, next goal will be moved so no need to stop and we will not spam unitmotion with useless request.

One question about aborting on obstructed message.
When forming formation, formation controller is not moving, so its members will abort movement on any obstruction, but could not create this situation.

In D2871#124702, @Angen wrote:

When forming formation, formation controller is not moving, so its members will abort movement on any obstruction, but could not create this situation.

Correct. However, I have been (too?) clever in UnitMotion and I only send "Obstructed" messages if the units is obstructed twice.
This avoids generally these very spurious 'obstructed' messages, and so in general units do manage to reach the intended target in a "not actually obstructed" situation.
Further, units in formations don't collide with each other, so you'd need an area full of units to really get in trouble, but at that point it's more acceptable to fail.
(The check in HandleObstructedMove checks for if (m_FailedPathComputations >= 1))

Silier accepted this revision.Jul 21 2020, 8:01 PM

I moved formation through choke-points, elevation-choke-points, forest, reformed multiple times, engaged in combat.
All units responded to formation movement.

This revision is now accepted and ready to land.Jul 21 2020, 8:01 PM
This revision was automatically updated to reflect the committed changes.