Page MenuHomeWildfire Games

Add proximity attack component.
Needs ReviewPublic

Authored by Freagarach on Apr 20 2019, 10:08 PM.

Details

Reviewers
None
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Trac Tickets
#995
Summary

Adding a ProximityAttack-component and changed the Damage-component so it can be used. This allows units to passively damage surrounding entities. Can perhaps be be used for e.g. trampling (and units which are on fire?). Perhaps for capturing nearby units passively as well? (With some adaptations.)

Test Plan

Give a unit the ProximityDamage-component and see how it works :) Hope I didn't overlook anything.

Diff Detail

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

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
Stan added a comment.Apr 21 2019, 8:57 AM

Don't we have splash damage for it ?

Perhaps my summary is a bit ambiguous, this allows a unit to have trample damage, so it can charge 'through' a formation of units whilst dealing damage. Useful for e.g. chariots, elephants, macadonian fire-raiser et alii.

Freagarach edited the summary of this revision. (Show Details)Apr 21 2019, 9:34 AM
wraitii added a reviewer: Restricted Owners Package.Apr 22 2019, 9:23 AM
wraitii added a subscriber: wraitii.

Open question for other devs: don't we already have a patch for trample damage somewhere?

Stan added a comment.Apr 22 2019, 11:03 AM

Well it's on #995

In D1838#75619, @Stan wrote:

Well it's on #995

As implied by my reference to that ticket, I've read the ticket (thorougly) and it states clearly that a seperate component is desired for trample damage. I understand that this is a far from compleat patch (one would like to have a trampling animation, the ability to push entities with a charging entity et cetera) but I reckon this is a good start. I would love to get some feedback and continue helping ;)

If you all agree this is unnecessary, however, I'll just use this only in my own mod.

Stan added a comment.Apr 22 2019, 12:55 PM

Sure, we were just making sure nobody did the work elsewhere :)

Does your patch have a significant performance impact when a lot of elephant and chariots with trample do stuff ?
One could also want to play a sound, and or switch animations when doing trample damages.

Shouldn't that component be called trample ?

Out of scope but would be nice to have a unit do trample damage when pressing a UI button. Such as hero special abilities.

binaries/data/mods/public/simulation/components/Damage.js
262

Comments on top, start with caps :)

binaries/data/mods/public/simulation/components/ProximityDamage.js
124

Comments start with caps :)

135

Comments start with caps :)

143

JSDoc. Also, are there messages one might want to ignore ?

Freagarach updated this revision to Diff 7810.Apr 22 2019, 8:51 PM
Freagarach retitled this revision from Add proximity attack component to Add proximity attack component..

