Page MenuHomeWildfire Games

Unit Motion / AI - check ranges explicitly, move in the the State handlers instead of the orders.
Needs ReviewPublic

Authored by wraitii on Wed, May 8, 10:47 AM.

Details

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

Currently, UnitAI often calls "MoveToTarget/Point" without checking if we are already in range of that. This works because UnitMotion's MoveToTarget/Point range functions return "false" if we are already in range (according to UM) and the code expects that.

This is broken because:

  • Returning "False" when a move is not necessary OR impossible is a weird interface.
  • UnitAI should be in charge of deciding if we are in range for actions, not unit motion.
  • UnitMotion should not be the component with range checking functions (these have nothing to do with movement, see D981).
  • Relying on movement supposes the entity has a UnitMotion component, which it might not. By explicitly checking we are in range first, we are moving closer to merging BuildAI and unitAI.

Note that there are several places in UnitAI where we are already calling Check...Range before moving, so this is arguably a standardisation.

This is a prerequisite to D981 since that currently sends us in an infinite loop because range checks in unit motion and the range functions are actually different.

Test Plan

Check for missed opportunities. This is likely to change hashes.

Diff Detail

Event Timeline

wraitii added inline comments.Wed, May 8, 10:50 AM
binaries/data/mods/public/simulation/components/UnitAI.js
2790

Here is an example where we really want MoveToTargetRange to return "false" if the goal is unreachable, and not if movement isn't necessary.

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
| 230| 230| 		let range = 4;
| 231| 231| 		if (this.CheckTargetRangeExplicit(msg.data.target, range, range) &&
| 232| 232| 			this.MoveToTargetRangeExplicit(msg.data.target, range, range))
| 233|    |-		{
|    | 233|+		
| 234| 234| 			this.SetNextState("INDIVIDUAL.WALKING");
| 235|    |-		}
|    | 235|+		
| 236| 236| 		else
| 237| 237| 		{
| 238| 238| 			// We are already at the target, or can't move at all
|    | [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
| 234| 234| 			this.SetNextState("INDIVIDUAL.WALKING");
| 235| 235| 		}
| 236| 236| 		else
| 237|    |-		{
|    | 237|+		
| 238| 238| 			// We are already at the target, or can't move at all
| 239| 239| 			this.FinishOrder();
| 240|    |-		}
|    | 240|+		
| 241| 241| 	},
| 242| 242| 
| 243| 243| 	// Individual orders:
|    | [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
| 336| 336| 
| 337| 337| 		var ok = this.CheckTargetRange(this.order.data.target) && this.MoveToTarget(this.order.data.target);
| 338| 338| 		if (ok)
| 339|    |-		{
|    | 339|+		
| 340| 340| 			// We've started walking to the given point
| 341| 341| 			if (this.IsAnimal())
| 342| 342| 				this.SetNextState("ANIMAL.WALKING");
| 343| 343| 			else
| 344| 344| 				this.SetNextState("INDIVIDUAL.WALKING");
| 345|    |-		}
|    | 345|+		
| 346| 346| 		else
| 347| 347| 		{
| 348| 348| 			// We are already at the target, or can't move at all
|    | [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
| 364| 364| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 365| 365| 		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 366| 366| 		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 367|    |-		{
|    | 367|+		
| 368| 368| 			// we were already on the shoreline, and have not moved since
| 369| 369| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
| 370| 370| 				needToMove = false;
| 371|    |-		}
|    | 371|+		
| 372| 372| 
| 373| 373| 		// TODO: what if the units are on a cliff ? the ship will go below the cliff
| 374| 374| 		// and the units won't be able to garrison. Should go to the nearest (accessible) shore
|    | [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
| 362| 362| 		// Check if we need to move     TODO implement a better way to know if we are on the shoreline
| 363| 363| 		var needToMove = true;
| 364| 364| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 365|    |-		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 366|    |-		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
|    | 365|+		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x) &&
|    | 366|+		    (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 367| 367| 		{
| 368| 368| 			// we were already on the shoreline, and have not moved since
| 369| 369| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
|    | [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
| 373| 373| 		// TODO: what if the units are on a cliff ? the ship will go below the cliff
| 374| 374| 		// and the units won't be able to garrison. Should go to the nearest (accessible) shore
| 375| 375| 		if (needToMove && this.CheckTargetRange(this.order.data.target) && this.MoveToTarget(this.order.data.target))
| 376|    |-		{
|    | 376|+		
| 377| 377| 			this.SetNextState("INDIVIDUAL.PICKUP.APPROACHING");
| 378|    |-		}
|    | 378|+		
| 379| 379| 		else
| 380| 380| 		{
| 381| 381| 			// We are already at the target, or can't move at all
|    | [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
| 403| 403| 		let distance = DistanceBetweenEntities(this.entity, this.order.data.target) + (+this.template.FleeDistance);
| 404| 404| 		if (this.CheckTargetRangeExplicit(this.order.data.target, distance, distance) &&
| 405| 405| 			this.MoveToTargetRangeExplicit(this.order.data.target, distance, distance))
| 406|    |-		{
|    | 406|+		
| 407| 407| 			// We've started fleeing from the given target
| 408| 408| 			if (this.IsAnimal())
| 409| 409| 				this.SetNextState("ANIMAL.FLEEING");
| 410| 410| 			else
| 411| 411| 				this.SetNextState("INDIVIDUAL.FLEEING");
| 412|    |-		}
|    | 412|+		
| 413| 413| 		else
| 414| 414| 		{
| 415| 415| 			// We are already at the target, or can't move at all
|    | [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
| 450| 450| 			}
| 451| 451| 
| 452| 452| 			if (this.order.data.attackType == this.oldAttackType)
| 453|    |-			{
|    | 453|+			
| 454| 454| 				if (this.IsAnimal())
| 455| 455| 					this.SetNextState("ANIMAL.COMBAT.ATTACKING");
| 456| 456| 				else
| 457| 457| 					this.SetNextState("INDIVIDUAL.COMBAT.ATTACKING");
| 458|    |-			}
|    | 458|+			
| 459| 459| 			else
| 460| 460| 			{
| 461| 461| 				if (this.IsAnimal())
|    | [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
| 457| 457| 					this.SetNextState("INDIVIDUAL.COMBAT.ATTACKING");
| 458| 458| 			}
| 459| 459| 			else
| 460|    |-			{
|    | 460|+			
| 461| 461| 				if (this.IsAnimal())
| 462| 462| 					this.SetNextState("ANIMAL.COMBAT.ATTACKING");
| 463| 463| 				else
| 464| 464| 					this.SetNextState("INDIVIDUAL.COMBAT.ATTACKING");
| 465|    |-			}
|    | 465|+			
| 466| 466| 			return;
| 467| 467| 		}
| 468| 468| 
|    | [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
| 584| 584| 					this.PushOrderFront("Walk", this.order.data.lastPos);
| 585| 585| 				}
| 586| 586| 				else
| 587|    |-				{
|    | 587|+				
| 588| 588| 					// We couldn't move there, or the target moved away
| 589| 589| 					this.FinishOrder();
| 590|    |-				}
|    | 590|+				
| 591| 591| 				return;
| 592| 592| 			}
| 593| 593| 
|    | [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
| 598| 598| 		// Try to move within range
| 599| 599| 		if (this.CheckTargetRange(this.order.data.target, IID_ResourceGatherer) &&
| 600| 600| 			this.MoveToTargetRange(this.order.data.target, IID_ResourceGatherer))
| 601|    |-		{
|    | 601|+		
| 602| 602| 			// We've started walking to the given point
| 603| 603| 			this.SetNextState("INDIVIDUAL.GATHER.APPROACHING");
| 604|    |-		}
|    | 604|+		
| 605| 605| 		else
| 606| 606| 		{
| 607| 607| 			// We are already at the target, or can't move at all,
|    | [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
| 677| 677| 		// Try to move within range
| 678| 678| 		if (this.CheckTargetRange(this.order.data.target, IID_Builder) &&
| 679| 679| 			this.MoveToTargetRange(this.order.data.target, IID_Builder))
| 680|    |-		{
|    | 680|+		
| 681| 681| 			// We've started walking to the given point
| 682| 682| 			this.SetNextState("INDIVIDUAL.REPAIR.APPROACHING");
| 683|    |-		}
|    | 683|+		
| 684| 684| 		else
| 685| 685| 		{
| 686| 686| 			// We are already at the target, or can't move at all,
|    | [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
| 713| 713| 		}
| 714| 714| 
| 715| 715| 		if (this.MoveToGarrisonRange(this.order.data.target))
| 716|    |-		{
|    | 716|+		
| 717| 717| 			this.SetNextState("INDIVIDUAL.GARRISON.APPROACHING");
| 718|    |-		}
|    | 718|+		
| 719| 719| 		else
| 720| 720| 		{
| 721| 721| 			// We do a range check before actually garrisoning
|    | [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
| 844| 844| 			if (!this.CheckTargetAttackRange(target, target))
| 845| 845| 			{
| 846| 846| 				if (this.TargetIsAlive(target) && this.CheckTargetVisible(target))
| 847|    |-				{
|    | 847|+				
| 848| 848| 					if (this.MoveToTargetAttackRange(target, target))
| 849| 849| 					{
| 850| 850| 						this.SetNextState("COMBAT.APPROACHING");
| 851| 851| 						return;
| 852| 852| 					}
| 853|    |-				}
|    | 853|+				
| 854| 854| 				this.FinishOrder();
| 855| 855| 				return;
| 856| 856| 			}
|    | [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
| 869| 869| 			}
| 870| 870| 			// Check if we are already in range, otherwise walk there
| 871| 871| 			if (!this.CheckGarrisonRange(msg.data.target))
| 872|    |-			{
|    | 872|+			
| 873| 873| 				if (!this.CheckTargetVisible(msg.data.target))
| 874| 874| 				{
| 875| 875| 					this.FinishOrder();
| 884| 884| 						return;
| 885| 885| 					}
| 886| 886| 				}
| 887|    |-			}
|    | 887|+			
| 888| 888| 
| 889| 889| 			this.SetNextState("GARRISON.GARRISONING");
| 890| 890| 		},
|    | [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
| 876| 876| 					return;
| 877| 877| 				}
| 878| 878| 				else
| 879|    |-				{
|    | 879|+				
| 880| 880| 					// Out of range; move there in formation
| 881| 881| 					if (this.MoveToGarrisonRange(msg.data.target))
| 882| 882| 					{
| 883| 883| 						this.SetNextState("GARRISON.APPROACHING");
| 884| 884| 						return;
| 885| 885| 					}
| 886|    |-				}
|    | 886|+				
| 887| 887| 			}
| 888| 888| 
| 889| 889| 			this.SetNextState("GARRISON.GARRISONING");
|    | [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
| 875| 875| 					this.FinishOrder();
| 876| 876| 					return;
| 877| 877| 				}
| 878|    |-				else
| 879|    |-				{
|    | 878|+				
| 880| 879| 					// Out of range; move there in formation
| 881| 880| 					if (this.MoveToGarrisonRange(msg.data.target))
| 882| 881| 					{
| 883| 882| 						this.SetNextState("GARRISON.APPROACHING");
| 884| 883| 						return;
| 885| 884| 					}
| 886|    |-				}
|    | 885|+				
| 887| 886| 			}
| 888| 887| 
| 889| 888| 			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
| 902| 902| 						this.PushOrderFront("Walk", msg.data.lastPos);
| 903| 903| 					}
| 904| 904| 					else
| 905|    |-					{
|    | 905|+					
| 906| 906| 						// We couldn't move there, or the target moved away
| 907| 907| 						this.FinishOrder();
| 908|    |-					}
|    | 908|+					
| 909| 909| 					return;
| 910| 910| 				}
| 911| 911| 
|    | [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
|1123|1123| 			},
|1124|1124| 		},
|1125|1125| 
|1126|    |-		"GARRISON":{
|    |1126|+		"GARRISON": {
|1127|1127| 			"enter": function() {
|1128|1128| 				// If the garrisonholder should pickup, warn it so it can take needed action
|1129|1129| 				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
|1307|1307| 			// If the controller handled an order but some members rejected it,
|1308|1308| 			// they will have no orders and be in the FORMATIONMEMBER.IDLE state.
|1309|1309| 			if (this.orderQueue.length)
|1310|    |-			{
|    |1310|+			
|1311|1311| 				// We're leaving the formation, so stop our FormationWalk order
|1312|1312| 				if (this.FinishOrder())
|1313|1313| 					return;
|1314|    |-			}
|    |1314|+			
|1315|1315| 
|1316|1316| 			// No orders left, we're an individual now
|1317|1317| 			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
|1336|1336| 			let range = 4;
|1337|1337| 			if (this.CheckTargetRangeExplicit(msg.data.target, range, range) &&
|1338|1338| 				this.MoveToTargetRangeExplicit(msg.data.target, range, range))
|1339|    |-			{
|    |1339|+			
|1340|1340| 				// We've started walking to the given point
|1341|1341| 				this.SetNextState("WALKINGTOPOINT");
|1342|    |-			}
|    |1342|+			
|1343|1343| 			else
|1344|1344| 			{
|1345|1345| 				// We are already at the target, or can't move at all
|    | [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
|1341|1341| 				this.SetNextState("WALKINGTOPOINT");
|1342|1342| 			}
|1343|1343| 			else
|1344|    |-			{
|    |1344|+			
|1345|1345| 				// We are already at the target, or can't move at all
|1346|1346| 				this.FinishOrder();
|1347|    |-			}
|    |1347|+			
|1348|1348| 		},
|1349|1349| 
|1350|1350| 
|    | [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
|1542|1542| 
|1543|1543| 			"LosRangeUpdate": function(msg) {
|1544|1544| 				if (this.GetStance().targetVisibleEnemies)
|1545|    |-				{
|    |1545|+				
|1546|1546| 					// Start attacking one of the newly-seen enemy (if any)
|1547|1547| 					this.AttackEntitiesByPreference(msg.data.added);
|1548|    |-				}
|    |1548|+				
|1549|1549| 			},
|1550|1550| 
|1551|1551| 			"LosHealRangeUpdate": function(msg) {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1729|1729| 						// if nothing better to do, check if the guarded needs to be healed or repaired
|1730|1730| 						var cmpHealth = Engine.QueryInterface(this.isGuardOf, IID_Health);
|1731|1731| 						if (cmpHealth && (cmpHealth.GetHitpoints() < cmpHealth.GetMaxHitpoints()))
|1732|    |-						{
|    |1732|+						
|1733|1733| 							if (this.CanHeal(this.isGuardOf))
|1734|1734| 								this.PushOrderFront("Heal", { "target": this.isGuardOf, "force": false });
|1735|1735| 							else if (this.CanRepair(this.isGuardOf))
|1736|1736| 								this.PushOrderFront("Repair", { "target": this.isGuardOf, "autocontinue": false, "force": false });
|1737|    |-						}
|    |1737|+						
|1738|1738| 					}
|1739|1739| 				},
|1740|1740| 
|    | [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
|1814|1814| 				"MoveCompleted": function() {
|1815|1815| 
|1816|1816| 					if (this.CheckTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1817|    |-					{
|    |1817|+					
|1818|1818| 						// If the unit needs to unpack, do so
|1819|1819| 						if (this.CanUnpack())
|1820|1820| 						{
|1823|1823| 						}
|1824|1824| 						else
|1825|1825| 							this.SetNextState("ATTACKING");
|1826|    |-					}
|    |1826|+					
|1827|1827| 					else
|1828|1828| 					{
|1829|1829| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|    | [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
|1821|1821| 							this.PushOrderFront("Unpack", { "force": true });
|1822|1822| 							return;
|1823|1823| 						}
|1824|    |-						else
|1825|    |-							this.SetNextState("ATTACKING");
|    |1824|+						this.SetNextState("ATTACKING");
|1826|1825| 					}
|1827|1826| 					else
|1828|1827| 					{
|    | [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
|1825|1825| 							this.SetNextState("ATTACKING");
|1826|1826| 					}
|1827|1827| 					else
|1828|    |-					{
|    |1828|+					
|1829|1829| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1830|1830| 						{
|1831|1831| 							this.SetNextState("APPROACHING");
|1835|1835| 							// Give up
|1836|1836| 							this.FinishOrder();
|1837|1837| 						}
|1838|    |-					}
|    |1838|+					
|1839|1839| 				},
|1840|1840| 			},
|1841|1841| 
|    | [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
|1827|1827| 					else
|1828|1828| 					{
|1829|1829| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1830|    |-						{
|    |1830|+						
|1831|1831| 							this.SetNextState("APPROACHING");
|1832|    |-						}
|    |1832|+						
|1833|1833| 						else
|1834|1834| 						{
|1835|1835| 							// Give up
|    | [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
|1831|1831| 							this.SetNextState("APPROACHING");
|1832|1832| 						}
|1833|1833| 						else
|1834|    |-						{
|    |1834|+						
|1835|1835| 							// Give up
|1836|1836| 							this.FinishOrder();
|1837|    |-						}
|    |1837|+						
|1838|1838| 					}
|1839|1839| 				},
|1840|1840| 			},
|    | [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
|1852|1852| 					}
|1853|1853| 					// Check the target is still alive and attackable
|1854|1854| 					if (this.CanAttack(target) && !this.CheckTargetAttackRange(target, this.order.data.attackType))
|1855|    |-					{
|    |1855|+					
|1856|1856| 						// Can't reach it - try to chase after it
|1857|1857| 						if (this.ShouldChaseTargetedEntity(target, this.order.data.force))
|1858|1858| 						{
|1867|1867| 								return;
|1868|1868| 							}
|1869|1869| 						}
|1870|    |-					}
|    |1870|+					
|1871|1871| 
|1872|1872| 					var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|1873|1873| 					this.attackTimers = cmpAttack.GetTimers(this.order.data.attackType);
|    | [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
|1898|1898| 					// TODO: we should probably only bother syncing projectile attacks, not melee
|1899|1899| 
|1900|1900| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|1901|    |-					this.resyncAnimation = (prepare != this.attackTimers.prepare) ? true : false;
|    |1901|+					this.resyncAnimation = (prepare != this.attackTimers.prepare);
|1902|1902| 
|1903|1903| 					this.FaceTowardsTarget(this.order.data.target);
|1904|1904| 
|    | [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
|2027|2027| 
|2028|2028| 				"Attacked": function(msg) {
|2029|2029| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2030|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2031|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2030|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2031|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2032|2032| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2033|2033| 				},
|2034|2034| 			},
|    | [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
|2041|2041| 					this.SelectAnimation("move");
|2042|2042| 					var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|2043|2043| 					if (cmpUnitAI && cmpUnitAI.IsFleeing())
|2044|    |-					{
|    |2044|+					
|2045|2045| 						// Run after a fleeing target
|2046|2046| 						this.SetMoveSpeedRatio(this.GetRunMultiplier());
|2047|    |-					}
|    |2047|+					
|2048|2048| 					this.StartTimer(1000, 1000);
|2049|2049| 				},
|2050|2050| 
|    | [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
|2100|2100| 						// Also don't switch to a different type of huntable animal
|2101|2101| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2102|2102| 							return (
|2103|    |-								ent != oldTarget
|2104|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2103|+								ent != oldTarget &&
|    |2104|+								 ((type.generic == "treasure" && oldType.generic == "treasure")
|2105|2105| 								 || (type.specific == oldType.specific
|2106|2106| 								 && (type.specific != "meat" || oldTemplate == template)))
|2107|2107| 							);
|    | [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
|2101|2101| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2102|2102| 							return (
|2103|2103| 								ent != oldTarget
|2104|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2105|    |-								 || (type.specific == oldType.specific
|    |2104|+								 && ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2105|+								 (type.specific == oldType.specific
|2106|2106| 								 && (type.specific != "meat" || oldTemplate == template)))
|2107|2107| 							);
|2108|2108| 						}, oldTarget);
|    | [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
|2102|2102| 							return (
|2103|2103| 								ent != oldTarget
|2104|2104| 								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2105|    |-								 || (type.specific == oldType.specific
|2106|    |-								 && (type.specific != "meat" || oldTemplate == template)))
|    |2105|+								 || (type.specific == oldType.specific &&
|    |2106|+								 (type.specific != "meat" || oldTemplate == template)))
|2107|2107| 							);
|2108|2108| 						}, oldTarget);
|2109|2109| 						if (nearby)
|    | [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
|2111|2111| 							this.PerformGather(nearby, false, false);
|2112|2112| 							return true;
|2113|2113| 						}
|2114|    |-						else
|2115|    |-						{
|    |2114|+						
|2116|2115| 							// It's probably better in this case, to avoid units getting stuck around a dropsite
|2117|2116| 							// in a "Target is far away, full, nearby are no good resources, return to dropsite" loop
|2118|2117| 							// to order it to GatherNear the resource position.
|2133|2132| 									return true;
|2134|2133| 								}
|2135|2134| 							}
|2136|    |-						}
|    |2135|+						
|2137|2136| 						return true;
|2138|2137| 					}
|2139|2138| 					return false;
|    | [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
|2123|2123| 								this.GatherNearPosition(pos.x, pos.z, oldType, oldTemplate);
|2124|2124| 								return true;
|2125|2125| 							}
|2126|    |-							else
|2127|    |-							{
|    |2126|+							
|2128|2127| 								// we're kind of stuck here. Return resource.
|2129|2128| 								var nearby = this.FindNearestDropsite(oldType.generic);
|2130|2129| 								if (nearby)
|2132|2131| 									this.PushOrderFront("ReturnResource", { "target": nearby, "force": false });
|2133|2132| 									return true;
|2134|2133| 								}
|2135|    |-							}
|    |2134|+							
|2136|2135| 						}
|2137|2136| 						return true;
|2138|2137| 					}
|    | [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
|2165|2165| 						// Also don't switch to a different type of huntable animal
|2166|2166| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2167|2167| 							return (
|2168|    |-								ent != oldTarget
|2169|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2168|+								ent != oldTarget &&
|    |2169|+								((type.generic == "treasure" && oldType.generic == "treasure")
|2170|2170| 								|| (type.specific == oldType.specific
|2171|2171| 								&& (type.specific != "meat" || oldTemplate == template)))
|2172|2172| 							);
|    | [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
|2166|2166| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2167|2167| 							return (
|2168|2168| 								ent != oldTarget
|2169|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2170|    |-								|| (type.specific == oldType.specific
|    |2169|+								&& ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2170|+								(type.specific == oldType.specific
|2171|2171| 								&& (type.specific != "meat" || oldTemplate == template)))
|2172|2172| 							);
|2173|2173| 						});
|    | [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
|2167|2167| 							return (
|2168|2168| 								ent != oldTarget
|2169|2169| 								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2170|    |-								|| (type.specific == oldType.specific
|2171|    |-								&& (type.specific != "meat" || oldTemplate == template)))
|    |2170|+								|| (type.specific == oldType.specific &&
|    |2171|+								(type.specific != "meat" || oldTemplate == template)))
|2172|2172| 							);
|2173|2173| 						});
|2174|2174| 						if (nearby)
|    | [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
|2212|2212| 					// Also don't switch to a different type of huntable animal
|2213|2213| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2214|2214| 						return (
|2215|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2216|    |-							|| (type.specific == resourceType.specific
|    |2215|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2216|+							(type.specific == resourceType.specific
|2217|2217| 							&& (type.specific != "meat" || resourceTemplate == template))
|2218|2218| 						);
|2219|2219| 					});
|    | [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
|2213|2213| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2214|2214| 						return (
|2215|2215| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2216|    |-							|| (type.specific == resourceType.specific
|2217|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2216|+							|| (type.specific == resourceType.specific &&
|    |2217|+							(type.specific != "meat" || resourceTemplate == template))
|2218|2218| 						);
|2219|2219| 					});
|2220|2220| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2329|2329| 
|2330|2330| 					var cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply);
|2331|2331| 					if (cmpSupply && cmpSupply.IsAvailable(cmpOwnership.GetOwner(), this.entity))
|2332|    |-					{
|    |2332|+					
|2333|2333| 						// Check we can still reach and gather from the target
|2334|2334| 						if (this.CheckTargetRange(this.gatheringTarget, IID_ResourceGatherer) && this.CanGather(this.gatheringTarget))
|2335|2335| 						{
|2395|2395| 								return;
|2396|2396| 							}
|2397|2397| 						}
|2398|    |-					}
|    |2398|+					
|2399|2399| 
|2400|2400| 					// We're already in range, can't get anywhere near it or the target is exhausted.
|2401|2401| 
|    | [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
|2421|2421| 					// Also don't switch to a different type of huntable animal
|2422|2422| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2423|2423| 						return (
|2424|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2425|    |-							|| (type.specific == resourceType.specific
|    |2424|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2425|+							(type.specific == resourceType.specific
|2426|2426| 							&& (type.specific != "meat" || resourceTemplate == template))
|2427|2427| 						);
|2428|2428| 					});
|    | [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
|2422|2422| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2423|2423| 						return (
|2424|2424| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2425|    |-							|| (type.specific == resourceType.specific
|2426|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2425|+							|| (type.specific == resourceType.specific &&
|    |2426|+							(type.specific != "meat" || resourceTemplate == template))
|2427|2427| 						);
|2428|2428| 					});
|2429|2429| 					if (nearby)
|    | [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
|2509|2509| 					this.StartTimer(prepare, this.healTimers.repeat);
|2510|2510| 
|2511|2511| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2512|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2512|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2513|2513| 
|2514|2514| 					this.FaceTowardsTarget(this.order.data.target);
|2515|2515| 				},
|    | [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
|2724|2724| 					{
|2725|2725| 						// The building was already finished/fully repaired before we arrived;
|2726|2726| 						// let the ConstructionFinished handler handle this.
|2727|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2727|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2728|2728| 						return true;
|2729|2729| 					}
|2730|2730| 
|    | [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
|2724|2724| 					{
|2725|2725| 						// The building was already finished/fully repaired before we arrived;
|2726|2726| 						// let the ConstructionFinished handler handle this.
|2727|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2727|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2728|2728| 						return true;
|2729|2729| 					}
|2730|2730| 
|    | [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
|2765|2765| 					if (!inRange && this.MoveToTargetRange(this.repairTarget, IID_Builder))
|2766|2766| 						this.SetNextState("APPROACHING");
|2767|2767| 					else if (!inRange)
|2768|    |-						this.FinishOrder(); //can't approach and isn't in reach
|    |2768|+						this.FinishOrder(); // can't approach and isn't in reach
|2769|2769| 				},
|2770|2770| 			},
|2771|2771| 
|    | [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
|2852|2852| 
|2853|2853| 				// Unit was approaching and there's nothing to do now, so switch to walking
|2854|2854| 				if (oldState === "INDIVIDUAL.REPAIR.APPROACHING")
|2855|    |-				{
|    |2855|+				
|2856|2856| 					// We're already walking to the given point, so add this as a order.
|2857|2857| 					this.WalkToTarget(msg.data.newentity, true);
|2858|    |-				}
|    |2858|+				
|2859|2859| 			},
|2860|2860| 		},
|2861|2861| 
|    | [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
|2905|2905| 
|2906|2906| 					// Check that we can garrison here
|2907|2907| 					if (this.CanGarrison(target))
|2908|    |-					{
|    |2908|+					
|2909|2909| 						// Check that we're in range of the garrison target
|2910|2910| 						if (this.CheckGarrisonRange(target))
|2911|2911| 						{
|2981|2981| 								return false;
|2982|2982| 							}
|2983|2983| 						}
|2984|    |-					}
|    |2984|+					
|2985|2985| 					// Garrisoning failed for some reason, so finish the order
|2986|2986| 					this.FinishOrder();
|2987|2987| 					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
|3088|3088| 		"Attacked": function(msg) {
|3089|3089| 			if (this.template.NaturalBehaviour == "skittish" ||
|3090|3090| 			    this.template.NaturalBehaviour == "passive")
|3091|    |-			{
|    |3091|+			
|3092|3092| 				this.Flee(msg.data.attacker, false);
|3093|    |-			}
|    |3093|+			
|3094|3094| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|3095|3095| 			{
|3096|3096| 				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
|3097|3097| 					this.Attack(msg.data.attacker, false);
|3098|3098| 			}
|3099|3099| 			else if (this.template.NaturalBehaviour == "domestic")
|3100|    |-			{
|    |3100|+			
|3101|3101| 				// Never flee, stop what we were doing
|3102|3102| 				this.SetNextState("IDLE");
|3103|    |-			}
|    |3103|+			
|3104|3104| 		},
|3105|3105| 
|3106|3106| 		"Order.LeaveFoundation": function(msg) {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3108|3108| 			var range = 4;
|3109|3109| 			if (this.CheckTargetRangeExplicit(msg.data.target, range, range) &&
|3110|3110| 				this.MoveToTargetRangeExplicit(msg.data.target, range, range))
|3111|    |-			{
|    |3111|+			
|3112|3112| 				// We've started walking to the given point
|3113|3113| 				this.SetNextState("WALKING");
|3114|    |-			}
|    |3114|+			
|3115|3115| 			else
|3116|3116| 			{
|3117|3117| 				// We are already at the target, or can't move at all
|    | [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
|3113|3113| 				this.SetNextState("WALKING");
|3114|3114| 			}
|3115|3115| 			else
|3116|    |-			{
|    |3116|+			
|3117|3117| 				// We are already at the target, or can't move at all
|3118|3118| 				this.FinishOrder();
|3119|    |-			}
|    |3119|+			
|3120|3120| 		},
|3121|3121| 
|3122|3122| 		"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
|3155|3155| 				}
|3156|3156| 				// Start attacking one of the newly-seen enemy (if any)
|3157|3157| 				else if (this.IsDangerousAnimal())
|3158|    |-				{
|    |3158|+				
|3159|3159| 					this.AttackVisibleEntity(msg.data.added);
|3160|    |-				}
|    |3160|+				
|3161|3161| 
|3162|3162| 				// TODO: if two units enter our range together, we'll attack the
|3163|3163| 				// 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
|3198|3198| 				}
|3199|3199| 				// Start attacking one of the newly-seen enemy (if any)
|3200|3200| 				else if (this.template.NaturalBehaviour == "violent")
|3201|    |-				{
|    |3201|+				
|3202|3202| 					this.AttackVisibleEntity(msg.data.added);
|3203|    |-				}
|    |3203|+				
|3204|3204| 			},
|3205|3205| 
|3206|3206| 			"MoveCompleted": function() { },
|    | [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
|3215|3215| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3216|3216| 
|3217|3217| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3218|    |-							// only used for domestic animals
|    |3218|+		// only used for domestic animals
|3219|3219| 	},
|3220|3220| };
|3221|3221| 
|    | [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
|3272|3272| 
|3273|3273| UnitAI.prototype.IsAnimal = function()
|3274|3274| {
|3275|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3275|+	return (!!this.template.NaturalBehaviour);
|3276|3276| };
|3277|3277| 
|3278|3278| 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
|3310|3310| UnitAI.prototype.GetGarrisonHolder = function()
|3311|3311| {
|3312|3312| 	if (this.IsGarrisoned())
|3313|    |-	{
|    |3313|+	
|3314|3314| 		for (let order of this.orderQueue)
|3315|3315| 			if (order.type == "Garrison")
|3316|3316| 				return order.data.target;
|3317|    |-	}
|    |3317|+	
|3318|3318| 	return INVALID_ENTITY;
|3319|3319| };
|3320|3320| 
|    | [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
|3388|3388| 		{
|3389|3389| 			let index = this.GetCurrentState().indexOf(".");
|3390|3390| 			if (index != -1)
|3391|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3391|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3392|3392| 			this.Stop(false);
|3393|3393| 		}
|3394|3394| 
|    | [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
|3444|3444| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3445|3445| 			continue;
|3446|3446| 		if (i == 0)
|3447|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3447|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3448|3448| 		else
|3449|3449| 			this.orderQueue.splice(i, 1);
|3450|3450| 		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
|3444|3444| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3445|3445| 			continue;
|3446|3446| 		if (i == 0)
|3447|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3447|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3448|3448| 		else
|3449|3449| 			this.orderQueue.splice(i, 1);
|3450|3450| 		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
|3528|3528| };
|3529|3529| 
|3530|3530| 
|3531|    |-//// FSM linkage functions ////
|    |3531|+// // FSM linkage functions ////
|3532|3532| 
|3533|3533| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3534|3534| 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
|3700|3700| 				continue;
|3701|3701| 			if (this.orderQueue[i].type == type)
|3702|3702| 				continue;
|3703|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3703|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3704|3704| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3705|3705| 			return;
|3706|3706| 		}
|    | [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
|3700|3700| 				continue;
|3701|3701| 			if (this.orderQueue[i].type == type)
|3702|3702| 				continue;
|3703|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3703|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3704|3704| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3705|3705| 			return;
|3706|3706| 		}
|    | [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
|3714|3714| {
|3715|3715| 	// Remember the previous work orders to be able to go back to them later if required
|3716|3716| 	if (data && data.force)
|3717|    |-	{
|    |3717|+	
|3718|3718| 		if (this.IsFormationController())
|3719|3719| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3720|3720| 		else
|3721|3721| 			this.UpdateWorkOrders(type);
|3722|    |-	}
|    |3722|+	
|3723|3723| 
|3724|3724| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3725|3725| 
|    | [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
|3791|3791| 	{
|3792|3792| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3793|3793| 		if (cmpUnitAI)
|3794|    |-		{
|    |3794|+		
|3795|3795| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3796|3796| 			{
|3797|3797| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3800|3800| 					return;
|3801|3801| 				}
|3802|3802| 			}
|3803|    |-		}
|    |3803|+		
|3804|3804| 	}
|3805|3805| 
|3806|3806| 	// 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
|3793|3793| 		if (cmpUnitAI)
|3794|3794| 		{
|3795|3795| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3796|    |-			{
|    |3796|+			
|3797|3797| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3798|3798| 				{
|3799|3799| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3800|3800| 					return;
|3801|3801| 				}
|3802|    |-			}
|    |3802|+			
|3803|3803| 		}
|3804|3804| 	}
|3805|3805| 
|    | [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
|3805|3805| 
|3806|3806| 	// If nothing found, take the unit orders
|3807|3807| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3808|    |-	{
|    |3808|+	
|3809|3809| 		if (isWorkType(this.orderQueue[i].type))
|3810|3810| 		{
|3811|3811| 			this.workOrders = this.orderQueue.slice(i);
|3812|3812| 			return;
|3813|3813| 		}
|3814|    |-	}
|    |3814|+	
|3815|3815| };
|3816|3816| 
|3817|3817| 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
|3871|3871| 	if (data.timerRepeat === undefined)
|3872|3872| 		this.timer = undefined;
|3873|3873| 
|3874|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3874|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3875|3875| };
|3876|3876| 
|3877|3877| /**
|    | [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
|3871|3871| 	if (data.timerRepeat === undefined)
|3872|3872| 		this.timer = undefined;
|3873|3873| 
|3874|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3874|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3875|3875| };
|3876|3876| 
|3877|3877| /**
|    | [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
|3906|3906| 	this.timer = undefined;
|3907|3907| };
|3908|3908| 
|3909|    |-//// Message handlers /////
|    |3909|+// // Message handlers /////
|3910|3910| 
|3911|3911| UnitAI.prototype.OnMotionChanged = function(msg)
|3912|3912| {
|    | [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
|3911|3911| UnitAI.prototype.OnMotionChanged = function(msg)
|3912|3912| {
|3913|3913| 	if (msg.starting && !msg.error)
|3914|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3914|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveStarted", "data": msg});
|3915|3915| 	else if (!msg.starting || msg.error)
|3916|3916| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3917|3917| };
|    | [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
|3911|3911| UnitAI.prototype.OnMotionChanged = function(msg)
|3912|3912| {
|3913|3913| 	if (msg.starting && !msg.error)
|3914|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3914|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg });
|3915|3915| 	else if (!msg.starting || msg.error)
|3916|3916| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3917|3917| };
|    | [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
|3913|3913| 	if (msg.starting && !msg.error)
|3914|3914| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3915|3915| 	else if (!msg.starting || msg.error)
|3916|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3916|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveCompleted", "data": msg});
|3917|3917| };
|3918|3918| 
|3919|3919| UnitAI.prototype.OnGlobalConstructionFinished = 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
|3913|3913| 	if (msg.starting && !msg.error)
|3914|3914| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3915|3915| 	else if (!msg.starting || msg.error)
|3916|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3916|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg });
|3917|3917| };
|3918|3918| 
|3919|3919| UnitAI.prototype.OnGlobalConstructionFinished = 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
|3921|3921| 	// TODO: This is a bit inefficient since every unit listens to every
|3922|3922| 	// construction message - ideally we could scope it to only the one we're building
|3923|3923| 
|3924|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3924|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3925|3925| };
|3926|3926| 
|3927|3927| 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
|3921|3921| 	// TODO: This is a bit inefficient since every unit listens to every
|3922|3922| 	// construction message - ideally we could scope it to only the one we're building
|3923|3923| 
|3924|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3924|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3925|3925| };
|3926|3926| 
|3927|3927| 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
|3946|3946| 
|3947|3947| UnitAI.prototype.OnAttacked = function(msg)
|3948|3948| {
|3949|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3949|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3950|3950| };
|3951|3951| 
|3952|3952| 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
|3946|3946| 
|3947|3947| UnitAI.prototype.OnAttacked = function(msg)
|3948|3948| {
|3949|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3949|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3950|3950| };
|3951|3951| 
|3952|3952| 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
|3951|3951| 
|3952|3952| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3953|3953| {
|3954|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3954|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|3955|3955| };
|3956|3956| 
|3957|3957| 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
|3951|3951| 
|3952|3952| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3953|3953| {
|3954|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3954|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|3955|3955| };
|3956|3956| 
|3957|3957| 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
|3956|3956| 
|3957|3957| UnitAI.prototype.OnHealthChanged = function(msg)
|3958|3958| {
|3959|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3959|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|3960|3960| };
|3961|3961| 
|3962|3962| 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
|3956|3956| 
|3957|3957| UnitAI.prototype.OnHealthChanged = function(msg)
|3958|3958| {
|3959|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3959|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|3960|3960| };
|3961|3961| 
|3962|3962| 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
|3962|3962| UnitAI.prototype.OnRangeUpdate = function(msg)
|3963|3963| {
|3964|3964| 	if (msg.tag == this.losRangeQuery)
|3965|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3965|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|3966|3966| 	else if (msg.tag == this.losHealRangeQuery)
|3967|3967| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3968|3968| };
|    | [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
|3962|3962| UnitAI.prototype.OnRangeUpdate = function(msg)
|3963|3963| {
|3964|3964| 	if (msg.tag == this.losRangeQuery)
|3965|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3965|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|3966|3966| 	else if (msg.tag == this.losHealRangeQuery)
|3967|3967| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3968|3968| };
|    | [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
|3964|3964| 	if (msg.tag == this.losRangeQuery)
|3965|3965| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3966|3966| 	else if (msg.tag == this.losHealRangeQuery)
|3967|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3967|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|3968|3968| };
|3969|3969| 
|3970|3970| 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
|3964|3964| 	if (msg.tag == this.losRangeQuery)
|3965|3965| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3966|3966| 	else if (msg.tag == this.losHealRangeQuery)
|3967|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3967|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|3968|3968| };
|3969|3969| 
|3970|3970| 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
|3969|3969| 
|3970|3970| UnitAI.prototype.OnPackFinished = function(msg)
|3971|3971| {
|3972|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3972|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|3973|3973| };
|3974|3974| 
|3975|3975| //// 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
|3969|3969| 
|3970|3970| UnitAI.prototype.OnPackFinished = function(msg)
|3971|3971| {
|3972|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3972|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|3973|3973| };
|3974|3974| 
|3975|3975| //// 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
|3972|3972| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|3973|3973| };
|3974|3974| 
|3975|    |-//// Helper functions to be called by the FSM ////
|    |3975|+// // Helper functions to be called by the FSM ////
|3976|3976| 
|3977|3977| UnitAI.prototype.GetWalkSpeed = function()
|3978|3978| {
|    | [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
|4074|4074| 	if (!cmpOwnership || cmpOwnership.GetOwner() == INVALID_PLAYER)
|4075|4075| 		return undefined;
|4076|4076| 
|4077|    |-	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position)
|    |4077|+	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
|4078|4078| 	if (!cmpPosition || !cmpPosition.IsInWorld())
|4079|4079| 		return undefined;
|4080|4080| 
|    | [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
|4159|4159| 			PlaySound(name, member);
|4160|4160| 	}
|4161|4161| 	else
|4162|    |-	{
|    |4162|+	
|4163|4163| 		// Otherwise use our own sounds
|4164|4164| 		PlaySound(name, this.entity);
|4165|    |-	}
|    |4165|+	
|4166|4166| };
|4167|4167| 
|4168|4168| /*
|    | [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
|4328|4328| 	else
|4329|4329| 		// return false? Or hope you come close enough?
|4330|4330| 		var parabolicMaxRange = 0;
|4331|    |-		//return false;
|    |4331|+		// return false;
|4332|4332| 
|4333|4333| 	// the parabole changes while walking, take something in the middle
|4334|4334| 	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
|4393|4393| 	if (this.IsFormationMember())
|4394|4394| 	{
|4395|4395| 		var cmpFormationUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|4396|    |-		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation()
|4397|    |-			&& cmpFormationUnitAI.order.data.target == target)
|    |4396|+		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation() &&
|    |4397|+			cmpFormationUnitAI.order.data.target == target)
|4398|4398| 			return true;
|4399|4399| 	}
|4400|4400| 
|    | [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
|4561|4561| UnitAI.prototype.AttackEntityInZone = function(ents)
|4562|4562| {
|4563|4563| 	var target = ents.find(target =>
|4564|    |-		this.CanAttack(target)
|4565|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4564|+		this.CanAttack(target) &&
|    |4565|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4566|4566| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4567|4567| 	);
|4568|4568| 	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
|4562|4562| {
|4563|4563| 	var target = ents.find(target =>
|4564|4564| 		this.CanAttack(target)
|4565|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4566|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4565|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4566|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4567|4567| 	);
|4568|4568| 	if (!target)
|4569|4569| 		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
|4626|4626| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4627|4627| 	if (this.isGuardOf)
|4628|4628| 	{
|4629|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4629|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4630|4630| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4631|4631| 		if (cmpUnitAI && cmpAttack &&
|4632|4632| 		    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
|4630|4630| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4631|4631| 		if (cmpUnitAI && cmpAttack &&
|4632|4632| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4633|    |-				return false;
|    |4633|+			return false;
|4634|4634| 	}
|4635|4635| 
|4636|4636| 	// 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
|4635|4635| 
|4636|4636| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4637|4637| 	if (this.GetStance().respondHoldGround)
|4638|    |-	{
|    |4638|+	
|4639|4639| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4640|4640| 			return true;
|4641|    |-	}
|    |4641|+	
|4642|4642| 
|4643|4643| 	// Stop if it's left our vision range, unless we're especially persistent
|4644|4644| 	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
|4642|4642| 
|4643|4643| 	// Stop if it's left our vision range, unless we're especially persistent
|4644|4644| 	if (!this.GetStance().respondChaseBeyondVision)
|4645|    |-	{
|    |4645|+	
|4646|4646| 		if (!this.CheckTargetIsInVisionRange(target))
|4647|4647| 			return true;
|4648|    |-	}
|    |4648|+	
|4649|4649| 
|4650|4650| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4651|4651| 	// 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
|4668|4668| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4669|4669| 	if (this.isGuardOf)
|4670|4670| 	{
|4671|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4671|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4672|4672| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4673|4673| 		if (cmpUnitAI && cmpAttack &&
|4674|4674| 		    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
|4681|4681| 	return false;
|4682|4682| };
|4683|4683| 
|4684|    |-//// External interface functions ////
|    |4684|+// // External interface functions ////
|4685|4685| 
|4686|4686| UnitAI.prototype.SetFormationController = function(ent)
|4687|4687| {
|    | [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
|4691|4691| 	// of our own formation (or ourself if not in formation)
|4692|4692| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4693|4693| 	if (cmpObstruction)
|4694|    |-	{
|    |4694|+	
|4695|4695| 		if (ent == INVALID_ENTITY)
|4696|4696| 			cmpObstruction.SetControlGroup(this.entity);
|4697|4697| 		else
|4698|4698| 			cmpObstruction.SetControlGroup(ent);
|4699|    |-	}
|    |4699|+	
|4700|4700| 
|4701|4701| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4702|4702| 	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
|4834|4834| 	// if we already had an old guard order, do nothing if the target is the same
|4835|4835| 	// and the order is running, otherwise remove the previous order
|4836|4836| 	if (this.isGuardOf)
|4837|    |-	{
|    |4837|+	
|4838|4838| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4839|4839| 			return;
|4840|4840| 		else
|4841|4841| 			this.RemoveGuard();
|4842|    |-	}
|    |4842|+	
|4843|4843| 
|4844|4844| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4845|4845| };
|    | [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
|4837|4837| 	{
|4838|4838| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4839|4839| 			return;
|4840|    |-		else
|4841|    |-			this.RemoveGuard();
|    |4840|+		this.RemoveGuard();
|4842|4841| 	}
|4843|4842| 
|4844|4843| 	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
|5008|5008| 			this.WalkToTarget(target, queued);
|5009|5009| 		return;
|5010|5010| 	}
|5011|    |-	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture}, queued);
|    |5011|+	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture }, queued);
|5012|5012| };
|5013|5013| 
|5014|5014| /**
|    | [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
|5157|5157| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5158|5158| 	{
|5159|5159| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5160|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5160|+		if (cmpTrader.HasBothMarkets() &&
|5161|5161| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5162|5162| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5163|5163| 		{
|    | [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
|5438|5438| 				{
|5439|5439| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5440|5440| 					var targetClasses = this.order.data.targetClasses;
|5441|    |-					if (targetClasses.attack && cmpIdentity
|5442|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5441|+					if (targetClasses.attack && cmpIdentity &&
|    |5442|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5443|5443| 						continue;
|5444|5444| 					if (targetClasses.avoid && cmpIdentity
|5445|5445| 						&& 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
|5441|5441| 					if (targetClasses.attack && cmpIdentity
|5442|5442| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5443|5443| 						continue;
|5444|    |-					if (targetClasses.avoid && cmpIdentity
|5445|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5444|+					if (targetClasses.avoid && cmpIdentity &&
|    |5445|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5446|5446| 						continue;
|5447|5447| 					// Only used by the AIs to prevent some choices of targets
|5448|5448| 					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
|5464|5464| 		{
|5465|5465| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5466|5466| 			var targetClasses = this.order.data.targetClasses;
|5467|    |-			if (cmpIdentity && targetClasses.attack
|5468|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5467|+			if (cmpIdentity && targetClasses.attack &&
|    |5468|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5469|5469| 				continue;
|5470|5470| 			if (cmpIdentity && targetClasses.avoid
|5471|5471| 				&& 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
|5467|5467| 			if (cmpIdentity && targetClasses.attack
|5468|5468| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5469|5469| 				continue;
|5470|    |-			if (cmpIdentity && targetClasses.avoid
|5471|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5470|+			if (cmpIdentity && targetClasses.avoid &&
|    |5471|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5472|5472| 				continue;
|5473|5473| 			// Only used by the AIs to prevent some choices of targets
|5474|5474| 			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
|5610|5610| 
|5611|5611| UnitAI.prototype.SetHeldPosition = function(x, z)
|5612|5612| {
|5613|    |-	this.heldPosition = {"x": x, "z": z};
|    |5613|+	this.heldPosition = { "x": x, "z": z};
|5614|5614| };
|5615|5615| 
|5616|5616| 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
|5610|5610| 
|5611|5611| UnitAI.prototype.SetHeldPosition = function(x, z)
|5612|5612| {
|5613|    |-	this.heldPosition = {"x": x, "z": z};
|    |5613|+	this.heldPosition = {"x": x, "z": z };
|5614|5614| };
|5615|5615| 
|5616|5616| 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
|5637|5637| 	return false;
|5638|5638| };
|5639|5639| 
|5640|    |-//// Helper functions ////
|    |5640|+// // Helper functions ////
|5641|5641| 
|5642|5642| UnitAI.prototype.CanAttack = function(target)
|5643|5643| {
|    | [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
|5841|5841| 	return cmpPack && cmpPack.IsPacking();
|5842|5842| };
|5843|5843| 
|5844|    |-//// Formation specific functions ////
|    |5844|+// // Formation specific functions ////
|5845|5845| 
|5846|5846| UnitAI.prototype.IsAttackingAsFormation = function()
|5847|5847| {
|    | [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
|5846|5846| UnitAI.prototype.IsAttackingAsFormation = function()
|5847|5847| {
|5848|5848| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5849|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5850|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5849|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5850|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5851|5851| };
|5852|5852| 
|5853|5853| //// 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
|5850|5850| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5851|5851| };
|5852|5852| 
|5853|    |-//// Animal specific functions ////
|    |5853|+// // Animal specific functions ////
|5854|5854| 
|5855|5855| UnitAI.prototype.MoveRandomly = function(distance)
|5856|5856| {

binaries/data/mods/public/simulation/components/UnitAI.js
|2411| »   »   »   »   »   »   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
|3776| »   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
|4548| »   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
|4563| »   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
|4609| »   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
|4632| »   »   ····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
|5088| »   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
| 366| »   »   ····&&·(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
|1890| »   »   »   »   »   »   var·cmpFormation·=·Engine.QueryInterface(this.formationController,·IID_Formation);
|    | [NORMAL] JSHintBear:
|    | 'cmpFormation' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|2031| »   »   »   »   »   »   &&·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
|2104| »   »   »   »   »   »   »   »   ·&&·((type.generic·==·"treasure"·&&·oldType.generic·==·"treasure")
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|2169| »   »   »   »   »   »   »   »   &&·((type.generic·==·"treasure"·&&·oldType.generic·==·"treasure")
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4341| »   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
|4397| »   »   »   &&·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
|4565| »   »   &&·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
|4566| »   »   &&·(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
|5088| »   var·lastPos·=·undefined;
|    | [NORMAL] JSHintBear:
|    | It's not necessary to initialize 'lastPos' to 'undefined'.

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

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|5557| »   »   var·range·=·iid·!==·IID_Attack·?·cmpRanged.GetRange()·:·cmpRanged.GetFullAttackRange();
|    | [MAJOR] JSHintBear:
|    | Too many errors. (92% scanned).
Executing section cli...

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

Stan added a subscriber: Stan.Wed, May 8, 11:14 AM

Maybe that could be a helper function ?

/**
 * @param {entity_id_t} target - The target's entity id.
 * @param {number} range - the treshold at which the unit isn't considered "in range" anymore.
 * @param {boolean} Whether the entity should switch to APPROACHING state.
 */
UnitAI.prototype.CanApproach = function(target, range)
{
    this.CheckTargetRangeExplicit(target, range, range) && this.MoveToTargetRangeExplicit(msg.data.target, range, range);
}
binaries/data/mods/public/simulation/components/UnitAI.js
227–228

Not sure we need the braces here. Or could be an early return maybe ?

325–326

var → let.

2790

Maybe more straightforward written as:

let isInRange = this.CheckTargetRange(this.repairTarget, IID_Builder);
if (!isInRange)
{
   if (this.MoveToTargetRange(this.repairTarget, IID_Builder))
   {
      this.SetNextState("APPROACHING");
      return;
   }

   // Can't approach and isn't in reach
   this.FinishOrder(); 
}
3153

Should probably be a global constant or something. Not related to this diff I guess.

Only three ocurrences

229 let range = 4;
1326 let range = 4;
3095 var range = 4

I'm not sure a helper function is good yet. Generally, unitAI will want to do different things in the following cases:

  • Already in Range
  • Not in Range, cannot move / goal isn't reachable (and even then those two cases could be split)
  • Not in Range, can move.

So it'll look like:

If (Check Range) { [already in range do stuff] }
else if (Can Move) { [move to range] }
else { [abandon entirely, switch targets, warn player...] }

And a helper function for the first two won't help much.

Stan added a subscriber: elexis.Wed, May 8, 11:28 AM
Stan added inline comments.
binaries/data/mods/public/simulation/components/UnitAI.js
3155

I remember @elexis saying we should indent with four spaces instead of tabs for ifs statements

wraitii updated this revision to Diff 7932.Wed, May 8, 2:29 PM

Had inadvertently forgotten to put a ! in front of all explicit range checks (biggest of oofs).

This now appears to work correctly in tandem with D981, which crashes on SVN.

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

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 230| 230| 		let range = 4;
| 231| 231| 		if (!this.CheckTargetRangeExplicit(msg.data.target, range, range) &&
| 232| 232| 		    this.MoveToTargetRangeExplicit(msg.data.target, range, range))
| 233|    |-		{
|    | 233|+		
| 234| 234| 			this.SetNextState("INDIVIDUAL.WALKING");
| 235|    |-		}
|    | 235|+		
| 236| 236| 		else
| 237| 237| 		{
| 238| 238| 			// We are already at the target, or can't move at all
|    | [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
| 234| 234| 			this.SetNextState("INDIVIDUAL.WALKING");
| 235| 235| 		}
| 236| 236| 		else
| 237|    |-		{
|    | 237|+		
| 238| 238| 			// We are already at the target, or can't move at all
| 239| 239| 			this.FinishOrder();
| 240|    |-		}
|    | 240|+		
| 241| 241| 	},
| 242| 242| 
| 243| 243| 	// Individual orders:
|    | [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
| 336| 336| 
| 337| 337| 		let ok = !this.CheckTargetRange(this.order.data.target) && this.MoveToTarget(this.order.data.target);
| 338| 338| 		if (ok)
| 339|    |-		{
|    | 339|+		
| 340| 340| 			// We've started walking to the given point
| 341| 341| 			if (this.IsAnimal())
| 342| 342| 				this.SetNextState("ANIMAL.WALKING");
| 343| 343| 			else
| 344| 344| 				this.SetNextState("INDIVIDUAL.WALKING");
| 345|    |-		}
|    | 345|+		
| 346| 346| 		else
| 347| 347| 		{
| 348| 348| 			// We are already at the target, or can't move at all
|    | [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
| 364| 364| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 365| 365| 		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 366| 366| 		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 367|    |-		{
|    | 367|+		
| 368| 368| 			// we were already on the shoreline, and have not moved since
| 369| 369| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
| 370| 370| 				needToMove = false;
| 371|    |-		}
|    | 371|+		
| 372| 372| 
| 373| 373| 		// TODO: what if the units are on a cliff ? the ship will go below the cliff
| 374| 374| 		// and the units won't be able to garrison. Should go to the nearest (accessible) shore
|    | [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
| 362| 362| 		// Check if we need to move     TODO implement a better way to know if we are on the shoreline
| 363| 363| 		var needToMove = true;
| 364| 364| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 365|    |-		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 366|    |-		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
|    | 365|+		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x) &&
|    | 366|+		    (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 367| 367| 		{
| 368| 368| 			// we were already on the shoreline, and have not moved since
| 369| 369| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
|    | [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
| 373| 373| 		// TODO: what if the units are on a cliff ? the ship will go below the cliff
| 374| 374| 		// and the units won't be able to garrison. Should go to the nearest (accessible) shore
| 375| 375| 		if (needToMove && !this.CheckTargetRange(this.order.data.target) && this.MoveToTarget(this.order.data.target))
| 376|    |-		{
|    | 376|+		
| 377| 377| 			this.SetNextState("INDIVIDUAL.PICKUP.APPROACHING");
| 378|    |-		}
|    | 378|+		
| 379| 379| 		else
| 380| 380| 		{
| 381| 381| 			// We are already at the target, or can't move at all
|    | [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
| 403| 403| 		let distance = DistanceBetweenEntities(this.entity, this.order.data.target) + (+this.template.FleeDistance);
| 404| 404| 		if (!this.CheckTargetRangeExplicit(this.order.data.target, distance, distance) &&
| 405| 405| 		    this.MoveToTargetRangeExplicit(this.order.data.target, distance, distance))
| 406|    |-		{
|    | 406|+		
| 407| 407| 			// We've started fleeing from the given target
| 408| 408| 			if (this.IsAnimal())
| 409| 409| 				this.SetNextState("ANIMAL.FLEEING");
| 410| 410| 			else
| 411| 411| 				this.SetNextState("INDIVIDUAL.FLEEING");
| 412|    |-		}
|    | 412|+		
| 413| 413| 		else
| 414| 414| 		{
| 415| 415| 			// We are already at the target, or can't move at all
|    | [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
| 450| 450| 			}
| 451| 451| 
| 452| 452| 			if (this.order.data.attackType == this.oldAttackType)
| 453|    |-			{
|    | 453|+			
| 454| 454| 				if (this.IsAnimal())
| 455| 455| 					this.SetNextState("ANIMAL.COMBAT.ATTACKING");
| 456| 456| 				else
| 457| 457| 					this.SetNextState("INDIVIDUAL.COMBAT.ATTACKING");
| 458|    |-			}
|    | 458|+			
| 459| 459| 			else
| 460| 460| 			{
| 461| 461| 				if (this.IsAnimal())
|    | [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
| 457| 457| 					this.SetNextState("INDIVIDUAL.COMBAT.ATTACKING");
| 458| 458| 			}
| 459| 459| 			else
| 460|    |-			{
|    | 460|+			
| 461| 461| 				if (this.IsAnimal())
| 462| 462| 					this.SetNextState("ANIMAL.COMBAT.ATTACKING");
| 463| 463| 				else
| 464| 464| 					this.SetNextState("INDIVIDUAL.COMBAT.ATTACKING");
| 465|    |-			}
|    | 465|+			
| 466| 466| 			return;
| 467| 467| 		}
| 468| 468| 
|    | [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
| 584| 584| 					this.PushOrderFront("Walk", this.order.data.lastPos);
| 585| 585| 				}
| 586| 586| 				else
| 587|    |-				{
|    | 587|+				
| 588| 588| 					// We couldn't move there, or the target moved away
| 589| 589| 					this.FinishOrder();
| 590|    |-				}
|    | 590|+				
| 591| 591| 				return;
| 592| 592| 			}
| 593| 593| 
|    | [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
| 598| 598| 		// Try to move within range
| 599| 599| 		if (this.CheckTargetRange(this.order.data.target, IID_ResourceGatherer) &&
| 600| 600| 		    !this.MoveToTargetRange(this.order.data.target, IID_ResourceGatherer))
| 601|    |-		{
|    | 601|+		
| 602| 602| 			// We've started walking to the given point
| 603| 603| 			this.SetNextState("INDIVIDUAL.GATHER.APPROACHING");
| 604|    |-		}
|    | 604|+		
| 605| 605| 		else
| 606| 606| 		{
| 607| 607| 			// We are already at the target, or can't move at all,
|    | [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
| 677| 677| 		// Try to move within range
| 678| 678| 		if (!this.CheckTargetRange(this.order.data.target, IID_Builder) &&
| 679| 679| 		    this.MoveToTargetRange(this.order.data.target, IID_Builder))
| 680|    |-		{
|    | 680|+		
| 681| 681| 			// We've started walking to the given point
| 682| 682| 			this.SetNextState("INDIVIDUAL.REPAIR.APPROACHING");
| 683|    |-		}
|    | 683|+		
| 684| 684| 		else
| 685| 685| 		{
| 686| 686| 			// We are already at the target, or can't move at all,
|    | [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
| 713| 713| 		}
| 714| 714| 
| 715| 715| 		if (this.MoveToGarrisonRange(this.order.data.target))
| 716|    |-		{
|    | 716|+		
| 717| 717| 			this.SetNextState("INDIVIDUAL.GARRISON.APPROACHING");
| 718|    |-		}
|    | 718|+		
| 719| 719| 		else
| 720| 720| 		{
| 721| 721| 			// We do a range check before actually garrisoning
|    | [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
| 844| 844| 			if (!this.CheckTargetAttackRange(target, target))
| 845| 845| 			{
| 846| 846| 				if (this.TargetIsAlive(target) && this.CheckTargetVisible(target))
| 847|    |-				{
|    | 847|+				
| 848| 848| 					if (this.MoveToTargetAttackRange(target, target))
| 849| 849| 					{
| 850| 850| 						this.SetNextState("COMBAT.APPROACHING");
| 851| 851| 						return;
| 852| 852| 					}
| 853|    |-				}
|    | 853|+				
| 854| 854| 				this.FinishOrder();
| 855| 855| 				return;
| 856| 856| 			}
|    | [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
| 869| 869| 			}
| 870| 870| 			// Check if we are already in range, otherwise walk there
| 871| 871| 			if (!this.CheckGarrisonRange(msg.data.target))
| 872|    |-			{
|    | 872|+			
| 873| 873| 				if (!this.CheckTargetVisible(msg.data.target))
| 874| 874| 				{
| 875| 875| 					this.FinishOrder();
| 884| 884| 						return;
| 885| 885| 					}
| 886| 886| 				}
| 887|    |-			}
|    | 887|+			
| 888| 888| 
| 889| 889| 			this.SetNextState("GARRISON.GARRISONING");
| 890| 890| 		},
|    | [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
| 876| 876| 					return;
| 877| 877| 				}
| 878| 878| 				else
| 879|    |-				{
|    | 879|+				
| 880| 880| 					// Out of range; move there in formation
| 881| 881| 					if (this.MoveToGarrisonRange(msg.data.target))
| 882| 882| 					{
| 883| 883| 						this.SetNextState("GARRISON.APPROACHING");
| 884| 884| 						return;
| 885| 885| 					}
| 886|    |-				}
|    | 886|+				
| 887| 887| 			}
| 888| 888| 
| 889| 889| 			this.SetNextState("GARRISON.GARRISONING");
|    | [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
| 875| 875| 					this.FinishOrder();
| 876| 876| 					return;
| 877| 877| 				}
| 878|    |-				else
| 879|    |-				{
|    | 878|+				
| 880| 879| 					// Out of range; move there in formation
| 881| 880| 					if (this.MoveToGarrisonRange(msg.data.target))
| 882| 881| 					{
| 883| 882| 						this.SetNextState("GARRISON.APPROACHING");
| 884| 883| 						return;
| 885| 884| 					}
| 886|    |-				}
|    | 885|+				
| 887| 886| 			}
| 888| 887| 
| 889| 888| 			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
| 902| 902| 						this.PushOrderFront("Walk", msg.data.lastPos);
| 903| 903| 					}
| 904| 904| 					else
| 905|    |-					{
|    | 905|+					
| 906| 906| 						// We couldn't move there, or the target moved away
| 907| 907| 						this.FinishOrder();
| 908|    |-					}
|    | 908|+					
| 909| 909| 					return;
| 910| 910| 				}
| 911| 911| 
|    | [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
|1123|1123| 			},
|1124|1124| 		},
|1125|1125| 
|1126|    |-		"GARRISON":{
|    |1126|+		"GARRISON": {
|1127|1127| 			"enter": function() {
|1128|1128| 				// If the garrisonholder should pickup, warn it so it can take needed action
|1129|1129| 				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
|1307|1307| 			// If the controller handled an order but some members rejected it,
|1308|1308| 			// they will have no orders and be in the FORMATIONMEMBER.IDLE state.
|1309|1309| 			if (this.orderQueue.length)
|1310|    |-			{
|    |1310|+			
|1311|1311| 				// We're leaving the formation, so stop our FormationWalk order
|1312|1312| 				if (this.FinishOrder())
|1313|1313| 					return;
|1314|    |-			}
|    |1314|+			
|1315|1315| 
|1316|1316| 			// No orders left, we're an individual now
|1317|1317| 			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
|1336|1336| 			let range = 4;
|1337|1337| 			if (!this.CheckTargetRangeExplicit(msg.data.target, range, range) &&
|1338|1338| 			    this.MoveToTargetRangeExplicit(msg.data.target, range, range))
|1339|    |-			{
|    |1339|+			
|1340|1340| 				// We've started walking to the given point
|1341|1341| 				this.SetNextState("WALKINGTOPOINT");
|1342|    |-			}
|    |1342|+			
|1343|1343| 			else
|1344|1344| 			{
|1345|1345| 				// We are already at the target, or can't move at all
|    | [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
|1341|1341| 				this.SetNextState("WALKINGTOPOINT");
|1342|1342| 			}
|1343|1343| 			else
|1344|    |-			{
|    |1344|+			
|1345|1345| 				// We are already at the target, or can't move at all
|1346|1346| 				this.FinishOrder();
|1347|    |-			}
|    |1347|+			
|1348|1348| 		},
|1349|1349| 
|1350|1350| 
|    | [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
|1542|1542| 
|1543|1543| 			"LosRangeUpdate": function(msg) {
|1544|1544| 				if (this.GetStance().targetVisibleEnemies)
|1545|    |-				{
|    |1545|+				
|1546|1546| 					// Start attacking one of the newly-seen enemy (if any)
|1547|1547| 					this.AttackEntitiesByPreference(msg.data.added);
|1548|    |-				}
|    |1548|+				
|1549|1549| 			},
|1550|1550| 
|1551|1551| 			"LosHealRangeUpdate": function(msg) {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1729|1729| 						// if nothing better to do, check if the guarded needs to be healed or repaired
|1730|1730| 						var cmpHealth = Engine.QueryInterface(this.isGuardOf, IID_Health);
|1731|1731| 						if (cmpHealth && (cmpHealth.GetHitpoints() < cmpHealth.GetMaxHitpoints()))
|1732|    |-						{
|    |1732|+						
|1733|1733| 							if (this.CanHeal(this.isGuardOf))
|1734|1734| 								this.PushOrderFront("Heal", { "target": this.isGuardOf, "force": false });
|1735|1735| 							else if (this.CanRepair(this.isGuardOf))
|1736|1736| 								this.PushOrderFront("Repair", { "target": this.isGuardOf, "autocontinue": false, "force": false });
|1737|    |-						}
|    |1737|+						
|1738|1738| 					}
|1739|1739| 				},
|1740|1740| 
|    | [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
|1814|1814| 				"MoveCompleted": function() {
|1815|1815| 
|1816|1816| 					if (this.CheckTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1817|    |-					{
|    |1817|+					
|1818|1818| 						// If the unit needs to unpack, do so
|1819|1819| 						if (this.CanUnpack())
|1820|1820| 						{
|1823|1823| 						}
|1824|1824| 						else
|1825|1825| 							this.SetNextState("ATTACKING");
|1826|    |-					}
|    |1826|+					
|1827|1827| 					else
|1828|1828| 					{
|1829|1829| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|    | [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
|1821|1821| 							this.PushOrderFront("Unpack", { "force": true });
|1822|1822| 							return;
|1823|1823| 						}
|1824|    |-						else
|1825|    |-							this.SetNextState("ATTACKING");
|    |1824|+						this.SetNextState("ATTACKING");
|1826|1825| 					}
|1827|1826| 					else
|1828|1827| 					{
|    | [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
|1825|1825| 							this.SetNextState("ATTACKING");
|1826|1826| 					}
|1827|1827| 					else
|1828|    |-					{
|    |1828|+					
|1829|1829| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1830|1830| 						{
|1831|1831| 							this.SetNextState("APPROACHING");
|1835|1835| 							// Give up
|1836|1836| 							this.FinishOrder();
|1837|1837| 						}
|1838|    |-					}
|    |1838|+					
|1839|1839| 				},
|1840|1840| 			},
|1841|1841| 
|    | [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
|1827|1827| 					else
|1828|1828| 					{
|1829|1829| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1830|    |-						{
|    |1830|+						
|1831|1831| 							this.SetNextState("APPROACHING");
|1832|    |-						}
|    |1832|+						
|1833|1833| 						else
|1834|1834| 						{
|1835|1835| 							// Give up
|    | [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
|1831|1831| 							this.SetNextState("APPROACHING");
|1832|1832| 						}
|1833|1833| 						else
|1834|    |-						{
|    |1834|+						
|1835|1835| 							// Give up
|1836|1836| 							this.FinishOrder();
|1837|    |-						}
|    |1837|+						
|1838|1838| 					}
|1839|1839| 				},
|1840|1840| 			},
|    | [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
|1852|1852| 					}
|1853|1853| 					// Check the target is still alive and attackable
|1854|1854| 					if (this.CanAttack(target) && !this.CheckTargetAttackRange(target, this.order.data.attackType))
|1855|    |-					{
|    |1855|+					
|1856|1856| 						// Can't reach it - try to chase after it
|1857|1857| 						if (this.ShouldChaseTargetedEntity(target, this.order.data.force))
|1858|1858| 						{
|1867|1867| 								return;
|1868|1868| 							}
|1869|1869| 						}
|1870|    |-					}
|    |1870|+					
|1871|1871| 
|1872|1872| 					var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|1873|1873| 					this.attackTimers = cmpAttack.GetTimers(this.order.data.attackType);
|    | [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
|1898|1898| 					// TODO: we should probably only bother syncing projectile attacks, not melee
|1899|1899| 
|1900|1900| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|1901|    |-					this.resyncAnimation = (prepare != this.attackTimers.prepare) ? true : false;
|    |1901|+					this.resyncAnimation = (prepare != this.attackTimers.prepare);
|1902|1902| 
|1903|1903| 					this.FaceTowardsTarget(this.order.data.target);
|1904|1904| 
|    | [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
|2027|2027| 
|2028|2028| 				"Attacked": function(msg) {
|2029|2029| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2030|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2031|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2030|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2031|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2032|2032| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2033|2033| 				},
|2034|2034| 			},
|    | [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
|2041|2041| 					this.SelectAnimation("move");
|2042|2042| 					var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|2043|2043| 					if (cmpUnitAI && cmpUnitAI.IsFleeing())
|2044|    |-					{
|    |2044|+					
|2045|2045| 						// Run after a fleeing target
|2046|2046| 						this.SetMoveSpeedRatio(this.GetRunMultiplier());
|2047|    |-					}
|    |2047|+					
|2048|2048| 					this.StartTimer(1000, 1000);
|2049|2049| 				},
|2050|2050| 
|    | [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
|2100|2100| 						// Also don't switch to a different type of huntable animal
|2101|2101| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2102|2102| 							return (
|2103|    |-								ent != oldTarget
|2104|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2103|+								ent != oldTarget &&
|    |2104|+								 ((type.generic == "treasure" && oldType.generic == "treasure")
|2105|2105| 								 || (type.specific == oldType.specific
|2106|2106| 								 && (type.specific != "meat" || oldTemplate == template)))
|2107|2107| 							);
|    | [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
|2101|2101| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2102|2102| 							return (
|2103|2103| 								ent != oldTarget
|2104|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2105|    |-								 || (type.specific == oldType.specific
|    |2104|+								 && ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2105|+								 (type.specific == oldType.specific
|2106|2106| 								 && (type.specific != "meat" || oldTemplate == template)))
|2107|2107| 							);
|2108|2108| 						}, oldTarget);
|    | [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
|2102|2102| 							return (
|2103|2103| 								ent != oldTarget
|2104|2104| 								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2105|    |-								 || (type.specific == oldType.specific
|2106|    |-								 && (type.specific != "meat" || oldTemplate == template)))
|    |2105|+								 || (type.specific == oldType.specific &&
|    |2106|+								 (type.specific != "meat" || oldTemplate == template)))
|2107|2107| 							);
|2108|2108| 						}, oldTarget);
|2109|2109| 						if (nearby)
|    | [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
|2111|2111| 							this.PerformGather(nearby, false, false);
|2112|2112| 							return true;
|2113|2113| 						}
|2114|    |-						else
|2115|    |-						{
|    |2114|+						
|2116|2115| 							// It's probably better in this case, to avoid units getting stuck around a dropsite
|2117|2116| 							// in a "Target is far away, full, nearby are no good resources, return to dropsite" loop
|2118|2117| 							// to order it to GatherNear the resource position.
|2133|2132| 									return true;
|2134|2133| 								}
|2135|2134| 							}
|2136|    |-						}
|    |2135|+						
|2137|2136| 						return true;
|2138|2137| 					}
|2139|2138| 					return false;
|    | [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
|2123|2123| 								this.GatherNearPosition(pos.x, pos.z, oldType, oldTemplate);
|2124|2124| 								return true;
|2125|2125| 							}
|2126|    |-							else
|2127|    |-							{
|    |2126|+							
|2128|2127| 								// we're kind of stuck here. Return resource.
|2129|2128| 								var nearby = this.FindNearestDropsite(oldType.generic);
|2130|2129| 								if (nearby)
|2132|2131| 									this.PushOrderFront("ReturnResource", { "target": nearby, "force": false });
|2133|2132| 									return true;
|2134|2133| 								}
|2135|    |-							}
|    |2134|+							
|2136|2135| 						}
|2137|2136| 						return true;
|2138|2137| 					}
|    | [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
|2165|2165| 						// Also don't switch to a different type of huntable animal
|2166|2166| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2167|2167| 							return (
|2168|    |-								ent != oldTarget
|2169|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2168|+								ent != oldTarget &&
|    |2169|+								((type.generic == "treasure" && oldType.generic == "treasure")
|2170|2170| 								|| (type.specific == oldType.specific
|2171|2171| 								&& (type.specific != "meat" || oldTemplate == template)))
|2172|2172| 							);
|    | [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
|2166|2166| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2167|2167| 							return (
|2168|2168| 								ent != oldTarget
|2169|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2170|    |-								|| (type.specific == oldType.specific
|    |2169|+								&& ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2170|+								(type.specific == oldType.specific
|2171|2171| 								&& (type.specific != "meat" || oldTemplate == template)))
|2172|2172| 							);
|2173|2173| 						});
|    | [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
|2167|2167| 							return (
|2168|2168| 								ent != oldTarget
|2169|2169| 								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2170|    |-								|| (type.specific == oldType.specific
|2171|    |-								&& (type.specific != "meat" || oldTemplate == template)))
|    |2170|+								|| (type.specific == oldType.specific &&
|    |2171|+								(type.specific != "meat" || oldTemplate == template)))
|2172|2172| 							);
|2173|2173| 						});
|2174|2174| 						if (nearby)
|    | [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
|2212|2212| 					// Also don't switch to a different type of huntable animal
|2213|2213| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2214|2214| 						return (
|2215|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2216|    |-							|| (type.specific == resourceType.specific
|    |2215|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2216|+							(type.specific == resourceType.specific
|2217|2217| 							&& (type.specific != "meat" || resourceTemplate == template))
|2218|2218| 						);
|2219|2219| 					});
|    | [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
|2213|2213| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2214|2214| 						return (
|2215|2215| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2216|    |-							|| (type.specific == resourceType.specific
|2217|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2216|+							|| (type.specific == resourceType.specific &&
|    |2217|+							(type.specific != "meat" || resourceTemplate == template))
|2218|2218| 						);
|2219|2219| 					});
|2220|2220| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2329|2329| 
|2330|2330| 					var cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply);
|2331|2331| 					if (cmpSupply && cmpSupply.IsAvailable(cmpOwnership.GetOwner(), this.entity))
|2332|    |-					{
|    |2332|+					
|2333|2333| 						// Check we can still reach and gather from the target
|2334|2334| 						if (this.CheckTargetRange(this.gatheringTarget, IID_ResourceGatherer) && this.CanGather(this.gatheringTarget))
|2335|2335| 						{
|2395|2395| 								return;
|2396|2396| 							}
|2397|2397| 						}
|2398|    |-					}
|    |2398|+					
|2399|2399| 
|2400|2400| 					// We're already in range, can't get anywhere near it or the target is exhausted.
|2401|2401| 
|    | [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
|2421|2421| 					// Also don't switch to a different type of huntable animal
|2422|2422| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2423|2423| 						return (
|2424|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2425|    |-							|| (type.specific == resourceType.specific
|    |2424|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2425|+							(type.specific == resourceType.specific
|2426|2426| 							&& (type.specific != "meat" || resourceTemplate == template))
|2427|2427| 						);
|2428|2428| 					});
|    | [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
|2422|2422| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2423|2423| 						return (
|2424|2424| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2425|    |-							|| (type.specific == resourceType.specific
|2426|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2425|+							|| (type.specific == resourceType.specific &&
|    |2426|+							(type.specific != "meat" || resourceTemplate == template))
|2427|2427| 						);
|2428|2428| 					});
|2429|2429| 					if (nearby)
|    | [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
|2509|2509| 					this.StartTimer(prepare, this.healTimers.repeat);
|2510|2510| 
|2511|2511| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2512|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2512|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2513|2513| 
|2514|2514| 					this.FaceTowardsTarget(this.order.data.target);
|2515|2515| 				},
|    | [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
|2724|2724| 					{
|2725|2725| 						// The building was already finished/fully repaired before we arrived;
|2726|2726| 						// let the ConstructionFinished handler handle this.
|2727|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2727|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2728|2728| 						return true;
|2729|2729| 					}
|2730|2730| 
|    | [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
|2724|2724| 					{
|2725|2725| 						// The building was already finished/fully repaired before we arrived;
|2726|2726| 						// let the ConstructionFinished handler handle this.
|2727|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2727|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2728|2728| 						return true;
|2729|2729| 					}
|2730|2730| 
|    | [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
|2765|2765| 					if (!inRange && this.MoveToTargetRange(this.repairTarget, IID_Builder))
|2766|2766| 						this.SetNextState("APPROACHING");
|2767|2767| 					else if (!inRange)
|2768|    |-						this.FinishOrder(); //can't approach and isn't in reach
|    |2768|+						this.FinishOrder(); // can't approach and isn't in reach
|2769|2769| 				},
|2770|2770| 			},
|2771|2771| 
|    | [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
|2852|2852| 
|2853|2853| 				// Unit was approaching and there's nothing to do now, so switch to walking
|2854|2854| 				if (oldState === "INDIVIDUAL.REPAIR.APPROACHING")
|2855|    |-				{
|    |2855|+				
|2856|2856| 					// We're already walking to the given point, so add this as a order.
|2857|2857| 					this.WalkToTarget(msg.data.newentity, true);
|2858|    |-				}
|    |2858|+				
|2859|2859| 			},
|2860|2860| 		},
|2861|2861| 
|    | [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
|2905|2905| 
|2906|2906| 					// Check that we can garrison here
|2907|2907| 					if (this.CanGarrison(target))
|2908|    |-					{
|    |2908|+					
|2909|2909| 						// Check that we're in range of the garrison target
|2910|2910| 						if (this.CheckGarrisonRange(target))
|2911|2911| 						{
|2981|2981| 								return false;
|2982|2982| 							}
|2983|2983| 						}
|2984|    |-					}
|    |2984|+					
|2985|2985| 					// Garrisoning failed for some reason, so finish the order
|2986|2986| 					this.FinishOrder();
|2987|2987| 					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
|3088|3088| 		"Attacked": function(msg) {
|3089|3089| 			if (this.template.NaturalBehaviour == "skittish" ||
|3090|3090| 			    this.template.NaturalBehaviour == "passive")
|3091|    |-			{
|    |3091|+			
|3092|3092| 				this.Flee(msg.data.attacker, false);
|3093|    |-			}
|    |3093|+			
|3094|3094| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|3095|3095| 			{
|3096|3096| 				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
|3097|3097| 					this.Attack(msg.data.attacker, false);
|3098|3098| 			}
|3099|3099| 			else if (this.template.NaturalBehaviour == "domestic")
|3100|    |-			{
|    |3100|+			
|3101|3101| 				// Never flee, stop what we were doing
|3102|3102| 				this.SetNextState("IDLE");
|3103|    |-			}
|    |3103|+			
|3104|3104| 		},
|3105|3105| 
|3106|3106| 		"Order.LeaveFoundation": function(msg) {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3108|3108| 			var range = 4;
|3109|3109| 			if (!this.CheckTargetRangeExplicit(msg.data.target, range, range) &&
|3110|3110| 				this.MoveToTargetRangeExplicit(msg.data.target, range, range))
|3111|    |-			{
|    |3111|+			
|3112|3112| 				// We've started walking to the given point
|3113|3113| 				this.SetNextState("WALKING");
|3114|    |-			}
|    |3114|+			
|3115|3115| 			else
|3116|3116| 			{
|3117|3117| 				// We are already at the target, or can't move at all
|    | [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
|3113|3113| 				this.SetNextState("WALKING");
|3114|3114| 			}
|3115|3115| 			else
|3116|    |-			{
|    |3116|+			
|3117|3117| 				// We are already at the target, or can't move at all
|3118|3118| 				this.FinishOrder();
|3119|    |-			}
|    |3119|+			
|3120|3120| 		},
|3121|3121| 
|3122|3122| 		"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
|3155|3155| 				}
|3156|3156| 				// Start attacking one of the newly-seen enemy (if any)
|3157|3157| 				else if (this.IsDangerousAnimal())
|3158|    |-				{
|    |3158|+				
|3159|3159| 					this.AttackVisibleEntity(msg.data.added);
|3160|    |-				}
|    |3160|+				
|3161|3161| 
|3162|3162| 				// TODO: if two units enter our range together, we'll attack the
|3163|3163| 				// 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
|3198|3198| 				}
|3199|3199| 				// Start attacking one of the newly-seen enemy (if any)
|3200|3200| 				else if (this.template.NaturalBehaviour == "violent")
|3201|    |-				{
|    |3201|+				
|3202|3202| 					this.AttackVisibleEntity(msg.data.added);
|3203|    |-				}
|    |3203|+				
|3204|3204| 			},
|3205|3205| 
|3206|3206| 			"MoveCompleted": function() { },
|    | [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
|3215|3215| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3216|3216| 
|3217|3217| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3218|    |-							// only used for domestic animals
|    |3218|+		// only used for domestic animals
|3219|3219| 	},
|3220|3220| };
|3221|3221| 
|    | [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
|3272|3272| 
|3273|3273| UnitAI.prototype.IsAnimal = function()
|3274|3274| {
|3275|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3275|+	return (!!this.template.NaturalBehaviour);
|3276|3276| };
|3277|3277| 
|3278|3278| 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
|3310|3310| UnitAI.prototype.GetGarrisonHolder = function()
|3311|3311| {
|3312|3312| 	if (this.IsGarrisoned())
|3313|    |-	{
|    |3313|+	
|3314|3314| 		for (let order of this.orderQueue)
|3315|3315| 			if (order.type == "Garrison")
|3316|3316| 				return order.data.target;
|3317|    |-	}
|    |3317|+	
|3318|3318| 	return INVALID_ENTITY;
|3319|3319| };
|3320|3320| 
|    | [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
|3388|3388| 		{
|3389|3389| 			let index = this.GetCurrentState().indexOf(".");
|3390|3390| 			if (index != -1)
|3391|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3391|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3392|3392| 			this.Stop(false);
|3393|3393| 		}
|3394|3394| 
|    | [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
|3444|3444| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3445|3445| 			continue;
|3446|3446| 		if (i == 0)
|3447|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3447|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3448|3448| 		else
|3449|3449| 			this.orderQueue.splice(i, 1);
|3450|3450| 		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
|3444|3444| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3445|3445| 			continue;
|3446|3446| 		if (i == 0)
|3447|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3447|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3448|3448| 		else
|3449|3449| 			this.orderQueue.splice(i, 1);
|3450|3450| 		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
|3528|3528| };
|3529|3529| 
|3530|3530| 
|3531|    |-//// FSM linkage functions ////
|    |3531|+// // FSM linkage functions ////
|3532|3532| 
|3533|3533| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3534|3534| 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
|3700|3700| 				continue;
|3701|3701| 			if (this.orderQueue[i].type == type)
|3702|3702| 				continue;
|3703|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3703|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3704|3704| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3705|3705| 			return;
|3706|3706| 		}
|    | [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
|3700|3700| 				continue;
|3701|3701| 			if (this.orderQueue[i].type == type)
|3702|3702| 				continue;
|3703|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3703|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3704|3704| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3705|3705| 			return;
|3706|3706| 		}
|    | [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
|3714|3714| {
|3715|3715| 	// Remember the previous work orders to be able to go back to them later if required
|3716|3716| 	if (data && data.force)
|3717|    |-	{
|    |3717|+	
|3718|3718| 		if (this.IsFormationController())
|3719|3719| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3720|3720| 		else
|3721|3721| 			this.UpdateWorkOrders(type);
|3722|    |-	}
|    |3722|+	
|3723|3723| 
|3724|3724| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3725|3725| 
|    | [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
|3791|3791| 	{
|3792|3792| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3793|3793| 		if (cmpUnitAI)
|3794|    |-		{
|    |3794|+		
|3795|3795| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3796|3796| 			{
|3797|3797| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3800|3800| 					return;
|3801|3801| 				}
|3802|3802| 			}
|3803|    |-		}
|    |3803|+		
|3804|3804| 	}
|3805|3805| 
|3806|3806| 	// 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
|3793|3793| 		if (cmpUnitAI)
|3794|3794| 		{
|3795|3795| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3796|    |-			{
|    |3796|+			
|3797|3797| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3798|3798| 				{
|3799|3799| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3800|3800| 					return;
|3801|3801| 				}
|3802|    |-			}
|    |3802|+			
|3803|3803| 		}
|3804|3804| 	}
|3805|3805| 
|    | [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
|3805|3805| 
|3806|3806| 	// If nothing found, take the unit orders
|3807|3807| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3808|    |-	{
|    |3808|+	
|3809|3809| 		if (isWorkType(this.orderQueue[i].type))
|3810|3810| 		{
|3811|3811| 			this.workOrders = this.orderQueue.slice(i);
|3812|3812| 			return;
|3813|3813| 		}
|3814|    |-	}
|    |3814|+	
|3815|3815| };
|3816|3816| 
|3817|3817| 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
|3871|3871| 	if (data.timerRepeat === undefined)
|3872|3872| 		this.timer = undefined;
|3873|3873| 
|3874|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3874|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3875|3875| };
|3876|3876| 
|3877|3877| /**
|    | [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
|3871|3871| 	if (data.timerRepeat === undefined)
|3872|3872| 		this.timer = undefined;
|3873|3873| 
|3874|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3874|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3875|3875| };
|3876|3876| 
|3877|3877| /**
|    | [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
|3906|3906| 	this.timer = undefined;
|3907|3907| };
|3908|3908| 
|3909|    |-//// Message handlers /////
|    |3909|+// // Message handlers /////
|3910|3910| 
|3911|3911| UnitAI.prototype.OnMotionChanged = function(msg)
|3912|3912| {
|    | [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
|3911|3911| UnitAI.prototype.OnMotionChanged = function(msg)
|3912|3912| {
|3913|3913| 	if (msg.starting && !msg.error)
|3914|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3914|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveStarted", "data": msg});
|3915|3915| 	else if (!msg.starting || msg.error)
|3916|3916| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3917|3917| };
|    | [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
|3911|3911| UnitAI.prototype.OnMotionChanged = function(msg)
|3912|3912| {
|3913|3913| 	if (msg.starting && !msg.error)
|3914|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3914|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg });
|3915|3915| 	else if (!msg.starting || msg.error)
|3916|3916| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3917|3917| };
|    | [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
|3913|3913| 	if (msg.starting && !msg.error)
|3914|3914| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3915|3915| 	else if (!msg.starting || msg.error)
|3916|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3916|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveCompleted", "data": msg});
|3917|3917| };
|3918|3918| 
|3919|3919| UnitAI.prototype.OnGlobalConstructionFinished = 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
|3913|3913| 	if (msg.starting && !msg.error)
|3914|3914| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3915|3915| 	else if (!msg.starting || msg.error)
|3916|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3916|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg });
|3917|3917| };
|3918|3918| 
|3919|3919| UnitAI.prototype.OnGlobalConstructionFinished = 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
|3921|3921| 	// TODO: This is a bit inefficient since every unit listens to every
|3922|3922| 	// construction message - ideally we could scope it to only the one we're building
|3923|3923| 
|3924|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3924|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3925|3925| };
|3926|3926| 
|3927|3927| 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
|3921|3921| 	// TODO: This is a bit inefficient since every unit listens to every
|3922|3922| 	// construction message - ideally we could scope it to only the one we're building
|3923|3923| 
|3924|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3924|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3925|3925| };
|3926|3926| 
|3927|3927| 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
|3946|3946| 
|3947|3947| UnitAI.prototype.OnAttacked = function(msg)
|3948|3948| {
|3949|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3949|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3950|3950| };
|3951|3951| 
|3952|3952| 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
|3946|3946| 
|3947|3947| UnitAI.prototype.OnAttacked = function(msg)
|3948|3948| {
|3949|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3949|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3950|3950| };
|3951|3951| 
|3952|3952| 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
|3951|3951| 
|3952|3952| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3953|3953| {
|3954|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3954|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|3955|3955| };
|3956|3956| 
|3957|3957| 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
|3951|3951| 
|3952|3952| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3953|3953| {
|3954|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3954|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|3955|3955| };
|3956|3956| 
|3957|3957| 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
|3956|3956| 
|3957|3957| UnitAI.prototype.OnHealthChanged = function(msg)
|3958|3958| {
|3959|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3959|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|3960|3960| };
|3961|3961| 
|3962|3962| 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
|3956|3956| 
|3957|3957| UnitAI.prototype.OnHealthChanged = function(msg)
|3958|3958| {
|3959|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3959|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|3960|3960| };
|3961|3961| 
|3962|3962| 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
|3962|3962| UnitAI.prototype.OnRangeUpdate = function(msg)
|3963|3963| {
|3964|3964| 	if (msg.tag == this.losRangeQuery)
|3965|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3965|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|3966|3966| 	else if (msg.tag == this.losHealRangeQuery)
|3967|3967| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3968|3968| };
|    | [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
|3962|3962| UnitAI.prototype.OnRangeUpdate = function(msg)
|3963|3963| {
|3964|3964| 	if (msg.tag == this.losRangeQuery)
|3965|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3965|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|3966|3966| 	else if (msg.tag == this.losHealRangeQuery)
|3967|3967| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3968|3968| };
|    | [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
|3964|3964| 	if (msg.tag == this.losRangeQuery)
|3965|3965| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3966|3966| 	else if (msg.tag == this.losHealRangeQuery)
|3967|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3967|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|3968|3968| };
|3969|3969| 
|3970|3970| 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
|3964|3964| 	if (msg.tag == this.losRangeQuery)
|3965|3965| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3966|3966| 	else if (msg.tag == this.losHealRangeQuery)
|3967|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3967|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|3968|3968| };
|3969|3969| 
|3970|3970| 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
|3969|3969| 
|3970|3970| UnitAI.prototype.OnPackFinished = function(msg)
|3971|3971| {
|3972|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3972|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|3973|3973| };
|3974|3974| 
|3975|3975| //// 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
|3969|3969| 
|3970|3970| UnitAI.prototype.OnPackFinished = function(msg)
|3971|3971| {
|3972|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3972|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|3973|3973| };
|3974|3974| 
|3975|3975| //// 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
|3972|3972| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|3973|3973| };
|3974|3974| 
|3975|    |-//// Helper functions to be called by the FSM ////
|    |3975|+// // Helper functions to be called by the FSM ////
|3976|3976| 
|3977|3977| UnitAI.prototype.GetWalkSpeed = function()
|3978|3978| {
|    | [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
|4074|4074| 	if (!cmpOwnership || cmpOwnership.GetOwner() == INVALID_PLAYER)
|4075|4075| 		return undefined;
|4076|4076| 
|4077|    |-	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position)
|    |4077|+	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
|4078|4078| 	if (!cmpPosition || !cmpPosition.IsInWorld())
|4079|4079| 		return undefined;
|4080|4080| 
|    | [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
|4159|4159| 			PlaySound(name, member);
|4160|4160| 	}
|4161|4161| 	else
|4162|    |-	{
|    |4162|+	
|4163|4163| 		// Otherwise use our own sounds
|4164|4164| 		PlaySound(name, this.entity);
|4165|    |-	}
|    |4165|+	
|4166|4166| };
|4167|4167| 
|4168|4168| /*
|    | [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
|4328|4328| 	else
|4329|4329| 		// return false? Or hope you come close enough?
|4330|4330| 		var parabolicMaxRange = 0;
|4331|    |-		//return false;
|    |4331|+		// return false;
|4332|4332| 
|4333|4333| 	// the parabole changes while walking, take something in the middle
|4334|4334| 	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
|4393|4393| 	if (this.IsFormationMember())
|4394|4394| 	{
|4395|4395| 		var cmpFormationUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|4396|    |-		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation()
|4397|    |-			&& cmpFormationUnitAI.order.data.target == target)
|    |4396|+		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation() &&
|    |4397|+			cmpFormationUnitAI.order.data.target == target)
|4398|4398| 			return true;
|4399|4399| 	}
|4400|4400| 
|    | [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
|4561|4561| UnitAI.prototype.AttackEntityInZone = function(ents)
|4562|4562| {
|4563|4563| 	var target = ents.find(target =>
|4564|    |-		this.CanAttack(target)
|4565|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4564|+		this.CanAttack(target) &&
|    |4565|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4566|4566| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4567|4567| 	);
|4568|4568| 	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
|4562|4562| {
|4563|4563| 	var target = ents.find(target =>
|4564|4564| 		this.CanAttack(target)
|4565|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4566|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4565|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4566|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4567|4567| 	);
|4568|4568| 	if (!target)
|4569|4569| 		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
|4626|4626| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4627|4627| 	if (this.isGuardOf)
|4628|4628| 	{
|4629|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4629|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4630|4630| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4631|4631| 		if (cmpUnitAI && cmpAttack &&
|4632|4632| 		    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
|4630|4630| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4631|4631| 		if (cmpUnitAI && cmpAttack &&
|4632|4632| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4633|    |-				return false;
|    |4633|+			return false;
|4634|4634| 	}
|4635|4635| 
|4636|4636| 	// 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
|4635|4635| 
|4636|4636| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4637|4637| 	if (this.GetStance().respondHoldGround)
|4638|    |-	{
|    |4638|+	
|4639|4639| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4640|4640| 			return true;
|4641|    |-	}
|    |4641|+	
|4642|4642| 
|4643|4643| 	// Stop if it's left our vision range, unless we're especially persistent
|4644|4644| 	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
|4642|4642| 
|4643|4643| 	// Stop if it's left our vision range, unless we're especially persistent
|4644|4644| 	if (!this.GetStance().respondChaseBeyondVision)
|4645|    |-	{
|    |4645|+	
|4646|4646| 		if (!this.CheckTargetIsInVisionRange(target))
|4647|4647| 			return true;
|4648|    |-	}
|    |4648|+	
|4649|4649| 
|4650|4650| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4651|4651| 	// 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
|4668|4668| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4669|4669| 	if (this.isGuardOf)
|4670|4670| 	{
|4671|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4671|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4672|4672| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4673|4673| 		if (cmpUnitAI && cmpAttack &&
|4674|4674| 		    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
|4681|4681| 	return false;
|4682|4682| };
|4683|4683| 
|4684|    |-//// External interface functions ////
|    |4684|+// // External interface functions ////
|4685|4685| 
|4686|4686| UnitAI.prototype.SetFormationController = function(ent)
|4687|4687| {
|    | [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
|4691|4691| 	// of our own formation (or ourself if not in formation)
|4692|4692| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4693|4693| 	if (cmpObstruction)
|4694|    |-	{
|    |4694|+	
|4695|4695| 		if (ent == INVALID_ENTITY)
|4696|4696| 			cmpObstruction.SetControlGroup(this.entity);
|4697|4697| 		else
|4698|4698| 			cmpObstruction.SetControlGroup(ent);
|4699|    |-	}
|    |4699|+	
|4700|4700| 
|4701|4701| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4702|4702| 	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
|4834|4834| 	// if we already had an old guard order, do nothing if the target is the same
|4835|4835| 	// and the order is running, otherwise remove the previous order
|4836|4836| 	if (this.isGuardOf)
|4837|    |-	{
|    |4837|+	
|4838|4838| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4839|4839| 			return;
|4840|4840| 		else
|4841|4841| 			this.RemoveGuard();
|4842|    |-	}
|    |4842|+	
|4843|4843| 
|4844|4844| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4845|4845| };
|    | [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
|4837|4837| 	{
|4838|4838| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4839|4839| 			return;
|4840|    |-		else
|4841|    |-			this.RemoveGuard();
|    |4840|+		this.RemoveGuard();
|4842|4841| 	}
|4843|4842| 
|4844|4843| 	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
|5008|5008| 			this.WalkToTarget(target, queued);
|5009|5009| 		return;
|5010|5010| 	}
|5011|    |-	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture}, queued);
|    |5011|+	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture }, queued);
|5012|5012| };
|5013|5013| 
|5014|5014| /**
|    | [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
|5157|5157| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5158|5158| 	{
|5159|5159| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5160|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5160|+		if (cmpTrader.HasBothMarkets() &&
|5161|5161| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5162|5162| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5163|5163| 		{
|    | [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
|5438|5438| 				{
|5439|5439| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5440|5440| 					var targetClasses = this.order.data.targetClasses;
|5441|    |-					if (targetClasses.attack && cmpIdentity
|5442|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5441|+					if (targetClasses.attack && cmpIdentity &&
|    |5442|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5443|5443| 						continue;
|5444|5444| 					if (targetClasses.avoid && cmpIdentity
|5445|5445| 						&& 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
|5441|5441| 					if (targetClasses.attack && cmpIdentity
|5442|5442| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5443|5443| 						continue;
|5444|    |-					if (targetClasses.avoid && cmpIdentity
|5445|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5444|+					if (targetClasses.avoid && cmpIdentity &&
|    |5445|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5446|5446| 						continue;
|5447|5447| 					// Only used by the AIs to prevent some choices of targets
|5448|5448| 					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
|5464|5464| 		{
|5465|5465| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5466|5466| 			var targetClasses = this.order.data.targetClasses;
|5467|    |-			if (cmpIdentity && targetClasses.attack
|5468|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5467|+			if (cmpIdentity && targetClasses.attack &&
|    |5468|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5469|5469| 				continue;
|5470|5470| 			if (cmpIdentity && targetClasses.avoid
|5471|5471| 				&& 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
|5467|5467| 			if (cmpIdentity && targetClasses.attack
|5468|5468| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5469|5469| 				continue;
|5470|    |-			if (cmpIdentity && targetClasses.avoid
|5471|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5470|+			if (cmpIdentity && targetClasses.avoid &&
|    |5471|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5472|5472| 				continue;
|5473|5473| 			// Only used by the AIs to prevent some choices of targets
|5474|5474| 			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
|5610|5610| 
|5611|5611| UnitAI.prototype.SetHeldPosition = function(x, z)
|5612|5612| {
|5613|    |-	this.heldPosition = {"x": x, "z": z};
|    |5613|+	this.heldPosition = { "x": x, "z": z};
|5614|5614| };
|5615|5615| 
|5616|5616| 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
|5610|5610| 
|5611|5611| UnitAI.prototype.SetHeldPosition = function(x, z)
|5612|5612| {
|5613|    |-	this.heldPosition = {"x": x, "z": z};
|    |5613|+	this.heldPosition = {"x": x, "z": z };
|5614|5614| };
|5615|5615| 
|5616|5616| 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
|5637|5637| 	return false;
|5638|5638| };
|5639|5639| 
|5640|    |-//// Helper functions ////
|    |5640|+// // Helper functions ////
|5641|5641| 
|5642|5642| UnitAI.prototype.CanAttack = function(target)
|5643|5643| {
|    | [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
|5841|5841| 	return cmpPack && cmpPack.IsPacking();
|5842|5842| };
|5843|5843| 
|5844|    |-//// Formation specific functions ////
|    |5844|+// // Formation specific functions ////
|5845|5845| 
|5846|5846| UnitAI.prototype.IsAttackingAsFormation = function()
|5847|5847| {
|    | [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
|5846|5846| UnitAI.prototype.IsAttackingAsFormation = function()
|5847|5847| {
|5848|5848| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5849|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5850|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5849|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5850|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5851|5851| };
|5852|5852| 
|5853|5853| //// 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
|5850|5850| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5851|5851| };
|5852|5852| 
|5853|    |-//// Animal specific functions ////
|    |5853|+// // Animal specific functions ////
|5854|5854| 
|5855|5855| UnitAI.prototype.MoveRandomly = function(distance)
|5856|5856| {

binaries/data/mods/public/simulation/components/UnitAI.js
|2411| »   »   »   »   »   »   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
|3776| »   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
|4548| »   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
|4563| »   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
|4609| »   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
|4632| »   »   ····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
|5088| »   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
| 366| »   »   ····&&·(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
|1890| »   »   »   »   »   »   var·cmpFormation·=·Engine.QueryInterface(this.formationController,·IID_Formation);
|    | [NORMAL] JSHintBear:
|    | 'cmpFormation' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|2031| »   »   »   »   »   »   &&·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
|2104| »   »   »   »   »   »   »   »   ·&&·((type.generic·==·"treasure"·&&·oldType.generic·==·"treasure")
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|2169| »   »   »   »   »   »   »   »   &&·((type.generic·==·"treasure"·&&·oldType.generic·==·"treasure")
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4341| »   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
|4397| »   »   »   &&·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
|4565| »   »   &&·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
|4566| »   »   &&·(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
|5088| »   var·lastPos·=·undefined;
|    | [NORMAL] JSHintBear:
|    | It's not necessary to initialize 'lastPos' to 'undefined'.

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|5554| »   »   var·cmpRanged·=·Engine.QueryInterface(this.entity,·iid);
|    | [MAJOR] JSHintBear:
|    | Too many errors. (92% scanned).
Executing section cli...

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

Stan added inline comments.Wed, May 8, 3:24 PM
binaries/data/mods/public/simulation/components/UnitAI.js
325–326

Actually, that variable could be inlined.

325–326

Could be a ternary.

364–365

Does that affect the todo on top ?

wraitii added inline comments.Wed, May 8, 3:36 PM
binaries/data/mods/public/simulation/components/UnitAI.js
364–365

Nope, that would be the global region thingy I guess.

wraitii updated this revision to Diff 7972.Sat, May 11, 6:45 PM

CheckTargetRange requires an interface so use explicit in two cases.

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
| 230| 230| 		let range = 4;
| 231| 231| 		if (!this.CheckTargetRangeExplicit(msg.data.target, range, range) &&
| 232| 232| 		    this.MoveToTargetRangeExplicit(msg.data.target, range, range))
| 233|    |-		{
|    | 233|+		
| 234| 234| 			this.SetNextState("INDIVIDUAL.WALKING");
| 235|    |-		}
|    | 235|+		
| 236| 236| 		else
| 237| 237| 		{
| 238| 238| 			// We are already at the target, or can't move at all
|    | [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
| 234| 234| 			this.SetNextState("INDIVIDUAL.WALKING");
| 235| 235| 		}
| 236| 236| 		else
| 237|    |-		{
|    | 237|+		
| 238| 238| 			// We are already at the target, or can't move at all
| 239| 239| 			this.FinishOrder();
| 240|    |-		}
|    | 240|+		
| 241| 241| 	},
| 242| 242| 
| 243| 243| 	// Individual orders:
|    | [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
| 336| 336| 
| 337| 337| 		let ok = !this.CheckTargetRangeExplicit(this.order.data.target, 0, 0) && this.MoveToTarget(this.order.data.target);
| 338| 338| 		if (ok)
| 339|    |-		{
|    | 339|+		
| 340| 340| 			// We've started walking to the given point
| 341| 341| 			if (this.IsAnimal())
| 342| 342| 				this.SetNextState("ANIMAL.WALKING");
| 343| 343| 			else
| 344| 344| 				this.SetNextState("INDIVIDUAL.WALKING");
| 345|    |-		}
|    | 345|+		
| 346| 346| 		else
| 347| 347| 		{
| 348| 348| 			// We are already at the target, or can't move at all
|    | [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
| 364| 364| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 365| 365| 		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 366| 366| 		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 367|    |-		{
|    | 367|+		
| 368| 368| 			// we were already on the shoreline, and have not moved since
| 369| 369| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
| 370| 370| 				needToMove = false;
| 371|    |-		}
|    | 371|+		
| 372| 372| 
| 373| 373| 		// TODO: what if the units are on a cliff ? the ship will go below the cliff
| 374| 374| 		// and the units won't be able to garrison. Should go to the nearest (accessible) shore
|    | [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
| 362| 362| 		// Check if we need to move     TODO implement a better way to know if we are on the shoreline
| 363| 363| 		var needToMove = true;
| 364| 364| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 365|    |-		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 366|    |-		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
|    | 365|+		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x) &&
|    | 366|+		    (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 367| 367| 		{
| 368| 368| 			// we were already on the shoreline, and have not moved since
| 369| 369| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
|    | [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
| 373| 373| 		// TODO: what if the units are on a cliff ? the ship will go below the cliff
| 374| 374| 		// and the units won't be able to garrison. Should go to the nearest (accessible) shore
| 375| 375| 		if (needToMove && !this.CheckTargetRangeExplicit(this.order.data.target, 0, 0) && this.MoveToTarget(this.order.data.target))
| 376|    |-		{
|    | 376|+		
| 377| 377| 			this.SetNextState("INDIVIDUAL.PICKUP.APPROACHING");
| 378|    |-		}
|    | 378|+		
| 379| 379| 		else
| 380| 380| 		{
| 381| 381| 			// We are already at the target, or can't move at all
|    | [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
| 403| 403| 		let distance = DistanceBetweenEntities(this.entity, this.order.data.target) + (+this.template.FleeDistance);
| 404| 404| 		if (!this.CheckTargetRangeExplicit(this.order.data.target, distance, distance) &&
| 405| 405| 		    this.MoveToTargetRangeExplicit(this.order.data.target, distance, distance))
| 406|    |-		{
|    | 406|+		
| 407| 407| 			// We've started fleeing from the given target
| 408| 408| 			if (this.IsAnimal())
| 409| 409| 				this.SetNextState("ANIMAL.FLEEING");
| 410| 410| 			else
| 411| 411| 				this.SetNextState("INDIVIDUAL.FLEEING");
| 412|    |-		}
|    | 412|+		
| 413| 413| 		else
| 414| 414| 		{
| 415| 415| 			// We are already at the target, or can't move at all
|    | [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
| 450| 450| 			}
| 451| 451| 
| 452| 452| 			if (this.order.data.attackType == this.oldAttackType)
| 453|    |-			{
|    | 453|+			
| 454| 454| 				if (this.IsAnimal())
| 455| 455| 					this.SetNextState("ANIMAL.COMBAT.ATTACKING");
| 456| 456| 				else
| 457| 457| 					this.SetNextState("INDIVIDUAL.COMBAT.ATTACKING");
| 458|    |-			}
|    | 458|+			
| 459| 459| 			else
| 460| 460| 			{
| 461| 461| 				if (this.IsAnimal())
|    | [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
| 457| 457| 					this.SetNextState("INDIVIDUAL.COMBAT.ATTACKING");
| 458| 458| 			}
| 459| 459| 			else
| 460|    |-			{
|    | 460|+			
| 461| 461| 				if (this.IsAnimal())
| 462| 462| 					this.SetNextState("ANIMAL.COMBAT.ATTACKING");
| 463| 463| 				else
| 464| 464| 					this.SetNextState("INDIVIDUAL.COMBAT.ATTACKING");
| 465|    |-			}
|    | 465|+			
| 466| 466| 			return;
| 467| 467| 		}
| 468| 468| 
|    | [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
| 584| 584| 					this.PushOrderFront("Walk", this.order.data.lastPos);
| 585| 585| 				}
| 586| 586| 				else
| 587|    |-				{
|    | 587|+				
| 588| 588| 					// We couldn't move there, or the target moved away
| 589| 589| 					this.FinishOrder();
| 590|    |-				}
|    | 590|+				
| 591| 591| 				return;
| 592| 592| 			}
| 593| 593| 
|    | [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
| 598| 598| 		// Try to move within range
| 599| 599| 		if (this.CheckTargetRange(this.order.data.target, IID_ResourceGatherer) &&
| 600| 600| 		    !this.MoveToTargetRange(this.order.data.target, IID_ResourceGatherer))
| 601|    |-		{
|    | 601|+		
| 602| 602| 			// We've started walking to the given point
| 603| 603| 			this.SetNextState("INDIVIDUAL.GATHER.APPROACHING");
| 604|    |-		}
|    | 604|+		
| 605| 605| 		else
| 606| 606| 		{
| 607| 607| 			// We are already at the target, or can't move at all,
|    | [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
| 677| 677| 		// Try to move within range
| 678| 678| 		if (!this.CheckTargetRange(this.order.data.target, IID_Builder) &&
| 679| 679| 		    this.MoveToTargetRange(this.order.data.target, IID_Builder))
| 680|    |-		{
|    | 680|+		
| 681| 681| 			// We've started walking to the given point
| 682| 682| 			this.SetNextState("INDIVIDUAL.REPAIR.APPROACHING");
| 683|    |-		}
|    | 683|+		
| 684| 684| 		else
| 685| 685| 		{
| 686| 686| 			// We are already at the target, or can't move at all,
|    | [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
| 713| 713| 		}
| 714| 714| 
| 715| 715| 		if (this.MoveToGarrisonRange(this.order.data.target))
| 716|    |-		{
|    | 716|+		
| 717| 717| 			this.SetNextState("INDIVIDUAL.GARRISON.APPROACHING");
| 718|    |-		}
|    | 718|+		
| 719| 719| 		else
| 720| 720| 		{
| 721| 721| 			// We do a range check before actually garrisoning
|    | [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
| 844| 844| 			if (!this.CheckTargetAttackRange(target, target))
| 845| 845| 			{
| 846| 846| 				if (this.TargetIsAlive(target) && this.CheckTargetVisible(target))
| 847|    |-				{
|    | 847|+				
| 848| 848| 					if (this.MoveToTargetAttackRange(target, target))
| 849| 849| 					{
| 850| 850| 						this.SetNextState("COMBAT.APPROACHING");
| 851| 851| 						return;
| 852| 852| 					}
| 853|    |-				}
|    | 853|+				
| 854| 854| 				this.FinishOrder();
| 855| 855| 				return;
| 856| 856| 			}
|    | [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
| 869| 869| 			}
| 870| 870| 			// Check if we are already in range, otherwise walk there
| 871| 871| 			if (!this.CheckGarrisonRange(msg.data.target))
| 872|    |-			{
|    | 872|+			
| 873| 873| 				if (!this.CheckTargetVisible(msg.data.target))
| 874| 874| 				{
| 875| 875| 					this.FinishOrder();
| 884| 884| 						return;
| 885| 885| 					}
| 886| 886| 				}
| 887|    |-			}
|    | 887|+			
| 888| 888| 
| 889| 889| 			this.SetNextState("GARRISON.GARRISONING");
| 890| 890| 		},
|    | [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
| 876| 876| 					return;
| 877| 877| 				}
| 878| 878| 				else
| 879|    |-				{
|    | 879|+				
| 880| 880| 					// Out of range; move there in formation
| 881| 881| 					if (this.MoveToGarrisonRange(msg.data.target))
| 882| 882| 					{
| 883| 883| 						this.SetNextState("GARRISON.APPROACHING");
| 884| 884| 						return;
| 885| 885| 					}
| 886|    |-				}
|    | 886|+				
| 887| 887| 			}
| 888| 888| 
| 889| 889| 			this.SetNextState("GARRISON.GARRISONING");
|    | [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
| 875| 875| 					this.FinishOrder();
| 876| 876| 					return;
| 877| 877| 				}
| 878|    |-				else
| 879|    |-				{
|    | 878|+				
| 880| 879| 					// Out of range; move there in formation
| 881| 880| 					if (this.MoveToGarrisonRange(msg.data.target))
| 882| 881| 					{
| 883| 882| 						this.SetNextState("GARRISON.APPROACHING");
| 884| 883| 						return;
| 885| 884| 					}
| 886|    |-				}
|    | 885|+				
| 887| 886| 			}
| 888| 887| 
| 889| 888| 			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
| 902| 902| 						this.PushOrderFront("Walk", msg.data.lastPos);
| 903| 903| 					}
| 904| 904| 					else
| 905|    |-					{
|    | 905|+					
| 906| 906| 						// We couldn't move there, or the target moved away
| 907| 907| 						this.FinishOrder();
| 908|    |-					}
|    | 908|+					
| 909| 909| 					return;
| 910| 910| 				}
| 911| 911| 
|    | [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
|1123|1123| 			},
|1124|1124| 		},
|1125|1125| 
|1126|    |-		"GARRISON":{
|    |1126|+		"GARRISON": {
|1127|1127| 			"enter": function() {
|1128|1128| 				// If the garrisonholder should pickup, warn it so it can take needed action
|1129|1129| 				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
|1307|1307| 			// If the controller handled an order but some members rejected it,
|1308|1308| 			// they will have no orders and be in the FORMATIONMEMBER.IDLE state.
|1309|1309| 			if (this.orderQueue.length)
|1310|    |-			{
|    |1310|+			
|1311|1311| 				// We're leaving the formation, so stop our FormationWalk order
|1312|1312| 				if (this.FinishOrder())
|1313|1313| 					return;
|1314|    |-			}
|    |1314|+			
|1315|1315| 
|1316|1316| 			// No orders left, we're an individual now
|1317|1317| 			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
|1336|1336| 			let range = 4;
|1337|1337| 			if (!this.CheckTargetRangeExplicit(msg.data.target, range, range) &&
|1338|1338| 			    this.MoveToTargetRangeExplicit(msg.data.target, range, range))
|1339|    |-			{
|    |1339|+			
|1340|1340| 				// We've started walking to the given point
|1341|1341| 				this.SetNextState("WALKINGTOPOINT");
|1342|    |-			}
|    |1342|+			
|1343|1343| 			else
|1344|1344| 			{
|1345|1345| 				// We are already at the target, or can't move at all
|    | [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
|1341|1341| 				this.SetNextState("WALKINGTOPOINT");
|1342|1342| 			}
|1343|1343| 			else
|1344|    |-			{
|    |1344|+			
|1345|1345| 				// We are already at the target, or can't move at all
|1346|1346| 				this.FinishOrder();
|1347|    |-			}
|    |1347|+			
|1348|1348| 		},
|1349|1349| 
|1350|1350| 
|    | [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
|1542|1542| 
|1543|1543| 			"LosRangeUpdate": function(msg) {
|1544|1544| 				if (this.GetStance().targetVisibleEnemies)
|1545|    |-				{
|    |1545|+				
|1546|1546| 					// Start attacking one of the newly-seen enemy (if any)
|1547|1547| 					this.AttackEntitiesByPreference(msg.data.added);
|1548|    |-				}
|    |1548|+				
|1549|1549| 			},
|1550|1550| 
|1551|1551| 			"LosHealRangeUpdate": function(msg) {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1729|1729| 						// if nothing better to do, check if the guarded needs to be healed or repaired
|1730|1730| 						var cmpHealth = Engine.QueryInterface(this.isGuardOf, IID_Health);
|1731|1731| 						if (cmpHealth && (cmpHealth.GetHitpoints() < cmpHealth.GetMaxHitpoints()))
|1732|    |-						{
|    |1732|+						
|1733|1733| 							if (this.CanHeal(this.isGuardOf))
|1734|1734| 								this.PushOrderFront("Heal", { "target": this.isGuardOf, "force": false });
|1735|1735| 							else if (this.CanRepair(this.isGuardOf))
|1736|1736| 								this.PushOrderFront("Repair", { "target": this.isGuardOf, "autocontinue": false, "force": false });
|1737|    |-						}
|    |1737|+						
|1738|1738| 					}
|1739|1739| 				},
|1740|1740| 
|    | [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
|1814|1814| 				"MoveCompleted": function() {
|1815|1815| 
|1816|1816| 					if (this.CheckTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1817|    |-					{
|    |1817|+					
|1818|1818| 						// If the unit needs to unpack, do so
|1819|1819| 						if (this.CanUnpack())
|1820|1820| 						{
|1823|1823| 						}
|1824|1824| 						else
|1825|1825| 							this.SetNextState("ATTACKING");
|1826|    |-					}
|    |1826|+					
|1827|1827| 					else
|1828|1828| 					{
|1829|1829| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|    | [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
|1821|1821| 							this.PushOrderFront("Unpack", { "force": true });
|1822|1822| 							return;
|1823|1823| 						}
|1824|    |-						else
|1825|    |-							this.SetNextState("ATTACKING");
|    |1824|+						this.SetNextState("ATTACKING");
|1826|1825| 					}
|1827|1826| 					else
|1828|1827| 					{
|    | [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
|1825|1825| 							this.SetNextState("ATTACKING");
|1826|1826| 					}
|1827|1827| 					else
|1828|    |-					{
|    |1828|+					
|1829|1829| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1830|1830| 						{
|1831|1831| 							this.SetNextState("APPROACHING");
|1835|1835| 							// Give up
|1836|1836| 							this.FinishOrder();
|1837|1837| 						}
|1838|    |-					}
|    |1838|+					
|1839|1839| 				},
|1840|1840| 			},
|1841|1841| 
|    | [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
|1827|1827| 					else
|1828|1828| 					{
|1829|1829| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1830|    |-						{
|    |1830|+						
|1831|1831| 							this.SetNextState("APPROACHING");
|1832|    |-						}
|    |1832|+						
|1833|1833| 						else
|1834|1834| 						{
|1835|1835| 							// Give up
|    | [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
|1831|1831| 							this.SetNextState("APPROACHING");
|1832|1832| 						}
|1833|1833| 						else
|1834|    |-						{
|    |1834|+						
|1835|1835| 							// Give up
|1836|1836| 							this.FinishOrder();
|1837|    |-						}
|    |1837|+						
|1838|1838| 					}
|1839|1839| 				},
|1840|1840| 			},
|    | [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
|1852|1852| 					}
|1853|1853| 					// Check the target is still alive and attackable
|1854|1854| 					if (this.CanAttack(target) && !this.CheckTargetAttackRange(target, this.order.data.attackType))
|1855|    |-					{
|    |1855|+					
|1856|1856| 						// Can't reach it - try to chase after it
|1857|1857| 						if (this.ShouldChaseTargetedEntity(target, this.order.data.force))
|1858|1858| 						{
|1867|1867| 								return;
|1868|1868| 							}
|1869|1869| 						}
|1870|    |-					}
|    |1870|+					
|1871|1871| 
|1872|1872| 					var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|1873|1873| 					this.attackTimers = cmpAttack.GetTimers(this.order.data.attackType);
|    | [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
|1898|1898| 					// TODO: we should probably only bother syncing projectile attacks, not melee
|1899|1899| 
|1900|1900| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|1901|    |-					this.resyncAnimation = (prepare != this.attackTimers.prepare) ? true : false;
|    |1901|+					this.resyncAnimation = (prepare != this.attackTimers.prepare);
|1902|1902| 
|1903|1903| 					this.FaceTowardsTarget(this.order.data.target);
|1904|1904| 
|    | [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
|2027|2027| 
|2028|2028| 				"Attacked": function(msg) {
|2029|2029| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2030|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2031|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2030|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2031|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2032|2032| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2033|2033| 				},
|2034|2034| 			},
|    | [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
|2041|2041| 					this.SelectAnimation("move");
|2042|2042| 					var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|2043|2043| 					if (cmpUnitAI && cmpUnitAI.IsFleeing())
|2044|    |-					{
|    |2044|+					
|2045|2045| 						// Run after a fleeing target
|2046|2046| 						this.SetMoveSpeedRatio(this.GetRunMultiplier());
|2047|    |-					}
|    |2047|+					
|2048|2048| 					this.StartTimer(1000, 1000);
|2049|2049| 				},
|2050|2050| 
|    | [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
|2102|2102| 						// Also don't switch to a different type of huntable animal
|2103|2103| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2104|2104| 							return (
|2105|    |-								ent != oldTarget
|2106|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2105|+								ent != oldTarget &&
|    |2106|+								 ((type.generic == "treasure" && oldType.generic == "treasure")
|2107|2107| 								 || (type.specific == oldType.specific
|2108|2108| 								 && (type.specific != "meat" || oldTemplate == template)))
|2109|2109| 							);
|    | [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
|2103|2103| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2104|2104| 							return (
|2105|2105| 								ent != oldTarget
|2106|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2107|    |-								 || (type.specific == oldType.specific
|    |2106|+								 && ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2107|+								 (type.specific == oldType.specific
|2108|2108| 								 && (type.specific != "meat" || oldTemplate == template)))
|2109|2109| 							);
|2110|2110| 						}, oldTarget);
|    | [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
|2104|2104| 							return (
|2105|2105| 								ent != oldTarget
|2106|2106| 								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2107|    |-								 || (type.specific == oldType.specific
|2108|    |-								 && (type.specific != "meat" || oldTemplate == template)))
|    |2107|+								 || (type.specific == oldType.specific &&
|    |2108|+								 (type.specific != "meat" || oldTemplate == template)))
|2109|2109| 							);
|2110|2110| 						}, oldTarget);
|2111|2111| 						if (nearby)
|    | [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
|2113|2113| 							this.PerformGather(nearby, false, false);
|2114|2114| 							return true;
|2115|2115| 						}
|2116|    |-						else
|2117|    |-						{
|    |2116|+						
|2118|2117| 							// It's probably better in this case, to avoid units getting stuck around a dropsite
|2119|2118| 							// in a "Target is far away, full, nearby are no good resources, return to dropsite" loop
|2120|2119| 							// to order it to GatherNear the resource position.
|2135|2134| 									return true;
|2136|2135| 								}
|2137|2136| 							}
|2138|    |-						}
|    |2137|+						
|2139|2138| 						return true;
|2140|2139| 					}
|2141|2140| 					return false;
|    | [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
|2125|2125| 								this.GatherNearPosition(pos.x, pos.z, oldType, oldTemplate);
|2126|2126| 								return true;
|2127|2127| 							}
|2128|    |-							else
|2129|    |-							{
|    |2128|+							
|2130|2129| 								// we're kind of stuck here. Return resource.
|2131|2130| 								var nearby = this.FindNearestDropsite(oldType.generic);
|2132|2131| 								if (nearby)
|2134|2133| 									this.PushOrderFront("ReturnResource", { "target": nearby, "force": false });
|2135|2134| 									return true;
|2136|2135| 								}
|2137|    |-							}
|    |2136|+							
|2138|2137| 						}
|2139|2138| 						return true;
|2140|2139| 					}
|    | [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
|2167|2167| 						// Also don't switch to a different type of huntable animal
|2168|2168| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2169|2169| 							return (
|2170|    |-								ent != oldTarget
|2171|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2170|+								ent != oldTarget &&
|    |2171|+								((type.generic == "treasure" && oldType.generic == "treasure")
|2172|2172| 								|| (type.specific == oldType.specific
|2173|2173| 								&& (type.specific != "meat" || oldTemplate == template)))
|2174|2174| 							);
|    | [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
|2168|2168| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2169|2169| 							return (
|2170|2170| 								ent != oldTarget
|2171|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2172|    |-								|| (type.specific == oldType.specific
|    |2171|+								&& ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2172|+								(type.specific == oldType.specific
|2173|2173| 								&& (type.specific != "meat" || oldTemplate == template)))
|2174|2174| 							);
|2175|2175| 						});
|    | [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
|2169|2169| 							return (
|2170|2170| 								ent != oldTarget
|2171|2171| 								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2172|    |-								|| (type.specific == oldType.specific
|2173|    |-								&& (type.specific != "meat" || oldTemplate == template)))
|    |2172|+								|| (type.specific == oldType.specific &&
|    |2173|+								(type.specific != "meat" || oldTemplate == template)))
|2174|2174| 							);
|2175|2175| 						});
|2176|2176| 						if (nearby)
|    | [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
|2214|2214| 					// Also don't switch to a different type of huntable animal
|2215|2215| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2216|2216| 						return (
|2217|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2218|    |-							|| (type.specific == resourceType.specific
|    |2217|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2218|+							(type.specific == resourceType.specific
|2219|2219| 							&& (type.specific != "meat" || resourceTemplate == template))
|2220|2220| 						);
|2221|2221| 					});
|    | [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
|2215|2215| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2216|2216| 						return (
|2217|2217| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2218|    |-							|| (type.specific == resourceType.specific
|2219|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2218|+							|| (type.specific == resourceType.specific &&
|    |2219|+							(type.specific != "meat" || resourceTemplate == template))
|2220|2220| 						);
|2221|2221| 					});
|2222|2222| 
|    | [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
|2331|2331| 
|2332|2332| 					var cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply);
|2333|2333| 					if (cmpSupply && cmpSupply.IsAvailable(cmpOwnership.GetOwner(), this.entity))
|2334|    |-					{
|    |2334|+					
|2335|2335| 						// Check we can still reach and gather from the target
|2336|2336| 						if (this.CheckTargetRange(this.gatheringTarget, IID_ResourceGatherer) && this.CanGather(this.gatheringTarget))
|2337|2337| 						{
|2397|2397| 								return;
|2398|2398| 							}
|2399|2399| 						}
|2400|    |-					}
|    |2400|+					
|2401|2401| 
|2402|2402| 					// We're already in range, can't get anywhere near it or the target is exhausted.
|2403|2403| 
|    | [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
|2423|2423| 					// Also don't switch to a different type of huntable animal
|2424|2424| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2425|2425| 						return (
|2426|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2427|    |-							|| (type.specific == resourceType.specific
|    |2426|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2427|+							(type.specific == resourceType.specific
|2428|2428| 							&& (type.specific != "meat" || resourceTemplate == template))
|2429|2429| 						);
|2430|2430| 					});
|    | [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
|2424|2424| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2425|2425| 						return (
|2426|2426| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2427|    |-							|| (type.specific == resourceType.specific
|2428|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2427|+							|| (type.specific == resourceType.specific &&
|    |2428|+							(type.specific != "meat" || resourceTemplate == template))
|2429|2429| 						);
|2430|2430| 					});
|2431|2431| 					if (nearby)
|    | [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
|2511|2511| 					this.StartTimer(prepare, this.healTimers.repeat);
|2512|2512| 
|2513|2513| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2514|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2514|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2515|2515| 
|2516|2516| 					this.FaceTowardsTarget(this.order.data.target);
|2517|2517| 				},
|    | [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
|2726|2726| 					{
|2727|2727| 						// The building was already finished/fully repaired before we arrived;
|2728|2728| 						// let the ConstructionFinished handler handle this.
|2729|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2729|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2730|2730| 						return true;
|2731|2731| 					}
|2732|2732| 
|    | [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
|2726|2726| 					{
|2727|2727| 						// The building was already finished/fully repaired before we arrived;
|2728|2728| 						// let the ConstructionFinished handler handle this.
|2729|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2729|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2730|2730| 						return true;
|2731|2731| 					}
|2732|2732| 
|    | [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
|2767|2767| 					if (!inRange && this.MoveToTargetRange(this.repairTarget, IID_Builder))
|2768|2768| 						this.SetNextState("APPROACHING");
|2769|2769| 					else if (!inRange)
|2770|    |-						this.FinishOrder(); //can't approach and isn't in reach
|    |2770|+						this.FinishOrder(); // can't approach and isn't in reach
|2771|2771| 				},
|2772|2772| 			},
|2773|2773| 
|    | [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
|2854|2854| 
|2855|2855| 				// Unit was approaching and there's nothing to do now, so switch to walking
|2856|2856| 				if (oldState === "INDIVIDUAL.REPAIR.APPROACHING")
|2857|    |-				{
|    |2857|+				
|2858|2858| 					// We're already walking to the given point, so add this as a order.
|2859|2859| 					this.WalkToTarget(msg.data.newentity, true);
|2860|    |-				}
|    |2860|+				
|2861|2861| 			},
|2862|2862| 		},
|2863|2863| 
|    | [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
|2907|2907| 
|2908|2908| 					// Check that we can garrison here
|2909|2909| 					if (this.CanGarrison(target))
|2910|    |-					{
|    |2910|+					
|2911|2911| 						// Check that we're in range of the garrison target
|2912|2912| 						if (this.CheckGarrisonRange(target))
|2913|2913| 						{
|2983|2983| 								return false;
|2984|2984| 							}
|2985|2985| 						}
|2986|    |-					}
|    |2986|+					
|2987|2987| 					// Garrisoning failed for some reason, so finish the order
|2988|2988| 					this.FinishOrder();
|2989|2989| 					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
|3090|3090| 		"Attacked": function(msg) {
|3091|3091| 			if (this.template.NaturalBehaviour == "skittish" ||
|3092|3092| 			    this.template.NaturalBehaviour == "passive")
|3093|    |-			{
|    |3093|+			
|3094|3094| 				this.Flee(msg.data.attacker, false);
|3095|    |-			}
|    |3095|+			
|3096|3096| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|3097|3097| 			{
|3098|3098| 				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
|3099|3099| 					this.Attack(msg.data.attacker, false);
|3100|3100| 			}
|3101|3101| 			else if (this.template.NaturalBehaviour == "domestic")
|3102|    |-			{
|    |3102|+			
|3103|3103| 				// Never flee, stop what we were doing
|3104|3104| 				this.SetNextState("IDLE");
|3105|    |-			}
|    |3105|+			
|3106|3106| 		},
|3107|3107| 
|3108|3108| 		"Order.LeaveFoundation": function(msg) {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3110|3110| 			var range = 4;
|3111|3111| 			if (!this.CheckTargetRangeExplicit(msg.data.target, range, range) &&
|3112|3112| 				this.MoveToTargetRangeExplicit(msg.data.target, range, range))
|3113|    |-			{
|    |3113|+			
|3114|3114| 				// We've started walking to the given point
|3115|3115| 				this.SetNextState("WALKING");
|3116|    |-			}
|    |3116|+			
|3117|3117| 			else
|3118|3118| 			{
|3119|3119| 				// We are already at the target, or can't move at all
|    | [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
|3115|3115| 				this.SetNextState("WALKING");
|3116|3116| 			}
|3117|3117| 			else
|3118|    |-			{
|    |3118|+			
|3119|3119| 				// We are already at the target, or can't move at all
|3120|3120| 				this.FinishOrder();
|3121|    |-			}
|    |3121|+			
|3122|3122| 		},
|3123|3123| 
|3124|3124| 		"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
|3157|3157| 				}
|3158|3158| 				// Start attacking one of the newly-seen enemy (if any)
|3159|3159| 				else if (this.IsDangerousAnimal())
|3160|    |-				{
|    |3160|+				
|3161|3161| 					this.AttackVisibleEntity(msg.data.added);
|3162|    |-				}
|    |3162|+				
|3163|3163| 
|3164|3164| 				// TODO: if two units enter our range together, we'll attack the
|3165|3165| 				// 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
|3200|3200| 				}
|3201|3201| 				// Start attacking one of the newly-seen enemy (if any)
|3202|3202| 				else if (this.template.NaturalBehaviour == "violent")
|3203|    |-				{
|    |3203|+				
|3204|3204| 					this.AttackVisibleEntity(msg.data.added);
|3205|    |-				}
|    |3205|+				
|3206|3206| 			},
|3207|3207| 
|3208|3208| 			"MoveCompleted": function() { },
|    | [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
|3217|3217| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3218|3218| 
|3219|3219| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3220|    |-							// only used for domestic animals
|    |3220|+		// only used for domestic animals
|3221|3221| 	},
|3222|3222| };
|3223|3223| 
|    | [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
|3274|3274| 
|3275|3275| UnitAI.prototype.IsAnimal = function()
|3276|3276| {
|3277|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3277|+	return (!!this.template.NaturalBehaviour);
|3278|3278| };
|3279|3279| 
|3280|3280| 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
|3312|3312| UnitAI.prototype.GetGarrisonHolder = function()
|3313|3313| {
|3314|3314| 	if (this.IsGarrisoned())
|3315|    |-	{
|    |3315|+	
|3316|3316| 		for (let order of this.orderQueue)
|3317|3317| 			if (order.type == "Garrison")
|3318|3318| 				return order.data.target;
|3319|    |-	}
|    |3319|+	
|3320|3320| 	return INVALID_ENTITY;
|3321|3321| };
|3322|3322| 
|    | [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
|3390|3390| 		{
|3391|3391| 			let index = this.GetCurrentState().indexOf(".");
|3392|3392| 			if (index != -1)
|3393|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3393|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3394|3394| 			this.Stop(false);
|3395|3395| 		}
|3396|3396| 
|    | [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
|3446|3446| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3447|3447| 			continue;
|3448|3448| 		if (i == 0)
|3449|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3449|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3450|3450| 		else
|3451|3451| 			this.orderQueue.splice(i, 1);
|3452|3452| 		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
|3446|3446| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3447|3447| 			continue;
|3448|3448| 		if (i == 0)
|3449|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3449|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3450|3450| 		else
|3451|3451| 			this.orderQueue.splice(i, 1);
|3452|3452| 		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
|3530|3530| };
|3531|3531| 
|3532|3532| 
|3533|    |-//// FSM linkage functions ////
|    |3533|+// // FSM linkage functions ////
|3534|3534| 
|3535|3535| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3536|3536| 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
|3702|3702| 				continue;
|3703|3703| 			if (this.orderQueue[i].type == type)
|3704|3704| 				continue;
|3705|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3705|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3706|3706| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3707|3707| 			return;
|3708|3708| 		}
|    | [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
|3702|3702| 				continue;
|3703|3703| 			if (this.orderQueue[i].type == type)
|3704|3704| 				continue;
|3705|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3705|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3706|3706| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3707|3707| 			return;
|3708|3708| 		}
|    | [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
|3716|3716| {
|3717|3717| 	// Remember the previous work orders to be able to go back to them later if required
|3718|3718| 	if (data && data.force)
|3719|    |-	{
|    |3719|+	
|3720|3720| 		if (this.IsFormationController())
|3721|3721| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3722|3722| 		else
|3723|3723| 			this.UpdateWorkOrders(type);
|3724|    |-	}
|    |3724|+	
|3725|3725| 
|3726|3726| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3727|3727| 
|    | [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
|3793|3793| 	{
|3794|3794| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3795|3795| 		if (cmpUnitAI)
|3796|    |-		{
|    |3796|+		
|3797|3797| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3798|3798| 			{
|3799|3799| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3802|3802| 					return;
|3803|3803| 				}
|3804|3804| 			}
|3805|    |-		}
|    |3805|+		
|3806|3806| 	}
|3807|3807| 
|3808|3808| 	// 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
|3795|3795| 		if (cmpUnitAI)
|3796|3796| 		{
|3797|3797| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3798|    |-			{
|    |3798|+			
|3799|3799| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3800|3800| 				{
|3801|3801| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3802|3802| 					return;
|3803|3803| 				}
|3804|    |-			}
|    |3804|+			
|3805|3805| 		}
|3806|3806| 	}
|3807|3807| 
|    | [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
|3807|3807| 
|3808|3808| 	// If nothing found, take the unit orders
|3809|3809| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3810|    |-	{
|    |3810|+	
|3811|3811| 		if (isWorkType(this.orderQueue[i].type))
|3812|3812| 		{
|3813|3813| 			this.workOrders = this.orderQueue.slice(i);
|3814|3814| 			return;
|3815|3815| 		}
|3816|    |-	}
|    |3816|+	
|3817|3817| };
|3818|3818| 
|3819|3819| 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
|3873|3873| 	if (data.timerRepeat === undefined)
|3874|3874| 		this.timer = undefined;
|3875|3875| 
|3876|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3876|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3877|3877| };
|3878|3878| 
|3879|3879| /**
|    | [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
|3873|3873| 	if (data.timerRepeat === undefined)
|3874|3874| 		this.timer = undefined;
|3875|3875| 
|3876|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3876|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3877|3877| };
|3878|3878| 
|3879|3879| /**
|    | [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
|3908|3908| 	this.timer = undefined;
|3909|3909| };
|3910|3910| 
|3911|    |-//// Message handlers /////
|    |3911|+// // Message handlers /////
|3912|3912| 
|3913|3913| UnitAI.prototype.OnMotionChanged = function(msg)
|3914|3914| {
|    | [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
|3913|3913| UnitAI.prototype.OnMotionChanged = function(msg)
|3914|3914| {
|3915|3915| 	if (msg.starting && !msg.error)
|3916|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3916|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveStarted", "data": msg});
|3917|3917| 	else if (!msg.starting || msg.error)
|3918|3918| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3919|3919| };
|    | [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
|3913|3913| UnitAI.prototype.OnMotionChanged = function(msg)
|3914|3914| {
|3915|3915| 	if (msg.starting && !msg.error)
|3916|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3916|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg });
|3917|3917| 	else if (!msg.starting || msg.error)
|3918|3918| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3919|3919| };
|    | [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
|3915|3915| 	if (msg.starting && !msg.error)
|3916|3916| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3917|3917| 	else if (!msg.starting || msg.error)
|3918|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3918|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveCompleted", "data": msg});
|3919|3919| };
|3920|3920| 
|3921|3921| UnitAI.prototype.OnGlobalConstructionFinished = 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
|3915|3915| 	if (msg.starting && !msg.error)
|3916|3916| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3917|3917| 	else if (!msg.starting || msg.error)
|3918|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3918|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg });
|3919|3919| };
|3920|3920| 
|3921|3921| UnitAI.prototype.OnGlobalConstructionFinished = 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
|3923|3923| 	// TODO: This is a bit inefficient since every unit listens to every
|3924|3924| 	// construction message - ideally we could scope it to only the one we're building
|3925|3925| 
|3926|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3926|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3927|3927| };
|3928|3928| 
|3929|3929| 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
|3923|3923| 	// TODO: This is a bit inefficient since every unit listens to every
|3924|3924| 	// construction message - ideally we could scope it to only the one we're building
|3925|3925| 
|3926|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3926|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3927|3927| };
|3928|3928| 
|3929|3929| 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
|3948|3948| 
|3949|3949| UnitAI.prototype.OnAttacked = function(msg)
|3950|3950| {
|3951|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3951|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3952|3952| };
|3953|3953| 
|3954|3954| 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
|3948|3948| 
|3949|3949| UnitAI.prototype.OnAttacked = function(msg)
|3950|3950| {
|3951|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3951|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3952|3952| };
|3953|3953| 
|3954|3954| 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
|3953|3953| 
|3954|3954| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3955|3955| {
|3956|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3956|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|3957|3957| };
|3958|3958| 
|3959|3959| 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
|3953|3953| 
|3954|3954| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3955|3955| {
|3956|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3956|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|3957|3957| };
|3958|3958| 
|3959|3959| 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
|3958|3958| 
|3959|3959| UnitAI.prototype.OnHealthChanged = function(msg)
|3960|3960| {
|3961|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3961|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|3962|3962| };
|3963|3963| 
|3964|3964| 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
|3958|3958| 
|3959|3959| UnitAI.prototype.OnHealthChanged = function(msg)
|3960|3960| {
|3961|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3961|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|3962|3962| };
|3963|3963| 
|3964|3964| 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
|3964|3964| UnitAI.prototype.OnRangeUpdate = function(msg)
|3965|3965| {
|3966|3966| 	if (msg.tag == this.losRangeQuery)
|3967|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3967|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|3968|3968| 	else if (msg.tag == this.losHealRangeQuery)
|3969|3969| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3970|3970| };
|    | [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
|3964|3964| UnitAI.prototype.OnRangeUpdate = function(msg)
|3965|3965| {
|3966|3966| 	if (msg.tag == this.losRangeQuery)
|3967|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3967|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|3968|3968| 	else if (msg.tag == this.losHealRangeQuery)
|3969|3969| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3970|3970| };
|    | [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
|3966|3966| 	if (msg.tag == this.losRangeQuery)
|3967|3967| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3968|3968| 	else if (msg.tag == this.losHealRangeQuery)
|3969|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3969|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|3970|3970| };
|3971|3971| 
|3972|3972| 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
|3966|3966| 	if (msg.tag == this.losRangeQuery)
|3967|3967| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3968|3968| 	else if (msg.tag == this.losHealRangeQuery)
|3969|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3969|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|3970|3970| };
|3971|3971| 
|3972|3972| 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
|3971|3971| 
|3972|3972| UnitAI.prototype.OnPackFinished = function(msg)
|3973|3973| {
|3974|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3974|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|3975|3975| };
|3976|3976| 
|3977|3977| //// 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
|3971|3971| 
|3972|3972| UnitAI.prototype.OnPackFinished = function(msg)
|3973|3973| {
|3974|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3974|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|3975|3975| };
|3976|3976| 
|3977|3977| //// 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
|3974|3974| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|3975|3975| };
|3976|3976| 
|3977|    |-//// Helper functions to be called by the FSM ////
|    |3977|+// // Helper functions to be called by the FSM ////
|3978|3978| 
|3979|3979| UnitAI.prototype.GetWalkSpeed = function()
|3980|3980| {
|    | [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
|4076|4076| 	if (!cmpOwnership || cmpOwnership.GetOwner() == INVALID_PLAYER)
|4077|4077| 		return undefined;
|4078|4078| 
|4079|    |-	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position)
|    |4079|+	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
|4080|4080| 	if (!cmpPosition || !cmpPosition.IsInWorld())
|4081|4081| 		return undefined;
|4082|4082| 
|    | [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
|4161|4161| 			PlaySound(name, member);
|4162|4162| 	}
|4163|4163| 	else
|4164|    |-	{
|    |4164|+	
|4165|4165| 		// Otherwise use our own sounds
|4166|4166| 		PlaySound(name, this.entity);
|4167|    |-	}
|    |4167|+	
|4168|4168| };
|4169|4169| 
|4170|4170| /*
|    | [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
|4330|4330| 	else
|4331|4331| 		// return false? Or hope you come close enough?
|4332|4332| 		var parabolicMaxRange = 0;
|4333|    |-		//return false;
|    |4333|+		// return false;
|4334|4334| 
|4335|4335| 	// the parabole changes while walking, take something in the middle
|4336|4336| 	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
|4395|4395| 	if (this.IsFormationMember())
|4396|4396| 	{
|4397|4397| 		var cmpFormationUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|4398|    |-		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation()
|4399|    |-			&& cmpFormationUnitAI.order.data.target == target)
|    |4398|+		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation() &&
|    |4399|+			cmpFormationUnitAI.order.data.target == target)
|4400|4400| 			return true;
|4401|4401| 	}
|4402|4402| 
|    | [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
|4563|4563| UnitAI.prototype.AttackEntityInZone = function(ents)
|4564|4564| {
|4565|4565| 	var target = ents.find(target =>
|4566|    |-		this.CanAttack(target)
|4567|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4566|+		this.CanAttack(target) &&
|    |4567|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4568|4568| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4569|4569| 	);
|4570|4570| 	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
|4564|4564| {
|4565|4565| 	var target = ents.find(target =>
|4566|4566| 		this.CanAttack(target)
|4567|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4568|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4567|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4568|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4569|4569| 	);
|4570|4570| 	if (!target)
|4571|4571| 		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
|4628|4628| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4629|4629| 	if (this.isGuardOf)
|4630|4630| 	{
|4631|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4631|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4632|4632| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4633|4633| 		if (cmpUnitAI && cmpAttack &&
|4634|4634| 		    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
|4632|4632| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4633|4633| 		if (cmpUnitAI && cmpAttack &&
|4634|4634| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4635|    |-				return false;
|    |4635|+			return false;
|4636|4636| 	}
|4637|4637| 
|4638|4638| 	// 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
|4637|4637| 
|4638|4638| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4639|4639| 	if (this.GetStance().respondHoldGround)
|4640|    |-	{
|    |4640|+	
|4641|4641| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4642|4642| 			return true;
|4643|    |-	}
|    |4643|+	
|4644|4644| 
|4645|4645| 	// Stop if it's left our vision range, unless we're especially persistent
|4646|4646| 	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
|4644|4644| 
|4645|4645| 	// Stop if it's left our vision range, unless we're especially persistent
|4646|4646| 	if (!this.GetStance().respondChaseBeyondVision)
|4647|    |-	{
|    |4647|+	
|4648|4648| 		if (!this.CheckTargetIsInVisionRange(target))
|4649|4649| 			return true;
|4650|    |-	}
|    |4650|+	
|4651|4651| 
|4652|4652| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4653|4653| 	// 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
|4670|4670| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4671|4671| 	if (this.isGuardOf)
|4672|4672| 	{
|4673|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4673|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4674|4674| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4675|4675| 		if (cmpUnitAI && cmpAttack &&
|4676|4676| 		    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
|4683|4683| 	return false;
|4684|4684| };
|4685|4685| 
|4686|    |-//// External interface functions ////
|    |4686|+// // External interface functions ////
|4687|4687| 
|4688|4688| UnitAI.prototype.SetFormationController = function(ent)
|4689|4689| {
|    | [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
|4693|4693| 	// of our own formation (or ourself if not in formation)
|4694|4694| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4695|4695| 	if (cmpObstruction)
|4696|    |-	{
|    |4696|+	
|4697|4697| 		if (ent == INVALID_ENTITY)
|4698|4698| 			cmpObstruction.SetControlGroup(this.entity);
|4699|4699| 		else
|4700|4700| 			cmpObstruction.SetControlGroup(ent);
|4701|    |-	}
|    |4701|+	
|4702|4702| 
|4703|4703| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4704|4704| 	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
|4836|4836| 	// if we already had an old guard order, do nothing if the target is the same
|4837|4837| 	// and the order is running, otherwise remove the previous order
|4838|4838| 	if (this.isGuardOf)
|4839|    |-	{
|    |4839|+	
|4840|4840| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4841|4841| 			return;
|4842|4842| 		else
|4843|4843| 			this.RemoveGuard();
|4844|    |-	}
|    |4844|+	
|4845|4845| 
|4846|4846| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4847|4847| };
|    | [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
|4839|4839| 	{
|4840|4840| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4841|4841| 			return;
|4842|    |-		else
|4843|    |-			this.RemoveGuard();
|    |4842|+		this.RemoveGuard();
|4844|4843| 	}
|4845|4844| 
|4846|4845| 	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
|5010|5010| 			this.WalkToTarget(target, queued);
|5011|5011| 		return;
|5012|5012| 	}
|5013|    |-	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture}, queued);
|    |5013|+	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture }, queued);
|5014|5014| };
|5015|5015| 
|5016|5016| /**
|    | [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
|5159|5159| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5160|5160| 	{
|5161|5161| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5162|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5162|+		if (cmpTrader.HasBothMarkets() &&
|5163|5163| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5164|5164| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5165|5165| 		{
|    | [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
|5440|5440| 				{
|5441|5441| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5442|5442| 					var targetClasses = this.order.data.targetClasses;
|5443|    |-					if (targetClasses.attack && cmpIdentity
|5444|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5443|+					if (targetClasses.attack && cmpIdentity &&
|    |5444|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5445|5445| 						continue;
|5446|5446| 					if (targetClasses.avoid && cmpIdentity
|5447|5447| 						&& 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
|5443|5443| 					if (targetClasses.attack && cmpIdentity
|5444|5444| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5445|5445| 						continue;
|5446|    |-					if (targetClasses.avoid && cmpIdentity
|5447|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5446|+					if (targetClasses.avoid && cmpIdentity &&
|    |5447|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5448|5448| 						continue;
|5449|5449| 					// Only used by the AIs to prevent some choices of targets
|5450|5450| 					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
|5466|5466| 		{
|5467|5467| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5468|5468| 			var targetClasses = this.order.data.targetClasses;
|5469|    |-			if (cmpIdentity && targetClasses.attack
|5470|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5469|+			if (cmpIdentity && targetClasses.attack &&
|    |5470|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5471|5471| 				continue;
|5472|5472| 			if (cmpIdentity && targetClasses.avoid
|5473|5473| 				&& 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
|5469|5469| 			if (cmpIdentity && targetClasses.attack
|5470|5470| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5471|5471| 				continue;
|5472|    |-			if (cmpIdentity && targetClasses.avoid
|5473|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5472|+			if (cmpIdentity && targetClasses.avoid &&
|    |5473|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5474|5474| 				continue;
|5475|5475| 			// Only used by the AIs to prevent some choices of targets
|5476|5476| 			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
|5612|5612| 
|5613|5613| UnitAI.prototype.SetHeldPosition = function(x, z)
|5614|5614| {
|5615|    |-	this.heldPosition = {"x": x, "z": z};
|    |5615|+	this.heldPosition = { "x": x, "z": z};
|5616|5616| };
|5617|5617| 
|5618|5618| 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
|5612|5612| 
|5613|5613| UnitAI.prototype.SetHeldPosition = function(x, z)
|5614|5614| {
|5615|    |-	this.heldPosition = {"x": x, "z": z};
|    |5615|+	this.heldPosition = {"x": x, "z": z };
|5616|5616| };
|5617|5617| 
|5618|5618| 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
|5639|5639| 	return false;
|5640|5640| };
|5641|5641| 
|5642|    |-//// Helper functions ////
|    |5642|+// // Helper functions ////
|5643|5643| 
|5644|5644| UnitAI.prototype.CanAttack = function(target)
|5645|5645| {
|    | [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
|5843|5843| 	return cmpPack && cmpPack.IsPacking();
|5844|5844| };
|5845|5845| 
|5846|    |-//// Formation specific functions ////
|    |5846|+// // Formation specific functions ////
|5847|5847| 
|5848|5848| UnitAI.prototype.IsAttackingAsFormation = function()
|5849|5849| {
|    | [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
|5848|5848| UnitAI.prototype.IsAttackingAsFormation = function()
|5849|5849| {
|5850|5850| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5851|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5852|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5851|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5852|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5853|5853| };
|5854|5854| 
|5855|5855| //// 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
|5852|5852| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5853|5853| };
|5854|5854| 
|5855|    |-//// Animal specific functions ////
|    |5855|+// // Animal specific functions ////
|5856|5856| 
|5857|5857| UnitAI.prototype.MoveRandomly = function(distance)
|5858|5858| {

binaries/data/mods/public/simulation/components/UnitAI.js
|2413| »   »   »   »   »   »   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
|3778| »   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
|4550| »   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
|4565| »   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
|4611| »   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
|4634| »   »   ····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
|5090| »   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
| 366| »   »   ····&&·(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
|1890| »   »   »   »   »   »   var·cmpFormation·=·Engine.QueryInterface(this.formationController,·IID_Formation);
|    | [NORMAL] JSHintBear:
|    | 'cmpFormation' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|2031| »   »   »   »   »   »   &&·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
|2106| »   »   »   »   »   »   »   »   ·&&·((type.generic·==·"treasure"·&&·oldType.generic·==·"treasure")
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|2171| »   »   »   »   »   »   »   »   &&·((type.generic·==·"treasure"·&&·oldType.generic·==·"treasure")
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4343| »   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
|4399| »   »   »   &&·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
|4567| »   »   &&·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
|4568| »   »   &&·(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
|5090| »   var·lastPos·=·undefined;
|    | [NORMAL] JSHintBear:
|    | It's not necessary to initialize 'lastPos' to 'undefined'.

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|5556| »   »   var·cmpRanged·=·Engine.QueryInterface(this.entity,·iid);
|    | [MAJOR] JSHintBear:
|    | Too many errors. (92% scanned).
Executing section cli...

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

bb added a subscriber: bb.Mon, May 13, 5:13 PM

I don't think this patch helps D981 a great deal, since consider a unit that is asked to attack something and unitmotion drops it of (with a moveToRange function) just outside the area an IsInRange function thinks it is in range. With this patch unitAI will now think the unit can't move and thus do nothing, meaning we will get idlers.

MoveTo...Range should be retuning whether the move will be successful or not

That sounds impossible, since the target can move into an unreachable area (gates). I don't think we want a unitMotion to be guessing around.
Furthermore what is the benefit of this change? The current unitAI expects a bool according to whether we are moving or not (so that we can set the state correctly and such) and that behavior shouldn't be changed, even if we can't reach a target we should move as close as possible to it, and thus be moving.

binaries/data/mods/public/simulation/components/UnitAI.js
325–326

inline while at it

1685–1686

Don't think that is correct, since we could be out of range, and then we need to move again

This comment was removed by wraitii.

That sounds impossible, since the target can move into an unreachable area (gates). I don't think we want a unitMotion to be guessing around.

Yeah I've changed my mind on that since (so your comments are right but no longer apply).


Overall, the idea is completed downstream - and perhaps I need to change the order I'm uploading my patches in.

Basically UnitMotion never stops on its own. You Call MoveToX - it returns true if it starts moving there, false otherwise - and then unless you call StopMoving it will try to go there forever.
UnitAI is in charge of range checks to know that we are actually in range. UnitMotion sends "hints" that a move might be done, and then unitAI decides if yes or no.


I don't think this patch helps D981 a great deal, since consider a unit that is asked to attack something and unitmotion drops it of (with a moveToRange function) just outside the area an IsInRange function thinks it is in range. With this patch unitAI will now think the unit can't move and thus do nothing, meaning we will get idlers.

This patch doesn't change that. All this patch does is check if we aren't already in range before moving.

wraitii edited the summary of this revision. (Show Details)Mon, May 13, 5:34 PM
wraitii updated this revision to Diff 8010.Mon, May 13, 8:58 PM
wraitii retitled this revision from Explicitly check ranges before trying to move in unit AI (D13 outtake) to Unit AI Motion cleanup - check ranges explicitly, move in the the State handlers instead of the orders..
wraitii edited the summary of this revision. (Show Details)

Incorporating changes from D1876 (which makes the explicit range checks look more logical).

This also makes unitMotion's "MoveTo" no longer return false when we are in range already (from UM's point of view). This never really made much sense:

  • If we cannot move at all, that's an actual failure on MoveToX's part and needs to be handled (probably we must abort our order).
  • If we were already in range, we can check for that explicitly which makes the code more explicit and more logical.
wraitii added inline comments.Mon, May 13, 10:26 PM
source/simulation2/components/CCmpUnitMotion.cpp
1053–1054

Forgot to update this particular case also.

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

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
| 356| 356| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 357| 357| 		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 358| 358| 		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 359|    |-		{
|    | 359|+		
| 360| 360| 			// we were already on the shoreline, and have not moved since
| 361| 361| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
| 362| 362| 				needToMove = false;
| 363|    |-		}
|    | 363|+		
| 364| 364| 
| 365| 365| 		if (needToMove)
| 366| 366| 			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
| 354| 354| 		// Check if we need to move     TODO implement a better way to know if we are on the shoreline
| 355| 355| 		var needToMove = true;
| 356| 356| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 357|    |-		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 358|    |-		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
|    | 357|+		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x) &&
|    | 358|+		    (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 359| 359| 		{
| 360| 360| 			// we were already on the shoreline, and have not moved since
| 361| 361| 			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
| 527| 527| 					this.PushOrderFront("Walk", this.order.data.lastPos);
| 528| 528| 				}
| 529| 529| 				else
| 530|    |-				{
|    | 530|+				
| 531| 531| 					// We couldn't move there, or the target moved away
| 532| 532| 					this.FinishOrder();
| 533|    |-				}
|    | 533|+				
| 534| 534| 				return;
| 535| 535| 			}
| 536| 536| 
|    | [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
| 742| 742| 			}
| 743| 743| 			// Check if we are already in range, otherwise walk there
| 744| 744| 			if (!this.CheckGarrisonRange(msg.data.target))
| 745|    |-			{
|    | 745|+			
| 746| 746| 				if (!this.CheckTargetVisible(msg.data.target))
| 747| 747| 				{
| 748| 748| 					this.FinishOrder();
| 753| 753| 					this.SetNextState("GARRISON.APPROACHING");
| 754| 754| 					return;
| 755| 755| 				}
| 756|    |-			}
|    | 756|+			
| 757| 757| 
| 758| 758| 			this.SetNextState("GARRISON.GARRISONING");
| 759| 759| 		},
|    | [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
| 748| 748| 					this.FinishOrder();
| 749| 749| 					return;
| 750| 750| 				}
| 751|    |-				else
| 752|    |-				{
|    | 751|+				
| 753| 752| 					this.SetNextState("GARRISON.APPROACHING");
| 754| 753| 					return;
| 755|    |-				}
|    | 754|+				
| 756| 755| 			}
| 757| 756| 
| 758| 757| 			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
| 771| 771| 						this.PushOrderFront("Walk", msg.data.lastPos);
| 772| 772| 					}
| 773| 773| 					else
| 774|    |-					{
|    | 774|+					
| 775| 775| 						// We couldn't move there, or the target moved away
| 776| 776| 						this.FinishOrder();
| 777|    |-					}
|    | 777|+					
| 778| 778| 					return;
| 779| 779| 				}
| 780| 780| 
|    | [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
|1019|1019| 			},
|1020|1020| 		},
|1021|1021| 
|1022|    |-		"GARRISON":{
|    |1022|+		"GARRISON": {
|1023|1023| 			"enter": function() {
|1024|1024| 				// If the garrisonholder should pickup, warn it so it can take needed action
|1025|1025| 				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
|1239|1239| 			// If the controller handled an order but some members rejected it,
|1240|1240| 			// they will have no orders and be in the FORMATIONMEMBER.IDLE state.
|1241|1241| 			if (this.orderQueue.length)
|1242|    |-			{
|    |1242|+			
|1243|1243| 				// We're leaving the formation, so stop our FormationWalk order
|1244|1244| 				if (this.FinishOrder())
|1245|1245| 					return;
|1246|    |-			}
|    |1246|+			
|1247|1247| 
|1248|1248| 			// No orders left, we're an individual now
|1249|1249| 			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
|1267|1267| 			// Move a tile outside the building
|1268|1268| 			let range = 4;
|1269|1269| 			if (this.CheckTargetRangeExplicit(msg.data.target, range, range))
|1270|    |-			{
|    |1270|+			
|1271|1271| 				// We are already at the target, or can't move at all
|1272|1272| 				this.FinishOrder();
|1273|    |-			}
|    |1273|+			
|1274|1274| 			else
|1275|1275| 			{
|1276|1276| 				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
|1482|1482| 
|1483|1483| 			"LosRangeUpdate": function(msg) {
|1484|1484| 				if (this.GetStance().targetVisibleEnemies)
|1485|    |-				{
|    |1485|+				
|1486|1486| 					// Start attacking one of the newly-seen enemy (if any)
|1487|1487| 					this.AttackEntitiesByPreference(msg.data.added);
|1488|    |-				}
|    |1488|+				
|1489|1489| 			},
|1490|1490| 
|1491|1491| 			"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
|1522|1522| 				this.SelectAnimation("move");
|1523|1523| 			},
|1524|1524| 
|1525|    |-			"leave": function () {
|    |1525|+			"leave": function() {
|1526|1526| 				this.SelectAnimation("idle");
|1527|1527| 				this.StopMoving();
|1528|1528| 			},
|    | [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
|1699|1699| 						// if nothing better to do, check if the guarded needs to be healed or repaired
|1700|1700| 						var cmpHealth = Engine.QueryInterface(this.isGuardOf, IID_Health);
|1701|1701| 						if (cmpHealth && (cmpHealth.GetHitpoints() < cmpHealth.GetMaxHitpoints()))
|1702|    |-						{
|    |1702|+						
|1703|1703| 							if (this.CanHeal(this.isGuardOf))
|1704|1704| 								this.PushOrderFront("Heal", { "target": this.isGuardOf, "force": false });
|1705|1705| 							else if (this.CanRepair(this.isGuardOf))
|1706|1706| 								this.PushOrderFront("Repair", { "target": this.isGuardOf, "autocontinue": false, "force": false });
|1707|    |-						}
|    |1707|+						
|1708|1708| 					}
|1709|1709| 				},
|1710|1710| 
|    | [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
|1797|1797| 				"MoveCompleted": function() {
|1798|1798| 
|1799|1799| 					if (this.CheckTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1800|    |-					{
|    |1800|+					
|1801|1801| 						// If the unit needs to unpack, do so
|1802|1802| 						if (this.CanUnpack())
|1803|1803| 						{
|1806|1806| 						}
|1807|1807| 						else
|1808|1808| 							this.SetNextState("ATTACKING");
|1809|    |-					}
|    |1809|+					
|1810|1810| 					else
|1811|1811| 					{
|1812|1812| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|    | [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
|1804|1804| 							this.PushOrderFront("Unpack", { "force": true });
|1805|1805| 							return;
|1806|1806| 						}
|1807|    |-						else
|1808|    |-							this.SetNextState("ATTACKING");
|    |1807|+						this.SetNextState("ATTACKING");
|1809|1808| 					}
|1810|1809| 					else
|1811|1810| 					{
|    | [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
|1808|1808| 							this.SetNextState("ATTACKING");
|1809|1809| 					}
|1810|1810| 					else
|1811|    |-					{
|    |1811|+					
|1812|1812| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1813|1813| 						{
|1814|1814| 							this.SetNextState("APPROACHING");
|1818|1818| 							// Give up
|1819|1819| 							this.FinishOrder();
|1820|1820| 						}
|1821|    |-					}
|    |1821|+					
|1822|1822| 				},
|1823|1823| 			},
|1824|1824| 
|    | [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
|1810|1810| 					else
|1811|1811| 					{
|1812|1812| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1813|    |-						{
|    |1813|+						
|1814|1814| 							this.SetNextState("APPROACHING");
|1815|    |-						}
|    |1815|+						
|1816|1816| 						else
|1817|1817| 						{
|1818|1818| 							// Give up
|    | [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
|1814|1814| 							this.SetNextState("APPROACHING");
|1815|1815| 						}
|1816|1816| 						else
|1817|    |-						{
|    |1817|+						
|1818|1818| 							// Give up
|1819|1819| 							this.FinishOrder();
|1820|    |-						}
|    |1820|+						
|1821|1821| 					}
|1822|1822| 				},
|1823|1823| 			},
|    | [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
|1835|1835| 					}
|1836|1836| 					// Check the target is still alive and attackable
|1837|1837| 					if (this.CanAttack(target) && !this.CheckTargetAttackRange(target, this.order.data.attackType))
|1838|    |-					{
|    |1838|+					
|1839|1839| 						// Can't reach it - try to chase after it
|1840|1840| 						if (this.ShouldChaseTargetedEntity(target, this.order.data.force))
|1841|1841| 						{
|1850|1850| 								return;
|1851|1851| 							}
|1852|1852| 						}
|1853|    |-					}
|    |1853|+					
|1854|1854| 
|1855|1855| 					this.StopMoving();
|1856|1856| 
|    | [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
|1883|1883| 					// TODO: we should probably only bother syncing projectile attacks, not melee
|1884|1884| 
|1885|1885| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|1886|    |-					this.resyncAnimation = (prepare != this.attackTimers.prepare) ? true : false;
|    |1886|+					this.resyncAnimation = (prepare != this.attackTimers.prepare);
|1887|1887| 
|1888|1888| 					this.FaceTowardsTarget(this.order.data.target);
|1889|1889| 
|    | [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
|2012|2012| 
|2013|2013| 				"Attacked": function(msg) {
|2014|2014| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2015|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2016|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2015|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2016|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2017|2017| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2018|2018| 				},
|2019|2019| 			},
|    | [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
|2032|2032| 					this.SelectAnimation("move");
|2033|2033| 					var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|2034|2034| 					if (cmpUnitAI && cmpUnitAI.IsFleeing())
|2035|    |-					{
|    |2035|+					
|2036|2036| 						// Run after a fleeing target
|2037|2037| 						this.SetSpeedMultiplier(this.GetRunMultiplier());
|2038|    |-					}
|    |2038|+					
|2039|2039| 					this.StartTimer(1000, 1000);
|2040|2040| 				},
|2041|2041| 
|    | [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
|2091|2091| 						// Also don't switch to a different type of huntable animal
|2092|2092| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2093|2093| 							return (
|2094|    |-								ent != oldTarget
|2095|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2094|+								ent != oldTarget &&
|    |2095|+								 ((type.generic == "treasure" && oldType.generic == "treasure")
|2096|2096| 								 || (type.specific == oldType.specific
|2097|2097| 								 && (type.specific != "meat" || oldTemplate == template)))
|2098|2098| 							);
|    | [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
|2092|2092| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2093|2093| 							return (
|2094|2094| 								ent != oldTarget
|2095|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2096|    |-								 || (type.specific == oldType.specific
|    |2095|+								 && ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2096|+								 (type.specific == oldType.specific
|2097|2097| 								 && (type.specific != "meat" || oldTemplate == template)))
|2098|2098| 							);
|2099|2099| 						}, oldTarget);
|    | [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
|2093|2093| 							return (
|2094|2094| 								ent != oldTarget
|2095|2095| 								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2096|    |-								 || (type.specific == oldType.specific
|2097|    |-								 && (type.specific != "meat" || oldTemplate == template)))
|    |2096|+								 || (type.specific == oldType.specific &&
|    |2097|+								 (type.specific != "meat" || oldTemplate == template)))
|2098|2098| 							);
|2099|2099| 						}, oldTarget);
|2100|2100| 						if (nearby)
|    | [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
|2102|2102| 							this.PerformGather(nearby, false, false);
|2103|2103| 							return true;
|2104|2104| 						}
|2105|    |-						else
|2106|    |-						{
|    |2105|+						
|2107|2106| 							// It's probably better in this case, to avoid units getting stuck around a dropsite
|2108|2107| 							// in a "Target is far away, full, nearby are no good resources, return to dropsite" loop
|2109|2108| 							// to order it to GatherNear the resource position.
|2124|2123| 									return true;
|2125|2124| 								}
|2126|2125| 							}
|2127|    |-						}
|    |2126|+						
|2128|2127| 						return true;
|2129|2128| 					}
|2130|2129| 
|    | [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
|2114|2114| 								this.GatherNearPosition(pos.x, pos.z, oldType, oldTemplate);
|2115|2115| 								return true;
|2116|2116| 							}
|2117|    |-							else
|2118|    |-							{
|    |2117|+							
|2119|2118| 								// we're kind of stuck here. Return resource.
|2120|2119| 								var nearby = this.FindNearestDropsite(oldType.generic);
|2121|2120| 								if (nearby)
|2123|2122| 									this.PushOrderFront("ReturnResource", { "target": nearby, "force": false });
|2124|2123| 									return true;
|2125|2124| 								}
|2126|    |-							}
|    |2125|+							
|2127|2126| 						}
|2128|2127| 						return true;
|2129|2128| 					}
|    | [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
|2166|2166| 						// Also don't switch to a different type of huntable animal
|2167|2167| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2168|2168| 							return (
|2169|    |-								ent != oldTarget
|2170|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2169|+								ent != oldTarget &&
|    |2170|+								((type.generic == "treasure" && oldType.generic == "treasure")
|2171|2171| 								|| (type.specific == oldType.specific
|2172|2172| 								&& (type.specific != "meat" || oldTemplate == template)))
|2173|2173| 							);
|    | [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
|2167|2167| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2168|2168| 							return (
|2169|2169| 								ent != oldTarget
|2170|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2171|    |-								|| (type.specific == oldType.specific
|    |2170|+								&& ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2171|+								(type.specific == oldType.specific
|2172|2172| 								&& (type.specific != "meat" || oldTemplate == template)))
|2173|2173| 							);
|2174|2174| 						});
|    | [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
|2168|2168| 							return (
|2169|2169| 								ent != oldTarget
|2170|2170| 								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2171|    |-								|| (type.specific == oldType.specific
|2172|    |-								&& (type.specific != "meat" || oldTemplate == template)))
|    |2171|+								|| (type.specific == oldType.specific &&
|    |2172|+								(type.specific != "meat" || oldTemplate == template)))
|2173|2173| 							);
|2174|2174| 						});
|2175|2175| 						if (nearby)
|    | [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
|2226|2226| 					// Also don't switch to a different type of huntable animal
|2227|2227| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2228|2228| 						return (
|2229|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2230|    |-							|| (type.specific == resourceType.specific
|    |2229|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2230|+							(type.specific == resourceType.specific
|2231|2231| 							&& (type.specific != "meat" || resourceTemplate == template))
|2232|2232| 						);
|2233|2233| 					});
|    | [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
|2227|2227| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2228|2228| 						return (
|2229|2229| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2230|    |-							|| (type.specific == resourceType.specific
|2231|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2230|+							|| (type.specific == resourceType.specific &&
|    |2231|+							(type.specific != "meat" || resourceTemplate == template))
|2232|2232| 						);
|2233|2233| 					});
|2234|2234| 
|    | [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
|2344|2344| 
|2345|2345| 					var cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply);
|2346|2346| 					if (cmpSupply && cmpSupply.IsAvailable(cmpOwnership.GetOwner(), this.entity))
|2347|    |-					{
|    |2347|+					
|2348|2348| 						// Check we can still reach and gather from the target
|2349|2349| 						if (this.CheckTargetRange(this.gatheringTarget, IID_ResourceGatherer) && this.CanGather(this.gatheringTarget))
|2350|2350| 						{
|2409|2409| 								return;
|2410|2410| 							}
|2411|2411| 						}
|2412|    |-					}
|    |2412|+					
|2413|2413| 
|2414|2414| 					// We're already in range, can't get anywhere near it or the target is exhausted.
|2415|2415| 
|    | [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
|2435|2435| 					// Also don't switch to a different type of huntable animal
|2436|2436| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2437|2437| 						return (
|2438|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2439|    |-							|| (type.specific == resourceType.specific
|    |2438|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2439|+							(type.specific == resourceType.specific
|2440|2440| 							&& (type.specific != "meat" || resourceTemplate == template))
|2441|2441| 						);
|2442|2442| 					});
|    | [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
|2436|2436| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2437|2437| 						return (
|2438|2438| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2439|    |-							|| (type.specific == resourceType.specific
|2440|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2439|+							|| (type.specific == resourceType.specific &&
|    |2440|+							(type.specific != "meat" || resourceTemplate == template))
|2441|2441| 						);
|2442|2442| 					});
|2443|2443| 					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
|2501|2501| 
|2502|2502| 				"Timer": function(msg) {
|2503|2503| 					if (this.ShouldAbandonChase(this.order.data.target, this.order.data.force, IID_Heal, null))
|2504|    |-					{
|    |2504|+					
|2505|2505| 						// Return to our original position unless we have a better order.
|2506|2506| 						if (!this.FinishOrder() && this.GetStance().respondHoldGround)
|2507|2507| 							this.WalkToHeldPosition();
|2508|    |-					}
|    |2508|+					
|2509|2509| 				},
|2510|2510| 
|2511|2511| 				"MoveCompleted": 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
|2535|2535| 					this.StartTimer(prepare, this.healTimers.repeat);
|2536|2536| 
|2537|2537| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2538|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2538|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2539|2539| 
|2540|2540| 					this.FaceTowardsTarget(this.order.data.target);
|2541|2541| 				},
|    | [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
|2747|2747| 					{
|2748|2748| 						// The building was already finished/fully repaired before we arrived;
|2749|2749| 						// let the ConstructionFinished handler handle this.
|2750|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2750|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2751|2751| 						return true;
|2752|2752| 					}
|2753|2753| 
|    | [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
|2747|2747| 					{
|2748|2748| 						// The building was already finished/fully repaired before we arrived;
|2749|2749| 						// let the ConstructionFinished handler handle this.
|2750|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2750|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2751|2751| 						return true;
|2752|2752| 					}
|2753|2753| 
|    | [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
|2790|2790| 					if (!inRange && this.MoveToTargetRange(this.repairTarget, IID_Builder))
|2791|2791| 						this.SetNextState("APPROACHING");
|2792|2792| 					else if (!inRange)
|2793|    |-						this.FinishOrder(); //can't approach and isn't in reach
|    |2793|+						this.FinishOrder(); // can't approach and isn't in reach
|2794|2794| 				},
|2795|2795| 			},
|2796|2796| 
|    | [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
|2877|2877| 
|2878|2878| 				// Unit was approaching and there's nothing to do now, so switch to walking
|2879|2879| 				if (oldState === "INDIVIDUAL.REPAIR.APPROACHING")
|2880|    |-				{
|    |2880|+				
|2881|2881| 					// We're already walking to the given point, so add this as a order.
|2882|2882| 					this.WalkToTarget(msg.data.newentity, true);
|2883|    |-				}
|    |2883|+				
|2884|2884| 			},
|2885|2885| 		},
|2886|2886| 
|    | [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
|2939|2939| 
|2940|2940| 					// Check that we can garrison here
|2941|2941| 					if (this.CanGarrison(target))
|2942|    |-					{
|    |2942|+					
|2943|2943| 						// Check that we're in range of the garrison target
|2944|2944| 						if (this.CheckGarrisonRange(target))
|2945|2945| 						{
|3015|3015| 								return false;
|3016|3016| 							}
|3017|3017| 						}
|3018|    |-					}
|    |3018|+					
|3019|3019| 					// Garrisoning failed for some reason, so finish the order
|3020|3020| 					this.FinishOrder();
|3021|3021| 					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
|3136|3136| 		"Attacked": function(msg) {
|3137|3137| 			if (this.template.NaturalBehaviour == "skittish" ||
|3138|3138| 			    this.template.NaturalBehaviour == "passive")
|3139|    |-			{
|    |3139|+			
|3140|3140| 				this.Flee(msg.data.attacker, false);
|3141|    |-			}
|    |3141|+			
|3142|3142| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|3143|3143| 			{
|3144|3144| 				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
|3145|3145| 					this.Attack(msg.data.attacker, false);
|3146|3146| 			}
|3147|3147| 			else if (this.template.NaturalBehaviour == "domestic")
|3148|    |-			{
|    |3148|+			
|3149|3149| 				// Never flee, stop what we were doing
|3150|3150| 				this.SetNextState("IDLE");
|3151|    |-			}
|    |3151|+			
|3152|3152| 		},
|3153|3153| 
|3154|3154| 		"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
|3159|3159| 				this.FinishOrder();
|3160|3160| 				return;
|3161|3161| 			}
|3162|    |-			else
|3163|    |-			{
|    |3162|+			
|3164|3163| 				this.order.data.min = range;
|3165|3164| 				this.SetNextState("WALKING");
|3166|    |-			}
|    |3165|+			
|3167|3166| 		},
|3168|3167| 
|3169|3168| 		"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
|3203|3203| 				}
|3204|3204| 				// Start attacking one of the newly-seen enemy (if any)
|3205|3205| 				else if (this.IsDangerousAnimal())
|3206|    |-				{
|    |3206|+				
|3207|3207| 					this.AttackVisibleEntity(msg.data.added);
|3208|    |-				}
|    |3208|+				
|3209|3209| 
|3210|3210| 				// TODO: if two units enter our range together, we'll attack the
|3211|3211| 				// 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
|3246|3246| 				}
|3247|3247| 				// Start attacking one of the newly-seen enemy (if any)
|3248|3248| 				else if (this.template.NaturalBehaviour == "violent")
|3249|    |-				{
|    |3249|+				
|3250|3250| 					this.AttackVisibleEntity(msg.data.added);
|3251|    |-				}
|    |3251|+				
|3252|3252| 			},
|3253|3253| 
|3254|3254| 			"MoveCompleted": function() { },
|    | [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
|3263|3263| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3264|3264| 
|3265|3265| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3266|    |-							// only used for domestic animals
|    |3266|+		// only used for domestic animals
|3267|3267| 	},
|3268|3268| };
|3269|3269| 
|    | [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
|3320|3320| 
|3321|3321| UnitAI.prototype.IsAnimal = function()
|3322|3322| {
|3323|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3323|+	return (!!this.template.NaturalBehaviour);
|3324|3324| };
|3325|3325| 
|3326|3326| 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
|3358|3358| UnitAI.prototype.GetGarrisonHolder = function()
|3359|3359| {
|3360|3360| 	if (this.IsGarrisoned())
|3361|    |-	{
|    |3361|+	
|3362|3362| 		for (let order of this.orderQueue)
|3363|3363| 			if (order.type == "Garrison")
|3364|3364| 				return order.data.target;
|3365|    |-	}
|    |3365|+	
|3366|3366| 	return INVALID_ENTITY;
|3367|3367| };
|3368|3368| 
|    | [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
|3436|3436| 		{
|3437|3437| 			let index = this.GetCurrentState().indexOf(".");
|3438|3438| 			if (index != -1)
|3439|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3439|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3440|3440| 			this.Stop(false);
|3441|3441| 		}
|3442|3442| 
|    | [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
|3492|3492| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3493|3493| 			continue;
|3494|3494| 		if (i == 0)
|3495|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3495|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3496|3496| 		else
|3497|3497| 			this.orderQueue.splice(i, 1);
|3498|3498| 		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
|3492|3492| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3493|3493| 			continue;
|3494|3494| 		if (i == 0)
|3495|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3495|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3496|3496| 		else
|3497|3497| 			this.orderQueue.splice(i, 1);
|3498|3498| 		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
|3576|3576| };
|3577|3577| 
|3578|3578| 
|3579|    |-//// FSM linkage functions ////
|    |3579|+// // FSM linkage functions ////
|3580|3580| 
|3581|3581| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3582|3582| 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
|3748|3748| 				continue;
|3749|3749| 			if (this.orderQueue[i].type == type)
|3750|3750| 				continue;
|3751|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3751|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3752|3752| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3753|3753| 			return;
|3754|3754| 		}
|    | [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
|3748|3748| 				continue;
|3749|3749| 			if (this.orderQueue[i].type == type)
|3750|3750| 				continue;
|3751|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3751|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3752|3752| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3753|3753| 			return;
|3754|3754| 		}
|    | [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
|3762|3762| {
|3763|3763| 	// Remember the previous work orders to be able to go back to them later if required
|3764|3764| 	if (data && data.force)
|3765|    |-	{
|    |3765|+	
|3766|3766| 		if (this.IsFormationController())
|3767|3767| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3768|3768| 		else
|3769|3769| 			this.UpdateWorkOrders(type);
|3770|    |-	}
|    |3770|+	
|3771|3771| 
|3772|3772| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3773|3773| 
|    | [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
|3839|3839| 	{
|3840|3840| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3841|3841| 		if (cmpUnitAI)
|3842|    |-		{
|    |3842|+		
|3843|3843| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3844|3844| 			{
|3845|3845| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3848|3848| 					return;
|3849|3849| 				}
|3850|3850| 			}
|3851|    |-		}
|    |3851|+		
|3852|3852| 	}
|3853|3853| 
|3854|3854| 	// 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
|3841|3841| 		if (cmpUnitAI)
|3842|3842| 		{
|3843|3843| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3844|    |-			{
|    |3844|+			
|3845|3845| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3846|3846| 				{
|3847|3847| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3848|3848| 					return;
|3849|3849| 				}
|3850|    |-			}
|    |3850|+			
|3851|3851| 		}
|3852|3852| 	}
|3853|3853| 
|    | [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
|3853|3853| 
|3854|3854| 	// If nothing found, take the unit orders
|3855|3855| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3856|    |-	{
|    |3856|+	
|3857|3857| 		if (isWorkType(this.orderQueue[i].type))
|3858|3858| 		{
|3859|3859| 			this.workOrders = this.orderQueue.slice(i);
|3860|3860| 			return;
|3861|3861| 		}
|3862|    |-	}
|    |3862|+	
|3863|3863| };
|3864|3864| 
|3865|3865| 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
|3919|3919| 	if (data.timerRepeat === undefined)
|3920|3920| 		this.timer = undefined;
|3921|3921| 
|3922|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3922|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3923|3923| };
|3924|3924| 
|3925|3925| /**
|    | [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
|3919|3919| 	if (data.timerRepeat === undefined)
|3920|3920| 		this.timer = undefined;
|3921|3921| 
|3922|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3922|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3923|3923| };
|3924|3924| 
|3925|3925| /**
|    | [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
|3954|3954| 	this.timer = undefined;
|3955|3955| };
|3956|3956| 
|3957|    |-//// Message handlers /////
|    |3957|+// // Message handlers /////
|3958|3958| 
|3959|3959| UnitAI.prototype.OnMotionChanged = function(msg)
|3960|3960| {
|    | [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
|3959|3959| UnitAI.prototype.OnMotionChanged = function(msg)
|3960|3960| {
|3961|3961| 	if (msg.starting && !msg.error)
|3962|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3962|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveStarted", "data": msg});
|3963|3963| 	else if (!msg.starting || msg.error)
|3964|3964| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3965|3965| };
|    | [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
|3959|3959| UnitAI.prototype.OnMotionChanged = function(msg)
|3960|3960| {
|3961|3961| 	if (msg.starting && !msg.error)
|3962|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3962|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg });
|3963|3963| 	else if (!msg.starting || msg.error)
|3964|3964| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3965|3965| };
|    | [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
|3961|3961| 	if (msg.starting && !msg.error)
|3962|3962| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3963|3963| 	else if (!msg.starting || msg.error)
|3964|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3964|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveCompleted", "data": msg});
|3965|3965| };
|3966|3966| 
|3967|3967| UnitAI.prototype.OnGlobalConstructionFinished = 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
|3961|3961| 	if (msg.starting && !msg.error)
|3962|3962| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3963|3963| 	else if (!msg.starting || msg.error)
|3964|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3964|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg });
|3965|3965| };
|3966|3966| 
|3967|3967| UnitAI.prototype.OnGlobalConstructionFinished = 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
|3969|3969| 	// TODO: This is a bit inefficient since every unit listens to every
|3970|3970| 	// construction message - ideally we could scope it to only the one we're building
|3971|3971| 
|3972|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3972|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3973|3973| };
|3974|3974| 
|3975|3975| 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
|3969|3969| 	// TODO: This is a bit inefficient since every unit listens to every
|3970|3970| 	// construction message - ideally we could scope it to only the one we're building
|3971|3971| 
|3972|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3972|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3973|3973| };
|3974|3974| 
|3975|3975| 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
|3994|3994| 
|3995|3995| UnitAI.prototype.OnAttacked = function(msg)
|3996|3996| {
|3997|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3997|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3998|3998| };
|3999|3999| 
|4000|4000| 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
|3994|3994| 
|3995|3995| UnitAI.prototype.OnAttacked = function(msg)
|3996|3996| {
|3997|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3997|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3998|3998| };
|3999|3999| 
|4000|4000| 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
|3999|3999| 
|4000|4000| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4001|4001| {
|4002|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4002|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4003|4003| };
|4004|4004| 
|4005|4005| 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
|3999|3999| 
|4000|4000| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4001|4001| {
|4002|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4002|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4003|4003| };
|4004|4004| 
|4005|4005| 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
|4004|4004| 
|4005|4005| UnitAI.prototype.OnHealthChanged = function(msg)
|4006|4006| {
|4007|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4007|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4008|4008| };
|4009|4009| 
|4010|4010| 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
|4004|4004| 
|4005|4005| UnitAI.prototype.OnHealthChanged = function(msg)
|4006|4006| {
|4007|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4007|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4008|4008| };
|4009|4009| 
|4010|4010| 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
|4010|4010| UnitAI.prototype.OnRangeUpdate = function(msg)
|4011|4011| {
|4012|4012| 	if (msg.tag == this.losRangeQuery)
|4013|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4013|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4014|4014| 	else if (msg.tag == this.losHealRangeQuery)
|4015|4015| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4016|4016| };
|    | [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
|4010|4010| UnitAI.prototype.OnRangeUpdate = function(msg)
|4011|4011| {
|4012|4012| 	if (msg.tag == this.losRangeQuery)
|4013|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4013|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4014|4014| 	else if (msg.tag == this.losHealRangeQuery)
|4015|4015| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4016|4016| };
|    | [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
|4012|4012| 	if (msg.tag == this.losRangeQuery)
|4013|4013| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4014|4014| 	else if (msg.tag == this.losHealRangeQuery)
|4015|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4015|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4016|4016| };
|4017|4017| 
|4018|4018| 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
|4012|4012| 	if (msg.tag == this.losRangeQuery)
|4013|4013| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4014|4014| 	else if (msg.tag == this.losHealRangeQuery)
|4015|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4015|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4016|4016| };
|4017|4017| 
|4018|4018| 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
|4017|4017| 
|4018|4018| UnitAI.prototype.OnPackFinished = function(msg)
|4019|4019| {
|4020|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4020|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4021|4021| };
|4022|4022| 
|4023|4023| //// 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
|4017|4017| 
|4018|4018| UnitAI.prototype.OnPackFinished = function(msg)
|4019|4019| {
|4020|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4020|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4021|4021| };
|4022|4022| 
|4023|4023| //// 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
|4020|4020| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4021|4021| };
|4022|4022| 
|4023|    |-//// Helper functions to be called by the FSM ////
|    |4023|+// // Helper functions to be called by the FSM ////
|4024|4024| 
|4025|4025| UnitAI.prototype.GetWalkSpeed = function()
|4026|4026| {
|    | [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
|4122|4122| 	if (!cmpOwnership || cmpOwnership.GetOwner() == INVALID_PLAYER)
|4123|4123| 		return undefined;
|4124|4124| 
|4125|    |-	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position)
|    |4125|+	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
|4126|4126| 	if (!cmpPosition || !cmpPosition.IsInWorld())
|4127|4127| 		return undefined;
|4128|4128| 
|    | [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
|4207|4207| 			PlaySound(name, member);
|4208|4208| 	}
|4209|4209| 	else
|4210|    |-	{
|    |4210|+	
|4211|4211| 		// Otherwise use our own sounds
|4212|4212| 		PlaySound(name, this.entity);
|4213|    |-	}
|    |4213|+	
|4214|4214| };
|4215|4215| 
|4216|4216| /*
|    | [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
|4303|4303| UnitAI.prototype.MoveTo = function(data, iid, type)
|4304|4304| {
|4305|4305| 	if (data["target"])
|4306|    |-	{
|    |4306|+	
|4307|4307| 		if (data["min"] || data["max"])
|4308|4308| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4309|4309| 		else
|4313|4313| 			else
|4314|4314| 				return this.MoveToTargetRange(data.target, iid, type);
|4315|4315| 		}
|4316|    |-	}
|    |4316|+	
|4317|4317| 	else
|4318|4318| 	{
|4319|4319| 		if (data["min"] || data["max"])
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["target"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4302|4302|  */
|4303|4303| UnitAI.prototype.MoveTo = function(data, iid, type)
|4304|4304| {
|4305|    |-	if (data["target"])
|    |4305|+	if (data.target)
|4306|4306| 	{
|4307|4307| 		if (data["min"] || data["max"])
|4308|4308| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["min"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4304|4304| {
|4305|4305| 	if (data["target"])
|4306|4306| 	{
|4307|    |-		if (data["min"] || data["max"])
|    |4307|+		if (data.min || data["max"])
|4308|4308| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4309|4309| 		else
|4310|4310| 		{
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["max"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4304|4304| {
|4305|4305| 	if (data["target"])
|4306|4306| 	{
|4307|    |-		if (data["min"] || data["max"])
|    |4307|+		if (data["min"] || data.max)
|4308|4308| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4309|4309| 		else
|4310|4310| 		{
|    | [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
|4307|4307| 		if (data["min"] || data["max"])
|4308|4308| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4309|4309| 		else
|4310|    |-		{
|    |4310|+		
|4311|4311| 			if (!iid)
|4312|4312| 				return this.MoveToTarget(data.target);
|4313|4313| 			else
|4314|4314| 				return this.MoveToTargetRange(data.target, iid, type);
|4315|    |-		}
|    |4315|+		
|4316|4316| 	}
|4317|4317| 	else
|4318|4318| 	{
|    | [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
|4306|4306| 	{
|4307|4307| 		if (data["min"] || data["max"])
|4308|4308| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4309|    |-		else
|4310|    |-		{
|    |4309|+		
|4311|4310| 			if (!iid)
|4312|4311| 				return this.MoveToTarget(data.target);
|4313|4312| 			else
|4314|4313| 				return this.MoveToTargetRange(data.target, iid, type);
|4315|    |-		}
|    |4314|+		
|4316|4315| 	}
|4317|4316| 	else
|4318|4317| 	{
|    | [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
|4310|4310| 		{
|4311|4311| 			if (!iid)
|4312|4312| 				return this.MoveToTarget(data.target);
|4313|    |-			else
|4314|    |-				return this.MoveToTargetRange(data.target, iid, type);
|    |4313|+			return this.MoveToTargetRange(data.target, iid, type);
|4315|4314| 		}
|4316|4315| 	}
|4317|4316| 	else
|    | [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
|4315|4315| 		}
|4316|4316| 	}
|4317|4317| 	else
|4318|    |-	{
|    |4318|+	
|4319|4319| 		if (data["min"] || data["max"])
|4320|4320| 			return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1);
|4321|4321| 		else
|4322|4322| 			return this.MoveToPoint(data.x, data.z);
|4323|    |-	}
|    |4323|+	
|4324|4324| }
|4325|4325| 
|4326|4326| UnitAI.prototype.MoveToPoint = function(x, z)
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["min"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4316|4316| 	}
|4317|4317| 	else
|4318|4318| 	{
|4319|    |-		if (data["min"] || data["max"])
|    |4319|+		if (data.min || data["max"])
|4320|4320| 			return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1);
|4321|4321| 		else
|4322|4322| 			return this.MoveToPoint(data.x, data.z);
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["max"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4316|4316| 	}
|4317|4317| 	else
|4318|4318| 	{
|4319|    |-		if (data["min"] || data["max"])
|    |4319|+		if (data["min"] || data.max)
|4320|4320| 			return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1);
|4321|4321| 		else
|4322|4322| 			return this.MoveToPoint(data.x, data.z);
|    | [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
|4318|4318| 	{
|4319|4319| 		if (data["min"] || data["max"])
|4320|4320| 			return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1);
|4321|    |-		else
|4322|    |-			return this.MoveToPoint(data.x, data.z);
|    |4321|+		return this.MoveToPoint(data.x, data.z);
|4323|4322| 	}
|4324|4323| }
|4325|4324| 
|    | [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
|4321|4321| 		else
|4322|4322| 			return this.MoveToPoint(data.x, data.z);
|4323|4323| 	}
|4324|    |-}
|    |4324|+};
|4325|4325| 
|4326|4326| UnitAI.prototype.MoveToPoint = function(x, z)
|4327|4327| {
|    | [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
|4405|4405| 	else
|4406|4406| 		// return false? Or hope you come close enough?
|4407|4407| 		var parabolicMaxRange = 0;
|4408|    |-		//return false;
|    |4408|+		// return false;
|4409|4409| 
|4410|4410| 	// the parabole changes while walking, take something in the middle
|4411|4411| 	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
|4470|4470| 	if (this.IsFormationMember())
|4471|4471| 	{
|4472|4472| 		var cmpFormationUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|4473|    |-		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation()
|4474|    |-			&& cmpFormationUnitAI.order.data.target == target)
|    |4473|+		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation() &&
|    |4474|+			cmpFormationUnitAI.order.data.target == target)
|4475|4475| 			return true;
|4476|4476| 	}
|4477|4477| 
|    | [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
|4638|4638| UnitAI.prototype.AttackEntityInZone = function(ents)
|4639|4639| {
|4640|4640| 	var target = ents.find(target =>
|4641|    |-		this.CanAttack(target)
|4642|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4641|+		this.CanAttack(target) &&
|    |4642|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4643|4643| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4644|4644| 	);
|4645|4645| 	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
|4639|4639| {
|4640|4640| 	var target = ents.find(target =>
|4641|4641| 		this.CanAttack(target)
|4642|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4643|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4642|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4643|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4644|4644| 	);
|4645|4645| 	if (!target)
|4646|4646| 		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
|4703|4703| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4704|4704| 	if (this.isGuardOf)
|4705|4705| 	{
|4706|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4706|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4707|4707| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4708|4708| 		if (cmpUnitAI && cmpAttack &&
|4709|4709| 		    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
|4707|4707| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4708|4708| 		if (cmpUnitAI && cmpAttack &&
|4709|4709| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4710|    |-				return false;
|    |4710|+			return false;
|4711|4711| 	}
|4712|4712| 
|4713|4713| 	// 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
|4712|4712| 
|4713|4713| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4714|4714| 	if (this.GetStance().respondHoldGround)
|4715|    |-	{
|    |4715|+	
|4716|4716| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4717|4717| 			return true;
|4718|    |-	}
|    |4718|+	
|4719|4719| 
|4720|4720| 	// Stop if it's left our vision range, unless we're especially persistent
|4721|4721| 	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
|4719|4719| 
|4720|4720| 	// Stop if it's left our vision range, unless we're especially persistent
|4721|4721| 	if (!this.GetStance().respondChaseBeyondVision)
|4722|    |-	{
|    |4722|+	
|4723|4723| 		if (!this.CheckTargetIsInVisionRange(target))
|4724|4724| 			return true;
|4725|    |-	}
|    |4725|+	
|4726|4726| 
|4727|4727| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4728|4728| 	// 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
|4745|4745| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4746|4746| 	if (this.isGuardOf)
|4747|4747| 	{
|4748|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4748|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4749|4749| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4750|4750| 		if (cmpUnitAI && cmpAttack &&
|4751|4751| 		    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
|4758|4758| 	return false;
|4759|4759| };
|4760|4760| 
|4761|    |-//// External interface functions ////
|    |4761|+// // External interface functions ////
|4762|4762| 
|4763|4763| UnitAI.prototype.SetFormationController = function(ent)
|4764|4764| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4768|4768| 	// of our own formation (or ourself if not in formation)
|4769|4769| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4770|4770| 	if (cmpObstruction)
|4771|    |-	{
|    |4771|+	
|4772|4772| 		if (ent == INVALID_ENTITY)
|4773|4773| 			cmpObstruction.SetControlGroup(this.entity);
|4774|4774| 		else
|4775|4775| 			cmpObstruction.SetControlGroup(ent);
|4776|    |-	}
|    |4776|+	
|4777|4777| 
|4778|4778| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4779|4779| 	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
|4911|4911| 	// if we already had an old guard order, do nothing if the target is the same
|4912|4912| 	// and the order is running, otherwise remove the previous order
|4913|4913| 	if (this.isGuardOf)
|4914|    |-	{
|    |4914|+	
|4915|4915| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4916|4916| 			return;
|4917|4917| 		else
|4918|4918| 			this.RemoveGuard();
|4919|    |-	}
|    |4919|+	
|4920|4920| 
|4921|4921| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4922|4922| };
|    | [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
|4914|4914| 	{
|4915|4915| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4916|4916| 			return;
|4917|    |-		else
|4918|    |-			this.RemoveGuard();
|    |4917|+		this.RemoveGuard();
|4919|4918| 	}
|4920|4919| 
|4921|4920| 	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
|5085|5085| 			this.WalkToTarget(target, queued);
|5086|5086| 		return;
|5087|5087| 	}
|5088|    |-	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture}, queued);
|    |5088|+	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture }, queued);
|5089|5089| };
|5090|5090| 
|5091|5091| /**
|    | [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
|5234|5234| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5235|5235| 	{
|5236|5236| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5237|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5237|+		if (cmpTrader.HasBothMarkets() &&
|5238|5238| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5239|5239| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5240|5240| 		{
|    | [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
|5515|5515| 				{
|5516|5516| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5517|5517| 					var targetClasses = this.order.data.targetClasses;
|5518|    |-					if (targetClasses.attack && cmpIdentity
|5519|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5518|+					if (targetClasses.attack && cmpIdentity &&
|    |5519|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5520|5520| 						continue;
|5521|5521| 					if (targetClasses.avoid && cmpIdentity
|5522|5522| 						&& 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
|5518|5518| 					if (targetClasses.attack && cmpIdentity
|5519|5519| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5520|5520| 						continue;
|5521|    |-					if (targetClasses.avoid && cmpIdentity
|5522|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5521|+					if (targetClasses.avoid && cmpIdentity &&
|    |5522|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5523|5523| 						continue;
|5524|5524| 					// Only used by the AIs to prevent some choices of targets
|5525|5525| 					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
|5541|5541| 		{
|5542|5542| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5543|5543| 			var targetClasses = this.order.data.targetClasses;
|5544|    |-			if (cmpIdentity && targetClasses.attack
|5545|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5544|+			if (cmpIdentity && targetClasses.attack &&
|    |5545|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5546|5546| 				continue;
|5547|5547| 			if (cmpIdentity && targetClasses.avoid
|5548|5548| 				&& 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
|5544|5544| 			if (cmpIdentity && targetClasses.attack
|5545|5545| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5546|5546| 				continue;
|5547|    |-			if (cmpIdentity && targetClasses.avoid
|5548|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5547|+			if (cmpIdentity && targetClasses.avoid &&
|    |5548|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5549|5549| 				continue;
|5550|5550| 			// Only used by the AIs to prevent some choices of targets
|5551|5551| 			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
|5687|5687| 
|5688|5688| UnitAI.prototype.SetHeldPosition = function(x, z)
|5689|5689| {
|5690|    |-	this.heldPosition = {"x": x, "z": z};
|    |5690|+	this.heldPosition = { "x": x, "z": z};
|5691|5691| };
|5692|5692| 
|5693|5693| 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
|5687|5687| 
|5688|5688| UnitAI.prototype.SetHeldPosition = function(x, z)
|5689|5689| {
|5690|    |-	this.heldPosition = {"x": x, "z": z};
|    |5690|+	this.heldPosition = {"x": x, "z": z };
|5691|5691| };
|5692|5692| 
|5693|5693| 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
|5714|5714| 	return false;
|5715|5715| };
|5716|5716| 
|5717|    |-//// Helper functions ////
|    |5717|+// // Helper functions ////
|5718|5718| 
|5719|5719| UnitAI.prototype.CanAttack = function(target)
|5720|5720| {
|    | [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
|5918|5918| 	return cmpPack && cmpPack.IsPacking();
|5919|5919| };
|5920|5920| 
|5921|    |-//// Formation specific functions ////
|    |5921|+// // Formation specific functions ////
|5922|5922| 
|5923|5923| UnitAI.prototype.IsAttackingAsFormation = function()
|5924|5924| {
|    | [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
|5923|5923| UnitAI.prototype.IsAttackingAsFormation = function()
|5924|5924| {
|5925|5925| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5926|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5927|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5926|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5927|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5928|5928| };
|5929|5929| 
|5930|5930| //// 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
|5927|5927| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5928|5928| };
|5929|5929| 
|5930|    |-//// Animal specific functions ////
|    |5930|+// // Animal specific functions ////
|5931|5931| 
|5932|5932| UnitAI.prototype.MoveRandomly = function(distance)
|5933|5933| {

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

binaries/data/mods/public/simulation/components/UnitAI.js
| 903| »   »   »   "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
| 928| »   »   »   "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
| 946| »   »   »   "leave":·function(msg)·{
|    | [NORMAL] ESLintBear (no-dupe-keys):
|    | Duplicate key 'leave'.

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

binaries/data/mods/public/simulation/components/UnitAI.js
|1044| »   »   »   »   "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
|1082| »   »   »   "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
|1115| »   »   »   »   "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
|1328| »   »   »   "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
|1627| »   »   »   »   »   return·false;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'enter' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
|2425| »   »   »   »   »   »   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
|2480| »   »   »   »   "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
|2598| »   »   »   »   "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
|2700| »   »   »   »   "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
|2909| »   »   »   »   "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
|3092| »   »   »   »   "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
|3824| »   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
|4625| »   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
|4640| »   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
|4686| »   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
|4709| »   »   ····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
|5165| »   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
| 358| »   »   ····&&·(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
| 946| »   »   »   "leave":·function(msg)·{
|    | [NORMAL] JSHintBear:
|    | Duplicate key 'leave'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1875| »   »   »   »   »   »   var·cmpFormation·=·Engine.QueryInterface(this.formationController,·IID_Formation);
|    | [NORMAL] JSHintBear:
|    | 'cmpFormation' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|2016| »   »   »   »   »   »   &&·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
|2095| »   »   »   »   »   »   »   »   ·&&·((type.generic·==·"treasure"·&&·oldType.generic·==·"treasure")
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|2170| »   »   »   »   »   »   »   »   &&·((type.generic·==·"treasure"·&&·oldType.generic·==·"treasure")
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4305| »   if·(data["target"])
|    | [NORMAL] JSHintBear:
|    | ['target'] is better written in dot notation.

binaries/data/mods/public/simulation/components/UnitAI.js
|4307| »   »   if·(data["min"]·||·data["max"])
|    | [NORMAL] JSHintBear:
|    | ['min'] is better written in dot notation.

binaries/data/mods/public/simulation/components/UnitAI.js
|4307| »   »   if·(data["min"]·||·data["max"])
|    | [NORMAL] JSHintBear:
|    | ['max'] is better written in dot notation.

binaries/data/mods/public/simulation/components/UnitAI.js
|4319| »   »   if·(data["min"]·||·data["max"])
|    | [NORMAL] JSHintBear:
|    | ['min'] is better written in dot notation.

binaries/data/mods/public/simulation/components/UnitAI.js
|4319| »   »   if·(data["min"]·||·data["max"])
|    | [NORMAL] JSHintBear:
|    | ['max'] is better written in dot notation.

binaries/data/mods/public/simulation/components/UnitAI.js
|4324| }
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4418| »   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
|4474| »   »   »   &&·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
|4642| »   »   &&·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
|4643| »   »   &&·(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
|5165| »   var·lastPos·=·undefined;
|    | [NORMAL] JSHintBear:
|    | It's not necessary to initialize 'lastPos' to 'undefined'.

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|5536| »   for·(var·targ·of·targets)
|    | [MAJOR] JSHintBear:
|    | Too many errors. (91% scanned).
Executing section cli...

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

wraitii updated this revision to Diff 8066.Sun, May 19, 4:36 PM
wraitii retitled this revision from Unit AI Motion cleanup - check ranges explicitly, move in the the State handlers instead of the orders. to Unit Motion / AI - check ranges explicitly, move in the the State handlers instead of the orders..

Updated. Needs to be committed alongside D981 since it makes that one not crash, but also relies on that one to work.

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

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
| 356| 356| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 357| 357| 		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 358| 358| 		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 359|    |-		{
|    | 359|+		
| 360| 360| 			// we were already on the shoreline, and have not moved since
| 361| 361| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
| 362| 362| 				needToMove = false;
| 363|    |-		}
|    | 363|+		
| 364| 364| 
| 365| 365| 		if (needToMove)
| 366| 366| 			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
| 354| 354| 		// Check if we need to move     TODO implement a better way to know if we are on the shoreline
| 355| 355| 		var needToMove = true;
| 356| 356| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 357|    |-		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 358|    |-		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
|    | 357|+		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x) &&
|    | 358|+		    (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 359| 359| 		{
| 360| 360| 			// we were already on the shoreline, and have not moved since
| 361| 361| 			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
| 527| 527| 					this.PushOrderFront("Walk", this.order.data.lastPos);
| 528| 528| 				}
| 529| 529| 				else
| 530|    |-				{
|    | 530|+				
| 531| 531| 					// We couldn't move there, or the target moved away
| 532| 532| 					this.FinishOrder();
| 533|    |-				}
|    | 533|+				
| 534| 534| 				return;
| 535| 535| 			}
| 536| 536| 
|    | [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
| 742| 742| 			}
| 743| 743| 			// Check if we are already in range, otherwise walk there
| 744| 744| 			if (!this.CheckGarrisonRange(msg.data.target))
| 745|    |-			{
|    | 745|+			
| 746| 746| 				if (!this.CheckTargetVisible(msg.data.target))
| 747| 747| 				{
| 748| 748| 					this.FinishOrder();
| 753| 753| 					this.SetNextState("GARRISON.APPROACHING");
| 754| 754| 					return;
| 755| 755| 				}
| 756|    |-			}
|    | 756|+			
| 757| 757| 
| 758| 758| 			this.SetNextState("GARRISON.GARRISONING");
| 759| 759| 		},
|    | [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
| 748| 748| 					this.FinishOrder();
| 749| 749| 					return;
| 750| 750| 				}
| 751|    |-				else
| 752|    |-				{
|    | 751|+				
| 753| 752| 					this.SetNextState("GARRISON.APPROACHING");
| 754| 753| 					return;
| 755|    |-				}
|    | 754|+				
| 756| 755| 			}
| 757| 756| 
| 758| 757| 			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
| 771| 771| 						this.PushOrderFront("Walk", msg.data.lastPos);
| 772| 772| 					}
| 773| 773| 					else
| 774|    |-					{
|    | 774|+					
| 775| 775| 						// We couldn't move there, or the target moved away
| 776| 776| 						this.FinishOrder();
| 777|    |-					}
|    | 777|+					
| 778| 778| 					return;
| 779| 779| 				}
| 780| 780| 
|    | [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
|1019|1019| 			},
|1020|1020| 		},
|1021|1021| 
|1022|    |-		"GARRISON":{
|    |1022|+		"GARRISON": {
|1023|1023| 			"enter": function() {
|1024|1024| 				// If the garrisonholder should pickup, warn it so it can take needed action
|1025|1025| 				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
|1239|1239| 			// If the controller handled an order but some members rejected it,
|1240|1240| 			// they will have no orders and be in the FORMATIONMEMBER.IDLE state.
|1241|1241| 			if (this.orderQueue.length)
|1242|    |-			{
|    |1242|+			
|1243|1243| 				// We're leaving the formation, so stop our FormationWalk order
|1244|1244| 				if (this.FinishOrder())
|1245|1245| 					return;
|1246|    |-			}
|    |1246|+			
|1247|1247| 
|1248|1248| 			// No orders left, we're an individual now
|1249|1249| 			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
|1267|1267| 			// Move a tile outside the building
|1268|1268| 			let range = 4;
|1269|1269| 			if (this.CheckTargetRangeExplicit(msg.data.target, range, range))
|1270|    |-			{
|    |1270|+			
|1271|1271| 				// We are already at the target, or can't move at all
|1272|1272| 				this.FinishOrder();
|1273|    |-			}
|    |1273|+			
|1274|1274| 			else
|1275|1275| 			{
|1276|1276| 				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
|1482|1482| 
|1483|1483| 			"LosRangeUpdate": function(msg) {
|1484|1484| 				if (this.GetStance().targetVisibleEnemies)
|1485|    |-				{
|    |1485|+				
|1486|1486| 					// Start attacking one of the newly-seen enemy (if any)
|1487|1487| 					this.AttackEntitiesByPreference(msg.data.added);
|1488|    |-				}
|    |1488|+				
|1489|1489| 			},
|1490|1490| 
|1491|1491| 			"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
|1519|1519| 				this.SelectAnimation("move");
|1520|1520| 			},
|1521|1521| 
|1522|    |-			"leave": function () {
|    |1522|+			"leave": function() {
|1523|1523| 				this.SelectAnimation("idle");
|1524|1524| 				this.StopMoving();
|1525|1525| 			},
|    | [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
|1696|1696| 						// if nothing better to do, check if the guarded needs to be healed or repaired
|1697|1697| 						var cmpHealth = Engine.QueryInterface(this.isGuardOf, IID_Health);
|1698|1698| 						if (cmpHealth && (cmpHealth.GetHitpoints() < cmpHealth.GetMaxHitpoints()))
|1699|    |-						{
|    |1699|+						
|1700|1700| 							if (this.CanHeal(this.isGuardOf))
|1701|1701| 								this.PushOrderFront("Heal", { "target": this.isGuardOf, "force": false });
|1702|1702| 							else if (this.CanRepair(this.isGuardOf))
|1703|1703| 								this.PushOrderFront("Repair", { "target": this.isGuardOf, "autocontinue": false, "force": false });
|1704|    |-						}
|    |1704|+						
|1705|1705| 					}
|1706|1706| 				},
|1707|1707| 
|    | [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
|1794|1794| 				"MoveCompleted": function() {
|1795|1795| 
|1796|1796| 					if (this.CheckTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1797|    |-					{
|    |1797|+					
|1798|1798| 						// If the unit needs to unpack, do so
|1799|1799| 						if (this.CanUnpack())
|1800|1800| 						{
|1803|1803| 						}
|1804|1804| 						else
|1805|1805| 							this.SetNextState("ATTACKING");
|1806|    |-					}
|    |1806|+					
|1807|1807| 					else
|1808|1808| 					{
|1809|1809| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|    | [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
|1801|1801| 							this.PushOrderFront("Unpack", { "force": true });
|1802|1802| 							return;
|1803|1803| 						}
|1804|    |-						else
|1805|    |-							this.SetNextState("ATTACKING");
|    |1804|+						this.SetNextState("ATTACKING");
|1806|1805| 					}
|1807|1806| 					else
|1808|1807| 					{
|    | [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
|1805|1805| 							this.SetNextState("ATTACKING");
|1806|1806| 					}
|1807|1807| 					else
|1808|    |-					{
|    |1808|+					
|1809|1809| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1810|1810| 						{
|1811|1811| 							this.SetNextState("APPROACHING");
|1815|1815| 							// Give up
|1816|1816| 							this.FinishOrder();
|1817|1817| 						}
|1818|    |-					}
|    |1818|+					
|1819|1819| 				},
|1820|1820| 			},
|1821|1821| 
|    | [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
|1807|1807| 					else
|1808|1808| 					{
|1809|1809| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1810|    |-						{
|    |1810|+						
|1811|1811| 							this.SetNextState("APPROACHING");
|1812|    |-						}
|    |1812|+						
|1813|1813| 						else
|1814|1814| 						{
|1815|1815| 							// Give up
|    | [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
|1811|1811| 							this.SetNextState("APPROACHING");
|1812|1812| 						}
|1813|1813| 						else
|1814|    |-						{
|    |1814|+						
|1815|1815| 							// Give up
|1816|1816| 							this.FinishOrder();
|1817|    |-						}
|    |1817|+						
|1818|1818| 					}
|1819|1819| 				},
|1820|1820| 			},
|    | [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
|1832|1832| 					}
|1833|1833| 					// Check the target is still alive and attackable
|1834|1834| 					if (this.CanAttack(target) && !this.CheckTargetAttackRange(target, this.order.data.attackType))
|1835|    |-					{
|    |1835|+					
|1836|1836| 						// Can't reach it - try to chase after it
|1837|1837| 						if (this.ShouldChaseTargetedEntity(target, this.order.data.force))
|1838|1838| 						{
|1847|1847| 								return;
|1848|1848| 							}
|1849|1849| 						}
|1850|    |-					}
|    |1850|+					
|1851|1851| 
|1852|1852| 					this.StopMoving();
|1853|1853| 
|    | [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
|1880|1880| 					// TODO: we should probably only bother syncing projectile attacks, not melee
|1881|1881| 
|1882|1882| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|1883|    |-					this.resyncAnimation = (prepare != this.attackTimers.prepare) ? true : false;
|    |1883|+					this.resyncAnimation = (prepare != this.attackTimers.prepare);
|1884|1884| 
|1885|1885| 					this.FaceTowardsTarget(this.order.data.target);
|1886|1886| 
|    | [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
|2009|2009| 
|2010|2010| 				"Attacked": function(msg) {
|2011|2011| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2012|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2013|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2012|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2013|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2014|2014| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2015|2015| 				},
|2016|2016| 			},
|    | [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
|2029|2029| 					this.SelectAnimation("move");
|2030|2030| 					var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|2031|2031| 					if (cmpUnitAI && cmpUnitAI.IsFleeing())
|2032|    |-					{
|    |2032|+					
|2033|2033| 						// Run after a fleeing target
|2034|2034| 						this.SetSpeedMultiplier(this.GetRunMultiplier());
|2035|    |-					}
|    |2035|+					
|2036|2036| 					this.StartTimer(1000, 1000);
|2037|2037| 				},
|2038|2038| 
|    | [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
|2088|2088| 						// Also don't switch to a different type of huntable animal
|2089|2089| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2090|2090| 							return (
|2091|    |-								ent != oldTarget
|2092|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2091|+								ent != oldTarget &&
|    |2092|+								 ((type.generic == "treasure" && oldType.generic == "treasure")
|2093|2093| 								 || (type.specific == oldType.specific
|2094|2094| 								 && (type.specific != "meat" || oldTemplate == template)))
|2095|2095| 							);
|    | [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
|2089|2089| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2090|2090| 							return (
|2091|2091| 								ent != oldTarget
|2092|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2093|    |-								 || (type.specific == oldType.specific
|    |2092|+								 && ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2093|+								 (type.specific == oldType.specific
|2094|2094| 								 && (type.specific != "meat" || oldTemplate == template)))
|2095|2095| 							);
|2096|2096| 						}, oldTarget);
|    | [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
|2090|2090| 							return (
|2091|2091| 								ent != oldTarget
|2092|2092| 								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2093|    |-								 || (type.specific == oldType.specific
|2094|    |-								 && (type.specific != "meat" || oldTemplate == template)))
|    |2093|+								 || (type.specific == oldType.specific &&
|    |2094|+								 (type.specific != "meat" || oldTemplate == template)))
|2095|2095| 							);
|2096|2096| 						}, oldTarget);
|2097|2097| 						if (nearby)
|    | [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
|2099|2099| 							this.PerformGather(nearby, false, false);
|2100|2100| 							return true;
|2101|2101| 						}
|2102|    |-						else
|2103|    |-						{
|    |2102|+						
|2104|2103| 							// It's probably better in this case, to avoid units getting stuck around a dropsite
|2105|2104| 							// in a "Target is far away, full, nearby are no good resources, return to dropsite" loop
|2106|2105| 							// to order it to GatherNear the resource position.
|2121|2120| 									return true;
|2122|2121| 								}
|2123|2122| 							}
|2124|    |-						}
|    |2123|+						
|2125|2124| 						return true;
|2126|2125| 					}
|2127|2126| 
|    | [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
|2111|2111| 								this.GatherNearPosition(pos.x, pos.z, oldType, oldTemplate);
|2112|2112| 								return true;
|2113|2113| 							}
|2114|    |-							else
|2115|    |-							{
|    |2114|+							
|2116|2115| 								// we're kind of stuck here. Return resource.
|2117|2116| 								var nearby = this.FindNearestDropsite(oldType.generic);
|2118|2117| 								if (nearby)
|2120|2119| 									this.PushOrderFront("ReturnResource", { "target": nearby, "force": false });
|2121|2120| 									return true;
|2122|2121| 								}
|2123|    |-							}
|    |2122|+							
|2124|2123| 						}
|2125|2124| 						return true;
|2126|2125| 					}
|    | [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
|2163|2163| 						// Also don't switch to a different type of huntable animal
|2164|2164| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2165|2165| 							return (
|2166|    |-								ent != oldTarget
|2167|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2166|+								ent != oldTarget &&
|    |2167|+								((type.generic == "treasure" && oldType.generic == "treasure")
|2168|2168| 								|| (type.specific == oldType.specific
|2169|2169| 								&& (type.specific != "meat" || oldTemplate == template)))
|2170|2170| 							);
|    | [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
|2164|2164| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2165|2165| 							return (
|2166|2166| 								ent != oldTarget
|2167|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2168|    |-								|| (type.specific == oldType.specific
|    |2167|+								&& ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2168|+								(type.specific == oldType.specific
|2169|2169| 								&& (type.specific != "meat" || oldTemplate == template)))
|2170|2170| 							);
|2171|2171| 						});
|    | [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
|2165|2165| 							return (
|2166|2166| 								ent != oldTarget
|2167|2167| 								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2168|    |-								|| (type.specific == oldType.specific
|2169|    |-								&& (type.specific != "meat" || oldTemplate == template)))
|    |2168|+								|| (type.specific == oldType.specific &&
|    |2169|+								(type.specific != "meat" || oldTemplate == template)))
|2170|2170| 							);
|2171|2171| 						});
|2172|2172| 						if (nearby)
|    | [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
|2223|2223| 					// Also don't switch to a different type of huntable animal
|2224|2224| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2225|2225| 						return (
|2226|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2227|    |-							|| (type.specific == resourceType.specific
|    |2226|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2227|+							(type.specific == resourceType.specific
|2228|2228| 							&& (type.specific != "meat" || resourceTemplate == template))
|2229|2229| 						);
|2230|2230| 					});
|    | [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
|2224|2224| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2225|2225| 						return (
|2226|2226| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2227|    |-							|| (type.specific == resourceType.specific
|2228|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2227|+							|| (type.specific == resourceType.specific &&
|    |2228|+							(type.specific != "meat" || resourceTemplate == template))
|2229|2229| 						);
|2230|2230| 					});
|2231|2231| 
|    | [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
|2341|2341| 
|2342|2342| 					var cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply);
|2343|2343| 					if (cmpSupply && cmpSupply.IsAvailable(cmpOwnership.GetOwner(), this.entity))
|2344|    |-					{
|    |2344|+					
|2345|2345| 						// Check we can still reach and gather from the target
|2346|2346| 						if (this.CheckTargetRange(this.gatheringTarget, IID_ResourceGatherer) && this.CanGather(this.gatheringTarget))
|2347|2347| 						{
|2406|2406| 								return;
|2407|2407| 							}
|2408|2408| 						}
|2409|    |-					}
|    |2409|+					
|2410|2410| 
|2411|2411| 					// We're already in range, can't get anywhere near it or the target is exhausted.
|2412|2412| 
|    | [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
|2432|2432| 					// Also don't switch to a different type of huntable animal
|2433|2433| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2434|2434| 						return (
|2435|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2436|    |-							|| (type.specific == resourceType.specific
|    |2435|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2436|+							(type.specific == resourceType.specific
|2437|2437| 							&& (type.specific != "meat" || resourceTemplate == template))
|2438|2438| 						);
|2439|2439| 					});
|    | [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
|2433|2433| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2434|2434| 						return (
|2435|2435| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2436|    |-							|| (type.specific == resourceType.specific
|2437|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2436|+							|| (type.specific == resourceType.specific &&
|    |2437|+							(type.specific != "meat" || resourceTemplate == template))
|2438|2438| 						);
|2439|2439| 					});
|2440|2440| 					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
|2498|2498| 
|2499|2499| 				"Timer": function(msg) {
|2500|2500| 					if (this.ShouldAbandonChase(this.order.data.target, this.order.data.force, IID_Heal, null))
|2501|    |-					{
|    |2501|+					
|2502|2502| 						// Return to our original position unless we have a better order.
|2503|2503| 						if (!this.FinishOrder() && this.GetStance().respondHoldGround)
|2504|2504| 							this.WalkToHeldPosition();
|2505|    |-					}
|    |2505|+					
|2506|2506| 				},
|2507|2507| 
|2508|2508| 				"MoveCompleted": 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
|2532|2532| 					this.StartTimer(prepare, this.healTimers.repeat);
|2533|2533| 
|2534|2534| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2535|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2535|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2536|2536| 
|2537|2537| 					this.FaceTowardsTarget(this.order.data.target);
|2538|2538| 				},
|    | [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
|2744|2744| 					{
|2745|2745| 						// The building was already finished/fully repaired before we arrived;
|2746|2746| 						// let the ConstructionFinished handler handle this.
|2747|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2747|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2748|2748| 						return true;
|2749|2749| 					}
|2750|2750| 
|    | [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
|2744|2744| 					{
|2745|2745| 						// The building was already finished/fully repaired before we arrived;
|2746|2746| 						// let the ConstructionFinished handler handle this.
|2747|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2747|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2748|2748| 						return true;
|2749|2749| 					}
|2750|2750| 
|    | [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
|2787|2787| 					if (!inRange && this.MoveToTargetRange(this.repairTarget, IID_Builder))
|2788|2788| 						this.SetNextState("APPROACHING");
|2789|2789| 					else if (!inRange)
|2790|    |-						this.FinishOrder(); //can't approach and isn't in reach
|    |2790|+						this.FinishOrder(); // can't approach and isn't in reach
|2791|2791| 				},
|2792|2792| 			},
|2793|2793| 
|    | [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
|2874|2874| 
|2875|2875| 				// Unit was approaching and there's nothing to do now, so switch to walking
|2876|2876| 				if (oldState === "INDIVIDUAL.REPAIR.APPROACHING")
|2877|    |-				{
|    |2877|+				
|2878|2878| 					// We're already walking to the given point, so add this as a order.
|2879|2879| 					this.WalkToTarget(msg.data.newentity, true);
|2880|    |-				}
|    |2880|+				
|2881|2881| 			},
|2882|2882| 		},
|2883|2883| 
|    | [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
|2936|2936| 
|2937|2937| 					// Check that we can garrison here
|2938|2938| 					if (this.CanGarrison(target))
|2939|    |-					{
|    |2939|+					
|2940|2940| 						// Check that we're in range of the garrison target
|2941|2941| 						if (this.CheckGarrisonRange(target))
|2942|2942| 						{
|3012|3012| 								return false;
|3013|3013| 							}
|3014|3014| 						}
|3015|    |-					}
|    |3015|+					
|3016|3016| 					// Garrisoning failed for some reason, so finish the order
|3017|3017| 					this.FinishOrder();
|3018|3018| 					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
|3133|3133| 		"Attacked": function(msg) {
|3134|3134| 			if (this.template.NaturalBehaviour == "skittish" ||
|3135|3135| 			    this.template.NaturalBehaviour == "passive")
|3136|    |-			{
|    |3136|+			
|3137|3137| 				this.Flee(msg.data.attacker, false);
|3138|    |-			}
|    |3138|+			
|3139|3139| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|3140|3140| 			{
|3141|3141| 				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
|3142|3142| 					this.Attack(msg.data.attacker, false);
|3143|3143| 			}
|3144|3144| 			else if (this.template.NaturalBehaviour == "domestic")
|3145|    |-			{
|    |3145|+			
|3146|3146| 				// Never flee, stop what we were doing
|3147|3147| 				this.SetNextState("IDLE");
|3148|    |-			}
|    |3148|+			
|3149|3149| 		},
|3150|3150| 
|3151|3151| 		"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
|3156|3156| 				this.FinishOrder();
|3157|3157| 				return;
|3158|3158| 			}
|3159|    |-			else
|3160|    |-			{
|    |3159|+			
|3161|3160| 				this.order.data.min = range;
|3162|3161| 				this.SetNextState("WALKING");
|3163|    |-			}
|    |3162|+			
|3164|3163| 		},
|3165|3164| 
|3166|3165| 		"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
|3200|3200| 				}
|3201|3201| 				// Start attacking one of the newly-seen enemy (if any)
|3202|3202| 				else if (this.IsDangerousAnimal())
|3203|    |-				{
|    |3203|+				
|3204|3204| 					this.AttackVisibleEntity(msg.data.added);
|3205|    |-				}
|    |3205|+				
|3206|3206| 
|3207|3207| 				// TODO: if two units enter our range together, we'll attack the
|3208|3208| 				// 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
|3243|3243| 				}
|3244|3244| 				// Start attacking one of the newly-seen enemy (if any)
|3245|3245| 				else if (this.template.NaturalBehaviour == "violent")
|3246|    |-				{
|    |3246|+				
|3247|3247| 					this.AttackVisibleEntity(msg.data.added);
|3248|    |-				}
|    |3248|+				
|3249|3249| 			},
|3250|3250| 
|3251|3251| 			"MoveCompleted": function() { },
|    | [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
|3260|3260| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3261|3261| 
|3262|3262| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3263|    |-							// only used for domestic animals
|    |3263|+		// only used for domestic animals
|3264|3264| 	},
|3265|3265| };
|3266|3266| 
|    | [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
|3317|3317| 
|3318|3318| UnitAI.prototype.IsAnimal = function()
|3319|3319| {
|3320|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3320|+	return (!!this.template.NaturalBehaviour);
|3321|3321| };
|3322|3322| 
|3323|3323| 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
|3355|3355| UnitAI.prototype.GetGarrisonHolder = function()
|3356|3356| {
|3357|3357| 	if (this.IsGarrisoned())
|3358|    |-	{
|    |3358|+	
|3359|3359| 		for (let order of this.orderQueue)
|3360|3360| 			if (order.type == "Garrison")
|3361|3361| 				return order.data.target;
|3362|    |-	}
|    |3362|+	
|3363|3363| 	return INVALID_ENTITY;
|3364|3364| };
|3365|3365| 
|    | [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
|3433|3433| 		{
|3434|3434| 			let index = this.GetCurrentState().indexOf(".");
|3435|3435| 			if (index != -1)
|3436|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3436|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3437|3437| 			this.Stop(false);
|3438|3438| 		}
|3439|3439| 
|    | [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
|3489|3489| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3490|3490| 			continue;
|3491|3491| 		if (i == 0)
|3492|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3492|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3493|3493| 		else
|3494|3494| 			this.orderQueue.splice(i, 1);
|3495|3495| 		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
|3489|3489| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3490|3490| 			continue;
|3491|3491| 		if (i == 0)
|3492|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3492|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3493|3493| 		else
|3494|3494| 			this.orderQueue.splice(i, 1);
|3495|3495| 		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
|3573|3573| };
|3574|3574| 
|3575|3575| 
|3576|    |-//// FSM linkage functions ////
|    |3576|+// // FSM linkage functions ////
|3577|3577| 
|3578|3578| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3579|3579| 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
|3745|3745| 				continue;
|3746|3746| 			if (this.orderQueue[i].type == type)
|3747|3747| 				continue;
|3748|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3748|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3749|3749| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3750|3750| 			return;
|3751|3751| 		}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3745|3745| 				continue;
|3746|3746| 			if (this.orderQueue[i].type == type)
|3747|3747| 				continue;
|3748|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3748|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3749|3749| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3750|3750| 			return;
|3751|3751| 		}
|    | [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
|3759|3759| {
|3760|3760| 	// Remember the previous work orders to be able to go back to them later if required
|3761|3761| 	if (data && data.force)
|3762|    |-	{
|    |3762|+	
|3763|3763| 		if (this.IsFormationController())
|3764|3764| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3765|3765| 		else
|3766|3766| 			this.UpdateWorkOrders(type);
|3767|    |-	}
|    |3767|+	
|3768|3768| 
|3769|3769| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3770|3770| 
|    | [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
|3836|3836| 	{
|3837|3837| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3838|3838| 		if (cmpUnitAI)
|3839|    |-		{
|    |3839|+		
|3840|3840| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3841|3841| 			{
|3842|3842| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3845|3845| 					return;
|3846|3846| 				}
|3847|3847| 			}
|3848|    |-		}
|    |3848|+		
|3849|3849| 	}
|3850|3850| 
|3851|3851| 	// 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
|3838|3838| 		if (cmpUnitAI)
|3839|3839| 		{
|3840|3840| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3841|    |-			{
|    |3841|+			
|3842|3842| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3843|3843| 				{
|3844|3844| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3845|3845| 					return;
|3846|3846| 				}
|3847|    |-			}
|    |3847|+			
|3848|3848| 		}
|3849|3849| 	}
|3850|3850| 
|    | [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
|3850|3850| 
|3851|3851| 	// If nothing found, take the unit orders
|3852|3852| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3853|    |-	{
|    |3853|+	
|3854|3854| 		if (isWorkType(this.orderQueue[i].type))
|3855|3855| 		{
|3856|3856| 			this.workOrders = this.orderQueue.slice(i);
|3857|3857| 			return;
|3858|3858| 		}
|3859|    |-	}
|    |3859|+	
|3860|3860| };
|3861|3861| 
|3862|3862| 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
|3916|3916| 	if (data.timerRepeat === undefined)
|3917|3917| 		this.timer = undefined;
|3918|3918| 
|3919|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3919|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3920|3920| };
|3921|3921| 
|3922|3922| /**
|    | [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
|3916|3916| 	if (data.timerRepeat === undefined)
|3917|3917| 		this.timer = undefined;
|3918|3918| 
|3919|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3919|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3920|3920| };
|3921|3921| 
|3922|3922| /**
|    | [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
|3951|3951| 	this.timer = undefined;
|3952|3952| };
|3953|3953| 
|3954|    |-//// Message handlers /////
|    |3954|+// // Message handlers /////
|3955|3955| 
|3956|3956| UnitAI.prototype.OnMotionChanged = function(msg)
|3957|3957| {
|    | [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
|3956|3956| UnitAI.prototype.OnMotionChanged = function(msg)
|3957|3957| {
|3958|3958| 	if (msg.starting && !msg.error)
|3959|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3959|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveStarted", "data": msg});
|3960|3960| 	else if (!msg.starting || msg.error)
|3961|3961| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3962|3962| };
|    | [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
|3956|3956| UnitAI.prototype.OnMotionChanged = function(msg)
|3957|3957| {
|3958|3958| 	if (msg.starting && !msg.error)
|3959|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3959|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg });
|3960|3960| 	else if (!msg.starting || msg.error)
|3961|3961| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3962|3962| };
|    | [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
|3958|3958| 	if (msg.starting && !msg.error)
|3959|3959| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3960|3960| 	else if (!msg.starting || msg.error)
|3961|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3961|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveCompleted", "data": msg});
|3962|3962| };
|3963|3963| 
|3964|3964| UnitAI.prototype.OnGlobalConstructionFinished = 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
|3958|3958| 	if (msg.starting && !msg.error)
|3959|3959| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3960|3960| 	else if (!msg.starting || msg.error)
|3961|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3961|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg });
|3962|3962| };
|3963|3963| 
|3964|3964| UnitAI.prototype.OnGlobalConstructionFinished = 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
|3966|3966| 	// TODO: This is a bit inefficient since every unit listens to every
|3967|3967| 	// construction message - ideally we could scope it to only the one we're building
|3968|3968| 
|3969|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3969|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3970|3970| };
|3971|3971| 
|3972|3972| 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
|3966|3966| 	// TODO: This is a bit inefficient since every unit listens to every
|3967|3967| 	// construction message - ideally we could scope it to only the one we're building
|3968|3968| 
|3969|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3969|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3970|3970| };
|3971|3971| 
|3972|3972| 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
|3991|3991| 
|3992|3992| UnitAI.prototype.OnAttacked = function(msg)
|3993|3993| {
|3994|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3994|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3995|3995| };
|3996|3996| 
|3997|3997| 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
|3991|3991| 
|3992|3992| UnitAI.prototype.OnAttacked = function(msg)
|3993|3993| {
|3994|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3994|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3995|3995| };
|3996|3996| 
|3997|3997| 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
|3996|3996| 
|3997|3997| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3998|3998| {
|3999|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3999|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4000|4000| };
|4001|4001| 
|4002|4002| 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
|3996|3996| 
|3997|3997| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3998|3998| {
|3999|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3999|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4000|4000| };
|4001|4001| 
|4002|4002| 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
|4001|4001| 
|4002|4002| UnitAI.prototype.OnHealthChanged = function(msg)
|4003|4003| {
|4004|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4004|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4005|4005| };
|4006|4006| 
|4007|4007| 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
|4001|4001| 
|4002|4002| UnitAI.prototype.OnHealthChanged = function(msg)
|4003|4003| {
|4004|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4004|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4005|4005| };
|4006|4006| 
|4007|4007| 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
|4007|4007| UnitAI.prototype.OnRangeUpdate = function(msg)
|4008|4008| {
|4009|4009| 	if (msg.tag == this.losRangeQuery)
|4010|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4010|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4011|4011| 	else if (msg.tag == this.losHealRangeQuery)
|4012|4012| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4013|4013| };
|    | [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
|4007|4007| UnitAI.prototype.OnRangeUpdate = function(msg)
|4008|4008| {
|4009|4009| 	if (msg.tag == this.losRangeQuery)
|4010|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4010|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4011|4011| 	else if (msg.tag == this.losHealRangeQuery)
|4012|4012| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4013|4013| };
|    | [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
|4009|4009| 	if (msg.tag == this.losRangeQuery)
|4010|4010| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4011|4011| 	else if (msg.tag == this.losHealRangeQuery)
|4012|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4012|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4013|4013| };
|4014|4014| 
|4015|4015| 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
|4009|4009| 	if (msg.tag == this.losRangeQuery)
|4010|4010| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4011|4011| 	else if (msg.tag == this.losHealRangeQuery)
|4012|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4012|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4013|4013| };
|4014|4014| 
|4015|4015| 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
|4014|4014| 
|4015|4015| UnitAI.prototype.OnPackFinished = function(msg)
|4016|4016| {
|4017|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4017|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4018|4018| };
|4019|4019| 
|4020|4020| //// 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
|4014|4014| 
|4015|4015| UnitAI.prototype.OnPackFinished = function(msg)
|4016|4016| {
|4017|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4017|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4018|4018| };
|4019|4019| 
|4020|4020| //// 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
|4017|4017| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4018|4018| };
|4019|4019| 
|4020|    |-//// Helper functions to be called by the FSM ////
|    |4020|+// // Helper functions to be called by the FSM ////
|4021|4021| 
|4022|4022| UnitAI.prototype.GetWalkSpeed = function()
|4023|4023| {
|    | [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
|4119|4119| 	if (!cmpOwnership || cmpOwnership.GetOwner() == INVALID_PLAYER)
|4120|4120| 		return undefined;
|4121|4121| 
|4122|    |-	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position)
|    |4122|+	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
|4123|4123| 	if (!cmpPosition || !cmpPosition.IsInWorld())
|4124|4124| 		return undefined;
|4125|4125| 
|    | [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
|4204|4204| 			PlaySound(name, member);
|4205|4205| 	}
|4206|4206| 	else
|4207|    |-	{
|    |4207|+	
|4208|4208| 		// Otherwise use our own sounds
|4209|4209| 		PlaySound(name, this.entity);
|4210|    |-	}
|    |4210|+	
|4211|4211| };
|4212|4212| 
|4213|4213| /*
|    | [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
|4300|4300| UnitAI.prototype.MoveTo = function(data, iid, type)
|4301|4301| {
|4302|4302| 	if (data["target"])
|4303|    |-	{
|    |4303|+	
|4304|4304| 		if (data["min"] || data["max"])
|4305|4305| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4306|4306| 		else
|4310|4310| 			else
|4311|4311| 				return this.MoveToTargetRange(data.target, iid, type);
|4312|4312| 		}
|4313|    |-	}
|    |4313|+	
|4314|4314| 	else
|4315|4315| 	{
|4316|4316| 		if (data["min"] || data["max"])
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["target"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4299|4299|  */
|4300|4300| UnitAI.prototype.MoveTo = function(data, iid, type)
|4301|4301| {
|4302|    |-	if (data["target"])
|    |4302|+	if (data.target)
|4303|4303| 	{
|4304|4304| 		if (data["min"] || data["max"])
|4305|4305| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["min"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4301|4301| {
|4302|4302| 	if (data["target"])
|4303|4303| 	{
|4304|    |-		if (data["min"] || data["max"])
|    |4304|+		if (data.min || data["max"])
|4305|4305| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4306|4306| 		else
|4307|4307| 		{
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["max"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4301|4301| {
|4302|4302| 	if (data["target"])
|4303|4303| 	{
|4304|    |-		if (data["min"] || data["max"])
|    |4304|+		if (data["min"] || data.max)
|4305|4305| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4306|4306| 		else
|4307|4307| 		{
|    | [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
|4304|4304| 		if (data["min"] || data["max"])
|4305|4305| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4306|4306| 		else
|4307|    |-		{
|    |4307|+		
|4308|4308| 			if (!iid)
|4309|4309| 				return this.MoveToTarget(data.target);
|4310|4310| 			else
|4311|4311| 				return this.MoveToTargetRange(data.target, iid, type);
|4312|    |-		}
|    |4312|+		
|4313|4313| 	}
|4314|4314| 	else
|4315|4315| 	{
|    | [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
|4303|4303| 	{
|4304|4304| 		if (data["min"] || data["max"])
|4305|4305| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4306|    |-		else
|4307|    |-		{
|    |4306|+		
|4308|4307| 			if (!iid)
|4309|4308| 				return this.MoveToTarget(data.target);
|4310|4309| 			else
|4311|4310| 				return this.MoveToTargetRange(data.target, iid, type);
|4312|    |-		}
|    |4311|+		
|4313|4312| 	}
|4314|4313| 	else
|4315|4314| 	{
|    | [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
|4307|4307| 		{
|4308|4308| 			if (!iid)
|4309|4309| 				return this.MoveToTarget(data.target);
|4310|    |-			else
|4311|    |-				return this.MoveToTargetRange(data.target, iid, type);
|    |4310|+			return this.MoveToTargetRange(data.target, iid, type);
|4312|4311| 		}
|4313|4312| 	}
|4314|4313| 	else
|    | [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
|4312|4312| 		}
|4313|4313| 	}
|4314|4314| 	else
|4315|    |-	{
|    |4315|+	
|4316|4316| 		if (data["min"] || data["max"])
|4317|4317| 			return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1);
|4318|4318| 		else
|4319|4319| 			return this.MoveToPoint(data.x, data.z);
|4320|    |-	}
|    |4320|+	
|4321|4321| }
|4322|4322| 
|4323|4323| UnitAI.prototype.MoveToPoint = function(x, z)
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["min"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4313|4313| 	}
|4314|4314| 	else
|4315|4315| 	{
|4316|    |-		if (data["min"] || data["max"])
|    |4316|+		if (data.min || data["max"])
|4317|4317| 			return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1);
|4318|4318| 		else
|4319|4319| 			return this.MoveToPoint(data.x, data.z);
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["max"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4313|4313| 	}
|4314|4314| 	else
|4315|4315| 	{
|4316|    |-		if (data["min"] || data["max"])
|    |4316|+		if (data["min"] || data.max)
|4317|4317| 			return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1);
|4318|4318| 		else
|4319|4319| 			return this.MoveToPoint(data.x, data.z);
|    | [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
|4315|4315| 	{
|4316|4316| 		if (data["min"] || data["max"])
|4317|4317| 			return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1);
|4318|    |-		else
|4319|    |-			return this.MoveToPoint(data.x, data.z);
|    |4318|+		return this.MoveToPoint(data.x, data.z);
|4320|4319| 	}
|4321|4320| }
|4322|4321| 
|    | [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
|4318|4318| 		else
|4319|4319| 			return this.MoveToPoint(data.x, data.z);
|4320|4320| 	}
|4321|    |-}
|    |4321|+};
|4322|4322| 
|4323|4323| UnitAI.prototype.MoveToPoint = function(x, z)
|4324|4324| {
|    | [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
|4402|4402| 	else
|4403|4403| 		// return false? Or hope you come close enough?
|4404|4404| 		var parabolicMaxRange = 0;
|4405|    |-		//return false;
|    |4405|+		// return false;
|4406|4406| 
|4407|4407| 	// the parabole changes while walking, take something in the middle
|4408|4408| 	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
|4467|4467| 	if (this.IsFormationMember())
|4468|4468| 	{
|4469|4469| 		var cmpFormationUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|4470|    |-		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation()
|4471|    |-			&& cmpFormationUnitAI.order.data.target == target)
|    |4470|+		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation() &&
|    |4471|+			cmpFormationUnitAI.order.data.target == target)
|4472|4472| 			return true;
|4473|4473| 	}
|4474|4474| 
|    | [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
|4635|4635| UnitAI.prototype.AttackEntityInZone = function(ents)
|4636|4636| {
|4637|4637| 	var target = ents.find(target =>
|4638|    |-		this.CanAttack(target)
|4639|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4638|+		this.CanAttack(target) &&
|    |4639|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4640|4640| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4641|4641| 	);
|4642|4642| 	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
|4636|4636| {
|4637|4637| 	var target = ents.find(target =>
|4638|4638| 		this.CanAttack(target)
|4639|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4640|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4639|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4640|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4641|4641| 	);
|4642|4642| 	if (!target)
|4643|4643| 		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
|4700|4700| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4701|4701| 	if (this.isGuardOf)
|4702|4702| 	{
|4703|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4703|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4704|4704| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4705|4705| 		if (cmpUnitAI && cmpAttack &&
|4706|4706| 		    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
|4704|4704| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4705|4705| 		if (cmpUnitAI && cmpAttack &&
|4706|4706| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4707|    |-				return false;
|    |4707|+			return false;
|4708|4708| 	}
|4709|4709| 
|4710|4710| 	// 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
|4709|4709| 
|4710|4710| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4711|4711| 	if (this.GetStance().respondHoldGround)
|4712|    |-	{
|    |4712|+	
|4713|4713| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4714|4714| 			return true;
|4715|    |-	}
|    |4715|+	
|4716|4716| 
|4717|4717| 	// Stop if it's left our vision range, unless we're especially persistent
|4718|4718| 	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
|4716|4716| 
|4717|4717| 	// Stop if it's left our vision range, unless we're especially persistent
|4718|4718| 	if (!this.GetStance().respondChaseBeyondVision)
|4719|    |-	{
|    |4719|+	
|4720|4720| 		if (!this.CheckTargetIsInVisionRange(target))
|4721|4721| 			return true;
|4722|    |-	}
|    |4722|+	
|4723|4723| 
|4724|4724| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4725|4725| 	// 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
|4742|4742| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4743|4743| 	if (this.isGuardOf)
|4744|4744| 	{
|4745|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4745|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4746|4746| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4747|4747| 		if (cmpUnitAI && cmpAttack &&
|4748|4748| 		    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
|4755|4755| 	return false;
|4756|4756| };
|4757|4757| 
|4758|    |-//// External interface functions ////
|    |4758|+// // External interface functions ////
|4759|4759| 
|4760|4760| UnitAI.prototype.SetFormationController = function(ent)
|4761|4761| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4765|4765| 	// of our own formation (or ourself if not in formation)
|4766|4766| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4767|4767| 	if (cmpObstruction)
|4768|    |-	{
|    |4768|+	
|4769|4769| 		if (ent == INVALID_ENTITY)
|4770|4770| 			cmpObstruction.SetControlGroup(this.entity);
|4771|4771| 		else
|4772|4772| 			cmpObstruction.SetControlGroup(ent);
|4773|    |-	}
|    |4773|+	
|4774|4774| 
|4775|4775| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4776|4776| 	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
|4908|4908| 	// if we already had an old guard order, do nothing if the target is the same
|4909|4909| 	// and the order is running, otherwise remove the previous order
|4910|4910| 	if (this.isGuardOf)
|4911|    |-	{
|    |4911|+	
|4912|4912| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4913|4913| 			return;
|4914|4914| 		else
|4915|4915| 			this.RemoveGuard();
|4916|    |-	}
|    |4916|+	
|4917|4917| 
|4918|4918| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4919|4919| };
|    | [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
|4911|4911| 	{
|4912|4912| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4913|4913| 			return;
|4914|    |-		else
|4915|    |-			this.RemoveGuard();
|    |4914|+		this.RemoveGuard();
|4916|4915| 	}
|4917|4916| 
|4918|4917| 	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
|5082|5082| 			this.WalkToTarget(target, queued);
|5083|5083| 		return;
|5084|5084| 	}
|5085|    |-	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture}, queued);
|    |5085|+	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture }, queued);
|5086|5086| };
|5087|5087| 
|5088|5088| /**
|    | [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
|5231|5231| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5232|5232| 	{
|5233|5233| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5234|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5234|+		if (cmpTrader.HasBothMarkets() &&
|5235|5235| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5236|5236| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5237|5237| 		{
|    | [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
|5512|5512| 				{
|5513|5513| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5514|5514| 					var targetClasses = this.order.data.targetClasses;
|5515|    |-					if (targetClasses.attack && cmpIdentity
|5516|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5515|+					if (targetClasses.attack && cmpIdentity &&
|    |5516|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5517|5517| 						continue;
|5518|5518| 					if (targetClasses.avoid && cmpIdentity
|5519|5519| 						&& 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
|5515|5515| 					if (targetClasses.attack && cmpIdentity
|5516|5516| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5517|5517| 						continue;
|5518|    |-					if (targetClasses.avoid && cmpIdentity
|5519|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5518|+					if (targetClasses.avoid && cmpIdentity &&
|    |5519|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5520|5520| 						continue;
|5521|5521| 					// Only used by the AIs to prevent some choices of targets
|5522|5522| 					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
|5538|5538| 		{
|5539|5539| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5540|5540| 			var targetClasses = this.order.data.targetClasses;
|5541|    |-			if (cmpIdentity && targetClasses.attack
|5542|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5541|+			if (cmpIdentity && targetClasses.attack &&
|    |5542|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5543|5543| 				continue;
|5544|5544| 			if (cmpIdentity && targetClasses.avoid
|5545|5545| 				&& 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
|5541|5541| 			if (cmpIdentity && targetClasses.attack
|5542|5542| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5543|5543| 				continue;
|5544|    |-			if (cmpIdentity && targetClasses.avoid
|5545|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5544|+			if (cmpIdentity && targetClasses.avoid &&
|    |5545|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5546|5546| 				continue;
|5547|5547| 			// Only used by the AIs to prevent some choices of targets
|5548|5548| 			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
|5684|5684| 
|5685|5685| UnitAI.prototype.SetHeldPosition = function(x, z)
|5686|5686| {
|5687|    |-	this.heldPosition = {"x": x, "z": z};
|    |5687|+	this.heldPosition = { "x": x, "z": z};
|5688|5688| };
|5689|5689| 
|5690|5690| 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
|5684|5684| 
|5685|5685| UnitAI.prototype.SetHeldPosition = function(x, z)
|5686|5686| {
|5687|    |-	this.heldPosition = {"x": x, "z": z};
|    |5687|+	this.heldPosition = {"x": x, "z": z };
|5688|5688| };
|5689|5689| 
|5690|5690| 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
|5711|5711| 	return false;
|5712|5712| };
|5713|5713| 
|5714|    |-//// Helper functions ////
|    |5714|+// // Helper functions ////
|5715|5715| 
|5716|5716| UnitAI.prototype.CanAttack = function(target)
|5717|5717| {
|    | [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
|5915|5915| 	return cmpPack && cmpPack.IsPacking();
|5916|5916| };
|5917|5917| 
|5918|    |-//// Formation specific functions ////
|    |5918|+// // Formation specific functions ////
|5919|5919| 
|5920|5920| UnitAI.prototype.IsAttackingAsFormation = function()
|5921|5921| {
|    | [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
|5920|5920| UnitAI.prototype.IsAttackingAsFormation = function()
|5921|5921| {
|5922|5922| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5923|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5924|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5923|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5924|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5925|5925| };
|5926|5926| 
|5927|5927| //// 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
|5924|5924| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5925|5925| };
|5926|5926| 
|5927|    |-//// Animal specific functions ////
|    |5927|+// // Animal specific functions ////
|5928|5928| 
|5929|5929| UnitAI.prototype.MoveRandomly = function(distance)
|5930|5930| {

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

binaries/data/mods/public/simulation/components/UnitAI.js
| 903| »   »   »   "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
| 928| »   »   »   "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
| 946| »   »   »   "leave":·function(msg)·{
|    | [NORMAL] ESLintBear (no-dupe-keys):
|    | Duplicate key 'leave'.

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

binaries/data/mods/public/simulation/components/UnitAI.js
|1044| »   »   »   »   "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
|1082| »   »   »   "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
|1115| »   »   »   »   "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
|1328| »   »   »   "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
|1624| »   »   »   »   »   return·false;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'enter' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
|2422| »   »   »   »   »   »   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
|2477| »   »   »   »   "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
|2595| »   »   »   »   "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
|2697| »   »   »   »   "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
|2906| »   »   »   »   "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
|3089| »   »   »   »   "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
|3821| »   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
|4622| »   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
|4637| »   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
|4683| »   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
|4706| »   »   ····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
|5162| »   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
| 358| »   »   ····&&·(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
| 946| »   »   »   "leave":·function(msg)·{
|    | [NORMAL] JSHintBear:
|    | Duplicate key 'leave'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1872| »   »   »   »   »   »   var·cmpFormation·=·Engine.QueryInterface(this.formationController,·IID_Formation);
|    | [NORMAL] JSHintBear:
|    | 'cmpFormation' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|2013| »   »   »   »   »   »   &&·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
|2092| »   »   »   »   »   »   »   »   ·&&·((type.generic·==·"treasure"·&&·oldType.generic·==·"treasure")
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|2167| »   »   »   »   »   »   »   »   &&·((type.generic·==·"treasure"·&&·oldType.generic·==·"treasure")
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4302| »   if·(data["target"])
|    | [NORMAL] JSHintBear:
|    | ['target'] is better written in dot notation.

binaries/data/mods/public/simulation/components/UnitAI.js
|4304| »   »   if·(data["min"]·||·data["max"])
|    | [NORMAL] JSHintBear:
|    | ['min'] is better written in dot notation.

binaries/data/mods/public/simulation/components/UnitAI.js
|4304| »   »   if·(data["min"]·||·data["max"])
|    | [NORMAL] JSHintBear:
|    | ['max'] is better written in dot notation.

binaries/data/mods/public/simulation/components/UnitAI.js
|4316| »   »   if·(data["min"]·||·data["max"])
|    | [NORMAL] JSHintBear:
|    | ['min'] is better written in dot notation.

binaries/data/mods/public/simulation/components/UnitAI.js
|4316| »   »   if·(data["min"]·||·data["max"])
|    | [NORMAL] JSHintBear:
|    | ['max'] is better written in dot notation.

binaries/data/mods/public/simulation/components/UnitAI.js
|4321| }
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4415| »   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
|4471| »   »   »   &&·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
|4639| »   »   &&·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
|4640| »   »   &&·(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
|5162| »   var·lastPos·=·undefined;
|    | [NORMAL] JSHintBear:
|    | It's not necessary to initialize 'lastPos' to 'undefined'.

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|5533| »   for·(var·targ·of·targets)
|    | [MAJOR] JSHintBear:
|    | Too many errors. (91% scanned).
Executing section cli...

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

wraitii updated this revision to Diff 8120.Sat, May 25, 4:21 PM

Fix c++ logic for stopping and I had missed something in UnitAI / Guard.

This appears to work along with D981 so I intend to commit this soon enough as it's really the cornerstone of every one of my other patches.

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

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
| 356| 356| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 357| 357| 		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 358| 358| 		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 359|    |-		{
|    | 359|+		
| 360| 360| 			// we were already on the shoreline, and have not moved since
| 361| 361| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
| 362| 362| 				needToMove = false;
| 363|    |-		}
|    | 363|+		
| 364| 364| 
| 365| 365| 		if (needToMove)
| 366| 366| 			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
| 354| 354| 		// Check if we need to move     TODO implement a better way to know if we are on the shoreline
| 355| 355| 		var needToMove = true;
| 356| 356| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 357|    |-		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 358|    |-		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
|    | 357|+		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x) &&
|    | 358|+		    (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 359| 359| 		{
| 360| 360| 			// we were already on the shoreline, and have not moved since
| 361| 361| 			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
| 527| 527| 					this.PushOrderFront("Walk", this.order.data.lastPos);
| 528| 528| 				}
| 529| 529| 				else
| 530|    |-				{
|    | 530|+				
| 531| 531| 					// We couldn't move there, or the target moved away
| 532| 532| 					this.FinishOrder();
| 533|    |-				}
|    | 533|+				
| 534| 534| 				return;
| 535| 535| 			}
| 536| 536| 
|    | [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
| 742| 742| 			}
| 743| 743| 			// Check if we are already in range, otherwise walk there
| 744| 744| 			if (!this.CheckGarrisonRange(msg.data.target))
| 745|    |-			{
|    | 745|+			
| 746| 746| 				if (!this.CheckTargetVisible(msg.data.target))
| 747| 747| 				{
| 748| 748| 					this.FinishOrder();
| 753| 753| 					this.SetNextState("GARRISON.APPROACHING");
| 754| 754| 					return;
| 755| 755| 				}
| 756|    |-			}
|    | 756|+			
| 757| 757| 
| 758| 758| 			this.SetNextState("GARRISON.GARRISONING");
| 759| 759| 		},
|    | [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
| 748| 748| 					this.FinishOrder();
| 749| 749| 					return;
| 750| 750| 				}
| 751|    |-				else
| 752|    |-				{
|    | 751|+				
| 753| 752| 					this.SetNextState("GARRISON.APPROACHING");
| 754| 753| 					return;
| 755|    |-				}
|    | 754|+				
| 756| 755| 			}
| 757| 756| 
| 758| 757| 			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
| 771| 771| 						this.PushOrderFront("Walk", msg.data.lastPos);
| 772| 772| 					}
| 773| 773| 					else
| 774|    |-					{
|    | 774|+					
| 775| 775| 						// We couldn't move there, or the target moved away
| 776| 776| 						this.FinishOrder();
| 777|    |-					}
|    | 777|+					
| 778| 778| 					return;
| 779| 779| 				}
| 780| 780| 
|    | [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
|1019|1019| 			},
|1020|1020| 		},
|1021|1021| 
|1022|    |-		"GARRISON":{
|    |1022|+		"GARRISON": {
|1023|1023| 			"enter": function() {
|1024|1024| 				// If the garrisonholder should pickup, warn it so it can take needed action
|1025|1025| 				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
|1239|1239| 			// If the controller handled an order but some members rejected it,
|1240|1240| 			// they will have no orders and be in the FORMATIONMEMBER.IDLE state.
|1241|1241| 			if (this.orderQueue.length)
|1242|    |-			{
|    |1242|+			
|1243|1243| 				// We're leaving the formation, so stop our FormationWalk order
|1244|1244| 				if (this.FinishOrder())
|1245|1245| 					return;
|1246|    |-			}
|    |1246|+			
|1247|1247| 
|1248|1248| 			// No orders left, we're an individual now
|1249|1249| 			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
|1267|1267| 			// Move a tile outside the building
|1268|1268| 			let range = 4;
|1269|1269| 			if (this.CheckTargetRangeExplicit(msg.data.target, range, range))
|1270|    |-			{
|    |1270|+			
|1271|1271| 				// We are already at the target, or can't move at all
|1272|1272| 				this.FinishOrder();
|1273|    |-			}
|    |1273|+			
|1274|1274| 			else
|1275|1275| 			{
|1276|1276| 				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
|1482|1482| 
|1483|1483| 			"LosRangeUpdate": function(msg) {
|1484|1484| 				if (this.GetStance().targetVisibleEnemies)
|1485|    |-				{
|    |1485|+				
|1486|1486| 					// Start attacking one of the newly-seen enemy (if any)
|1487|1487| 					this.AttackEntitiesByPreference(msg.data.added);
|1488|    |-				}
|    |1488|+				
|1489|1489| 			},
|1490|1490| 
|1491|1491| 			"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
|1519|1519| 				this.SelectAnimation("move");
|1520|1520| 			},
|1521|1521| 
|1522|    |-			"leave": function () {
|    |1522|+			"leave": function() {
|1523|1523| 				this.SelectAnimation("idle");
|1524|1524| 				this.StopMoving();
|1525|1525| 			},
|    | [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
|1696|1696| 						// if nothing better to do, check if the guarded needs to be healed or repaired
|1697|1697| 						var cmpHealth = Engine.QueryInterface(this.isGuardOf, IID_Health);
|1698|1698| 						if (cmpHealth && cmpHealth.IsInjured())
|1699|    |-						{
|    |1699|+						
|1700|1700| 							if (this.CanHeal(this.isGuardOf))
|1701|1701| 								this.PushOrderFront("Heal", { "target": this.isGuardOf, "force": false });
|1702|1702| 							else if (this.CanRepair(this.isGuardOf))
|1703|1703| 								this.PushOrderFront("Repair", { "target": this.isGuardOf, "autocontinue": false, "force": false });
|1704|    |-						}
|    |1704|+						
|1705|1705| 					}
|1706|1706| 				},
|1707|1707| 
|    | [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
|1794|1794| 				"MoveCompleted": function() {
|1795|1795| 
|1796|1796| 					if (this.CheckTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1797|    |-					{
|    |1797|+					
|1798|1798| 						// If the unit needs to unpack, do so
|1799|1799| 						if (this.CanUnpack())
|1800|1800| 						{
|1803|1803| 						}
|1804|1804| 						else
|1805|1805| 							this.SetNextState("ATTACKING");
|1806|    |-					}
|    |1806|+					
|1807|1807| 					else
|1808|1808| 					{
|1809|1809| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|    | [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
|1801|1801| 							this.PushOrderFront("Unpack", { "force": true });
|1802|1802| 							return;
|1803|1803| 						}
|1804|    |-						else
|1805|    |-							this.SetNextState("ATTACKING");
|    |1804|+						this.SetNextState("ATTACKING");
|1806|1805| 					}
|1807|1806| 					else
|1808|1807| 					{
|    | [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
|1805|1805| 							this.SetNextState("ATTACKING");
|1806|1806| 					}
|1807|1807| 					else
|1808|    |-					{
|    |1808|+					
|1809|1809| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1810|1810| 						{
|1811|1811| 							this.SetNextState("APPROACHING");
|1815|1815| 							// Give up
|1816|1816| 							this.FinishOrder();
|1817|1817| 						}
|1818|    |-					}
|    |1818|+					
|1819|1819| 				},
|1820|1820| 			},
|1821|1821| 
|    | [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
|1807|1807| 					else
|1808|1808| 					{
|1809|1809| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1810|    |-						{
|    |1810|+						
|1811|1811| 							this.SetNextState("APPROACHING");
|1812|    |-						}
|    |1812|+						
|1813|1813| 						else
|1814|1814| 						{
|1815|1815| 							// Give up
|    | [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
|1811|1811| 							this.SetNextState("APPROACHING");
|1812|1812| 						}
|1813|1813| 						else
|1814|    |-						{
|    |1814|+						
|1815|1815| 							// Give up
|1816|1816| 							this.FinishOrder();
|1817|    |-						}
|    |1817|+						
|1818|1818| 					}
|1819|1819| 				},
|1820|1820| 			},
|    | [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
|1832|1832| 					}
|1833|1833| 					// Check the target is still alive and attackable
|1834|1834| 					if (this.CanAttack(target) && !this.CheckTargetAttackRange(target, this.order.data.attackType))
|1835|    |-					{
|    |1835|+					
|1836|1836| 						// Can't reach it - try to chase after it
|1837|1837| 						if (this.ShouldChaseTargetedEntity(target, this.order.data.force))
|1838|1838| 						{
|1847|1847| 								return;
|1848|1848| 							}
|1849|1849| 						}
|1850|    |-					}
|    |1850|+					
|1851|1851| 
|1852|1852| 					this.StopMoving();
|1853|1853| 
|    | [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
|1880|1880| 					// TODO: we should probably only bother syncing projectile attacks, not melee
|1881|1881| 
|1882|1882| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|1883|    |-					this.resyncAnimation = (prepare != this.attackTimers.prepare) ? true : false;
|    |1883|+					this.resyncAnimation = (prepare != this.attackTimers.prepare);
|1884|1884| 
|1885|1885| 					this.FaceTowardsTarget(this.order.data.target);
|1886|1886| 
|    | [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
|2009|2009| 
|2010|2010| 				"Attacked": function(msg) {
|2011|2011| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2012|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2013|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2012|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2013|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2014|2014| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2015|2015| 				},
|2016|2016| 			},
|    | [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
|2029|2029| 					this.SelectAnimation("move");
|2030|2030| 					var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|2031|2031| 					if (cmpUnitAI && cmpUnitAI.IsFleeing())
|2032|    |-					{
|    |2032|+					
|2033|2033| 						// Run after a fleeing target
|2034|2034| 						this.SetSpeedMultiplier(this.GetRunMultiplier());
|2035|    |-					}
|    |2035|+					
|2036|2036| 					this.StartTimer(1000, 1000);
|2037|2037| 				},
|2038|2038| 
|    | [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
|2088|2088| 						// Also don't switch to a different type of huntable animal
|2089|2089| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2090|2090| 							return (
|2091|    |-								ent != oldTarget
|2092|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2091|+								ent != oldTarget &&
|    |2092|+								 ((type.generic == "treasure" && oldType.generic == "treasure")
|2093|2093| 								 || (type.specific == oldType.specific
|2094|2094| 								 && (type.specific != "meat" || oldTemplate == template)))
|2095|2095| 							);
|    | [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
|2089|2089| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2090|2090| 							return (
|2091|2091| 								ent != oldTarget
|2092|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2093|    |-								 || (type.specific == oldType.specific
|    |2092|+								 && ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2093|+								 (type.specific == oldType.specific
|2094|2094| 								 && (type.specific != "meat" || oldTemplate == template)))
|2095|2095| 							);
|2096|2096| 						}, oldTarget);
|    | [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
|2090|2090| 							return (
|2091|2091| 								ent != oldTarget
|2092|2092| 								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2093|    |-								 || (type.specific == oldType.specific
|2094|    |-								 && (type.specific != "meat" || oldTemplate == template)))
|    |2093|+								 || (type.specific == oldType.specific &&
|    |2094|+								 (type.specific != "meat" || oldTemplate == template)))
|2095|2095| 							);
|2096|2096| 						}, oldTarget);
|2097|2097| 						if (nearby)
|    | [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
|2099|2099| 							this.PerformGather(nearby, false, false);
|2100|2100| 							return true;
|2101|2101| 						}
|2102|    |-						else
|2103|    |-						{
|    |2102|+						
|2104|2103| 							// It's probably better in this case, to avoid units getting stuck around a dropsite
|2105|2104| 							// in a "Target is far away, full, nearby are no good resources, return to dropsite" loop
|2106|2105| 							// to order it to GatherNear the resource position.
|2121|2120| 									return true;
|2122|2121| 								}
|2123|2122| 							}
|2124|    |-						}
|    |2123|+						
|2125|2124| 						return true;
|2126|2125| 					}
|2127|2126| 
|    | [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
|2111|2111| 								this.GatherNearPosition(pos.x, pos.z, oldType, oldTemplate);
|2112|2112| 								return true;
|2113|2113| 							}
|2114|    |-							else
|2115|    |-							{
|    |2114|+							
|2116|2115| 								// we're kind of stuck here. Return resource.
|2117|2116| 								var nearby = this.FindNearestDropsite(oldType.generic);
|2118|2117| 								if (nearby)
|2120|2119| 									this.PushOrderFront("ReturnResource", { "target": nearby, "force": false });
|2121|2120| 									return true;
|2122|2121| 								}
|2123|    |-							}
|    |2122|+							
|2124|2123| 						}
|2125|2124| 						return true;
|2126|2125| 					}
|    | [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
|2163|2163| 						// Also don't switch to a different type of huntable animal
|2164|2164| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2165|2165| 							return (
|2166|    |-								ent != oldTarget
|2167|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2166|+								ent != oldTarget &&
|    |2167|+								((type.generic == "treasure" && oldType.generic == "treasure")
|2168|2168| 								|| (type.specific == oldType.specific
|2169|2169| 								&& (type.specific != "meat" || oldTemplate == template)))
|2170|2170| 							);
|    | [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
|2164|2164| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2165|2165| 							return (
|2166|2166| 								ent != oldTarget
|2167|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2168|    |-								|| (type.specific == oldType.specific
|    |2167|+								&& ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2168|+								(type.specific == oldType.specific
|2169|2169| 								&& (type.specific != "meat" || oldTemplate == template)))
|2170|2170| 							);
|2171|2171| 						});
|    | [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
|2165|2165| 							return (
|2166|2166| 								ent != oldTarget
|2167|2167| 								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2168|    |-								|| (type.specific == oldType.specific
|2169|    |-								&& (type.specific != "meat" || oldTemplate == template)))
|    |2168|+								|| (type.specific == oldType.specific &&
|    |2169|+								(type.specific != "meat" || oldTemplate == template)))
|2170|2170| 							);
|2171|2171| 						});
|2172|2172| 						if (nearby)
|    | [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
|2223|2223| 					// Also don't switch to a different type of huntable animal
|2224|2224| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2225|2225| 						return (
|2226|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2227|    |-							|| (type.specific == resourceType.specific
|    |2226|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2227|+							(type.specific == resourceType.specific
|2228|2228| 							&& (type.specific != "meat" || resourceTemplate == template))
|2229|2229| 						);
|2230|2230| 					});
|    | [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
|2224|2224| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2225|2225| 						return (
|2226|2226| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2227|    |-							|| (type.specific == resourceType.specific
|2228|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2227|+							|| (type.specific == resourceType.specific &&
|    |2228|+							(type.specific != "meat" || resourceTemplate == template))
|2229|2229| 						);
|2230|2230| 					});
|2231|2231| 
|    | [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
|2341|2341| 
|2342|2342| 					var cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply);
|2343|2343| 					if (cmpSupply && cmpSupply.IsAvailable(cmpOwnership.GetOwner(), this.entity))
|2344|    |-					{
|    |2344|+					
|2345|2345| 						// Check we can still reach and gather from the target
|2346|2346| 						if (this.CheckTargetRange(this.gatheringTarget, IID_ResourceGatherer) && this.CanGather(this.gatheringTarget))
|2347|2347| 						{
|2406|2406| 								return;
|2407|2407| 							}
|2408|2408| 						}
|2409|    |-					}
|    |2409|+					
|2410|2410| 
|2411|2411| 					// We're already in range, can't get anywhere near it or the target is exhausted.
|2412|2412| 
|    | [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
|2432|2432| 					// Also don't switch to a different type of huntable animal
|2433|2433| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2434|2434| 						return (
|2435|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2436|    |-							|| (type.specific == resourceType.specific
|    |2435|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2436|+							(type.specific == resourceType.specific
|2437|2437| 							&& (type.specific != "meat" || resourceTemplate == template))
|2438|2438| 						);
|2439|2439| 					});
|    | [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
|2433|2433| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2434|2434| 						return (
|2435|2435| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2436|    |-							|| (type.specific == resourceType.specific
|2437|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2436|+							|| (type.specific == resourceType.specific &&
|    |2437|+							(type.specific != "meat" || resourceTemplate == template))
|2438|2438| 						);
|2439|2439| 					});
|2440|2440| 					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
|2498|2498| 
|2499|2499| 				"Timer": function(msg) {
|2500|2500| 					if (this.ShouldAbandonChase(this.order.data.target, this.order.data.force, IID_Heal, null))
|2501|    |-					{
|    |2501|+					
|2502|2502| 						// Return to our original position unless we have a better order.
|2503|2503| 						if (!this.FinishOrder() && this.GetStance().respondHoldGround)
|2504|2504| 							this.WalkToHeldPosition();
|2505|    |-					}
|    |2505|+					
|2506|2506| 				},
|2507|2507| 
|2508|2508| 				"MoveCompleted": 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
|2532|2532| 					this.StartTimer(prepare, this.healTimers.repeat);
|2533|2533| 
|2534|2534| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2535|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2535|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2536|2536| 
|2537|2537| 					this.FaceTowardsTarget(this.order.data.target);
|2538|2538| 				},
|    | [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
|2744|2744| 					{
|2745|2745| 						// The building was already finished/fully repaired before we arrived;
|2746|2746| 						// let the ConstructionFinished handler handle this.
|2747|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2747|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2748|2748| 						return true;
|2749|2749| 					}
|2750|2750| 
|    | [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
|2744|2744| 					{
|2745|2745| 						// The building was already finished/fully repaired before we arrived;
|2746|2746| 						// let the ConstructionFinished handler handle this.
|2747|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2747|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2748|2748| 						return true;
|2749|2749| 					}
|2750|2750| 
|    | [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
|2787|2787| 					if (!inRange && this.MoveToTargetRange(this.repairTarget, IID_Builder))
|2788|2788| 						this.SetNextState("APPROACHING");
|2789|2789| 					else if (!inRange)
|2790|    |-						this.FinishOrder(); //can't approach and isn't in reach
|    |2790|+						this.FinishOrder(); // can't approach and isn't in reach
|2791|2791| 				},
|2792|2792| 			},
|2793|2793| 
|    | [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
|2874|2874| 
|2875|2875| 				// Unit was approaching and there's nothing to do now, so switch to walking
|2876|2876| 				if (oldState === "INDIVIDUAL.REPAIR.APPROACHING")
|2877|    |-				{
|    |2877|+				
|2878|2878| 					// We're already walking to the given point, so add this as a order.
|2879|2879| 					this.WalkToTarget(msg.data.newentity, true);
|2880|    |-				}
|    |2880|+				
|2881|2881| 			},
|2882|2882| 		},
|2883|2883| 
|    | [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
|2936|2936| 
|2937|2937| 					// Check that we can garrison here
|2938|2938| 					if (this.CanGarrison(target))
|2939|    |-					{
|    |2939|+					
|2940|2940| 						// Check that we're in range of the garrison target
|2941|2941| 						if (this.CheckGarrisonRange(target))
|2942|2942| 						{
|3012|3012| 								return false;
|3013|3013| 							}
|3014|3014| 						}
|3015|    |-					}
|    |3015|+					
|3016|3016| 					// Garrisoning failed for some reason, so finish the order
|3017|3017| 					this.FinishOrder();
|3018|3018| 					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
|3133|3133| 		"Attacked": function(msg) {
|3134|3134| 			if (this.template.NaturalBehaviour == "skittish" ||
|3135|3135| 			    this.template.NaturalBehaviour == "passive")
|3136|    |-			{
|    |3136|+			
|3137|3137| 				this.Flee(msg.data.attacker, false);
|3138|    |-			}
|    |3138|+			
|3139|3139| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|3140|3140| 			{
|3141|3141| 				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
|3142|3142| 					this.Attack(msg.data.attacker, false);
|3143|3143| 			}
|3144|3144| 			else if (this.template.NaturalBehaviour == "domestic")
|3145|    |-			{
|    |3145|+			
|3146|3146| 				// Never flee, stop what we were doing
|3147|3147| 				this.SetNextState("IDLE");
|3148|    |-			}
|    |3148|+			
|3149|3149| 		},
|3150|3150| 
|3151|3151| 		"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
|3156|3156| 				this.FinishOrder();
|3157|3157| 				return;
|3158|3158| 			}
|3159|    |-			else
|3160|    |-			{
|    |3159|+			
|3161|3160| 				this.order.data.min = range;
|3162|3161| 				this.SetNextState("WALKING");
|3163|    |-			}
|    |3162|+			
|3164|3163| 		},
|3165|3164| 
|3166|3165| 		"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
|3200|3200| 				}
|3201|3201| 				// Start attacking one of the newly-seen enemy (if any)
|3202|3202| 				else if (this.IsDangerousAnimal())
|3203|    |-				{
|    |3203|+				
|3204|3204| 					this.AttackVisibleEntity(msg.data.added);
|3205|    |-				}
|    |3205|+				
|3206|3206| 
|3207|3207| 				// TODO: if two units enter our range together, we'll attack the
|3208|3208| 				// 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
|3243|3243| 				}
|3244|3244| 				// Start attacking one of the newly-seen enemy (if any)
|3245|3245| 				else if (this.template.NaturalBehaviour == "violent")
|3246|    |-				{
|    |3246|+				
|3247|3247| 					this.AttackVisibleEntity(msg.data.added);
|3248|    |-				}
|    |3248|+				
|3249|3249| 			},
|3250|3250| 
|3251|3251| 			"MoveCompleted": function() { },
|    | [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
|3260|3260| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3261|3261| 
|3262|3262| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3263|    |-							// only used for domestic animals
|    |3263|+		// only used for domestic animals
|3264|3264| 	},
|3265|3265| };
|3266|3266| 
|    | [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
|3317|3317| 
|3318|3318| UnitAI.prototype.IsAnimal = function()
|3319|3319| {
|3320|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3320|+	return (!!this.template.NaturalBehaviour);
|3321|3321| };
|3322|3322| 
|3323|3323| 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
|3355|3355| UnitAI.prototype.GetGarrisonHolder = function()
|3356|3356| {
|3357|3357| 	if (this.IsGarrisoned())
|3358|    |-	{
|    |3358|+	
|3359|3359| 		for (let order of this.orderQueue)
|3360|3360| 			if (order.type == "Garrison")
|3361|3361| 				return order.data.target;
|3362|    |-	}
|    |3362|+	
|3363|3363| 	return INVALID_ENTITY;
|3364|3364| };
|3365|3365| 
|    | [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
|3433|3433| 		{
|3434|3434| 			let index = this.GetCurrentState().indexOf(".");
|3435|3435| 			if (index != -1)
|3436|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3436|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3437|3437| 			this.Stop(false);
|3438|3438| 		}
|3439|3439| 
|    | [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
|3489|3489| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3490|3490| 			continue;
|3491|3491| 		if (i == 0)
|3492|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3492|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3493|3493| 		else
|3494|3494| 			this.orderQueue.splice(i, 1);
|3495|3495| 		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
|3489|3489| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3490|3490| 			continue;
|3491|3491| 		if (i == 0)
|3492|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3492|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3493|3493| 		else
|3494|3494| 			this.orderQueue.splice(i, 1);
|3495|3495| 		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
|3573|3573| };
|3574|3574| 
|3575|3575| 
|3576|    |-//// FSM linkage functions ////
|    |3576|+// // FSM linkage functions ////
|3577|3577| 
|3578|3578| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3579|3579| 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
|3745|3745| 				continue;
|3746|3746| 			if (this.orderQueue[i].type == type)
|3747|3747| 				continue;
|3748|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3748|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3749|3749| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3750|3750| 			return;
|3751|3751| 		}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3745|3745| 				continue;
|3746|3746| 			if (this.orderQueue[i].type == type)
|3747|3747| 				continue;
|3748|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3748|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3749|3749| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3750|3750| 			return;
|3751|3751| 		}
|    | [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
|3759|3759| {
|3760|3760| 	// Remember the previous work orders to be able to go back to them later if required
|3761|3761| 	if (data && data.force)
|3762|    |-	{
|    |3762|+	
|3763|3763| 		if (this.IsFormationController())
|3764|3764| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3765|3765| 		else
|3766|3766| 			this.UpdateWorkOrders(type);
|3767|    |-	}
|    |3767|+	
|3768|3768| 
|3769|3769| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3770|3770| 
|    | [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
|3836|3836| 	{
|3837|3837| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3838|3838| 		if (cmpUnitAI)
|3839|    |-		{
|    |3839|+		
|3840|3840| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3841|3841| 			{
|3842|3842| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3845|3845| 					return;
|3846|3846| 				}
|3847|3847| 			}
|3848|    |-		}
|    |3848|+		
|3849|3849| 	}
|3850|3850| 
|3851|3851| 	// 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
|3838|3838| 		if (cmpUnitAI)
|3839|3839| 		{
|3840|3840| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3841|    |-			{
|    |3841|+			
|3842|3842| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3843|3843| 				{
|3844|3844| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3845|3845| 					return;
|3846|3846| 				}
|3847|    |-			}
|    |3847|+			
|3848|3848| 		}
|3849|3849| 	}
|3850|3850| 
|    | [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
|3850|3850| 
|3851|3851| 	// If nothing found, take the unit orders
|3852|3852| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3853|    |-	{
|    |3853|+	
|3854|3854| 		if (isWorkType(this.orderQueue[i].type))
|3855|3855| 		{
|3856|3856| 			this.workOrders = this.orderQueue.slice(i);
|3857|3857| 			return;
|3858|3858| 		}
|3859|    |-	}
|    |3859|+	
|3860|3860| };
|3861|3861| 
|3862|3862| 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
|3916|3916| 	if (data.timerRepeat === undefined)
|3917|3917| 		this.timer = undefined;
|3918|3918| 
|3919|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3919|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3920|3920| };
|3921|3921| 
|3922|3922| /**
|    | [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
|3916|3916| 	if (data.timerRepeat === undefined)
|3917|3917| 		this.timer = undefined;
|3918|3918| 
|3919|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3919|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3920|3920| };
|3921|3921| 
|3922|3922| /**
|    | [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
|3951|3951| 	this.timer = undefined;
|3952|3952| };
|3953|3953| 
|3954|    |-//// Message handlers /////
|    |3954|+// // Message handlers /////
|3955|3955| 
|3956|3956| UnitAI.prototype.OnMotionChanged = function(msg)
|3957|3957| {
|    | [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
|3956|3956| UnitAI.prototype.OnMotionChanged = function(msg)
|3957|3957| {
|3958|3958| 	if (msg.starting && !msg.error)
|3959|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3959|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveStarted", "data": msg});
|3960|3960| 	else if (!msg.starting || msg.error)
|3961|3961| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3962|3962| };
|    | [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
|3956|3956| UnitAI.prototype.OnMotionChanged = function(msg)
|3957|3957| {
|3958|3958| 	if (msg.starting && !msg.error)
|3959|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3959|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg });
|3960|3960| 	else if (!msg.starting || msg.error)
|3961|3961| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3962|3962| };
|    | [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
|3958|3958| 	if (msg.starting && !msg.error)
|3959|3959| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3960|3960| 	else if (!msg.starting || msg.error)
|3961|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3961|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveCompleted", "data": msg});
|3962|3962| };
|3963|3963| 
|3964|3964| UnitAI.prototype.OnGlobalConstructionFinished = 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
|3958|3958| 	if (msg.starting && !msg.error)
|3959|3959| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3960|3960| 	else if (!msg.starting || msg.error)
|3961|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3961|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg });
|3962|3962| };
|3963|3963| 
|3964|3964| UnitAI.prototype.OnGlobalConstructionFinished = 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
|3966|3966| 	// TODO: This is a bit inefficient since every unit listens to every
|3967|3967| 	// construction message - ideally we could scope it to only the one we're building
|3968|3968| 
|3969|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3969|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3970|3970| };
|3971|3971| 
|3972|3972| 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
|3966|3966| 	// TODO: This is a bit inefficient since every unit listens to every
|3967|3967| 	// construction message - ideally we could scope it to only the one we're building
|3968|3968| 
|3969|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3969|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3970|3970| };
|3971|3971| 
|3972|3972| 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
|3991|3991| 
|3992|3992| UnitAI.prototype.OnAttacked = function(msg)
|3993|3993| {
|3994|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3994|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3995|3995| };
|3996|3996| 
|3997|3997| 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
|3991|3991| 
|3992|3992| UnitAI.prototype.OnAttacked = function(msg)
|3993|3993| {
|3994|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3994|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3995|3995| };
|3996|3996| 
|3997|3997| 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
|3996|3996| 
|3997|3997| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3998|3998| {
|3999|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3999|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4000|4000| };
|4001|4001| 
|4002|4002| 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
|3996|3996| 
|3997|3997| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3998|3998| {
|3999|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3999|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4000|4000| };
|4001|4001| 
|4002|4002| 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
|4001|4001| 
|4002|4002| UnitAI.prototype.OnHealthChanged = function(msg)
|4003|4003| {
|4004|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4004|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4005|4005| };
|4006|4006| 
|4007|4007| 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
|4001|4001| 
|4002|4002| UnitAI.prototype.OnHealthChanged = function(msg)
|4003|4003| {
|4004|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4004|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4005|4005| };
|4006|4006| 
|4007|4007| 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
|4007|4007| UnitAI.prototype.OnRangeUpdate = function(msg)
|4008|4008| {
|4009|4009| 	if (msg.tag == this.losRangeQuery)
|4010|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4010|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4011|4011| 	else if (msg.tag == this.losHealRangeQuery)
|4012|4012| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4013|4013| };
|    | [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
|4007|4007| UnitAI.prototype.OnRangeUpdate = function(msg)
|4008|4008| {
|4009|4009| 	if (msg.tag == this.losRangeQuery)
|4010|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4010|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4011|4011| 	else if (msg.tag == this.losHealRangeQuery)
|4012|4012| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4013|4013| };
|    | [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
|4009|4009| 	if (msg.tag == this.losRangeQuery)
|4010|4010| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4011|4011| 	else if (msg.tag == this.losHealRangeQuery)
|4012|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4012|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4013|4013| };
|4014|4014| 
|4015|4015| 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
|4009|4009| 	if (msg.tag == this.losRangeQuery)
|4010|4010| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4011|4011| 	else if (msg.tag == this.losHealRangeQuery)
|4012|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4012|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4013|4013| };
|4014|4014| 
|4015|4015| 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
|4014|4014| 
|4015|4015| UnitAI.prototype.OnPackFinished = function(msg)
|4016|4016| {
|4017|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4017|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4018|4018| };
|4019|4019| 
|4020|4020| //// 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
|4014|4014| 
|4015|4015| UnitAI.prototype.OnPackFinished = function(msg)
|4016|4016| {
|4017|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4017|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4018|4018| };
|4019|4019| 
|4020|4020| //// 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
|4017|4017| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4018|4018| };
|4019|4019| 
|4020|    |-//// Helper functions to be called by the FSM ////
|    |4020|+// // Helper functions to be called by the FSM ////
|4021|4021| 
|4022|4022| UnitAI.prototype.GetWalkSpeed = function()
|4023|4023| {
|    | [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
|4119|4119| 	if (!cmpOwnership || cmpOwnership.GetOwner() == INVALID_PLAYER)
|4120|4120| 		return undefined;
|4121|4121| 
|4122|    |-	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position)
|    |4122|+	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
|4123|4123| 	if (!cmpPosition || !cmpPosition.IsInWorld())
|4124|4124| 		return undefined;
|4125|4125| 
|    | [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
|4204|4204| 			PlaySound(name, member);
|4205|4205| 	}
|4206|4206| 	else
|4207|    |-	{
|    |4207|+	
|4208|4208| 		// Otherwise use our own sounds
|4209|4209| 		PlaySound(name, this.entity);
|4210|    |-	}
|    |4210|+	
|4211|4211| };
|4212|4212| 
|4213|4213| /*
|    | [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
|4300|4300| UnitAI.prototype.MoveTo = function(data, iid, type)
|4301|4301| {
|4302|4302| 	if (data["target"])
|4303|    |-	{
|    |4303|+	
|4304|4304| 		if (data["min"] || data["max"])
|4305|4305| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4306|4306| 		else
|4310|4310| 			else
|4311|4311| 				return this.MoveToTargetRange(data.target, iid, type);
|4312|4312| 		}
|4313|    |-	}
|    |4313|+	
|4314|4314| 	else
|4315|4315| 	{
|4316|4316| 		if (data["min"] || data["max"])
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["target"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4299|4299|  */
|4300|4300| UnitAI.prototype.MoveTo = function(data, iid, type)
|4301|4301| {
|4302|    |-	if (data["target"])
|    |4302|+	if (data.target)
|4303|4303| 	{
|4304|4304| 		if (data["min"] || data["max"])
|4305|4305| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["min"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4301|4301| {
|4302|4302| 	if (data["target"])
|4303|4303| 	{
|4304|    |-		if (data["min"] || data["max"])
|    |4304|+		if (data.min || data["max"])
|4305|4305| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4306|4306| 		else
|4307|4307| 		{
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["max"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4301|4301| {
|4302|4302| 	if (data["target"])
|4303|4303| 	{
|4304|    |-		if (data["min"] || data["max"])
|    |4304|+		if (data["min"] || data.max)
|4305|4305| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4306|4306| 		else
|4307|4307| 		{
|    | [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
|4304|4304| 		if (data["min"] || data["max"])
|4305|4305| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4306|4306| 		else
|4307|    |-		{
|    |4307|+		
|4308|4308| 			if (!iid)
|4309|4309| 				return this.MoveToTarget(data.target);
|4310|4310| 			else
|4311|4311| 				return this.MoveToTargetRange(data.target, iid, type);
|4312|    |-		}
|    |4312|+		
|4313|4313| 	}
|4314|4314| 	else
|4315|4315| 	{
|    | [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
|4303|4303| 	{
|4304|4304| 		if (data["min"] || data["max"])
|4305|4305| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4306|    |-		else
|4307|    |-		{
|    |4306|+		
|4308|4307| 			if (!iid)
|4309|4308| 				return this.MoveToTarget(data.target);
|4310|4309| 			else
|4311|4310| 				return this.MoveToTargetRange(data.target, iid, type);
|4312|    |-		}
|    |4311|+		
|4313|4312| 	}
|4314|4313| 	else
|4315|4314| 	{
|    | [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
|4307|4307| 		{
|4308|4308| 			if (!iid)
|4309|4309| 				return this.MoveToTarget(data.target);
|4310|    |-			else
|4311|    |-				return this.MoveToTargetRange(data.target, iid, type);
|    |4310|+			return this.MoveToTargetRange(data.target, iid, type);
|4312|4311| 		}
|4313|4312| 	}
|4314|4313| 	else
|    | [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
|4312|4312| 		}
|4313|4313| 	}
|4314|4314| 	else
|4315|    |-	{
|    |4315|+	
|4316|4316| 		if (data["min"] || data["max"])
|4317|4317| 			return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1);
|4318|4318| 		else
|4319|4319| 			return this.MoveToPoint(data.x, data.z);
|4320|    |-	}
|    |4320|+	
|4321|4321| }
|4322|4322| 
|4323|4323| UnitAI.prototype.MoveToPoint = function(x, z)
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["min"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4313|4313| 	}
|4314|4314| 	else
|4315|4315| 	{
|4316|    |-		if (data["min"] || data["max"])
|    |4316|+		if (data.min || data["max"])
|4317|4317| 			return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1);
|4318|4318| 		else
|4319|4319| 			return this.MoveToPoint(data.x, data.z);
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["max"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4313|4313| 	}
|4314|4314| 	else
|4315|4315| 	{
|4316|    |-		if (data["min"] || data["max"])
|    |4316|+		if (data["min"] || data.max)
|4317|4317| 			return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1);
|4318|4318| 		else
|4319|4319| 			return this.MoveToPoint(data.x, data.z);
|    | [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
|4315|4315| 	{
|4316|4316| 		if (data["min"] || data["max"])
|4317|4317| 			return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1);
|4318|    |-		else
|4319|    |-			return this.MoveToPoint(data.x, data.z);
|    |4318|+		return this.MoveToPoint(data.x, data.z);
|4320|4319| 	}
|4321|4320| }
|4322|4321| 
|    | [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
|4318|4318| 		else
|4319|4319| 			return this.MoveToPoint(data.x, data.z);
|4320|4320| 	}
|4321|    |-}
|    |4321|+};
|4322|4322| 
|4323|4323| UnitAI.prototype.MoveToPoint = function(x, z)
|4324|4324| {
|    | [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
|4402|4402| 	else
|4403|4403| 		// return false? Or hope you come close enough?
|4404|4404| 		var parabolicMaxRange = 0;
|4405|    |-		//return false;
|    |4405|+		// return false;
|4406|4406| 
|4407|4407| 	// the parabole changes while walking, take something in the middle
|4408|4408| 	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
|4467|4467| 	if (this.IsFormationMember())
|4468|4468| 	{
|4469|4469| 		var cmpFormationUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|4470|    |-		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation()
|4471|    |-			&& cmpFormationUnitAI.order.data.target == target)
|    |4470|+		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation() &&
|    |4471|+			cmpFormationUnitAI.order.data.target == target)
|4472|4472| 			return true;
|4473|4473| 	}
|4474|4474| 
|    | [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
|4635|4635| UnitAI.prototype.AttackEntityInZone = function(ents)
|4636|4636| {
|4637|4637| 	var target = ents.find(target =>
|4638|    |-		this.CanAttack(target)
|4639|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4638|+		this.CanAttack(target) &&
|    |4639|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4640|4640| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4641|4641| 	);
|4642|4642| 	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
|4636|4636| {
|4637|4637| 	var target = ents.find(target =>
|4638|4638| 		this.CanAttack(target)
|4639|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4640|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4639|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4640|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4641|4641| 	);
|4642|4642| 	if (!target)
|4643|4643| 		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
|4700|4700| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4701|4701| 	if (this.isGuardOf)
|4702|4702| 	{
|4703|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4703|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4704|4704| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4705|4705| 		if (cmpUnitAI && cmpAttack &&
|4706|4706| 		    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
|4704|4704| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4705|4705| 		if (cmpUnitAI && cmpAttack &&
|4706|4706| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4707|    |-				return false;
|    |4707|+			return false;
|4708|4708| 	}
|4709|4709| 
|4710|4710| 	// 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
|4709|4709| 
|4710|4710| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4711|4711| 	if (this.GetStance().respondHoldGround)
|4712|    |-	{
|    |4712|+	
|4713|4713| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4714|4714| 			return true;
|4715|    |-	}
|    |4715|+	
|4716|4716| 
|4717|4717| 	// Stop if it's left our vision range, unless we're especially persistent
|4718|4718| 	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
|4716|4716| 
|4717|4717| 	// Stop if it's left our vision range, unless we're especially persistent
|4718|4718| 	if (!this.GetStance().respondChaseBeyondVision)
|4719|    |-	{
|    |4719|+	
|4720|4720| 		if (!this.CheckTargetIsInVisionRange(target))
|4721|4721| 			return true;
|4722|    |-	}
|    |4722|+	
|4723|4723| 
|4724|4724| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4725|4725| 	// 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
|4742|4742| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4743|4743| 	if (this.isGuardOf)
|4744|4744| 	{
|4745|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4745|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4746|4746| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4747|4747| 		if (cmpUnitAI && cmpAttack &&
|4748|4748| 		    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
|4755|4755| 	return false;
|4756|4756| };
|4757|4757| 
|4758|    |-//// External interface functions ////
|    |4758|+// // External interface functions ////
|4759|4759| 
|4760|4760| UnitAI.prototype.SetFormationController = function(ent)
|4761|4761| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4765|4765| 	// of our own formation (or ourself if not in formation)
|4766|4766| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4767|4767| 	if (cmpObstruction)
|4768|    |-	{
|    |4768|+	
|4769|4769| 		if (ent == INVALID_ENTITY)
|4770|4770| 			cmpObstruction.SetControlGroup(this.entity);
|4771|4771| 		else
|4772|4772| 			cmpObstruction.SetControlGroup(ent);
|4773|    |-	}
|    |4773|+	
|4774|4774| 
|4775|4775| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4776|4776| 	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
|4908|4908| 	// if we already had an old guard order, do nothing if the target is the same
|4909|4909| 	// and the order is running, otherwise remove the previous order
|4910|4910| 	if (this.isGuardOf)
|4911|    |-	{
|    |4911|+	
|4912|4912| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4913|4913| 			return;
|4914|4914| 		else
|4915|4915| 			this.RemoveGuard();
|4916|    |-	}
|    |4916|+	
|4917|4917| 
|4918|4918| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4919|4919| };
|    | [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
|4911|4911| 	{
|4912|4912| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4913|4913| 			return;
|4914|    |-		else
|4915|    |-			this.RemoveGuard();
|    |4914|+		this.RemoveGuard();
|4916|4915| 	}
|4917|4916| 
|4918|4917| 	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
|5082|5082| 			this.WalkToTarget(target, queued);
|5083|5083| 		return;
|5084|5084| 	}
|5085|    |-	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture}, queued);
|    |5085|+	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture }, queued);
|5086|5086| };
|5087|5087| 
|5088|5088| /**
|    | [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
|5231|5231| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5232|5232| 	{
|5233|5233| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5234|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5234|+		if (cmpTrader.HasBothMarkets() &&
|5235|5235| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5236|5236| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5237|5237| 		{
|    | [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
|5512|5512| 				{
|5513|5513| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5514|5514| 					var targetClasses = this.order.data.targetClasses;
|5515|    |-					if (targetClasses.attack && cmpIdentity
|5516|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5515|+					if (targetClasses.attack && cmpIdentity &&
|    |5516|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5517|5517| 						continue;
|5518|5518| 					if (targetClasses.avoid && cmpIdentity
|5519|5519| 						&& 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
|5515|5515| 					if (targetClasses.attack && cmpIdentity
|5516|5516| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5517|5517| 						continue;
|5518|    |-					if (targetClasses.avoid && cmpIdentity
|5519|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5518|+					if (targetClasses.avoid && cmpIdentity &&
|    |5519|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5520|5520| 						continue;
|5521|5521| 					// Only used by the AIs to prevent some choices of targets
|5522|5522| 					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
|5538|5538| 		{
|5539|5539| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5540|5540| 			var targetClasses = this.order.data.targetClasses;
|5541|    |-			if (cmpIdentity && targetClasses.attack
|5542|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5541|+			if (cmpIdentity && targetClasses.attack &&
|    |5542|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5543|5543| 				continue;
|5544|5544| 			if (cmpIdentity && targetClasses.avoid
|5545|5545| 				&& 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
|5541|5541| 			if (cmpIdentity && targetClasses.attack
|5542|5542| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5543|5543| 				continue;
|5544|    |-			if (cmpIdentity && targetClasses.avoid
|5545|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5544|+			if (cmpIdentity && targetClasses.avoid &&
|    |5545|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5546|5546| 				continue;
|5547|5547| 			// Only used by the AIs to prevent some choices of targets
|5548|5548| 			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
|5684|5684| 
|5685|5685| UnitAI.prototype.SetHeldPosition = function(x, z)
|5686|5686| {
|5687|    |-	this.heldPosition = {"x": x, "z": z};
|    |5687|+	this.heldPosition = { "x": x, "z": z};
|5688|5688| };
|5689|5689| 
|5690|5690| 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
|5684|5684| 
|5685|5685| UnitAI.prototype.SetHeldPosition = function(x, z)
|5686|5686| {
|5687|    |-	this.heldPosition = {"x": x, "z": z};
|    |5687|+	this.heldPosition = {"x": x, "z": z };
|5688|5688| };
|5689|5689| 
|5690|5690| 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
|5711|5711| 	return false;
|5712|5712| };
|5713|5713| 
|5714|    |-//// Helper functions ////
|    |5714|+// // Helper functions ////
|5715|5715| 
|5716|5716| UnitAI.prototype.CanAttack = function(target)
|5717|5717| {
|    | [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
|5915|5915| 	return cmpPack && cmpPack.IsPacking();
|5916|5916| };
|5917|5917| 
|5918|    |-//// Formation specific functions ////
|    |5918|+// // Formation specific functions ////
|5919|5919| 
|5920|5920| UnitAI.prototype.IsAttackingAsFormation = function()
|5921|5921| {
|    | [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
|5920|5920| UnitAI.prototype.IsAttackingAsFormation = function()
|5921|5921| {
|5922|5922| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5923|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5924|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5923|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5924|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5925|5925| };
|5926|5926| 
|5927|5927| //// 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
|5924|5924| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5925|5925| };
|5926|5926| 
|5927|    |-//// Animal specific functions ////
|    |5927|+// // Animal specific functions ////
|5928|5928| 
|5929|5929| UnitAI.prototype.MoveRandomly = function(distance)
|5930|5930| {

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

binaries/data/mods/public/simulation/components/UnitAI.js
| 903| »   »   »   "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
| 928| »   »   »   "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
| 946| »   »   »   "leave":·function(msg)·{
|    | [NORMAL] ESLintBear (no-dupe-keys):
|    | Duplicate key 'leave'.

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

binaries/data/mods/public/simulation/components/UnitAI.js
|1044| »   »   »   »   "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
|1082| »   »   »   "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
|1115| »   »   »   »   "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
|1328| »   »   »   "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
|1624| »   »   »   »   »   return·false;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'enter' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
|2422| »   »   »   »   »   »   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
|2477| »   »   »   »   "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
|2595| »   »   »   »   "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
|2697| »   »   »   »   "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
|2906| »   »   »   »   "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
|3089| »   »   »   »   "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
|3821| »   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
|4622| »   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
|4637| »   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
|4683| »   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
|4706| »   »   ····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
|5162| »   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
| 358| »   »   ····&&·(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
| 946| »   »   »   "leave":·function(msg)·{
|    | [NORMAL] JSHintBear:
|    | Duplicate key 'leave'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1872| »   »   »   »   »   »   var·cmpFormation·=·Engine.QueryInterface(this.formationController,·IID_Formation);
|    | [NORMAL] JSHintBear:
|    | 'cmpFormation' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|2013| »   »   »   »   »   »   &&·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
|2092| »   »   »   »   »   »   »   »   ·&&·((type.generic·==·"treasure"·&&·oldType.generic·==·"treasure")
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|2167| »   »   »   »   »   »   »   »   &&·((type.generic·==·"treasure"·&&·oldType.generic·==·"treasure")
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4302| »   if·(data["target"])
|    | [NORMAL] JSHintBear:
|    | ['target'] is better written in dot notation.

binaries/data/mods/public/simulation/components/UnitAI.js
|4304| »   »   if·(data["min"]·||·data["max"])
|    | [NORMAL] JSHintBear:
|    | ['min'] is better written in dot notation.

binaries/data/mods/public/simulation/components/UnitAI.js
|4304| »   »   if·(data["min"]·||·data["max"])
|    | [NORMAL] JSHintBear:
|    | ['max'] is better written in dot notation.

binaries/data/mods/public/simulation/components/UnitAI.js
|4316| »   »   if·(data["min"]·||·data["max"])
|    | [NORMAL] JSHintBear:
|    | ['min'] is better written in dot notation.

binaries/data/mods/public/simulation/components/UnitAI.js
|4316| »   »   if·(data["min"]·||·data["max"])
|    | [NORMAL] JSHintBear:
|    | ['max'] is better written in dot notation.

binaries/data/mods/public/simulation/components/UnitAI.js
|4321| }
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4415| »   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
|4471| »   »   »   &&·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
|4639| »   »   &&·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
|4640| »   »   &&·(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
|5162| »   var·lastPos·=·undefined;
|    | [NORMAL] JSHintBear:
|    | It's not necessary to initialize 'lastPos' to 'undefined'.

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|5533| »   for·(var·targ·of·targets)
|    | [MAJOR] JSHintBear:
|    | Too many errors. (91% scanned).
Executing section cli...

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

wraitii updated this revision to Diff 8121.Sat, May 25, 4:27 PM

Actually had the same issue with attacking since that should use MoveToAttackingRange

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

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
| 356| 356| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 357| 357| 		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 358| 358| 		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 359|    |-		{
|    | 359|+		
| 360| 360| 			// we were already on the shoreline, and have not moved since
| 361| 361| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
| 362| 362| 				needToMove = false;
| 363|    |-		}
|    | 363|+		
| 364| 364| 
| 365| 365| 		if (needToMove)
| 366| 366| 			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
| 354| 354| 		// Check if we need to move     TODO implement a better way to know if we are on the shoreline
| 355| 355| 		var needToMove = true;
| 356| 356| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 357|    |-		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 358|    |-		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
|    | 357|+		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x) &&
|    | 358|+		    (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 359| 359| 		{
| 360| 360| 			// we were already on the shoreline, and have not moved since
| 361| 361| 			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
| 527| 527| 					this.PushOrderFront("Walk", this.order.data.lastPos);
| 528| 528| 				}
| 529| 529| 				else
| 530|    |-				{
|    | 530|+				
| 531| 531| 					// We couldn't move there, or the target moved away
| 532| 532| 					this.FinishOrder();
| 533|    |-				}
|    | 533|+				
| 534| 534| 				return;
| 535| 535| 			}
| 536| 536| 
|    | [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
| 742| 742| 			}
| 743| 743| 			// Check if we are already in range, otherwise walk there
| 744| 744| 			if (!this.CheckGarrisonRange(msg.data.target))
| 745|    |-			{
|    | 745|+			
| 746| 746| 				if (!this.CheckTargetVisible(msg.data.target))
| 747| 747| 				{
| 748| 748| 					this.FinishOrder();
| 753| 753| 					this.SetNextState("GARRISON.APPROACHING");
| 754| 754| 					return;
| 755| 755| 				}
| 756|    |-			}
|    | 756|+			
| 757| 757| 
| 758| 758| 			this.SetNextState("GARRISON.GARRISONING");
| 759| 759| 		},
|    | [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
| 748| 748| 					this.FinishOrder();
| 749| 749| 					return;
| 750| 750| 				}
| 751|    |-				else
| 752|    |-				{
|    | 751|+				
| 753| 752| 					this.SetNextState("GARRISON.APPROACHING");
| 754| 753| 					return;
| 755|    |-				}
|    | 754|+				
| 756| 755| 			}
| 757| 756| 
| 758| 757| 			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
| 771| 771| 						this.PushOrderFront("Walk", msg.data.lastPos);
| 772| 772| 					}
| 773| 773| 					else
| 774|    |-					{
|    | 774|+					
| 775| 775| 						// We couldn't move there, or the target moved away
| 776| 776| 						this.FinishOrder();
| 777|    |-					}
|    | 777|+					
| 778| 778| 					return;
| 779| 779| 				}
| 780| 780| 
|    | [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
|1019|1019| 			},
|1020|1020| 		},
|1021|1021| 
|1022|    |-		"GARRISON":{
|    |1022|+		"GARRISON": {
|1023|1023| 			"enter": function() {
|1024|1024| 				// If the garrisonholder should pickup, warn it so it can take needed action
|1025|1025| 				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
|1239|1239| 			// If the controller handled an order but some members rejected it,
|1240|1240| 			// they will have no orders and be in the FORMATIONMEMBER.IDLE state.
|1241|1241| 			if (this.orderQueue.length)
|1242|    |-			{
|    |1242|+			
|1243|1243| 				// We're leaving the formation, so stop our FormationWalk order
|1244|1244| 				if (this.FinishOrder())
|1245|1245| 					return;
|1246|    |-			}
|    |1246|+			
|1247|1247| 
|1248|1248| 			// No orders left, we're an individual now
|1249|1249| 			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
|1267|1267| 			// Move a tile outside the building
|1268|1268| 			let range = 4;
|1269|1269| 			if (this.CheckTargetRangeExplicit(msg.data.target, range, range))
|1270|    |-			{
|    |1270|+			
|1271|1271| 				// We are already at the target, or can't move at all
|1272|1272| 				this.FinishOrder();
|1273|    |-			}
|    |1273|+			
|1274|1274| 			else
|1275|1275| 			{
|1276|1276| 				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
|1482|1482| 
|1483|1483| 			"LosRangeUpdate": function(msg) {
|1484|1484| 				if (this.GetStance().targetVisibleEnemies)
|1485|    |-				{
|    |1485|+				
|1486|1486| 					// Start attacking one of the newly-seen enemy (if any)
|1487|1487| 					this.AttackEntitiesByPreference(msg.data.added);
|1488|    |-				}
|    |1488|+				
|1489|1489| 			},
|1490|1490| 
|1491|1491| 			"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
|1519|1519| 				this.SelectAnimation("move");
|1520|1520| 			},
|1521|1521| 
|1522|    |-			"leave": function () {
|    |1522|+			"leave": function() {
|1523|1523| 				this.SelectAnimation("idle");
|1524|1524| 				this.StopMoving();
|1525|1525| 			},
|    | [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
|1696|1696| 						// if nothing better to do, check if the guarded needs to be healed or repaired
|1697|1697| 						var cmpHealth = Engine.QueryInterface(this.isGuardOf, IID_Health);
|1698|1698| 						if (cmpHealth && cmpHealth.IsInjured())
|1699|    |-						{
|    |1699|+						
|1700|1700| 							if (this.CanHeal(this.isGuardOf))
|1701|1701| 								this.PushOrderFront("Heal", { "target": this.isGuardOf, "force": false });
|1702|1702| 							else if (this.CanRepair(this.isGuardOf))
|1703|1703| 								this.PushOrderFront("Repair", { "target": this.isGuardOf, "autocontinue": false, "force": false });
|1704|    |-						}
|    |1704|+						
|1705|1705| 					}
|1706|1706| 				},
|1707|1707| 
|    | [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
|1794|1794| 				"MoveCompleted": function() {
|1795|1795| 
|1796|1796| 					if (this.CheckTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1797|    |-					{
|    |1797|+					
|1798|1798| 						// If the unit needs to unpack, do so
|1799|1799| 						if (this.CanUnpack())
|1800|1800| 						{
|1803|1803| 						}
|1804|1804| 						else
|1805|1805| 							this.SetNextState("ATTACKING");
|1806|    |-					}
|    |1806|+					
|1807|1807| 					else
|1808|1808| 					{
|1809|1809| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|    | [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
|1801|1801| 							this.PushOrderFront("Unpack", { "force": true });
|1802|1802| 							return;
|1803|1803| 						}
|1804|    |-						else
|1805|    |-							this.SetNextState("ATTACKING");
|    |1804|+						this.SetNextState("ATTACKING");
|1806|1805| 					}
|1807|1806| 					else
|1808|1807| 					{
|    | [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
|1805|1805| 							this.SetNextState("ATTACKING");
|1806|1806| 					}
|1807|1807| 					else
|1808|    |-					{
|    |1808|+					
|1809|1809| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1810|1810| 						{
|1811|1811| 							this.SetNextState("APPROACHING");
|1815|1815| 							// Give up
|1816|1816| 							this.FinishOrder();
|1817|1817| 						}
|1818|    |-					}
|    |1818|+					
|1819|1819| 				},
|1820|1820| 			},
|1821|1821| 
|    | [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
|1807|1807| 					else
|1808|1808| 					{
|1809|1809| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1810|    |-						{
|    |1810|+						
|1811|1811| 							this.SetNextState("APPROACHING");
|1812|    |-						}
|    |1812|+						
|1813|1813| 						else
|1814|1814| 						{
|1815|1815| 							// Give up
|    | [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
|1811|1811| 							this.SetNextState("APPROACHING");
|1812|1812| 						}
|1813|1813| 						else
|1814|    |-						{
|    |1814|+						
|1815|1815| 							// Give up
|1816|1816| 							this.FinishOrder();
|1817|    |-						}
|    |1817|+						
|1818|1818| 					}
|1819|1819| 				},
|1820|1820| 			},
|    | [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
|1832|1832| 					}
|1833|1833| 					// Check the target is still alive and attackable
|1834|1834| 					if (this.CanAttack(target) && !this.CheckTargetAttackRange(target, this.order.data.attackType))
|1835|    |-					{
|    |1835|+					
|1836|1836| 						// Can't reach it - try to chase after it
|1837|1837| 						if (this.ShouldChaseTargetedEntity(target, this.order.data.force))
|1838|1838| 						{
|1847|1847| 								return;
|1848|1848| 							}
|1849|1849| 						}
|1850|    |-					}
|    |1850|+					
|1851|1851| 
|1852|1852| 					this.StopMoving();
|1853|1853| 
|    | [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
|1880|1880| 					// TODO: we should probably only bother syncing projectile attacks, not melee
|1881|1881| 
|1882|1882| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|1883|    |-					this.resyncAnimation = (prepare != this.attackTimers.prepare) ? true : false;
|    |1883|+					this.resyncAnimation = (prepare != this.attackTimers.prepare);
|1884|1884| 
|1885|1885| 					this.FaceTowardsTarget(this.order.data.target);
|1886|1886| 
|    | [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
|2009|2009| 
|2010|2010| 				"Attacked": function(msg) {
|2011|2011| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2012|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2013|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2012|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2013|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2014|2014| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2015|2015| 				},
|2016|2016| 			},
|    | [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
|2029|2029| 					this.SelectAnimation("move");
|2030|2030| 					var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|2031|2031| 					if (cmpUnitAI && cmpUnitAI.IsFleeing())
|2032|    |-					{
|    |2032|+					
|2033|2033| 						// Run after a fleeing target
|2034|2034| 						this.SetSpeedMultiplier(this.GetRunMultiplier());
|2035|    |-					}
|    |2035|+					
|2036|2036| 					this.StartTimer(1000, 1000);
|2037|2037| 				},
|2038|2038| 
|    | [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
|2088|2088| 						// Also don't switch to a different type of huntable animal
|2089|2089| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2090|2090| 							return (
|2091|    |-								ent != oldTarget
|2092|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2091|+								ent != oldTarget &&
|    |2092|+								 ((type.generic == "treasure" && oldType.generic == "treasure")
|2093|2093| 								 || (type.specific == oldType.specific
|2094|2094| 								 && (type.specific != "meat" || oldTemplate == template)))
|2095|2095| 							);
|    | [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
|2089|2089| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2090|2090| 							return (
|2091|2091| 								ent != oldTarget
|2092|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2093|    |-								 || (type.specific == oldType.specific
|    |2092|+								 && ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2093|+								 (type.specific == oldType.specific
|2094|2094| 								 && (type.specific != "meat" || oldTemplate == template)))
|2095|2095| 							);
|2096|2096| 						}, oldTarget);
|    | [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
|2090|2090| 							return (
|2091|2091| 								ent != oldTarget
|2092|2092| 								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2093|    |-								 || (type.specific == oldType.specific
|2094|    |-								 && (type.specific != "meat" || oldTemplate == template)))
|    |2093|+								 || (type.specific == oldType.specific &&
|    |2094|+								 (type.specific != "meat" || oldTemplate == template)))
|2095|2095| 							);
|2096|2096| 						}, oldTarget);
|2097|2097| 						if (nearby)
|    | [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
|2099|2099| 							this.PerformGather(nearby, false, false);
|2100|2100| 							return true;
|2101|2101| 						}
|2102|    |-						else
|2103|    |-						{
|    |2102|+						
|2104|2103| 							// It's probably better in this case, to avoid units getting stuck around a dropsite
|2105|2104| 							// in a "Target is far away, full, nearby are no good resources, return to dropsite" loop
|2106|2105| 							// to order it to GatherNear the resource position.
|2121|2120| 									return true;
|2122|2121| 								}
|2123|2122| 							}
|2124|    |-						}
|    |2123|+						
|2125|2124| 						return true;
|2126|2125| 					}
|2127|2126| 
|    | [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
|2111|2111| 								this.GatherNearPosition(pos.x, pos.z, oldType, oldTemplate);
|2112|2112| 								return true;
|2113|2113| 							}
|2114|    |-							else
|2115|    |-							{
|    |2114|+							
|2116|2115| 								// we're kind of stuck here. Return resource.
|2117|2116| 								var nearby = this.FindNearestDropsite(oldType.generic);
|2118|2117| 								if (nearby)
|2120|2119| 									this.PushOrderFront("ReturnResource", { "target": nearby, "force": false });
|2121|2120| 									return true;
|2122|2121| 								}
|2123|    |-							}
|    |2122|+							
|2124|2123| 						}
|2125|2124| 						return true;
|2126|2125| 					}
|    | [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
|2163|2163| 						// Also don't switch to a different type of huntable animal
|2164|2164| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2165|2165| 							return (
|2166|    |-								ent != oldTarget
|2167|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2166|+								ent != oldTarget &&
|    |2167|+								((type.generic == "treasure" && oldType.generic == "treasure")
|2168|2168| 								|| (type.specific == oldType.specific
|2169|2169| 								&& (type.specific != "meat" || oldTemplate == template)))
|2170|2170| 							);
|    | [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
|2164|2164| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2165|2165| 							return (
|2166|2166| 								ent != oldTarget
|2167|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2168|    |-								|| (type.specific == oldType.specific
|    |2167|+								&& ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2168|+								(type.specific == oldType.specific
|2169|2169| 								&& (type.specific != "meat" || oldTemplate == template)))
|2170|2170| 							);
|2171|2171| 						});
|    | [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
|2165|2165| 							return (
|2166|2166| 								ent != oldTarget
|2167|2167| 								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2168|    |-								|| (type.specific == oldType.specific
|2169|    |-								&& (type.specific != "meat" || oldTemplate == template)))
|    |2168|+								|| (type.specific == oldType.specific &&
|    |2169|+								(type.specific != "meat" || oldTemplate == template)))
|2170|2170| 							);
|2171|2171| 						});
|2172|2172| 						if (nearby)
|    | [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
|2223|2223| 					// Also don't switch to a different type of huntable animal
|2224|2224| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2225|2225| 						return (
|2226|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2227|    |-							|| (type.specific == resourceType.specific
|    |2226|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2227|+							(type.specific == resourceType.specific
|2228|2228| 							&& (type.specific != "meat" || resourceTemplate == template))
|2229|2229| 						);
|2230|2230| 					});
|    | [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
|2224|2224| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2225|2225| 						return (
|2226|2226| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2227|    |-							|| (type.specific == resourceType.specific
|2228|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2227|+							|| (type.specific == resourceType.specific &&
|    |2228|+							(type.specific != "meat" || resourceTemplate == template))
|2229|2229| 						);
|2230|2230| 					});
|2231|2231| 
|    | [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
|2341|2341| 
|2342|2342| 					var cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply);
|2343|2343| 					if (cmpSupply && cmpSupply.IsAvailable(cmpOwnership.GetOwner(), this.entity))
|2344|    |-					{
|    |2344|+					
|2345|2345| 						// Check we can still reach and gather from the target
|2346|2346| 						if (this.CheckTargetRange(this.gatheringTarget, IID_ResourceGatherer) && this.CanGather(this.gatheringTarget))
|2347|2347| 						{
|2406|2406| 								return;
|2407|2407| 							}
|2408|2408| 						}
|2409|    |-					}
|    |2409|+					
|2410|2410| 
|2411|2411| 					// We're already in range, can't get anywhere near it or the target is exhausted.
|2412|2412| 
|    | [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
|2432|2432| 					// Also don't switch to a different type of huntable animal
|2433|2433| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2434|2434| 						return (
|2435|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2436|    |-							|| (type.specific == resourceType.specific
|    |2435|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2436|+							(type.specific == resourceType.specific
|2437|2437| 							&& (type.specific != "meat" || resourceTemplate == template))
|2438|2438| 						);
|2439|2439| 					});
|    | [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
|2433|2433| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2434|2434| 						return (
|2435|2435| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2436|    |-							|| (type.specific == resourceType.specific
|2437|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2436|+							|| (type.specific == resourceType.specific &&
|    |2437|+							(type.specific != "meat" || resourceTemplate == template))
|2438|2438| 						);
|2439|2439| 					});
|2440|2440| 					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
|2498|2498| 
|2499|2499| 				"Timer": function(msg) {
|2500|2500| 					if (this.ShouldAbandonChase(this.order.data.target, this.order.data.force, IID_Heal, null))
|2501|    |-					{
|    |2501|+					
|2502|2502| 						// Return to our original position unless we have a better order.
|2503|2503| 						if (!this.FinishOrder() && this.GetStance().respondHoldGround)
|2504|2504| 							this.WalkToHeldPosition();
|2505|    |-					}
|    |2505|+					
|2506|2506| 				},
|2507|2507| 
|2508|2508| 				"MoveCompleted": 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
|2532|2532| 					this.StartTimer(prepare, this.healTimers.repeat);
|2533|2533| 
|2534|2534| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2535|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2535|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2536|2536| 
|2537|2537| 					this.FaceTowardsTarget(this.order.data.target);
|2538|2538| 				},
|    | [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
|2744|2744| 					{
|2745|2745| 						// The building was already finished/fully repaired before we arrived;
|2746|2746| 						// let the ConstructionFinished handler handle this.
|2747|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2747|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2748|2748| 						return true;
|2749|2749| 					}
|2750|2750| 
|    | [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
|2744|2744| 					{
|2745|2745| 						// The building was already finished/fully repaired before we arrived;
|2746|2746| 						// let the ConstructionFinished handler handle this.
|2747|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2747|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2748|2748| 						return true;
|2749|2749| 					}
|2750|2750| 
|    | [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
|2787|2787| 					if (!inRange && this.MoveToTargetRange(this.repairTarget, IID_Builder))
|2788|2788| 						this.SetNextState("APPROACHING");
|2789|2789| 					else if (!inRange)
|2790|    |-						this.FinishOrder(); //can't approach and isn't in reach
|    |2790|+						this.FinishOrder(); // can't approach and isn't in reach
|2791|2791| 				},
|2792|2792| 			},
|2793|2793| 
|    | [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
|2874|2874| 
|2875|2875| 				// Unit was approaching and there's nothing to do now, so switch to walking
|2876|2876| 				if (oldState === "INDIVIDUAL.REPAIR.APPROACHING")
|2877|    |-				{
|    |2877|+				
|2878|2878| 					// We're already walking to the given point, so add this as a order.
|2879|2879| 					this.WalkToTarget(msg.data.newentity, true);
|2880|    |-				}
|    |2880|+				
|2881|2881| 			},
|2882|2882| 		},
|2883|2883| 
|    | [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
|2936|2936| 
|2937|2937| 					// Check that we can garrison here
|2938|2938| 					if (this.CanGarrison(target))
|2939|    |-					{
|    |2939|+					
|2940|2940| 						// Check that we're in range of the garrison target
|2941|2941| 						if (this.CheckGarrisonRange(target))
|2942|2942| 						{
|3012|3012| 								return false;
|3013|3013| 							}
|3014|3014| 						}
|3015|    |-					}
|    |3015|+					
|3016|3016| 					// Garrisoning failed for some reason, so finish the order
|3017|3017| 					this.FinishOrder();
|3018|3018| 					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
|3133|3133| 		"Attacked": function(msg) {
|3134|3134| 			if (this.template.NaturalBehaviour == "skittish" ||
|3135|3135| 			    this.template.NaturalBehaviour == "passive")
|3136|    |-			{
|    |3136|+			
|3137|3137| 				this.Flee(msg.data.attacker, false);
|3138|    |-			}
|    |3138|+			
|3139|3139| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|3140|3140| 			{
|3141|3141| 				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
|3142|3142| 					this.Attack(msg.data.attacker, false);
|3143|3143| 			}
|3144|3144| 			else if (this.template.NaturalBehaviour == "domestic")
|3145|    |-			{
|    |3145|+			
|3146|3146| 				// Never flee, stop what we were doing
|3147|3147| 				this.SetNextState("IDLE");
|3148|    |-			}
|    |3148|+			
|3149|3149| 		},
|3150|3150| 
|3151|3151| 		"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
|3156|3156| 				this.FinishOrder();
|3157|3157| 				return;
|3158|3158| 			}
|3159|    |-			else
|3160|    |-			{
|    |3159|+			
|3161|3160| 				this.order.data.min = range;
|3162|3161| 				this.SetNextState("WALKING");
|3163|    |-			}
|    |3162|+			
|3164|3163| 		},
|3165|3164| 
|3166|3165| 		"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
|3200|3200| 				}
|3201|3201| 				// Start attacking one of the newly-seen enemy (if any)
|3202|3202| 				else if (this.IsDangerousAnimal())
|3203|    |-				{
|    |3203|+				
|3204|3204| 					this.AttackVisibleEntity(msg.data.added);
|3205|    |-				}
|    |3205|+				
|3206|3206| 
|3207|3207| 				// TODO: if two units enter our range together, we'll attack the
|3208|3208| 				// 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
|3243|3243| 				}
|3244|3244| 				// Start attacking one of the newly-seen enemy (if any)
|3245|3245| 				else if (this.template.NaturalBehaviour == "violent")
|3246|    |-				{
|    |3246|+				
|3247|3247| 					this.AttackVisibleEntity(msg.data.added);
|3248|    |-				}
|    |3248|+				
|3249|3249| 			},
|3250|3250| 
|3251|3251| 			"MoveCompleted": function() { },
|    | [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
|3260|3260| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3261|3261| 
|3262|3262| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3263|    |-							// only used for domestic animals
|    |3263|+		// only used for domestic animals
|3264|3264| 	},
|3265|3265| };
|3266|3266| 
|    | [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
|3317|3317| 
|3318|3318| UnitAI.prototype.IsAnimal = function()
|3319|3319| {
|3320|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3320|+	return (!!this.template.NaturalBehaviour);
|3321|3321| };
|3322|3322| 
|3323|3323| 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
|3355|3355| UnitAI.prototype.GetGarrisonHolder = function()
|3356|3356| {
|3357|3357| 	if (this.IsGarrisoned())
|3358|    |-	{
|    |3358|+	
|3359|3359| 		for (let order of this.orderQueue)
|3360|3360| 			if (order.type == "Garrison")
|3361|3361| 				return order.data.target;
|3362|    |-	}
|    |3362|+	
|3363|3363| 	return INVALID_ENTITY;
|3364|3364| };
|3365|3365| 
|    | [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
|3433|3433| 		{
|3434|3434| 			let index = this.GetCurrentState().indexOf(".");
|3435|3435| 			if (index != -1)
|3436|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3436|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3437|3437| 			this.Stop(false);
|3438|3438| 		}
|3439|3439| 
|    | [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
|3489|3489| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3490|3490| 			continue;
|3491|3491| 		if (i == 0)
|3492|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3492|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3493|3493| 		else
|3494|3494| 			this.orderQueue.splice(i, 1);
|3495|3495| 		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
|3489|3489| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3490|3490| 			continue;
|3491|3491| 		if (i == 0)
|3492|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3492|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3493|3493| 		else
|3494|3494| 			this.orderQueue.splice(i, 1);
|3495|3495| 		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
|3573|3573| };
|3574|3574| 
|3575|3575| 
|3576|    |-//// FSM linkage functions ////
|    |3576|+// // FSM linkage functions ////
|3577|3577| 
|3578|3578| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3579|3579| 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
|3745|3745| 				continue;
|3746|3746| 			if (this.orderQueue[i].type == type)
|3747|3747| 				continue;
|3748|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3748|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3749|3749| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3750|3750| 			return;
|3751|3751| 		}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3745|3745| 				continue;
|3746|3746| 			if (this.orderQueue[i].type == type)
|3747|3747| 				continue;
|3748|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3748|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3749|3749| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3750|3750| 			return;
|3751|3751| 		}
|    | [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
|3759|3759| {
|3760|3760| 	// Remember the previous work orders to be able to go back to them later if required
|3761|3761| 	if (data && data.force)
|3762|    |-	{
|    |3762|+	
|3763|3763| 		if (this.IsFormationController())
|3764|3764| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3765|3765| 		else
|3766|3766| 			this.UpdateWorkOrders(type);
|3767|    |-	}
|    |3767|+	
|3768|3768| 
|3769|3769| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3770|3770| 
|    | [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
|3836|3836| 	{
|3837|3837| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3838|3838| 		if (cmpUnitAI)
|3839|    |-		{
|    |3839|+		
|3840|3840| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3841|3841| 			{
|3842|3842| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3845|3845| 					return;
|3846|3846| 				}
|3847|3847| 			}
|3848|    |-		}
|    |3848|+		
|3849|3849| 	}
|3850|3850| 
|3851|3851| 	// 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
|3838|3838| 		if (cmpUnitAI)
|3839|3839| 		{
|3840|3840| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3841|    |-			{
|    |3841|+			
|3842|3842| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3843|3843| 				{
|3844|3844| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3845|3845| 					return;
|3846|3846| 				}
|3847|    |-			}
|    |3847|+			
|3848|3848| 		}
|3849|3849| 	}
|3850|3850| 
|    | [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
|3850|3850| 
|3851|3851| 	// If nothing found, take the unit orders
|3852|3852| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3853|    |-	{
|    |3853|+	
|3854|3854| 		if (isWorkType(this.orderQueue[i].type))
|3855|3855| 		{
|3856|3856| 			this.workOrders = this.orderQueue.slice(i);
|3857|3857| 			return;
|3858|3858| 		}
|3859|    |-	}
|    |3859|+	
|3860|3860| };
|3861|3861| 
|3862|3862| 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
|3916|3916| 	if (data.timerRepeat === undefined)
|3917|3917| 		this.timer = undefined;
|3918|3918| 
|3919|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3919|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3920|3920| };
|3921|3921| 
|3922|3922| /**
|    | [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
|3916|3916| 	if (data.timerRepeat === undefined)
|3917|3917| 		this.timer = undefined;
|3918|3918| 
|3919|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3919|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3920|3920| };
|3921|3921| 
|3922|3922| /**
|    | [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
|3951|3951| 	this.timer = undefined;
|3952|3952| };
|3953|3953| 
|3954|    |-//// Message handlers /////
|    |3954|+// // Message handlers /////
|3955|3955| 
|3956|3956| UnitAI.prototype.OnMotionChanged = function(msg)
|3957|3957| {
|    | [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
|3956|3956| UnitAI.prototype.OnMotionChanged = function(msg)
|3957|3957| {
|3958|3958| 	if (msg.starting && !msg.error)
|3959|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3959|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveStarted", "data": msg});
|3960|3960| 	else if (!msg.starting || msg.error)
|3961|3961| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3962|3962| };
|    | [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
|3956|3956| UnitAI.prototype.OnMotionChanged = function(msg)
|3957|3957| {
|3958|3958| 	if (msg.starting && !msg.error)
|3959|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3959|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg });
|3960|3960| 	else if (!msg.starting || msg.error)
|3961|3961| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3962|3962| };
|    | [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
|3958|3958| 	if (msg.starting && !msg.error)
|3959|3959| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3960|3960| 	else if (!msg.starting || msg.error)
|3961|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3961|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveCompleted", "data": msg});
|3962|3962| };
|3963|3963| 
|3964|3964| UnitAI.prototype.OnGlobalConstructionFinished = 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
|3958|3958| 	if (msg.starting && !msg.error)
|3959|3959| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3960|3960| 	else if (!msg.starting || msg.error)
|3961|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3961|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg });
|3962|3962| };
|3963|3963| 
|3964|3964| UnitAI.prototype.OnGlobalConstructionFinished = 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
|3966|3966| 	// TODO: This is a bit inefficient since every unit listens to every
|3967|3967| 	// construction message - ideally we could scope it to only the one we're building
|3968|3968| 
|3969|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3969|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3970|3970| };
|3971|3971| 
|3972|3972| 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
|3966|3966| 	// TODO: This is a bit inefficient since every unit listens to every
|3967|3967| 	// construction message - ideally we could scope it to only the one we're building
|3968|3968| 
|3969|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3969|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3970|3970| };
|3971|3971| 
|3972|3972| 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
|3991|3991| 
|3992|3992| UnitAI.prototype.OnAttacked = function(msg)
|3993|3993| {
|3994|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3994|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3995|3995| };
|3996|3996| 
|3997|3997| 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
|3991|3991| 
|3992|3992| UnitAI.prototype.OnAttacked = function(msg)
|3993|3993| {
|3994|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3994|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3995|3995| };
|3996|3996| 
|3997|3997| 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
|3996|3996| 
|3997|3997| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3998|3998| {
|3999|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3999|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4000|4000| };
|4001|4001| 
|4002|4002| 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
|3996|3996| 
|3997|3997| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3998|3998| {
|3999|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3999|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4000|4000| };
|4001|4001| 
|4002|4002| 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
|4001|4001| 
|4002|4002| UnitAI.prototype.OnHealthChanged = function(msg)
|4003|4003| {
|4004|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4004|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4005|4005| };
|4006|4006| 
|4007|4007| 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
|4001|4001| 
|4002|4002| UnitAI.prototype.OnHealthChanged = function(msg)
|4003|4003| {
|4004|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4004|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4005|4005| };
|4006|4006| 
|4007|4007| 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
|4007|4007| UnitAI.prototype.OnRangeUpdate = function(msg)
|4008|4008| {
|4009|4009| 	if (msg.tag == this.losRangeQuery)
|4010|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4010|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4011|4011| 	else if (msg.tag == this.losHealRangeQuery)
|4012|4012| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4013|4013| };
|    | [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
|4007|4007| UnitAI.prototype.OnRangeUpdate = function(msg)
|4008|4008| {
|4009|4009| 	if (msg.tag == this.losRangeQuery)
|4010|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4010|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4011|4011| 	else if (msg.tag == this.losHealRangeQuery)
|4012|4012| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4013|4013| };
|    | [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
|4009|4009| 	if (msg.tag == this.losRangeQuery)
|4010|4010| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4011|4011| 	else if (msg.tag == this.losHealRangeQuery)
|4012|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4012|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4013|4013| };
|4014|4014| 
|4015|4015| 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
|4009|4009| 	if (msg.tag == this.losRangeQuery)
|4010|4010| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4011|4011| 	else if (msg.tag == this.losHealRangeQuery)
|4012|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4012|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4013|4013| };
|4014|4014| 
|4015|4015| 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
|4014|4014| 
|4015|4015| UnitAI.prototype.OnPackFinished = function(msg)
|4016|4016| {
|4017|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4017|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4018|4018| };
|4019|4019| 
|4020|4020| //// 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
|4014|4014| 
|4015|4015| UnitAI.prototype.OnPackFinished = function(msg)
|4016|4016| {
|4017|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4017|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4018|4018| };
|4019|4019| 
|4020|4020| //// 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
|4017|4017| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4018|4018| };
|4019|4019| 
|4020|    |-//// Helper functions to be called by the FSM ////
|    |4020|+// // Helper functions to be called by the FSM ////
|4021|4021| 
|4022|4022| UnitAI.prototype.GetWalkSpeed = function()
|4023|4023| {
|    | [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
|4119|4119| 	if (!cmpOwnership || cmpOwnership.GetOwner() == INVALID_PLAYER)
|4120|4120| 		return undefined;
|4121|4121| 
|4122|    |-	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position)
|    |4122|+	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
|4123|4123| 	if (!cmpPosition || !cmpPosition.IsInWorld())
|4124|4124| 		return undefined;
|4125|4125| 
|    | [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
|4204|4204| 			PlaySound(name, member);
|4205|4205| 	}
|4206|4206| 	else
|4207|    |-	{
|    |4207|+	
|4208|4208| 		// Otherwise use our own sounds
|4209|4209| 		PlaySound(name, this.entity);
|4210|    |-	}
|    |4210|+	
|4211|4211| };
|4212|4212| 
|4213|4213| /*
|    | [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
|4300|4300| UnitAI.prototype.MoveTo = function(data, iid, type)
|4301|4301| {
|4302|4302| 	if (data["target"])
|4303|    |-	{
|    |4303|+	
|4304|4304| 		if (data["min"] || data["max"])
|4305|4305| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4306|4306| 		else
|4310|4310| 			else
|4311|4311| 				return this.MoveToTargetRange(data.target, iid, type);
|4312|4312| 		}
|4313|    |-	}
|    |4313|+	
|4314|4314| 	else
|4315|4315| 	{
|4316|4316| 		if (data["min"] || data["max"])
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["target"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4299|4299|  */
|4300|4300| UnitAI.prototype.MoveTo = function(data, iid, type)
|4301|4301| {
|4302|    |-	if (data["target"])
|    |4302|+	if (data.target)
|4303|4303| 	{
|4304|4304| 		if (data["min"] || data["max"])
|4305|4305| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["min"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4301|4301| {
|4302|4302| 	if (data["target"])
|4303|4303| 	{
|4304|    |-		if (data["min"] || data["max"])
|    |4304|+		if (data.min || data["max"])
|4305|4305| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4306|4306| 		else
|4307|4307| 		{
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["max"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4301|4301| {
|4302|4302| 	if (data["target"])
|4303|4303| 	{
|4304|    |-		if (data["min"] || data["max"])
|    |4304|+		if (data["min"] || data.max)
|4305|4305| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4306|4306| 		else
|4307|4307| 		{
|    | [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
|4304|4304| 		if (data["min"] || data["max"])
|4305|4305| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4306|4306| 		else
|4307|    |-		{
|    |4307|+		
|4308|4308| 			if (!iid)
|4309|4309| 				return this.MoveToTarget(data.target);
|4310|4310| 			else
|4311|4311| 				return this.MoveToTargetRange(data.target, iid, type);
|4312|    |-		}
|    |4312|+		
|4313|4313| 	}
|4314|4314| 	else
|4315|4315| 	{
|    | [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
|4303|4303| 	{
|4304|4304| 		if (data["min"] || data["max"])
|4305|4305| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4306|    |-		else
|4307|    |-		{
|    |4306|+		
|4308|4307| 			if (!iid)
|4309|4308| 				return this.MoveToTarget(data.target);
|4310|4309| 			else
|4311|4310| 				return this.MoveToTargetRange(data.target, iid, type);
|4312|    |-		}
|    |4311|+		
|4313|4312| 	}
|4314|4313| 	else
|4315|4314| 	{
|    | [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
|4307|4307| 		{
|4308|4308| 			if (!iid)
|4309|4309| 				return this.MoveToTarget(data.target);
|4310|    |-			else
|4311|    |-				return this.MoveToTargetRange(data.target, iid, type);
|    |4310|+			return this.MoveToTargetRange(data.target, iid, type);
|4312|4311| 		}
|4313|4312| 	}
|4314|4313| 	else
|    | [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
|4312|4312| 		}
|4313|4313| 	}
|4314|4314| 	else
|4315|    |-	{
|    |4315|+	
|4316|4316| 		if (data["min"] || data["max"])
|4317|4317| 			return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1);
|4318|4318| 		else
|4319|4319| 			return this.MoveToPoint(data.x, data.z);
|4320|    |-	}
|    |4320|+	
|4321|4321| }
|4322|4322| 
|4323|4323| UnitAI.prototype.MoveToPoint = function(x, z)
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["min"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4313|4313| 	}
|4314|4314| 	else
|4315|4315| 	{
|4316|    |-		if (data["min"] || data["max"])
|    |4316|+		if (data.min || data["max"])
|4317|4317| 			return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1);
|4318|4318| 		else
|4319|4319| 			return this.MoveToPoint(data.x, data.z);
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["max"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4313|4313| 	}
|4314|4314| 	else
|4315|4315| 	{
|4316|    |-		if (data["min"] || data["max"])
|    |4316|+		if (data["min"] || data.max)
|4317|4317| 			return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1);
|4318|4318| 		else
|4319|4319| 			return this.MoveToPoint(data.x, data.z);
|    | [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
|4315|4315| 	{
|4316|4316| 		if (data["min"] || data["max"])
|4317|4317| 			return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1);
|4318|    |-		else
|4319|    |-			return this.MoveToPoint(data.x, data.z);
|    |4318|+		return this.MoveToPoint(data.x, data.z);
|4320|4319| 	}
|4321|4320| }
|4322|4321| 
|    | [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
|4318|4318| 		else
|4319|4319| 			return this.MoveToPoint(data.x, data.z);
|4320|4320| 	}
|4321|    |-}
|    |4321|+};
|4322|4322| 
|4323|4323| UnitAI.prototype.MoveToPoint = function(x, z)
|4324|4324| {
|    | [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
|4402|4402| 	else
|4403|4403| 		// return false? Or hope you come close enough?
|4404|4404| 		var parabolicMaxRange = 0;
|4405|    |-		//return false;
|    |4405|+		// return false;
|4406|4406| 
|4407|4407| 	// the parabole changes while walking, take something in the middle
|4408|4408| 	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
|4467|4467| 	if (this.IsFormationMember())
|4468|4468| 	{
|4469|4469| 		var cmpFormationUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|4470|    |-		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation()
|4471|    |-			&& cmpFormationUnitAI.order.data.target == target)
|    |4470|+		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation() &&
|    |4471|+			cmpFormationUnitAI.order.data.target == target)
|4472|4472| 			return true;
|4473|4473| 	}
|4474|4474| 
|    | [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
|4635|4635| UnitAI.prototype.AttackEntityInZone = function(ents)
|4636|4636| {
|4637|4637| 	var target = ents.find(target =>
|4638|    |-		this.CanAttack(target)
|4639|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4638|+		this.CanAttack(target) &&
|    |4639|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4640|4640| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4641|4641| 	);
|4642|4642| 	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
|4636|4636| {
|4637|4637| 	var target = ents.find(target =>
|4638|4638| 		this.CanAttack(target)
|4639|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4640|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4639|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4640|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4641|4641| 	);
|4642|4642| 	if (!target)
|4643|4643| 		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
|4700|4700| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4701|4701| 	if (this.isGuardOf)
|4702|4702| 	{
|4703|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4703|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4704|4704| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4705|4705| 		if (cmpUnitAI && cmpAttack &&
|4706|4706| 		    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
|4704|4704| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4705|4705| 		if (cmpUnitAI && cmpAttack &&
|4706|4706| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4707|    |-				return false;
|    |4707|+			return false;
|4708|4708| 	}
|4709|4709| 
|4710|4710| 	// 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
|4709|4709| 
|4710|4710| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4711|4711| 	if (this.GetStance().respondHoldGround)
|4712|    |-	{
|    |4712|+	
|4713|4713| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4714|4714| 			return true;
|4715|    |-	}
|    |4715|+	
|4716|4716| 
|4717|4717| 	// Stop if it's left our vision range, unless we're especially persistent
|4718|4718| 	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
|4716|4716| 
|4717|4717| 	// Stop if it's left our vision range, unless we're especially persistent
|4718|4718| 	if (!this.GetStance().respondChaseBeyondVision)
|4719|    |-	{
|    |4719|+	
|4720|4720| 		if (!this.CheckTargetIsInVisionRange(target))
|4721|4721| 			return true;
|4722|    |-	}
|    |4722|+	
|4723|4723| 
|4724|4724| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4725|4725| 	// 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
|4742|4742| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4743|4743| 	if (this.isGuardOf)
|4744|4744| 	{
|4745|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4745|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4746|4746| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4747|4747| 		if (cmpUnitAI && cmpAttack &&
|4748|4748| 		    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
|4755|4755| 	return false;
|4756|4756| };
|4757|4757| 
|4758|    |-//// External interface functions ////
|    |4758|+// // External interface functions ////
|4759|4759| 
|4760|4760| UnitAI.prototype.SetFormationController = function(ent)
|4761|4761| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4765|4765| 	// of our own formation (or ourself if not in formation)
|4766|4766| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4767|4767| 	if (cmpObstruction)
|4768|    |-	{
|    |4768|+	
|4769|4769| 		if (ent == INVALID_ENTITY)
|4770|4770| 			cmpObstruction.SetControlGroup(this.entity);
|4771|4771| 		else
|4772|4772| 			cmpObstruction.SetControlGroup(ent);
|4773|    |-	}
|    |4773|+	
|4774|4774| 
|4775|4775| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4776|4776| 	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
|4908|4908| 	// if we already had an old guard order, do nothing if the target is the same
|4909|4909| 	// and the order is running, otherwise remove the previous order
|4910|4910| 	if (this.isGuardOf)
|4911|    |-	{
|    |4911|+	
|4912|4912| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4913|4913| 			return;
|4914|4914| 		else
|4915|4915| 			this.RemoveGuard();
|4916|    |-	}
|    |4916|+	
|4917|4917| 
|4918|4918| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4919|4919| };
|    | [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
|4911|4911| 	{
|4912|4912| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4913|4913| 			return;
|4914|    |-		else
|4915|    |-			this.RemoveGuard();
|    |4914|+		this.RemoveGuard();
|4916|4915| 	}
|4917|4916| 
|4918|4917| 	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
|5082|5082| 			this.WalkToTarget(target, queued);
|5083|5083| 		return;
|5084|5084| 	}
|5085|    |-	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture}, queued);
|    |5085|+	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture }, queued);
|5086|5086| };
|5087|5087| 
|5088|5088| /**
|    | [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
|5231|5231| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5232|5232| 	{
|5233|5233| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5234|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5234|+		if (cmpTrader.HasBothMarkets() &&
|5235|5235| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5236|5236| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5237|5237| 		{
|    | [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
|5512|5512| 				{
|5513|5513| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5514|5514| 					var targetClasses = this.order.data.targetClasses;
|5515|    |-					if (targetClasses.attack && cmpIdentity
|5516|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5515|+					if (targetClasses.attack && cmpIdentity &&
|    |5516|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5517|5517| 						continue;
|5518|5518| 					if (targetClasses.avoid && cmpIdentity
|5519|5519| 						&& 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
|5515|5515| 					if (targetClasses.attack && cmpIdentity
|5516|5516| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5517|5517| 						continue;
|5518|    |-					if (targetClasses.avoid && cmpIdentity
|5519|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5518|+					if (targetClasses.avoid && cmpIdentity &&
|    |5519|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5520|5520| 						continue;
|5521|5521| 					// Only used by the AIs to prevent some choices of targets
|5522|5522| 					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
|5538|5538| 		{
|5539|5539| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5540|5540| 			var targetClasses = this.order.data.targetClasses;
|5541|    |-			if (cmpIdentity && targetClasses.attack
|5542|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5541|+			if (cmpIdentity && targetClasses.attack &&
|    |5542|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5543|5543| 				continue;
|5544|5544| 			if (cmpIdentity && targetClasses.avoid
|5545|5545| 				&& 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
|5541|5541| 			if (cmpIdentity && targetClasses.attack
|5542|5542| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5543|5543| 				continue;
|5544|    |-			if (cmpIdentity && targetClasses.avoid
|5545|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5544|+			if (cmpIdentity && targetClasses.avoid &&
|    |5545|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5546|5546| 				continue;
|5547|5547| 			// Only used by the AIs to prevent some choices of targets
|5548|5548| 			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
|5684|5684| 
|5685|5685| UnitAI.prototype.SetHeldPosition = function(x, z)
|5686|5686| {
|5687|    |-	this.heldPosition = {"x": x, "z": z};
|    |5687|+	this.heldPosition = { "x": x, "z": z};
|5688|5688| };
|5689|5689| 
|5690|5690| 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
|5684|5684| 
|5685|5685| UnitAI.prototype.SetHeldPosition = function(x, z)
|5686|5686| {
|5687|    |-	this.heldPosition = {"x": x, "z": z};
|    |5687|+	this.heldPosition = {"x": x, "z": z };
|5688|5688| };
|5689|5689| 
|5690|5690| 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
|5711|5711| 	return false;
|5712|5712| };
|5713|5713| 
|5714|    |-//// Helper functions ////
|    |5714|+// // Helper functions ////
|5715|5715| 
|5716|5716| UnitAI.prototype.CanAttack = function(target)
|5717|5717| {
|    | [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
|5915|5915| 	return cmpPack && cmpPack.IsPacking();
|5916|5916| };
|5917|5917| 
|5918|    |-//// Formation specific functions ////
|    |5918|+// // Formation specific functions ////
|5919|5919| 
|5920|5920| UnitAI.prototype.IsAttackingAsFormation = function()
|5921|5921| {
|    | [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
|5920|5920| UnitAI.prototype.IsAttackingAsFormation = function()
|5921|5921| {
|5922|5922| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5923|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5924|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5923|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5924|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5925|5925| };
|5926|5926| 
|5927|5927| //// 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
|5924|5924| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5925|5925| };
|5926|5926| 
|5927|    |-//// Animal specific functions ////
|    |5927|+// // Animal specific functions ////
|5928|5928| 
|5929|5929| UnitAI.prototype.MoveRandomly = function(distance)
|5930|5930| {

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

binaries/data/mods/public/simulation/components/UnitAI.js
| 903| »   »   »   "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
| 928| »   »   »   "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
| 946| »   »   »   "leave":·function(msg)·{
|    | [NORMAL] ESLintBear (no-dupe-keys):
|    | Duplicate key 'leave'.

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

binaries/data/mods/public/simulation/components/UnitAI.js
|1044| »   »   »   »   "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
|1082| »   »   »   "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
|1115| »   »   »   »   "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
|1328| »   »   »   "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
|1624| »   »   »   »   »   return·false;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'enter' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
|2422| »   »   »   »   »   »   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
|2477| »   »   »   »   "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
|2595| »   »   »   »   "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
|2697| »   »   »   »   "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
|2906| »   »   »   »   "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
|3089| »   »   »   »   "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
|3821| »   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
|4622| »   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
|4637| »   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
|4683| »   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
|4706| »   »   ····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
|5162| »   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
| 358| »   »   ····&&·(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
| 946| »   »   »   "leave":·function(msg)·{
|    | [NORMAL] JSHintBear:
|    | Duplicate key 'leave'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1872| »   »   »   »   »   »   var·cmpFormation·=·Engine.QueryInterface(this.formationController,·IID_Formation);
|    | [NORMAL] JSHintBear:
|    | 'cmpFormation' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|2013| »   »   »   »   »   »   &&·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
|2092| »   »   »   »   »   »   »   »   ·&&·((type.generic·==·"treasure"·&&·oldType.generic·==·"treasure")
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|2167| »   »   »   »   »   »   »   »   &&·((type.generic·==·"treasure"·&&·oldType.generic·==·"treasure")
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4302| »   if·(data["target"])
|    | [NORMAL] JSHintBear:
|    | ['target'] is better written in dot notation.

binaries/data/mods/public/simulation/components/UnitAI.js
|4304| »   »   if·(data["min"]·||·data["max"])
|    | [NORMAL] JSHintBear:
|    | ['min'] is better written in dot notation.

binaries/data/mods/public/simulation/components/UnitAI.js
|4304| »   »   if·(data["min"]·||·data["max"])
|    | [NORMAL] JSHintBear:
|    | ['max'] is better written in dot notation.

binaries/data/mods/public/simulation/components/UnitAI.js
|4316| »   »   if·(data["min"]·||·data["max"])
|    | [NORMAL] JSHintBear:
|    | ['min'] is better written in dot notation.

binaries/data/mods/public/simulation/components/UnitAI.js
|4316| »   »   if·(data["min"]·||·data["max"])
|    | [NORMAL] JSHintBear:
|    | ['max'] is better written in dot notation.

binaries/data/mods/public/simulation/components/UnitAI.js
|4321| }
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4415| »   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
|4471| »   »   »   &&·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
|4639| »   »   &&·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
|4640| »   »   &&·(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
|5162| »   var·lastPos·=·undefined;
|    | [NORMAL] JSHintBear:
|    | It's not necessary to initialize 'lastPos' to 'undefined'.

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|5533| »   for·(var·targ·of·targets)
|    | [MAJOR] JSHintBear:
|    | Too many errors. (91% scanned).
Executing section cli...

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

wraitii updated this revision to Diff 8157.Sun, May 26, 3:44 PM

Remove the dependency on D981. Will commit soon-ish.

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

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
| 356| 356| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 357| 357| 		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 358| 358| 		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 359|    |-		{
|    | 359|+		
| 360| 360| 			// we were already on the shoreline, and have not moved since
| 361| 361| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
| 362| 362| 				needToMove = false;
| 363|    |-		}
|    | 363|+		
| 364| 364| 
| 365| 365| 		if (needToMove)
| 366| 366| 			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
| 354| 354| 		// Check if we need to move     TODO implement a better way to know if we are on the shoreline
| 355| 355| 		var needToMove = true;
| 356| 356| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 357|    |-		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 358|    |-		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
|    | 357|+		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x) &&
|    | 358|+		    (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 359| 359| 		{
| 360| 360| 			// we were already on the shoreline, and have not moved since
| 361| 361| 			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
| 527| 527| 					this.PushOrderFront("Walk", this.order.data.lastPos);
| 528| 528| 				}
| 529| 529| 				else
| 530|    |-				{
|    | 530|+				
| 531| 531| 					// We couldn't move there, or the target moved away
| 532| 532| 					this.FinishOrder();
| 533|    |-				}
|    | 533|+				
| 534| 534| 				return;
| 535| 535| 			}
| 536| 536| 
|    | [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
| 742| 742| 			}
| 743| 743| 			// Check if we are already in range, otherwise walk there
| 744| 744| 			if (!this.CheckGarrisonRange(msg.data.target))
| 745|    |-			{
|    | 745|+			
| 746| 746| 				if (!this.CheckTargetVisible(msg.data.target))
| 747| 747| 				{
| 748| 748| 					this.FinishOrder();
| 753| 753| 					this.SetNextState("GARRISON.APPROACHING");
| 754| 754| 					return;
| 755| 755| 				}
| 756|    |-			}
|    | 756|+			
| 757| 757| 
| 758| 758| 			this.SetNextState("GARRISON.GARRISONING");
| 759| 759| 		},
|    | [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
| 748| 748| 					this.FinishOrder();
| 749| 749| 					return;
| 750| 750| 				}
| 751|    |-				else
| 752|    |-				{
|    | 751|+				
| 753| 752| 					this.SetNextState("GARRISON.APPROACHING");
| 754| 753| 					return;
| 755|    |-				}
|    | 754|+				
| 756| 755| 			}
| 757| 756| 
| 758| 757| 			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
| 771| 771| 						this.PushOrderFront("Walk", msg.data.lastPos);
| 772| 772| 					}
| 773| 773| 					else
| 774|    |-					{
|    | 774|+					
| 775| 775| 						// We couldn't move there, or the target moved away
| 776| 776| 						this.FinishOrder();
| 777|    |-					}
|    | 777|+					
| 778| 778| 					return;
| 779| 779| 				}
| 780| 780| 
|    | [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
|1019|1019| 			},
|1020|1020| 		},
|1021|1021| 
|1022|    |-		"GARRISON":{
|    |1022|+		"GARRISON": {
|1023|1023| 			"enter": function() {
|1024|1024| 				// If the garrisonholder should pickup, warn it so it can take needed action
|1025|1025| 				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
|1239|1239| 			// If the controller handled an order but some members rejected it,
|1240|1240| 			// they will have no orders and be in the FORMATIONMEMBER.IDLE state.
|1241|1241| 			if (this.orderQueue.length)
|1242|    |-			{
|    |1242|+			
|1243|1243| 				// We're leaving the formation, so stop our FormationWalk order
|1244|1244| 				if (this.FinishOrder())
|1245|1245| 					return;
|1246|    |-			}
|    |1246|+			
|1247|1247| 
|1248|1248| 			// No orders left, we're an individual now
|1249|1249| 			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
|1267|1267| 			// Move a tile outside the building
|1268|1268| 			let range = 4;
|1269|1269| 			if (this.CheckTargetRangeExplicit(msg.data.target, range, range))
|1270|    |-			{
|    |1270|+			
|1271|1271| 				// We are already at the target, or can't move at all
|1272|1272| 				this.FinishOrder();
|1273|    |-			}
|    |1273|+			
|1274|1274| 			else
|1275|1275| 			{
|1276|1276| 				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
|1482|1482| 
|1483|1483| 			"LosRangeUpdate": function(msg) {
|1484|1484| 				if (this.GetStance().targetVisibleEnemies)
|1485|    |-				{
|    |1485|+				
|1486|1486| 					// Start attacking one of the newly-seen enemy (if any)
|1487|1487| 					this.AttackEntitiesByPreference(msg.data.added);
|1488|    |-				}
|    |1488|+				
|1489|1489| 			},
|1490|1490| 
|1491|1491| 			"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
|1519|1519| 				this.SelectAnimation("move");
|1520|1520| 			},
|1521|1521| 
|1522|    |-			"leave": function () {
|    |1522|+			"leave": function() {
|1523|1523| 				this.SelectAnimation("idle");
|1524|1524| 				this.StopMoving();
|1525|1525| 			},
|    | [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
|1696|1696| 						// if nothing better to do, check if the guarded needs to be healed or repaired
|1697|1697| 						var cmpHealth = Engine.QueryInterface(this.isGuardOf, IID_Health);
|1698|1698| 						if (cmpHealth && cmpHealth.IsInjured())
|1699|    |-						{
|    |1699|+						
|1700|1700| 							if (this.CanHeal(this.isGuardOf))
|1701|1701| 								this.PushOrderFront("Heal", { "target": this.isGuardOf, "force": false });
|1702|1702| 							else if (this.CanRepair(this.isGuardOf))
|1703|1703| 								this.PushOrderFront("Repair", { "target": this.isGuardOf, "autocontinue": false, "force": false });
|1704|    |-						}
|    |1704|+						
|1705|1705| 					}
|1706|1706| 				},
|1707|1707| 
|    | [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
|1794|1794| 				"MoveCompleted": function() {
|1795|1795| 
|1796|1796| 					if (this.CheckTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1797|    |-					{
|    |1797|+					
|1798|1798| 						// If the unit needs to unpack, do so
|1799|1799| 						if (this.CanUnpack())
|1800|1800| 						{
|1803|1803| 						}
|1804|1804| 						else
|1805|1805| 							this.SetNextState("ATTACKING");
|1806|    |-					}
|    |1806|+					
|1807|1807| 					else
|1808|1808| 					{
|1809|1809| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|    | [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
|1801|1801| 							this.PushOrderFront("Unpack", { "force": true });
|1802|1802| 							return;
|1803|1803| 						}
|1804|    |-						else
|1805|    |-							this.SetNextState("ATTACKING");
|    |1804|+						this.SetNextState("ATTACKING");
|1806|1805| 					}
|1807|1806| 					else
|1808|1807| 					{
|    | [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
|1805|1805| 							this.SetNextState("ATTACKING");
|1806|1806| 					}
|1807|1807| 					else
|1808|    |-					{
|    |1808|+					
|1809|1809| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1810|1810| 						{
|1811|1811| 							this.SetNextState("APPROACHING");
|1815|1815| 							// Give up
|1816|1816| 							this.FinishOrder();
|1817|1817| 						}
|1818|    |-					}
|    |1818|+					
|1819|1819| 				},
|1820|1820| 			},
|1821|1821| 
|    | [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
|1807|1807| 					else
|1808|1808| 					{
|1809|1809| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1810|    |-						{
|    |1810|+						
|1811|1811| 							this.SetNextState("APPROACHING");
|1812|    |-						}
|    |1812|+						
|1813|1813| 						else
|1814|1814| 						{
|1815|1815| 							// Give up
|    | [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
|1811|1811| 							this.SetNextState("APPROACHING");
|1812|1812| 						}
|1813|1813| 						else
|1814|    |-						{
|    |1814|+						
|1815|1815| 							// Give up
|1816|1816| 							this.FinishOrder();
|1817|    |-						}
|    |1817|+						
|1818|1818| 					}
|1819|1819| 				},
|1820|1820| 			},
|    | [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
|1832|1832| 					}
|1833|1833| 					// Check the target is still alive and attackable
|1834|1834| 					if (this.CanAttack(target) && !this.CheckTargetAttackRange(target, this.order.data.attackType))
|1835|    |-					{
|    |1835|+					
|1836|1836| 						// Can't reach it - try to chase after it
|1837|1837| 						if (this.ShouldChaseTargetedEntity(target, this.order.data.force))
|1838|1838| 						{
|1847|1847| 								return;
|1848|1848| 							}
|1849|1849| 						}
|1850|    |-					}
|    |1850|+					
|1851|1851| 
|1852|1852| 					this.StopMoving();
|1853|1853| 
|    | [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
|1880|1880| 					// TODO: we should probably only bother syncing projectile attacks, not melee
|1881|1881| 
|1882|1882| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|1883|    |-					this.resyncAnimation = (prepare != this.attackTimers.prepare) ? true : false;
|    |1883|+					this.resyncAnimation = (prepare != this.attackTimers.prepare);
|1884|1884| 
|1885|1885| 					this.FaceTowardsTarget(this.order.data.target);
|1886|1886| 
|    | [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
|2009|2009| 
|2010|2010| 				"Attacked": function(msg) {
|2011|2011| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2012|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2013|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2012|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2013|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2014|2014| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2015|2015| 				},
|2016|2016| 			},
|    | [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
|2029|2029| 					this.SelectAnimation("move");
|2030|2030| 					var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|2031|2031| 					if (cmpUnitAI && cmpUnitAI.IsFleeing())
|2032|    |-					{
|    |2032|+					
|2033|2033| 						// Run after a fleeing target
|2034|2034| 						this.SetSpeedMultiplier(this.GetRunMultiplier());
|2035|    |-					}
|    |2035|+					
|2036|2036| 					this.StartTimer(1000, 1000);
|2037|2037| 				},
|2038|2038| 
|    | [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
|2088|2088| 						// Also don't switch to a different type of huntable animal
|2089|2089| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2090|2090| 							return (
|2091|    |-								ent != oldTarget
|2092|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2091|+								ent != oldTarget &&
|    |2092|+								 ((type.generic == "treasure" && oldType.generic == "treasure")
|2093|2093| 								 || (type.specific == oldType.specific
|2094|2094| 								 && (type.specific != "meat" || oldTemplate == template)))
|2095|2095| 							);
|    | [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
|2089|2089| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2090|2090| 							return (
|2091|2091| 								ent != oldTarget
|2092|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2093|    |-								 || (type.specific == oldType.specific
|    |2092|+								 && ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2093|+								 (type.specific == oldType.specific
|2094|2094| 								 && (type.specific != "meat" || oldTemplate == template)))
|2095|2095| 							);
|2096|2096| 						}, oldTarget);
|    | [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
|2090|2090| 							return (
|2091|2091| 								ent != oldTarget
|2092|2092| 								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2093|    |-								 || (type.specific == oldType.specific
|2094|    |-								 && (type.specific != "meat" || oldTemplate == template)))
|    |2093|+								 || (type.specific == oldType.specific &&
|    |2094|+								 (type.specific != "meat" || oldTemplate == template)))
|2095|2095| 							);
|2096|2096| 						}, oldTarget);
|2097|2097| 						if (nearby)
|    | [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
|2099|2099| 							this.PerformGather(nearby, false, false);
|2100|2100| 							return true;
|2101|2101| 						}
|2102|    |-						else
|2103|    |-						{
|    |2102|+						
|2104|2103| 							// It's probably better in this case, to avoid units getting stuck around a dropsite
|2105|2104| 							// in a "Target is far away, full, nearby are no good resources, return to dropsite" loop
|2106|2105| 							// to order it to GatherNear the resource position.
|2121|2120| 									return true;
|2122|2121| 								}
|2123|2122| 							}
|2124|    |-						}
|    |2123|+						
|2125|2124| 						return true;
|2126|2125| 					}
|2127|2126| 
|    | [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
|2111|2111| 								this.GatherNearPosition(pos.x, pos.z, oldType, oldTemplate);
|2112|2112| 								return true;
|2113|2113| 							}
|2114|    |-							else
|2115|    |-							{
|    |2114|+							
|2116|2115| 								// we're kind of stuck here. Return resource.
|2117|2116| 								var nearby = this.FindNearestDropsite(oldType.generic);
|2118|2117| 								if (nearby)
|2120|2119| 									this.PushOrderFront("ReturnResource", { "target": nearby, "force": false });
|2121|2120| 									return true;
|2122|2121| 								}
|2123|    |-							}
|    |2122|+							
|2124|2123| 						}
|2125|2124| 						return true;
|2126|2125| 					}
|    | [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
|2163|2163| 						// Also don't switch to a different type of huntable animal
|2164|2164| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2165|2165| 							return (
|2166|    |-								ent != oldTarget
|2167|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2166|+								ent != oldTarget &&
|    |2167|+								((type.generic == "treasure" && oldType.generic == "treasure")
|2168|2168| 								|| (type.specific == oldType.specific
|2169|2169| 								&& (type.specific != "meat" || oldTemplate == template)))
|2170|2170| 							);
|    | [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
|2164|2164| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2165|2165| 							return (
|2166|2166| 								ent != oldTarget
|2167|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2168|    |-								|| (type.specific == oldType.specific
|    |2167|+								&& ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2168|+								(type.specific == oldType.specific
|2169|2169| 								&& (type.specific != "meat" || oldTemplate == template)))
|2170|2170| 							);
|2171|2171| 						});
|    | [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
|2165|2165| 							return (
|2166|2166| 								ent != oldTarget
|2167|2167| 								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2168|    |-								|| (type.specific == oldType.specific
|2169|    |-								&& (type.specific != "meat" || oldTemplate == template)))
|    |2168|+								|| (type.specific == oldType.specific &&
|    |2169|+								(type.specific != "meat" || oldTemplate == template)))
|2170|2170| 							);
|2171|2171| 						});
|2172|2172| 						if (nearby)
|    | [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
|2223|2223| 					// Also don't switch to a different type of huntable animal
|2224|2224| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2225|2225| 						return (
|2226|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2227|    |-							|| (type.specific == resourceType.specific
|    |2226|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2227|+							(type.specific == resourceType.specific
|2228|2228| 							&& (type.specific != "meat" || resourceTemplate == template))
|2229|2229| 						);
|2230|2230| 					});
|    | [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
|2224|2224| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2225|2225| 						return (
|2226|2226| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2227|    |-							|| (type.specific == resourceType.specific
|2228|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2227|+							|| (type.specific == resourceType.specific &&
|    |2228|+							(type.specific != "meat" || resourceTemplate == template))
|2229|2229| 						);
|2230|2230| 					});
|2231|2231| 
|    | [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
|2341|2341| 
|2342|2342| 					var cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply);
|2343|2343| 					if (cmpSupply && cmpSupply.IsAvailable(cmpOwnership.GetOwner(), this.entity))
|2344|    |-					{
|    |2344|+					
|2345|2345| 						// Check we can still reach and gather from the target
|2346|2346| 						if (this.CheckTargetRange(this.gatheringTarget, IID_ResourceGatherer) && this.CanGather(this.gatheringTarget))
|2347|2347| 						{
|2406|2406| 								return;
|2407|2407| 							}
|2408|2408| 						}
|2409|    |-					}
|    |2409|+					
|2410|2410| 
|2411|2411| 					// We're already in range, can't get anywhere near it or the target is exhausted.
|2412|2412| 
|    | [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
|2432|2432| 					// Also don't switch to a different type of huntable animal
|2433|2433| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2434|2434| 						return (
|2435|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2436|    |-							|| (type.specific == resourceType.specific
|    |2435|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2436|+							(type.specific == resourceType.specific
|2437|2437| 							&& (type.specific != "meat" || resourceTemplate == template))
|2438|2438| 						);
|2439|2439| 					});
|    | [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
|2433|2433| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2434|2434| 						return (
|2435|2435| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2436|    |-							|| (type.specific == resourceType.specific
|2437|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2436|+							|| (type.specific == resourceType.specific &&
|    |2437|+							(type.specific != "meat" || resourceTemplate == template))
|2438|2438| 						);
|2439|2439| 					});
|2440|2440| 					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
|2498|2498| 
|2499|2499| 				"Timer": function(msg) {
|2500|2500| 					if (this.ShouldAbandonChase(this.order.data.target, this.order.data.force, IID_Heal, null))
|2501|    |-					{
|    |2501|+					
|2502|2502| 						// Return to our original position unless we have a better order.
|2503|2503| 						if (!this.FinishOrder() && this.GetStance().respondHoldGround)
|2504|2504| 							this.WalkToHeldPosition();
|2505|    |-					}
|    |2505|+					
|2506|2506| 				},
|2507|2507| 
|2508|2508| 				"MoveCompleted": 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
|2532|2532| 					this.StartTimer(prepare, this.healTimers.repeat);
|2533|2533| 
|2534|2534| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2535|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2535|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2536|2536| 
|2537|2537| 					this.FaceTowardsTarget(this.order.data.target);
|2538|2538| 				},
|    | [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
|2744|2744| 					{
|2745|2745| 						// The building was already finished/fully repaired before we arrived;
|2746|2746| 						// let the ConstructionFinished handler handle this.
|2747|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2747|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2748|2748| 						return true;
|2749|2749| 					}
|2750|2750| 
|    | [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
|2744|2744| 					{
|2745|2745| 						// The building was already finished/fully repaired before we arrived;
|2746|2746| 						// let the ConstructionFinished handler handle this.
|2747|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2747|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2748|2748| 						return true;
|2749|2749| 					}
|2750|2750| 
|    | [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
|2787|2787| 					if (!inRange && this.MoveToTargetRange(this.repairTarget, IID_Builder))
|2788|2788| 						this.SetNextState("APPROACHING");
|2789|2789| 					else if (!inRange)
|2790|    |-						this.FinishOrder(); //can't approach and isn't in reach
|    |2790|+						this.FinishOrder(); // can't approach and isn't in reach
|2791|2791| 				},
|2792|2792| 			},
|2793|2793| 
|    | [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
|2874|2874| 
|2875|2875| 				// Unit was approaching and there's nothing to do now, so switch to walking
|2876|2876| 				if (oldState === "INDIVIDUAL.REPAIR.APPROACHING")
|2877|    |-				{
|    |2877|+				
|2878|2878| 					// We're already walking to the given point, so add this as a order.
|2879|2879| 					this.WalkToTarget(msg.data.newentity, true);
|2880|    |-				}
|    |2880|+				
|2881|2881| 			},
|2882|2882| 		},
|2883|2883| 
|    | [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
|2936|2936| 
|2937|2937| 					// Check that we can garrison here
|2938|2938| 					if (this.CanGarrison(target))
|2939|    |-					{
|    |2939|+					
|2940|2940| 						// Check that we're in range of the garrison target
|2941|2941| 						if (this.CheckGarrisonRange(target))
|2942|2942| 						{
|3012|3012| 								return false;
|3013|3013| 							}
|3014|3014| 						}
|3015|    |-					}
|    |3015|+					
|3016|3016| 					// Garrisoning failed for some reason, so finish the order
|3017|3017| 					this.FinishOrder();
|3018|3018| 					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
|3133|3133| 		"Attacked": function(msg) {
|3134|3134| 			if (this.template.NaturalBehaviour == "skittish" ||
|3135|3135| 			    this.template.NaturalBehaviour == "passive")
|3136|    |-			{
|    |3136|+			
|3137|3137| 				this.Flee(msg.data.attacker, false);
|3138|    |-			}
|    |3138|+			
|3139|3139| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|3140|3140| 			{
|3141|3141| 				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
|3142|3142| 					this.Attack(msg.data.attacker, false);
|3143|3143| 			}
|3144|3144| 			else if (this.template.NaturalBehaviour == "domestic")
|3145|    |-			{
|    |3145|+			
|3146|3146| 				// Never flee, stop what we were doing
|3147|3147| 				this.SetNextState("IDLE");
|3148|    |-			}
|    |3148|+			
|3149|3149| 		},
|3150|3150| 
|3151|3151| 		"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
|3156|3156| 				this.FinishOrder();
|3157|3157| 				return;
|3158|3158| 			}
|3159|    |-			else
|3160|    |-			{
|    |3159|+			
|3161|3160| 				this.order.data.min = range;
|3162|3161| 				this.SetNextState("WALKING");
|3163|    |-			}
|    |3162|+			
|3164|3163| 		},
|3165|3164| 
|3166|3165| 		"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
|3200|3200| 				}
|3201|3201| 				// Start attacking one of the newly-seen enemy (if any)
|3202|3202| 				else if (this.IsDangerousAnimal())
|3203|    |-				{
|    |3203|+				
|3204|3204| 					this.AttackVisibleEntity(msg.data.added);
|3205|    |-				}
|    |3205|+				
|3206|3206| 
|3207|3207| 				// TODO: if two units enter our range together, we'll attack the
|3208|3208| 				// 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
|3243|3243| 				}
|3244|3244| 				// Start attacking one of the newly-seen enemy (if any)
|3245|3245| 				else if (this.template.NaturalBehaviour == "violent")
|3246|    |-				{
|    |3246|+				
|3247|3247| 					this.AttackVisibleEntity(msg.data.added);
|3248|    |-				}
|    |3248|+				
|3249|3249| 			},
|3250|3250| 
|3251|3251| 			"MoveCompleted": function() { },
|    | [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
|3260|3260| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3261|3261| 
|3262|3262| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3263|    |-							// only used for domestic animals
|    |3263|+		// only used for domestic animals
|3264|3264| 	},
|3265|3265| };
|3266|3266| 
|    | [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
|3317|3317| 
|3318|3318| UnitAI.prototype.IsAnimal = function()
|3319|3319| {
|3320|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3320|+	return (!!this.template.NaturalBehaviour);
|3321|3321| };
|3322|3322| 
|3323|3323| 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
|3355|3355| UnitAI.prototype.GetGarrisonHolder = function()
|3356|3356| {
|3357|3357| 	if (this.IsGarrisoned())
|3358|    |-	{
|    |3358|+	
|3359|3359| 		for (let order of this.orderQueue)
|3360|3360| 			if (order.type == "Garrison")
|3361|3361| 				return order.data.target;
|3362|    |-	}
|    |3362|+	
|3363|3363| 	return INVALID_ENTITY;
|3364|3364| };
|3365|3365| 
|    | [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
|3433|3433| 		{
|3434|3434| 			let index = this.GetCurrentState().indexOf(".");
|3435|3435| 			if (index != -1)
|3436|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3436|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3437|3437| 			this.Stop(false);
|3438|3438| 		}
|3439|3439| 
|    | [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
|3489|3489| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3490|3490| 			continue;
|3491|3491| 		if (i == 0)
|3492|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3492|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3493|3493| 		else
|3494|3494| 			this.orderQueue.splice(i, 1);
|3495|3495| 		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
|3489|3489| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3490|3490| 			continue;
|3491|3491| 		if (i == 0)
|3492|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3492|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3493|3493| 		else
|3494|3494| 			this.orderQueue.splice(i, 1);
|3495|3495| 		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
|3573|3573| };
|3574|3574| 
|3575|3575| 
|3576|    |-//// FSM linkage functions ////
|    |3576|+// // FSM linkage functions ////
|3577|3577| 
|3578|3578| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3579|3579| 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
|3745|3745| 				continue;
|3746|3746| 			if (this.orderQueue[i].type == type)
|3747|3747| 				continue;
|3748|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3748|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3749|3749| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3750|3750| 			return;
|3751|3751| 		}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3745|3745| 				continue;
|3746|3746| 			if (this.orderQueue[i].type == type)
|3747|3747| 				continue;
|3748|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3748|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3749|3749| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3750|3750| 			return;
|3751|3751| 		}
|    | [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
|3759|3759| {
|3760|3760| 	// Remember the previous work orders to be able to go back to them later if required
|3761|3761| 	if (data && data.force)
|3762|    |-	{
|    |3762|+	
|3763|3763| 		if (this.IsFormationController())
|3764|3764| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3765|3765| 		else
|3766|3766| 			this.UpdateWorkOrders(type);
|3767|    |-	}
|    |3767|+	
|3768|3768| 
|3769|3769| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3770|3770| 
|    | [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
|3836|3836| 	{
|3837|3837| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3838|3838| 		if (cmpUnitAI)
|3839|    |-		{
|    |3839|+		
|3840|3840| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3841|3841| 			{
|3842|3842| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3845|3845| 					return;
|3846|3846| 				}
|3847|3847| 			}
|3848|    |-		}
|    |3848|+		
|3849|3849| 	}
|3850|3850| 
|3851|3851| 	// 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
|3838|3838| 		if (cmpUnitAI)
|3839|3839| 		{
|3840|3840| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3841|    |-			{
|    |3841|+			
|3842|3842| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3843|3843| 				{
|3844|3844| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3845|3845| 					return;
|3846|3846| 				}
|3847|    |-			}
|    |3847|+			
|3848|3848| 		}
|3849|3849| 	}
|3850|3850| 
|    | [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
|3850|3850| 
|3851|3851| 	// If nothing found, take the unit orders
|3852|3852| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3853|    |-	{
|    |3853|+	
|3854|3854| 		if (isWorkType(this.orderQueue[i].type))
|3855|3855| 		{
|3856|3856| 			this.workOrders = this.orderQueue.slice(i);
|3857|3857| 			return;
|3858|3858| 		}
|3859|    |-	}
|    |3859|+	
|3860|3860| };
|3861|3861| 
|3862|3862| 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
|3916|3916| 	if (data.timerRepeat === undefined)
|3917|3917| 		this.timer = undefined;
|3918|3918| 
|3919|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3919|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3920|3920| };
|3921|3921| 
|3922|3922| /**
|    | [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
|3916|3916| 	if (data.timerRepeat === undefined)
|3917|3917| 		this.timer = undefined;
|3918|3918| 
|3919|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3919|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3920|3920| };
|3921|3921| 
|3922|3922| /**
|    | [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
|3951|3951| 	this.timer = undefined;
|3952|3952| };
|3953|3953| 
|3954|    |-//// Message handlers /////
|    |3954|+// // Message handlers /////
|3955|3955| 
|3956|3956| UnitAI.prototype.OnMotionChanged = function(msg)
|3957|3957| {
|    | [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
|3956|3956| UnitAI.prototype.OnMotionChanged = function(msg)
|3957|3957| {
|3958|3958| 	if (msg.starting && !msg.error)
|3959|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3959|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveStarted", "data": msg});
|3960|3960| 	else if (!msg.starting || msg.error)
|3961|3961| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3962|3962| };
|    | [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
|3956|3956| UnitAI.prototype.OnMotionChanged = function(msg)
|3957|3957| {
|3958|3958| 	if (msg.starting && !msg.error)
|3959|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3959|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg });
|3960|3960| 	else if (!msg.starting || msg.error)
|3961|3961| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3962|3962| };
|    | [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
|3958|3958| 	if (msg.starting && !msg.error)
|3959|3959| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3960|3960| 	else if (!msg.starting || msg.error)
|3961|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3961|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveCompleted", "data": msg});
|3962|3962| };
|3963|3963| 
|3964|3964| UnitAI.prototype.OnGlobalConstructionFinished = 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
|3958|3958| 	if (msg.starting && !msg.error)
|3959|3959| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3960|3960| 	else if (!msg.starting || msg.error)
|3961|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3961|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg });
|3962|3962| };
|3963|3963| 
|3964|3964| UnitAI.prototype.OnGlobalConstructionFinished = 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
|3966|3966| 	// TODO: This is a bit inefficient since every unit listens to every
|3967|3967| 	// construction message - ideally we could scope it to only the one we're building
|3968|3968| 
|3969|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3969|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3970|3970| };
|3971|3971| 
|3972|3972| 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
|3966|3966| 	// TODO: This is a bit inefficient since every unit listens to every
|3967|3967| 	// construction message - ideally we could scope it to only the one we're building
|3968|3968| 
|3969|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3969|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3970|3970| };
|3971|3971| 
|3972|3972| 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
|3991|3991| 
|3992|3992| UnitAI.prototype.OnAttacked = function(msg)
|3993|3993| {
|3994|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3994|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3995|3995| };
|3996|3996| 
|3997|3997| 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
|3991|3991| 
|3992|3992| UnitAI.prototype.OnAttacked = function(msg)
|3993|3993| {
|3994|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3994|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3995|3995| };
|3996|3996| 
|3997|3997| 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
|3996|3996| 
|3997|3997| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3998|3998| {
|3999|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3999|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4000|4000| };
|4001|4001| 
|4002|4002| 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
|3996|3996| 
|3997|3997| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3998|3998| {
|3999|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3999|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4000|4000| };
|4001|4001| 
|4002|4002| 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
|4001|4001| 
|4002|4002| UnitAI.prototype.OnHealthChanged = function(msg)
|4003|4003| {
|4004|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4004|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4005|4005| };
|4006|4006| 
|4007|4007| 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
|4001|4001| 
|4002|4002| UnitAI.prototype.OnHealthChanged = function(msg)
|4003|4003| {
|4004|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4004|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4005|4005| };
|4006|4006| 
|4007|4007| 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
|4007|4007| UnitAI.prototype.OnRangeUpdate = function(msg)
|4008|4008| {
|4009|4009| 	if (msg.tag == this.losRangeQuery)
|4010|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4010|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4011|4011| 	else if (msg.tag == this.losHealRangeQuery)
|4012|4012| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4013|4013| };
|    | [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
|4007|4007| UnitAI.prototype.OnRangeUpdate = function(msg)
|4008|4008| {
|4009|4009| 	if (msg.tag == this.losRangeQuery)
|4010|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4010|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4011|4011| 	else if (msg.tag == this.losHealRangeQuery)
|4012|4012| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4013|4013| };
|    | [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
|4009|4009| 	if (msg.tag == this.losRangeQuery)
|4010|4010| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4011|4011| 	else if (msg.tag == this.losHealRangeQuery)
|4012|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4012|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4013|4013| };
|4014|4014| 
|4015|4015| 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
|4009|4009| 	if (msg.tag == this.losRangeQuery)
|4010|4010| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4011|4011| 	else if (msg.tag == this.losHealRangeQuery)
|4012|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4012|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4013|4013| };
|4014|4014| 
|4015|4015| 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
|4014|4014| 
|4015|4015| UnitAI.prototype.OnPackFinished = function(msg)
|4016|4016| {
|4017|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4017|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4018|4018| };
|4019|4019| 
|4020|4020| //// 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
|4014|4014| 
|4015|4015| UnitAI.prototype.OnPackFinished = function(msg)
|4016|4016| {
|4017|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4017|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4018|4018| };
|4019|4019| 
|4020|4020| //// 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
|4017|4017| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4018|4018| };
|4019|4019| 
|4020|    |-//// Helper functions to be called by the FSM ////
|    |4020|+// // Helper functions to be called by the FSM ////
|4021|4021| 
|4022|4022| UnitAI.prototype.GetWalkSpeed = function()
|4023|4023| {
|    | [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
|4119|4119| 	if (!cmpOwnership || cmpOwnership.GetOwner() == INVALID_PLAYER)
|4120|4120| 		return undefined;
|4121|4121| 
|4122|    |-	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position)
|    |4122|+	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
|4123|4123| 	if (!cmpPosition || !cmpPosition.IsInWorld())
|4124|4124| 		return undefined;
|4125|4125| 
|    | [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
|4204|4204| 			PlaySound(name, member);
|4205|4205| 	}
|4206|4206| 	else
|4207|    |-	{
|    |4207|+	
|4208|4208| 		// Otherwise use our own sounds
|4209|4209| 		PlaySound(name, this.entity);
|4210|    |-	}
|    |4210|+	
|4211|4211| };
|4212|4212| 
|4213|4213| /*
|    | [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
|4300|4300| UnitAI.prototype.MoveTo = function(data, iid, type)
|4301|4301| {
|4302|4302| 	if (data["target"])
|4303|    |-	{
|    |4303|+	
|4304|4304| 		if (data["min"] || data["max"])
|4305|4305| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4306|4306| 		else
|4310|4310| 			else
|4311|4311| 				return this.MoveToTargetRange(data.target, iid, type);
|4312|4312| 		}
|4313|    |-	}
|    |4313|+	
|4314|4314| 	else
|4315|4315| 	{
|4316|4316| 		if (data["min"] || data["max"])
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["target"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4299|4299|  */
|4300|4300| UnitAI.prototype.MoveTo = function(data, iid, type)
|4301|4301| {
|4302|    |-	if (data["target"])
|    |4302|+	if (data.target)
|4303|4303| 	{
|4304|4304| 		if (data["min"] || data["max"])
|4305|4305| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["min"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4301|4301| {
|4302|4302| 	if (data["target"])
|4303|4303| 	{
|4304|    |-		if (data["min"] || data["max"])
|    |4304|+		if (data.min || data["max"])
|4305|4305| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4306|4306| 		else
|4307|4307| 		{
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["max"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4301|4301| {
|4302|4302| 	if (data["target"])
|4303|4303| 	{
|4304|    |-		if (data["min"] || data["max"])
|    |4304|+		if (data["min"] || data.max)
|4305|4305| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4306|4306| 		else
|4307|4307| 		{
|    | [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
|4304|4304| 		if (data["min"] || data["max"])
|4305|4305| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4306|4306| 		else
|4307|    |-		{
|    |4307|+		
|4308|4308| 			if (!iid)
|4309|4309| 				return this.MoveToTarget(data.target);
|4310|4310| 			else
|4311|4311| 				return this.MoveToTargetRange(data.target, iid, type);
|4312|    |-		}
|    |4312|+		
|4313|4313| 	}
|4314|4314| 	else
|4315|4315| 	{
|    | [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
|4303|4303| 	{
|4304|4304| 		if (data["min"] || data["max"])
|4305|4305| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4306|    |-		else
|4307|    |-		{
|    |4306|+		
|4308|4307| 			if (!iid)
|4309|4308| 				return this.MoveToTarget(data.target);
|4310|4309| 			else
|4311|4310| 				return this.MoveToTargetRange(data.target, iid, type);
|4312|    |-		}
|    |4311|+		
|4313|4312| 	}
|4314|4313| 	else
|4315|4314| 	{
|    | [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
|4307|4307| 		{
|4308|4308| 			if (!iid)
|4309|4309| 				return this.MoveToTarget(data.target);
|4310|    |-			else
|4311|    |-				return this.MoveToTargetRange(data.target, iid, type);
|    |4310|+			return this.MoveToTargetRange(data.target, iid, type);
|4312|4311| 		}
|4313|4312| 	}
|4314|4313| 	else
|    | [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
|4312|4312| 		}
|4313|4313| 	}
|4314|4314| 	else
|4315|    |-	{
|    |4315|+	
|4316|4316| 		if (data["min"] || data["max"])
|4317|4317| 			return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1);
|4318|4318| 		else
|4319|4319| 			return this.MoveToPoint(data.x, data.z);
|4320|    |-	}
|    |4320|+	
|4321|4321| }
|4322|4322| 
|4323|4323| UnitAI.prototype.MoveToPoint = function(x, z)
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["min"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4313|4313| 	}
|4314|4314| 	else
|4315|4315| 	{
|4316|    |-		if (data["min"] || data["max"])
|    |4316|+		if (data.min || data["max"])
|4317|4317| 			return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1);
|4318|4318| 		else
|4319|4319| 			return this.MoveToPoint(data.x, data.z);
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["max"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4313|4313| 	}
|4314|4314| 	else
|4315|4315| 	{
|4316|    |-		if (data["min"] || data["max"])
|    |4316|+		if (data["min"] || data.max)
|4317|4317| 			return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1);
|4318|4318| 		else
|4319|4319| 			return this.MoveToPoint(data.x, data.z);
|    | [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
|4315|4315| 	{
|4316|4316| 		if (data["min"] || data["max"])
|4317|4317| 			return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1);
|4318|    |-		else
|4319|    |-			return this.MoveToPoint(data.x, data.z);
|    |4318|+		return this.MoveToPoint(data.x, data.z);
|4320|4319| 	}
|4321|4320| }
|4322|4321| 
|    | [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
|4318|4318| 		else
|4319|4319| 			return this.MoveToPoint(data.x, data.z);
|4320|4320| 	}
|4321|    |-}
|    |4321|+};
|4322|4322| 
|4323|4323| UnitAI.prototype.MoveToPoint = function(x, z)
|4324|4324| {
|    | [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
|4402|4402| 	else
|4403|4403| 		// return false? Or hope you come close enough?
|4404|4404| 		var parabolicMaxRange = 0;
|4405|    |-		//return false;
|    |4405|+		// return false;
|4406|4406| 
|4407|4407| 	// the parabole changes while walking, take something in the middle
|4408|4408| 	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
|4467|4467| 	if (this.IsFormationMember())
|4468|4468| 	{
|4469|4469| 		var cmpFormationUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|4470|    |-		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation()
|4471|    |-			&& cmpFormationUnitAI.order.data.target == target)
|    |4470|+		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation() &&
|    |4471|+			cmpFormationUnitAI.order.data.target == target)
|4472|4472| 			return true;
|4473|4473| 	}
|4474|4474| 
|    | [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
|4635|4635| UnitAI.prototype.AttackEntityInZone = function(ents)
|4636|4636| {
|4637|4637| 	var target = ents.find(target =>
|4638|    |-		this.CanAttack(target)
|4639|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4638|+		this.CanAttack(target) &&
|    |4639|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4640|4640| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4641|4641| 	);
|4642|4642| 	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
|4636|4636| {
|4637|4637| 	var target = ents.find(target =>
|4638|4638| 		this.CanAttack(target)
|4639|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4640|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4639|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4640|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4641|4641| 	);
|4642|4642| 	if (!target)
|4643|4643| 		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
|4700|4700| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4701|4701| 	if (this.isGuardOf)
|4702|4702| 	{
|4703|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4703|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4704|4704| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4705|4705| 		if (cmpUnitAI && cmpAttack &&
|4706|4706| 		    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
|4704|4704| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4705|4705| 		if (cmpUnitAI && cmpAttack &&
|4706|4706| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4707|    |-				return false;
|    |4707|+			return false;
|4708|4708| 	}
|4709|4709| 
|4710|4710| 	// 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
|4709|4709| 
|4710|4710| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4711|4711| 	if (this.GetStance().respondHoldGround)
|4712|    |-	{
|    |4712|+	
|4713|4713| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4714|4714| 			return true;
|4715|    |-	}
|    |4715|+	
|4716|4716| 
|4717|4717| 	// Stop if it's left our vision range, unless we're especially persistent
|4718|4718| 	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
|4716|4716| 
|4717|4717| 	// Stop if it's left our vision range, unless we're especially persistent
|4718|4718| 	if (!this.GetStance().respondChaseBeyondVision)
|4719|    |-	{
|    |4719|+	
|4720|4720| 		if (!this.CheckTargetIsInVisionRange(target))
|4721|4721| 			return true;
|4722|    |-	}
|    |4722|+	
|4723|4723| 
|4724|4724| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4725|4725| 	// 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
|4742|4742| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4743|4743| 	if (this.isGuardOf)
|4744|4744| 	{
|4745|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4745|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4746|4746| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4747|4747| 		if (cmpUnitAI && cmpAttack &&
|4748|4748| 		    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
|4755|4755| 	return false;
|4756|4756| };
|4757|4757| 
|4758|    |-//// External interface functions ////
|    |4758|+// // External interface functions ////
|4759|4759| 
|4760|4760| UnitAI.prototype.SetFormationController = function(ent)
|4761|4761| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4765|4765| 	// of our own formation (or ourself if not in formation)
|4766|4766| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4767|4767| 	if (cmpObstruction)
|4768|    |-	{
|    |4768|+	
|4769|4769| 		if (ent == INVALID_ENTITY)
|4770|4770| 			cmpObstruction.SetControlGroup(this.entity);
|4771|4771| 		else
|4772|4772| 			cmpObstruction.SetControlGroup(ent);
|4773|    |-	}
|    |4773|+	
|4774|4774| 
|4775|4775| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4776|4776| 	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
|4908|4908| 	// if we already had an old guard order, do nothing if the target is the same
|4909|4909| 	// and the order is running, otherwise remove the previous order
|4910|4910| 	if (this.isGuardOf)
|4911|    |-	{
|    |4911|+	
|4912|4912| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4913|4913| 			return;
|4914|4914| 		else
|4915|4915| 			this.RemoveGuard();
|4916|    |-	}
|    |4916|+	
|4917|4917| 
|4918|4918| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4919|4919| };
|    | [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
|4911|4911| 	{
|4912|4912| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4913|4913| 			return;
|4914|    |-		else
|4915|    |-			this.RemoveGuard();
|    |4914|+		this.RemoveGuard();
|4916|4915| 	}
|4917|4916| 
|4918|4917| 	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
|5082|5082| 			this.WalkToTarget(target, queued);
|5083|5083| 		return;
|5084|5084| 	}
|5085|    |-	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture}, queued);
|    |5085|+	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture }, queued);
|5086|5086| };
|5087|5087| 
|5088|5088| /**
|    | [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
|5231|5231| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5232|5232| 	{
|5233|5233| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5234|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5234|+		if (cmpTrader.HasBothMarkets() &&
|5235|5235| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5236|5236| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5237|5237| 		{
|    | [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
|5512|5512| 				{
|5513|5513| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5514|5514| 					var targetClasses = this.order.data.targetClasses;
|5515|    |-					if (targetClasses.attack && cmpIdentity
|5516|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5515|+					if (targetClasses.attack && cmpIdentity &&
|    |5516|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5517|5517| 						continue;
|5518|5518| 					if (targetClasses.avoid && cmpIdentity
|5519|5519| 						&& 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
|5515|5515| 					if (targetClasses.attack && cmpIdentity
|5516|5516| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5517|5517| 						continue;
|5518|    |-					if (targetClasses.avoid && cmpIdentity
|5519|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5518|+					if (targetClasses.avoid && cmpIdentity &&
|    |5519|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5520|5520| 						continue;
|5521|5521| 					// Only used by the AIs to prevent some choices of targets
|5522|5522| 					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
|5538|5538| 		{
|5539|5539| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5540|5540| 			var targetClasses = this.order.data.targetClasses;
|5541|    |-			if (cmpIdentity && targetClasses.attack
|5542|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5541|+			if (cmpIdentity && targetClasses.attack &&
|    |5542|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5543|5543| 				continue;
|5544|5544| 			if (cmpIdentity && targetClasses.avoid
|5545|5545| 				&& 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
|5541|5541| 			if (cmpIdentity && targetClasses.attack
|5542|5542| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5543|5543| 				continue;
|5544|    |-			if (cmpIdentity && targetClasses.avoid
|5545|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5544|+			if (cmpIdentity && targetClasses.avoid &&
|    |5545|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5546|5546| 				continue;
|5547|5547| 			// Only used by the AIs to prevent some choices of targets
|5548|5548| 			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
|5684|5684| 
|5685|5685| UnitAI.prototype.SetHeldPosition = function(x, z)
|5686|5686| {
|5687|    |-	this.heldPosition = {"x": x, "z": z};
|    |5687|+	this.heldPosition = { "x": x, "z": z};
|5688|5688| };
|5689|5689| 
|5690|5690| 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
|5684|5684| 
|5685|5685| UnitAI.prototype.SetHeldPosition = function(x, z)
|5686|5686| {
|5687|    |-	this.heldPosition = {"x": x, "z": z};
|    |5687|+	this.heldPosition = {"x": x, "z": z };
|5688|5688| };
|5689|5689| 
|5690|5690| 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
|5711|5711| 	return false;
|5712|5712| };
|5713|5713| 
|5714|    |-//// Helper functions ////
|    |5714|+// // Helper functions ////
|5715|5715| 
|5716|5716| UnitAI.prototype.CanAttack = function(target)
|5717|5717| {
|    | [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
|5915|5915| 	return cmpPack && cmpPack.IsPacking();
|5916|5916| };
|5917|5917| 
|5918|    |-//// Formation specific functions ////
|    |5918|+// // Formation specific functions ////
|5919|5919| 
|5920|5920| UnitAI.prototype.IsAttackingAsFormation = function()
|5921|5921| {
|    | [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
|5920|5920| UnitAI.prototype.IsAttackingAsFormation = function()
|5921|5921| {
|5922|5922| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5923|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5924|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5923|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5924|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5925|5925| };
|5926|5926| 
|5927|5927| //// 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
|5924|5924| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5925|5925| };
|5926|5926| 
|5927|    |-//// Animal specific functions ////
|    |5927|+// // Animal specific functions ////
|5928|5928| 
|5929|5929| UnitAI.prototype.MoveRandomly = function(distance)
|5930|5930| {

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

binaries/data/mods/public/simulation/components/UnitAI.js
| 903| »   »   »   "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
| 928| »   »   »   "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
| 946| »   »   »   "leave":·function(msg)·{
|    | [NORMAL] ESLintBear (no-dupe-keys):
|    | Duplicate key 'leave'.

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

binaries/data/mods/public/simulation/components/UnitAI.js
|1044| »   »   »   »   "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
|1082| »   »   »   "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
|1115| »   »   »   »   "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
|1328| »   »   »   "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
|1624| »   »   »   »   »   return·false;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'enter' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
|2422| »   »   »   »   »   »   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
|2477| »   »   »   »   "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
|2595| »   »   »   »   "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
|2697| »   »   »   »   "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
|2906| »   »   »   »   "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
|3089| »   »   »   »   "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
|3821| »   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
|4622| »   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
|4637| »   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
|4683| »   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
|4706| »   »   ····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
|5162| »   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
| 358| »   »   ····&&·(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
| 946| »   »   »   "leave":·function(msg)·{
|    | [NORMAL] JSHintBear:
|    | Duplicate key 'leave'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1872| »   »   »   »   »   »   var·cmpFormation·=·Engine.QueryInterface(this.formationController,·IID_Formation);
|    | [NORMAL] JSHintBear:
|    | 'cmpFormation' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|2013| »   »   »   »   »   »   &&·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
|2092| »   »   »   »   »   »   »   »   ·&&·((type.generic·==·"treasure"·&&·oldType.generic·==·"treasure")
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|2167| »   »   »   »   »   »   »   »   &&·((type.generic·==·"treasure"·&&·oldType.generic·==·"treasure")
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4302| »   if·(data["target"])
|    | [NORMAL] JSHintBear:
|    | ['target'] is better written in dot notation.

binaries/data/mods/public/simulation/components/UnitAI.js
|4304| »   »   if·(data["min"]·||·data["max"])
|    | [NORMAL] JSHintBear:
|    | ['min'] is better written in dot notation.

binaries/data/mods/public/simulation/components/UnitAI.js
|4304| »   »   if·(data["min"]·||·data["max"])
|    | [NORMAL] JSHintBear:
|    | ['max'] is better written in dot notation.

binaries/data/mods/public/simulation/components/UnitAI.js
|4316| »   »   if·(data["min"]·||·data["max"])
|    | [NORMAL] JSHintBear:
|    | ['min'] is better written in dot notation.

binaries/data/mods/public/simulation/components/UnitAI.js
|4316| »   »   if·(data["min"]·||·data["max"])
|    | [NORMAL] JSHintBear:
|    | ['max'] is better written in dot notation.

binaries/data/mods/public/simulation/components/UnitAI.js
|4321| }
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4415| »   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
|4471| »   »   »   &&·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
|4639| »   »   &&·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
|4640| »   »   &&·(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
|5162| »   var·lastPos·=·undefined;
|    | [NORMAL] JSHintBear:
|    | It's not necessary to initialize 'lastPos' to 'undefined'.

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|5533| »   for·(var·targ·of·targets)
|    | [MAJOR] JSHintBear:
|    | Too many errors. (91% scanned).
Executing section cli...

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

wraitii updated this revision to Diff 8160.Sun, May 26, 4:22 PM

Fix the unitAI mocks so that the tests pass.