Page MenuHomeWildfire Games

Ensure units do get in attacking range since that range can change over time because of elevation differences
ClosedPublic

Authored by wraitii on Tue, Jul 2, 10:35 PM.

Details

Reviewers
None
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Commits
rP22429: Ensure units do get in attacking range since that range can change over time…
Trac Tickets
#5478
Summary

This is a partial revert of rP22351, which skipped the "MoveToTargetAttackingRange" in APPROACHING. I (incorrectly) assumed that the original order was still perfectly fine, but in fact the attacker's max range may have changed as that depends on the relative elevation between attack and target - and so the original order might never get us in range!

This was introduced right from the start in rP13626 - so I must assume it was intentionally done to fix this very issue.

I have added a comment so that future readers won't do the same mistake.

Test Plan

Try attacking a deer with a ranged unit from a higher ground.

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.Tue, Jul 2, 10:35 PM

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.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/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.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/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'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/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.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 734| 734| 			}
| 735| 735| 			// Check if we are already in range, otherwise walk there
| 736| 736| 			if (!this.CheckGarrisonRange(msg.data.target))
| 737|    |-			{
|    | 737|+			
| 738| 738| 				if (!this.CheckTargetVisible(msg.data.target))
| 739| 739| 				{
| 740| 740| 					this.FinishOrder();
| 745| 745| 					this.SetNextState("GARRISON.APPROACHING");
| 746| 746| 					return;
| 747| 747| 				}
| 748|    |-			}
|    | 748|+			
| 749| 749| 
| 750| 750| 			this.SetNextState("GARRISON.GARRISONING");
| 751| 751| 		},
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 740| 740| 					this.FinishOrder();
| 741| 741| 					return;
| 742| 742| 				}
| 743|    |-				else
| 744|    |-				{
|    | 743|+				
| 745| 744| 					this.SetNextState("GARRISON.APPROACHING");
| 746| 745| 					return;
| 747|    |-				}
|    | 746|+				
| 748| 747| 			}
| 749| 748| 
| 750| 749| 			this.SetNextState("GARRISON.GARRISONING");
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 763| 763| 						this.PushOrderFront("Walk", msg.data.lastPos);
| 764| 764| 					}
| 765| 765| 					else
| 766|    |-					{
|    | 766|+					
| 767| 767| 						// We couldn't move there, or the target moved away
| 768| 768| 						this.FinishOrder();
| 769|    |-					}
|    | 769|+					
| 770| 770| 					return;
| 771| 771| 				}
| 772| 772| 
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'GARRISON'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 996| 996| 			},
| 997| 997| 		},
| 998| 998| 
| 999|    |-		"GARRISON":{
|    | 999|+		"GARRISON": {
|1000|1000| 			"enter": function() {
|1001|1001| 				// If the garrisonholder should pickup, warn it so it can take needed action
|1002|1002| 				var cmpGarrisonHolder = Engine.QueryInterface(this.order.data.target, IID_GarrisonHolder);
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1209|1209| 			// If the controller handled an order but some members rejected it,
|1210|1210| 			// they will have no orders and be in the FORMATIONMEMBER.IDLE state.
|1211|1211| 			if (this.orderQueue.length)
|1212|    |-			{
|    |1212|+			
|1213|1213| 				// We're leaving the formation, so stop our FormationWalk order
|1214|1214| 				if (this.FinishOrder())
|1215|1215| 					return;
|1216|    |-			}
|    |1216|+			
|1217|1217| 
|1218|1218| 			// No orders left, we're an individual now
|1219|1219| 			if (this.IsAnimal())
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1237|1237| 			// Move a tile outside the building
|1238|1238| 			let range = 4;
|1239|1239| 			if (this.CheckTargetRangeExplicit(msg.data.target, range, -1))
|1240|    |-			{
|    |1240|+			
|1241|1241| 				// We are already at the target, or can't move at all
|1242|1242| 				this.FinishOrder();
|1243|    |-			}
|    |1243|+			
|1244|1244| 			else
|1245|1245| 			{
|1246|1246| 				this.order.data.min = range;
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1458|1458| 
|1459|1459| 			"LosRangeUpdate": function(msg) {
|1460|1460| 				if (this.GetStance().targetVisibleEnemies)
|1461|    |-				{
|    |1461|+				
|1462|1462| 					// Start attacking one of the newly-seen enemy (if any)
|1463|1463| 					this.AttackEntitiesByPreference(msg.data.added);
|1464|    |-				}
|    |1464|+				
|1465|1465| 			},
|1466|1466| 
|1467|1467| 			"LosHealRangeUpdate": function(msg) {
|    | [NORMAL] ESLintBear (space-before-function-paren):
|    | Unexpected space before function parentheses.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1491|1491| 				this.SelectAnimation("move");
|1492|1492| 			},
|1493|1493| 
|1494|    |-			"leave": function () {
|    |1494|+			"leave": function() {
|1495|1495| 				this.SelectAnimation("idle");
|1496|1496| 				this.StopMoving();
|1497|1497| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1671|1671| 						// if nothing better to do, check if the guarded needs to be healed or repaired
|1672|1672| 						var cmpHealth = Engine.QueryInterface(this.isGuardOf, IID_Health);
|1673|1673| 						if (cmpHealth && cmpHealth.IsInjured())
|1674|    |-						{
|    |1674|+						
|1675|1675| 							if (this.CanHeal(this.isGuardOf))
|1676|1676| 								this.PushOrderFront("Heal", { "target": this.isGuardOf, "force": false });
|1677|1677| 							else if (this.CanRepair(this.isGuardOf))
|1678|1678| 								this.PushOrderFront("Repair", { "target": this.isGuardOf, "autocontinue": false, "force": false });
|1679|    |-						}
|    |1679|+						
|1680|1680| 					}
|1681|1681| 				},
|1682|1682| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1960|1960| 
|1961|1961| 				"Attacked": function(msg) {
|1962|1962| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|1963|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|1964|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |1963|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |1964|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|1965|1965| 						this.RespondToTargetedEntities([msg.data.attacker]);
|1966|1966| 				},
|1967|1967| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2013|2013| 					this.SelectAnimation("move");
|2014|2014| 					var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|2015|2015| 					if (cmpUnitAI && cmpUnitAI.IsFleeing())
|2016|    |-					{
|    |2016|+					
|2017|2017| 						// Run after a fleeing target
|2018|2018| 						this.SetSpeedMultiplier(this.GetRunMultiplier());
|2019|    |-					}
|    |2019|+					
|2020|2020| 					this.StartTimer(1000, 1000);
|2021|2021| 				},
|2022|2022| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2195|2195| 
|2196|2196| 					var cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply);
|2197|2197| 					if (cmpSupply && cmpSupply.IsAvailable(cmpOwnership.GetOwner(), this.entity))
|2198|    |-					{
|    |2198|+					
|2199|2199| 						// Check we can still reach and gather from the target
|2200|2200| 						if (this.CheckTargetRange(this.gatheringTarget, IID_ResourceGatherer) && this.CanGather(this.gatheringTarget))
|2201|2201| 						{
|2258|2258| 								return;
|2259|2259| 							}
|2260|2260| 						}
|2261|    |-					}
|    |2261|+					
|2262|2262| 
|2263|2263| 					// We're already in range, can't get anywhere near it or the target is exhausted.
|2264|2264| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2284|2284| 					// Also don't switch to a different type of huntable animal
|2285|2285| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2286|2286| 						return (
|2287|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2288|    |-							|| (type.specific == resourceType.specific
|    |2287|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2288|+							(type.specific == resourceType.specific
|2289|2289| 							&& (type.specific != "meat" || resourceTemplate == template))
|2290|2290| 						);
|2291|2291| 					});
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2285|2285| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2286|2286| 						return (
|2287|2287| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2288|    |-							|| (type.specific == resourceType.specific
|2289|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2288|+							|| (type.specific == resourceType.specific &&
|    |2289|+							(type.specific != "meat" || resourceTemplate == template))
|2290|2290| 						);
|2291|2291| 					});
|2292|2292| 					if (nearby)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2350|2350| 
|2351|2351| 				"Timer": function(msg) {
|2352|2352| 					if (this.ShouldAbandonChase(this.order.data.target, this.order.data.force, IID_Heal, null))
|2353|    |-					{
|    |2353|+					
|2354|2354| 						// Return to our original position unless we have a better order.
|2355|2355| 						if (!this.FinishOrder() && this.GetStance().respondHoldGround)
|2356|2356| 							this.WalkToHeldPosition();
|2357|    |-					}
|    |2357|+					
|2358|2358| 				},
|2359|2359| 
|2360|2360| 				"MovementUpdate": function() {
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2384|2384| 					this.StartTimer(prepare, this.healTimers.repeat);
|2385|2385| 
|2386|2386| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2387|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2387|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2388|2388| 
|2389|2389| 					this.FaceTowardsTarget(this.order.data.target);
|2390|2390| 				},
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2596|2596| 					{
|2597|2597| 						// The building was already finished/fully repaired before we arrived;
|2598|2598| 						// let the ConstructionFinished handler handle this.
|2599|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2599|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2600|2600| 						return true;
|2601|2601| 					}
|2602|2602| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2596|2596| 					{
|2597|2597| 						// The building was already finished/fully repaired before we arrived;
|2598|2598| 						// let the ConstructionFinished handler handle this.
|2599|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2599|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2600|2600| 						return true;
|2601|2601| 					}
|2602|2602| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2723|2723| 
|2724|2724| 				// Unit was approaching and there's nothing to do now, so switch to walking
|2725|2725| 				if (oldState === "INDIVIDUAL.REPAIR.APPROACHING")
|2726|    |-				{
|    |2726|+				
|2727|2727| 					// We're already walking to the given point, so add this as a order.
|2728|2728| 					this.WalkToTarget(msg.data.newentity, true);
|2729|    |-				}
|    |2729|+				
|2730|2730| 			},
|2731|2731| 		},
|2732|2732| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2785|2785| 
|2786|2786| 					// Check that we can garrison here
|2787|2787| 					if (this.CanGarrison(target))
|2788|    |-					{
|    |2788|+					
|2789|2789| 						// Check that we're in range of the garrison target
|2790|2790| 						if (this.CheckGarrisonRange(target))
|2791|2791| 						{
|2861|2861| 								return false;
|2862|2862| 							}
|2863|2863| 						}
|2864|    |-					}
|    |2864|+					
|2865|2865| 					// Garrisoning failed for some reason, so finish the order
|2866|2866| 					this.FinishOrder();
|2867|2867| 					return true;
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2982|2982| 		"Attacked": function(msg) {
|2983|2983| 			if (this.template.NaturalBehaviour == "skittish" ||
|2984|2984| 			    this.template.NaturalBehaviour == "passive")
|2985|    |-			{
|    |2985|+			
|2986|2986| 				this.Flee(msg.data.attacker, false);
|2987|    |-			}
|    |2987|+			
|2988|2988| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|2989|2989| 			{
|2990|2990| 				if (this.CanAttack(msg.data.attacker))
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2991|2991| 					this.Attack(msg.data.attacker, false);
|2992|2992| 			}
|2993|2993| 			else if (this.template.NaturalBehaviour == "domestic")
|2994|    |-			{
|    |2994|+			
|2995|2995| 				// Never flee, stop what we were doing
|2996|2996| 				this.SetNextState("IDLE");
|2997|    |-			}
|    |2997|+			
|2998|2998| 		},
|2999|2999| 
|3000|3000| 		"Order.LeaveFoundation": function(msg) {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3046|3046| 				}
|3047|3047| 				// Start attacking one of the newly-seen enemy (if any)
|3048|3048| 				else if (this.IsDangerousAnimal())
|3049|    |-				{
|    |3049|+				
|3050|3050| 					this.AttackVisibleEntity(msg.data.added);
|3051|    |-				}
|    |3051|+				
|3052|3052| 
|3053|3053| 				// TODO: if two units enter our range together, we'll attack the
|3054|3054| 				// first and then the second won't trigger another LosRangeUpdate
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3089|3089| 				}
|3090|3090| 				// Start attacking one of the newly-seen enemy (if any)
|3091|3091| 				else if (this.template.NaturalBehaviour == "violent")
|3092|    |-				{
|    |3092|+				
|3093|3093| 					this.AttackVisibleEntity(msg.data.added);
|3094|    |-				}
|    |3094|+				
|3095|3095| 			},
|3096|3096| 
|3097|3097| 			"Timer": function(msg) {
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 7.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3104|3104| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3105|3105| 
|3106|3106| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3107|    |-							// only used for domestic animals
|    |3107|+		// only used for domestic animals
|3108|3108| 	},
|3109|3109| };
|3110|3110| 
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3161|3161| 
|3162|3162| UnitAI.prototype.IsAnimal = function()
|3163|3163| {
|3164|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3164|+	return (!!this.template.NaturalBehaviour);
|3165|3165| };
|3166|3166| 
|3167|3167| UnitAI.prototype.IsDangerousAnimal = function()
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3199|3199| UnitAI.prototype.GetGarrisonHolder = function()
|3200|3200| {
|3201|3201| 	if (this.IsGarrisoned())
|3202|    |-	{
|    |3202|+	
|3203|3203| 		for (let order of this.orderQueue)
|3204|3204| 			if (order.type == "Garrison")
|3205|3205| 				return order.data.target;
|3206|    |-	}
|    |3206|+	
|3207|3207| 	return INVALID_ENTITY;
|3208|3208| };
|3209|3209| 
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3277|3277| 		{
|3278|3278| 			let index = this.GetCurrentState().indexOf(".");
|3279|3279| 			if (index != -1)
|3280|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3280|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3281|3281| 			this.Stop(false);
|3282|3282| 		}
|3283|3283| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3333|3333| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3334|3334| 			continue;
|3335|3335| 		if (i == 0)
|3336|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3336|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3337|3337| 		else
|3338|3338| 			this.orderQueue.splice(i, 1);
|3339|3339| 		Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3333|3333| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3334|3334| 			continue;
|3335|3335| 		if (i == 0)
|3336|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3336|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3337|3337| 		else
|3338|3338| 			this.orderQueue.splice(i, 1);
|3339|3339| 		Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3417|3417| };
|3418|3418| 
|3419|3419| 
|3420|    |-//// FSM linkage functions ////
|    |3420|+// // FSM linkage functions ////
|3421|3421| 
|3422|3422| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3423|3423| UnitAI.prototype.SetNextState = function(state)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3589|3589| 				continue;
|3590|3590| 			if (this.orderQueue[i].type == type)
|3591|3591| 				continue;
|3592|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3592|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3593|3593| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3594|3594| 			return;
|3595|3595| 		}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3589|3589| 				continue;
|3590|3590| 			if (this.orderQueue[i].type == type)
|3591|3591| 				continue;
|3592|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3592|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3593|3593| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3594|3594| 			return;
|3595|3595| 		}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3603|3603| {
|3604|3604| 	// Remember the previous work orders to be able to go back to them later if required
|3605|3605| 	if (data && data.force)
|3606|    |-	{
|    |3606|+	
|3607|3607| 		if (this.IsFormationController())
|3608|3608| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3609|3609| 		else
|3610|3610| 			this.UpdateWorkOrders(type);
|3611|    |-	}
|    |3611|+	
|3612|3612| 
|3613|3613| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3614|3614| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3680|3680| 	{
|3681|3681| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3682|3682| 		if (cmpUnitAI)
|3683|    |-		{
|    |3683|+		
|3684|3684| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3685|3685| 			{
|3686|3686| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3689|3689| 					return;
|3690|3690| 				}
|3691|3691| 			}
|3692|    |-		}
|    |3692|+		
|3693|3693| 	}
|3694|3694| 
|3695|3695| 	// If nothing found, take the unit orders
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3682|3682| 		if (cmpUnitAI)
|3683|3683| 		{
|3684|3684| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3685|    |-			{
|    |3685|+			
|3686|3686| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3687|3687| 				{
|3688|3688| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3689|3689| 					return;
|3690|3690| 				}
|3691|    |-			}
|    |3691|+			
|3692|3692| 		}
|3693|3693| 	}
|3694|3694| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3694|3694| 
|3695|3695| 	// If nothing found, take the unit orders
|3696|3696| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3697|    |-	{
|    |3697|+	
|3698|3698| 		if (isWorkType(this.orderQueue[i].type))
|3699|3699| 		{
|3700|3700| 			this.workOrders = this.orderQueue.slice(i);
|3701|3701| 			return;
|3702|3702| 		}
|3703|    |-	}
|    |3703|+	
|3704|3704| };
|3705|3705| 
|3706|3706| UnitAI.prototype.BackToWork = function()
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3760|3760| 	if (data.timerRepeat === undefined)
|3761|3761| 		this.timer = undefined;
|3762|3762| 
|3763|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3763|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3764|3764| };
|3765|3765| 
|3766|3766| /**
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3760|3760| 	if (data.timerRepeat === undefined)
|3761|3761| 		this.timer = undefined;
|3762|3762| 
|3763|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3763|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3764|3764| };
|3765|3765| 
|3766|3766| /**
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3795|3795| 	this.timer = undefined;
|3796|3796| };
|3797|3797| 
|3798|    |-//// Message handlers /////
|    |3798|+// // Message handlers /////
|3799|3799| 
|3800|3800| UnitAI.prototype.OnMotionChanged = function(msg)
|3801|3801| {
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3807|3807| 	// TODO: This is a bit inefficient since every unit listens to every
|3808|3808| 	// construction message - ideally we could scope it to only the one we're building
|3809|3809| 
|3810|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3810|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3811|3811| };
|3812|3812| 
|3813|3813| UnitAI.prototype.OnGlobalEntityRenamed = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3807|3807| 	// TODO: This is a bit inefficient since every unit listens to every
|3808|3808| 	// construction message - ideally we could scope it to only the one we're building
|3809|3809| 
|3810|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3810|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3811|3811| };
|3812|3812| 
|3813|3813| UnitAI.prototype.OnGlobalEntityRenamed = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3832|3832| 
|3833|3833| UnitAI.prototype.OnAttacked = function(msg)
|3834|3834| {
|3835|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3835|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3836|3836| };
|3837|3837| 
|3838|3838| UnitAI.prototype.OnGuardedAttacked = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3832|3832| 
|3833|3833| UnitAI.prototype.OnAttacked = function(msg)
|3834|3834| {
|3835|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3835|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3836|3836| };
|3837|3837| 
|3838|3838| UnitAI.prototype.OnGuardedAttacked = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3837|3837| 
|3838|3838| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3839|3839| {
|3840|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3840|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|3841|3841| };
|3842|3842| 
|3843|3843| UnitAI.prototype.OnHealthChanged = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3837|3837| 
|3838|3838| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3839|3839| {
|3840|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3840|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|3841|3841| };
|3842|3842| 
|3843|3843| UnitAI.prototype.OnHealthChanged = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3842|3842| 
|3843|3843| UnitAI.prototype.OnHealthChanged = function(msg)
|3844|3844| {
|3845|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3845|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|3846|3846| };
|3847|3847| 
|3848|3848| UnitAI.prototype.OnRangeUpdate = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3842|3842| 
|3843|3843| UnitAI.prototype.OnHealthChanged = function(msg)
|3844|3844| {
|3845|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3845|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|3846|3846| };
|3847|3847| 
|3848|3848| UnitAI.prototype.OnRangeUpdate = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3848|3848| UnitAI.prototype.OnRangeUpdate = function(msg)
|3849|3849| {
|3850|3850| 	if (msg.tag == this.losRangeQuery)
|3851|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3851|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|3852|3852| 	else if (msg.tag == this.losHealRangeQuery)
|3853|3853| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3854|3854| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3848|3848| UnitAI.prototype.OnRangeUpdate = function(msg)
|3849|3849| {
|3850|3850| 	if (msg.tag == this.losRangeQuery)
|3851|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3851|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|3852|3852| 	else if (msg.tag == this.losHealRangeQuery)
|3853|3853| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3854|3854| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3850|3850| 	if (msg.tag == this.losRangeQuery)
|3851|3851| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3852|3852| 	else if (msg.tag == this.losHealRangeQuery)
|3853|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3853|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|3854|3854| };
|3855|3855| 
|3856|3856| UnitAI.prototype.OnPackFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3850|3850| 	if (msg.tag == this.losRangeQuery)
|3851|3851| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3852|3852| 	else if (msg.tag == this.losHealRangeQuery)
|3853|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3853|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|3854|3854| };
|3855|3855| 
|3856|3856| UnitAI.prototype.OnPackFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3855|3855| 
|3856|3856| UnitAI.prototype.OnPackFinished = function(msg)
|3857|3857| {
|3858|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3858|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|3859|3859| };
|3860|3860| 
|3861|3861| //// Helper functions to be called by the FSM ////
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3855|3855| 
|3856|3856| UnitAI.prototype.OnPackFinished = function(msg)
|3857|3857| {
|3858|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3858|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|3859|3859| };
|3860|3860| 
|3861|3861| //// Helper functions to be called by the FSM ////
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3858|3858| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|3859|3859| };
|3860|3860| 
|3861|    |-//// Helper functions to be called by the FSM ////
|    |3861|+// // Helper functions to be called by the FSM ////
|3862|3862| 
|3863|3863| UnitAI.prototype.GetWalkSpeed = function()
|3864|3864| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4045|4045| 			PlaySound(name, member);
|4046|4046| 	}
|4047|4047| 	else
|4048|    |-	{
|    |4048|+	
|4049|4049| 		// Otherwise use our own sounds
|4050|4050| 		PlaySound(name, this.entity);
|4051|    |-	}
|    |4051|+	
|4052|4052| };
|4053|4053| 
|4054|4054| /*
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4237|4237| 	else
|4238|4238| 		// return false? Or hope you come close enough?
|4239|4239| 		var parabolicMaxRange = 0;
|4240|    |-		//return false;
|    |4240|+		// return false;
|4241|4241| 
|4242|4242| 	// the parabole changes while walking, take something in the middle
|4243|4243| 	var guessedMaxRange = (range.max + parabolicMaxRange)/2;
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4324|4324| 	if (this.IsFormationMember())
|4325|4325| 	{
|4326|4326| 		var cmpFormationUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|4327|    |-		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation()
|4328|    |-			&& cmpFormationUnitAI.order.data.target == target)
|    |4327|+		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation() &&
|    |4328|+			cmpFormationUnitAI.order.data.target == target)
|4329|4329| 			return true;
|4330|4330| 	}
|4331|4331| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4497|4497| UnitAI.prototype.AttackEntityInZone = function(ents)
|4498|4498| {
|4499|4499| 	var target = ents.find(target =>
|4500|    |-		this.CanAttack(target)
|4501|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4500|+		this.CanAttack(target) &&
|    |4501|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4502|4502| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4503|4503| 	);
|4504|4504| 	if (!target)
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4498|4498| {
|4499|4499| 	var target = ents.find(target =>
|4500|4500| 		this.CanAttack(target)
|4501|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4502|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4501|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4502|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4503|4503| 	);
|4504|4504| 	if (!target)
|4505|4505| 		return false;
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before 'Engine'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4562|4562| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4563|4563| 	if (this.isGuardOf)
|4564|4564| 	{
|4565|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4565|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4566|4566| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4567|4567| 		if (cmpUnitAI && cmpAttack &&
|4568|4568| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 4.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4566|4566| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4567|4567| 		if (cmpUnitAI && cmpAttack &&
|4568|4568| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4569|    |-				return false;
|    |4569|+			return false;
|4570|4570| 	}
|4571|4571| 
|4572|4572| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4571|4571| 
|4572|4572| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4573|4573| 	if (this.GetStance().respondHoldGround)
|4574|    |-	{
|    |4574|+	
|4575|4575| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4576|4576| 			return true;
|4577|    |-	}
|    |4577|+	
|4578|4578| 
|4579|4579| 	// Stop if it's left our vision range, unless we're especially persistent
|4580|4580| 	if (!this.GetStance().respondChaseBeyondVision)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4578|4578| 
|4579|4579| 	// Stop if it's left our vision range, unless we're especially persistent
|4580|4580| 	if (!this.GetStance().respondChaseBeyondVision)
|4581|    |-	{
|    |4581|+	
|4582|4582| 		if (!this.CheckTargetIsInVisionRange(target))
|4583|4583| 			return true;
|4584|    |-	}
|    |4584|+	
|4585|4585| 
|4586|4586| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4587|4587| 	// and will continue moving to its last seen position and then stop)
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before 'Engine'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4604|4604| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4605|4605| 	if (this.isGuardOf)
|4606|4606| 	{
|4607|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4607|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4608|4608| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4609|4609| 		if (cmpUnitAI && cmpAttack &&
|4610|4610| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4617|4617| 	return false;
|4618|4618| };
|4619|4619| 
|4620|    |-//// External interface functions ////
|    |4620|+// // External interface functions ////
|4621|4621| 
|4622|4622| UnitAI.prototype.SetFormationController = function(ent)
|4623|4623| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4627|4627| 	// of our own formation (or ourself if not in formation)
|4628|4628| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4629|4629| 	if (cmpObstruction)
|4630|    |-	{
|    |4630|+	
|4631|4631| 		if (ent == INVALID_ENTITY)
|4632|4632| 			cmpObstruction.SetControlGroup(this.entity);
|4633|4633| 		else
|4634|4634| 			cmpObstruction.SetControlGroup(ent);
|4635|    |-	}
|    |4635|+	
|4636|4636| 
|4637|4637| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4638|4638| 	if (ent == INVALID_ENTITY)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4770|4770| 	// if we already had an old guard order, do nothing if the target is the same
|4771|4771| 	// and the order is running, otherwise remove the previous order
|4772|4772| 	if (this.isGuardOf)
|4773|    |-	{
|    |4773|+	
|4774|4774| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4775|4775| 			return;
|4776|4776| 		else
|4777|4777| 			this.RemoveGuard();
|4778|    |-	}
|    |4778|+	
|4779|4779| 
|4780|4780| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4781|4781| };
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4773|4773| 	{
|4774|4774| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4775|4775| 			return;
|4776|    |-		else
|4777|    |-			this.RemoveGuard();
|    |4776|+		this.RemoveGuard();
|4778|4777| 	}
|4779|4778| 
|4780|4779| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|    | [NORMAL] ESLintBear (no-trailing-spaces):
|    | Trailing spaces not allowed.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5104|5104| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5105|5105| 	{
|5106|5106| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5107|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5107|+		if (cmpTrader.HasBothMarkets() &&
|5108|5108| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5109|5109| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5110|5110| 		{
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5385|5385| 				{
|5386|5386| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5387|5387| 					var targetClasses = this.order.data.targetClasses;
|5388|    |-					if (targetClasses.attack && cmpIdentity
|5389|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5388|+					if (targetClasses.attack && cmpIdentity &&
|    |5389|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5390|5390| 						continue;
|5391|5391| 					if (targetClasses.avoid && cmpIdentity
|5392|5392| 						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5388|5388| 					if (targetClasses.attack && cmpIdentity
|5389|5389| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5390|5390| 						continue;
|5391|    |-					if (targetClasses.avoid && cmpIdentity
|5392|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5391|+					if (targetClasses.avoid && cmpIdentity &&
|    |5392|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5393|5393| 						continue;
|5394|5394| 					// Only used by the AIs to prevent some choices of targets
|5395|5395| 					if (targetClasses.vetoEntities && targetClasses.vetoEntities[targ])
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5411|5411| 		{
|5412|5412| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5413|5413| 			var targetClasses = this.order.data.targetClasses;
|5414|    |-			if (cmpIdentity && targetClasses.attack
|5415|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5414|+			if (cmpIdentity && targetClasses.attack &&
|    |5415|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5416|5416| 				continue;
|5417|5417| 			if (cmpIdentity && targetClasses.avoid
|5418|5418| 				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5414|5414| 			if (cmpIdentity && targetClasses.attack
|5415|5415| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5416|5416| 				continue;
|5417|    |-			if (cmpIdentity && targetClasses.avoid
|5418|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5417|+			if (cmpIdentity && targetClasses.avoid &&
|    |5418|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5419|5419| 				continue;
|5420|5420| 			// Only used by the AIs to prevent some choices of targets
|5421|5421| 			if (targetClasses.vetoEntities && targetClasses.vetoEntities[targ])
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5571|5571| 
|5572|5572| UnitAI.prototype.SetHeldPosition = function(x, z)
|5573|5573| {
|5574|    |-	this.heldPosition = {"x": x, "z": z};
|    |5574|+	this.heldPosition = { "x": x, "z": z};
|5575|5575| };
|5576|5576| 
|5577|5577| UnitAI.prototype.SetHeldPositionOnEntity = function(entity)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5571|5571| 
|5572|5572| UnitAI.prototype.SetHeldPosition = function(x, z)
|5573|5573| {
|5574|    |-	this.heldPosition = {"x": x, "z": z};
|    |5574|+	this.heldPosition = {"x": x, "z": z };
|5575|5575| };
|5576|5576| 
|5577|5577| UnitAI.prototype.SetHeldPositionOnEntity = function(entity)
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5598|5598| 	return false;
|5599|5599| };
|5600|5600| 
|5601|    |-//// Helper functions ////
|    |5601|+// // Helper functions ////
|5602|5602| 
|5603|5603| UnitAI.prototype.CanAttack = function(target)
|5604|5604| {
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5802|5802| 	return cmpPack && cmpPack.IsPacking();
|5803|5803| };
|5804|5804| 
|5805|    |-//// Formation specific functions ////
|    |5805|+// // Formation specific functions ////
|5806|5806| 
|5807|5807| UnitAI.prototype.IsAttackingAsFormation = function()
|5808|5808| {
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5807|5807| UnitAI.prototype.IsAttackingAsFormation = function()
|5808|5808| {
|5809|5809| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5810|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5811|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5810|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5811|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5812|5812| };
|5813|5813| 
|5814|5814| //// Animal specific functions ////
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5811|5811| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5812|5812| };
|5813|5813| 
|5814|    |-//// Animal specific functions ////
|    |5814|+// // Animal specific functions ////
|5815|5815| 
|5816|5816| UnitAI.prototype.MoveRandomly = function(distance)
|5817|5817| {

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
| 889| »   »   »   "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
| 911| »   »   »   "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
| 958| »   »   »   »   »   return·true;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'enter' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
|1021| »   »   »   »   "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
|1056| »   »   »   "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
|1088| »   »   »   »   "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
|1302| »   »   »   "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
|1485| »   »   »   "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
|1506| »   »   »   "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
|1691| »   »   »   "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
|1742| »   »   »   »   "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
|1817| »   »   »   »   "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
|1987| »   »   »   »   »   »   return·true;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'enter' expected no return value.

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|2003| »   »   »   »   "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
|2093| »   »   »   »   "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
|2274| »   »   »   »   »   »   let·nearby·=·this.FindNearestDropsite(resourceType.generic);
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'nearby' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|2329| »   »   »   »   "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
|2447| »   »   »   »   "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
|2512| »   »   »   »   "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
|2755| »   »   »   »   "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
|3665| »   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
|4484| »   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
|4499| »   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
|4545| »   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
|4568| »   »   ····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
|1964| »   »   »   »   »   »   &&·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
|2269| »   »   »   »   »   var·cmpResourceGatherer·=·Engine.QueryInterface(this.entity,·IID_ResourceGatherer);
|    | [NORMAL] JSHintBear:
|    | 'cmpResourceGatherer' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|2285| »   »   »   »   »   var·nearby·=·this.FindNearbyResource(function(ent,·type,·template)·{
|    | [NORMAL] JSHintBear:
|    | 'nearby' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|2288| »   »   »   »   »   »   »   ||·(type.specific·==·resourceType.specific
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '||'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
|2289| »   »   »   »   »   »   »   &&·(type.specific·!=·"meat"·||·resourceTemplate·==·template))
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
|2309| »   »   »   »   »   var·nearby·=·this.FindNearestDropsite(resourceType.generic);
|    | [NORMAL] JSHintBear:
|    | 'nearby' is already defined.

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

binaries/data/mods/public/simulation/components/UnitAI.js
|2702| »   »   »   »   »   var·cmpResourceDropsite·=·Engine.QueryInterface(msg.data.newentity,·IID_ResourceDropsite);
|    | [NORMAL] JSHintBear:
|    | 'cmpResourceDropsite' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|2787| »   »   »   »   »   if·(this.CanGarrison(target))
|    | [NORMAL] JSHintBear:
|    | 'target' used out of scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|2790| »   »   »   »   »   »   if·(this.CheckGarrisonRange(target))
|    | [NORMAL] JSHintBear:
|    | 'target' used out of scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|2792| »   »   »   »   »   »   »   var·cmpGarrisonHolder·=·Engine.QueryInterface(target,·IID_GarrisonHolder);
|    | [NORMAL] JSHintBear:
|    | 'target' used out of scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|2814| »   »   »   »   »   »   »   »   var·cmpResourceDropsite·=·Engine.QueryInterface(target,·IID_ResourceDropsite);
|    | [NORMAL] JSHintBear:
|    | 'target' used out of scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|2815| »   »   »   »   »   »   »   »   if·(cmpResourceDropsite·&&·this.CanReturnResource(target,·true))
|    | [NORMAL] JSHintBear:
|    | 'target' used out of scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|2830| »   »   »   »   »   »   »   »   »   var·cmpHolderPosition·=·Engine.QueryInterface(target,·IID_Position);
|    | [NORMAL] JSHintBear:
|    | 'target' used out of scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|2831| »   »   »   »   »   »   »   »   »   var·cmpHolderUnitAI·=·Engine.QueryInterface(target,·IID_UnitAI);
|    | [NORMAL] JSHintBear:
|    | 'target' used out of scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|2858| »   »   »   »   »   »   »   if·(!this.CheckTargetRangeExplicit(target,·0,·0)·&&·this.MoveToTarget(target))
|    | [NORMAL] JSHintBear:
|    | 'target' used out of scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|2858| »   »   »   »   »   »   »   if·(!this.CheckTargetRangeExplicit(target,·0,·0)·&&·this.MoveToTarget(target))
|    | [NORMAL] JSHintBear:
|    | 'target' used out of scope.

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4239| »   »   var·parabolicMaxRange·=·0;
|    | [NORMAL] JSHintBear:
|    | 'parabolicMaxRange' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|4243| »   var·guessedMaxRange·=·(range.max·+·parabolicMaxRange)/2;
|    | [NORMAL] JSHintBear:
|    | 'parabolicMaxRange' used out of scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|4250| »   return·cmpUnitMotion.MoveToTargetRange(target,·range.min,·Math.min(range.max,·parabolicMaxRange));
|    | [NORMAL] JSHintBear:
|    | 'parabolicMaxRange' used out of scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|4328| »   »   »   &&·cmpFormationUnitAI.order.data.target·==·target)
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

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

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

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

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

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

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

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

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

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

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

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

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

wraitii added inline comments.Wed, Jul 3, 3:13 PM
binaries/data/mods/public/simulation/components/UnitAI.js
1802 ↗(On Diff #8695)

For sanity I should check and if false call finish order here.

wraitii updated this revision to Diff 8704.Wed, Jul 3, 6:21 PM

Better comment & FinishOrder

Vulcan added a comment.Wed, Jul 3, 6:22 PM

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.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/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.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/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'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/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.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 734| 734| 			}
| 735| 735| 			// Check if we are already in range, otherwise walk there
| 736| 736| 			if (!this.CheckGarrisonRange(msg.data.target))
| 737|    |-			{
|    | 737|+			
| 738| 738| 				if (!this.CheckTargetVisible(msg.data.target))
| 739| 739| 				{
| 740| 740| 					this.FinishOrder();
| 745| 745| 					this.SetNextState("GARRISON.APPROACHING");
| 746| 746| 					return;
| 747| 747| 				}
| 748|    |-			}
|    | 748|+			
| 749| 749| 
| 750| 750| 			this.SetNextState("GARRISON.GARRISONING");
| 751| 751| 		},
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 740| 740| 					this.FinishOrder();
| 741| 741| 					return;
| 742| 742| 				}
| 743|    |-				else
| 744|    |-				{
|    | 743|+				
| 745| 744| 					this.SetNextState("GARRISON.APPROACHING");
| 746| 745| 					return;
| 747|    |-				}
|    | 746|+				
| 748| 747| 			}
| 749| 748| 
| 750| 749| 			this.SetNextState("GARRISON.GARRISONING");
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 763| 763| 						this.PushOrderFront("Walk", msg.data.lastPos);
| 764| 764| 					}
| 765| 765| 					else
| 766|    |-					{
|    | 766|+					
| 767| 767| 						// We couldn't move there, or the target moved away
| 768| 768| 						this.FinishOrder();
| 769|    |-					}
|    | 769|+					
| 770| 770| 					return;
| 771| 771| 				}
| 772| 772| 
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'GARRISON'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 996| 996| 			},
| 997| 997| 		},
| 998| 998| 
| 999|    |-		"GARRISON":{
|    | 999|+		"GARRISON": {
|1000|1000| 			"enter": function() {
|1001|1001| 				// If the garrisonholder should pickup, warn it so it can take needed action
|1002|1002| 				var cmpGarrisonHolder = Engine.QueryInterface(this.order.data.target, IID_GarrisonHolder);
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1209|1209| 			// If the controller handled an order but some members rejected it,
|1210|1210| 			// they will have no orders and be in the FORMATIONMEMBER.IDLE state.
|1211|1211| 			if (this.orderQueue.length)
|1212|    |-			{
|    |1212|+			
|1213|1213| 				// We're leaving the formation, so stop our FormationWalk order
|1214|1214| 				if (this.FinishOrder())
|1215|1215| 					return;
|1216|    |-			}
|    |1216|+			
|1217|1217| 
|1218|1218| 			// No orders left, we're an individual now
|1219|1219| 			if (this.IsAnimal())
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1237|1237| 			// Move a tile outside the building
|1238|1238| 			let range = 4;
|1239|1239| 			if (this.CheckTargetRangeExplicit(msg.data.target, range, -1))
|1240|    |-			{
|    |1240|+			
|1241|1241| 				// We are already at the target, or can't move at all
|1242|1242| 				this.FinishOrder();
|1243|    |-			}
|    |1243|+			
|1244|1244| 			else
|1245|1245| 			{
|1246|1246| 				this.order.data.min = range;
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1458|1458| 
|1459|1459| 			"LosRangeUpdate": function(msg) {
|1460|1460| 				if (this.GetStance().targetVisibleEnemies)
|1461|    |-				{
|    |1461|+				
|1462|1462| 					// Start attacking one of the newly-seen enemy (if any)
|1463|1463| 					this.AttackEntitiesByPreference(msg.data.added);
|1464|    |-				}
|    |1464|+				
|1465|1465| 			},
|1466|1466| 
|1467|1467| 			"LosHealRangeUpdate": function(msg) {
|    | [NORMAL] ESLintBear (space-before-function-paren):
|    | Unexpected space before function parentheses.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1491|1491| 				this.SelectAnimation("move");
|1492|1492| 			},
|1493|1493| 
|1494|    |-			"leave": function () {
|    |1494|+			"leave": function() {
|1495|1495| 				this.SelectAnimation("idle");
|1496|1496| 				this.StopMoving();
|1497|1497| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1671|1671| 						// if nothing better to do, check if the guarded needs to be healed or repaired
|1672|1672| 						var cmpHealth = Engine.QueryInterface(this.isGuardOf, IID_Health);
|1673|1673| 						if (cmpHealth && cmpHealth.IsInjured())
|1674|    |-						{
|    |1674|+						
|1675|1675| 							if (this.CanHeal(this.isGuardOf))
|1676|1676| 								this.PushOrderFront("Heal", { "target": this.isGuardOf, "force": false });
|1677|1677| 							else if (this.CanRepair(this.isGuardOf))
|1678|1678| 								this.PushOrderFront("Repair", { "target": this.isGuardOf, "autocontinue": false, "force": false });
|1679|    |-						}
|    |1679|+						
|1680|1680| 					}
|1681|1681| 				},
|1682|1682| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1961|1961| 
|1962|1962| 				"Attacked": function(msg) {
|1963|1963| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|1964|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|1965|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |1964|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |1965|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|1966|1966| 						this.RespondToTargetedEntities([msg.data.attacker]);
|1967|1967| 				},
|1968|1968| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2014|2014| 					this.SelectAnimation("move");
|2015|2015| 					var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|2016|2016| 					if (cmpUnitAI && cmpUnitAI.IsFleeing())
|2017|    |-					{
|    |2017|+					
|2018|2018| 						// Run after a fleeing target
|2019|2019| 						this.SetSpeedMultiplier(this.GetRunMultiplier());
|2020|    |-					}
|    |2020|+					
|2021|2021| 					this.StartTimer(1000, 1000);
|2022|2022| 				},
|2023|2023| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2196|2196| 
|2197|2197| 					var cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply);
|2198|2198| 					if (cmpSupply && cmpSupply.IsAvailable(cmpOwnership.GetOwner(), this.entity))
|2199|    |-					{
|    |2199|+					
|2200|2200| 						// Check we can still reach and gather from the target
|2201|2201| 						if (this.CheckTargetRange(this.gatheringTarget, IID_ResourceGatherer) && this.CanGather(this.gatheringTarget))
|2202|2202| 						{
|2259|2259| 								return;
|2260|2260| 							}
|2261|2261| 						}
|2262|    |-					}
|    |2262|+					
|2263|2263| 
|2264|2264| 					// We're already in range, can't get anywhere near it or the target is exhausted.
|2265|2265| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2285|2285| 					// Also don't switch to a different type of huntable animal
|2286|2286| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2287|2287| 						return (
|2288|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2289|    |-							|| (type.specific == resourceType.specific
|    |2288|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2289|+							(type.specific == resourceType.specific
|2290|2290| 							&& (type.specific != "meat" || resourceTemplate == template))
|2291|2291| 						);
|2292|2292| 					});
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2286|2286| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2287|2287| 						return (
|2288|2288| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2289|    |-							|| (type.specific == resourceType.specific
|2290|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2289|+							|| (type.specific == resourceType.specific &&
|    |2290|+							(type.specific != "meat" || resourceTemplate == template))
|2291|2291| 						);
|2292|2292| 					});
|2293|2293| 					if (nearby)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2351|2351| 
|2352|2352| 				"Timer": function(msg) {
|2353|2353| 					if (this.ShouldAbandonChase(this.order.data.target, this.order.data.force, IID_Heal, null))
|2354|    |-					{
|    |2354|+					
|2355|2355| 						// Return to our original position unless we have a better order.
|2356|2356| 						if (!this.FinishOrder() && this.GetStance().respondHoldGround)
|2357|2357| 							this.WalkToHeldPosition();
|2358|    |-					}
|    |2358|+					
|2359|2359| 				},
|2360|2360| 
|2361|2361| 				"MovementUpdate": function() {
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2385|2385| 					this.StartTimer(prepare, this.healTimers.repeat);
|2386|2386| 
|2387|2387| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2388|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2388|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2389|2389| 
|2390|2390| 					this.FaceTowardsTarget(this.order.data.target);
|2391|2391| 				},
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2597|2597| 					{
|2598|2598| 						// The building was already finished/fully repaired before we arrived;
|2599|2599| 						// let the ConstructionFinished handler handle this.
|2600|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2600|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2601|2601| 						return true;
|2602|2602| 					}
|2603|2603| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2597|2597| 					{
|2598|2598| 						// The building was already finished/fully repaired before we arrived;
|2599|2599| 						// let the ConstructionFinished handler handle this.
|2600|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2600|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2601|2601| 						return true;
|2602|2602| 					}
|2603|2603| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2724|2724| 
|2725|2725| 				// Unit was approaching and there's nothing to do now, so switch to walking
|2726|2726| 				if (oldState === "INDIVIDUAL.REPAIR.APPROACHING")
|2727|    |-				{
|    |2727|+				
|2728|2728| 					// We're already walking to the given point, so add this as a order.
|2729|2729| 					this.WalkToTarget(msg.data.newentity, true);
|2730|    |-				}
|    |2730|+				
|2731|2731| 			},
|2732|2732| 		},
|2733|2733| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2786|2786| 
|2787|2787| 					// Check that we can garrison here
|2788|2788| 					if (this.CanGarrison(target))
|2789|    |-					{
|    |2789|+					
|2790|2790| 						// Check that we're in range of the garrison target
|2791|2791| 						if (this.CheckGarrisonRange(target))
|2792|2792| 						{
|2862|2862| 								return false;
|2863|2863| 							}
|2864|2864| 						}
|2865|    |-					}
|    |2865|+					
|2866|2866| 					// Garrisoning failed for some reason, so finish the order
|2867|2867| 					this.FinishOrder();
|2868|2868| 					return true;
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2983|2983| 		"Attacked": function(msg) {
|2984|2984| 			if (this.template.NaturalBehaviour == "skittish" ||
|2985|2985| 			    this.template.NaturalBehaviour == "passive")
|2986|    |-			{
|    |2986|+			
|2987|2987| 				this.Flee(msg.data.attacker, false);
|2988|    |-			}
|    |2988|+			
|2989|2989| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|2990|2990| 			{
|2991|2991| 				if (this.CanAttack(msg.data.attacker))
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2992|2992| 					this.Attack(msg.data.attacker, false);
|2993|2993| 			}
|2994|2994| 			else if (this.template.NaturalBehaviour == "domestic")
|2995|    |-			{
|    |2995|+			
|2996|2996| 				// Never flee, stop what we were doing
|2997|2997| 				this.SetNextState("IDLE");
|2998|    |-			}
|    |2998|+			
|2999|2999| 		},
|3000|3000| 
|3001|3001| 		"Order.LeaveFoundation": function(msg) {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3047|3047| 				}
|3048|3048| 				// Start attacking one of the newly-seen enemy (if any)
|3049|3049| 				else if (this.IsDangerousAnimal())
|3050|    |-				{
|    |3050|+				
|3051|3051| 					this.AttackVisibleEntity(msg.data.added);
|3052|    |-				}
|    |3052|+				
|3053|3053| 
|3054|3054| 				// TODO: if two units enter our range together, we'll attack the
|3055|3055| 				// first and then the second won't trigger another LosRangeUpdate
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3090|3090| 				}
|3091|3091| 				// Start attacking one of the newly-seen enemy (if any)
|3092|3092| 				else if (this.template.NaturalBehaviour == "violent")
|3093|    |-				{
|    |3093|+				
|3094|3094| 					this.AttackVisibleEntity(msg.data.added);
|3095|    |-				}
|    |3095|+				
|3096|3096| 			},
|3097|3097| 
|3098|3098| 			"Timer": function(msg) {
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 7.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3105|3105| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3106|3106| 
|3107|3107| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3108|    |-							// only used for domestic animals
|    |3108|+		// only used for domestic animals
|3109|3109| 	},
|3110|3110| };
|3111|3111| 
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3162|3162| 
|3163|3163| UnitAI.prototype.IsAnimal = function()
|3164|3164| {
|3165|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3165|+	return (!!this.template.NaturalBehaviour);
|3166|3166| };
|3167|3167| 
|3168|3168| UnitAI.prototype.IsDangerousAnimal = function()
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3200|3200| UnitAI.prototype.GetGarrisonHolder = function()
|3201|3201| {
|3202|3202| 	if (this.IsGarrisoned())
|3203|    |-	{
|    |3203|+	
|3204|3204| 		for (let order of this.orderQueue)
|3205|3205| 			if (order.type == "Garrison")
|3206|3206| 				return order.data.target;
|3207|    |-	}
|    |3207|+	
|3208|3208| 	return INVALID_ENTITY;
|3209|3209| };
|3210|3210| 
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3278|3278| 		{
|3279|3279| 			let index = this.GetCurrentState().indexOf(".");
|3280|3280| 			if (index != -1)
|3281|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3281|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3282|3282| 			this.Stop(false);
|3283|3283| 		}
|3284|3284| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3334|3334| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3335|3335| 			continue;
|3336|3336| 		if (i == 0)
|3337|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3337|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3338|3338| 		else
|3339|3339| 			this.orderQueue.splice(i, 1);
|3340|3340| 		Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3334|3334| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3335|3335| 			continue;
|3336|3336| 		if (i == 0)
|3337|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3337|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3338|3338| 		else
|3339|3339| 			this.orderQueue.splice(i, 1);
|3340|3340| 		Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3418|3418| };
|3419|3419| 
|3420|3420| 
|3421|    |-//// FSM linkage functions ////
|    |3421|+// // FSM linkage functions ////
|3422|3422| 
|3423|3423| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3424|3424| UnitAI.prototype.SetNextState = function(state)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3590|3590| 				continue;
|3591|3591| 			if (this.orderQueue[i].type == type)
|3592|3592| 				continue;
|3593|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3593|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3594|3594| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3595|3595| 			return;
|3596|3596| 		}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3590|3590| 				continue;
|3591|3591| 			if (this.orderQueue[i].type == type)
|3592|3592| 				continue;
|3593|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3593|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3594|3594| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3595|3595| 			return;
|3596|3596| 		}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3604|3604| {
|3605|3605| 	// Remember the previous work orders to be able to go back to them later if required
|3606|3606| 	if (data && data.force)
|3607|    |-	{
|    |3607|+	
|3608|3608| 		if (this.IsFormationController())
|3609|3609| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3610|3610| 		else
|3611|3611| 			this.UpdateWorkOrders(type);
|3612|    |-	}
|    |3612|+	
|3613|3613| 
|3614|3614| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3615|3615| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3681|3681| 	{
|3682|3682| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3683|3683| 		if (cmpUnitAI)
|3684|    |-		{
|    |3684|+		
|3685|3685| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3686|3686| 			{
|3687|3687| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3690|3690| 					return;
|3691|3691| 				}
|3692|3692| 			}
|3693|    |-		}
|    |3693|+		
|3694|3694| 	}
|3695|3695| 
|3696|3696| 	// If nothing found, take the unit orders
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3683|3683| 		if (cmpUnitAI)
|3684|3684| 		{
|3685|3685| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3686|    |-			{
|    |3686|+			
|3687|3687| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3688|3688| 				{
|3689|3689| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3690|3690| 					return;
|3691|3691| 				}
|3692|    |-			}
|    |3692|+			
|3693|3693| 		}
|3694|3694| 	}
|3695|3695| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3695|3695| 
|3696|3696| 	// If nothing found, take the unit orders
|3697|3697| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3698|    |-	{
|    |3698|+	
|3699|3699| 		if (isWorkType(this.orderQueue[i].type))
|3700|3700| 		{
|3701|3701| 			this.workOrders = this.orderQueue.slice(i);
|3702|3702| 			return;
|3703|3703| 		}
|3704|    |-	}
|    |3704|+	
|3705|3705| };
|3706|3706| 
|3707|3707| UnitAI.prototype.BackToWork = function()
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3761|3761| 	if (data.timerRepeat === undefined)
|3762|3762| 		this.timer = undefined;
|3763|3763| 
|3764|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3764|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3765|3765| };
|3766|3766| 
|3767|3767| /**
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3761|3761| 	if (data.timerRepeat === undefined)
|3762|3762| 		this.timer = undefined;
|3763|3763| 
|3764|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3764|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3765|3765| };
|3766|3766| 
|3767|3767| /**
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3796|3796| 	this.timer = undefined;
|3797|3797| };
|3798|3798| 
|3799|    |-//// Message handlers /////
|    |3799|+// // Message handlers /////
|3800|3800| 
|3801|3801| UnitAI.prototype.OnMotionChanged = function(msg)
|3802|3802| {
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3808|3808| 	// TODO: This is a bit inefficient since every unit listens to every
|3809|3809| 	// construction message - ideally we could scope it to only the one we're building
|3810|3810| 
|3811|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3811|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3812|3812| };
|3813|3813| 
|3814|3814| UnitAI.prototype.OnGlobalEntityRenamed = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3808|3808| 	// TODO: This is a bit inefficient since every unit listens to every
|3809|3809| 	// construction message - ideally we could scope it to only the one we're building
|3810|3810| 
|3811|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3811|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3812|3812| };
|3813|3813| 
|3814|3814| UnitAI.prototype.OnGlobalEntityRenamed = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3833|3833| 
|3834|3834| UnitAI.prototype.OnAttacked = function(msg)
|3835|3835| {
|3836|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3836|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3837|3837| };
|3838|3838| 
|3839|3839| UnitAI.prototype.OnGuardedAttacked = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3833|3833| 
|3834|3834| UnitAI.prototype.OnAttacked = function(msg)
|3835|3835| {
|3836|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3836|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3837|3837| };
|3838|3838| 
|3839|3839| UnitAI.prototype.OnGuardedAttacked = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3838|3838| 
|3839|3839| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3840|3840| {
|3841|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3841|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|3842|3842| };
|3843|3843| 
|3844|3844| UnitAI.prototype.OnHealthChanged = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3838|3838| 
|3839|3839| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3840|3840| {
|3841|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3841|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|3842|3842| };
|3843|3843| 
|3844|3844| UnitAI.prototype.OnHealthChanged = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3843|3843| 
|3844|3844| UnitAI.prototype.OnHealthChanged = function(msg)
|3845|3845| {
|3846|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3846|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|3847|3847| };
|3848|3848| 
|3849|3849| UnitAI.prototype.OnRangeUpdate = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3843|3843| 
|3844|3844| UnitAI.prototype.OnHealthChanged = function(msg)
|3845|3845| {
|3846|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3846|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|3847|3847| };
|3848|3848| 
|3849|3849| UnitAI.prototype.OnRangeUpdate = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3849|3849| UnitAI.prototype.OnRangeUpdate = function(msg)
|3850|3850| {
|3851|3851| 	if (msg.tag == this.losRangeQuery)
|3852|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3852|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|3853|3853| 	else if (msg.tag == this.losHealRangeQuery)
|3854|3854| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3855|3855| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3849|3849| UnitAI.prototype.OnRangeUpdate = function(msg)
|3850|3850| {
|3851|3851| 	if (msg.tag == this.losRangeQuery)
|3852|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3852|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|3853|3853| 	else if (msg.tag == this.losHealRangeQuery)
|3854|3854| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3855|3855| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3851|3851| 	if (msg.tag == this.losRangeQuery)
|3852|3852| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3853|3853| 	else if (msg.tag == this.losHealRangeQuery)
|3854|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3854|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|3855|3855| };
|3856|3856| 
|3857|3857| UnitAI.prototype.OnPackFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3851|3851| 	if (msg.tag == this.losRangeQuery)
|3852|3852| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3853|3853| 	else if (msg.tag == this.losHealRangeQuery)
|3854|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3854|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|3855|3855| };
|3856|3856| 
|3857|3857| UnitAI.prototype.OnPackFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3856|3856| 
|3857|3857| UnitAI.prototype.OnPackFinished = function(msg)
|3858|3858| {
|3859|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3859|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|3860|3860| };
|3861|3861| 
|3862|3862| //// Helper functions to be called by the FSM ////
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3856|3856| 
|3857|3857| UnitAI.prototype.OnPackFinished = function(msg)
|3858|3858| {
|3859|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3859|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|3860|3860| };
|3861|3861| 
|3862|3862| //// Helper functions to be called by the FSM ////
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3859|3859| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|3860|3860| };
|3861|3861| 
|3862|    |-//// Helper functions to be called by the FSM ////
|    |3862|+// // Helper functions to be called by the FSM ////
|3863|3863| 
|3864|3864| UnitAI.prototype.GetWalkSpeed = function()
|3865|3865| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4046|4046| 			PlaySound(name, member);
|4047|4047| 	}
|4048|4048| 	else
|4049|    |-	{
|    |4049|+	
|4050|4050| 		// Otherwise use our own sounds
|4051|4051| 		PlaySound(name, this.entity);
|4052|    |-	}
|    |4052|+	
|4053|4053| };
|4054|4054| 
|4055|4055| /*
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4238|4238| 	else
|4239|4239| 		// return false? Or hope you come close enough?
|4240|4240| 		var parabolicMaxRange = 0;
|4241|    |-		//return false;
|    |4241|+		// return false;
|4242|4242| 
|4243|4243| 	// the parabole changes while walking, take something in the middle
|4244|4244| 	var guessedMaxRange = (range.max + parabolicMaxRange)/2;
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4325|4325| 	if (this.IsFormationMember())
|4326|4326| 	{
|4327|4327| 		var cmpFormationUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|4328|    |-		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation()
|4329|    |-			&& cmpFormationUnitAI.order.data.target == target)
|    |4328|+		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation() &&
|    |4329|+			cmpFormationUnitAI.order.data.target == target)
|4330|4330| 			return true;
|4331|4331| 	}
|4332|4332| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4498|4498| UnitAI.prototype.AttackEntityInZone = function(ents)
|4499|4499| {
|4500|4500| 	var target = ents.find(target =>
|4501|    |-		this.CanAttack(target)
|4502|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4501|+		this.CanAttack(target) &&
|    |4502|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4503|4503| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4504|4504| 	);
|4505|4505| 	if (!target)
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4499|4499| {
|4500|4500| 	var target = ents.find(target =>
|4501|4501| 		this.CanAttack(target)
|4502|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4503|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4502|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4503|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4504|4504| 	);
|4505|4505| 	if (!target)
|4506|4506| 		return false;
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before 'Engine'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4563|4563| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4564|4564| 	if (this.isGuardOf)
|4565|4565| 	{
|4566|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4566|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4567|4567| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4568|4568| 		if (cmpUnitAI && cmpAttack &&
|4569|4569| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 4.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4567|4567| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4568|4568| 		if (cmpUnitAI && cmpAttack &&
|4569|4569| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4570|    |-				return false;
|    |4570|+			return false;
|4571|4571| 	}
|4572|4572| 
|4573|4573| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4572|4572| 
|4573|4573| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4574|4574| 	if (this.GetStance().respondHoldGround)
|4575|    |-	{
|    |4575|+	
|4576|4576| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4577|4577| 			return true;
|4578|    |-	}
|    |4578|+	
|4579|4579| 
|4580|4580| 	// Stop if it's left our vision range, unless we're especially persistent
|4581|4581| 	if (!this.GetStance().respondChaseBeyondVision)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4579|4579| 
|4580|4580| 	// Stop if it's left our vision range, unless we're especially persistent
|4581|4581| 	if (!this.GetStance().respondChaseBeyondVision)
|4582|    |-	{
|    |4582|+	
|4583|4583| 		if (!this.CheckTargetIsInVisionRange(target))
|4584|4584| 			return true;
|4585|    |-	}
|    |4585|+	
|4586|4586| 
|4587|4587| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4588|4588| 	// and will continue moving to its last seen position and then stop)
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before 'Engine'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4605|4605| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4606|4606| 	if (this.isGuardOf)
|4607|4607| 	{
|4608|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4608|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4609|4609| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4610|4610| 		if (cmpUnitAI && cmpAttack &&
|4611|4611| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4618|4618| 	return false;
|4619|4619| };
|4620|4620| 
|4621|    |-//// External interface functions ////
|    |4621|+// // External interface functions ////
|4622|4622| 
|4623|4623| UnitAI.prototype.SetFormationController = function(ent)
|4624|4624| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4628|4628| 	// of our own formation (or ourself if not in formation)
|4629|4629| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4630|4630| 	if (cmpObstruction)
|4631|    |-	{
|    |4631|+	
|4632|4632| 		if (ent == INVALID_ENTITY)
|4633|4633| 			cmpObstruction.SetControlGroup(this.entity);
|4634|4634| 		else
|4635|4635| 			cmpObstruction.SetControlGroup(ent);
|4636|    |-	}
|    |4636|+	
|4637|4637| 
|4638|4638| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4639|4639| 	if (ent == INVALID_ENTITY)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4771|4771| 	// if we already had an old guard order, do nothing if the target is the same
|4772|4772| 	// and the order is running, otherwise remove the previous order
|4773|4773| 	if (this.isGuardOf)
|4774|    |-	{
|    |4774|+	
|4775|4775| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4776|4776| 			return;
|4777|4777| 		else
|4778|4778| 			this.RemoveGuard();
|4779|    |-	}
|    |4779|+	
|4780|4780| 
|4781|4781| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4782|4782| };
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4774|4774| 	{
|4775|4775| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4776|4776| 			return;
|4777|    |-		else
|4778|    |-			this.RemoveGuard();
|    |4777|+		this.RemoveGuard();
|4779|4778| 	}
|4780|4779| 
|4781|4780| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|    | [NORMAL] ESLintBear (no-trailing-spaces):
|    | Trailing spaces not allowed.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5105|5105| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5106|5106| 	{
|5107|5107| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5108|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5108|+		if (cmpTrader.HasBothMarkets() &&
|5109|5109| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5110|5110| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5111|5111| 		{
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5386|5386| 				{
|5387|5387| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5388|5388| 					var targetClasses = this.order.data.targetClasses;
|5389|    |-					if (targetClasses.attack && cmpIdentity
|5390|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5389|+					if (targetClasses.attack && cmpIdentity &&
|    |5390|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5391|5391| 						continue;
|5392|5392| 					if (targetClasses.avoid && cmpIdentity
|5393|5393| 						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5389|5389| 					if (targetClasses.attack && cmpIdentity
|5390|5390| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5391|5391| 						continue;
|5392|    |-					if (targetClasses.avoid && cmpIdentity
|5393|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5392|+					if (targetClasses.avoid && cmpIdentity &&
|    |5393|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5394|5394| 						continue;
|5395|5395| 					// Only used by the AIs to prevent some choices of targets
|5396|5396| 					if (targetClasses.vetoEntities && targetClasses.vetoEntities[targ])
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5412|5412| 		{
|5413|5413| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5414|5414| 			var targetClasses = this.order.data.targetClasses;
|5415|    |-			if (cmpIdentity && targetClasses.attack
|5416|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5415|+			if (cmpIdentity && targetClasses.attack &&
|    |5416|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5417|5417| 				continue;
|5418|5418| 			if (cmpIdentity && targetClasses.avoid
|5419|5419| 				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5415|5415| 			if (cmpIdentity && targetClasses.attack
|5416|5416| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5417|5417| 				continue;
|5418|    |-			if (cmpIdentity && targetClasses.avoid
|5419|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5418|+			if (cmpIdentity && targetClasses.avoid &&
|    |5419|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5420|5420| 				continue;
|5421|5421| 			// Only used by the AIs to prevent some choices of targets
|5422|5422| 			if (targetClasses.vetoEntities && targetClasses.vetoEntities[targ])
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5572|5572| 
|5573|5573| UnitAI.prototype.SetHeldPosition = function(x, z)
|5574|5574| {
|5575|    |-	this.heldPosition = {"x": x, "z": z};
|    |5575|+	this.heldPosition = { "x": x, "z": z};
|5576|5576| };
|5577|5577| 
|5578|5578| UnitAI.prototype.SetHeldPositionOnEntity = function(entity)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5572|5572| 
|5573|5573| UnitAI.prototype.SetHeldPosition = function(x, z)
|5574|5574| {
|5575|    |-	this.heldPosition = {"x": x, "z": z};
|    |5575|+	this.heldPosition = {"x": x, "z": z };
|5576|5576| };
|5577|5577| 
|5578|5578| UnitAI.prototype.SetHeldPositionOnEntity = function(entity)
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5599|5599| 	return false;
|5600|5600| };
|5601|5601| 
|5602|    |-//// Helper functions ////
|    |5602|+// // Helper functions ////
|5603|5603| 
|5604|5604| UnitAI.prototype.CanAttack = function(target)
|5605|5605| {
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5803|5803| 	return cmpPack && cmpPack.IsPacking();
|5804|5804| };
|5805|5805| 
|5806|    |-//// Formation specific functions ////
|    |5806|+// // Formation specific functions ////
|5807|5807| 
|5808|5808| UnitAI.prototype.IsAttackingAsFormation = function()
|5809|5809| {
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5808|5808| UnitAI.prototype.IsAttackingAsFormation = function()
|5809|5809| {
|5810|5810| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5811|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5812|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5811|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5812|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5813|5813| };
|5814|5814| 
|5815|5815| //// Animal specific functions ////
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5812|5812| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5813|5813| };
|5814|5814| 
|5815|    |-//// Animal specific functions ////
|    |5815|+// // Animal specific functions ////
|5816|5816| 
|5817|5817| UnitAI.prototype.MoveRandomly = function(distance)
|5818|5818| {

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
| 889| »   »   »   "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
| 911| »   »   »   "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
| 958| »   »   »   »   »   return·true;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'enter' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
|1021| »   »   »   »   "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
|1056| »   »   »   "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
|1088| »   »   »   »   "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
|1302| »   »   »   "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
|1485| »   »   »   "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
|1506| »   »   »   "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
|1691| »   »   »   "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
|1742| »   »   »   »   "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
|1818| »   »   »   »   "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
|1988| »   »   »   »   »   »   return·true;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'enter' expected no return value.

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|2004| »   »   »   »   "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
|2094| »   »   »   »   "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
|2275| »   »   »   »   »   »   let·nearby·=·this.FindNearestDropsite(resourceType.generic);
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'nearby' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|2330| »   »   »   »   "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
|2448| »   »   »   »   "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
|2553| »   »   »   »   "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
|2756| »   »   »   »   "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
|2939| »   »   »   »   "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
|3666| »   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
|4485| »   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
|4500| »   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
|4546| »   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
|4569| »   »   ····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
|1965| »   »   »   »   »   »   &&·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
|2270| »   »   »   »   »   var·cmpResourceGatherer·=·Engine.QueryInterface(this.entity,·IID_ResourceGatherer);
|    | [NORMAL] JSHintBear:
|    | 'cmpResourceGatherer' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|2286| »   »   »   »   »   var·nearby·=·this.FindNearbyResource(function(ent,·type,·template)·{
|    | [NORMAL] JSHintBear:
|    | 'nearby' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|2289| »   »   »   »   »   »   »   ||·(type.specific·==·resourceType.specific
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '||'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
|2290| »   »   »   »   »   »   »   &&·(type.specific·!=·"meat"·||·resourceTemplate·==·template))
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
|2310| »   »   »   »   »   var·nearby·=·this.FindNearestDropsite(resourceType.generic);
|    | [NORMAL] JSHintBear:
|    | 'nearby' is already defined.

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
|2703| »   »   »   »   »   var·cmpResourceDropsite·=·Engine.QueryInterface(msg.data.newentity,·IID_ResourceDropsite);
|    | [NORMAL] JSHintBear:
|    | 'cmpResourceDropsite' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|2788| »   »   »   »   »   if·(this.CanGarrison(target))
|    | [NORMAL] JSHintBear:
|    | 'target' used out of scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|2791| »   »   »   »   »   »   if·(this.CheckGarrisonRange(target))
|    | [NORMAL] JSHintBear:
|    | 'target' used out of scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|2793| »   »   »   »   »   »   »   var·cmpGarrisonHolder·=·Engine.QueryInterface(target,·IID_GarrisonHolder);
|    | [NORMAL] JSHintBear:
|    | 'target' used out of scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|2815| »   »   »   »   »   »   »   »   var·cmpResourceDropsite·=·Engine.QueryInterface(target,·IID_ResourceDropsite);
|    | [NORMAL] JSHintBear:
|    | 'target' used out of scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|2816| »   »   »   »   »   »   »   »   if·(cmpResourceDropsite·&&·this.CanReturnResource(target,·true))
|    | [NORMAL] JSHintBear:
|    | 'target' used out of scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|2831| »   »   »   »   »   »   »   »   »   var·cmpHolderPosition·=·Engine.QueryInterface(target,·IID_Position);
|    | [NORMAL] JSHintBear:
|    | 'target' used out of scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|2832| »   »   »   »   »   »   »   »   »   var·cmpHolderUnitAI·=·Engine.QueryInterface(target,·IID_UnitAI);
|    | [NORMAL] JSHintBear:
|    | 'target' used out of scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|2859| »   »   »   »   »   »   »   if·(!this.CheckTargetRangeExplicit(target,·0,·0)·&&·this.MoveToTarget(target))
|    | [NORMAL] JSHintBear:
|    | 'target' used out of scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|2859| »   »   »   »   »   »   »   if·(!this.CheckTargetRangeExplicit(target,·0,·0)·&&·this.MoveToTarget(target))
|    | [NORMAL] JSHintBear:
|    | 'target' used out of scope.

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4240| »   »   var·parabolicMaxRange·=·0;
|    | [NORMAL] JSHintBear:
|    | 'parabolicMaxRange' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|4244| »   var·guessedMaxRange·=·(range.max·+·parabolicMaxRange)/2;
|    | [NORMAL] JSHintBear:
|    | 'parabolicMaxRange' used out of scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|4251| »   return·cmpUnitMotion.MoveToTargetRange(target,·range.min,·Math.min(range.max,·parabolicMaxRange));
|    | [NORMAL] JSHintBear:
|    | 'parabolicMaxRange' used out of scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|4329| »   »   »   &&·cmpFormationUnitAI.order.data.target·==·target)
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

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

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

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

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

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

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

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

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

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

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

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

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

wraitii updated this revision to Diff 8707.Wed, Jul 3, 7:23 PM

Use the opportunity to clean up these functions and use the exact same calls.

There was a second issue: when we were already in range, we returned true since rP22313, but we still didn't set our move request. This fetches the upstream (D1984) change that we always set our move-request for sanity.

source/simulation2/components/CCmpUnitMotion.cpp
1154 ↗(On Diff #8707)

This is a mistake in D1983 and shouldn't be here, messed up.

Vulcan added a comment.Wed, Jul 3, 7:24 PM

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

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

wraitii updated this revision to Diff 8709.Wed, Jul 3, 7:26 PM

Remove the D1983 leftover so jenkins compiles.

Vulcan added a comment.Wed, Jul 3, 8:01 PM

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.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/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.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/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'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/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.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 734| 734| 			}
| 735| 735| 			// Check if we are already in range, otherwise walk there
| 736| 736| 			if (!this.CheckGarrisonRange(msg.data.target))
| 737|    |-			{
|    | 737|+			
| 738| 738| 				if (!this.CheckTargetVisible(msg.data.target))
| 739| 739| 				{
| 740| 740| 					this.FinishOrder();
| 745| 745| 					this.SetNextState("GARRISON.APPROACHING");
| 746| 746| 					return;
| 747| 747| 				}
| 748|    |-			}
|    | 748|+			
| 749| 749| 
| 750| 750| 			this.SetNextState("GARRISON.GARRISONING");
| 751| 751| 		},
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 740| 740| 					this.FinishOrder();
| 741| 741| 					return;
| 742| 742| 				}
| 743|    |-				else
| 744|    |-				{
|    | 743|+				
| 745| 744| 					this.SetNextState("GARRISON.APPROACHING");
| 746| 745| 					return;
| 747|    |-				}
|    | 746|+				
| 748| 747| 			}
| 749| 748| 
| 750| 749| 			this.SetNextState("GARRISON.GARRISONING");
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 763| 763| 						this.PushOrderFront("Walk", msg.data.lastPos);
| 764| 764| 					}
| 765| 765| 					else
| 766|    |-					{
|    | 766|+					
| 767| 767| 						// We couldn't move there, or the target moved away
| 768| 768| 						this.FinishOrder();
| 769|    |-					}
|    | 769|+					
| 770| 770| 					return;
| 771| 771| 				}
| 772| 772| 
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'GARRISON'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 996| 996| 			},
| 997| 997| 		},
| 998| 998| 
| 999|    |-		"GARRISON":{
|    | 999|+		"GARRISON": {
|1000|1000| 			"enter": function() {
|1001|1001| 				// If the garrisonholder should pickup, warn it so it can take needed action
|1002|1002| 				var cmpGarrisonHolder = Engine.QueryInterface(this.order.data.target, IID_GarrisonHolder);
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1209|1209| 			// If the controller handled an order but some members rejected it,
|1210|1210| 			// they will have no orders and be in the FORMATIONMEMBER.IDLE state.
|1211|1211| 			if (this.orderQueue.length)
|1212|    |-			{
|    |1212|+			
|1213|1213| 				// We're leaving the formation, so stop our FormationWalk order
|1214|1214| 				if (this.FinishOrder())
|1215|1215| 					return;
|1216|    |-			}
|    |1216|+			
|1217|1217| 
|1218|1218| 			// No orders left, we're an individual now
|1219|1219| 			if (this.IsAnimal())
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1237|1237| 			// Move a tile outside the building
|1238|1238| 			let range = 4;
|1239|1239| 			if (this.CheckTargetRangeExplicit(msg.data.target, range, -1))
|1240|    |-			{
|    |1240|+			
|1241|1241| 				// We are already at the target, or can't move at all
|1242|1242| 				this.FinishOrder();
|1243|    |-			}
|    |1243|+			
|1244|1244| 			else
|1245|1245| 			{
|1246|1246| 				this.order.data.min = range;
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1458|1458| 
|1459|1459| 			"LosRangeUpdate": function(msg) {
|1460|1460| 				if (this.GetStance().targetVisibleEnemies)
|1461|    |-				{
|    |1461|+				
|1462|1462| 					// Start attacking one of the newly-seen enemy (if any)
|1463|1463| 					this.AttackEntitiesByPreference(msg.data.added);
|1464|    |-				}
|    |1464|+				
|1465|1465| 			},
|1466|1466| 
|1467|1467| 			"LosHealRangeUpdate": function(msg) {
|    | [NORMAL] ESLintBear (space-before-function-paren):
|    | Unexpected space before function parentheses.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1491|1491| 				this.SelectAnimation("move");
|1492|1492| 			},
|1493|1493| 
|1494|    |-			"leave": function () {
|    |1494|+			"leave": function() {
|1495|1495| 				this.SelectAnimation("idle");
|1496|1496| 				this.StopMoving();
|1497|1497| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1671|1671| 						// if nothing better to do, check if the guarded needs to be healed or repaired
|1672|1672| 						var cmpHealth = Engine.QueryInterface(this.isGuardOf, IID_Health);
|1673|1673| 						if (cmpHealth && cmpHealth.IsInjured())
|1674|    |-						{
|    |1674|+						
|1675|1675| 							if (this.CanHeal(this.isGuardOf))
|1676|1676| 								this.PushOrderFront("Heal", { "target": this.isGuardOf, "force": false });
|1677|1677| 							else if (this.CanRepair(this.isGuardOf))
|1678|1678| 								this.PushOrderFront("Repair", { "target": this.isGuardOf, "autocontinue": false, "force": false });
|1679|    |-						}
|    |1679|+						
|1680|1680| 					}
|1681|1681| 				},
|1682|1682| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1961|1961| 
|1962|1962| 				"Attacked": function(msg) {
|1963|1963| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|1964|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|1965|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |1964|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |1965|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|1966|1966| 						this.RespondToTargetedEntities([msg.data.attacker]);
|1967|1967| 				},
|1968|1968| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2014|2014| 					this.SelectAnimation("move");
|2015|2015| 					var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|2016|2016| 					if (cmpUnitAI && cmpUnitAI.IsFleeing())
|2017|    |-					{
|    |2017|+					
|2018|2018| 						// Run after a fleeing target
|2019|2019| 						this.SetSpeedMultiplier(this.GetRunMultiplier());
|2020|    |-					}
|    |2020|+					
|2021|2021| 					this.StartTimer(1000, 1000);
|2022|2022| 				},
|2023|2023| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2196|2196| 
|2197|2197| 					var cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply);
|2198|2198| 					if (cmpSupply && cmpSupply.IsAvailable(cmpOwnership.GetOwner(), this.entity))
|2199|    |-					{
|    |2199|+					
|2200|2200| 						// Check we can still reach and gather from the target
|2201|2201| 						if (this.CheckTargetRange(this.gatheringTarget, IID_ResourceGatherer) && this.CanGather(this.gatheringTarget))
|2202|2202| 						{
|2259|2259| 								return;
|2260|2260| 							}
|2261|2261| 						}
|2262|    |-					}
|    |2262|+					
|2263|2263| 
|2264|2264| 					// We're already in range, can't get anywhere near it or the target is exhausted.
|2265|2265| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2285|2285| 					// Also don't switch to a different type of huntable animal
|2286|2286| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2287|2287| 						return (
|2288|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2289|    |-							|| (type.specific == resourceType.specific
|    |2288|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2289|+							(type.specific == resourceType.specific
|2290|2290| 							&& (type.specific != "meat" || resourceTemplate == template))
|2291|2291| 						);
|2292|2292| 					});
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2286|2286| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2287|2287| 						return (
|2288|2288| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2289|    |-							|| (type.specific == resourceType.specific
|2290|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2289|+							|| (type.specific == resourceType.specific &&
|    |2290|+							(type.specific != "meat" || resourceTemplate == template))
|2291|2291| 						);
|2292|2292| 					});
|2293|2293| 					if (nearby)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2351|2351| 
|2352|2352| 				"Timer": function(msg) {
|2353|2353| 					if (this.ShouldAbandonChase(this.order.data.target, this.order.data.force, IID_Heal, null))
|2354|    |-					{
|    |2354|+					
|2355|2355| 						// Return to our original position unless we have a better order.
|2356|2356| 						if (!this.FinishOrder() && this.GetStance().respondHoldGround)
|2357|2357| 							this.WalkToHeldPosition();
|2358|    |-					}
|    |2358|+					
|2359|2359| 				},
|2360|2360| 
|2361|2361| 				"MovementUpdate": function() {
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2385|2385| 					this.StartTimer(prepare, this.healTimers.repeat);
|2386|2386| 
|2387|2387| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2388|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2388|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2389|2389| 
|2390|2390| 					this.FaceTowardsTarget(this.order.data.target);
|2391|2391| 				},
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2597|2597| 					{
|2598|2598| 						// The building was already finished/fully repaired before we arrived;
|2599|2599| 						// let the ConstructionFinished handler handle this.
|2600|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2600|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2601|2601| 						return true;
|2602|2602| 					}
|2603|2603| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2597|2597| 					{
|2598|2598| 						// The building was already finished/fully repaired before we arrived;
|2599|2599| 						// let the ConstructionFinished handler handle this.
|2600|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2600|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2601|2601| 						return true;
|2602|2602| 					}
|2603|2603| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2724|2724| 
|2725|2725| 				// Unit was approaching and there's nothing to do now, so switch to walking
|2726|2726| 				if (oldState === "INDIVIDUAL.REPAIR.APPROACHING")
|2727|    |-				{
|    |2727|+				
|2728|2728| 					// We're already walking to the given point, so add this as a order.
|2729|2729| 					this.WalkToTarget(msg.data.newentity, true);
|2730|    |-				}
|    |2730|+				
|2731|2731| 			},
|2732|2732| 		},
|2733|2733| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2786|2786| 
|2787|2787| 					// Check that we can garrison here
|2788|2788| 					if (this.CanGarrison(target))
|2789|    |-					{
|    |2789|+					
|2790|2790| 						// Check that we're in range of the garrison target
|2791|2791| 						if (this.CheckGarrisonRange(target))
|2792|2792| 						{
|2862|2862| 								return false;
|2863|2863| 							}
|2864|2864| 						}
|2865|    |-					}
|    |2865|+					
|2866|2866| 					// Garrisoning failed for some reason, so finish the order
|2867|2867| 					this.FinishOrder();
|2868|2868| 					return true;
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2983|2983| 		"Attacked": function(msg) {
|2984|2984| 			if (this.template.NaturalBehaviour == "skittish" ||
|2985|2985| 			    this.template.NaturalBehaviour == "passive")
|2986|    |-			{
|    |2986|+			
|2987|2987| 				this.Flee(msg.data.attacker, false);
|2988|    |-			}
|    |2988|+			
|2989|2989| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|2990|2990| 			{
|2991|2991| 				if (this.CanAttack(msg.data.attacker))
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2992|2992| 					this.Attack(msg.data.attacker, false);
|2993|2993| 			}
|2994|2994| 			else if (this.template.NaturalBehaviour == "domestic")
|2995|    |-			{
|    |2995|+			
|2996|2996| 				// Never flee, stop what we were doing
|2997|2997| 				this.SetNextState("IDLE");
|2998|    |-			}
|    |2998|+			
|2999|2999| 		},
|3000|3000| 
|3001|3001| 		"Order.LeaveFoundation": function(msg) {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3047|3047| 				}
|3048|3048| 				// Start attacking one of the newly-seen enemy (if any)
|3049|3049| 				else if (this.IsDangerousAnimal())
|3050|    |-				{
|    |3050|+				
|3051|3051| 					this.AttackVisibleEntity(msg.data.added);
|3052|    |-				}
|    |3052|+				
|3053|3053| 
|3054|3054| 				// TODO: if two units enter our range together, we'll attack the
|3055|3055| 				// first and then the second won't trigger another LosRangeUpdate
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3090|3090| 				}
|3091|3091| 				// Start attacking one of the newly-seen enemy (if any)
|3092|3092| 				else if (this.template.NaturalBehaviour == "violent")
|3093|    |-				{
|    |3093|+				
|3094|3094| 					this.AttackVisibleEntity(msg.data.added);
|3095|    |-				}
|    |3095|+				
|3096|3096| 			},
|3097|3097| 
|3098|3098| 			"Timer": function(msg) {
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 7.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3105|3105| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3106|3106| 
|3107|3107| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3108|    |-							// only used for domestic animals
|    |3108|+		// only used for domestic animals
|3109|3109| 	},
|3110|3110| };
|3111|3111| 
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3162|3162| 
|3163|3163| UnitAI.prototype.IsAnimal = function()
|3164|3164| {
|3165|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3165|+	return (!!this.template.NaturalBehaviour);
|3166|3166| };
|3167|3167| 
|3168|3168| UnitAI.prototype.IsDangerousAnimal = function()
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3200|3200| UnitAI.prototype.GetGarrisonHolder = function()
|3201|3201| {
|3202|3202| 	if (this.IsGarrisoned())
|3203|    |-	{
|    |3203|+	
|3204|3204| 		for (let order of this.orderQueue)
|3205|3205| 			if (order.type == "Garrison")
|3206|3206| 				return order.data.target;
|3207|    |-	}
|    |3207|+	
|3208|3208| 	return INVALID_ENTITY;
|3209|3209| };
|3210|3210| 
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3278|3278| 		{
|3279|3279| 			let index = this.GetCurrentState().indexOf(".");
|3280|3280| 			if (index != -1)
|3281|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3281|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3282|3282| 			this.Stop(false);
|3283|3283| 		}
|3284|3284| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3334|3334| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3335|3335| 			continue;
|3336|3336| 		if (i == 0)
|3337|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3337|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3338|3338| 		else
|3339|3339| 			this.orderQueue.splice(i, 1);
|3340|3340| 		Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3334|3334| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3335|3335| 			continue;
|3336|3336| 		if (i == 0)
|3337|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3337|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3338|3338| 		else
|3339|3339| 			this.orderQueue.splice(i, 1);
|3340|3340| 		Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3418|3418| };
|3419|3419| 
|3420|3420| 
|3421|    |-//// FSM linkage functions ////
|    |3421|+// // FSM linkage functions ////
|3422|3422| 
|3423|3423| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3424|3424| UnitAI.prototype.SetNextState = function(state)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3590|3590| 				continue;
|3591|3591| 			if (this.orderQueue[i].type == type)
|3592|3592| 				continue;
|3593|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3593|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3594|3594| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3595|3595| 			return;
|3596|3596| 		}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3590|3590| 				continue;
|3591|3591| 			if (this.orderQueue[i].type == type)
|3592|3592| 				continue;
|3593|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3593|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3594|3594| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3595|3595| 			return;
|3596|3596| 		}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3604|3604| {
|3605|3605| 	// Remember the previous work orders to be able to go back to them later if required
|3606|3606| 	if (data && data.force)
|3607|    |-	{
|    |3607|+	
|3608|3608| 		if (this.IsFormationController())
|3609|3609| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3610|3610| 		else
|3611|3611| 			this.UpdateWorkOrders(type);
|3612|    |-	}
|    |3612|+	
|3613|3613| 
|3614|3614| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3615|3615| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3681|3681| 	{
|3682|3682| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3683|3683| 		if (cmpUnitAI)
|3684|    |-		{
|    |3684|+		
|3685|3685| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3686|3686| 			{
|3687|3687| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3690|3690| 					return;
|3691|3691| 				}
|3692|3692| 			}
|3693|    |-		}
|    |3693|+		
|3694|3694| 	}
|3695|3695| 
|3696|3696| 	// If nothing found, take the unit orders
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3683|3683| 		if (cmpUnitAI)
|3684|3684| 		{
|3685|3685| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3686|    |-			{
|    |3686|+			
|3687|3687| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3688|3688| 				{
|3689|3689| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3690|3690| 					return;
|3691|3691| 				}
|3692|    |-			}
|    |3692|+			
|3693|3693| 		}
|3694|3694| 	}
|3695|3695| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3695|3695| 
|3696|3696| 	// If nothing found, take the unit orders
|3697|3697| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3698|    |-	{
|    |3698|+	
|3699|3699| 		if (isWorkType(this.orderQueue[i].type))
|3700|3700| 		{
|3701|3701| 			this.workOrders = this.orderQueue.slice(i);
|3702|3702| 			return;
|3703|3703| 		}
|3704|    |-	}
|    |3704|+	
|3705|3705| };
|3706|3706| 
|3707|3707| UnitAI.prototype.BackToWork = function()
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3761|3761| 	if (data.timerRepeat === undefined)
|3762|3762| 		this.timer = undefined;
|3763|3763| 
|3764|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3764|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3765|3765| };
|3766|3766| 
|3767|3767| /**
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3761|3761| 	if (data.timerRepeat === undefined)
|3762|3762| 		this.timer = undefined;
|3763|3763| 
|3764|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3764|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3765|3765| };
|3766|3766| 
|3767|3767| /**
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3796|3796| 	this.timer = undefined;
|3797|3797| };
|3798|3798| 
|3799|    |-//// Message handlers /////
|    |3799|+// // Message handlers /////
|3800|3800| 
|3801|3801| UnitAI.prototype.OnMotionChanged = function(msg)
|3802|3802| {
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3808|3808| 	// TODO: This is a bit inefficient since every unit listens to every
|3809|3809| 	// construction message - ideally we could scope it to only the one we're building
|3810|3810| 
|3811|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3811|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3812|3812| };
|3813|3813| 
|3814|3814| UnitAI.prototype.OnGlobalEntityRenamed = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3808|3808| 	// TODO: This is a bit inefficient since every unit listens to every
|3809|3809| 	// construction message - ideally we could scope it to only the one we're building
|3810|3810| 
|3811|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3811|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3812|3812| };
|3813|3813| 
|3814|3814| UnitAI.prototype.OnGlobalEntityRenamed = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3833|3833| 
|3834|3834| UnitAI.prototype.OnAttacked = function(msg)
|3835|3835| {
|3836|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3836|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3837|3837| };
|3838|3838| 
|3839|3839| UnitAI.prototype.OnGuardedAttacked = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3833|3833| 
|3834|3834| UnitAI.prototype.OnAttacked = function(msg)
|3835|3835| {
|3836|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3836|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3837|3837| };
|3838|3838| 
|3839|3839| UnitAI.prototype.OnGuardedAttacked = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3838|3838| 
|3839|3839| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3840|3840| {
|3841|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3841|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|3842|3842| };
|3843|3843| 
|3844|3844| UnitAI.prototype.OnHealthChanged = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3838|3838| 
|3839|3839| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3840|3840| {
|3841|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3841|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|3842|3842| };
|3843|3843| 
|3844|3844| UnitAI.prototype.OnHealthChanged = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3843|3843| 
|3844|3844| UnitAI.prototype.OnHealthChanged = function(msg)
|3845|3845| {
|3846|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3846|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|3847|3847| };
|3848|3848| 
|3849|3849| UnitAI.prototype.OnRangeUpdate = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3843|3843| 
|3844|3844| UnitAI.prototype.OnHealthChanged = function(msg)
|3845|3845| {
|3846|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3846|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|3847|3847| };
|3848|3848| 
|3849|3849| UnitAI.prototype.OnRangeUpdate = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3849|3849| UnitAI.prototype.OnRangeUpdate = function(msg)
|3850|3850| {
|3851|3851| 	if (msg.tag == this.losRangeQuery)
|3852|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3852|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|3853|3853| 	else if (msg.tag == this.losHealRangeQuery)
|3854|3854| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3855|3855| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3849|3849| UnitAI.prototype.OnRangeUpdate = function(msg)
|3850|3850| {
|3851|3851| 	if (msg.tag == this.losRangeQuery)
|3852|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3852|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|3853|3853| 	else if (msg.tag == this.losHealRangeQuery)
|3854|3854| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3855|3855| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3851|3851| 	if (msg.tag == this.losRangeQuery)
|3852|3852| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3853|3853| 	else if (msg.tag == this.losHealRangeQuery)
|3854|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3854|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|3855|3855| };
|3856|3856| 
|3857|3857| UnitAI.prototype.OnPackFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3851|3851| 	if (msg.tag == this.losRangeQuery)
|3852|3852| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3853|3853| 	else if (msg.tag == this.losHealRangeQuery)
|3854|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3854|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|3855|3855| };
|3856|3856| 
|3857|3857| UnitAI.prototype.OnPackFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3856|3856| 
|3857|3857| UnitAI.prototype.OnPackFinished = function(msg)
|3858|3858| {
|3859|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3859|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|3860|3860| };
|3861|3861| 
|3862|3862| //// Helper functions to be called by the FSM ////
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3856|3856| 
|3857|3857| UnitAI.prototype.OnPackFinished = function(msg)
|3858|3858| {
|3859|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3859|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|3860|3860| };
|3861|3861| 
|3862|3862| //// Helper functions to be called by the FSM ////
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3859|3859| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|3860|3860| };
|3861|3861| 
|3862|    |-//// Helper functions to be called by the FSM ////
|    |3862|+// // Helper functions to be called by the FSM ////
|3863|3863| 
|3864|3864| UnitAI.prototype.GetWalkSpeed = function()
|3865|3865| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4046|4046| 			PlaySound(name, member);
|4047|4047| 	}
|4048|4048| 	else
|4049|    |-	{
|    |4049|+	
|4050|4050| 		// Otherwise use our own sounds
|4051|4051| 		PlaySound(name, this.entity);
|4052|    |-	}
|    |4052|+	
|4053|4053| };
|4054|4054| 
|4055|4055| /*
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4492|4492| UnitAI.prototype.AttackEntityInZone = function(ents)
|4493|4493| {
|4494|4494| 	var target = ents.find(target =>
|4495|    |-		this.CanAttack(target)
|4496|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4495|+		this.CanAttack(target) &&
|    |4496|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4497|4497| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4498|4498| 	);
|4499|4499| 	if (!target)
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4493|4493| {
|4494|4494| 	var target = ents.find(target =>
|4495|4495| 		this.CanAttack(target)
|4496|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4497|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4496|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4497|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4498|4498| 	);
|4499|4499| 	if (!target)
|4500|4500| 		return false;
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before 'Engine'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4557|4557| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4558|4558| 	if (this.isGuardOf)
|4559|4559| 	{
|4560|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4560|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4561|4561| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4562|4562| 		if (cmpUnitAI && cmpAttack &&
|4563|4563| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 4.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4561|4561| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4562|4562| 		if (cmpUnitAI && cmpAttack &&
|4563|4563| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4564|    |-				return false;
|    |4564|+			return false;
|4565|4565| 	}
|4566|4566| 
|4567|4567| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4566|4566| 
|4567|4567| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4568|4568| 	if (this.GetStance().respondHoldGround)
|4569|    |-	{
|    |4569|+	
|4570|4570| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4571|4571| 			return true;
|4572|    |-	}
|    |4572|+	
|4573|4573| 
|4574|4574| 	// Stop if it's left our vision range, unless we're especially persistent
|4575|4575| 	if (!this.GetStance().respondChaseBeyondVision)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4573|4573| 
|4574|4574| 	// Stop if it's left our vision range, unless we're especially persistent
|4575|4575| 	if (!this.GetStance().respondChaseBeyondVision)
|4576|    |-	{
|    |4576|+	
|4577|4577| 		if (!this.CheckTargetIsInVisionRange(target))
|4578|4578| 			return true;
|4579|    |-	}
|    |4579|+	
|4580|4580| 
|4581|4581| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4582|4582| 	// and will continue moving to its last seen position and then stop)
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before 'Engine'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4599|4599| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4600|4600| 	if (this.isGuardOf)
|4601|4601| 	{
|4602|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4602|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4603|4603| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4604|4604| 		if (cmpUnitAI && cmpAttack &&
|4605|4605| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4612|4612| 	return false;
|4613|4613| };
|4614|4614| 
|4615|    |-//// External interface functions ////
|    |4615|+// // External interface functions ////
|4616|4616| 
|4617|4617| UnitAI.prototype.SetFormationController = function(ent)
|4618|4618| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4622|4622| 	// of our own formation (or ourself if not in formation)
|4623|4623| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4624|4624| 	if (cmpObstruction)
|4625|    |-	{
|    |4625|+	
|4626|4626| 		if (ent == INVALID_ENTITY)
|4627|4627| 			cmpObstruction.SetControlGroup(this.entity);
|4628|4628| 		else
|4629|4629| 			cmpObstruction.SetControlGroup(ent);
|4630|    |-	}
|    |4630|+	
|4631|4631| 
|4632|4632| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4633|4633| 	if (ent == INVALID_ENTITY)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4765|4765| 	// if we already had an old guard order, do nothing if the target is the same
|4766|4766| 	// and the order is running, otherwise remove the previous order
|4767|4767| 	if (this.isGuardOf)
|4768|    |-	{
|    |4768|+	
|4769|4769| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4770|4770| 			return;
|4771|4771| 		else
|4772|4772| 			this.RemoveGuard();
|4773|    |-	}
|    |4773|+	
|4774|4774| 
|4775|4775| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4776|4776| };
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4768|4768| 	{
|4769|4769| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4770|4770| 			return;
|4771|    |-		else
|4772|    |-			this.RemoveGuard();
|    |4771|+		this.RemoveGuard();
|4773|4772| 	}
|4774|4773| 
|4775|4774| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|    | [NORMAL] ESLintBear (no-trailing-spaces):
|    | Trailing spaces not allowed.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5099|5099| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5100|5100| 	{
|5101|5101| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5102|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5102|+		if (cmpTrader.HasBothMarkets() &&
|5103|5103| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5104|5104| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5105|5105| 		{
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5380|5380| 				{
|5381|5381| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5382|5382| 					var targetClasses = this.order.data.targetClasses;
|5383|    |-					if (targetClasses.attack && cmpIdentity
|5384|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5383|+					if (targetClasses.attack && cmpIdentity &&
|    |5384|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5385|5385| 						continue;
|5386|5386| 					if (targetClasses.avoid && cmpIdentity
|5387|5387| 						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5383|5383| 					if (targetClasses.attack && cmpIdentity
|5384|5384| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5385|5385| 						continue;
|5386|    |-					if (targetClasses.avoid && cmpIdentity
|5387|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5386|+					if (targetClasses.avoid && cmpIdentity &&
|    |5387|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5388|5388| 						continue;
|5389|5389| 					// Only used by the AIs to prevent some choices of targets
|5390|5390| 					if (targetClasses.vetoEntities && targetClasses.vetoEntities[targ])
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5406|5406| 		{
|5407|5407| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5408|5408| 			var targetClasses = this.order.data.targetClasses;
|5409|    |-			if (cmpIdentity && targetClasses.attack
|5410|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5409|+			if (cmpIdentity && targetClasses.attack &&
|    |5410|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5411|5411| 				continue;
|5412|5412| 			if (cmpIdentity && targetClasses.avoid
|5413|5413| 				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5409|5409| 			if (cmpIdentity && targetClasses.attack
|5410|5410| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5411|5411| 				continue;
|5412|    |-			if (cmpIdentity && targetClasses.avoid
|5413|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5412|+			if (cmpIdentity && targetClasses.avoid &&
|    |5413|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5414|5414| 				continue;
|5415|5415| 			// Only used by the AIs to prevent some choices of targets
|5416|5416| 			if (targetClasses.vetoEntities && targetClasses.vetoEntities[targ])
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5566|5566| 
|5567|5567| UnitAI.prototype.SetHeldPosition = function(x, z)
|5568|5568| {
|5569|    |-	this.heldPosition = {"x": x, "z": z};
|    |5569|+	this.heldPosition = { "x": x, "z": z};
|5570|5570| };
|5571|5571| 
|5572|5572| UnitAI.prototype.SetHeldPositionOnEntity = function(entity)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5566|5566| 
|5567|5567| UnitAI.prototype.SetHeldPosition = function(x, z)
|5568|5568| {
|5569|    |-	this.heldPosition = {"x": x, "z": z};
|    |5569|+	this.heldPosition = {"x": x, "z": z };
|5570|5570| };
|5571|5571| 
|5572|5572| UnitAI.prototype.SetHeldPositionOnEntity = function(entity)
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5593|5593| 	return false;
|5594|5594| };
|5595|5595| 
|5596|    |-//// Helper functions ////
|    |5596|+// // Helper functions ////
|5597|5597| 
|5598|5598| UnitAI.prototype.CanAttack = function(target)
|5599|5599| {
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5797|5797| 	return cmpPack && cmpPack.IsPacking();
|5798|5798| };
|5799|5799| 
|5800|    |-//// Formation specific functions ////
|    |5800|+// // Formation specific functions ////
|5801|5801| 
|5802|5802| UnitAI.prototype.IsAttackingAsFormation = function()
|5803|5803| {
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5802|5802| UnitAI.prototype.IsAttackingAsFormation = function()
|5803|5803| {
|5804|5804| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5805|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5806|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5805|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5806|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5807|5807| };
|5808|5808| 
|5809|5809| //// Animal specific functions ////
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5806|5806| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5807|5807| };
|5808|5808| 
|5809|    |-//// Animal specific functions ////
|    |5809|+// // Animal specific functions ////
|5810|5810| 
|5811|5811| UnitAI.prototype.MoveRandomly = function(distance)
|5812|5812| {

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
| 889| »   »   »   "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
| 911| »   »   »   "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
| 958| »   »   »   »   »   return·true;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'enter' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
|1021| »   »   »   »   "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
|1056| »   »   »   "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
|1088| »   »   »   »   "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
|1302| »   »   »   "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
|1485| »   »   »   "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
|1506| »   »   »   "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
|1691| »   »   »   "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
|1742| »   »   »   »   "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
|1818| »   »   »   »   "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
|1988| »   »   »   »   »   »   return·true;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'enter' expected no return value.

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|2004| »   »   »   »   "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
|2094| »   »   »   »   "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
|2275| »   »   »   »   »   »   let·nearby·=·this.FindNearestDropsite(resourceType.generic);
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'nearby' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|2330| »   »   »   »   "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
|2448| »   »   »   »   "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
|2553| »   »   »   »   "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
|2756| »   »   »   »   "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
|2939| »   »   »   »   "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
|3666| »   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
|4479| »   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
|4494| »   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
|4540| »   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
|4563| »   »   ····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
|1965| »   »   »   »   »   »   &&·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
|2270| »   »   »   »   »   var·cmpResourceGatherer·=·Engine.QueryInterface(this.entity,·IID_ResourceGatherer);
|    | [NORMAL] JSHintBear:
|    | 'cmpResourceGatherer' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|2286| »   »   »   »   »   var·nearby·=·this.FindNearbyResource(function(ent,·type,·template)·{
|    | [NORMAL] JSHintBear:
|    | 'nearby' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|2289| »   »   »   »   »   »   »   ||·(type.specific·==·resourceType.specific
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '||'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
|2290| »   »   »   »   »   »   »   &&·(type.specific·!=·"meat"·||·resourceTemplate·==·template))
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
|2310| »   »   »   »   »   var·nearby·=·this.FindNearestDropsite(resourceType.generic);
|    | [NORMAL] JSHintBear:
|    | 'nearby' is already defined.

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
|2703| »   »   »   »   »   var·cmpResourceDropsite·=·Engine.QueryInterface(msg.data.newentity,·IID_ResourceDropsite);
|    | [NORMAL] JSHintBear:
|    | 'cmpResourceDropsite' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|2788| »   »   »   »   »   if·(this.CanGarrison(target))
|    | [NORMAL] JSHintBear:
|    | 'target' used out of scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|2791| »   »   »   »   »   »   if·(this.CheckGarrisonRange(target))
|    | [NORMAL] JSHintBear:
|    | 'target' used out of scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|2793| »   »   »   »   »   »   »   var·cmpGarrisonHolder·=·Engine.QueryInterface(target,·IID_GarrisonHolder);
|    | [NORMAL] JSHintBear:
|    | 'target' used out of scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|2815| »   »   »   »   »   »   »   »   var·cmpResourceDropsite·=·Engine.QueryInterface(target,·IID_ResourceDropsite);
|    | [NORMAL] JSHintBear:
|    | 'target' used out of scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|2816| »   »   »   »   »   »   »   »   if·(cmpResourceDropsite·&&·this.CanReturnResource(target,·true))
|    | [NORMAL] JSHintBear:
|    | 'target' used out of scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|2831| »   »   »   »   »   »   »   »   »   var·cmpHolderPosition·=·Engine.QueryInterface(target,·IID_Position);
|    | [NORMAL] JSHintBear:
|    | 'target' used out of scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|2832| »   »   »   »   »   »   »   »   »   var·cmpHolderUnitAI·=·Engine.QueryInterface(target,·IID_UnitAI);
|    | [NORMAL] JSHintBear:
|    | 'target' used out of scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|2859| »   »   »   »   »   »   »   if·(!this.CheckTargetRangeExplicit(target,·0,·0)·&&·this.MoveToTarget(target))
|    | [NORMAL] JSHintBear:
|    | 'target' used out of scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|2859| »   »   »   »   »   »   »   if·(!this.CheckTargetRangeExplicit(target,·0,·0)·&&·this.MoveToTarget(target))
|    | [NORMAL] JSHintBear:
|    | 'target' used out of scope.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

wraitii added inline comments.Wed, Jul 3, 8:03 PM
binaries/data/mods/public/simulation/components/UnitAI.js
4246 ↗(On Diff #8709)

Will remove the Math.Min and keep guessedMaxRange before committing.

This revision was not accepted when it landed; it landed in state Needs Review.Wed, Jul 3, 8:05 PM
This revision was automatically updated to reflect the committed changes.