Page MenuHomeWildfire Games

UnitMotion - more explicit handling of target death in Combat.Approaching
ClosedPublic

Authored by wraitii on Jun 16 2019, 8:07 PM.

Details

Reviewers
None
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Commits
rP22425: UnitMotion - Explicit handling of movement errors (such as target death) in…
Summary

As reported by @Angen, even with D1979.

In A23, units that are approaching an enemy (Combat.Approaching) will carry on moving to their last waypoint if the target dies, and then go idle.
In current svn and with D1979, these units never go idle.
This difference is because svn doesn't send MovementUpdate messages when out of waypoint - something I've done to avoid hiding bugs such as this one.

Instead, we should explicitly decide in UnitAI what we want to do, which is done here.

Test Plan

Check out unit behaviour when approaching an enemy that gets destroyed.
test:

  • gathering
  • ordering to attack, then queuing another order
  • try and test non-forced behaviour.

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.Jun 16 2019, 8:07 PM
wraitii added a comment.EditedJun 16 2019, 8:12 PM

I think to be quite complete this should make MoveToX set a default long waypoint at the target's position, so that we (almost) always have a position to go to. And perhaps other orders should behave similarly to attack here.

edit: and possibly remove the lastPos used in Gathering

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
| 515| 515| 					this.PushOrderFront("Walk", this.order.data.lastPos);
| 516| 516| 				}
| 517| 517| 				else
| 518|    |-				{
|    | 518|+				
| 519| 519| 					// We couldn't move there, or the target moved away
| 520| 520| 					this.FinishOrder();
| 521|    |-				}
|    | 521|+				
| 522| 522| 				return;
| 523| 523| 			}
| 524| 524| 
|    | [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
| 730| 730| 			}
| 731| 731| 			// Check if we are already in range, otherwise walk there
| 732| 732| 			if (!this.CheckGarrisonRange(msg.data.target))
| 733|    |-			{
|    | 733|+			
| 734| 734| 				if (!this.CheckTargetVisible(msg.data.target))
| 735| 735| 				{
| 736| 736| 					this.FinishOrder();
| 741| 741| 					this.SetNextState("GARRISON.APPROACHING");
| 742| 742| 					return;
| 743| 743| 				}
| 744|    |-			}
|    | 744|+			
| 745| 745| 
| 746| 746| 			this.SetNextState("GARRISON.GARRISONING");
| 747| 747| 		},
|    | [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
| 736| 736| 					this.FinishOrder();
| 737| 737| 					return;
| 738| 738| 				}
| 739|    |-				else
| 740|    |-				{
|    | 739|+				
| 741| 740| 					this.SetNextState("GARRISON.APPROACHING");
| 742| 741| 					return;
| 743|    |-				}
|    | 742|+				
| 744| 743| 			}
| 745| 744| 
| 746| 745| 			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
| 759| 759| 						this.PushOrderFront("Walk", msg.data.lastPos);
| 760| 760| 					}
| 761| 761| 					else
| 762|    |-					{
|    | 762|+					
| 763| 763| 						// We couldn't move there, or the target moved away
| 764| 764| 						this.FinishOrder();
| 765|    |-					}
|    | 765|+					
| 766| 766| 					return;
| 767| 767| 				}
| 768| 768| 
|    | [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
| 992| 992| 			},
| 993| 993| 		},
| 994| 994| 
| 995|    |-		"GARRISON":{
|    | 995|+		"GARRISON": {
| 996| 996| 			"enter": function() {
| 997| 997| 				// If the garrisonholder should pickup, warn it so it can take needed action
| 998| 998| 				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
|1205|1205| 			// If the controller handled an order but some members rejected it,
|1206|1206| 			// they will have no orders and be in the FORMATIONMEMBER.IDLE state.
|1207|1207| 			if (this.orderQueue.length)
|1208|    |-			{
|    |1208|+			
|1209|1209| 				// We're leaving the formation, so stop our FormationWalk order
|1210|1210| 				if (this.FinishOrder())
|1211|1211| 					return;
|1212|    |-			}
|    |1212|+			
|1213|1213| 
|1214|1214| 			// No orders left, we're an individual now
|1215|1215| 			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
|1233|1233| 			// Move a tile outside the building
|1234|1234| 			let range = 4;
|1235|1235| 			if (this.CheckTargetRangeExplicit(msg.data.target, range, range))
|1236|    |-			{
|    |1236|+			
|1237|1237| 				// We are already at the target, or can't move at all
|1238|1238| 				this.FinishOrder();
|1239|    |-			}
|    |1239|+			
|1240|1240| 			else
|1241|1241| 			{
|1242|1242| 				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
|1454|1454| 
|1455|1455| 			"LosRangeUpdate": function(msg) {
|1456|1456| 				if (this.GetStance().targetVisibleEnemies)
|1457|    |-				{
|    |1457|+				
|1458|1458| 					// Start attacking one of the newly-seen enemy (if any)
|1459|1459| 					this.AttackEntitiesByPreference(msg.data.added);
|1460|    |-				}
|    |1460|+				
|1461|1461| 			},
|1462|1462| 
|1463|1463| 			"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
|1487|1487| 				this.SelectAnimation("move");
|1488|1488| 			},
|1489|1489| 
|1490|    |-			"leave": function () {
|    |1490|+			"leave": function() {
|1491|1491| 				this.SelectAnimation("idle");
|1492|1492| 				this.StopMoving();
|1493|1493| 			},
|    | [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
|1667|1667| 						// if nothing better to do, check if the guarded needs to be healed or repaired
|1668|1668| 						var cmpHealth = Engine.QueryInterface(this.isGuardOf, IID_Health);
|1669|1669| 						if (cmpHealth && cmpHealth.IsInjured())
|1670|    |-						{
|    |1670|+						
|1671|1671| 							if (this.CanHeal(this.isGuardOf))
|1672|1672| 								this.PushOrderFront("Heal", { "target": this.isGuardOf, "force": false });
|1673|1673| 							else if (this.CanRepair(this.isGuardOf))
|1674|1674| 								this.PushOrderFront("Repair", { "target": this.isGuardOf, "autocontinue": false, "force": false });
|1675|    |-						}
|    |1675|+						
|1676|1676| 					}
|1677|1677| 				},
|1678|1678| 
|    | [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
|1824|1824| 					}
|1825|1825| 					// Check the target is still alive and attackable
|1826|1826| 					if (this.CanAttack(target) && !this.CheckTargetAttackRange(target, this.order.data.attackType))
|1827|    |-					{
|    |1827|+					
|1828|1828| 						// Can't reach it - try to chase after it
|1829|1829| 						if (this.ShouldChaseTargetedEntity(target, this.order.data.force))
|1830|1830| 						{
|1837|1837| 							this.SetNextState("COMBAT.CHASING");
|1838|1838| 							return true;
|1839|1839| 						}
|1840|    |-					}
|    |1840|+					
|1841|1841| 
|1842|1842| 					this.StopMoving();
|1843|1843| 
|    | [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
|1878|1878| 						// TODO: we should probably only bother syncing projectile attacks, not melee
|1879|1879| 
|1880|1880| 						// If using a non-default prepare time, re-sync the animation when the timer runs.
|1881|    |-						this.resyncAnimation = (prepare != this.attackTimers.prepare) ? true : false;
|    |1881|+						this.resyncAnimation = (prepare != this.attackTimers.prepare);
|1882|1882| 
|1883|1883| 						this.FaceTowardsTarget(this.order.data.target);
|1884|1884| 					}
|    | [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
|2001|2001| 
|2002|2002| 				"Attacked": function(msg) {
|2003|2003| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2004|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2005|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2004|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2005|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2006|2006| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2007|2007| 				},
|2008|2008| 			},
|    | [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
|2021|2021| 					this.SelectAnimation("move");
|2022|2022| 					var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|2023|2023| 					if (cmpUnitAI && cmpUnitAI.IsFleeing())
|2024|    |-					{
|    |2024|+					
|2025|2025| 						// Run after a fleeing target
|2026|2026| 						this.SetSpeedMultiplier(this.GetRunMultiplier());
|2027|    |-					}
|    |2027|+					
|2028|2028| 					this.StartTimer(1000, 1000);
|2029|2029| 				},
|2030|2030| 
|    | [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
|2203|2203| 
|2204|2204| 					var cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply);
|2205|2205| 					if (cmpSupply && cmpSupply.IsAvailable(cmpOwnership.GetOwner(), this.entity))
|2206|    |-					{
|    |2206|+					
|2207|2207| 						// Check we can still reach and gather from the target
|2208|2208| 						if (this.CheckTargetRange(this.gatheringTarget, IID_ResourceGatherer) && this.CanGather(this.gatheringTarget))
|2209|2209| 						{
|2254|2254| 								return;
|2255|2255| 							}
|2256|2256| 						}
|2257|    |-					}
|    |2257|+					
|2258|2258| 
|2259|2259| 					// We're already in range, can't get anywhere near it or the target is exhausted.
|2260|2260| 
|    | [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
|2246|2246| 								return;
|2247|2247| 						}
|2248|2248| 						else
|2249|    |-						{
|    |2249|+						
|2250|2250| 							// Try to follow the target
|2251|2251| 							if (this.MoveToTargetRange(this.gatheringTarget, IID_ResourceGatherer))
|2252|2252| 							{
|2253|2253| 								this.SetNextState("APPROACHING");
|2254|2254| 								return;
|2255|2255| 							}
|2256|    |-						}
|    |2256|+						
|2257|2257| 					}
|2258|2258| 
|2259|2259| 					// We're already in range, can't get anywhere near it or the target is exhausted.
|    | [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
|2280|2280| 					// Also don't switch to a different type of huntable animal
|2281|2281| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2282|2282| 						return (
|2283|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2284|    |-							|| (type.specific == resourceType.specific
|    |2283|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2284|+							(type.specific == resourceType.specific
|2285|2285| 							&& (type.specific != "meat" || resourceTemplate == template))
|2286|2286| 						);
|2287|2287| 					});
|    | [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
|2281|2281| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2282|2282| 						return (
|2283|2283| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2284|    |-							|| (type.specific == resourceType.specific
|2285|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2284|+							|| (type.specific == resourceType.specific &&
|    |2285|+							(type.specific != "meat" || resourceTemplate == template))
|2286|2286| 						);
|2287|2287| 					});
|2288|2288| 					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
|2346|2346| 
|2347|2347| 				"Timer": function(msg) {
|2348|2348| 					if (this.ShouldAbandonChase(this.order.data.target, this.order.data.force, IID_Heal, null))
|2349|    |-					{
|    |2349|+					
|2350|2350| 						// Return to our original position unless we have a better order.
|2351|2351| 						if (!this.FinishOrder() && this.GetStance().respondHoldGround)
|2352|2352| 							this.WalkToHeldPosition();
|2353|    |-					}
|    |2353|+					
|2354|2354| 				},
|2355|2355| 
|2356|2356| 				"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
|2380|2380| 					this.StartTimer(prepare, this.healTimers.repeat);
|2381|2381| 
|2382|2382| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2383|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2383|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2384|2384| 
|2385|2385| 					this.FaceTowardsTarget(this.order.data.target);
|2386|2386| 				},
|    | [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
|2592|2592| 					{
|2593|2593| 						// The building was already finished/fully repaired before we arrived;
|2594|2594| 						// let the ConstructionFinished handler handle this.
|2595|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2595|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2596|2596| 						return true;
|2597|2597| 					}
|2598|2598| 
|    | [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
|2592|2592| 					{
|2593|2593| 						// The building was already finished/fully repaired before we arrived;
|2594|2594| 						// let the ConstructionFinished handler handle this.
|2595|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2595|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2596|2596| 						return true;
|2597|2597| 					}
|2598|2598| 
|    | [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
|2719|2719| 
|2720|2720| 				// Unit was approaching and there's nothing to do now, so switch to walking
|2721|2721| 				if (oldState === "INDIVIDUAL.REPAIR.APPROACHING")
|2722|    |-				{
|    |2722|+				
|2723|2723| 					// We're already walking to the given point, so add this as a order.
|2724|2724| 					this.WalkToTarget(msg.data.newentity, true);
|2725|    |-				}
|    |2725|+				
|2726|2726| 			},
|2727|2727| 		},
|2728|2728| 
|    | [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
|2781|2781| 
|2782|2782| 					// Check that we can garrison here
|2783|2783| 					if (this.CanGarrison(target))
|2784|    |-					{
|    |2784|+					
|2785|2785| 						// Check that we're in range of the garrison target
|2786|2786| 						if (this.CheckGarrisonRange(target))
|2787|2787| 						{
|2857|2857| 								return false;
|2858|2858| 							}
|2859|2859| 						}
|2860|    |-					}
|    |2860|+					
|2861|2861| 					// Garrisoning failed for some reason, so finish the order
|2862|2862| 					this.FinishOrder();
|2863|2863| 					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
|2978|2978| 		"Attacked": function(msg) {
|2979|2979| 			if (this.template.NaturalBehaviour == "skittish" ||
|2980|2980| 			    this.template.NaturalBehaviour == "passive")
|2981|    |-			{
|    |2981|+			
|2982|2982| 				this.Flee(msg.data.attacker, false);
|2983|    |-			}
|    |2983|+			
|2984|2984| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|2985|2985| 			{
|2986|2986| 				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
|2987|2987| 					this.Attack(msg.data.attacker, false);
|2988|2988| 			}
|2989|2989| 			else if (this.template.NaturalBehaviour == "domestic")
|2990|    |-			{
|    |2990|+			
|2991|2991| 				// Never flee, stop what we were doing
|2992|2992| 				this.SetNextState("IDLE");
|2993|    |-			}
|    |2993|+			
|2994|2994| 		},
|2995|2995| 
|2996|2996| 		"Order.LeaveFoundation": function(msg) {
|    | [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
|3001|3001| 				this.FinishOrder();
|3002|3002| 				return;
|3003|3003| 			}
|3004|    |-			else
|3005|    |-			{
|    |3004|+			
|3006|3005| 				this.order.data.min = range;
|3007|3006| 				this.SetNextState("WALKING");
|3008|    |-			}
|    |3007|+			
|3009|3008| 		},
|3010|3009| 
|3011|3010| 		"IDLE": {
|    | [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
|3045|3045| 				}
|3046|3046| 				// Start attacking one of the newly-seen enemy (if any)
|3047|3047| 				else if (this.IsDangerousAnimal())
|3048|    |-				{
|    |3048|+				
|3049|3049| 					this.AttackVisibleEntity(msg.data.added);
|3050|    |-				}
|    |3050|+				
|3051|3051| 
|3052|3052| 				// TODO: if two units enter our range together, we'll attack the
|3053|3053| 				// 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
|3088|3088| 				}
|3089|3089| 				// Start attacking one of the newly-seen enemy (if any)
|3090|3090| 				else if (this.template.NaturalBehaviour == "violent")
|3091|    |-				{
|    |3091|+				
|3092|3092| 					this.AttackVisibleEntity(msg.data.added);
|3093|    |-				}
|    |3093|+				
|3094|3094| 			},
|3095|3095| 
|3096|3096| 			"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
|3103|3103| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3104|3104| 
|3105|3105| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3106|    |-							// only used for domestic animals
|    |3106|+		// only used for domestic animals
|3107|3107| 	},
|3108|3108| };
|3109|3109| 
|    | [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
|3160|3160| 
|3161|3161| UnitAI.prototype.IsAnimal = function()
|3162|3162| {
|3163|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3163|+	return (!!this.template.NaturalBehaviour);
|3164|3164| };
|3165|3165| 
|3166|3166| 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
|3198|3198| UnitAI.prototype.GetGarrisonHolder = function()
|3199|3199| {
|3200|3200| 	if (this.IsGarrisoned())
|3201|    |-	{
|    |3201|+	
|3202|3202| 		for (let order of this.orderQueue)
|3203|3203| 			if (order.type == "Garrison")
|3204|3204| 				return order.data.target;
|3205|    |-	}
|    |3205|+	
|3206|3206| 	return INVALID_ENTITY;
|3207|3207| };
|3208|3208| 
|    | [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
|3276|3276| 		{
|3277|3277| 			let index = this.GetCurrentState().indexOf(".");
|3278|3278| 			if (index != -1)
|3279|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3279|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3280|3280| 			this.Stop(false);
|3281|3281| 		}
|3282|3282| 
|    | [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
|3332|3332| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3333|3333| 			continue;
|3334|3334| 		if (i == 0)
|3335|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3335|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3336|3336| 		else
|3337|3337| 			this.orderQueue.splice(i, 1);
|3338|3338| 		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
|3332|3332| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3333|3333| 			continue;
|3334|3334| 		if (i == 0)
|3335|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3335|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3336|3336| 		else
|3337|3337| 			this.orderQueue.splice(i, 1);
|3338|3338| 		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
|3416|3416| };
|3417|3417| 
|3418|3418| 
|3419|    |-//// FSM linkage functions ////
|    |3419|+// // FSM linkage functions ////
|3420|3420| 
|3421|3421| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3422|3422| 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
|3588|3588| 				continue;
|3589|3589| 			if (this.orderQueue[i].type == type)
|3590|3590| 				continue;
|3591|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3591|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3592|3592| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3593|3593| 			return;
|3594|3594| 		}
|    | [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
|3588|3588| 				continue;
|3589|3589| 			if (this.orderQueue[i].type == type)
|3590|3590| 				continue;
|3591|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3591|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3592|3592| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3593|3593| 			return;
|3594|3594| 		}
|    | [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
|3602|3602| {
|3603|3603| 	// Remember the previous work orders to be able to go back to them later if required
|3604|3604| 	if (data && data.force)
|3605|    |-	{
|    |3605|+	
|3606|3606| 		if (this.IsFormationController())
|3607|3607| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3608|3608| 		else
|3609|3609| 			this.UpdateWorkOrders(type);
|3610|    |-	}
|    |3610|+	
|3611|3611| 
|3612|3612| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3613|3613| 
|    | [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
|3679|3679| 	{
|3680|3680| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3681|3681| 		if (cmpUnitAI)
|3682|    |-		{
|    |3682|+		
|3683|3683| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3684|3684| 			{
|3685|3685| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3688|3688| 					return;
|3689|3689| 				}
|3690|3690| 			}
|3691|    |-		}
|    |3691|+		
|3692|3692| 	}
|3693|3693| 
|3694|3694| 	// 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
|3681|3681| 		if (cmpUnitAI)
|3682|3682| 		{
|3683|3683| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3684|    |-			{
|    |3684|+			
|3685|3685| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3686|3686| 				{
|3687|3687| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3688|3688| 					return;
|3689|3689| 				}
|3690|    |-			}
|    |3690|+			
|3691|3691| 		}
|3692|3692| 	}
|3693|3693| 
|    | [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
|3693|3693| 
|3694|3694| 	// If nothing found, take the unit orders
|3695|3695| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3696|    |-	{
|    |3696|+	
|3697|3697| 		if (isWorkType(this.orderQueue[i].type))
|3698|3698| 		{
|3699|3699| 			this.workOrders = this.orderQueue.slice(i);
|3700|3700| 			return;
|3701|3701| 		}
|3702|    |-	}
|    |3702|+	
|3703|3703| };
|3704|3704| 
|3705|3705| 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
|3759|3759| 	if (data.timerRepeat === undefined)
|3760|3760| 		this.timer = undefined;
|3761|3761| 
|3762|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3762|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3763|3763| };
|3764|3764| 
|3765|3765| /**
|    | [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
|3759|3759| 	if (data.timerRepeat === undefined)
|3760|3760| 		this.timer = undefined;
|3761|3761| 
|3762|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3762|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3763|3763| };
|3764|3764| 
|3765|3765| /**
|    | [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
|3794|3794| 	this.timer = undefined;
|3795|3795| };
|3796|3796| 
|3797|    |-//// Message handlers /////
|    |3797|+// // Message handlers /////
|3798|3798| 
|3799|3799| UnitAI.prototype.OnMotionChanged = function(msg)
|3800|3800| {
|    | [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
|3806|3806| 	// TODO: This is a bit inefficient since every unit listens to every
|3807|3807| 	// construction message - ideally we could scope it to only the one we're building
|3808|3808| 
|3809|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3809|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3810|3810| };
|3811|3811| 
|3812|3812| 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
|3806|3806| 	// TODO: This is a bit inefficient since every unit listens to every
|3807|3807| 	// construction message - ideally we could scope it to only the one we're building
|3808|3808| 
|3809|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3809|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3810|3810| };
|3811|3811| 
|3812|3812| 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
|3831|3831| 
|3832|3832| UnitAI.prototype.OnAttacked = function(msg)
|3833|3833| {
|3834|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3834|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3835|3835| };
|3836|3836| 
|3837|3837| 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
|3831|3831| 
|3832|3832| UnitAI.prototype.OnAttacked = function(msg)
|3833|3833| {
|3834|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3834|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3835|3835| };
|3836|3836| 
|3837|3837| 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
|3836|3836| 
|3837|3837| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3838|3838| {
|3839|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3839|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|3840|3840| };
|3841|3841| 
|3842|3842| 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
|3836|3836| 
|3837|3837| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3838|3838| {
|3839|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3839|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|3840|3840| };
|3841|3841| 
|3842|3842| 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
|3841|3841| 
|3842|3842| UnitAI.prototype.OnHealthChanged = function(msg)
|3843|3843| {
|3844|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3844|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|3845|3845| };
|3846|3846| 
|3847|3847| 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
|3841|3841| 
|3842|3842| UnitAI.prototype.OnHealthChanged = function(msg)
|3843|3843| {
|3844|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3844|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|3845|3845| };
|3846|3846| 
|3847|3847| 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
|3847|3847| UnitAI.prototype.OnRangeUpdate = function(msg)
|3848|3848| {
|3849|3849| 	if (msg.tag == this.losRangeQuery)
|3850|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3850|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|3851|3851| 	else if (msg.tag == this.losHealRangeQuery)
|3852|3852| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3853|3853| };
|    | [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
|3847|3847| UnitAI.prototype.OnRangeUpdate = function(msg)
|3848|3848| {
|3849|3849| 	if (msg.tag == this.losRangeQuery)
|3850|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3850|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|3851|3851| 	else if (msg.tag == this.losHealRangeQuery)
|3852|3852| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3853|3853| };
|    | [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| 	if (msg.tag == this.losRangeQuery)
|3850|3850| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3851|3851| 	else if (msg.tag == this.losHealRangeQuery)
|3852|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3852|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|3853|3853| };
|3854|3854| 
|3855|3855| 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
|3849|3849| 	if (msg.tag == this.losRangeQuery)
|3850|3850| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3851|3851| 	else if (msg.tag == this.losHealRangeQuery)
|3852|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3852|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|3853|3853| };
|3854|3854| 
|3855|3855| 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
|3854|3854| 
|3855|3855| UnitAI.prototype.OnPackFinished = function(msg)
|3856|3856| {
|3857|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3857|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|3858|3858| };
|3859|3859| 
|3860|3860| //// 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
|3854|3854| 
|3855|3855| UnitAI.prototype.OnPackFinished = function(msg)
|3856|3856| {
|3857|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3857|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|3858|3858| };
|3859|3859| 
|3860|3860| //// 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
|3857|3857| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|3858|3858| };
|3859|3859| 
|3860|    |-//// Helper functions to be called by the FSM ////
|    |3860|+// // Helper functions to be called by the FSM ////
|3861|3861| 
|3862|3862| UnitAI.prototype.GetWalkSpeed = function()
|3863|3863| {
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /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
|3959|3959| 	if (!cmpOwnership || cmpOwnership.GetOwner() == INVALID_PLAYER)
|3960|3960| 		return undefined;
|3961|3961| 
|3962|    |-	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position)
|    |3962|+	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
|3963|3963| 	if (!cmpPosition || !cmpPosition.IsInWorld())
|3964|3964| 		return undefined;
|3965|3965| 
|    | [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
|4044|4044| 			PlaySound(name, member);
|4045|4045| 	}
|4046|4046| 	else
|4047|    |-	{
|    |4047|+	
|4048|4048| 		// Otherwise use our own sounds
|4049|4049| 		PlaySound(name, this.entity);
|4050|    |-	}
|    |4050|+	
|4051|4051| };
|4052|4052| 
|4053|4053| /*
|    | [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
|4236|4236| 	else
|4237|4237| 		// return false? Or hope you come close enough?
|4238|4238| 		var parabolicMaxRange = 0;
|4239|    |-		//return false;
|    |4239|+		// return false;
|4240|4240| 
|4241|4241| 	// the parabole changes while walking, take something in the middle
|4242|4242| 	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
|4323|4323| 	if (this.IsFormationMember())
|4324|4324| 	{
|4325|4325| 		var cmpFormationUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|4326|    |-		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation()
|4327|    |-			&& cmpFormationUnitAI.order.data.target == target)
|    |4326|+		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation() &&
|    |4327|+			cmpFormationUnitAI.order.data.target == target)
|4328|4328| 			return true;
|4329|4329| 	}
|4330|4330| 
|    | [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
|4491|4491| UnitAI.prototype.AttackEntityInZone = function(ents)
|4492|4492| {
|4493|4493| 	var target = ents.find(target =>
|4494|    |-		this.CanAttack(target)
|4495|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4494|+		this.CanAttack(target) &&
|    |4495|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4496|4496| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4497|4497| 	);
|4498|4498| 	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
|4492|4492| {
|4493|4493| 	var target = ents.find(target =>
|4494|4494| 		this.CanAttack(target)
|4495|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4496|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4495|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4496|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4497|4497| 	);
|4498|4498| 	if (!target)
|4499|4499| 		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
|4556|4556| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4557|4557| 	if (this.isGuardOf)
|4558|4558| 	{
|4559|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4559|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4560|4560| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4561|4561| 		if (cmpUnitAI && cmpAttack &&
|4562|4562| 		    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
|4560|4560| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4561|4561| 		if (cmpUnitAI && cmpAttack &&
|4562|4562| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4563|    |-				return false;
|    |4563|+			return false;
|4564|4564| 	}
|4565|4565| 
|4566|4566| 	// 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
|4565|4565| 
|4566|4566| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4567|4567| 	if (this.GetStance().respondHoldGround)
|4568|    |-	{
|    |4568|+	
|4569|4569| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4570|4570| 			return true;
|4571|    |-	}
|    |4571|+	
|4572|4572| 
|4573|4573| 	// Stop if it's left our vision range, unless we're especially persistent
|4574|4574| 	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
|4572|4572| 
|4573|4573| 	// Stop if it's left our vision range, unless we're especially persistent
|4574|4574| 	if (!this.GetStance().respondChaseBeyondVision)
|4575|    |-	{
|    |4575|+	
|4576|4576| 		if (!this.CheckTargetIsInVisionRange(target))
|4577|4577| 			return true;
|4578|    |-	}
|    |4578|+	
|4579|4579| 
|4580|4580| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4581|4581| 	// 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
|4598|4598| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4599|4599| 	if (this.isGuardOf)
|4600|4600| 	{
|4601|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4601|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4602|4602| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4603|4603| 		if (cmpUnitAI && cmpAttack &&
|4604|4604| 		    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
|4611|4611| 	return false;
|4612|4612| };
|4613|4613| 
|4614|    |-//// External interface functions ////
|    |4614|+// // External interface functions ////
|4615|4615| 
|4616|4616| UnitAI.prototype.SetFormationController = function(ent)
|4617|4617| {
|    | [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
|4621|4621| 	// of our own formation (or ourself if not in formation)
|4622|4622| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4623|4623| 	if (cmpObstruction)
|4624|    |-	{
|    |4624|+	
|4625|4625| 		if (ent == INVALID_ENTITY)
|4626|4626| 			cmpObstruction.SetControlGroup(this.entity);
|4627|4627| 		else
|4628|4628| 			cmpObstruction.SetControlGroup(ent);
|4629|    |-	}
|    |4629|+	
|4630|4630| 
|4631|4631| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4632|4632| 	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
|4764|4764| 	// if we already had an old guard order, do nothing if the target is the same
|4765|4765| 	// and the order is running, otherwise remove the previous order
|4766|4766| 	if (this.isGuardOf)
|4767|    |-	{
|    |4767|+	
|4768|4768| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4769|4769| 			return;
|4770|4770| 		else
|4771|4771| 			this.RemoveGuard();
|4772|    |-	}
|    |4772|+	
|4773|4773| 
|4774|4774| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4775|4775| };
|    | [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
|4767|4767| 	{
|4768|4768| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4769|4769| 			return;
|4770|    |-		else
|4771|    |-			this.RemoveGuard();
|    |4770|+		this.RemoveGuard();
|4772|4771| 	}
|4773|4772| 
|4774|4773| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|    | [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
|4938|4938| 			this.WalkToTarget(target, queued);
|4939|4939| 		return;
|4940|4940| 	}
|4941|    |-	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture}, queued);
|    |4941|+	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture }, queued);
|4942|4942| };
|4943|4943| 
|4944|4944| /**
|    | [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
|5087|5087| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5088|5088| 	{
|5089|5089| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5090|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5090|+		if (cmpTrader.HasBothMarkets() &&
|5091|5091| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5092|5092| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5093|5093| 		{
|    | [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
|5368|5368| 				{
|5369|5369| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5370|5370| 					var targetClasses = this.order.data.targetClasses;
|5371|    |-					if (targetClasses.attack && cmpIdentity
|5372|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5371|+					if (targetClasses.attack && cmpIdentity &&
|    |5372|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5373|5373| 						continue;
|5374|5374| 					if (targetClasses.avoid && cmpIdentity
|5375|5375| 						&& 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
|5371|5371| 					if (targetClasses.attack && cmpIdentity
|5372|5372| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5373|5373| 						continue;
|5374|    |-					if (targetClasses.avoid && cmpIdentity
|5375|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5374|+					if (targetClasses.avoid && cmpIdentity &&
|    |5375|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5376|5376| 						continue;
|5377|5377| 					// Only used by the AIs to prevent some choices of targets
|5378|5378| 					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
|5394|5394| 		{
|5395|5395| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5396|5396| 			var targetClasses = this.order.data.targetClasses;
|5397|    |-			if (cmpIdentity && targetClasses.attack
|5398|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5397|+			if (cmpIdentity && targetClasses.attack &&
|    |5398|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5399|5399| 				continue;
|5400|5400| 			if (cmpIdentity && targetClasses.avoid
|5401|5401| 				&& 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
|5397|5397| 			if (cmpIdentity && targetClasses.attack
|5398|5398| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5399|5399| 				continue;
|5400|    |-			if (cmpIdentity && targetClasses.avoid
|5401|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5400|+			if (cmpIdentity && targetClasses.avoid &&
|    |5401|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5402|5402| 				continue;
|5403|5403| 			// Only used by the AIs to prevent some choices of targets
|5404|5404| 			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
|5540|5540| 
|5541|5541| UnitAI.prototype.SetHeldPosition = function(x, z)
|5542|5542| {
|5543|    |-	this.heldPosition = {"x": x, "z": z};
|    |5543|+	this.heldPosition = { "x": x, "z": z};
|5544|5544| };
|5545|5545| 
|5546|5546| 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
|5540|5540| 
|5541|5541| UnitAI.prototype.SetHeldPosition = function(x, z)
|5542|5542| {
|5543|    |-	this.heldPosition = {"x": x, "z": z};
|    |5543|+	this.heldPosition = {"x": x, "z": z };
|5544|5544| };
|5545|5545| 
|5546|5546| 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
|5567|5567| 	return false;
|5568|5568| };
|5569|5569| 
|5570|    |-//// Helper functions ////
|    |5570|+// // Helper functions ////
|5571|5571| 
|5572|5572| UnitAI.prototype.CanAttack = function(target)
|5573|5573| {
|    | [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
|5771|5771| 	return cmpPack && cmpPack.IsPacking();
|5772|5772| };
|5773|5773| 
|5774|    |-//// Formation specific functions ////
|    |5774|+// // Formation specific functions ////
|5775|5775| 
|5776|5776| UnitAI.prototype.IsAttackingAsFormation = function()
|5777|5777| {
|    | [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
|5776|5776| UnitAI.prototype.IsAttackingAsFormation = function()
|5777|5777| {
|5778|5778| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5779|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5780|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5779|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5780|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5781|5781| };
|5782|5782| 
|5783|5783| //// 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
|5780|5780| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5781|5781| };
|5782|5782| 
|5783|    |-//// Animal specific functions ////
|    |5783|+// // Animal specific functions ////
|5784|5784| 
|5785|5785| UnitAI.prototype.MoveRandomly = function(distance)
|5786|5786| {

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

binaries/data/mods/public/simulation/components/UnitAI.js
|1017| »   »   »   »   "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
|1052| »   »   »   "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
|1084| »   »   »   »   "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
|1298| »   »   »   "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
|1481| »   »   »   "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
|1502| »   »   »   "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
|1532| »   »   »   "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
|1687| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|2011| »   »   »   »   "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
|2101| »   »   »   »   "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
|2270| »   »   »   »   »   »   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
|2325| »   »   »   »   "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
|2443| »   »   »   »   "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
|2508| »   »   »   »   "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
|2548| »   »   »   »   "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
|2751| »   »   »   »   "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
|2934| »   »   »   »   "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
|3664| »   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
|4478| »   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
|4493| »   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
|4539| »   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
|4562| »   »   ····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
|5018| »   var·lastPos·=·undefined;
|    | [NORMAL] ESLintBear (no-undef-init):
|    | It's not necessary to initialize 'lastPos' to undefined.

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
|1862| »   »   »   »   »   »   var·cmpFormation·=·Engine.QueryInterface(this.formationController,·IID_Formation);
|    | [NORMAL] JSHintBear:
|    | 'cmpFormation' is already defined.

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|2284| »   »   »   »   »   »   »   ||·(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
|2285| »   »   »   »   »   »   »   &&·(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
|2305| »   »   »   »   »   var·nearby·=·this.FindNearestDropsite(resourceType.generic);
|    | [NORMAL] JSHintBear:
|    | 'nearby' is already defined.

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

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

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

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

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

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

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|3962| »   let·cmpPosition·=·Engine.QueryInterface(this.entity,·IID_Position)
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4249| »   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
|4327| »   »   »   &&·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
|4495| »   »   &&·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
|4496| »   »   &&·(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
|5018| »   var·lastPos·=·undefined;
|    | [NORMAL] JSHintBear:
|    | It's not necessary to initialize 'lastPos' to 'undefined'.

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

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

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

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

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

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

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

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

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
|5498| »   »   var·cmpVision·=·Engine.QueryInterface(this.entity,·IID_Vision);
|    | [NORMAL] JSHintBear:
|    | 'cmpVision' is already defined.

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

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

wraitii planned changes to this revision.Jun 17 2019, 8:28 PM

Given how Gathering handles this, I should probably just cache a "last known position" variable in unit Motion updated each turn.

wraitii updated this revision to Diff 8541.Jun 17 2019, 10:18 PM
wraitii retitled this revision from UnitMotion - more explicit handling of target death in Combat.Approaching, and bypass CheckRange and error messages to UnitMotion - more explicit handling of target death in Combat.Approaching.
wraitii edited the summary of this revision. (Show Details)

I was looking into how we could merge this behaviour with the gathering LastPos, and after some thinking my initial diff was pretty poor. UnitMotion waypoints are OK but might not exist, and this is more of a UnitAI behaviour anyways.

I noticed/remembered that we already have a way, in UnitAI, to remember a position (called a "Held Position"). So instead I've updated all code to use that instead. Incidentally, I noticed that code was buggy.

This still introduces proper handling of the situation in Combat.Approaching.

Also split of D1998

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

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

wraitii added inline comments.Jun 17 2019, 10:20 PM
binaries/data/mods/public/simulation/components/Promotion.js
38 ↗(On Diff #8541)

I'm not sure why Promotions didn't use this code already.

binaries/data/mods/public/simulation/components/UnitAI.js
4407 ↗(On Diff #8541)

Should capitalise this, I missed that this function existed.

5528 ↗(On Diff #8541)

I believe this.entity before was a typo dating from the writing of this function.

5545 ↗(On Diff #8541)

I'm calling FinishOrder here and only moving back if we don't have another order. I've checked, and it shouldn't change our existing behaviour anywhere (in fact one caller already did that), so we're good.

wraitii planned changes to this revision.Jun 18 2019, 8:32 AM

Thought about this overnight: this most likely breaks some code think attacking will change the held position kept by other components.
So probably I just need clean things up using orders.

wraitii updated this revision to Diff 8646.EditedSat, Jun 29, 5:34 PM

This version is committable pending other issues (such as bugs in it)

It reverts rP12549 - I don't believe that is a huge issue because:

  • wasting an attack when the target is dead doesn't seem like the worst thing in the world
  • arguably the "new" attack is unprepared so it should go through the prepare time again, and thus the behaviour from rP12549 is wrong.

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, range))
|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
|1953|1953| 
|1954|1954| 				"Attacked": function(msg) {
|1955|1955| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|1956|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|1957|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |1956|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |1957|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|1958|1958| 						this.RespondToTargetedEntities([msg.data.attacker]);
|1959|1959| 				},
|1960|1960| 			},
|    | [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
|2004|2004| 					this.SelectAnimation("move");
|2005|2005| 					var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|2006|2006| 					if (cmpUnitAI && cmpUnitAI.IsFleeing())
|2007|    |-					{
|    |2007|+					
|2008|2008| 						// Run after a fleeing target
|2009|2009| 						this.SetSpeedMultiplier(this.GetRunMultiplier());
|2010|    |-					}
|    |2010|+					
|2011|2011| 					this.StartTimer(1000, 1000);
|2012|2012| 				},
|2013|2013| 
|    | [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
|2186|2186| 
|2187|2187| 					var cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply);
|2188|2188| 					if (cmpSupply && cmpSupply.IsAvailable(cmpOwnership.GetOwner(), this.entity))
|2189|    |-					{
|    |2189|+					
|2190|2190| 						// Check we can still reach and gather from the target
|2191|2191| 						if (this.CheckTargetRange(this.gatheringTarget, IID_ResourceGatherer) && this.CanGather(this.gatheringTarget))
|2192|2192| 						{
|2237|2237| 								return;
|2238|2238| 							}
|2239|2239| 						}
|2240|    |-					}
|    |2240|+					
|2241|2241| 
|2242|2242| 					// We're already in range, can't get anywhere near it or the target is exhausted.
|2243|2243| 
|    | [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
|2229|2229| 								return;
|2230|2230| 						}
|2231|2231| 						else
|2232|    |-						{
|    |2232|+						
|2233|2233| 							// Try to follow the target
|2234|2234| 							if (this.MoveToTargetRange(this.gatheringTarget, IID_ResourceGatherer))
|2235|2235| 							{
|2236|2236| 								this.SetNextState("APPROACHING");
|2237|2237| 								return;
|2238|2238| 							}
|2239|    |-						}
|    |2239|+						
|2240|2240| 					}
|2241|2241| 
|2242|2242| 					// We're already in range, can't get anywhere near it or the target is exhausted.
|    | [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
|2263|2263| 					// Also don't switch to a different type of huntable animal
|2264|2264| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2265|2265| 						return (
|2266|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2267|    |-							|| (type.specific == resourceType.specific
|    |2266|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2267|+							(type.specific == resourceType.specific
|2268|2268| 							&& (type.specific != "meat" || resourceTemplate == template))
|2269|2269| 						);
|2270|2270| 					});
|    | [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
|2264|2264| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2265|2265| 						return (
|2266|2266| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2267|    |-							|| (type.specific == resourceType.specific
|2268|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2267|+							|| (type.specific == resourceType.specific &&
|    |2268|+							(type.specific != "meat" || resourceTemplate == template))
|2269|2269| 						);
|2270|2270| 					});
|2271|2271| 					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
|2329|2329| 
|2330|2330| 				"Timer": function(msg) {
|2331|2331| 					if (this.ShouldAbandonChase(this.order.data.target, this.order.data.force, IID_Heal, null))
|2332|    |-					{
|    |2332|+					
|2333|2333| 						// Return to our original position unless we have a better order.
|2334|2334| 						if (!this.FinishOrder() && this.GetStance().respondHoldGround)
|2335|2335| 							this.WalkToHeldPosition();
|2336|    |-					}
|    |2336|+					
|2337|2337| 				},
|2338|2338| 
|2339|2339| 				"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
|2363|2363| 					this.StartTimer(prepare, this.healTimers.repeat);
|2364|2364| 
|2365|2365| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2366|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2366|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2367|2367| 
|2368|2368| 					this.FaceTowardsTarget(this.order.data.target);
|2369|2369| 				},
|    | [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
|2576|2576| 					{
|2577|2577| 						// The building was already finished/fully repaired before we arrived;
|2578|2578| 						// let the ConstructionFinished handler handle this.
|2579|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2579|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2580|2580| 						return true;
|2581|2581| 					}
|2582|2582| 
|    | [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
|2576|2576| 					{
|2577|2577| 						// The building was already finished/fully repaired before we arrived;
|2578|2578| 						// let the ConstructionFinished handler handle this.
|2579|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2579|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2580|2580| 						return true;
|2581|2581| 					}
|2582|2582| 
|    | [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
|2703|2703| 
|2704|2704| 				// Unit was approaching and there's nothing to do now, so switch to walking
|2705|2705| 				if (oldState === "INDIVIDUAL.REPAIR.APPROACHING")
|2706|    |-				{
|    |2706|+				
|2707|2707| 					// We're already walking to the given point, so add this as a order.
|2708|2708| 					this.WalkToTarget(msg.data.newentity, true);
|2709|    |-				}
|    |2709|+				
|2710|2710| 			},
|2711|2711| 		},
|2712|2712| 
|    | [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
|2766|2766| 
|2767|2767| 					// Check that we can garrison here
|2768|2768| 					if (this.CanGarrison(target))
|2769|    |-					{
|    |2769|+					
|2770|2770| 						// Check that we're in range of the garrison target
|2771|2771| 						if (this.CheckGarrisonRange(target))
|2772|2772| 						{
|2842|2842| 								return false;
|2843|2843| 							}
|2844|2844| 						}
|2845|    |-					}
|    |2845|+					
|2846|2846| 					// Garrisoning failed for some reason, so finish the order
|2847|2847| 					this.FinishOrder();
|2848|2848| 					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
|2964|2964| 		"Attacked": function(msg) {
|2965|2965| 			if (this.template.NaturalBehaviour == "skittish" ||
|2966|2966| 			    this.template.NaturalBehaviour == "passive")
|2967|    |-			{
|    |2967|+			
|2968|2968| 				this.Flee(msg.data.attacker, false);
|2969|    |-			}
|    |2969|+			
|2970|2970| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|2971|2971| 			{
|2972|2972| 				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
|2973|2973| 					this.Attack(msg.data.attacker, false);
|2974|2974| 			}
|2975|2975| 			else if (this.template.NaturalBehaviour == "domestic")
|2976|    |-			{
|    |2976|+			
|2977|2977| 				// Never flee, stop what we were doing
|2978|2978| 				this.SetNextState("IDLE");
|2979|    |-			}
|    |2979|+			
|2980|2980| 		},
|2981|2981| 
|2982|2982| 		"Order.LeaveFoundation": function(msg) {
|    | [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
|2987|2987| 				this.FinishOrder();
|2988|2988| 				return;
|2989|2989| 			}
|2990|    |-			else
|2991|    |-			{
|    |2990|+			
|2992|2991| 				this.order.data.min = range;
|2993|2992| 				this.SetNextState("WALKING");
|2994|    |-			}
|    |2993|+			
|2995|2994| 		},
|2996|2995| 
|2997|2996| 		"IDLE": {
|    | [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
|3031|3031| 				}
|3032|3032| 				// Start attacking one of the newly-seen enemy (if any)
|3033|3033| 				else if (this.IsDangerousAnimal())
|3034|    |-				{
|    |3034|+				
|3035|3035| 					this.AttackVisibleEntity(msg.data.added);
|3036|    |-				}
|    |3036|+				
|3037|3037| 
|3038|3038| 				// TODO: if two units enter our range together, we'll attack the
|3039|3039| 				// 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
|3074|3074| 				}
|3075|3075| 				// Start attacking one of the newly-seen enemy (if any)
|3076|3076| 				else if (this.template.NaturalBehaviour == "violent")
|3077|    |-				{
|    |3077|+				
|3078|3078| 					this.AttackVisibleEntity(msg.data.added);
|3079|    |-				}
|    |3079|+				
|3080|3080| 			},
|3081|3081| 
|3082|3082| 			"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
|3089|3089| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3090|3090| 
|3091|3091| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3092|    |-							// only used for domestic animals
|    |3092|+		// only used for domestic animals
|3093|3093| 	},
|3094|3094| };
|3095|3095| 
|    | [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
|3146|3146| 
|3147|3147| UnitAI.prototype.IsAnimal = function()
|3148|3148| {
|3149|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3149|+	return (!!this.template.NaturalBehaviour);
|3150|3150| };
|3151|3151| 
|3152|3152| 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
|3184|3184| UnitAI.prototype.GetGarrisonHolder = function()
|3185|3185| {
|3186|3186| 	if (this.IsGarrisoned())
|3187|    |-	{
|    |3187|+	
|3188|3188| 		for (let order of this.orderQueue)
|3189|3189| 			if (order.type == "Garrison")
|3190|3190| 				return order.data.target;
|3191|    |-	}
|    |3191|+	
|3192|3192| 	return INVALID_ENTITY;
|3193|3193| };
|3194|3194| 
|    | [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
|3262|3262| 		{
|3263|3263| 			let index = this.GetCurrentState().indexOf(".");
|3264|3264| 			if (index != -1)
|3265|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3265|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3266|3266| 			this.Stop(false);
|3267|3267| 		}
|3268|3268| 
|    | [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
|3318|3318| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3319|3319| 			continue;
|3320|3320| 		if (i == 0)
|3321|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3321|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3322|3322| 		else
|3323|3323| 			this.orderQueue.splice(i, 1);
|3324|3324| 		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
|3318|3318| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3319|3319| 			continue;
|3320|3320| 		if (i == 0)
|3321|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3321|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3322|3322| 		else
|3323|3323| 			this.orderQueue.splice(i, 1);
|3324|3324| 		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
|3402|3402| };
|3403|3403| 
|3404|3404| 
|3405|    |-//// FSM linkage functions ////
|    |3405|+// // FSM linkage functions ////
|3406|3406| 
|3407|3407| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3408|3408| 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
|3574|3574| 				continue;
|3575|3575| 			if (this.orderQueue[i].type == type)
|3576|3576| 				continue;
|3577|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3577|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3578|3578| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3579|3579| 			return;
|3580|3580| 		}
|    | [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
|3574|3574| 				continue;
|3575|3575| 			if (this.orderQueue[i].type == type)
|3576|3576| 				continue;
|3577|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3577|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3578|3578| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3579|3579| 			return;
|3580|3580| 		}
|    | [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
|3588|3588| {
|3589|3589| 	// Remember the previous work orders to be able to go back to them later if required
|3590|3590| 	if (data && data.force)
|3591|    |-	{
|    |3591|+	
|3592|3592| 		if (this.IsFormationController())
|3593|3593| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3594|3594| 		else
|3595|3595| 			this.UpdateWorkOrders(type);
|3596|    |-	}
|    |3596|+	
|3597|3597| 
|3598|3598| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3599|3599| 
|    | [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
|3665|3665| 	{
|3666|3666| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3667|3667| 		if (cmpUnitAI)
|3668|    |-		{
|    |3668|+		
|3669|3669| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3670|3670| 			{
|3671|3671| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3674|3674| 					return;
|3675|3675| 				}
|3676|3676| 			}
|3677|    |-		}
|    |3677|+		
|3678|3678| 	}
|3679|3679| 
|3680|3680| 	// 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
|3667|3667| 		if (cmpUnitAI)
|3668|3668| 		{
|3669|3669| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3670|    |-			{
|    |3670|+			
|3671|3671| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3672|3672| 				{
|3673|3673| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3674|3674| 					return;
|3675|3675| 				}
|3676|    |-			}
|    |3676|+			
|3677|3677| 		}
|3678|3678| 	}
|3679|3679| 
|    | [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
|3679|3679| 
|3680|3680| 	// If nothing found, take the unit orders
|3681|3681| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3682|    |-	{
|    |3682|+	
|3683|3683| 		if (isWorkType(this.orderQueue[i].type))
|3684|3684| 		{
|3685|3685| 			this.workOrders = this.orderQueue.slice(i);
|3686|3686| 			return;
|3687|3687| 		}
|3688|    |-	}
|    |3688|+	
|3689|3689| };
|3690|3690| 
|3691|3691| 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
|3745|3745| 	if (data.timerRepeat === undefined)
|3746|3746| 		this.timer = undefined;
|3747|3747| 
|3748|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3748|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3749|3749| };
|3750|3750| 
|3751|3751| /**
|    | [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
|3745|3745| 	if (data.timerRepeat === undefined)
|3746|3746| 		this.timer = undefined;
|3747|3747| 
|3748|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3748|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3749|3749| };
|3750|3750| 
|3751|3751| /**
|    | [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
|3780|3780| 	this.timer = undefined;
|3781|3781| };
|3782|3782| 
|3783|    |-//// Message handlers /////
|    |3783|+// // Message handlers /////
|3784|3784| 
|3785|3785| UnitAI.prototype.OnMotionChanged = function(msg)
|3786|3786| {
|    | [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
|3792|3792| 	// TODO: This is a bit inefficient since every unit listens to every
|3793|3793| 	// construction message - ideally we could scope it to only the one we're building
|3794|3794| 
|3795|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3795|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3796|3796| };
|3797|3797| 
|3798|3798| 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
|3792|3792| 	// TODO: This is a bit inefficient since every unit listens to every
|3793|3793| 	// construction message - ideally we could scope it to only the one we're building
|3794|3794| 
|3795|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3795|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3796|3796| };
|3797|3797| 
|3798|3798| 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
|3817|3817| 
|3818|3818| UnitAI.prototype.OnAttacked = function(msg)
|3819|3819| {
|3820|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3820|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3821|3821| };
|3822|3822| 
|3823|3823| 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
|3817|3817| 
|3818|3818| UnitAI.prototype.OnAttacked = function(msg)
|3819|3819| {
|3820|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3820|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3821|3821| };
|3822|3822| 
|3823|3823| 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
|3822|3822| 
|3823|3823| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3824|3824| {
|3825|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3825|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|3826|3826| };
|3827|3827| 
|3828|3828| 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
|3822|3822| 
|3823|3823| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3824|3824| {
|3825|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3825|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|3826|3826| };
|3827|3827| 
|3828|3828| 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
|3827|3827| 
|3828|3828| UnitAI.prototype.OnHealthChanged = function(msg)
|3829|3829| {
|3830|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3830|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|3831|3831| };
|3832|3832| 
|3833|3833| 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
|3827|3827| 
|3828|3828| UnitAI.prototype.OnHealthChanged = function(msg)
|3829|3829| {
|3830|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3830|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|3831|3831| };
|3832|3832| 
|3833|3833| 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
|3833|3833| UnitAI.prototype.OnRangeUpdate = function(msg)
|3834|3834| {
|3835|3835| 	if (msg.tag == this.losRangeQuery)
|3836|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3836|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|3837|3837| 	else if (msg.tag == this.losHealRangeQuery)
|3838|3838| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3839|3839| };
|    | [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| UnitAI.prototype.OnRangeUpdate = function(msg)
|3834|3834| {
|3835|3835| 	if (msg.tag == this.losRangeQuery)
|3836|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3836|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|3837|3837| 	else if (msg.tag == this.losHealRangeQuery)
|3838|3838| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3839|3839| };
|    | [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
|3835|3835| 	if (msg.tag == this.losRangeQuery)
|3836|3836| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3837|3837| 	else if (msg.tag == this.losHealRangeQuery)
|3838|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3838|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|3839|3839| };
|3840|3840| 
|3841|3841| 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
|3835|3835| 	if (msg.tag == this.losRangeQuery)
|3836|3836| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3837|3837| 	else if (msg.tag == this.losHealRangeQuery)
|3838|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3838|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|3839|3839| };
|3840|3840| 
|3841|3841| 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
|3840|3840| 
|3841|3841| UnitAI.prototype.OnPackFinished = function(msg)
|3842|3842| {
|3843|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3843|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|3844|3844| };
|3845|3845| 
|3846|3846| //// 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
|3840|3840| 
|3841|3841| UnitAI.prototype.OnPackFinished = function(msg)
|3842|3842| {
|3843|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3843|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|3844|3844| };
|3845|3845| 
|3846|3846| //// 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
|3843|3843| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|3844|3844| };
|3845|3845| 
|3846|    |-//// Helper functions to be called by the FSM ////
|    |3846|+// // Helper functions to be called by the FSM ////
|3847|3847| 
|3848|3848| UnitAI.prototype.GetWalkSpeed = function()
|3849|3849| {
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /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
|3945|3945| 	if (!cmpOwnership || cmpOwnership.GetOwner() == INVALID_PLAYER)
|3946|3946| 		return undefined;
|3947|3947| 
|3948|    |-	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position)
|    |3948|+	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
|3949|3949| 	if (!cmpPosition || !cmpPosition.IsInWorld())
|3950|3950| 		return undefined;
|3951|3951| 
|    | [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
|4030|4030| 			PlaySound(name, member);
|4031|4031| 	}
|4032|4032| 	else
|4033|    |-	{
|    |4033|+	
|4034|4034| 		// Otherwise use our own sounds
|4035|4035| 		PlaySound(name, this.entity);
|4036|    |-	}
|    |4036|+	
|4037|4037| };
|4038|4038| 
|4039|4039| /*
|    | [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
|4222|4222| 	else
|4223|4223| 		// return false? Or hope you come close enough?
|4224|4224| 		var parabolicMaxRange = 0;
|4225|    |-		//return false;
|    |4225|+		// return false;
|4226|4226| 
|4227|4227| 	// the parabole changes while walking, take something in the middle
|4228|4228| 	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
|4309|4309| 	if (this.IsFormationMember())
|4310|4310| 	{
|4311|4311| 		var cmpFormationUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|4312|    |-		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation()
|4313|    |-			&& cmpFormationUnitAI.order.data.target == target)
|    |4312|+		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation() &&
|    |4313|+			cmpFormationUnitAI.order.data.target == target)
|4314|4314| 			return true;
|4315|4315| 	}
|4316|4316| 
|    | [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
|4477|4477| UnitAI.prototype.AttackEntityInZone = function(ents)
|4478|4478| {
|4479|4479| 	var target = ents.find(target =>
|4480|    |-		this.CanAttack(target)
|4481|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4480|+		this.CanAttack(target) &&
|    |4481|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4482|4482| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4483|4483| 	);
|4484|4484| 	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
|4478|4478| {
|4479|4479| 	var target = ents.find(target =>
|4480|4480| 		this.CanAttack(target)
|4481|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4482|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4481|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4482|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4483|4483| 	);
|4484|4484| 	if (!target)
|4485|4485| 		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
|4542|4542| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4543|4543| 	if (this.isGuardOf)
|4544|4544| 	{
|4545|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4545|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4546|4546| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4547|4547| 		if (cmpUnitAI && cmpAttack &&
|4548|4548| 		    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
|4546|4546| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4547|4547| 		if (cmpUnitAI && cmpAttack &&
|4548|4548| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4549|    |-				return false;
|    |4549|+			return false;
|4550|4550| 	}
|4551|4551| 
|4552|4552| 	// 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
|4551|4551| 
|4552|4552| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4553|4553| 	if (this.GetStance().respondHoldGround)
|4554|    |-	{
|    |4554|+	
|4555|4555| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4556|4556| 			return true;
|4557|    |-	}
|    |4557|+	
|4558|4558| 
|4559|4559| 	// Stop if it's left our vision range, unless we're especially persistent
|4560|4560| 	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
|4558|4558| 
|4559|4559| 	// Stop if it's left our vision range, unless we're especially persistent
|4560|4560| 	if (!this.GetStance().respondChaseBeyondVision)
|4561|    |-	{
|    |4561|+	
|4562|4562| 		if (!this.CheckTargetIsInVisionRange(target))
|4563|4563| 			return true;
|4564|    |-	}
|    |4564|+	
|4565|4565| 
|4566|4566| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4567|4567| 	// 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
|4584|4584| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4585|4585| 	if (this.isGuardOf)
|4586|4586| 	{
|4587|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4587|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4588|4588| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4589|4589| 		if (cmpUnitAI && cmpAttack &&
|4590|4590| 		    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
|4597|4597| 	return false;
|4598|4598| };
|4599|4599| 
|4600|    |-//// External interface functions ////
|    |4600|+// // External interface functions ////
|4601|4601| 
|4602|4602| UnitAI.prototype.SetFormationController = function(ent)
|4603|4603| {
|    | [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
|4607|4607| 	// of our own formation (or ourself if not in formation)
|4608|4608| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4609|4609| 	if (cmpObstruction)
|4610|    |-	{
|    |4610|+	
|4611|4611| 		if (ent == INVALID_ENTITY)
|4612|4612| 			cmpObstruction.SetControlGroup(this.entity);
|4613|4613| 		else
|4614|4614| 			cmpObstruction.SetControlGroup(ent);
|4615|    |-	}
|    |4615|+	
|4616|4616| 
|4617|4617| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4618|4618| 	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
|4750|4750| 	// if we already had an old guard order, do nothing if the target is the same
|4751|4751| 	// and the order is running, otherwise remove the previous order
|4752|4752| 	if (this.isGuardOf)
|4753|    |-	{
|    |4753|+	
|4754|4754| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4755|4755| 			return;
|4756|4756| 		else
|4757|4757| 			this.RemoveGuard();
|4758|    |-	}
|    |4758|+	
|4759|4759| 
|4760|4760| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4761|4761| };
|    | [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
|4753|4753| 	{
|4754|4754| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4755|4755| 			return;
|4756|    |-		else
|4757|    |-			this.RemoveGuard();
|    |4756|+		this.RemoveGuard();
|4758|4757| 	}
|4759|4758| 
|4760|4759| 	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
|5084|5084| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5085|5085| 	{
|5086|5086| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5087|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5087|+		if (cmpTrader.HasBothMarkets() &&
|5088|5088| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5089|5089| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5090|5090| 		{
|    | [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
|5365|5365| 				{
|5366|5366| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5367|5367| 					var targetClasses = this.order.data.targetClasses;
|5368|    |-					if (targetClasses.attack && cmpIdentity
|5369|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5368|+					if (targetClasses.attack && cmpIdentity &&
|    |5369|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5370|5370| 						continue;
|5371|5371| 					if (targetClasses.avoid && cmpIdentity
|5372|5372| 						&& 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
|5368|5368| 					if (targetClasses.attack && cmpIdentity
|5369|5369| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5370|5370| 						continue;
|5371|    |-					if (targetClasses.avoid && cmpIdentity
|5372|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5371|+					if (targetClasses.avoid && cmpIdentity &&
|    |5372|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5373|5373| 						continue;
|5374|5374| 					// Only used by the AIs to prevent some choices of targets
|5375|5375| 					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
|5391|5391| 		{
|5392|5392| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5393|5393| 			var targetClasses = this.order.data.targetClasses;
|5394|    |-			if (cmpIdentity && targetClasses.attack
|5395|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5394|+			if (cmpIdentity && targetClasses.attack &&
|    |5395|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5396|5396| 				continue;
|5397|5397| 			if (cmpIdentity && targetClasses.avoid
|5398|5398| 				&& 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
|5394|5394| 			if (cmpIdentity && targetClasses.attack
|5395|5395| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5396|5396| 				continue;
|5397|    |-			if (cmpIdentity && targetClasses.avoid
|5398|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5397|+			if (cmpIdentity && targetClasses.avoid &&
|    |5398|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5399|5399| 				continue;
|5400|5400| 			// Only used by the AIs to prevent some choices of targets
|5401|5401| 			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
|5551|5551| 
|5552|5552| UnitAI.prototype.SetHeldPosition = function(x, z)
|5553|5553| {
|5554|    |-	this.heldPosition = {"x": x, "z": z};
|    |5554|+	this.heldPosition = { "x": x, "z": z};
|5555|5555| };
|5556|5556| 
|5557|5557| 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
|5551|5551| 
|5552|5552| UnitAI.prototype.SetHeldPosition = function(x, z)
|5553|5553| {
|5554|    |-	this.heldPosition = {"x": x, "z": z};
|    |5554|+	this.heldPosition = {"x": x, "z": z };
|5555|5555| };
|5556|5556| 
|5557|5557| 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
|5578|5578| 	return false;
|5579|5579| };
|5580|5580| 
|5581|    |-//// Helper functions ////
|    |5581|+// // Helper functions ////
|5582|5582| 
|5583|5583| UnitAI.prototype.CanAttack = function(target)
|5584|5584| {
|    | [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
|5782|5782| 	return cmpPack && cmpPack.IsPacking();
|5783|5783| };
|5784|5784| 
|5785|    |-//// Formation specific functions ////
|    |5785|+// // Formation specific functions ////
|5786|5786| 
|5787|5787| UnitAI.prototype.IsAttackingAsFormation = function()
|5788|5788| {
|    | [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
|5787|5787| UnitAI.prototype.IsAttackingAsFormation = function()
|5788|5788| {
|5789|5789| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5790|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5791|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5790|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5791|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5792|5792| };
|5793|5793| 
|5794|5794| //// 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
|5791|5791| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5792|5792| };
|5793|5793| 
|5794|    |-//// Animal specific functions ////
|    |5794|+// // Animal specific functions ////
|5795|5795| 
|5796|5796| UnitAI.prototype.MoveRandomly = function(distance)
|5797|5797| {

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

binaries/data/mods/public/simulation/components/UnitAI.js
|1994| »   »   »   »   "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
|2084| »   »   »   »   "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
|2253| »   »   »   »   »   »   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
|2308| »   »   »   »   "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
|2426| »   »   »   »   "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
|2491| »   »   »   »   "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
|2531| »   »   »   »   "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
|2735| »   »   »   »   "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
|2919| »   »   »   »   "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
|3650| »   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
|4464| »   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
|4479| »   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
|4525| »   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
|4548| »   »   ····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
|1957| »   »   »   »   »   »   &&·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
|2248| »   »   »   »   »   var·cmpResourceGatherer·=·Engine.QueryInterface(this.entity,·IID_ResourceGatherer);
|    | [NORMAL] JSHintBear:
|    | 'cmpResourceGatherer' is already defined.

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

binaries/data/mods/public/simulation/components/UnitAI.js
|2267| »   »   »   »   »   »   »   ||·(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
|2268| »   »   »   »   »   »   »   &&·(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
|2288| »   »   »   »   »   var·nearby·=·this.FindNearestDropsite(resourceType.generic);
|    | [NORMAL] JSHintBear:
|    | 'nearby' is already defined.

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

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

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

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

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

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

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|3948| »   let·cmpPosition·=·Engine.QueryInterface(this.entity,·IID_Position)
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

wraitii updated this revision to Diff 8670.Sun, Jun 30, 10:05 PM

Tested, fixed a few issues, looks ready now.

wraitii added inline comments.Sun, Jun 30, 10:07 PM
binaries/data/mods/public/simulation/components/UnitAI.js
1799 ↗(On Diff #8670)

The chase logic is only handled in Timer, since if we're failing distance checks in "enter" we were never in-range in the first place.

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
|1954|1954| 
|1955|1955| 				"Attacked": function(msg) {
|1956|1956| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|1957|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|1958|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |1957|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |1958|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|1959|1959| 						this.RespondToTargetedEntities([msg.data.attacker]);
|1960|1960| 				},
|1961|1961| 			},
|    | [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
|2009|2009| 					this.SelectAnimation("move");
|2010|2010| 					var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|2011|2011| 					if (cmpUnitAI && cmpUnitAI.IsFleeing())
|2012|    |-					{
|    |2012|+					
|2013|2013| 						// Run after a fleeing target
|2014|2014| 						this.SetSpeedMultiplier(this.GetRunMultiplier());
|2015|    |-					}
|    |2015|+					
|2016|2016| 					this.StartTimer(1000, 1000);
|2017|2017| 				},
|2018|2018| 
|    | [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
|2191|2191| 
|2192|2192| 					var cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply);
|2193|2193| 					if (cmpSupply && cmpSupply.IsAvailable(cmpOwnership.GetOwner(), this.entity))
|2194|    |-					{
|    |2194|+					
|2195|2195| 						// Check we can still reach and gather from the target
|2196|2196| 						if (this.CheckTargetRange(this.gatheringTarget, IID_ResourceGatherer) && this.CanGather(this.gatheringTarget))
|2197|2197| 						{
|2254|2254| 								return;
|2255|2255| 							}
|2256|2256| 						}
|2257|    |-					}
|    |2257|+					
|2258|2258| 
|2259|2259| 					// We're already in range, can't get anywhere near it or the target is exhausted.
|2260|2260| 
|    | [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
|2280|2280| 					// Also don't switch to a different type of huntable animal
|2281|2281| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2282|2282| 						return (
|2283|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2284|    |-							|| (type.specific == resourceType.specific
|    |2283|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2284|+							(type.specific == resourceType.specific
|2285|2285| 							&& (type.specific != "meat" || resourceTemplate == template))
|2286|2286| 						);
|2287|2287| 					});
|    | [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
|2281|2281| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2282|2282| 						return (
|2283|2283| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2284|    |-							|| (type.specific == resourceType.specific
|2285|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2284|+							|| (type.specific == resourceType.specific &&
|    |2285|+							(type.specific != "meat" || resourceTemplate == template))
|2286|2286| 						);
|2287|2287| 					});
|2288|2288| 					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
|2346|2346| 
|2347|2347| 				"Timer": function(msg) {
|2348|2348| 					if (this.ShouldAbandonChase(this.order.data.target, this.order.data.force, IID_Heal, null))
|2349|    |-					{
|    |2349|+					
|2350|2350| 						// Return to our original position unless we have a better order.
|2351|2351| 						if (!this.FinishOrder() && this.GetStance().respondHoldGround)
|2352|2352| 							this.WalkToHeldPosition();
|2353|    |-					}
|    |2353|+					
|2354|2354| 				},
|2355|2355| 
|2356|2356| 				"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
|2380|2380| 					this.StartTimer(prepare, this.healTimers.repeat);
|2381|2381| 
|2382|2382| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2383|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2383|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2384|2384| 
|2385|2385| 					this.FaceTowardsTarget(this.order.data.target);
|2386|2386| 				},
|    | [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
|2593|2593| 					{
|2594|2594| 						// The building was already finished/fully repaired before we arrived;
|2595|2595| 						// let the ConstructionFinished handler handle this.
|2596|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2596|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2597|2597| 						return true;
|2598|2598| 					}
|2599|2599| 
|    | [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
|2593|2593| 					{
|2594|2594| 						// The building was already finished/fully repaired before we arrived;
|2595|2595| 						// let the ConstructionFinished handler handle this.
|2596|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2596|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2597|2597| 						return true;
|2598|2598| 					}
|2599|2599| 
|    | [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
|2720|2720| 
|2721|2721| 				// Unit was approaching and there's nothing to do now, so switch to walking
|2722|2722| 				if (oldState === "INDIVIDUAL.REPAIR.APPROACHING")
|2723|    |-				{
|    |2723|+				
|2724|2724| 					// We're already walking to the given point, so add this as a order.
|2725|2725| 					this.WalkToTarget(msg.data.newentity, true);
|2726|    |-				}
|    |2726|+				
|2727|2727| 			},
|2728|2728| 		},
|2729|2729| 
|    | [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
|2783|2783| 
|2784|2784| 					// Check that we can garrison here
|2785|2785| 					if (this.CanGarrison(target))
|2786|    |-					{
|    |2786|+					
|2787|2787| 						// Check that we're in range of the garrison target
|2788|2788| 						if (this.CheckGarrisonRange(target))
|2789|2789| 						{
|2859|2859| 								return false;
|2860|2860| 							}
|2861|2861| 						}
|2862|    |-					}
|    |2862|+					
|2863|2863| 					// Garrisoning failed for some reason, so finish the order
|2864|2864| 					this.FinishOrder();
|2865|2865| 					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
|2981|2981| 		"Attacked": function(msg) {
|2982|2982| 			if (this.template.NaturalBehaviour == "skittish" ||
|2983|2983| 			    this.template.NaturalBehaviour == "passive")
|2984|    |-			{
|    |2984|+			
|2985|2985| 				this.Flee(msg.data.attacker, false);
|2986|    |-			}
|    |2986|+			
|2987|2987| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|2988|2988| 			{
|2989|2989| 				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
|2990|2990| 					this.Attack(msg.data.attacker, false);
|2991|2991| 			}
|2992|2992| 			else if (this.template.NaturalBehaviour == "domestic")
|2993|    |-			{
|    |2993|+			
|2994|2994| 				// Never flee, stop what we were doing
|2995|2995| 				this.SetNextState("IDLE");
|2996|    |-			}
|    |2996|+			
|2997|2997| 		},
|2998|2998| 
|2999|2999| 		"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
|3045|3045| 				}
|3046|3046| 				// Start attacking one of the newly-seen enemy (if any)
|3047|3047| 				else if (this.IsDangerousAnimal())
|3048|    |-				{
|    |3048|+				
|3049|3049| 					this.AttackVisibleEntity(msg.data.added);
|3050|    |-				}
|    |3050|+				
|3051|3051| 
|3052|3052| 				// TODO: if two units enter our range together, we'll attack the
|3053|3053| 				// 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
|3088|3088| 				}
|3089|3089| 				// Start attacking one of the newly-seen enemy (if any)
|3090|3090| 				else if (this.template.NaturalBehaviour == "violent")
|3091|    |-				{
|    |3091|+				
|3092|3092| 					this.AttackVisibleEntity(msg.data.added);
|3093|    |-				}
|    |3093|+				
|3094|3094| 			},
|3095|3095| 
|3096|3096| 			"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
|3103|3103| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3104|3104| 
|3105|3105| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3106|    |-							// only used for domestic animals
|    |3106|+		// only used for domestic animals
|3107|3107| 	},
|3108|3108| };
|3109|3109| 
|    | [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
|3160|3160| 
|3161|3161| UnitAI.prototype.IsAnimal = function()
|3162|3162| {
|3163|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3163|+	return (!!this.template.NaturalBehaviour);
|3164|3164| };
|3165|3165| 
|3166|3166| 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
|3198|3198| UnitAI.prototype.GetGarrisonHolder = function()
|3199|3199| {
|3200|3200| 	if (this.IsGarrisoned())
|3201|    |-	{
|    |3201|+	
|3202|3202| 		for (let order of this.orderQueue)
|3203|3203| 			if (order.type == "Garrison")
|3204|3204| 				return order.data.target;
|3205|    |-	}
|    |3205|+	
|3206|3206| 	return INVALID_ENTITY;
|3207|3207| };
|3208|3208| 
|    | [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
|3276|3276| 		{
|3277|3277| 			let index = this.GetCurrentState().indexOf(".");
|3278|3278| 			if (index != -1)
|3279|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3279|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3280|3280| 			this.Stop(false);
|3281|3281| 		}
|3282|3282| 
|    | [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
|3332|3332| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3333|3333| 			continue;
|3334|3334| 		if (i == 0)
|3335|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3335|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3336|3336| 		else
|3337|3337| 			this.orderQueue.splice(i, 1);
|3338|3338| 		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
|3332|3332| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3333|3333| 			continue;
|3334|3334| 		if (i == 0)
|3335|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3335|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3336|3336| 		else
|3337|3337| 			this.orderQueue.splice(i, 1);
|3338|3338| 		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
|3416|3416| };
|3417|3417| 
|3418|3418| 
|3419|    |-//// FSM linkage functions ////
|    |3419|+// // FSM linkage functions ////
|3420|3420| 
|3421|3421| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3422|3422| 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
|3588|3588| 				continue;
|3589|3589| 			if (this.orderQueue[i].type == type)
|3590|3590| 				continue;
|3591|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3591|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3592|3592| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3593|3593| 			return;
|3594|3594| 		}
|    | [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
|3588|3588| 				continue;
|3589|3589| 			if (this.orderQueue[i].type == type)
|3590|3590| 				continue;
|3591|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3591|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3592|3592| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3593|3593| 			return;
|3594|3594| 		}
|    | [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
|3602|3602| {
|3603|3603| 	// Remember the previous work orders to be able to go back to them later if required
|3604|3604| 	if (data && data.force)
|3605|    |-	{
|    |3605|+	
|3606|3606| 		if (this.IsFormationController())
|3607|3607| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3608|3608| 		else
|3609|3609| 			this.UpdateWorkOrders(type);
|3610|    |-	}
|    |3610|+	
|3611|3611| 
|3612|3612| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3613|3613| 
|    | [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
|3679|3679| 	{
|3680|3680| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3681|3681| 		if (cmpUnitAI)
|3682|    |-		{
|    |3682|+		
|3683|3683| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3684|3684| 			{
|3685|3685| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3688|3688| 					return;
|3689|3689| 				}
|3690|3690| 			}
|3691|    |-		}
|    |3691|+		
|3692|3692| 	}
|3693|3693| 
|3694|3694| 	// 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
|3681|3681| 		if (cmpUnitAI)
|3682|3682| 		{
|3683|3683| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3684|    |-			{
|    |3684|+			
|3685|3685| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3686|3686| 				{
|3687|3687| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3688|3688| 					return;
|3689|3689| 				}
|3690|    |-			}
|    |3690|+			
|3691|3691| 		}
|3692|3692| 	}
|3693|3693| 
|    | [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
|3693|3693| 
|3694|3694| 	// If nothing found, take the unit orders
|3695|3695| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3696|    |-	{
|    |3696|+	
|3697|3697| 		if (isWorkType(this.orderQueue[i].type))
|3698|3698| 		{
|3699|3699| 			this.workOrders = this.orderQueue.slice(i);
|3700|3700| 			return;
|3701|3701| 		}
|3702|    |-	}
|    |3702|+	
|3703|3703| };
|3704|3704| 
|3705|3705| 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
|3759|3759| 	if (data.timerRepeat === undefined)
|3760|3760| 		this.timer = undefined;
|3761|3761| 
|3762|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3762|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3763|3763| };
|3764|3764| 
|3765|3765| /**
|    | [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
|3759|3759| 	if (data.timerRepeat === undefined)
|3760|3760| 		this.timer = undefined;
|3761|3761| 
|3762|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3762|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3763|3763| };
|3764|3764| 
|3765|3765| /**
|    | [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
|3794|3794| 	this.timer = undefined;
|3795|3795| };
|3796|3796| 
|3797|    |-//// Message handlers /////
|    |3797|+// // Message handlers /////
|3798|3798| 
|3799|3799| UnitAI.prototype.OnMotionChanged = function(msg)
|3800|3800| {
|    | [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
|3806|3806| 	// TODO: This is a bit inefficient since every unit listens to every
|3807|3807| 	// construction message - ideally we could scope it to only the one we're building
|3808|3808| 
|3809|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3809|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3810|3810| };
|3811|3811| 
|3812|3812| 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
|3806|3806| 	// TODO: This is a bit inefficient since every unit listens to every
|3807|3807| 	// construction message - ideally we could scope it to only the one we're building
|3808|3808| 
|3809|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3809|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3810|3810| };
|3811|3811| 
|3812|3812| 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
|3831|3831| 
|3832|3832| UnitAI.prototype.OnAttacked = function(msg)
|3833|3833| {
|3834|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3834|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3835|3835| };
|3836|3836| 
|3837|3837| 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
|3831|3831| 
|3832|3832| UnitAI.prototype.OnAttacked = function(msg)
|3833|3833| {
|3834|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3834|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3835|3835| };
|3836|3836| 
|3837|3837| 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
|3836|3836| 
|3837|3837| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3838|3838| {
|3839|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3839|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|3840|3840| };
|3841|3841| 
|3842|3842| 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
|3836|3836| 
|3837|3837| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3838|3838| {
|3839|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3839|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|3840|3840| };
|3841|3841| 
|3842|3842| 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
|3841|3841| 
|3842|3842| UnitAI.prototype.OnHealthChanged = function(msg)
|3843|3843| {
|3844|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3844|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|3845|3845| };
|3846|3846| 
|3847|3847| 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
|3841|3841| 
|3842|3842| UnitAI.prototype.OnHealthChanged = function(msg)
|3843|3843| {
|3844|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3844|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|3845|3845| };
|3846|3846| 
|3847|3847| 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
|3847|3847| UnitAI.prototype.OnRangeUpdate = function(msg)
|3848|3848| {
|3849|3849| 	if (msg.tag == this.losRangeQuery)
|3850|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3850|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|3851|3851| 	else if (msg.tag == this.losHealRangeQuery)
|3852|3852| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3853|3853| };
|    | [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
|3847|3847| UnitAI.prototype.OnRangeUpdate = function(msg)
|3848|3848| {
|3849|3849| 	if (msg.tag == this.losRangeQuery)
|3850|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3850|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|3851|3851| 	else if (msg.tag == this.losHealRangeQuery)
|3852|3852| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3853|3853| };
|    | [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| 	if (msg.tag == this.losRangeQuery)
|3850|3850| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3851|3851| 	else if (msg.tag == this.losHealRangeQuery)
|3852|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3852|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|3853|3853| };
|3854|3854| 
|3855|3855| 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
|3849|3849| 	if (msg.tag == this.losRangeQuery)
|3850|3850| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3851|3851| 	else if (msg.tag == this.losHealRangeQuery)
|3852|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3852|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|3853|3853| };
|3854|3854| 
|3855|3855| 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
|3854|3854| 
|3855|3855| UnitAI.prototype.OnPackFinished = function(msg)
|3856|3856| {
|3857|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3857|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|3858|3858| };
|3859|3859| 
|3860|3860| //// 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
|3854|3854| 
|3855|3855| UnitAI.prototype.OnPackFinished = function(msg)
|3856|3856| {
|3857|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3857|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|3858|3858| };
|3859|3859| 
|3860|3860| //// 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
|3857|3857| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|3858|3858| };
|3859|3859| 
|3860|    |-//// Helper functions to be called by the FSM ////
|    |3860|+// // Helper functions to be called by the FSM ////
|3861|3861| 
|3862|3862| UnitAI.prototype.GetWalkSpeed = function()
|3863|3863| {
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /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
|3959|3959| 	if (!cmpOwnership || cmpOwnership.GetOwner() == INVALID_PLAYER)
|3960|3960| 		return undefined;
|3961|3961| 
|3962|    |-	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position)
|    |3962|+	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
|3963|3963| 	if (!cmpPosition || !cmpPosition.IsInWorld())
|3964|3964| 		return undefined;
|3965|3965| 
|    | [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
|4044|4044| 			PlaySound(name, member);
|4045|4045| 	}
|4046|4046| 	else
|4047|    |-	{
|    |4047|+	
|4048|4048| 		// Otherwise use our own sounds
|4049|4049| 		PlaySound(name, this.entity);
|4050|    |-	}
|    |4050|+	
|4051|4051| };
|4052|4052| 
|4053|4053| /*
|    | [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
|4236|4236| 	else
|4237|4237| 		// return false? Or hope you come close enough?
|4238|4238| 		var parabolicMaxRange = 0;
|4239|    |-		//return false;
|    |4239|+		// return false;
|4240|4240| 
|4241|4241| 	// the parabole changes while walking, take something in the middle
|4242|4242| 	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
|4323|4323| 	if (this.IsFormationMember())
|4324|4324| 	{
|4325|4325| 		var cmpFormationUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|4326|    |-		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation()
|4327|    |-			&& cmpFormationUnitAI.order.data.target == target)
|    |4326|+		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation() &&
|    |4327|+			cmpFormationUnitAI.order.data.target == target)
|4328|4328| 			return true;
|4329|4329| 	}
|4330|4330| 
|    | [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
|4491|4491| UnitAI.prototype.AttackEntityInZone = function(ents)
|4492|4492| {
|4493|4493| 	var target = ents.find(target =>
|4494|    |-		this.CanAttack(target)
|4495|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4494|+		this.CanAttack(target) &&
|    |4495|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4496|4496| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4497|4497| 	);
|4498|4498| 	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
|4492|4492| {
|4493|4493| 	var target = ents.find(target =>
|4494|4494| 		this.CanAttack(target)
|4495|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4496|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4495|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4496|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4497|4497| 	);
|4498|4498| 	if (!target)
|4499|4499| 		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
|4556|4556| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4557|4557| 	if (this.isGuardOf)
|4558|4558| 	{
|4559|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4559|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4560|4560| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4561|4561| 		if (cmpUnitAI && cmpAttack &&
|4562|4562| 		    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
|4560|4560| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4561|4561| 		if (cmpUnitAI && cmpAttack &&
|4562|4562| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4563|    |-				return false;
|    |4563|+			return false;
|4564|4564| 	}
|4565|4565| 
|4566|4566| 	// 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
|4565|4565| 
|4566|4566| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4567|4567| 	if (this.GetStance().respondHoldGround)
|4568|    |-	{
|    |4568|+	
|4569|4569| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4570|4570| 			return true;
|4571|    |-	}
|    |4571|+	
|4572|4572| 
|4573|4573| 	// Stop if it's left our vision range, unless we're especially persistent
|4574|4574| 	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
|4572|4572| 
|4573|4573| 	// Stop if it's left our vision range, unless we're especially persistent
|4574|4574| 	if (!this.GetStance().respondChaseBeyondVision)
|4575|    |-	{
|    |4575|+	
|4576|4576| 		if (!this.CheckTargetIsInVisionRange(target))
|4577|4577| 			return true;
|4578|    |-	}
|    |4578|+	
|4579|4579| 
|4580|4580| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4581|4581| 	// 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
|4598|4598| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4599|4599| 	if (this.isGuardOf)
|4600|4600| 	{
|4601|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4601|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4602|4602| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4603|4603| 		if (cmpUnitAI && cmpAttack &&
|4604|4604| 		    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
|4611|4611| 	return false;
|4612|4612| };
|4613|4613| 
|4614|    |-//// External interface functions ////
|    |4614|+// // External interface functions ////
|4615|4615| 
|4616|4616| UnitAI.prototype.SetFormationController = function(ent)
|4617|4617| {
|    | [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
|4621|4621| 	// of our own formation (or ourself if not in formation)
|4622|4622| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4623|4623| 	if (cmpObstruction)
|4624|    |-	{
|    |4624|+	
|4625|4625| 		if (ent == INVALID_ENTITY)
|4626|4626| 			cmpObstruction.SetControlGroup(this.entity);
|4627|4627| 		else
|4628|4628| 			cmpObstruction.SetControlGroup(ent);
|4629|    |-	}
|    |4629|+	
|4630|4630| 
|4631|4631| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4632|4632| 	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
|4764|4764| 	// if we already had an old guard order, do nothing if the target is the same
|4765|4765| 	// and the order is running, otherwise remove the previous order
|4766|4766| 	if (this.isGuardOf)
|4767|    |-	{
|    |4767|+	
|4768|4768| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4769|4769| 			return;
|4770|4770| 		else
|4771|4771| 			this.RemoveGuard();
|4772|    |-	}
|    |4772|+	
|4773|4773| 
|4774|4774| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4775|4775| };
|    | [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
|4767|4767| 	{
|4768|4768| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4769|4769| 			return;
|4770|    |-		else
|4771|    |-			this.RemoveGuard();
|    |4770|+		this.RemoveGuard();
|4772|4771| 	}
|4773|4772| 
|4774|4773| 	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
|5098|5098| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5099|5099| 	{
|5100|5100| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5101|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5101|+		if (cmpTrader.HasBothMarkets() &&
|5102|5102| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5103|5103| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5104|5104| 		{
|    | [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
|5379|5379| 				{
|5380|5380| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5381|5381| 					var targetClasses = this.order.data.targetClasses;
|5382|    |-					if (targetClasses.attack && cmpIdentity
|5383|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5382|+					if (targetClasses.attack && cmpIdentity &&
|    |5383|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5384|5384| 						continue;
|5385|5385| 					if (targetClasses.avoid && cmpIdentity
|5386|5386| 						&& 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
|5382|5382| 					if (targetClasses.attack && cmpIdentity
|5383|5383| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5384|5384| 						continue;
|5385|    |-					if (targetClasses.avoid && cmpIdentity
|5386|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5385|+					if (targetClasses.avoid && cmpIdentity &&
|    |5386|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5387|5387| 						continue;
|5388|5388| 					// Only used by the AIs to prevent some choices of targets
|5389|5389| 					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
|5405|5405| 		{
|5406|5406| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5407|5407| 			var targetClasses = this.order.data.targetClasses;
|5408|    |-			if (cmpIdentity && targetClasses.attack
|5409|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5408|+			if (cmpIdentity && targetClasses.attack &&
|    |5409|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5410|5410| 				continue;
|5411|5411| 			if (cmpIdentity && targetClasses.avoid
|5412|5412| 				&& 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
|5408|5408| 			if (cmpIdentity && targetClasses.attack
|5409|5409| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5410|5410| 				continue;
|5411|    |-			if (cmpIdentity && targetClasses.avoid
|5412|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5411|+			if (cmpIdentity && targetClasses.avoid &&
|    |5412|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5413|5413| 				continue;
|5414|5414| 			// Only used by the AIs to prevent some choices of targets
|5415|5415| 			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
|5565|5565| 
|5566|5566| UnitAI.prototype.SetHeldPosition = function(x, z)
|5567|5567| {
|5568|    |-	this.heldPosition = {"x": x, "z": z};
|    |5568|+	this.heldPosition = { "x": x, "z": z};
|5569|5569| };
|5570|5570| 
|5571|5571| 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
|5565|5565| 
|5566|5566| UnitAI.prototype.SetHeldPosition = function(x, z)
|5567|5567| {
|5568|    |-	this.heldPosition = {"x": x, "z": z};
|    |5568|+	this.heldPosition = {"x": x, "z": z };
|5569|5569| };
|5570|5570| 
|5571|5571| 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
|5592|5592| 	return false;
|5593|5593| };
|5594|5594| 
|5595|    |-//// Helper functions ////
|    |5595|+// // Helper functions ////
|5596|5596| 
|5597|5597| UnitAI.prototype.CanAttack = function(target)
|5598|5598| {
|    | [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
|5796|5796| 	return cmpPack && cmpPack.IsPacking();
|5797|5797| };
|5798|5798| 
|5799|    |-//// Formation specific functions ////
|    |5799|+// // Formation specific functions ////
|5800|5800| 
|5801|5801| UnitAI.prototype.IsAttackingAsFormation = function()
|5802|5802| {
|    | [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
|5801|5801| UnitAI.prototype.IsAttackingAsFormation = function()
|5802|5802| {
|5803|5803| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5804|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5805|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5804|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5805|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5806|5806| };
|5807|5807| 
|5808|5808| //// 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
|5805|5805| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5806|5806| };
|5807|5807| 
|5808|    |-//// Animal specific functions ////
|    |5808|+// // Animal specific functions ////
|5809|5809| 
|5810|5810| UnitAI.prototype.MoveRandomly = function(distance)
|5811|5811| {

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|1999| »   »   »   »   "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
|2089| »   »   »   »   "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
|2270| »   »   »   »   »   »   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
|2325| »   »   »   »   "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
|2443| »   »   »   »   "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
|2508| »   »   »   »   "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
|2548| »   »   »   »   "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
|2752| »   »   »   »   "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
|2936| »   »   »   »   "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
|3664| »   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
|4478| »   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
|4493| »   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
|4539| »   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
|4562| »   »   ····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
|1958| »   »   »   »   »   »   &&·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
|2265| »   »   »   »   »   var·cmpResourceGatherer·=·Engine.QueryInterface(this.entity,·IID_ResourceGatherer);
|    | [NORMAL] JSHintBear:
|    | 'cmpResourceGatherer' is already defined.

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

binaries/data/mods/public/simulation/components/UnitAI.js
|2284| »   »   »   »   »   »   »   ||·(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
|2285| »   »   »   »   »   »   »   &&·(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
|2305| »   »   »   »   »   var·nearby·=·this.FindNearestDropsite(resourceType.generic);
|    | [NORMAL] JSHintBear:
|    | 'nearby' is already defined.

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

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

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

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

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

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

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|3962| »   let·cmpPosition·=·Engine.QueryInterface(this.entity,·IID_Position)
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

wraitii planned changes to this revision.Mon, Jul 1, 3:31 PM

Need to account for hunting correctly.

binaries/data/mods/public/simulation/components/UnitAI.js
1793 ↗(On Diff #8670)

Shouldn't happen when hunting I think.

wraitii updated this revision to Diff 8676.Mon, Jul 1, 7:23 PM

Fix debug "warn" call, checked that hunting works and it does.

wraitii added inline comments.Mon, Jul 1, 7:24 PM
binaries/data/mods/public/simulation/components/UnitAI.js
1793 ↗(On Diff #8670)

actually harmless since we have finishorder() above.

Vulcan added a comment.Mon, Jul 1, 7:30 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
|1955|1955| 
|1956|1956| 				"Attacked": function(msg) {
|1957|1957| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|1958|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|1959|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |1958|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |1959|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|1960|1960| 						this.RespondToTargetedEntities([msg.data.attacker]);
|1961|1961| 				},
|1962|1962| 			},
|    | [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
|2008|2008| 					this.SelectAnimation("move");
|2009|2009| 					var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|2010|2010| 					if (cmpUnitAI && cmpUnitAI.IsFleeing())
|2011|    |-					{
|    |2011|+					
|2012|2012| 						// Run after a fleeing target
|2013|2013| 						this.SetSpeedMultiplier(this.GetRunMultiplier());
|2014|    |-					}
|    |2014|+					
|2015|2015| 					this.StartTimer(1000, 1000);
|2016|2016| 				},
|2017|2017| 
|    | [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
|2190|2190| 
|2191|2191| 					var cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply);
|2192|2192| 					if (cmpSupply && cmpSupply.IsAvailable(cmpOwnership.GetOwner(), this.entity))
|2193|    |-					{
|    |2193|+					
|2194|2194| 						// Check we can still reach and gather from the target
|2195|2195| 						if (this.CheckTargetRange(this.gatheringTarget, IID_ResourceGatherer) && this.CanGather(this.gatheringTarget))
|2196|2196| 						{
|2253|2253| 								return;
|2254|2254| 							}
|2255|2255| 						}
|2256|    |-					}
|    |2256|+					
|2257|2257| 
|2258|2258| 					// We're already in range, can't get anywhere near it or the target is exhausted.
|2259|2259| 
|    | [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
|2279|2279| 					// Also don't switch to a different type of huntable animal
|2280|2280| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2281|2281| 						return (
|2282|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2283|    |-							|| (type.specific == resourceType.specific
|    |2282|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2283|+							(type.specific == resourceType.specific
|2284|2284| 							&& (type.specific != "meat" || resourceTemplate == template))
|2285|2285| 						);
|2286|2286| 					});
|    | [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
|2280|2280| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2281|2281| 						return (
|2282|2282| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2283|    |-							|| (type.specific == resourceType.specific
|2284|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2283|+							|| (type.specific == resourceType.specific &&
|    |2284|+							(type.specific != "meat" || resourceTemplate == template))
|2285|2285| 						);
|2286|2286| 					});
|2287|2287| 					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
|2345|2345| 
|2346|2346| 				"Timer": function(msg) {
|2347|2347| 					if (this.ShouldAbandonChase(this.order.data.target, this.order.data.force, IID_Heal, null))
|2348|    |-					{
|    |2348|+					
|2349|2349| 						// Return to our original position unless we have a better order.
|2350|2350| 						if (!this.FinishOrder() && this.GetStance().respondHoldGround)
|2351|2351| 							this.WalkToHeldPosition();
|2352|    |-					}
|    |2352|+					
|2353|2353| 				},
|2354|2354| 
|2355|2355| 				"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
|2379|2379| 					this.StartTimer(prepare, this.healTimers.repeat);
|2380|2380| 
|2381|2381| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2382|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2382|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2383|2383| 
|2384|2384| 					this.FaceTowardsTarget(this.order.data.target);
|2385|2385| 				},
|    | [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
|2592|2592| 					{
|2593|2593| 						// The building was already finished/fully repaired before we arrived;
|2594|2594| 						// let the ConstructionFinished handler handle this.
|2595|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2595|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2596|2596| 						return true;
|2597|2597| 					}
|2598|2598| 
|    | [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
|2592|2592| 					{
|2593|2593| 						// The building was already finished/fully repaired before we arrived;
|2594|2594| 						// let the ConstructionFinished handler handle this.
|2595|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2595|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2596|2596| 						return true;
|2597|2597| 					}
|2598|2598| 
|    | [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
|2719|2719| 
|2720|2720| 				// Unit was approaching and there's nothing to do now, so switch to walking
|2721|2721| 				if (oldState === "INDIVIDUAL.REPAIR.APPROACHING")
|2722|    |-				{
|    |2722|+				
|2723|2723| 					// We're already walking to the given point, so add this as a order.
|2724|2724| 					this.WalkToTarget(msg.data.newentity, true);
|2725|    |-				}
|    |2725|+				
|2726|2726| 			},
|2727|2727| 		},
|2728|2728| 
|    | [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
|2782|2782| 
|2783|2783| 					// Check that we can garrison here
|2784|2784| 					if (this.CanGarrison(target))
|2785|    |-					{
|    |2785|+					
|2786|2786| 						// Check that we're in range of the garrison target
|2787|2787| 						if (this.CheckGarrisonRange(target))
|2788|2788| 						{
|2858|2858| 								return false;
|2859|2859| 							}
|2860|2860| 						}
|2861|    |-					}
|    |2861|+					
|2862|2862| 					// Garrisoning failed for some reason, so finish the order
|2863|2863| 					this.FinishOrder();
|2864|2864| 					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
|2980|2980| 		"Attacked": function(msg) {
|2981|2981| 			if (this.template.NaturalBehaviour == "skittish" ||
|2982|2982| 			    this.template.NaturalBehaviour == "passive")
|2983|    |-			{
|    |2983|+			
|2984|2984| 				this.Flee(msg.data.attacker, false);
|2985|    |-			}
|    |2985|+			
|2986|2986| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|2987|2987| 			{
|2988|2988| 				if (this.CanAttack(msg.data.attacker))
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /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
|2989|2989| 					this.Attack(msg.data.attacker, false);
|2990|2990| 			}
|2991|2991| 			else if (this.template.NaturalBehaviour == "domestic")
|2992|    |-			{
|    |2992|+			
|2993|2993| 				// Never flee, stop what we were doing
|2994|2994| 				this.SetNextState("IDLE");
|2995|    |-			}
|    |2995|+			
|2996|2996| 		},
|2997|2997| 
|2998|2998| 		"Order.LeaveFoundation": function(msg) {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /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
|3044|3044| 				}
|3045|3045| 				// Start attacking one of the newly-seen enemy (if any)
|3046|3046| 				else if (this.IsDangerousAnimal())
|3047|    |-				{
|    |3047|+				
|3048|3048| 					this.AttackVisibleEntity(msg.data.added);
|3049|    |-				}
|    |3049|+				
|3050|3050| 
|3051|3051| 				// TODO: if two units enter our range together, we'll attack the
|3052|3052| 				// 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
|3087|3087| 				}
|3088|3088| 				// Start attacking one of the newly-seen enemy (if any)
|3089|3089| 				else if (this.template.NaturalBehaviour == "violent")
|3090|    |-				{
|    |3090|+				
|3091|3091| 					this.AttackVisibleEntity(msg.data.added);
|3092|    |-				}
|    |3092|+				
|3093|3093| 			},
|3094|3094| 
|3095|3095| 			"Timer": function(msg) {
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 7.
|----|    | /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
|3102|3102| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3103|3103| 
|3104|3104| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3105|    |-							// only used for domestic animals
|    |3105|+		// only used for domestic animals
|3106|3106| 	},
|3107|3107| };
|3108|3108| 
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /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
|3159|3159| 
|3160|3160| UnitAI.prototype.IsAnimal = function()
|3161|3161| {
|3162|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3162|+	return (!!this.template.NaturalBehaviour);
|3163|3163| };
|3164|3164| 
|3165|3165| UnitAI.prototype.IsDangerousAnimal = function()
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /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
|3197|3197| UnitAI.prototype.GetGarrisonHolder = function()
|3198|3198| {
|3199|3199| 	if (this.IsGarrisoned())
|3200|    |-	{
|    |3200|+	
|3201|3201| 		for (let order of this.orderQueue)
|3202|3202| 			if (order.type == "Garrison")
|3203|3203| 				return order.data.target;
|3204|    |-	}
|    |3204|+	
|3205|3205| 	return INVALID_ENTITY;
|3206|3206| };
|3207|3207| 
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /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
|3275|3275| 		{
|3276|3276| 			let index = this.GetCurrentState().indexOf(".");
|3277|3277| 			if (index != -1)
|3278|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3278|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3279|3279| 			this.Stop(false);
|3280|3280| 		}
|3281|3281| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /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
|3331|3331| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3332|3332| 			continue;
|3333|3333| 		if (i == 0)
|3334|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3334|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3335|3335| 		else
|3336|3336| 			this.orderQueue.splice(i, 1);
|3337|3337| 		Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /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
|3331|3331| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3332|3332| 			continue;
|3333|3333| 		if (i == 0)
|3334|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3334|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3335|3335| 		else
|3336|3336| 			this.orderQueue.splice(i, 1);
|3337|3337| 		Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /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
|3415|3415| };
|3416|3416| 
|3417|3417| 
|3418|    |-//// FSM linkage functions ////
|    |3418|+// // FSM linkage functions ////
|3419|3419| 
|3420|3420| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3421|3421| UnitAI.prototype.SetNextState = function(state)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /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
|3587|3587| 				continue;
|3588|3588| 			if (this.orderQueue[i].type == type)
|3589|3589| 				continue;
|3590|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3590|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3591|3591| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3592|3592| 			return;
|3593|3593| 		}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /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
|3587|3587| 				continue;
|3588|3588| 			if (this.orderQueue[i].type == type)
|3589|3589| 				continue;
|3590|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3590|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3591|3591| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3592|3592| 			return;
|3593|3593| 		}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /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
|3601|3601| {
|3602|3602| 	// Remember the previous work orders to be able to go back to them later if required
|3603|3603| 	if (data && data.force)
|3604|    |-	{
|    |3604|+	
|3605|3605| 		if (this.IsFormationController())
|3606|3606| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3607|3607| 		else
|3608|3608| 			this.UpdateWorkOrders(type);
|3609|    |-	}
|    |3609|+	
|3610|3610| 
|3611|3611| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3612|3612| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /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
|3678|3678| 	{
|3679|3679| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3680|3680| 		if (cmpUnitAI)
|3681|    |-		{
|    |3681|+		
|3682|3682| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3683|3683| 			{
|3684|3684| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3687|3687| 					return;
|3688|3688| 				}
|3689|3689| 			}
|3690|    |-		}
|    |3690|+		
|3691|3691| 	}
|3692|3692| 
|3693|3693| 	// If nothing found, take the unit orders
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for' condition.
|----|    | /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| 		if (cmpUnitAI)
|3681|3681| 		{
|3682|3682| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3683|    |-			{
|    |3683|+			
|3684|3684| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3685|3685| 				{
|3686|3686| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3687|3687| 					return;
|3688|3688| 				}
|3689|    |-			}
|    |3689|+			
|3690|3690| 		}
|3691|3691| 	}
|3692|3692| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for' condition.
|----|    | /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
|3692|3692| 
|3693|3693| 	// If nothing found, take the unit orders
|3694|3694| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3695|    |-	{
|    |3695|+	
|3696|3696| 		if (isWorkType(this.orderQueue[i].type))
|3697|3697| 		{
|3698|3698| 			this.workOrders = this.orderQueue.slice(i);
|3699|3699| 			return;
|3700|3700| 		}
|3701|    |-	}
|    |3701|+	
|3702|3702| };
|3703|3703| 
|3704|3704| UnitAI.prototype.BackToWork = function()
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /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
|3758|3758| 	if (data.timerRepeat === undefined)
|3759|3759| 		this.timer = undefined;
|3760|3760| 
|3761|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3761|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3762|3762| };
|3763|3763| 
|3764|3764| /**
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /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
|3758|3758| 	if (data.timerRepeat === undefined)
|3759|3759| 		this.timer = undefined;
|3760|3760| 
|3761|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3761|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3762|3762| };
|3763|3763| 
|3764|3764| /**
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /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
|3793|3793| 	this.timer = undefined;
|3794|3794| };
|3795|3795| 
|3796|    |-//// Message handlers /////
|    |3796|+// // Message handlers /////
|3797|3797| 
|3798|3798| UnitAI.prototype.OnMotionChanged = function(msg)
|3799|3799| {
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /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
|3805|3805| 	// TODO: This is a bit inefficient since every unit listens to every
|3806|3806| 	// construction message - ideally we could scope it to only the one we're building
|3807|3807| 
|3808|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3808|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3809|3809| };
|3810|3810| 
|3811|3811| UnitAI.prototype.OnGlobalEntityRenamed = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /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
|3805|3805| 	// TODO: This is a bit inefficient since every unit listens to every
|3806|3806| 	// construction message - ideally we could scope it to only the one we're building
|3807|3807| 
|3808|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3808|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3809|3809| };
|3810|3810| 
|3811|3811| UnitAI.prototype.OnGlobalEntityRenamed = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /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
|3830|3830| 
|3831|3831| UnitAI.prototype.OnAttacked = function(msg)
|3832|3832| {
|3833|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3833|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3834|3834| };
|3835|3835| 
|3836|3836| UnitAI.prototype.OnGuardedAttacked = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /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
|3830|3830| 
|3831|3831| UnitAI.prototype.OnAttacked = function(msg)
|3832|3832| {
|3833|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3833|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3834|3834| };
|3835|3835| 
|3836|3836| UnitAI.prototype.OnGuardedAttacked = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /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
|3835|3835| 
|3836|3836| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3837|3837| {
|3838|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3838|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|3839|3839| };
|3840|3840| 
|3841|3841| UnitAI.prototype.OnHealthChanged = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /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
|3835|3835| 
|3836|3836| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3837|3837| {
|3838|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3838|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|3839|3839| };
|3840|3840| 
|3841|3841| UnitAI.prototype.OnHealthChanged = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /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
|3840|3840| 
|3841|3841| UnitAI.prototype.OnHealthChanged = function(msg)
|3842|3842| {
|3843|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3843|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|3844|3844| };
|3845|3845| 
|3846|3846| UnitAI.prototype.OnRangeUpdate = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /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
|3840|3840| 
|3841|3841| UnitAI.prototype.OnHealthChanged = function(msg)
|3842|3842| {
|3843|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3843|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|3844|3844| };
|3845|3845| 
|3846|3846| UnitAI.prototype.OnRangeUpdate = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /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
|3846|3846| UnitAI.prototype.OnRangeUpdate = function(msg)
|3847|3847| {
|3848|3848| 	if (msg.tag == this.losRangeQuery)
|3849|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3849|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|3850|3850| 	else if (msg.tag == this.losHealRangeQuery)
|3851|3851| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3852|3852| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /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
|3846|3846| UnitAI.prototype.OnRangeUpdate = function(msg)
|3847|3847| {
|3848|3848| 	if (msg.tag == this.losRangeQuery)
|3849|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3849|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|3850|3850| 	else if (msg.tag == this.losHealRangeQuery)
|3851|3851| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3852|3852| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /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| 	if (msg.tag == this.losRangeQuery)
|3849|3849| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3850|3850| 	else if (msg.tag == this.losHealRangeQuery)
|3851|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3851|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|3852|3852| };
|3853|3853| 
|3854|3854| UnitAI.prototype.OnPackFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /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| 	if (msg.tag == this.losRangeQuery)
|3849|3849| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3850|3850| 	else if (msg.tag == this.losHealRangeQuery)
|3851|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3851|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|3852|3852| };
|3853|3853| 
|3854|3854| UnitAI.prototype.OnPackFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /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
|3853|3853| 
|3854|3854| UnitAI.prototype.OnPackFinished = function(msg)
|3855|3855| {
|3856|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3856|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|3857|3857| };
|3858|3858| 
|3859|3859| //// Helper functions to be called by the FSM ////
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /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
|3853|3853| 
|3854|3854| UnitAI.prototype.OnPackFinished = function(msg)
|3855|3855| {
|3856|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3856|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|3857|3857| };
|3858|3858| 
|3859|3859| //// Helper functions to be called by the FSM ////
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /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| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|3857|3857| };
|3858|3858| 
|3859|    |-//// Helper functions to be called by the FSM ////
|    |3859|+// // Helper functions to be called by the FSM ////
|3860|3860| 
|3861|3861| UnitAI.prototype.GetWalkSpeed = function()
|3862|3862| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /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
|4043|4043| 			PlaySound(name, member);
|4044|4044| 	}
|4045|4045| 	else
|4046|    |-	{
|    |4046|+	
|4047|4047| 		// Otherwise use our own sounds
|4048|4048| 		PlaySound(name, this.entity);
|4049|    |-	}
|    |4049|+	
|4050|4050| };
|4051|4051| 
|4052|4052| /*
|    | [NORMAL] ESLintBear (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
|4235|4235| 	else
|4236|4236| 		// return false? Or hope you come close enough?
|4237|4237| 		var parabolicMaxRange = 0;
|4238|    |-		//return false;
|    |4238|+		// return false;
|4239|4239| 
|4240|4240| 	// the parabole changes while walking, take something in the middle
|4241|4241| 	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
|4322|4322| 	if (this.IsFormationMember())
|4323|4323| 	{
|4324|4324| 		var cmpFormationUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|4325|    |-		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation()
|4326|    |-			&& cmpFormationUnitAI.order.data.target == target)
|    |4325|+		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation() &&
|    |4326|+			cmpFormationUnitAI.order.data.target == target)
|4327|4327| 			return true;
|4328|4328| 	}
|4329|4329| 
|    | [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
|4495|4495| UnitAI.prototype.AttackEntityInZone = function(ents)
|4496|4496| {
|4497|4497| 	var target = ents.find(target =>
|4498|    |-		this.CanAttack(target)
|4499|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4498|+		this.CanAttack(target) &&
|    |4499|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4500|4500| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4501|4501| 	);
|4502|4502| 	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
|4496|4496| {
|4497|4497| 	var target = ents.find(target =>
|4498|4498| 		this.CanAttack(target)
|4499|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4500|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4499|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4500|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4501|4501| 	);
|4502|4502| 	if (!target)
|4503|4503| 		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
|4560|4560| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4561|4561| 	if (this.isGuardOf)
|4562|4562| 	{
|4563|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4563|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4564|4564| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4565|4565| 		if (cmpUnitAI && cmpAttack &&
|4566|4566| 		    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
|4564|4564| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4565|4565| 		if (cmpUnitAI && cmpAttack &&
|4566|4566| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4567|    |-				return false;
|    |4567|+			return false;
|4568|4568| 	}
|4569|4569| 
|4570|4570| 	// 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
|4569|4569| 
|4570|4570| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4571|4571| 	if (this.GetStance().respondHoldGround)
|4572|    |-	{
|    |4572|+	
|4573|4573| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4574|4574| 			return true;
|4575|    |-	}
|    |4575|+	
|4576|4576| 
|4577|4577| 	// Stop if it's left our vision range, unless we're especially persistent
|4578|4578| 	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
|4576|4576| 
|4577|4577| 	// Stop if it's left our vision range, unless we're especially persistent
|4578|4578| 	if (!this.GetStance().respondChaseBeyondVision)
|4579|    |-	{
|    |4579|+	
|4580|4580| 		if (!this.CheckTargetIsInVisionRange(target))
|4581|4581| 			return true;
|4582|    |-	}
|    |4582|+	
|4583|4583| 
|4584|4584| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4585|4585| 	// 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
|4602|4602| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4603|4603| 	if (this.isGuardOf)
|4604|4604| 	{
|4605|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4605|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4606|4606| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4607|4607| 		if (cmpUnitAI && cmpAttack &&
|4608|4608| 		    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
|4615|4615| 	return false;
|4616|4616| };
|4617|4617| 
|4618|    |-//// External interface functions ////
|    |4618|+// // External interface functions ////
|4619|4619| 
|4620|4620| UnitAI.prototype.SetFormationController = function(ent)
|4621|4621| {
|    | [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
|4625|4625| 	// of our own formation (or ourself if not in formation)
|4626|4626| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4627|4627| 	if (cmpObstruction)
|4628|    |-	{
|    |4628|+	
|4629|4629| 		if (ent == INVALID_ENTITY)
|4630|4630| 			cmpObstruction.SetControlGroup(this.entity);
|4631|4631| 		else
|4632|4632| 			cmpObstruction.SetControlGroup(ent);
|4633|    |-	}
|    |4633|+	
|4634|4634| 
|4635|4635| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4636|4636| 	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
|4768|4768| 	// if we already had an old guard order, do nothing if the target is the same
|4769|4769| 	// and the order is running, otherwise remove the previous order
|4770|4770| 	if (this.isGuardOf)
|4771|    |-	{
|    |4771|+	
|4772|4772| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4773|4773| 			return;
|4774|4774| 		else
|4775|4775| 			this.RemoveGuard();
|4776|    |-	}
|    |4776|+	
|4777|4777| 
|4778|4778| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4779|4779| };
|    | [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
|4771|4771| 	{
|4772|4772| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4773|4773| 			return;
|4774|    |-		else
|4775|    |-			this.RemoveGuard();
|    |4774|+		this.RemoveGuard();
|4776|4775| 	}
|4777|4776| 
|4778|4777| 	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
|5102|5102| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5103|5103| 	{
|5104|5104| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5105|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5105|+		if (cmpTrader.HasBothMarkets() &&
|5106|5106| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5107|5107| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5108|5108| 		{
|    | [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| 				{
|5384|5384| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5385|5385| 					var targetClasses = this.order.data.targetClasses;
|5386|    |-					if (targetClasses.attack && cmpIdentity
|5387|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5386|+					if (targetClasses.attack && cmpIdentity &&
|    |5387|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5388|5388| 						continue;
|5389|5389| 					if (targetClasses.avoid && cmpIdentity
|5390|5390| 						&& 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
|5386|5386| 					if (targetClasses.attack && cmpIdentity
|5387|5387| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5388|5388| 						continue;
|5389|    |-					if (targetClasses.avoid && cmpIdentity
|5390|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5389|+					if (targetClasses.avoid && cmpIdentity &&
|    |5390|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5391|5391| 						continue;
|5392|5392| 					// Only used by the AIs to prevent some choices of targets
|5393|5393| 					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
|5409|5409| 		{
|5410|5410| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5411|5411| 			var targetClasses = this.order.data.targetClasses;
|5412|    |-			if (cmpIdentity && targetClasses.attack
|5413|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5412|+			if (cmpIdentity && targetClasses.attack &&
|    |5413|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5414|5414| 				continue;
|5415|5415| 			if (cmpIdentity && targetClasses.avoid
|5416|5416| 				&& 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
|5412|5412| 			if (cmpIdentity && targetClasses.attack
|5413|5413| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5414|5414| 				continue;
|5415|    |-			if (cmpIdentity && targetClasses.avoid
|5416|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5415|+			if (cmpIdentity && targetClasses.avoid &&
|    |5416|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5417|5417| 				continue;
|5418|5418| 			// Only used by the AIs to prevent some choices of targets
|5419|5419| 			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
|5569|5569| 
|5570|5570| UnitAI.prototype.SetHeldPosition = function(x, z)
|5571|5571| {
|5572|    |-	this.heldPosition = {"x": x, "z": z};
|    |5572|+	this.heldPosition = { "x": x, "z": z};
|5573|5573| };
|5574|5574| 
|5575|5575| 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
|5569|5569| 
|5570|5570| UnitAI.prototype.SetHeldPosition = function(x, z)
|5571|5571| {
|5572|    |-	this.heldPosition = {"x": x, "z": z};
|    |5572|+	this.heldPosition = {"x": x, "z": z };
|5573|5573| };
|5574|5574| 
|5575|5575| 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
|5596|5596| 	return false;
|5597|5597| };
|5598|5598| 
|5599|    |-//// Helper functions ////
|    |5599|+// // Helper functions ////
|5600|5600| 
|5601|5601| UnitAI.prototype.CanAttack = function(target)
|5602|5602| {
|    | [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
|5800|5800| 	return cmpPack && cmpPack.IsPacking();
|5801|5801| };
|5802|5802| 
|5803|    |-//// Formation specific functions ////
|    |5803|+// // Formation specific functions ////
|5804|5804| 
|5805|5805| UnitAI.prototype.IsAttackingAsFormation = function()
|5806|5806| {
|    | [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
|5805|5805| UnitAI.prototype.IsAttackingAsFormation = function()
|5806|5806| {
|5807|5807| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5808|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5809|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5808|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5809|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5810|5810| };
|5811|5811| 
|5812|5812| //// 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
|5809|5809| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5810|5810| };
|5811|5811| 
|5812|    |-//// Animal specific functions ////
|    |5812|+// // Animal specific functions ////
|5813|5813| 
|5814|5814| UnitAI.prototype.MoveRandomly = function(distance)
|5815|5815| {

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|1998| »   »   »   »   "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
|2088| »   »   »   »   "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
|2269| »   »   »   »   »   »   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
|2324| »   »   »   »   "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
|2442| »   »   »   »   "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
|2507| »   »   »   »   "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
|2547| »   »   »   »   "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
|2751| »   »   »   »   "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
|2935| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|2283| »   »   »   »   »   »   »   ||·(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
|2284| »   »   »   »   »   »   »   &&·(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
|2304| »   »   »   »   »   var·nearby·=·this.FindNearestDropsite(resourceType.generic);
|    | [NORMAL] JSHintBear:
|    | 'nearby' is already defined.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Stan added a subscriber: Stan.Mon, Jul 1, 7:42 PM
Stan added inline comments.
binaries/data/mods/public/simulation/components/UnitAI.js
1793 ↗(On Diff #8670)

Would be nice to use vector2D here at some point.

1778 ↗(On Diff #8676)

Is that intended ?

wraitii added inline comments.Mon, Jul 1, 7:43 PM
binaries/data/mods/public/simulation/components/UnitAI.js
1778 ↗(On Diff #8676)

Yes? Not sure why you would think it's not.

Stan added inline comments.Mon, Jul 1, 7:45 PM
binaries/data/mods/public/simulation/components/UnitAI.js
1778 ↗(On Diff #8676)

Well usually you abort when there is an error no ?

wraitii added inline comments.Mon, Jul 1, 7:52 PM
binaries/data/mods/public/simulation/components/UnitAI.js
1778 ↗(On Diff #8676)

Well the whole point of the diff is to cleverly handle the error.

wraitii updated this revision to Diff 8686.Mon, Jul 1, 9:54 PM

Don't move code that no longer needs to move.

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
|1955|1955| 
|1956|1956| 				"Attacked": function(msg) {
|1957|1957| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|1958|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|1959|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |1958|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |1959|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|1960|1960| 						this.RespondToTargetedEntities([msg.data.attacker]);
|1961|1961| 				},
|1962|1962| 			},
|    | [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
|2008|2008| 					this.SelectAnimation("move");
|2009|2009| 					var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|2010|2010| 					if (cmpUnitAI && cmpUnitAI.IsFleeing())
|2011|    |-					{
|    |2011|+					
|2012|2012| 						// Run after a fleeing target
|2013|2013| 						this.SetSpeedMultiplier(this.GetRunMultiplier());
|2014|    |-					}
|    |2014|+					
|2015|2015| 					this.StartTimer(1000, 1000);
|2016|2016| 				},
|2017|2017| 
|    | [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
|2190|2190| 
|2191|2191| 					var cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply);
|2192|2192| 					if (cmpSupply && cmpSupply.IsAvailable(cmpOwnership.GetOwner(), this.entity))
|2193|    |-					{
|    |2193|+					
|2194|2194| 						// Check we can still reach and gather from the target
|2195|2195| 						if (this.CheckTargetRange(this.gatheringTarget, IID_ResourceGatherer) && this.CanGather(this.gatheringTarget))
|2196|2196| 						{
|2253|2253| 								return;
|2254|2254| 							}
|2255|2255| 						}
|2256|    |-					}
|    |2256|+					
|2257|2257| 
|2258|2258| 					// We're already in range, can't get anywhere near it or the target is exhausted.
|2259|2259| 
|    | [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
|2279|2279| 					// Also don't switch to a different type of huntable animal
|2280|2280| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2281|2281| 						return (
|2282|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2283|    |-							|| (type.specific == resourceType.specific
|    |2282|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2283|+							(type.specific == resourceType.specific
|2284|2284| 							&& (type.specific != "meat" || resourceTemplate == template))
|2285|2285| 						);
|2286|2286| 					});
|    | [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
|2280|2280| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2281|2281| 						return (
|2282|2282| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2283|    |-							|| (type.specific == resourceType.specific
|2284|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2283|+							|| (type.specific == resourceType.specific &&
|    |2284|+							(type.specific != "meat" || resourceTemplate == template))
|2285|2285| 						);
|2286|2286| 					});
|2287|2287| 					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
|2345|2345| 
|2346|2346| 				"Timer": function(msg) {
|2347|2347| 					if (this.ShouldAbandonChase(this.order.data.target, this.order.data.force, IID_Heal, null))
|2348|    |-					{
|    |2348|+					
|2349|2349| 						// Return to our original position unless we have a better order.
|2350|2350| 						if (!this.FinishOrder() && this.GetStance().respondHoldGround)
|2351|2351| 							this.WalkToHeldPosition();
|2352|    |-					}
|    |2352|+					
|2353|2353| 				},
|2354|2354| 
|2355|2355| 				"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
|2379|2379| 					this.StartTimer(prepare, this.healTimers.repeat);
|2380|2380| 
|2381|2381| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2382|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2382|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2383|2383| 
|2384|2384| 					this.FaceTowardsTarget(this.order.data.target);
|2385|2385| 				},
|    | [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
|2591|2591| 					{
|2592|2592| 						// The building was already finished/fully repaired before we arrived;
|2593|2593| 						// let the ConstructionFinished handler handle this.
|2594|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2594|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2595|2595| 						return true;
|2596|2596| 					}
|2597|2597| 
|    | [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
|2591|2591| 					{
|2592|2592| 						// The building was already finished/fully repaired before we arrived;
|2593|2593| 						// let the ConstructionFinished handler handle this.
|2594|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2594|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2595|2595| 						return true;
|2596|2596| 					}
|2597|2597| 
|    | [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
|2718|2718| 
|2719|2719| 				// Unit was approaching and there's nothing to do now, so switch to walking
|2720|2720| 				if (oldState === "INDIVIDUAL.REPAIR.APPROACHING")
|2721|    |-				{
|    |2721|+				
|2722|2722| 					// We're already walking to the given point, so add this as a order.
|2723|2723| 					this.WalkToTarget(msg.data.newentity, true);
|2724|    |-				}
|    |2724|+				
|2725|2725| 			},
|2726|2726| 		},
|2727|2727| 
|    | [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
|2780|2780| 
|2781|2781| 					// Check that we can garrison here
|2782|2782| 					if (this.CanGarrison(target))
|2783|    |-					{
|    |2783|+					
|2784|2784| 						// Check that we're in range of the garrison target
|2785|2785| 						if (this.CheckGarrisonRange(target))
|2786|2786| 						{
|2856|2856| 								return false;
|2857|2857| 							}
|2858|2858| 						}
|2859|    |-					}
|    |2859|+					
|2860|2860| 					// Garrisoning failed for some reason, so finish the order
|2861|2861| 					this.FinishOrder();
|2862|2862| 					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
|2977|2977| 		"Attacked": function(msg) {
|2978|2978| 			if (this.template.NaturalBehaviour == "skittish" ||
|2979|2979| 			    this.template.NaturalBehaviour == "passive")
|2980|    |-			{
|    |2980|+			
|2981|2981| 				this.Flee(msg.data.attacker, false);
|2982|    |-			}
|    |2982|+			
|2983|2983| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|2984|2984| 			{
|2985|2985| 				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
|2986|2986| 					this.Attack(msg.data.attacker, false);
|2987|2987| 			}
|2988|2988| 			else if (this.template.NaturalBehaviour == "domestic")
|2989|    |-			{
|    |2989|+			
|2990|2990| 				// Never flee, stop what we were doing
|2991|2991| 				this.SetNextState("IDLE");
|2992|    |-			}
|    |2992|+			
|2993|2993| 		},
|2994|2994| 
|2995|2995| 		"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
|3041|3041| 				}
|3042|3042| 				// Start attacking one of the newly-seen enemy (if any)
|3043|3043| 				else if (this.IsDangerousAnimal())
|3044|    |-				{
|    |3044|+				
|3045|3045| 					this.AttackVisibleEntity(msg.data.added);
|3046|    |-				}
|    |3046|+				
|3047|3047| 
|3048|3048| 				// TODO: if two units enter our range together, we'll attack the
|3049|3049| 				// 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
|3084|3084| 				}
|3085|3085| 				// Start attacking one of the newly-seen enemy (if any)
|3086|3086| 				else if (this.template.NaturalBehaviour == "violent")
|3087|    |-				{
|    |3087|+				
|3088|3088| 					this.AttackVisibleEntity(msg.data.added);
|3089|    |-				}
|    |3089|+				
|3090|3090| 			},
|3091|3091| 
|3092|3092| 			"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
|3099|3099| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3100|3100| 
|3101|3101| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3102|    |-							// only used for domestic animals
|    |3102|+		// only used for domestic animals
|3103|3103| 	},
|3104|3104| };
|3105|3105| 
|    | [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
|3156|3156| 
|3157|3157| UnitAI.prototype.IsAnimal = function()
|3158|3158| {
|3159|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3159|+	return (!!this.template.NaturalBehaviour);
|3160|3160| };
|3161|3161| 
|3162|3162| 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
|3194|3194| UnitAI.prototype.GetGarrisonHolder = function()
|3195|3195| {
|3196|3196| 	if (this.IsGarrisoned())
|3197|    |-	{
|    |3197|+	
|3198|3198| 		for (let order of this.orderQueue)
|3199|3199| 			if (order.type == "Garrison")
|3200|3200| 				return order.data.target;
|3201|    |-	}
|    |3201|+	
|3202|3202| 	return INVALID_ENTITY;
|3203|3203| };
|3204|3204| 
|    | [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
|3272|3272| 		{
|3273|3273| 			let index = this.GetCurrentState().indexOf(".");
|3274|3274| 			if (index != -1)
|3275|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3275|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3276|3276| 			this.Stop(false);
|3277|3277| 		}
|3278|3278| 
|    | [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
|3328|3328| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3329|3329| 			continue;
|3330|3330| 		if (i == 0)
|3331|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3331|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3332|3332| 		else
|3333|3333| 			this.orderQueue.splice(i, 1);
|3334|3334| 		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
|3328|3328| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3329|3329| 			continue;
|3330|3330| 		if (i == 0)
|3331|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3331|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3332|3332| 		else
|3333|3333| 			this.orderQueue.splice(i, 1);
|3334|3334| 		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
|3412|3412| };
|3413|3413| 
|3414|3414| 
|3415|    |-//// FSM linkage functions ////
|    |3415|+// // FSM linkage functions ////
|3416|3416| 
|3417|3417| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3418|3418| 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
|3584|3584| 				continue;
|3585|3585| 			if (this.orderQueue[i].type == type)
|3586|3586| 				continue;
|3587|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3587|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3588|3588| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3589|3589| 			return;
|3590|3590| 		}
|    | [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
|3584|3584| 				continue;
|3585|3585| 			if (this.orderQueue[i].type == type)
|3586|3586| 				continue;
|3587|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3587|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3588|3588| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3589|3589| 			return;
|3590|3590| 		}
|    | [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
|3598|3598| {
|3599|3599| 	// Remember the previous work orders to be able to go back to them later if required
|3600|3600| 	if (data && data.force)
|3601|    |-	{
|    |3601|+	
|3602|3602| 		if (this.IsFormationController())
|3603|3603| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3604|3604| 		else
|3605|3605| 			this.UpdateWorkOrders(type);
|3606|    |-	}
|    |3606|+	
|3607|3607| 
|3608|3608| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3609|3609| 
|    | [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
|3675|3675| 	{
|3676|3676| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3677|3677| 		if (cmpUnitAI)
|3678|    |-		{
|    |3678|+		
|3679|3679| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3680|3680| 			{
|3681|3681| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3684|3684| 					return;
|3685|3685| 				}
|3686|3686| 			}
|3687|    |-		}
|    |3687|+		
|3688|3688| 	}
|3689|3689| 
|3690|3690| 	// 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
|3677|3677| 		if (cmpUnitAI)
|3678|3678| 		{
|3679|3679| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3680|    |-			{
|    |3680|+			
|3681|3681| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3682|3682| 				{
|3683|3683| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3684|3684| 					return;
|3685|3685| 				}
|3686|    |-			}
|    |3686|+			
|3687|3687| 		}
|3688|3688| 	}
|3689|3689| 
|    | [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
|3689|3689| 
|3690|3690| 	// If nothing found, take the unit orders
|3691|3691| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3692|    |-	{
|    |3692|+	
|3693|3693| 		if (isWorkType(this.orderQueue[i].type))
|3694|3694| 		{
|3695|3695| 			this.workOrders = this.orderQueue.slice(i);
|3696|3696| 			return;
|3697|3697| 		}
|3698|    |-	}
|    |3698|+	
|3699|3699| };
|3700|3700| 
|3701|3701| 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
|3755|3755| 	if (data.timerRepeat === undefined)
|3756|3756| 		this.timer = undefined;
|3757|3757| 
|3758|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3758|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3759|3759| };
|3760|3760| 
|3761|3761| /**
|    | [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
|3755|3755| 	if (data.timerRepeat === undefined)
|3756|3756| 		this.timer = undefined;
|3757|3757| 
|3758|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3758|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3759|3759| };
|3760|3760| 
|3761|3761| /**
|    | [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
|3790|3790| 	this.timer = undefined;
|3791|3791| };
|3792|3792| 
|3793|    |-//// Message handlers /////
|    |3793|+// // Message handlers /////
|3794|3794| 
|3795|3795| UnitAI.prototype.OnMotionChanged = function(msg)
|3796|3796| {
|    | [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
|3802|3802| 	// TODO: This is a bit inefficient since every unit listens to every
|3803|3803| 	// construction message - ideally we could scope it to only the one we're building
|3804|3804| 
|3805|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3805|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3806|3806| };
|3807|3807| 
|3808|3808| 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
|3802|3802| 	// TODO: This is a bit inefficient since every unit listens to every
|3803|3803| 	// construction message - ideally we could scope it to only the one we're building
|3804|3804| 
|3805|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3805|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3806|3806| };
|3807|3807| 
|3808|3808| 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
|3827|3827| 
|3828|3828| UnitAI.prototype.OnAttacked = function(msg)
|3829|3829| {
|3830|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3830|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3831|3831| };
|3832|3832| 
|3833|3833| 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
|3827|3827| 
|3828|3828| UnitAI.prototype.OnAttacked = function(msg)
|3829|3829| {
|3830|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3830|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3831|3831| };
|3832|3832| 
|3833|3833| 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
|3832|3832| 
|3833|3833| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3834|3834| {
|3835|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3835|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|3836|3836| };
|3837|3837| 
|3838|3838| 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
|3832|3832| 
|3833|3833| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3834|3834| {
|3835|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3835|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|3836|3836| };
|3837|3837| 
|3838|3838| 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
|3837|3837| 
|3838|3838| UnitAI.prototype.OnHealthChanged = function(msg)
|3839|3839| {
|3840|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3840|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|3841|3841| };
|3842|3842| 
|3843|3843| 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
|3837|3837| 
|3838|3838| UnitAI.prototype.OnHealthChanged = function(msg)
|3839|3839| {
|3840|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3840|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|3841|3841| };
|3842|3842| 
|3843|3843| 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
|3843|3843| UnitAI.prototype.OnRangeUpdate = function(msg)
|3844|3844| {
|3845|3845| 	if (msg.tag == this.losRangeQuery)
|3846|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3846|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|3847|3847| 	else if (msg.tag == this.losHealRangeQuery)
|3848|3848| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3849|3849| };
|    | [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| UnitAI.prototype.OnRangeUpdate = function(msg)
|3844|3844| {
|3845|3845| 	if (msg.tag == this.losRangeQuery)
|3846|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3846|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|3847|3847| 	else if (msg.tag == this.losHealRangeQuery)
|3848|3848| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3849|3849| };
|    | [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
|3845|3845| 	if (msg.tag == this.losRangeQuery)
|3846|3846| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3847|3847| 	else if (msg.tag == this.losHealRangeQuery)
|3848|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3848|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|3849|3849| };
|3850|3850| 
|3851|3851| 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
|3845|3845| 	if (msg.tag == this.losRangeQuery)
|3846|3846| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3847|3847| 	else if (msg.tag == this.losHealRangeQuery)
|3848|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3848|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|3849|3849| };
|3850|3850| 
|3851|3851| 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
|3850|3850| 
|3851|3851| UnitAI.prototype.OnPackFinished = function(msg)
|3852|3852| {
|3853|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3853|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|3854|3854| };
|3855|3855| 
|3856|3856| //// 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
|3850|3850| 
|3851|3851| UnitAI.prototype.OnPackFinished = function(msg)
|3852|3852| {
|3853|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3853|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|3854|3854| };
|3855|3855| 
|3856|3856| //// 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
|3853|3853| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|3854|3854| };
|3855|3855| 
|3856|    |-//// Helper functions to be called by the FSM ////
|    |3856|+// // Helper functions to be called by the FSM ////
|3857|3857| 
|3858|3858| UnitAI.prototype.GetWalkSpeed = function()
|3859|3859| {
|    | [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
|4040|4040| 			PlaySound(name, member);
|4041|4041| 	}
|4042|4042| 	else
|4043|    |-	{
|    |4043|+	
|4044|4044| 		// Otherwise use our own sounds
|4045|4045| 		PlaySound(name, this.entity);
|4046|    |-	}
|    |4046|+	
|4047|4047| };
|4048|4048| 
|4049|4049| /*
|    | [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
|4232|4232| 	else
|4233|4233| 		// return false? Or hope you come close enough?
|4234|4234| 		var parabolicMaxRange = 0;
|4235|    |-		//return false;
|    |4235|+		// return false;
|4236|4236| 
|4237|4237| 	// the parabole changes while walking, take something in the middle
|4238|4238| 	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
|4319|4319| 	if (this.IsFormationMember())
|4320|4320| 	{
|4321|4321| 		var cmpFormationUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|4322|    |-		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation()
|4323|    |-			&& cmpFormationUnitAI.order.data.target == target)
|    |4322|+		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation() &&
|    |4323|+			cmpFormationUnitAI.order.data.target == target)
|4324|4324| 			return true;
|4325|4325| 	}
|4326|4326| 
|    | [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
|1812| »   »   »   »   "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
|1982| »   »   »   »   »   »   return·true;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'enter' expected no return value.

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

binaries/data/mods/public/simulation/components/UnitAI.js
|1998| »   »   »   »   "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
|2088| »   »   »   »   "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
|2269| »   »   »   »   »   »   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
|2324| »   »   »   »   "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
|2442| »   »   »   »   "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
|2507| »   »   »   »   "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
|2547| »   »   »   »   "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
|2750| »   »   »   »   "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
|2933| »   »   »   »   "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
|3660| »   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
|1959| »   »   »   »   »   »   &&·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
|2264| »   »   »   »   »   var·cmpResourceGatherer·=·Engine.QueryInterface(this.entity,·IID_ResourceGatherer);
|    | [NORMAL] JSHintBear:
|    | 'cmpResourceGatherer' is already defined.

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

binaries/data/mods/public/simulation/components/UnitAI.js
|2283| »   »   »   »   »   »   »   ||·(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
|2284| »   »   »   »   »   »   »   &&·(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
|2304| »   »   »   »   »   var·nearby·=·this.FindNearestDropsite(resourceType.generic);
|    | [NORMAL] JSHintBear:
|    | 'nearby' is already defined.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

This revision was not accepted when it landed; it landed in state Needs Review.Tue, Jul 2, 8:49 AM
This revision was automatically updated to reflect the committed changes.