Page MenuHomeWildfire Games

Enable vision range for skittish animals to fix behaviour depending on their los
Needs ReviewPublic

Authored by Angen on May 13 2019, 10:12 AM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

Animals with skittish behaviour should flee when they are feeding and someone enters their los, but their vision inherited from template_unit_fauna.xml is 0 so they do not flee and stay there.

Update chase and approach behaviour so unit starts to run if target starts running.

Test Plan

Come near to deer (e.g) while feeding. It should run away.

Diff Detail

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

Event Timeline

Angen created this revision.May 13 2019, 10:12 AM
Angen edited the summary of this revision. (Show Details)
Stan added a subscriber: Stan.May 13 2019, 10:15 AM

Can you check if it wasn't removed to fix the infinite chase bug ?

well, melee units now cannot catch their pray because they do not start to run after it.

Angen updated this revision to Diff 7987.May 13 2019, 10:37 AM

start running if target starts fleeing

Angen updated this revision to Diff 7988.May 13 2019, 10:41 AM

reset move speed

Nescio added a subscriber: Nescio.May 13 2019, 10:42 AM

How about non-skittish animals? Wouldn't it be better if 10 vision was set in template_unit_fauna.xml?

Angen edited the summary of this revision. (Show Details)May 13 2019, 10:42 AM
Angen added a comment.EditedMay 13 2019, 10:51 AM

los range update for animals has cases: attack, flee (when skittish), animals which can attack have their vision range > 0, now skittish animals have their range > 0 so they can flee, every other animals (sheep, chicken - domestic animals) have no vision so they will not trigger onlosrangeupdate which will do nothing in their case anyway.

I guess this could be reason for setting vision to 0 in https://code.wildfiregames.com/rP14027, sadly cannot enter ticket.

Actually most other animals do have vision. The current situation is:

 0 – template_unit_fauna.xml
20 – template_unit_fauna_breed.xml
10 – template_unit_fauna_breed_passive.xml
20 – template_unit_fauna_herd.xml
 6 – template_unit_fauna_herd_domestic.xml
10 – template_unit_fauna_hunt_aggressive.xml
10 – template_unit_fauna_hunt_violent.xml
10 – template_unit_fauna_wild_aggressive.xml
10 – template_unit_fauna_wild_violent.xml
Stan added a subscriber: wraitii.May 13 2019, 11:09 AM
Stan added inline comments.
binaries/data/mods/public/simulation/components/UnitAI.js
1784

@wraitii's fix ? :D

1806

Maybe:

let cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
if (!cmpUnitAI || !cmpUnitAI.IsFleeing())
    return;

// Run after the fleeing target
this.SetMoveSpeedRatio(this.GetRunMultiplier());
2060

Since it's both time the same code, maybe make it a function ?

Angen added inline comments.May 13 2019, 11:12 AM
binaries/data/mods/public/simulation/components/UnitAI.js
1784

it is related only to code I just added

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

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

Stan added a comment.May 13 2019, 11:14 AM

What happens if the unit is in formation ?

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

