Page MenuHomeWildfire Games

Make capture attack work with units with BuildingAI.
Needs ReviewPublic

Authored by Freagarach on Apr 6 2019, 8:25 AM.

Details

Reviewers
elexis
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Trac Tickets
#4189
#3356
#4000
Summary

Adds a test in the UnitAI so that units (and buildings) with a capture attack, can actually capture other stuff. And gives the SiegeTower its CaptureAttack back.

Test Plan

Hope that nothing is overlooked here.

Diff Detail

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

Event Timeline

Freagarach created this revision.Apr 6 2019, 8:25 AM
Owners added a subscriber: Restricted Owners Package.Apr 6 2019, 8:25 AM
Nescio added a subscriber: Nescio.Apr 6 2019, 9:46 AM
Nescio added inline comments.
binaries/data/mods/public/simulation/templates/template_unit_mechanical_siege_tower.xml
31 ↗(On Diff #7680)

Why is this necessary?

elexis added reviewers: elexis, Restricted Owners Package.Apr 6 2019, 11:26 AM
elexis updated the Trac tickets for this revision.
Freagarach added inline comments.Apr 7 2019, 12:05 PM
binaries/data/mods/public/simulation/templates/template_unit_mechanical_siege_tower.xml
31 ↗(On Diff #7680)

I've changed this so one can check easily that an arrow is still fired when using the siege tower and the capture command is given. I thought that something like this was meant with

When you modify or add methods to simulation components, you should add unit tests that test all added or modified changes.

in the "SubmittingPatches"-wiki? If not then I'll revert this.

Nescio added inline comments.Apr 7 2019, 12:14 PM
binaries/data/mods/public/simulation/templates/template_unit_mechanical_siege_tower.xml
31 ↗(On Diff #7680)

It's probably better to revert this tweak and simply test with one or more infantry units garrisoned inside the siege tower.

Stan added a subscriber: Stan.Apr 7 2019, 12:31 PM
Stan added inline comments.
binaries/data/mods/public/simulation/templates/template_unit_mechanical_siege_tower.xml
31 ↗(On Diff #7680)

Unit tests are not template changes :) There are unit test examples in the simulation/components/test. You have to write code to check that your change works, and ensure that someone breaking it in the future will get a notification.

It's recommended but not an obligation.

As for the template change it's fine as long as it won't be committed. That's on the person who commits the patch

Stan added inline comments.Apr 7 2019, 12:32 PM
binaries/data/mods/public/simulation/components/UnitAI.js
1893–1894

if (cmpAttack && cmpBuildingAI && !((cmpAttack.GetAttackTypes().indexOf("Capture") != -1) && (this.order.data.attackType == "Capture")) ) ?

1943–1944

Check for cmp attack as well.

Silier added a subscriber: Silier.Apr 7 2019, 12:59 PM
Silier added inline comments.
binaries/data/mods/public/simulation/components/UnitAI.js
1893

While here I would suggest var - >let

Stan added inline comments.Apr 7 2019, 1:03 PM
binaries/data/mods/public/simulation/components/UnitAI.js
1893

+1 and the one below as well.

elexis added a comment.Apr 7 2019, 2:17 PM

That it attacks and captures simultaneously is a bit in contradiction with the rest of the units that can either capture or attack at a time. I see this making the unit probably OP if not nerfed somehow otherwise.
I wonder whether it makes sense for a siege engine to capture - I thought the men are rattling at the door.
Due to popular demand, UnitAI.js should support capturing for units with buildingAI anyhow.

binaries/data/mods/public/simulation/components/UnitAI.js
1893–1894

Why propose the unneeded parentheses?
Would recommend resolving !(x && y) to (!x ||!y) to remove one step of indirection.
Is the equation actually correct? IIRC cmpBuildingAI requires cmpAttack, so in that case it is. If it wouldn't the equation would be wrong for units that don't have cmpAttack but cmpBuildingAI or I have potatoes on my eyes.

Freagarach updated this revision to Diff 7694.Apr 7 2019, 2:46 PM
Freagarach marked 2 inline comments as done.
Freagarach edited the summary of this revision. (Show Details)
Freagarach edited the test plan for this revision. (Show Details)

Applied feedback (check for cmpAttack, revert test arrow for SiegeTower)

Harbormaster completed remote builds in B7129: Diff 7694.
Freagarach added inline comments.Apr 7 2019, 2:49 PM
binaries/data/mods/public/simulation/components/UnitAI.js
1893

I would be glad to do just that, for I understand the difference and read the CodingConventions, but cmpAttack is declared earlier as well. I think it is outside of the scope of this little patch to try and change it all the way so that "let" can be used here?

binaries/data/mods/public/simulation/templates/template_unit_mechanical_siege_tower.xml
31 ↗(On Diff #7680)

Ah, thanks for the clarification!
I'll revert the extra arrow, that should ease the work of the committer.

Nescio removed a subscriber: Nescio.Apr 7 2019, 2:51 PM
Freagarach marked an inline comment as not done.Apr 7 2019, 3:03 PM
Freagarach added inline comments.
binaries/data/mods/public/simulation/templates/template_unit_mechanical_siege_tower.xml
31 ↗(On Diff #7680)

Oh, I forgot to ask: should the whole CaptureAttack be removed then? For it is not the primary purpose of this patch.

Silier added inline comments.Apr 7 2019, 3:21 PM
binaries/data/mods/public/simulation/components/UnitAI.js
1893

That is why it should be used let. It would warn you that you are re declaring this variable.
Line 1896 is not needed and should (really should) be deleted as the same variable is declared at line 1863.

var is used only for global variables, for anything local, use let (unless you have strong reason to not)

Freagarach marked an inline comment as not done.Apr 7 2019, 4:23 PM
Freagarach added inline comments.
binaries/data/mods/public/simulation/components/UnitAI.js
1893

I understand, it is just that throughout the whole codebase they are not used consistently. I get that one does not want the danger of declaring variables twice, I totally agree. However, I can also understand that it is easier with this kind of variables (querying a component) that it is easier to remove when it appears to be not needed. E.g. when some patch removes the code at 1863 it would probably require a test to find out that cmpAttack is not declared anymore, since not everybody will check code many lines ahead for this (pretty standard) variable to be used. With this case it is a relatively small distance but I can imagine that there is more complex code which would have similar effects.
Right now it seems that whenever a QueryInterface is done it is done right before the code where it is used and stored in a var.

Additionally I would be more than happy to go through the Components to look for vars that can safely be replaced by lets, but it would result in a large patch. If there is need for that I can create a ticket and work on it? But there has te be a consensus about things like this (QueryInterface).

Stan added inline comments.Apr 7 2019, 4:33 PM
binaries/data/mods/public/simulation/components/UnitAI.js
1893

I understand, it is just that throughout the whole codebase they are not used consistently.

Well some parts of the codebase are very old, and UnitAI is generally avoided because of it. Whenever we can we need to enforce the new coding conventions.

If the function is too long and hard to understand, it should be refactored. There is no need to add another layer of complexity for readability.

Silier added inline comments.Apr 7 2019, 4:34 PM
binaries/data/mods/public/simulation/components/UnitAI.js
1893

If someone decides to remove that line 1683 it is his responsibility to check that variable is not needed anymore in that scope. So this does not stand as argument to have this duplication.

consensus is use var for globals and let for locals. l (it is in coding conventions), there are still var in code where should be let, because code is old and they are slowly replaced if something is changed around them to avoid huge changes.

(there is something similar in c++ with NULL and nullptr, patch exists but it is big and hard to review because there is a lot of changes in it)

bb added a subscriber: bb.Apr 7 2019, 6:15 PM

I won't stop anyone for making/commiting a temporal fix, but the underlying problem is that we have two components (buidlingAI and unitAI) on the same unit trying to achieve the same thing (attack something). In the end that is the thing we need to fix (as in subunits)

binaries/data/mods/public/simulation/templates/template_unit_mechanical_siege_tower.xml
31 ↗(On Diff #7680)

I assume since otherwise the ship still shoots arrows even when capturing, however this patch doesn't affect the arrows from garrisoned units, those will still be shot

Freagarach updated this revision to Diff 7696.Apr 7 2019, 8:05 PM
Freagarach marked 2 inline comments as done.

Changed some var to let in the vicinity, reduced indirection at line 1897.

Freagarach added inline comments.Apr 7 2019, 8:06 PM
binaries/data/mods/public/simulation/components/UnitAI.js
1893

As said earlier, I fully agree with you, but I was only playing the devil's advocate. Thank you for your responses!

(I will then not create such a huge patch but only change bits of code when encountered.)

Freagarach marked 2 inline comments as done.Apr 26 2019, 4:54 PM
Freagarach marked 6 inline comments as done.Apr 29 2019, 7:46 PM
Freagarach updated this revision to Diff 7961.May 10 2019, 8:43 PM
  • Removed some rudementary braces
  • Edited Siege-tower template to comply with new template method

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
|1802|1802| 				"MoveCompleted": function() {
|1803|1803| 
|1804|1804| 					if (this.CheckTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1805|    |-					{
|    |1805|+					
|1806|1806| 						// If the unit needs to unpack, do so
|1807|1807| 						if (this.CanUnpack())
|1808|1808| 						{
|1811|1811| 						}
|1812|1812| 						else
|1813|1813| 							this.SetNextState("ATTACKING");
|1814|    |-					}
|    |1814|+					
|1815|1815| 					else
|1816|1816| 					{
|1817|1817| 						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
|1809|1809| 							this.PushOrderFront("Unpack", { "force": true });
|1810|1810| 							return;
|1811|1811| 						}
|1812|    |-						else
|1813|    |-							this.SetNextState("ATTACKING");
|    |1812|+						this.SetNextState("ATTACKING");
|1814|1813| 					}
|1815|1814| 					else
|1816|1815| 					{
|    | [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
|1813|1813| 							this.SetNextState("ATTACKING");
|1814|1814| 					}
|1815|1815| 					else
|1816|    |-					{
|    |1816|+					
|1817|1817| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1818|1818| 						{
|1819|1819| 							this.SetNextState("APPROACHING");
|1823|1823| 							// Give up
|1824|1824| 							this.FinishOrder();
|1825|1825| 						}
|1826|    |-					}
|    |1826|+					
|1827|1827| 				},
|1828|1828| 			},
|1829|1829| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1815|1815| 					else
|1816|1816| 					{
|1817|1817| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1818|    |-						{
|    |1818|+						
|1819|1819| 							this.SetNextState("APPROACHING");
|1820|    |-						}
|    |1820|+						
|1821|1821| 						else
|1822|1822| 						{
|1823|1823| 							// 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
|1819|1819| 							this.SetNextState("APPROACHING");
|1820|1820| 						}
|1821|1821| 						else
|1822|    |-						{
|    |1822|+						
|1823|1823| 							// Give up
|1824|1824| 							this.FinishOrder();
|1825|    |-						}
|    |1825|+						
|1826|1826| 					}
|1827|1827| 				},
|1828|1828| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1840|1840| 					}
|1841|1841| 					// Check the target is still alive and attackable
|1842|1842| 					if (this.CanAttack(target) && !this.CheckTargetAttackRange(target, this.order.data.attackType))
|1843|    |-					{
|    |1843|+					
|1844|1844| 						// Can't reach it - try to chase after it
|1845|1845| 						if (this.ShouldChaseTargetedEntity(target, this.order.data.force))
|1846|1846| 						{
|1855|1855| 								return;
|1856|1856| 							}
|1857|1857| 						}
|1858|    |-					}
|    |1858|+					
|1859|1859| 
|1860|1860| 					let cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|1861|1861| 					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
|1886|1886| 					// TODO: we should probably only bother syncing projectile attacks, not melee
|1887|1887| 
|1888|1888| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|1889|    |-					this.resyncAnimation = (prepare != this.attackTimers.prepare) ? true : false;
|    |1889|+					this.resyncAnimation = (prepare != this.attackTimers.prepare);
|1890|1890| 
|1891|1891| 					this.FaceTowardsTarget(this.order.data.target);
|1892|1892| 
|    | [NORMAL] ESLintBear (space-in-parens):
|    | There should be no spaces inside this paren.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1891|1891| 					this.FaceTowardsTarget(this.order.data.target);
|1892|1892| 
|1893|1893| 					let cmpBuildingAI = Engine.QueryInterface(this.entity, IID_BuildingAI);
|1894|    |-					if (cmpAttack && cmpBuildingAI && (cmpAttack.GetAttackTypes().indexOf("Capture") == -1 || this.order.data.attackType == "Capture") )
|    |1894|+					if (cmpAttack && cmpBuildingAI && (cmpAttack.GetAttackTypes().indexOf("Capture") == -1 || this.order.data.attackType == "Capture"))
|1895|1895| 						cmpBuildingAI.SetUnitAITarget(this.order.data.target);
|1896|1896| 				},
|1897|1897| 
|    | [NORMAL] ESLintBear (space-in-parens):
|    | There should be no spaces inside this paren.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1943|1943| 						// BuildingAI has it's own attack-routine
|1944|1944| 						let cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|1945|1945| 						let cmpBuildingAI = Engine.QueryInterface(this.entity, IID_BuildingAI);
|1946|    |-						if ( cmpAttack && (this.order.data.attackType == "Capture") ? (cmpAttack.GetAttackTypes().indexOf("Capture") != -1) : !cmpBuildingAI )
|    |1946|+						if (cmpAttack && (this.order.data.attackType == "Capture") ? (cmpAttack.GetAttackTypes().indexOf("Capture") != -1) : !cmpBuildingAI )
|1947|1947| 							cmpAttack.PerformAttack(this.order.data.attackType, target);
|1948|1948| 
|1949|1949| 						// Check we can still reach the target for the next attack
|    | [NORMAL] ESLintBear (space-in-parens):
|    | There should be no spaces inside this paren.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1943|1943| 						// BuildingAI has it's own attack-routine
|1944|1944| 						let cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|1945|1945| 						let cmpBuildingAI = Engine.QueryInterface(this.entity, IID_BuildingAI);
|1946|    |-						if ( cmpAttack && (this.order.data.attackType == "Capture") ? (cmpAttack.GetAttackTypes().indexOf("Capture") != -1) : !cmpBuildingAI )
|    |1946|+						if ( cmpAttack && (this.order.data.attackType == "Capture") ? (cmpAttack.GetAttackTypes().indexOf("Capture") != -1) : !cmpBuildingAI)
|1947|1947| 							cmpAttack.PerformAttack(this.order.data.attackType, target);
|1948|1948| 
|1949|1949| 						// Check we can still reach the target for the next attack
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2013|2013| 
|2014|2014| 				"Attacked": function(msg) {
|2015|2015| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2016|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2017|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2016|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2017|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2018|2018| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2019|2019| 				},
|2020|2020| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2027|2027| 					this.SelectAnimation("move");
|2028|2028| 					var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|2029|2029| 					if (cmpUnitAI && cmpUnitAI.IsFleeing())
|2030|    |-					{
|    |2030|+					
|2031|2031| 						// Run after a fleeing target
|2032|2032| 						this.SetMoveSpeedRatio(this.GetRunMultiplier());
|2033|    |-					}
|    |2033|+					
|2034|2034| 					this.StartTimer(1000, 1000);
|2035|2035| 				},
|2036|2036| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2086|2086| 						// Also don't switch to a different type of huntable animal
|2087|2087| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2088|2088| 							return (
|2089|    |-								ent != oldTarget
|2090|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2089|+								ent != oldTarget &&
|    |2090|+								 ((type.generic == "treasure" && oldType.generic == "treasure")
|2091|2091| 								 || (type.specific == oldType.specific
|2092|2092| 								 && (type.specific != "meat" || oldTemplate == template)))
|2093|2093| 							);
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2087|2087| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2088|2088| 							return (
|2089|2089| 								ent != oldTarget
|2090|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2091|    |-								 || (type.specific == oldType.specific
|    |2090|+								 && ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2091|+								 (type.specific == oldType.specific
|2092|2092| 								 && (type.specific != "meat" || oldTemplate == template)))
|2093|2093| 							);
|2094|2094| 						}, 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
|2088|2088| 							return (
|2089|2089| 								ent != oldTarget
|2090|2090| 								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2091|    |-								 || (type.specific == oldType.specific
|2092|    |-								 && (type.specific != "meat" || oldTemplate == template)))
|    |2091|+								 || (type.specific == oldType.specific &&
|    |2092|+								 (type.specific != "meat" || oldTemplate == template)))
|2093|2093| 							);
|2094|2094| 						}, oldTarget);
|2095|2095| 						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
|2097|2097| 							this.PerformGather(nearby, false, false);
|2098|2098| 							return true;
|2099|2099| 						}
|2100|    |-						else
|2101|    |-						{
|    |2100|+						
|2102|2101| 							// It's probably better in this case, to avoid units getting stuck around a dropsite
|2103|2102| 							// in a "Target is far away, full, nearby are no good resources, return to dropsite" loop
|2104|2103| 							// to order it to GatherNear the resource position.
|2119|2118| 									return true;
|2120|2119| 								}
|2121|2120| 							}
|2122|    |-						}
|    |2121|+						
|2123|2122| 						return true;
|2124|2123| 					}
|2125|2124| 					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
|2109|2109| 								this.GatherNearPosition(pos.x, pos.z, oldType, oldTemplate);
|2110|2110| 								return true;
|2111|2111| 							}
|2112|    |-							else
|2113|    |-							{
|    |2112|+							
|2114|2113| 								// we're kind of stuck here. Return resource.
|2115|2114| 								var nearby = this.FindNearestDropsite(oldType.generic);
|2116|2115| 								if (nearby)
|2118|2117| 									this.PushOrderFront("ReturnResource", { "target": nearby, "force": false });
|2119|2118| 									return true;
|2120|2119| 								}
|2121|    |-							}
|    |2120|+							
|2122|2121| 						}
|2123|2122| 						return true;
|2124|2123| 					}
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2151|2151| 						// Also don't switch to a different type of huntable animal
|2152|2152| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2153|2153| 							return (
|2154|    |-								ent != oldTarget
|2155|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2154|+								ent != oldTarget &&
|    |2155|+								((type.generic == "treasure" && oldType.generic == "treasure")
|2156|2156| 								|| (type.specific == oldType.specific
|2157|2157| 								&& (type.specific != "meat" || oldTemplate == template)))
|2158|2158| 							);
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2152|2152| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2153|2153| 							return (
|2154|2154| 								ent != oldTarget
|2155|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2156|    |-								|| (type.specific == oldType.specific
|    |2155|+								&& ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2156|+								(type.specific == oldType.specific
|2157|2157| 								&& (type.specific != "meat" || oldTemplate == template)))
|2158|2158| 							);
|2159|2159| 						});
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2153|2153| 							return (
|2154|2154| 								ent != oldTarget
|2155|2155| 								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2156|    |-								|| (type.specific == oldType.specific
|2157|    |-								&& (type.specific != "meat" || oldTemplate == template)))
|    |2156|+								|| (type.specific == oldType.specific &&
|    |2157|+								(type.specific != "meat" || oldTemplate == template)))
|2158|2158| 							);
|2159|2159| 						});
|2160|2160| 						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
|2198|2198| 					// Also don't switch to a different type of huntable animal
|2199|2199| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2200|2200| 						return (
|2201|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2202|    |-							|| (type.specific == resourceType.specific
|    |2201|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2202|+							(type.specific == resourceType.specific
|2203|2203| 							&& (type.specific != "meat" || resourceTemplate == template))
|2204|2204| 						);
|2205|2205| 					});
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2199|2199| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2200|2200| 						return (
|2201|2201| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2202|    |-							|| (type.specific == resourceType.specific
|2203|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2202|+							|| (type.specific == resourceType.specific &&
|    |2203|+							(type.specific != "meat" || resourceTemplate == template))
|2204|2204| 						);
|2205|2205| 					});
|2206|2206| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2315|2315| 
|2316|2316| 					var cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply);
|2317|2317| 					if (cmpSupply && cmpSupply.IsAvailable(cmpOwnership.GetOwner(), this.entity))
|2318|    |-					{
|    |2318|+					
|2319|2319| 						// Check we can still reach and gather from the target
|2320|2320| 						if (this.CheckTargetRange(this.gatheringTarget, IID_ResourceGatherer) && this.CanGather(this.gatheringTarget))
|2321|2321| 						{
|2381|2381| 								return;
|2382|2382| 							}
|2383|2383| 						}
|2384|    |-					}
|    |2384|+					
|2385|2385| 
|2386|2386| 					// We're already in range, can't get anywhere near it or the target is exhausted.
|2387|2387| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2407|2407| 					// Also don't switch to a different type of huntable animal
|2408|2408| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2409|2409| 						return (
|2410|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2411|    |-							|| (type.specific == resourceType.specific
|    |2410|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2411|+							(type.specific == resourceType.specific
|2412|2412| 							&& (type.specific != "meat" || resourceTemplate == template))
|2413|2413| 						);
|2414|2414| 					});
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2408|2408| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2409|2409| 						return (
|2410|2410| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2411|    |-							|| (type.specific == resourceType.specific
|2412|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2411|+							|| (type.specific == resourceType.specific &&
|    |2412|+							(type.specific != "meat" || resourceTemplate == template))
|2413|2413| 						);
|2414|2414| 					});
|2415|2415| 					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
|2495|2495| 					this.StartTimer(prepare, this.healTimers.repeat);
|2496|2496| 
|2497|2497| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2498|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2498|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2499|2499| 
|2500|2500| 					this.FaceTowardsTarget(this.order.data.target);
|2501|2501| 				},
|    | [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
|2710|2710| 					{
|2711|2711| 						// The building was already finished/fully repaired before we arrived;
|2712|2712| 						// let the ConstructionFinished handler handle this.
|2713|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2713|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2714|2714| 						return true;
|2715|2715| 					}
|2716|2716| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2710|2710| 					{
|2711|2711| 						// The building was already finished/fully repaired before we arrived;
|2712|2712| 						// let the ConstructionFinished handler handle this.
|2713|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2713|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2714|2714| 						return true;
|2715|2715| 					}
|2716|2716| 
|    | [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
|2750|2750| 					if (this.MoveToTargetRange(this.repairTarget, IID_Builder))
|2751|2751| 						this.SetNextState("APPROACHING");
|2752|2752| 					else if (!this.CheckTargetRange(this.repairTarget, IID_Builder))
|2753|    |-						this.FinishOrder(); //can't approach and isn't in reach
|    |2753|+						this.FinishOrder(); // can't approach and isn't in reach
|2754|2754| 				},
|2755|2755| 			},
|2756|2756| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2837|2837| 
|2838|2838| 				// Unit was approaching and there's nothing to do now, so switch to walking
|2839|2839| 				if (oldState === "INDIVIDUAL.REPAIR.APPROACHING")
|2840|    |-				{
|    |2840|+				
|2841|2841| 					// We're already walking to the given point, so add this as a order.
|2842|2842| 					this.WalkToTarget(msg.data.newentity, true);
|2843|    |-				}
|    |2843|+				
|2844|2844| 			},
|2845|2845| 		},
|2846|2846| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2890|2890| 
|2891|2891| 					// Check that we can garrison here
|2892|2892| 					if (this.CanGarrison(target))
|2893|    |-					{
|    |2893|+					
|2894|2894| 						// Check that we're in range of the garrison target
|2895|2895| 						if (this.CheckGarrisonRange(target))
|2896|2896| 						{
|2966|2966| 								return false;
|2967|2967| 							}
|2968|2968| 						}
|2969|    |-					}
|    |2969|+					
|2970|2970| 					// Garrisoning failed for some reason, so finish the order
|2971|2971| 					this.FinishOrder();
|2972|2972| 					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
|3073|3073| 		"Attacked": function(msg) {
|3074|3074| 			if (this.template.NaturalBehaviour == "skittish" ||
|3075|3075| 			    this.template.NaturalBehaviour == "passive")
|3076|    |-			{
|    |3076|+			
|3077|3077| 				this.Flee(msg.data.attacker, false);
|3078|    |-			}
|    |3078|+			
|3079|3079| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|3080|3080| 			{
|3081|3081| 				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
|3082|3082| 					this.Attack(msg.data.attacker, false);
|3083|3083| 			}
|3084|3084| 			else if (this.template.NaturalBehaviour == "domestic")
|3085|    |-			{
|    |3085|+			
|3086|3086| 				// Never flee, stop what we were doing
|3087|3087| 				this.SetNextState("IDLE");
|3088|    |-			}
|    |3088|+			
|3089|3089| 		},
|3090|3090| 
|3091|3091| 		"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
|3092|3092| 			// Move a tile outside the building
|3093|3093| 			var range = 4;
|3094|3094| 			if (this.MoveToTargetRangeExplicit(msg.data.target, range, range))
|3095|    |-			{
|    |3095|+			
|3096|3096| 				// We've started walking to the given point
|3097|3097| 				this.SetNextState("WALKING");
|3098|    |-			}
|    |3098|+			
|3099|3099| 			else
|3100|3100| 			{
|3101|3101| 				// 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
|3097|3097| 				this.SetNextState("WALKING");
|3098|3098| 			}
|3099|3099| 			else
|3100|    |-			{
|    |3100|+			
|3101|3101| 				// We are already at the target, or can't move at all
|3102|3102| 				this.FinishOrder();
|3103|    |-			}
|    |3103|+			
|3104|3104| 		},
|3105|3105| 
|3106|3106| 		"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
|3139|3139| 				}
|3140|3140| 				// Start attacking one of the newly-seen enemy (if any)
|3141|3141| 				else if (this.IsDangerousAnimal())
|3142|    |-				{
|    |3142|+				
|3143|3143| 					this.AttackVisibleEntity(msg.data.added);
|3144|    |-				}
|    |3144|+				
|3145|3145| 
|3146|3146| 				// TODO: if two units enter our range together, we'll attack the
|3147|3147| 				// 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
|3182|3182| 				}
|3183|3183| 				// Start attacking one of the newly-seen enemy (if any)
|3184|3184| 				else if (this.template.NaturalBehaviour == "violent")
|3185|    |-				{
|    |3185|+				
|3186|3186| 					this.AttackVisibleEntity(msg.data.added);
|3187|    |-				}
|    |3187|+				
|3188|3188| 			},
|3189|3189| 
|3190|3190| 			"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
|3199|3199| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3200|3200| 
|3201|3201| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3202|    |-							// only used for domestic animals
|    |3202|+		// only used for domestic animals
|3203|3203| 	},
|3204|3204| };
|3205|3205| 
|    | [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
|3256|3256| 
|3257|3257| UnitAI.prototype.IsAnimal = function()
|3258|3258| {
|3259|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3259|+	return (!!this.template.NaturalBehaviour);
|3260|3260| };
|3261|3261| 
|3262|3262| 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
|3294|3294| UnitAI.prototype.GetGarrisonHolder = function()
|3295|3295| {
|3296|3296| 	if (this.IsGarrisoned())
|3297|    |-	{
|    |3297|+	
|3298|3298| 		for (let order of this.orderQueue)
|3299|3299| 			if (order.type == "Garrison")
|3300|3300| 				return order.data.target;
|3301|    |-	}
|    |3301|+	
|3302|3302| 	return INVALID_ENTITY;
|3303|3303| };
|3304|3304| 
|    | [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
|3372|3372| 		{
|3373|3373| 			let index = this.GetCurrentState().indexOf(".");
|3374|3374| 			if (index != -1)
|3375|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3375|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3376|3376| 			this.Stop(false);
|3377|3377| 		}
|3378|3378| 
|    | [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
|3428|3428| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3429|3429| 			continue;
|3430|3430| 		if (i == 0)
|3431|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3431|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3432|3432| 		else
|3433|3433| 			this.orderQueue.splice(i, 1);
|3434|3434| 		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
|3428|3428| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3429|3429| 			continue;
|3430|3430| 		if (i == 0)
|3431|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3431|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3432|3432| 		else
|3433|3433| 			this.orderQueue.splice(i, 1);
|3434|3434| 		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
|3512|3512| };
|3513|3513| 
|3514|3514| 
|3515|    |-//// FSM linkage functions ////
|    |3515|+// // FSM linkage functions ////
|3516|3516| 
|3517|3517| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3518|3518| 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
|3684|3684| 				continue;
|3685|3685| 			if (this.orderQueue[i].type == type)
|3686|3686| 				continue;
|3687|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3687|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3688|3688| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3689|3689| 			return;
|3690|3690| 		}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3684|3684| 				continue;
|3685|3685| 			if (this.orderQueue[i].type == type)
|3686|3686| 				continue;
|3687|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3687|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3688|3688| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3689|3689| 			return;
|3690|3690| 		}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3698|3698| {
|3699|3699| 	// Remember the previous work orders to be able to go back to them later if required
|3700|3700| 	if (data && data.force)
|3701|    |-	{
|    |3701|+	
|3702|3702| 		if (this.IsFormationController())
|3703|3703| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3704|3704| 		else
|3705|3705| 			this.UpdateWorkOrders(type);
|3706|    |-	}
|    |3706|+	
|3707|3707| 
|3708|3708| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3709|3709| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3775|3775| 	{
|3776|3776| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3777|3777| 		if (cmpUnitAI)
|3778|    |-		{
|    |3778|+		
|3779|3779| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3780|3780| 			{
|3781|3781| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3784|3784| 					return;
|3785|3785| 				}
|3786|3786| 			}
|3787|    |-		}
|    |3787|+		
|3788|3788| 	}
|3789|3789| 
|3790|3790| 	// 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
|3777|3777| 		if (cmpUnitAI)
|3778|3778| 		{
|3779|3779| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3780|    |-			{
|    |3780|+			
|3781|3781| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3782|3782| 				{
|3783|3783| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3784|3784| 					return;
|3785|3785| 				}
|3786|    |-			}
|    |3786|+			
|3787|3787| 		}
|3788|3788| 	}
|3789|3789| 
|    | [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
|3789|3789| 
|3790|3790| 	// If nothing found, take the unit orders
|3791|3791| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3792|    |-	{
|    |3792|+	
|3793|3793| 		if (isWorkType(this.orderQueue[i].type))
|3794|3794| 		{
|3795|3795| 			this.workOrders = this.orderQueue.slice(i);
|3796|3796| 			return;
|3797|3797| 		}
|3798|    |-	}
|    |3798|+	
|3799|3799| };
|3800|3800| 
|3801|3801| 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
|3855|3855| 	if (data.timerRepeat === undefined)
|3856|3856| 		this.timer = undefined;
|3857|3857| 
|3858|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3858|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3859|3859| };
|3860|3860| 
|3861|3861| /**
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3855|3855| 	if (data.timerRepeat === undefined)
|3856|3856| 		this.timer = undefined;
|3857|3857| 
|3858|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3858|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3859|3859| };
|3860|3860| 
|3861|3861| /**
|    | [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
|3890|3890| 	this.timer = undefined;
|3891|3891| };
|3892|3892| 
|3893|    |-//// Message handlers /////
|    |3893|+// // Message handlers /////
|3894|3894| 
|3895|3895| UnitAI.prototype.OnMotionChanged = function(msg)
|3896|3896| {
|    | [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
|3895|3895| UnitAI.prototype.OnMotionChanged = function(msg)
|3896|3896| {
|3897|3897| 	if (msg.starting && !msg.error)
|3898|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3898|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveStarted", "data": msg});
|3899|3899| 	else if (!msg.starting || msg.error)
|3900|3900| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3901|3901| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3895|3895| UnitAI.prototype.OnMotionChanged = function(msg)
|3896|3896| {
|3897|3897| 	if (msg.starting && !msg.error)
|3898|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3898|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg });
|3899|3899| 	else if (!msg.starting || msg.error)
|3900|3900| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3901|3901| };
|    | [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
|3897|3897| 	if (msg.starting && !msg.error)
|3898|3898| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3899|3899| 	else if (!msg.starting || msg.error)
|3900|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3900|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveCompleted", "data": msg});
|3901|3901| };
|3902|3902| 
|3903|3903| 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
|3897|3897| 	if (msg.starting && !msg.error)
|3898|3898| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3899|3899| 	else if (!msg.starting || msg.error)
|3900|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3900|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg });
|3901|3901| };
|3902|3902| 
|3903|3903| 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
|3905|3905| 	// TODO: This is a bit inefficient since every unit listens to every
|3906|3906| 	// construction message - ideally we could scope it to only the one we're building
|3907|3907| 
|3908|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3908|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3909|3909| };
|3910|3910| 
|3911|3911| 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
|3905|3905| 	// TODO: This is a bit inefficient since every unit listens to every
|3906|3906| 	// construction message - ideally we could scope it to only the one we're building
|3907|3907| 
|3908|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3908|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3909|3909| };
|3910|3910| 
|3911|3911| 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
|3930|3930| 
|3931|3931| UnitAI.prototype.OnAttacked = function(msg)
|3932|3932| {
|3933|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3933|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3934|3934| };
|3935|3935| 
|3936|3936| 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
|3930|3930| 
|3931|3931| UnitAI.prototype.OnAttacked = function(msg)
|3932|3932| {
|3933|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3933|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3934|3934| };
|3935|3935| 
|3936|3936| 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
|3935|3935| 
|3936|3936| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3937|3937| {
|3938|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3938|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|3939|3939| };
|3940|3940| 
|3941|3941| 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
|3935|3935| 
|3936|3936| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3937|3937| {
|3938|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3938|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|3939|3939| };
|3940|3940| 
|3941|3941| 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
|3940|3940| 
|3941|3941| UnitAI.prototype.OnHealthChanged = function(msg)
|3942|3942| {
|3943|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3943|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|3944|3944| };
|3945|3945| 
|3946|3946| 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
|3940|3940| 
|3941|3941| UnitAI.prototype.OnHealthChanged = function(msg)
|3942|3942| {
|3943|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3943|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|3944|3944| };
|3945|3945| 
|3946|3946| 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
|3946|3946| UnitAI.prototype.OnRangeUpdate = function(msg)
|3947|3947| {
|3948|3948| 	if (msg.tag == this.losRangeQuery)
|3949|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3949|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|3950|3950| 	else if (msg.tag == this.losHealRangeQuery)
|3951|3951| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3952|3952| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/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| UnitAI.prototype.OnRangeUpdate = function(msg)
|3947|3947| {
|3948|3948| 	if (msg.tag == this.losRangeQuery)
|3949|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3949|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|3950|3950| 	else if (msg.tag == this.losHealRangeQuery)
|3951|3951| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3952|3952| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3948|3948| 	if (msg.tag == this.losRangeQuery)
|3949|3949| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3950|3950| 	else if (msg.tag == this.losHealRangeQuery)
|3951|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3951|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|3952|3952| };
|3953|3953| 
|3954|3954| 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
|3948|3948| 	if (msg.tag == this.losRangeQuery)
|3949|3949| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3950|3950| 	else if (msg.tag == this.losHealRangeQuery)
|3951|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3951|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|3952|3952| };
|3953|3953| 
|3954|3954| 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
|3953|3953| 
|3954|3954| UnitAI.prototype.OnPackFinished = function(msg)
|3955|3955| {
|3956|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3956|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|3957|3957| };
|3958|3958| 
|3959|3959| //// 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
|3953|3953| 
|3954|3954| UnitAI.prototype.OnPackFinished = function(msg)
|3955|3955| {
|3956|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3956|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|3957|3957| };
|3958|3958| 
|3959|3959| //// 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
|3956|3956| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|3957|3957| };
|3958|3958| 
|3959|    |-//// Helper functions to be called by the FSM ////
|    |3959|+// // Helper functions to be called by the FSM ////
|3960|3960| 
|3961|3961| UnitAI.prototype.GetWalkSpeed = function()
|3962|3962| {
|    | [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
|4058|4058| 	if (!cmpOwnership || cmpOwnership.GetOwner() == INVALID_PLAYER)
|4059|4059| 		return undefined;
|4060|4060| 
|4061|    |-	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position)
|    |4061|+	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
|4062|4062| 	if (!cmpPosition || !cmpPosition.IsInWorld())
|4063|4063| 		return undefined;
|4064|4064| 
|    | [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
|4143|4143| 			PlaySound(name, member);
|4144|4144| 	}
|4145|4145| 	else
|4146|    |-	{
|    |4146|+	
|4147|4147| 		// Otherwise use our own sounds
|4148|4148| 		PlaySound(name, this.entity);
|4149|    |-	}
|    |4149|+	
|4150|4150| };
|4151|4151| 
|4152|4152| /*
|    | [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
|4312|4312| 	else
|4313|4313| 		// return false? Or hope you come close enough?
|4314|4314| 		var parabolicMaxRange = 0;
|4315|    |-		//return false;
|    |4315|+		// return false;
|4316|4316| 
|4317|4317| 	// the parabole changes while walking, take something in the middle
|4318|4318| 	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
|4377|4377| 	if (this.IsFormationMember())
|4378|4378| 	{
|4379|4379| 		var cmpFormationUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|4380|    |-		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation()
|4381|    |-			&& cmpFormationUnitAI.order.data.target == target)
|    |4380|+		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation() &&
|    |4381|+			cmpFormationUnitAI.order.data.target == target)
|4382|4382| 			return true;
|4383|4383| 	}
|4384|4384| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4545|4545| UnitAI.prototype.AttackEntityInZone = function(ents)
|4546|4546| {
|4547|4547| 	var target = ents.find(target =>
|4548|    |-		this.CanAttack(target)
|4549|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4548|+		this.CanAttack(target) &&
|    |4549|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4550|4550| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4551|4551| 	);
|4552|4552| 	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
|4546|4546| {
|4547|4547| 	var target = ents.find(target =>
|4548|4548| 		this.CanAttack(target)
|4549|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4550|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4549|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4550|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4551|4551| 	);
|4552|4552| 	if (!target)
|4553|4553| 		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
|4610|4610| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4611|4611| 	if (this.isGuardOf)
|4612|4612| 	{
|4613|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4613|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4614|4614| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4615|4615| 		if (cmpUnitAI && cmpAttack &&
|4616|4616| 		    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
|4614|4614| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4615|4615| 		if (cmpUnitAI && cmpAttack &&
|4616|4616| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4617|    |-				return false;
|    |4617|+			return false;
|4618|4618| 	}
|4619|4619| 
|4620|4620| 	// 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
|4619|4619| 
|4620|4620| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4621|4621| 	if (this.GetStance().respondHoldGround)
|4622|    |-	{
|    |4622|+	
|4623|4623| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4624|4624| 			return true;
|4625|    |-	}
|    |4625|+	
|4626|4626| 
|4627|4627| 	// Stop if it's left our vision range, unless we're especially persistent
|4628|4628| 	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
|4626|4626| 
|4627|4627| 	// Stop if it's left our vision range, unless we're especially persistent
|4628|4628| 	if (!this.GetStance().respondChaseBeyondVision)
|4629|    |-	{
|    |4629|+	
|4630|4630| 		if (!this.CheckTargetIsInVisionRange(target))
|4631|4631| 			return true;
|4632|    |-	}
|    |4632|+	
|4633|4633| 
|4634|4634| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4635|4635| 	// 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
|4652|4652| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4653|4653| 	if (this.isGuardOf)
|4654|4654| 	{
|4655|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4655|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4656|4656| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4657|4657| 		if (cmpUnitAI && cmpAttack &&
|4658|4658| 		    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
|4665|4665| 	return false;
|4666|4666| };
|4667|4667| 
|4668|    |-//// External interface functions ////
|    |4668|+// // External interface functions ////
|4669|4669| 
|4670|4670| UnitAI.prototype.SetFormationController = function(ent)
|4671|4671| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4675|4675| 	// of our own formation (or ourself if not in formation)
|4676|4676| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4677|4677| 	if (cmpObstruction)
|4678|    |-	{
|    |4678|+	
|4679|4679| 		if (ent == INVALID_ENTITY)
|4680|4680| 			cmpObstruction.SetControlGroup(this.entity);
|4681|4681| 		else
|4682|4682| 			cmpObstruction.SetControlGroup(ent);
|4683|    |-	}
|    |4683|+	
|4684|4684| 
|4685|4685| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4686|4686| 	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
|4818|4818| 	// if we already had an old guard order, do nothing if the target is the same
|4819|4819| 	// and the order is running, otherwise remove the previous order
|4820|4820| 	if (this.isGuardOf)
|4821|    |-	{
|    |4821|+	
|4822|4822| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4823|4823| 			return;
|4824|4824| 		else
|4825|4825| 			this.RemoveGuard();
|4826|    |-	}
|    |4826|+	
|4827|4827| 
|4828|4828| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4829|4829| };
|    | [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
|4821|4821| 	{
|4822|4822| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4823|4823| 			return;
|4824|    |-		else
|4825|    |-			this.RemoveGuard();
|    |4824|+		this.RemoveGuard();
|4826|4825| 	}
|4827|4826| 
|4828|4827| 	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
|4992|4992| 			this.WalkToTarget(target, queued);
|4993|4993| 		return;
|4994|4994| 	}
|4995|    |-	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture}, queued);
|    |4995|+	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture }, queued);
|4996|4996| };
|4997|4997| 
|4998|4998| /**
|    | [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
|5141|5141| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5142|5142| 	{
|5143|5143| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5144|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5144|+		if (cmpTrader.HasBothMarkets() &&
|5145|5145| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5146|5146| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5147|5147| 		{
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5422|5422| 				{
|5423|5423| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5424|5424| 					var targetClasses = this.order.data.targetClasses;
|5425|    |-					if (targetClasses.attack && cmpIdentity
|5426|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5425|+					if (targetClasses.attack && cmpIdentity &&
|    |5426|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5427|5427| 						continue;
|5428|5428| 					if (targetClasses.avoid && cmpIdentity
|5429|5429| 						&& 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
|5425|5425| 					if (targetClasses.attack && cmpIdentity
|5426|5426| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5427|5427| 						continue;
|5428|    |-					if (targetClasses.avoid && cmpIdentity
|5429|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5428|+					if (targetClasses.avoid && cmpIdentity &&
|    |5429|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5430|5430| 						continue;
|5431|5431| 					// Only used by the AIs to prevent some choices of targets
|5432|5432| 					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
|5448|5448| 		{
|5449|5449| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5450|5450| 			var targetClasses = this.order.data.targetClasses;
|5451|    |-			if (cmpIdentity && targetClasses.attack
|5452|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5451|+			if (cmpIdentity && targetClasses.attack &&
|    |5452|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5453|5453| 				continue;
|5454|5454| 			if (cmpIdentity && targetClasses.avoid
|5455|5455| 				&& 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
|5451|5451| 			if (cmpIdentity && targetClasses.attack
|5452|5452| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5453|5453| 				continue;
|5454|    |-			if (cmpIdentity && targetClasses.avoid
|5455|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5454|+			if (cmpIdentity && targetClasses.avoid &&
|    |5455|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5456|5456| 				continue;
|5457|5457| 			// Only used by the AIs to prevent some choices of targets
|5458|5458| 			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
|5594|5594| 
|5595|5595| UnitAI.prototype.SetHeldPosition = function(x, z)
|5596|5596| {
|5597|    |-	this.heldPosition = {"x": x, "z": z};
|    |5597|+	this.heldPosition = { "x": x, "z": z};
|5598|5598| };
|5599|5599| 
|5600|5600| 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
|5594|5594| 
|5595|5595| UnitAI.prototype.SetHeldPosition = function(x, z)
|5596|5596| {
|5597|    |-	this.heldPosition = {"x": x, "z": z};
|    |5597|+	this.heldPosition = {"x": x, "z": z };
|5598|5598| };
|5599|5599| 
|5600|5600| 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
|5621|5621| 	return false;
|5622|5622| };
|5623|5623| 
|5624|    |-//// Helper functions ////
|    |5624|+// // Helper functions ////
|5625|5625| 
|5626|5626| UnitAI.prototype.CanAttack = function(target)
|5627|5627| {
|    | [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
|5825|5825| 	return cmpPack && cmpPack.IsPacking();
|5826|5826| };
|5827|5827| 
|5828|    |-//// Formation specific functions ////
|    |5828|+// // Formation specific functions ////
|5829|5829| 
|5830|5830| UnitAI.prototype.IsAttackingAsFormation = function()
|5831|5831| {
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5830|5830| UnitAI.prototype.IsAttackingAsFormation = function()
|5831|5831| {
|5832|5832| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5833|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5834|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5833|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5834|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5835|5835| };
|5836|5836| 
|5837|5837| //// 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
|5834|5834| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5835|5835| };
|5836|5836| 
|5837|    |-//// Animal specific functions ////
|    |5837|+// // Animal specific functions ////
|5838|5838| 
|5839|5839| UnitAI.prototype.MoveRandomly = function(distance)
|5840|5840| {

binaries/data/mods/public/simulation/components/UnitAI.js
|1878| »   »   »   »   »   »   let·cmpFormation·=·Engine.QueryInterface(this.formationController,·IID_Formation);
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'cmpFormation' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|2397| »   »   »   »   »   »   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
|3760| »   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
|4532| »   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
|4547| »   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
|4593| »   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
|4616| »   »   ····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
|5072| »   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
|2017| »   »   »   »   »   »   &&·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
|2090| »   »   »   »   »   »   »   »   ·&&·((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
|2091| »   »   »   »   »   »   »   »   ·||·(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
|2092| »   »   »   »   »   »   »   »   ·&&·(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
|2115| »   »   »   »   »   »   »   »   var·nearby·=·this.FindNearestDropsite(oldType.generic);
|    | [NORMAL] JSHintBear:
|    | 'nearby' is already defined.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4325| »   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
|4381| »   »   »   &&·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
|4549| »   »   &&·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
|4550| »   »   &&·(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
|5072| »   var·lastPos·=·undefined;
|    | [NORMAL] JSHintBear:
|    | It's not necessary to initialize 'lastPos' to 'undefined'.

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

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

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

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

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

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

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

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

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
|5542| »   »   var·cmpVision·=·Engine.QueryInterface(this.entity,·IID_Vision);
|    | [MAJOR] JSHintBear:
|    | Too many errors. (92% scanned).
Executing section cli...

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

Stan added inline comments.Mar 9 2023, 9:41 AM
binaries/data/mods/public/simulation/components/UnitAI.js
1894

cmpAttack.CanCapture() We don't want to expose the internals too much.

We also might make more generic e.g.

cmpAttack.HasAbility(AttackHelper.CaptureAttack)