Applied Stan's inline suggestions.

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|  23|  23| 	let cmpTimer = Engine.QueryInterface(SYSTEM_ENTITY, IID_Timer);
|  24|  24| 	let turnLength = cmpTimer.GetLatestTurnLength();
|  25|  25| 	return new Vector3D(
|  26|    |-			(curPos.x * (turnLength - lateness) + prevPos.x * lateness) / turnLength,
|    |  26|+		(curPos.x * (turnLength - lateness) + prevPos.x * lateness) / turnLength,
|  27|  27| 			0,
|  28|  28| 			(curPos.z * (turnLength - lateness) + prevPos.z * lateness) / turnLength);
|  29|  29| };
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|  24|  24| 	let turnLength = cmpTimer.GetLatestTurnLength();
|  25|  25| 	return new Vector3D(
|  26|  26| 			(curPos.x * (turnLength - lateness) + prevPos.x * lateness) / turnLength,
|  27|    |-			0,
|    |  27|+		0,
|  28|  28| 			(curPos.z * (turnLength - lateness) + prevPos.z * lateness) / turnLength);
|  29|  29| };
|  30|  30| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|  25|  25| 	return new Vector3D(
|  26|  26| 			(curPos.x * (turnLength - lateness) + prevPos.x * lateness) / turnLength,
|  27|  27| 			0,
|  28|    |-			(curPos.z * (turnLength - lateness) + prevPos.z * lateness) / turnLength);
|    |  28|+		(curPos.z * (turnLength - lateness) + prevPos.z * lateness) / turnLength);
|  29|  29| };
|  30|  30| 
|  31|  31| /**
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
| 111| 111| 
| 112| 112| 	// Do this first in case the direct hit kills the target
| 113| 113| 	if (data.isSplash)
| 114|    |-	{
|    | 114|+	
| 115| 115| 		this.CauseSplashDamage({
| 116| 116| 			"attacker": data.attacker,
| 117| 117| 			"origin": Vector2D.from3D(data.position),
| 124| 124| 			"type": data.type,
| 125| 125| 			"attackerOwner": data.attackerOwner
| 126| 126| 		});
| 127|    |-	}
|    | 127|+	
| 128| 128| 
| 129| 129| 	let cmpProjectileManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_ProjectileManager);
| 130| 130| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
| 212| 212| 				damageMultiplier = 0;
| 213| 213| 		}
| 214| 214| 		else // In case someone calls this function with an invalid shape.
| 215|    |-		{
|    | 215|+		
| 216| 216| 			warn("The " + data.shape + " splash damage shape is not implemented!");
| 217|    |-		}
|    | 217|+		
| 218| 218| 
| 219| 219| 		if (data.splashBonus)
| 220| 220| 			damageMultiplier *= GetDamageBonus(ent, data.splashBonus);
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
| 245| 245| 			continue;
| 246| 246| 
| 247| 247| 		// Do not damage restricted classes
| 248|    |-		let cmpProximityDamage = Engine.QueryInterface(data.attacker, IID_ProximityDamage)
|    | 248|+		let cmpProximityDamage = Engine.QueryInterface(data.attacker, IID_ProximityDamage);
| 249| 249| 		let restrictedClasses = cmpProximityDamage.GetRestrictedClasses();
| 250| 250| 		let cmpIdentity = QueryMiragedInterface(ent, IID_Identity);
| 251| 251| 		let targetClasses = cmpIdentity.GetClassesList();
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
| 257| 257| 		if (data.shape == 'Circular')
| 258| 258| 			damageMultiplier = 1 - data.origin.distanceToSquared(entityPosition) / (data.radius * data.radius);
| 259| 259| 		else
| 260|    |-		{
|    | 260|+		
| 261| 261| 			warn("The " + data.shape + " proximity damage shape is not implemented!");
| 262|    |-		}
|    | 262|+		
| 263| 263| 
| 264| 264| 		if (data.proximityBonus)
| 265| 265| 			damageMultiplier *= GetDamageBonus(ent, data.proximityBonus);

binaries/data/mods/public/simulation/components/Damage.js
| 248| »   »   let·cmpProximityDamage·=·Engine.QueryInterface(data.attacker,·IID_ProximityDamage)
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/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| 					var 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 (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2015|2015| 
|2016|2016| 				"Attacked": function(msg) {
|2017|2017| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2018|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2019|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2018|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2019|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2020|2020| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2021|2021| 				},
|2022|2022| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2029|2029| 					this.SelectAnimation("move");
|2030|2030| 					var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|2031|2031| 					if (cmpUnitAI && cmpUnitAI.IsFleeing())
|2032|    |-					{
|    |2032|+					
|2033|2033| 						// Run after a fleeing target
|2034|2034| 						this.SetMoveSpeedRatio(this.GetRunMultiplier());
|2035|    |-					}
|    |2035|+					
|2036|2036| 					this.StartTimer(1000, 1000);
|2037|2037| 				},
|2038|2038| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2088|2088| 						// Also don't switch to a different type of huntable animal
|2089|2089| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2090|2090| 							return (
|2091|    |-								ent != oldTarget
|2092|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2091|+								ent != oldTarget &&
|    |2092|+								 ((type.generic == "treasure" && oldType.generic == "treasure")
|2093|2093| 								 || (type.specific == oldType.specific
|2094|2094| 								 && (type.specific != "meat" || oldTemplate == template)))
|2095|2095| 							);
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2089|2089| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2090|2090| 							return (
|2091|2091| 								ent != oldTarget
|2092|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2093|    |-								 || (type.specific == oldType.specific
|    |2092|+								 && ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2093|+								 (type.specific == oldType.specific
|2094|2094| 								 && (type.specific != "meat" || oldTemplate == template)))
|2095|2095| 							);
|2096|2096| 						}, oldTarget);
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2090|2090| 							return (
|2091|2091| 								ent != oldTarget
|2092|2092| 								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2093|    |-								 || (type.specific == oldType.specific
|2094|    |-								 && (type.specific != "meat" || oldTemplate == template)))
|    |2093|+								 || (type.specific == oldType.specific &&
|    |2094|+								 (type.specific != "meat" || oldTemplate == template)))
|2095|2095| 							);
|2096|2096| 						}, oldTarget);
|2097|2097| 						if (nearby)
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2099|2099| 							this.PerformGather(nearby, false, false);
|2100|2100| 							return true;
|2101|2101| 						}
|2102|    |-						else
|2103|    |-						{
|    |2102|+						
|2104|2103| 							// It's probably better in this case, to avoid units getting stuck around a dropsite
|2105|2104| 							// in a "Target is far away, full, nearby are no good resources, return to dropsite" loop
|2106|2105| 							// to order it to GatherNear the resource position.
|2121|2120| 									return true;
|2122|2121| 								}
|2123|2122| 							}
|2124|    |-						}
|    |2123|+						
|2125|2124| 						return true;
|2126|2125| 					}
|2127|2126| 					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
|2111|2111| 								this.GatherNearPosition(pos.x, pos.z, oldType, oldTemplate);
|2112|2112| 								return true;
|2113|2113| 							}
|2114|    |-							else
|2115|    |-							{
|    |2114|+							
|2116|2115| 								// we're kind of stuck here. Return resource.
|2117|2116| 								var nearby = this.FindNearestDropsite(oldType.generic);
|2118|2117| 								if (nearby)
|2120|2119| 									this.PushOrderFront("ReturnResource", { "target": nearby, "force": false });
|2121|2120| 									return true;
|2122|2121| 								}
|2123|    |-							}
|    |2122|+							
|2124|2123| 						}
|2125|2124| 						return true;
|2126|2125| 					}
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2153|2153| 						// Also don't switch to a different type of huntable animal
|2154|2154| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2155|2155| 							return (
|2156|    |-								ent != oldTarget
|2157|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2156|+								ent != oldTarget &&
|    |2157|+								((type.generic == "treasure" && oldType.generic == "treasure")
|2158|2158| 								|| (type.specific == oldType.specific
|2159|2159| 								&& (type.specific != "meat" || oldTemplate == template)))
|2160|2160| 							);
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2154|2154| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2155|2155| 							return (
|2156|2156| 								ent != oldTarget
|2157|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2158|    |-								|| (type.specific == oldType.specific
|    |2157|+								&& ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2158|+								(type.specific == oldType.specific
|2159|2159| 								&& (type.specific != "meat" || oldTemplate == template)))
|2160|2160| 							);
|2161|2161| 						});
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2155|2155| 							return (
|2156|2156| 								ent != oldTarget
|2157|2157| 								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2158|    |-								|| (type.specific == oldType.specific
|2159|    |-								&& (type.specific != "meat" || oldTemplate == template)))
|    |2158|+								|| (type.specific == oldType.specific &&
|    |2159|+								(type.specific != "meat" || oldTemplate == template)))
|2160|2160| 							);
|2161|2161| 						});
|2162|2162| 						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
|2200|2200| 					// Also don't switch to a different type of huntable animal
|2201|2201| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2202|2202| 						return (
|2203|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2204|    |-							|| (type.specific == resourceType.specific
|    |2203|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2204|+							(type.specific == resourceType.specific
|2205|2205| 							&& (type.specific != "meat" || resourceTemplate == template))
|2206|2206| 						);
|2207|2207| 					});
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2201|2201| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2202|2202| 						return (
|2203|2203| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2204|    |-							|| (type.specific == resourceType.specific
|2205|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2204|+							|| (type.specific == resourceType.specific &&
|    |2205|+							(type.specific != "meat" || resourceTemplate == template))
|2206|2206| 						);
|2207|2207| 					});
|2208|2208| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2317|2317| 
|2318|2318| 					var cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply);
|2319|2319| 					if (cmpSupply && cmpSupply.IsAvailable(cmpOwnership.GetOwner(), this.entity))
|2320|    |-					{
|    |2320|+					
|2321|2321| 						// Check we can still reach and gather from the target
|2322|2322| 						if (this.CheckTargetRange(this.gatheringTarget, IID_ResourceGatherer) && this.CanGather(this.gatheringTarget))
|2323|2323| 						{
|2383|2383| 								return;
|2384|2384| 							}
|2385|2385| 						}
|2386|    |-					}
|    |2386|+					
|2387|2387| 
|2388|2388| 					// We're already in range, can't get anywhere near it or the target is exhausted.
|2389|2389| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2409|2409| 					// Also don't switch to a different type of huntable animal
|2410|2410| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2411|2411| 						return (
|2412|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2413|    |-							|| (type.specific == resourceType.specific
|    |2412|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2413|+							(type.specific == resourceType.specific
|2414|2414| 							&& (type.specific != "meat" || resourceTemplate == template))
|2415|2415| 						);
|2416|2416| 					});
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2410|2410| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2411|2411| 						return (
|2412|2412| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2413|    |-							|| (type.specific == resourceType.specific
|2414|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2413|+							|| (type.specific == resourceType.specific &&
|    |2414|+							(type.specific != "meat" || resourceTemplate == template))
|2415|2415| 						);
|2416|2416| 					});
|2417|2417| 					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
|2497|2497| 					this.StartTimer(prepare, this.healTimers.repeat);
|2498|2498| 
|2499|2499| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2500|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2500|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2501|2501| 
|2502|2502| 					this.FaceTowardsTarget(this.order.data.target);
|2503|2503| 				},
|    | [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
|2712|2712| 					{
|2713|2713| 						// The building was already finished/fully repaired before we arrived;
|2714|2714| 						// let the ConstructionFinished handler handle this.
|2715|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2715|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2716|2716| 						return true;
|2717|2717| 					}
|2718|2718| 
|    | [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
|2712|2712| 					{
|2713|2713| 						// The building was already finished/fully repaired before we arrived;
|2714|2714| 						// let the ConstructionFinished handler handle this.
|2715|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2715|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2716|2716| 						return true;
|2717|2717| 					}
|2718|2718| 
|    | [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
|2752|2752| 					if (this.MoveToTargetRange(this.repairTarget, IID_Builder))
|2753|2753| 						this.SetNextState("APPROACHING");
|2754|2754| 					else if (!this.CheckTargetRange(this.repairTarget, IID_Builder))
|2755|    |-						this.FinishOrder(); //can't approach and isn't in reach
|    |2755|+						this.FinishOrder(); // can't approach and isn't in reach
|2756|2756| 				},
|2757|2757| 			},
|2758|2758| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2839|2839| 
|2840|2840| 				// Unit was approaching and there's nothing to do now, so switch to walking
|2841|2841| 				if (oldState === "INDIVIDUAL.REPAIR.APPROACHING")
|2842|    |-				{
|    |2842|+				
|2843|2843| 					// We're already walking to the given point, so add this as a order.
|2844|2844| 					this.WalkToTarget(msg.data.newentity, true);
|2845|    |-				}
|    |2845|+				
|2846|2846| 			},
|2847|2847| 		},
|2848|2848| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2892|2892| 
|2893|2893| 					// Check that we can garrison here
|2894|2894| 					if (this.CanGarrison(target))
|2895|    |-					{
|    |2895|+					
|2896|2896| 						// Check that we're in range of the garrison target
|2897|2897| 						if (this.CheckGarrisonRange(target))
|2898|2898| 						{
|2968|2968| 								return false;
|2969|2969| 							}
|2970|2970| 						}
|2971|    |-					}
|    |2971|+					
|2972|2972| 					// Garrisoning failed for some reason, so finish the order
|2973|2973| 					this.FinishOrder();
|2974|2974| 					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
|3075|3075| 		"Attacked": function(msg) {
|3076|3076| 			if (this.template.NaturalBehaviour == "skittish" ||
|3077|3077| 			    this.template.NaturalBehaviour == "passive")
|3078|    |-			{
|    |3078|+			
|3079|3079| 				this.Flee(msg.data.attacker, false);
|3080|    |-			}
|    |3080|+			
|3081|3081| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|3082|3082| 			{
|3083|3083| 				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
|3084|3084| 					this.Attack(msg.data.attacker, false);
|3085|3085| 			}
|3086|3086| 			else if (this.template.NaturalBehaviour == "domestic")
|3087|    |-			{
|    |3087|+			
|3088|3088| 				// Never flee, stop what we were doing
|3089|3089| 				this.SetNextState("IDLE");
|3090|    |-			}
|    |3090|+			
|3091|3091| 		},
|3092|3092| 
|3093|3093| 		"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
|3094|3094| 			// Move a tile outside the building
|3095|3095| 			var range = 4;
|3096|3096| 			if (this.MoveToTargetRangeExplicit(msg.data.target, range, range))
|3097|    |-			{
|    |3097|+			
|3098|3098| 				// We've started walking to the given point
|3099|3099| 				this.SetNextState("WALKING");
|3100|    |-			}
|    |3100|+			
|3101|3101| 			else
|3102|3102| 			{
|3103|3103| 				// 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
|3099|3099| 				this.SetNextState("WALKING");
|3100|3100| 			}
|3101|3101| 			else
|3102|    |-			{
|    |3102|+			
|3103|3103| 				// We are already at the target, or can't move at all
|3104|3104| 				this.FinishOrder();
|3105|    |-			}
|    |3105|+			
|3106|3106| 		},
|3107|3107| 
|3108|3108| 		"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
|3141|3141| 				}
|3142|3142| 				// Start attacking one of the newly-seen enemy (if any)
|3143|3143| 				else if (this.IsDangerousAnimal())
|3144|    |-				{
|    |3144|+				
|3145|3145| 					this.AttackVisibleEntity(msg.data.added);
|3146|    |-				}
|    |3146|+				
|3147|3147| 
|3148|3148| 				// TODO: if two units enter our range together, we'll attack the
|3149|3149| 				// 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
|3184|3184| 				}
|3185|3185| 				// Start attacking one of the newly-seen enemy (if any)
|3186|3186| 				else if (this.template.NaturalBehaviour == "violent")
|3187|    |-				{
|    |3187|+				
|3188|3188| 					this.AttackVisibleEntity(msg.data.added);
|3189|    |-				}
|    |3189|+				
|3190|3190| 			},
|3191|3191| 
|3192|3192| 			"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
|3201|3201| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3202|3202| 
|3203|3203| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3204|    |-							// only used for domestic animals
|    |3204|+		// only used for domestic animals
|3205|3205| 	},
|3206|3206| };
|3207|3207| 
|    | [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
|3258|3258| 
|3259|3259| UnitAI.prototype.IsAnimal = function()
|3260|3260| {
|3261|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3261|+	return (!!this.template.NaturalBehaviour);
|3262|3262| };
|3263|3263| 
|3264|3264| 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
|3296|3296| UnitAI.prototype.GetGarrisonHolder = function()
|3297|3297| {
|3298|3298| 	if (this.IsGarrisoned())
|3299|    |-	{
|    |3299|+	
|3300|3300| 		for (let order of this.orderQueue)
|3301|3301| 			if (order.type == "Garrison")
|3302|3302| 				return order.data.target;
|3303|    |-	}
|    |3303|+	
|3304|3304| 	return INVALID_ENTITY;
|3305|3305| };
|3306|3306| 
|    | [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
|3380|3380| 		{
|3381|3381| 			let index = this.GetCurrentState().indexOf(".");
|3382|3382| 			if (index != -1)
|3383|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3383|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3384|3384| 			this.Stop(false);
|3385|3385| 		}
|3386|3386| 
|    | [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
|3436|3436| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3437|3437| 			continue;
|3438|3438| 		if (i == 0)
|3439|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3439|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3440|3440| 		else
|3441|3441| 			this.orderQueue.splice(i, 1);
|3442|3442| 		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
|3436|3436| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3437|3437| 			continue;
|3438|3438| 		if (i == 0)
|3439|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3439|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3440|3440| 		else
|3441|3441| 			this.orderQueue.splice(i, 1);
|3442|3442| 		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
|3520|3520| };
|3521|3521| 
|3522|3522| 
|3523|    |-//// FSM linkage functions ////
|    |3523|+// // FSM linkage functions ////
|3524|3524| 
|3525|3525| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3526|3526| 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
|3692|3692| 				continue;
|3693|3693| 			if (this.orderQueue[i].type == type)
|3694|3694| 				continue;
|3695|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3695|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3696|3696| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3697|3697| 			return;
|3698|3698| 		}
|    | [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
|3692|3692| 				continue;
|3693|3693| 			if (this.orderQueue[i].type == type)
|3694|3694| 				continue;
|3695|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3695|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3696|3696| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3697|3697| 			return;
|3698|3698| 		}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3706|3706| {
|3707|3707| 	// Remember the previous work orders to be able to go back to them later if required
|3708|3708| 	if (data && data.force)
|3709|    |-	{
|    |3709|+	
|3710|3710| 		if (this.IsFormationController())
|3711|3711| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3712|3712| 		else
|3713|3713| 			this.UpdateWorkOrders(type);
|3714|    |-	}
|    |3714|+	
|3715|3715| 
|3716|3716| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3717|3717| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3783|3783| 	{
|3784|3784| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3785|3785| 		if (cmpUnitAI)
|3786|    |-		{
|    |3786|+		
|3787|3787| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3788|3788| 			{
|3789|3789| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3792|3792| 					return;
|3793|3793| 				}
|3794|3794| 			}
|3795|    |-		}
|    |3795|+		
|3796|3796| 	}
|3797|3797| 
|3798|3798| 	// 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
|3785|3785| 		if (cmpUnitAI)
|3786|3786| 		{
|3787|3787| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3788|    |-			{
|    |3788|+			
|3789|3789| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3790|3790| 				{
|3791|3791| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3792|3792| 					return;
|3793|3793| 				}
|3794|    |-			}
|    |3794|+			
|3795|3795| 		}
|3796|3796| 	}
|3797|3797| 
|    | [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
|3797|3797| 
|3798|3798| 	// If nothing found, take the unit orders
|3799|3799| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3800|    |-	{
|    |3800|+	
|3801|3801| 		if (isWorkType(this.orderQueue[i].type))
|3802|3802| 		{
|3803|3803| 			this.workOrders = this.orderQueue.slice(i);
|3804|3804| 			return;
|3805|3805| 		}
|3806|    |-	}
|    |3806|+	
|3807|3807| };
|3808|3808| 
|3809|3809| 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
|3863|3863| 	if (data.timerRepeat === undefined)
|3864|3864| 		this.timer = undefined;
|3865|3865| 
|3866|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3866|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3867|3867| };
|3868|3868| 
|3869|3869| /**
|    | [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
|3863|3863| 	if (data.timerRepeat === undefined)
|3864|3864| 		this.timer = undefined;
|3865|3865| 
|3866|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3866|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3867|3867| };
|3868|3868| 
|3869|3869| /**
|    | [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
|3898|3898| 	this.timer = undefined;
|3899|3899| };
|3900|3900| 
|3901|    |-//// Message handlers /////
|    |3901|+// // Message handlers /////
|3902|3902| 
|3903|3903| UnitAI.prototype.OnMotionChanged = function(msg)
|3904|3904| {
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3903|3903| UnitAI.prototype.OnMotionChanged = function(msg)
|3904|3904| {
|3905|3905| 	if (msg.starting && !msg.error)
|3906|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3906|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveStarted", "data": msg});
|3907|3907| 	else if (!msg.starting || msg.error)
|3908|3908| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3909|3909| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3903|3903| UnitAI.prototype.OnMotionChanged = function(msg)
|3904|3904| {
|3905|3905| 	if (msg.starting && !msg.error)
|3906|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3906|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg });
|3907|3907| 	else if (!msg.starting || msg.error)
|3908|3908| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3909|3909| };
|    | [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| 	if (msg.starting && !msg.error)
|3906|3906| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3907|3907| 	else if (!msg.starting || msg.error)
|3908|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3908|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveCompleted", "data": msg});
|3909|3909| };
|3910|3910| 
|3911|3911| 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
|3905|3905| 	if (msg.starting && !msg.error)
|3906|3906| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3907|3907| 	else if (!msg.starting || msg.error)
|3908|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3908|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg });
|3909|3909| };
|3910|3910| 
|3911|3911| 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
|3913|3913| 	// TODO: This is a bit inefficient since every unit listens to every
|3914|3914| 	// construction message - ideally we could scope it to only the one we're building
|3915|3915| 
|3916|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3916|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3917|3917| };
|3918|3918| 
|3919|3919| 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
|3913|3913| 	// TODO: This is a bit inefficient since every unit listens to every
|3914|3914| 	// construction message - ideally we could scope it to only the one we're building
|3915|3915| 
|3916|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3916|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3917|3917| };
|3918|3918| 
|3919|3919| 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
|3938|3938| 
|3939|3939| UnitAI.prototype.OnAttacked = function(msg)
|3940|3940| {
|3941|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3941|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3942|3942| };
|3943|3943| 
|3944|3944| 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
|3938|3938| 
|3939|3939| UnitAI.prototype.OnAttacked = function(msg)
|3940|3940| {
|3941|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3941|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3942|3942| };
|3943|3943| 
|3944|3944| 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
|3943|3943| 
|3944|3944| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3945|3945| {
|3946|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3946|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|3947|3947| };
|3948|3948| 
|3949|3949| 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
|3943|3943| 
|3944|3944| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3945|3945| {
|3946|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3946|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|3947|3947| };
|3948|3948| 
|3949|3949| 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
|3948|3948| 
|3949|3949| UnitAI.prototype.OnHealthChanged = function(msg)
|3950|3950| {
|3951|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3951|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|3952|3952| };
|3953|3953| 
|3954|3954| 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
|3948|3948| 
|3949|3949| UnitAI.prototype.OnHealthChanged = function(msg)
|3950|3950| {
|3951|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3951|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|3952|3952| };
|3953|3953| 
|3954|3954| 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
|3954|3954| UnitAI.prototype.OnRangeUpdate = function(msg)
|3955|3955| {
|3956|3956| 	if (msg.tag == this.losRangeQuery)
|3957|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3957|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|3958|3958| 	else if (msg.tag == this.losHealRangeQuery)
|3959|3959| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3960|3960| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3954|3954| UnitAI.prototype.OnRangeUpdate = function(msg)
|3955|3955| {
|3956|3956| 	if (msg.tag == this.losRangeQuery)
|3957|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3957|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|3958|3958| 	else if (msg.tag == this.losHealRangeQuery)
|3959|3959| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3960|3960| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3956|3956| 	if (msg.tag == this.losRangeQuery)
|3957|3957| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3958|3958| 	else if (msg.tag == this.losHealRangeQuery)
|3959|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3959|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|3960|3960| };
|3961|3961| 
|3962|3962| 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
|3956|3956| 	if (msg.tag == this.losRangeQuery)
|3957|3957| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3958|3958| 	else if (msg.tag == this.losHealRangeQuery)
|3959|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3959|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|3960|3960| };
|3961|3961| 
|3962|3962| 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
|3961|3961| 
|3962|3962| UnitAI.prototype.OnPackFinished = function(msg)
|3963|3963| {
|3964|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3964|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|3965|3965| };
|3966|3966| 
|3967|3967| //// 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
|3961|3961| 
|3962|3962| UnitAI.prototype.OnPackFinished = function(msg)
|3963|3963| {
|3964|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3964|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|3965|3965| };
|3966|3966| 
|3967|3967| //// 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
|3964|3964| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|3965|3965| };
|3966|3966| 
|3967|    |-//// Helper functions to be called by the FSM ////
|    |3967|+// // Helper functions to be called by the FSM ////
|3968|3968| 
|3969|3969| UnitAI.prototype.GetWalkSpeed = function()
|3970|3970| {
|    | [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
|4066|4066| 	if (!cmpOwnership || cmpOwnership.GetOwner() == INVALID_PLAYER)
|4067|4067| 		return undefined;
|4068|4068| 
|4069|    |-	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position)
|    |4069|+	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
|4070|4070| 	if (!cmpPosition || !cmpPosition.IsInWorld())
|4071|4071| 		return undefined;
|4072|4072| 
|    | [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
|4151|4151| 			PlaySound(name, member);
|4152|4152| 	}
|4153|4153| 	else
|4154|    |-	{
|    |4154|+	
|4155|4155| 		// Otherwise use our own sounds
|4156|4156| 		PlaySound(name, this.entity);
|4157|    |-	}
|    |4157|+	
|4158|4158| };
|4159|4159| 
|4160|4160| /*
|    | [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
|4320|4320| 	else
|4321|4321| 		// return false? Or hope you come close enough?
|4322|4322| 		var parabolicMaxRange = 0;
|4323|    |-		//return false;
|    |4323|+		// return false;
|4324|4324| 
|4325|4325| 	// the parabole changes while walking, take something in the middle
|4326|4326| 	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
|4385|4385| 	if (this.IsFormationMember())
|4386|4386| 	{
|4387|4387| 		var cmpFormationUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|4388|    |-		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation()
|4389|    |-			&& cmpFormationUnitAI.order.data.target == target)
|    |4388|+		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation() &&
|    |4389|+			cmpFormationUnitAI.order.data.target == target)
|4390|4390| 			return true;
|4391|4391| 	}
|4392|4392| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4553|4553| UnitAI.prototype.AttackEntityInZone = function(ents)
|4554|4554| {
|4555|4555| 	var target = ents.find(target =>
|4556|    |-		this.CanAttack(target)
|4557|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4556|+		this.CanAttack(target) &&
|    |4557|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4558|4558| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4559|4559| 	);
|4560|4560| 	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
|4554|4554| {
|4555|4555| 	var target = ents.find(target =>
|4556|4556| 		this.CanAttack(target)
|4557|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4558|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4557|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4558|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4559|4559| 	);
|4560|4560| 	if (!target)
|4561|4561| 		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
|4618|4618| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4619|4619| 	if (this.isGuardOf)
|4620|4620| 	{
|4621|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4621|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4622|4622| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4623|4623| 		if (cmpUnitAI && cmpAttack &&
|4624|4624| 		    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
|4622|4622| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4623|4623| 		if (cmpUnitAI && cmpAttack &&
|4624|4624| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4625|    |-				return false;
|    |4625|+			return false;
|4626|4626| 	}
|4627|4627| 
|4628|4628| 	// 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
|4627|4627| 
|4628|4628| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4629|4629| 	if (this.GetStance().respondHoldGround)
|4630|    |-	{
|    |4630|+	
|4631|4631| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4632|4632| 			return true;
|4633|    |-	}
|    |4633|+	
|4634|4634| 
|4635|4635| 	// Stop if it's left our vision range, unless we're especially persistent
|4636|4636| 	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
|4634|4634| 
|4635|4635| 	// Stop if it's left our vision range, unless we're especially persistent
|4636|4636| 	if (!this.GetStance().respondChaseBeyondVision)
|4637|    |-	{
|    |4637|+	
|4638|4638| 		if (!this.CheckTargetIsInVisionRange(target))
|4639|4639| 			return true;
|4640|    |-	}
|    |4640|+	
|4641|4641| 
|4642|4642| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4643|4643| 	// 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
|4660|4660| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4661|4661| 	if (this.isGuardOf)
|4662|4662| 	{
|4663|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4663|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4664|4664| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4665|4665| 		if (cmpUnitAI && cmpAttack &&
|4666|4666| 		    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
|4673|4673| 	return false;
|4674|4674| };
|4675|4675| 
|4676|    |-//// External interface functions ////
|    |4676|+// // External interface functions ////
|4677|4677| 
|4678|4678| UnitAI.prototype.SetFormationController = function(ent)
|4679|4679| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4683|4683| 	// of our own formation (or ourself if not in formation)
|4684|4684| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4685|4685| 	if (cmpObstruction)
|4686|    |-	{
|    |4686|+	
|4687|4687| 		if (ent == INVALID_ENTITY)
|4688|4688| 			cmpObstruction.SetControlGroup(this.entity);
|4689|4689| 		else
|4690|4690| 			cmpObstruction.SetControlGroup(ent);
|4691|    |-	}
|    |4691|+	
|4692|4692| 
|4693|4693| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4694|4694| 	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
|4826|4826| 	// if we already had an old guard order, do nothing if the target is the same
|4827|4827| 	// and the order is running, otherwise remove the previous order
|4828|4828| 	if (this.isGuardOf)
|4829|    |-	{
|    |4829|+	
|4830|4830| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4831|4831| 			return;
|4832|4832| 		else
|4833|4833| 			this.RemoveGuard();
|4834|    |-	}
|    |4834|+	
|4835|4835| 
|4836|4836| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4837|4837| };
|    | [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
|4829|4829| 	{
|4830|4830| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4831|4831| 			return;
|4832|    |-		else
|4833|    |-			this.RemoveGuard();
|    |4832|+		this.RemoveGuard();
|4834|4833| 	}
|4835|4834| 
|4836|4835| 	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
|5000|5000| 			this.WalkToTarget(target, queued);
|5001|5001| 		return;
|5002|5002| 	}
|5003|    |-	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture}, queued);
|    |5003|+	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture }, queued);
|5004|5004| };
|5005|5005| 
|5006|5006| /**
|    | [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
|5149|5149| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5150|5150| 	{
|5151|5151| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5152|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5152|+		if (cmpTrader.HasBothMarkets() &&
|5153|5153| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5154|5154| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5155|5155| 		{
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5430|5430| 				{
|5431|5431| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5432|5432| 					var targetClasses = this.order.data.targetClasses;
|5433|    |-					if (targetClasses.attack && cmpIdentity
|5434|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5433|+					if (targetClasses.attack && cmpIdentity &&
|    |5434|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5435|5435| 						continue;
|5436|5436| 					if (targetClasses.avoid && cmpIdentity
|5437|5437| 						&& 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
|5433|5433| 					if (targetClasses.attack && cmpIdentity
|5434|5434| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5435|5435| 						continue;
|5436|    |-					if (targetClasses.avoid && cmpIdentity
|5437|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5436|+					if (targetClasses.avoid && cmpIdentity &&
|    |5437|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5438|5438| 						continue;
|5439|5439| 					// Only used by the AIs to prevent some choices of targets
|5440|5440| 					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
|5456|5456| 		{
|5457|5457| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5458|5458| 			var targetClasses = this.order.data.targetClasses;
|5459|    |-			if (cmpIdentity && targetClasses.attack
|5460|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5459|+			if (cmpIdentity && targetClasses.attack &&
|    |5460|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5461|5461| 				continue;
|5462|5462| 			if (cmpIdentity && targetClasses.avoid
|5463|5463| 				&& 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
|5459|5459| 			if (cmpIdentity && targetClasses.attack
|5460|5460| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5461|5461| 				continue;
|5462|    |-			if (cmpIdentity && targetClasses.avoid
|5463|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5462|+			if (cmpIdentity && targetClasses.avoid &&
|    |5463|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5464|5464| 				continue;
|5465|5465| 			// Only used by the AIs to prevent some choices of targets
|5466|5466| 			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
|5602|5602| 
|5603|5603| UnitAI.prototype.SetHeldPosition = function(x, z)
|5604|5604| {
|5605|    |-	this.heldPosition = {"x": x, "z": z};
|    |5605|+	this.heldPosition = { "x": x, "z": z};
|5606|5606| };
|5607|5607| 
|5608|5608| 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
|5602|5602| 
|5603|5603| UnitAI.prototype.SetHeldPosition = function(x, z)
|5604|5604| {
|5605|    |-	this.heldPosition = {"x": x, "z": z};
|    |5605|+	this.heldPosition = {"x": x, "z": z };
|5606|5606| };
|5607|5607| 
|5608|5608| 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
|5629|5629| 	return false;
|5630|5630| };
|5631|5631| 
|5632|    |-//// Helper functions ////
|    |5632|+// // Helper functions ////
|5633|5633| 
|5634|5634| UnitAI.prototype.CanAttack = function(target)
|5635|5635| {
|    | [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
|5833|5833| 	return cmpPack && cmpPack.IsPacking();
|5834|5834| };
|5835|5835| 
|5836|    |-//// Formation specific functions ////
|    |5836|+// // Formation specific functions ////
|5837|5837| 
|5838|5838| UnitAI.prototype.IsAttackingAsFormation = function()
|5839|5839| {
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5838|5838| UnitAI.prototype.IsAttackingAsFormation = function()
|5839|5839| {
|5840|5840| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5841|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5842|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5841|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5842|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5843|5843| };
|5844|5844| 
|5845|5845| //// 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
|5842|5842| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5843|5843| };
|5844|5844| 
|5845|    |-//// Animal specific functions ////
|    |5845|+// // Animal specific functions ////
|5846|5846| 
|5847|5847| UnitAI.prototype.MoveRandomly = function(distance)
|5848|5848| {

binaries/data/mods/public/simulation/components/UnitAI.js
|2399| »   »   »   »   »   »   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
|3768| »   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
|4540| »   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
|4555| »   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
|4601| »   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
|4624| »   »   ····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
|5080| »   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
|1878| »   »   »   »   »   »   var·cmpFormation·=·Engine.QueryInterface(this.formationController,·IID_Formation);
|    | [NORMAL] JSHintBear:
|    | 'cmpFormation' is already defined.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Freagarach marked 3 inline comments as done.Apr 22 2019, 9:25 PM

I understand :)

Performance impact: game drops to 12 FPS when I order 100 elephants to storm down an Acropolis without the trample and 12 FPS when I order them to storm down with the trample. (18 FPS When just watching in both cases). From my POV it looks neglectable, but is there a standardised method to test this?
It would indeed be awesome if trampling sounds would be played when charging through formations of infantry, but I am currently not able to implement that myself.

At first I named it Trample indeed, but it could also be used for the Fireship in my opinion. That it can be lit when close to an enemy and does this proximity damage instead of death damage. Perhaps there are even more possibilities, hence the more generic name.

Ah yes, and when in trample mode the unit takes extra revenge damage?

binaries/data/mods/public/simulation/components/ProximityDamage.js
143

I'm sorry, what exactly do you mean with JSDoc?
Regarding the messages to be ignored, I have no clue ;) Well, I think the timer ought only be checked when the movement changes, but I don't know how to check for only those messages. Something to do with "OnMotionChanged" in UnitAI?

Stan added a comment.Apr 22 2019, 10:53 PM

If you want to be complete you can also (this is optionnal) add unit tests for the UnitAI methods, and the trample class. To see how to do that look in the test folder of the components.

binaries/data/mods/public/simulation/components/ProximityDamage.js
64

Could make it an empty function instead. Did you try to save ? Also, what about the deserialize function

115

JSDoc

127

One could also use the delete keyword.

143

JSDoc is the documentation on top of functions So for instance

/**
 * This function does stuff
 * @param {string} charstring the entry charstring
 * @param {{ "valuekey": valuetype, "valuekey2": valuetype2}}
 * @return {boolean} Whether the method worked successfully.
 */

