Page MenuHomeWildfire Games

Flee away from the attacker's position rather than the attacker
AbandonedPublic

Authored by wraitii on Jun 11 2019, 9:49 PM.

Details

Reviewers
None
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Summary

This is a behaviour change to make fleeing less broken [in my opinion]

Currently, units flee away from a target, so if that target moves closer, the unit can keep fleeing infinitely. This can lead to pretty long chases across the map, which is annoying. It also forces chasing units to move at running speed, or they might never catch up the fleeing entity - and this conversely forces us to make fleeing units slower (when running) than most units, or hunting won't be possible.

This diff makes it so that units instead from from the position of the attacker. They won't flee still if the attacker moved closer in the meantime - only if they have a reason to flee again, such as being attacked again.

This also makes it a bit less tricky to commit D1880 - possibly.

Test Plan

Check out fleeing animals

Diff Detail

Repository
rP 0 A.D. Public Repository
Branch
D1970_fleeing
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 7965
Build 12964: Vulcan BuildJenkins
Build 12963: arc lint + arc unit

Event Timeline

wraitii created this revision.Jun 11 2019, 9:49 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
| 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
|1804|1804| 					}
|1805|1805| 					// Check the target is still alive and attackable
|1806|1806| 					if (this.CanAttack(target) && !this.CheckTargetAttackRange(target, this.order.data.attackType))
|1807|    |-					{
|    |1807|+					
|1808|1808| 						// Can't reach it - try to chase after it
|1809|1809| 						if (this.ShouldChaseTargetedEntity(target, this.order.data.force))
|1810|1810| 						{
|1819|1819| 								return true;
|1820|1820| 							}
|1821|1821| 						}
|1822|    |-					}
|    |1822|+					
|1823|1823| 
|1824|1824| 					this.StopMoving();
|1825|1825| 
|    | [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
|1852|1852| 					// TODO: we should probably only bother syncing projectile attacks, not melee
|1853|1853| 
|1854|1854| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|1855|    |-					this.resyncAnimation = (prepare != this.attackTimers.prepare) ? true : false;
|    |1855|+					this.resyncAnimation = (prepare != this.attackTimers.prepare);
|1856|1856| 
|1857|1857| 					this.FaceTowardsTarget(this.order.data.target);
|1858|1858| 
|    | [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
|1981|1981| 
|1982|1982| 				"Attacked": function(msg) {
|1983|1983| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|1984|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|1985|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |1984|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |1985|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|1986|1986| 						this.RespondToTargetedEntities([msg.data.attacker]);
|1987|1987| 				},
|1988|1988| 			},
|    | [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
|2001|2001| 					this.SelectAnimation("move");
|2002|2002| 					var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|2003|2003| 					if (cmpUnitAI && cmpUnitAI.IsFleeing())
|2004|    |-					{
|    |2004|+					
|2005|2005| 						// Run after a fleeing target
|2006|2006| 						this.SetSpeedMultiplier(this.GetRunMultiplier());
|2007|    |-					}
|    |2007|+					
|2008|2008| 					this.StartTimer(1000, 1000);
|2009|2009| 				},
|2010|2010| 
|    | [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
|2183|2183| 
|2184|2184| 					var cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply);
|2185|2185| 					if (cmpSupply && cmpSupply.IsAvailable(cmpOwnership.GetOwner(), this.entity))
|2186|    |-					{
|    |2186|+					
|2187|2187| 						// Check we can still reach and gather from the target
|2188|2188| 						if (this.CheckTargetRange(this.gatheringTarget, IID_ResourceGatherer) && this.CanGather(this.gatheringTarget))
|2189|2189| 						{
|2248|2248| 								return;
|2249|2249| 							}
|2250|2250| 						}
|2251|    |-					}
|    |2251|+					
|2252|2252| 
|2253|2253| 					// We're already in range, can't get anywhere near it or the target is exhausted.
|2254|2254| 
|    | [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
|2274|2274| 					// Also don't switch to a different type of huntable animal
|2275|2275| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2276|2276| 						return (
|2277|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2278|    |-							|| (type.specific == resourceType.specific
|    |2277|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2278|+							(type.specific == resourceType.specific
|2279|2279| 							&& (type.specific != "meat" || resourceTemplate == template))
|2280|2280| 						);
|2281|2281| 					});
|    | [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
|2275|2275| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2276|2276| 						return (
|2277|2277| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2278|    |-							|| (type.specific == resourceType.specific
|2279|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2278|+							|| (type.specific == resourceType.specific &&
|    |2279|+							(type.specific != "meat" || resourceTemplate == template))
|2280|2280| 						);
|2281|2281| 					});
|2282|2282| 					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
|2340|2340| 
|2341|2341| 				"Timer": function(msg) {
|2342|2342| 					if (this.ShouldAbandonChase(this.order.data.target, this.order.data.force, IID_Heal, null))
|2343|    |-					{
|    |2343|+					
|2344|2344| 						// Return to our original position unless we have a better order.
|2345|2345| 						if (!this.FinishOrder() && this.GetStance().respondHoldGround)
|2346|2346| 							this.WalkToHeldPosition();
|2347|    |-					}
|    |2347|+					
|2348|2348| 				},
|2349|2349| 
|2350|2350| 				"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
|2374|2374| 					this.StartTimer(prepare, this.healTimers.repeat);
|2375|2375| 
|2376|2376| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2377|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2377|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2378|2378| 
|2379|2379| 					this.FaceTowardsTarget(this.order.data.target);
|2380|2380| 				},
|    | [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
|2590|2590| 					{
|2591|2591| 						// The building was already finished/fully repaired before we arrived;
|2592|2592| 						// let the ConstructionFinished handler handle this.
|2593|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2593|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2594|2594| 						return true;
|2595|2595| 					}
|2596|2596| 
|    | [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
|2590|2590| 					{
|2591|2591| 						// The building was already finished/fully repaired before we arrived;
|2592|2592| 						// let the ConstructionFinished handler handle this.
|2593|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2593|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2594|2594| 						return true;
|2595|2595| 					}
|2596|2596| 
|    | [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
|2633|2633| 					if (!inRange && this.MoveToTargetRange(this.repairTarget, IID_Builder))
|2634|2634| 						this.SetNextState("APPROACHING");
|2635|2635| 					else if (!inRange)
|2636|    |-						this.FinishOrder(); //can't approach and isn't in reach
|    |2636|+						this.FinishOrder(); // can't approach and isn't in reach
|2637|2637| 				},
|2638|2638| 			},
|2639|2639| 
|    | [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 (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
|3004|3004| 				this.FinishOrder();
|3005|3005| 				return;
|3006|3006| 			}
|3007|    |-			else
|3008|    |-			{
|    |3007|+			
|3009|3008| 				this.order.data.min = range;
|3010|3009| 				this.SetNextState("WALKING");
|3011|    |-			}
|    |3010|+			
|3012|3011| 		},
|3013|3012| 
|3014|3013| 		"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
|3048|3048| 				}
|3049|3049| 				// Start attacking one of the newly-seen enemy (if any)
|3050|3050| 				else if (this.IsDangerousAnimal())
|3051|    |-				{
|    |3051|+				
|3052|3052| 					this.AttackVisibleEntity(msg.data.added);
|3053|    |-				}
|    |3053|+				
|3054|3054| 
|3055|3055| 				// TODO: if two units enter our range together, we'll attack the
|3056|3056| 				// 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
|3091|3091| 				}
|3092|3092| 				// Start attacking one of the newly-seen enemy (if any)
|3093|3093| 				else if (this.template.NaturalBehaviour == "violent")
|3094|    |-				{
|    |3094|+				
|3095|3095| 					this.AttackVisibleEntity(msg.data.added);
|3096|    |-				}
|    |3096|+				
|3097|3097| 			},
|3098|3098| 
|3099|3099| 			"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
|3106|3106| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3107|3107| 
|3108|3108| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3109|    |-							// only used for domestic animals
|    |3109|+		// only used for domestic animals
|3110|3110| 	},
|3111|3111| };
|3112|3112| 
|    | [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
|3163|3163| 
|3164|3164| UnitAI.prototype.IsAnimal = function()
|3165|3165| {
|3166|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3166|+	return (!!this.template.NaturalBehaviour);
|3167|3167| };
|3168|3168| 
|3169|3169| 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
|3201|3201| UnitAI.prototype.GetGarrisonHolder = function()
|3202|3202| {
|3203|3203| 	if (this.IsGarrisoned())
|3204|    |-	{
|    |3204|+	
|3205|3205| 		for (let order of this.orderQueue)
|3206|3206| 			if (order.type == "Garrison")
|3207|3207| 				return order.data.target;
|3208|    |-	}
|    |3208|+	
|3209|3209| 	return INVALID_ENTITY;
|3210|3210| };
|3211|3211| 
|    | [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
|3279|3279| 		{
|3280|3280| 			let index = this.GetCurrentState().indexOf(".");
|3281|3281| 			if (index != -1)
|3282|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3282|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3283|3283| 			this.Stop(false);
|3284|3284| 		}
|3285|3285| 
|    | [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
|3335|3335| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3336|3336| 			continue;
|3337|3337| 		if (i == 0)
|3338|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3338|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3339|3339| 		else
|3340|3340| 			this.orderQueue.splice(i, 1);
|3341|3341| 		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
|3335|3335| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3336|3336| 			continue;
|3337|3337| 		if (i == 0)
|3338|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3338|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3339|3339| 		else
|3340|3340| 			this.orderQueue.splice(i, 1);
|3341|3341| 		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
|3419|3419| };
|3420|3420| 
|3421|3421| 
|3422|    |-//// FSM linkage functions ////
|    |3422|+// // FSM linkage functions ////
|3423|3423| 
|3424|3424| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3425|3425| 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
|3591|3591| 				continue;
|3592|3592| 			if (this.orderQueue[i].type == type)
|3593|3593| 				continue;
|3594|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3594|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3595|3595| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3596|3596| 			return;
|3597|3597| 		}
|    | [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
|3591|3591| 				continue;
|3592|3592| 			if (this.orderQueue[i].type == type)
|3593|3593| 				continue;
|3594|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3594|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3595|3595| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3596|3596| 			return;
|3597|3597| 		}
|    | [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
|3605|3605| {
|3606|3606| 	// Remember the previous work orders to be able to go back to them later if required
|3607|3607| 	if (data && data.force)
|3608|    |-	{
|    |3608|+	
|3609|3609| 		if (this.IsFormationController())
|3610|3610| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3611|3611| 		else
|3612|3612| 			this.UpdateWorkOrders(type);
|3613|    |-	}
|    |3613|+	
|3614|3614| 
|3615|3615| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3616|3616| 
|    | [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
|3682|3682| 	{
|3683|3683| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3684|3684| 		if (cmpUnitAI)
|3685|    |-		{
|    |3685|+		
|3686|3686| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3687|3687| 			{
|3688|3688| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3691|3691| 					return;
|3692|3692| 				}
|3693|3693| 			}
|3694|    |-		}
|    |3694|+		
|3695|3695| 	}
|3696|3696| 
|3697|3697| 	// 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
|3684|3684| 		if (cmpUnitAI)
|3685|3685| 		{
|3686|3686| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3687|    |-			{
|    |3687|+			
|3688|3688| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3689|3689| 				{
|3690|3690| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3691|3691| 					return;
|3692|3692| 				}
|3693|    |-			}
|    |3693|+			
|3694|3694| 		}
|3695|3695| 	}
|3696|3696| 
|    | [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
|3696|3696| 
|3697|3697| 	// If nothing found, take the unit orders
|3698|3698| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3699|    |-	{
|    |3699|+	
|3700|3700| 		if (isWorkType(this.orderQueue[i].type))
|3701|3701| 		{
|3702|3702| 			this.workOrders = this.orderQueue.slice(i);
|3703|3703| 			return;
|3704|3704| 		}
|3705|    |-	}
|    |3705|+	
|3706|3706| };
|3707|3707| 
|3708|3708| 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
|3762|3762| 	if (data.timerRepeat === undefined)
|3763|3763| 		this.timer = undefined;
|3764|3764| 
|3765|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3765|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3766|3766| };
|3767|3767| 
|3768|3768| /**
|    | [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
|3762|3762| 	if (data.timerRepeat === undefined)
|3763|3763| 		this.timer = undefined;
|3764|3764| 
|3765|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3765|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3766|3766| };
|3767|3767| 
|3768|3768| /**
|    | [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
|3797|3797| 	this.timer = undefined;
|3798|3798| };
|3799|3799| 
|3800|    |-//// Message handlers /////
|    |3800|+// // Message handlers /////
|3801|3801| 
|3802|3802| UnitAI.prototype.OnMotionChanged = function(msg)
|3803|3803| {
|    | [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
|3809|3809| 	// TODO: This is a bit inefficient since every unit listens to every
|3810|3810| 	// construction message - ideally we could scope it to only the one we're building
|3811|3811| 
|3812|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3812|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3813|3813| };
|3814|3814| 
|3815|3815| 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
|3809|3809| 	// TODO: This is a bit inefficient since every unit listens to every
|3810|3810| 	// construction message - ideally we could scope it to only the one we're building
|3811|3811| 
|3812|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3812|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3813|3813| };
|3814|3814| 
|3815|3815| 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
|3834|3834| 
|3835|3835| UnitAI.prototype.OnAttacked = function(msg)
|3836|3836| {
|3837|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3837|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3838|3838| };
|3839|3839| 
|3840|3840| 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
|3834|3834| 
|3835|3835| UnitAI.prototype.OnAttacked = function(msg)
|3836|3836| {
|3837|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3837|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3838|3838| };
|3839|3839| 
|3840|3840| 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
|3839|3839| 
|3840|3840| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3841|3841| {
|3842|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3842|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|3843|3843| };
|3844|3844| 
|3845|3845| 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
|3839|3839| 
|3840|3840| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3841|3841| {
|3842|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3842|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|3843|3843| };
|3844|3844| 
|3845|3845| 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
|3844|3844| 
|3845|3845| UnitAI.prototype.OnHealthChanged = function(msg)
|3846|3846| {
|3847|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3847|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|3848|3848| };
|3849|3849| 
|3850|3850| 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
|3844|3844| 
|3845|3845| UnitAI.prototype.OnHealthChanged = function(msg)
|3846|3846| {
|3847|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3847|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|3848|3848| };
|3849|3849| 
|3850|3850| 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
|3850|3850| UnitAI.prototype.OnRangeUpdate = function(msg)
|3851|3851| {
|3852|3852| 	if (msg.tag == this.losRangeQuery)
|3853|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3853|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|3854|3854| 	else if (msg.tag == this.losHealRangeQuery)
|3855|3855| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3856|3856| };
|    | [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| UnitAI.prototype.OnRangeUpdate = function(msg)
|3851|3851| {
|3852|3852| 	if (msg.tag == this.losRangeQuery)
|3853|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3853|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|3854|3854| 	else if (msg.tag == this.losHealRangeQuery)
|3855|3855| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3856|3856| };
|    | [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
|3852|3852| 	if (msg.tag == this.losRangeQuery)
|3853|3853| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3854|3854| 	else if (msg.tag == this.losHealRangeQuery)
|3855|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3855|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|3856|3856| };
|3857|3857| 
|3858|3858| 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
|3852|3852| 	if (msg.tag == this.losRangeQuery)
|3853|3853| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3854|3854| 	else if (msg.tag == this.losHealRangeQuery)
|3855|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3855|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|3856|3856| };
|3857|3857| 
|3858|3858| 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
|3857|3857| 
|3858|3858| UnitAI.prototype.OnPackFinished = function(msg)
|3859|3859| {
|3860|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3860|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|3861|3861| };
|3862|3862| 
|3863|3863| //// 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
|3857|3857| 
|3858|3858| UnitAI.prototype.OnPackFinished = function(msg)
|3859|3859| {
|3860|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3860|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|3861|3861| };
|3862|3862| 
|3863|3863| //// 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
|3860|3860| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|3861|3861| };
|3862|3862| 
|3863|    |-//// Helper functions to be called by the FSM ////
|    |3863|+// // Helper functions to be called by the FSM ////
|3864|3864| 
|3865|3865| UnitAI.prototype.GetWalkSpeed = function()
|3866|3866| {
|    | [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
|3962|3962| 	if (!cmpOwnership || cmpOwnership.GetOwner() == INVALID_PLAYER)
|3963|3963| 		return undefined;
|3964|3964| 
|3965|    |-	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position)
|    |3965|+	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
|3966|3966| 	if (!cmpPosition || !cmpPosition.IsInWorld())
|3967|3967| 		return undefined;
|3968|3968| 
|    | [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
|4047|4047| 			PlaySound(name, member);
|4048|4048| 	}
|4049|4049| 	else
|4050|    |-	{
|    |4050|+	
|4051|4051| 		// Otherwise use our own sounds
|4052|4052| 		PlaySound(name, this.entity);
|4053|    |-	}
|    |4053|+	
|4054|4054| };
|4055|4055| 
|4056|4056| /*
|    | [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
|4239|4239| 	else
|4240|4240| 		// return false? Or hope you come close enough?
|4241|4241| 		var parabolicMaxRange = 0;
|4242|    |-		//return false;
|    |4242|+		// return false;
|4243|4243| 
|4244|4244| 	// the parabole changes while walking, take something in the middle
|4245|4245| 	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
|4326|4326| 	if (this.IsFormationMember())
|4327|4327| 	{
|4328|4328| 		var cmpFormationUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|4329|    |-		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation()
|4330|    |-			&& cmpFormationUnitAI.order.data.target == target)
|    |4329|+		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation() &&
|    |4330|+			cmpFormationUnitAI.order.data.target == target)
|4331|4331| 			return true;
|4332|4332| 	}
|4333|4333| 
|    | [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
|4494|4494| UnitAI.prototype.AttackEntityInZone = function(ents)
|4495|4495| {
|4496|4496| 	var target = ents.find(target =>
|4497|    |-		this.CanAttack(target)
|4498|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4497|+		this.CanAttack(target) &&
|    |4498|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4499|4499| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4500|4500| 	);
|4501|4501| 	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
|4495|4495| {
|4496|4496| 	var target = ents.find(target =>
|4497|4497| 		this.CanAttack(target)
|4498|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4499|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4498|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4499|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4500|4500| 	);
|4501|4501| 	if (!target)
|4502|4502| 		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
|4559|4559| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4560|4560| 	if (this.isGuardOf)
|4561|4561| 	{
|4562|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4562|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4563|4563| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4564|4564| 		if (cmpUnitAI && cmpAttack &&
|4565|4565| 		    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
|4563|4563| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4564|4564| 		if (cmpUnitAI && cmpAttack &&
|4565|4565| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4566|    |-				return false;
|    |4566|+			return false;
|4567|4567| 	}
|4568|4568| 
|4569|4569| 	// 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
|4568|4568| 
|4569|4569| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4570|4570| 	if (this.GetStance().respondHoldGround)
|4571|    |-	{
|    |4571|+	
|4572|4572| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4573|4573| 			return true;
|4574|    |-	}
|    |4574|+	
|4575|4575| 
|4576|4576| 	// Stop if it's left our vision range, unless we're especially persistent
|4577|4577| 	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
|4575|4575| 
|4576|4576| 	// Stop if it's left our vision range, unless we're especially persistent
|4577|4577| 	if (!this.GetStance().respondChaseBeyondVision)
|4578|    |-	{
|    |4578|+	
|4579|4579| 		if (!this.CheckTargetIsInVisionRange(target))
|4580|4580| 			return true;
|4581|    |-	}
|    |4581|+	
|4582|4582| 
|4583|4583| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4584|4584| 	// 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
|4601|4601| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4602|4602| 	if (this.isGuardOf)
|4603|4603| 	{
|4604|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4604|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4605|4605| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4606|4606| 		if (cmpUnitAI && cmpAttack &&
|4607|4607| 		    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
|4614|4614| 	return false;
|4615|4615| };
|4616|4616| 
|4617|    |-//// External interface functions ////
|    |4617|+// // External interface functions ////
|4618|4618| 
|4619|4619| UnitAI.prototype.SetFormationController = function(ent)
|4620|4620| {
|    | [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
|4624|4624| 	// of our own formation (or ourself if not in formation)
|4625|4625| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4626|4626| 	if (cmpObstruction)
|4627|    |-	{
|    |4627|+	
|4628|4628| 		if (ent == INVALID_ENTITY)
|4629|4629| 			cmpObstruction.SetControlGroup(this.entity);
|4630|4630| 		else
|4631|4631| 			cmpObstruction.SetControlGroup(ent);
|4632|    |-	}
|    |4632|+	
|4633|4633| 
|4634|4634| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4635|4635| 	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
|4767|4767| 	// if we already had an old guard order, do nothing if the target is the same
|4768|4768| 	// and the order is running, otherwise remove the previous order
|4769|4769| 	if (this.isGuardOf)
|4770|    |-	{
|    |4770|+	
|4771|4771| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4772|4772| 			return;
|4773|4773| 		else
|4774|4774| 			this.RemoveGuard();
|4775|    |-	}
|    |4775|+	
|4776|4776| 
|4777|4777| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4778|4778| };
|    | [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
|4770|4770| 	{
|4771|4771| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4772|4772| 			return;
|4773|    |-		else
|4774|    |-			this.RemoveGuard();
|    |4773|+		this.RemoveGuard();
|4775|4774| 	}
|4776|4775| 
|4777|4776| 	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
|4941|4941| 			this.WalkToTarget(target, queued);
|4942|4942| 		return;
|4943|4943| 	}
|4944|    |-	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture}, queued);
|    |4944|+	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture }, queued);
|4945|4945| };
|4946|4946| 
|4947|4947| /**
|    | [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
|5090|5090| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5091|5091| 	{
|5092|5092| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5093|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5093|+		if (cmpTrader.HasBothMarkets() &&
|5094|5094| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5095|5095| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5096|5096| 		{
|    | [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| 				{
|5372|5372| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5373|5373| 					var targetClasses = this.order.data.targetClasses;
|5374|    |-					if (targetClasses.attack && cmpIdentity
|5375|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5374|+					if (targetClasses.attack && cmpIdentity &&
|    |5375|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5376|5376| 						continue;
|5377|5377| 					if (targetClasses.avoid && cmpIdentity
|5378|5378| 						&& 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
|5374|5374| 					if (targetClasses.attack && cmpIdentity
|5375|5375| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5376|5376| 						continue;
|5377|    |-					if (targetClasses.avoid && cmpIdentity
|5378|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5377|+					if (targetClasses.avoid && cmpIdentity &&
|    |5378|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5379|5379| 						continue;
|5380|5380| 					// Only used by the AIs to prevent some choices of targets
|5381|5381| 					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
|5397|5397| 		{
|5398|5398| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5399|5399| 			var targetClasses = this.order.data.targetClasses;
|5400|    |-			if (cmpIdentity && targetClasses.attack
|5401|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5400|+			if (cmpIdentity && targetClasses.attack &&
|    |5401|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5402|5402| 				continue;
|5403|5403| 			if (cmpIdentity && targetClasses.avoid
|5404|5404| 				&& 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
|5400|5400| 			if (cmpIdentity && targetClasses.attack
|5401|5401| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5402|5402| 				continue;
|5403|    |-			if (cmpIdentity && targetClasses.avoid
|5404|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5403|+			if (cmpIdentity && targetClasses.avoid &&
|    |5404|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5405|5405| 				continue;
|5406|5406| 			// Only used by the AIs to prevent some choices of targets
|5407|5407| 			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
|5543|5543| 
|5544|5544| UnitAI.prototype.SetHeldPosition = function(x, z)
|5545|5545| {
|5546|    |-	this.heldPosition = {"x": x, "z": z};
|    |5546|+	this.heldPosition = { "x": x, "z": z};
|5547|5547| };
|5548|5548| 
|5549|5549| 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
|5543|5543| 
|5544|5544| UnitAI.prototype.SetHeldPosition = function(x, z)
|5545|5545| {
|5546|    |-	this.heldPosition = {"x": x, "z": z};
|    |5546|+	this.heldPosition = {"x": x, "z": z };
|5547|5547| };
|5548|5548| 
|5549|5549| 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
|5570|5570| 	return false;
|5571|5571| };
|5572|5572| 
|5573|    |-//// Helper functions ////
|    |5573|+// // Helper functions ////
|5574|5574| 
|5575|5575| UnitAI.prototype.CanAttack = function(target)
|5576|5576| {
|    | [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
|5774|5774| 	return cmpPack && cmpPack.IsPacking();
|5775|5775| };
|5776|5776| 
|5777|    |-//// Formation specific functions ////
|    |5777|+// // Formation specific functions ////
|5778|5778| 
|5779|5779| UnitAI.prototype.IsAttackingAsFormation = function()
|5780|5780| {
|    | [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
|5779|5779| UnitAI.prototype.IsAttackingAsFormation = function()
|5780|5780| {
|5781|5781| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5782|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5783|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5782|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5783|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5784|5784| };
|5785|5785| 
|5786|5786| //// 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
|5783|5783| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5784|5784| };
|5785|5785| 
|5786|    |-//// Animal specific functions ////
|    |5786|+// // Animal specific functions ////
|5787|5787| 
|5788|5788| UnitAI.prototype.MoveRandomly = function(distance)
|5789|5789| {

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|2264| »   »   »   »   »   »   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
|2319| »   »   »   »   "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
|2437| »   »   »   »   "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
|2502| »   »   »   »   "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
|2542| »   »   »   »   "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
|3667| »   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
|4481| »   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
|4496| »   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
|4542| »   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
|4565| »   »   ····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
|5021| »   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
|1844| »   »   »   »   »   »   var·cmpFormation·=·Engine.QueryInterface(this.formationController,·IID_Formation);
|    | [NORMAL] JSHintBear:
|    | 'cmpFormation' is already defined.

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|2479| »   »   »   »   »   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
|3629| »   »   var·order·=·{·"type":·type,·"data":·data·};
|    | [NORMAL] JSHintBear:
|    | 'order' is already defined.

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4252| »   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
|4330| »   »   »   &&·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
|4498| »   »   &&·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
|4499| »   »   &&·(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
|5021| »   var·lastPos·=·undefined;
|    | [NORMAL] JSHintBear:
|    | It's not necessary to initialize 'lastPos' to 'undefined'.

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

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

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

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

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

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

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

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

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

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

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

wraitii updated this revision to Diff 8505.Jun 16 2019, 10:37 AM
wraitii edited the summary of this revision. (Show Details)

Also make chasing units not run, since that is no longer needed.

We could/should make units flee farther if we go with this diff.

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
|1804|1804| 					}
|1805|1805| 					// Check the target is still alive and attackable
|1806|1806| 					if (this.CanAttack(target) && !this.CheckTargetAttackRange(target, this.order.data.attackType))
|1807|    |-					{
|    |1807|+					
|1808|1808| 						// Can't reach it - try to chase after it
|1809|1809| 						if (this.ShouldChaseTargetedEntity(target, this.order.data.force))
|1810|1810| 						{
|1817|1817| 							this.SetNextState("COMBAT.CHASING");
|1818|1818| 							return true;
|1819|1819| 						}
|1820|    |-					}
|    |1820|+					
|1821|1821| 
|1822|1822| 					this.StopMoving();
|1823|1823| 
|    | [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
|1850|1850| 					// TODO: we should probably only bother syncing projectile attacks, not melee
|1851|1851| 
|1852|1852| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|1853|    |-					this.resyncAnimation = (prepare != this.attackTimers.prepare) ? true : false;
|    |1853|+					this.resyncAnimation = (prepare != this.attackTimers.prepare);
|1854|1854| 
|1855|1855| 					this.FaceTowardsTarget(this.order.data.target);
|1856|1856| 
|    | [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
|1976|1976| 
|1977|1977| 				"Attacked": function(msg) {
|1978|1978| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|1979|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|1980|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |1979|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |1980|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|1981|1981| 						this.RespondToTargetedEntities([msg.data.attacker]);
|1982|1982| 				},
|1983|1983| 			},
|    | [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
|2170|2170| 
|2171|2171| 					var cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply);
|2172|2172| 					if (cmpSupply && cmpSupply.IsAvailable(cmpOwnership.GetOwner(), this.entity))
|2173|    |-					{
|    |2173|+					
|2174|2174| 						// Check we can still reach and gather from the target
|2175|2175| 						if (this.CheckTargetRange(this.gatheringTarget, IID_ResourceGatherer) && this.CanGather(this.gatheringTarget))
|2176|2176| 						{
|2221|2221| 								return;
|2222|2222| 							}
|2223|2223| 						}
|2224|    |-					}
|    |2224|+					
|2225|2225| 
|2226|2226| 					// We're already in range, can't get anywhere near it or the target is exhausted.
|2227|2227| 
|    | [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
|2213|2213| 								return;
|2214|2214| 						}
|2215|2215| 						else
|2216|    |-						{
|    |2216|+						
|2217|2217| 							// Try to follow the target
|2218|2218| 							if (this.MoveToTargetRange(this.gatheringTarget, IID_ResourceGatherer))
|2219|2219| 							{
|2220|2220| 								this.SetNextState("APPROACHING");
|2221|2221| 								return;
|2222|2222| 							}
|2223|    |-						}
|    |2223|+						
|2224|2224| 					}
|2225|2225| 
|2226|2226| 					// 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
|2247|2247| 					// Also don't switch to a different type of huntable animal
|2248|2248| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2249|2249| 						return (
|2250|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2251|    |-							|| (type.specific == resourceType.specific
|    |2250|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2251|+							(type.specific == resourceType.specific
|2252|2252| 							&& (type.specific != "meat" || resourceTemplate == template))
|2253|2253| 						);
|2254|2254| 					});
|    | [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
|2248|2248| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2249|2249| 						return (
|2250|2250| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2251|    |-							|| (type.specific == resourceType.specific
|2252|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2251|+							|| (type.specific == resourceType.specific &&
|    |2252|+							(type.specific != "meat" || resourceTemplate == template))
|2253|2253| 						);
|2254|2254| 					});
|2255|2255| 					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
|2313|2313| 
|2314|2314| 				"Timer": function(msg) {
|2315|2315| 					if (this.ShouldAbandonChase(this.order.data.target, this.order.data.force, IID_Heal, null))
|2316|    |-					{
|    |2316|+					
|2317|2317| 						// Return to our original position unless we have a better order.
|2318|2318| 						if (!this.FinishOrder() && this.GetStance().respondHoldGround)
|2319|2319| 							this.WalkToHeldPosition();
|2320|    |-					}
|    |2320|+					
|2321|2321| 				},
|2322|2322| 
|2323|2323| 				"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
|2347|2347| 					this.StartTimer(prepare, this.healTimers.repeat);
|2348|2348| 
|2349|2349| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2350|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2350|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2351|2351| 
|2352|2352| 					this.FaceTowardsTarget(this.order.data.target);
|2353|2353| 				},
|    | [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
|2560|2560| 					{
|2561|2561| 						// The building was already finished/fully repaired before we arrived;
|2562|2562| 						// let the ConstructionFinished handler handle this.
|2563|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2563|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2564|2564| 						return true;
|2565|2565| 					}
|2566|2566| 
|    | [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
|2560|2560| 					{
|2561|2561| 						// The building was already finished/fully repaired before we arrived;
|2562|2562| 						// let the ConstructionFinished handler handle this.
|2563|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2563|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2564|2564| 						return true;
|2565|2565| 					}
|2566|2566| 
|    | [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
|2687|2687| 
|2688|2688| 				// Unit was approaching and there's nothing to do now, so switch to walking
|2689|2689| 				if (oldState === "INDIVIDUAL.REPAIR.APPROACHING")
|2690|    |-				{
|    |2690|+				
|2691|2691| 					// We're already walking to the given point, so add this as a order.
|2692|2692| 					this.WalkToTarget(msg.data.newentity, true);
|2693|    |-				}
|    |2693|+				
|2694|2694| 			},
|2695|2695| 		},
|2696|2696| 
|    | [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
|2750|2750| 
|2751|2751| 					// Check that we can garrison here
|2752|2752| 					if (this.CanGarrison(target))
|2753|    |-					{
|    |2753|+					
|2754|2754| 						// Check that we're in range of the garrison target
|2755|2755| 						if (this.CheckGarrisonRange(target))
|2756|2756| 						{
|2826|2826| 								return false;
|2827|2827| 							}
|2828|2828| 						}
|2829|    |-					}
|    |2829|+					
|2830|2830| 					// Garrisoning failed for some reason, so finish the order
|2831|2831| 					this.FinishOrder();
|2832|2832| 					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
|2948|2948| 		"Attacked": function(msg) {
|2949|2949| 			if (this.template.NaturalBehaviour == "skittish" ||
|2950|2950| 			    this.template.NaturalBehaviour == "passive")
|2951|    |-			{
|    |2951|+			
|2952|2952| 				this.Flee(msg.data.attacker, false);
|2953|    |-			}
|    |2953|+			
|2954|2954| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|2955|2955| 			{
|2956|2956| 				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
|2957|2957| 					this.Attack(msg.data.attacker, false);
|2958|2958| 			}
|2959|2959| 			else if (this.template.NaturalBehaviour == "domestic")
|2960|    |-			{
|    |2960|+			
|2961|2961| 				// Never flee, stop what we were doing
|2962|2962| 				this.SetNextState("IDLE");
|2963|    |-			}
|    |2963|+			
|2964|2964| 		},
|2965|2965| 
|2966|2966| 		"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
|2971|2971| 				this.FinishOrder();
|2972|2972| 				return;
|2973|2973| 			}
|2974|    |-			else
|2975|    |-			{
|    |2974|+			
|2976|2975| 				this.order.data.min = range;
|2977|2976| 				this.SetNextState("WALKING");
|2978|    |-			}
|    |2977|+			
|2979|2978| 		},
|2980|2979| 
|2981|2980| 		"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
|3015|3015| 				}
|3016|3016| 				// Start attacking one of the newly-seen enemy (if any)
|3017|3017| 				else if (this.IsDangerousAnimal())
|3018|    |-				{
|    |3018|+				
|3019|3019| 					this.AttackVisibleEntity(msg.data.added);
|3020|    |-				}
|    |3020|+				
|3021|3021| 
|3022|3022| 				// TODO: if two units enter our range together, we'll attack the
|3023|3023| 				// 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
|3058|3058| 				}
|3059|3059| 				// Start attacking one of the newly-seen enemy (if any)
|3060|3060| 				else if (this.template.NaturalBehaviour == "violent")
|3061|    |-				{
|    |3061|+				
|3062|3062| 					this.AttackVisibleEntity(msg.data.added);
|3063|    |-				}
|    |3063|+				
|3064|3064| 			},
|3065|3065| 
|3066|3066| 			"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
|3073|3073| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3074|3074| 
|3075|3075| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3076|    |-							// only used for domestic animals
|    |3076|+		// only used for domestic animals
|3077|3077| 	},
|3078|3078| };
|3079|3079| 
|    | [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
|3130|3130| 
|3131|3131| UnitAI.prototype.IsAnimal = function()
|3132|3132| {
|3133|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3133|+	return (!!this.template.NaturalBehaviour);
|3134|3134| };
|3135|3135| 
|3136|3136| 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
|3168|3168| UnitAI.prototype.GetGarrisonHolder = function()
|3169|3169| {
|3170|3170| 	if (this.IsGarrisoned())
|3171|    |-	{
|    |3171|+	
|3172|3172| 		for (let order of this.orderQueue)
|3173|3173| 			if (order.type == "Garrison")
|3174|3174| 				return order.data.target;
|3175|    |-	}
|    |3175|+	
|3176|3176| 	return INVALID_ENTITY;
|3177|3177| };
|3178|3178| 
|    | [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
|3246|3246| 		{
|3247|3247| 			let index = this.GetCurrentState().indexOf(".");
|3248|3248| 			if (index != -1)
|3249|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3249|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3250|3250| 			this.Stop(false);
|3251|3251| 		}
|3252|3252| 
|    | [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
|3302|3302| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3303|3303| 			continue;
|3304|3304| 		if (i == 0)
|3305|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3305|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3306|3306| 		else
|3307|3307| 			this.orderQueue.splice(i, 1);
|3308|3308| 		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
|3302|3302| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3303|3303| 			continue;
|3304|3304| 		if (i == 0)
|3305|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3305|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3306|3306| 		else
|3307|3307| 			this.orderQueue.splice(i, 1);
|3308|3308| 		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
|3386|3386| };
|3387|3387| 
|3388|3388| 
|3389|    |-//// FSM linkage functions ////
|    |3389|+// // FSM linkage functions ////
|3390|3390| 
|3391|3391| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3392|3392| 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
|3558|3558| 				continue;
|3559|3559| 			if (this.orderQueue[i].type == type)
|3560|3560| 				continue;
|3561|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3561|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3562|3562| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3563|3563| 			return;
|3564|3564| 		}
|    | [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
|3558|3558| 				continue;
|3559|3559| 			if (this.orderQueue[i].type == type)
|3560|3560| 				continue;
|3561|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3561|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3562|3562| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3563|3563| 			return;
|3564|3564| 		}
|    | [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
|3572|3572| {
|3573|3573| 	// Remember the previous work orders to be able to go back to them later if required
|3574|3574| 	if (data && data.force)
|3575|    |-	{
|    |3575|+	
|3576|3576| 		if (this.IsFormationController())
|3577|3577| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3578|3578| 		else
|3579|3579| 			this.UpdateWorkOrders(type);
|3580|    |-	}
|    |3580|+	
|3581|3581| 
|3582|3582| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3583|3583| 
|    | [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
|3649|3649| 	{
|3650|3650| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3651|3651| 		if (cmpUnitAI)
|3652|    |-		{
|    |3652|+		
|3653|3653| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3654|3654| 			{
|3655|3655| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3658|3658| 					return;
|3659|3659| 				}
|3660|3660| 			}
|3661|    |-		}
|    |3661|+		
|3662|3662| 	}
|3663|3663| 
|3664|3664| 	// 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
|3651|3651| 		if (cmpUnitAI)
|3652|3652| 		{
|3653|3653| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3654|    |-			{
|    |3654|+			
|3655|3655| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3656|3656| 				{
|3657|3657| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3658|3658| 					return;
|3659|3659| 				}
|3660|    |-			}
|    |3660|+			
|3661|3661| 		}
|3662|3662| 	}
|3663|3663| 
|    | [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
|3663|3663| 
|3664|3664| 	// If nothing found, take the unit orders
|3665|3665| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3666|    |-	{
|    |3666|+	
|3667|3667| 		if (isWorkType(this.orderQueue[i].type))
|3668|3668| 		{
|3669|3669| 			this.workOrders = this.orderQueue.slice(i);
|3670|3670| 			return;
|3671|3671| 		}
|3672|    |-	}
|    |3672|+	
|3673|3673| };
|3674|3674| 
|3675|3675| 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
|3729|3729| 	if (data.timerRepeat === undefined)
|3730|3730| 		this.timer = undefined;
|3731|3731| 
|3732|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3732|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3733|3733| };
|3734|3734| 
|3735|3735| /**
|    | [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
|3729|3729| 	if (data.timerRepeat === undefined)
|3730|3730| 		this.timer = undefined;
|3731|3731| 
|3732|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3732|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3733|3733| };
|3734|3734| 
|3735|3735| /**
|    | [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
|3764|3764| 	this.timer = undefined;
|3765|3765| };
|3766|3766| 
|3767|    |-//// Message handlers /////
|    |3767|+// // Message handlers /////
|3768|3768| 
|3769|3769| UnitAI.prototype.OnMotionChanged = function(msg)
|3770|3770| {
|    | [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
|3776|3776| 	// TODO: This is a bit inefficient since every unit listens to every
|3777|3777| 	// construction message - ideally we could scope it to only the one we're building
|3778|3778| 
|3779|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3779|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3780|3780| };
|3781|3781| 
|3782|3782| 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
|3776|3776| 	// TODO: This is a bit inefficient since every unit listens to every
|3777|3777| 	// construction message - ideally we could scope it to only the one we're building
|3778|3778| 
|3779|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3779|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3780|3780| };
|3781|3781| 
|3782|3782| 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
|3801|3801| 
|3802|3802| UnitAI.prototype.OnAttacked = function(msg)
|3803|3803| {
|3804|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3804|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3805|3805| };
|3806|3806| 
|3807|3807| 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
|3801|3801| 
|3802|3802| UnitAI.prototype.OnAttacked = function(msg)
|3803|3803| {
|3804|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3804|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3805|3805| };
|3806|3806| 
|3807|3807| 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
|3806|3806| 
|3807|3807| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3808|3808| {
|3809|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3809|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|3810|3810| };
|3811|3811| 
|3812|3812| 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
|3806|3806| 
|3807|3807| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3808|3808| {
|3809|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3809|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|3810|3810| };
|3811|3811| 
|3812|3812| 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
|3811|3811| 
|3812|3812| UnitAI.prototype.OnHealthChanged = function(msg)
|3813|3813| {
|3814|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3814|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|3815|3815| };
|3816|3816| 
|3817|3817| 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
|3811|3811| 
|3812|3812| UnitAI.prototype.OnHealthChanged = function(msg)
|3813|3813| {
|3814|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3814|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|3815|3815| };
|3816|3816| 
|3817|3817| 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
|3817|3817| UnitAI.prototype.OnRangeUpdate = function(msg)
|3818|3818| {
|3819|3819| 	if (msg.tag == this.losRangeQuery)
|3820|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3820|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|3821|3821| 	else if (msg.tag == this.losHealRangeQuery)
|3822|3822| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3823|3823| };
|    | [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| UnitAI.prototype.OnRangeUpdate = function(msg)
|3818|3818| {
|3819|3819| 	if (msg.tag == this.losRangeQuery)
|3820|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3820|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|3821|3821| 	else if (msg.tag == this.losHealRangeQuery)
|3822|3822| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3823|3823| };
|    | [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
|3819|3819| 	if (msg.tag == this.losRangeQuery)
|3820|3820| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3821|3821| 	else if (msg.tag == this.losHealRangeQuery)
|3822|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3822|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|3823|3823| };
|3824|3824| 
|3825|3825| 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
|3819|3819| 	if (msg.tag == this.losRangeQuery)
|3820|3820| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3821|3821| 	else if (msg.tag == this.losHealRangeQuery)
|3822|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3822|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|3823|3823| };
|3824|3824| 
|3825|3825| 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
|3824|3824| 
|3825|3825| UnitAI.prototype.OnPackFinished = function(msg)
|3826|3826| {
|3827|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3827|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|3828|3828| };
|3829|3829| 
|3830|3830| //// 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
|3824|3824| 
|3825|3825| UnitAI.prototype.OnPackFinished = function(msg)
|3826|3826| {
|3827|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3827|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|3828|3828| };
|3829|3829| 
|3830|3830| //// 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
|3827|3827| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|3828|3828| };
|3829|3829| 
|3830|    |-//// Helper functions to be called by the FSM ////
|    |3830|+// // Helper functions to be called by the FSM ////
|3831|3831| 
|3832|3832| UnitAI.prototype.GetWalkSpeed = function()
|3833|3833| {
|    | [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
|3929|3929| 	if (!cmpOwnership || cmpOwnership.GetOwner() == INVALID_PLAYER)
|3930|3930| 		return undefined;
|3931|3931| 
|3932|    |-	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position)
|    |3932|+	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
|3933|3933| 	if (!cmpPosition || !cmpPosition.IsInWorld())
|3934|3934| 		return undefined;
|3935|3935| 
|    | [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
|4014|4014| 			PlaySound(name, member);
|4015|4015| 	}
|4016|4016| 	else
|4017|    |-	{
|    |4017|+	
|4018|4018| 		// Otherwise use our own sounds
|4019|4019| 		PlaySound(name, this.entity);
|4020|    |-	}
|    |4020|+	
|4021|4021| };
|4022|4022| 
|4023|4023| /*
|    | [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
|4206|4206| 	else
|4207|4207| 		// return false? Or hope you come close enough?
|4208|4208| 		var parabolicMaxRange = 0;
|4209|    |-		//return false;
|    |4209|+		// return false;
|4210|4210| 
|4211|4211| 	// the parabole changes while walking, take something in the middle
|4212|4212| 	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
|4293|4293| 	if (this.IsFormationMember())
|4294|4294| 	{
|4295|4295| 		var cmpFormationUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|4296|    |-		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation()
|4297|    |-			&& cmpFormationUnitAI.order.data.target == target)
|    |4296|+		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation() &&
|    |4297|+			cmpFormationUnitAI.order.data.target == target)
|4298|4298| 			return true;
|4299|4299| 	}
|4300|4300| 
|    | [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
|4461|4461| UnitAI.prototype.AttackEntityInZone = function(ents)
|4462|4462| {
|4463|4463| 	var target = ents.find(target =>
|4464|    |-		this.CanAttack(target)
|4465|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4464|+		this.CanAttack(target) &&
|    |4465|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4466|4466| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4467|4467| 	);
|4468|4468| 	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
|4462|4462| {
|4463|4463| 	var target = ents.find(target =>
|4464|4464| 		this.CanAttack(target)
|4465|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4466|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4465|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4466|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4467|4467| 	);
|4468|4468| 	if (!target)
|4469|4469| 		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
|4526|4526| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4527|4527| 	if (this.isGuardOf)
|4528|4528| 	{
|4529|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4529|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4530|4530| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4531|4531| 		if (cmpUnitAI && cmpAttack &&
|4532|4532| 		    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
|4530|4530| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4531|4531| 		if (cmpUnitAI && cmpAttack &&
|4532|4532| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4533|    |-				return false;
|    |4533|+			return false;
|4534|4534| 	}
|4535|4535| 
|4536|4536| 	// 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
|4535|4535| 
|4536|4536| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4537|4537| 	if (this.GetStance().respondHoldGround)
|4538|    |-	{
|    |4538|+	
|4539|4539| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4540|4540| 			return true;
|4541|    |-	}
|    |4541|+	
|4542|4542| 
|4543|4543| 	// Stop if it's left our vision range, unless we're especially persistent
|4544|4544| 	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
|4542|4542| 
|4543|4543| 	// Stop if it's left our vision range, unless we're especially persistent
|4544|4544| 	if (!this.GetStance().respondChaseBeyondVision)
|4545|    |-	{
|    |4545|+	
|4546|4546| 		if (!this.CheckTargetIsInVisionRange(target))
|4547|4547| 			return true;
|4548|    |-	}
|    |4548|+	
|4549|4549| 
|4550|4550| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4551|4551| 	// 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
|4568|4568| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4569|4569| 	if (this.isGuardOf)
|4570|4570| 	{
|4571|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4571|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4572|4572| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4573|4573| 		if (cmpUnitAI && cmpAttack &&
|4574|4574| 		    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
|4581|4581| 	return false;
|4582|4582| };
|4583|4583| 
|4584|    |-//// External interface functions ////
|    |4584|+// // External interface functions ////
|4585|4585| 
|4586|4586| UnitAI.prototype.SetFormationController = function(ent)
|4587|4587| {
|    | [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
|4591|4591| 	// of our own formation (or ourself if not in formation)
|4592|4592| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4593|4593| 	if (cmpObstruction)
|4594|    |-	{
|    |4594|+	
|4595|4595| 		if (ent == INVALID_ENTITY)
|4596|4596| 			cmpObstruction.SetControlGroup(this.entity);
|4597|4597| 		else
|4598|4598| 			cmpObstruction.SetControlGroup(ent);
|4599|    |-	}
|    |4599|+	
|4600|4600| 
|4601|4601| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4602|4602| 	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
|4734|4734| 	// if we already had an old guard order, do nothing if the target is the same
|4735|4735| 	// and the order is running, otherwise remove the previous order
|4736|4736| 	if (this.isGuardOf)
|4737|    |-	{
|    |4737|+	
|4738|4738| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4739|4739| 			return;
|4740|4740| 		else
|4741|4741| 			this.RemoveGuard();
|4742|    |-	}
|    |4742|+	
|4743|4743| 
|4744|4744| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4745|4745| };
|    | [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
|4737|4737| 	{
|4738|4738| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4739|4739| 			return;
|4740|    |-		else
|4741|    |-			this.RemoveGuard();
|    |4740|+		this.RemoveGuard();
|4742|4741| 	}
|4743|4742| 
|4744|4743| 	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
|4908|4908| 			this.WalkToTarget(target, queued);
|4909|4909| 		return;
|4910|4910| 	}
|4911|    |-	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture}, queued);
|    |4911|+	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture }, queued);
|4912|4912| };
|4913|4913| 
|4914|4914| /**
|    | [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
|5057|5057| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5058|5058| 	{
|5059|5059| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5060|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5060|+		if (cmpTrader.HasBothMarkets() &&
|5061|5061| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5062|5062| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5063|5063| 		{
|    | [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
|5338|5338| 				{
|5339|5339| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5340|5340| 					var targetClasses = this.order.data.targetClasses;
|5341|    |-					if (targetClasses.attack && cmpIdentity
|5342|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5341|+					if (targetClasses.attack && cmpIdentity &&
|    |5342|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5343|5343| 						continue;
|5344|5344| 					if (targetClasses.avoid && cmpIdentity
|5345|5345| 						&& 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
|5341|5341| 					if (targetClasses.attack && cmpIdentity
|5342|5342| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5343|5343| 						continue;
|5344|    |-					if (targetClasses.avoid && cmpIdentity
|5345|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5344|+					if (targetClasses.avoid && cmpIdentity &&
|    |5345|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5346|5346| 						continue;
|5347|5347| 					// Only used by the AIs to prevent some choices of targets
|5348|5348| 					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
|5364|5364| 		{
|5365|5365| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5366|5366| 			var targetClasses = this.order.data.targetClasses;
|5367|    |-			if (cmpIdentity && targetClasses.attack
|5368|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5367|+			if (cmpIdentity && targetClasses.attack &&
|    |5368|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5369|5369| 				continue;
|5370|5370| 			if (cmpIdentity && targetClasses.avoid
|5371|5371| 				&& 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
|5367|5367| 			if (cmpIdentity && targetClasses.attack
|5368|5368| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5369|5369| 				continue;
|5370|    |-			if (cmpIdentity && targetClasses.avoid
|5371|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5370|+			if (cmpIdentity && targetClasses.avoid &&
|    |5371|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5372|5372| 				continue;
|5373|5373| 			// Only used by the AIs to prevent some choices of targets
|5374|5374| 			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
|5510|5510| 
|5511|5511| UnitAI.prototype.SetHeldPosition = function(x, z)
|5512|5512| {
|5513|    |-	this.heldPosition = {"x": x, "z": z};
|    |5513|+	this.heldPosition = { "x": x, "z": z};
|5514|5514| };
|5515|5515| 
|5516|5516| 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
|5510|5510| 
|5511|5511| UnitAI.prototype.SetHeldPosition = function(x, z)
|5512|5512| {
|5513|    |-	this.heldPosition = {"x": x, "z": z};
|    |5513|+	this.heldPosition = {"x": x, "z": z };
|5514|5514| };
|5515|5515| 
|5516|5516| 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
|5537|5537| 	return false;
|5538|5538| };
|5539|5539| 
|5540|    |-//// Helper functions ////
|    |5540|+// // Helper functions ////
|5541|5541| 
|5542|5542| UnitAI.prototype.CanAttack = function(target)
|5543|5543| {
|    | [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
|5741|5741| 	return cmpPack && cmpPack.IsPacking();
|5742|5742| };
|5743|5743| 
|5744|    |-//// Formation specific functions ////
|    |5744|+// // Formation specific functions ////
|5745|5745| 
|5746|5746| UnitAI.prototype.IsAttackingAsFormation = function()
|5747|5747| {
|    | [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
|5746|5746| UnitAI.prototype.IsAttackingAsFormation = function()
|5747|5747| {
|5748|5748| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5749|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5750|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5749|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5750|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5751|5751| };
|5752|5752| 
|5753|5753| //// 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
|5750|5750| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5751|5751| };
|5752|5752| 
|5753|    |-//// Animal specific functions ////
|    |5753|+// // Animal specific functions ////
|5754|5754| 
|5755|5755| UnitAI.prototype.MoveRandomly = function(distance)
|5756|5756| {

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
|1748| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

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

binaries/data/mods/public/simulation/components/UnitAI.js
|1986| »   »   »   »   "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
|2068| »   »   »   »   "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
|2237| »   »   »   »   »   »   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
|2292| »   »   »   »   "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
|2410| »   »   »   »   "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
|2475| »   »   »   »   "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
|2515| »   »   »   »   "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
|2719| »   »   »   »   "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
|2903| »   »   »   »   "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
|3634| »   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
|4448| »   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
|4463| »   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
|4509| »   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
|4532| »   »   ····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
|4988| »   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
|1842| »   »   »   »   »   »   var·cmpFormation·=·Engine.QueryInterface(this.formationController,·IID_Formation);
|    | [NORMAL] JSHintBear:
|    | 'cmpFormation' is already defined.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4219| »   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
|4297| »   »   »   &&·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
|4465| »   »   &&·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
|4466| »   »   &&·(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
|4988| »   var·lastPos·=·undefined;
|    | [NORMAL] JSHintBear:
|    | It's not necessary to initialize 'lastPos' to 'undefined'.

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

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

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

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

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

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

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

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

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

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

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

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

Freagarach added inline comments.
binaries/data/mods/public/simulation/components/UnitAI.js
1985

Wouldn't "Chasing" be the same as "Approaching" then?

wraitii added inline comments.Jun 19 2019, 9:56 AM
binaries/data/mods/public/simulation/components/UnitAI.js
1985

Does seem similar - I guess they could be merged anyways because this "run if target is fleeing" logic could be handled in approaching too.

wraitii abandoned this revision.Jul 28 2019, 2:04 PM

Didn't get any attention as a positive change -> might make into a ticket some day.