Page MenuHomeWildfire Games

Unit Motion - improve PathResult/Obstructed move handling
ClosedPublic

Authored by wraitii on May 19 2019, 5:03 PM.

Details

Reviewers
None
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Commits
rP22464: Unit Motion - improve PathResult/Obstructed move handling
Summary

Short Paths should be used to get around units. The current logic is not very explicit in that regards. By improving it a bit, we can reduce the number of units that get stuck in odd situations, and clarify the code flow.

Test Plan

Compile and review ingame

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

wraitii created this revision.May 19 2019, 5:03 PM

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

Link to build: https://jenkins.wildfiregames.com/job/differential/1459/display/redirect

wraitii updated this revision to Diff 8847.Jul 12 2019, 6:17 PM

Rebased, some changes for consistency.

This introduces a counter for how many times we're failing to find path before informing other components, so that units will fail but will be somewhat resilient.

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 352| 352| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 353| 353| 		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 354| 354| 		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 355|    |-		{
|    | 355|+		
| 356| 356| 			// we were already on the shoreline, and have not moved since
| 357| 357| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
| 358| 358| 				needToMove = false;
| 359|    |-		}
|    | 359|+		
| 360| 360| 
| 361| 361| 		if (needToMove)
| 362| 362| 			this.SetNextState("INDIVIDUAL.PICKUP.APPROACHING");
|    | [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
| 350| 350| 		// Check if we need to move     TODO implement a better way to know if we are on the shoreline
| 351| 351| 		var needToMove = true;
| 352| 352| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 353|    |-		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 354|    |-		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
|    | 353|+		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x) &&
|    | 354|+		    (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 355| 355| 		{
| 356| 356| 			// we were already on the shoreline, and have not moved since
| 357| 357| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 517| 517| 					this.PushOrderFront("Walk", this.order.data.lastPos);
| 518| 518| 				}
| 519| 519| 				else
| 520|    |-				{
|    | 520|+				
| 521| 521| 					// We couldn't move there, or the target moved away
| 522| 522| 					this.FinishOrder();
| 523|    |-				}
|    | 523|+				
| 524| 524| 				return;
| 525| 525| 			}
| 526| 526| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 736| 736| 			}
| 737| 737| 			// Check if we are already in range, otherwise walk there
| 738| 738| 			if (!this.CheckGarrisonRange(msg.data.target))
| 739|    |-			{
|    | 739|+			
| 740| 740| 				if (!this.CheckTargetVisible(msg.data.target))
| 741| 741| 				{
| 742| 742| 					this.FinishOrder();
| 747| 747| 					this.SetNextState("GARRISON.APPROACHING");
| 748| 748| 					return;
| 749| 749| 				}
| 750|    |-			}
|    | 750|+			
| 751| 751| 
| 752| 752| 			this.SetNextState("GARRISON.GARRISONING");
| 753| 753| 		},
|    | [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
| 742| 742| 					this.FinishOrder();
| 743| 743| 					return;
| 744| 744| 				}
| 745|    |-				else
| 746|    |-				{
|    | 745|+				
| 747| 746| 					this.SetNextState("GARRISON.APPROACHING");
| 748| 747| 					return;
| 749|    |-				}
|    | 748|+				
| 750| 749| 			}
| 751| 750| 
| 752| 751| 			this.SetNextState("GARRISON.GARRISONING");
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 765| 765| 						this.PushOrderFront("Walk", msg.data.lastPos);
| 766| 766| 					}
| 767| 767| 					else
| 768|    |-					{
|    | 768|+					
| 769| 769| 						// We couldn't move there, or the target moved away
| 770| 770| 						this.FinishOrder();
| 771|    |-					}
|    | 771|+					
| 772| 772| 					return;
| 773| 773| 				}
| 774| 774| 
|    | [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
| 998| 998| 			},
| 999| 999| 		},
|1000|1000| 
|1001|    |-		"GARRISON":{
|    |1001|+		"GARRISON": {
|1002|1002| 			"enter": function() {
|1003|1003| 				// If the garrisonholder should pickup, warn it so it can take needed action
|1004|1004| 				var cmpGarrisonHolder = Engine.QueryInterface(this.order.data.target, IID_GarrisonHolder);
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1211|1211| 			// If the controller handled an order but some members rejected it,
|1212|1212| 			// they will have no orders and be in the FORMATIONMEMBER.IDLE state.
|1213|1213| 			if (this.orderQueue.length)
|1214|    |-			{
|    |1214|+			
|1215|1215| 				// We're leaving the formation, so stop our FormationWalk order
|1216|1216| 				if (this.FinishOrder())
|1217|1217| 					return;
|1218|    |-			}
|    |1218|+			
|1219|1219| 
|1220|1220| 			// No orders left, we're an individual now
|1221|1221| 			this.SetNextState("INDIVIDUAL.IDLE");
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1236|1236| 			// Move a tile outside the building
|1237|1237| 			let range = 4;
|1238|1238| 			if (this.CheckTargetRangeExplicit(msg.data.target, range, -1))
|1239|    |-			{
|    |1239|+			
|1240|1240| 				// We are already at the target, or can't move at all
|1241|1241| 				this.FinishOrder();
|1242|    |-			}
|    |1242|+			
|1243|1243| 			else
|1244|1244| 			{
|1245|1245| 				this.order.data.min = range;
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1465|1465| 
|1466|1466| 			"LosRangeUpdate": function(msg) {
|1467|1467| 				if (this.GetStance().targetVisibleEnemies)
|1468|    |-				{
|    |1468|+				
|1469|1469| 					// Start attacking one of the newly-seen enemy (if any)
|1470|1470| 					this.AttackEntitiesByPreference(msg.data.added);
|1471|    |-				}
|    |1471|+				
|1472|1472| 			},
|1473|1473| 
|1474|1474| 			"LosHealRangeUpdate": function(msg) {
|    | [NORMAL] ESLintBear (space-before-function-paren):
|    | Unexpected space before function parentheses.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1493|1493| 				}
|1494|1494| 			},
|1495|1495| 
|1496|    |-			"leave": function () {
|    |1496|+			"leave": function() {
|1497|1497| 				this.StopMoving();
|1498|1498| 			},
|1499|1499| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1668|1668| 						// if nothing better to do, check if the guarded needs to be healed or repaired
|1669|1669| 						var cmpHealth = Engine.QueryInterface(this.isGuardOf, IID_Health);
|1670|1670| 						if (cmpHealth && cmpHealth.IsInjured())
|1671|    |-						{
|    |1671|+						
|1672|1672| 							if (this.CanHeal(this.isGuardOf))
|1673|1673| 								this.PushOrderFront("Heal", { "target": this.isGuardOf, "force": false });
|1674|1674| 							else if (this.CanRepair(this.isGuardOf))
|1675|1675| 								this.PushOrderFront("Repair", { "target": this.isGuardOf, "autocontinue": false, "force": false });
|1676|    |-						}
|    |1676|+						
|1677|1677| 					}
|1678|1678| 				},
|1679|1679| 
|    | [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
|1950|1950| 
|1951|1951| 				"Attacked": function(msg) {
|1952|1952| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|1953|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|1954|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |1953|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |1954|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|1955|1955| 						this.RespondToTargetedEntities([msg.data.attacker]);
|1956|1956| 				},
|1957|1957| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2002|2002| 
|2003|2003| 					var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|2004|2004| 					if (cmpUnitAI && cmpUnitAI.IsFleeing())
|2005|    |-					{
|    |2005|+					
|2006|2006| 						// Run after a fleeing target
|2007|2007| 						this.SetSpeedMultiplier(this.GetRunMultiplier());
|2008|    |-					}
|    |2008|+					
|2009|2009| 					this.StartTimer(1000, 1000);
|2010|2010| 				},
|2011|2011| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2353|2353| 
|2354|2354| 				"Timer": function(msg) {
|2355|2355| 					if (this.ShouldAbandonChase(this.order.data.target, this.order.data.force, IID_Heal, null))
|2356|    |-					{
|    |2356|+					
|2357|2357| 						// Return to our original position unless we have a better order.
|2358|2358| 						if (!this.FinishOrder() && this.GetStance().respondHoldGround)
|2359|2359| 							this.WalkToHeldPosition();
|2360|    |-					}
|    |2360|+					
|2361|2361| 				},
|2362|2362| 
|2363|2363| 				"MovementUpdate": function() {
|    | [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
|2387|2387| 					this.StartTimer(prepare, this.healTimers.repeat);
|2388|2388| 
|2389|2389| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2390|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2390|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2391|2391| 
|2392|2392| 					this.FaceTowardsTarget(this.order.data.target);
|2393|2393| 				},
|    | [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
|2595|2595| 					{
|2596|2596| 						// The building was already finished/fully repaired before we arrived;
|2597|2597| 						// let the ConstructionFinished handler handle this.
|2598|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2598|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2599|2599| 						return true;
|2600|2600| 					}
|2601|2601| 
|    | [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
|2595|2595| 					{
|2596|2596| 						// The building was already finished/fully repaired before we arrived;
|2597|2597| 						// let the ConstructionFinished handler handle this.
|2598|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2598|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2599|2599| 						return true;
|2600|2600| 					}
|2601|2601| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2980|2980| 		"Attacked": function(msg) {
|2981|2981| 			if (this.template.NaturalBehaviour == "skittish" ||
|2982|2982| 			    this.template.NaturalBehaviour == "passive")
|2983|    |-			{
|    |2983|+			
|2984|2984| 				this.Flee(msg.data.attacker, false);
|2985|    |-			}
|    |2985|+			
|2986|2986| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|2987|2987| 			{
|2988|2988| 				if (this.CanAttack(msg.data.attacker))
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2989|2989| 					this.Attack(msg.data.attacker, false);
|2990|2990| 			}
|2991|2991| 			else if (this.template.NaturalBehaviour == "domestic")
|2992|    |-			{
|    |2992|+			
|2993|2993| 				// Never flee, stop what we were doing
|2994|2994| 				this.SetNextState("IDLE");
|2995|    |-			}
|    |2995|+			
|2996|2996| 		},
|2997|2997| 
|2998|2998| 		"Order.LeaveFoundation": function(msg) {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3043|3043| 				}
|3044|3044| 				// Start attacking one of the newly-seen enemy (if any)
|3045|3045| 				else if (this.IsDangerousAnimal())
|3046|    |-				{
|    |3046|+				
|3047|3047| 					this.AttackVisibleEntity(msg.data.added);
|3048|    |-				}
|    |3048|+				
|3049|3049| 
|3050|3050| 				// TODO: if two units enter our range together, we'll attack the
|3051|3051| 				// first and then the second won't trigger another LosRangeUpdate
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3087|3087| 				}
|3088|3088| 				// Start attacking one of the newly-seen enemy (if any)
|3089|3089| 				else if (this.template.NaturalBehaviour == "violent")
|3090|    |-				{
|    |3090|+				
|3091|3091| 					this.AttackVisibleEntity(msg.data.added);
|3092|    |-				}
|    |3092|+				
|3093|3093| 			},
|3094|3094| 
|3095|3095| 			"Timer": function(msg) {
|    | [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
|3102|3102| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3103|3103| 
|3104|3104| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3105|    |-							// only used for domestic animals
|    |3105|+		// only used for domestic animals
|3106|3106| 	},
|3107|3107| };
|3108|3108| 
|    | [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
|3159|3159| 
|3160|3160| UnitAI.prototype.IsAnimal = function()
|3161|3161| {
|3162|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3162|+	return (!!this.template.NaturalBehaviour);
|3163|3163| };
|3164|3164| 
|3165|3165| UnitAI.prototype.IsDangerousAnimal = function()
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3197|3197| UnitAI.prototype.GetGarrisonHolder = function()
|3198|3198| {
|3199|3199| 	if (this.IsGarrisoned())
|3200|    |-	{
|    |3200|+	
|3201|3201| 		for (let order of this.orderQueue)
|3202|3202| 			if (order.type == "Garrison")
|3203|3203| 				return order.data.target;
|3204|    |-	}
|    |3204|+	
|3205|3205| 	return INVALID_ENTITY;
|3206|3206| };
|3207|3207| 
|    | [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
|3275|3275| 		{
|3276|3276| 			let index = this.GetCurrentState().indexOf(".");
|3277|3277| 			if (index != -1)
|3278|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3278|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3279|3279| 			this.Stop(false);
|3280|3280| 		}
|3281|3281| 
|    | [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
|3331|3331| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3332|3332| 			continue;
|3333|3333| 		if (i == 0)
|3334|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3334|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3335|3335| 		else
|3336|3336| 			this.orderQueue.splice(i, 1);
|3337|3337| 		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
|3331|3331| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3332|3332| 			continue;
|3333|3333| 		if (i == 0)
|3334|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3334|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3335|3335| 		else
|3336|3336| 			this.orderQueue.splice(i, 1);
|3337|3337| 		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
|3415|3415| };
|3416|3416| 
|3417|3417| 
|3418|    |-//// FSM linkage functions ////
|    |3418|+// // FSM linkage functions ////
|3419|3419| 
|3420|3420| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3421|3421| 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
|3587|3587| 				continue;
|3588|3588| 			if (this.orderQueue[i].type == type)
|3589|3589| 				continue;
|3590|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3590|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3591|3591| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3592|3592| 			return;
|3593|3593| 		}
|    | [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
|3587|3587| 				continue;
|3588|3588| 			if (this.orderQueue[i].type == type)
|3589|3589| 				continue;
|3590|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3590|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3591|3591| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3592|3592| 			return;
|3593|3593| 		}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3601|3601| {
|3602|3602| 	// Remember the previous work orders to be able to go back to them later if required
|3603|3603| 	if (data && data.force)
|3604|    |-	{
|    |3604|+	
|3605|3605| 		if (this.IsFormationController())
|3606|3606| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3607|3607| 		else
|3608|3608| 			this.UpdateWorkOrders(type);
|3609|    |-	}
|    |3609|+	
|3610|3610| 
|3611|3611| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3612|3612| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3678|3678| 	{
|3679|3679| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3680|3680| 		if (cmpUnitAI)
|3681|    |-		{
|    |3681|+		
|3682|3682| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3683|3683| 			{
|3684|3684| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3687|3687| 					return;
|3688|3688| 				}
|3689|3689| 			}
|3690|    |-		}
|    |3690|+		
|3691|3691| 	}
|3692|3692| 
|3693|3693| 	// If nothing found, take the unit orders
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3680|3680| 		if (cmpUnitAI)
|3681|3681| 		{
|3682|3682| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3683|    |-			{
|    |3683|+			
|3684|3684| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3685|3685| 				{
|3686|3686| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3687|3687| 					return;
|3688|3688| 				}
|3689|    |-			}
|    |3689|+			
|3690|3690| 		}
|3691|3691| 	}
|3692|3692| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3692|3692| 
|3693|3693| 	// If nothing found, take the unit orders
|3694|3694| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3695|    |-	{
|    |3695|+	
|3696|3696| 		if (isWorkType(this.orderQueue[i].type))
|3697|3697| 		{
|3698|3698| 			this.workOrders = this.orderQueue.slice(i);
|3699|3699| 			return;
|3700|3700| 		}
|3701|    |-	}
|    |3701|+	
|3702|3702| };
|3703|3703| 
|3704|3704| UnitAI.prototype.BackToWork = function()
|    | [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
|3758|3758| 	if (data.timerRepeat === undefined)
|3759|3759| 		this.timer = undefined;
|3760|3760| 
|3761|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3761|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3762|3762| };
|3763|3763| 
|3764|3764| /**
|    | [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
|3758|3758| 	if (data.timerRepeat === undefined)
|3759|3759| 		this.timer = undefined;
|3760|3760| 
|3761|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3761|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3762|3762| };
|3763|3763| 
|3764|3764| /**
|    | [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
|3793|3793| 	this.timer = undefined;
|3794|3794| };
|3795|3795| 
|3796|    |-//// Message handlers /////
|    |3796|+// // Message handlers /////
|3797|3797| 
|3798|3798| UnitAI.prototype.OnMotionChanged = function(msg)
|3799|3799| {
|    | [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
|3805|3805| 	// TODO: This is a bit inefficient since every unit listens to every
|3806|3806| 	// construction message - ideally we could scope it to only the one we're building
|3807|3807| 
|3808|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3808|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3809|3809| };
|3810|3810| 
|3811|3811| 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
|3805|3805| 	// TODO: This is a bit inefficient since every unit listens to every
|3806|3806| 	// construction message - ideally we could scope it to only the one we're building
|3807|3807| 
|3808|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3808|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3809|3809| };
|3810|3810| 
|3811|3811| 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
|3830|3830| 
|3831|3831| UnitAI.prototype.OnAttacked = function(msg)
|3832|3832| {
|3833|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3833|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3834|3834| };
|3835|3835| 
|3836|3836| 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
|3830|3830| 
|3831|3831| UnitAI.prototype.OnAttacked = function(msg)
|3832|3832| {
|3833|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3833|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3834|3834| };
|3835|3835| 
|3836|3836| 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
|3835|3835| 
|3836|3836| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3837|3837| {
|3838|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3838|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|3839|3839| };
|3840|3840| 
|3841|3841| 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
|3835|3835| 
|3836|3836| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3837|3837| {
|3838|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3838|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|3839|3839| };
|3840|3840| 
|3841|3841| 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
|3840|3840| 
|3841|3841| UnitAI.prototype.OnHealthChanged = function(msg)
|3842|3842| {
|3843|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3843|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|3844|3844| };
|3845|3845| 
|3846|3846| 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
|3840|3840| 
|3841|3841| UnitAI.prototype.OnHealthChanged = function(msg)
|3842|3842| {
|3843|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3843|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|3844|3844| };
|3845|3845| 
|3846|3846| 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
|3846|3846| UnitAI.prototype.OnRangeUpdate = function(msg)
|3847|3847| {
|3848|3848| 	if (msg.tag == this.losRangeQuery)
|3849|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3849|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|3850|3850| 	else if (msg.tag == this.losHealRangeQuery)
|3851|3851| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3852|3852| };
|    | [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
|3846|3846| UnitAI.prototype.OnRangeUpdate = function(msg)
|3847|3847| {
|3848|3848| 	if (msg.tag == this.losRangeQuery)
|3849|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3849|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|3850|3850| 	else if (msg.tag == this.losHealRangeQuery)
|3851|3851| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3852|3852| };
|    | [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
|3848|3848| 	if (msg.tag == this.losRangeQuery)
|3849|3849| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3850|3850| 	else if (msg.tag == this.losHealRangeQuery)
|3851|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3851|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|3852|3852| };
|3853|3853| 
|3854|3854| 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
|3848|3848| 	if (msg.tag == this.losRangeQuery)
|3849|3849| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3850|3850| 	else if (msg.tag == this.losHealRangeQuery)
|3851|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3851|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|3852|3852| };
|3853|3853| 
|3854|3854| 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
|3853|3853| 
|3854|3854| UnitAI.prototype.OnPackFinished = function(msg)
|3855|3855| {
|3856|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3856|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|3857|3857| };
|3858|3858| 
|3859|3859| //// 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
|3853|3853| 
|3854|3854| UnitAI.prototype.OnPackFinished = function(msg)
|3855|3855| {
|3856|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3856|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|3857|3857| };
|3858|3858| 
|3859|3859| //// 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
|3856|3856| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|3857|3857| };
|3858|3858| 
|3859|    |-//// Helper functions to be called by the FSM ////
|    |3859|+// // Helper functions to be called by the FSM ////
|3860|3860| 
|3861|3861| UnitAI.prototype.GetWalkSpeed = function()
|3862|3862| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4043|4043| 			PlaySound(name, member);
|4044|4044| 	}
|4045|4045| 	else
|4046|    |-	{
|    |4046|+	
|4047|4047| 		// Otherwise use our own sounds
|4048|4048| 		PlaySound(name, this.entity);
|4049|    |-	}
|    |4049|+	
|4050|4050| };
|4051|4051| 
|4052|4052| /*
|    | [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
|4489|4489| UnitAI.prototype.AttackEntityInZone = function(ents)
|4490|4490| {
|4491|4491| 	var target = ents.find(target =>
|4492|    |-		this.CanAttack(target)
|4493|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4492|+		this.CanAttack(target) &&
|    |4493|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4494|4494| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4495|4495| 	);
|4496|4496| 	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
|4490|4490| {
|4491|4491| 	var target = ents.find(target =>
|4492|4492| 		this.CanAttack(target)
|4493|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4494|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4493|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4494|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4495|4495| 	);
|4496|4496| 	if (!target)
|4497|4497| 		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
|4554|4554| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4555|4555| 	if (this.isGuardOf)
|4556|4556| 	{
|4557|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4557|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4558|4558| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4559|4559| 		if (cmpUnitAI && cmpAttack &&
|4560|4560| 		    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
|4558|4558| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4559|4559| 		if (cmpUnitAI && cmpAttack &&
|4560|4560| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4561|    |-				return false;
|    |4561|+			return false;
|4562|4562| 	}
|4563|4563| 
|4564|4564| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4563|4563| 
|4564|4564| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4565|4565| 	if (this.GetStance().respondHoldGround)
|4566|    |-	{
|    |4566|+	
|4567|4567| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4568|4568| 			return true;
|4569|    |-	}
|    |4569|+	
|4570|4570| 
|4571|4571| 	// Stop if it's left our vision range, unless we're especially persistent
|4572|4572| 	if (!this.GetStance().respondChaseBeyondVision)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4570|4570| 
|4571|4571| 	// Stop if it's left our vision range, unless we're especially persistent
|4572|4572| 	if (!this.GetStance().respondChaseBeyondVision)
|4573|    |-	{
|    |4573|+	
|4574|4574| 		if (!this.CheckTargetIsInVisionRange(target))
|4575|4575| 			return true;
|4576|    |-	}
|    |4576|+	
|4577|4577| 
|4578|4578| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4579|4579| 	// and will continue moving to its last seen position and then stop)
|    | [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
|4596|4596| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4597|4597| 	if (this.isGuardOf)
|4598|4598| 	{
|4599|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4599|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4600|4600| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4601|4601| 		if (cmpUnitAI && cmpAttack &&
|4602|4602| 		    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
|4609|4609| 	return false;
|4610|4610| };
|4611|4611| 
|4612|    |-//// External interface functions ////
|    |4612|+// // External interface functions ////
|4613|4613| 
|4614|4614| UnitAI.prototype.SetFormationController = function(ent)
|4615|4615| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4619|4619| 	// of our own formation (or ourself if not in formation)
|4620|4620| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4621|4621| 	if (cmpObstruction)
|4622|    |-	{
|    |4622|+	
|4623|4623| 		if (ent == INVALID_ENTITY)
|4624|4624| 			cmpObstruction.SetControlGroup(this.entity);
|4625|4625| 		else
|4626|4626| 			cmpObstruction.SetControlGroup(ent);
|4627|    |-	}
|    |4627|+	
|4628|4628| 
|4629|4629| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4630|4630| 	if (ent == INVALID_ENTITY)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4762|4762| 	// if we already had an old guard order, do nothing if the target is the same
|4763|4763| 	// and the order is running, otherwise remove the previous order
|4764|4764| 	if (this.isGuardOf)
|4765|    |-	{
|    |4765|+	
|4766|4766| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4767|4767| 			return;
|4768|4768| 		else
|4769|4769| 			this.RemoveGuard();
|4770|    |-	}
|    |4770|+	
|4771|4771| 
|4772|4772| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4773|4773| };
|    | [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
|4765|4765| 	{
|4766|4766| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4767|4767| 			return;
|4768|    |-		else
|4769|    |-			this.RemoveGuard();
|    |4768|+		this.RemoveGuard();
|4770|4769| 	}
|4771|4770| 
|4772|4771| 	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
|5097|5097| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5098|5098| 	{
|5099|5099| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5100|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5100|+		if (cmpTrader.HasBothMarkets() &&
|5101|5101| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5102|5102| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5103|5103| 		{
|    | [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
|5378|5378| 				{
|5379|5379| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5380|5380| 					var targetClasses = this.order.data.targetClasses;
|5381|    |-					if (targetClasses.attack && cmpIdentity
|5382|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5381|+					if (targetClasses.attack && cmpIdentity &&
|    |5382|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5383|5383| 						continue;
|5384|5384| 					if (targetClasses.avoid && cmpIdentity
|5385|5385| 						&& 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
|5381|5381| 					if (targetClasses.attack && cmpIdentity
|5382|5382| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5383|5383| 						continue;
|5384|    |-					if (targetClasses.avoid && cmpIdentity
|5385|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5384|+					if (targetClasses.avoid && cmpIdentity &&
|    |5385|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5386|5386| 						continue;
|5387|5387| 					// Only used by the AIs to prevent some choices of targets
|5388|5388| 					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
|5404|5404| 		{
|5405|5405| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5406|5406| 			var targetClasses = this.order.data.targetClasses;
|5407|    |-			if (cmpIdentity && targetClasses.attack
|5408|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5407|+			if (cmpIdentity && targetClasses.attack &&
|    |5408|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5409|5409| 				continue;
|5410|5410| 			if (cmpIdentity && targetClasses.avoid
|5411|5411| 				&& 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
|5407|5407| 			if (cmpIdentity && targetClasses.attack
|5408|5408| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5409|5409| 				continue;
|5410|    |-			if (cmpIdentity && targetClasses.avoid
|5411|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5410|+			if (cmpIdentity && targetClasses.avoid &&
|    |5411|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5412|5412| 				continue;
|5413|5413| 			// Only used by the AIs to prevent some choices of targets
|5414|5414| 			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
|5564|5564| 
|5565|5565| UnitAI.prototype.SetHeldPosition = function(x, z)
|5566|5566| {
|5567|    |-	this.heldPosition = {"x": x, "z": z};
|    |5567|+	this.heldPosition = { "x": x, "z": z};
|5568|5568| };
|5569|5569| 
|5570|5570| 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
|5564|5564| 
|5565|5565| UnitAI.prototype.SetHeldPosition = function(x, z)
|5566|5566| {
|5567|    |-	this.heldPosition = {"x": x, "z": z};
|    |5567|+	this.heldPosition = {"x": x, "z": z };
|5568|5568| };
|5569|5569| 
|5570|5570| 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
|5591|5591| 	return false;
|5592|5592| };
|5593|5593| 
|5594|    |-//// Helper functions ////
|    |5594|+// // Helper functions ////
|5595|5595| 
|5596|5596| UnitAI.prototype.CanAttack = function(target)
|5597|5597| {
|    | [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
|5795|5795| 	return cmpPack && cmpPack.IsPacking();
|5796|5796| };
|5797|5797| 
|5798|    |-//// Formation specific functions ////
|    |5798|+// // Formation specific functions ////
|5799|5799| 
|5800|5800| UnitAI.prototype.IsAttackingAsFormation = function()
|5801|5801| {
|    | [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
|5800|5800| UnitAI.prototype.IsAttackingAsFormation = function()
|5801|5801| {
|5802|5802| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5803|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5804|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5803|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5804|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5805|5805| };
|5806|5806| 
|5807|5807| //// 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
|5804|5804| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5805|5805| };
|5806|5806| 
|5807|    |-//// Animal specific functions ////
|    |5807|+// // Animal specific functions ////
|5808|5808| 
|5809|5809| UnitAI.prototype.MoveRandomly = function(distance)
|5810|5810| {

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

binaries/data/mods/public/simulation/components/UnitAI.js
| 891| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
| 913| »   »   »   "enter":·function(msg)·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

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

binaries/data/mods/public/simulation/components/UnitAI.js
|1023| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1058| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1090| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1250| »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1309| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1488| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1507| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1536| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1688| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1738| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1813| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|1993| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2081| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2333| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2451| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2513| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2552| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2758| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2938| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|3663| »   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
|4476| »   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
|4491| »   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
|4537| »   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
|4560| »   »   ····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
| 354| »   »   ····&&·(this.lastShorelinePosition.z·==·cmpPosition.GetPosition().z))
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
|1954| »   »   »   »   »   »   &&·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
|2490| »   »   »   »   »   var·cmpResourceGatherer·=·Engine.QueryInterface(this.entity,·IID_ResourceGatherer);
|    | [NORMAL] JSHintBear:
|    | 'cmpResourceGatherer' is already defined.

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|5408| »   »   »   »   &&·!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
|5411| »   »   »   »   &&·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
|5486| »   »   var·cmpVision·=·Engine.QueryInterface(this.entity,·IID_Vision);
|    | [NORMAL] JSHintBear:
|    | 'cmpVision' is already defined.

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

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

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

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

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

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

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

wraitii updated this revision to Diff 8853.Jul 13 2019, 2:26 PM

Some further cleanup and movement of code around so that things behave better. Tested to work as well as I expect it to right now - still can have some stuck units when ordering a group to go somewhere impassable, but that's not really something we can deal with efficiently right now.

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 352| 352| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 353| 353| 		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 354| 354| 		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 355|    |-		{
|    | 355|+		
| 356| 356| 			// we were already on the shoreline, and have not moved since
| 357| 357| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
| 358| 358| 				needToMove = false;
| 359|    |-		}
|    | 359|+		
| 360| 360| 
| 361| 361| 		if (needToMove)
| 362| 362| 			this.SetNextState("INDIVIDUAL.PICKUP.APPROACHING");
|    | [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
| 350| 350| 		// Check if we need to move     TODO implement a better way to know if we are on the shoreline
| 351| 351| 		var needToMove = true;
| 352| 352| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 353|    |-		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 354|    |-		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
|    | 353|+		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x) &&
|    | 354|+		    (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 355| 355| 		{
| 356| 356| 			// we were already on the shoreline, and have not moved since
| 357| 357| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 517| 517| 					this.PushOrderFront("Walk", this.order.data.lastPos);
| 518| 518| 				}
| 519| 519| 				else
| 520|    |-				{
|    | 520|+				
| 521| 521| 					// We couldn't move there, or the target moved away
| 522| 522| 					this.FinishOrder();
| 523|    |-				}
|    | 523|+				
| 524| 524| 				return;
| 525| 525| 			}
| 526| 526| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 736| 736| 			}
| 737| 737| 			// Check if we are already in range, otherwise walk there
| 738| 738| 			if (!this.CheckGarrisonRange(msg.data.target))
| 739|    |-			{
|    | 739|+			
| 740| 740| 				if (!this.CheckTargetVisible(msg.data.target))
| 741| 741| 				{
| 742| 742| 					this.FinishOrder();
| 747| 747| 					this.SetNextState("GARRISON.APPROACHING");
| 748| 748| 					return;
| 749| 749| 				}
| 750|    |-			}
|    | 750|+			
| 751| 751| 
| 752| 752| 			this.SetNextState("GARRISON.GARRISONING");
| 753| 753| 		},
|    | [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
| 742| 742| 					this.FinishOrder();
| 743| 743| 					return;
| 744| 744| 				}
| 745|    |-				else
| 746|    |-				{
|    | 745|+				
| 747| 746| 					this.SetNextState("GARRISON.APPROACHING");
| 748| 747| 					return;
| 749|    |-				}
|    | 748|+				
| 750| 749| 			}
| 751| 750| 
| 752| 751| 			this.SetNextState("GARRISON.GARRISONING");
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 765| 765| 						this.PushOrderFront("Walk", msg.data.lastPos);
| 766| 766| 					}
| 767| 767| 					else
| 768|    |-					{
|    | 768|+					
| 769| 769| 						// We couldn't move there, or the target moved away
| 770| 770| 						this.FinishOrder();
| 771|    |-					}
|    | 771|+					
| 772| 772| 					return;
| 773| 773| 				}
| 774| 774| 
|    | [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
| 998| 998| 			},
| 999| 999| 		},
|1000|1000| 
|1001|    |-		"GARRISON":{
|    |1001|+		"GARRISON": {
|1002|1002| 			"enter": function() {
|1003|1003| 				// If the garrisonholder should pickup, warn it so it can take needed action
|1004|1004| 				var cmpGarrisonHolder = Engine.QueryInterface(this.order.data.target, IID_GarrisonHolder);
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1211|1211| 			// If the controller handled an order but some members rejected it,
|1212|1212| 			// they will have no orders and be in the FORMATIONMEMBER.IDLE state.
|1213|1213| 			if (this.orderQueue.length)
|1214|    |-			{
|    |1214|+			
|1215|1215| 				// We're leaving the formation, so stop our FormationWalk order
|1216|1216| 				if (this.FinishOrder())
|1217|1217| 					return;
|1218|    |-			}
|    |1218|+			
|1219|1219| 
|1220|1220| 			// No orders left, we're an individual now
|1221|1221| 			this.SetNextState("INDIVIDUAL.IDLE");
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1236|1236| 			// Move a tile outside the building
|1237|1237| 			let range = 4;
|1238|1238| 			if (this.CheckTargetRangeExplicit(msg.data.target, range, -1))
|1239|    |-			{
|    |1239|+			
|1240|1240| 				// We are already at the target, or can't move at all
|1241|1241| 				this.FinishOrder();
|1242|    |-			}
|    |1242|+			
|1243|1243| 			else
|1244|1244| 			{
|1245|1245| 				this.order.data.min = range;
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1465|1465| 
|1466|1466| 			"LosRangeUpdate": function(msg) {
|1467|1467| 				if (this.GetStance().targetVisibleEnemies)
|1468|    |-				{
|    |1468|+				
|1469|1469| 					// Start attacking one of the newly-seen enemy (if any)
|1470|1470| 					this.AttackEntitiesByPreference(msg.data.added);
|1471|    |-				}
|    |1471|+				
|1472|1472| 			},
|1473|1473| 
|1474|1474| 			"LosHealRangeUpdate": function(msg) {
|    | [NORMAL] ESLintBear (space-before-function-paren):
|    | Unexpected space before function parentheses.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1493|1493| 				}
|1494|1494| 			},
|1495|1495| 
|1496|    |-			"leave": function () {
|    |1496|+			"leave": function() {
|1497|1497| 				this.StopMoving();
|1498|1498| 			},
|1499|1499| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1668|1668| 						// if nothing better to do, check if the guarded needs to be healed or repaired
|1669|1669| 						var cmpHealth = Engine.QueryInterface(this.isGuardOf, IID_Health);
|1670|1670| 						if (cmpHealth && cmpHealth.IsInjured())
|1671|    |-						{
|    |1671|+						
|1672|1672| 							if (this.CanHeal(this.isGuardOf))
|1673|1673| 								this.PushOrderFront("Heal", { "target": this.isGuardOf, "force": false });
|1674|1674| 							else if (this.CanRepair(this.isGuardOf))
|1675|1675| 								this.PushOrderFront("Repair", { "target": this.isGuardOf, "autocontinue": false, "force": false });
|1676|    |-						}
|    |1676|+						
|1677|1677| 					}
|1678|1678| 				},
|1679|1679| 
|    | [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
|1950|1950| 
|1951|1951| 				"Attacked": function(msg) {
|1952|1952| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|1953|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|1954|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |1953|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |1954|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|1955|1955| 						this.RespondToTargetedEntities([msg.data.attacker]);
|1956|1956| 				},
|1957|1957| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2002|2002| 
|2003|2003| 					var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|2004|2004| 					if (cmpUnitAI && cmpUnitAI.IsFleeing())
|2005|    |-					{
|    |2005|+					
|2006|2006| 						// Run after a fleeing target
|2007|2007| 						this.SetSpeedMultiplier(this.GetRunMultiplier());
|2008|    |-					}
|    |2008|+					
|2009|2009| 					this.StartTimer(1000, 1000);
|2010|2010| 				},
|2011|2011| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2353|2353| 
|2354|2354| 				"Timer": function(msg) {
|2355|2355| 					if (this.ShouldAbandonChase(this.order.data.target, this.order.data.force, IID_Heal, null))
|2356|    |-					{
|    |2356|+					
|2357|2357| 						// Return to our original position unless we have a better order.
|2358|2358| 						if (!this.FinishOrder() && this.GetStance().respondHoldGround)
|2359|2359| 							this.WalkToHeldPosition();
|2360|    |-					}
|    |2360|+					
|2361|2361| 				},
|2362|2362| 
|2363|2363| 				"MovementUpdate": function() {
|    | [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
|2387|2387| 					this.StartTimer(prepare, this.healTimers.repeat);
|2388|2388| 
|2389|2389| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2390|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2390|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2391|2391| 
|2392|2392| 					this.FaceTowardsTarget(this.order.data.target);
|2393|2393| 				},
|    | [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
|2595|2595| 					{
|2596|2596| 						// The building was already finished/fully repaired before we arrived;
|2597|2597| 						// let the ConstructionFinished handler handle this.
|2598|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2598|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2599|2599| 						return true;
|2600|2600| 					}
|2601|2601| 
|    | [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
|2595|2595| 					{
|2596|2596| 						// The building was already finished/fully repaired before we arrived;
|2597|2597| 						// let the ConstructionFinished handler handle this.
|2598|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2598|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2599|2599| 						return true;
|2600|2600| 					}
|2601|2601| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2980|2980| 		"Attacked": function(msg) {
|2981|2981| 			if (this.template.NaturalBehaviour == "skittish" ||
|2982|2982| 			    this.template.NaturalBehaviour == "passive")
|2983|    |-			{
|    |2983|+			
|2984|2984| 				this.Flee(msg.data.attacker, false);
|2985|    |-			}
|    |2985|+			
|2986|2986| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|2987|2987| 			{
|2988|2988| 				if (this.CanAttack(msg.data.attacker))
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2989|2989| 					this.Attack(msg.data.attacker, false);
|2990|2990| 			}
|2991|2991| 			else if (this.template.NaturalBehaviour == "domestic")
|2992|    |-			{
|    |2992|+			
|2993|2993| 				// Never flee, stop what we were doing
|2994|2994| 				this.SetNextState("IDLE");
|2995|    |-			}
|    |2995|+			
|2996|2996| 		},
|2997|2997| 
|2998|2998| 		"Order.LeaveFoundation": function(msg) {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3043|3043| 				}
|3044|3044| 				// Start attacking one of the newly-seen enemy (if any)
|3045|3045| 				else if (this.IsDangerousAnimal())
|3046|    |-				{
|    |3046|+				
|3047|3047| 					this.AttackVisibleEntity(msg.data.added);
|3048|    |-				}
|    |3048|+				
|3049|3049| 
|3050|3050| 				// TODO: if two units enter our range together, we'll attack the
|3051|3051| 				// first and then the second won't trigger another LosRangeUpdate
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3087|3087| 				}
|3088|3088| 				// Start attacking one of the newly-seen enemy (if any)
|3089|3089| 				else if (this.template.NaturalBehaviour == "violent")
|3090|    |-				{
|    |3090|+				
|3091|3091| 					this.AttackVisibleEntity(msg.data.added);
|3092|    |-				}
|    |3092|+				
|3093|3093| 			},
|3094|3094| 
|3095|3095| 			"Timer": function(msg) {
|    | [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
|3102|3102| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3103|3103| 
|3104|3104| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3105|    |-							// only used for domestic animals
|    |3105|+		// only used for domestic animals
|3106|3106| 	},
|3107|3107| };
|3108|3108| 
|    | [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
|3159|3159| 
|3160|3160| UnitAI.prototype.IsAnimal = function()
|3161|3161| {
|3162|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3162|+	return (!!this.template.NaturalBehaviour);
|3163|3163| };
|3164|3164| 
|3165|3165| UnitAI.prototype.IsDangerousAnimal = function()
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3197|3197| UnitAI.prototype.GetGarrisonHolder = function()
|3198|3198| {
|3199|3199| 	if (this.IsGarrisoned())
|3200|    |-	{
|    |3200|+	
|3201|3201| 		for (let order of this.orderQueue)
|3202|3202| 			if (order.type == "Garrison")
|3203|3203| 				return order.data.target;
|3204|    |-	}
|    |3204|+	
|3205|3205| 	return INVALID_ENTITY;
|3206|3206| };
|3207|3207| 
|    | [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
|3275|3275| 		{
|3276|3276| 			let index = this.GetCurrentState().indexOf(".");
|3277|3277| 			if (index != -1)
|3278|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3278|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3279|3279| 			this.Stop(false);
|3280|3280| 		}
|3281|3281| 
|    | [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
|3331|3331| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3332|3332| 			continue;
|3333|3333| 		if (i == 0)
|3334|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3334|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3335|3335| 		else
|3336|3336| 			this.orderQueue.splice(i, 1);
|3337|3337| 		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
|3331|3331| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3332|3332| 			continue;
|3333|3333| 		if (i == 0)
|3334|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3334|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3335|3335| 		else
|3336|3336| 			this.orderQueue.splice(i, 1);
|3337|3337| 		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
|3415|3415| };
|3416|3416| 
|3417|3417| 
|3418|    |-//// FSM linkage functions ////
|    |3418|+// // FSM linkage functions ////
|3419|3419| 
|3420|3420| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3421|3421| 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
|3587|3587| 				continue;
|3588|3588| 			if (this.orderQueue[i].type == type)
|3589|3589| 				continue;
|3590|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3590|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3591|3591| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3592|3592| 			return;
|3593|3593| 		}
|    | [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
|3587|3587| 				continue;
|3588|3588| 			if (this.orderQueue[i].type == type)
|3589|3589| 				continue;
|3590|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3590|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3591|3591| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3592|3592| 			return;
|3593|3593| 		}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3601|3601| {
|3602|3602| 	// Remember the previous work orders to be able to go back to them later if required
|3603|3603| 	if (data && data.force)
|3604|    |-	{
|    |3604|+	
|3605|3605| 		if (this.IsFormationController())
|3606|3606| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3607|3607| 		else
|3608|3608| 			this.UpdateWorkOrders(type);
|3609|    |-	}
|    |3609|+	
|3610|3610| 
|3611|3611| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3612|3612| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3678|3678| 	{
|3679|3679| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3680|3680| 		if (cmpUnitAI)
|3681|    |-		{
|    |3681|+		
|3682|3682| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3683|3683| 			{
|3684|3684| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3687|3687| 					return;
|3688|3688| 				}
|3689|3689| 			}
|3690|    |-		}
|    |3690|+		
|3691|3691| 	}
|3692|3692| 
|3693|3693| 	// If nothing found, take the unit orders
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3680|3680| 		if (cmpUnitAI)
|3681|3681| 		{
|3682|3682| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3683|    |-			{
|    |3683|+			
|3684|3684| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3685|3685| 				{
|3686|3686| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3687|3687| 					return;
|3688|3688| 				}
|3689|    |-			}
|    |3689|+			
|3690|3690| 		}
|3691|3691| 	}
|3692|3692| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3692|3692| 
|3693|3693| 	// If nothing found, take the unit orders
|3694|3694| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3695|    |-	{
|    |3695|+	
|3696|3696| 		if (isWorkType(this.orderQueue[i].type))
|3697|3697| 		{
|3698|3698| 			this.workOrders = this.orderQueue.slice(i);
|3699|3699| 			return;
|3700|3700| 		}
|3701|    |-	}
|    |3701|+	
|3702|3702| };
|3703|3703| 
|3704|3704| UnitAI.prototype.BackToWork = function()
|    | [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
|3758|3758| 	if (data.timerRepeat === undefined)
|3759|3759| 		this.timer = undefined;
|3760|3760| 
|3761|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3761|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3762|3762| };
|3763|3763| 
|3764|3764| /**
|    | [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
|3758|3758| 	if (data.timerRepeat === undefined)
|3759|3759| 		this.timer = undefined;
|3760|3760| 
|3761|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3761|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3762|3762| };
|3763|3763| 
|3764|3764| /**
|    | [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
|3793|3793| 	this.timer = undefined;
|3794|3794| };
|3795|3795| 
|3796|    |-//// Message handlers /////
|    |3796|+// // Message handlers /////
|3797|3797| 
|3798|3798| UnitAI.prototype.OnMotionChanged = function(msg)
|3799|3799| {
|    | [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
|3805|3805| 	// TODO: This is a bit inefficient since every unit listens to every
|3806|3806| 	// construction message - ideally we could scope it to only the one we're building
|3807|3807| 
|3808|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3808|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3809|3809| };
|3810|3810| 
|3811|3811| 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
|3805|3805| 	// TODO: This is a bit inefficient since every unit listens to every
|3806|3806| 	// construction message - ideally we could scope it to only the one we're building
|3807|3807| 
|3808|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3808|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3809|3809| };
|3810|3810| 
|3811|3811| 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
|3830|3830| 
|3831|3831| UnitAI.prototype.OnAttacked = function(msg)
|3832|3832| {
|3833|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3833|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3834|3834| };
|3835|3835| 
|3836|3836| 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
|3830|3830| 
|3831|3831| UnitAI.prototype.OnAttacked = function(msg)
|3832|3832| {
|3833|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3833|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3834|3834| };
|3835|3835| 
|3836|3836| 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
|3835|3835| 
|3836|3836| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3837|3837| {
|3838|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3838|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|3839|3839| };
|3840|3840| 
|3841|3841| 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
|3835|3835| 
|3836|3836| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3837|3837| {
|3838|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3838|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|3839|3839| };
|3840|3840| 
|3841|3841| 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
|3840|3840| 
|3841|3841| UnitAI.prototype.OnHealthChanged = function(msg)
|3842|3842| {
|3843|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3843|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|3844|3844| };
|3845|3845| 
|3846|3846| 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
|3840|3840| 
|3841|3841| UnitAI.prototype.OnHealthChanged = function(msg)
|3842|3842| {
|3843|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3843|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|3844|3844| };
|3845|3845| 
|3846|3846| 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
|3846|3846| UnitAI.prototype.OnRangeUpdate = function(msg)
|3847|3847| {
|3848|3848| 	if (msg.tag == this.losRangeQuery)
|3849|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3849|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|3850|3850| 	else if (msg.tag == this.losHealRangeQuery)
|3851|3851| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3852|3852| };
|    | [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
|3846|3846| UnitAI.prototype.OnRangeUpdate = function(msg)
|3847|3847| {
|3848|3848| 	if (msg.tag == this.losRangeQuery)
|3849|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3849|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|3850|3850| 	else if (msg.tag == this.losHealRangeQuery)
|3851|3851| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3852|3852| };
|    | [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
|3848|3848| 	if (msg.tag == this.losRangeQuery)
|3849|3849| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3850|3850| 	else if (msg.tag == this.losHealRangeQuery)
|3851|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3851|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|3852|3852| };
|3853|3853| 
|3854|3854| 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
|3848|3848| 	if (msg.tag == this.losRangeQuery)
|3849|3849| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3850|3850| 	else if (msg.tag == this.losHealRangeQuery)
|3851|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3851|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|3852|3852| };
|3853|3853| 
|3854|3854| 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
|3853|3853| 
|3854|3854| UnitAI.prototype.OnPackFinished = function(msg)
|3855|3855| {
|3856|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3856|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|3857|3857| };
|3858|3858| 
|3859|3859| //// 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
|3853|3853| 
|3854|3854| UnitAI.prototype.OnPackFinished = function(msg)
|3855|3855| {
|3856|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3856|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|3857|3857| };
|3858|3858| 
|3859|3859| //// 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
|3856|3856| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|3857|3857| };
|3858|3858| 
|3859|    |-//// Helper functions to be called by the FSM ////
|    |3859|+// // Helper functions to be called by the FSM ////
|3860|3860| 
|3861|3861| UnitAI.prototype.GetWalkSpeed = function()
|3862|3862| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4043|4043| 			PlaySound(name, member);
|4044|4044| 	}
|4045|4045| 	else
|4046|    |-	{
|    |4046|+	
|4047|4047| 		// Otherwise use our own sounds
|4048|4048| 		PlaySound(name, this.entity);
|4049|    |-	}
|    |4049|+	
|4050|4050| };
|4051|4051| 
|4052|4052| /*
|    | [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
|4489|4489| UnitAI.prototype.AttackEntityInZone = function(ents)
|4490|4490| {
|4491|4491| 	var target = ents.find(target =>
|4492|    |-		this.CanAttack(target)
|4493|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4492|+		this.CanAttack(target) &&
|    |4493|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4494|4494| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4495|4495| 	);
|4496|4496| 	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
|4490|4490| {
|4491|4491| 	var target = ents.find(target =>
|4492|4492| 		this.CanAttack(target)
|4493|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4494|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4493|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4494|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4495|4495| 	);
|4496|4496| 	if (!target)
|4497|4497| 		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
|4554|4554| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4555|4555| 	if (this.isGuardOf)
|4556|4556| 	{
|4557|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4557|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4558|4558| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4559|4559| 		if (cmpUnitAI && cmpAttack &&
|4560|4560| 		    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
|4558|4558| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4559|4559| 		if (cmpUnitAI && cmpAttack &&
|4560|4560| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4561|    |-				return false;
|    |4561|+			return false;
|4562|4562| 	}
|4563|4563| 
|4564|4564| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4563|4563| 
|4564|4564| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4565|4565| 	if (this.GetStance().respondHoldGround)
|4566|    |-	{
|    |4566|+	
|4567|4567| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4568|4568| 			return true;
|4569|    |-	}
|    |4569|+	
|4570|4570| 
|4571|4571| 	// Stop if it's left our vision range, unless we're especially persistent
|4572|4572| 	if (!this.GetStance().respondChaseBeyondVision)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4570|4570| 
|4571|4571| 	// Stop if it's left our vision range, unless we're especially persistent
|4572|4572| 	if (!this.GetStance().respondChaseBeyondVision)
|4573|    |-	{
|    |4573|+	
|4574|4574| 		if (!this.CheckTargetIsInVisionRange(target))
|4575|4575| 			return true;
|4576|    |-	}
|    |4576|+	
|4577|4577| 
|4578|4578| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4579|4579| 	// and will continue moving to its last seen position and then stop)
|    | [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
|4596|4596| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4597|4597| 	if (this.isGuardOf)
|4598|4598| 	{
|4599|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4599|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4600|4600| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4601|4601| 		if (cmpUnitAI && cmpAttack &&
|4602|4602| 		    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
|4609|4609| 	return false;
|4610|4610| };
|4611|4611| 
|4612|    |-//// External interface functions ////
|    |4612|+// // External interface functions ////
|4613|4613| 
|4614|4614| UnitAI.prototype.SetFormationController = function(ent)
|4615|4615| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4619|4619| 	// of our own formation (or ourself if not in formation)
|4620|4620| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4621|4621| 	if (cmpObstruction)
|4622|    |-	{
|    |4622|+	
|4623|4623| 		if (ent == INVALID_ENTITY)
|4624|4624| 			cmpObstruction.SetControlGroup(this.entity);
|4625|4625| 		else
|4626|4626| 			cmpObstruction.SetControlGroup(ent);
|4627|    |-	}
|    |4627|+	
|4628|4628| 
|4629|4629| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4630|4630| 	if (ent == INVALID_ENTITY)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4762|4762| 	// if we already had an old guard order, do nothing if the target is the same
|4763|4763| 	// and the order is running, otherwise remove the previous order
|4764|4764| 	if (this.isGuardOf)
|4765|    |-	{
|    |4765|+	
|4766|4766| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4767|4767| 			return;
|4768|4768| 		else
|4769|4769| 			this.RemoveGuard();
|4770|    |-	}
|    |4770|+	
|4771|4771| 
|4772|4772| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4773|4773| };
|    | [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
|4765|4765| 	{
|4766|4766| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4767|4767| 			return;
|4768|    |-		else
|4769|    |-			this.RemoveGuard();
|    |4768|+		this.RemoveGuard();
|4770|4769| 	}
|4771|4770| 
|4772|4771| 	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
|5097|5097| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5098|5098| 	{
|5099|5099| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5100|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5100|+		if (cmpTrader.HasBothMarkets() &&
|5101|5101| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5102|5102| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5103|5103| 		{
|    | [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
|5378|5378| 				{
|5379|5379| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5380|5380| 					var targetClasses = this.order.data.targetClasses;
|5381|    |-					if (targetClasses.attack && cmpIdentity
|5382|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5381|+					if (targetClasses.attack && cmpIdentity &&
|    |5382|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5383|5383| 						continue;
|5384|5384| 					if (targetClasses.avoid && cmpIdentity
|5385|5385| 						&& 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
|5381|5381| 					if (targetClasses.attack && cmpIdentity
|5382|5382| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5383|5383| 						continue;
|5384|    |-					if (targetClasses.avoid && cmpIdentity
|5385|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5384|+					if (targetClasses.avoid && cmpIdentity &&
|    |5385|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5386|5386| 						continue;
|5387|5387| 					// Only used by the AIs to prevent some choices of targets
|5388|5388| 					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
|5404|5404| 		{
|5405|5405| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5406|5406| 			var targetClasses = this.order.data.targetClasses;
|5407|    |-			if (cmpIdentity && targetClasses.attack
|5408|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5407|+			if (cmpIdentity && targetClasses.attack &&
|    |5408|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5409|5409| 				continue;
|5410|5410| 			if (cmpIdentity && targetClasses.avoid
|5411|5411| 				&& 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
|5407|5407| 			if (cmpIdentity && targetClasses.attack
|5408|5408| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5409|5409| 				continue;
|5410|    |-			if (cmpIdentity && targetClasses.avoid
|5411|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5410|+			if (cmpIdentity && targetClasses.avoid &&
|    |5411|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5412|5412| 				continue;
|5413|5413| 			// Only used by the AIs to prevent some choices of targets
|5414|5414| 			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
|5564|5564| 
|5565|5565| UnitAI.prototype.SetHeldPosition = function(x, z)
|5566|5566| {
|5567|    |-	this.heldPosition = {"x": x, "z": z};
|    |5567|+	this.heldPosition = { "x": x, "z": z};
|5568|5568| };
|5569|5569| 
|5570|5570| 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
|5564|5564| 
|5565|5565| UnitAI.prototype.SetHeldPosition = function(x, z)
|5566|5566| {
|5567|    |-	this.heldPosition = {"x": x, "z": z};
|    |5567|+	this.heldPosition = {"x": x, "z": z };
|5568|5568| };
|5569|5569| 
|5570|5570| 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
|5591|5591| 	return false;
|5592|5592| };
|5593|5593| 
|5594|    |-//// Helper functions ////
|    |5594|+// // Helper functions ////
|5595|5595| 
|5596|5596| UnitAI.prototype.CanAttack = function(target)
|5597|5597| {
|    | [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
|5795|5795| 	return cmpPack && cmpPack.IsPacking();
|5796|5796| };
|5797|5797| 
|5798|    |-//// Formation specific functions ////
|    |5798|+// // Formation specific functions ////
|5799|5799| 
|5800|5800| UnitAI.prototype.IsAttackingAsFormation = function()
|5801|5801| {
|    | [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
|5800|5800| UnitAI.prototype.IsAttackingAsFormation = function()
|5801|5801| {
|5802|5802| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5803|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5804|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5803|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5804|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5805|5805| };
|5806|5806| 
|5807|5807| //// 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
|5804|5804| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5805|5805| };
|5806|5806| 
|5807|    |-//// Animal specific functions ////
|    |5807|+// // Animal specific functions ////
|5808|5808| 
|5809|5809| UnitAI.prototype.MoveRandomly = function(distance)
|5810|5810| {

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

binaries/data/mods/public/simulation/components/UnitAI.js
| 891| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
| 913| »   »   »   "enter":·function(msg)·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

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

binaries/data/mods/public/simulation/components/UnitAI.js
|1023| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1058| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1090| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1250| »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1309| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1488| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1507| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1536| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1688| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1738| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1813| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|1993| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2081| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2333| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2451| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2513| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2552| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2758| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2938| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|3663| »   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
|4476| »   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
|4491| »   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
|4537| »   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
|4560| »   »   ····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
| 354| »   »   ····&&·(this.lastShorelinePosition.z·==·cmpPosition.GetPosition().z))
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
|1954| »   »   »   »   »   »   &&·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
|2490| »   »   »   »   »   var·cmpResourceGatherer·=·Engine.QueryInterface(this.entity,·IID_ResourceGatherer);
|    | [NORMAL] JSHintBear:
|    | 'cmpResourceGatherer' is already defined.

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|5408| »   »   »   »   &&·!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
|5411| »   »   »   »   &&·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
|5486| »   »   var·cmpVision·=·Engine.QueryInterface(this.entity,·IID_Vision);
|    | [NORMAL] JSHintBear:
|    | 'cmpVision' is already defined.

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

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

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

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

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

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

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

This revision was not accepted when it landed; it landed in state Needs Review.Jul 13 2019, 5:53 PM
This revision was automatically updated to reflect the committed changes.
Silier added a subscriber: Silier.EditedJul 14 2019, 10:15 AM

Here is source of crash reported by gameboy on forum reproducible with vs2013 build https://wildfiregames.com/forum/index.php?/topic/26498-game-crash/

Edit: Even debug build on vs2015 cannot reproduce it

Edit: Actually it is line 232, sorry

ps/trunk/source/simulation2/components/CCmpUnitMotion.cpp
234

vs2013 serialisation out of bounds
pyrogenesis.exe!ISerializer::NumberU8(const char * name, unsigned char value, unsigned char lower, unsigned char upper) Line 31 at path\source\simulation2\serialization\iserializer.cpp(31)

wraitii added inline comments.Jul 14 2019, 11:26 AM
ps/trunk/source/simulation2/components/CCmpUnitMotion.cpp
234

As said on IRC, it was actually L232, fixed by D2074.