ProximityDamage.prototype.DoInterestingStuff = function(charstring, obj)
{
 // Do stuff
 return true;
}

To figure out the messages one could just add warn(uneval(msg)) and see what's in it, then early return if it's not useful.

Freagarach updated this revision to Diff 7817.Apr 23 2019, 8:52 AM

Some documentation mainly.

I certainly would like to be complete, but the unit tests seem a little too complicated for me now :)
Is the JSDoc somewhat better now?

binaries/data/mods/public/simulation/components/ProximityDamage.js
64

Uhm, I have no clue what this does and why it should or should not be here. I used the DeathDamage component as a template and build this component upon that. And this line was in the DeathDamage component.

143

I can't seem to get the proper ignoring of messages working, I'll look into that when I've got more time on my hands.

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|  23|  23| 	let cmpTimer = Engine.QueryInterface(SYSTEM_ENTITY, IID_Timer);
|  24|  24| 	let turnLength = cmpTimer.GetLatestTurnLength();
|  25|  25| 	return new Vector3D(
|  26|    |-			(curPos.x * (turnLength - lateness) + prevPos.x * lateness) / turnLength,
|    |  26|+		(curPos.x * (turnLength - lateness) + prevPos.x * lateness) / turnLength,
|  27|  27| 			0,
|  28|  28| 			(curPos.z * (turnLength - lateness) + prevPos.z * lateness) / turnLength);
|  29|  29| };
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|  24|  24| 	let turnLength = cmpTimer.GetLatestTurnLength();
|  25|  25| 	return new Vector3D(
|  26|  26| 			(curPos.x * (turnLength - lateness) + prevPos.x * lateness) / turnLength,
|  27|    |-			0,
|    |  27|+		0,
|  28|  28| 			(curPos.z * (turnLength - lateness) + prevPos.z * lateness) / turnLength);
|  29|  29| };
|  30|  30| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|  25|  25| 	return new Vector3D(
|  26|  26| 			(curPos.x * (turnLength - lateness) + prevPos.x * lateness) / turnLength,
|  27|  27| 			0,
|  28|    |-			(curPos.z * (turnLength - lateness) + prevPos.z * lateness) / turnLength);
|    |  28|+		(curPos.z * (turnLength - lateness) + prevPos.z * lateness) / turnLength);
|  29|  29| };
|  30|  30| 
|  31|  31| /**
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
| 111| 111| 
| 112| 112| 	// Do this first in case the direct hit kills the target
| 113| 113| 	if (data.isSplash)
| 114|    |-	{
|    | 114|+	
| 115| 115| 		this.CauseSplashDamage({
| 116| 116| 			"attacker": data.attacker,
| 117| 117| 			"origin": Vector2D.from3D(data.position),
| 124| 124| 			"type": data.type,
| 125| 125| 			"attackerOwner": data.attackerOwner
| 126| 126| 		});
| 127|    |-	}
|    | 127|+	
| 128| 128| 
| 129| 129| 	let cmpProjectileManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_ProjectileManager);
| 130| 130| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
| 212| 212| 				damageMultiplier = 0;
| 213| 213| 		}
| 214| 214| 		else // In case someone calls this function with an invalid shape.
| 215|    |-		{
|    | 215|+		
| 216| 216| 			warn("The " + data.shape + " splash damage shape is not implemented!");
| 217|    |-		}
|    | 217|+		
| 218| 218| 
| 219| 219| 		if (data.splashBonus)
| 220| 220| 			damageMultiplier *= GetDamageBonus(ent, data.splashBonus);
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
| 258| 258| 			continue;
| 259| 259| 
| 260| 260| 		// Do not damage restricted classes
| 261|    |-		let cmpProximityDamage = Engine.QueryInterface(data.attacker, IID_ProximityDamage)
|    | 261|+		let cmpProximityDamage = Engine.QueryInterface(data.attacker, IID_ProximityDamage);
| 262| 262| 		let restrictedClasses = cmpProximityDamage.GetRestrictedClasses();
| 263| 263| 		let cmpIdentity = QueryMiragedInterface(ent, IID_Identity);
| 264| 264| 		let targetClasses = cmpIdentity.GetClassesList();
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
| 270| 270| 		if (data.shape == 'Circular')
| 271| 271| 			damageMultiplier = 1 - data.origin.distanceToSquared(entityPosition) / (data.radius * data.radius);
| 272| 272| 		else
| 273|    |-		{
|    | 273|+		
| 274| 274| 			warn("The " + data.shape + " proximity damage shape is not implemented!");
| 275|    |-		}
|    | 275|+		
| 276| 276| 
| 277| 277| 		// Apply bonusses
| 278| 278| 		if (data.proximityBonus)

binaries/data/mods/public/simulation/components/Damage.js
| 261| »   »   let·cmpProximityDamage·=·Engine.QueryInterface(data.attacker,·IID_ProximityDamage)
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/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| 					var 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 (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2015|2015| 
|2016|2016| 				"Attacked": function(msg) {
|2017|2017| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2018|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2019|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2018|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2019|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2020|2020| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2021|2021| 				},
|2022|2022| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2029|2029| 					this.SelectAnimation("move");
|2030|2030| 					var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|2031|2031| 					if (cmpUnitAI && cmpUnitAI.IsFleeing())
|2032|    |-					{
|    |2032|+					
|2033|2033| 						// Run after a fleeing target
|2034|2034| 						this.SetMoveSpeedRatio(this.GetRunMultiplier());
|2035|    |-					}
|    |2035|+					
|2036|2036| 					this.StartTimer(1000, 1000);
|2037|2037| 				},
|2038|2038| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2088|2088| 						// Also don't switch to a different type of huntable animal
|2089|2089| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2090|2090| 							return (
|2091|    |-								ent != oldTarget
|2092|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2091|+								ent != oldTarget &&
|    |2092|+								 ((type.generic == "treasure" && oldType.generic == "treasure")
|2093|2093| 								 || (type.specific == oldType.specific
|2094|2094| 								 && (type.specific != "meat" || oldTemplate == template)))
|2095|2095| 							);
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2089|2089| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2090|2090| 							return (
|2091|2091| 								ent != oldTarget
|2092|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2093|    |-								 || (type.specific == oldType.specific
|    |2092|+								 && ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2093|+								 (type.specific == oldType.specific
|2094|2094| 								 && (type.specific != "meat" || oldTemplate == template)))
|2095|2095| 							);
|2096|2096| 						}, oldTarget);
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2090|2090| 							return (
|2091|2091| 								ent != oldTarget
|2092|2092| 								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2093|    |-								 || (type.specific == oldType.specific
|2094|    |-								 && (type.specific != "meat" || oldTemplate == template)))
|    |2093|+								 || (type.specific == oldType.specific &&
|    |2094|+								 (type.specific != "meat" || oldTemplate == template)))
|2095|2095| 							);
|2096|2096| 						}, oldTarget);
|2097|2097| 						if (nearby)
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2099|2099| 							this.PerformGather(nearby, false, false);
|2100|2100| 							return true;
|2101|2101| 						}
|2102|    |-						else
|2103|    |-						{
|    |2102|+						
|2104|2103| 							// It's probably better in this case, to avoid units getting stuck around a dropsite
|2105|2104| 							// in a "Target is far away, full, nearby are no good resources, return to dropsite" loop
|2106|2105| 							// to order it to GatherNear the resource position.
|2121|2120| 									return true;
|2122|2121| 								}
|2123|2122| 							}
|2124|    |-						}
|    |2123|+						
|2125|2124| 						return true;
|2126|2125| 					}
|2127|2126| 					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
|2111|2111| 								this.GatherNearPosition(pos.x, pos.z, oldType, oldTemplate);
|2112|2112| 								return true;
|2113|2113| 							}
|2114|    |-							else
|2115|    |-							{
|    |2114|+							
|2116|2115| 								// we're kind of stuck here. Return resource.
|2117|2116| 								var nearby = this.FindNearestDropsite(oldType.generic);
|2118|2117| 								if (nearby)
|2120|2119| 									this.PushOrderFront("ReturnResource", { "target": nearby, "force": false });
|2121|2120| 									return true;
|2122|2121| 								}
|2123|    |-							}
|    |2122|+							
|2124|2123| 						}
|2125|2124| 						return true;
|2126|2125| 					}
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2153|2153| 						// Also don't switch to a different type of huntable animal
|2154|2154| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2155|2155| 							return (
|2156|    |-								ent != oldTarget
|2157|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2156|+								ent != oldTarget &&
|    |2157|+								((type.generic == "treasure" && oldType.generic == "treasure")
|2158|2158| 								|| (type.specific == oldType.specific
|2159|2159| 								&& (type.specific != "meat" || oldTemplate == template)))
|2160|2160| 							);
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2154|2154| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2155|2155| 							return (
|2156|2156| 								ent != oldTarget
|2157|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2158|    |-								|| (type.specific == oldType.specific
|    |2157|+								&& ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2158|+								(type.specific == oldType.specific
|2159|2159| 								&& (type.specific != "meat" || oldTemplate == template)))
|2160|2160| 							);
|2161|2161| 						});
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2155|2155| 							return (
|2156|2156| 								ent != oldTarget
|2157|2157| 								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2158|    |-								|| (type.specific == oldType.specific
|2159|    |-								&& (type.specific != "meat" || oldTemplate == template)))
|    |2158|+								|| (type.specific == oldType.specific &&
|    |2159|+								(type.specific != "meat" || oldTemplate == template)))
|2160|2160| 							);
|2161|2161| 						});
|2162|2162| 						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
|2200|2200| 					// Also don't switch to a different type of huntable animal
|2201|2201| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2202|2202| 						return (
|2203|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2204|    |-							|| (type.specific == resourceType.specific
|    |2203|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2204|+							(type.specific == resourceType.specific
|2205|2205| 							&& (type.specific != "meat" || resourceTemplate == template))
|2206|2206| 						);
|2207|2207| 					});
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2201|2201| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2202|2202| 						return (
|2203|2203| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2204|    |-							|| (type.specific == resourceType.specific
|2205|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2204|+							|| (type.specific == resourceType.specific &&
|    |2205|+							(type.specific != "meat" || resourceTemplate == template))
|2206|2206| 						);
|2207|2207| 					});
|2208|2208| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2317|2317| 
|2318|2318| 					var cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply);
|2319|2319| 					if (cmpSupply && cmpSupply.IsAvailable(cmpOwnership.GetOwner(), this.entity))
|2320|    |-					{
|    |2320|+					
|2321|2321| 						// Check we can still reach and gather from the target
|2322|2322| 						if (this.CheckTargetRange(this.gatheringTarget, IID_ResourceGatherer) && this.CanGather(this.gatheringTarget))
|2323|2323| 						{
|2383|2383| 								return;
|2384|2384| 							}
|2385|2385| 						}
|2386|    |-					}
|    |2386|+					
|2387|2387| 
|2388|2388| 					// We're already in range, can't get anywhere near it or the target is exhausted.
|2389|2389| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2409|2409| 					// Also don't switch to a different type of huntable animal
|2410|2410| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2411|2411| 						return (
|2412|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2413|    |-							|| (type.specific == resourceType.specific
|    |2412|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2413|+							(type.specific == resourceType.specific
|2414|2414| 							&& (type.specific != "meat" || resourceTemplate == template))
|2415|2415| 						);
|2416|2416| 					});
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2410|2410| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2411|2411| 						return (
|2412|2412| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2413|    |-							|| (type.specific == resourceType.specific
|2414|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2413|+							|| (type.specific == resourceType.specific &&
|    |2414|+							(type.specific != "meat" || resourceTemplate == template))
|2415|2415| 						);
|2416|2416| 					});
|2417|2417| 					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
|2497|2497| 					this.StartTimer(prepare, this.healTimers.repeat);
|2498|2498| 
|2499|2499| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2500|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2500|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2501|2501| 
|2502|2502| 					this.FaceTowardsTarget(this.order.data.target);
|2503|2503| 				},
|    | [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
|2712|2712| 					{
|2713|2713| 						// The building was already finished/fully repaired before we arrived;
|2714|2714| 						// let the ConstructionFinished handler handle this.
|2715|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2715|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2716|2716| 						return true;
|2717|2717| 					}
|2718|2718| 
|    | [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
|2712|2712| 					{
|2713|2713| 						// The building was already finished/fully repaired before we arrived;
|2714|2714| 						// let the ConstructionFinished handler handle this.
|2715|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2715|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2716|2716| 						return true;
|2717|2717| 					}
|2718|2718| 
|    | [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
|2752|2752| 					if (this.MoveToTargetRange(this.repairTarget, IID_Builder))
|2753|2753| 						this.SetNextState("APPROACHING");
|2754|2754| 					else if (!this.CheckTargetRange(this.repairTarget, IID_Builder))
|2755|    |-						this.FinishOrder(); //can't approach and isn't in reach
|    |2755|+						this.FinishOrder(); // can't approach and isn't in reach
|2756|2756| 				},
|2757|2757| 			},
|2758|2758| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2839|2839| 
|2840|2840| 				// Unit was approaching and there's nothing to do now, so switch to walking
|2841|2841| 				if (oldState === "INDIVIDUAL.REPAIR.APPROACHING")
|2842|    |-				{
|    |2842|+				
|2843|2843| 					// We're already walking to the given point, so add this as a order.
|2844|2844| 					this.WalkToTarget(msg.data.newentity, true);
|2845|    |-				}
|    |2845|+				
|2846|2846| 			},
|2847|2847| 		},
|2848|2848| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2892|2892| 
|2893|2893| 					// Check that we can garrison here
|2894|2894| 					if (this.CanGarrison(target))
|2895|    |-					{
|    |2895|+					
|2896|2896| 						// Check that we're in range of the garrison target
|2897|2897| 						if (this.CheckGarrisonRange(target))
|2898|2898| 						{
|2968|2968| 								return false;
|2969|2969| 							}
|2970|2970| 						}
|2971|    |-					}
|    |2971|+					
|2972|2972| 					// Garrisoning failed for some reason, so finish the order
|2973|2973| 					this.FinishOrder();
|2974|2974| 					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
|3075|3075| 		"Attacked": function(msg) {
|3076|3076| 			if (this.template.NaturalBehaviour == "skittish" ||
|3077|3077| 			    this.template.NaturalBehaviour == "passive")
|3078|    |-			{
|    |3078|+			
|3079|3079| 				this.Flee(msg.data.attacker, false);
|3080|    |-			}
|    |3080|+			
|3081|3081| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|3082|3082| 			{
|3083|3083| 				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
|3084|3084| 					this.Attack(msg.data.attacker, false);
|3085|3085| 			}
|3086|3086| 			else if (this.template.NaturalBehaviour == "domestic")
|3087|    |-			{
|    |3087|+			
|3088|3088| 				// Never flee, stop what we were doing
|3089|3089| 				this.SetNextState("IDLE");
|3090|    |-			}
|    |3090|+			
|3091|3091| 		},
|3092|3092| 
|3093|3093| 		"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
|3094|3094| 			// Move a tile outside the building
|3095|3095| 			var range = 4;
|3096|3096| 			if (this.MoveToTargetRangeExplicit(msg.data.target, range, range))
|3097|    |-			{
|    |3097|+			
|3098|3098| 				// We've started walking to the given point
|3099|3099| 				this.SetNextState("WALKING");
|3100|    |-			}
|    |3100|+			
|3101|3101| 			else
|3102|3102| 			{
|3103|3103| 				// 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
|3099|3099| 				this.SetNextState("WALKING");
|3100|3100| 			}
|3101|3101| 			else
|3102|    |-			{
|    |3102|+			
|3103|3103| 				// We are already at the target, or can't move at all
|3104|3104| 				this.FinishOrder();
|3105|    |-			}
|    |3105|+			
|3106|3106| 		},
|3107|3107| 
|3108|3108| 		"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
|3141|3141| 				}
|3142|3142| 				// Start attacking one of the newly-seen enemy (if any)
|3143|3143| 				else if (this.IsDangerousAnimal())
|3144|    |-				{
|    |3144|+				
|3145|3145| 					this.AttackVisibleEntity(msg.data.added);
|3146|    |-				}
|    |3146|+				
|3147|3147| 
|3148|3148| 				// TODO: if two units enter our range together, we'll attack the
|3149|3149| 				// 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
|3184|3184| 				}
|3185|3185| 				// Start attacking one of the newly-seen enemy (if any)
|3186|3186| 				else if (this.template.NaturalBehaviour == "violent")
|3187|    |-				{
|    |3187|+				
|3188|3188| 					this.AttackVisibleEntity(msg.data.added);
|3189|    |-				}
|    |3189|+				
|3190|3190| 			},
|3191|3191| 
|3192|3192| 			"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
|3201|3201| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3202|3202| 
|3203|3203| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3204|    |-							// only used for domestic animals
|    |3204|+		// only used for domestic animals
|3205|3205| 	},
|3206|3206| };
|3207|3207| 
|    | [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
|3258|3258| 
|3259|3259| UnitAI.prototype.IsAnimal = function()
|3260|3260| {
|3261|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3261|+	return (!!this.template.NaturalBehaviour);
|3262|3262| };
|3263|3263| 
|3264|3264| 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
|3296|3296| UnitAI.prototype.GetGarrisonHolder = function()
|3297|3297| {
|3298|3298| 	if (this.IsGarrisoned())
|3299|    |-	{
|    |3299|+	
|3300|3300| 		for (let order of this.orderQueue)
|3301|3301| 			if (order.type == "Garrison")
|3302|3302| 				return order.data.target;
|3303|    |-	}
|    |3303|+	
|3304|3304| 	return INVALID_ENTITY;
|3305|3305| };
|3306|3306| 
|    | [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
|3380|3380| 		{
|3381|3381| 			let index = this.GetCurrentState().indexOf(".");
|3382|3382| 			if (index != -1)
|3383|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3383|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3384|3384| 			this.Stop(false);
|3385|3385| 		}
|3386|3386| 
|    | [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
|3436|3436| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3437|3437| 			continue;
|3438|3438| 		if (i == 0)
|3439|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3439|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3440|3440| 		else
|3441|3441| 			this.orderQueue.splice(i, 1);
|3442|3442| 		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
|3436|3436| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3437|3437| 			continue;
|3438|3438| 		if (i == 0)
|3439|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3439|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3440|3440| 		else
|3441|3441| 			this.orderQueue.splice(i, 1);
|3442|3442| 		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
|3520|3520| };
|3521|3521| 
|3522|3522| 
|3523|    |-//// FSM linkage functions ////
|    |3523|+// // FSM linkage functions ////
|3524|3524| 
|3525|3525| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3526|3526| 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
|3692|3692| 				continue;
|3693|3693| 			if (this.orderQueue[i].type == type)
|3694|3694| 				continue;
|3695|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3695|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3696|3696| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3697|3697| 			return;
|3698|3698| 		}
|    | [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
|3692|3692| 				continue;
|3693|3693| 			if (this.orderQueue[i].type == type)
|3694|3694| 				continue;
|3695|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3695|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3696|3696| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3697|3697| 			return;
|3698|3698| 		}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3706|3706| {
|3707|3707| 	// Remember the previous work orders to be able to go back to them later if required
|3708|3708| 	if (data && data.force)
|3709|    |-	{
|    |3709|+	
|3710|3710| 		if (this.IsFormationController())
|3711|3711| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3712|3712| 		else
|3713|3713| 			this.UpdateWorkOrders(type);
|3714|    |-	}
|    |3714|+	
|3715|3715| 
|3716|3716| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3717|3717| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3783|3783| 	{
|3784|3784| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3785|3785| 		if (cmpUnitAI)
|3786|    |-		{
|    |3786|+		
|3787|3787| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3788|3788| 			{
|3789|3789| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3792|3792| 					return;
|3793|3793| 				}
|3794|3794| 			}
|3795|    |-		}
|    |3795|+		
|3796|3796| 	}
|3797|3797| 
|3798|3798| 	// 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
|3785|3785| 		if (cmpUnitAI)
|3786|3786| 		{
|3787|3787| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3788|    |-			{
|    |3788|+			
|3789|3789| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3790|3790| 				{
|3791|3791| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3792|3792| 					return;
|3793|3793| 				}
|3794|    |-			}
|    |3794|+			
|3795|3795| 		}
|3796|3796| 	}
|3797|3797| 
|    | [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
|3797|3797| 
|3798|3798| 	// If nothing found, take the unit orders
|3799|3799| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3800|    |-	{
|    |3800|+	
|3801|3801| 		if (isWorkType(this.orderQueue[i].type))
|3802|3802| 		{
|3803|3803| 			this.workOrders = this.orderQueue.slice(i);
|3804|3804| 			return;
|3805|3805| 		}
|3806|    |-	}
|    |3806|+	
|3807|3807| };
|3808|3808| 
|3809|3809| 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
|3863|3863| 	if (data.timerRepeat === undefined)
|3864|3864| 		this.timer = undefined;
|3865|3865| 
|3866|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3866|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3867|3867| };
|3868|3868| 
|3869|3869| /**
|    | [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
|3863|3863| 	if (data.timerRepeat === undefined)
|3864|3864| 		this.timer = undefined;
|3865|3865| 
|3866|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3866|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3867|3867| };
|3868|3868| 
|3869|3869| /**
|    | [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
|3898|3898| 	this.timer = undefined;
|3899|3899| };
|3900|3900| 
|3901|    |-//// Message handlers /////
|    |3901|+// // Message handlers /////
|3902|3902| 
|3903|3903| UnitAI.prototype.OnMotionChanged = function(msg)
|3904|3904| {
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3903|3903| UnitAI.prototype.OnMotionChanged = function(msg)
|3904|3904| {
|3905|3905| 	if (msg.starting && !msg.error)
|3906|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3906|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveStarted", "data": msg});
|3907|3907| 	else if (!msg.starting || msg.error)
|3908|3908| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3909|3909| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3903|3903| UnitAI.prototype.OnMotionChanged = function(msg)
|3904|3904| {
|3905|3905| 	if (msg.starting && !msg.error)
|3906|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3906|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg });
|3907|3907| 	else if (!msg.starting || msg.error)
|3908|3908| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3909|3909| };
|    | [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| 	if (msg.starting && !msg.error)
|3906|3906| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3907|3907| 	else if (!msg.starting || msg.error)
|3908|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3908|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveCompleted", "data": msg});
|3909|3909| };
|3910|3910| 
|3911|3911| 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
|3905|3905| 	if (msg.starting && !msg.error)
|3906|3906| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3907|3907| 	else if (!msg.starting || msg.error)
|3908|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3908|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg });
|3909|3909| };
|3910|3910| 
|3911|3911| 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
|3913|3913| 	// TODO: This is a bit inefficient since every unit listens to every
|3914|3914| 	// construction message - ideally we could scope it to only the one we're building
|3915|3915| 
|3916|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3916|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3917|3917| };
|3918|3918| 
|3919|3919| 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
|3913|3913| 	// TODO: This is a bit inefficient since every unit listens to every
|3914|3914| 	// construction message - ideally we could scope it to only the one we're building
|3915|3915| 
|3916|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3916|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3917|3917| };
|3918|3918| 
|3919|3919| 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
|3938|3938| 
|3939|3939| UnitAI.prototype.OnAttacked = function(msg)
|3940|3940| {
|3941|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3941|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3942|3942| };
|3943|3943| 
|3944|3944| 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
|3938|3938| 
|3939|3939| UnitAI.prototype.OnAttacked = function(msg)
|3940|3940| {
|3941|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3941|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3942|3942| };
|3943|3943| 
|3944|3944| 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
|3943|3943| 
|3944|3944| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3945|3945| {
|3946|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3946|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|3947|3947| };
|3948|3948| 
|3949|3949| 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
|3943|3943| 
|3944|3944| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3945|3945| {
|3946|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3946|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|3947|3947| };
|3948|3948| 
|3949|3949| 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
|3948|3948| 
|3949|3949| UnitAI.prototype.OnHealthChanged = function(msg)
|3950|3950| {
|3951|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3951|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|3952|3952| };
|3953|3953| 
|3954|3954| 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
|3948|3948| 
|3949|3949| UnitAI.prototype.OnHealthChanged = function(msg)
|3950|3950| {
|3951|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3951|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|3952|3952| };
|3953|3953| 
|3954|3954| 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
|3954|3954| UnitAI.prototype.OnRangeUpdate = function(msg)
|3955|3955| {
|3956|3956| 	if (msg.tag == this.losRangeQuery)
|3957|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3957|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|3958|3958| 	else if (msg.tag == this.losHealRangeQuery)
|3959|3959| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3960|3960| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3954|3954| UnitAI.prototype.OnRangeUpdate = function(msg)
|3955|3955| {
|3956|3956| 	if (msg.tag == this.losRangeQuery)
|3957|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3957|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|3958|3958| 	else if (msg.tag == this.losHealRangeQuery)
|3959|3959| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3960|3960| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3956|3956| 	if (msg.tag == this.losRangeQuery)
|3957|3957| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3958|3958| 	else if (msg.tag == this.losHealRangeQuery)
|3959|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3959|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|3960|3960| };
|3961|3961| 
|3962|3962| 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
|3956|3956| 	if (msg.tag == this.losRangeQuery)
|3957|3957| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3958|3958| 	else if (msg.tag == this.losHealRangeQuery)
|3959|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3959|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|3960|3960| };
|3961|3961| 
|3962|3962| 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
|3961|3961| 
|3962|3962| UnitAI.prototype.OnPackFinished = function(msg)
|3963|3963| {
|3964|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3964|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|3965|3965| };
|3966|3966| 
|3967|3967| //// 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
|3961|3961| 
|3962|3962| UnitAI.prototype.OnPackFinished = function(msg)
|3963|3963| {
|3964|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3964|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|3965|3965| };
|3966|3966| 
|3967|3967| //// 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
|3964|3964| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|3965|3965| };
|3966|3966| 
|3967|    |-//// Helper functions to be called by the FSM ////
|    |3967|+// // Helper functions to be called by the FSM ////
|3968|3968| 
|3969|3969| UnitAI.prototype.GetWalkSpeed = function()
|3970|3970| {
|    | [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
|4066|4066| 	if (!cmpOwnership || cmpOwnership.GetOwner() == INVALID_PLAYER)
|4067|4067| 		return undefined;
|4068|4068| 
|4069|    |-	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position)
|    |4069|+	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
|4070|4070| 	if (!cmpPosition || !cmpPosition.IsInWorld())
|4071|4071| 		return undefined;
|4072|4072| 
|    | [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
|4151|4151| 			PlaySound(name, member);
|4152|4152| 	}
|4153|4153| 	else
|4154|    |-	{
|    |4154|+	
|4155|4155| 		// Otherwise use our own sounds
|4156|4156| 		PlaySound(name, this.entity);
|4157|    |-	}
|    |4157|+	
|4158|4158| };
|4159|4159| 
|4160|4160| /*
|    | [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
|4320|4320| 	else
|4321|4321| 		// return false? Or hope you come close enough?
|4322|4322| 		var parabolicMaxRange = 0;
|4323|    |-		//return false;
|    |4323|+		// return false;
|4324|4324| 
|4325|4325| 	// the parabole changes while walking, take something in the middle
|4326|4326| 	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
|4385|4385| 	if (this.IsFormationMember())
|4386|4386| 	{
|4387|4387| 		var cmpFormationUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|4388|    |-		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation()
|4389|    |-			&& cmpFormationUnitAI.order.data.target == target)
|    |4388|+		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation() &&
|    |4389|+			cmpFormationUnitAI.order.data.target == target)
|4390|4390| 			return true;
|4391|4391| 	}
|4392|4392| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4553|4553| UnitAI.prototype.AttackEntityInZone = function(ents)
|4554|4554| {
|4555|4555| 	var target = ents.find(target =>
|4556|    |-		this.CanAttack(target)
|4557|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4556|+		this.CanAttack(target) &&
|    |4557|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4558|4558| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4559|4559| 	);
|4560|4560| 	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
|4554|4554| {
|4555|4555| 	var target = ents.find(target =>
|4556|4556| 		this.CanAttack(target)
|4557|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4558|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4557|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4558|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4559|4559| 	);
|4560|4560| 	if (!target)
|4561|4561| 		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
|4618|4618| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4619|4619| 	if (this.isGuardOf)
|4620|4620| 	{
|4621|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4621|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4622|4622| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4623|4623| 		if (cmpUnitAI && cmpAttack &&
|4624|4624| 		    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
|4622|4622| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4623|4623| 		if (cmpUnitAI && cmpAttack &&
|4624|4624| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4625|    |-				return false;
|    |4625|+			return false;
|4626|4626| 	}
|4627|4627| 
|4628|4628| 	// 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
|4627|4627| 
|4628|4628| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4629|4629| 	if (this.GetStance().respondHoldGround)
|4630|    |-	{
|    |4630|+	
|4631|4631| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4632|4632| 			return true;
|4633|    |-	}
|    |4633|+	
|4634|4634| 
|4635|4635| 	// Stop if it's left our vision range, unless we're especially persistent
|4636|4636| 	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
|4634|4634| 
|4635|4635| 	// Stop if it's left our vision range, unless we're especially persistent
|4636|4636| 	if (!this.GetStance().respondChaseBeyondVision)
|4637|    |-	{
|    |4637|+	
|4638|4638| 		if (!this.CheckTargetIsInVisionRange(target))
|4639|4639| 			return true;
|4640|    |-	}
|    |4640|+	
|4641|4641| 
|4642|4642| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4643|4643| 	// 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
|4660|4660| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4661|4661| 	if (this.isGuardOf)
|4662|4662| 	{
|4663|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4663|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4664|4664| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4665|4665| 		if (cmpUnitAI && cmpAttack &&
|4666|4666| 		    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
|4673|4673| 	return false;
|4674|4674| };
|4675|4675| 
|4676|    |-//// External interface functions ////
|    |4676|+// // External interface functions ////
|4677|4677| 
|4678|4678| UnitAI.prototype.SetFormationController = function(ent)
|4679|4679| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4683|4683| 	// of our own formation (or ourself if not in formation)
|4684|4684| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4685|4685| 	if (cmpObstruction)
|4686|    |-	{
|    |4686|+	
|4687|4687| 		if (ent == INVALID_ENTITY)
|4688|4688| 			cmpObstruction.SetControlGroup(this.entity);
|4689|4689| 		else
|4690|4690| 			cmpObstruction.SetControlGroup(ent);
|4691|    |-	}
|    |4691|+	
|4692|4692| 
|4693|4693| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4694|4694| 	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
|4826|4826| 	// if we already had an old guard order, do nothing if the target is the same
|4827|4827| 	// and the order is running, otherwise remove the previous order
|4828|4828| 	if (this.isGuardOf)
|4829|    |-	{
|    |4829|+	
|4830|4830| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4831|4831| 			return;
|4832|4832| 		else
|4833|4833| 			this.RemoveGuard();
|4834|    |-	}
|    |4834|+	
|4835|4835| 
|4836|4836| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4837|4837| };
|    | [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
|4829|4829| 	{
|4830|4830| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4831|4831| 			return;
|4832|    |-		else
|4833|    |-			this.RemoveGuard();
|    |4832|+		this.RemoveGuard();
|4834|4833| 	}
|4835|4834| 
|4836|4835| 	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
|5000|5000| 			this.WalkToTarget(target, queued);
|5001|5001| 		return;
|5002|5002| 	}
|5003|    |-	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture}, queued);
|    |5003|+	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture }, queued);
|5004|5004| };
|5005|5005| 
|5006|5006| /**
|    | [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
|5149|5149| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5150|5150| 	{
|5151|5151| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5152|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5152|+		if (cmpTrader.HasBothMarkets() &&
|5153|5153| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5154|5154| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5155|5155| 		{
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5430|5430| 				{
|5431|5431| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5432|5432| 					var targetClasses = this.order.data.targetClasses;
|5433|    |-					if (targetClasses.attack && cmpIdentity
|5434|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5433|+					if (targetClasses.attack && cmpIdentity &&
|    |5434|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5435|5435| 						continue;
|5436|5436| 					if (targetClasses.avoid && cmpIdentity
|5437|5437| 						&& 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
|5433|5433| 					if (targetClasses.attack && cmpIdentity
|5434|5434| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5435|5435| 						continue;
|5436|    |-					if (targetClasses.avoid && cmpIdentity
|5437|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5436|+					if (targetClasses.avoid && cmpIdentity &&
|    |5437|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5438|5438| 						continue;
|5439|5439| 					// Only used by the AIs to prevent some choices of targets
|5440|5440| 					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
|5456|5456| 		{
|5457|5457| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5458|5458| 			var targetClasses = this.order.data.targetClasses;
|5459|    |-			if (cmpIdentity && targetClasses.attack
|5460|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5459|+			if (cmpIdentity && targetClasses.attack &&
|    |5460|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5461|5461| 				continue;
|5462|5462| 			if (cmpIdentity && targetClasses.avoid
|5463|5463| 				&& 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
|5459|5459| 			if (cmpIdentity && targetClasses.attack
|5460|5460| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5461|5461| 				continue;
|5462|    |-			if (cmpIdentity && targetClasses.avoid
|5463|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5462|+			if (cmpIdentity && targetClasses.avoid &&
|    |5463|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5464|5464| 				continue;
|5465|5465| 			// Only used by the AIs to prevent some choices of targets
|5466|5466| 			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
|5602|5602| 
|5603|5603| UnitAI.prototype.SetHeldPosition = function(x, z)
|5604|5604| {
|5605|    |-	this.heldPosition = {"x": x, "z": z};
|    |5605|+	this.heldPosition = { "x": x, "z": z};
|5606|5606| };
|5607|5607| 
|5608|5608| 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
|5602|5602| 
|5603|5603| UnitAI.prototype.SetHeldPosition = function(x, z)
|5604|5604| {
|5605|    |-	this.heldPosition = {"x": x, "z": z};
|    |5605|+	this.heldPosition = {"x": x, "z": z };
|5606|5606| };
|5607|5607| 
|5608|5608| 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
|5629|5629| 	return false;
|5630|5630| };
|5631|5631| 
|5632|    |-//// Helper functions ////
|    |5632|+// // Helper functions ////
|5633|5633| 
|5634|5634| UnitAI.prototype.CanAttack = function(target)
|5635|5635| {
|    | [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
|5833|5833| 	return cmpPack && cmpPack.IsPacking();
|5834|5834| };
|5835|5835| 
|5836|    |-//// Formation specific functions ////
|    |5836|+// // Formation specific functions ////
|5837|5837| 
|5838|5838| UnitAI.prototype.IsAttackingAsFormation = function()
|5839|5839| {
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5838|5838| UnitAI.prototype.IsAttackingAsFormation = function()
|5839|5839| {
|5840|5840| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5841|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5842|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5841|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5842|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5843|5843| };
|5844|5844| 
|5845|5845| //// 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
|5842|5842| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5843|5843| };
|5844|5844| 
|5845|    |-//// Animal specific functions ////
|    |5845|+// // Animal specific functions ////
|5846|5846| 
|5847|5847| UnitAI.prototype.MoveRandomly = function(distance)
|5848|5848| {

binaries/data/mods/public/simulation/components/UnitAI.js
|2399| »   »   »   »   »   »   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
|3768| »   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
|4540| »   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
|4555| »   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
|4601| »   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
|4624| »   »   ····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
|5080| »   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
|1878| »   »   »   »   »   »   var·cmpFormation·=·Engine.QueryInterface(this.formationController,·IID_Formation);
|    | [NORMAL] JSHintBear:
|    | 'cmpFormation' is already defined.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Stan added a comment.Apr 23 2019, 10:23 AM

Tests are actually easier than writing whole components.

First you need to load all other component files you will need. To figure out what you need you can look at your code and which component you call, or just bruteforce it by fixing warnings one by one.

EG.

Engine.LoadHelperScript("Player.js");
Engine.LoadComponentScript("interfaces/TechnologyManager.js");
Engine.LoadComponentScript("interfaces/ProductionQueue.js");
Engine.LoadComponentScript("ProductionQueue.js");

For components where you want to use special behavior, let's say assume that the entities player are always iberians you will add mocks.

AddMock(playerEntityID, IID_Player, {
    "GetCiv": () => "iber",
});

Then you need to create a fake component instance. For your component it could be

let cmpProximityDamage = ConstructComponent(6, "ProximityDamage", {
	"Shape": "Circular",
	"Range": 10,
	"FriendlyFire": true,
	"Hack": 0.0,
	"Pierce": 10.0,
	"Crush": 50.0,
	"OnlyWhenMoving": true,
	"RestrictedClasses":{
		"_string": "Javelin"
	},
	"Bonuses": {
		"Bonus1":{
			"Civ": "iber"
		},
		"Bonus2":{
			"Classes": "Javelin"
		},
		"Bonus3":{
			"Civ": "athen",
			"Multiplier": 2
		}
	}
});

To Check whether an array or an object has the right elements use

TS_ASSERT_UNEVAL_EQUALS(currentArray, expectedArray);

To check whether two values are equal use

TS_ASSERT_EQUALS(actual, expected);

To check whether a value is true

TS_ASSERT(expression);

With the component above you could test

TS_ASSERT_UNEVAL_EQUALS(cmpProximityDamage.GetBonusTemplate(), 	{ "Bonuses": {
		"Bonus1":{
			"Civ": "iber"
		},
		"Bonus2":{
			"Classes": "Javelin"
		},
		"Bonus3":{
			"Civ": "athen",
			"Multiplier": 2
		}
	}});

TS_ASSERT(cmpProximityDamage.GetBonusTemplate() != null);

Then you can create another cmpProximityDamage without bonuses and make sure it returns null;

You can find a more complex list here https://github.com/0ad/0ad/blob/4b35ac33f7f30e6bb0a674a6996357a8a75cf1a3/binaries/data/tests/test_setup.js
Also the official documentation https://trac.wildfiregames.com/wiki/WritingTests

binaries/data/mods/public/simulation/components/ProximityDamage.js
64

Oh I see. Well while saving the game components are serialized and deserialized. The more things you serialize the bigger the savegame becomes, and the longer it takes to do it. Some stuff, especially stuff being inherited from the template does not need to be serialized because it can be recomputed without going out of sync. However stuff like counters and other variables that get changed during the game randomly need to be.

In your case I'm not sure but I think the timer id could be serialized.

143

Sure. It's just to make sure we don't do unnecessary processing too often.

Stan added inline comments.Apr 23 2019, 10:24 AM
binaries/data/mods/public/simulation/components/Damage.js
247

I guess you could write data.strength.hack Number

Freagarach marked an inline comment as done.Apr 26 2019, 4:51 PM
Freagarach added inline comments.
binaries/data/mods/public/simulation/components/Damage.js
247

You mean:

* @param {Object}   data.strengths - data of the form { data.strengths.hack: number, data.strengths.pierce: number, data.strengths.crush: number }

? Or something else?

Stan added inline comments.Apr 26 2019, 5:40 PM
binaries/data/mods/public/simulation/components/Damage.js
247
* @param {number} data.strengths.hack - 
* @param {number} data.strengths.crush -
* @param {number} data.strengths.pierce -

But I think that's a bit too verbose.

267

Move out of loop unless you mean ent instead of data.attacker.

268

Same here.

275

Check component, and is in world maybe ?

binaries/data/mods/public/simulation/components/ProximityDamage.js
88

One 's' for bonusses.

103

Remove temporary variable, and use it in the object directly.

105

Might want to check if the unit has an ownership component before using it.

155

I'm not sure but I think it should be undefined instead of null.

binaries/data/mods/public/simulation/components/UnitAI.js
3328 ↗(On Diff #7817)

I wonder if there is a list of states somewhere.

One could also add a local variable called states:

var movingStates = ["WALKING", "APPROACHING", "RUNNING", "CHARGING", "FLEEING"]
return movingStates.IndexOf(this.GetCurrentState().split(".").pop()) != -1;
wraitii added inline comments.Apr 26 2019, 5:51 PM
binaries/data/mods/public/simulation/components/UnitAI.js
3328 ↗(On Diff #7817)

This isn't the right data for the name of the function, as actually moving depends on CmpPosition or CmpUnitMotion

Freagarach marked 7 inline comments as done.Apr 26 2019, 9:56 PM
Freagarach added inline comments.
binaries/data/mods/public/simulation/components/Damage.js
275

Where should I check for the component? In the line "if (data.shape ...)'? Or should I split this line into:

let cmpPosition = Engine.QueryInterface(ent, IID_Position);
if (cmpPosition) { cmpPosition.GetPosition2D(); }

Shouldn't the entity be in the world to be returned by EntitiesNearPoint?

binaries/data/mods/public/simulation/components/ProximityDamage.js
64

But the timers of other components are not serialised either. So I'll let this be.

155

It's undefined at ResourceTrickle.js and null at Health.js ;)

binaries/data/mods/public/simulation/components/UnitAI.js
3328 ↗(On Diff #7817)

I wonder if there is a list of states somewhere.

I could not find it, but it would indeed be useful :)

This isn't the right data for the name of the function, as actually moving depends on CmpPosition or CmpUnitMotion

So is there a way to check whether the entity is moving? (And not return true when garrisoned in a moving entity.) Or just rename this to something else?

Freagarach updated this revision to Diff 7872.Apr 26 2019, 10:04 PM
Freagarach marked an inline comment as done and an inline comment as not done.

Implemented some suggestions.

Stan added a subscriber: elexis.Apr 26 2019, 10:05 PM
Stan added inline comments.
binaries/data/mods/public/simulation/components/Damage.js
275

You should split the line like your example. Maybe early return instead false. If the unit isnt in the world its likely not moving. The only units that do are planes.

cmpPosition.IsInWorld()

binaries/data/mods/public/simulation/components/ProximityDamage.js
64

By default everything is serialized :)

155

@elexis would know

binaries/data/mods/public/simulation/components/UnitAI.js
3328 ↗(On Diff #7817)

You could look at components using the UnitMotion component :)

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|  23|  23| 	let cmpTimer = Engine.QueryInterface(SYSTEM_ENTITY, IID_Timer);
|  24|  24| 	let turnLength = cmpTimer.GetLatestTurnLength();
|  25|  25| 	return new Vector3D(
|  26|    |-			(curPos.x * (turnLength - lateness) + prevPos.x * lateness) / turnLength,
|    |  26|+		(curPos.x * (turnLength - lateness) + prevPos.x * lateness) / turnLength,
|  27|  27| 			0,
|  28|  28| 			(curPos.z * (turnLength - lateness) + prevPos.z * lateness) / turnLength);
|  29|  29| };
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|  24|  24| 	let turnLength = cmpTimer.GetLatestTurnLength();
|  25|  25| 	return new Vector3D(
|  26|  26| 			(curPos.x * (turnLength - lateness) + prevPos.x * lateness) / turnLength,
|  27|    |-			0,
|    |  27|+		0,
|  28|  28| 			(curPos.z * (turnLength - lateness) + prevPos.z * lateness) / turnLength);
|  29|  29| };
|  30|  30| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|  25|  25| 	return new Vector3D(
|  26|  26| 			(curPos.x * (turnLength - lateness) + prevPos.x * lateness) / turnLength,
|  27|  27| 			0,
|  28|    |-			(curPos.z * (turnLength - lateness) + prevPos.z * lateness) / turnLength);
|    |  28|+		(curPos.z * (turnLength - lateness) + prevPos.z * lateness) / turnLength);
|  29|  29| };
|  30|  30| 
|  31|  31| /**
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
| 111| 111| 
| 112| 112| 	// Do this first in case the direct hit kills the target
| 113| 113| 	if (data.isSplash)
| 114|    |-	{
|    | 114|+	
| 115| 115| 		this.CauseSplashDamage({
| 116| 116| 			"attacker": data.attacker,
| 117| 117| 			"origin": Vector2D.from3D(data.position),
| 124| 124| 			"type": data.type,
| 125| 125| 			"attackerOwner": data.attackerOwner
| 126| 126| 		});
| 127|    |-	}
|    | 127|+	
| 128| 128| 
| 129| 129| 	let cmpProjectileManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_ProjectileManager);
| 130| 130| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
| 212| 212| 				damageMultiplier = 0;
| 213| 213| 		}
| 214| 214| 		else // In case someone calls this function with an invalid shape.
| 215|    |-		{
|    | 215|+		
| 216| 216| 			warn("The " + data.shape + " splash damage shape is not implemented!");
| 217|    |-		}
|    | 217|+		
| 218| 218| 
| 219| 219| 		if (data.splashBonus)
| 220| 220| 			damageMultiplier *= GetDamageBonus(ent, data.splashBonus);
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/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| 					var 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 (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2015|2015| 
|2016|2016| 				"Attacked": function(msg) {
|2017|2017| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2018|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2019|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2018|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2019|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2020|2020| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2021|2021| 				},
|2022|2022| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2029|2029| 					this.SelectAnimation("move");
|2030|2030| 					var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|2031|2031| 					if (cmpUnitAI && cmpUnitAI.IsFleeing())
|2032|    |-					{
|    |2032|+					
|2033|2033| 						// Run after a fleeing target
|2034|2034| 						this.SetMoveSpeedRatio(this.GetRunMultiplier());
|2035|    |-					}
|    |2035|+					
|2036|2036| 					this.StartTimer(1000, 1000);
|2037|2037| 				},
|2038|2038| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2088|2088| 						// Also don't switch to a different type of huntable animal
|2089|2089| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2090|2090| 							return (
|2091|    |-								ent != oldTarget
|2092|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2091|+								ent != oldTarget &&
|    |2092|+								 ((type.generic == "treasure" && oldType.generic == "treasure")
|2093|2093| 								 || (type.specific == oldType.specific
|2094|2094| 								 && (type.specific != "meat" || oldTemplate == template)))
|2095|2095| 							);
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2089|2089| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2090|2090| 							return (
|2091|2091| 								ent != oldTarget
|2092|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2093|    |-								 || (type.specific == oldType.specific
|    |2092|+								 && ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2093|+								 (type.specific == oldType.specific
|2094|2094| 								 && (type.specific != "meat" || oldTemplate == template)))
|2095|2095| 							);
|2096|2096| 						}, oldTarget);
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2090|2090| 							return (
|2091|2091| 								ent != oldTarget
|2092|2092| 								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2093|    |-								 || (type.specific == oldType.specific
|2094|    |-								 && (type.specific != "meat" || oldTemplate == template)))
|    |2093|+								 || (type.specific == oldType.specific &&
|    |2094|+								 (type.specific != "meat" || oldTemplate == template)))
|2095|2095| 							);
|2096|2096| 						}, oldTarget);
|2097|2097| 						if (nearby)
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2099|2099| 							this.PerformGather(nearby, false, false);
|2100|2100| 							return true;
|2101|2101| 						}
|2102|    |-						else
|2103|    |-						{
|    |2102|+						
|2104|2103| 							// It's probably better in this case, to avoid units getting stuck around a dropsite
|2105|2104| 							// in a "Target is far away, full, nearby are no good resources, return to dropsite" loop
|2106|2105| 							// to order it to GatherNear the resource position.
|2121|2120| 									return true;
|2122|2121| 								}
|2123|2122| 							}
|2124|    |-						}
|    |2123|+						
|2125|2124| 						return true;
|2126|2125| 					}
|2127|2126| 					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
|2111|2111| 								this.GatherNearPosition(pos.x, pos.z, oldType, oldTemplate);
|2112|2112| 								return true;
|2113|2113| 							}
|2114|    |-							else
|2115|    |-							{
|    |2114|+							
|2116|2115| 								// we're kind of stuck here. Return resource.
|2117|2116| 								var nearby = this.FindNearestDropsite(oldType.generic);
|2118|2117| 								if (nearby)
|2120|2119| 									this.PushOrderFront("ReturnResource", { "target": nearby, "force": false });
|2121|2120| 									return true;
|2122|2121| 								}
|2123|    |-							}
|    |2122|+							
|2124|2123| 						}
|2125|2124| 						return true;
|2126|2125| 					}
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2153|2153| 						// Also don't switch to a different type of huntable animal
|2154|2154| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2155|2155| 							return (
|2156|    |-								ent != oldTarget
|2157|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2156|+								ent != oldTarget &&
|    |2157|+								((type.generic == "treasure" && oldType.generic == "treasure")
|2158|2158| 								|| (type.specific == oldType.specific
|2159|2159| 								&& (type.specific != "meat" || oldTemplate == template)))
|2160|2160| 							);
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2154|2154| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2155|2155| 							return (
|2156|2156| 								ent != oldTarget
|2157|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2158|    |-								|| (type.specific == oldType.specific
|    |2157|+								&& ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2158|+								(type.specific == oldType.specific
|2159|2159| 								&& (type.specific != "meat" || oldTemplate == template)))
|2160|2160| 							);
|2161|2161| 						});
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2155|2155| 							return (
|2156|2156| 								ent != oldTarget
|2157|2157| 								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2158|    |-								|| (type.specific == oldType.specific
|2159|    |-								&& (type.specific != "meat" || oldTemplate == template)))
|    |2158|+								|| (type.specific == oldType.specific &&
|    |2159|+								(type.specific != "meat" || oldTemplate == template)))
|2160|2160| 							);
|2161|2161| 						});
|2162|2162| 						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
|2200|2200| 					// Also don't switch to a different type of huntable animal
|2201|2201| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2202|2202| 						return (
|2203|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2204|    |-							|| (type.specific == resourceType.specific
|    |2203|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2204|+							(type.specific == resourceType.specific
|2205|2205| 							&& (type.specific != "meat" || resourceTemplate == template))
|2206|2206| 						);
|2207|2207| 					});
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2201|2201| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2202|2202| 						return (
|2203|2203| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2204|    |-							|| (type.specific == resourceType.specific
|2205|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2204|+							|| (type.specific == resourceType.specific &&
|    |2205|+							(type.specific != "meat" || resourceTemplate == template))
|2206|2206| 						);
|2207|2207| 					});
|2208|2208| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2317|2317| 
|2318|2318| 					var cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply);
|2319|2319| 					if (cmpSupply && cmpSupply.IsAvailable(cmpOwnership.GetOwner(), this.entity))
|2320|    |-					{
|    |2320|+					
|2321|2321| 						// Check we can still reach and gather from the target
|2322|2322| 						if (this.CheckTargetRange(this.gatheringTarget, IID_ResourceGatherer) && this.CanGather(this.gatheringTarget))
|2323|2323| 						{
|2383|2383| 								return;
|2384|2384| 							}
|2385|2385| 						}
|2386|    |-					}
|    |2386|+					
|2387|2387| 
|2388|2388| 					// We're already in range, can't get anywhere near it or the target is exhausted.
|2389|2389| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2409|2409| 					// Also don't switch to a different type of huntable animal
|2410|2410| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2411|2411| 						return (
|2412|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2413|    |-							|| (type.specific == resourceType.specific
|    |2412|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2413|+							(type.specific == resourceType.specific
|2414|2414| 							&& (type.specific != "meat" || resourceTemplate == template))
|2415|2415| 						);
|2416|2416| 					});
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2410|2410| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2411|2411| 						return (
|2412|2412| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2413|    |-							|| (type.specific == resourceType.specific
|2414|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2413|+							|| (type.specific == resourceType.specific &&
|    |2414|+							(type.specific != "meat" || resourceTemplate == template))
|2415|2415| 						);
|2416|2416| 					});
|2417|2417| 					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
|2497|2497| 					this.StartTimer(prepare, this.healTimers.repeat);
|2498|2498| 
|2499|2499| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2500|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2500|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2501|2501| 
|2502|2502| 					this.FaceTowardsTarget(this.order.data.target);
|2503|2503| 				},
|    | [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
|2712|2712| 					{
|2713|2713| 						// The building was already finished/fully repaired before we arrived;
|2714|2714| 						// let the ConstructionFinished handler handle this.
|2715|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2715|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2716|2716| 						return true;
|2717|2717| 					}
|2718|2718| 
|    | [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
|2712|2712| 					{
|2713|2713| 						// The building was already finished/fully repaired before we arrived;
|2714|2714| 						// let the ConstructionFinished handler handle this.
|2715|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2715|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2716|2716| 						return true;
|2717|2717| 					}
|2718|2718| 
|    | [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
|2752|2752| 					if (this.MoveToTargetRange(this.repairTarget, IID_Builder))
|2753|2753| 						this.SetNextState("APPROACHING");
|2754|2754| 					else if (!this.CheckTargetRange(this.repairTarget, IID_Builder))
|2755|    |-						this.FinishOrder(); //can't approach and isn't in reach
|    |2755|+						this.FinishOrder(); // can't approach and isn't in reach
|2756|2756| 				},
|2757|2757| 			},
|2758|2758| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2839|2839| 
|2840|2840| 				// Unit was approaching and there's nothing to do now, so switch to walking
|2841|2841| 				if (oldState === "INDIVIDUAL.REPAIR.APPROACHING")
|2842|    |-				{
|    |2842|+				
|2843|2843| 					// We're already walking to the given point, so add this as a order.
|2844|2844| 					this.WalkToTarget(msg.data.newentity, true);
|2845|    |-				}
|    |2845|+				
|2846|2846| 			},
|2847|2847| 		},
|2848|2848| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2892|2892| 
|2893|2893| 					// Check that we can garrison here
|2894|2894| 					if (this.CanGarrison(target))
|2895|    |-					{
|    |2895|+					
|2896|2896| 						// Check that we're in range of the garrison target
|2897|2897| 						if (this.CheckGarrisonRange(target))
|2898|2898| 						{
|2968|2968| 								return false;
|2969|2969| 							}
|2970|2970| 						}
|2971|    |-					}
|    |2971|+					
|2972|2972| 					// Garrisoning failed for some reason, so finish the order
|2973|2973| 					this.FinishOrder();
|2974|2974| 					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
|3075|3075| 		"Attacked": function(msg) {
|3076|3076| 			if (this.template.NaturalBehaviour == "skittish" ||
|3077|3077| 			    this.template.NaturalBehaviour == "passive")
|3078|    |-			{
|    |3078|+			
|3079|3079| 				this.Flee(msg.data.attacker, false);
|3080|    |-			}
|    |3080|+			
|3081|3081| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|3082|3082| 			{
|3083|3083| 				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
|3084|3084| 					this.Attack(msg.data.attacker, false);
|3085|3085| 			}
|3086|3086| 			else if (this.template.NaturalBehaviour == "domestic")
|3087|    |-			{
|    |3087|+			
|3088|3088| 				// Never flee, stop what we were doing
|3089|3089| 				this.SetNextState("IDLE");
|3090|    |-			}
|    |3090|+			
|3091|3091| 		},
|3092|3092| 
|3093|3093| 		"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
|3094|3094| 			// Move a tile outside the building
|3095|3095| 			var range = 4;
|3096|3096| 			if (this.MoveToTargetRangeExplicit(msg.data.target, range, range))
|3097|    |-			{
|    |3097|+			
|3098|3098| 				// We've started walking to the given point
|3099|3099| 				this.SetNextState("WALKING");
|3100|    |-			}
|    |3100|+			
|3101|3101| 			else
|3102|3102| 			{
|3103|3103| 				// 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
|3099|3099| 				this.SetNextState("WALKING");
|3100|3100| 			}
|3101|3101| 			else
|3102|    |-			{
|    |3102|+			
|3103|3103| 				// We are already at the target, or can't move at all
|3104|3104| 				this.FinishOrder();
|3105|    |-			}
|    |3105|+			
|3106|3106| 		},
|3107|3107| 
|3108|3108| 		"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
|3141|3141| 				}
|3142|3142| 				// Start attacking one of the newly-seen enemy (if any)
|3143|3143| 				else if (this.IsDangerousAnimal())
|3144|    |-				{
|    |3144|+				
|3145|3145| 					this.AttackVisibleEntity(msg.data.added);
|3146|    |-				}
|    |3146|+				
|3147|3147| 
|3148|3148| 				// TODO: if two units enter our range together, we'll attack the
|3149|3149| 				// 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
|3184|3184| 				}
|3185|3185| 				// Start attacking one of the newly-seen enemy (if any)
|3186|3186| 				else if (this.template.NaturalBehaviour == "violent")
|3187|    |-				{
|    |3187|+				
|3188|3188| 					this.AttackVisibleEntity(msg.data.added);
|3189|    |-				}
|    |3189|+				
|3190|3190| 			},
|3191|3191| 
|3192|3192| 			"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
|3201|3201| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3202|3202| 
|3203|3203| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3204|    |-							// only used for domestic animals
|    |3204|+		// only used for domestic animals
|3205|3205| 	},
|3206|3206| };
|3207|3207| 
|    | [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
|3258|3258| 
|3259|3259| UnitAI.prototype.IsAnimal = function()
|3260|3260| {
|3261|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3261|+	return (!!this.template.NaturalBehaviour);
|3262|3262| };
|3263|3263| 
|3264|3264| 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
|3296|3296| UnitAI.prototype.GetGarrisonHolder = function()
|3297|3297| {
|3298|3298| 	if (this.IsGarrisoned())
|3299|    |-	{
|    |3299|+	
|3300|3300| 		for (let order of this.orderQueue)
|3301|3301| 			if (order.type == "Garrison")
|3302|3302| 				return order.data.target;
|3303|    |-	}
|    |3303|+	
|3304|3304| 	return INVALID_ENTITY;
|3305|3305| };
|3306|3306| 
|    | [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
|3380|3380| 		{
|3381|3381| 			let index = this.GetCurrentState().indexOf(".");
|3382|3382| 			if (index != -1)
|3383|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3383|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3384|3384| 			this.Stop(false);
|3385|3385| 		}
|3386|3386| 
|    | [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
|3436|3436| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3437|3437| 			continue;
|3438|3438| 		if (i == 0)
|3439|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3439|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3440|3440| 		else
|3441|3441| 			this.orderQueue.splice(i, 1);
|3442|3442| 		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
|3436|3436| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3437|3437| 			continue;
|3438|3438| 		if (i == 0)
|3439|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3439|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3440|3440| 		else
|3441|3441| 			this.orderQueue.splice(i, 1);
|3442|3442| 		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
|3520|3520| };
|3521|3521| 
|3522|3522| 
|3523|    |-//// FSM linkage functions ////
|    |3523|+// // FSM linkage functions ////
|3524|3524| 
|3525|3525| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3526|3526| 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
|3692|3692| 				continue;
|3693|3693| 			if (this.orderQueue[i].type == type)
|3694|3694| 				continue;
|3695|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3695|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3696|3696| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3697|3697| 			return;
|3698|3698| 		}
|    | [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
|3692|3692| 				continue;
|3693|3693| 			if (this.orderQueue[i].type == type)
|3694|3694| 				continue;
|3695|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3695|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3696|3696| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3697|3697| 			return;
|3698|3698| 		}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3706|3706| {
|3707|3707| 	// Remember the previous work orders to be able to go back to them later if required
|3708|3708| 	if (data && data.force)
|3709|    |-	{
|    |3709|+	
|3710|3710| 		if (this.IsFormationController())
|3711|3711| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3712|3712| 		else
|3713|3713| 			this.UpdateWorkOrders(type);
|3714|    |-	}
|    |3714|+	
|3715|3715| 
|3716|3716| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3717|3717| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3783|3783| 	{
|3784|3784| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3785|3785| 		if (cmpUnitAI)
|3786|    |-		{
|    |3786|+		
|3787|3787| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3788|3788| 			{
|3789|3789| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3792|3792| 					return;
|3793|3793| 				}
|3794|3794| 			}
|3795|    |-		}
|    |3795|+		
|3796|3796| 	}
|3797|3797| 
|3798|3798| 	// 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
|3785|3785| 		if (cmpUnitAI)
|3786|3786| 		{
|3787|3787| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3788|    |-			{
|    |3788|+			
|3789|3789| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3790|3790| 				{
|3791|3791| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3792|3792| 					return;
|3793|3793| 				}
|3794|    |-			}
|    |3794|+			
|3795|3795| 		}
|3796|3796| 	}
|3797|3797| 
|    | [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
|3797|3797| 
|3798|3798| 	// If nothing found, take the unit orders
|3799|3799| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3800|    |-	{
|    |3800|+	
|3801|3801| 		if (isWorkType(this.orderQueue[i].type))
|3802|3802| 		{
|3803|3803| 			this.workOrders = this.orderQueue.slice(i);
|3804|3804| 			return;
|3805|3805| 		}
|3806|    |-	}
|    |3806|+	
|3807|3807| };
|3808|3808| 
|3809|3809| 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
|3863|3863| 	if (data.timerRepeat === undefined)
|3864|3864| 		this.timer = undefined;
|3865|3865| 
|3866|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3866|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3867|3867| };
|3868|3868| 
|3869|3869| /**
|    | [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
|3863|3863| 	if (data.timerRepeat === undefined)
|3864|3864| 		this.timer = undefined;
|3865|3865| 
|3866|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3866|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3867|3867| };
|3868|3868| 
|3869|3869| /**
|    | [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
|3898|3898| 	this.timer = undefined;
|3899|3899| };
|3900|3900| 
|3901|    |-//// Message handlers /////
|    |3901|+// // Message handlers /////
|3902|3902| 
|3903|3903| UnitAI.prototype.OnMotionChanged = function(msg)
|3904|3904| {
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3903|3903| UnitAI.prototype.OnMotionChanged = function(msg)
|3904|3904| {
|3905|3905| 	if (msg.starting && !msg.error)
|3906|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3906|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveStarted", "data": msg});
|3907|3907| 	else if (!msg.starting || msg.error)
|3908|3908| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3909|3909| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3903|3903| UnitAI.prototype.OnMotionChanged = function(msg)
|3904|3904| {
|3905|3905| 	if (msg.starting && !msg.error)
|3906|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3906|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg });
|3907|3907| 	else if (!msg.starting || msg.error)
|3908|3908| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3909|3909| };
|    | [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| 	if (msg.starting && !msg.error)
|3906|3906| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3907|3907| 	else if (!msg.starting || msg.error)
|3908|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3908|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveCompleted", "data": msg});
|3909|3909| };
|3910|3910| 
|3911|3911| 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
|3905|3905| 	if (msg.starting && !msg.error)
|3906|3906| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3907|3907| 	else if (!msg.starting || msg.error)
|3908|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3908|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg });
|3909|3909| };
|3910|3910| 
|3911|3911| 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
|3913|3913| 	// TODO: This is a bit inefficient since every unit listens to every
|3914|3914| 	// construction message - ideally we could scope it to only the one we're building
|3915|3915| 
|3916|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3916|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3917|3917| };
|3918|3918| 
|3919|3919| 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
|3913|3913| 	// TODO: This is a bit inefficient since every unit listens to every
|3914|3914| 	// construction message - ideally we could scope it to only the one we're building
|3915|3915| 
|3916|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3916|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3917|3917| };
|3918|3918| 
|3919|3919| 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
|3938|3938| 
|3939|3939| UnitAI.prototype.OnAttacked = function(msg)
|3940|3940| {
|3941|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3941|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3942|3942| };
|3943|3943| 
|3944|3944| 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
|3938|3938| 
|3939|3939| UnitAI.prototype.OnAttacked = function(msg)
|3940|3940| {
|3941|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3941|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3942|3942| };
|3943|3943| 
|3944|3944| 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
|3943|3943| 
|3944|3944| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3945|3945| {
|3946|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3946|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|3947|3947| };
|3948|3948| 
|3949|3949| 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
|3943|3943| 
|3944|3944| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3945|3945| {
|3946|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3946|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|3947|3947| };
|3948|3948| 
|3949|3949| 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
|3948|3948| 
|3949|3949| UnitAI.prototype.OnHealthChanged = function(msg)
|3950|3950| {
|3951|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3951|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|3952|3952| };
|3953|3953| 
|3954|3954| 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
|3948|3948| 
|3949|3949| UnitAI.prototype.OnHealthChanged = function(msg)
|3950|3950| {
|3951|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3951|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|3952|3952| };
|3953|3953| 
|3954|3954| 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
|3954|3954| UnitAI.prototype.OnRangeUpdate = function(msg)
|3955|3955| {
|3956|3956| 	if (msg.tag == this.losRangeQuery)
|3957|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3957|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|3958|3958| 	else if (msg.tag == this.losHealRangeQuery)
|3959|3959| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3960|3960| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3954|3954| UnitAI.prototype.OnRangeUpdate = function(msg)
|3955|3955| {
|3956|3956| 	if (msg.tag == this.losRangeQuery)
|3957|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3957|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|3958|3958| 	else if (msg.tag == this.losHealRangeQuery)
|3959|3959| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3960|3960| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3956|3956| 	if (msg.tag == this.losRangeQuery)
|3957|3957| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3958|3958| 	else if (msg.tag == this.losHealRangeQuery)
|3959|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3959|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|3960|3960| };
|3961|3961| 
|3962|3962| 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
|3956|3956| 	if (msg.tag == this.losRangeQuery)
|3957|3957| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3958|3958| 	else if (msg.tag == this.losHealRangeQuery)
|3959|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3959|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|3960|3960| };
|3961|3961| 
|3962|3962| 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
|3961|3961| 
|3962|3962| UnitAI.prototype.OnPackFinished = function(msg)
|3963|3963| {
|3964|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3964|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|3965|3965| };
|3966|3966| 
|3967|3967| //// 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
|3961|3961| 
|3962|3962| UnitAI.prototype.OnPackFinished = function(msg)
|3963|3963| {
|3964|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3964|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|3965|3965| };
|3966|3966| 
|3967|3967| //// 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
|3964|3964| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|3965|3965| };
|3966|3966| 
|3967|    |-//// Helper functions to be called by the FSM ////
|    |3967|+// // Helper functions to be called by the FSM ////
|3968|3968| 
|3969|3969| UnitAI.prototype.GetWalkSpeed = function()
|3970|3970| {
|    | [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
|4066|4066| 	if (!cmpOwnership || cmpOwnership.GetOwner() == INVALID_PLAYER)
|4067|4067| 		return undefined;
|4068|4068| 
|4069|    |-	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position)
|    |4069|+	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
|4070|4070| 	if (!cmpPosition || !cmpPosition.IsInWorld())
|4071|4071| 		return undefined;
|4072|4072| 
|    | [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
|4151|4151| 			PlaySound(name, member);
|4152|4152| 	}
|4153|4153| 	else
|4154|    |-	{
|    |4154|+	
|4155|4155| 		// Otherwise use our own sounds
|4156|4156| 		PlaySound(name, this.entity);
|4157|    |-	}
|    |4157|+	
|4158|4158| };
|4159|4159| 
|4160|4160| /*
|    | [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
|4320|4320| 	else
|4321|4321| 		// return false? Or hope you come close enough?
|4322|4322| 		var parabolicMaxRange = 0;
|4323|    |-		//return false;
|    |4323|+		// return false;
|4324|4324| 
|4325|4325| 	// the parabole changes while walking, take something in the middle
|4326|4326| 	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
|4385|4385| 	if (this.IsFormationMember())
|4386|4386| 	{
|4387|4387| 		var cmpFormationUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|4388|    |-		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation()
|4389|    |-			&& cmpFormationUnitAI.order.data.target == target)
|    |4388|+		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation() &&
|    |4389|+			cmpFormationUnitAI.order.data.target == target)
|4390|4390| 			return true;
|4391|4391| 	}
|4392|4392| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4553|4553| UnitAI.prototype.AttackEntityInZone = function(ents)
|4554|4554| {
|4555|4555| 	var target = ents.find(target =>
|4556|    |-		this.CanAttack(target)
|4557|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4556|+		this.CanAttack(target) &&
|    |4557|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4558|4558| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4559|4559| 	);
|4560|4560| 	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
|4554|4554| {
|4555|4555| 	var target = ents.find(target =>
|4556|4556| 		this.CanAttack(target)
|4557|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4558|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4557|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4558|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4559|4559| 	);
|4560|4560| 	if (!target)
|4561|4561| 		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
|4618|4618| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4619|4619| 	if (this.isGuardOf)
|4620|4620| 	{
|4621|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4621|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4622|4622| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4623|4623| 		if (cmpUnitAI && cmpAttack &&
|4624|4624| 		    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
|4622|4622| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4623|4623| 		if (cmpUnitAI && cmpAttack &&
|4624|4624| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4625|    |-				return false;
|    |4625|+			return false;
|4626|4626| 	}
|4627|4627| 
|4628|4628| 	// 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
|4627|4627| 
|4628|4628| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4629|4629| 	if (this.GetStance().respondHoldGround)
|4630|    |-	{
|    |4630|+	
|4631|4631| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4632|4632| 			return true;
|4633|    |-	}
|    |4633|+	
|4634|4634| 
|4635|4635| 	// Stop if it's left our vision range, unless we're especially persistent
|4636|4636| 	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
|4634|4634| 
|4635|4635| 	// Stop if it's left our vision range, unless we're especially persistent
|4636|4636| 	if (!this.GetStance().respondChaseBeyondVision)
|4637|    |-	{
|    |4637|+	
|4638|4638| 		if (!this.CheckTargetIsInVisionRange(target))
|4639|4639| 			return true;
|4640|    |-	}
|    |4640|+	
|4641|4641| 
|4642|4642| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4643|4643| 	// 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
|4660|4660| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4661|4661| 	if (this.isGuardOf)
|4662|4662| 	{
|4663|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4663|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4664|4664| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4665|4665| 		if (cmpUnitAI && cmpAttack &&
|4666|4666| 		    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
|4673|4673| 	return false;
|4674|4674| };
|4675|4675| 
|4676|    |-//// External interface functions ////
|    |4676|+// // External interface functions ////
|4677|4677| 
|4678|4678| UnitAI.prototype.SetFormationController = function(ent)
|4679|4679| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4683|4683| 	// of our own formation (or ourself if not in formation)
|4684|4684| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4685|4685| 	if (cmpObstruction)
|4686|    |-	{
|    |4686|+	
|4687|4687| 		if (ent == INVALID_ENTITY)
|4688|4688| 			cmpObstruction.SetControlGroup(this.entity);
|4689|4689| 		else
|4690|4690| 			cmpObstruction.SetControlGroup(ent);
|4691|    |-	}
|    |4691|+	
|4692|4692| 
|4693|4693| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4694|4694| 	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
|4826|4826| 	// if we already had an old guard order, do nothing if the target is the same
|4827|4827| 	// and the order is running, otherwise remove the previous order
|4828|4828| 	if (this.isGuardOf)
|4829|    |-	{
|    |4829|+	
|4830|4830| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4831|4831| 			return;
|4832|4832| 		else
|4833|4833| 			this.RemoveGuard();
|4834|    |-	}
|    |4834|+	
|4835|4835| 
|4836|4836| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4837|4837| };
|    | [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
|4829|4829| 	{
|4830|4830| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4831|4831| 			return;
|4832|    |-		else
|4833|    |-			this.RemoveGuard();
|    |4832|+		this.RemoveGuard();
|4834|4833| 	}
|4835|4834| 
|4836|4835| 	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
|5000|5000| 			this.WalkToTarget(target, queued);
|5001|5001| 		return;
|5002|5002| 	}
|5003|    |-	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture}, queued);
|    |5003|+	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture }, queued);
|5004|5004| };
|5005|5005| 
|5006|5006| /**
|    | [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
|5149|5149| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5150|5150| 	{
|5151|5151| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5152|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5152|+		if (cmpTrader.HasBothMarkets() &&
|5153|5153| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5154|5154| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5155|5155| 		{
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5430|5430| 				{
|5431|5431| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5432|5432| 					var targetClasses = this.order.data.targetClasses;
|5433|    |-					if (targetClasses.attack && cmpIdentity
|5434|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5433|+					if (targetClasses.attack && cmpIdentity &&
|    |5434|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5435|5435| 						continue;
|5436|5436| 					if (targetClasses.avoid && cmpIdentity
|5437|5437| 						&& 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
|5433|5433| 					if (targetClasses.attack && cmpIdentity
|5434|5434| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5435|5435| 						continue;
|5436|    |-					if (targetClasses.avoid && cmpIdentity
|5437|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5436|+					if (targetClasses.avoid && cmpIdentity &&
|    |5437|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5438|5438| 						continue;
|5439|5439| 					// Only used by the AIs to prevent some choices of targets
|5440|5440| 					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
|5456|5456| 		{
|5457|5457| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5458|5458| 			var targetClasses = this.order.data.targetClasses;
|5459|    |-			if (cmpIdentity && targetClasses.attack
|5460|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5459|+			if (cmpIdentity && targetClasses.attack &&
|    |5460|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5461|5461| 				continue;
|5462|5462| 			if (cmpIdentity && targetClasses.avoid
|5463|5463| 				&& 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
|5459|5459| 			if (cmpIdentity && targetClasses.attack
|5460|5460| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5461|5461| 				continue;
|5462|    |-			if (cmpIdentity && targetClasses.avoid
|5463|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5462|+			if (cmpIdentity && targetClasses.avoid &&
|    |5463|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5464|5464| 				continue;
|5465|5465| 			// Only used by the AIs to prevent some choices of targets
|5466|5466| 			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
|5602|5602| 
|5603|5603| UnitAI.prototype.SetHeldPosition = function(x, z)
|5604|5604| {
|5605|    |-	this.heldPosition = {"x": x, "z": z};
|    |5605|+	this.heldPosition = { "x": x, "z": z};
|5606|5606| };
|5607|5607| 
|5608|5608| 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
|5602|5602| 
|5603|5603| UnitAI.prototype.SetHeldPosition = function(x, z)
|5604|5604| {
|5605|    |-	this.heldPosition = {"x": x, "z": z};
|    |5605|+	this.heldPosition = {"x": x, "z": z };
|5606|5606| };
|5607|5607| 
|5608|5608| 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
|5629|5629| 	return false;
|5630|5630| };
|5631|5631| 
|5632|    |-//// Helper functions ////
|    |5632|+// // Helper functions ////
|5633|5633| 
|5634|5634| UnitAI.prototype.CanAttack = function(target)
|5635|5635| {
|    | [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
|5833|5833| 	return cmpPack && cmpPack.IsPacking();
|5834|5834| };
|5835|5835| 
|5836|    |-//// Formation specific functions ////
|    |5836|+// // Formation specific functions ////
|5837|5837| 
|5838|5838| UnitAI.prototype.IsAttackingAsFormation = function()
|5839|5839| {
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5838|5838| UnitAI.prototype.IsAttackingAsFormation = function()
|5839|5839| {
|5840|5840| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5841|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5842|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5841|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5842|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5843|5843| };
|5844|5844| 
|5845|5845| //// 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
|5842|5842| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5843|5843| };
|5844|5844| 
|5845|    |-//// Animal specific functions ////
|    |5845|+// // Animal specific functions ////
|5846|5846| 
|5847|5847| UnitAI.prototype.MoveRandomly = function(distance)
|5848|5848| {

binaries/data/mods/public/simulation/components/UnitAI.js
|2399| »   »   »   »   »   »   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
|3768| »   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
|4540| »   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
|4555| »   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
|4601| »   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
|4624| »   »   ····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
|5080| »   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
|1878| »   »   »   »   »   »   var·cmpFormation·=·Engine.QueryInterface(this.formationController,·IID_Formation);
|    | [NORMAL] JSHintBear:
|    | 'cmpFormation' is already defined.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Freagarach added inline comments.Fri, Apr 26, 10:16 PM
binaries/data/mods/public/simulation/components/ProximityDamage.js
64

Ah, okay. My grep returned mostly null ;)

binaries/data/mods/public/simulation/components/UnitAI.js
3328 ↗(On Diff #7817)

Yep, found it: posting here for my reference.
let cmpUnitMotion = Engine.QueryInterface(this.entity, IID_UnitMotion);
cmpUnitMotion.IsMoving()

Freagarach updated this revision to Diff 7875.Sat, Apr 27, 4:51 PM
Freagarach marked 5 inline comments as done.
Freagarach edited the summary of this revision. (Show Details)

Better way for checking unit motion. Some more fixes.

binaries/data/mods/public/simulation/components/Damage.js
275

Off-topic: Are flying objects considered to be not in the world?

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|  23|  23| 	let cmpTimer = Engine.QueryInterface(SYSTEM_ENTITY, IID_Timer);
|  24|  24| 	let turnLength = cmpTimer.GetLatestTurnLength();
|  25|  25| 	return new Vector3D(
|  26|    |-			(curPos.x * (turnLength - lateness) + prevPos.x * lateness) / turnLength,
|    |  26|+		(curPos.x * (turnLength - lateness) + prevPos.x * lateness) / turnLength,
|  27|  27| 			0,
|  28|  28| 			(curPos.z * (turnLength - lateness) + prevPos.z * lateness) / turnLength);
|  29|  29| };
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|  24|  24| 	let turnLength = cmpTimer.GetLatestTurnLength();
|  25|  25| 	return new Vector3D(
|  26|  26| 			(curPos.x * (turnLength - lateness) + prevPos.x * lateness) / turnLength,
|  27|    |-			0,
|    |  27|+		0,
|  28|  28| 			(curPos.z * (turnLength - lateness) + prevPos.z * lateness) / turnLength);
|  29|  29| };
|  30|  30| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|  25|  25| 	return new Vector3D(
|  26|  26| 			(curPos.x * (turnLength - lateness) + prevPos.x * lateness) / turnLength,
|  27|  27| 			0,
|  28|    |-			(curPos.z * (turnLength - lateness) + prevPos.z * lateness) / turnLength);
|    |  28|+		(curPos.z * (turnLength - lateness) + prevPos.z * lateness) / turnLength);
|  29|  29| };
|  30|  30| 
|  31|  31| /**
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
| 111| 111| 
| 112| 112| 	// Do this first in case the direct hit kills the target
| 113| 113| 	if (data.isSplash)
| 114|    |-	{
|    | 114|+	
| 115| 115| 		this.CauseSplashDamage({
| 116| 116| 			"attacker": data.attacker,
| 117| 117| 			"origin": Vector2D.from3D(data.position),
| 124| 124| 			"type": data.type,
| 125| 125| 			"attackerOwner": data.attackerOwner
| 126| 126| 		});
| 127|    |-	}
|    | 127|+	
| 128| 128| 
| 129| 129| 	let cmpProjectileManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_ProjectileManager);
| 130| 130| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
| 212| 212| 				damageMultiplier = 0;
| 213| 213| 		}
| 214| 214| 		else // In case someone calls this function with an invalid shape.
| 215|    |-		{
|    | 215|+		
| 216| 216| 			warn("The " + data.shape + " splash damage shape is not implemented!");
| 217|    |-		}
|    | 217|+		
| 218| 218| 
| 219| 219| 		if (data.splashBonus)
| 220| 220| 			damageMultiplier *= GetDamageBonus(ent, data.splashBonus);
Executing section cli...

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

Stan added inline comments.Sat, Apr 27, 5:02 PM
binaries/data/mods/public/simulation/components/Damage.js
275

I don't think so but they have their own unit motion.

Freagarach marked 6 inline comments as done.Mon, Apr 29, 8:19 PM
Freagarach added inline comments.
binaries/data/mods/public/simulation/components/Damage.js
275

Ah I see, thanks!

binaries/data/mods/public/simulation/components/ProximityDamage.js
64

Did you try to save ?

I tried, it works fine. What is your suggestion now?

143

I think there are little messages to be ignored whith this (OnMotionChanged) check ;)

Angen added a subscriber: Angen.Mon, Apr 29, 8:28 PM

Quick question:
Would not be better to use range query to get entities around instead calling this.EntitiesNearPoint ?

Freagarach marked 2 inline comments as done.Tue, Apr 30, 7:46 PM
In D1838#76640, @Angen wrote:

Quick question:
Would not be better to use range query to get entities around instead calling this.EntitiesNearPoint ?

You mean:

let nearEnts = cmpRangeManager.ExecuteQuery(data.attacker, 0, data.radius, data.playersToDamage, IID_DamageReceiver);

instead of:

let nearEnts = this.EntitiesNearPoint(data.origin, data.radius, data.playersToDamage);

? That seems to be neater, I guess. Would this also ensure that an entity does not damage itself?

Freagarach updated this revision to Diff 7895.Wed, May 1, 4:57 PM
Freagarach edited the summary of this revision. (Show Details)
  • Added test
  • Replaced the timer-check at init with one at Ownership-change to prevent entities with OnlyWhenMoving == true to do damage upon creation.
  • Use range query instead of EntitiesNearPoint as suggested by Angen
  • Typo (bonusses)
  • Fixed error with FriendlyFire
  • Updated JSDoc
Vulcan added a comment.Wed, May 1, 4:59 PM

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'turnLength' found.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_ProximityDamage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_ProximityDamage.js
|  10|  10| Engine.LoadComponentScript("Timer.js");
|  11|  11| 
|  12|  12| let cmpTimer = ConstructComponent(SYSTEM_ENTITY, "Timer");
|  13|    |-cmpTimer.OnUpdate({ turnLength: 1 });
|    |  13|+cmpTimer.OnUpdate({ "turnLength": 1 });
|  14|  14| 
|  15|  15| let damagingEnt = 42;
|  16|  16| let player = 1;
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'RestrictedClasses'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_ProximityDamage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_ProximityDamage.js
|  81|  81| 	"Hack": 0.0,
|  82|  82| 	"Pierce": 10.0,
|  83|  83| 	"Crush": 50.0,
|  84|    |-	"RestrictedClasses":{
|    |  84|+	"RestrictedClasses": {
|  85|  85| 		"_string": "Javelin"
|  86|  86| 	},
|  87|  87| 	"Bonuses": {
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'Bonus1'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_ProximityDamage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_ProximityDamage.js
|  85|  85| 		"_string": "Javelin"
|  86|  86| 	},
|  87|  87| 	"Bonuses": {
|  88|    |-		"Bonus1":{
|    |  88|+		"Bonus1": {
|  89|  89| 			"Civ": "iber"
|  90|  90| 		},
|  91|  91| 		"Bonus2":{
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'Bonus2'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_ProximityDamage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_ProximityDamage.js
|  88|  88| 		"Bonus1":{
|  89|  89| 			"Civ": "iber"
|  90|  90| 		},
|  91|    |-		"Bonus2":{
|    |  91|+		"Bonus2": {
|  92|  92| 			"Classes": "Javelin"
|  93|  93| 		},
|  94|  94| 		"Bonus3":{
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'Bonus3'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_ProximityDamage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_ProximityDamage.js
|  91|  91| 		"Bonus2":{
|  92|  92| 			"Classes": "Javelin"
|  93|  93| 		},
|  94|    |-		"Bonus3":{
|    |  94|+		"Bonus3": {
|  95|  95| 			"Civ": "athen",
|  96|  96| 			"Multiplier": 2
|  97|  97| 		}
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|  23|  23| 	let cmpTimer = Engine.QueryInterface(SYSTEM_ENTITY, IID_Timer);
|  24|  24| 	let turnLength = cmpTimer.GetLatestTurnLength();
|  25|  25| 	return new Vector3D(
|  26|    |-			(curPos.x * (turnLength - lateness) + prevPos.x * lateness) / turnLength,
|    |  26|+		(curPos.x * (turnLength - lateness) + prevPos.x * lateness) / turnLength,
|  27|  27| 			0,
|  28|  28| 			(curPos.z * (turnLength - lateness) + prevPos.z * lateness) / turnLength);
|  29|  29| };
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|  24|  24| 	let turnLength = cmpTimer.GetLatestTurnLength();
|  25|  25| 	return new Vector3D(
|  26|  26| 			(curPos.x * (turnLength - lateness) + prevPos.x * lateness) / turnLength,
|  27|    |-			0,
|    |  27|+		0,
|  28|  28| 			(curPos.z * (turnLength - lateness) + prevPos.z * lateness) / turnLength);
|  29|  29| };
|  30|  30| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|  25|  25| 	return new Vector3D(
|  26|  26| 			(curPos.x * (turnLength - lateness) + prevPos.x * lateness) / turnLength,
|  27|  27| 			0,
|  28|    |-			(curPos.z * (turnLength - lateness) + prevPos.z * lateness) / turnLength);
|    |  28|+		(curPos.z * (turnLength - lateness) + prevPos.z * lateness) / turnLength);
|  29|  29| };
|  30|  30| 
|  31|  31| /**
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
| 111| 111| 
| 112| 112| 	// Do this first in case the direct hit kills the target
| 113| 113| 	if (data.isSplash)
| 114|    |-	{
|    | 114|+	
| 115| 115| 		this.CauseSplashDamage({
| 116| 116| 			"attacker": data.attacker,
| 117| 117| 			"origin": Vector2D.from3D(data.position),
| 124| 124| 			"type": data.type,
| 125| 125| 			"attackerOwner": data.attackerOwner
| 126| 126| 		});
| 127|    |-	}
|    | 127|+	
| 128| 128| 
| 129| 129| 	let cmpProjectileManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_ProjectileManager);
| 130| 130| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
| 212| 212| 				damageMultiplier = 0;
| 213| 213| 		}
| 214| 214| 		else // In case someone calls this function with an invalid shape.
| 215|    |-		{
|    | 215|+		
| 216| 216| 			warn("The " + data.shape + " splash damage shape is not implemented!");
| 217|    |-		}
|    | 217|+		
| 218| 218| 
| 219| 219| 		if (data.splashBonus)
| 220| 220| 			damageMultiplier *= GetDamageBonus(ent, data.splashBonus);
Executing section cli...

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

Freagarach edited the summary of this revision. (Show Details)Wed, May 15, 4:19 PM
Freagarach added inline comments.
binaries/data/mods/public/simulation/components/Damage.js
254

MTM: Check if the entity causing proximity damage has a position and is in world.

Freagarach updated this revision to Diff 8052.Sat, May 18, 10:38 AM

Removed duplicate type in cmpDamage.CauseProximityDamage at CauseDamage.

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'turnLength' found.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_ProximityDamage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_ProximityDamage.js
|  10|  10| Engine.LoadComponentScript("Timer.js");
|  11|  11| 
|  12|  12| let cmpTimer = ConstructComponent(SYSTEM_ENTITY, "Timer");
|  13|    |-cmpTimer.OnUpdate({ turnLength: 1 });
|    |  13|+cmpTimer.OnUpdate({ "turnLength": 1 });
|  14|  14| 
|  15|  15| let damagingEnt = 42;
|  16|  16| let player = 1;
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'RestrictedClasses'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_ProximityDamage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_ProximityDamage.js
|  81|  81| 	"Hack": 0.0,
|  82|  82| 	"Pierce": 10.0,
|  83|  83| 	"Crush": 50.0,
|  84|    |-	"RestrictedClasses":{
|    |  84|+	"RestrictedClasses": {
|  85|  85| 		"_string": "Javelin"
|  86|  86| 	},
|  87|  87| 	"Bonuses": {
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'Bonus1'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_ProximityDamage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_ProximityDamage.js
|  85|  85| 		"_string": "Javelin"
|  86|  86| 	},
|  87|  87| 	"Bonuses": {
|  88|    |-		"Bonus1":{
|    |  88|+		"Bonus1": {
|  89|  89| 			"Civ": "iber"
|  90|  90| 		},
|  91|  91| 		"Bonus2":{
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'Bonus2'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_ProximityDamage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_ProximityDamage.js
|  88|  88| 		"Bonus1":{
|  89|  89| 			"Civ": "iber"
|  90|  90| 		},
|  91|    |-		"Bonus2":{
|    |  91|+		"Bonus2": {
|  92|  92| 			"Classes": "Javelin"
|  93|  93| 		},
|  94|  94| 		"Bonus3":{
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'Bonus3'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_ProximityDamage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_ProximityDamage.js
|  91|  91| 		"Bonus2":{
|  92|  92| 			"Classes": "Javelin"
|  93|  93| 		},
|  94|    |-		"Bonus3":{
|    |  94|+		"Bonus3": {
|  95|  95| 			"Civ": "athen",
|  96|  96| 			"Multiplier": 2
|  97|  97| 		}
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|  23|  23| 	let cmpTimer = Engine.QueryInterface(SYSTEM_ENTITY, IID_Timer);
|  24|  24| 	let turnLength = cmpTimer.GetLatestTurnLength();
|  25|  25| 	return new Vector3D(
|  26|    |-			(curPos.x * (turnLength - lateness) + prevPos.x * lateness) / turnLength,
|    |  26|+		(curPos.x * (turnLength - lateness) + prevPos.x * lateness) / turnLength,
|  27|  27| 			0,
|  28|  28| 			(curPos.z * (turnLength - lateness) + prevPos.z * lateness) / turnLength);
|  29|  29| };
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|  24|  24| 	let turnLength = cmpTimer.GetLatestTurnLength();
|  25|  25| 	return new Vector3D(
|  26|  26| 			(curPos.x * (turnLength - lateness) + prevPos.x * lateness) / turnLength,
|  27|    |-			0,
|    |  27|+		0,
|  28|  28| 			(curPos.z * (turnLength - lateness) + prevPos.z * lateness) / turnLength);
|  29|  29| };
|  30|  30| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|  25|  25| 	return new Vector3D(
|  26|  26| 			(curPos.x * (turnLength - lateness) + prevPos.x * lateness) / turnLength,
|  27|  27| 			0,
|  28|    |-			(curPos.z * (turnLength - lateness) + prevPos.z * lateness) / turnLength);
|    |  28|+		(curPos.z * (turnLength - lateness) + prevPos.z * lateness) / turnLength);
|  29|  29| };
|  30|  30| 
|  31|  31| /**
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
| 111| 111| 
| 112| 112| 	// Do this first in case the direct hit kills the target
| 113| 113| 	if (data.isSplash)
| 114|    |-	{
|    | 114|+	
| 115| 115| 		this.CauseSplashDamage({
| 116| 116| 			"attacker": data.attacker,
| 117| 117| 			"origin": Vector2D.from3D(data.position),
| 124| 124| 			"type": data.type,
| 125| 125| 			"attackerOwner": data.attackerOwner
| 126| 126| 		});
| 127|    |-	}
|    | 127|+	
| 128| 128| 
| 129| 129| 	let cmpProjectileManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_ProjectileManager);
| 130| 130| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
| 212| 212| 				damageMultiplier = 0;
| 213| 213| 		}
| 214| 214| 		else // In case someone calls this function with an invalid shape.
| 215|    |-		{
|    | 215|+		
| 216| 216| 			warn("The " + data.shape + " splash damage shape is not implemented!");
| 217|    |-		}
|    | 217|+		
| 218| 218| 
| 219| 219| 		if (data.splashBonus)
| 220| 220| 			damageMultiplier *= GetDamageBonus(ent, data.splashBonus);
Executing section cli...

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

Freagarach updated this revision to Diff 8168.Sun, May 26, 9:18 PM
Freagarach marked 3 inline comments as done.

(Hopefully) fixed serialising. (Load/Save works fine.)

@elexis Do you know if it should be "null" or "undefined" at line 166 in ProximityDamage.js?

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'turnLength' found.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_ProximityDamage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_ProximityDamage.js
|  10|  10| Engine.LoadComponentScript("Timer.js");
|  11|  11| 
|  12|  12| let cmpTimer = ConstructComponent(SYSTEM_ENTITY, "Timer");
|  13|    |-cmpTimer.OnUpdate({ turnLength: 1 });
|    |  13|+cmpTimer.OnUpdate({ "turnLength": 1 });
|  14|  14| 
|  15|  15| let damagingEnt = 42;
|  16|  16| let player = 1;
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'RestrictedClasses'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_ProximityDamage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_ProximityDamage.js
|  81|  81| 	"Hack": 0.0,
|  82|  82| 	"Pierce": 10.0,
|  83|  83| 	"Crush": 50.0,
|  84|    |-	"RestrictedClasses":{
|    |  84|+	"RestrictedClasses": {
|  85|  85| 		"_string": "Javelin"
|  86|  86| 	},
|  87|  87| 	"Bonuses": {
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'Bonus1'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_ProximityDamage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_ProximityDamage.js
|  85|  85| 		"_string": "Javelin"
|  86|  86| 	},
|  87|  87| 	"Bonuses": {
|  88|    |-		"Bonus1":{
|    |  88|+		"Bonus1": {
|  89|  89| 			"Civ": "iber"
|  90|  90| 		},
|  91|  91| 		"Bonus2":{
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'Bonus2'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_ProximityDamage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_ProximityDamage.js
|  88|  88| 		"Bonus1":{
|  89|  89| 			"Civ": "iber"
|  90|  90| 		},
|  91|    |-		"Bonus2":{
|    |  91|+		"Bonus2": {
|  92|  92| 			"Classes": "Javelin"
|  93|  93| 		},
|  94|  94| 		"Bonus3":{
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'Bonus3'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_ProximityDamage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_ProximityDamage.js
|  91|  91| 		"Bonus2":{
|  92|  92| 			"Classes": "Javelin"
|  93|  93| 		},
|  94|    |-		"Bonus3":{
|    |  94|+		"Bonus3": {
|  95|  95| 			"Civ": "athen",
|  96|  96| 			"Multiplier": 2
|  97|  97| 		}
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/ProximityDamage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/ProximityDamage.js
|  71|  71| 
|  72|  72| ProximityDamage.prototype.Deserialize = function(data)
|  73|  73| {
|  74|    |-	this.proximityDamageTimer = data.proximityDamageTimer
|    |  74|+	this.proximityDamageTimer = data.proximityDamageTimer;
|  75|  75| };
|  76|  76| 
|  77|  77| 

binaries/data/mods/public/simulation/components/ProximityDamage.js
|  74| »   this.proximityDamageTimer·=·data.proximityDamageTimer
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|  23|  23| 	let cmpTimer = Engine.QueryInterface(SYSTEM_ENTITY, IID_Timer);
|  24|  24| 	let turnLength = cmpTimer.GetLatestTurnLength();
|  25|  25| 	return new Vector3D(
|  26|    |-			(curPos.x * (turnLength - lateness) + prevPos.x * lateness) / turnLength,
|    |  26|+		(curPos.x * (turnLength - lateness) + prevPos.x * lateness) / turnLength,
|  27|  27| 			0,
|  28|  28| 			(curPos.z * (turnLength - lateness) + prevPos.z * lateness) / turnLength);
|  29|  29| };
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|  24|  24| 	let turnLength = cmpTimer.GetLatestTurnLength();
|  25|  25| 	return new Vector3D(
|  26|  26| 			(curPos.x * (turnLength - lateness) + prevPos.x * lateness) / turnLength,
|  27|    |-			0,
|    |  27|+		0,
|  28|  28| 			(curPos.z * (turnLength - lateness) + prevPos.z * lateness) / turnLength);
|  29|  29| };
|  30|  30| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|  25|  25| 	return new Vector3D(
|  26|  26| 			(curPos.x * (turnLength - lateness) + prevPos.x * lateness) / turnLength,
|  27|  27| 			0,
|  28|    |-			(curPos.z * (turnLength - lateness) + prevPos.z * lateness) / turnLength);
|    |  28|+		(curPos.z * (turnLength - lateness) + prevPos.z * lateness) / turnLength);
|  29|  29| };
|  30|  30| 
|  31|  31| /**
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
| 112| 112| 
| 113| 113| 	// Do this first in case the direct hit kills the target
| 114| 114| 	if (data.isSplash)
| 115|    |-	{
|    | 115|+	
| 116| 116| 		this.CauseSplashDamage({
| 117| 117| 			"attacker": data.attacker,
| 118| 118| 			"origin": Vector2D.from3D(data.position),
| 125| 125| 			"type": data.type,
| 126| 126| 			"attackerOwner": data.attackerOwner
| 127| 127| 		});
| 128|    |-	}
|    | 128|+	
| 129| 129| 
| 130| 130| 	let cmpProjectileManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_ProjectileManager);
| 131| 131| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Damage.js
| 218| 218| 				damageMultiplier = 0;
| 219| 219| 		}
| 220| 220| 		else // In case someone calls this function with an invalid shape.
| 221|    |-		{
|    | 221|+		
| 222| 222| 			warn("The " + data.shape + " splash damage shape is not implemented!");
| 223|    |-		}
|    | 223|+		
| 224| 224| 
| 225| 225| 		if (data.splashBonus)
| 226| 226| 			damageMultiplier *= GetDamageBonus(ent, data.splashBonus);
Executing section cli...

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