Oh okay.

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 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.SetNextState("ANIMAL.COMBAT.ATTACKING");
| 461| 461| 				else
| 462| 462| 					this.SetNextState("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 (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
|1797|1797| 						if (this.GetStance().respondHoldGround)
|1798|1798| 							this.WalkToHeldPosition();
|1799|1799| 					}
|1800|    |-					else 
|    |1800|+					else
|1801|1801| 					{
|1802|1802| 						// Check if target does not started to run
|1803|1803| 						let cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1802|1802| 						// Check if target does not started to run
|1803|1803| 						let cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|1804|1804| 						if (cmpUnitAI && cmpUnitAI.IsFleeing())
|1805|    |-						{
|    |1805|+						
|1806|1806| 							// Run after a fleeing target
|1807|1807| 							this.SetMoveSpeedRatio(this.GetRunMultiplier());
|1808|    |-						}
|    |1808|+						
|1809|1809| 					}
|1810|1810| 				},
|1811|1811| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/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| 				"MoveCompleted": function() {
|1813|1813| 
|1814|1814| 					if (this.CheckTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1815|    |-					{
|    |1815|+					
|1816|1816| 						// If the unit needs to unpack, do so
|1817|1817| 						if (this.CanUnpack())
|1818|1818| 						{
|1821|1821| 						}
|1822|1822| 						else
|1823|1823| 							this.SetNextState("ATTACKING");
|1824|    |-					}
|    |1824|+					
|1825|1825| 					else
|1826|1826| 					{
|1827|1827| 						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
|1819|1819| 							this.PushOrderFront("Unpack", { "force": true });
|1820|1820| 							return;
|1821|1821| 						}
|1822|    |-						else
|1823|    |-							this.SetNextState("ATTACKING");
|    |1822|+						this.SetNextState("ATTACKING");
|1824|1823| 					}
|1825|1824| 					else
|1826|1825| 					{
|    | [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
|1823|1823| 							this.SetNextState("ATTACKING");
|1824|1824| 					}
|1825|1825| 					else
|1826|    |-					{
|    |1826|+					
|1827|1827| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1828|1828| 						{
|1829|1829| 							this.SetNextState("APPROACHING");
|1833|1833| 							// Give up
|1834|1834| 							this.FinishOrder();
|1835|1835| 						}
|1836|    |-					}
|    |1836|+					
|1837|1837| 				},
|1838|1838| 			},
|1839|1839| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1825|1825| 					else
|1826|1826| 					{
|1827|1827| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1828|    |-						{
|    |1828|+						
|1829|1829| 							this.SetNextState("APPROACHING");
|1830|    |-						}
|    |1830|+						
|1831|1831| 						else
|1832|1832| 						{
|1833|1833| 							// 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
|1829|1829| 							this.SetNextState("APPROACHING");
|1830|1830| 						}
|1831|1831| 						else
|1832|    |-						{
|    |1832|+						
|1833|1833| 							// Give up
|1834|1834| 							this.FinishOrder();
|1835|    |-						}
|    |1835|+						
|1836|1836| 					}
|1837|1837| 				},
|1838|1838| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/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| 					// Check the target is still alive and attackable
|1852|1852| 					if (this.CanAttack(target) && !this.CheckTargetAttackRange(target, this.order.data.attackType))
|1853|    |-					{
|    |1853|+					
|1854|1854| 						// Can't reach it - try to chase after it
|1855|1855| 						if (this.ShouldChaseTargetedEntity(target, this.order.data.force))
|1856|1856| 						{
|1865|1865| 								return;
|1866|1866| 							}
|1867|1867| 						}
|1868|    |-					}
|    |1868|+					
|1869|1869| 
|1870|1870| 					var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|1871|1871| 					this.attackTimers = cmpAttack.GetTimers(this.order.data.attackType);
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1896|1896| 					// TODO: we should probably only bother syncing projectile attacks, not melee
|1897|1897| 
|1898|1898| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|1899|    |-					this.resyncAnimation = (prepare != this.attackTimers.prepare) ? true : false;
|    |1899|+					this.resyncAnimation = (prepare != this.attackTimers.prepare);
|1900|1900| 
|1901|1901| 					this.FaceTowardsTarget(this.order.data.target);
|1902|1902| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2025|2025| 
|2026|2026| 				"Attacked": function(msg) {
|2027|2027| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2028|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2029|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2028|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2029|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2030|2030| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2031|2031| 				},
|2032|2032| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2039|2039| 					this.SelectAnimation("move");
|2040|2040| 					var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|2041|2041| 					if (cmpUnitAI && cmpUnitAI.IsFleeing())
|2042|    |-					{
|    |2042|+					
|2043|2043| 						// Run after a fleeing target
|2044|2044| 						this.SetMoveSpeedRatio(this.GetRunMultiplier());
|2045|    |-					}
|    |2045|+					
|2046|2046| 					this.StartTimer(1000, 1000);
|2047|2047| 				},
|2048|2048| 
|    | [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
|2065|2065| 						if (this.GetStance().respondHoldGround)
|2066|2066| 							this.WalkToHeldPosition();
|2067|2067| 					}
|2068|    |-					else 
|    |2068|+					else
|2069|2069| 					{
|2070|2070| 						// Check if target does not started to run
|2071|2071| 						let cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2070|2070| 						// Check if target does not started to run
|2071|2071| 						let cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|2072|2072| 						if (cmpUnitAI && cmpUnitAI.IsFleeing())
|2073|    |-						{
|    |2073|+						
|2074|2074| 							// Run after a fleeing target
|2075|2075| 							this.SetMoveSpeedRatio(this.GetRunMultiplier());
|2076|    |-						}
|    |2076|+						
|2077|2077| 					}
|2078|2078| 				},
|2079|2079| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2110|2110| 						// Also don't switch to a different type of huntable animal
|2111|2111| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2112|2112| 							return (
|2113|    |-								ent != oldTarget
|2114|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2113|+								ent != oldTarget &&
|    |2114|+								 ((type.generic == "treasure" && oldType.generic == "treasure")
|2115|2115| 								 || (type.specific == oldType.specific
|2116|2116| 								 && (type.specific != "meat" || oldTemplate == template)))
|2117|2117| 							);
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2111|2111| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2112|2112| 							return (
|2113|2113| 								ent != oldTarget
|2114|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2115|    |-								 || (type.specific == oldType.specific
|    |2114|+								 && ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2115|+								 (type.specific == oldType.specific
|2116|2116| 								 && (type.specific != "meat" || oldTemplate == template)))
|2117|2117| 							);
|2118|2118| 						}, 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
|2112|2112| 							return (
|2113|2113| 								ent != oldTarget
|2114|2114| 								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2115|    |-								 || (type.specific == oldType.specific
|2116|    |-								 && (type.specific != "meat" || oldTemplate == template)))
|    |2115|+								 || (type.specific == oldType.specific &&
|    |2116|+								 (type.specific != "meat" || oldTemplate == template)))
|2117|2117| 							);
|2118|2118| 						}, oldTarget);
|2119|2119| 						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
|2121|2121| 							this.PerformGather(nearby, false, false);
|2122|2122| 							return true;
|2123|2123| 						}
|2124|    |-						else
|2125|    |-						{
|    |2124|+						
|2126|2125| 							// It's probably better in this case, to avoid units getting stuck around a dropsite
|2127|2126| 							// in a "Target is far away, full, nearby are no good resources, return to dropsite" loop
|2128|2127| 							// to order it to GatherNear the resource position.
|2143|2142| 									return true;
|2144|2143| 								}
|2145|2144| 							}
|2146|    |-						}
|    |2145|+						
|2147|2146| 						return true;
|2148|2147| 					}
|2149|2148| 					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
|2133|2133| 								this.GatherNearPosition(pos.x, pos.z, oldType, oldTemplate);
|2134|2134| 								return true;
|2135|2135| 							}
|2136|    |-							else
|2137|    |-							{
|    |2136|+							
|2138|2137| 								// we're kind of stuck here. Return resource.
|2139|2138| 								var nearby = this.FindNearestDropsite(oldType.generic);
|2140|2139| 								if (nearby)
|2142|2141| 									this.PushOrderFront("ReturnResource", { "target": nearby, "force": false });
|2143|2142| 									return true;
|2144|2143| 								}
|2145|    |-							}
|    |2144|+							
|2146|2145| 						}
|2147|2146| 						return true;
|2148|2147| 					}
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2175|2175| 						// Also don't switch to a different type of huntable animal
|2176|2176| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2177|2177| 							return (
|2178|    |-								ent != oldTarget
|2179|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2178|+								ent != oldTarget &&
|    |2179|+								((type.generic == "treasure" && oldType.generic == "treasure")
|2180|2180| 								|| (type.specific == oldType.specific
|2181|2181| 								&& (type.specific != "meat" || oldTemplate == template)))
|2182|2182| 							);
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2176|2176| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2177|2177| 							return (
|2178|2178| 								ent != oldTarget
|2179|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2180|    |-								|| (type.specific == oldType.specific
|    |2179|+								&& ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2180|+								(type.specific == oldType.specific
|2181|2181| 								&& (type.specific != "meat" || oldTemplate == template)))
|2182|2182| 							);
|2183|2183| 						});
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2177|2177| 							return (
|2178|2178| 								ent != oldTarget
|2179|2179| 								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2180|    |-								|| (type.specific == oldType.specific
|2181|    |-								&& (type.specific != "meat" || oldTemplate == template)))
|    |2180|+								|| (type.specific == oldType.specific &&
|    |2181|+								(type.specific != "meat" || oldTemplate == template)))
|2182|2182| 							);
|2183|2183| 						});
|2184|2184| 						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
|2222|2222| 					// Also don't switch to a different type of huntable animal
|2223|2223| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2224|2224| 						return (
|2225|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2226|    |-							|| (type.specific == resourceType.specific
|    |2225|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2226|+							(type.specific == resourceType.specific
|2227|2227| 							&& (type.specific != "meat" || resourceTemplate == template))
|2228|2228| 						);
|2229|2229| 					});
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2223|2223| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2224|2224| 						return (
|2225|2225| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2226|    |-							|| (type.specific == resourceType.specific
|2227|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2226|+							|| (type.specific == resourceType.specific &&
|    |2227|+							(type.specific != "meat" || resourceTemplate == template))
|2228|2228| 						);
|2229|2229| 					});
|2230|2230| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2339|2339| 
|2340|2340| 					var cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply);
|2341|2341| 					if (cmpSupply && cmpSupply.IsAvailable(cmpOwnership.GetOwner(), this.entity))
|2342|    |-					{
|    |2342|+					
|2343|2343| 						// Check we can still reach and gather from the target
|2344|2344| 						if (this.CheckTargetRange(this.gatheringTarget, IID_ResourceGatherer) && this.CanGather(this.gatheringTarget))
|2345|2345| 						{
|2405|2405| 								return;
|2406|2406| 							}
|2407|2407| 						}
|2408|    |-					}
|    |2408|+					
|2409|2409| 
|2410|2410| 					// We're already in range, can't get anywhere near it or the target is exhausted.
|2411|2411| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2431|2431| 					// Also don't switch to a different type of huntable animal
|2432|2432| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2433|2433| 						return (
|2434|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2435|    |-							|| (type.specific == resourceType.specific
|    |2434|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2435|+							(type.specific == resourceType.specific
|2436|2436| 							&& (type.specific != "meat" || resourceTemplate == template))
|2437|2437| 						);
|2438|2438| 					});
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2432|2432| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2433|2433| 						return (
|2434|2434| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2435|    |-							|| (type.specific == resourceType.specific
|2436|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2435|+							|| (type.specific == resourceType.specific &&
|    |2436|+							(type.specific != "meat" || resourceTemplate == template))
|2437|2437| 						);
|2438|2438| 					});
|2439|2439| 					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
|2519|2519| 					this.StartTimer(prepare, this.healTimers.repeat);
|2520|2520| 
|2521|2521| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2522|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2522|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2523|2523| 
|2524|2524| 					this.FaceTowardsTarget(this.order.data.target);
|2525|2525| 				},
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2734|2734| 					{
|2735|2735| 						// The building was already finished/fully repaired before we arrived;
|2736|2736| 						// let the ConstructionFinished handler handle this.
|2737|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2737|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2738|2738| 						return true;
|2739|2739| 					}
|2740|2740| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2734|2734| 					{
|2735|2735| 						// The building was already finished/fully repaired before we arrived;
|2736|2736| 						// let the ConstructionFinished handler handle this.
|2737|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2737|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2738|2738| 						return true;
|2739|2739| 					}
|2740|2740| 
|    | [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
|2774|2774| 					if (this.MoveToTargetRange(this.repairTarget, IID_Builder))
|2775|2775| 						this.SetNextState("APPROACHING");
|2776|2776| 					else if (!this.CheckTargetRange(this.repairTarget, IID_Builder))
|2777|    |-						this.FinishOrder(); //can't approach and isn't in reach
|    |2777|+						this.FinishOrder(); // can't approach and isn't in reach
|2778|2778| 				},
|2779|2779| 			},
|2780|2780| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2861|2861| 
|2862|2862| 				// Unit was approaching and there's nothing to do now, so switch to walking
|2863|2863| 				if (oldState === "INDIVIDUAL.REPAIR.APPROACHING")
|2864|    |-				{
|    |2864|+				
|2865|2865| 					// We're already walking to the given point, so add this as a order.
|2866|2866| 					this.WalkToTarget(msg.data.newentity, true);
|2867|    |-				}
|    |2867|+				
|2868|2868| 			},
|2869|2869| 		},
|2870|2870| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2914|2914| 
|2915|2915| 					// Check that we can garrison here
|2916|2916| 					if (this.CanGarrison(target))
|2917|    |-					{
|    |2917|+					
|2918|2918| 						// Check that we're in range of the garrison target
|2919|2919| 						if (this.CheckGarrisonRange(target))
|2920|2920| 						{
|2990|2990| 								return false;
|2991|2991| 							}
|2992|2992| 						}
|2993|    |-					}
|    |2993|+					
|2994|2994| 					// Garrisoning failed for some reason, so finish the order
|2995|2995| 					this.FinishOrder();
|2996|2996| 					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
|3097|3097| 		"Attacked": function(msg) {
|3098|3098| 			if (this.template.NaturalBehaviour == "skittish" ||
|3099|3099| 			    this.template.NaturalBehaviour == "passive")
|3100|    |-			{
|    |3100|+			
|3101|3101| 				this.Flee(msg.data.attacker, false);
|3102|    |-			}
|    |3102|+			
|3103|3103| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|3104|3104| 			{
|3105|3105| 				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
|3106|3106| 					this.Attack(msg.data.attacker, false);
|3107|3107| 			}
|3108|3108| 			else if (this.template.NaturalBehaviour == "domestic")
|3109|    |-			{
|    |3109|+			
|3110|3110| 				// Never flee, stop what we were doing
|3111|3111| 				this.SetNextState("IDLE");
|3112|    |-			}
|    |3112|+			
|3113|3113| 		},
|3114|3114| 
|3115|3115| 		"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
|3116|3116| 			// Move a tile outside the building
|3117|3117| 			var range = 4;
|3118|3118| 			if (this.MoveToTargetRangeExplicit(msg.data.target, range, range))
|3119|    |-			{
|    |3119|+			
|3120|3120| 				// We've started walking to the given point
|3121|3121| 				this.SetNextState("WALKING");
|3122|    |-			}
|    |3122|+			
|3123|3123| 			else
|3124|3124| 			{
|3125|3125| 				// 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
|3121|3121| 				this.SetNextState("WALKING");
|3122|3122| 			}
|3123|3123| 			else
|3124|    |-			{
|    |3124|+			
|3125|3125| 				// We are already at the target, or can't move at all
|3126|3126| 				this.FinishOrder();
|3127|    |-			}
|    |3127|+			
|3128|3128| 		},
|3129|3129| 
|3130|3130| 		"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
|3163|3163| 				}
|3164|3164| 				// Start attacking one of the newly-seen enemy (if any)
|3165|3165| 				else if (this.IsDangerousAnimal())
|3166|    |-				{
|    |3166|+				
|3167|3167| 					this.AttackVisibleEntity(msg.data.added);
|3168|    |-				}
|    |3168|+				
|3169|3169| 
|3170|3170| 				// TODO: if two units enter our range together, we'll attack the
|3171|3171| 				// 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
|3206|3206| 				}
|3207|3207| 				// Start attacking one of the newly-seen enemy (if any)
|3208|3208| 				else if (this.template.NaturalBehaviour == "violent")
|3209|    |-				{
|    |3209|+				
|3210|3210| 					this.AttackVisibleEntity(msg.data.added);
|3211|    |-				}
|    |3211|+				
|3212|3212| 			},
|3213|3213| 
|3214|3214| 			"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
|3223|3223| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3224|3224| 
|3225|3225| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3226|    |-							// only used for domestic animals
|    |3226|+		// only used for domestic animals
|3227|3227| 	},
|3228|3228| };
|3229|3229| 
|    | [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
|3280|3280| 
|3281|3281| UnitAI.prototype.IsAnimal = function()
|3282|3282| {
|3283|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3283|+	return (!!this.template.NaturalBehaviour);
|3284|3284| };
|3285|3285| 
|3286|3286| 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
|3318|3318| UnitAI.prototype.GetGarrisonHolder = function()
|3319|3319| {
|3320|3320| 	if (this.IsGarrisoned())
|3321|    |-	{
|    |3321|+	
|3322|3322| 		for (let order of this.orderQueue)
|3323|3323| 			if (order.type == "Garrison")
|3324|3324| 				return order.data.target;
|3325|    |-	}
|    |3325|+	
|3326|3326| 	return INVALID_ENTITY;
|3327|3327| };
|3328|3328| 
|    | [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
|3396|3396| 		{
|3397|3397| 			let index = this.GetCurrentState().indexOf(".");
|3398|3398| 			if (index != -1)
|3399|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3399|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3400|3400| 			this.Stop(false);
|3401|3401| 		}
|3402|3402| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3452|3452| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3453|3453| 			continue;
|3454|3454| 		if (i == 0)
|3455|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3455|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3456|3456| 		else
|3457|3457| 			this.orderQueue.splice(i, 1);
|3458|3458| 		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
|3452|3452| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3453|3453| 			continue;
|3454|3454| 		if (i == 0)
|3455|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3455|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3456|3456| 		else
|3457|3457| 			this.orderQueue.splice(i, 1);
|3458|3458| 		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
|3536|3536| };
|3537|3537| 
|3538|3538| 
|3539|    |-//// FSM linkage functions ////
|    |3539|+// // FSM linkage functions ////
|3540|3540| 
|3541|3541| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3542|3542| UnitAI.prototype.SetNextState = function(state)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3708|3708| 				continue;
|3709|3709| 			if (this.orderQueue[i].type == type)
|3710|3710| 				continue;
|3711|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3711|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3712|3712| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3713|3713| 			return;
|3714|3714| 		}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3708|3708| 				continue;
|3709|3709| 			if (this.orderQueue[i].type == type)
|3710|3710| 				continue;
|3711|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3711|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3712|3712| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3713|3713| 			return;
|3714|3714| 		}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3722|3722| {
|3723|3723| 	// Remember the previous work orders to be able to go back to them later if required
|3724|3724| 	if (data && data.force)
|3725|    |-	{
|    |3725|+	
|3726|3726| 		if (this.IsFormationController())
|3727|3727| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3728|3728| 		else
|3729|3729| 			this.UpdateWorkOrders(type);
|3730|    |-	}
|    |3730|+	
|3731|3731| 
|3732|3732| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3733|3733| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3799|3799| 	{
|3800|3800| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3801|3801| 		if (cmpUnitAI)
|3802|    |-		{
|    |3802|+		
|3803|3803| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3804|3804| 			{
|3805|3805| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3808|3808| 					return;
|3809|3809| 				}
|3810|3810| 			}
|3811|    |-		}
|    |3811|+		
|3812|3812| 	}
|3813|3813| 
|3814|3814| 	// 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
|3801|3801| 		if (cmpUnitAI)
|3802|3802| 		{
|3803|3803| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3804|    |-			{
|    |3804|+			
|3805|3805| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3806|3806| 				{
|3807|3807| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3808|3808| 					return;
|3809|3809| 				}
|3810|    |-			}
|    |3810|+			
|3811|3811| 		}
|3812|3812| 	}
|3813|3813| 
|    | [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
|3813|3813| 
|3814|3814| 	// If nothing found, take the unit orders
|3815|3815| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3816|    |-	{
|    |3816|+	
|3817|3817| 		if (isWorkType(this.orderQueue[i].type))
|3818|3818| 		{
|3819|3819| 			this.workOrders = this.orderQueue.slice(i);
|3820|3820| 			return;
|3821|3821| 		}
|3822|    |-	}
|    |3822|+	
|3823|3823| };
|3824|3824| 
|3825|3825| 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
|3879|3879| 	if (data.timerRepeat === undefined)
|3880|3880| 		this.timer = undefined;
|3881|3881| 
|3882|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3882|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3883|3883| };
|3884|3884| 
|3885|3885| /**
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3879|3879| 	if (data.timerRepeat === undefined)
|3880|3880| 		this.timer = undefined;
|3881|3881| 
|3882|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3882|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3883|3883| };
|3884|3884| 
|3885|3885| /**
|    | [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
|3914|3914| 	this.timer = undefined;
|3915|3915| };
|3916|3916| 
|3917|    |-//// Message handlers /////
|    |3917|+// // Message handlers /////
|3918|3918| 
|3919|3919| UnitAI.prototype.OnMotionChanged = function(msg)
|3920|3920| {
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3919|3919| UnitAI.prototype.OnMotionChanged = function(msg)
|3920|3920| {
|3921|3921| 	if (msg.starting && !msg.error)
|3922|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3922|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveStarted", "data": msg});
|3923|3923| 	else if (!msg.starting || msg.error)
|3924|3924| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3925|3925| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3919|3919| UnitAI.prototype.OnMotionChanged = function(msg)
|3920|3920| {
|3921|3921| 	if (msg.starting && !msg.error)
|3922|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3922|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg });
|3923|3923| 	else if (!msg.starting || msg.error)
|3924|3924| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3925|3925| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3921|3921| 	if (msg.starting && !msg.error)
|3922|3922| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3923|3923| 	else if (!msg.starting || msg.error)
|3924|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3924|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveCompleted", "data": msg});
|3925|3925| };
|3926|3926| 
|3927|3927| 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
|3921|3921| 	if (msg.starting && !msg.error)
|3922|3922| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3923|3923| 	else if (!msg.starting || msg.error)
|3924|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3924|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg });
|3925|3925| };
|3926|3926| 
|3927|3927| 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
|3929|3929| 	// TODO: This is a bit inefficient since every unit listens to every
|3930|3930| 	// construction message - ideally we could scope it to only the one we're building
|3931|3931| 
|3932|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3932|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3933|3933| };
|3934|3934| 
|3935|3935| 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
|3929|3929| 	// TODO: This is a bit inefficient since every unit listens to every
|3930|3930| 	// construction message - ideally we could scope it to only the one we're building
|3931|3931| 
|3932|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3932|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3933|3933| };
|3934|3934| 
|3935|3935| 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
|3954|3954| 
|3955|3955| UnitAI.prototype.OnAttacked = function(msg)
|3956|3956| {
|3957|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3957|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3958|3958| };
|3959|3959| 
|3960|3960| 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
|3954|3954| 
|3955|3955| UnitAI.prototype.OnAttacked = function(msg)
|3956|3956| {
|3957|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3957|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3958|3958| };
|3959|3959| 
|3960|3960| 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
|3959|3959| 
|3960|3960| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3961|3961| {
|3962|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3962|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|3963|3963| };
|3964|3964| 
|3965|3965| 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
|3959|3959| 
|3960|3960| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3961|3961| {
|3962|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3962|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|3963|3963| };
|3964|3964| 
|3965|3965| 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
|3964|3964| 
|3965|3965| UnitAI.prototype.OnHealthChanged = function(msg)
|3966|3966| {
|3967|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3967|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|3968|3968| };
|3969|3969| 
|3970|3970| 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
|3964|3964| 
|3965|3965| UnitAI.prototype.OnHealthChanged = function(msg)
|3966|3966| {
|3967|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3967|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|3968|3968| };
|3969|3969| 
|3970|3970| 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
|3970|3970| UnitAI.prototype.OnRangeUpdate = function(msg)
|3971|3971| {
|3972|3972| 	if (msg.tag == this.losRangeQuery)
|3973|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3973|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|3974|3974| 	else if (msg.tag == this.losHealRangeQuery)
|3975|3975| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3976|3976| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3970|3970| UnitAI.prototype.OnRangeUpdate = function(msg)
|3971|3971| {
|3972|3972| 	if (msg.tag == this.losRangeQuery)
|3973|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3973|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|3974|3974| 	else if (msg.tag == this.losHealRangeQuery)
|3975|3975| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3976|3976| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3972|3972| 	if (msg.tag == this.losRangeQuery)
|3973|3973| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3974|3974| 	else if (msg.tag == this.losHealRangeQuery)
|3975|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3975|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|3976|3976| };
|3977|3977| 
|3978|3978| 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
|3972|3972| 	if (msg.tag == this.losRangeQuery)
|3973|3973| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3974|3974| 	else if (msg.tag == this.losHealRangeQuery)
|3975|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3975|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|3976|3976| };
|3977|3977| 
|3978|3978| 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
|3977|3977| 
|3978|3978| UnitAI.prototype.OnPackFinished = function(msg)
|3979|3979| {
|3980|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3980|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|3981|3981| };
|3982|3982| 
|3983|3983| //// 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
|3977|3977| 
|3978|3978| UnitAI.prototype.OnPackFinished = function(msg)
|3979|3979| {
|3980|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3980|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|3981|3981| };
|3982|3982| 
|3983|3983| //// 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
|3980|3980| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|3981|3981| };
|3982|3982| 
|3983|    |-//// Helper functions to be called by the FSM ////
|    |3983|+// // Helper functions to be called by the FSM ////
|3984|3984| 
|3985|3985| UnitAI.prototype.GetWalkSpeed = function()
|3986|3986| {
|    | [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
|4082|4082| 	if (!cmpOwnership || cmpOwnership.GetOwner() == INVALID_PLAYER)
|4083|4083| 		return undefined;
|4084|4084| 
|4085|    |-	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position)
|    |4085|+	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
|4086|4086| 	if (!cmpPosition || !cmpPosition.IsInWorld())
|4087|4087| 		return undefined;
|4088|4088| 
|    | [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
|4167|4167| 			PlaySound(name, member);
|4168|4168| 	}
|4169|4169| 	else
|4170|    |-	{
|    |4170|+	
|4171|4171| 		// Otherwise use our own sounds
|4172|4172| 		PlaySound(name, this.entity);
|4173|    |-	}
|    |4173|+	
|4174|4174| };
|4175|4175| 
|4176|4176| /*
|    | [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
|4336|4336| 	else
|4337|4337| 		// return false? Or hope you come close enough?
|4338|4338| 		var parabolicMaxRange = 0;
|4339|    |-		//return false;
|    |4339|+		// return false;
|4340|4340| 
|4341|4341| 	// the parabole changes while walking, take something in the middle
|4342|4342| 	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
|4401|4401| 	if (this.IsFormationMember())
|4402|4402| 	{
|4403|4403| 		var cmpFormationUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|4404|    |-		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation()
|4405|    |-			&& cmpFormationUnitAI.order.data.target == target)
|    |4404|+		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation() &&
|    |4405|+			cmpFormationUnitAI.order.data.target == target)
|4406|4406| 			return true;
|4407|4407| 	}
|4408|4408| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4569|4569| UnitAI.prototype.AttackEntityInZone = function(ents)
|4570|4570| {
|4571|4571| 	var target = ents.find(target =>
|4572|    |-		this.CanAttack(target)
|4573|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4572|+		this.CanAttack(target) &&
|    |4573|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4574|4574| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4575|4575| 	);
|4576|4576| 	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
|4570|4570| {
|4571|4571| 	var target = ents.find(target =>
|4572|4572| 		this.CanAttack(target)
|4573|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4574|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4573|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4574|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4575|4575| 	);
|4576|4576| 	if (!target)
|4577|4577| 		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
|4634|4634| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4635|4635| 	if (this.isGuardOf)
|4636|4636| 	{
|4637|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4637|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4638|4638| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4639|4639| 		if (cmpUnitAI && cmpAttack &&
|4640|4640| 		    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
|4638|4638| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4639|4639| 		if (cmpUnitAI && cmpAttack &&
|4640|4640| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4641|    |-				return false;
|    |4641|+			return false;
|4642|4642| 	}
|4643|4643| 
|4644|4644| 	// 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
|4643|4643| 
|4644|4644| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4645|4645| 	if (this.GetStance().respondHoldGround)
|4646|    |-	{
|    |4646|+	
|4647|4647| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4648|4648| 			return true;
|4649|    |-	}
|    |4649|+	
|4650|4650| 
|4651|4651| 	// Stop if it's left our vision range, unless we're especially persistent
|4652|4652| 	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
|4650|4650| 
|4651|4651| 	// Stop if it's left our vision range, unless we're especially persistent
|4652|4652| 	if (!this.GetStance().respondChaseBeyondVision)
|4653|    |-	{
|    |4653|+	
|4654|4654| 		if (!this.CheckTargetIsInVisionRange(target))
|4655|4655| 			return true;
|4656|    |-	}
|    |4656|+	
|4657|4657| 
|4658|4658| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4659|4659| 	// 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
|4676|4676| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4677|4677| 	if (this.isGuardOf)
|4678|4678| 	{
|4679|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4679|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4680|4680| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4681|4681| 		if (cmpUnitAI && cmpAttack &&
|4682|4682| 		    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
|4689|4689| 	return false;
|4690|4690| };
|4691|4691| 
|4692|    |-//// External interface functions ////
|    |4692|+// // External interface functions ////
|4693|4693| 
|4694|4694| UnitAI.prototype.SetFormationController = function(ent)
|4695|4695| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4699|4699| 	// of our own formation (or ourself if not in formation)
|4700|4700| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4701|4701| 	if (cmpObstruction)
|4702|    |-	{
|    |4702|+	
|4703|4703| 		if (ent == INVALID_ENTITY)
|4704|4704| 			cmpObstruction.SetControlGroup(this.entity);
|4705|4705| 		else
|4706|4706| 			cmpObstruction.SetControlGroup(ent);
|4707|    |-	}
|    |4707|+	
|4708|4708| 
|4709|4709| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4710|4710| 	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
|4842|4842| 	// if we already had an old guard order, do nothing if the target is the same
|4843|4843| 	// and the order is running, otherwise remove the previous order
|4844|4844| 	if (this.isGuardOf)
|4845|    |-	{
|    |4845|+	
|4846|4846| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4847|4847| 			return;
|4848|4848| 		else
|4849|4849| 			this.RemoveGuard();
|4850|    |-	}
|    |4850|+	
|4851|4851| 
|4852|4852| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4853|4853| };
|    | [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
|4845|4845| 	{
|4846|4846| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4847|4847| 			return;
|4848|    |-		else
|4849|    |-			this.RemoveGuard();
|    |4848|+		this.RemoveGuard();
|4850|4849| 	}
|4851|4850| 
|4852|4851| 	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
|5016|5016| 			this.WalkToTarget(target, queued);
|5017|5017| 		return;
|5018|5018| 	}
|5019|    |-	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture}, queued);
|    |5019|+	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture }, queued);
|5020|5020| };
|5021|5021| 
|5022|5022| /**
|    | [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
|5165|5165| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5166|5166| 	{
|5167|5167| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5168|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5168|+		if (cmpTrader.HasBothMarkets() &&
|5169|5169| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5170|5170| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5171|5171| 		{
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5446|5446| 				{
|5447|5447| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5448|5448| 					var targetClasses = this.order.data.targetClasses;
|5449|    |-					if (targetClasses.attack && cmpIdentity
|5450|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5449|+					if (targetClasses.attack && cmpIdentity &&
|    |5450|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5451|5451| 						continue;
|5452|5452| 					if (targetClasses.avoid && cmpIdentity
|5453|5453| 						&& 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
|5449|5449| 					if (targetClasses.attack && cmpIdentity
|5450|5450| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5451|5451| 						continue;
|5452|    |-					if (targetClasses.avoid && cmpIdentity
|5453|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5452|+					if (targetClasses.avoid && cmpIdentity &&
|    |5453|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5454|5454| 						continue;
|5455|5455| 					// Only used by the AIs to prevent some choices of targets
|5456|5456| 					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
|5472|5472| 		{
|5473|5473| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5474|5474| 			var targetClasses = this.order.data.targetClasses;
|5475|    |-			if (cmpIdentity && targetClasses.attack
|5476|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5475|+			if (cmpIdentity && targetClasses.attack &&
|    |5476|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5477|5477| 				continue;
|5478|5478| 			if (cmpIdentity && targetClasses.avoid
|5479|5479| 				&& 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
|5475|5475| 			if (cmpIdentity && targetClasses.attack
|5476|5476| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5477|5477| 				continue;
|5478|    |-			if (cmpIdentity && targetClasses.avoid
|5479|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5478|+			if (cmpIdentity && targetClasses.avoid &&
|    |5479|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5480|5480| 				continue;
|5481|5481| 			// Only used by the AIs to prevent some choices of targets
|5482|5482| 			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
|5618|5618| 
|5619|5619| UnitAI.prototype.SetHeldPosition = function(x, z)
|5620|5620| {
|5621|    |-	this.heldPosition = {"x": x, "z": z};
|    |5621|+	this.heldPosition = { "x": x, "z": z};
|5622|5622| };
|5623|5623| 
|5624|5624| 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
|5618|5618| 
|5619|5619| UnitAI.prototype.SetHeldPosition = function(x, z)
|5620|5620| {
|5621|    |-	this.heldPosition = {"x": x, "z": z};
|    |5621|+	this.heldPosition = {"x": x, "z": z };
|5622|5622| };
|5623|5623| 
|5624|5624| 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
|5645|5645| 	return false;
|5646|5646| };
|5647|5647| 
|5648|    |-//// Helper functions ////
|    |5648|+// // Helper functions ////
|5649|5649| 
|5650|5650| UnitAI.prototype.CanAttack = function(target)
|5651|5651| {
|    | [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
|5849|5849| 	return cmpPack && cmpPack.IsPacking();
|5850|5850| };
|5851|5851| 
|5852|    |-//// Formation specific functions ////
|    |5852|+// // Formation specific functions ////
|5853|5853| 
|5854|5854| UnitAI.prototype.IsAttackingAsFormation = function()
|5855|5855| {
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5854|5854| UnitAI.prototype.IsAttackingAsFormation = function()
|5855|5855| {
|5856|5856| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5857|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5858|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5857|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5858|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5859|5859| };
|5860|5860| 
|5861|5861| //// 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
|5858|5858| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5859|5859| };
|5860|5860| 
|5861|    |-//// Animal specific functions ////
|    |5861|+// // Animal specific functions ////
|5862|5862| 
|5863|5863| UnitAI.prototype.MoveRandomly = function(distance)
|5864|5864| {

binaries/data/mods/public/simulation/components/UnitAI.js
|2421| »   »   »   »   »   »   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
|3784| »   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
|4556| »   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
|4571| »   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
|4617| »   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
|4640| »   »   ····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
|5096| »   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
|1888| »   »   »   »   »   »   var·cmpFormation·=·Engine.QueryInterface(this.formationController,·IID_Formation);
|    | [NORMAL] JSHintBear:
|    | 'cmpFormation' is already defined.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4349| »   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
|4405| »   »   »   &&·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
|4573| »   »   &&·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
|4574| »   »   &&·(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
|5096| »   var·lastPos·=·undefined;
|    | [NORMAL] JSHintBear:
|    | It's not necessary to initialize 'lastPos' to 'undefined'.

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

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

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

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

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

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

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

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

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

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

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 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.SetNextState("ANIMAL.COMBAT.ATTACKING");
| 461| 461| 				else
| 462| 462| 					this.SetNextState("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 (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
|1798|1798| 						if (this.GetStance().respondHoldGround)
|1799|1799| 							this.WalkToHeldPosition();
|1800|1800| 					}
|1801|    |-					else 
|    |1801|+					else
|1802|1802| 					{
|1803|1803| 						// Check if target does not started to run
|1804|1804| 						let cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1803|1803| 						// Check if target does not started to run
|1804|1804| 						let cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|1805|1805| 						if (cmpUnitAI && cmpUnitAI.IsFleeing())
|1806|    |-						{
|    |1806|+						
|1807|1807| 							// Run after a fleeing target
|1808|1808| 							this.SetMoveSpeedRatio(this.GetRunMultiplier());
|1809|    |-						}
|    |1809|+						
|1810|1810| 					}
|1811|1811| 				},
|1812|1812| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1813|1813| 				"MoveCompleted": function() {
|1814|1814| 
|1815|1815| 					if (this.CheckTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1816|    |-					{
|    |1816|+					
|1817|1817| 						// If the unit needs to unpack, do so
|1818|1818| 						if (this.CanUnpack())
|1819|1819| 						{
|1822|1822| 						}
|1823|1823| 						else
|1824|1824| 							this.SetNextState("ATTACKING");
|1825|    |-					}
|    |1825|+					
|1826|1826| 					else
|1827|1827| 					{
|1828|1828| 						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
|1820|1820| 							this.PushOrderFront("Unpack", { "force": true });
|1821|1821| 							return;
|1822|1822| 						}
|1823|    |-						else
|1824|    |-							this.SetNextState("ATTACKING");
|    |1823|+						this.SetNextState("ATTACKING");
|1825|1824| 					}
|1826|1825| 					else
|1827|1826| 					{
|    | [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
|1824|1824| 							this.SetNextState("ATTACKING");
|1825|1825| 					}
|1826|1826| 					else
|1827|    |-					{
|    |1827|+					
|1828|1828| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1829|1829| 						{
|1830|1830| 							this.SetNextState("APPROACHING");
|1834|1834| 							// Give up
|1835|1835| 							this.FinishOrder();
|1836|1836| 						}
|1837|    |-					}
|    |1837|+					
|1838|1838| 				},
|1839|1839| 			},
|1840|1840| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1826|1826| 					else
|1827|1827| 					{
|1828|1828| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1829|    |-						{
|    |1829|+						
|1830|1830| 							this.SetNextState("APPROACHING");
|1831|    |-						}
|    |1831|+						
|1832|1832| 						else
|1833|1833| 						{
|1834|1834| 							// 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
|1830|1830| 							this.SetNextState("APPROACHING");
|1831|1831| 						}
|1832|1832| 						else
|1833|    |-						{
|    |1833|+						
|1834|1834| 							// Give up
|1835|1835| 							this.FinishOrder();
|1836|    |-						}
|    |1836|+						
|1837|1837| 					}
|1838|1838| 				},
|1839|1839| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1851|1851| 					}
|1852|1852| 					// Check the target is still alive and attackable
|1853|1853| 					if (this.CanAttack(target) && !this.CheckTargetAttackRange(target, this.order.data.attackType))
|1854|    |-					{
|    |1854|+					
|1855|1855| 						// Can't reach it - try to chase after it
|1856|1856| 						if (this.ShouldChaseTargetedEntity(target, this.order.data.force))
|1857|1857| 						{
|1866|1866| 								return;
|1867|1867| 							}
|1868|1868| 						}
|1869|    |-					}
|    |1869|+					
|1870|1870| 
|1871|1871| 					var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|1872|1872| 					this.attackTimers = cmpAttack.GetTimers(this.order.data.attackType);
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1897|1897| 					// TODO: we should probably only bother syncing projectile attacks, not melee
|1898|1898| 
|1899|1899| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|1900|    |-					this.resyncAnimation = (prepare != this.attackTimers.prepare) ? true : false;
|    |1900|+					this.resyncAnimation = (prepare != this.attackTimers.prepare);
|1901|1901| 
|1902|1902| 					this.FaceTowardsTarget(this.order.data.target);
|1903|1903| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2026|2026| 
|2027|2027| 				"Attacked": function(msg) {
|2028|2028| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2029|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2030|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2029|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2030|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2031|2031| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2032|2032| 				},
|2033|2033| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2040|2040| 					this.SelectAnimation("move");
|2041|2041| 					var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|2042|2042| 					if (cmpUnitAI && cmpUnitAI.IsFleeing())
|2043|    |-					{
|    |2043|+					
|2044|2044| 						// Run after a fleeing target
|2045|2045| 						this.SetMoveSpeedRatio(this.GetRunMultiplier());
|2046|    |-					}
|    |2046|+					
|2047|2047| 					this.StartTimer(1000, 1000);
|2048|2048| 				},
|2049|2049| 
|    | [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
|2066|2066| 						if (this.GetStance().respondHoldGround)
|2067|2067| 							this.WalkToHeldPosition();
|2068|2068| 					}
|2069|    |-					else 
|    |2069|+					else
|2070|2070| 					{
|2071|2071| 						// Check if target does not started to run
|2072|2072| 						let cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2071|2071| 						// Check if target does not started to run
|2072|2072| 						let cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|2073|2073| 						if (cmpUnitAI && cmpUnitAI.IsFleeing())
|2074|    |-						{
|    |2074|+						
|2075|2075| 							// Run after a fleeing target
|2076|2076| 							this.SetMoveSpeedRatio(this.GetRunMultiplier());
|2077|    |-						}
|    |2077|+						
|2078|2078| 					}
|2079|2079| 				},
|2080|2080| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2111|2111| 						// Also don't switch to a different type of huntable animal
|2112|2112| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2113|2113| 							return (
|2114|    |-								ent != oldTarget
|2115|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2114|+								ent != oldTarget &&
|    |2115|+								 ((type.generic == "treasure" && oldType.generic == "treasure")
|2116|2116| 								 || (type.specific == oldType.specific
|2117|2117| 								 && (type.specific != "meat" || oldTemplate == template)))
|2118|2118| 							);
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2112|2112| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2113|2113| 							return (
|2114|2114| 								ent != oldTarget
|2115|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2116|    |-								 || (type.specific == oldType.specific
|    |2115|+								 && ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2116|+								 (type.specific == oldType.specific
|2117|2117| 								 && (type.specific != "meat" || oldTemplate == template)))
|2118|2118| 							);
|2119|2119| 						}, 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
|2113|2113| 							return (
|2114|2114| 								ent != oldTarget
|2115|2115| 								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2116|    |-								 || (type.specific == oldType.specific
|2117|    |-								 && (type.specific != "meat" || oldTemplate == template)))
|    |2116|+								 || (type.specific == oldType.specific &&
|    |2117|+								 (type.specific != "meat" || oldTemplate == template)))
|2118|2118| 							);
|2119|2119| 						}, oldTarget);
|2120|2120| 						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
|2122|2122| 							this.PerformGather(nearby, false, false);
|2123|2123| 							return true;
|2124|2124| 						}
|2125|    |-						else
|2126|    |-						{
|    |2125|+						
|2127|2126| 							// It's probably better in this case, to avoid units getting stuck around a dropsite
|2128|2127| 							// in a "Target is far away, full, nearby are no good resources, return to dropsite" loop
|2129|2128| 							// to order it to GatherNear the resource position.
|2144|2143| 									return true;
|2145|2144| 								}
|2146|2145| 							}
|2147|    |-						}
|    |2146|+						
|2148|2147| 						return true;
|2149|2148| 					}
|2150|2149| 					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
|2134|2134| 								this.GatherNearPosition(pos.x, pos.z, oldType, oldTemplate);
|2135|2135| 								return true;
|2136|2136| 							}
|2137|    |-							else
|2138|    |-							{
|    |2137|+							
|2139|2138| 								// we're kind of stuck here. Return resource.
|2140|2139| 								var nearby = this.FindNearestDropsite(oldType.generic);
|2141|2140| 								if (nearby)
|2143|2142| 									this.PushOrderFront("ReturnResource", { "target": nearby, "force": false });
|2144|2143| 									return true;
|2145|2144| 								}
|2146|    |-							}
|    |2145|+							
|2147|2146| 						}
|2148|2147| 						return true;
|2149|2148| 					}
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2176|2176| 						// Also don't switch to a different type of huntable animal
|2177|2177| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2178|2178| 							return (
|2179|    |-								ent != oldTarget
|2180|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2179|+								ent != oldTarget &&
|    |2180|+								((type.generic == "treasure" && oldType.generic == "treasure")
|2181|2181| 								|| (type.specific == oldType.specific
|2182|2182| 								&& (type.specific != "meat" || oldTemplate == template)))
|2183|2183| 							);
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2177|2177| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2178|2178| 							return (
|2179|2179| 								ent != oldTarget
|2180|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2181|    |-								|| (type.specific == oldType.specific
|    |2180|+								&& ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2181|+								(type.specific == oldType.specific
|2182|2182| 								&& (type.specific != "meat" || oldTemplate == template)))
|2183|2183| 							);
|2184|2184| 						});
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2178|2178| 							return (
|2179|2179| 								ent != oldTarget
|2180|2180| 								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2181|    |-								|| (type.specific == oldType.specific
|2182|    |-								&& (type.specific != "meat" || oldTemplate == template)))
|    |2181|+								|| (type.specific == oldType.specific &&
|    |2182|+								(type.specific != "meat" || oldTemplate == template)))
|2183|2183| 							);
|2184|2184| 						});
|2185|2185| 						if (nearby)
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2223|2223| 					// Also don't switch to a different type of huntable animal
|2224|2224| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2225|2225| 						return (
|2226|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2227|    |-							|| (type.specific == resourceType.specific
|    |2226|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2227|+							(type.specific == resourceType.specific
|2228|2228| 							&& (type.specific != "meat" || resourceTemplate == template))
|2229|2229| 						);
|2230|2230| 					});
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2224|2224| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2225|2225| 						return (
|2226|2226| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2227|    |-							|| (type.specific == resourceType.specific
|2228|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2227|+							|| (type.specific == resourceType.specific &&
|    |2228|+							(type.specific != "meat" || resourceTemplate == template))
|2229|2229| 						);
|2230|2230| 					});
|2231|2231| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2340|2340| 
|2341|2341| 					var cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply);
|2342|2342| 					if (cmpSupply && cmpSupply.IsAvailable(cmpOwnership.GetOwner(), this.entity))
|2343|    |-					{
|    |2343|+					
|2344|2344| 						// Check we can still reach and gather from the target
|2345|2345| 						if (this.CheckTargetRange(this.gatheringTarget, IID_ResourceGatherer) && this.CanGather(this.gatheringTarget))
|2346|2346| 						{
|2406|2406| 								return;
|2407|2407| 							}
|2408|2408| 						}
|2409|    |-					}
|    |2409|+					
|2410|2410| 
|2411|2411| 					// We're already in range, can't get anywhere near it or the target is exhausted.
|2412|2412| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2432|2432| 					// Also don't switch to a different type of huntable animal
|2433|2433| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2434|2434| 						return (
|2435|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2436|    |-							|| (type.specific == resourceType.specific
|    |2435|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2436|+							(type.specific == resourceType.specific
|2437|2437| 							&& (type.specific != "meat" || resourceTemplate == template))
|2438|2438| 						);
|2439|2439| 					});
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2433|2433| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2434|2434| 						return (
|2435|2435| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2436|    |-							|| (type.specific == resourceType.specific
|2437|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2436|+							|| (type.specific == resourceType.specific &&
|    |2437|+							(type.specific != "meat" || resourceTemplate == template))
|2438|2438| 						);
|2439|2439| 					});
|2440|2440| 					if (nearby)
|    | [NORMAL] ESLintBear (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
|2520|2520| 					this.StartTimer(prepare, this.healTimers.repeat);
|2521|2521| 
|2522|2522| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2523|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2523|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2524|2524| 
|2525|2525| 					this.FaceTowardsTarget(this.order.data.target);
|2526|2526| 				},
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2735|2735| 					{
|2736|2736| 						// The building was already finished/fully repaired before we arrived;
|2737|2737| 						// let the ConstructionFinished handler handle this.
|2738|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2738|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2739|2739| 						return true;
|2740|2740| 					}
|2741|2741| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2735|2735| 					{
|2736|2736| 						// The building was already finished/fully repaired before we arrived;
|2737|2737| 						// let the ConstructionFinished handler handle this.
|2738|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2738|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2739|2739| 						return true;
|2740|2740| 					}
|2741|2741| 
|    | [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
|2775|2775| 					if (this.MoveToTargetRange(this.repairTarget, IID_Builder))
|2776|2776| 						this.SetNextState("APPROACHING");
|2777|2777| 					else if (!this.CheckTargetRange(this.repairTarget, IID_Builder))
|2778|    |-						this.FinishOrder(); //can't approach and isn't in reach
|    |2778|+						this.FinishOrder(); // can't approach and isn't in reach
|2779|2779| 				},
|2780|2780| 			},
|2781|2781| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2862|2862| 
|2863|2863| 				// Unit was approaching and there's nothing to do now, so switch to walking
|2864|2864| 				if (oldState === "INDIVIDUAL.REPAIR.APPROACHING")
|2865|    |-				{
|    |2865|+				
|2866|2866| 					// We're already walking to the given point, so add this as a order.
|2867|2867| 					this.WalkToTarget(msg.data.newentity, true);
|2868|    |-				}
|    |2868|+				
|2869|2869| 			},
|2870|2870| 		},
|2871|2871| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2915|2915| 
|2916|2916| 					// Check that we can garrison here
|2917|2917| 					if (this.CanGarrison(target))
|2918|    |-					{
|    |2918|+					
|2919|2919| 						// Check that we're in range of the garrison target
|2920|2920| 						if (this.CheckGarrisonRange(target))
|2921|2921| 						{
|2991|2991| 								return false;
|2992|2992| 							}
|2993|2993| 						}
|2994|    |-					}
|    |2994|+					
|2995|2995| 					// Garrisoning failed for some reason, so finish the order
|2996|2996| 					this.FinishOrder();
|2997|2997| 					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
|3098|3098| 		"Attacked": function(msg) {
|3099|3099| 			if (this.template.NaturalBehaviour == "skittish" ||
|3100|3100| 			    this.template.NaturalBehaviour == "passive")
|3101|    |-			{
|    |3101|+			
|3102|3102| 				this.Flee(msg.data.attacker, false);
|3103|    |-			}
|    |3103|+			
|3104|3104| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|3105|3105| 			{
|3106|3106| 				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
|3107|3107| 					this.Attack(msg.data.attacker, false);
|3108|3108| 			}
|3109|3109| 			else if (this.template.NaturalBehaviour == "domestic")
|3110|    |-			{
|    |3110|+			
|3111|3111| 				// Never flee, stop what we were doing
|3112|3112| 				this.SetNextState("IDLE");
|3113|    |-			}
|    |3113|+			
|3114|3114| 		},
|3115|3115| 
|3116|3116| 		"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
|3117|3117| 			// Move a tile outside the building
|3118|3118| 			var range = 4;
|3119|3119| 			if (this.MoveToTargetRangeExplicit(msg.data.target, range, range))
|3120|    |-			{
|    |3120|+			
|3121|3121| 				// We've started walking to the given point
|3122|3122| 				this.SetNextState("WALKING");
|3123|    |-			}
|    |3123|+			
|3124|3124| 			else
|3125|3125| 			{
|3126|3126| 				// 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
|3122|3122| 				this.SetNextState("WALKING");
|3123|3123| 			}
|3124|3124| 			else
|3125|    |-			{
|    |3125|+			
|3126|3126| 				// We are already at the target, or can't move at all
|3127|3127| 				this.FinishOrder();
|3128|    |-			}
|    |3128|+			
|3129|3129| 		},
|3130|3130| 
|3131|3131| 		"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
|3164|3164| 				}
|3165|3165| 				// Start attacking one of the newly-seen enemy (if any)
|3166|3166| 				else if (this.IsDangerousAnimal())
|3167|    |-				{
|    |3167|+				
|3168|3168| 					this.AttackVisibleEntity(msg.data.added);
|3169|    |-				}
|    |3169|+				
|3170|3170| 
|3171|3171| 				// TODO: if two units enter our range together, we'll attack the
|3172|3172| 				// 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
|3207|3207| 				}
|3208|3208| 				// Start attacking one of the newly-seen enemy (if any)
|3209|3209| 				else if (this.template.NaturalBehaviour == "violent")
|3210|    |-				{
|    |3210|+				
|3211|3211| 					this.AttackVisibleEntity(msg.data.added);
|3212|    |-				}
|    |3212|+				
|3213|3213| 			},
|3214|3214| 
|3215|3215| 			"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
|3224|3224| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3225|3225| 
|3226|3226| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3227|    |-							// only used for domestic animals
|    |3227|+		// only used for domestic animals
|3228|3228| 	},
|3229|3229| };
|3230|3230| 
|    | [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
|3281|3281| 
|3282|3282| UnitAI.prototype.IsAnimal = function()
|3283|3283| {
|3284|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3284|+	return (!!this.template.NaturalBehaviour);
|3285|3285| };
|3286|3286| 
|3287|3287| 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
|3319|3319| UnitAI.prototype.GetGarrisonHolder = function()
|3320|3320| {
|3321|3321| 	if (this.IsGarrisoned())
|3322|    |-	{
|    |3322|+	
|3323|3323| 		for (let order of this.orderQueue)
|3324|3324| 			if (order.type == "Garrison")
|3325|3325| 				return order.data.target;
|3326|    |-	}
|    |3326|+	
|3327|3327| 	return INVALID_ENTITY;
|3328|3328| };
|3329|3329| 
|    | [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
|3397|3397| 		{
|3398|3398| 			let index = this.GetCurrentState().indexOf(".");
|3399|3399| 			if (index != -1)
|3400|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3400|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3401|3401| 			this.Stop(false);
|3402|3402| 		}
|3403|3403| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3453|3453| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3454|3454| 			continue;
|3455|3455| 		if (i == 0)
|3456|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3456|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3457|3457| 		else
|3458|3458| 			this.orderQueue.splice(i, 1);
|3459|3459| 		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
|3453|3453| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3454|3454| 			continue;
|3455|3455| 		if (i == 0)
|3456|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3456|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3457|3457| 		else
|3458|3458| 			this.orderQueue.splice(i, 1);
|3459|3459| 		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
|3537|3537| };
|3538|3538| 
|3539|3539| 
|3540|    |-//// FSM linkage functions ////
|    |3540|+// // FSM linkage functions ////
|3541|3541| 
|3542|3542| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3543|3543| UnitAI.prototype.SetNextState = function(state)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3709|3709| 				continue;
|3710|3710| 			if (this.orderQueue[i].type == type)
|3711|3711| 				continue;
|3712|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3712|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3713|3713| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3714|3714| 			return;
|3715|3715| 		}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3709|3709| 				continue;
|3710|3710| 			if (this.orderQueue[i].type == type)
|3711|3711| 				continue;
|3712|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3712|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3713|3713| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3714|3714| 			return;
|3715|3715| 		}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3723|3723| {
|3724|3724| 	// Remember the previous work orders to be able to go back to them later if required
|3725|3725| 	if (data && data.force)
|3726|    |-	{
|    |3726|+	
|3727|3727| 		if (this.IsFormationController())
|3728|3728| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3729|3729| 		else
|3730|3730| 			this.UpdateWorkOrders(type);
|3731|    |-	}
|    |3731|+	
|3732|3732| 
|3733|3733| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3734|3734| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3800|3800| 	{
|3801|3801| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3802|3802| 		if (cmpUnitAI)
|3803|    |-		{
|    |3803|+		
|3804|3804| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3805|3805| 			{
|3806|3806| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3809|3809| 					return;
|3810|3810| 				}
|3811|3811| 			}
|3812|    |-		}
|    |3812|+		
|3813|3813| 	}
|3814|3814| 
|3815|3815| 	// 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
|3802|3802| 		if (cmpUnitAI)
|3803|3803| 		{
|3804|3804| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3805|    |-			{
|    |3805|+			
|3806|3806| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3807|3807| 				{
|3808|3808| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3809|3809| 					return;
|3810|3810| 				}
|3811|    |-			}
|    |3811|+			
|3812|3812| 		}
|3813|3813| 	}
|3814|3814| 
|    | [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
|3814|3814| 
|3815|3815| 	// If nothing found, take the unit orders
|3816|3816| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3817|    |-	{
|    |3817|+	
|3818|3818| 		if (isWorkType(this.orderQueue[i].type))
|3819|3819| 		{
|3820|3820| 			this.workOrders = this.orderQueue.slice(i);
|3821|3821| 			return;
|3822|3822| 		}
|3823|    |-	}
|    |3823|+	
|3824|3824| };
|3825|3825| 
|3826|3826| 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
|3880|3880| 	if (data.timerRepeat === undefined)
|3881|3881| 		this.timer = undefined;
|3882|3882| 
|3883|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3883|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3884|3884| };
|3885|3885| 
|3886|3886| /**
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3880|3880| 	if (data.timerRepeat === undefined)
|3881|3881| 		this.timer = undefined;
|3882|3882| 
|3883|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3883|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3884|3884| };
|3885|3885| 
|3886|3886| /**
|    | [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
|3915|3915| 	this.timer = undefined;
|3916|3916| };
|3917|3917| 
|3918|    |-//// Message handlers /////
|    |3918|+// // Message handlers /////
|3919|3919| 
|3920|3920| UnitAI.prototype.OnMotionChanged = function(msg)
|3921|3921| {
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3920|3920| UnitAI.prototype.OnMotionChanged = function(msg)
|3921|3921| {
|3922|3922| 	if (msg.starting && !msg.error)
|3923|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3923|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveStarted", "data": msg});
|3924|3924| 	else if (!msg.starting || msg.error)
|3925|3925| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3926|3926| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3920|3920| UnitAI.prototype.OnMotionChanged = function(msg)
|3921|3921| {
|3922|3922| 	if (msg.starting && !msg.error)
|3923|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3923|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg });
|3924|3924| 	else if (!msg.starting || msg.error)
|3925|3925| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3926|3926| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3922|3922| 	if (msg.starting && !msg.error)
|3923|3923| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3924|3924| 	else if (!msg.starting || msg.error)
|3925|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3925|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveCompleted", "data": msg});
|3926|3926| };
|3927|3927| 
|3928|3928| 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
|3922|3922| 	if (msg.starting && !msg.error)
|3923|3923| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3924|3924| 	else if (!msg.starting || msg.error)
|3925|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3925|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg });
|3926|3926| };
|3927|3927| 
|3928|3928| 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
|3930|3930| 	// TODO: This is a bit inefficient since every unit listens to every
|3931|3931| 	// construction message - ideally we could scope it to only the one we're building
|3932|3932| 
|3933|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3933|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3934|3934| };
|3935|3935| 
|3936|3936| 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
|3930|3930| 	// TODO: This is a bit inefficient since every unit listens to every
|3931|3931| 	// construction message - ideally we could scope it to only the one we're building
|3932|3932| 
|3933|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3933|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3934|3934| };
|3935|3935| 
|3936|3936| 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
|3955|3955| 
|3956|3956| UnitAI.prototype.OnAttacked = function(msg)
|3957|3957| {
|3958|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3958|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3959|3959| };
|3960|3960| 
|3961|3961| 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
|3955|3955| 
|3956|3956| UnitAI.prototype.OnAttacked = function(msg)
|3957|3957| {
|3958|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3958|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3959|3959| };
|3960|3960| 
|3961|3961| 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
|3960|3960| 
|3961|3961| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3962|3962| {
|3963|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3963|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|3964|3964| };
|3965|3965| 
|3966|3966| 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
|3960|3960| 
|3961|3961| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3962|3962| {
|3963|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3963|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|3964|3964| };
|3965|3965| 
|3966|3966| 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
|3965|3965| 
|3966|3966| UnitAI.prototype.OnHealthChanged = function(msg)
|3967|3967| {
|3968|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3968|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|3969|3969| };
|3970|3970| 
|3971|3971| 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
|3965|3965| 
|3966|3966| UnitAI.prototype.OnHealthChanged = function(msg)
|3967|3967| {
|3968|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3968|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|3969|3969| };
|3970|3970| 
|3971|3971| 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
|3971|3971| UnitAI.prototype.OnRangeUpdate = function(msg)
|3972|3972| {
|3973|3973| 	if (msg.tag == this.losRangeQuery)
|3974|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3974|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|3975|3975| 	else if (msg.tag == this.losHealRangeQuery)
|3976|3976| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3977|3977| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3971|3971| UnitAI.prototype.OnRangeUpdate = function(msg)
|3972|3972| {
|3973|3973| 	if (msg.tag == this.losRangeQuery)
|3974|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3974|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|3975|3975| 	else if (msg.tag == this.losHealRangeQuery)
|3976|3976| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3977|3977| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3973|3973| 	if (msg.tag == this.losRangeQuery)
|3974|3974| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3975|3975| 	else if (msg.tag == this.losHealRangeQuery)
|3976|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3976|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|3977|3977| };
|3978|3978| 
|3979|3979| 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
|3973|3973| 	if (msg.tag == this.losRangeQuery)
|3974|3974| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3975|3975| 	else if (msg.tag == this.losHealRangeQuery)
|3976|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3976|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|3977|3977| };
|3978|3978| 
|3979|3979| 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
|3978|3978| 
|3979|3979| UnitAI.prototype.OnPackFinished = function(msg)
|3980|3980| {
|3981|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3981|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|3982|3982| };
|3983|3983| 
|3984|3984| //// 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
|3978|3978| 
|3979|3979| UnitAI.prototype.OnPackFinished = function(msg)
|3980|3980| {
|3981|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3981|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|3982|3982| };
|3983|3983| 
|3984|3984| //// 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
|3981|3981| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|3982|3982| };
|3983|3983| 
|3984|    |-//// Helper functions to be called by the FSM ////
|    |3984|+// // Helper functions to be called by the FSM ////
|3985|3985| 
|3986|3986| UnitAI.prototype.GetWalkSpeed = function()
|3987|3987| {
|    | [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
|4083|4083| 	if (!cmpOwnership || cmpOwnership.GetOwner() == INVALID_PLAYER)
|4084|4084| 		return undefined;
|4085|4085| 
|4086|    |-	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position)
|    |4086|+	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
|4087|4087| 	if (!cmpPosition || !cmpPosition.IsInWorld())
|4088|4088| 		return undefined;
|4089|4089| 
|    | [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
|4168|4168| 			PlaySound(name, member);
|4169|4169| 	}
|4170|4170| 	else
|4171|    |-	{
|    |4171|+	
|4172|4172| 		// Otherwise use our own sounds
|4173|4173| 		PlaySound(name, this.entity);
|4174|    |-	}
|    |4174|+	
|4175|4175| };
|4176|4176| 
|4177|4177| /*
|    | [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
|4337|4337| 	else
|4338|4338| 		// return false? Or hope you come close enough?
|4339|4339| 		var parabolicMaxRange = 0;
|4340|    |-		//return false;
|    |4340|+		// return false;
|4341|4341| 
|4342|4342| 	// the parabole changes while walking, take something in the middle
|4343|4343| 	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
|4402|4402| 	if (this.IsFormationMember())
|4403|4403| 	{
|4404|4404| 		var cmpFormationUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|4405|    |-		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation()
|4406|    |-			&& cmpFormationUnitAI.order.data.target == target)
|    |4405|+		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation() &&
|    |4406|+			cmpFormationUnitAI.order.data.target == target)
|4407|4407| 			return true;
|4408|4408| 	}
|4409|4409| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4570|4570| UnitAI.prototype.AttackEntityInZone = function(ents)
|4571|4571| {
|4572|4572| 	var target = ents.find(target =>
|4573|    |-		this.CanAttack(target)
|4574|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4573|+		this.CanAttack(target) &&
|    |4574|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4575|4575| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4576|4576| 	);
|4577|4577| 	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
|4571|4571| {
|4572|4572| 	var target = ents.find(target =>
|4573|4573| 		this.CanAttack(target)
|4574|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4575|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4574|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4575|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4576|4576| 	);
|4577|4577| 	if (!target)
|4578|4578| 		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
|4635|4635| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4636|4636| 	if (this.isGuardOf)
|4637|4637| 	{
|4638|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4638|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4639|4639| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4640|4640| 		if (cmpUnitAI && cmpAttack &&
|4641|4641| 		    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
|4639|4639| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4640|4640| 		if (cmpUnitAI && cmpAttack &&
|4641|4641| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4642|    |-				return false;
|    |4642|+			return false;
|4643|4643| 	}
|4644|4644| 
|4645|4645| 	// 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
|4644|4644| 
|4645|4645| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4646|4646| 	if (this.GetStance().respondHoldGround)
|4647|    |-	{
|    |4647|+	
|4648|4648| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4649|4649| 			return true;
|4650|    |-	}
|    |4650|+	
|4651|4651| 
|4652|4652| 	// Stop if it's left our vision range, unless we're especially persistent
|4653|4653| 	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
|4651|4651| 
|4652|4652| 	// Stop if it's left our vision range, unless we're especially persistent
|4653|4653| 	if (!this.GetStance().respondChaseBeyondVision)
|4654|    |-	{
|    |4654|+	
|4655|4655| 		if (!this.CheckTargetIsInVisionRange(target))
|4656|4656| 			return true;
|4657|    |-	}
|    |4657|+	
|4658|4658| 
|4659|4659| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4660|4660| 	// 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
|4677|4677| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4678|4678| 	if (this.isGuardOf)
|4679|4679| 	{
|4680|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4680|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4681|4681| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4682|4682| 		if (cmpUnitAI && cmpAttack &&
|4683|4683| 		    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
|4690|4690| 	return false;
|4691|4691| };
|4692|4692| 
|4693|    |-//// External interface functions ////
|    |4693|+// // External interface functions ////
|4694|4694| 
|4695|4695| UnitAI.prototype.SetFormationController = function(ent)
|4696|4696| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4700|4700| 	// of our own formation (or ourself if not in formation)
|4701|4701| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4702|4702| 	if (cmpObstruction)
|4703|    |-	{
|    |4703|+	
|4704|4704| 		if (ent == INVALID_ENTITY)
|4705|4705| 			cmpObstruction.SetControlGroup(this.entity);
|4706|4706| 		else
|4707|4707| 			cmpObstruction.SetControlGroup(ent);
|4708|    |-	}
|    |4708|+	
|4709|4709| 
|4710|4710| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4711|4711| 	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
|4843|4843| 	// if we already had an old guard order, do nothing if the target is the same
|4844|4844| 	// and the order is running, otherwise remove the previous order
|4845|4845| 	if (this.isGuardOf)
|4846|    |-	{
|    |4846|+	
|4847|4847| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4848|4848| 			return;
|4849|4849| 		else
|4850|4850| 			this.RemoveGuard();
|4851|    |-	}
|    |4851|+	
|4852|4852| 
|4853|4853| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4854|4854| };
|    | [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
|4846|4846| 	{
|4847|4847| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4848|4848| 			return;
|4849|    |-		else
|4850|    |-			this.RemoveGuard();
|    |4849|+		this.RemoveGuard();
|4851|4850| 	}
|4852|4851| 
|4853|4852| 	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
|5017|5017| 			this.WalkToTarget(target, queued);
|5018|5018| 		return;
|5019|5019| 	}
|5020|    |-	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture}, queued);
|    |5020|+	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture }, queued);
|5021|5021| };
|5022|5022| 
|5023|5023| /**
|    | [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
|5166|5166| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5167|5167| 	{
|5168|5168| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5169|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5169|+		if (cmpTrader.HasBothMarkets() &&
|5170|5170| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5171|5171| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5172|5172| 		{
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5447|5447| 				{
|5448|5448| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5449|5449| 					var targetClasses = this.order.data.targetClasses;
|5450|    |-					if (targetClasses.attack && cmpIdentity
|5451|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5450|+					if (targetClasses.attack && cmpIdentity &&
|    |5451|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5452|5452| 						continue;
|5453|5453| 					if (targetClasses.avoid && cmpIdentity
|5454|5454| 						&& 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
|5450|5450| 					if (targetClasses.attack && cmpIdentity
|5451|5451| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5452|5452| 						continue;
|5453|    |-					if (targetClasses.avoid && cmpIdentity
|5454|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5453|+					if (targetClasses.avoid && cmpIdentity &&
|    |5454|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5455|5455| 						continue;
|5456|5456| 					// Only used by the AIs to prevent some choices of targets
|5457|5457| 					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
|5473|5473| 		{
|5474|5474| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5475|5475| 			var targetClasses = this.order.data.targetClasses;
|5476|    |-			if (cmpIdentity && targetClasses.attack
|5477|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5476|+			if (cmpIdentity && targetClasses.attack &&
|    |5477|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5478|5478| 				continue;
|5479|5479| 			if (cmpIdentity && targetClasses.avoid
|5480|5480| 				&& 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
|5476|5476| 			if (cmpIdentity && targetClasses.attack
|5477|5477| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5478|5478| 				continue;
|5479|    |-			if (cmpIdentity && targetClasses.avoid
|5480|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5479|+			if (cmpIdentity && targetClasses.avoid &&
|    |5480|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5481|5481| 				continue;
|5482|5482| 			// Only used by the AIs to prevent some choices of targets
|5483|5483| 			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
|5619|5619| 
|5620|5620| UnitAI.prototype.SetHeldPosition = function(x, z)
|5621|5621| {
|5622|    |-	this.heldPosition = {"x": x, "z": z};
|    |5622|+	this.heldPosition = { "x": x, "z": z};
|5623|5623| };
|5624|5624| 
|5625|5625| 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
|5619|5619| 
|5620|5620| UnitAI.prototype.SetHeldPosition = function(x, z)
|5621|5621| {
|5622|    |-	this.heldPosition = {"x": x, "z": z};
|    |5622|+	this.heldPosition = {"x": x, "z": z };
|5623|5623| };
|5624|5624| 
|5625|5625| 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
|5646|5646| 	return false;
|5647|5647| };
|5648|5648| 
|5649|    |-//// Helper functions ////
|    |5649|+// // Helper functions ////
|5650|5650| 
|5651|5651| UnitAI.prototype.CanAttack = function(target)
|5652|5652| {
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5850|5850| 	return cmpPack && cmpPack.IsPacking();
|5851|5851| };
|5852|5852| 
|5853|    |-//// Formation specific functions ////
|    |5853|+// // Formation specific functions ////
|5854|5854| 
|5855|5855| UnitAI.prototype.IsAttackingAsFormation = function()
|5856|5856| {
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5855|5855| UnitAI.prototype.IsAttackingAsFormation = function()
|5856|5856| {
|5857|5857| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5858|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5859|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5858|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5859|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5860|5860| };
|5861|5861| 
|5862|5862| //// 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
|5859|5859| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5860|5860| };
|5861|5861| 
|5862|    |-//// Animal specific functions ////
|    |5862|+// // Animal specific functions ////
|5863|5863| 
|5864|5864| UnitAI.prototype.MoveRandomly = function(distance)
|5865|5865| {

binaries/data/mods/public/simulation/components/UnitAI.js
|2422| »   »   »   »   »   »   let·nearby·=·this.FindNearestDropsite(resourceType.generic);
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'nearby' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|3785| »   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
|4557| »   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
|4572| »   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
|4618| »   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
|4641| »   »   ····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
|5097| »   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
|1889| »   »   »   »   »   »   var·cmpFormation·=·Engine.QueryInterface(this.formationController,·IID_Formation);
|    | [NORMAL] JSHintBear:
|    | 'cmpFormation' is already defined.

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

binaries/data/mods/public/simulation/components/UnitAI.js
|2180| »   »   »   »   »   »   »   »   &&·((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
|2181| »   »   »   »   »   »   »   »   ||·(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
|2182| »   »   »   »   »   »   »   »   &&·(type.specific·!=·"meat"·||·oldTemplate·==·template)))
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4350| »   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
|4406| »   »   »   &&·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
|4574| »   »   &&·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
|4575| »   »   &&·(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
|5097| »   var·lastPos·=·undefined;
|    | [NORMAL] JSHintBear:
|    | It's not necessary to initialize 'lastPos' to 'undefined'.

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

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

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

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

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

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

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

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

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

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

In D1880#77759, @Stan wrote:

What happens if the unit is in formation ?

Well, yes, This does not work with formations.

I think this mostly highlights that chasing / fleeing is kind of broken in 0 A.D.

IMO the fact that units start to run when the target flees is completely broken behaviour - I am in favour of removing running altogether from the game.

In AoE 2, deer can only be killed by fast units / ranged units (and villagers have a ranged attack against deer), because they flee. Either:

  • We don't care about slow melee units killing deer (this includes villagers I think)
  • We don't have deer flee / we have them fleeing at a leisurely pace.
Stan added a comment.May 13 2019, 11:39 AM

Since UnitAI is at best weird and at worse buggy, we should always try to test every weird quirk that might be thrown at us. Would be nice to add some tests for this if you can.

Stan added a comment.May 13 2019, 11:46 AM

I think this mostly highlights that chasing / fleeing is kind of broken in 0 A.D.
IMO the fact that units start to run when the target flees is completely broken behaviour - I am in favour of removing running altogether from the game.

I don't know I like the fact that units are able to run, and I actually wanted to use that for charging etc. I find it also more realistic that if someone is attacking you with the sword you could run ;)

Since UnitAI is at best weird and at worse buggy, we should always try to test every weird quirk that might be thrown at us. Would be nice to add some tests for this if you can.

In D1880#77768, @Stan wrote:

I don't know I like the fact that units are able to run, and I actually wanted to use that for charging etc. I find it also more realistic that if someone is attacking you with the sword you could run ;)

This is the epitome situation where realism = bad gameplay imo.
Regardless, running will be supported since it's implemented similarly to "walking slow". I'm talking about running as a current game mechanic here.

Angen added a comment.EditedMay 13 2019, 12:40 PM

Ok so. Formations does not run after fleeing targets even now. They can kill them just because they actually do not flee when close.
And actually try to now hunt deer with solo pikeman, he never catches it after deer starts to flee (so nothing new to the game with this, just a bit more realistic behaviour)
Roman swordsman can catch deer even with this patch.
Only bad thing would be that formations will not be able to hunt skittish animals (there would be needed bigger rewrite.)
Do we actually care about formation hunting now?


Edit: Formation runs at first then walks.

Stan added a comment.May 13 2019, 12:43 PM

I guess not though maybe it would be nice to create a ticket to keep track of it.

Angen updated this revision to Diff 7991.May 13 2019, 3:53 PM

move check to function
move vision to parent and remove not needed from children

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 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.SetNextState("ANIMAL.COMBAT.ATTACKING");
| 461| 461| 				else
| 462| 462| 					this.SetNextState("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| 						{
|1858|1858| 								return;
|1859|1859| 							}
|1860|1860| 						}
|1861|    |-					}
|    |1861|+					
|1862|1862| 
|1863|1863| 					var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|1864|1864| 					this.attackTimers = cmpAttack.GetTimers(this.order.data.attackType);
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1889|1889| 					// TODO: we should probably only bother syncing projectile attacks, not melee
|1890|1890| 
|1891|1891| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|1892|    |-					this.resyncAnimation = (prepare != this.attackTimers.prepare) ? true : false;
|    |1892|+					this.resyncAnimation = (prepare != this.attackTimers.prepare);
|1893|1893| 
|1894|1894| 					this.FaceTowardsTarget(this.order.data.target);
|1895|1895| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2018|2018| 
|2019|2019| 				"Attacked": function(msg) {
|2020|2020| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2021|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2022|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2021|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2022|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2023|2023| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2024|2024| 				},
|2025|2025| 			},
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/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 (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2716|2716| 					{
|2717|2717| 						// The building was already finished/fully repaired before we arrived;
|2718|2718| 						// let the ConstructionFinished handler handle this.
|2719|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2719|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2720|2720| 						return true;
|2721|2721| 					}
|2722|2722| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2716|2716| 					{
|2717|2717| 						// The building was already finished/fully repaired before we arrived;
|2718|2718| 						// let the ConstructionFinished handler handle this.
|2719|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2719|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2720|2720| 						return true;
|2721|2721| 					}
|2722|2722| 
|    | [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
|2756|2756| 					if (this.MoveToTargetRange(this.repairTarget, IID_Builder))
|2757|2757| 						this.SetNextState("APPROACHING");
|2758|2758| 					else if (!this.CheckTargetRange(this.repairTarget, IID_Builder))
|2759|    |-						this.FinishOrder(); //can't approach and isn't in reach
|    |2759|+						this.FinishOrder(); // can't approach and isn't in reach
|2760|2760| 				},
|2761|2761| 			},
|2762|2762| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2843|2843| 
|2844|2844| 				// Unit was approaching and there's nothing to do now, so switch to walking
|2845|2845| 				if (oldState === "INDIVIDUAL.REPAIR.APPROACHING")
|2846|    |-				{
|    |2846|+				
|2847|2847| 					// We're already walking to the given point, so add this as a order.
|2848|2848| 					this.WalkToTarget(msg.data.newentity, true);
|2849|    |-				}
|    |2849|+				
|2850|2850| 			},
|2851|2851| 		},
|2852|2852| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2896|2896| 
|2897|2897| 					// Check that we can garrison here
|2898|2898| 					if (this.CanGarrison(target))
|2899|    |-					{
|    |2899|+					
|2900|2900| 						// Check that we're in range of the garrison target
|2901|2901| 						if (this.CheckGarrisonRange(target))
|2902|2902| 						{
|2972|2972| 								return false;
|2973|2973| 							}
|2974|2974| 						}
|2975|    |-					}
|    |2975|+					
|2976|2976| 					// Garrisoning failed for some reason, so finish the order
|2977|2977| 					this.FinishOrder();
|2978|2978| 					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
|3079|3079| 		"Attacked": function(msg) {
|3080|3080| 			if (this.template.NaturalBehaviour == "skittish" ||
|3081|3081| 			    this.template.NaturalBehaviour == "passive")
|3082|    |-			{
|    |3082|+			
|3083|3083| 				this.Flee(msg.data.attacker, false);
|3084|    |-			}
|    |3084|+			
|3085|3085| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|3086|3086| 			{
|3087|3087| 				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
|3088|3088| 					this.Attack(msg.data.attacker, false);
|3089|3089| 			}
|3090|3090| 			else if (this.template.NaturalBehaviour == "domestic")
|3091|    |-			{
|    |3091|+			
|3092|3092| 				// Never flee, stop what we were doing
|3093|3093| 				this.SetNextState("IDLE");
|3094|    |-			}
|    |3094|+			
|3095|3095| 		},
|3096|3096| 
|3097|3097| 		"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
|3098|3098| 			// Move a tile outside the building
|3099|3099| 			var range = 4;
|3100|3100| 			if (this.MoveToTargetRangeExplicit(msg.data.target, range, range))
|3101|    |-			{
|    |3101|+			
|3102|3102| 				// We've started walking to the given point
|3103|3103| 				this.SetNextState("WALKING");
|3104|    |-			}
|    |3104|+			
|3105|3105| 			else
|3106|3106| 			{
|3107|3107| 				// 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
|3103|3103| 				this.SetNextState("WALKING");
|3104|3104| 			}
|3105|3105| 			else
|3106|    |-			{
|    |3106|+			
|3107|3107| 				// We are already at the target, or can't move at all
|3108|3108| 				this.FinishOrder();
|3109|    |-			}
|    |3109|+			
|3110|3110| 		},
|3111|3111| 
|3112|3112| 		"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
|3145|3145| 				}
|3146|3146| 				// Start attacking one of the newly-seen enemy (if any)
|3147|3147| 				else if (this.IsDangerousAnimal())
|3148|    |-				{
|    |3148|+				
|3149|3149| 					this.AttackVisibleEntity(msg.data.added);
|3150|    |-				}
|    |3150|+				
|3151|3151| 
|3152|3152| 				// TODO: if two units enter our range together, we'll attack the
|3153|3153| 				// 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
|3188|3188| 				}
|3189|3189| 				// Start attacking one of the newly-seen enemy (if any)
|3190|3190| 				else if (this.template.NaturalBehaviour == "violent")
|3191|    |-				{
|    |3191|+				
|3192|3192| 					this.AttackVisibleEntity(msg.data.added);
|3193|    |-				}
|    |3193|+				
|3194|3194| 			},
|3195|3195| 
|3196|3196| 			"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
|3205|3205| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3206|3206| 
|3207|3207| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3208|    |-							// only used for domestic animals
|    |3208|+		// only used for domestic animals
|3209|3209| 	},
|3210|3210| };
|3211|3211| 
|    | [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
|3262|3262| 
|3263|3263| UnitAI.prototype.IsAnimal = function()
|3264|3264| {
|3265|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3265|+	return (!!this.template.NaturalBehaviour);
|3266|3266| };
|3267|3267| 
|3268|3268| 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
|3300|3300| UnitAI.prototype.GetGarrisonHolder = function()
|3301|3301| {
|3302|3302| 	if (this.IsGarrisoned())
|3303|    |-	{
|    |3303|+	
|3304|3304| 		for (let order of this.orderQueue)
|3305|3305| 			if (order.type == "Garrison")
|3306|3306| 				return order.data.target;
|3307|    |-	}
|    |3307|+	
|3308|3308| 	return INVALID_ENTITY;
|3309|3309| };
|3310|3310| 
|    | [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
|3378|3378| 		{
|3379|3379| 			let index = this.GetCurrentState().indexOf(".");
|3380|3380| 			if (index != -1)
|3381|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3381|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3382|3382| 			this.Stop(false);
|3383|3383| 		}
|3384|3384| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3434|3434| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3435|3435| 			continue;
|3436|3436| 		if (i == 0)
|3437|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3437|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3438|3438| 		else
|3439|3439| 			this.orderQueue.splice(i, 1);
|3440|3440| 		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
|3434|3434| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3435|3435| 			continue;
|3436|3436| 		if (i == 0)
|3437|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3437|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3438|3438| 		else
|3439|3439| 			this.orderQueue.splice(i, 1);
|3440|3440| 		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
|3518|3518| };
|3519|3519| 
|3520|3520| 
|3521|    |-//// FSM linkage functions ////
|    |3521|+// // FSM linkage functions ////
|3522|3522| 
|3523|3523| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3524|3524| UnitAI.prototype.SetNextState = function(state)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3690|3690| 				continue;
|3691|3691| 			if (this.orderQueue[i].type == type)
|3692|3692| 				continue;
|3693|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3693|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3694|3694| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3695|3695| 			return;
|3696|3696| 		}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3690|3690| 				continue;
|3691|3691| 			if (this.orderQueue[i].type == type)
|3692|3692| 				continue;
|3693|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3693|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3694|3694| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3695|3695| 			return;
|3696|3696| 		}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3704|3704| {
|3705|3705| 	// Remember the previous work orders to be able to go back to them later if required
|3706|3706| 	if (data && data.force)
|3707|    |-	{
|    |3707|+	
|3708|3708| 		if (this.IsFormationController())
|3709|3709| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3710|3710| 		else
|3711|3711| 			this.UpdateWorkOrders(type);
|3712|    |-	}
|    |3712|+	
|3713|3713| 
|3714|3714| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3715|3715| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3781|3781| 	{
|3782|3782| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3783|3783| 		if (cmpUnitAI)
|3784|    |-		{
|    |3784|+		
|3785|3785| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3786|3786| 			{
|3787|3787| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3790|3790| 					return;
|3791|3791| 				}
|3792|3792| 			}
|3793|    |-		}
|    |3793|+		
|3794|3794| 	}
|3795|3795| 
|3796|3796| 	// 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
|3783|3783| 		if (cmpUnitAI)
|3784|3784| 		{
|3785|3785| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3786|    |-			{
|    |3786|+			
|3787|3787| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3788|3788| 				{
|3789|3789| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3790|3790| 					return;
|3791|3791| 				}
|3792|    |-			}
|    |3792|+			
|3793|3793| 		}
|3794|3794| 	}
|3795|3795| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3795|3795| 
|3796|3796| 	// If nothing found, take the unit orders
|3797|3797| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3798|    |-	{
|    |3798|+	
|3799|3799| 		if (isWorkType(this.orderQueue[i].type))
|3800|3800| 		{
|3801|3801| 			this.workOrders = this.orderQueue.slice(i);
|3802|3802| 			return;
|3803|3803| 		}
|3804|    |-	}
|    |3804|+	
|3805|3805| };
|3806|3806| 
|3807|3807| 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
|3861|3861| 	if (data.timerRepeat === undefined)
|3862|3862| 		this.timer = undefined;
|3863|3863| 
|3864|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3864|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3865|3865| };
|3866|3866| 
|3867|3867| /**
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3861|3861| 	if (data.timerRepeat === undefined)
|3862|3862| 		this.timer = undefined;
|3863|3863| 
|3864|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3864|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3865|3865| };
|3866|3866| 
|3867|3867| /**
|    | [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
|3896|3896| 	this.timer = undefined;
|3897|3897| };
|3898|3898| 
|3899|    |-//// Message handlers /////
|    |3899|+// // Message handlers /////
|3900|3900| 
|3901|3901| UnitAI.prototype.OnMotionChanged = function(msg)
|3902|3902| {
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3901|3901| UnitAI.prototype.OnMotionChanged = function(msg)
|3902|3902| {
|3903|3903| 	if (msg.starting && !msg.error)
|3904|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3904|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveStarted", "data": msg});
|3905|3905| 	else if (!msg.starting || msg.error)
|3906|3906| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3907|3907| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3901|3901| UnitAI.prototype.OnMotionChanged = function(msg)
|3902|3902| {
|3903|3903| 	if (msg.starting && !msg.error)
|3904|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3904|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg });
|3905|3905| 	else if (!msg.starting || msg.error)
|3906|3906| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3907|3907| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3903|3903| 	if (msg.starting && !msg.error)
|3904|3904| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3905|3905| 	else if (!msg.starting || msg.error)
|3906|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3906|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveCompleted", "data": msg});
|3907|3907| };
|3908|3908| 
|3909|3909| 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
|3903|3903| 	if (msg.starting && !msg.error)
|3904|3904| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3905|3905| 	else if (!msg.starting || msg.error)
|3906|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3906|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg });
|3907|3907| };
|3908|3908| 
|3909|3909| 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
|3911|3911| 	// TODO: This is a bit inefficient since every unit listens to every
|3912|3912| 	// construction message - ideally we could scope it to only the one we're building
|3913|3913| 
|3914|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3914|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3915|3915| };
|3916|3916| 
|3917|3917| 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
|3911|3911| 	// TODO: This is a bit inefficient since every unit listens to every
|3912|3912| 	// construction message - ideally we could scope it to only the one we're building
|3913|3913| 
|3914|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3914|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3915|3915| };
|3916|3916| 
|3917|3917| 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
|3936|3936| 
|3937|3937| UnitAI.prototype.OnAttacked = function(msg)
|3938|3938| {
|3939|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3939|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3940|3940| };
|3941|3941| 
|3942|3942| 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
|3936|3936| 
|3937|3937| UnitAI.prototype.OnAttacked = function(msg)
|3938|3938| {
|3939|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3939|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3940|3940| };
|3941|3941| 
|3942|3942| 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
|3941|3941| 
|3942|3942| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3943|3943| {
|3944|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3944|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|3945|3945| };
|3946|3946| 
|3947|3947| 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
|3941|3941| 
|3942|3942| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3943|3943| {
|3944|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3944|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|3945|3945| };
|3946|3946| 
|3947|3947| 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
|3946|3946| 
|3947|3947| UnitAI.prototype.OnHealthChanged = function(msg)
|3948|3948| {
|3949|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3949|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|3950|3950| };
|3951|3951| 
|3952|3952| 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
|3946|3946| 
|3947|3947| UnitAI.prototype.OnHealthChanged = function(msg)
|3948|3948| {
|3949|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3949|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|3950|3950| };
|3951|3951| 
|3952|3952| 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
|3952|3952| UnitAI.prototype.OnRangeUpdate = function(msg)
|3953|3953| {
|3954|3954| 	if (msg.tag == this.losRangeQuery)
|3955|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3955|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|3956|3956| 	else if (msg.tag == this.losHealRangeQuery)
|3957|3957| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3958|3958| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3952|3952| UnitAI.prototype.OnRangeUpdate = function(msg)
|3953|3953| {
|3954|3954| 	if (msg.tag == this.losRangeQuery)
|3955|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3955|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|3956|3956| 	else if (msg.tag == this.losHealRangeQuery)
|3957|3957| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3958|3958| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3954|3954| 	if (msg.tag == this.losRangeQuery)
|3955|3955| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3956|3956| 	else if (msg.tag == this.losHealRangeQuery)
|3957|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3957|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|3958|3958| };
|3959|3959| 
|3960|3960| 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
|3954|3954| 	if (msg.tag == this.losRangeQuery)
|3955|3955| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3956|3956| 	else if (msg.tag == this.losHealRangeQuery)
|3957|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3957|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|3958|3958| };
|3959|3959| 
|3960|3960| 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
|3959|3959| 
|3960|3960| UnitAI.prototype.OnPackFinished = function(msg)
|3961|3961| {
|3962|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3962|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|3963|3963| };
|3964|3964| 
|3965|3965| //// 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
|3959|3959| 
|3960|3960| UnitAI.prototype.OnPackFinished = function(msg)
|3961|3961| {
|3962|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3962|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|3963|3963| };
|3964|3964| 
|3965|3965| //// 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
|3962|3962| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|3963|3963| };
|3964|3964| 
|3965|    |-//// Helper functions to be called by the FSM ////
|    |3965|+// // Helper functions to be called by the FSM ////
|3966|3966| 
|3967|3967| UnitAI.prototype.GetWalkSpeed = function()
|3968|3968| {
|    | [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
|4064|4064| 	if (!cmpOwnership || cmpOwnership.GetOwner() == INVALID_PLAYER)
|4065|4065| 		return undefined;
|4066|4066| 
|4067|    |-	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position)
|    |4067|+	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
|4068|4068| 	if (!cmpPosition || !cmpPosition.IsInWorld())
|4069|4069| 		return undefined;
|4070|4070| 
|    | [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
|4149|4149| 			PlaySound(name, member);
|4150|4150| 	}
|4151|4151| 	else
|4152|    |-	{
|    |4152|+	
|4153|4153| 		// Otherwise use our own sounds
|4154|4154| 		PlaySound(name, this.entity);
|4155|    |-	}
|    |4155|+	
|4156|4156| };
|4157|4157| 
|4158|4158| /*
|    | [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
|4318|4318| 	else
|4319|4319| 		// return false? Or hope you come close enough?
|4320|4320| 		var parabolicMaxRange = 0;
|4321|    |-		//return false;
|    |4321|+		// return false;
|4322|4322| 
|4323|4323| 	// the parabole changes while walking, take something in the middle
|4324|4324| 	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
|4383|4383| 	if (this.IsFormationMember())
|4384|4384| 	{
|4385|4385| 		var cmpFormationUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|4386|    |-		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation()
|4387|    |-			&& cmpFormationUnitAI.order.data.target == target)
|    |4386|+		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation() &&
|    |4387|+			cmpFormationUnitAI.order.data.target == target)
|4388|4388| 			return true;
|4389|4389| 	}
|4390|4390| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/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| UnitAI.prototype.AttackEntityInZone = function(ents)
|4552|4552| {
|4553|4553| 	var target = ents.find(target =>
|4554|    |-		this.CanAttack(target)
|4555|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4554|+		this.CanAttack(target) &&
|    |4555|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4556|4556| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4557|4557| 	);
|4558|4558| 	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
|4552|4552| {
|4553|4553| 	var target = ents.find(target =>
|4554|4554| 		this.CanAttack(target)
|4555|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4556|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4555|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4556|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4557|4557| 	);
|4558|4558| 	if (!target)
|4559|4559| 		return false;
|    | [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
|4608|4608| {
|4609|4609| 	let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4610|4610| 	return cmpUnitAI && cmpUnitAI.IsFleeing();
|4611|    |-}
|    |4611|+};
|4612|4612| 
|4613|4613| /**
|4614|4614|  * Returns true if we should stop following the target entity.
|    | [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
|4622|4622| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4623|4623| 	if (this.isGuardOf)
|4624|4624| 	{
|4625|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4625|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4626|4626| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4627|4627| 		if (cmpUnitAI && cmpAttack &&
|4628|4628| 		    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
|4626|4626| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4627|4627| 		if (cmpUnitAI && cmpAttack &&
|4628|4628| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4629|    |-				return false;
|    |4629|+			return false;
|4630|4630| 	}
|4631|4631| 
|4632|4632| 	// 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
|4631|4631| 
|4632|4632| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4633|4633| 	if (this.GetStance().respondHoldGround)
|4634|    |-	{
|    |4634|+	
|4635|4635| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4636|4636| 			return true;
|4637|    |-	}
|    |4637|+	
|4638|4638| 
|4639|4639| 	// Stop if it's left our vision range, unless we're especially persistent
|4640|4640| 	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
|4638|4638| 
|4639|4639| 	// Stop if it's left our vision range, unless we're especially persistent
|4640|4640| 	if (!this.GetStance().respondChaseBeyondVision)
|4641|    |-	{
|    |4641|+	
|4642|4642| 		if (!this.CheckTargetIsInVisionRange(target))
|4643|4643| 			return true;
|4644|    |-	}
|    |4644|+	
|4645|4645| 
|4646|4646| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4647|4647| 	// 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
|4664|4664| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4665|4665| 	if (this.isGuardOf)
|4666|4666| 	{
|4667|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4667|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4668|4668| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4669|4669| 		if (cmpUnitAI && cmpAttack &&
|4670|4670| 		    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
|4677|4677| 	return false;
|4678|4678| };
|4679|4679| 
|4680|    |-//// External interface functions ////
|    |4680|+// // External interface functions ////
|4681|4681| 
|4682|4682| UnitAI.prototype.SetFormationController = function(ent)
|4683|4683| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4687|4687| 	// of our own formation (or ourself if not in formation)
|4688|4688| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4689|4689| 	if (cmpObstruction)
|4690|    |-	{
|    |4690|+	
|4691|4691| 		if (ent == INVALID_ENTITY)
|4692|4692| 			cmpObstruction.SetControlGroup(this.entity);
|4693|4693| 		else
|4694|4694| 			cmpObstruction.SetControlGroup(ent);
|4695|    |-	}
|    |4695|+	
|4696|4696| 
|4697|4697| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4698|4698| 	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
|4830|4830| 	// if we already had an old guard order, do nothing if the target is the same
|4831|4831| 	// and the order is running, otherwise remove the previous order
|4832|4832| 	if (this.isGuardOf)
|4833|    |-	{
|    |4833|+	
|4834|4834| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4835|4835| 			return;
|4836|4836| 		else
|4837|4837| 			this.RemoveGuard();
|4838|    |-	}
|    |4838|+	
|4839|4839| 
|4840|4840| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4841|4841| };
|    | [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
|4833|4833| 	{
|4834|4834| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4835|4835| 			return;
|4836|    |-		else
|4837|    |-			this.RemoveGuard();
|    |4836|+		this.RemoveGuard();
|4838|4837| 	}
|4839|4838| 
|4840|4839| 	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
|5004|5004| 			this.WalkToTarget(target, queued);
|5005|5005| 		return;
|5006|5006| 	}
|5007|    |-	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture}, queued);
|    |5007|+	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture }, queued);
|5008|5008| };
|5009|5009| 
|5010|5010| /**
|    | [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
|5153|5153| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5154|5154| 	{
|5155|5155| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5156|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5156|+		if (cmpTrader.HasBothMarkets() &&
|5157|5157| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5158|5158| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5159|5159| 		{
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5434|5434| 				{
|5435|5435| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5436|5436| 					var targetClasses = this.order.data.targetClasses;
|5437|    |-					if (targetClasses.attack && cmpIdentity
|5438|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5437|+					if (targetClasses.attack && cmpIdentity &&
|    |5438|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5439|5439| 						continue;
|5440|5440| 					if (targetClasses.avoid && cmpIdentity
|5441|5441| 						&& 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
|5437|5437| 					if (targetClasses.attack && cmpIdentity
|5438|5438| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5439|5439| 						continue;
|5440|    |-					if (targetClasses.avoid && cmpIdentity
|5441|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5440|+					if (targetClasses.avoid && cmpIdentity &&
|    |5441|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5442|5442| 						continue;
|5443|5443| 					// Only used by the AIs to prevent some choices of targets
|5444|5444| 					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
|5460|5460| 		{
|5461|5461| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5462|5462| 			var targetClasses = this.order.data.targetClasses;
|5463|    |-			if (cmpIdentity && targetClasses.attack
|5464|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5463|+			if (cmpIdentity && targetClasses.attack &&
|    |5464|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5465|5465| 				continue;
|5466|5466| 			if (cmpIdentity && targetClasses.avoid
|5467|5467| 				&& 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
|5463|5463| 			if (cmpIdentity && targetClasses.attack
|5464|5464| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5465|5465| 				continue;
|5466|    |-			if (cmpIdentity && targetClasses.avoid
|5467|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5466|+			if (cmpIdentity && targetClasses.avoid &&
|    |5467|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5468|5468| 				continue;
|5469|5469| 			// Only used by the AIs to prevent some choices of targets
|5470|5470| 			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
|5606|5606| 
|5607|5607| UnitAI.prototype.SetHeldPosition = function(x, z)
|5608|5608| {
|5609|    |-	this.heldPosition = {"x": x, "z": z};
|    |5609|+	this.heldPosition = { "x": x, "z": z};
|5610|5610| };
|5611|5611| 
|5612|5612| 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
|5606|5606| 
|5607|5607| UnitAI.prototype.SetHeldPosition = function(x, z)
|5608|5608| {
|5609|    |-	this.heldPosition = {"x": x, "z": z};
|    |5609|+	this.heldPosition = {"x": x, "z": z };
|5610|5610| };
|5611|5611| 
|5612|5612| 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
|5633|5633| 	return false;
|5634|5634| };
|5635|5635| 
|5636|    |-//// Helper functions ////
|    |5636|+// // Helper functions ////
|5637|5637| 
|5638|5638| UnitAI.prototype.CanAttack = function(target)
|5639|5639| {
|    | [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
|5837|5837| 	return cmpPack && cmpPack.IsPacking();
|5838|5838| };
|5839|5839| 
|5840|    |-//// Formation specific functions ////
|    |5840|+// // Formation specific functions ////
|5841|5841| 
|5842|5842| UnitAI.prototype.IsAttackingAsFormation = function()
|5843|5843| {
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5842|5842| UnitAI.prototype.IsAttackingAsFormation = function()
|5843|5843| {
|5844|5844| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5845|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5846|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5845|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5846|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5847|5847| };
|5848|5848| 
|5849|5849| //// 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
|5846|5846| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5847|5847| };
|5848|5848| 
|5849|    |-//// Animal specific functions ////
|    |5849|+// // Animal specific functions ////
|5850|5850| 
|5851|5851| UnitAI.prototype.MoveRandomly = function(distance)
|5852|5852| {

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4331| »   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
|4387| »   »   »   &&·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
|4555| »   »   &&·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
|4556| »   »   &&·(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
|4611| }
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

binaries/data/mods/public/simulation/components/UnitAI.js
|5084| »   var·lastPos·=·undefined;
|    | [NORMAL] JSHintBear:
|    | It's not necessary to initialize 'lastPos' to 'undefined'.

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

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

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

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

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

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

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

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

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