Page MenuHomeWildfire Games

Automatically cancel unpacking when units are ordered to move
Needs ReviewPublic

Authored by causative on May 24 2018, 12:23 PM.

Details

Reviewers
temple
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Trac Tickets
#5328
#5175
#4015
Summary

It's slightly inconvenient to pack and move your catapults or bolt shooters that are currently unpacking. You have to click to cancel unpacking, and then tell them to move, instead of being able to tell them to move with one click and letting them take care of it.

This patch adds the ability to automatically cancel unpacking when ordered to move. As a bonus, this mitigates the impact of #5175.

Test Plan

Create a catapult. Tell it to start unpacking. Before it finishes, give it a move or garrison command. It should cancel unpacking by itself and start moving. Try this nearby an enemy under conditions where clicking the cancel unpacking button directly would fail due to #5175. When you give it the walk command, again it should cancel unpacking and start moving.

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Lint Skipped
Unit
Unit Tests Skipped
Build Status
Buildable 6161
Build 10246: Vulcan BuildJenkins

Event Timeline

causative created this revision.May 24 2018, 12:23 PM
Vulcan added a subscriber: Vulcan.May 25 2018, 6:59 PM

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

Linter detected issues:
Executing section Default...
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 232| 232| 		// Move a tile outside the building
| 233| 233| 		let range = 4;
| 234| 234| 		if (this.MoveToTargetRangeExplicit(msg.data.target, range, range))
| 235|    |-		{
|    | 235|+		
| 236| 236| 			// We've started walking to the given point
| 237| 237| 			this.SetNextState("INDIVIDUAL.WALKING");
| 238|    |-		}
|    | 238|+		
| 239| 239| 		else
| 240| 240| 		{
| 241| 241| 			// 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
| 237| 237| 			this.SetNextState("INDIVIDUAL.WALKING");
| 238| 238| 		}
| 239| 239| 		else
| 240|    |-		{
|    | 240|+		
| 241| 241| 			// We are already at the target, or can't move at all
| 242| 242| 			this.FinishOrder();
| 243|    |-		}
|    | 243|+		
| 244| 244| 	},
| 245| 245| 
| 246| 246| 	// Individual orders:
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 339| 339| 
| 340| 340| 		var ok = this.MoveToTarget(this.order.data.target);
| 341| 341| 		if (ok)
| 342|    |-		{
|    | 342|+		
| 343| 343| 			// We've started walking to the given point
| 344| 344| 			if (this.IsAnimal())
| 345| 345| 				this.SetNextState("ANIMAL.WALKING");
| 346| 346| 			else
| 347| 347| 				this.SetNextState("INDIVIDUAL.WALKING");
| 348|    |-		}
|    | 348|+		
| 349| 349| 		else
| 350| 350| 		{
| 351| 351| 			// We are already at the target, or can't move at all
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 367| 367| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 368| 368| 		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 369| 369| 		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 370|    |-		{
|    | 370|+		
| 371| 371| 			// we were already on the shoreline, and have not moved since
| 372| 372| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
| 373| 373| 				needToMove = false;
| 374|    |-		}
|    | 374|+		
| 375| 375| 
| 376| 376| 		// TODO: what if the units are on a cliff ? the ship will go below the cliff
| 377| 377| 		// and the units won't be able to garrison. Should go to the nearest (accessible) shore
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 365| 365| 		// Check if we need to move     TODO implement a better way to know if we are on the shoreline
| 366| 366| 		var needToMove = true;
| 367| 367| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 368|    |-		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 369|    |-		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
|    | 368|+		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x) &&
|    | 369|+		    (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 370| 370| 		{
| 371| 371| 			// we were already on the shoreline, and have not moved since
| 372| 372| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 376| 376| 		// TODO: what if the units are on a cliff ? the ship will go below the cliff
| 377| 377| 		// and the units won't be able to garrison. Should go to the nearest (accessible) shore
| 378| 378| 		if (needToMove && this.MoveToTarget(this.order.data.target))
| 379|    |-		{
|    | 379|+		
| 380| 380| 			this.SetNextState("INDIVIDUAL.PICKUP.APPROACHING");
| 381|    |-		}
|    | 381|+		
| 382| 382| 		else
| 383| 383| 		{
| 384| 384| 			// We are already at the target, or can't move at all
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 405| 405| 		var distance = DistanceBetweenEntities(this.entity, this.order.data.target) + (+this.template.FleeDistance);
| 406| 406| 		var cmpUnitMotion = Engine.QueryInterface(this.entity, IID_UnitMotion);
| 407| 407| 		if (cmpUnitMotion.MoveToTargetRange(this.order.data.target, distance, -1))
| 408|    |-		{
|    | 408|+		
| 409| 409| 			// We've started fleeing from the given target
| 410| 410| 			if (this.IsAnimal())
| 411| 411| 				this.SetNextState("ANIMAL.FLEEING");
| 412| 412| 			else
| 413| 413| 				this.SetNextState("INDIVIDUAL.FLEEING");
| 414|    |-		}
|    | 414|+		
| 415| 415| 		else
| 416| 416| 		{
| 417| 417| 			// We are already at the target, or can't move at all
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 452| 452| 			}
| 453| 453| 
| 454| 454| 			if (this.order.data.attackType == this.oldAttackType)
| 455|    |-			{
|    | 455|+			
| 456| 456| 				if (this.IsAnimal())
| 457| 457| 					this.SetNextState("ANIMAL.COMBAT.ATTACKING");
| 458| 458| 				else
| 459| 459| 					this.SetNextState("INDIVIDUAL.COMBAT.ATTACKING");
| 460|    |-			}
|    | 460|+			
| 461| 461| 			else
| 462| 462| 			{
| 463| 463| 				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
| 459| 459| 					this.SetNextState("INDIVIDUAL.COMBAT.ATTACKING");
| 460| 460| 			}
| 461| 461| 			else
| 462|    |-			{
|    | 462|+			
| 463| 463| 				if (this.IsAnimal())
| 464| 464| 					this.SetNextStateAlwaysEntering("ANIMAL.COMBAT.ATTACKING");
| 465| 465| 				else
| 466| 466| 					this.SetNextStateAlwaysEntering("INDIVIDUAL.COMBAT.ATTACKING");
| 467|    |-			}
|    | 467|+			
| 468| 468| 			return;
| 469| 469| 		}
| 470| 470| 
|    | [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
| 584| 584| 					this.PushOrderFront("Walk", this.order.data.lastPos);
| 585| 585| 				}
| 586| 586| 				else
| 587|    |-				{
|    | 587|+				
| 588| 588| 					// We couldn't move there, or the target moved away
| 589| 589| 					this.FinishOrder();
| 590|    |-				}
|    | 590|+				
| 591| 591| 				return;
| 592| 592| 			}
| 593| 593| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 597| 597| 
| 598| 598| 		// Try to move within range
| 599| 599| 		if (this.MoveToTargetRange(this.order.data.target, IID_ResourceGatherer))
| 600|    |-		{
|    | 600|+		
| 601| 601| 			// We've started walking to the given point
| 602| 602| 			this.SetNextState("INDIVIDUAL.GATHER.APPROACHING");
| 603|    |-		}
|    | 603|+		
| 604| 604| 		else
| 605| 605| 		{
| 606| 606| 			// 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
| 674| 674| 	"Order.Repair": function(msg) {
| 675| 675| 		// Try to move within range
| 676| 676| 		if (this.MoveToTargetRange(this.order.data.target, IID_Builder))
| 677|    |-		{
|    | 677|+		
| 678| 678| 			// We've started walking to the given point
| 679| 679| 			this.SetNextState("INDIVIDUAL.REPAIR.APPROACHING");
| 680|    |-		}
|    | 680|+		
| 681| 681| 		else
| 682| 682| 		{
| 683| 683| 			// 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
| 710| 710| 		}
| 711| 711| 
| 712| 712| 		if (this.MoveToGarrisonRange(this.order.data.target))
| 713|    |-		{
|    | 713|+		
| 714| 714| 			this.SetNextState("INDIVIDUAL.GARRISON.APPROACHING");
| 715|    |-		}
|    | 715|+		
| 716| 716| 		else
| 717| 717| 		{
| 718| 718| 			// 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
| 838| 838| 			if (!this.CheckTargetAttackRange(target, target))
| 839| 839| 			{
| 840| 840| 				if (this.TargetIsAlive(target) && this.CheckTargetVisible(target))
| 841|    |-				{
|    | 841|+				
| 842| 842| 					if (this.MoveToTargetAttackRange(target, target))
| 843| 843| 					{
| 844| 844| 						this.SetNextState("COMBAT.APPROACHING");
| 845| 845| 						return;
| 846| 846| 					}
| 847|    |-				}
|    | 847|+				
| 848| 848| 				this.FinishOrder();
| 849| 849| 				return;
| 850| 850| 			}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 863| 863| 			}
| 864| 864| 			// Check if we are already in range, otherwise walk there
| 865| 865| 			if (!this.CheckGarrisonRange(msg.data.target))
| 866|    |-			{
|    | 866|+			
| 867| 867| 				if (!this.CheckTargetVisible(msg.data.target))
| 868| 868| 				{
| 869| 869| 					this.FinishOrder();
| 878| 878| 						return;
| 879| 879| 					}
| 880| 880| 				}
| 881|    |-			}
|    | 881|+			
| 882| 882| 
| 883| 883| 			this.SetNextState("GARRISON.GARRISONING");
| 884| 884| 		},
|    | [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
| 870| 870| 					return;
| 871| 871| 				}
| 872| 872| 				else
| 873|    |-				{
|    | 873|+				
| 874| 874| 					// Out of range; move there in formation
| 875| 875| 					if (this.MoveToGarrisonRange(msg.data.target))
| 876| 876| 					{
| 877| 877| 						this.SetNextState("GARRISON.APPROACHING");
| 878| 878| 						return;
| 879| 879| 					}
| 880|    |-				}
|    | 880|+				
| 881| 881| 			}
| 882| 882| 
| 883| 883| 			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
| 869| 869| 					this.FinishOrder();
| 870| 870| 					return;
| 871| 871| 				}
| 872|    |-				else
| 873|    |-				{
|    | 872|+				
| 874| 873| 					// Out of range; move there in formation
| 875| 874| 					if (this.MoveToGarrisonRange(msg.data.target))
| 876| 875| 					{
| 877| 876| 						this.SetNextState("GARRISON.APPROACHING");
| 878| 877| 						return;
| 879| 878| 					}
| 880|    |-				}
|    | 879|+				
| 881| 880| 			}
| 882| 881| 
| 883| 882| 			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
| 896| 896| 						this.PushOrderFront("Walk", msg.data.lastPos);
| 897| 897| 					}
| 898| 898| 					else
| 899|    |-					{
|    | 899|+					
| 900| 900| 						// We couldn't move there, or the target moved away
| 901| 901| 						this.FinishOrder();
| 902|    |-					}
|    | 902|+					
| 903| 903| 					return;
| 904| 904| 				}
| 905| 905| 
|    | [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
|1117|1117| 			},
|1118|1118| 		},
|1119|1119| 
|1120|    |-		"GARRISON":{
|    |1120|+		"GARRISON": {
|1121|1121| 			"enter": function() {
|1122|1122| 				// If the garrisonholder should pickup, warn it so it can take needed action
|1123|1123| 				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
|1301|1301| 			// If the controller handled an order but some members rejected it,
|1302|1302| 			// they will have no orders and be in the FORMATIONMEMBER.IDLE state.
|1303|1303| 			if (this.orderQueue.length)
|1304|    |-			{
|    |1304|+			
|1305|1305| 				// We're leaving the formation, so stop our FormationWalk order
|1306|1306| 				if (this.FinishOrder())
|1307|1307| 					return;
|1308|    |-			}
|    |1308|+			
|1309|1309| 
|1310|1310| 			// No orders left, we're an individual now
|1311|1311| 			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
|1329|1329| 			// Move a tile outside the building
|1330|1330| 			let range = 4;
|1331|1331| 			if (this.MoveToTargetRangeExplicit(msg.data.target, range, range))
|1332|    |-			{
|    |1332|+			
|1333|1333| 				// We've started walking to the given point
|1334|1334| 				this.SetNextState("WALKINGTOPOINT");
|1335|    |-			}
|    |1335|+			
|1336|1336| 			else
|1337|1337| 			{
|1338|1338| 				// 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
|1334|1334| 				this.SetNextState("WALKINGTOPOINT");
|1335|1335| 			}
|1336|1336| 			else
|1337|    |-			{
|    |1337|+			
|1338|1338| 				// We are already at the target, or can't move at all
|1339|1339| 				this.FinishOrder();
|1340|    |-			}
|    |1340|+			
|1341|1341| 		},
|1342|1342| 
|1343|1343| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1535|1535| 
|1536|1536| 			"LosRangeUpdate": function(msg) {
|1537|1537| 				if (this.GetStance().targetVisibleEnemies)
|1538|    |-				{
|    |1538|+				
|1539|1539| 					// Start attacking one of the newly-seen enemy (if any)
|1540|1540| 					this.AttackEntitiesByPreference(msg.data.added);
|1541|    |-				}
|    |1541|+				
|1542|1542| 			},
|1543|1543| 
|1544|1544| 			"LosHealRangeUpdate": function(msg) {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1721|1721| 						// if nothing better to do, check if the guarded needs to be healed or repaired
|1722|1722| 						var cmpHealth = Engine.QueryInterface(this.isGuardOf, IID_Health);
|1723|1723| 						if (cmpHealth && (cmpHealth.GetHitpoints() < cmpHealth.GetMaxHitpoints()))
|1724|    |-						{
|    |1724|+						
|1725|1725| 							if (this.CanHeal(this.isGuardOf))
|1726|1726| 								this.PushOrderFront("Heal", { "target": this.isGuardOf, "force": false });
|1727|1727| 							else if (this.CanRepair(this.isGuardOf))
|1728|1728| 								this.PushOrderFront("Repair", { "target": this.isGuardOf, "autocontinue": false, "force": false });
|1729|    |-						}
|    |1729|+						
|1730|1730| 					}
|1731|1731| 				},
|1732|1732| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1809|1809| 				"MoveCompleted": function() {
|1810|1810| 
|1811|1811| 					if (this.CheckTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1812|    |-					{
|    |1812|+					
|1813|1813| 						// If the unit needs to unpack, do so
|1814|1814| 						if (this.CanUnpack())
|1815|1815| 						{
|1818|1818| 						}
|1819|1819| 						else
|1820|1820| 							this.SetNextState("ATTACKING");
|1821|    |-					}
|    |1821|+					
|1822|1822| 					else
|1823|1823| 					{
|1824|1824| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1816|1816| 							this.PushOrderFront("Unpack", { "force": true });
|1817|1817| 							return;
|1818|1818| 						}
|1819|    |-						else
|1820|    |-							this.SetNextState("ATTACKING");
|    |1819|+						this.SetNextState("ATTACKING");
|1821|1820| 					}
|1822|1821| 					else
|1823|1822| 					{
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1820|1820| 							this.SetNextState("ATTACKING");
|1821|1821| 					}
|1822|1822| 					else
|1823|    |-					{
|    |1823|+					
|1824|1824| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1825|1825| 						{
|1826|1826| 							this.SetNextState("APPROACHING");
|1830|1830| 							// Give up
|1831|1831| 							this.FinishOrder();
|1832|1832| 						}
|1833|    |-					}
|    |1833|+					
|1834|1834| 				},
|1835|1835| 			},
|1836|1836| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1822|1822| 					else
|1823|1823| 					{
|1824|1824| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1825|    |-						{
|    |1825|+						
|1826|1826| 							this.SetNextState("APPROACHING");
|1827|    |-						}
|    |1827|+						
|1828|1828| 						else
|1829|1829| 						{
|1830|1830| 							// Give up
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1826|1826| 							this.SetNextState("APPROACHING");
|1827|1827| 						}
|1828|1828| 						else
|1829|    |-						{
|    |1829|+						
|1830|1830| 							// Give up
|1831|1831| 							this.FinishOrder();
|1832|    |-						}
|    |1832|+						
|1833|1833| 					}
|1834|1834| 				},
|1835|1835| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1847|1847| 					}
|1848|1848| 					// Check the target is still alive and attackable
|1849|1849| 					if (this.CanAttack(target) && !this.CheckTargetAttackRange(target, this.order.data.attackType))
|1850|    |-					{
|    |1850|+					
|1851|1851| 						// Can't reach it - try to chase after it
|1852|1852| 						if (this.ShouldChaseTargetedEntity(target, this.order.data.force))
|1853|1853| 						{
|1862|1862| 								return;
|1863|1863| 							}
|1864|1864| 						}
|1865|    |-					}
|    |1865|+					
|1866|1866| 
|1867|1867| 					var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|1868|1868| 					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
|1893|1893| 					// TODO: we should probably only bother syncing projectile attacks, not melee
|1894|1894| 
|1895|1895| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|1896|    |-					this.resyncAnimation = (prepare != this.attackTimers.prepare) ? true : false;
|    |1896|+					this.resyncAnimation = (prepare != this.attackTimers.prepare);
|1897|1897| 
|1898|1898| 					this.FaceTowardsTarget(this.order.data.target);
|1899|1899| 
|    | [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
|2022|2022| 
|2023|2023| 				"Attacked": function(msg) {
|2024|2024| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2025|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2026|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2025|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2026|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2027|2027| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2028|2028| 				},
|2029|2029| 			},
|    | [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
|2106|2106| 						// Also don't switch to a different type of huntable animal
|2107|2107| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2108|2108| 							return (
|2109|    |-								ent != oldTarget
|2110|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2109|+								ent != oldTarget &&
|    |2110|+								 ((type.generic == "treasure" && oldType.generic == "treasure")
|2111|2111| 								 || (type.specific == oldType.specific
|2112|2112| 								 && (type.specific != "meat" || oldTemplate == template)))
|2113|2113| 							);
|    | [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
|2107|2107| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2108|2108| 							return (
|2109|2109| 								ent != oldTarget
|2110|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2111|    |-								 || (type.specific == oldType.specific
|    |2110|+								 && ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2111|+								 (type.specific == oldType.specific
|2112|2112| 								 && (type.specific != "meat" || oldTemplate == template)))
|2113|2113| 							);
|2114|2114| 						}, 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
|2108|2108| 							return (
|2109|2109| 								ent != oldTarget
|2110|2110| 								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2111|    |-								 || (type.specific == oldType.specific
|2112|    |-								 && (type.specific != "meat" || oldTemplate == template)))
|    |2111|+								 || (type.specific == oldType.specific &&
|    |2112|+								 (type.specific != "meat" || oldTemplate == template)))
|2113|2113| 							);
|2114|2114| 						}, oldTarget);
|2115|2115| 						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
|2117|2117| 							this.PerformGather(nearby, false, false);
|2118|2118| 							return true;
|2119|2119| 						}
|2120|    |-						else
|2121|    |-						{
|    |2120|+						
|2122|2121| 							// It's probably better in this case, to avoid units getting stuck around a dropsite
|2123|2122| 							// in a "Target is far away, full, nearby are no good resources, return to dropsite" loop
|2124|2123| 							// to order it to GatherNear the resource position.
|2139|2138| 									return true;
|2140|2139| 								}
|2141|2140| 							}
|2142|    |-						}
|    |2141|+						
|2143|2142| 						return true;
|2144|2143| 					}
|2145|2144| 					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
|2129|2129| 								this.GatherNearPosition(pos.x, pos.z, oldType, oldTemplate);
|2130|2130| 								return true;
|2131|2131| 							}
|2132|    |-							else
|2133|    |-							{
|    |2132|+							
|2134|2133| 								// we're kind of stuck here. Return resource.
|2135|2134| 								var nearby = this.FindNearestDropsite(oldType.generic);
|2136|2135| 								if (nearby)
|2138|2137| 									this.PushOrderFront("ReturnResource", { "target": nearby, "force": false });
|2139|2138| 									return true;
|2140|2139| 								}
|2141|    |-							}
|    |2140|+							
|2142|2141| 						}
|2143|2142| 						return true;
|2144|2143| 					}
|    | [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
|2171|2171| 						// Also don't switch to a different type of huntable animal
|2172|2172| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2173|2173| 							return (
|2174|    |-								ent != oldTarget
|2175|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2174|+								ent != oldTarget &&
|    |2175|+								((type.generic == "treasure" && oldType.generic == "treasure")
|2176|2176| 								|| (type.specific == oldType.specific
|2177|2177| 								&& (type.specific != "meat" || oldTemplate == template)))
|2178|2178| 							);
|    | [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
|2172|2172| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2173|2173| 							return (
|2174|2174| 								ent != oldTarget
|2175|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2176|    |-								|| (type.specific == oldType.specific
|    |2175|+								&& ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2176|+								(type.specific == oldType.specific
|2177|2177| 								&& (type.specific != "meat" || oldTemplate == template)))
|2178|2178| 							);
|2179|2179| 						});
|    | [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
|2173|2173| 							return (
|2174|2174| 								ent != oldTarget
|2175|2175| 								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2176|    |-								|| (type.specific == oldType.specific
|2177|    |-								&& (type.specific != "meat" || oldTemplate == template)))
|    |2176|+								|| (type.specific == oldType.specific &&
|    |2177|+								(type.specific != "meat" || oldTemplate == template)))
|2178|2178| 							);
|2179|2179| 						});
|2180|2180| 						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
|2218|2218| 					// Also don't switch to a different type of huntable animal
|2219|2219| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2220|2220| 						return (
|2221|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2222|    |-							|| (type.specific == resourceType.specific
|    |2221|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2222|+							(type.specific == resourceType.specific
|2223|2223| 							&& (type.specific != "meat" || resourceTemplate == template))
|2224|2224| 						);
|2225|2225| 					});
|    | [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
|2219|2219| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2220|2220| 						return (
|2221|2221| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2222|    |-							|| (type.specific == resourceType.specific
|2223|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2222|+							|| (type.specific == resourceType.specific &&
|    |2223|+							(type.specific != "meat" || resourceTemplate == template))
|2224|2224| 						);
|2225|2225| 					});
|2226|2226| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2335|2335| 
|2336|2336| 					var cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply);
|2337|2337| 					if (cmpSupply && cmpSupply.IsAvailable(cmpOwnership.GetOwner(), this.entity))
|2338|    |-					{
|    |2338|+					
|2339|2339| 						// Check we can still reach and gather from the target
|2340|2340| 						if (this.CheckTargetRange(this.gatheringTarget, IID_ResourceGatherer) && this.CanGather(this.gatheringTarget))
|2341|2341| 						{
|2401|2401| 								return;
|2402|2402| 							}
|2403|2403| 						}
|2404|    |-					}
|    |2404|+					
|2405|2405| 
|2406|2406| 					// We're already in range, can't get anywhere near it or the target is exhausted.
|2407|2407| 
|    | [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
|2427|2427| 					// Also don't switch to a different type of huntable animal
|2428|2428| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2429|2429| 						return (
|2430|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2431|    |-							|| (type.specific == resourceType.specific
|    |2430|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2431|+							(type.specific == resourceType.specific
|2432|2432| 							&& (type.specific != "meat" || resourceTemplate == template))
|2433|2433| 						);
|2434|2434| 					});
|    | [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
|2428|2428| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2429|2429| 						return (
|2430|2430| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2431|    |-							|| (type.specific == resourceType.specific
|2432|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2431|+							|| (type.specific == resourceType.specific &&
|    |2432|+							(type.specific != "meat" || resourceTemplate == template))
|2433|2433| 						);
|2434|2434| 					});
|2435|2435| 					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
|2515|2515| 					this.StartTimer(prepare, this.healTimers.repeat);
|2516|2516| 
|2517|2517| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2518|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2518|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2519|2519| 
|2520|2520| 					this.FaceTowardsTarget(this.order.data.target);
|2521|2521| 				},
|    | [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
|2730|2730| 					{
|2731|2731| 						// The building was already finished/fully repaired before we arrived;
|2732|2732| 						// let the ConstructionFinished handler handle this.
|2733|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2733|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2734|2734| 						return true;
|2735|2735| 					}
|2736|2736| 
|    | [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
|2730|2730| 					{
|2731|2731| 						// The building was already finished/fully repaired before we arrived;
|2732|2732| 						// let the ConstructionFinished handler handle this.
|2733|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2733|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2734|2734| 						return true;
|2735|2735| 					}
|2736|2736| 
|    | [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
|2770|2770| 					if (this.MoveToTargetRange(this.repairTarget, IID_Builder))
|2771|2771| 						this.SetNextState("APPROACHING");
|2772|2772| 					else if (!this.CheckTargetRange(this.repairTarget, IID_Builder))
|2773|    |-						this.FinishOrder(); //can't approach and isn't in reach
|    |2773|+						this.FinishOrder(); // can't approach and isn't in reach
|2774|2774| 				},
|2775|2775| 			},
|2776|2776| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2857|2857| 
|2858|2858| 				// Unit was approaching and there's nothing to do now, so switch to walking
|2859|2859| 				if (oldState === "INDIVIDUAL.REPAIR.APPROACHING")
|2860|    |-				{
|    |2860|+				
|2861|2861| 					// We're already walking to the given point, so add this as a order.
|2862|2862| 					this.WalkToTarget(msg.data.newentity, true);
|2863|    |-				}
|    |2863|+				
|2864|2864| 			},
|2865|2865| 		},
|2866|2866| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2910|2910| 
|2911|2911| 					// Check that we can garrison here
|2912|2912| 					if (this.CanGarrison(target))
|2913|    |-					{
|    |2913|+					
|2914|2914| 						// Check that we're in range of the garrison target
|2915|2915| 						if (this.CheckGarrisonRange(target))
|2916|2916| 						{
|2986|2986| 								return false;
|2987|2987| 							}
|2988|2988| 						}
|2989|    |-					}
|    |2989|+					
|2990|2990| 					// Garrisoning failed for some reason, so finish the order
|2991|2991| 					this.FinishOrder();
|2992|2992| 					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
|3093|3093| 		"Attacked": function(msg) {
|3094|3094| 			if (this.template.NaturalBehaviour == "skittish" ||
|3095|3095| 			    this.template.NaturalBehaviour == "passive")
|3096|    |-			{
|    |3096|+			
|3097|3097| 				this.Flee(msg.data.attacker, false);
|3098|    |-			}
|    |3098|+			
|3099|3099| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|3100|3100| 			{
|3101|3101| 				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
|3102|3102| 					this.Attack(msg.data.attacker, false);
|3103|3103| 			}
|3104|3104| 			else if (this.template.NaturalBehaviour == "domestic")
|3105|    |-			{
|    |3105|+			
|3106|3106| 				// Never flee, stop what we were doing
|3107|3107| 				this.SetNextState("IDLE");
|3108|    |-			}
|    |3108|+			
|3109|3109| 		},
|3110|3110| 
|3111|3111| 		"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
|3112|3112| 			// Move a tile outside the building
|3113|3113| 			var range = 4;
|3114|3114| 			if (this.MoveToTargetRangeExplicit(msg.data.target, range, range))
|3115|    |-			{
|    |3115|+			
|3116|3116| 				// We've started walking to the given point
|3117|3117| 				this.SetNextState("WALKING");
|3118|    |-			}
|    |3118|+			
|3119|3119| 			else
|3120|3120| 			{
|3121|3121| 				// 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
|3117|3117| 				this.SetNextState("WALKING");
|3118|3118| 			}
|3119|3119| 			else
|3120|    |-			{
|    |3120|+			
|3121|3121| 				// We are already at the target, or can't move at all
|3122|3122| 				this.FinishOrder();
|3123|    |-			}
|    |3123|+			
|3124|3124| 		},
|3125|3125| 
|3126|3126| 		"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
|3159|3159| 				}
|3160|3160| 				// Start attacking one of the newly-seen enemy (if any)
|3161|3161| 				else if (this.IsDangerousAnimal())
|3162|    |-				{
|    |3162|+				
|3163|3163| 					this.AttackVisibleEntity(msg.data.added);
|3164|    |-				}
|    |3164|+				
|3165|3165| 
|3166|3166| 				// TODO: if two units enter our range together, we'll attack the
|3167|3167| 				// 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
|3202|3202| 				}
|3203|3203| 				// Start attacking one of the newly-seen enemy (if any)
|3204|3204| 				else if (this.template.NaturalBehaviour == "violent")
|3205|    |-				{
|    |3205|+				
|3206|3206| 					this.AttackVisibleEntity(msg.data.added);
|3207|    |-				}
|    |3207|+				
|3208|3208| 			},
|3209|3209| 
|3210|3210| 			"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
|3219|3219| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3220|3220| 
|3221|3221| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3222|    |-							// only used for domestic animals
|    |3222|+		// only used for domestic animals
|3223|3223| 	},
|3224|3224| };
|3225|3225| 
|    | [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
|3276|3276| 
|3277|3277| UnitAI.prototype.IsAnimal = function()
|3278|3278| {
|3279|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3279|+	return (!!this.template.NaturalBehaviour);
|3280|3280| };
|3281|3281| 
|3282|3282| 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
|3314|3314| UnitAI.prototype.GetGarrisonHolder = function()
|3315|3315| {
|3316|3316| 	if (this.IsGarrisoned())
|3317|    |-	{
|    |3317|+	
|3318|3318| 		for (let order of this.orderQueue)
|3319|3319| 			if (order.type == "Garrison")
|3320|3320| 				return order.data.target;
|3321|    |-	}
|    |3321|+	
|3322|3322| 	return INVALID_ENTITY;
|3323|3323| };
|3324|3324| 
|    | [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
|3392|3392| 		{
|3393|3393| 			let index = this.GetCurrentState().indexOf(".");
|3394|3394| 			if (index != -1)
|3395|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3395|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3396|3396| 			this.Stop(false);
|3397|3397| 		}
|3398|3398| 
|    | [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
|3448|3448| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3449|3449| 			continue;
|3450|3450| 		if (i == 0)
|3451|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3451|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3452|3452| 		else
|3453|3453| 			this.orderQueue.splice(i, 1);
|3454|3454| 		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
|3448|3448| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3449|3449| 			continue;
|3450|3450| 		if (i == 0)
|3451|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3451|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3452|3452| 		else
|3453|3453| 			this.orderQueue.splice(i, 1);
|3454|3454| 		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
|3532|3532| };
|3533|3533| 
|3534|3534| 
|3535|    |-//// FSM linkage functions ////
|    |3535|+// // FSM linkage functions ////
|3536|3536| 
|3537|3537| UnitAI.prototype.SetNextState = function(state)
|3538|3538| {
|    | [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
|3706|3706| 				continue;
|3707|3707| 			if (this.orderQueue[i].type == type)
|3708|3708| 				continue;
|3709|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3709|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3710|3710| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3711|3711| 			return;
|3712|3712| 		}
|    | [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
|3706|3706| 				continue;
|3707|3707| 			if (this.orderQueue[i].type == type)
|3708|3708| 				continue;
|3709|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3709|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3710|3710| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3711|3711| 			return;
|3712|3712| 		}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3720|3720| {
|3721|3721| 	// Remember the previous work orders to be able to go back to them later if required
|3722|3722| 	if (data && data.force)
|3723|    |-	{
|    |3723|+	
|3724|3724| 		if (this.IsFormationController())
|3725|3725| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3726|3726| 		else
|3727|3727| 			this.UpdateWorkOrders(type);
|3728|    |-	}
|    |3728|+	
|3729|3729| 
|3730|3730| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3731|3731| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3806|3806| 	{
|3807|3807| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3808|3808| 		if (cmpUnitAI)
|3809|    |-		{
|    |3809|+		
|3810|3810| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3811|3811| 			{
|3812|3812| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3815|3815| 					return;
|3816|3816| 				}
|3817|3817| 			}
|3818|    |-		}
|    |3818|+		
|3819|3819| 	}
|3820|3820| 
|3821|3821| 	// 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
|3808|3808| 		if (cmpUnitAI)
|3809|3809| 		{
|3810|3810| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3811|    |-			{
|    |3811|+			
|3812|3812| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3813|3813| 				{
|3814|3814| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3815|3815| 					return;
|3816|3816| 				}
|3817|    |-			}
|    |3817|+			
|3818|3818| 		}
|3819|3819| 	}
|3820|3820| 
|    | [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
|3820|3820| 
|3821|3821| 	// If nothing found, take the unit orders
|3822|3822| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3823|    |-	{
|    |3823|+	
|3824|3824| 		if (isWorkType(this.orderQueue[i].type))
|3825|3825| 		{
|3826|3826| 			this.workOrders = this.orderQueue.slice(i);
|3827|3827| 			return;
|3828|3828| 		}
|3829|    |-	}
|    |3829|+	
|3830|3830| };
|3831|3831| 
|3832|3832| 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
|3886|3886| 	if (data.timerRepeat === undefined)
|3887|3887| 		this.timer = undefined;
|3888|3888| 
|3889|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3889|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3890|3890| };
|3891|3891| 
|3892|3892| /**
|    | [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
|3886|3886| 	if (data.timerRepeat === undefined)
|3887|3887| 		this.timer = undefined;
|3888|3888| 
|3889|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3889|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3890|3890| };
|3891|3891| 
|3892|3892| /**
|    | [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
|3921|3921| 	this.timer = undefined;
|3922|3922| };
|3923|3923| 
|3924|    |-//// Message handlers /////
|    |3924|+// // Message handlers /////
|3925|3925| 
|3926|3926| UnitAI.prototype.OnMotionChanged = function(msg)
|3927|3927| {
|    | [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
|3926|3926| UnitAI.prototype.OnMotionChanged = function(msg)
|3927|3927| {
|3928|3928| 	if (msg.starting && !msg.error)
|3929|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3929|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveStarted", "data": msg});
|3930|3930| 	else if (!msg.starting || msg.error)
|3931|3931| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3932|3932| };
|    | [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
|3926|3926| UnitAI.prototype.OnMotionChanged = function(msg)
|3927|3927| {
|3928|3928| 	if (msg.starting && !msg.error)
|3929|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3929|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg });
|3930|3930| 	else if (!msg.starting || msg.error)
|3931|3931| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3932|3932| };
|    | [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
|3928|3928| 	if (msg.starting && !msg.error)
|3929|3929| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3930|3930| 	else if (!msg.starting || msg.error)
|3931|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3931|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveCompleted", "data": msg});
|3932|3932| };
|3933|3933| 
|3934|3934| 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
|3928|3928| 	if (msg.starting && !msg.error)
|3929|3929| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3930|3930| 	else if (!msg.starting || msg.error)
|3931|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3931|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg });
|3932|3932| };
|3933|3933| 
|3934|3934| 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
|3936|3936| 	// TODO: This is a bit inefficient since every unit listens to every
|3937|3937| 	// construction message - ideally we could scope it to only the one we're building
|3938|3938| 
|3939|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3939|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3940|3940| };
|3941|3941| 
|3942|3942| 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
|3936|3936| 	// TODO: This is a bit inefficient since every unit listens to every
|3937|3937| 	// construction message - ideally we could scope it to only the one we're building
|3938|3938| 
|3939|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3939|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3940|3940| };
|3941|3941| 
|3942|3942| 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
|3961|3961| 
|3962|3962| UnitAI.prototype.OnAttacked = function(msg)
|3963|3963| {
|3964|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3964|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3965|3965| };
|3966|3966| 
|3967|3967| 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
|3961|3961| 
|3962|3962| UnitAI.prototype.OnAttacked = function(msg)
|3963|3963| {
|3964|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3964|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3965|3965| };
|3966|3966| 
|3967|3967| 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
|3966|3966| 
|3967|3967| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3968|3968| {
|3969|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3969|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|3970|3970| };
|3971|3971| 
|3972|3972| 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
|3966|3966| 
|3967|3967| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3968|3968| {
|3969|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3969|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|3970|3970| };
|3971|3971| 
|3972|3972| 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
|3971|3971| 
|3972|3972| UnitAI.prototype.OnHealthChanged = function(msg)
|3973|3973| {
|3974|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3974|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|3975|3975| };
|3976|3976| 
|3977|3977| 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
|3971|3971| 
|3972|3972| UnitAI.prototype.OnHealthChanged = function(msg)
|3973|3973| {
|3974|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3974|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|3975|3975| };
|3976|3976| 
|3977|3977| 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
|3977|3977| UnitAI.prototype.OnRangeUpdate = function(msg)
|3978|3978| {
|3979|3979| 	if (msg.tag == this.losRangeQuery)
|3980|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3980|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|3981|3981| 	else if (msg.tag == this.losHealRangeQuery)
|3982|3982| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3983|3983| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3977|3977| UnitAI.prototype.OnRangeUpdate = function(msg)
|3978|3978| {
|3979|3979| 	if (msg.tag == this.losRangeQuery)
|3980|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3980|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|3981|3981| 	else if (msg.tag == this.losHealRangeQuery)
|3982|3982| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3983|3983| };
|    | [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
|3979|3979| 	if (msg.tag == this.losRangeQuery)
|3980|3980| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3981|3981| 	else if (msg.tag == this.losHealRangeQuery)
|3982|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3982|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|3983|3983| };
|3984|3984| 
|3985|3985| 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
|3979|3979| 	if (msg.tag == this.losRangeQuery)
|3980|3980| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3981|3981| 	else if (msg.tag == this.losHealRangeQuery)
|3982|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3982|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|3983|3983| };
|3984|3984| 
|3985|3985| 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
|3984|3984| 
|3985|3985| UnitAI.prototype.OnPackFinished = function(msg)
|3986|3986| {
|3987|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3987|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|3988|3988| };
|3989|3989| 
|3990|3990| //// 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
|3984|3984| 
|3985|3985| UnitAI.prototype.OnPackFinished = function(msg)
|3986|3986| {
|3987|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3987|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|3988|3988| };
|3989|3989| 
|3990|3990| //// 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
|3987|3987| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|3988|3988| };
|3989|3989| 
|3990|    |-//// Helper functions to be called by the FSM ////
|    |3990|+// // Helper functions to be called by the FSM ////
|3991|3991| 
|3992|3992| UnitAI.prototype.GetWalkSpeed = function()
|3993|3993| {
|    | [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
|4091|4091| 	if (!cmpOwnership || cmpOwnership.GetOwner() == INVALID_PLAYER)
|4092|4092| 		return undefined;
|4093|4093| 
|4094|    |-	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position)
|    |4094|+	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
|4095|4095| 	if (!cmpPosition || !cmpPosition.IsInWorld())
|4096|4096| 		return undefined;
|4097|4097| 
|    | [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
|4176|4176| 			PlaySound(name, member);
|4177|4177| 	}
|4178|4178| 	else
|4179|    |-	{
|    |4179|+	
|4180|4180| 		// Otherwise use our own sounds
|4181|4181| 		PlaySound(name, this.entity);
|4182|    |-	}
|    |4182|+	
|4183|4183| };
|4184|4184| 
|4185|4185| /*
|    | [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
|4345|4345| 	else
|4346|4346| 		// return false? Or hope you come close enough?
|4347|4347| 		var parabolicMaxRange = 0;
|4348|    |-		//return false;
|    |4348|+		// return false;
|4349|4349| 
|4350|4350| 	// the parabole changes while walking, take something in the middle
|4351|4351| 	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
|4410|4410| 	if (this.IsFormationMember())
|4411|4411| 	{
|4412|4412| 		var cmpFormationUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|4413|    |-		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation()
|4414|    |-			&& cmpFormationUnitAI.order.data.target == target)
|    |4413|+		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation() &&
|    |4414|+			cmpFormationUnitAI.order.data.target == target)
|4415|4415| 			return true;
|4416|4416| 	}
|4417|4417| 
|    | [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
|4578|4578| UnitAI.prototype.AttackEntityInZone = function(ents)
|4579|4579| {
|4580|4580| 	var target = ents.find(target =>
|4581|    |-		this.CanAttack(target)
|4582|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4581|+		this.CanAttack(target) &&
|    |4582|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4583|4583| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4584|4584| 	);
|4585|4585| 	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
|4579|4579| {
|4580|4580| 	var target = ents.find(target =>
|4581|4581| 		this.CanAttack(target)
|4582|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4583|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4582|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4583|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4584|4584| 	);
|4585|4585| 	if (!target)
|4586|4586| 		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
|4643|4643| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4644|4644| 	if (this.isGuardOf)
|4645|4645| 	{
|4646|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4646|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4647|4647| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4648|4648| 		if (cmpUnitAI && cmpAttack &&
|4649|4649| 		    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
|4647|4647| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4648|4648| 		if (cmpUnitAI && cmpAttack &&
|4649|4649| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4650|    |-				return false;
|    |4650|+			return false;
|4651|4651| 	}
|4652|4652| 
|4653|4653| 	// 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
|4652|4652| 
|4653|4653| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4654|4654| 	if (this.GetStance().respondHoldGround)
|4655|    |-	{
|    |4655|+	
|4656|4656| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4657|4657| 			return true;
|4658|    |-	}
|    |4658|+	
|4659|4659| 
|4660|4660| 	// Stop if it's left our vision range, unless we're especially persistent
|4661|4661| 	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
|4659|4659| 
|4660|4660| 	// Stop if it's left our vision range, unless we're especially persistent
|4661|4661| 	if (!this.GetStance().respondChaseBeyondVision)
|4662|    |-	{
|    |4662|+	
|4663|4663| 		if (!this.CheckTargetIsInVisionRange(target))
|4664|4664| 			return true;
|4665|    |-	}
|    |4665|+	
|4666|4666| 
|4667|4667| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4668|4668| 	// 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
|4685|4685| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4686|4686| 	if (this.isGuardOf)
|4687|4687| 	{
|4688|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4688|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4689|4689| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4690|4690| 		if (cmpUnitAI && cmpAttack &&
|4691|4691| 		    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
|4698|4698| 	return false;
|4699|4699| };
|4700|4700| 
|4701|    |-//// External interface functions ////
|    |4701|+// // External interface functions ////
|4702|4702| 
|4703|4703| UnitAI.prototype.SetFormationController = function(ent)
|4704|4704| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4708|4708| 	// of our own formation (or ourself if not in formation)
|4709|4709| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4710|4710| 	if (cmpObstruction)
|4711|    |-	{
|    |4711|+	
|4712|4712| 		if (ent == INVALID_ENTITY)
|4713|4713| 			cmpObstruction.SetControlGroup(this.entity);
|4714|4714| 		else
|4715|4715| 			cmpObstruction.SetControlGroup(ent);
|4716|    |-	}
|    |4716|+	
|4717|4717| 
|4718|4718| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4719|4719| 	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
|4851|4851| 	// if we already had an old guard order, do nothing if the target is the same
|4852|4852| 	// and the order is running, otherwise remove the previous order
|4853|4853| 	if (this.isGuardOf)
|4854|    |-	{
|    |4854|+	
|4855|4855| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4856|4856| 			return;
|4857|4857| 		else
|4858|4858| 			this.RemoveGuard();
|4859|    |-	}
|    |4859|+	
|4860|4860| 
|4861|4861| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4862|4862| };
|    | [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
|4854|4854| 	{
|4855|4855| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4856|4856| 			return;
|4857|    |-		else
|4858|    |-			this.RemoveGuard();
|    |4857|+		this.RemoveGuard();
|4859|4858| 	}
|4860|4859| 
|4861|4860| 	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
|5025|5025| 			this.WalkToTarget(target, queued);
|5026|5026| 		return;
|5027|5027| 	}
|5028|    |-	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture}, queued);
|    |5028|+	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture }, queued);
|5029|5029| };
|5030|5030| 
|5031|5031| /**
|    | [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
|5174|5174| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5175|5175| 	{
|5176|5176| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5177|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5177|+		if (cmpTrader.HasBothMarkets() &&
|5178|5178| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5179|5179| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5180|5180| 		{
|    | [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
|5455|5455| 				{
|5456|5456| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5457|5457| 					var targetClasses = this.order.data.targetClasses;
|5458|    |-					if (targetClasses.attack && cmpIdentity
|5459|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5458|+					if (targetClasses.attack && cmpIdentity &&
|    |5459|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5460|5460| 						continue;
|5461|5461| 					if (targetClasses.avoid && cmpIdentity
|5462|5462| 						&& 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
|5458|5458| 					if (targetClasses.attack && cmpIdentity
|5459|5459| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5460|5460| 						continue;
|5461|    |-					if (targetClasses.avoid && cmpIdentity
|5462|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5461|+					if (targetClasses.avoid && cmpIdentity &&
|    |5462|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5463|5463| 						continue;
|5464|5464| 					// Only used by the AIs to prevent some choices of targets
|5465|5465| 					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
|5481|5481| 		{
|5482|5482| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5483|5483| 			var targetClasses = this.order.data.targetClasses;
|5484|    |-			if (cmpIdentity && targetClasses.attack
|5485|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5484|+			if (cmpIdentity && targetClasses.attack &&
|    |5485|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5486|5486| 				continue;
|5487|5487| 			if (cmpIdentity && targetClasses.avoid
|5488|5488| 				&& 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
|5484|5484| 			if (cmpIdentity && targetClasses.attack
|5485|5485| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5486|5486| 				continue;
|5487|    |-			if (cmpIdentity && targetClasses.avoid
|5488|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5487|+			if (cmpIdentity && targetClasses.avoid &&
|    |5488|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5489|5489| 				continue;
|5490|5490| 			// Only used by the AIs to prevent some choices of targets
|5491|5491| 			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
|5617|5617| 
|5618|5618| UnitAI.prototype.SetHeldPosition = function(x, z)
|5619|5619| {
|5620|    |-	this.heldPosition = {"x": x, "z": z};
|    |5620|+	this.heldPosition = { "x": x, "z": z};
|5621|5621| };
|5622|5622| 
|5623|5623| 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
|5617|5617| 
|5618|5618| UnitAI.prototype.SetHeldPosition = function(x, z)
|5619|5619| {
|5620|    |-	this.heldPosition = {"x": x, "z": z};
|    |5620|+	this.heldPosition = {"x": x, "z": z };
|5621|5621| };
|5622|5622| 
|5623|5623| 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
|5644|5644| 	return false;
|5645|5645| };
|5646|5646| 
|5647|    |-//// Helper functions ////
|    |5647|+// // Helper functions ////
|5648|5648| 
|5649|5649| UnitAI.prototype.CanAttack = function(target)
|5650|5650| {
|    | [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
|5848|5848| 	return cmpPack && cmpPack.IsPacking();
|5849|5849| };
|5850|5850| 
|5851|    |-//// Formation specific functions ////
|    |5851|+// // Formation specific functions ////
|5852|5852| 
|5853|5853| UnitAI.prototype.IsAttackingAsFormation = function()
|5854|5854| {
|    | [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
|5853|5853| UnitAI.prototype.IsAttackingAsFormation = function()
|5854|5854| {
|5855|5855| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5856|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5857|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5856|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5857|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5858|5858| };
|5859|5859| 
|5860|5860| //// 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
|5857|5857| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5858|5858| };
|5859|5859| 
|5860|    |-//// Animal specific functions ////
|    |5860|+// // Animal specific functions ////
|5861|5861| 
|5862|5862| UnitAI.prototype.MoveRandomly = function(distance)
|5863|5863| {

binaries/data/mods/public/simulation/components/UnitAI.js
|2417| »   »   »   »   »   »   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
|3791| »   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
|4565| »   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
|4580| »   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
|4626| »   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
|4649| »   »   ····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
|5105| »   var·lastPos·=·undefined;
|    | [NORMAL] ESLintBear (no-undef-init):
|    | It's not necessary to initialize 'lastPos' to undefined.

binaries/data/mods/public/simulation/components/UnitAI.js
| 369| »   »   ····&&·(this.lastShorelinePosition.z·==·cmpPosition.GetPosition().z))
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
|1885| »   »   »   »   »   »   var·cmpFormation·=·Engine.QueryInterface(this.formationController,·IID_Formation);
|    | [NORMAL] JSHintBear:
|    | 'cmpFormation' is already defined.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4358| »   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
|4414| »   »   »   &&·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
|4582| »   »   &&·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
|4583| »   »   &&·(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
|5105| »   var·lastPos·=·undefined;
|    | [NORMAL] JSHintBear:
|    | It's not necessary to initialize 'lastPos' to 'undefined'.

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

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

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

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

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

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

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

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

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

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

wraitii added a reviewer: Restricted Owners Package.May 26 2018, 6:55 AM
aeonios added a subscriber: aeonios.EditedMay 26 2018, 8:24 AM

Couldn't this be applied equally the other direction? That is, if a unit is unpacked and packing up, and then given an order to attack something within range, to automatically cancel packing?

EDIT: it should also respect halt orders both ways, if it doesn't already.

elexis updated the Trac tickets for this revision.May 26 2018, 11:27 AM
elexis added a subscriber: elexis.May 26 2018, 11:32 AM

The cancel unpacking part was requested in #4015 too IIRC, might want to check the discussion over there.

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

This file having 6k lines and only one global seems to indicate that it'd be better to avoid globals.
I didn't investigate the alternatives yet, but I wouldn't be surprised if the alternative is copy&pasting conditions to the states above.
Another possibility might be to store one boolean per state in the prototype, something like CancelsUnpacking(), dunno

Couldn't this be applied equally the other direction? That is, if a unit is unpacked and packing up, and then given an order to attack something within range, to automatically cancel packing?
EDIT: it should also respect halt orders both ways, if it doesn't already.

That's trickier. UnitAI currently makes an assumption about packing: if the unit is packing, the first order is assumed to be the packing order or a cancel packing order. PushOrderFront and ReplaceOrder are designed to enforce this assumption by refusing to change the first order if the unit is packing. This means that we can't actually be in Order.Attack, where it would be decided the unit needs to cancel packing, unless the unit is not currently packing. It can still be done, but perhaps not in a nice way.

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

Just because there is only one global is not a reason not to add more.

The alternative is having g_OrdersCancelUnpacking be a local variable in PushOrderFront, which is less efficient.

137

meant to say a local variable in ReplaceOrder

elexis added inline comments.May 26 2018, 12:39 PM
binaries/data/mods/public/simulation/components/UnitAI.js
137

Wouldn't it be feasible to call the cancel-unpacking order or code in the affected orders? It would keep the data structure more self-contained.

(Assembler is more efficient than JavaScript too, yet we optimize for readability and maintainability unless performance is non-neglibile (in which case things are moved to C++ if it can't be fixed in JS))

causative added inline comments.May 26 2018, 8:09 PM
binaries/data/mods/public/simulation/components/UnitAI.js
137

Not without restructuring how UnitAI deals with packing entirely - see the reply to aeonios

causative updated this revision to Diff 6655.May 27 2018, 4:40 AM

Added code to cancel packing/unpacking the unit as necessary when it is issued an attack order, depending on the range to the target. This code is not pretty due to having to work around the way UnitAI handles packing.

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

Linter detected issues:
Executing section Default...
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 232| 232| 		// Move a tile outside the building
| 233| 233| 		let range = 4;
| 234| 234| 		if (this.MoveToTargetRangeExplicit(msg.data.target, range, range))
| 235|    |-		{
|    | 235|+		
| 236| 236| 			// We've started walking to the given point
| 237| 237| 			this.SetNextState("INDIVIDUAL.WALKING");
| 238|    |-		}
|    | 238|+		
| 239| 239| 		else
| 240| 240| 		{
| 241| 241| 			// 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
| 237| 237| 			this.SetNextState("INDIVIDUAL.WALKING");
| 238| 238| 		}
| 239| 239| 		else
| 240|    |-		{
|    | 240|+		
| 241| 241| 			// We are already at the target, or can't move at all
| 242| 242| 			this.FinishOrder();
| 243|    |-		}
|    | 243|+		
| 244| 244| 	},
| 245| 245| 
| 246| 246| 	// Individual orders:
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 339| 339| 
| 340| 340| 		var ok = this.MoveToTarget(this.order.data.target);
| 341| 341| 		if (ok)
| 342|    |-		{
|    | 342|+		
| 343| 343| 			// We've started walking to the given point
| 344| 344| 			if (this.IsAnimal())
| 345| 345| 				this.SetNextState("ANIMAL.WALKING");
| 346| 346| 			else
| 347| 347| 				this.SetNextState("INDIVIDUAL.WALKING");
| 348|    |-		}
|    | 348|+		
| 349| 349| 		else
| 350| 350| 		{
| 351| 351| 			// We are already at the target, or can't move at all
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 367| 367| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 368| 368| 		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 369| 369| 		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 370|    |-		{
|    | 370|+		
| 371| 371| 			// we were already on the shoreline, and have not moved since
| 372| 372| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
| 373| 373| 				needToMove = false;
| 374|    |-		}
|    | 374|+		
| 375| 375| 
| 376| 376| 		// TODO: what if the units are on a cliff ? the ship will go below the cliff
| 377| 377| 		// and the units won't be able to garrison. Should go to the nearest (accessible) shore
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 365| 365| 		// Check if we need to move     TODO implement a better way to know if we are on the shoreline
| 366| 366| 		var needToMove = true;
| 367| 367| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 368|    |-		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 369|    |-		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
|    | 368|+		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x) &&
|    | 369|+		    (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 370| 370| 		{
| 371| 371| 			// we were already on the shoreline, and have not moved since
| 372| 372| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 376| 376| 		// TODO: what if the units are on a cliff ? the ship will go below the cliff
| 377| 377| 		// and the units won't be able to garrison. Should go to the nearest (accessible) shore
| 378| 378| 		if (needToMove && this.MoveToTarget(this.order.data.target))
| 379|    |-		{
|    | 379|+		
| 380| 380| 			this.SetNextState("INDIVIDUAL.PICKUP.APPROACHING");
| 381|    |-		}
|    | 381|+		
| 382| 382| 		else
| 383| 383| 		{
| 384| 384| 			// We are already at the target, or can't move at all
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 405| 405| 		var distance = DistanceBetweenEntities(this.entity, this.order.data.target) + (+this.template.FleeDistance);
| 406| 406| 		var cmpUnitMotion = Engine.QueryInterface(this.entity, IID_UnitMotion);
| 407| 407| 		if (cmpUnitMotion.MoveToTargetRange(this.order.data.target, distance, -1))
| 408|    |-		{
|    | 408|+		
| 409| 409| 			// We've started fleeing from the given target
| 410| 410| 			if (this.IsAnimal())
| 411| 411| 				this.SetNextState("ANIMAL.FLEEING");
| 412| 412| 			else
| 413| 413| 				this.SetNextState("INDIVIDUAL.FLEEING");
| 414|    |-		}
|    | 414|+		
| 415| 415| 		else
| 416| 416| 		{
| 417| 417| 			// We are already at the target, or can't move at all
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 425| 425| 		// so that if we abort the Attack order we can resume packing.
| 426| 426| 		let cmpPack = Engine.QueryInterface(this.entity, IID_Pack);
| 427| 427| 		if (cmpPack && cmpPack.IsPacking())
| 428|    |-		{
|    | 428|+		
| 429| 429| 			if (cmpPack.IsPacked())
| 430| 430| 				this.orderQueue.push({"type": "Unpack", "data": {force: "true"}});
| 431| 431| 			else
| 432| 432| 				this.orderQueue.push({"type": "Pack", "data": {force: "true"}});
| 433|    |-		}
|    | 433|+		
| 434| 434| 
| 435| 435| 		// Check the target is alive
| 436| 436| 		if (!this.TargetIsAlive(this.order.data.target))
|    | [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
| 427| 427| 		if (cmpPack && cmpPack.IsPacking())
| 428| 428| 		{
| 429| 429| 			if (cmpPack.IsPacked())
| 430|    |-				this.orderQueue.push({"type": "Unpack", "data": {force: "true"}});
|    | 430|+				this.orderQueue.push({ "type": "Unpack", "data": {force: "true"}});
| 431| 431| 			else
| 432| 432| 				this.orderQueue.push({"type": "Pack", "data": {force: "true"}});
| 433| 433| 		}
|    | [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
| 427| 427| 		if (cmpPack && cmpPack.IsPacking())
| 428| 428| 		{
| 429| 429| 			if (cmpPack.IsPacked())
| 430|    |-				this.orderQueue.push({"type": "Unpack", "data": {force: "true"}});
|    | 430|+				this.orderQueue.push({"type": "Unpack", "data": { force: "true"}});
| 431| 431| 			else
| 432| 432| 				this.orderQueue.push({"type": "Pack", "data": {force: "true"}});
| 433| 433| 		}
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'force' found.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 427| 427| 		if (cmpPack && cmpPack.IsPacking())
| 428| 428| 		{
| 429| 429| 			if (cmpPack.IsPacked())
| 430|    |-				this.orderQueue.push({"type": "Unpack", "data": {force: "true"}});
|    | 430|+				this.orderQueue.push({"type": "Unpack", "data": {"force": "true"}});
| 431| 431| 			else
| 432| 432| 				this.orderQueue.push({"type": "Pack", "data": {force: "true"}});
| 433| 433| 		}
|    | [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
| 427| 427| 		if (cmpPack && cmpPack.IsPacking())
| 428| 428| 		{
| 429| 429| 			if (cmpPack.IsPacked())
| 430|    |-				this.orderQueue.push({"type": "Unpack", "data": {force: "true"}});
|    | 430|+				this.orderQueue.push({"type": "Unpack", "data": {force: "true" }});
| 431| 431| 			else
| 432| 432| 				this.orderQueue.push({"type": "Pack", "data": {force: "true"}});
| 433| 433| 		}
|    | [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
| 427| 427| 		if (cmpPack && cmpPack.IsPacking())
| 428| 428| 		{
| 429| 429| 			if (cmpPack.IsPacked())
| 430|    |-				this.orderQueue.push({"type": "Unpack", "data": {force: "true"}});
|    | 430|+				this.orderQueue.push({"type": "Unpack", "data": {force: "true"} });
| 431| 431| 			else
| 432| 432| 				this.orderQueue.push({"type": "Pack", "data": {force: "true"}});
| 433| 433| 		}
|    | [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
| 429| 429| 			if (cmpPack.IsPacked())
| 430| 430| 				this.orderQueue.push({"type": "Unpack", "data": {force: "true"}});
| 431| 431| 			else
| 432|    |-				this.orderQueue.push({"type": "Pack", "data": {force: "true"}});
|    | 432|+				this.orderQueue.push({ "type": "Pack", "data": {force: "true"}});
| 433| 433| 		}
| 434| 434| 
| 435| 435| 		// Check the target is alive
|    | [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
| 429| 429| 			if (cmpPack.IsPacked())
| 430| 430| 				this.orderQueue.push({"type": "Unpack", "data": {force: "true"}});
| 431| 431| 			else
| 432|    |-				this.orderQueue.push({"type": "Pack", "data": {force: "true"}});
|    | 432|+				this.orderQueue.push({"type": "Pack", "data": { force: "true"}});
| 433| 433| 		}
| 434| 434| 
| 435| 435| 		// Check the target is alive
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'force' found.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 429| 429| 			if (cmpPack.IsPacked())
| 430| 430| 				this.orderQueue.push({"type": "Unpack", "data": {force: "true"}});
| 431| 431| 			else
| 432|    |-				this.orderQueue.push({"type": "Pack", "data": {force: "true"}});
|    | 432|+				this.orderQueue.push({"type": "Pack", "data": {"force": "true"}});
| 433| 433| 		}
| 434| 434| 
| 435| 435| 		// Check the target is alive
|    | [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
| 429| 429| 			if (cmpPack.IsPacked())
| 430| 430| 				this.orderQueue.push({"type": "Unpack", "data": {force: "true"}});
| 431| 431| 			else
| 432|    |-				this.orderQueue.push({"type": "Pack", "data": {force: "true"}});
|    | 432|+				this.orderQueue.push({"type": "Pack", "data": {force: "true" }});
| 433| 433| 		}
| 434| 434| 
| 435| 435| 		// Check the target is alive
|    | [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
| 429| 429| 			if (cmpPack.IsPacked())
| 430| 430| 				this.orderQueue.push({"type": "Unpack", "data": {force: "true"}});
| 431| 431| 			else
| 432|    |-				this.orderQueue.push({"type": "Pack", "data": {force: "true"}});
|    | 432|+				this.orderQueue.push({"type": "Pack", "data": {force: "true"} });
| 433| 433| 		}
| 434| 434| 
| 435| 435| 		// Check the target is alive
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 467| 467| 				return;
| 468| 468| 
| 469| 469| 			if (this.order.data.attackType == this.oldAttackType)
| 470|    |-			{
|    | 470|+			
| 471| 471| 				if (this.IsAnimal())
| 472| 472| 					this.SetNextState("ANIMAL.COMBAT.ATTACKING");
| 473| 473| 				else
| 474| 474| 					this.SetNextState("INDIVIDUAL.COMBAT.ATTACKING");
| 475|    |-			}
|    | 475|+			
| 476| 476| 			else
| 477| 477| 			{
| 478| 478| 				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
| 474| 474| 					this.SetNextState("INDIVIDUAL.COMBAT.ATTACKING");
| 475| 475| 			}
| 476| 476| 			else
| 477|    |-			{
|    | 477|+			
| 478| 478| 				if (this.IsAnimal())
| 479| 479| 					this.SetNextStateAlwaysEntering("ANIMAL.COMBAT.ATTACKING");
| 480| 480| 				else
| 481| 481| 					this.SetNextStateAlwaysEntering("INDIVIDUAL.COMBAT.ATTACKING");
| 482|    |-			}
|    | 482|+			
| 483| 483| 			return;
| 484| 484| 		}
| 485| 485| 
|    | [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
| 603| 603| 					this.PushOrderFront("Walk", this.order.data.lastPos);
| 604| 604| 				}
| 605| 605| 				else
| 606|    |-				{
|    | 606|+				
| 607| 607| 					// We couldn't move there, or the target moved away
| 608| 608| 					this.FinishOrder();
| 609|    |-				}
|    | 609|+				
| 610| 610| 				return;
| 611| 611| 			}
| 612| 612| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 616| 616| 
| 617| 617| 		// Try to move within range
| 618| 618| 		if (this.MoveToTargetRange(this.order.data.target, IID_ResourceGatherer))
| 619|    |-		{
|    | 619|+		
| 620| 620| 			// We've started walking to the given point
| 621| 621| 			this.SetNextState("INDIVIDUAL.GATHER.APPROACHING");
| 622|    |-		}
|    | 622|+		
| 623| 623| 		else
| 624| 624| 		{
| 625| 625| 			// 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
| 693| 693| 	"Order.Repair": function(msg) {
| 694| 694| 		// Try to move within range
| 695| 695| 		if (this.MoveToTargetRange(this.order.data.target, IID_Builder))
| 696|    |-		{
|    | 696|+		
| 697| 697| 			// We've started walking to the given point
| 698| 698| 			this.SetNextState("INDIVIDUAL.REPAIR.APPROACHING");
| 699|    |-		}
|    | 699|+		
| 700| 700| 		else
| 701| 701| 		{
| 702| 702| 			// 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
| 729| 729| 		}
| 730| 730| 
| 731| 731| 		if (this.MoveToGarrisonRange(this.order.data.target))
| 732|    |-		{
|    | 732|+		
| 733| 733| 			this.SetNextState("INDIVIDUAL.GARRISON.APPROACHING");
| 734|    |-		}
|    | 734|+		
| 735| 735| 		else
| 736| 736| 		{
| 737| 737| 			// 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
| 857| 857| 			if (!this.CheckTargetAttackRange(target, target))
| 858| 858| 			{
| 859| 859| 				if (this.TargetIsAlive(target) && this.CheckTargetVisible(target))
| 860|    |-				{
|    | 860|+				
| 861| 861| 					if (this.MoveToTargetAttackRange(target, target))
| 862| 862| 					{
| 863| 863| 						this.SetNextState("COMBAT.APPROACHING");
| 864| 864| 						return;
| 865| 865| 					}
| 866|    |-				}
|    | 866|+				
| 867| 867| 				this.FinishOrder();
| 868| 868| 				return;
| 869| 869| 			}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 882| 882| 			}
| 883| 883| 			// Check if we are already in range, otherwise walk there
| 884| 884| 			if (!this.CheckGarrisonRange(msg.data.target))
| 885|    |-			{
|    | 885|+			
| 886| 886| 				if (!this.CheckTargetVisible(msg.data.target))
| 887| 887| 				{
| 888| 888| 					this.FinishOrder();
| 897| 897| 						return;
| 898| 898| 					}
| 899| 899| 				}
| 900|    |-			}
|    | 900|+			
| 901| 901| 
| 902| 902| 			this.SetNextState("GARRISON.GARRISONING");
| 903| 903| 		},
|    | [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
| 889| 889| 					return;
| 890| 890| 				}
| 891| 891| 				else
| 892|    |-				{
|    | 892|+				
| 893| 893| 					// Out of range; move there in formation
| 894| 894| 					if (this.MoveToGarrisonRange(msg.data.target))
| 895| 895| 					{
| 896| 896| 						this.SetNextState("GARRISON.APPROACHING");
| 897| 897| 						return;
| 898| 898| 					}
| 899|    |-				}
|    | 899|+				
| 900| 900| 			}
| 901| 901| 
| 902| 902| 			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
| 888| 888| 					this.FinishOrder();
| 889| 889| 					return;
| 890| 890| 				}
| 891|    |-				else
| 892|    |-				{
|    | 891|+				
| 893| 892| 					// Out of range; move there in formation
| 894| 893| 					if (this.MoveToGarrisonRange(msg.data.target))
| 895| 894| 					{
| 896| 895| 						this.SetNextState("GARRISON.APPROACHING");
| 897| 896| 						return;
| 898| 897| 					}
| 899|    |-				}
|    | 898|+				
| 900| 899| 			}
| 901| 900| 
| 902| 901| 			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
| 915| 915| 						this.PushOrderFront("Walk", msg.data.lastPos);
| 916| 916| 					}
| 917| 917| 					else
| 918|    |-					{
|    | 918|+					
| 919| 919| 						// We couldn't move there, or the target moved away
| 920| 920| 						this.FinishOrder();
| 921|    |-					}
|    | 921|+					
| 922| 922| 					return;
| 923| 923| 				}
| 924| 924| 
|    | [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
|1136|1136| 			},
|1137|1137| 		},
|1138|1138| 
|1139|    |-		"GARRISON":{
|    |1139|+		"GARRISON": {
|1140|1140| 			"enter": function() {
|1141|1141| 				// If the garrisonholder should pickup, warn it so it can take needed action
|1142|1142| 				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
|1320|1320| 			// If the controller handled an order but some members rejected it,
|1321|1321| 			// they will have no orders and be in the FORMATIONMEMBER.IDLE state.
|1322|1322| 			if (this.orderQueue.length)
|1323|    |-			{
|    |1323|+			
|1324|1324| 				// We're leaving the formation, so stop our FormationWalk order
|1325|1325| 				if (this.FinishOrder())
|1326|1326| 					return;
|1327|    |-			}
|    |1327|+			
|1328|1328| 
|1329|1329| 			// No orders left, we're an individual now
|1330|1330| 			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
|1348|1348| 			// Move a tile outside the building
|1349|1349| 			let range = 4;
|1350|1350| 			if (this.MoveToTargetRangeExplicit(msg.data.target, range, range))
|1351|    |-			{
|    |1351|+			
|1352|1352| 				// We've started walking to the given point
|1353|1353| 				this.SetNextState("WALKINGTOPOINT");
|1354|    |-			}
|    |1354|+			
|1355|1355| 			else
|1356|1356| 			{
|1357|1357| 				// 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
|1353|1353| 				this.SetNextState("WALKINGTOPOINT");
|1354|1354| 			}
|1355|1355| 			else
|1356|    |-			{
|    |1356|+			
|1357|1357| 				// We are already at the target, or can't move at all
|1358|1358| 				this.FinishOrder();
|1359|    |-			}
|    |1359|+			
|1360|1360| 		},
|1361|1361| 
|1362|1362| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1554|1554| 
|1555|1555| 			"LosRangeUpdate": function(msg) {
|1556|1556| 				if (this.GetStance().targetVisibleEnemies)
|1557|    |-				{
|    |1557|+				
|1558|1558| 					// Start attacking one of the newly-seen enemy (if any)
|1559|1559| 					this.AttackEntitiesByPreference(msg.data.added);
|1560|    |-				}
|    |1560|+				
|1561|1561| 			},
|1562|1562| 
|1563|1563| 			"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
|1740|1740| 						// if nothing better to do, check if the guarded needs to be healed or repaired
|1741|1741| 						var cmpHealth = Engine.QueryInterface(this.isGuardOf, IID_Health);
|1742|1742| 						if (cmpHealth && (cmpHealth.GetHitpoints() < cmpHealth.GetMaxHitpoints()))
|1743|    |-						{
|    |1743|+						
|1744|1744| 							if (this.CanHeal(this.isGuardOf))
|1745|1745| 								this.PushOrderFront("Heal", { "target": this.isGuardOf, "force": false });
|1746|1746| 							else if (this.CanRepair(this.isGuardOf))
|1747|1747| 								this.PushOrderFront("Repair", { "target": this.isGuardOf, "autocontinue": false, "force": false });
|1748|    |-						}
|    |1748|+						
|1749|1749| 					}
|1750|1750| 				},
|1751|1751| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1828|1828| 				"MoveCompleted": function() {
|1829|1829| 
|1830|1830| 					if (this.CheckTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1831|    |-					{
|    |1831|+					
|1832|1832| 						// If the unit needs to unpack, do so
|1833|1833| 						if (this.CanUnpack())
|1834|1834| 						{
|1837|1837| 						}
|1838|1838| 						else
|1839|1839| 							this.SetNextState("ATTACKING");
|1840|    |-					}
|    |1840|+					
|1841|1841| 					else
|1842|1842| 					{
|1843|1843| 						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
|1835|1835| 							this.PushOrderFront("Unpack", { "force": true });
|1836|1836| 							return;
|1837|1837| 						}
|1838|    |-						else
|1839|    |-							this.SetNextState("ATTACKING");
|    |1838|+						this.SetNextState("ATTACKING");
|1840|1839| 					}
|1841|1840| 					else
|1842|1841| 					{
|    | [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
|1839|1839| 							this.SetNextState("ATTACKING");
|1840|1840| 					}
|1841|1841| 					else
|1842|    |-					{
|    |1842|+					
|1843|1843| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1844|1844| 						{
|1845|1845| 							this.SetNextState("APPROACHING");
|1849|1849| 							// Give up
|1850|1850| 							this.FinishOrder();
|1851|1851| 						}
|1852|    |-					}
|    |1852|+					
|1853|1853| 				},
|1854|1854| 			},
|1855|1855| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1841|1841| 					else
|1842|1842| 					{
|1843|1843| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1844|    |-						{
|    |1844|+						
|1845|1845| 							this.SetNextState("APPROACHING");
|1846|    |-						}
|    |1846|+						
|1847|1847| 						else
|1848|1848| 						{
|1849|1849| 							// 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
|1845|1845| 							this.SetNextState("APPROACHING");
|1846|1846| 						}
|1847|1847| 						else
|1848|    |-						{
|    |1848|+						
|1849|1849| 							// Give up
|1850|1850| 							this.FinishOrder();
|1851|    |-						}
|    |1851|+						
|1852|1852| 					}
|1853|1853| 				},
|1854|1854| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1866|1866| 					}
|1867|1867| 					// Check the target is still alive and attackable
|1868|1868| 					if (this.CanAttack(target) && !this.CheckTargetAttackRange(target, this.order.data.attackType))
|1869|    |-					{
|    |1869|+					
|1870|1870| 						// Can't reach it - try to chase after it
|1871|1871| 						if (this.ShouldChaseTargetedEntity(target, this.order.data.force))
|1872|1872| 						{
|1881|1881| 								return;
|1882|1882| 							}
|1883|1883| 						}
|1884|    |-					}
|    |1884|+					
|1885|1885| 
|1886|1886| 					var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|1887|1887| 					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
|1912|1912| 					// TODO: we should probably only bother syncing projectile attacks, not melee
|1913|1913| 
|1914|1914| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|1915|    |-					this.resyncAnimation = (prepare != this.attackTimers.prepare) ? true : false;
|    |1915|+					this.resyncAnimation = (prepare != this.attackTimers.prepare);
|1916|1916| 
|1917|1917| 					this.FaceTowardsTarget(this.order.data.target);
|1918|1918| 
|    | [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
|2041|2041| 
|2042|2042| 				"Attacked": function(msg) {
|2043|2043| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2044|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2045|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2044|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2045|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2046|2046| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2047|2047| 				},
|2048|2048| 			},
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2125|2125| 						// Also don't switch to a different type of huntable animal
|2126|2126| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2127|2127| 							return (
|2128|    |-								ent != oldTarget
|2129|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2128|+								ent != oldTarget &&
|    |2129|+								 ((type.generic == "treasure" && oldType.generic == "treasure")
|2130|2130| 								 || (type.specific == oldType.specific
|2131|2131| 								 && (type.specific != "meat" || oldTemplate == template)))
|2132|2132| 							);
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2126|2126| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2127|2127| 							return (
|2128|2128| 								ent != oldTarget
|2129|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2130|    |-								 || (type.specific == oldType.specific
|    |2129|+								 && ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2130|+								 (type.specific == oldType.specific
|2131|2131| 								 && (type.specific != "meat" || oldTemplate == template)))
|2132|2132| 							);
|2133|2133| 						}, 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
|2127|2127| 							return (
|2128|2128| 								ent != oldTarget
|2129|2129| 								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2130|    |-								 || (type.specific == oldType.specific
|2131|    |-								 && (type.specific != "meat" || oldTemplate == template)))
|    |2130|+								 || (type.specific == oldType.specific &&
|    |2131|+								 (type.specific != "meat" || oldTemplate == template)))
|2132|2132| 							);
|2133|2133| 						}, oldTarget);
|2134|2134| 						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
|2136|2136| 							this.PerformGather(nearby, false, false);
|2137|2137| 							return true;
|2138|2138| 						}
|2139|    |-						else
|2140|    |-						{
|    |2139|+						
|2141|2140| 							// It's probably better in this case, to avoid units getting stuck around a dropsite
|2142|2141| 							// in a "Target is far away, full, nearby are no good resources, return to dropsite" loop
|2143|2142| 							// to order it to GatherNear the resource position.
|2158|2157| 									return true;
|2159|2158| 								}
|2160|2159| 							}
|2161|    |-						}
|    |2160|+						
|2162|2161| 						return true;
|2163|2162| 					}
|2164|2163| 					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
|2148|2148| 								this.GatherNearPosition(pos.x, pos.z, oldType, oldTemplate);
|2149|2149| 								return true;
|2150|2150| 							}
|2151|    |-							else
|2152|    |-							{
|    |2151|+							
|2153|2152| 								// we're kind of stuck here. Return resource.
|2154|2153| 								var nearby = this.FindNearestDropsite(oldType.generic);
|2155|2154| 								if (nearby)
|2157|2156| 									this.PushOrderFront("ReturnResource", { "target": nearby, "force": false });
|2158|2157| 									return true;
|2159|2158| 								}
|2160|    |-							}
|    |2159|+							
|2161|2160| 						}
|2162|2161| 						return true;
|2163|2162| 					}
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2190|2190| 						// Also don't switch to a different type of huntable animal
|2191|2191| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2192|2192| 							return (
|2193|    |-								ent != oldTarget
|2194|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2193|+								ent != oldTarget &&
|    |2194|+								((type.generic == "treasure" && oldType.generic == "treasure")
|2195|2195| 								|| (type.specific == oldType.specific
|2196|2196| 								&& (type.specific != "meat" || oldTemplate == template)))
|2197|2197| 							);
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2191|2191| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2192|2192| 							return (
|2193|2193| 								ent != oldTarget
|2194|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2195|    |-								|| (type.specific == oldType.specific
|    |2194|+								&& ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2195|+								(type.specific == oldType.specific
|2196|2196| 								&& (type.specific != "meat" || oldTemplate == template)))
|2197|2197| 							);
|2198|2198| 						});
|    | [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
|2192|2192| 							return (
|2193|2193| 								ent != oldTarget
|2194|2194| 								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2195|    |-								|| (type.specific == oldType.specific
|2196|    |-								&& (type.specific != "meat" || oldTemplate == template)))
|    |2195|+								|| (type.specific == oldType.specific &&
|    |2196|+								(type.specific != "meat" || oldTemplate == template)))
|2197|2197| 							);
|2198|2198| 						});
|2199|2199| 						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
|2237|2237| 					// Also don't switch to a different type of huntable animal
|2238|2238| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2239|2239| 						return (
|2240|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2241|    |-							|| (type.specific == resourceType.specific
|    |2240|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2241|+							(type.specific == resourceType.specific
|2242|2242| 							&& (type.specific != "meat" || resourceTemplate == template))
|2243|2243| 						);
|2244|2244| 					});
|    | [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
|2238|2238| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2239|2239| 						return (
|2240|2240| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2241|    |-							|| (type.specific == resourceType.specific
|2242|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2241|+							|| (type.specific == resourceType.specific &&
|    |2242|+							(type.specific != "meat" || resourceTemplate == template))
|2243|2243| 						);
|2244|2244| 					});
|2245|2245| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2354|2354| 
|2355|2355| 					var cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply);
|2356|2356| 					if (cmpSupply && cmpSupply.IsAvailable(cmpOwnership.GetOwner(), this.entity))
|2357|    |-					{
|    |2357|+					
|2358|2358| 						// Check we can still reach and gather from the target
|2359|2359| 						if (this.CheckTargetRange(this.gatheringTarget, IID_ResourceGatherer) && this.CanGather(this.gatheringTarget))
|2360|2360| 						{
|2420|2420| 								return;
|2421|2421| 							}
|2422|2422| 						}
|2423|    |-					}
|    |2423|+					
|2424|2424| 
|2425|2425| 					// We're already in range, can't get anywhere near it or the target is exhausted.
|2426|2426| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2446|2446| 					// Also don't switch to a different type of huntable animal
|2447|2447| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2448|2448| 						return (
|2449|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2450|    |-							|| (type.specific == resourceType.specific
|    |2449|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2450|+							(type.specific == resourceType.specific
|2451|2451| 							&& (type.specific != "meat" || resourceTemplate == template))
|2452|2452| 						);
|2453|2453| 					});
|    | [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
|2447|2447| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2448|2448| 						return (
|2449|2449| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2450|    |-							|| (type.specific == resourceType.specific
|2451|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2450|+							|| (type.specific == resourceType.specific &&
|    |2451|+							(type.specific != "meat" || resourceTemplate == template))
|2452|2452| 						);
|2453|2453| 					});
|2454|2454| 					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
|2534|2534| 					this.StartTimer(prepare, this.healTimers.repeat);
|2535|2535| 
|2536|2536| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2537|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2537|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2538|2538| 
|2539|2539| 					this.FaceTowardsTarget(this.order.data.target);
|2540|2540| 				},
|    | [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
|2749|2749| 					{
|2750|2750| 						// The building was already finished/fully repaired before we arrived;
|2751|2751| 						// let the ConstructionFinished handler handle this.
|2752|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2752|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2753|2753| 						return true;
|2754|2754| 					}
|2755|2755| 
|    | [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
|2749|2749| 					{
|2750|2750| 						// The building was already finished/fully repaired before we arrived;
|2751|2751| 						// let the ConstructionFinished handler handle this.
|2752|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2752|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2753|2753| 						return true;
|2754|2754| 					}
|2755|2755| 
|    | [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
|2789|2789| 					if (this.MoveToTargetRange(this.repairTarget, IID_Builder))
|2790|2790| 						this.SetNextState("APPROACHING");
|2791|2791| 					else if (!this.CheckTargetRange(this.repairTarget, IID_Builder))
|2792|    |-						this.FinishOrder(); //can't approach and isn't in reach
|    |2792|+						this.FinishOrder(); // can't approach and isn't in reach
|2793|2793| 				},
|2794|2794| 			},
|2795|2795| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2876|2876| 
|2877|2877| 				// Unit was approaching and there's nothing to do now, so switch to walking
|2878|2878| 				if (oldState === "INDIVIDUAL.REPAIR.APPROACHING")
|2879|    |-				{
|    |2879|+				
|2880|2880| 					// We're already walking to the given point, so add this as a order.
|2881|2881| 					this.WalkToTarget(msg.data.newentity, true);
|2882|    |-				}
|    |2882|+				
|2883|2883| 			},
|2884|2884| 		},
|2885|2885| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2929|2929| 
|2930|2930| 					// Check that we can garrison here
|2931|2931| 					if (this.CanGarrison(target))
|2932|    |-					{
|    |2932|+					
|2933|2933| 						// Check that we're in range of the garrison target
|2934|2934| 						if (this.CheckGarrisonRange(target))
|2935|2935| 						{
|3005|3005| 								return false;
|3006|3006| 							}
|3007|3007| 						}
|3008|    |-					}
|    |3008|+					
|3009|3009| 					// Garrisoning failed for some reason, so finish the order
|3010|3010| 					this.FinishOrder();
|3011|3011| 					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
|3112|3112| 		"Attacked": function(msg) {
|3113|3113| 			if (this.template.NaturalBehaviour == "skittish" ||
|3114|3114| 			    this.template.NaturalBehaviour == "passive")
|3115|    |-			{
|    |3115|+			
|3116|3116| 				this.Flee(msg.data.attacker, false);
|3117|    |-			}
|    |3117|+			
|3118|3118| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|3119|3119| 			{
|3120|3120| 				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
|3121|3121| 					this.Attack(msg.data.attacker, false);
|3122|3122| 			}
|3123|3123| 			else if (this.template.NaturalBehaviour == "domestic")
|3124|    |-			{
|    |3124|+			
|3125|3125| 				// Never flee, stop what we were doing
|3126|3126| 				this.SetNextState("IDLE");
|3127|    |-			}
|    |3127|+			
|3128|3128| 		},
|3129|3129| 
|3130|3130| 		"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
|3131|3131| 			// Move a tile outside the building
|3132|3132| 			var range = 4;
|3133|3133| 			if (this.MoveToTargetRangeExplicit(msg.data.target, range, range))
|3134|    |-			{
|    |3134|+			
|3135|3135| 				// We've started walking to the given point
|3136|3136| 				this.SetNextState("WALKING");
|3137|    |-			}
|    |3137|+			
|3138|3138| 			else
|3139|3139| 			{
|3140|3140| 				// 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
|3136|3136| 				this.SetNextState("WALKING");
|3137|3137| 			}
|3138|3138| 			else
|3139|    |-			{
|    |3139|+			
|3140|3140| 				// We are already at the target, or can't move at all
|3141|3141| 				this.FinishOrder();
|3142|    |-			}
|    |3142|+			
|3143|3143| 		},
|3144|3144| 
|3145|3145| 		"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
|3178|3178| 				}
|3179|3179| 				// Start attacking one of the newly-seen enemy (if any)
|3180|3180| 				else if (this.IsDangerousAnimal())
|3181|    |-				{
|    |3181|+				
|3182|3182| 					this.AttackVisibleEntity(msg.data.added);
|3183|    |-				}
|    |3183|+				
|3184|3184| 
|3185|3185| 				// TODO: if two units enter our range together, we'll attack the
|3186|3186| 				// 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
|3221|3221| 				}
|3222|3222| 				// Start attacking one of the newly-seen enemy (if any)
|3223|3223| 				else if (this.template.NaturalBehaviour == "violent")
|3224|    |-				{
|    |3224|+				
|3225|3225| 					this.AttackVisibleEntity(msg.data.added);
|3226|    |-				}
|    |3226|+				
|3227|3227| 			},
|3228|3228| 
|3229|3229| 			"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
|3238|3238| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3239|3239| 
|3240|3240| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3241|    |-							// only used for domestic animals
|    |3241|+		// only used for domestic animals
|3242|3242| 	},
|3243|3243| };
|3244|3244| 
|    | [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
|3295|3295| 
|3296|3296| UnitAI.prototype.IsAnimal = function()
|3297|3297| {
|3298|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3298|+	return (!!this.template.NaturalBehaviour);
|3299|3299| };
|3300|3300| 
|3301|3301| 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
|3333|3333| UnitAI.prototype.GetGarrisonHolder = function()
|3334|3334| {
|3335|3335| 	if (this.IsGarrisoned())
|3336|    |-	{
|    |3336|+	
|3337|3337| 		for (let order of this.orderQueue)
|3338|3338| 			if (order.type == "Garrison")
|3339|3339| 				return order.data.target;
|3340|    |-	}
|    |3340|+	
|3341|3341| 	return INVALID_ENTITY;
|3342|3342| };
|3343|3343| 
|    | [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
|3411|3411| 		{
|3412|3412| 			let index = this.GetCurrentState().indexOf(".");
|3413|3413| 			if (index != -1)
|3414|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3414|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3415|3415| 			this.Stop(false);
|3416|3416| 		}
|3417|3417| 
|    | [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
|3467|3467| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3468|3468| 			continue;
|3469|3469| 		if (i == 0)
|3470|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3470|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3471|3471| 		else
|3472|3472| 			this.orderQueue.splice(i, 1);
|3473|3473| 		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
|3467|3467| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3468|3468| 			continue;
|3469|3469| 		if (i == 0)
|3470|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3470|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3471|3471| 		else
|3472|3472| 			this.orderQueue.splice(i, 1);
|3473|3473| 		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
|3551|3551| };
|3552|3552| 
|3553|3553| 
|3554|    |-//// FSM linkage functions ////
|    |3554|+// // FSM linkage functions ////
|3555|3555| 
|3556|3556| UnitAI.prototype.SetNextState = function(state)
|3557|3557| {
|    | [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
|3725|3725| 				continue;
|3726|3726| 			if (this.orderQueue[i].type == type)
|3727|3727| 				continue;
|3728|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3728|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3729|3729| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3730|3730| 			return;
|3731|3731| 		}
|    | [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
|3725|3725| 				continue;
|3726|3726| 			if (this.orderQueue[i].type == type)
|3727|3727| 				continue;
|3728|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3728|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3729|3729| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3730|3730| 			return;
|3731|3731| 		}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3749|3749| UnitAI.prototype.packForAttack = function(cmpPack, preferUnpacked)
|3750|3750| {
|3751|3751| 	if (cmpPack && cmpPack.IsPacking())
|3752|    |-	{
|    |3752|+	
|3753|3753| 		if(cmpPack.IsPacked() ^ preferUnpacked)
|3754|3754| 		{
|3755|3755| 			// The unit is already in the packed/unpacked state we want.
|3767|3767| 			this.orderQueue[1] = tmp;
|3768|3768| 			return false;
|3769|3769| 		}
|3770|    |-	}
|    |3770|+	
|3771|3771| 	return true;
|3772|3772| };
|3773|3773| 
|    | [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
|3754|3754| 		{
|3755|3755| 			// The unit is already in the packed/unpacked state we want.
|3756|3756| 			// Delete the packing order.
|3757|    |-			this.orderQueue.splice(1,1);
|    |3757|+			this.orderQueue.splice(1, 1);
|3758|3758| 			cmpPack.CancelPack();
|3759|3759| 			// Continue with the attack order.
|3760|3760| 			return true;
|    | [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
|3759|3759| 			// Continue with the attack order.
|3760|3760| 			return true;
|3761|3761| 		}
|3762|    |-		else
|3763|    |-		{
|    |3762|+		
|3764|3763| 			// Move the attack order behind the unpacking order, to continue unpacking.
|3765|3764| 			let tmp = this.orderQueue[0];
|3766|3765| 			this.orderQueue[0] = this.orderQueue[1];
|3767|3766| 			this.orderQueue[1] = tmp;
|3768|3767| 			return false;
|3769|    |-		}
|    |3768|+		
|3770|3769| 	}
|3771|3770| 	return true;
|3772|3771| };
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3775|3775| {
|3776|3776| 	// Remember the previous work orders to be able to go back to them later if required
|3777|3777| 	if (data && data.force)
|3778|    |-	{
|    |3778|+	
|3779|3779| 		if (this.IsFormationController())
|3780|3780| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3781|3781| 		else
|3782|3782| 			this.UpdateWorkOrders(type);
|3783|    |-	}
|    |3783|+	
|3784|3784| 
|3785|3785| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3786|3786| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3867|3867| 	{
|3868|3868| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3869|3869| 		if (cmpUnitAI)
|3870|    |-		{
|    |3870|+		
|3871|3871| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3872|3872| 			{
|3873|3873| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3876|3876| 					return;
|3877|3877| 				}
|3878|3878| 			}
|3879|    |-		}
|    |3879|+		
|3880|3880| 	}
|3881|3881| 
|3882|3882| 	// 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
|3869|3869| 		if (cmpUnitAI)
|3870|3870| 		{
|3871|3871| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3872|    |-			{
|    |3872|+			
|3873|3873| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3874|3874| 				{
|3875|3875| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3876|3876| 					return;
|3877|3877| 				}
|3878|    |-			}
|    |3878|+			
|3879|3879| 		}
|3880|3880| 	}
|3881|3881| 
|    | [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
|3881|3881| 
|3882|3882| 	// If nothing found, take the unit orders
|3883|3883| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3884|    |-	{
|    |3884|+	
|3885|3885| 		if (isWorkType(this.orderQueue[i].type))
|3886|3886| 		{
|3887|3887| 			this.workOrders = this.orderQueue.slice(i);
|3888|3888| 			return;
|3889|3889| 		}
|3890|    |-	}
|    |3890|+	
|3891|3891| };
|3892|3892| 
|3893|3893| 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
|3947|3947| 	if (data.timerRepeat === undefined)
|3948|3948| 		this.timer = undefined;
|3949|3949| 
|3950|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3950|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3951|3951| };
|3952|3952| 
|3953|3953| /**
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3947|3947| 	if (data.timerRepeat === undefined)
|3948|3948| 		this.timer = undefined;
|3949|3949| 
|3950|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3950|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3951|3951| };
|3952|3952| 
|3953|3953| /**
|    | [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
|3982|3982| 	this.timer = undefined;
|3983|3983| };
|3984|3984| 
|3985|    |-//// Message handlers /////
|    |3985|+// // Message handlers /////
|3986|3986| 
|3987|3987| UnitAI.prototype.OnMotionChanged = function(msg)
|3988|3988| {
|    | [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
|3987|3987| UnitAI.prototype.OnMotionChanged = function(msg)
|3988|3988| {
|3989|3989| 	if (msg.starting && !msg.error)
|3990|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3990|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveStarted", "data": msg});
|3991|3991| 	else if (!msg.starting || msg.error)
|3992|3992| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3993|3993| };
|    | [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
|3987|3987| UnitAI.prototype.OnMotionChanged = function(msg)
|3988|3988| {
|3989|3989| 	if (msg.starting && !msg.error)
|3990|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3990|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg });
|3991|3991| 	else if (!msg.starting || msg.error)
|3992|3992| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3993|3993| };
|    | [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
|3989|3989| 	if (msg.starting && !msg.error)
|3990|3990| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3991|3991| 	else if (!msg.starting || msg.error)
|3992|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3992|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveCompleted", "data": msg});
|3993|3993| };
|3994|3994| 
|3995|3995| 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
|3989|3989| 	if (msg.starting && !msg.error)
|3990|3990| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3991|3991| 	else if (!msg.starting || msg.error)
|3992|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3992|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg });
|3993|3993| };
|3994|3994| 
|3995|3995| 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
|3997|3997| 	// TODO: This is a bit inefficient since every unit listens to every
|3998|3998| 	// construction message - ideally we could scope it to only the one we're building
|3999|3999| 
|4000|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4000|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4001|4001| };
|4002|4002| 
|4003|4003| 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
|3997|3997| 	// TODO: This is a bit inefficient since every unit listens to every
|3998|3998| 	// construction message - ideally we could scope it to only the one we're building
|3999|3999| 
|4000|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4000|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4001|4001| };
|4002|4002| 
|4003|4003| 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
|4022|4022| 
|4023|4023| UnitAI.prototype.OnAttacked = function(msg)
|4024|4024| {
|4025|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4025|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4026|4026| };
|4027|4027| 
|4028|4028| 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
|4022|4022| 
|4023|4023| UnitAI.prototype.OnAttacked = function(msg)
|4024|4024| {
|4025|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4025|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4026|4026| };
|4027|4027| 
|4028|4028| 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
|4027|4027| 
|4028|4028| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4029|4029| {
|4030|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4030|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4031|4031| };
|4032|4032| 
|4033|4033| 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
|4027|4027| 
|4028|4028| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4029|4029| {
|4030|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4030|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4031|4031| };
|4032|4032| 
|4033|4033| 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
|4032|4032| 
|4033|4033| UnitAI.prototype.OnHealthChanged = function(msg)
|4034|4034| {
|4035|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4035|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4036|4036| };
|4037|4037| 
|4038|4038| 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
|4032|4032| 
|4033|4033| UnitAI.prototype.OnHealthChanged = function(msg)
|4034|4034| {
|4035|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4035|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4036|4036| };
|4037|4037| 
|4038|4038| 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
|4038|4038| UnitAI.prototype.OnRangeUpdate = function(msg)
|4039|4039| {
|4040|4040| 	if (msg.tag == this.losRangeQuery)
|4041|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4041|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4042|4042| 	else if (msg.tag == this.losHealRangeQuery)
|4043|4043| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4044|4044| };
|    | [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
|4038|4038| UnitAI.prototype.OnRangeUpdate = function(msg)
|4039|4039| {
|4040|4040| 	if (msg.tag == this.losRangeQuery)
|4041|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4041|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4042|4042| 	else if (msg.tag == this.losHealRangeQuery)
|4043|4043| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4044|4044| };
|    | [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
|4040|4040| 	if (msg.tag == this.losRangeQuery)
|4041|4041| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4042|4042| 	else if (msg.tag == this.losHealRangeQuery)
|4043|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4043|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4044|4044| };
|4045|4045| 
|4046|4046| 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
|4040|4040| 	if (msg.tag == this.losRangeQuery)
|4041|4041| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4042|4042| 	else if (msg.tag == this.losHealRangeQuery)
|4043|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4043|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4044|4044| };
|4045|4045| 
|4046|4046| 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
|4045|4045| 
|4046|4046| UnitAI.prototype.OnPackFinished = function(msg)
|4047|4047| {
|4048|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4048|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4049|4049| };
|4050|4050| 
|4051|4051| //// 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
|4045|4045| 
|4046|4046| UnitAI.prototype.OnPackFinished = function(msg)
|4047|4047| {
|4048|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4048|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4049|4049| };
|4050|4050| 
|4051|4051| //// 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
|4048|4048| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4049|4049| };
|4050|4050| 
|4051|    |-//// Helper functions to be called by the FSM ////
|    |4051|+// // Helper functions to be called by the FSM ////
|4052|4052| 
|4053|4053| UnitAI.prototype.GetWalkSpeed = function()
|4054|4054| {
|    | [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
|4152|4152| 	if (!cmpOwnership || cmpOwnership.GetOwner() == INVALID_PLAYER)
|4153|4153| 		return undefined;
|4154|4154| 
|4155|    |-	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position)
|    |4155|+	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
|4156|4156| 	if (!cmpPosition || !cmpPosition.IsInWorld())
|4157|4157| 		return undefined;
|4158|4158| 
|    | [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
|4237|4237| 			PlaySound(name, member);
|4238|4238| 	}
|4239|4239| 	else
|4240|    |-	{
|    |4240|+	
|4241|4241| 		// Otherwise use our own sounds
|4242|4242| 		PlaySound(name, this.entity);
|4243|    |-	}
|    |4243|+	
|4244|4244| };
|4245|4245| 
|4246|4246| /*
|    | [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
|4406|4406| 	else
|4407|4407| 		// return false? Or hope you come close enough?
|4408|4408| 		var parabolicMaxRange = 0;
|4409|    |-		//return false;
|    |4409|+		// return false;
|4410|4410| 
|4411|4411| 	// the parabole changes while walking, take something in the middle
|4412|4412| 	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
|4471|4471| 	if (this.IsFormationMember())
|4472|4472| 	{
|4473|4473| 		var cmpFormationUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|4474|    |-		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation()
|4475|    |-			&& cmpFormationUnitAI.order.data.target == target)
|    |4474|+		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation() &&
|    |4475|+			cmpFormationUnitAI.order.data.target == target)
|4476|4476| 			return true;
|4477|4477| 	}
|4478|4478| 
|    | [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
|4639|4639| UnitAI.prototype.AttackEntityInZone = function(ents)
|4640|4640| {
|4641|4641| 	var target = ents.find(target =>
|4642|    |-		this.CanAttack(target)
|4643|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4642|+		this.CanAttack(target) &&
|    |4643|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4644|4644| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4645|4645| 	);
|4646|4646| 	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
|4640|4640| {
|4641|4641| 	var target = ents.find(target =>
|4642|4642| 		this.CanAttack(target)
|4643|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4644|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4643|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4644|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4645|4645| 	);
|4646|4646| 	if (!target)
|4647|4647| 		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
|4704|4704| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4705|4705| 	if (this.isGuardOf)
|4706|4706| 	{
|4707|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4707|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4708|4708| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4709|4709| 		if (cmpUnitAI && cmpAttack &&
|4710|4710| 		    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
|4708|4708| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4709|4709| 		if (cmpUnitAI && cmpAttack &&
|4710|4710| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4711|    |-				return false;
|    |4711|+			return false;
|4712|4712| 	}
|4713|4713| 
|4714|4714| 	// 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
|4713|4713| 
|4714|4714| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4715|4715| 	if (this.GetStance().respondHoldGround)
|4716|    |-	{
|    |4716|+	
|4717|4717| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4718|4718| 			return true;
|4719|    |-	}
|    |4719|+	
|4720|4720| 
|4721|4721| 	// Stop if it's left our vision range, unless we're especially persistent
|4722|4722| 	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
|4720|4720| 
|4721|4721| 	// Stop if it's left our vision range, unless we're especially persistent
|4722|4722| 	if (!this.GetStance().respondChaseBeyondVision)
|4723|    |-	{
|    |4723|+	
|4724|4724| 		if (!this.CheckTargetIsInVisionRange(target))
|4725|4725| 			return true;
|4726|    |-	}
|    |4726|+	
|4727|4727| 
|4728|4728| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4729|4729| 	// 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
|4746|4746| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4747|4747| 	if (this.isGuardOf)
|4748|4748| 	{
|4749|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4749|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4750|4750| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4751|4751| 		if (cmpUnitAI && cmpAttack &&
|4752|4752| 		    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
|4759|4759| 	return false;
|4760|4760| };
|4761|4761| 
|4762|    |-//// External interface functions ////
|    |4762|+// // External interface functions ////
|4763|4763| 
|4764|4764| UnitAI.prototype.SetFormationController = function(ent)
|4765|4765| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4769|4769| 	// of our own formation (or ourself if not in formation)
|4770|4770| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4771|4771| 	if (cmpObstruction)
|4772|    |-	{
|    |4772|+	
|4773|4773| 		if (ent == INVALID_ENTITY)
|4774|4774| 			cmpObstruction.SetControlGroup(this.entity);
|4775|4775| 		else
|4776|4776| 			cmpObstruction.SetControlGroup(ent);
|4777|    |-	}
|    |4777|+	
|4778|4778| 
|4779|4779| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4780|4780| 	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
|4912|4912| 	// if we already had an old guard order, do nothing if the target is the same
|4913|4913| 	// and the order is running, otherwise remove the previous order
|4914|4914| 	if (this.isGuardOf)
|4915|    |-	{
|    |4915|+	
|4916|4916| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4917|4917| 			return;
|4918|4918| 		else
|4919|4919| 			this.RemoveGuard();
|4920|    |-	}
|    |4920|+	
|4921|4921| 
|4922|4922| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4923|4923| };
|    | [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
|4915|4915| 	{
|4916|4916| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4917|4917| 			return;
|4918|    |-		else
|4919|    |-			this.RemoveGuard();
|    |4918|+		this.RemoveGuard();
|4920|4919| 	}
|4921|4920| 
|4922|4921| 	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
|5086|5086| 			this.WalkToTarget(target, queued);
|5087|5087| 		return;
|5088|5088| 	}
|5089|    |-	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture}, queued);
|    |5089|+	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture }, queued);
|5090|5090| };
|5091|5091| 
|5092|5092| /**
|    | [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
|5235|5235| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5236|5236| 	{
|5237|5237| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5238|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5238|+		if (cmpTrader.HasBothMarkets() &&
|5239|5239| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5240|5240| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5241|5241| 		{
|    | [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
|5516|5516| 				{
|5517|5517| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5518|5518| 					var targetClasses = this.order.data.targetClasses;
|5519|    |-					if (targetClasses.attack && cmpIdentity
|5520|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5519|+					if (targetClasses.attack && cmpIdentity &&
|    |5520|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5521|5521| 						continue;
|5522|5522| 					if (targetClasses.avoid && cmpIdentity
|5523|5523| 						&& 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
|5519|5519| 					if (targetClasses.attack && cmpIdentity
|5520|5520| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5521|5521| 						continue;
|5522|    |-					if (targetClasses.avoid && cmpIdentity
|5523|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5522|+					if (targetClasses.avoid && cmpIdentity &&
|    |5523|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5524|5524| 						continue;
|5525|5525| 					// Only used by the AIs to prevent some choices of targets
|5526|5526| 					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
|5542|5542| 		{
|5543|5543| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5544|5544| 			var targetClasses = this.order.data.targetClasses;
|5545|    |-			if (cmpIdentity && targetClasses.attack
|5546|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5545|+			if (cmpIdentity && targetClasses.attack &&
|    |5546|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5547|5547| 				continue;
|5548|5548| 			if (cmpIdentity && targetClasses.avoid
|5549|5549| 				&& 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
|5545|5545| 			if (cmpIdentity && targetClasses.attack
|5546|5546| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5547|5547| 				continue;
|5548|    |-			if (cmpIdentity && targetClasses.avoid
|5549|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5548|+			if (cmpIdentity && targetClasses.avoid &&
|    |5549|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5550|5550| 				continue;
|5551|5551| 			// Only used by the AIs to prevent some choices of targets
|5552|5552| 			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
|5678|5678| 
|5679|5679| UnitAI.prototype.SetHeldPosition = function(x, z)
|5680|5680| {
|5681|    |-	this.heldPosition = {"x": x, "z": z};
|    |5681|+	this.heldPosition = { "x": x, "z": z};
|5682|5682| };
|5683|5683| 
|5684|5684| 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
|5678|5678| 
|5679|5679| UnitAI.prototype.SetHeldPosition = function(x, z)
|5680|5680| {
|5681|    |-	this.heldPosition = {"x": x, "z": z};
|    |5681|+	this.heldPosition = {"x": x, "z": z };
|5682|5682| };
|5683|5683| 
|5684|5684| 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
|5705|5705| 	return false;
|5706|5706| };
|5707|5707| 
|5708|    |-//// Helper functions ////
|    |5708|+// // Helper functions ////
|5709|5709| 
|5710|5710| UnitAI.prototype.CanAttack = function(target)
|5711|5711| {
|    | [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
|5909|5909| 	return cmpPack && cmpPack.IsPacking();
|5910|5910| };
|5911|5911| 
|5912|    |-//// Formation specific functions ////
|    |5912|+// // Formation specific functions ////
|5913|5913| 
|5914|5914| UnitAI.prototype.IsAttackingAsFormation = function()
|5915|5915| {
|    | [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
|5914|5914| UnitAI.prototype.IsAttackingAsFormation = function()
|5915|5915| {
|5916|5916| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5917|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5918|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5917|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5918|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5919|5919| };
|5920|5920| 
|5921|5921| //// 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
|5918|5918| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5919|5919| };
|5920|5920| 
|5921|    |-//// Animal specific functions ////
|    |5921|+// // Animal specific functions ////
|5922|5922| 
|5923|5923| UnitAI.prototype.MoveRandomly = function(distance)
|5924|5924| {

binaries/data/mods/public/simulation/components/UnitAI.js
|2436| »   »   »   »   »   »   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
|3852| »   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
|4626| »   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
|4641| »   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
|4687| »   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
|4710| »   »   ····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
|5166| »   var·lastPos·=·undefined;
|    | [NORMAL] ESLintBear (no-undef-init):
|    | It's not necessary to initialize 'lastPos' to undefined.

binaries/data/mods/public/simulation/components/UnitAI.js
| 369| »   »   ····&&·(this.lastShorelinePosition.z·==·cmpPosition.GetPosition().z))
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
|1904| »   »   »   »   »   »   var·cmpFormation·=·Engine.QueryInterface(this.formationController,·IID_Formation);
|    | [NORMAL] JSHintBear:
|    | 'cmpFormation' is already defined.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4419| »   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
|4475| »   »   »   &&·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
|4643| »   »   &&·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
|4644| »   »   &&·(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
|5166| »   var·lastPos·=·undefined;
|    | [NORMAL] JSHintBear:
|    | It's not necessary to initialize 'lastPos' to 'undefined'.

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

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

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

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

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

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

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

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

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

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

elexis updated the Trac tickets for this revision.Jan 18 2019, 5:38 PM