Page MenuHomeWildfire Games

fix packing problems reported in rP21630
AbandonedPublic

Authored by mimo on Apr 18 2018, 5:50 PM.

Details

Reviewers
None
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Commits
rP21786: really fix packing problems reported in rP21630
Summary

I agree with temple proposition in rP21630 (switching the order of the standground check and the pack), but there is still a problem for packing units in attack-move order. The problem is that currently, attack orders from an attack-move are considered as forced, while it would be consistent with the rest of the code that they are not. Currently a unit which has stopped its attack-move to attack a unit will try to chase it while it can't because of its stance.
I see no reason why attack-move sub-orders should be forced, and i guess it was like that only to allow packed units to be able to pack/unpack. But now that this is changed, attack-move should also be changed.

Test Plan

Check that there are no side-effect of the patch with attack-move.

Diff Detail

Repository
rP 0 A.D. Public Repository
Branch
/ps/trunk
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 5909
Build 9870: Vulcan BuildJenkins
Build 9869: arc lint + arc unit

Event Timeline

mimo created this revision.Apr 18 2018, 5:50 PM
Vulcan added a subscriber: Vulcan.Apr 18 2018, 6:50 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
| 228| 228| 		// Move a tile outside the building
| 229| 229| 		let range = 4;
| 230| 230| 		if (this.MoveToTargetRangeExplicit(msg.data.target, range, range))
| 231|    |-		{
|    | 231|+		
| 232| 232| 			// We've started walking to the given point
| 233| 233| 			this.SetNextState("INDIVIDUAL.WALKING");
| 234|    |-		}
|    | 234|+		
| 235| 235| 		else
| 236| 236| 		{
| 237| 237| 			// 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
| 233| 233| 			this.SetNextState("INDIVIDUAL.WALKING");
| 234| 234| 		}
| 235| 235| 		else
| 236|    |-		{
|    | 236|+		
| 237| 237| 			// We are already at the target, or can't move at all
| 238| 238| 			this.FinishOrder();
| 239|    |-		}
|    | 239|+		
| 240| 240| 	},
| 241| 241| 
| 242| 242| 	// 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
| 335| 335| 
| 336| 336| 		var ok = this.MoveToTarget(this.order.data.target);
| 337| 337| 		if (ok)
| 338|    |-		{
|    | 338|+		
| 339| 339| 			// We've started walking to the given point
| 340| 340| 			if (this.IsAnimal())
| 341| 341| 				this.SetNextState("ANIMAL.WALKING");
| 342| 342| 			else
| 343| 343| 				this.SetNextState("INDIVIDUAL.WALKING");
| 344|    |-		}
|    | 344|+		
| 345| 345| 		else
| 346| 346| 		{
| 347| 347| 			// 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
| 363| 363| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 364| 364| 		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 365| 365| 		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 366|    |-		{
|    | 366|+		
| 367| 367| 			// we were already on the shoreline, and have not moved since
| 368| 368| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
| 369| 369| 				needToMove = false;
| 370|    |-		}
|    | 370|+		
| 371| 371| 
| 372| 372| 		// TODO: what if the units are on a cliff ? the ship will go below the cliff
| 373| 373| 		// 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
| 361| 361| 		// Check if we need to move     TODO implement a better way to know if we are on the shoreline
| 362| 362| 		var needToMove = true;
| 363| 363| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 364|    |-		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 365|    |-		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
|    | 364|+		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x) &&
|    | 365|+		    (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 366| 366| 		{
| 367| 367| 			// we were already on the shoreline, and have not moved since
| 368| 368| 			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
| 372| 372| 		// TODO: what if the units are on a cliff ? the ship will go below the cliff
| 373| 373| 		// and the units won't be able to garrison. Should go to the nearest (accessible) shore
| 374| 374| 		if (needToMove && this.MoveToTarget(this.order.data.target))
| 375|    |-		{
|    | 375|+		
| 376| 376| 			this.SetNextState("INDIVIDUAL.PICKUP.APPROACHING");
| 377|    |-		}
|    | 377|+		
| 378| 378| 		else
| 379| 379| 		{
| 380| 380| 			// 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
| 401| 401| 		var distance = DistanceBetweenEntities(this.entity, this.order.data.target) + (+this.template.FleeDistance);
| 402| 402| 		var cmpUnitMotion = Engine.QueryInterface(this.entity, IID_UnitMotion);
| 403| 403| 		if (cmpUnitMotion.MoveToTargetRange(this.order.data.target, distance, -1))
| 404|    |-		{
|    | 404|+		
| 405| 405| 			// We've started fleeing from the given target
| 406| 406| 			if (this.IsAnimal())
| 407| 407| 				this.SetNextState("ANIMAL.FLEEING");
| 408| 408| 			else
| 409| 409| 				this.SetNextState("INDIVIDUAL.FLEEING");
| 410|    |-		}
|    | 410|+		
| 411| 411| 		else
| 412| 412| 		{
| 413| 413| 			// 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
| 448| 448| 			}
| 449| 449| 
| 450| 450| 			if (this.order.data.attackType == this.oldAttackType)
| 451|    |-			{
|    | 451|+			
| 452| 452| 				if (this.IsAnimal())
| 453| 453| 					this.SetNextState("ANIMAL.COMBAT.ATTACKING");
| 454| 454| 				else
| 455| 455| 					this.SetNextState("INDIVIDUAL.COMBAT.ATTACKING");
| 456|    |-			}
|    | 456|+			
| 457| 457| 			else
| 458| 458| 			{
| 459| 459| 				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
| 455| 455| 					this.SetNextState("INDIVIDUAL.COMBAT.ATTACKING");
| 456| 456| 			}
| 457| 457| 			else
| 458|    |-			{
|    | 458|+			
| 459| 459| 				if (this.IsAnimal())
| 460| 460| 					this.SetNextStateAlwaysEntering("ANIMAL.COMBAT.ATTACKING");
| 461| 461| 				else
| 462| 462| 					this.SetNextStateAlwaysEntering("INDIVIDUAL.COMBAT.ATTACKING");
| 463|    |-			}
|    | 463|+			
| 464| 464| 			return;
| 465| 465| 		}
| 466| 466| 
|    | [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
| 580| 580| 					this.PushOrderFront("Walk", this.order.data.lastPos);
| 581| 581| 				}
| 582| 582| 				else
| 583|    |-				{
|    | 583|+				
| 584| 584| 					// We couldn't move there, or the target moved away
| 585| 585| 					this.FinishOrder();
| 586|    |-				}
|    | 586|+				
| 587| 587| 				return;
| 588| 588| 			}
| 589| 589| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 593| 593| 
| 594| 594| 		// Try to move within range
| 595| 595| 		if (this.MoveToTargetRange(this.order.data.target, IID_ResourceGatherer))
| 596|    |-		{
|    | 596|+		
| 597| 597| 			// We've started walking to the given point
| 598| 598| 			this.SetNextState("INDIVIDUAL.GATHER.APPROACHING");
| 599|    |-		}
|    | 599|+		
| 600| 600| 		else
| 601| 601| 		{
| 602| 602| 			// 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
| 670| 670| 	"Order.Repair": function(msg) {
| 671| 671| 		// Try to move within range
| 672| 672| 		if (this.MoveToTargetRange(this.order.data.target, IID_Builder))
| 673|    |-		{
|    | 673|+		
| 674| 674| 			// We've started walking to the given point
| 675| 675| 			this.SetNextState("INDIVIDUAL.REPAIR.APPROACHING");
| 676|    |-		}
|    | 676|+		
| 677| 677| 		else
| 678| 678| 		{
| 679| 679| 			// 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
| 706| 706| 		}
| 707| 707| 
| 708| 708| 		if (this.MoveToGarrisonRange(this.order.data.target))
| 709|    |-		{
|    | 709|+		
| 710| 710| 			this.SetNextState("INDIVIDUAL.GARRISON.APPROACHING");
| 711|    |-		}
|    | 711|+		
| 712| 712| 		else
| 713| 713| 		{
| 714| 714| 			// 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
| 834| 834| 			if (!this.CheckTargetAttackRange(target, target))
| 835| 835| 			{
| 836| 836| 				if (this.TargetIsAlive(target) && this.CheckTargetVisible(target))
| 837|    |-				{
|    | 837|+				
| 838| 838| 					if (this.MoveToTargetAttackRange(target, target))
| 839| 839| 					{
| 840| 840| 						this.SetNextState("COMBAT.APPROACHING");
| 841| 841| 						return;
| 842| 842| 					}
| 843|    |-				}
|    | 843|+				
| 844| 844| 				this.FinishOrder();
| 845| 845| 				return;
| 846| 846| 			}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 859| 859| 			}
| 860| 860| 			// Check if we are already in range, otherwise walk there
| 861| 861| 			if (!this.CheckGarrisonRange(msg.data.target))
| 862|    |-			{
|    | 862|+			
| 863| 863| 				if (!this.CheckTargetVisible(msg.data.target))
| 864| 864| 				{
| 865| 865| 					this.FinishOrder();
| 874| 874| 						return;
| 875| 875| 					}
| 876| 876| 				}
| 877|    |-			}
|    | 877|+			
| 878| 878| 
| 879| 879| 			this.SetNextState("GARRISON.GARRISONING");
| 880| 880| 		},
|    | [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
| 866| 866| 					return;
| 867| 867| 				}
| 868| 868| 				else
| 869|    |-				{
|    | 869|+				
| 870| 870| 					// Out of range; move there in formation
| 871| 871| 					if (this.MoveToGarrisonRange(msg.data.target))
| 872| 872| 					{
| 873| 873| 						this.SetNextState("GARRISON.APPROACHING");
| 874| 874| 						return;
| 875| 875| 					}
| 876|    |-				}
|    | 876|+				
| 877| 877| 			}
| 878| 878| 
| 879| 879| 			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
| 865| 865| 					this.FinishOrder();
| 866| 866| 					return;
| 867| 867| 				}
| 868|    |-				else
| 869|    |-				{
|    | 868|+				
| 870| 869| 					// Out of range; move there in formation
| 871| 870| 					if (this.MoveToGarrisonRange(msg.data.target))
| 872| 871| 					{
| 873| 872| 						this.SetNextState("GARRISON.APPROACHING");
| 874| 873| 						return;
| 875| 874| 					}
| 876|    |-				}
|    | 875|+				
| 877| 876| 			}
| 878| 877| 
| 879| 878| 			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
| 892| 892| 						this.PushOrderFront("Walk", msg.data.lastPos);
| 893| 893| 					}
| 894| 894| 					else
| 895|    |-					{
|    | 895|+					
| 896| 896| 						// We couldn't move there, or the target moved away
| 897| 897| 						this.FinishOrder();
| 898|    |-					}
|    | 898|+					
| 899| 899| 					return;
| 900| 900| 				}
| 901| 901| 
|    | [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
|1113|1113| 			},
|1114|1114| 		},
|1115|1115| 
|1116|    |-		"GARRISON":{
|    |1116|+		"GARRISON": {
|1117|1117| 			"enter": function() {
|1118|1118| 				// If the garrisonholder should pickup, warn it so it can take needed action
|1119|1119| 				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
|1297|1297| 			// If the controller handled an order but some members rejected it,
|1298|1298| 			// they will have no orders and be in the FORMATIONMEMBER.IDLE state.
|1299|1299| 			if (this.orderQueue.length)
|1300|    |-			{
|    |1300|+			
|1301|1301| 				// We're leaving the formation, so stop our FormationWalk order
|1302|1302| 				if (this.FinishOrder())
|1303|1303| 					return;
|1304|    |-			}
|    |1304|+			
|1305|1305| 
|1306|1306| 			// No orders left, we're an individual now
|1307|1307| 			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
|1325|1325| 			// Move a tile outside the building
|1326|1326| 			let range = 4;
|1327|1327| 			if (this.MoveToTargetRangeExplicit(msg.data.target, range, range))
|1328|    |-			{
|    |1328|+			
|1329|1329| 				// We've started walking to the given point
|1330|1330| 				this.SetNextState("WALKINGTOPOINT");
|1331|    |-			}
|    |1331|+			
|1332|1332| 			else
|1333|1333| 			{
|1334|1334| 				// 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
|1330|1330| 				this.SetNextState("WALKINGTOPOINT");
|1331|1331| 			}
|1332|1332| 			else
|1333|    |-			{
|    |1333|+			
|1334|1334| 				// We are already at the target, or can't move at all
|1335|1335| 				this.FinishOrder();
|1336|    |-			}
|    |1336|+			
|1337|1337| 		},
|1338|1338| 
|1339|1339| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1531|1531| 
|1532|1532| 			"LosRangeUpdate": function(msg) {
|1533|1533| 				if (this.GetStance().targetVisibleEnemies)
|1534|    |-				{
|    |1534|+				
|1535|1535| 					// Start attacking one of the newly-seen enemy (if any)
|1536|1536| 					this.AttackEntitiesByPreference(msg.data.added);
|1537|    |-				}
|    |1537|+				
|1538|1538| 			},
|1539|1539| 
|1540|1540| 			"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
|1717|1717| 						// if nothing better to do, check if the guarded needs to be healed or repaired
|1718|1718| 						var cmpHealth = Engine.QueryInterface(this.isGuardOf, IID_Health);
|1719|1719| 						if (cmpHealth && (cmpHealth.GetHitpoints() < cmpHealth.GetMaxHitpoints()))
|1720|    |-						{
|    |1720|+						
|1721|1721| 							if (this.CanHeal(this.isGuardOf))
|1722|1722| 								this.PushOrderFront("Heal", { "target": this.isGuardOf, "force": false });
|1723|1723| 							else if (this.CanRepair(this.isGuardOf))
|1724|1724| 								this.PushOrderFront("Repair", { "target": this.isGuardOf, "autocontinue": false, "force": false });
|1725|    |-						}
|    |1725|+						
|1726|1726| 					}
|1727|1727| 				},
|1728|1728| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1805|1805| 				"MoveCompleted": function() {
|1806|1806| 
|1807|1807| 					if (this.CheckTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1808|    |-					{
|    |1808|+					
|1809|1809| 						// If the unit needs to unpack, do so
|1810|1810| 						if (this.CanUnpack())
|1811|1811| 						{
|1814|1814| 						}
|1815|1815| 						else
|1816|1816| 							this.SetNextState("ATTACKING");
|1817|    |-					}
|    |1817|+					
|1818|1818| 					else
|1819|1819| 					{
|1820|1820| 						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
|1812|1812| 							this.PushOrderFront("Unpack", { "force": true });
|1813|1813| 							return;
|1814|1814| 						}
|1815|    |-						else
|1816|    |-							this.SetNextState("ATTACKING");
|    |1815|+						this.SetNextState("ATTACKING");
|1817|1816| 					}
|1818|1817| 					else
|1819|1818| 					{
|    | [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
|1816|1816| 							this.SetNextState("ATTACKING");
|1817|1817| 					}
|1818|1818| 					else
|1819|    |-					{
|    |1819|+					
|1820|1820| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1821|1821| 						{
|1822|1822| 							this.SetNextState("APPROACHING");
|1826|1826| 							// Give up
|1827|1827| 							this.FinishOrder();
|1828|1828| 						}
|1829|    |-					}
|    |1829|+					
|1830|1830| 				},
|1831|1831| 			},
|1832|1832| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1818|1818| 					else
|1819|1819| 					{
|1820|1820| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1821|    |-						{
|    |1821|+						
|1822|1822| 							this.SetNextState("APPROACHING");
|1823|    |-						}
|    |1823|+						
|1824|1824| 						else
|1825|1825| 						{
|1826|1826| 							// 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
|1822|1822| 							this.SetNextState("APPROACHING");
|1823|1823| 						}
|1824|1824| 						else
|1825|    |-						{
|    |1825|+						
|1826|1826| 							// Give up
|1827|1827| 							this.FinishOrder();
|1828|    |-						}
|    |1828|+						
|1829|1829| 					}
|1830|1830| 				},
|1831|1831| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1843|1843| 					}
|1844|1844| 					// Check the target is still alive and attackable
|1845|1845| 					if (this.CanAttack(target) && !this.CheckTargetAttackRange(target, this.order.data.attackType))
|1846|    |-					{
|    |1846|+					
|1847|1847| 						// Can't reach it - try to chase after it
|1848|1848| 						if (this.ShouldChaseTargetedEntity(target, this.order.data.force))
|1849|1849| 						{
|1853|1853| 								return;
|1854|1854| 							}
|1855|1855| 						}
|1856|    |-					}
|    |1856|+					
|1857|1857| 
|1858|1858| 					var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|1859|1859| 					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
|1846|1846| 					{
|1847|1847| 						// Can't reach it - try to chase after it
|1848|1848| 						if (this.ShouldChaseTargetedEntity(target, this.order.data.force))
|1849|    |-						{
|    |1849|+						
|1850|1850| 							if (this.MoveToTargetAttackRange(target, this.order.data.attackType))
|1851|1851| 							{
|1852|1852| 								this.SetNextState("COMBAT.CHASING");
|1853|1853| 								return;
|1854|1854| 							}
|1855|    |-						}
|    |1855|+						
|1856|1856| 					}
|1857|1857| 
|1858|1858| 					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
|1884|1884| 					// TODO: we should probably only bother syncing projectile attacks, not melee
|1885|1885| 
|1886|1886| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|1887|    |-					this.resyncAnimation = (prepare != this.attackTimers.prepare) ? true : false;
|    |1887|+					this.resyncAnimation = (prepare != this.attackTimers.prepare);
|1888|1888| 
|1889|1889| 					this.FaceTowardsTarget(this.order.data.target);
|1890|1890| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1959|1959| 
|1960|1960| 						// Can't reach it - try to chase after it
|1961|1961| 						if (this.ShouldChaseTargetedEntity(target, this.order.data.force))
|1962|    |-						{
|    |1962|+						
|1963|1963| 							if (this.MoveToTargetRange(target, IID_Attack, this.order.data.attackType))
|1964|1964| 							{
|1965|1965| 								this.SetNextState("COMBAT.CHASING");
|1966|1966| 								return;
|1967|1967| 							}
|1968|    |-						}
|    |1968|+						
|1969|1969| 					}
|1970|1970| 
|1971|1971| 					// 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
|2008|2008| 
|2009|2009| 				"Attacked": function(msg) {
|2010|2010| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2011|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2012|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2011|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2012|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2013|2013| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2014|2014| 				},
|2015|2015| 			},
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2092|2092| 						// Also don't switch to a different type of huntable animal
|2093|2093| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2094|2094| 							return (
|2095|    |-								ent != oldTarget
|2096|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2095|+								ent != oldTarget &&
|    |2096|+								 ((type.generic == "treasure" && oldType.generic == "treasure")
|2097|2097| 								 || (type.specific == oldType.specific
|2098|2098| 								 && (type.specific != "meat" || oldTemplate == template)))
|2099|2099| 							);
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2093|2093| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2094|2094| 							return (
|2095|2095| 								ent != oldTarget
|2096|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2097|    |-								 || (type.specific == oldType.specific
|    |2096|+								 && ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2097|+								 (type.specific == oldType.specific
|2098|2098| 								 && (type.specific != "meat" || oldTemplate == template)))
|2099|2099| 							);
|2100|2100| 						}, 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
|2094|2094| 							return (
|2095|2095| 								ent != oldTarget
|2096|2096| 								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2097|    |-								 || (type.specific == oldType.specific
|2098|    |-								 && (type.specific != "meat" || oldTemplate == template)))
|    |2097|+								 || (type.specific == oldType.specific &&
|    |2098|+								 (type.specific != "meat" || oldTemplate == template)))
|2099|2099| 							);
|2100|2100| 						}, oldTarget);
|2101|2101| 						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
|2103|2103| 							this.PerformGather(nearby, false, false);
|2104|2104| 							return true;
|2105|2105| 						}
|2106|    |-						else
|2107|    |-						{
|    |2106|+						
|2108|2107| 							// It's probably better in this case, to avoid units getting stuck around a dropsite
|2109|2108| 							// in a "Target is far away, full, nearby are no good resources, return to dropsite" loop
|2110|2109| 							// to order it to GatherNear the resource position.
|2125|2124| 									return true;
|2126|2125| 								}
|2127|2126| 							}
|2128|    |-						}
|    |2127|+						
|2129|2128| 						return true;
|2130|2129| 					}
|2131|2130| 					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
|2115|2115| 								this.GatherNearPosition(pos.x, pos.z, oldType, oldTemplate);
|2116|2116| 								return true;
|2117|2117| 							}
|2118|    |-							else
|2119|    |-							{
|    |2118|+							
|2120|2119| 								// we're kind of stuck here. Return resource.
|2121|2120| 								var nearby = this.FindNearestDropsite(oldType.generic);
|2122|2121| 								if (nearby)
|2124|2123| 									this.PushOrderFront("ReturnResource", { "target": nearby, "force": false });
|2125|2124| 									return true;
|2126|2125| 								}
|2127|    |-							}
|    |2126|+							
|2128|2127| 						}
|2129|2128| 						return true;
|2130|2129| 					}
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2157|2157| 						// Also don't switch to a different type of huntable animal
|2158|2158| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2159|2159| 							return (
|2160|    |-								ent != oldTarget
|2161|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2160|+								ent != oldTarget &&
|    |2161|+								((type.generic == "treasure" && oldType.generic == "treasure")
|2162|2162| 								|| (type.specific == oldType.specific
|2163|2163| 								&& (type.specific != "meat" || oldTemplate == template)))
|2164|2164| 							);
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2158|2158| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2159|2159| 							return (
|2160|2160| 								ent != oldTarget
|2161|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2162|    |-								|| (type.specific == oldType.specific
|    |2161|+								&& ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2162|+								(type.specific == oldType.specific
|2163|2163| 								&& (type.specific != "meat" || oldTemplate == template)))
|2164|2164| 							);
|2165|2165| 						});
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2159|2159| 							return (
|2160|2160| 								ent != oldTarget
|2161|2161| 								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2162|    |-								|| (type.specific == oldType.specific
|2163|    |-								&& (type.specific != "meat" || oldTemplate == template)))
|    |2162|+								|| (type.specific == oldType.specific &&
|    |2163|+								(type.specific != "meat" || oldTemplate == template)))
|2164|2164| 							);
|2165|2165| 						});
|2166|2166| 						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
|2204|2204| 					// Also don't switch to a different type of huntable animal
|2205|2205| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2206|2206| 						return (
|2207|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2208|    |-							|| (type.specific == resourceType.specific
|    |2207|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2208|+							(type.specific == resourceType.specific
|2209|2209| 							&& (type.specific != "meat" || resourceTemplate == template))
|2210|2210| 						);
|2211|2211| 					});
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2205|2205| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2206|2206| 						return (
|2207|2207| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2208|    |-							|| (type.specific == resourceType.specific
|2209|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2208|+							|| (type.specific == resourceType.specific &&
|    |2209|+							(type.specific != "meat" || resourceTemplate == template))
|2210|2210| 						);
|2211|2211| 					});
|2212|2212| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2321|2321| 
|2322|2322| 					var cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply);
|2323|2323| 					if (cmpSupply && cmpSupply.IsAvailable(cmpOwnership.GetOwner(), this.entity))
|2324|    |-					{
|    |2324|+					
|2325|2325| 						// Check we can still reach and gather from the target
|2326|2326| 						if (this.CheckTargetRange(this.gatheringTarget, IID_ResourceGatherer) && this.CanGather(this.gatheringTarget))
|2327|2327| 						{
|2387|2387| 								return;
|2388|2388| 							}
|2389|2389| 						}
|2390|    |-					}
|    |2390|+					
|2391|2391| 
|2392|2392| 					// We're already in range, can't get anywhere near it or the target is exhausted.
|2393|2393| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2413|2413| 					// Also don't switch to a different type of huntable animal
|2414|2414| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2415|2415| 						return (
|2416|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2417|    |-							|| (type.specific == resourceType.specific
|    |2416|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2417|+							(type.specific == resourceType.specific
|2418|2418| 							&& (type.specific != "meat" || resourceTemplate == template))
|2419|2419| 						);
|2420|2420| 					});
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2414|2414| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2415|2415| 						return (
|2416|2416| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2417|    |-							|| (type.specific == resourceType.specific
|2418|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2417|+							|| (type.specific == resourceType.specific &&
|    |2418|+							(type.specific != "meat" || resourceTemplate == template))
|2419|2419| 						);
|2420|2420| 					});
|2421|2421| 					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
|2501|2501| 					this.StartTimer(prepare, this.healTimers.repeat);
|2502|2502| 
|2503|2503| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2504|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2504|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2505|2505| 
|2506|2506| 					this.FaceTowardsTarget(this.order.data.target);
|2507|2507| 				},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2534|2534| 						}
|2535|2535| 						// Can't reach it - try to chase after it
|2536|2536| 						if (this.ShouldChaseTargetedEntity(target, this.order.data.force))
|2537|    |-						{
|    |2537|+						
|2538|2538| 							if (this.MoveToTargetRange(target, IID_Heal))
|2539|2539| 							{
|2540|2540| 								this.SetNextState("HEAL.CHASING");
|2541|2541| 								return;
|2542|2542| 							}
|2543|    |-						}
|    |2543|+						
|2544|2544| 					}
|2545|2545| 					// Can't reach it, healed to max hp or doesn't exist any more - give up
|2546|2546| 					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
|2711|2711| 					{
|2712|2712| 						// The building was already finished/fully repaired before we arrived;
|2713|2713| 						// let the ConstructionFinished handler handle this.
|2714|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2714|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2715|2715| 						return true;
|2716|2716| 					}
|2717|2717| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2711|2711| 					{
|2712|2712| 						// The building was already finished/fully repaired before we arrived;
|2713|2713| 						// let the ConstructionFinished handler handle this.
|2714|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2714|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2715|2715| 						return true;
|2716|2716| 					}
|2717|2717| 
|    | [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
|2751|2751| 					if (this.MoveToTargetRange(this.repairTarget, IID_Builder))
|2752|2752| 						this.SetNextState("APPROACHING");
|2753|2753| 					else if (!this.CheckTargetRange(this.repairTarget, IID_Builder))
|2754|    |-						this.FinishOrder(); //can't approach and isn't in reach
|    |2754|+						this.FinishOrder(); // can't approach and isn't in reach
|2755|2755| 				},
|2756|2756| 			},
|2757|2757| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2838|2838| 
|2839|2839| 				// Unit was approaching and there's nothing to do now, so switch to walking
|2840|2840| 				if (oldState === "INDIVIDUAL.REPAIR.APPROACHING")
|2841|    |-				{
|    |2841|+				
|2842|2842| 					// We're already walking to the given point, so add this as a order.
|2843|2843| 					this.WalkToTarget(msg.data.newentity, true);
|2844|    |-				}
|    |2844|+				
|2845|2845| 			},
|2846|2846| 		},
|2847|2847| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2891|2891| 
|2892|2892| 					// Check that we can garrison here
|2893|2893| 					if (this.CanGarrison(target))
|2894|    |-					{
|    |2894|+					
|2895|2895| 						// Check that we're in range of the garrison target
|2896|2896| 						if (this.CheckGarrisonRange(target))
|2897|2897| 						{
|2967|2967| 								return false;
|2968|2968| 							}
|2969|2969| 						}
|2970|    |-					}
|    |2970|+					
|2971|2971| 					// Garrisoning failed for some reason, so finish the order
|2972|2972| 					this.FinishOrder();
|2973|2973| 					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
|3074|3074| 		"Attacked": function(msg) {
|3075|3075| 			if (this.template.NaturalBehaviour == "skittish" ||
|3076|3076| 			    this.template.NaturalBehaviour == "passive")
|3077|    |-			{
|    |3077|+			
|3078|3078| 				this.Flee(msg.data.attacker, false);
|3079|    |-			}
|    |3079|+			
|3080|3080| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|3081|3081| 			{
|3082|3082| 				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
|3083|3083| 					this.Attack(msg.data.attacker, false);
|3084|3084| 			}
|3085|3085| 			else if (this.template.NaturalBehaviour == "domestic")
|3086|    |-			{
|    |3086|+			
|3087|3087| 				// Never flee, stop what we were doing
|3088|3088| 				this.SetNextState("IDLE");
|3089|    |-			}
|    |3089|+			
|3090|3090| 		},
|3091|3091| 
|3092|3092| 		"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
|3093|3093| 			// Move a tile outside the building
|3094|3094| 			var range = 4;
|3095|3095| 			if (this.MoveToTargetRangeExplicit(msg.data.target, range, range))
|3096|    |-			{
|    |3096|+			
|3097|3097| 				// We've started walking to the given point
|3098|3098| 				this.SetNextState("WALKING");
|3099|    |-			}
|    |3099|+			
|3100|3100| 			else
|3101|3101| 			{
|3102|3102| 				// 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
|3098|3098| 				this.SetNextState("WALKING");
|3099|3099| 			}
|3100|3100| 			else
|3101|    |-			{
|    |3101|+			
|3102|3102| 				// We are already at the target, or can't move at all
|3103|3103| 				this.FinishOrder();
|3104|    |-			}
|    |3104|+			
|3105|3105| 		},
|3106|3106| 
|3107|3107| 		"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
|3140|3140| 				}
|3141|3141| 				// Start attacking one of the newly-seen enemy (if any)
|3142|3142| 				else if (this.IsDangerousAnimal())
|3143|    |-				{
|    |3143|+				
|3144|3144| 					this.AttackVisibleEntity(msg.data.added);
|3145|    |-				}
|    |3145|+				
|3146|3146| 
|3147|3147| 				// TODO: if two units enter our range together, we'll attack the
|3148|3148| 				// 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
|3183|3183| 				}
|3184|3184| 				// Start attacking one of the newly-seen enemy (if any)
|3185|3185| 				else if (this.template.NaturalBehaviour == "violent")
|3186|    |-				{
|    |3186|+				
|3187|3187| 					this.AttackVisibleEntity(msg.data.added);
|3188|    |-				}
|    |3188|+				
|3189|3189| 			},
|3190|3190| 
|3191|3191| 			"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
|3200|3200| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3201|3201| 
|3202|3202| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3203|    |-							// only used for domestic animals
|    |3203|+		// only used for domestic animals
|3204|3204| 	},
|3205|3205| };
|3206|3206| 
|    | [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
|3257|3257| 
|3258|3258| UnitAI.prototype.IsAnimal = function()
|3259|3259| {
|3260|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3260|+	return (!!this.template.NaturalBehaviour);
|3261|3261| };
|3262|3262| 
|3263|3263| 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
|3295|3295| UnitAI.prototype.GetGarrisonHolder = function()
|3296|3296| {
|3297|3297| 	if (this.IsGarrisoned())
|3298|    |-	{
|    |3298|+	
|3299|3299| 		for (let order of this.orderQueue)
|3300|3300| 			if (order.type == "Garrison")
|3301|3301| 				return order.data.target;
|3302|    |-	}
|    |3302|+	
|3303|3303| 	return INVALID_ENTITY;
|3304|3304| };
|3305|3305| 
|    | [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
|3373|3373| 		{
|3374|3374| 			let index = this.GetCurrentState().indexOf(".");
|3375|3375| 			if (index != -1)
|3376|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3376|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3377|3377| 			this.Stop(false);
|3378|3378| 		}
|3379|3379| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3429|3429| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3430|3430| 			continue;
|3431|3431| 		if (i == 0)
|3432|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3432|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3433|3433| 		else
|3434|3434| 			this.orderQueue.splice(i, 1);
|3435|3435| 		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
|3429|3429| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3430|3430| 			continue;
|3431|3431| 		if (i == 0)
|3432|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3432|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3433|3433| 		else
|3434|3434| 			this.orderQueue.splice(i, 1);
|3435|3435| 		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
|3513|3513| };
|3514|3514| 
|3515|3515| 
|3516|    |-//// FSM linkage functions ////
|    |3516|+// // FSM linkage functions ////
|3517|3517| 
|3518|3518| UnitAI.prototype.SetNextState = function(state)
|3519|3519| {
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3687|3687| 				continue;
|3688|3688| 			if (this.orderQueue[i].type == type)
|3689|3689| 				continue;
|3690|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3690|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3691|3691| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3692|3692| 			return;
|3693|3693| 		}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3687|3687| 				continue;
|3688|3688| 			if (this.orderQueue[i].type == type)
|3689|3689| 				continue;
|3690|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3690|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3691|3691| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3692|3692| 			return;
|3693|3693| 		}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3701|3701| {
|3702|3702| 	// Remember the previous work orders to be able to go back to them later if required
|3703|3703| 	if (data && data.force)
|3704|    |-	{
|    |3704|+	
|3705|3705| 		if (this.IsFormationController())
|3706|3706| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3707|3707| 		else
|3708|3708| 			this.UpdateWorkOrders(type);
|3709|    |-	}
|    |3709|+	
|3710|3710| 
|3711|3711| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3712|3712| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3778|3778| 	{
|3779|3779| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3780|3780| 		if (cmpUnitAI)
|3781|    |-		{
|    |3781|+		
|3782|3782| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3783|3783| 			{
|3784|3784| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3787|3787| 					return;
|3788|3788| 				}
|3789|3789| 			}
|3790|    |-		}
|    |3790|+		
|3791|3791| 	}
|3792|3792| 
|3793|3793| 	// 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
|3780|3780| 		if (cmpUnitAI)
|3781|3781| 		{
|3782|3782| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3783|    |-			{
|    |3783|+			
|3784|3784| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3785|3785| 				{
|3786|3786| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3787|3787| 					return;
|3788|3788| 				}
|3789|    |-			}
|    |3789|+			
|3790|3790| 		}
|3791|3791| 	}
|3792|3792| 
|    | [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
|3792|3792| 
|3793|3793| 	// If nothing found, take the unit orders
|3794|3794| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3795|    |-	{
|    |3795|+	
|3796|3796| 		if (isWorkType(this.orderQueue[i].type))
|3797|3797| 		{
|3798|3798| 			this.workOrders = this.orderQueue.slice(i);
|3799|3799| 			return;
|3800|3800| 		}
|3801|    |-	}
|    |3801|+	
|3802|3802| };
|3803|3803| 
|3804|3804| 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
|3858|3858| 	if (data.timerRepeat === undefined)
|3859|3859| 		this.timer = undefined;
|3860|3860| 
|3861|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3861|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3862|3862| };
|3863|3863| 
|3864|3864| /**
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3858|3858| 	if (data.timerRepeat === undefined)
|3859|3859| 		this.timer = undefined;
|3860|3860| 
|3861|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3861|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3862|3862| };
|3863|3863| 
|3864|3864| /**
|    | [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
|3893|3893| 	this.timer = undefined;
|3894|3894| };
|3895|3895| 
|3896|    |-//// Message handlers /////
|    |3896|+// // Message handlers /////
|3897|3897| 
|3898|3898| UnitAI.prototype.OnMotionChanged = function(msg)
|3899|3899| {
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3898|3898| UnitAI.prototype.OnMotionChanged = function(msg)
|3899|3899| {
|3900|3900| 	if (msg.starting && !msg.error)
|3901|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3901|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveStarted", "data": msg});
|3902|3902| 	else if (!msg.starting || msg.error)
|3903|3903| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3904|3904| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3898|3898| UnitAI.prototype.OnMotionChanged = function(msg)
|3899|3899| {
|3900|3900| 	if (msg.starting && !msg.error)
|3901|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3901|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg });
|3902|3902| 	else if (!msg.starting || msg.error)
|3903|3903| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3904|3904| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3900|3900| 	if (msg.starting && !msg.error)
|3901|3901| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3902|3902| 	else if (!msg.starting || msg.error)
|3903|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3903|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveCompleted", "data": msg});
|3904|3904| };
|3905|3905| 
|3906|3906| 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
|3900|3900| 	if (msg.starting && !msg.error)
|3901|3901| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3902|3902| 	else if (!msg.starting || msg.error)
|3903|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3903|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg });
|3904|3904| };
|3905|3905| 
|3906|3906| 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
|3908|3908| 	// TODO: This is a bit inefficient since every unit listens to every
|3909|3909| 	// construction message - ideally we could scope it to only the one we're building
|3910|3910| 
|3911|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3911|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3912|3912| };
|3913|3913| 
|3914|3914| 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
|3908|3908| 	// TODO: This is a bit inefficient since every unit listens to every
|3909|3909| 	// construction message - ideally we could scope it to only the one we're building
|3910|3910| 
|3911|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3911|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3912|3912| };
|3913|3913| 
|3914|3914| 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
|3933|3933| 
|3934|3934| UnitAI.prototype.OnAttacked = function(msg)
|3935|3935| {
|3936|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3936|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3937|3937| };
|3938|3938| 
|3939|3939| 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
|3933|3933| 
|3934|3934| UnitAI.prototype.OnAttacked = function(msg)
|3935|3935| {
|3936|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3936|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3937|3937| };
|3938|3938| 
|3939|3939| 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
|3938|3938| 
|3939|3939| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3940|3940| {
|3941|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3941|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|3942|3942| };
|3943|3943| 
|3944|3944| 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
|3938|3938| 
|3939|3939| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3940|3940| {
|3941|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3941|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|3942|3942| };
|3943|3943| 
|3944|3944| 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
|3943|3943| 
|3944|3944| UnitAI.prototype.OnHealthChanged = function(msg)
|3945|3945| {
|3946|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3946|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|3947|3947| };
|3948|3948| 
|3949|3949| 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
|3943|3943| 
|3944|3944| UnitAI.prototype.OnHealthChanged = function(msg)
|3945|3945| {
|3946|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3946|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|3947|3947| };
|3948|3948| 
|3949|3949| 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
|3949|3949| UnitAI.prototype.OnRangeUpdate = function(msg)
|3950|3950| {
|3951|3951| 	if (msg.tag == this.losRangeQuery)
|3952|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3952|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|3953|3953| 	else if (msg.tag == this.losHealRangeQuery)
|3954|3954| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3955|3955| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3949|3949| UnitAI.prototype.OnRangeUpdate = function(msg)
|3950|3950| {
|3951|3951| 	if (msg.tag == this.losRangeQuery)
|3952|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3952|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|3953|3953| 	else if (msg.tag == this.losHealRangeQuery)
|3954|3954| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3955|3955| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/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| 	if (msg.tag == this.losRangeQuery)
|3952|3952| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3953|3953| 	else if (msg.tag == this.losHealRangeQuery)
|3954|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3954|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|3955|3955| };
|3956|3956| 
|3957|3957| 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
|3951|3951| 	if (msg.tag == this.losRangeQuery)
|3952|3952| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3953|3953| 	else if (msg.tag == this.losHealRangeQuery)
|3954|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3954|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|3955|3955| };
|3956|3956| 
|3957|3957| 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
|3956|3956| 
|3957|3957| UnitAI.prototype.OnPackFinished = function(msg)
|3958|3958| {
|3959|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3959|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|3960|3960| };
|3961|3961| 
|3962|3962| //// 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
|3956|3956| 
|3957|3957| UnitAI.prototype.OnPackFinished = function(msg)
|3958|3958| {
|3959|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3959|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|3960|3960| };
|3961|3961| 
|3962|3962| //// 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
|3959|3959| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|3960|3960| };
|3961|3961| 
|3962|    |-//// Helper functions to be called by the FSM ////
|    |3962|+// // Helper functions to be called by the FSM ////
|3963|3963| 
|3964|3964| UnitAI.prototype.GetWalkSpeed = function()
|3965|3965| {
|    | [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
|4063|4063| 	if (!cmpOwnership || cmpOwnership.GetOwner() == INVALID_PLAYER)
|4064|4064| 		return undefined;
|4065|4065| 
|4066|    |-	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position)
|    |4066|+	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
|4067|4067| 	if (!cmpPosition || !cmpPosition.IsInWorld())
|4068|4068| 		return undefined;
|4069|4069| 
|    | [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
|4148|4148| 			PlaySound(name, member);
|4149|4149| 	}
|4150|4150| 	else
|4151|    |-	{
|    |4151|+	
|4152|4152| 		// Otherwise use our own sounds
|4153|4153| 		PlaySound(name, this.entity);
|4154|    |-	}
|    |4154|+	
|4155|4155| };
|4156|4156| 
|4157|4157| /*
|    | [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
|4317|4317| 	else
|4318|4318| 		// return false? Or hope you come close enough?
|4319|4319| 		var parabolicMaxRange = 0;
|4320|    |-		//return false;
|    |4320|+		// return false;
|4321|4321| 
|4322|4322| 	// the parabole changes while walking, take something in the middle
|4323|4323| 	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
|4382|4382| 	if (this.IsFormationMember())
|4383|4383| 	{
|4384|4384| 		var cmpFormationUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|4385|    |-		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation()
|4386|    |-			&& cmpFormationUnitAI.order.data.target == target)
|    |4385|+		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation() &&
|    |4386|+			cmpFormationUnitAI.order.data.target == target)
|4387|4387| 			return true;
|4388|4388| 	}
|4389|4389| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4550|4550| UnitAI.prototype.AttackEntityInZone = function(ents)
|4551|4551| {
|4552|4552| 	var target = ents.find(target =>
|4553|    |-		this.CanAttack(target)
|4554|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4553|+		this.CanAttack(target) &&
|    |4554|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4555|4555| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4556|4556| 	);
|4557|4557| 	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
|4551|4551| {
|4552|4552| 	var target = ents.find(target =>
|4553|4553| 		this.CanAttack(target)
|4554|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4555|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4554|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4555|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4556|4556| 	);
|4557|4557| 	if (!target)
|4558|4558| 		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
|4615|4615| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4616|4616| 	if (this.isGuardOf)
|4617|4617| 	{
|4618|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4618|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4619|4619| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4620|4620| 		if (cmpUnitAI && cmpAttack &&
|4621|4621| 		    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
|4619|4619| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4620|4620| 		if (cmpUnitAI && cmpAttack &&
|4621|4621| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4622|    |-				return false;
|    |4622|+			return false;
|4623|4623| 	}
|4624|4624| 
|4625|4625| 	// 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
|4624|4624| 
|4625|4625| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4626|4626| 	if (this.GetStance().respondHoldGround)
|4627|    |-	{
|    |4627|+	
|4628|4628| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4629|4629| 			return true;
|4630|    |-	}
|    |4630|+	
|4631|4631| 
|4632|4632| 	// Stop if it's left our vision range, unless we're especially persistent
|4633|4633| 	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
|4631|4631| 
|4632|4632| 	// Stop if it's left our vision range, unless we're especially persistent
|4633|4633| 	if (!this.GetStance().respondChaseBeyondVision)
|4634|    |-	{
|    |4634|+	
|4635|4635| 		if (!this.CheckTargetIsInVisionRange(target))
|4636|4636| 			return true;
|4637|    |-	}
|    |4637|+	
|4638|4638| 
|4639|4639| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4640|4640| 	// 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
|4657|4657| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4658|4658| 	if (this.isGuardOf)
|4659|4659| 	{
|4660|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4660|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4661|4661| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4662|4662| 		if (cmpUnitAI && cmpAttack &&
|4663|4663| 		    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
|4670|4670| 	return false;
|4671|4671| };
|4672|4672| 
|4673|    |-//// External interface functions ////
|    |4673|+// // External interface functions ////
|4674|4674| 
|4675|4675| UnitAI.prototype.SetFormationController = function(ent)
|4676|4676| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4680|4680| 	// of our own formation (or ourself if not in formation)
|4681|4681| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4682|4682| 	if (cmpObstruction)
|4683|    |-	{
|    |4683|+	
|4684|4684| 		if (ent == INVALID_ENTITY)
|4685|4685| 			cmpObstruction.SetControlGroup(this.entity);
|4686|4686| 		else
|4687|4687| 			cmpObstruction.SetControlGroup(ent);
|4688|    |-	}
|    |4688|+	
|4689|4689| 
|4690|4690| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4691|4691| 	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
|4823|4823| 	// if we already had an old guard order, do nothing if the target is the same
|4824|4824| 	// and the order is running, otherwise remove the previous order
|4825|4825| 	if (this.isGuardOf)
|4826|    |-	{
|    |4826|+	
|4827|4827| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4828|4828| 			return;
|4829|4829| 		else
|4830|4830| 			this.RemoveGuard();
|4831|    |-	}
|    |4831|+	
|4832|4832| 
|4833|4833| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4834|4834| };
|    | [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
|4826|4826| 	{
|4827|4827| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4828|4828| 			return;
|4829|    |-		else
|4830|    |-			this.RemoveGuard();
|    |4829|+		this.RemoveGuard();
|4831|4830| 	}
|4832|4831| 
|4833|4832| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4997|4997| 			this.WalkToTarget(target, queued);
|4998|4998| 		return;
|4999|4999| 	}
|5000|    |-	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture}, queued);
|    |5000|+	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture }, queued);
|5001|5001| };
|5002|5002| 
|5003|5003| /**
|    | [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
|5146|5146| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5147|5147| 	{
|5148|5148| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5149|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5149|+		if (cmpTrader.HasBothMarkets() &&
|5150|5150| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5151|5151| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5152|5152| 		{
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5427|5427| 				{
|5428|5428| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5429|5429| 					var targetClasses = this.order.data.targetClasses;
|5430|    |-					if (targetClasses.attack && cmpIdentity
|5431|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5430|+					if (targetClasses.attack && cmpIdentity &&
|    |5431|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5432|5432| 						continue;
|5433|5433| 					if (targetClasses.avoid && cmpIdentity
|5434|5434| 						&& 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
|5430|5430| 					if (targetClasses.attack && cmpIdentity
|5431|5431| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5432|5432| 						continue;
|5433|    |-					if (targetClasses.avoid && cmpIdentity
|5434|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5433|+					if (targetClasses.avoid && cmpIdentity &&
|    |5434|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5435|5435| 						continue;
|5436|5436| 					// Only used by the AIs to prevent some choices of targets
|5437|5437| 					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
|5453|5453| 		{
|5454|5454| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5455|5455| 			var targetClasses = this.order.data.targetClasses;
|5456|    |-			if (cmpIdentity && targetClasses.attack
|5457|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5456|+			if (cmpIdentity && targetClasses.attack &&
|    |5457|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5458|5458| 				continue;
|5459|5459| 			if (cmpIdentity && targetClasses.avoid
|5460|5460| 				&& 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
|5456|5456| 			if (cmpIdentity && targetClasses.attack
|5457|5457| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5458|5458| 				continue;
|5459|    |-			if (cmpIdentity && targetClasses.avoid
|5460|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5459|+			if (cmpIdentity && targetClasses.avoid &&
|    |5460|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5461|5461| 				continue;
|5462|5462| 			// Only used by the AIs to prevent some choices of targets
|5463|5463| 			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
|5589|5589| 
|5590|5590| UnitAI.prototype.SetHeldPosition = function(x, z)
|5591|5591| {
|5592|    |-	this.heldPosition = {"x": x, "z": z};
|    |5592|+	this.heldPosition = { "x": x, "z": z};
|5593|5593| };
|5594|5594| 
|5595|5595| 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
|5589|5589| 
|5590|5590| UnitAI.prototype.SetHeldPosition = function(x, z)
|5591|5591| {
|5592|    |-	this.heldPosition = {"x": x, "z": z};
|    |5592|+	this.heldPosition = {"x": x, "z": z };
|5593|5593| };
|5594|5594| 
|5595|5595| 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
|5616|5616| 	return false;
|5617|5617| };
|5618|5618| 
|5619|    |-//// Helper functions ////
|    |5619|+// // Helper functions ////
|5620|5620| 
|5621|5621| UnitAI.prototype.CanAttack = function(target)
|5622|5622| {
|    | [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
|5820|5820| 	return cmpPack && cmpPack.IsPacking();
|5821|5821| };
|5822|5822| 
|5823|    |-//// Formation specific functions ////
|    |5823|+// // Formation specific functions ////
|5824|5824| 
|5825|5825| UnitAI.prototype.IsAttackingAsFormation = function()
|5826|5826| {
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5825|5825| UnitAI.prototype.IsAttackingAsFormation = function()
|5826|5826| {
|5827|5827| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5828|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5829|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5828|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5829|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5830|5830| };
|5831|5831| 
|5832|5832| //// 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
|5829|5829| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5830|5830| };
|5831|5831| 
|5832|    |-//// Animal specific functions ////
|    |5832|+// // Animal specific functions ////
|5833|5833| 
|5834|5834| UnitAI.prototype.MoveRandomly = function(distance)
|5835|5835| {

binaries/data/mods/public/simulation/components/UnitAI.js
|2403| »   »   »   »   »   »   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
|3763| »   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
|4537| »   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
|4552| »   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
|4598| »   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
|4621| »   »   ····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
|5077| »   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
| 365| »   »   ····&&·(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
|1876| »   »   »   »   »   »   var·cmpFormation·=·Engine.QueryInterface(this.formationController,·IID_Formation);
|    | [NORMAL] JSHintBear:
|    | 'cmpFormation' is already defined.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|5457| »   »   »   »   &&·!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
|5460| »   »   »   »   &&·MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.avoid))
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|5546| »   »   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/408/display/redirect

temple added a subscriber: temple.Apr 19 2018, 12:51 AM

Doesn't work for defensive stance, since the held position is where you clicked to attack-move, so they won't respond to any units attacking them along the way (until they get close enough to the held position).

mimo added a comment.EditedApr 19 2018, 4:41 PM

Good catch, but that's rather a walk-and-fight definition: if in defensive mode, it may be wanted that the attack-move only starts when around the target (otherwise why choosing that defensive stance?).
But i'm also aware that this is not necessary the expected behaviour. If the expected behaviour is a "standard" attack-move, the fix is to set the current position as heldPosition when searching for new targets (as done in the new version of the patch).

mimo updated this revision to Diff 6430.Apr 19 2018, 5:23 PM

update patch

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
| 228| 228| 		// Move a tile outside the building
| 229| 229| 		let range = 4;
| 230| 230| 		if (this.MoveToTargetRangeExplicit(msg.data.target, range, range))
| 231|    |-		{
|    | 231|+		
| 232| 232| 			// We've started walking to the given point
| 233| 233| 			this.SetNextState("INDIVIDUAL.WALKING");
| 234|    |-		}
|    | 234|+		
| 235| 235| 		else
| 236| 236| 		{
| 237| 237| 			// 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
| 233| 233| 			this.SetNextState("INDIVIDUAL.WALKING");
| 234| 234| 		}
| 235| 235| 		else
| 236|    |-		{
|    | 236|+		
| 237| 237| 			// We are already at the target, or can't move at all
| 238| 238| 			this.FinishOrder();
| 239|    |-		}
|    | 239|+		
| 240| 240| 	},
| 241| 241| 
| 242| 242| 	// 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
| 335| 335| 
| 336| 336| 		var ok = this.MoveToTarget(this.order.data.target);
| 337| 337| 		if (ok)
| 338|    |-		{
|    | 338|+		
| 339| 339| 			// We've started walking to the given point
| 340| 340| 			if (this.IsAnimal())
| 341| 341| 				this.SetNextState("ANIMAL.WALKING");
| 342| 342| 			else
| 343| 343| 				this.SetNextState("INDIVIDUAL.WALKING");
| 344|    |-		}
|    | 344|+		
| 345| 345| 		else
| 346| 346| 		{
| 347| 347| 			// 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
| 363| 363| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 364| 364| 		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 365| 365| 		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 366|    |-		{
|    | 366|+		
| 367| 367| 			// we were already on the shoreline, and have not moved since
| 368| 368| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
| 369| 369| 				needToMove = false;
| 370|    |-		}
|    | 370|+		
| 371| 371| 
| 372| 372| 		// TODO: what if the units are on a cliff ? the ship will go below the cliff
| 373| 373| 		// 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
| 361| 361| 		// Check if we need to move     TODO implement a better way to know if we are on the shoreline
| 362| 362| 		var needToMove = true;
| 363| 363| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 364|    |-		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 365|    |-		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
|    | 364|+		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x) &&
|    | 365|+		    (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 366| 366| 		{
| 367| 367| 			// we were already on the shoreline, and have not moved since
| 368| 368| 			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
| 372| 372| 		// TODO: what if the units are on a cliff ? the ship will go below the cliff
| 373| 373| 		// and the units won't be able to garrison. Should go to the nearest (accessible) shore
| 374| 374| 		if (needToMove && this.MoveToTarget(this.order.data.target))
| 375|    |-		{
|    | 375|+		
| 376| 376| 			this.SetNextState("INDIVIDUAL.PICKUP.APPROACHING");
| 377|    |-		}
|    | 377|+		
| 378| 378| 		else
| 379| 379| 		{
| 380| 380| 			// 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
| 401| 401| 		var distance = DistanceBetweenEntities(this.entity, this.order.data.target) + (+this.template.FleeDistance);
| 402| 402| 		var cmpUnitMotion = Engine.QueryInterface(this.entity, IID_UnitMotion);
| 403| 403| 		if (cmpUnitMotion.MoveToTargetRange(this.order.data.target, distance, -1))
| 404|    |-		{
|    | 404|+		
| 405| 405| 			// We've started fleeing from the given target
| 406| 406| 			if (this.IsAnimal())
| 407| 407| 				this.SetNextState("ANIMAL.FLEEING");
| 408| 408| 			else
| 409| 409| 				this.SetNextState("INDIVIDUAL.FLEEING");
| 410|    |-		}
|    | 410|+		
| 411| 411| 		else
| 412| 412| 		{
| 413| 413| 			// 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
| 448| 448| 			}
| 449| 449| 
| 450| 450| 			if (this.order.data.attackType == this.oldAttackType)
| 451|    |-			{
|    | 451|+			
| 452| 452| 				if (this.IsAnimal())
| 453| 453| 					this.SetNextState("ANIMAL.COMBAT.ATTACKING");
| 454| 454| 				else
| 455| 455| 					this.SetNextState("INDIVIDUAL.COMBAT.ATTACKING");
| 456|    |-			}
|    | 456|+			
| 457| 457| 			else
| 458| 458| 			{
| 459| 459| 				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
| 455| 455| 					this.SetNextState("INDIVIDUAL.COMBAT.ATTACKING");
| 456| 456| 			}
| 457| 457| 			else
| 458|    |-			{
|    | 458|+			
| 459| 459| 				if (this.IsAnimal())
| 460| 460| 					this.SetNextStateAlwaysEntering("ANIMAL.COMBAT.ATTACKING");
| 461| 461| 				else
| 462| 462| 					this.SetNextStateAlwaysEntering("INDIVIDUAL.COMBAT.ATTACKING");
| 463|    |-			}
|    | 463|+			
| 464| 464| 			return;
| 465| 465| 		}
| 466| 466| 
|    | [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
| 580| 580| 					this.PushOrderFront("Walk", this.order.data.lastPos);
| 581| 581| 				}
| 582| 582| 				else
| 583|    |-				{
|    | 583|+				
| 584| 584| 					// We couldn't move there, or the target moved away
| 585| 585| 					this.FinishOrder();
| 586|    |-				}
|    | 586|+				
| 587| 587| 				return;
| 588| 588| 			}
| 589| 589| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 593| 593| 
| 594| 594| 		// Try to move within range
| 595| 595| 		if (this.MoveToTargetRange(this.order.data.target, IID_ResourceGatherer))
| 596|    |-		{
|    | 596|+		
| 597| 597| 			// We've started walking to the given point
| 598| 598| 			this.SetNextState("INDIVIDUAL.GATHER.APPROACHING");
| 599|    |-		}
|    | 599|+		
| 600| 600| 		else
| 601| 601| 		{
| 602| 602| 			// 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
| 670| 670| 	"Order.Repair": function(msg) {
| 671| 671| 		// Try to move within range
| 672| 672| 		if (this.MoveToTargetRange(this.order.data.target, IID_Builder))
| 673|    |-		{
|    | 673|+		
| 674| 674| 			// We've started walking to the given point
| 675| 675| 			this.SetNextState("INDIVIDUAL.REPAIR.APPROACHING");
| 676|    |-		}
|    | 676|+		
| 677| 677| 		else
| 678| 678| 		{
| 679| 679| 			// 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
| 706| 706| 		}
| 707| 707| 
| 708| 708| 		if (this.MoveToGarrisonRange(this.order.data.target))
| 709|    |-		{
|    | 709|+		
| 710| 710| 			this.SetNextState("INDIVIDUAL.GARRISON.APPROACHING");
| 711|    |-		}
|    | 711|+		
| 712| 712| 		else
| 713| 713| 		{
| 714| 714| 			// 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
| 834| 834| 			if (!this.CheckTargetAttackRange(target, target))
| 835| 835| 			{
| 836| 836| 				if (this.TargetIsAlive(target) && this.CheckTargetVisible(target))
| 837|    |-				{
|    | 837|+				
| 838| 838| 					if (this.MoveToTargetAttackRange(target, target))
| 839| 839| 					{
| 840| 840| 						this.SetNextState("COMBAT.APPROACHING");
| 841| 841| 						return;
| 842| 842| 					}
| 843|    |-				}
|    | 843|+				
| 844| 844| 				this.FinishOrder();
| 845| 845| 				return;
| 846| 846| 			}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 859| 859| 			}
| 860| 860| 			// Check if we are already in range, otherwise walk there
| 861| 861| 			if (!this.CheckGarrisonRange(msg.data.target))
| 862|    |-			{
|    | 862|+			
| 863| 863| 				if (!this.CheckTargetVisible(msg.data.target))
| 864| 864| 				{
| 865| 865| 					this.FinishOrder();
| 874| 874| 						return;
| 875| 875| 					}
| 876| 876| 				}
| 877|    |-			}
|    | 877|+			
| 878| 878| 
| 879| 879| 			this.SetNextState("GARRISON.GARRISONING");
| 880| 880| 		},
|    | [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
| 866| 866| 					return;
| 867| 867| 				}
| 868| 868| 				else
| 869|    |-				{
|    | 869|+				
| 870| 870| 					// Out of range; move there in formation
| 871| 871| 					if (this.MoveToGarrisonRange(msg.data.target))
| 872| 872| 					{
| 873| 873| 						this.SetNextState("GARRISON.APPROACHING");
| 874| 874| 						return;
| 875| 875| 					}
| 876|    |-				}
|    | 876|+				
| 877| 877| 			}
| 878| 878| 
| 879| 879| 			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
| 865| 865| 					this.FinishOrder();
| 866| 866| 					return;
| 867| 867| 				}
| 868|    |-				else
| 869|    |-				{
|    | 868|+				
| 870| 869| 					// Out of range; move there in formation
| 871| 870| 					if (this.MoveToGarrisonRange(msg.data.target))
| 872| 871| 					{
| 873| 872| 						this.SetNextState("GARRISON.APPROACHING");
| 874| 873| 						return;
| 875| 874| 					}
| 876|    |-				}
|    | 875|+				
| 877| 876| 			}
| 878| 877| 
| 879| 878| 			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
| 892| 892| 						this.PushOrderFront("Walk", msg.data.lastPos);
| 893| 893| 					}
| 894| 894| 					else
| 895|    |-					{
|    | 895|+					
| 896| 896| 						// We couldn't move there, or the target moved away
| 897| 897| 						this.FinishOrder();
| 898|    |-					}
|    | 898|+					
| 899| 899| 					return;
| 900| 900| 				}
| 901| 901| 
|    | [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
|1115|1115| 			},
|1116|1116| 		},
|1117|1117| 
|1118|    |-		"GARRISON":{
|    |1118|+		"GARRISON": {
|1119|1119| 			"enter": function() {
|1120|1120| 				// If the garrisonholder should pickup, warn it so it can take needed action
|1121|1121| 				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
|1299|1299| 			// If the controller handled an order but some members rejected it,
|1300|1300| 			// they will have no orders and be in the FORMATIONMEMBER.IDLE state.
|1301|1301| 			if (this.orderQueue.length)
|1302|    |-			{
|    |1302|+			
|1303|1303| 				// We're leaving the formation, so stop our FormationWalk order
|1304|1304| 				if (this.FinishOrder())
|1305|1305| 					return;
|1306|    |-			}
|    |1306|+			
|1307|1307| 
|1308|1308| 			// No orders left, we're an individual now
|1309|1309| 			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
|1327|1327| 			// Move a tile outside the building
|1328|1328| 			let range = 4;
|1329|1329| 			if (this.MoveToTargetRangeExplicit(msg.data.target, range, range))
|1330|    |-			{
|    |1330|+			
|1331|1331| 				// We've started walking to the given point
|1332|1332| 				this.SetNextState("WALKINGTOPOINT");
|1333|    |-			}
|    |1333|+			
|1334|1334| 			else
|1335|1335| 			{
|1336|1336| 				// 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
|1332|1332| 				this.SetNextState("WALKINGTOPOINT");
|1333|1333| 			}
|1334|1334| 			else
|1335|    |-			{
|    |1335|+			
|1336|1336| 				// We are already at the target, or can't move at all
|1337|1337| 				this.FinishOrder();
|1338|    |-			}
|    |1338|+			
|1339|1339| 		},
|1340|1340| 
|1341|1341| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1533|1533| 
|1534|1534| 			"LosRangeUpdate": function(msg) {
|1535|1535| 				if (this.GetStance().targetVisibleEnemies)
|1536|    |-				{
|    |1536|+				
|1537|1537| 					// Start attacking one of the newly-seen enemy (if any)
|1538|1538| 					this.AttackEntitiesByPreference(msg.data.added);
|1539|    |-				}
|    |1539|+				
|1540|1540| 			},
|1541|1541| 
|1542|1542| 			"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
|1721|1721| 						// if nothing better to do, check if the guarded needs to be healed or repaired
|1722|1722| 						var cmpHealth = Engine.QueryInterface(this.isGuardOf, IID_Health);
|1723|1723| 						if (cmpHealth && (cmpHealth.GetHitpoints() < cmpHealth.GetMaxHitpoints()))
|1724|    |-						{
|    |1724|+						
|1725|1725| 							if (this.CanHeal(this.isGuardOf))
|1726|1726| 								this.PushOrderFront("Heal", { "target": this.isGuardOf, "force": false });
|1727|1727| 							else if (this.CanRepair(this.isGuardOf))
|1728|1728| 								this.PushOrderFront("Repair", { "target": this.isGuardOf, "autocontinue": false, "force": false });
|1729|    |-						}
|    |1729|+						
|1730|1730| 					}
|1731|1731| 				},
|1732|1732| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1809|1809| 				"MoveCompleted": function() {
|1810|1810| 
|1811|1811| 					if (this.CheckTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1812|    |-					{
|    |1812|+					
|1813|1813| 						// If the unit needs to unpack, do so
|1814|1814| 						if (this.CanUnpack())
|1815|1815| 						{
|1818|1818| 						}
|1819|1819| 						else
|1820|1820| 							this.SetNextState("ATTACKING");
|1821|    |-					}
|    |1821|+					
|1822|1822| 					else
|1823|1823| 					{
|1824|1824| 						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
|1816|1816| 							this.PushOrderFront("Unpack", { "force": true });
|1817|1817| 							return;
|1818|1818| 						}
|1819|    |-						else
|1820|    |-							this.SetNextState("ATTACKING");
|    |1819|+						this.SetNextState("ATTACKING");
|1821|1820| 					}
|1822|1821| 					else
|1823|1822| 					{
|    | [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
|1820|1820| 							this.SetNextState("ATTACKING");
|1821|1821| 					}
|1822|1822| 					else
|1823|    |-					{
|    |1823|+					
|1824|1824| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1825|1825| 						{
|1826|1826| 							this.SetNextState("APPROACHING");
|1830|1830| 							// Give up
|1831|1831| 							this.FinishOrder();
|1832|1832| 						}
|1833|    |-					}
|    |1833|+					
|1834|1834| 				},
|1835|1835| 			},
|1836|1836| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1822|1822| 					else
|1823|1823| 					{
|1824|1824| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1825|    |-						{
|    |1825|+						
|1826|1826| 							this.SetNextState("APPROACHING");
|1827|    |-						}
|    |1827|+						
|1828|1828| 						else
|1829|1829| 						{
|1830|1830| 							// 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
|1826|1826| 							this.SetNextState("APPROACHING");
|1827|1827| 						}
|1828|1828| 						else
|1829|    |-						{
|    |1829|+						
|1830|1830| 							// Give up
|1831|1831| 							this.FinishOrder();
|1832|    |-						}
|    |1832|+						
|1833|1833| 					}
|1834|1834| 				},
|1835|1835| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1847|1847| 					}
|1848|1848| 					// Check the target is still alive and attackable
|1849|1849| 					if (this.CanAttack(target) && !this.CheckTargetAttackRange(target, this.order.data.attackType))
|1850|    |-					{
|    |1850|+					
|1851|1851| 						// Can't reach it - try to chase after it
|1852|1852| 						if (this.ShouldChaseTargetedEntity(target, this.order.data.force))
|1853|1853| 						{
|1857|1857| 								return;
|1858|1858| 							}
|1859|1859| 						}
|1860|    |-					}
|    |1860|+					
|1861|1861| 
|1862|1862| 					var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|1863|1863| 					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
|1850|1850| 					{
|1851|1851| 						// Can't reach it - try to chase after it
|1852|1852| 						if (this.ShouldChaseTargetedEntity(target, this.order.data.force))
|1853|    |-						{
|    |1853|+						
|1854|1854| 							if (this.MoveToTargetAttackRange(target, this.order.data.attackType))
|1855|1855| 							{
|1856|1856| 								this.SetNextState("COMBAT.CHASING");
|1857|1857| 								return;
|1858|1858| 							}
|1859|    |-						}
|    |1859|+						
|1860|1860| 					}
|1861|1861| 
|1862|1862| 					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
|1888|1888| 					// TODO: we should probably only bother syncing projectile attacks, not melee
|1889|1889| 
|1890|1890| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|1891|    |-					this.resyncAnimation = (prepare != this.attackTimers.prepare) ? true : false;
|    |1891|+					this.resyncAnimation = (prepare != this.attackTimers.prepare);
|1892|1892| 
|1893|1893| 					this.FaceTowardsTarget(this.order.data.target);
|1894|1894| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1963|1963| 
|1964|1964| 						// Can't reach it - try to chase after it
|1965|1965| 						if (this.ShouldChaseTargetedEntity(target, this.order.data.force))
|1966|    |-						{
|    |1966|+						
|1967|1967| 							if (this.MoveToTargetRange(target, IID_Attack, this.order.data.attackType))
|1968|1968| 							{
|1969|1969| 								this.SetNextState("COMBAT.CHASING");
|1970|1970| 								return;
|1971|1971| 							}
|1972|    |-						}
|    |1972|+						
|1973|1973| 					}
|1974|1974| 
|1975|1975| 					// 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
|2012|2012| 
|2013|2013| 				"Attacked": function(msg) {
|2014|2014| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2015|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2016|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2015|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2016|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2017|2017| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2018|2018| 				},
|2019|2019| 			},
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2096|2096| 						// Also don't switch to a different type of huntable animal
|2097|2097| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2098|2098| 							return (
|2099|    |-								ent != oldTarget
|2100|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2099|+								ent != oldTarget &&
|    |2100|+								 ((type.generic == "treasure" && oldType.generic == "treasure")
|2101|2101| 								 || (type.specific == oldType.specific
|2102|2102| 								 && (type.specific != "meat" || oldTemplate == template)))
|2103|2103| 							);
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2097|2097| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2098|2098| 							return (
|2099|2099| 								ent != oldTarget
|2100|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2101|    |-								 || (type.specific == oldType.specific
|    |2100|+								 && ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2101|+								 (type.specific == oldType.specific
|2102|2102| 								 && (type.specific != "meat" || oldTemplate == template)))
|2103|2103| 							);
|2104|2104| 						}, 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
|2098|2098| 							return (
|2099|2099| 								ent != oldTarget
|2100|2100| 								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2101|    |-								 || (type.specific == oldType.specific
|2102|    |-								 && (type.specific != "meat" || oldTemplate == template)))
|    |2101|+								 || (type.specific == oldType.specific &&
|    |2102|+								 (type.specific != "meat" || oldTemplate == template)))
|2103|2103| 							);
|2104|2104| 						}, oldTarget);
|2105|2105| 						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
|2107|2107| 							this.PerformGather(nearby, false, false);
|2108|2108| 							return true;
|2109|2109| 						}
|2110|    |-						else
|2111|    |-						{
|    |2110|+						
|2112|2111| 							// It's probably better in this case, to avoid units getting stuck around a dropsite
|2113|2112| 							// in a "Target is far away, full, nearby are no good resources, return to dropsite" loop
|2114|2113| 							// to order it to GatherNear the resource position.
|2129|2128| 									return true;
|2130|2129| 								}
|2131|2130| 							}
|2132|    |-						}
|    |2131|+						
|2133|2132| 						return true;
|2134|2133| 					}
|2135|2134| 					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
|2119|2119| 								this.GatherNearPosition(pos.x, pos.z, oldType, oldTemplate);
|2120|2120| 								return true;
|2121|2121| 							}
|2122|    |-							else
|2123|    |-							{
|    |2122|+							
|2124|2123| 								// we're kind of stuck here. Return resource.
|2125|2124| 								var nearby = this.FindNearestDropsite(oldType.generic);
|2126|2125| 								if (nearby)
|2128|2127| 									this.PushOrderFront("ReturnResource", { "target": nearby, "force": false });
|2129|2128| 									return true;
|2130|2129| 								}
|2131|    |-							}
|    |2130|+							
|2132|2131| 						}
|2133|2132| 						return true;
|2134|2133| 					}
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2161|2161| 						// Also don't switch to a different type of huntable animal
|2162|2162| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2163|2163| 							return (
|2164|    |-								ent != oldTarget
|2165|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2164|+								ent != oldTarget &&
|    |2165|+								((type.generic == "treasure" && oldType.generic == "treasure")
|2166|2166| 								|| (type.specific == oldType.specific
|2167|2167| 								&& (type.specific != "meat" || oldTemplate == template)))
|2168|2168| 							);
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2162|2162| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2163|2163| 							return (
|2164|2164| 								ent != oldTarget
|2165|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2166|    |-								|| (type.specific == oldType.specific
|    |2165|+								&& ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2166|+								(type.specific == oldType.specific
|2167|2167| 								&& (type.specific != "meat" || oldTemplate == template)))
|2168|2168| 							);
|2169|2169| 						});
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2163|2163| 							return (
|2164|2164| 								ent != oldTarget
|2165|2165| 								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2166|    |-								|| (type.specific == oldType.specific
|2167|    |-								&& (type.specific != "meat" || oldTemplate == template)))
|    |2166|+								|| (type.specific == oldType.specific &&
|    |2167|+								(type.specific != "meat" || oldTemplate == template)))
|2168|2168| 							);
|2169|2169| 						});
|2170|2170| 						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
|2208|2208| 					// Also don't switch to a different type of huntable animal
|2209|2209| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2210|2210| 						return (
|2211|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2212|    |-							|| (type.specific == resourceType.specific
|    |2211|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2212|+							(type.specific == resourceType.specific
|2213|2213| 							&& (type.specific != "meat" || resourceTemplate == template))
|2214|2214| 						);
|2215|2215| 					});
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2209|2209| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2210|2210| 						return (
|2211|2211| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2212|    |-							|| (type.specific == resourceType.specific
|2213|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2212|+							|| (type.specific == resourceType.specific &&
|    |2213|+							(type.specific != "meat" || resourceTemplate == template))
|2214|2214| 						);
|2215|2215| 					});
|2216|2216| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2325|2325| 
|2326|2326| 					var cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply);
|2327|2327| 					if (cmpSupply && cmpSupply.IsAvailable(cmpOwnership.GetOwner(), this.entity))
|2328|    |-					{
|    |2328|+					
|2329|2329| 						// Check we can still reach and gather from the target
|2330|2330| 						if (this.CheckTargetRange(this.gatheringTarget, IID_ResourceGatherer) && this.CanGather(this.gatheringTarget))
|2331|2331| 						{
|2391|2391| 								return;
|2392|2392| 							}
|2393|2393| 						}
|2394|    |-					}
|    |2394|+					
|2395|2395| 
|2396|2396| 					// We're already in range, can't get anywhere near it or the target is exhausted.
|2397|2397| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2417|2417| 					// Also don't switch to a different type of huntable animal
|2418|2418| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2419|2419| 						return (
|2420|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2421|    |-							|| (type.specific == resourceType.specific
|    |2420|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2421|+							(type.specific == resourceType.specific
|2422|2422| 							&& (type.specific != "meat" || resourceTemplate == template))
|2423|2423| 						);
|2424|2424| 					});
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2418|2418| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2419|2419| 						return (
|2420|2420| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2421|    |-							|| (type.specific == resourceType.specific
|2422|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2421|+							|| (type.specific == resourceType.specific &&
|    |2422|+							(type.specific != "meat" || resourceTemplate == template))
|2423|2423| 						);
|2424|2424| 					});
|2425|2425| 					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
|2505|2505| 					this.StartTimer(prepare, this.healTimers.repeat);
|2506|2506| 
|2507|2507| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2508|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2508|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2509|2509| 
|2510|2510| 					this.FaceTowardsTarget(this.order.data.target);
|2511|2511| 				},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2538|2538| 						}
|2539|2539| 						// Can't reach it - try to chase after it
|2540|2540| 						if (this.ShouldChaseTargetedEntity(target, this.order.data.force))
|2541|    |-						{
|    |2541|+						
|2542|2542| 							if (this.MoveToTargetRange(target, IID_Heal))
|2543|2543| 							{
|2544|2544| 								this.SetNextState("HEAL.CHASING");
|2545|2545| 								return;
|2546|2546| 							}
|2547|    |-						}
|    |2547|+						
|2548|2548| 					}
|2549|2549| 					// Can't reach it, healed to max hp or doesn't exist any more - give up
|2550|2550| 					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
|2715|2715| 					{
|2716|2716| 						// The building was already finished/fully repaired before we arrived;
|2717|2717| 						// let the ConstructionFinished handler handle this.
|2718|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2718|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2719|2719| 						return true;
|2720|2720| 					}
|2721|2721| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2715|2715| 					{
|2716|2716| 						// The building was already finished/fully repaired before we arrived;
|2717|2717| 						// let the ConstructionFinished handler handle this.
|2718|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2718|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2719|2719| 						return true;
|2720|2720| 					}
|2721|2721| 
|    | [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
|2755|2755| 					if (this.MoveToTargetRange(this.repairTarget, IID_Builder))
|2756|2756| 						this.SetNextState("APPROACHING");
|2757|2757| 					else if (!this.CheckTargetRange(this.repairTarget, IID_Builder))
|2758|    |-						this.FinishOrder(); //can't approach and isn't in reach
|    |2758|+						this.FinishOrder(); // can't approach and isn't in reach
|2759|2759| 				},
|2760|2760| 			},
|2761|2761| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2842|2842| 
|2843|2843| 				// Unit was approaching and there's nothing to do now, so switch to walking
|2844|2844| 				if (oldState === "INDIVIDUAL.REPAIR.APPROACHING")
|2845|    |-				{
|    |2845|+				
|2846|2846| 					// We're already walking to the given point, so add this as a order.
|2847|2847| 					this.WalkToTarget(msg.data.newentity, true);
|2848|    |-				}
|    |2848|+				
|2849|2849| 			},
|2850|2850| 		},
|2851|2851| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2895|2895| 
|2896|2896| 					// Check that we can garrison here
|2897|2897| 					if (this.CanGarrison(target))
|2898|    |-					{
|    |2898|+					
|2899|2899| 						// Check that we're in range of the garrison target
|2900|2900| 						if (this.CheckGarrisonRange(target))
|2901|2901| 						{
|2971|2971| 								return false;
|2972|2972| 							}
|2973|2973| 						}
|2974|    |-					}
|    |2974|+					
|2975|2975| 					// Garrisoning failed for some reason, so finish the order
|2976|2976| 					this.FinishOrder();
|2977|2977| 					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
|3078|3078| 		"Attacked": function(msg) {
|3079|3079| 			if (this.template.NaturalBehaviour == "skittish" ||
|3080|3080| 			    this.template.NaturalBehaviour == "passive")
|3081|    |-			{
|    |3081|+			
|3082|3082| 				this.Flee(msg.data.attacker, false);
|3083|    |-			}
|    |3083|+			
|3084|3084| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|3085|3085| 			{
|3086|3086| 				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
|3087|3087| 					this.Attack(msg.data.attacker, false);
|3088|3088| 			}
|3089|3089| 			else if (this.template.NaturalBehaviour == "domestic")
|3090|    |-			{
|    |3090|+			
|3091|3091| 				// Never flee, stop what we were doing
|3092|3092| 				this.SetNextState("IDLE");
|3093|    |-			}
|    |3093|+			
|3094|3094| 		},
|3095|3095| 
|3096|3096| 		"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
|3097|3097| 			// Move a tile outside the building
|3098|3098| 			var range = 4;
|3099|3099| 			if (this.MoveToTargetRangeExplicit(msg.data.target, range, range))
|3100|    |-			{
|    |3100|+			
|3101|3101| 				// We've started walking to the given point
|3102|3102| 				this.SetNextState("WALKING");
|3103|    |-			}
|    |3103|+			
|3104|3104| 			else
|3105|3105| 			{
|3106|3106| 				// 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
|3102|3102| 				this.SetNextState("WALKING");
|3103|3103| 			}
|3104|3104| 			else
|3105|    |-			{
|    |3105|+			
|3106|3106| 				// We are already at the target, or can't move at all
|3107|3107| 				this.FinishOrder();
|3108|    |-			}
|    |3108|+			
|3109|3109| 		},
|3110|3110| 
|3111|3111| 		"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
|3144|3144| 				}
|3145|3145| 				// Start attacking one of the newly-seen enemy (if any)
|3146|3146| 				else if (this.IsDangerousAnimal())
|3147|    |-				{
|    |3147|+				
|3148|3148| 					this.AttackVisibleEntity(msg.data.added);
|3149|    |-				}
|    |3149|+				
|3150|3150| 
|3151|3151| 				// TODO: if two units enter our range together, we'll attack the
|3152|3152| 				// 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
|3187|3187| 				}
|3188|3188| 				// Start attacking one of the newly-seen enemy (if any)
|3189|3189| 				else if (this.template.NaturalBehaviour == "violent")
|3190|    |-				{
|    |3190|+				
|3191|3191| 					this.AttackVisibleEntity(msg.data.added);
|3192|    |-				}
|    |3192|+				
|3193|3193| 			},
|3194|3194| 
|3195|3195| 			"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
|3204|3204| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3205|3205| 
|3206|3206| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3207|    |-							// only used for domestic animals
|    |3207|+		// only used for domestic animals
|3208|3208| 	},
|3209|3209| };
|3210|3210| 
|    | [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
|3261|3261| 
|3262|3262| UnitAI.prototype.IsAnimal = function()
|3263|3263| {
|3264|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3264|+	return (!!this.template.NaturalBehaviour);
|3265|3265| };
|3266|3266| 
|3267|3267| 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
|3299|3299| UnitAI.prototype.GetGarrisonHolder = function()
|3300|3300| {
|3301|3301| 	if (this.IsGarrisoned())
|3302|    |-	{
|    |3302|+	
|3303|3303| 		for (let order of this.orderQueue)
|3304|3304| 			if (order.type == "Garrison")
|3305|3305| 				return order.data.target;
|3306|    |-	}
|    |3306|+	
|3307|3307| 	return INVALID_ENTITY;
|3308|3308| };
|3309|3309| 
|    | [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
|3377|3377| 		{
|3378|3378| 			let index = this.GetCurrentState().indexOf(".");
|3379|3379| 			if (index != -1)
|3380|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3380|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3381|3381| 			this.Stop(false);
|3382|3382| 		}
|3383|3383| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3433|3433| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3434|3434| 			continue;
|3435|3435| 		if (i == 0)
|3436|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3436|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3437|3437| 		else
|3438|3438| 			this.orderQueue.splice(i, 1);
|3439|3439| 		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
|3433|3433| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3434|3434| 			continue;
|3435|3435| 		if (i == 0)
|3436|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3436|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3437|3437| 		else
|3438|3438| 			this.orderQueue.splice(i, 1);
|3439|3439| 		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
|3517|3517| };
|3518|3518| 
|3519|3519| 
|3520|    |-//// FSM linkage functions ////
|    |3520|+// // FSM linkage functions ////
|3521|3521| 
|3522|3522| UnitAI.prototype.SetNextState = function(state)
|3523|3523| {
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3691|3691| 				continue;
|3692|3692| 			if (this.orderQueue[i].type == type)
|3693|3693| 				continue;
|3694|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3694|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3695|3695| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3696|3696| 			return;
|3697|3697| 		}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3691|3691| 				continue;
|3692|3692| 			if (this.orderQueue[i].type == type)
|3693|3693| 				continue;
|3694|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3694|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3695|3695| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3696|3696| 			return;
|3697|3697| 		}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3705|3705| {
|3706|3706| 	// Remember the previous work orders to be able to go back to them later if required
|3707|3707| 	if (data && data.force)
|3708|    |-	{
|    |3708|+	
|3709|3709| 		if (this.IsFormationController())
|3710|3710| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3711|3711| 		else
|3712|3712| 			this.UpdateWorkOrders(type);
|3713|    |-	}
|    |3713|+	
|3714|3714| 
|3715|3715| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3716|3716| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3782|3782| 	{
|3783|3783| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3784|3784| 		if (cmpUnitAI)
|3785|    |-		{
|    |3785|+		
|3786|3786| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3787|3787| 			{
|3788|3788| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3791|3791| 					return;
|3792|3792| 				}
|3793|3793| 			}
|3794|    |-		}
|    |3794|+		
|3795|3795| 	}
|3796|3796| 
|3797|3797| 	// 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
|3784|3784| 		if (cmpUnitAI)
|3785|3785| 		{
|3786|3786| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3787|    |-			{
|    |3787|+			
|3788|3788| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3789|3789| 				{
|3790|3790| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3791|3791| 					return;
|3792|3792| 				}
|3793|    |-			}
|    |3793|+			
|3794|3794| 		}
|3795|3795| 	}
|3796|3796| 
|    | [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
|3796|3796| 
|3797|3797| 	// If nothing found, take the unit orders
|3798|3798| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3799|    |-	{
|    |3799|+	
|3800|3800| 		if (isWorkType(this.orderQueue[i].type))
|3801|3801| 		{
|3802|3802| 			this.workOrders = this.orderQueue.slice(i);
|3803|3803| 			return;
|3804|3804| 		}
|3805|    |-	}
|    |3805|+	
|3806|3806| };
|3807|3807| 
|3808|3808| 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
|3862|3862| 	if (data.timerRepeat === undefined)
|3863|3863| 		this.timer = undefined;
|3864|3864| 
|3865|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3865|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3866|3866| };
|3867|3867| 
|3868|3868| /**
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3862|3862| 	if (data.timerRepeat === undefined)
|3863|3863| 		this.timer = undefined;
|3864|3864| 
|3865|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3865|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3866|3866| };
|3867|3867| 
|3868|3868| /**
|    | [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
|3897|3897| 	this.timer = undefined;
|3898|3898| };
|3899|3899| 
|3900|    |-//// Message handlers /////
|    |3900|+// // Message handlers /////
|3901|3901| 
|3902|3902| UnitAI.prototype.OnMotionChanged = function(msg)
|3903|3903| {
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3902|3902| UnitAI.prototype.OnMotionChanged = function(msg)
|3903|3903| {
|3904|3904| 	if (msg.starting && !msg.error)
|3905|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3905|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveStarted", "data": msg});
|3906|3906| 	else if (!msg.starting || msg.error)
|3907|3907| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3908|3908| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3902|3902| UnitAI.prototype.OnMotionChanged = function(msg)
|3903|3903| {
|3904|3904| 	if (msg.starting && !msg.error)
|3905|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3905|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg });
|3906|3906| 	else if (!msg.starting || msg.error)
|3907|3907| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3908|3908| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3904|3904| 	if (msg.starting && !msg.error)
|3905|3905| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3906|3906| 	else if (!msg.starting || msg.error)
|3907|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3907|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveCompleted", "data": msg});
|3908|3908| };
|3909|3909| 
|3910|3910| 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
|3904|3904| 	if (msg.starting && !msg.error)
|3905|3905| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3906|3906| 	else if (!msg.starting || msg.error)
|3907|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3907|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg });
|3908|3908| };
|3909|3909| 
|3910|3910| 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
|3912|3912| 	// TODO: This is a bit inefficient since every unit listens to every
|3913|3913| 	// construction message - ideally we could scope it to only the one we're building
|3914|3914| 
|3915|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3915|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3916|3916| };
|3917|3917| 
|3918|3918| 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
|3912|3912| 	// TODO: This is a bit inefficient since every unit listens to every
|3913|3913| 	// construction message - ideally we could scope it to only the one we're building
|3914|3914| 
|3915|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3915|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3916|3916| };
|3917|3917| 
|3918|3918| 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
|3937|3937| 
|3938|3938| UnitAI.prototype.OnAttacked = function(msg)
|3939|3939| {
|3940|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3940|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3941|3941| };
|3942|3942| 
|3943|3943| 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
|3937|3937| 
|3938|3938| UnitAI.prototype.OnAttacked = function(msg)
|3939|3939| {
|3940|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3940|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3941|3941| };
|3942|3942| 
|3943|3943| 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
|3942|3942| 
|3943|3943| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3944|3944| {
|3945|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3945|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|3946|3946| };
|3947|3947| 
|3948|3948| 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
|3942|3942| 
|3943|3943| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3944|3944| {
|3945|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3945|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|3946|3946| };
|3947|3947| 
|3948|3948| 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
|3947|3947| 
|3948|3948| UnitAI.prototype.OnHealthChanged = function(msg)
|3949|3949| {
|3950|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3950|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|3951|3951| };
|3952|3952| 
|3953|3953| 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
|3947|3947| 
|3948|3948| UnitAI.prototype.OnHealthChanged = function(msg)
|3949|3949| {
|3950|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3950|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|3951|3951| };
|3952|3952| 
|3953|3953| 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
|3953|3953| UnitAI.prototype.OnRangeUpdate = function(msg)
|3954|3954| {
|3955|3955| 	if (msg.tag == this.losRangeQuery)
|3956|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3956|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|3957|3957| 	else if (msg.tag == this.losHealRangeQuery)
|3958|3958| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3959|3959| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3953|3953| UnitAI.prototype.OnRangeUpdate = function(msg)
|3954|3954| {
|3955|3955| 	if (msg.tag == this.losRangeQuery)
|3956|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3956|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|3957|3957| 	else if (msg.tag == this.losHealRangeQuery)
|3958|3958| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3959|3959| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3955|3955| 	if (msg.tag == this.losRangeQuery)
|3956|3956| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3957|3957| 	else if (msg.tag == this.losHealRangeQuery)
|3958|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3958|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|3959|3959| };
|3960|3960| 
|3961|3961| 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
|3955|3955| 	if (msg.tag == this.losRangeQuery)
|3956|3956| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3957|3957| 	else if (msg.tag == this.losHealRangeQuery)
|3958|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3958|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|3959|3959| };
|3960|3960| 
|3961|3961| 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
|3960|3960| 
|3961|3961| UnitAI.prototype.OnPackFinished = function(msg)
|3962|3962| {
|3963|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3963|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|3964|3964| };
|3965|3965| 
|3966|3966| //// 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
|3960|3960| 
|3961|3961| UnitAI.prototype.OnPackFinished = function(msg)
|3962|3962| {
|3963|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3963|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|3964|3964| };
|3965|3965| 
|3966|3966| //// 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
|3963|3963| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|3964|3964| };
|3965|3965| 
|3966|    |-//// Helper functions to be called by the FSM ////
|    |3966|+// // Helper functions to be called by the FSM ////
|3967|3967| 
|3968|3968| UnitAI.prototype.GetWalkSpeed = function()
|3969|3969| {
|    | [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
|4067|4067| 	if (!cmpOwnership || cmpOwnership.GetOwner() == INVALID_PLAYER)
|4068|4068| 		return undefined;
|4069|4069| 
|4070|    |-	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position)
|    |4070|+	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
|4071|4071| 	if (!cmpPosition || !cmpPosition.IsInWorld())
|4072|4072| 		return undefined;
|4073|4073| 
|    | [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
|4152|4152| 			PlaySound(name, member);
|4153|4153| 	}
|4154|4154| 	else
|4155|    |-	{
|    |4155|+	
|4156|4156| 		// Otherwise use our own sounds
|4157|4157| 		PlaySound(name, this.entity);
|4158|    |-	}
|    |4158|+	
|4159|4159| };
|4160|4160| 
|4161|4161| /*
|    | [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
|4321|4321| 	else
|4322|4322| 		// return false? Or hope you come close enough?
|4323|4323| 		var parabolicMaxRange = 0;
|4324|    |-		//return false;
|    |4324|+		// return false;
|4325|4325| 
|4326|4326| 	// the parabole changes while walking, take something in the middle
|4327|4327| 	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
|4386|4386| 	if (this.IsFormationMember())
|4387|4387| 	{
|4388|4388| 		var cmpFormationUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|4389|    |-		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation()
|4390|    |-			&& cmpFormationUnitAI.order.data.target == target)
|    |4389|+		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation() &&
|    |4390|+			cmpFormationUnitAI.order.data.target == target)
|4391|4391| 			return true;
|4392|4392| 	}
|4393|4393| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4554|4554| UnitAI.prototype.AttackEntityInZone = function(ents)
|4555|4555| {
|4556|4556| 	var target = ents.find(target =>
|4557|    |-		this.CanAttack(target)
|4558|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4557|+		this.CanAttack(target) &&
|    |4558|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4559|4559| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4560|4560| 	);
|4561|4561| 	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
|4555|4555| {
|4556|4556| 	var target = ents.find(target =>
|4557|4557| 		this.CanAttack(target)
|4558|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4559|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4558|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4559|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4560|4560| 	);
|4561|4561| 	if (!target)
|4562|4562| 		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
|4619|4619| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4620|4620| 	if (this.isGuardOf)
|4621|4621| 	{
|4622|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4622|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4623|4623| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4624|4624| 		if (cmpUnitAI && cmpAttack &&
|4625|4625| 		    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
|4623|4623| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4624|4624| 		if (cmpUnitAI && cmpAttack &&
|4625|4625| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4626|    |-				return false;
|    |4626|+			return false;
|4627|4627| 	}
|4628|4628| 
|4629|4629| 	// 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
|4628|4628| 
|4629|4629| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4630|4630| 	if (this.GetStance().respondHoldGround)
|4631|    |-	{
|    |4631|+	
|4632|4632| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4633|4633| 			return true;
|4634|    |-	}
|    |4634|+	
|4635|4635| 
|4636|4636| 	// Stop if it's left our vision range, unless we're especially persistent
|4637|4637| 	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
|4635|4635| 
|4636|4636| 	// Stop if it's left our vision range, unless we're especially persistent
|4637|4637| 	if (!this.GetStance().respondChaseBeyondVision)
|4638|    |-	{
|    |4638|+	
|4639|4639| 		if (!this.CheckTargetIsInVisionRange(target))
|4640|4640| 			return true;
|4641|    |-	}
|    |4641|+	
|4642|4642| 
|4643|4643| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4644|4644| 	// 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
|4661|4661| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4662|4662| 	if (this.isGuardOf)
|4663|4663| 	{
|4664|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4664|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4665|4665| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4666|4666| 		if (cmpUnitAI && cmpAttack &&
|4667|4667| 		    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
|4674|4674| 	return false;
|4675|4675| };
|4676|4676| 
|4677|    |-//// External interface functions ////
|    |4677|+// // External interface functions ////
|4678|4678| 
|4679|4679| UnitAI.prototype.SetFormationController = function(ent)
|4680|4680| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4684|4684| 	// of our own formation (or ourself if not in formation)
|4685|4685| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4686|4686| 	if (cmpObstruction)
|4687|    |-	{
|    |4687|+	
|4688|4688| 		if (ent == INVALID_ENTITY)
|4689|4689| 			cmpObstruction.SetControlGroup(this.entity);
|4690|4690| 		else
|4691|4691| 			cmpObstruction.SetControlGroup(ent);
|4692|    |-	}
|    |4692|+	
|4693|4693| 
|4694|4694| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4695|4695| 	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
|4827|4827| 	// if we already had an old guard order, do nothing if the target is the same
|4828|4828| 	// and the order is running, otherwise remove the previous order
|4829|4829| 	if (this.isGuardOf)
|4830|    |-	{
|    |4830|+	
|4831|4831| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4832|4832| 			return;
|4833|4833| 		else
|4834|4834| 			this.RemoveGuard();
|4835|    |-	}
|    |4835|+	
|4836|4836| 
|4837|4837| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4838|4838| };
|    | [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
|4830|4830| 	{
|4831|4831| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4832|4832| 			return;
|4833|    |-		else
|4834|    |-			this.RemoveGuard();
|    |4833|+		this.RemoveGuard();
|4835|4834| 	}
|4836|4835| 
|4837|4836| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5001|5001| 			this.WalkToTarget(target, queued);
|5002|5002| 		return;
|5003|5003| 	}
|5004|    |-	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture}, queued);
|    |5004|+	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture }, queued);
|5005|5005| };
|5006|5006| 
|5007|5007| /**
|    | [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
|5150|5150| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5151|5151| 	{
|5152|5152| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5153|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5153|+		if (cmpTrader.HasBothMarkets() &&
|5154|5154| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5155|5155| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5156|5156| 		{
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5433|5433| 				{
|5434|5434| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5435|5435| 					var targetClasses = this.order.data.targetClasses;
|5436|    |-					if (targetClasses.attack && cmpIdentity
|5437|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5436|+					if (targetClasses.attack && cmpIdentity &&
|    |5437|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5438|5438| 						continue;
|5439|5439| 					if (targetClasses.avoid && cmpIdentity
|5440|5440| 						&& 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
|5436|5436| 					if (targetClasses.attack && cmpIdentity
|5437|5437| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5438|5438| 						continue;
|5439|    |-					if (targetClasses.avoid && cmpIdentity
|5440|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5439|+					if (targetClasses.avoid && cmpIdentity &&
|    |5440|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5441|5441| 						continue;
|5442|5442| 					// Only used by the AIs to prevent some choices of targets
|5443|5443| 					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
|5459|5459| 		{
|5460|5460| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5461|5461| 			var targetClasses = this.order.data.targetClasses;
|5462|    |-			if (cmpIdentity && targetClasses.attack
|5463|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5462|+			if (cmpIdentity && targetClasses.attack &&
|    |5463|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5464|5464| 				continue;
|5465|5465| 			if (cmpIdentity && targetClasses.avoid
|5466|5466| 				&& 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
|5462|5462| 			if (cmpIdentity && targetClasses.attack
|5463|5463| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5464|5464| 				continue;
|5465|    |-			if (cmpIdentity && targetClasses.avoid
|5466|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5465|+			if (cmpIdentity && targetClasses.avoid &&
|    |5466|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5467|5467| 				continue;
|5468|5468| 			// Only used by the AIs to prevent some choices of targets
|5469|5469| 			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
|5595|5595| 
|5596|5596| UnitAI.prototype.SetHeldPosition = function(x, z)
|5597|5597| {
|5598|    |-	this.heldPosition = {"x": x, "z": z};
|    |5598|+	this.heldPosition = { "x": x, "z": z};
|5599|5599| };
|5600|5600| 
|5601|5601| 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
|5595|5595| 
|5596|5596| UnitAI.prototype.SetHeldPosition = function(x, z)
|5597|5597| {
|5598|    |-	this.heldPosition = {"x": x, "z": z};
|    |5598|+	this.heldPosition = {"x": x, "z": z };
|5599|5599| };
|5600|5600| 
|5601|5601| 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
|5622|5622| 	return false;
|5623|5623| };
|5624|5624| 
|5625|    |-//// Helper functions ////
|    |5625|+// // Helper functions ////
|5626|5626| 
|5627|5627| UnitAI.prototype.CanAttack = function(target)
|5628|5628| {
|    | [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
|5826|5826| 	return cmpPack && cmpPack.IsPacking();
|5827|5827| };
|5828|5828| 
|5829|    |-//// Formation specific functions ////
|    |5829|+// // Formation specific functions ////
|5830|5830| 
|5831|5831| UnitAI.prototype.IsAttackingAsFormation = function()
|5832|5832| {
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5831|5831| UnitAI.prototype.IsAttackingAsFormation = function()
|5832|5832| {
|5833|5833| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5834|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5835|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5834|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5835|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5836|5836| };
|5837|5837| 
|5838|5838| //// 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
|5835|5835| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5836|5836| };
|5837|5837| 
|5838|    |-//// Animal specific functions ////
|    |5838|+// // Animal specific functions ////
|5839|5839| 
|5840|5840| UnitAI.prototype.MoveRandomly = function(distance)
|5841|5841| {

binaries/data/mods/public/simulation/components/UnitAI.js
|2407| »   »   »   »   »   »   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
|3767| »   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
|4541| »   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
|4556| »   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
|4602| »   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
|4625| »   »   ····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
|5081| »   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
| 365| »   »   ····&&·(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
|1880| »   »   »   »   »   »   var·cmpFormation·=·Engine.QueryInterface(this.formationController,·IID_Formation);
|    | [NORMAL] JSHintBear:
|    | 'cmpFormation' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|2016| »   »   »   »   »   »   &&·this.order.data.target·!=·msg.data.attacker·&&·this.GetBestAttackAgainst(msg.data.attacker,·true)·!=·"Capture")
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4334| »   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
|4390| »   »   »   &&·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
|4558| »   »   &&·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
|4559| »   »   &&·(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
|5081| »   var·lastPos·=·undefined;
|    | [NORMAL] JSHintBear:
|    | It's not necessary to initialize 'lastPos' to 'undefined'.

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

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|5552| »   »   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/411/display/redirect

mimo added a comment.Apr 19 2018, 7:11 PM

In fact, on second thought, i'd prefer the previous version: when in defense stance with attack-move, it means that you want to defend something around the position you give and it makes sense to start the real attack-move only when you are around that position, otherwise you'd better choose the aggressive stance.

In D1458#59699, @mimo wrote:

In fact, on second thought, i'd prefer the previous version: when in defense stance with attack-move, it means that you want to defend something around the position you give and it makes sense to start the real attack-move only when you are around that position, otherwise you'd better choose the aggressive stance.

How should standground behave?

mimo added a comment.EditedApr 19 2018, 8:50 PM
In D1458#59700, @temple wrote:
In D1458#59699, @mimo wrote:

How should standground behave?

I would say:

  • agressive: attack everything on the route, chasing it
  • standground: attack everything *on range* on the route, but don't chase (do not deviate from a straight line to the goal)
  • defensive: attack everything around the goal, not those enemy which are far from it even if on range

That's what was done in the previous version. But defensive may be subject to different interpretation, not clear to me what most people would expect.

In D1458#59703, @mimo wrote:
In D1458#59700, @temple wrote:

How should standground behave?

I would say:

  • agressive: attack everything on the route, chasing it
  • standground: attack everything *on range* on the route, but don't chase (do not deviate from a straight line to the goal)
  • defensive: attack everything around the goal, not those enemy which are far from it even if on range

That's what was done in the previous version. But defensive may be subject to different interpretation, not clear to me what most people would expect.

Seems inconsistent for standground units to stop and attack when units in range but for defensive units to not do that?
I'm just thinking players will think it's a bug if they tell units to attack-move (or patrol, does this apply to that too?) and instead the units only move.

mimo abandoned this revision.Apr 20 2018, 4:47 PM

Before that patch, all stances would be nearly equivalent in attack-move as all orders were treated as forced, which has precedence on stance.
Now, we have quite different behaviors and choosing different stances has some consequences, so that's fine with me and i cannot say better than "commandeer the patch and commit the version you like more" (i don't really mind, and you can consider it as accepted by me as I wrote it).

But the last version has some drawbacks, as when putting the holdPosition on the current position, you may be drifted very far from your route which is contradictory with the defensive stance (it would work as expected if we could only update the holdPosition when along the initial route, not when we have started to chase ... that may be a way to go but at first sight, it needs quite some changes not compatible imo with such a nearby release (the patch in that last version already modifies too much for my taste).

On the other side, there are use case with the previous version with minimal changes, for example when you want to send your army to an attacked spot, and don't want it to be distracted by possible enemies on the route which would make them drift to a not wanted position.

In D1458#59806, @mimo wrote:

Before that patch, all stances would be nearly equivalent in attack-move as all orders were treated as forced, which has precedence on stance.
Now, we have quite different behaviors and choosing different stances has some consequences, so that's fine with me and i cannot say better than "commandeer the patch and commit the version you like more" (i don't really mind, and you can consider it as accepted by me as I wrote it).

But the last version has some drawbacks, as when putting the holdPosition on the current position, you may be drifted very far from your route which is contradictory with the defensive stance (it would work as expected if we could only update the holdPosition when along the initial route, not when we have started to chase ... that may be a way to go but at first sight, it needs quite some changes not compatible imo with such a nearby release (the patch in that last version already modifies too much for my taste).

On the other side, there are use case with the previous version with minimal changes, for example when you want to send your army to an attacked spot, and don't want it to be distracted by possible enemies on the route which would make them drift to a not wanted position.

The packing bug should be fixed in any case. (I'm not interested in taking this over or making decisions on how stances should behave.)

mimo added a comment.Apr 21 2018, 1:46 PM
In D1458#59831, @temple wrote:

The packing bug should be fixed in any case. (I'm not interested in taking this over or making decisions on how stances should behave.)

Then you (or somebody else) has to accept the patch, as simple as that. I also don't have time nor interest to discuss further the way stances should work in attack-move, so if anybody is interested, he should commandeer this patch, otherwise i'm fine with the first version and will commit it when accepted.

In D1458#59879, @mimo wrote:
In D1458#59831, @temple wrote:

Then you (or somebody else) has to accept the patch, as simple as that. I also don't have time nor interest to discuss further the way stances should work in attack-move, so if anybody is interested, he should commandeer this patch, otherwise i'm fine with the first version and will commit it when accepted.

I accept moving the pack lines, I don't accept changing the attack-move behavior.

mimo added a comment.Apr 21 2018, 8:55 PM
In D1458#59893, @temple wrote:
In D1458#59879, @mimo wrote:
In D1458#59831, @temple wrote:

Then you (or somebody else) has to accept the patch, as simple as that. I also don't have time nor interest to discuss further the way stances should work in attack-move, so if anybody is interested, he should commandeer this patch, otherwise i'm fine with the first version and will commit it when accepted.

I accept moving the pack lines, I don't accept changing the attack-move behavior.

And i would consider that as a poor review's job to be satisfied by only fixing part of the problems. Try what is described above, having a catapult in attack-move with an enemy unit on its route, and when attacked, move the unit out of range. The catapult will stay indefinitely unpacked, trying to chase, with or without the lines switching. But all that is already described above.

This seems to solve the chase problem for siege? (And attack-move changes can be saved for a24.)

binaries/data/mods/public/simulation/components/UnitAI.js
1850

In Order.Attack we pack before moving, so shouldn't we do the same here?

if (this.CanPack())
{
	this.PushOrderFront("Pack", { "force": true });
	return;
}
1963

And here.

2538

(Maybe here, I guess.)

mimo added a comment.Apr 23 2018, 11:40 AM
In D1458#59987, @temple wrote:

This seems to solve the chase problem for siege? (And attack-move changes can be saved for a24.)

Not really, that would make the siege to chase, but that's an unwanted behavior as its default stance is standground. When attack-move with catapults, you don't want them to chase any nearby units (which are much faster than them) but rather bomb anything on their route. Once again, the root of the problem is that the Attack suborder of a move-attack is considered as force=true while it should be force=false so to behave as expected from its stance.

That said, having the canPack at the place you mention seems to be useful to avoid units to be stuck.

In D1458#60001, @mimo wrote:
In D1458#59987, @temple wrote:

This seems to solve the chase problem for siege? (And attack-move changes can be saved for a24.)

Not really, that would make the siege to chase, but that's an unwanted behavior as its default stance is standground. When attack-move with catapults, you don't want them to chase any nearby units (which are much faster than them) but rather bomb anything on their route. Once again, the root of the problem is that the Attack suborder of a move-attack is considered as force=true while it should be force=false so to behave as expected from its stance.

That said, having the canPack at the place you mention seems to be useful to avoid units to be stuck.

In a22 non-packable standground units do chase, so I think we should keep force=true for a23 anyway.

mimo added a comment.Apr 23 2018, 11:00 PM
In D1458#60068, @temple wrote:
In D1458#60001, @mimo wrote:
In D1458#59987, @temple wrote:

This seems to solve the chase problem for siege? (And attack-move changes can be saved for a24.)

Not really, that would make the siege to chase, but that's an unwanted behavior as its default stance is standground. When attack-move with catapults, you don't want them to chase any nearby units (which are much faster than them) but rather bomb anything on their route. Once again, the root of the problem is that the Attack suborder of a move-attack is considered as force=true while it should be force=false so to behave as expected from its stance.

That said, having the canPack at the place you mention seems to be useful to avoid units to be stuck.

In a22 non-packable standground units do chase, so I think we should keep force=true for a23 anyway.

I don't quite follow the logic. because we have a bug in An, we should keep it in An+1?
Yep, all units would chase in A22 independently of their stance because of the force=true. But that was a mistake to have it so. That's what i keep saying since the beginning of this ticket. That looks like a sterile discussion.

In D1458#60069, @mimo wrote:
In D1458#60068, @temple wrote:
In D1458#60001, @mimo wrote:
In D1458#59987, @temple wrote:

This seems to solve the chase problem for siege? (And attack-move changes can be saved for a24.)

Not really, that would make the siege to chase, but that's an unwanted behavior as its default stance is standground. When attack-move with catapults, you don't want them to chase any nearby units (which are much faster than them) but rather bomb anything on their route. Once again, the root of the problem is that the Attack suborder of a move-attack is considered as force=true while it should be force=false so to behave as expected from its stance.

That said, having the canPack at the place you mention seems to be useful to avoid units to be stuck.

In a22 non-packable standground units do chase, so I think we should keep force=true for a23 anyway.

I don't quite follow the logic. because we have a bug in An, we should keep it in An+1?
Yep, all units would chase in A22 independently of their stance because of the force=true. But that was a mistake to have it so. That's what i keep saying since the beginning of this ticket. That looks like a sterile discussion.

If we tell a unit to attack, they'll chase regardless of their stance. If we tell a unit to attack-move, whether they should also chase regardless of their stance is a design question (not a bug).

What is a bug are the packing problems bb pointed out.