Page MenuHomeWildfire Games

Fix Fsm error message when a guard ent is killed
ClosedPublic

Authored by mimo on Apr 7 2018, 2:54 PM.

Details

Summary

When a guard ent is killed while it was in an attack state, we got the error
UnitAI.prototype.UnitFsmSpec.INDIVIDUAL.IDLE.enter@simulation/components/UnitAI.js

This is a consequence of the move OutOfWorld of killed units and the subsequent changes.

Test Plan

The problem can be reproduced on r21666 with (on turn about 37000)

pyrogenesis -autostart=random/islands -autostart-seed=18182 -autostart-aiseed=6828 -autostart-players=4 -autostart-ai=1:petra -autostart-civ=1:sele -autostart-ai=2:petra -autostart-civ=2:sele -autostart-ai=3:petra -autostart-civ=3:maur -autostart-ai=4:petra -autostart-civ=4:sele -autostart-nonvisual -autostart-victory=regicide

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

mimo created this revision.Apr 7 2018, 2:54 PM
Vulcan added a subscriber: Vulcan.Apr 7 2018, 2:57 PM

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

Linter detected issues:
Executing section Default...
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 228| 228| 		// Move a tile outside the building
| 229| 229| 		let range = 4;
| 230| 230| 		if (this.MoveToTargetRangeExplicit(msg.data.target, range, range))
| 231|    |-		{
|    | 231|+		
| 232| 232| 			// We've started walking to the given point
| 233| 233| 			this.SetNextState("INDIVIDUAL.WALKING");
| 234|    |-		}
|    | 234|+		
| 235| 235| 		else
| 236| 236| 		{
| 237| 237| 			// We are already at the target, or can't move at all
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 233| 233| 			this.SetNextState("INDIVIDUAL.WALKING");
| 234| 234| 		}
| 235| 235| 		else
| 236|    |-		{
|    | 236|+		
| 237| 237| 			// We are already at the target, or can't move at all
| 238| 238| 			this.FinishOrder();
| 239|    |-		}
|    | 239|+		
| 240| 240| 	},
| 241| 241| 
| 242| 242| 	// Individual orders:
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 335| 335| 
| 336| 336| 		var ok = this.MoveToTarget(this.order.data.target);
| 337| 337| 		if (ok)
| 338|    |-		{
|    | 338|+		
| 339| 339| 			// We've started walking to the given point
| 340| 340| 			if (this.IsAnimal())
| 341| 341| 				this.SetNextState("ANIMAL.WALKING");
| 342| 342| 			else
| 343| 343| 				this.SetNextState("INDIVIDUAL.WALKING");
| 344|    |-		}
|    | 344|+		
| 345| 345| 		else
| 346| 346| 		{
| 347| 347| 			// We are already at the target, or can't move at all
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 363| 363| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 364| 364| 		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 365| 365| 		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 366|    |-		{
|    | 366|+		
| 367| 367| 			// we were already on the shoreline, and have not moved since
| 368| 368| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
| 369| 369| 				needToMove = false;
| 370|    |-		}
|    | 370|+		
| 371| 371| 
| 372| 372| 		// TODO: what if the units are on a cliff ? the ship will go below the cliff
| 373| 373| 		// and the units won't be able to garrison. Should go to the nearest (accessible) shore
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 361| 361| 		// Check if we need to move     TODO implement a better way to know if we are on the shoreline
| 362| 362| 		var needToMove = true;
| 363| 363| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 364|    |-		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 365|    |-		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
|    | 364|+		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x) &&
|    | 365|+		    (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 366| 366| 		{
| 367| 367| 			// we were already on the shoreline, and have not moved since
| 368| 368| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 372| 372| 		// TODO: what if the units are on a cliff ? the ship will go below the cliff
| 373| 373| 		// and the units won't be able to garrison. Should go to the nearest (accessible) shore
| 374| 374| 		if (needToMove && this.MoveToTarget(this.order.data.target))
| 375|    |-		{
|    | 375|+		
| 376| 376| 			this.SetNextState("INDIVIDUAL.PICKUP.APPROACHING");
| 377|    |-		}
|    | 377|+		
| 378| 378| 		else
| 379| 379| 		{
| 380| 380| 			// We are already at the target, or can't move at all
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 401| 401| 		var distance = DistanceBetweenEntities(this.entity, this.order.data.target) + (+this.template.FleeDistance);
| 402| 402| 		var cmpUnitMotion = Engine.QueryInterface(this.entity, IID_UnitMotion);
| 403| 403| 		if (cmpUnitMotion.MoveToTargetRange(this.order.data.target, distance, -1))
| 404|    |-		{
|    | 404|+		
| 405| 405| 			// We've started fleeing from the given target
| 406| 406| 			if (this.IsAnimal())
| 407| 407| 				this.SetNextState("ANIMAL.FLEEING");
| 408| 408| 			else
| 409| 409| 				this.SetNextState("INDIVIDUAL.FLEEING");
| 410|    |-		}
|    | 410|+		
| 411| 411| 		else
| 412| 412| 		{
| 413| 413| 			// We are already at the target, or can't move at all
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 448| 448| 			}
| 449| 449| 
| 450| 450| 			if (this.order.data.attackType == this.oldAttackType)
| 451|    |-			{
|    | 451|+			
| 452| 452| 				if (this.IsAnimal())
| 453| 453| 					this.SetNextState("ANIMAL.COMBAT.ATTACKING");
| 454| 454| 				else
| 455| 455| 					this.SetNextState("INDIVIDUAL.COMBAT.ATTACKING");
| 456|    |-			}
|    | 456|+			
| 457| 457| 			else
| 458| 458| 			{
| 459| 459| 				if (this.IsAnimal())
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 455| 455| 					this.SetNextState("INDIVIDUAL.COMBAT.ATTACKING");
| 456| 456| 			}
| 457| 457| 			else
| 458|    |-			{
|    | 458|+			
| 459| 459| 				if (this.IsAnimal())
| 460| 460| 					this.SetNextStateAlwaysEntering("ANIMAL.COMBAT.ATTACKING");
| 461| 461| 				else
| 462| 462| 					this.SetNextStateAlwaysEntering("INDIVIDUAL.COMBAT.ATTACKING");
| 463|    |-			}
|    | 463|+			
| 464| 464| 			return;
| 465| 465| 		}
| 466| 466| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 580| 580| 					this.PushOrderFront("Walk", this.order.data.lastPos);
| 581| 581| 				}
| 582| 582| 				else
| 583|    |-				{
|    | 583|+				
| 584| 584| 					// We couldn't move there, or the target moved away
| 585| 585| 					this.FinishOrder();
| 586|    |-				}
|    | 586|+				
| 587| 587| 				return;
| 588| 588| 			}
| 589| 589| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 593| 593| 
| 594| 594| 		// Try to move within range
| 595| 595| 		if (this.MoveToTargetRange(this.order.data.target, IID_ResourceGatherer))
| 596|    |-		{
|    | 596|+		
| 597| 597| 			// We've started walking to the given point
| 598| 598| 			this.SetNextState("INDIVIDUAL.GATHER.APPROACHING");
| 599|    |-		}
|    | 599|+		
| 600| 600| 		else
| 601| 601| 		{
| 602| 602| 			// We are already at the target, or can't move at all,
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 670| 670| 	"Order.Repair": function(msg) {
| 671| 671| 		// Try to move within range
| 672| 672| 		if (this.MoveToTargetRange(this.order.data.target, IID_Builder))
| 673|    |-		{
|    | 673|+		
| 674| 674| 			// We've started walking to the given point
| 675| 675| 			this.SetNextState("INDIVIDUAL.REPAIR.APPROACHING");
| 676|    |-		}
|    | 676|+		
| 677| 677| 		else
| 678| 678| 		{
| 679| 679| 			// We are already at the target, or can't move at all,
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 706| 706| 		}
| 707| 707| 
| 708| 708| 		if (this.MoveToGarrisonRange(this.order.data.target))
| 709|    |-		{
|    | 709|+		
| 710| 710| 			this.SetNextState("INDIVIDUAL.GARRISON.APPROACHING");
| 711|    |-		}
|    | 711|+		
| 712| 712| 		else
| 713| 713| 		{
| 714| 714| 			// We do a range check before actually garrisoning
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 834| 834| 			if (!this.CheckTargetAttackRange(target, target))
| 835| 835| 			{
| 836| 836| 				if (this.TargetIsAlive(target) && this.CheckTargetVisible(target))
| 837|    |-				{
|    | 837|+				
| 838| 838| 					if (this.MoveToTargetAttackRange(target, target))
| 839| 839| 					{
| 840| 840| 						this.SetNextState("COMBAT.APPROACHING");
| 841| 841| 						return;
| 842| 842| 					}
| 843|    |-				}
|    | 843|+				
| 844| 844| 				this.FinishOrder();
| 845| 845| 				return;
| 846| 846| 			}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 859| 859| 			}
| 860| 860| 			// Check if we are already in range, otherwise walk there
| 861| 861| 			if (!this.CheckGarrisonRange(msg.data.target))
| 862|    |-			{
|    | 862|+			
| 863| 863| 				if (!this.CheckTargetVisible(msg.data.target))
| 864| 864| 				{
| 865| 865| 					this.FinishOrder();
| 874| 874| 						return;
| 875| 875| 					}
| 876| 876| 				}
| 877|    |-			}
|    | 877|+			
| 878| 878| 
| 879| 879| 			this.SetNextState("GARRISON.GARRISONING");
| 880| 880| 		},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 866| 866| 					return;
| 867| 867| 				}
| 868| 868| 				else
| 869|    |-				{
|    | 869|+				
| 870| 870| 					// Out of range; move there in formation
| 871| 871| 					if (this.MoveToGarrisonRange(msg.data.target))
| 872| 872| 					{
| 873| 873| 						this.SetNextState("GARRISON.APPROACHING");
| 874| 874| 						return;
| 875| 875| 					}
| 876|    |-				}
|    | 876|+				
| 877| 877| 			}
| 878| 878| 
| 879| 879| 			this.SetNextState("GARRISON.GARRISONING");
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 865| 865| 					this.FinishOrder();
| 866| 866| 					return;
| 867| 867| 				}
| 868|    |-				else
| 869|    |-				{
|    | 868|+				
| 870| 869| 					// Out of range; move there in formation
| 871| 870| 					if (this.MoveToGarrisonRange(msg.data.target))
| 872| 871| 					{
| 873| 872| 						this.SetNextState("GARRISON.APPROACHING");
| 874| 873| 						return;
| 875| 874| 					}
| 876|    |-				}
|    | 875|+				
| 877| 876| 			}
| 878| 877| 
| 879| 878| 			this.SetNextState("GARRISON.GARRISONING");
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 892| 892| 						this.PushOrderFront("Walk", msg.data.lastPos);
| 893| 893| 					}
| 894| 894| 					else
| 895|    |-					{
|    | 895|+					
| 896| 896| 						// We couldn't move there, or the target moved away
| 897| 897| 						this.FinishOrder();
| 898|    |-					}
|    | 898|+					
| 899| 899| 					return;
| 900| 900| 				}
| 901| 901| 
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'GARRISON'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1113|1113| 			},
|1114|1114| 		},
|1115|1115| 
|1116|    |-		"GARRISON":{
|    |1116|+		"GARRISON": {
|1117|1117| 			"enter": function() {
|1118|1118| 				// If the garrisonholder should pickup, warn it so it can take needed action
|1119|1119| 				var cmpGarrisonHolder = Engine.QueryInterface(this.order.data.target, IID_GarrisonHolder);
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1294|1294| 			// If the controller handled an order but some members rejected it,
|1295|1295| 			// they will have no orders and be in the FORMATIONMEMBER.IDLE state.
|1296|1296| 			if (this.orderQueue.length)
|1297|    |-			{
|    |1297|+			
|1298|1298| 				// We're leaving the formation, so stop our FormationWalk order
|1299|1299| 				if (this.FinishOrder())
|1300|1300| 					return;
|1301|    |-			}
|    |1301|+			
|1302|1302| 
|1303|1303| 			// No orders left, we're an individual now
|1304|1304| 			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
|1322|1322| 			// Move a tile outside the building
|1323|1323| 			let range = 4;
|1324|1324| 			if (this.MoveToTargetRangeExplicit(msg.data.target, range, range))
|1325|    |-			{
|    |1325|+			
|1326|1326| 				// We've started walking to the given point
|1327|1327| 				this.SetNextState("WALKINGTOPOINT");
|1328|    |-			}
|    |1328|+			
|1329|1329| 			else
|1330|1330| 			{
|1331|1331| 				// 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
|1327|1327| 				this.SetNextState("WALKINGTOPOINT");
|1328|1328| 			}
|1329|1329| 			else
|1330|    |-			{
|    |1330|+			
|1331|1331| 				// We are already at the target, or can't move at all
|1332|1332| 				this.FinishOrder();
|1333|    |-			}
|    |1333|+			
|1334|1334| 		},
|1335|1335| 
|1336|1336| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1528|1528| 
|1529|1529| 			"LosRangeUpdate": function(msg) {
|1530|1530| 				if (this.GetStance().targetVisibleEnemies)
|1531|    |-				{
|    |1531|+				
|1532|1532| 					// Start attacking one of the newly-seen enemy (if any)
|1533|1533| 					this.AttackEntitiesByPreference(msg.data.added);
|1534|    |-				}
|    |1534|+				
|1535|1535| 			},
|1536|1536| 
|1537|1537| 			"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
|1714|1714| 						// if nothing better to do, check if the guarded needs to be healed or repaired
|1715|1715| 						var cmpHealth = Engine.QueryInterface(this.isGuardOf, IID_Health);
|1716|1716| 						if (cmpHealth && (cmpHealth.GetHitpoints() < cmpHealth.GetMaxHitpoints()))
|1717|    |-						{
|    |1717|+						
|1718|1718| 							if (this.CanHeal(this.isGuardOf))
|1719|1719| 								this.PushOrderFront("Heal", { "target": this.isGuardOf, "force": false });
|1720|1720| 							else if (this.CanRepair(this.isGuardOf))
|1721|1721| 								this.PushOrderFront("Repair", { "target": this.isGuardOf, "autocontinue": false, "force": false });
|1722|    |-						}
|    |1722|+						
|1723|1723| 					}
|1724|1724| 				},
|1725|1725| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1802|1802| 				"MoveCompleted": function() {
|1803|1803| 
|1804|1804| 					if (this.CheckTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1805|    |-					{
|    |1805|+					
|1806|1806| 						// If the unit needs to unpack, do so
|1807|1807| 						if (this.CanUnpack())
|1808|1808| 						{
|1811|1811| 						}
|1812|1812| 						else
|1813|1813| 							this.SetNextState("ATTACKING");
|1814|    |-					}
|    |1814|+					
|1815|1815| 					else
|1816|1816| 					{
|1817|1817| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1809|1809| 							this.PushOrderFront("Unpack", { "force": true });
|1810|1810| 							return;
|1811|1811| 						}
|1812|    |-						else
|1813|    |-							this.SetNextState("ATTACKING");
|    |1812|+						this.SetNextState("ATTACKING");
|1814|1813| 					}
|1815|1814| 					else
|1816|1815| 					{
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1813|1813| 							this.SetNextState("ATTACKING");
|1814|1814| 					}
|1815|1815| 					else
|1816|    |-					{
|    |1816|+					
|1817|1817| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1818|1818| 						{
|1819|1819| 							this.SetNextState("APPROACHING");
|1823|1823| 							// Give up
|1824|1824| 							this.FinishOrder();
|1825|1825| 						}
|1826|    |-					}
|    |1826|+					
|1827|1827| 				},
|1828|1828| 			},
|1829|1829| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1815|1815| 					else
|1816|1816| 					{
|1817|1817| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1818|    |-						{
|    |1818|+						
|1819|1819| 							this.SetNextState("APPROACHING");
|1820|    |-						}
|    |1820|+						
|1821|1821| 						else
|1822|1822| 						{
|1823|1823| 							// Give up
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1819|1819| 							this.SetNextState("APPROACHING");
|1820|1820| 						}
|1821|1821| 						else
|1822|    |-						{
|    |1822|+						
|1823|1823| 							// Give up
|1824|1824| 							this.FinishOrder();
|1825|    |-						}
|    |1825|+						
|1826|1826| 					}
|1827|1827| 				},
|1828|1828| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1840|1840| 					}
|1841|1841| 					// Check the target is still alive and attackable
|1842|1842| 					if (this.CanAttack(target) && !this.CheckTargetAttackRange(target, this.order.data.attackType))
|1843|    |-					{
|    |1843|+					
|1844|1844| 						// Can't reach it - try to chase after it
|1845|1845| 						if (this.ShouldChaseTargetedEntity(target, this.order.data.force))
|1846|1846| 						{
|1850|1850| 								return;
|1851|1851| 							}
|1852|1852| 						}
|1853|    |-					}
|    |1853|+					
|1854|1854| 
|1855|1855| 					var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|1856|1856| 					this.attackTimers = cmpAttack.GetTimers(this.order.data.attackType);
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1843|1843| 					{
|1844|1844| 						// Can't reach it - try to chase after it
|1845|1845| 						if (this.ShouldChaseTargetedEntity(target, this.order.data.force))
|1846|    |-						{
|    |1846|+						
|1847|1847| 							if (this.MoveToTargetAttackRange(target, this.order.data.attackType))
|1848|1848| 							{
|1849|1849| 								this.SetNextState("COMBAT.CHASING");
|1850|1850| 								return;
|1851|1851| 							}
|1852|    |-						}
|    |1852|+						
|1853|1853| 					}
|1854|1854| 
|1855|1855| 					var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1881|1881| 					// TODO: we should probably only bother syncing projectile attacks, not melee
|1882|1882| 
|1883|1883| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|1884|    |-					this.resyncAnimation = (prepare != this.attackTimers.prepare) ? true : false;
|    |1884|+					this.resyncAnimation = (prepare != this.attackTimers.prepare);
|1885|1885| 
|1886|1886| 					this.FaceTowardsTarget(this.order.data.target);
|1887|1887| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1956|1956| 
|1957|1957| 						// Can't reach it - try to chase after it
|1958|1958| 						if (this.ShouldChaseTargetedEntity(target, this.order.data.force))
|1959|    |-						{
|    |1959|+						
|1960|1960| 							if (this.MoveToTargetRange(target, IID_Attack, this.order.data.attackType))
|1961|1961| 							{
|1962|1962| 								this.SetNextState("COMBAT.CHASING");
|1963|1963| 								return;
|1964|1964| 							}
|1965|    |-						}
|    |1965|+						
|1966|1966| 					}
|1967|1967| 
|1968|1968| 					// if we're targetting a formation, find a new member of that formation
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2005|2005| 
|2006|2006| 				"Attacked": function(msg) {
|2007|2007| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2008|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2009|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2008|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2009|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2010|2010| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2011|2011| 				},
|2012|2012| 			},
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2089|2089| 						// Also don't switch to a different type of huntable animal
|2090|2090| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2091|2091| 							return (
|2092|    |-								ent != oldTarget
|2093|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2092|+								ent != oldTarget &&
|    |2093|+								 ((type.generic == "treasure" && oldType.generic == "treasure")
|2094|2094| 								 || (type.specific == oldType.specific
|2095|2095| 								 && (type.specific != "meat" || oldTemplate == template)))
|2096|2096| 							);
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2090|2090| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2091|2091| 							return (
|2092|2092| 								ent != oldTarget
|2093|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2094|    |-								 || (type.specific == oldType.specific
|    |2093|+								 && ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2094|+								 (type.specific == oldType.specific
|2095|2095| 								 && (type.specific != "meat" || oldTemplate == template)))
|2096|2096| 							);
|2097|2097| 						}, 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
|2091|2091| 							return (
|2092|2092| 								ent != oldTarget
|2093|2093| 								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2094|    |-								 || (type.specific == oldType.specific
|2095|    |-								 && (type.specific != "meat" || oldTemplate == template)))
|    |2094|+								 || (type.specific == oldType.specific &&
|    |2095|+								 (type.specific != "meat" || oldTemplate == template)))
|2096|2096| 							);
|2097|2097| 						}, oldTarget);
|2098|2098| 						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
|2100|2100| 							this.PerformGather(nearby, false, false);
|2101|2101| 							return true;
|2102|2102| 						}
|2103|    |-						else
|2104|    |-						{
|    |2103|+						
|2105|2104| 							// It's probably better in this case, to avoid units getting stuck around a dropsite
|2106|2105| 							// in a "Target is far away, full, nearby are no good resources, return to dropsite" loop
|2107|2106| 							// to order it to GatherNear the resource position.
|2122|2121| 									return true;
|2123|2122| 								}
|2124|2123| 							}
|2125|    |-						}
|    |2124|+						
|2126|2125| 						return true;
|2127|2126| 					}
|2128|2127| 					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
|2112|2112| 								this.GatherNearPosition(pos.x, pos.z, oldType, oldTemplate);
|2113|2113| 								return true;
|2114|2114| 							}
|2115|    |-							else
|2116|    |-							{
|    |2115|+							
|2117|2116| 								// we're kind of stuck here. Return resource.
|2118|2117| 								var nearby = this.FindNearestDropsite(oldType.generic);
|2119|2118| 								if (nearby)
|2121|2120| 									this.PushOrderFront("ReturnResource", { "target": nearby, "force": false });
|2122|2121| 									return true;
|2123|2122| 								}
|2124|    |-							}
|    |2123|+							
|2125|2124| 						}
|2126|2125| 						return true;
|2127|2126| 					}
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2154|2154| 						// Also don't switch to a different type of huntable animal
|2155|2155| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2156|2156| 							return (
|2157|    |-								ent != oldTarget
|2158|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2157|+								ent != oldTarget &&
|    |2158|+								((type.generic == "treasure" && oldType.generic == "treasure")
|2159|2159| 								|| (type.specific == oldType.specific
|2160|2160| 								&& (type.specific != "meat" || oldTemplate == template)))
|2161|2161| 							);
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2155|2155| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2156|2156| 							return (
|2157|2157| 								ent != oldTarget
|2158|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2159|    |-								|| (type.specific == oldType.specific
|    |2158|+								&& ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2159|+								(type.specific == oldType.specific
|2160|2160| 								&& (type.specific != "meat" || oldTemplate == template)))
|2161|2161| 							);
|2162|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
|2156|2156| 							return (
|2157|2157| 								ent != oldTarget
|2158|2158| 								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2159|    |-								|| (type.specific == oldType.specific
|2160|    |-								&& (type.specific != "meat" || oldTemplate == template)))
|    |2159|+								|| (type.specific == oldType.specific &&
|    |2160|+								(type.specific != "meat" || oldTemplate == template)))
|2161|2161| 							);
|2162|2162| 						});
|2163|2163| 						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
|2201|2201| 					// Also don't switch to a different type of huntable animal
|2202|2202| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2203|2203| 						return (
|2204|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2205|    |-							|| (type.specific == resourceType.specific
|    |2204|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2205|+							(type.specific == resourceType.specific
|2206|2206| 							&& (type.specific != "meat" || resourceTemplate == template))
|2207|2207| 						);
|2208|2208| 					});
|    | [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
|2202|2202| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2203|2203| 						return (
|2204|2204| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2205|    |-							|| (type.specific == resourceType.specific
|2206|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2205|+							|| (type.specific == resourceType.specific &&
|    |2206|+							(type.specific != "meat" || resourceTemplate == template))
|2207|2207| 						);
|2208|2208| 					});
|2209|2209| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2318|2318| 
|2319|2319| 					var cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply);
|2320|2320| 					if (cmpSupply && cmpSupply.IsAvailable(cmpOwnership.GetOwner(), this.entity))
|2321|    |-					{
|    |2321|+					
|2322|2322| 						// Check we can still reach and gather from the target
|2323|2323| 						if (this.CheckTargetRange(this.gatheringTarget, IID_ResourceGatherer) && this.CanGather(this.gatheringTarget))
|2324|2324| 						{
|2384|2384| 								return;
|2385|2385| 							}
|2386|2386| 						}
|2387|    |-					}
|    |2387|+					
|2388|2388| 
|2389|2389| 					// We're already in range, can't get anywhere near it or the target is exhausted.
|2390|2390| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2410|2410| 					// Also don't switch to a different type of huntable animal
|2411|2411| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2412|2412| 						return (
|2413|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2414|    |-							|| (type.specific == resourceType.specific
|    |2413|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2414|+							(type.specific == resourceType.specific
|2415|2415| 							&& (type.specific != "meat" || resourceTemplate == template))
|2416|2416| 						);
|2417|2417| 					});
|    | [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
|2411|2411| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2412|2412| 						return (
|2413|2413| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2414|    |-							|| (type.specific == resourceType.specific
|2415|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2414|+							|| (type.specific == resourceType.specific &&
|    |2415|+							(type.specific != "meat" || resourceTemplate == template))
|2416|2416| 						);
|2417|2417| 					});
|2418|2418| 					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
|2498|2498| 					this.StartTimer(prepare, this.healTimers.repeat);
|2499|2499| 
|2500|2500| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2501|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2501|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2502|2502| 
|2503|2503| 					this.FaceTowardsTarget(this.order.data.target);
|2504|2504| 				},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2531|2531| 						}
|2532|2532| 						// Can't reach it - try to chase after it
|2533|2533| 						if (this.ShouldChaseTargetedEntity(target, this.order.data.force))
|2534|    |-						{
|    |2534|+						
|2535|2535| 							if (this.MoveToTargetRange(target, IID_Heal))
|2536|2536| 							{
|2537|2537| 								this.SetNextState("HEAL.CHASING");
|2538|2538| 								return;
|2539|2539| 							}
|2540|    |-						}
|    |2540|+						
|2541|2541| 					}
|2542|2542| 					// Can't reach it, healed to max hp or doesn't exist any more - give up
|2543|2543| 					if (this.FinishOrder())
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2708|2708| 					{
|2709|2709| 						// The building was already finished/fully repaired before we arrived;
|2710|2710| 						// let the ConstructionFinished handler handle this.
|2711|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2711|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2712|2712| 						return true;
|2713|2713| 					}
|2714|2714| 
|    | [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
|2708|2708| 					{
|2709|2709| 						// The building was already finished/fully repaired before we arrived;
|2710|2710| 						// let the ConstructionFinished handler handle this.
|2711|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2711|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2712|2712| 						return true;
|2713|2713| 					}
|2714|2714| 
|    | [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
|2748|2748| 					if (this.MoveToTargetRange(this.repairTarget, IID_Builder))
|2749|2749| 						this.SetNextState("APPROACHING");
|2750|2750| 					else if (!this.CheckTargetRange(this.repairTarget, IID_Builder))
|2751|    |-						this.FinishOrder(); //can't approach and isn't in reach
|    |2751|+						this.FinishOrder(); // can't approach and isn't in reach
|2752|2752| 				},
|2753|2753| 			},
|2754|2754| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2835|2835| 
|2836|2836| 				// Unit was approaching and there's nothing to do now, so switch to walking
|2837|2837| 				if (oldState === "INDIVIDUAL.REPAIR.APPROACHING")
|2838|    |-				{
|    |2838|+				
|2839|2839| 					// We're already walking to the given point, so add this as a order.
|2840|2840| 					this.WalkToTarget(msg.data.newentity, true);
|2841|    |-				}
|    |2841|+				
|2842|2842| 			},
|2843|2843| 		},
|2844|2844| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2888|2888| 
|2889|2889| 					// Check that we can garrison here
|2890|2890| 					if (this.CanGarrison(target))
|2891|    |-					{
|    |2891|+					
|2892|2892| 						// Check that we're in range of the garrison target
|2893|2893| 						if (this.CheckGarrisonRange(target))
|2894|2894| 						{
|2964|2964| 								return false;
|2965|2965| 							}
|2966|2966| 						}
|2967|    |-					}
|    |2967|+					
|2968|2968| 					// Garrisoning failed for some reason, so finish the order
|2969|2969| 					this.FinishOrder();
|2970|2970| 					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
|3071|3071| 		"Attacked": function(msg) {
|3072|3072| 			if (this.template.NaturalBehaviour == "skittish" ||
|3073|3073| 			    this.template.NaturalBehaviour == "passive")
|3074|    |-			{
|    |3074|+			
|3075|3075| 				this.Flee(msg.data.attacker, false);
|3076|    |-			}
|    |3076|+			
|3077|3077| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|3078|3078| 			{
|3079|3079| 				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
|3080|3080| 					this.Attack(msg.data.attacker, false);
|3081|3081| 			}
|3082|3082| 			else if (this.template.NaturalBehaviour == "domestic")
|3083|    |-			{
|    |3083|+			
|3084|3084| 				// Never flee, stop what we were doing
|3085|3085| 				this.SetNextState("IDLE");
|3086|    |-			}
|    |3086|+			
|3087|3087| 		},
|3088|3088| 
|3089|3089| 		"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
|3090|3090| 			// Move a tile outside the building
|3091|3091| 			var range = 4;
|3092|3092| 			if (this.MoveToTargetRangeExplicit(msg.data.target, range, range))
|3093|    |-			{
|    |3093|+			
|3094|3094| 				// We've started walking to the given point
|3095|3095| 				this.SetNextState("WALKING");
|3096|    |-			}
|    |3096|+			
|3097|3097| 			else
|3098|3098| 			{
|3099|3099| 				// 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
|3095|3095| 				this.SetNextState("WALKING");
|3096|3096| 			}
|3097|3097| 			else
|3098|    |-			{
|    |3098|+			
|3099|3099| 				// We are already at the target, or can't move at all
|3100|3100| 				this.FinishOrder();
|3101|    |-			}
|    |3101|+			
|3102|3102| 		},
|3103|3103| 
|3104|3104| 		"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
|3137|3137| 				}
|3138|3138| 				// Start attacking one of the newly-seen enemy (if any)
|3139|3139| 				else if (this.IsDangerousAnimal())
|3140|    |-				{
|    |3140|+				
|3141|3141| 					this.AttackVisibleEntity(msg.data.added);
|3142|    |-				}
|    |3142|+				
|3143|3143| 
|3144|3144| 				// TODO: if two units enter our range together, we'll attack the
|3145|3145| 				// 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
|3180|3180| 				}
|3181|3181| 				// Start attacking one of the newly-seen enemy (if any)
|3182|3182| 				else if (this.template.NaturalBehaviour == "violent")
|3183|    |-				{
|    |3183|+				
|3184|3184| 					this.AttackVisibleEntity(msg.data.added);
|3185|    |-				}
|    |3185|+				
|3186|3186| 			},
|3187|3187| 
|3188|3188| 			"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
|3197|3197| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3198|3198| 
|3199|3199| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3200|    |-							// only used for domestic animals
|    |3200|+		// only used for domestic animals
|3201|3201| 	},
|3202|3202| };
|3203|3203| 
|    | [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
|3254|3254| 
|3255|3255| UnitAI.prototype.IsAnimal = function()
|3256|3256| {
|3257|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3257|+	return (!!this.template.NaturalBehaviour);
|3258|3258| };
|3259|3259| 
|3260|3260| 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
|3292|3292| UnitAI.prototype.GetGarrisonHolder = function()
|3293|3293| {
|3294|3294| 	if (this.IsGarrisoned())
|3295|    |-	{
|    |3295|+	
|3296|3296| 		for (let order of this.orderQueue)
|3297|3297| 			if (order.type == "Garrison")
|3298|3298| 				return order.data.target;
|3299|    |-	}
|    |3299|+	
|3300|3300| 	return INVALID_ENTITY;
|3301|3301| };
|3302|3302| 
|    | [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
|3370|3370| 		{
|3371|3371| 			let index = this.GetCurrentState().indexOf(".");
|3372|3372| 			if (index != -1)
|3373|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3373|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3374|3374| 			this.Stop(false);
|3375|3375| 		}
|3376|3376| 
|    | [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
|3426|3426| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3427|3427| 			continue;
|3428|3428| 		if (i == 0)
|3429|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3429|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3430|3430| 		else
|3431|3431| 			this.orderQueue.splice(i, 1);
|3432|3432| 		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
|3426|3426| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3427|3427| 			continue;
|3428|3428| 		if (i == 0)
|3429|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3429|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3430|3430| 		else
|3431|3431| 			this.orderQueue.splice(i, 1);
|3432|3432| 		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
|3510|3510| };
|3511|3511| 
|3512|3512| 
|3513|    |-//// FSM linkage functions ////
|    |3513|+// // FSM linkage functions ////
|3514|3514| 
|3515|3515| UnitAI.prototype.SetNextState = function(state)
|3516|3516| {
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3684|3684| 				continue;
|3685|3685| 			if (this.orderQueue[i].type == type)
|3686|3686| 				continue;
|3687|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3687|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3688|3688| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3689|3689| 			return;
|3690|3690| 		}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3684|3684| 				continue;
|3685|3685| 			if (this.orderQueue[i].type == type)
|3686|3686| 				continue;
|3687|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3687|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3688|3688| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3689|3689| 			return;
|3690|3690| 		}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3698|3698| {
|3699|3699| 	// Remember the previous work orders to be able to go back to them later if required
|3700|3700| 	if (data && data.force)
|3701|    |-	{
|    |3701|+	
|3702|3702| 		if (this.IsFormationController())
|3703|3703| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3704|3704| 		else
|3705|3705| 			this.UpdateWorkOrders(type);
|3706|    |-	}
|    |3706|+	
|3707|3707| 
|3708|3708| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3709|3709| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3775|3775| 	{
|3776|3776| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3777|3777| 		if (cmpUnitAI)
|3778|    |-		{
|    |3778|+		
|3779|3779| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3780|3780| 			{
|3781|3781| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3784|3784| 					return;
|3785|3785| 				}
|3786|3786| 			}
|3787|    |-		}
|    |3787|+		
|3788|3788| 	}
|3789|3789| 
|3790|3790| 	// If nothing found, take the unit orders
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3777|3777| 		if (cmpUnitAI)
|3778|3778| 		{
|3779|3779| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3780|    |-			{
|    |3780|+			
|3781|3781| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3782|3782| 				{
|3783|3783| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3784|3784| 					return;
|3785|3785| 				}
|3786|    |-			}
|    |3786|+			
|3787|3787| 		}
|3788|3788| 	}
|3789|3789| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3789|3789| 
|3790|3790| 	// If nothing found, take the unit orders
|3791|3791| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3792|    |-	{
|    |3792|+	
|3793|3793| 		if (isWorkType(this.orderQueue[i].type))
|3794|3794| 		{
|3795|3795| 			this.workOrders = this.orderQueue.slice(i);
|3796|3796| 			return;
|3797|3797| 		}
|3798|    |-	}
|    |3798|+	
|3799|3799| };
|3800|3800| 
|3801|3801| UnitAI.prototype.BackToWork = function()
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3855|3855| 	if (data.timerRepeat === undefined)
|3856|3856| 		this.timer = undefined;
|3857|3857| 
|3858|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3858|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3859|3859| };
|3860|3860| 
|3861|3861| /**
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3855|3855| 	if (data.timerRepeat === undefined)
|3856|3856| 		this.timer = undefined;
|3857|3857| 
|3858|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3858|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3859|3859| };
|3860|3860| 
|3861|3861| /**
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3890|3890| 	this.timer = undefined;
|3891|3891| };
|3892|3892| 
|3893|    |-//// Message handlers /////
|    |3893|+// // Message handlers /////
|3894|3894| 
|3895|3895| UnitAI.prototype.OnMotionChanged = function(msg)
|3896|3896| {
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3895|3895| UnitAI.prototype.OnMotionChanged = function(msg)
|3896|3896| {
|3897|3897| 	if (msg.starting && !msg.error)
|3898|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3898|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveStarted", "data": msg});
|3899|3899| 	else if (!msg.starting || msg.error)
|3900|3900| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3901|3901| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3895|3895| UnitAI.prototype.OnMotionChanged = function(msg)
|3896|3896| {
|3897|3897| 	if (msg.starting && !msg.error)
|3898|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3898|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg });
|3899|3899| 	else if (!msg.starting || msg.error)
|3900|3900| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3901|3901| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3897|3897| 	if (msg.starting && !msg.error)
|3898|3898| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3899|3899| 	else if (!msg.starting || msg.error)
|3900|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3900|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveCompleted", "data": msg});
|3901|3901| };
|3902|3902| 
|3903|3903| UnitAI.prototype.OnGlobalConstructionFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3897|3897| 	if (msg.starting && !msg.error)
|3898|3898| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3899|3899| 	else if (!msg.starting || msg.error)
|3900|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3900|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg });
|3901|3901| };
|3902|3902| 
|3903|3903| UnitAI.prototype.OnGlobalConstructionFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3905|3905| 	// TODO: This is a bit inefficient since every unit listens to every
|3906|3906| 	// construction message - ideally we could scope it to only the one we're building
|3907|3907| 
|3908|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3908|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3909|3909| };
|3910|3910| 
|3911|3911| UnitAI.prototype.OnGlobalEntityRenamed = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3905|3905| 	// TODO: This is a bit inefficient since every unit listens to every
|3906|3906| 	// construction message - ideally we could scope it to only the one we're building
|3907|3907| 
|3908|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3908|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3909|3909| };
|3910|3910| 
|3911|3911| UnitAI.prototype.OnGlobalEntityRenamed = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3930|3930| 
|3931|3931| UnitAI.prototype.OnAttacked = function(msg)
|3932|3932| {
|3933|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3933|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3934|3934| };
|3935|3935| 
|3936|3936| UnitAI.prototype.OnGuardedAttacked = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3930|3930| 
|3931|3931| UnitAI.prototype.OnAttacked = function(msg)
|3932|3932| {
|3933|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3933|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3934|3934| };
|3935|3935| 
|3936|3936| UnitAI.prototype.OnGuardedAttacked = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3935|3935| 
|3936|3936| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3937|3937| {
|3938|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3938|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|3939|3939| };
|3940|3940| 
|3941|3941| UnitAI.prototype.OnHealthChanged = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3935|3935| 
|3936|3936| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3937|3937| {
|3938|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3938|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|3939|3939| };
|3940|3940| 
|3941|3941| UnitAI.prototype.OnHealthChanged = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3940|3940| 
|3941|3941| UnitAI.prototype.OnHealthChanged = function(msg)
|3942|3942| {
|3943|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3943|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|3944|3944| };
|3945|3945| 
|3946|3946| UnitAI.prototype.OnRangeUpdate = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3940|3940| 
|3941|3941| UnitAI.prototype.OnHealthChanged = function(msg)
|3942|3942| {
|3943|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3943|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|3944|3944| };
|3945|3945| 
|3946|3946| UnitAI.prototype.OnRangeUpdate = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3946|3946| UnitAI.prototype.OnRangeUpdate = function(msg)
|3947|3947| {
|3948|3948| 	if (msg.tag == this.losRangeQuery)
|3949|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3949|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|3950|3950| 	else if (msg.tag == this.losHealRangeQuery)
|3951|3951| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3952|3952| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3946|3946| UnitAI.prototype.OnRangeUpdate = function(msg)
|3947|3947| {
|3948|3948| 	if (msg.tag == this.losRangeQuery)
|3949|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3949|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|3950|3950| 	else if (msg.tag == this.losHealRangeQuery)
|3951|3951| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3952|3952| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3948|3948| 	if (msg.tag == this.losRangeQuery)
|3949|3949| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3950|3950| 	else if (msg.tag == this.losHealRangeQuery)
|3951|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3951|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|3952|3952| };
|3953|3953| 
|3954|3954| UnitAI.prototype.OnPackFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3948|3948| 	if (msg.tag == this.losRangeQuery)
|3949|3949| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3950|3950| 	else if (msg.tag == this.losHealRangeQuery)
|3951|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3951|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|3952|3952| };
|3953|3953| 
|3954|3954| UnitAI.prototype.OnPackFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3953|3953| 
|3954|3954| UnitAI.prototype.OnPackFinished = function(msg)
|3955|3955| {
|3956|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3956|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|3957|3957| };
|3958|3958| 
|3959|3959| //// Helper functions to be called by the FSM ////
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3953|3953| 
|3954|3954| UnitAI.prototype.OnPackFinished = function(msg)
|3955|3955| {
|3956|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3956|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|3957|3957| };
|3958|3958| 
|3959|3959| //// Helper functions to be called by the FSM ////
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3956|3956| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|3957|3957| };
|3958|3958| 
|3959|    |-//// Helper functions to be called by the FSM ////
|    |3959|+// // Helper functions to be called by the FSM ////
|3960|3960| 
|3961|3961| UnitAI.prototype.GetWalkSpeed = function()
|3962|3962| {
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4060|4060| 	if (!cmpOwnership || cmpOwnership.GetOwner() == INVALID_PLAYER)
|4061|4061| 		return undefined;
|4062|4062| 
|4063|    |-	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position)
|    |4063|+	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
|4064|4064| 	if (!cmpPosition || !cmpPosition.IsInWorld())
|4065|4065| 		return undefined;
|4066|4066| 
|    | [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
|4145|4145| 			PlaySound(name, member);
|4146|4146| 	}
|4147|4147| 	else
|4148|    |-	{
|    |4148|+	
|4149|4149| 		// Otherwise use our own sounds
|4150|4150| 		PlaySound(name, this.entity);
|4151|    |-	}
|    |4151|+	
|4152|4152| };
|4153|4153| 
|4154|4154| /*
|    | [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
|4314|4314| 	else
|4315|4315| 		// return false? Or hope you come close enough?
|4316|4316| 		var parabolicMaxRange = 0;
|4317|    |-		//return false;
|    |4317|+		// return false;
|4318|4318| 
|4319|4319| 	// the parabole changes while walking, take something in the middle
|4320|4320| 	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
|4379|4379| 	if (this.IsFormationMember())
|4380|4380| 	{
|4381|4381| 		var cmpFormationUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|4382|    |-		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation()
|4383|    |-			&& cmpFormationUnitAI.order.data.target == target)
|    |4382|+		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation() &&
|    |4383|+			cmpFormationUnitAI.order.data.target == target)
|4384|4384| 			return true;
|4385|4385| 	}
|4386|4386| 
|    | [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
|4547|4547| UnitAI.prototype.AttackEntityInZone = function(ents)
|4548|4548| {
|4549|4549| 	var target = ents.find(target =>
|4550|    |-		this.CanAttack(target)
|4551|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4550|+		this.CanAttack(target) &&
|    |4551|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4552|4552| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4553|4553| 	);
|4554|4554| 	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
|4548|4548| {
|4549|4549| 	var target = ents.find(target =>
|4550|4550| 		this.CanAttack(target)
|4551|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4552|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4551|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4552|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4553|4553| 	);
|4554|4554| 	if (!target)
|4555|4555| 		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
|4612|4612| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4613|4613| 	if (this.isGuardOf)
|4614|4614| 	{
|4615|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4615|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4616|4616| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4617|4617| 		if (cmpUnitAI && cmpAttack &&
|4618|4618| 		    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
|4616|4616| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4617|4617| 		if (cmpUnitAI && cmpAttack &&
|4618|4618| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4619|    |-				return false;
|    |4619|+			return false;
|4620|4620| 	}
|4621|4621| 
|4622|4622| 	// 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
|4621|4621| 
|4622|4622| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4623|4623| 	if (this.GetStance().respondHoldGround)
|4624|    |-	{
|    |4624|+	
|4625|4625| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4626|4626| 			return true;
|4627|    |-	}
|    |4627|+	
|4628|4628| 
|4629|4629| 	// Stop if it's left our vision range, unless we're especially persistent
|4630|4630| 	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
|4628|4628| 
|4629|4629| 	// Stop if it's left our vision range, unless we're especially persistent
|4630|4630| 	if (!this.GetStance().respondChaseBeyondVision)
|4631|    |-	{
|    |4631|+	
|4632|4632| 		if (!this.CheckTargetIsInVisionRange(target))
|4633|4633| 			return true;
|4634|    |-	}
|    |4634|+	
|4635|4635| 
|4636|4636| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4637|4637| 	// 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
|4654|4654| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4655|4655| 	if (this.isGuardOf)
|4656|4656| 	{
|4657|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4657|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4658|4658| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4659|4659| 		if (cmpUnitAI && cmpAttack &&
|4660|4660| 		    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
|4667|4667| 	return false;
|4668|4668| };
|4669|4669| 
|4670|    |-//// External interface functions ////
|    |4670|+// // External interface functions ////
|4671|4671| 
|4672|4672| UnitAI.prototype.SetFormationController = function(ent)
|4673|4673| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4677|4677| 	// of our own formation (or ourself if not in formation)
|4678|4678| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4679|4679| 	if (cmpObstruction)
|4680|    |-	{
|    |4680|+	
|4681|4681| 		if (ent == INVALID_ENTITY)
|4682|4682| 			cmpObstruction.SetControlGroup(this.entity);
|4683|4683| 		else
|4684|4684| 			cmpObstruction.SetControlGroup(ent);
|4685|    |-	}
|    |4685|+	
|4686|4686| 
|4687|4687| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4688|4688| 	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
|4820|4820| 	// if we already had an old guard order, do nothing if the target is the same
|4821|4821| 	// and the order is running, otherwise remove the previous order
|4822|4822| 	if (this.isGuardOf)
|4823|    |-	{
|    |4823|+	
|4824|4824| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4825|4825| 			return;
|4826|4826| 		else
|4827|4827| 			this.RemoveGuard();
|4828|    |-	}
|    |4828|+	
|4829|4829| 
|4830|4830| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4831|4831| };
|    | [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
|4823|4823| 	{
|4824|4824| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4825|4825| 			return;
|4826|    |-		else
|4827|    |-			this.RemoveGuard();
|    |4826|+		this.RemoveGuard();
|4828|4827| 	}
|4829|4828| 
|4830|4829| 	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
|4994|4994| 			this.WalkToTarget(target, queued);
|4995|4995| 		return;
|4996|4996| 	}
|4997|    |-	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture}, queued);
|    |4997|+	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture }, queued);
|4998|4998| };
|4999|4999| 
|5000|5000| /**
|    | [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
|5143|5143| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5144|5144| 	{
|5145|5145| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5146|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5146|+		if (cmpTrader.HasBothMarkets() &&
|5147|5147| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5148|5148| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5149|5149| 		{
|    | [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
|5424|5424| 				{
|5425|5425| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5426|5426| 					var targetClasses = this.order.data.targetClasses;
|5427|    |-					if (targetClasses.attack && cmpIdentity
|5428|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5427|+					if (targetClasses.attack && cmpIdentity &&
|    |5428|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5429|5429| 						continue;
|5430|5430| 					if (targetClasses.avoid && cmpIdentity
|5431|5431| 						&& 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
|5427|5427| 					if (targetClasses.attack && cmpIdentity
|5428|5428| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5429|5429| 						continue;
|5430|    |-					if (targetClasses.avoid && cmpIdentity
|5431|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5430|+					if (targetClasses.avoid && cmpIdentity &&
|    |5431|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5432|5432| 						continue;
|5433|5433| 					// Only used by the AIs to prevent some choices of targets
|5434|5434| 					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
|5450|5450| 		{
|5451|5451| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5452|5452| 			var targetClasses = this.order.data.targetClasses;
|5453|    |-			if (cmpIdentity && targetClasses.attack
|5454|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5453|+			if (cmpIdentity && targetClasses.attack &&
|    |5454|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5455|5455| 				continue;
|5456|5456| 			if (cmpIdentity && targetClasses.avoid
|5457|5457| 				&& 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
|5453|5453| 			if (cmpIdentity && targetClasses.attack
|5454|5454| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5455|5455| 				continue;
|5456|    |-			if (cmpIdentity && targetClasses.avoid
|5457|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5456|+			if (cmpIdentity && targetClasses.avoid &&
|    |5457|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5458|5458| 				continue;
|5459|5459| 			// Only used by the AIs to prevent some choices of targets
|5460|5460| 			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
|5586|5586| 
|5587|5587| UnitAI.prototype.SetHeldPosition = function(x, z)
|5588|5588| {
|5589|    |-	this.heldPosition = {"x": x, "z": z};
|    |5589|+	this.heldPosition = { "x": x, "z": z};
|5590|5590| };
|5591|5591| 
|5592|5592| 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
|5586|5586| 
|5587|5587| UnitAI.prototype.SetHeldPosition = function(x, z)
|5588|5588| {
|5589|    |-	this.heldPosition = {"x": x, "z": z};
|    |5589|+	this.heldPosition = {"x": x, "z": z };
|5590|5590| };
|5591|5591| 
|5592|5592| 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
|5613|5613| 	return false;
|5614|5614| };
|5615|5615| 
|5616|    |-//// Helper functions ////
|    |5616|+// // Helper functions ////
|5617|5617| 
|5618|5618| UnitAI.prototype.CanAttack = function(target)
|5619|5619| {
|    | [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
|5817|5817| 	return cmpPack && cmpPack.IsPacking();
|5818|5818| };
|5819|5819| 
|5820|    |-//// Formation specific functions ////
|    |5820|+// // Formation specific functions ////
|5821|5821| 
|5822|5822| UnitAI.prototype.IsAttackingAsFormation = function()
|5823|5823| {
|    | [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
|5822|5822| UnitAI.prototype.IsAttackingAsFormation = function()
|5823|5823| {
|5824|5824| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5825|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5826|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5825|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5826|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5827|5827| };
|5828|5828| 
|5829|5829| //// 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
|5826|5826| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5827|5827| };
|5828|5828| 
|5829|    |-//// Animal specific functions ////
|    |5829|+// // Animal specific functions ////
|5830|5830| 
|5831|5831| UnitAI.prototype.MoveRandomly = function(distance)
|5832|5832| {

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

binaries/data/mods/public/simulation/components/UnitAI.js
|3760| »   var·isWorkType·=·type·=>·type·==·"Gather"·||·type·==·"Trade"·||·type·==·"Repair"·||·type·==·"ReturnResource";
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'type' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|4534| »   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
|4549| »   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
|4595| »   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
|4618| »   »   ····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
|5074| »   var·lastPos·=·undefined;
|    | [NORMAL] ESLintBear (no-undef-init):
|    | It's not necessary to initialize 'lastPos' to undefined.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4327| »   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
|4383| »   »   »   &&·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
|4551| »   »   &&·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
|4552| »   »   &&·(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
|5074| »   var·lastPos·=·undefined;
|    | [NORMAL] JSHintBear:
|    | It's not necessary to initialize 'lastPos' to 'undefined'.

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

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

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

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

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

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

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

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

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

mimo added a comment.Apr 8 2018, 11:02 AM

Faster to reproduce (at turn about 5000) with
pyrogenesis -autostart=random/mainland -autostart-seed=5137 -autostart-aiseed=4193 -autostart-players=4 -autostart-ai=1:petra -autostart-civ=1:brit -autostart-ai=2:petra -autostart-civ=2:mace -autostart-ai=3:petra -autostart-civ=3:iber -autostart-ai=4:petra -autostart-civ=4:maur -autostart-nonvisual -autostart-victory=regicide

temple accepted this revision.Apr 8 2018, 11:44 PM
temple added a subscriber: temple.

Wonder if it would be better to rearrange and early return if not garrisoned and not in world, etc.

This revision is now accepted and ready to land.Apr 8 2018, 11:44 PM
This revision was automatically updated to reflect the committed changes.
mimo added a comment.EditedApr 9 2018, 6:44 PM

Thanks for the review.

In D1441#58826, @temple wrote:

Wonder if it would be better to rearrange and early return if not garrisoned and not in world, etc.

I agree, but also i don't like the current test to determine if an entity has been sent outOfWorld while being destroyed which is not really robust. It would be better to add a new UnitAI flag which would be set when a UnitAI unit is destroyed and used here for such an early return. But we'd rather do that after a23 to avoid any unforeseen side-effect (UnitAI is always full of surprises).