Page MenuHomeWildfire Games

Fix infinite UnitAI loop when units are moved out of world (after promotion)
ClosedPublic

Authored by mimo on Mar 19 2018, 7:45 PM.

Details

Summary

See the description of the bug in #5079

Test Plan

Check that it fixes the replay uploaded on trac

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

mimo created this revision.Mar 19 2018, 7:45 PM
mimo updated this revision to Diff 6226.Mar 19 2018, 8:01 PM

upload the right version of the patch (taking garrisoning into account)

Vulcan added a subscriber: Vulcan.Mar 19 2018, 8:28 PM

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

Linter detected issues:
Executing section Default...
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
| 229| 229| 		// Move a tile outside the building
| 230| 230| 		let range = 4;
| 231| 231| 		if (this.MoveToTargetRangeExplicit(msg.data.target, range, range))
| 232|    |-		{
|    | 232|+		
| 233| 233| 			// We've started walking to the given point
| 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
| 339| 339| 
| 340| 340| 		var ok = this.MoveToTarget(this.order.data.target);
| 341| 341| 		if (ok)
| 342|    |-		{
|    | 342|+		
| 343| 343| 			// We've started walking to the given point
| 344| 344| 			if (this.IsAnimal())
| 345| 345| 				this.SetNextState("ANIMAL.WALKING");
| 346| 346| 			else
| 347| 347| 				this.SetNextState("INDIVIDUAL.WALKING");
| 348|    |-		}
|    | 348|+		
| 349| 349| 		else
| 350| 350| 		{
| 351| 351| 			// 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
| 367| 367| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 368| 368| 		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 369| 369| 		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 370|    |-		{
|    | 370|+		
| 371| 371| 			// we were already on the shoreline, and have not moved since
| 372| 372| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
| 373| 373| 				needToMove = false;
| 374|    |-		}
|    | 374|+		
| 375| 375| 
| 376| 376| 		// TODO: what if the units are on a cliff ? the ship will go below the cliff
| 377| 377| 		// 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
| 365| 365| 		// Check if we need to move     TODO implement a better way to know if we are on the shoreline
| 366| 366| 		var needToMove = true;
| 367| 367| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 368|    |-		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 369|    |-		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
|    | 368|+		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x) &&
|    | 369|+		    (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 370| 370| 		{
| 371| 371| 			// we were already on the shoreline, and have not moved since
| 372| 372| 			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
| 376| 376| 		// TODO: what if the units are on a cliff ? the ship will go below the cliff
| 377| 377| 		// and the units won't be able to garrison. Should go to the nearest (accessible) shore
| 378| 378| 		if (needToMove && this.MoveToTarget(this.order.data.target))
| 379|    |-		{
|    | 379|+		
| 380| 380| 			this.SetNextState("INDIVIDUAL.PICKUP.APPROACHING");
| 381|    |-		}
|    | 381|+		
| 382| 382| 		else
| 383| 383| 		{
| 384| 384| 			// 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
| 405| 405| 		var distance = DistanceBetweenEntities(this.entity, this.order.data.target) + (+this.template.FleeDistance);
| 406| 406| 		var cmpUnitMotion = Engine.QueryInterface(this.entity, IID_UnitMotion);
| 407| 407| 		if (cmpUnitMotion.MoveToTargetRange(this.order.data.target, distance, -1))
| 408|    |-		{
|    | 408|+		
| 409| 409| 			// We've started fleeing from the given target
| 410| 410| 			if (this.IsAnimal())
| 411| 411| 				this.SetNextState("ANIMAL.FLEEING");
| 412| 412| 			else
| 413| 413| 				this.SetNextState("INDIVIDUAL.FLEEING");
| 414|    |-		}
|    | 414|+		
| 415| 415| 		else
| 416| 416| 		{
| 417| 417| 			// 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
| 461| 461| 			}
| 462| 462| 
| 463| 463| 			if (this.order.data.attackType == this.oldAttackType)
| 464|    |-			{
|    | 464|+			
| 465| 465| 				if (this.IsAnimal())
| 466| 466| 					this.SetNextState("ANIMAL.COMBAT.ATTACKING");
| 467| 467| 				else
| 468| 468| 					this.SetNextState("INDIVIDUAL.COMBAT.ATTACKING");
| 469|    |-			}
|    | 469|+			
| 470| 470| 			else
| 471| 471| 			{
| 472| 472| 				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
| 468| 468| 					this.SetNextState("INDIVIDUAL.COMBAT.ATTACKING");
| 469| 469| 			}
| 470| 470| 			else
| 471|    |-			{
|    | 471|+			
| 472| 472| 				if (this.IsAnimal())
| 473| 473| 					this.SetNextStateAlwaysEntering("ANIMAL.COMBAT.ATTACKING");
| 474| 474| 				else
| 475| 475| 					this.SetNextStateAlwaysEntering("INDIVIDUAL.COMBAT.ATTACKING");
| 476|    |-			}
|    | 476|+			
| 477| 477| 			return;
| 478| 478| 		}
| 479| 479| 
|    | [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
| 606| 606| 					this.PushOrderFront("Walk", this.order.data.lastPos);
| 607| 607| 				}
| 608| 608| 				else
| 609|    |-				{
|    | 609|+				
| 610| 610| 					// We couldn't move there, or the target moved away
| 611| 611| 					this.FinishOrder();
| 612|    |-				}
|    | 612|+				
| 613| 613| 				return;
| 614| 614| 			}
| 615| 615| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 619| 619| 
| 620| 620| 		// Try to move within range
| 621| 621| 		if (this.MoveToTargetRange(this.order.data.target, IID_ResourceGatherer))
| 622|    |-		{
|    | 622|+		
| 623| 623| 			// We've started walking to the given point
| 624| 624| 			this.SetNextState("INDIVIDUAL.GATHER.APPROACHING");
| 625|    |-		}
|    | 625|+		
| 626| 626| 		else
| 627| 627| 		{
| 628| 628| 			// 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
| 696| 696| 	"Order.Repair": function(msg) {
| 697| 697| 		// Try to move within range
| 698| 698| 		if (this.MoveToTargetRange(this.order.data.target, IID_Builder))
| 699|    |-		{
|    | 699|+		
| 700| 700| 			// We've started walking to the given point
| 701| 701| 			this.SetNextState("INDIVIDUAL.REPAIR.APPROACHING");
| 702|    |-		}
|    | 702|+		
| 703| 703| 		else
| 704| 704| 		{
| 705| 705| 			// 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
| 733| 733| 		}
| 734| 734| 
| 735| 735| 		if (this.MoveToGarrisonRange(this.order.data.target))
| 736|    |-		{
|    | 736|+		
| 737| 737| 			this.SetNextState("INDIVIDUAL.GARRISON.APPROACHING");
| 738|    |-		}
|    | 738|+		
| 739| 739| 		else
| 740| 740| 		{
| 741| 741| 			// 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
| 871| 871| 			if (!this.CheckTargetAttackRange(target, target))
| 872| 872| 			{
| 873| 873| 				if (this.TargetIsAlive(target) && this.CheckTargetVisible(target))
| 874|    |-				{
|    | 874|+				
| 875| 875| 					if (this.MoveToTargetAttackRange(target, target))
| 876| 876| 					{
| 877| 877| 						this.SetNextState("COMBAT.APPROACHING");
| 878| 878| 						return;
| 879| 879| 					}
| 880|    |-				}
|    | 880|+				
| 881| 881| 				this.FinishOrder();
| 882| 882| 				return;
| 883| 883| 			}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 896| 896| 			}
| 897| 897| 			// Check if we are already in range, otherwise walk there
| 898| 898| 			if (!this.CheckGarrisonRange(msg.data.target))
| 899|    |-			{
|    | 899|+			
| 900| 900| 				if (!this.CheckTargetVisible(msg.data.target))
| 901| 901| 				{
| 902| 902| 					this.FinishOrder();
| 911| 911| 						return;
| 912| 912| 					}
| 913| 913| 				}
| 914|    |-			}
|    | 914|+			
| 915| 915| 
| 916| 916| 			this.SetNextState("GARRISON.GARRISONING");
| 917| 917| 		},
|    | [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
| 903| 903| 					return;
| 904| 904| 				}
| 905| 905| 				else
| 906|    |-				{
|    | 906|+				
| 907| 907| 					// Out of range; move there in formation
| 908| 908| 					if (this.MoveToGarrisonRange(msg.data.target))
| 909| 909| 					{
| 910| 910| 						this.SetNextState("GARRISON.APPROACHING");
| 911| 911| 						return;
| 912| 912| 					}
| 913|    |-				}
|    | 913|+				
| 914| 914| 			}
| 915| 915| 
| 916| 916| 			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
| 902| 902| 					this.FinishOrder();
| 903| 903| 					return;
| 904| 904| 				}
| 905|    |-				else
| 906|    |-				{
|    | 905|+				
| 907| 906| 					// Out of range; move there in formation
| 908| 907| 					if (this.MoveToGarrisonRange(msg.data.target))
| 909| 908| 					{
| 910| 909| 						this.SetNextState("GARRISON.APPROACHING");
| 911| 910| 						return;
| 912| 911| 					}
| 913|    |-				}
|    | 912|+				
| 914| 913| 			}
| 915| 914| 
| 916| 915| 			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
| 929| 929| 						this.PushOrderFront("Walk", msg.data.lastPos);
| 930| 930| 					}
| 931| 931| 					else
| 932|    |-					{
|    | 932|+					
| 933| 933| 						// We couldn't move there, or the target moved away
| 934| 934| 						this.FinishOrder();
| 935|    |-					}
|    | 935|+					
| 936| 936| 					return;
| 937| 937| 				}
| 938| 938| 
|    | [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
|1150|1150| 			},
|1151|1151| 		},
|1152|1152| 
|1153|    |-		"GARRISON":{
|    |1153|+		"GARRISON": {
|1154|1154| 			"enter": function() {
|1155|1155| 				// If the garrisonholder should pickup, warn it so it can take needed action
|1156|1156| 				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
|1331|1331| 			// If the controller handled an order but some members rejected it,
|1332|1332| 			// they will have no orders and be in the FORMATIONMEMBER.IDLE state.
|1333|1333| 			if (this.orderQueue.length)
|1334|    |-			{
|    |1334|+			
|1335|1335| 				// We're leaving the formation, so stop our FormationWalk order
|1336|1336| 				if (this.FinishOrder())
|1337|1337| 					return;
|1338|    |-			}
|    |1338|+			
|1339|1339| 
|1340|1340| 			// No orders left, we're an individual now
|1341|1341| 			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
|1359|1359| 			// Move a tile outside the building
|1360|1360| 			let range = 4;
|1361|1361| 			if (this.MoveToTargetRangeExplicit(msg.data.target, range, range))
|1362|    |-			{
|    |1362|+			
|1363|1363| 				// We've started walking to the given point
|1364|1364| 				this.SetNextState("WALKINGTOPOINT");
|1365|    |-			}
|    |1365|+			
|1366|1366| 			else
|1367|1367| 			{
|1368|1368| 				// 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
|1364|1364| 				this.SetNextState("WALKINGTOPOINT");
|1365|1365| 			}
|1366|1366| 			else
|1367|    |-			{
|    |1367|+			
|1368|1368| 				// We are already at the target, or can't move at all
|1369|1369| 				this.FinishOrder();
|1370|    |-			}
|    |1370|+			
|1371|1371| 		},
|1372|1372| 
|1373|1373| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1565|1565| 
|1566|1566| 			"LosRangeUpdate": function(msg) {
|1567|1567| 				if (this.GetStance().targetVisibleEnemies)
|1568|    |-				{
|    |1568|+				
|1569|1569| 					// Start attacking one of the newly-seen enemy (if any)
|1570|1570| 					this.AttackEntitiesByPreference(msg.data.added);
|1571|    |-				}
|    |1571|+				
|1572|1572| 			},
|1573|1573| 
|1574|1574| 			"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
|1751|1751| 						// if nothing better to do, check if the guarded needs to be healed or repaired
|1752|1752| 						var cmpHealth = Engine.QueryInterface(this.isGuardOf, IID_Health);
|1753|1753| 						if (cmpHealth && (cmpHealth.GetHitpoints() < cmpHealth.GetMaxHitpoints()))
|1754|    |-						{
|    |1754|+						
|1755|1755| 							if (this.CanHeal(this.isGuardOf))
|1756|1756| 								this.PushOrderFront("Heal", { "target": this.isGuardOf, "force": false });
|1757|1757| 							else if (this.CanRepair(this.isGuardOf))
|1758|1758| 								this.PushOrderFront("Repair", { "target": this.isGuardOf, "autocontinue": false, "force": false });
|1759|    |-						}
|    |1759|+						
|1760|1760| 					}
|1761|1761| 				},
|1762|1762| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1839|1839| 				"MoveCompleted": function() {
|1840|1840| 
|1841|1841| 					if (this.CheckTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1842|    |-					{
|    |1842|+					
|1843|1843| 						// If the unit needs to unpack, do so
|1844|1844| 						if (this.CanUnpack())
|1845|1845| 						{
|1848|1848| 						}
|1849|1849| 						else
|1850|1850| 							this.SetNextState("ATTACKING");
|1851|    |-					}
|    |1851|+					
|1852|1852| 					else
|1853|1853| 					{
|1854|1854| 						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
|1846|1846| 							this.PushOrderFront("Unpack", { "force": true });
|1847|1847| 							return;
|1848|1848| 						}
|1849|    |-						else
|1850|    |-							this.SetNextState("ATTACKING");
|    |1849|+						this.SetNextState("ATTACKING");
|1851|1850| 					}
|1852|1851| 					else
|1853|1852| 					{
|    | [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
|1850|1850| 							this.SetNextState("ATTACKING");
|1851|1851| 					}
|1852|1852| 					else
|1853|    |-					{
|    |1853|+					
|1854|1854| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1855|1855| 						{
|1856|1856| 							this.SetNextState("APPROACHING");
|1860|1860| 							// Give up
|1861|1861| 							this.FinishOrder();
|1862|1862| 						}
|1863|    |-					}
|    |1863|+					
|1864|1864| 				},
|1865|1865| 			},
|1866|1866| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/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| 					else
|1853|1853| 					{
|1854|1854| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1855|    |-						{
|    |1855|+						
|1856|1856| 							this.SetNextState("APPROACHING");
|1857|    |-						}
|    |1857|+						
|1858|1858| 						else
|1859|1859| 						{
|1860|1860| 							// 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
|1856|1856| 							this.SetNextState("APPROACHING");
|1857|1857| 						}
|1858|1858| 						else
|1859|    |-						{
|    |1859|+						
|1860|1860| 							// Give up
|1861|1861| 							this.FinishOrder();
|1862|    |-						}
|    |1862|+						
|1863|1863| 					}
|1864|1864| 				},
|1865|1865| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1877|1877| 					}
|1878|1878| 					// Check the target is still alive and attackable
|1879|1879| 					if (this.CanAttack(target) && !this.CheckTargetAttackRange(target, this.order.data.attackType))
|1880|    |-					{
|    |1880|+					
|1881|1881| 						// Can't reach it - try to chase after it
|1882|1882| 						if (this.ShouldChaseTargetedEntity(target, this.order.data.force))
|1883|1883| 						{
|1887|1887| 								return;
|1888|1888| 							}
|1889|1889| 						}
|1890|    |-					}
|    |1890|+					
|1891|1891| 
|1892|1892| 					var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|1893|1893| 					this.attackTimers = cmpAttack.GetTimers(this.order.data.attackType);
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/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| 					{
|1881|1881| 						// Can't reach it - try to chase after it
|1882|1882| 						if (this.ShouldChaseTargetedEntity(target, this.order.data.force))
|1883|    |-						{
|    |1883|+						
|1884|1884| 							if (this.MoveToTargetAttackRange(target, this.order.data.attackType))
|1885|1885| 							{
|1886|1886| 								this.SetNextState("COMBAT.CHASING");
|1887|1887| 								return;
|1888|1888| 							}
|1889|    |-						}
|    |1889|+						
|1890|1890| 					}
|1891|1891| 
|1892|1892| 					var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|    | [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
|1918|1918| 					// TODO: we should probably only bother syncing projectile attacks, not melee
|1919|1919| 
|1920|1920| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|1921|    |-					this.resyncAnimation = (prepare != this.attackTimers.prepare) ? true : false;
|    |1921|+					this.resyncAnimation = (prepare != this.attackTimers.prepare);
|1922|1922| 
|1923|1923| 					this.FaceTowardsTarget(this.order.data.target);
|1924|1924| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1993|1993| 
|1994|1994| 						// Can't reach it - try to chase after it
|1995|1995| 						if (this.ShouldChaseTargetedEntity(target, this.order.data.force))
|1996|    |-						{
|    |1996|+						
|1997|1997| 							if (this.MoveToTargetRange(target, IID_Attack, this.order.data.attackType))
|1998|1998| 							{
|1999|1999| 								this.SetNextState("COMBAT.CHASING");
|2000|2000| 								return;
|2001|2001| 							}
|2002|    |-						}
|    |2002|+						
|2003|2003| 					}
|2004|2004| 
|2005|2005| 					// if we're targetting a formation, find a new member of that formation
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2040|2040| 
|2041|2041| 				"Attacked": function(msg) {
|2042|2042| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2043|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2044|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2043|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2044|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2045|2045| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2046|2046| 				},
|2047|2047| 			},
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2124|2124| 						// Also don't switch to a different type of huntable animal
|2125|2125| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2126|2126| 							return (
|2127|    |-								ent != oldTarget
|2128|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2127|+								ent != oldTarget &&
|    |2128|+								 ((type.generic == "treasure" && oldType.generic == "treasure")
|2129|2129| 								 || (type.specific == oldType.specific
|2130|2130| 								 && (type.specific != "meat" || oldTemplate == template)))
|2131|2131| 							);
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/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| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2126|2126| 							return (
|2127|2127| 								ent != oldTarget
|2128|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2129|    |-								 || (type.specific == oldType.specific
|    |2128|+								 && ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2129|+								 (type.specific == oldType.specific
|2130|2130| 								 && (type.specific != "meat" || oldTemplate == template)))
|2131|2131| 							);
|2132|2132| 						}, 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
|2126|2126| 							return (
|2127|2127| 								ent != oldTarget
|2128|2128| 								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2129|    |-								 || (type.specific == oldType.specific
|2130|    |-								 && (type.specific != "meat" || oldTemplate == template)))
|    |2129|+								 || (type.specific == oldType.specific &&
|    |2130|+								 (type.specific != "meat" || oldTemplate == template)))
|2131|2131| 							);
|2132|2132| 						}, oldTarget);
|2133|2133| 						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
|2135|2135| 							this.PerformGather(nearby, false, false);
|2136|2136| 							return true;
|2137|2137| 						}
|2138|    |-						else
|2139|    |-						{
|    |2138|+						
|2140|2139| 							// It's probably better in this case, to avoid units getting stuck around a dropsite
|2141|2140| 							// in a "Target is far away, full, nearby are no good resources, return to dropsite" loop
|2142|2141| 							// to order it to GatherNear the resource position.
|2157|2156| 									return true;
|2158|2157| 								}
|2159|2158| 							}
|2160|    |-						}
|    |2159|+						
|2161|2160| 						return true;
|2162|2161| 					}
|2163|2162| 					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
|2147|2147| 								this.GatherNearPosition(pos.x, pos.z, oldType, oldTemplate);
|2148|2148| 								return true;
|2149|2149| 							}
|2150|    |-							else
|2151|    |-							{
|    |2150|+							
|2152|2151| 								// we're kind of stuck here. Return resource.
|2153|2152| 								var nearby = this.FindNearestDropsite(oldType.generic);
|2154|2153| 								if (nearby)
|2156|2155| 									this.PushOrderFront("ReturnResource", { "target": nearby, "force": false });
|2157|2156| 									return true;
|2158|2157| 								}
|2159|    |-							}
|    |2158|+							
|2160|2159| 						}
|2161|2160| 						return true;
|2162|2161| 					}
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2189|2189| 						// Also don't switch to a different type of huntable animal
|2190|2190| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2191|2191| 							return (
|2192|    |-								ent != oldTarget
|2193|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2192|+								ent != oldTarget &&
|    |2193|+								((type.generic == "treasure" && oldType.generic == "treasure")
|2194|2194| 								|| (type.specific == oldType.specific
|2195|2195| 								&& (type.specific != "meat" || oldTemplate == template)))
|2196|2196| 							);
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2190|2190| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2191|2191| 							return (
|2192|2192| 								ent != oldTarget
|2193|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2194|    |-								|| (type.specific == oldType.specific
|    |2193|+								&& ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2194|+								(type.specific == oldType.specific
|2195|2195| 								&& (type.specific != "meat" || oldTemplate == template)))
|2196|2196| 							);
|2197|2197| 						});
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2191|2191| 							return (
|2192|2192| 								ent != oldTarget
|2193|2193| 								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2194|    |-								|| (type.specific == oldType.specific
|2195|    |-								&& (type.specific != "meat" || oldTemplate == template)))
|    |2194|+								|| (type.specific == oldType.specific &&
|    |2195|+								(type.specific != "meat" || oldTemplate == template)))
|2196|2196| 							);
|2197|2197| 						});
|2198|2198| 						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
|2236|2236| 					// Also don't switch to a different type of huntable animal
|2237|2237| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2238|2238| 						return (
|2239|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2240|    |-							|| (type.specific == resourceType.specific
|    |2239|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2240|+							(type.specific == resourceType.specific
|2241|2241| 							&& (type.specific != "meat" || resourceTemplate == template))
|2242|2242| 						);
|2243|2243| 					});
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2237|2237| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2238|2238| 						return (
|2239|2239| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2240|    |-							|| (type.specific == resourceType.specific
|2241|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2240|+							|| (type.specific == resourceType.specific &&
|    |2241|+							(type.specific != "meat" || resourceTemplate == template))
|2242|2242| 						);
|2243|2243| 					});
|2244|2244| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2353|2353| 
|2354|2354| 					var cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply);
|2355|2355| 					if (cmpSupply && cmpSupply.IsAvailable(cmpOwnership.GetOwner(), this.entity))
|2356|    |-					{
|    |2356|+					
|2357|2357| 						// Check we can still reach and gather from the target
|2358|2358| 						if (this.CheckTargetRange(this.gatheringTarget, IID_ResourceGatherer) && this.CanGather(this.gatheringTarget))
|2359|2359| 						{
|2419|2419| 								return;
|2420|2420| 							}
|2421|2421| 						}
|2422|    |-					}
|    |2422|+					
|2423|2423| 
|2424|2424| 					// We're already in range, can't get anywhere near it or the target is exhausted.
|2425|2425| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2445|2445| 					// Also don't switch to a different type of huntable animal
|2446|2446| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2447|2447| 						return (
|2448|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2449|    |-							|| (type.specific == resourceType.specific
|    |2448|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2449|+							(type.specific == resourceType.specific
|2450|2450| 							&& (type.specific != "meat" || resourceTemplate == template))
|2451|2451| 						);
|2452|2452| 					});
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2446|2446| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2447|2447| 						return (
|2448|2448| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2449|    |-							|| (type.specific == resourceType.specific
|2450|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2449|+							|| (type.specific == resourceType.specific &&
|    |2450|+							(type.specific != "meat" || resourceTemplate == template))
|2451|2451| 						);
|2452|2452| 					});
|2453|2453| 					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
|2533|2533| 					this.StartTimer(prepare, this.healTimers.repeat);
|2534|2534| 
|2535|2535| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2536|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2536|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2537|2537| 
|2538|2538| 					this.FaceTowardsTarget(this.order.data.target);
|2539|2539| 				},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2566|2566| 						}
|2567|2567| 						// Can't reach it - try to chase after it
|2568|2568| 						if (this.ShouldChaseTargetedEntity(target, this.order.data.force))
|2569|    |-						{
|    |2569|+						
|2570|2570| 							if (this.MoveToTargetRange(target, IID_Heal))
|2571|2571| 							{
|2572|2572| 								this.SetNextState("HEAL.CHASING");
|2573|2573| 								return;
|2574|2574| 							}
|2575|    |-						}
|    |2575|+						
|2576|2576| 					}
|2577|2577| 					// Can't reach it, healed to max hp or doesn't exist any more - give up
|2578|2578| 					if (this.FinishOrder())
|    | [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
|2743|2743| 					{
|2744|2744| 						// The building was already finished/fully repaired before we arrived;
|2745|2745| 						// let the ConstructionFinished handler handle this.
|2746|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2746|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2747|2747| 						return true;
|2748|2748| 					}
|2749|2749| 
|    | [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
|2743|2743| 					{
|2744|2744| 						// The building was already finished/fully repaired before we arrived;
|2745|2745| 						// let the ConstructionFinished handler handle this.
|2746|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2746|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2747|2747| 						return true;
|2748|2748| 					}
|2749|2749| 
|    | [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
|2783|2783| 					if (this.MoveToTargetRange(this.repairTarget, IID_Builder))
|2784|2784| 						this.SetNextState("APPROACHING");
|2785|2785| 					else if (!this.CheckTargetRange(this.repairTarget, IID_Builder))
|2786|    |-						this.FinishOrder(); //can't approach and isn't in reach
|    |2786|+						this.FinishOrder(); // can't approach and isn't in reach
|2787|2787| 				},
|2788|2788| 			},
|2789|2789| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2870|2870| 
|2871|2871| 				// Unit was approaching and there's nothing to do now, so switch to walking
|2872|2872| 				if (oldState === "INDIVIDUAL.REPAIR.APPROACHING")
|2873|    |-				{
|    |2873|+				
|2874|2874| 					// We're already walking to the given point, so add this as a order.
|2875|2875| 					this.WalkToTarget(msg.data.newentity, true);
|2876|    |-				}
|    |2876|+				
|2877|2877| 			},
|2878|2878| 		},
|2879|2879| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2920|2920| 
|2921|2921| 					// Check that we can garrison here
|2922|2922| 					if (this.CanGarrison(target))
|2923|    |-					{
|    |2923|+					
|2924|2924| 						// Check that we're in range of the garrison target
|2925|2925| 						if (this.CheckGarrisonRange(target))
|2926|2926| 						{
|2996|2996| 								return false;
|2997|2997| 							}
|2998|2998| 						}
|2999|    |-					}
|    |2999|+					
|3000|3000| 					// Garrisoning failed for some reason, so finish the order
|3001|3001| 					this.FinishOrder();
|3002|3002| 					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
|3113|3113| 		"Attacked": function(msg) {
|3114|3114| 			if (this.template.NaturalBehaviour == "skittish" ||
|3115|3115| 			    this.template.NaturalBehaviour == "passive")
|3116|    |-			{
|    |3116|+			
|3117|3117| 				this.Flee(msg.data.attacker, false);
|3118|    |-			}
|    |3118|+			
|3119|3119| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|3120|3120| 			{
|3121|3121| 				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
|3122|3122| 					this.Attack(msg.data.attacker, false);
|3123|3123| 			}
|3124|3124| 			else if (this.template.NaturalBehaviour == "domestic")
|3125|    |-			{
|    |3125|+			
|3126|3126| 				// Never flee, stop what we were doing
|3127|3127| 				this.SetNextState("IDLE");
|3128|    |-			}
|    |3128|+			
|3129|3129| 		},
|3130|3130| 
|3131|3131| 		"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
|3132|3132| 			// Move a tile outside the building
|3133|3133| 			var range = 4;
|3134|3134| 			if (this.MoveToTargetRangeExplicit(msg.data.target, range, range))
|3135|    |-			{
|    |3135|+			
|3136|3136| 				// We've started walking to the given point
|3137|3137| 				this.SetNextState("WALKING");
|3138|    |-			}
|    |3138|+			
|3139|3139| 			else
|3140|3140| 			{
|3141|3141| 				// 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
|3137|3137| 				this.SetNextState("WALKING");
|3138|3138| 			}
|3139|3139| 			else
|3140|    |-			{
|    |3140|+			
|3141|3141| 				// We are already at the target, or can't move at all
|3142|3142| 				this.FinishOrder();
|3143|    |-			}
|    |3143|+			
|3144|3144| 		},
|3145|3145| 
|3146|3146| 		"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
|3179|3179| 				}
|3180|3180| 				// Start attacking one of the newly-seen enemy (if any)
|3181|3181| 				else if (this.IsDangerousAnimal())
|3182|    |-				{
|    |3182|+				
|3183|3183| 					this.AttackVisibleEntity(msg.data.added);
|3184|    |-				}
|    |3184|+				
|3185|3185| 
|3186|3186| 				// TODO: if two units enter our range together, we'll attack the
|3187|3187| 				// 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
|3222|3222| 				}
|3223|3223| 				// Start attacking one of the newly-seen enemy (if any)
|3224|3224| 				else if (this.template.NaturalBehaviour == "violent")
|3225|    |-				{
|    |3225|+				
|3226|3226| 					this.AttackVisibleEntity(msg.data.added);
|3227|    |-				}
|    |3227|+				
|3228|3228| 			},
|3229|3229| 
|3230|3230| 			"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
|3239|3239| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3240|3240| 
|3241|3241| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3242|    |-							// only used for domestic animals
|    |3242|+		// only used for domestic animals
|3243|3243| 	},
|3244|3244| };
|3245|3245| 
|    | [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
|3296|3296| 
|3297|3297| UnitAI.prototype.IsAnimal = function()
|3298|3298| {
|3299|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3299|+	return (!!this.template.NaturalBehaviour);
|3300|3300| };
|3301|3301| 
|3302|3302| 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
|3334|3334| UnitAI.prototype.GetGarrisonHolder = function()
|3335|3335| {
|3336|3336| 	if (this.IsGarrisoned())
|3337|    |-	{
|    |3337|+	
|3338|3338| 		for (let order of this.orderQueue)
|3339|3339| 			if (order.type == "Garrison" || order.type == "Autogarrison")
|3340|3340| 				return order.data.target;
|3341|    |-	}
|    |3341|+	
|3342|3342| 	return INVALID_ENTITY;
|3343|3343| };
|3344|3344| 
|    | [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
|3415|3415| 		{
|3416|3416| 			let index = this.GetCurrentState().indexOf(".");
|3417|3417| 			if (index != -1)
|3418|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3418|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3419|3419| 			this.Stop(false);
|3420|3420| 		}
|3421|3421| 
|    | [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
|3471|3471| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3472|3472| 			continue;
|3473|3473| 		if (i == 0)
|3474|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3474|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3475|3475| 		else
|3476|3476| 			this.orderQueue.splice(i, 1);
|3477|3477| 		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
|3471|3471| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3472|3472| 			continue;
|3473|3473| 		if (i == 0)
|3474|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3474|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3475|3475| 		else
|3476|3476| 			this.orderQueue.splice(i, 1);
|3477|3477| 		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
|3555|3555| };
|3556|3556| 
|3557|3557| 
|3558|    |-//// FSM linkage functions ////
|    |3558|+// // FSM linkage functions ////
|3559|3559| 
|3560|3560| UnitAI.prototype.SetNextState = function(state)
|3561|3561| {
|    | [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
|3608|3608| 	if (this.orderQueue.length && cmpPosition && cmpPosition.IsInWorld())
|3609|3609| 	{
|3610|3610| 		let ret = this.UnitFsm.ProcessMessage(this,
|3611|    |-			{"type": "Order."+this.order.type, "data": this.order.data}
|    |3611|+			{ "type": "Order."+this.order.type, "data": this.order.data}
|3612|3612| 		);
|3613|3613| 
|3614|3614| 		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
|3608|3608| 	if (this.orderQueue.length && cmpPosition && cmpPosition.IsInWorld())
|3609|3609| 	{
|3610|3610| 		let ret = this.UnitFsm.ProcessMessage(this,
|3611|    |-			{"type": "Order."+this.order.type, "data": this.order.data}
|    |3611|+			{"type": "Order."+this.order.type, "data": this.order.data }
|3612|3612| 		);
|3613|3613| 
|3614|3614| 		Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|    | [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
|3621|3621| 		// Otherwise we've successfully processed a new order
|3622|3622| 		return true;
|3623|3623| 	}
|3624|    |-	else
|3625|    |-	{
|    |3624|+	
|3626|3625| 		this.SetNextState("IDLE");
|3627|3626| 
|3628|3627| 		Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3643|3642| 		}
|3644|3643| 
|3645|3644| 		return false;
|3646|    |-	}
|    |3645|+	
|3647|3646| };
|3648|3647| 
|3649|3648| /**
|    | [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
|3660|3660| 	{
|3661|3661| 		this.order = order;
|3662|3662| 		let ret = this.UnitFsm.ProcessMessage(this,
|3663|    |-			{"type": "Order."+this.order.type, "data": this.order.data}
|    |3663|+			{ "type": "Order."+this.order.type, "data": this.order.data}
|3664|3664| 		);
|3665|3665| 
|3666|3666| 		// If the order was rejected then immediately take it off
|    | [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
|3660|3660| 	{
|3661|3661| 		this.order = order;
|3662|3662| 		let ret = this.UnitFsm.ProcessMessage(this,
|3663|    |-			{"type": "Order."+this.order.type, "data": this.order.data}
|    |3663|+			{"type": "Order."+this.order.type, "data": this.order.data }
|3664|3664| 		);
|3665|3665| 
|3666|3666| 		// If the order was rejected then immediately take it off
|    | [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
|3696|3696| 		this.orderQueue.unshift(order);
|3697|3697| 		this.order = order;
|3698|3698| 		let ret = this.UnitFsm.ProcessMessage(this,
|3699|    |-			{"type": "Order."+this.order.type, "data": this.order.data}
|    |3699|+			{ "type": "Order."+this.order.type, "data": this.order.data}
|3700|3700| 		);
|3701|3701| 
|3702|3702| 		// If the order was rejected then immediately take it off again;
|    | [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
|3696|3696| 		this.orderQueue.unshift(order);
|3697|3697| 		this.order = order;
|3698|3698| 		let ret = this.UnitFsm.ProcessMessage(this,
|3699|    |-			{"type": "Order."+this.order.type, "data": this.order.data}
|    |3699|+			{"type": "Order."+this.order.type, "data": this.order.data }
|3700|3700| 		);
|3701|3701| 
|3702|3702| 		// If the order was rejected then immediately take it off again;
|    | [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
|3730|3730| 				continue;
|3731|3731| 			if (this.orderQueue[i].type == type)
|3732|3732| 				continue;
|3733|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3733|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3734|3734| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3735|3735| 			return;
|3736|3736| 		}
|    | [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
|3730|3730| 				continue;
|3731|3731| 			if (this.orderQueue[i].type == type)
|3732|3732| 				continue;
|3733|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3733|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3734|3734| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3735|3735| 			return;
|3736|3736| 		}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3744|3744| {
|3745|3745| 	// Remember the previous work orders to be able to go back to them later if required
|3746|3746| 	if (data && data.force)
|3747|    |-	{
|    |3747|+	
|3748|3748| 		if (this.IsFormationController())
|3749|3749| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3750|3750| 		else
|3751|3751| 			this.UpdateWorkOrders(type);
|3752|    |-	}
|    |3752|+	
|3753|3753| 
|3754|3754| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3755|3755| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3821|3821| 	{
|3822|3822| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3823|3823| 		if (cmpUnitAI)
|3824|    |-		{
|    |3824|+		
|3825|3825| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3826|3826| 			{
|3827|3827| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3830|3830| 					return;
|3831|3831| 				}
|3832|3832| 			}
|3833|    |-		}
|    |3833|+		
|3834|3834| 	}
|3835|3835| 
|3836|3836| 	// 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
|3823|3823| 		if (cmpUnitAI)
|3824|3824| 		{
|3825|3825| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3826|    |-			{
|    |3826|+			
|3827|3827| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3828|3828| 				{
|3829|3829| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3830|3830| 					return;
|3831|3831| 				}
|3832|    |-			}
|    |3832|+			
|3833|3833| 		}
|3834|3834| 	}
|3835|3835| 
|    | [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
|3835|3835| 
|3836|3836| 	// If nothing found, take the unit orders
|3837|3837| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3838|    |-	{
|    |3838|+	
|3839|3839| 		if (isWorkType(this.orderQueue[i].type))
|3840|3840| 		{
|3841|3841| 			this.workOrders = this.orderQueue.slice(i);
|3842|3842| 			return;
|3843|3843| 		}
|3844|    |-	}
|    |3844|+	
|3845|3845| };
|3846|3846| 
|3847|3847| 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
|3901|3901| 	if (data.timerRepeat === undefined)
|3902|3902| 		this.timer = undefined;
|3903|3903| 
|3904|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3904|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3905|3905| };
|3906|3906| 
|3907|3907| /**
|    | [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
|3901|3901| 	if (data.timerRepeat === undefined)
|3902|3902| 		this.timer = undefined;
|3903|3903| 
|3904|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3904|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3905|3905| };
|3906|3906| 
|3907|3907| /**
|    | [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
|3936|3936| 	this.timer = undefined;
|3937|3937| };
|3938|3938| 
|3939|    |-//// Message handlers /////
|    |3939|+// // Message handlers /////
|3940|3940| 
|3941|3941| UnitAI.prototype.OnMotionChanged = function(msg)
|3942|3942| {
|    | [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
|3941|3941| UnitAI.prototype.OnMotionChanged = function(msg)
|3942|3942| {
|3943|3943| 	if (msg.starting && !msg.error)
|3944|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3944|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveStarted", "data": msg});
|3945|3945| 	else if (!msg.starting || msg.error)
|3946|3946| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3947|3947| };
|    | [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
|3941|3941| UnitAI.prototype.OnMotionChanged = function(msg)
|3942|3942| {
|3943|3943| 	if (msg.starting && !msg.error)
|3944|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3944|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg });
|3945|3945| 	else if (!msg.starting || msg.error)
|3946|3946| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3947|3947| };
|    | [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
|3943|3943| 	if (msg.starting && !msg.error)
|3944|3944| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3945|3945| 	else if (!msg.starting || msg.error)
|3946|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3946|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveCompleted", "data": msg});
|3947|3947| };
|3948|3948| 
|3949|3949| 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
|3943|3943| 	if (msg.starting && !msg.error)
|3944|3944| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3945|3945| 	else if (!msg.starting || msg.error)
|3946|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3946|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg });
|3947|3947| };
|3948|3948| 
|3949|3949| 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
|3951|3951| 	// TODO: This is a bit inefficient since every unit listens to every
|3952|3952| 	// construction message - ideally we could scope it to only the one we're building
|3953|3953| 
|3954|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3954|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3955|3955| };
|3956|3956| 
|3957|3957| 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
|3951|3951| 	// TODO: This is a bit inefficient since every unit listens to every
|3952|3952| 	// construction message - ideally we could scope it to only the one we're building
|3953|3953| 
|3954|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3954|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3955|3955| };
|3956|3956| 
|3957|3957| 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
|3976|3976| 
|3977|3977| UnitAI.prototype.OnAttacked = function(msg)
|3978|3978| {
|3979|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3979|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3980|3980| };
|3981|3981| 
|3982|3982| 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
|3976|3976| 
|3977|3977| UnitAI.prototype.OnAttacked = function(msg)
|3978|3978| {
|3979|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3979|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3980|3980| };
|3981|3981| 
|3982|3982| 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
|3981|3981| 
|3982|3982| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3983|3983| {
|3984|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3984|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|3985|3985| };
|3986|3986| 
|3987|3987| 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
|3981|3981| 
|3982|3982| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3983|3983| {
|3984|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3984|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|3985|3985| };
|3986|3986| 
|3987|3987| 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
|3986|3986| 
|3987|3987| UnitAI.prototype.OnHealthChanged = function(msg)
|3988|3988| {
|3989|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3989|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|3990|3990| };
|3991|3991| 
|3992|3992| 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
|3986|3986| 
|3987|3987| UnitAI.prototype.OnHealthChanged = function(msg)
|3988|3988| {
|3989|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3989|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|3990|3990| };
|3991|3991| 
|3992|3992| 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
|3992|3992| UnitAI.prototype.OnRangeUpdate = function(msg)
|3993|3993| {
|3994|3994| 	if (msg.tag == this.losRangeQuery)
|3995|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3995|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|3996|3996| 	else if (msg.tag == this.losHealRangeQuery)
|3997|3997| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3998|3998| };
|    | [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
|3992|3992| UnitAI.prototype.OnRangeUpdate = function(msg)
|3993|3993| {
|3994|3994| 	if (msg.tag == this.losRangeQuery)
|3995|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3995|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|3996|3996| 	else if (msg.tag == this.losHealRangeQuery)
|3997|3997| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3998|3998| };
|    | [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| 	if (msg.tag == this.losRangeQuery)
|3995|3995| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3996|3996| 	else if (msg.tag == this.losHealRangeQuery)
|3997|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3997|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|3998|3998| };
|3999|3999| 
|4000|4000| 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
|3994|3994| 	if (msg.tag == this.losRangeQuery)
|3995|3995| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3996|3996| 	else if (msg.tag == this.losHealRangeQuery)
|3997|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3997|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|3998|3998| };
|3999|3999| 
|4000|4000| 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
|3999|3999| 
|4000|4000| UnitAI.prototype.OnPackFinished = function(msg)
|4001|4001| {
|4002|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4002|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4003|4003| };
|4004|4004| 
|4005|4005| //// 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
|3999|3999| 
|4000|4000| UnitAI.prototype.OnPackFinished = function(msg)
|4001|4001| {
|4002|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4002|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4003|4003| };
|4004|4004| 
|4005|4005| //// 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
|4002|4002| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4003|4003| };
|4004|4004| 
|4005|    |-//// Helper functions to be called by the FSM ////
|    |4005|+// // Helper functions to be called by the FSM ////
|4006|4006| 
|4007|4007| UnitAI.prototype.GetWalkSpeed = function()
|4008|4008| {
|    | [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
|4106|4106| 	if (!cmpOwnership || cmpOwnership.GetOwner() == INVALID_PLAYER)
|4107|4107| 		return undefined;
|4108|4108| 
|4109|    |-	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position)
|    |4109|+	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
|4110|4110| 	if (!cmpPosition || !cmpPosition.IsInWorld())
|4111|4111| 		return undefined;
|4112|4112| 
|    | [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
|4191|4191| 			PlaySound(name, member);
|4192|4192| 	}
|4193|4193| 	else
|4194|    |-	{
|    |4194|+	
|4195|4195| 		// Otherwise use our own sounds
|4196|4196| 		PlaySound(name, this.entity);
|4197|    |-	}
|    |4197|+	
|4198|4198| };
|4199|4199| 
|4200|4200| /*
|    | [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
|4360|4360| 	else
|4361|4361| 		// return false? Or hope you come close enough?
|4362|4362| 		var parabolicMaxRange = 0;
|4363|    |-		//return false;
|    |4363|+		// return false;
|4364|4364| 
|4365|4365| 	// the parabole changes while walking, take something in the middle
|4366|4366| 	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
|4425|4425| 	if (this.IsFormationMember())
|4426|4426| 	{
|4427|4427| 		var cmpFormationUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|4428|    |-		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation()
|4429|    |-			&& cmpFormationUnitAI.order.data.target == target)
|    |4428|+		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation() &&
|    |4429|+			cmpFormationUnitAI.order.data.target == target)
|4430|4430| 			return true;
|4431|4431| 	}
|4432|4432| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4593|4593| UnitAI.prototype.AttackEntityInZone = function(ents)
|4594|4594| {
|4595|4595| 	var target = ents.find(target =>
|4596|    |-		this.CanAttack(target)
|4597|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4596|+		this.CanAttack(target) &&
|    |4597|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4598|4598| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4599|4599| 	);
|4600|4600| 	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
|4594|4594| {
|4595|4595| 	var target = ents.find(target =>
|4596|4596| 		this.CanAttack(target)
|4597|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4598|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4597|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4598|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4599|4599| 	);
|4600|4600| 	if (!target)
|4601|4601| 		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
|4658|4658| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4659|4659| 	if (this.isGuardOf)
|4660|4660| 	{
|4661|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4661|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4662|4662| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4663|4663| 		if (cmpUnitAI && cmpAttack &&
|4664|4664| 		    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
|4662|4662| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4663|4663| 		if (cmpUnitAI && cmpAttack &&
|4664|4664| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4665|    |-				return false;
|    |4665|+			return false;
|4666|4666| 	}
|4667|4667| 
|4668|4668| 	// 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
|4667|4667| 
|4668|4668| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4669|4669| 	if (this.GetStance().respondHoldGround)
|4670|    |-	{
|    |4670|+	
|4671|4671| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4672|4672| 			return true;
|4673|    |-	}
|    |4673|+	
|4674|4674| 
|4675|4675| 	// Stop if it's left our vision range, unless we're especially persistent
|4676|4676| 	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
|4674|4674| 
|4675|4675| 	// Stop if it's left our vision range, unless we're especially persistent
|4676|4676| 	if (!this.GetStance().respondChaseBeyondVision)
|4677|    |-	{
|    |4677|+	
|4678|4678| 		if (!this.CheckTargetIsInVisionRange(target))
|4679|4679| 			return true;
|4680|    |-	}
|    |4680|+	
|4681|4681| 
|4682|4682| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4683|4683| 	// 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
|4705|4705| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4706|4706| 	if (this.isGuardOf)
|4707|4707| 	{
|4708|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4708|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4709|4709| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4710|4710| 		if (cmpUnitAI && cmpAttack &&
|4711|4711| 		    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
|4718|4718| 	return false;
|4719|4719| };
|4720|4720| 
|4721|    |-//// External interface functions ////
|    |4721|+// // External interface functions ////
|4722|4722| 
|4723|4723| UnitAI.prototype.SetFormationController = function(ent)
|4724|4724| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4728|4728| 	// of our own formation (or ourself if not in formation)
|4729|4729| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4730|4730| 	if (cmpObstruction)
|4731|    |-	{
|    |4731|+	
|4732|4732| 		if (ent == INVALID_ENTITY)
|4733|4733| 			cmpObstruction.SetControlGroup(this.entity);
|4734|4734| 		else
|4735|4735| 			cmpObstruction.SetControlGroup(ent);
|4736|    |-	}
|    |4736|+	
|4737|4737| 
|4738|4738| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4739|4739| 	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
|4871|4871| 	// if we already had an old guard order, do nothing if the target is the same
|4872|4872| 	// and the order is running, otherwise remove the previous order
|4873|4873| 	if (this.isGuardOf)
|4874|    |-	{
|    |4874|+	
|4875|4875| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4876|4876| 			return;
|4877|4877| 		else
|4878|4878| 			this.RemoveGuard();
|4879|    |-	}
|    |4879|+	
|4880|4880| 
|4881|4881| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4882|4882| };
|    | [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
|4874|4874| 	{
|4875|4875| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4876|4876| 			return;
|4877|    |-		else
|4878|    |-			this.RemoveGuard();
|    |4877|+		this.RemoveGuard();
|4879|4878| 	}
|4880|4879| 
|4881|4880| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|    | [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
|4916|4916| 		return;
|4917|4917| 
|4918|4918| 	if (this.order.type == "Guard")
|4919|    |-		this.UnitFsm.ProcessMessage(this, {"type": "RemoveGuard"});
|    |4919|+		this.UnitFsm.ProcessMessage(this, { "type": "RemoveGuard"});
|4920|4920| 	else
|4921|4921| 		for (let i = 1; i < this.orderQueue.length; ++i)
|4922|4922| 			if (this.orderQueue[i].type == "Guard")
|    | [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
|4916|4916| 		return;
|4917|4917| 
|4918|4918| 	if (this.order.type == "Guard")
|4919|    |-		this.UnitFsm.ProcessMessage(this, {"type": "RemoveGuard"});
|    |4919|+		this.UnitFsm.ProcessMessage(this, {"type": "RemoveGuard" });
|4920|4920| 	else
|4921|4921| 		for (let i = 1; i < this.orderQueue.length; ++i)
|4922|4922| 			if (this.orderQueue[i].type == "Guard")
|    | [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
|5045|5045| 			this.WalkToTarget(target, queued);
|5046|5046| 		return;
|5047|5047| 	}
|5048|    |-	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture}, queued);
|    |5048|+	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture }, queued);
|5049|5049| };
|5050|5050| 
|5051|5051| /**
|    | [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
|5194|5194| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5195|5195| 	{
|5196|5196| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5197|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5197|+		if (cmpTrader.HasBothMarkets() &&
|5198|5198| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5199|5199| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5200|5200| 		{
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5475|5475| 				{
|5476|5476| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5477|5477| 					var targetClasses = this.order.data.targetClasses;
|5478|    |-					if (targetClasses.attack && cmpIdentity
|5479|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5478|+					if (targetClasses.attack && cmpIdentity &&
|    |5479|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5480|5480| 						continue;
|5481|5481| 					if (targetClasses.avoid && cmpIdentity
|5482|5482| 						&& 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
|5478|5478| 					if (targetClasses.attack && cmpIdentity
|5479|5479| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5480|5480| 						continue;
|5481|    |-					if (targetClasses.avoid && cmpIdentity
|5482|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5481|+					if (targetClasses.avoid && cmpIdentity &&
|    |5482|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5483|5483| 						continue;
|5484|5484| 					// Only used by the AIs to prevent some choices of targets
|5485|5485| 					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
|5501|5501| 		{
|5502|5502| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5503|5503| 			var targetClasses = this.order.data.targetClasses;
|5504|    |-			if (cmpIdentity && targetClasses.attack
|5505|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5504|+			if (cmpIdentity && targetClasses.attack &&
|    |5505|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5506|5506| 				continue;
|5507|5507| 			if (cmpIdentity && targetClasses.avoid
|5508|5508| 				&& 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
|5504|5504| 			if (cmpIdentity && targetClasses.attack
|5505|5505| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5506|5506| 				continue;
|5507|    |-			if (cmpIdentity && targetClasses.avoid
|5508|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5507|+			if (cmpIdentity && targetClasses.avoid &&
|    |5508|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5509|5509| 				continue;
|5510|5510| 			// Only used by the AIs to prevent some choices of targets
|5511|5511| 			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
|5637|5637| 
|5638|5638| UnitAI.prototype.SetHeldPosition = function(x, z)
|5639|5639| {
|5640|    |-	this.heldPosition = {"x": x, "z": z};
|    |5640|+	this.heldPosition = { "x": x, "z": z};
|5641|5641| };
|5642|5642| 
|5643|5643| 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
|5637|5637| 
|5638|5638| UnitAI.prototype.SetHeldPosition = function(x, z)
|5639|5639| {
|5640|    |-	this.heldPosition = {"x": x, "z": z};
|    |5640|+	this.heldPosition = {"x": x, "z": z };
|5641|5641| };
|5642|5642| 
|5643|5643| 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
|5664|5664| 	return false;
|5665|5665| };
|5666|5666| 
|5667|    |-//// Helper functions ////
|    |5667|+// // Helper functions ////
|5668|5668| 
|5669|5669| UnitAI.prototype.CanAttack = function(target)
|5670|5670| {
|    | [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
|5868|5868| 	return (cmpPack && cmpPack.IsPacking());
|5869|5869| };
|5870|5870| 
|5871|    |-//// Formation specific functions ////
|    |5871|+// // Formation specific functions ////
|5872|5872| 
|5873|5873| UnitAI.prototype.IsAttackingAsFormation = function()
|5874|5874| {
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5873|5873| UnitAI.prototype.IsAttackingAsFormation = function()
|5874|5874| {
|5875|5875| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5876|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5877|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5876|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5877|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5878|5878| };
|5879|5879| 
|5880|5880| //// 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
|5877|5877| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5878|5878| };
|5879|5879| 
|5880|    |-//// Animal specific functions ////
|    |5880|+// // Animal specific functions ////
|5881|5881| 
|5882|5882| UnitAI.prototype.MoveRandomly = function(distance)
|5883|5883| {

binaries/data/mods/public/simulation/components/UnitAI.js
|2435| »   »   »   »   »   »   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
|3806| »   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
|4580| »   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
|4595| »   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
|4641| »   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
|4664| »   »   ····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
|5125| »   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
| 369| »   »   ····&&·(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
|1910| »   »   »   »   »   »   var·cmpFormation·=·Engine.QueryInterface(this.formationController,·IID_Formation);
|    | [NORMAL] JSHintBear:
|    | 'cmpFormation' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|2044| »   »   »   »   »   »   &&·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
|2128| »   »   »   »   »   »   »   »   ·&&·((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
|2129| »   »   »   »   »   »   »   »   ·||·(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
|2130| »   »   »   »   »   »   »   »   ·&&·(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
|2153| »   »   »   »   »   »   »   »   var·nearby·=·this.FindNearestDropsite(oldType.generic);
|    | [NORMAL] JSHintBear:
|    | 'nearby' is already defined.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4373| »   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
|4429| »   »   »   &&·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
|4597| »   »   &&·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
|4598| »   »   &&·(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
|5125| »   var·lastPos·=·undefined;
|    | [NORMAL] JSHintBear:
|    | It's not necessary to initialize 'lastPos' to 'undefined'.

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

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

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

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

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

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

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

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

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

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

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

Linter detected issues:
Executing section Default...
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
| 229| 229| 		// Move a tile outside the building
| 230| 230| 		let range = 4;
| 231| 231| 		if (this.MoveToTargetRangeExplicit(msg.data.target, range, range))
| 232|    |-		{
|    | 232|+		
| 233| 233| 			// We've started walking to the given point
| 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
| 339| 339| 
| 340| 340| 		var ok = this.MoveToTarget(this.order.data.target);
| 341| 341| 		if (ok)
| 342|    |-		{
|    | 342|+		
| 343| 343| 			// We've started walking to the given point
| 344| 344| 			if (this.IsAnimal())
| 345| 345| 				this.SetNextState("ANIMAL.WALKING");
| 346| 346| 			else
| 347| 347| 				this.SetNextState("INDIVIDUAL.WALKING");
| 348|    |-		}
|    | 348|+		
| 349| 349| 		else
| 350| 350| 		{
| 351| 351| 			// 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
| 367| 367| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 368| 368| 		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 369| 369| 		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 370|    |-		{
|    | 370|+		
| 371| 371| 			// we were already on the shoreline, and have not moved since
| 372| 372| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
| 373| 373| 				needToMove = false;
| 374|    |-		}
|    | 374|+		
| 375| 375| 
| 376| 376| 		// TODO: what if the units are on a cliff ? the ship will go below the cliff
| 377| 377| 		// 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
| 365| 365| 		// Check if we need to move     TODO implement a better way to know if we are on the shoreline
| 366| 366| 		var needToMove = true;
| 367| 367| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 368|    |-		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 369|    |-		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
|    | 368|+		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x) &&
|    | 369|+		    (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 370| 370| 		{
| 371| 371| 			// we were already on the shoreline, and have not moved since
| 372| 372| 			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
| 376| 376| 		// TODO: what if the units are on a cliff ? the ship will go below the cliff
| 377| 377| 		// and the units won't be able to garrison. Should go to the nearest (accessible) shore
| 378| 378| 		if (needToMove && this.MoveToTarget(this.order.data.target))
| 379|    |-		{
|    | 379|+		
| 380| 380| 			this.SetNextState("INDIVIDUAL.PICKUP.APPROACHING");
| 381|    |-		}
|    | 381|+		
| 382| 382| 		else
| 383| 383| 		{
| 384| 384| 			// 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
| 405| 405| 		var distance = DistanceBetweenEntities(this.entity, this.order.data.target) + (+this.template.FleeDistance);
| 406| 406| 		var cmpUnitMotion = Engine.QueryInterface(this.entity, IID_UnitMotion);
| 407| 407| 		if (cmpUnitMotion.MoveToTargetRange(this.order.data.target, distance, -1))
| 408|    |-		{
|    | 408|+		
| 409| 409| 			// We've started fleeing from the given target
| 410| 410| 			if (this.IsAnimal())
| 411| 411| 				this.SetNextState("ANIMAL.FLEEING");
| 412| 412| 			else
| 413| 413| 				this.SetNextState("INDIVIDUAL.FLEEING");
| 414|    |-		}
|    | 414|+		
| 415| 415| 		else
| 416| 416| 		{
| 417| 417| 			// 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
| 461| 461| 			}
| 462| 462| 
| 463| 463| 			if (this.order.data.attackType == this.oldAttackType)
| 464|    |-			{
|    | 464|+			
| 465| 465| 				if (this.IsAnimal())
| 466| 466| 					this.SetNextState("ANIMAL.COMBAT.ATTACKING");
| 467| 467| 				else
| 468| 468| 					this.SetNextState("INDIVIDUAL.COMBAT.ATTACKING");
| 469|    |-			}
|    | 469|+			
| 470| 470| 			else
| 471| 471| 			{
| 472| 472| 				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
| 468| 468| 					this.SetNextState("INDIVIDUAL.COMBAT.ATTACKING");
| 469| 469| 			}
| 470| 470| 			else
| 471|    |-			{
|    | 471|+			
| 472| 472| 				if (this.IsAnimal())
| 473| 473| 					this.SetNextStateAlwaysEntering("ANIMAL.COMBAT.ATTACKING");
| 474| 474| 				else
| 475| 475| 					this.SetNextStateAlwaysEntering("INDIVIDUAL.COMBAT.ATTACKING");
| 476|    |-			}
|    | 476|+			
| 477| 477| 			return;
| 478| 478| 		}
| 479| 479| 
|    | [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
| 606| 606| 					this.PushOrderFront("Walk", this.order.data.lastPos);
| 607| 607| 				}
| 608| 608| 				else
| 609|    |-				{
|    | 609|+				
| 610| 610| 					// We couldn't move there, or the target moved away
| 611| 611| 					this.FinishOrder();
| 612|    |-				}
|    | 612|+				
| 613| 613| 				return;
| 614| 614| 			}
| 615| 615| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 619| 619| 
| 620| 620| 		// Try to move within range
| 621| 621| 		if (this.MoveToTargetRange(this.order.data.target, IID_ResourceGatherer))
| 622|    |-		{
|    | 622|+		
| 623| 623| 			// We've started walking to the given point
| 624| 624| 			this.SetNextState("INDIVIDUAL.GATHER.APPROACHING");
| 625|    |-		}
|    | 625|+		
| 626| 626| 		else
| 627| 627| 		{
| 628| 628| 			// 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
| 696| 696| 	"Order.Repair": function(msg) {
| 697| 697| 		// Try to move within range
| 698| 698| 		if (this.MoveToTargetRange(this.order.data.target, IID_Builder))
| 699|    |-		{
|    | 699|+		
| 700| 700| 			// We've started walking to the given point
| 701| 701| 			this.SetNextState("INDIVIDUAL.REPAIR.APPROACHING");
| 702|    |-		}
|    | 702|+		
| 703| 703| 		else
| 704| 704| 		{
| 705| 705| 			// 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
| 733| 733| 		}
| 734| 734| 
| 735| 735| 		if (this.MoveToGarrisonRange(this.order.data.target))
| 736|    |-		{
|    | 736|+		
| 737| 737| 			this.SetNextState("INDIVIDUAL.GARRISON.APPROACHING");
| 738|    |-		}
|    | 738|+		
| 739| 739| 		else
| 740| 740| 		{
| 741| 741| 			// 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
| 871| 871| 			if (!this.CheckTargetAttackRange(target, target))
| 872| 872| 			{
| 873| 873| 				if (this.TargetIsAlive(target) && this.CheckTargetVisible(target))
| 874|    |-				{
|    | 874|+				
| 875| 875| 					if (this.MoveToTargetAttackRange(target, target))
| 876| 876| 					{
| 877| 877| 						this.SetNextState("COMBAT.APPROACHING");
| 878| 878| 						return;
| 879| 879| 					}
| 880|    |-				}
|    | 880|+				
| 881| 881| 				this.FinishOrder();
| 882| 882| 				return;
| 883| 883| 			}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 896| 896| 			}
| 897| 897| 			// Check if we are already in range, otherwise walk there
| 898| 898| 			if (!this.CheckGarrisonRange(msg.data.target))
| 899|    |-			{
|    | 899|+			
| 900| 900| 				if (!this.CheckTargetVisible(msg.data.target))
| 901| 901| 				{
| 902| 902| 					this.FinishOrder();
| 911| 911| 						return;
| 912| 912| 					}
| 913| 913| 				}
| 914|    |-			}
|    | 914|+			
| 915| 915| 
| 916| 916| 			this.SetNextState("GARRISON.GARRISONING");
| 917| 917| 		},
|    | [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
| 903| 903| 					return;
| 904| 904| 				}
| 905| 905| 				else
| 906|    |-				{
|    | 906|+				
| 907| 907| 					// Out of range; move there in formation
| 908| 908| 					if (this.MoveToGarrisonRange(msg.data.target))
| 909| 909| 					{
| 910| 910| 						this.SetNextState("GARRISON.APPROACHING");
| 911| 911| 						return;
| 912| 912| 					}
| 913|    |-				}
|    | 913|+				
| 914| 914| 			}
| 915| 915| 
| 916| 916| 			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
| 902| 902| 					this.FinishOrder();
| 903| 903| 					return;
| 904| 904| 				}
| 905|    |-				else
| 906|    |-				{
|    | 905|+				
| 907| 906| 					// Out of range; move there in formation
| 908| 907| 					if (this.MoveToGarrisonRange(msg.data.target))
| 909| 908| 					{
| 910| 909| 						this.SetNextState("GARRISON.APPROACHING");
| 911| 910| 						return;
| 912| 911| 					}
| 913|    |-				}
|    | 912|+				
| 914| 913| 			}
| 915| 914| 
| 916| 915| 			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
| 929| 929| 						this.PushOrderFront("Walk", msg.data.lastPos);
| 930| 930| 					}
| 931| 931| 					else
| 932|    |-					{
|    | 932|+					
| 933| 933| 						// We couldn't move there, or the target moved away
| 934| 934| 						this.FinishOrder();
| 935|    |-					}
|    | 935|+					
| 936| 936| 					return;
| 937| 937| 				}
| 938| 938| 
|    | [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
|1150|1150| 			},
|1151|1151| 		},
|1152|1152| 
|1153|    |-		"GARRISON":{
|    |1153|+		"GARRISON": {
|1154|1154| 			"enter": function() {
|1155|1155| 				// If the garrisonholder should pickup, warn it so it can take needed action
|1156|1156| 				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
|1331|1331| 			// If the controller handled an order but some members rejected it,
|1332|1332| 			// they will have no orders and be in the FORMATIONMEMBER.IDLE state.
|1333|1333| 			if (this.orderQueue.length)
|1334|    |-			{
|    |1334|+			
|1335|1335| 				// We're leaving the formation, so stop our FormationWalk order
|1336|1336| 				if (this.FinishOrder())
|1337|1337| 					return;
|1338|    |-			}
|    |1338|+			
|1339|1339| 
|1340|1340| 			// No orders left, we're an individual now
|1341|1341| 			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
|1359|1359| 			// Move a tile outside the building
|1360|1360| 			let range = 4;
|1361|1361| 			if (this.MoveToTargetRangeExplicit(msg.data.target, range, range))
|1362|    |-			{
|    |1362|+			
|1363|1363| 				// We've started walking to the given point
|1364|1364| 				this.SetNextState("WALKINGTOPOINT");
|1365|    |-			}
|    |1365|+			
|1366|1366| 			else
|1367|1367| 			{
|1368|1368| 				// 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
|1364|1364| 				this.SetNextState("WALKINGTOPOINT");
|1365|1365| 			}
|1366|1366| 			else
|1367|    |-			{
|    |1367|+			
|1368|1368| 				// We are already at the target, or can't move at all
|1369|1369| 				this.FinishOrder();
|1370|    |-			}
|    |1370|+			
|1371|1371| 		},
|1372|1372| 
|1373|1373| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1565|1565| 
|1566|1566| 			"LosRangeUpdate": function(msg) {
|1567|1567| 				if (this.GetStance().targetVisibleEnemies)
|1568|    |-				{
|    |1568|+				
|1569|1569| 					// Start attacking one of the newly-seen enemy (if any)
|1570|1570| 					this.AttackEntitiesByPreference(msg.data.added);
|1571|    |-				}
|    |1571|+				
|1572|1572| 			},
|1573|1573| 
|1574|1574| 			"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
|1751|1751| 						// if nothing better to do, check if the guarded needs to be healed or repaired
|1752|1752| 						var cmpHealth = Engine.QueryInterface(this.isGuardOf, IID_Health);
|1753|1753| 						if (cmpHealth && (cmpHealth.GetHitpoints() < cmpHealth.GetMaxHitpoints()))
|1754|    |-						{
|    |1754|+						
|1755|1755| 							if (this.CanHeal(this.isGuardOf))
|1756|1756| 								this.PushOrderFront("Heal", { "target": this.isGuardOf, "force": false });
|1757|1757| 							else if (this.CanRepair(this.isGuardOf))
|1758|1758| 								this.PushOrderFront("Repair", { "target": this.isGuardOf, "autocontinue": false, "force": false });
|1759|    |-						}
|    |1759|+						
|1760|1760| 					}
|1761|1761| 				},
|1762|1762| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1839|1839| 				"MoveCompleted": function() {
|1840|1840| 
|1841|1841| 					if (this.CheckTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1842|    |-					{
|    |1842|+					
|1843|1843| 						// If the unit needs to unpack, do so
|1844|1844| 						if (this.CanUnpack())
|1845|1845| 						{
|1848|1848| 						}
|1849|1849| 						else
|1850|1850| 							this.SetNextState("ATTACKING");
|1851|    |-					}
|    |1851|+					
|1852|1852| 					else
|1853|1853| 					{
|1854|1854| 						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
|1846|1846| 							this.PushOrderFront("Unpack", { "force": true });
|1847|1847| 							return;
|1848|1848| 						}
|1849|    |-						else
|1850|    |-							this.SetNextState("ATTACKING");
|    |1849|+						this.SetNextState("ATTACKING");
|1851|1850| 					}
|1852|1851| 					else
|1853|1852| 					{
|    | [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
|1850|1850| 							this.SetNextState("ATTACKING");
|1851|1851| 					}
|1852|1852| 					else
|1853|    |-					{
|    |1853|+					
|1854|1854| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1855|1855| 						{
|1856|1856| 							this.SetNextState("APPROACHING");
|1860|1860| 							// Give up
|1861|1861| 							this.FinishOrder();
|1862|1862| 						}
|1863|    |-					}
|    |1863|+					
|1864|1864| 				},
|1865|1865| 			},
|1866|1866| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/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| 					else
|1853|1853| 					{
|1854|1854| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1855|    |-						{
|    |1855|+						
|1856|1856| 							this.SetNextState("APPROACHING");
|1857|    |-						}
|    |1857|+						
|1858|1858| 						else
|1859|1859| 						{
|1860|1860| 							// 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
|1856|1856| 							this.SetNextState("APPROACHING");
|1857|1857| 						}
|1858|1858| 						else
|1859|    |-						{
|    |1859|+						
|1860|1860| 							// Give up
|1861|1861| 							this.FinishOrder();
|1862|    |-						}
|    |1862|+						
|1863|1863| 					}
|1864|1864| 				},
|1865|1865| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1877|1877| 					}
|1878|1878| 					// Check the target is still alive and attackable
|1879|1879| 					if (this.CanAttack(target) && !this.CheckTargetAttackRange(target, this.order.data.attackType))
|1880|    |-					{
|    |1880|+					
|1881|1881| 						// Can't reach it - try to chase after it
|1882|1882| 						if (this.ShouldChaseTargetedEntity(target, this.order.data.force))
|1883|1883| 						{
|1887|1887| 								return;
|1888|1888| 							}
|1889|1889| 						}
|1890|    |-					}
|    |1890|+					
|1891|1891| 
|1892|1892| 					var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|1893|1893| 					this.attackTimers = cmpAttack.GetTimers(this.order.data.attackType);
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/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| 					{
|1881|1881| 						// Can't reach it - try to chase after it
|1882|1882| 						if (this.ShouldChaseTargetedEntity(target, this.order.data.force))
|1883|    |-						{
|    |1883|+						
|1884|1884| 							if (this.MoveToTargetAttackRange(target, this.order.data.attackType))
|1885|1885| 							{
|1886|1886| 								this.SetNextState("COMBAT.CHASING");
|1887|1887| 								return;
|1888|1888| 							}
|1889|    |-						}
|    |1889|+						
|1890|1890| 					}
|1891|1891| 
|1892|1892| 					var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|    | [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
|1918|1918| 					// TODO: we should probably only bother syncing projectile attacks, not melee
|1919|1919| 
|1920|1920| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|1921|    |-					this.resyncAnimation = (prepare != this.attackTimers.prepare) ? true : false;
|    |1921|+					this.resyncAnimation = (prepare != this.attackTimers.prepare);
|1922|1922| 
|1923|1923| 					this.FaceTowardsTarget(this.order.data.target);
|1924|1924| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1993|1993| 
|1994|1994| 						// Can't reach it - try to chase after it
|1995|1995| 						if (this.ShouldChaseTargetedEntity(target, this.order.data.force))
|1996|    |-						{
|    |1996|+						
|1997|1997| 							if (this.MoveToTargetRange(target, IID_Attack, this.order.data.attackType))
|1998|1998| 							{
|1999|1999| 								this.SetNextState("COMBAT.CHASING");
|2000|2000| 								return;
|2001|2001| 							}
|2002|    |-						}
|    |2002|+						
|2003|2003| 					}
|2004|2004| 
|2005|2005| 					// if we're targetting a formation, find a new member of that formation
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2040|2040| 
|2041|2041| 				"Attacked": function(msg) {
|2042|2042| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2043|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2044|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2043|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2044|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2045|2045| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2046|2046| 				},
|2047|2047| 			},
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2124|2124| 						// Also don't switch to a different type of huntable animal
|2125|2125| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2126|2126| 							return (
|2127|    |-								ent != oldTarget
|2128|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2127|+								ent != oldTarget &&
|    |2128|+								 ((type.generic == "treasure" && oldType.generic == "treasure")
|2129|2129| 								 || (type.specific == oldType.specific
|2130|2130| 								 && (type.specific != "meat" || oldTemplate == template)))
|2131|2131| 							);
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/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| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2126|2126| 							return (
|2127|2127| 								ent != oldTarget
|2128|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2129|    |-								 || (type.specific == oldType.specific
|    |2128|+								 && ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2129|+								 (type.specific == oldType.specific
|2130|2130| 								 && (type.specific != "meat" || oldTemplate == template)))
|2131|2131| 							);
|2132|2132| 						}, 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
|2126|2126| 							return (
|2127|2127| 								ent != oldTarget
|2128|2128| 								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2129|    |-								 || (type.specific == oldType.specific
|2130|    |-								 && (type.specific != "meat" || oldTemplate == template)))
|    |2129|+								 || (type.specific == oldType.specific &&
|    |2130|+								 (type.specific != "meat" || oldTemplate == template)))
|2131|2131| 							);
|2132|2132| 						}, oldTarget);
|2133|2133| 						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
|2135|2135| 							this.PerformGather(nearby, false, false);
|2136|2136| 							return true;
|2137|2137| 						}
|2138|    |-						else
|2139|    |-						{
|    |2138|+						
|2140|2139| 							// It's probably better in this case, to avoid units getting stuck around a dropsite
|2141|2140| 							// in a "Target is far away, full, nearby are no good resources, return to dropsite" loop
|2142|2141| 							// to order it to GatherNear the resource position.
|2157|2156| 									return true;
|2158|2157| 								}
|2159|2158| 							}
|2160|    |-						}
|    |2159|+						
|2161|2160| 						return true;
|2162|2161| 					}
|2163|2162| 					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
|2147|2147| 								this.GatherNearPosition(pos.x, pos.z, oldType, oldTemplate);
|2148|2148| 								return true;
|2149|2149| 							}
|2150|    |-							else
|2151|    |-							{
|    |2150|+							
|2152|2151| 								// we're kind of stuck here. Return resource.
|2153|2152| 								var nearby = this.FindNearestDropsite(oldType.generic);
|2154|2153| 								if (nearby)
|2156|2155| 									this.PushOrderFront("ReturnResource", { "target": nearby, "force": false });
|2157|2156| 									return true;
|2158|2157| 								}
|2159|    |-							}
|    |2158|+							
|2160|2159| 						}
|2161|2160| 						return true;
|2162|2161| 					}
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2189|2189| 						// Also don't switch to a different type of huntable animal
|2190|2190| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2191|2191| 							return (
|2192|    |-								ent != oldTarget
|2193|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2192|+								ent != oldTarget &&
|    |2193|+								((type.generic == "treasure" && oldType.generic == "treasure")
|2194|2194| 								|| (type.specific == oldType.specific
|2195|2195| 								&& (type.specific != "meat" || oldTemplate == template)))
|2196|2196| 							);
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2190|2190| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2191|2191| 							return (
|2192|2192| 								ent != oldTarget
|2193|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2194|    |-								|| (type.specific == oldType.specific
|    |2193|+								&& ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2194|+								(type.specific == oldType.specific
|2195|2195| 								&& (type.specific != "meat" || oldTemplate == template)))
|2196|2196| 							);
|2197|2197| 						});
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2191|2191| 							return (
|2192|2192| 								ent != oldTarget
|2193|2193| 								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2194|    |-								|| (type.specific == oldType.specific
|2195|    |-								&& (type.specific != "meat" || oldTemplate == template)))
|    |2194|+								|| (type.specific == oldType.specific &&
|    |2195|+								(type.specific != "meat" || oldTemplate == template)))
|2196|2196| 							);
|2197|2197| 						});
|2198|2198| 						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
|2236|2236| 					// Also don't switch to a different type of huntable animal
|2237|2237| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2238|2238| 						return (
|2239|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2240|    |-							|| (type.specific == resourceType.specific
|    |2239|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2240|+							(type.specific == resourceType.specific
|2241|2241| 							&& (type.specific != "meat" || resourceTemplate == template))
|2242|2242| 						);
|2243|2243| 					});
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2237|2237| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2238|2238| 						return (
|2239|2239| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2240|    |-							|| (type.specific == resourceType.specific
|2241|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2240|+							|| (type.specific == resourceType.specific &&
|    |2241|+							(type.specific != "meat" || resourceTemplate == template))
|2242|2242| 						);
|2243|2243| 					});
|2244|2244| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2353|2353| 
|2354|2354| 					var cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply);
|2355|2355| 					if (cmpSupply && cmpSupply.IsAvailable(cmpOwnership.GetOwner(), this.entity))
|2356|    |-					{
|    |2356|+					
|2357|2357| 						// Check we can still reach and gather from the target
|2358|2358| 						if (this.CheckTargetRange(this.gatheringTarget, IID_ResourceGatherer) && this.CanGather(this.gatheringTarget))
|2359|2359| 						{
|2419|2419| 								return;
|2420|2420| 							}
|2421|2421| 						}
|2422|    |-					}
|    |2422|+					
|2423|2423| 
|2424|2424| 					// We're already in range, can't get anywhere near it or the target is exhausted.
|2425|2425| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2445|2445| 					// Also don't switch to a different type of huntable animal
|2446|2446| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2447|2447| 						return (
|2448|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2449|    |-							|| (type.specific == resourceType.specific
|    |2448|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2449|+							(type.specific == resourceType.specific
|2450|2450| 							&& (type.specific != "meat" || resourceTemplate == template))
|2451|2451| 						);
|2452|2452| 					});
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2446|2446| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2447|2447| 						return (
|2448|2448| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2449|    |-							|| (type.specific == resourceType.specific
|2450|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2449|+							|| (type.specific == resourceType.specific &&
|    |2450|+							(type.specific != "meat" || resourceTemplate == template))
|2451|2451| 						);
|2452|2452| 					});
|2453|2453| 					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
|2533|2533| 					this.StartTimer(prepare, this.healTimers.repeat);
|2534|2534| 
|2535|2535| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2536|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2536|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2537|2537| 
|2538|2538| 					this.FaceTowardsTarget(this.order.data.target);
|2539|2539| 				},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2566|2566| 						}
|2567|2567| 						// Can't reach it - try to chase after it
|2568|2568| 						if (this.ShouldChaseTargetedEntity(target, this.order.data.force))
|2569|    |-						{
|    |2569|+						
|2570|2570| 							if (this.MoveToTargetRange(target, IID_Heal))
|2571|2571| 							{
|2572|2572| 								this.SetNextState("HEAL.CHASING");
|2573|2573| 								return;
|2574|2574| 							}
|2575|    |-						}
|    |2575|+						
|2576|2576| 					}
|2577|2577| 					// Can't reach it, healed to max hp or doesn't exist any more - give up
|2578|2578| 					if (this.FinishOrder())
|    | [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
|2743|2743| 					{
|2744|2744| 						// The building was already finished/fully repaired before we arrived;
|2745|2745| 						// let the ConstructionFinished handler handle this.
|2746|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2746|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2747|2747| 						return true;
|2748|2748| 					}
|2749|2749| 
|    | [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
|2743|2743| 					{
|2744|2744| 						// The building was already finished/fully repaired before we arrived;
|2745|2745| 						// let the ConstructionFinished handler handle this.
|2746|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2746|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2747|2747| 						return true;
|2748|2748| 					}
|2749|2749| 
|    | [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
|2783|2783| 					if (this.MoveToTargetRange(this.repairTarget, IID_Builder))
|2784|2784| 						this.SetNextState("APPROACHING");
|2785|2785| 					else if (!this.CheckTargetRange(this.repairTarget, IID_Builder))
|2786|    |-						this.FinishOrder(); //can't approach and isn't in reach
|    |2786|+						this.FinishOrder(); // can't approach and isn't in reach
|2787|2787| 				},
|2788|2788| 			},
|2789|2789| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2870|2870| 
|2871|2871| 				// Unit was approaching and there's nothing to do now, so switch to walking
|2872|2872| 				if (oldState === "INDIVIDUAL.REPAIR.APPROACHING")
|2873|    |-				{
|    |2873|+				
|2874|2874| 					// We're already walking to the given point, so add this as a order.
|2875|2875| 					this.WalkToTarget(msg.data.newentity, true);
|2876|    |-				}
|    |2876|+				
|2877|2877| 			},
|2878|2878| 		},
|2879|2879| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2920|2920| 
|2921|2921| 					// Check that we can garrison here
|2922|2922| 					if (this.CanGarrison(target))
|2923|    |-					{
|    |2923|+					
|2924|2924| 						// Check that we're in range of the garrison target
|2925|2925| 						if (this.CheckGarrisonRange(target))
|2926|2926| 						{
|2996|2996| 								return false;
|2997|2997| 							}
|2998|2998| 						}
|2999|    |-					}
|    |2999|+					
|3000|3000| 					// Garrisoning failed for some reason, so finish the order
|3001|3001| 					this.FinishOrder();
|3002|3002| 					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
|3113|3113| 		"Attacked": function(msg) {
|3114|3114| 			if (this.template.NaturalBehaviour == "skittish" ||
|3115|3115| 			    this.template.NaturalBehaviour == "passive")
|3116|    |-			{
|    |3116|+			
|3117|3117| 				this.Flee(msg.data.attacker, false);
|3118|    |-			}
|    |3118|+			
|3119|3119| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|3120|3120| 			{
|3121|3121| 				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
|3122|3122| 					this.Attack(msg.data.attacker, false);
|3123|3123| 			}
|3124|3124| 			else if (this.template.NaturalBehaviour == "domestic")
|3125|    |-			{
|    |3125|+			
|3126|3126| 				// Never flee, stop what we were doing
|3127|3127| 				this.SetNextState("IDLE");
|3128|    |-			}
|    |3128|+			
|3129|3129| 		},
|3130|3130| 
|3131|3131| 		"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
|3132|3132| 			// Move a tile outside the building
|3133|3133| 			var range = 4;
|3134|3134| 			if (this.MoveToTargetRangeExplicit(msg.data.target, range, range))
|3135|    |-			{
|    |3135|+			
|3136|3136| 				// We've started walking to the given point
|3137|3137| 				this.SetNextState("WALKING");
|3138|    |-			}
|    |3138|+			
|3139|3139| 			else
|3140|3140| 			{
|3141|3141| 				// 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
|3137|3137| 				this.SetNextState("WALKING");
|3138|3138| 			}
|3139|3139| 			else
|3140|    |-			{
|    |3140|+			
|3141|3141| 				// We are already at the target, or can't move at all
|3142|3142| 				this.FinishOrder();
|3143|    |-			}
|    |3143|+			
|3144|3144| 		},
|3145|3145| 
|3146|3146| 		"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
|3179|3179| 				}
|3180|3180| 				// Start attacking one of the newly-seen enemy (if any)
|3181|3181| 				else if (this.IsDangerousAnimal())
|3182|    |-				{
|    |3182|+				
|3183|3183| 					this.AttackVisibleEntity(msg.data.added);
|3184|    |-				}
|    |3184|+				
|3185|3185| 
|3186|3186| 				// TODO: if two units enter our range together, we'll attack the
|3187|3187| 				// 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
|3222|3222| 				}
|3223|3223| 				// Start attacking one of the newly-seen enemy (if any)
|3224|3224| 				else if (this.template.NaturalBehaviour == "violent")
|3225|    |-				{
|    |3225|+				
|3226|3226| 					this.AttackVisibleEntity(msg.data.added);
|3227|    |-				}
|    |3227|+				
|3228|3228| 			},
|3229|3229| 
|3230|3230| 			"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
|3239|3239| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3240|3240| 
|3241|3241| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3242|    |-							// only used for domestic animals
|    |3242|+		// only used for domestic animals
|3243|3243| 	},
|3244|3244| };
|3245|3245| 
|    | [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
|3296|3296| 
|3297|3297| UnitAI.prototype.IsAnimal = function()
|3298|3298| {
|3299|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3299|+	return (!!this.template.NaturalBehaviour);
|3300|3300| };
|3301|3301| 
|3302|3302| 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
|3334|3334| UnitAI.prototype.GetGarrisonHolder = function()
|3335|3335| {
|3336|3336| 	if (this.IsGarrisoned())
|3337|    |-	{
|    |3337|+	
|3338|3338| 		for (let order of this.orderQueue)
|3339|3339| 			if (order.type == "Garrison" || order.type == "Autogarrison")
|3340|3340| 				return order.data.target;
|3341|    |-	}
|    |3341|+	
|3342|3342| 	return INVALID_ENTITY;
|3343|3343| };
|3344|3344| 
|    | [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
|3415|3415| 		{
|3416|3416| 			let index = this.GetCurrentState().indexOf(".");
|3417|3417| 			if (index != -1)
|3418|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3418|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3419|3419| 			this.Stop(false);
|3420|3420| 		}
|3421|3421| 
|    | [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
|3471|3471| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3472|3472| 			continue;
|3473|3473| 		if (i == 0)
|3474|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3474|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3475|3475| 		else
|3476|3476| 			this.orderQueue.splice(i, 1);
|3477|3477| 		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
|3471|3471| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3472|3472| 			continue;
|3473|3473| 		if (i == 0)
|3474|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3474|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3475|3475| 		else
|3476|3476| 			this.orderQueue.splice(i, 1);
|3477|3477| 		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
|3555|3555| };
|3556|3556| 
|3557|3557| 
|3558|    |-//// FSM linkage functions ////
|    |3558|+// // FSM linkage functions ////
|3559|3559| 
|3560|3560| UnitAI.prototype.SetNextState = function(state)
|3561|3561| {
|    | [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
|3608|3608| 	if (this.orderQueue.length && (this.IsGarrisoned() || cmpPosition && cmpPosition.IsInWorld()))
|3609|3609| 	{
|3610|3610| 		let ret = this.UnitFsm.ProcessMessage(this,
|3611|    |-			{"type": "Order."+this.order.type, "data": this.order.data}
|    |3611|+			{ "type": "Order."+this.order.type, "data": this.order.data}
|3612|3612| 		);
|3613|3613| 
|3614|3614| 		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
|3608|3608| 	if (this.orderQueue.length && (this.IsGarrisoned() || cmpPosition && cmpPosition.IsInWorld()))
|3609|3609| 	{
|3610|3610| 		let ret = this.UnitFsm.ProcessMessage(this,
|3611|    |-			{"type": "Order."+this.order.type, "data": this.order.data}
|    |3611|+			{"type": "Order."+this.order.type, "data": this.order.data }
|3612|3612| 		);
|3613|3613| 
|3614|3614| 		Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|    | [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
|3621|3621| 		// Otherwise we've successfully processed a new order
|3622|3622| 		return true;
|3623|3623| 	}
|3624|    |-	else
|3625|    |-	{
|    |3624|+	
|3626|3625| 		this.SetNextState("IDLE");
|3627|3626| 
|3628|3627| 		Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3643|3642| 		}
|3644|3643| 
|3645|3644| 		return false;
|3646|    |-	}
|    |3645|+	
|3647|3646| };
|3648|3647| 
|3649|3648| /**
|    | [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
|3660|3660| 	{
|3661|3661| 		this.order = order;
|3662|3662| 		let ret = this.UnitFsm.ProcessMessage(this,
|3663|    |-			{"type": "Order."+this.order.type, "data": this.order.data}
|    |3663|+			{ "type": "Order."+this.order.type, "data": this.order.data}
|3664|3664| 		);
|3665|3665| 
|3666|3666| 		// If the order was rejected then immediately take it off
|    | [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
|3660|3660| 	{
|3661|3661| 		this.order = order;
|3662|3662| 		let ret = this.UnitFsm.ProcessMessage(this,
|3663|    |-			{"type": "Order."+this.order.type, "data": this.order.data}
|    |3663|+			{"type": "Order."+this.order.type, "data": this.order.data }
|3664|3664| 		);
|3665|3665| 
|3666|3666| 		// If the order was rejected then immediately take it off
|    | [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
|3696|3696| 		this.orderQueue.unshift(order);
|3697|3697| 		this.order = order;
|3698|3698| 		let ret = this.UnitFsm.ProcessMessage(this,
|3699|    |-			{"type": "Order."+this.order.type, "data": this.order.data}
|    |3699|+			{ "type": "Order."+this.order.type, "data": this.order.data}
|3700|3700| 		);
|3701|3701| 
|3702|3702| 		// If the order was rejected then immediately take it off again;
|    | [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
|3696|3696| 		this.orderQueue.unshift(order);
|3697|3697| 		this.order = order;
|3698|3698| 		let ret = this.UnitFsm.ProcessMessage(this,
|3699|    |-			{"type": "Order."+this.order.type, "data": this.order.data}
|    |3699|+			{"type": "Order."+this.order.type, "data": this.order.data }
|3700|3700| 		);
|3701|3701| 
|3702|3702| 		// If the order was rejected then immediately take it off again;
|    | [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
|3730|3730| 				continue;
|3731|3731| 			if (this.orderQueue[i].type == type)
|3732|3732| 				continue;
|3733|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3733|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3734|3734| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3735|3735| 			return;
|3736|3736| 		}
|    | [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
|3730|3730| 				continue;
|3731|3731| 			if (this.orderQueue[i].type == type)
|3732|3732| 				continue;
|3733|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3733|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3734|3734| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3735|3735| 			return;
|3736|3736| 		}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3744|3744| {
|3745|3745| 	// Remember the previous work orders to be able to go back to them later if required
|3746|3746| 	if (data && data.force)
|3747|    |-	{
|    |3747|+	
|3748|3748| 		if (this.IsFormationController())
|3749|3749| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3750|3750| 		else
|3751|3751| 			this.UpdateWorkOrders(type);
|3752|    |-	}
|    |3752|+	
|3753|3753| 
|3754|3754| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3755|3755| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3821|3821| 	{
|3822|3822| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3823|3823| 		if (cmpUnitAI)
|3824|    |-		{
|    |3824|+		
|3825|3825| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3826|3826| 			{
|3827|3827| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3830|3830| 					return;
|3831|3831| 				}
|3832|3832| 			}
|3833|    |-		}
|    |3833|+		
|3834|3834| 	}
|3835|3835| 
|3836|3836| 	// 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
|3823|3823| 		if (cmpUnitAI)
|3824|3824| 		{
|3825|3825| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3826|    |-			{
|    |3826|+			
|3827|3827| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3828|3828| 				{
|3829|3829| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3830|3830| 					return;
|3831|3831| 				}
|3832|    |-			}
|    |3832|+			
|3833|3833| 		}
|3834|3834| 	}
|3835|3835| 
|    | [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
|3835|3835| 
|3836|3836| 	// If nothing found, take the unit orders
|3837|3837| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3838|    |-	{
|    |3838|+	
|3839|3839| 		if (isWorkType(this.orderQueue[i].type))
|3840|3840| 		{
|3841|3841| 			this.workOrders = this.orderQueue.slice(i);
|3842|3842| 			return;
|3843|3843| 		}
|3844|    |-	}
|    |3844|+	
|3845|3845| };
|3846|3846| 
|3847|3847| 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
|3901|3901| 	if (data.timerRepeat === undefined)
|3902|3902| 		this.timer = undefined;
|3903|3903| 
|3904|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3904|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3905|3905| };
|3906|3906| 
|3907|3907| /**
|    | [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
|3901|3901| 	if (data.timerRepeat === undefined)
|3902|3902| 		this.timer = undefined;
|3903|3903| 
|3904|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3904|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3905|3905| };
|3906|3906| 
|3907|3907| /**
|    | [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
|3936|3936| 	this.timer = undefined;
|3937|3937| };
|3938|3938| 
|3939|    |-//// Message handlers /////
|    |3939|+// // Message handlers /////
|3940|3940| 
|3941|3941| UnitAI.prototype.OnMotionChanged = function(msg)
|3942|3942| {
|    | [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
|3941|3941| UnitAI.prototype.OnMotionChanged = function(msg)
|3942|3942| {
|3943|3943| 	if (msg.starting && !msg.error)
|3944|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3944|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveStarted", "data": msg});
|3945|3945| 	else if (!msg.starting || msg.error)
|3946|3946| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3947|3947| };
|    | [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
|3941|3941| UnitAI.prototype.OnMotionChanged = function(msg)
|3942|3942| {
|3943|3943| 	if (msg.starting && !msg.error)
|3944|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3944|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg });
|3945|3945| 	else if (!msg.starting || msg.error)
|3946|3946| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3947|3947| };
|    | [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
|3943|3943| 	if (msg.starting && !msg.error)
|3944|3944| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3945|3945| 	else if (!msg.starting || msg.error)
|3946|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3946|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveCompleted", "data": msg});
|3947|3947| };
|3948|3948| 
|3949|3949| 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
|3943|3943| 	if (msg.starting && !msg.error)
|3944|3944| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3945|3945| 	else if (!msg.starting || msg.error)
|3946|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3946|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg });
|3947|3947| };
|3948|3948| 
|3949|3949| 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
|3951|3951| 	// TODO: This is a bit inefficient since every unit listens to every
|3952|3952| 	// construction message - ideally we could scope it to only the one we're building
|3953|3953| 
|3954|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3954|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3955|3955| };
|3956|3956| 
|3957|3957| 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
|3951|3951| 	// TODO: This is a bit inefficient since every unit listens to every
|3952|3952| 	// construction message - ideally we could scope it to only the one we're building
|3953|3953| 
|3954|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3954|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3955|3955| };
|3956|3956| 
|3957|3957| 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
|3976|3976| 
|3977|3977| UnitAI.prototype.OnAttacked = function(msg)
|3978|3978| {
|3979|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3979|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3980|3980| };
|3981|3981| 
|3982|3982| 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
|3976|3976| 
|3977|3977| UnitAI.prototype.OnAttacked = function(msg)
|3978|3978| {
|3979|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3979|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3980|3980| };
|3981|3981| 
|3982|3982| 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
|3981|3981| 
|3982|3982| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3983|3983| {
|3984|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3984|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|3985|3985| };
|3986|3986| 
|3987|3987| 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
|3981|3981| 
|3982|3982| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3983|3983| {
|3984|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3984|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|3985|3985| };
|3986|3986| 
|3987|3987| 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
|3986|3986| 
|3987|3987| UnitAI.prototype.OnHealthChanged = function(msg)
|3988|3988| {
|3989|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3989|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|3990|3990| };
|3991|3991| 
|3992|3992| 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
|3986|3986| 
|3987|3987| UnitAI.prototype.OnHealthChanged = function(msg)
|3988|3988| {
|3989|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3989|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|3990|3990| };
|3991|3991| 
|3992|3992| 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
|3992|3992| UnitAI.prototype.OnRangeUpdate = function(msg)
|3993|3993| {
|3994|3994| 	if (msg.tag == this.losRangeQuery)
|3995|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3995|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|3996|3996| 	else if (msg.tag == this.losHealRangeQuery)
|3997|3997| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3998|3998| };
|    | [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
|3992|3992| UnitAI.prototype.OnRangeUpdate = function(msg)
|3993|3993| {
|3994|3994| 	if (msg.tag == this.losRangeQuery)
|3995|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3995|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|3996|3996| 	else if (msg.tag == this.losHealRangeQuery)
|3997|3997| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3998|3998| };
|    | [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| 	if (msg.tag == this.losRangeQuery)
|3995|3995| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3996|3996| 	else if (msg.tag == this.losHealRangeQuery)
|3997|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3997|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|3998|3998| };
|3999|3999| 
|4000|4000| 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
|3994|3994| 	if (msg.tag == this.losRangeQuery)
|3995|3995| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3996|3996| 	else if (msg.tag == this.losHealRangeQuery)
|3997|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3997|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|3998|3998| };
|3999|3999| 
|4000|4000| 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
|3999|3999| 
|4000|4000| UnitAI.prototype.OnPackFinished = function(msg)
|4001|4001| {
|4002|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4002|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4003|4003| };
|4004|4004| 
|4005|4005| //// 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
|3999|3999| 
|4000|4000| UnitAI.prototype.OnPackFinished = function(msg)
|4001|4001| {
|4002|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4002|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4003|4003| };
|4004|4004| 
|4005|4005| //// 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
|4002|4002| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4003|4003| };
|4004|4004| 
|4005|    |-//// Helper functions to be called by the FSM ////
|    |4005|+// // Helper functions to be called by the FSM ////
|4006|4006| 
|4007|4007| UnitAI.prototype.GetWalkSpeed = function()
|4008|4008| {
|    | [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
|4106|4106| 	if (!cmpOwnership || cmpOwnership.GetOwner() == INVALID_PLAYER)
|4107|4107| 		return undefined;
|4108|4108| 
|4109|    |-	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position)
|    |4109|+	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
|4110|4110| 	if (!cmpPosition || !cmpPosition.IsInWorld())
|4111|4111| 		return undefined;
|4112|4112| 
|    | [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
|4191|4191| 			PlaySound(name, member);
|4192|4192| 	}
|4193|4193| 	else
|4194|    |-	{
|    |4194|+	
|4195|4195| 		// Otherwise use our own sounds
|4196|4196| 		PlaySound(name, this.entity);
|4197|    |-	}
|    |4197|+	
|4198|4198| };
|4199|4199| 
|4200|4200| /*
|    | [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
|4360|4360| 	else
|4361|4361| 		// return false? Or hope you come close enough?
|4362|4362| 		var parabolicMaxRange = 0;
|4363|    |-		//return false;
|    |4363|+		// return false;
|4364|4364| 
|4365|4365| 	// the parabole changes while walking, take something in the middle
|4366|4366| 	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
|4425|4425| 	if (this.IsFormationMember())
|4426|4426| 	{
|4427|4427| 		var cmpFormationUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|4428|    |-		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation()
|4429|    |-			&& cmpFormationUnitAI.order.data.target == target)
|    |4428|+		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation() &&
|    |4429|+			cmpFormationUnitAI.order.data.target == target)
|4430|4430| 			return true;
|4431|4431| 	}
|4432|4432| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4593|4593| UnitAI.prototype.AttackEntityInZone = function(ents)
|4594|4594| {
|4595|4595| 	var target = ents.find(target =>
|4596|    |-		this.CanAttack(target)
|4597|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4596|+		this.CanAttack(target) &&
|    |4597|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4598|4598| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4599|4599| 	);
|4600|4600| 	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
|4594|4594| {
|4595|4595| 	var target = ents.find(target =>
|4596|4596| 		this.CanAttack(target)
|4597|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4598|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4597|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4598|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4599|4599| 	);
|4600|4600| 	if (!target)
|4601|4601| 		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
|4658|4658| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4659|4659| 	if (this.isGuardOf)
|4660|4660| 	{
|4661|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4661|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4662|4662| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4663|4663| 		if (cmpUnitAI && cmpAttack &&
|4664|4664| 		    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
|4662|4662| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4663|4663| 		if (cmpUnitAI && cmpAttack &&
|4664|4664| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4665|    |-				return false;
|    |4665|+			return false;
|4666|4666| 	}
|4667|4667| 
|4668|4668| 	// 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
|4667|4667| 
|4668|4668| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4669|4669| 	if (this.GetStance().respondHoldGround)
|4670|    |-	{
|    |4670|+	
|4671|4671| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4672|4672| 			return true;
|4673|    |-	}
|    |4673|+	
|4674|4674| 
|4675|4675| 	// Stop if it's left our vision range, unless we're especially persistent
|4676|4676| 	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
|4674|4674| 
|4675|4675| 	// Stop if it's left our vision range, unless we're especially persistent
|4676|4676| 	if (!this.GetStance().respondChaseBeyondVision)
|4677|    |-	{
|    |4677|+	
|4678|4678| 		if (!this.CheckTargetIsInVisionRange(target))
|4679|4679| 			return true;
|4680|    |-	}
|    |4680|+	
|4681|4681| 
|4682|4682| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4683|4683| 	// 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
|4705|4705| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4706|4706| 	if (this.isGuardOf)
|4707|4707| 	{
|4708|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4708|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4709|4709| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4710|4710| 		if (cmpUnitAI && cmpAttack &&
|4711|4711| 		    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
|4718|4718| 	return false;
|4719|4719| };
|4720|4720| 
|4721|    |-//// External interface functions ////
|    |4721|+// // External interface functions ////
|4722|4722| 
|4723|4723| UnitAI.prototype.SetFormationController = function(ent)
|4724|4724| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4728|4728| 	// of our own formation (or ourself if not in formation)
|4729|4729| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4730|4730| 	if (cmpObstruction)
|4731|    |-	{
|    |4731|+	
|4732|4732| 		if (ent == INVALID_ENTITY)
|4733|4733| 			cmpObstruction.SetControlGroup(this.entity);
|4734|4734| 		else
|4735|4735| 			cmpObstruction.SetControlGroup(ent);
|4736|    |-	}
|    |4736|+	
|4737|4737| 
|4738|4738| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4739|4739| 	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
|4871|4871| 	// if we already had an old guard order, do nothing if the target is the same
|4872|4872| 	// and the order is running, otherwise remove the previous order
|4873|4873| 	if (this.isGuardOf)
|4874|    |-	{
|    |4874|+	
|4875|4875| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4876|4876| 			return;
|4877|4877| 		else
|4878|4878| 			this.RemoveGuard();
|4879|    |-	}
|    |4879|+	
|4880|4880| 
|4881|4881| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4882|4882| };
|    | [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
|4874|4874| 	{
|4875|4875| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4876|4876| 			return;
|4877|    |-		else
|4878|    |-			this.RemoveGuard();
|    |4877|+		this.RemoveGuard();
|4879|4878| 	}
|4880|4879| 
|4881|4880| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|    | [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
|4916|4916| 		return;
|4917|4917| 
|4918|4918| 	if (this.order.type == "Guard")
|4919|    |-		this.UnitFsm.ProcessMessage(this, {"type": "RemoveGuard"});
|    |4919|+		this.UnitFsm.ProcessMessage(this, { "type": "RemoveGuard"});
|4920|4920| 	else
|4921|4921| 		for (let i = 1; i < this.orderQueue.length; ++i)
|4922|4922| 			if (this.orderQueue[i].type == "Guard")
|    | [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
|4916|4916| 		return;
|4917|4917| 
|4918|4918| 	if (this.order.type == "Guard")
|4919|    |-		this.UnitFsm.ProcessMessage(this, {"type": "RemoveGuard"});
|    |4919|+		this.UnitFsm.ProcessMessage(this, {"type": "RemoveGuard" });
|4920|4920| 	else
|4921|4921| 		for (let i = 1; i < this.orderQueue.length; ++i)
|4922|4922| 			if (this.orderQueue[i].type == "Guard")
|    | [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
|5045|5045| 			this.WalkToTarget(target, queued);
|5046|5046| 		return;
|5047|5047| 	}
|5048|    |-	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture}, queued);
|    |5048|+	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture }, queued);
|5049|5049| };
|5050|5050| 
|5051|5051| /**
|    | [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
|5194|5194| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5195|5195| 	{
|5196|5196| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5197|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5197|+		if (cmpTrader.HasBothMarkets() &&
|5198|5198| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5199|5199| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5200|5200| 		{
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5475|5475| 				{
|5476|5476| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5477|5477| 					var targetClasses = this.order.data.targetClasses;
|5478|    |-					if (targetClasses.attack && cmpIdentity
|5479|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5478|+					if (targetClasses.attack && cmpIdentity &&
|    |5479|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5480|5480| 						continue;
|5481|5481| 					if (targetClasses.avoid && cmpIdentity
|5482|5482| 						&& 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
|5478|5478| 					if (targetClasses.attack && cmpIdentity
|5479|5479| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5480|5480| 						continue;
|5481|    |-					if (targetClasses.avoid && cmpIdentity
|5482|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5481|+					if (targetClasses.avoid && cmpIdentity &&
|    |5482|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5483|5483| 						continue;
|5484|5484| 					// Only used by the AIs to prevent some choices of targets
|5485|5485| 					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
|5501|5501| 		{
|5502|5502| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5503|5503| 			var targetClasses = this.order.data.targetClasses;
|5504|    |-			if (cmpIdentity && targetClasses.attack
|5505|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5504|+			if (cmpIdentity && targetClasses.attack &&
|    |5505|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5506|5506| 				continue;
|5507|5507| 			if (cmpIdentity && targetClasses.avoid
|5508|5508| 				&& 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
|5504|5504| 			if (cmpIdentity && targetClasses.attack
|5505|5505| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5506|5506| 				continue;
|5507|    |-			if (cmpIdentity && targetClasses.avoid
|5508|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5507|+			if (cmpIdentity && targetClasses.avoid &&
|    |5508|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5509|5509| 				continue;
|5510|5510| 			// Only used by the AIs to prevent some choices of targets
|5511|5511| 			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
|5637|5637| 
|5638|5638| UnitAI.prototype.SetHeldPosition = function(x, z)
|5639|5639| {
|5640|    |-	this.heldPosition = {"x": x, "z": z};
|    |5640|+	this.heldPosition = { "x": x, "z": z};
|5641|5641| };
|5642|5642| 
|5643|5643| 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
|5637|5637| 
|5638|5638| UnitAI.prototype.SetHeldPosition = function(x, z)
|5639|5639| {
|5640|    |-	this.heldPosition = {"x": x, "z": z};
|    |5640|+	this.heldPosition = {"x": x, "z": z };
|5641|5641| };
|5642|5642| 
|5643|5643| 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
|5664|5664| 	return false;
|5665|5665| };
|5666|5666| 
|5667|    |-//// Helper functions ////
|    |5667|+// // Helper functions ////
|5668|5668| 
|5669|5669| UnitAI.prototype.CanAttack = function(target)
|5670|5670| {
|    | [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
|5868|5868| 	return (cmpPack && cmpPack.IsPacking());
|5869|5869| };
|5870|5870| 
|5871|    |-//// Formation specific functions ////
|    |5871|+// // Formation specific functions ////
|5872|5872| 
|5873|5873| UnitAI.prototype.IsAttackingAsFormation = function()
|5874|5874| {
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5873|5873| UnitAI.prototype.IsAttackingAsFormation = function()
|5874|5874| {
|5875|5875| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5876|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5877|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5876|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5877|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5878|5878| };
|5879|5879| 
|5880|5880| //// 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
|5877|5877| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5878|5878| };
|5879|5879| 
|5880|    |-//// Animal specific functions ////
|    |5880|+// // Animal specific functions ////
|5881|5881| 
|5882|5882| UnitAI.prototype.MoveRandomly = function(distance)
|5883|5883| {

binaries/data/mods/public/simulation/components/UnitAI.js
|2435| »   »   »   »   »   »   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
|3806| »   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
|4580| »   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
|4595| »   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
|4641| »   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
|4664| »   »   ····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
|5125| »   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
| 369| »   »   ····&&·(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
|1910| »   »   »   »   »   »   var·cmpFormation·=·Engine.QueryInterface(this.formationController,·IID_Formation);
|    | [NORMAL] JSHintBear:
|    | 'cmpFormation' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|2044| »   »   »   »   »   »   &&·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
|2128| »   »   »   »   »   »   »   »   ·&&·((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
|2129| »   »   »   »   »   »   »   »   ·||·(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
|2130| »   »   »   »   »   »   »   »   ·&&·(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
|2153| »   »   »   »   »   »   »   »   var·nearby·=·this.FindNearestDropsite(oldType.generic);
|    | [NORMAL] JSHintBear:
|    | 'nearby' is already defined.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4373| »   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
|4429| »   »   »   &&·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
|4597| »   »   &&·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
|4598| »   »   &&·(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
|5125| »   var·lastPos·=·undefined;
|    | [NORMAL] JSHintBear:
|    | It's not necessary to initialize 'lastPos' to 'undefined'.

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

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

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

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

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

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

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

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

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

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

temple accepted this revision.Mar 20 2018, 5:26 PM
temple added a subscriber: temple.

Tests correct. Can't see why units waiting to be destroyed would need to process any new orders, so it looks good.

binaries/data/mods/public/simulation/components/UnitAI.js
3591–3592 ↗(On Diff #6226)

something garrison too

This revision is now accepted and ready to land.Mar 20 2018, 5:26 PM
bb added a subscriber: bb.Mar 20 2018, 5:28 PM

(Still thinking "moving out of range if killed" is a hack as noticed in that old revision meh)

mimo added a comment.Mar 20 2018, 6:57 PM
In D1406#57692, @bb wrote:

(Still thinking "moving out of range if killed" is a hack as noticed in that old revision meh)

I've no strong opinions about it and anyway, this infinite loop has to be fixed for a23.

binaries/data/mods/public/simulation/components/UnitAI.js
3591–3592 ↗(On Diff #6226)

yes, will add it when committing (+ some fixes to lint warnings in that function)

This revision was automatically updated to reflect the committed changes.