Page MenuHomeWildfire Games

UnitAI cleanup [GATHER]
ClosedPublic

Authored by Silier on May 31 2019, 6:34 PM.

Details

Reviewers
None
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Commits
rP23497: UnitAI cleanup [GATHER]
Summary

move ownership check before starting timer
switch conditions in if so faster evaluation goes first
nuke not needed variables
var -> let

Test Plan

check that functionality is the same

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

Silier created this revision.May 31 2019, 6:34 PM

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 356| 356| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 357| 357| 		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 358| 358| 		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 359|    |-		{
|    | 359|+		
| 360| 360| 			// we were already on the shoreline, and have not moved since
| 361| 361| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
| 362| 362| 				needToMove = false;
| 363|    |-		}
|    | 363|+		
| 364| 364| 
| 365| 365| 		if (needToMove)
| 366| 366| 			this.SetNextState("INDIVIDUAL.PICKUP.APPROACHING");
|    | [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
| 354| 354| 		// Check if we need to move     TODO implement a better way to know if we are on the shoreline
| 355| 355| 		var needToMove = true;
| 356| 356| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 357|    |-		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 358|    |-		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
|    | 357|+		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x) &&
|    | 358|+		    (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 359| 359| 		{
| 360| 360| 			// we were already on the shoreline, and have not moved since
| 361| 361| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
|    | [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
| 519| 519| 					this.PushOrderFront("Walk", this.order.data.lastPos);
| 520| 520| 				}
| 521| 521| 				else
| 522|    |-				{
|    | 522|+				
| 523| 523| 					// We couldn't move there, or the target moved away
| 524| 524| 					this.FinishOrder();
| 525|    |-				}
|    | 525|+				
| 526| 526| 				return;
| 527| 527| 			}
| 528| 528| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 734| 734| 			}
| 735| 735| 			// Check if we are already in range, otherwise walk there
| 736| 736| 			if (!this.CheckGarrisonRange(msg.data.target))
| 737|    |-			{
|    | 737|+			
| 738| 738| 				if (!this.CheckTargetVisible(msg.data.target))
| 739| 739| 				{
| 740| 740| 					this.FinishOrder();
| 745| 745| 					this.SetNextState("GARRISON.APPROACHING");
| 746| 746| 					return;
| 747| 747| 				}
| 748|    |-			}
|    | 748|+			
| 749| 749| 
| 750| 750| 			this.SetNextState("GARRISON.GARRISONING");
| 751| 751| 		},
|    | [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
| 740| 740| 					this.FinishOrder();
| 741| 741| 					return;
| 742| 742| 				}
| 743|    |-				else
| 744|    |-				{
|    | 743|+				
| 745| 744| 					this.SetNextState("GARRISON.APPROACHING");
| 746| 745| 					return;
| 747|    |-				}
|    | 746|+				
| 748| 747| 			}
| 749| 748| 
| 750| 749| 			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
| 763| 763| 						this.PushOrderFront("Walk", msg.data.lastPos);
| 764| 764| 					}
| 765| 765| 					else
| 766|    |-					{
|    | 766|+					
| 767| 767| 						// We couldn't move there, or the target moved away
| 768| 768| 						this.FinishOrder();
| 769|    |-					}
|    | 769|+					
| 770| 770| 					return;
| 771| 771| 				}
| 772| 772| 
|    | [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
|1011|1011| 			},
|1012|1012| 		},
|1013|1013| 
|1014|    |-		"GARRISON":{
|    |1014|+		"GARRISON": {
|1015|1015| 			"enter": function() {
|1016|1016| 				// If the garrisonholder should pickup, warn it so it can take needed action
|1017|1017| 				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
|1231|1231| 			// If the controller handled an order but some members rejected it,
|1232|1232| 			// they will have no orders and be in the FORMATIONMEMBER.IDLE state.
|1233|1233| 			if (this.orderQueue.length)
|1234|    |-			{
|    |1234|+			
|1235|1235| 				// We're leaving the formation, so stop our FormationWalk order
|1236|1236| 				if (this.FinishOrder())
|1237|1237| 					return;
|1238|    |-			}
|    |1238|+			
|1239|1239| 
|1240|1240| 			// No orders left, we're an individual now
|1241|1241| 			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
|1259|1259| 			// Move a tile outside the building
|1260|1260| 			let range = 4;
|1261|1261| 			if (this.CheckTargetRangeExplicit(msg.data.target, range, range))
|1262|    |-			{
|    |1262|+			
|1263|1263| 				// We are already at the target, or can't move at all
|1264|1264| 				this.FinishOrder();
|1265|    |-			}
|    |1265|+			
|1266|1266| 			else
|1267|1267| 			{
|1268|1268| 				this.order.data.min = range;
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1474|1474| 
|1475|1475| 			"LosRangeUpdate": function(msg) {
|1476|1476| 				if (this.GetStance().targetVisibleEnemies)
|1477|    |-				{
|    |1477|+				
|1478|1478| 					// Start attacking one of the newly-seen enemy (if any)
|1479|1479| 					this.AttackEntitiesByPreference(msg.data.added);
|1480|    |-				}
|    |1480|+				
|1481|1481| 			},
|1482|1482| 
|1483|1483| 			"LosHealRangeUpdate": function(msg) {
|    | [NORMAL] ESLintBear (space-before-function-paren):
|    | Unexpected space before function parentheses.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1511|1511| 				this.SelectAnimation("move");
|1512|1512| 			},
|1513|1513| 
|1514|    |-			"leave": function () {
|    |1514|+			"leave": function() {
|1515|1515| 				this.SelectAnimation("idle");
|1516|1516| 				this.StopMoving();
|1517|1517| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1688|1688| 						// if nothing better to do, check if the guarded needs to be healed or repaired
|1689|1689| 						var cmpHealth = Engine.QueryInterface(this.isGuardOf, IID_Health);
|1690|1690| 						if (cmpHealth && cmpHealth.IsInjured())
|1691|    |-						{
|    |1691|+						
|1692|1692| 							if (this.CanHeal(this.isGuardOf))
|1693|1693| 								this.PushOrderFront("Heal", { "target": this.isGuardOf, "force": false });
|1694|1694| 							else if (this.CanRepair(this.isGuardOf))
|1695|1695| 								this.PushOrderFront("Repair", { "target": this.isGuardOf, "autocontinue": false, "force": false });
|1696|    |-						}
|    |1696|+						
|1697|1697| 					}
|1698|1698| 				},
|1699|1699| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1791|1791| 				"MoveCompleted": function() {
|1792|1792| 
|1793|1793| 					if (this.CheckTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1794|    |-					{
|    |1794|+					
|1795|1795| 						// If the unit needs to unpack, do so
|1796|1796| 						if (this.CanUnpack())
|1797|1797| 						{
|1800|1800| 						}
|1801|1801| 						else
|1802|1802| 							this.SetNextState("ATTACKING");
|1803|    |-					}
|    |1803|+					
|1804|1804| 					else
|1805|1805| 					{
|1806|1806| 						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
|1798|1798| 							this.PushOrderFront("Unpack", { "force": true });
|1799|1799| 							return;
|1800|1800| 						}
|1801|    |-						else
|1802|    |-							this.SetNextState("ATTACKING");
|    |1801|+						this.SetNextState("ATTACKING");
|1803|1802| 					}
|1804|1803| 					else
|1805|1804| 					{
|    | [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
|1802|1802| 							this.SetNextState("ATTACKING");
|1803|1803| 					}
|1804|1804| 					else
|1805|    |-					{
|    |1805|+					
|1806|1806| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1807|1807| 						{
|1808|1808| 							this.SetNextState("APPROACHING");
|1812|1812| 							// Give up
|1813|1813| 							this.FinishOrder();
|1814|1814| 						}
|1815|    |-					}
|    |1815|+					
|1816|1816| 				},
|1817|1817| 			},
|1818|1818| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1804|1804| 					else
|1805|1805| 					{
|1806|1806| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1807|    |-						{
|    |1807|+						
|1808|1808| 							this.SetNextState("APPROACHING");
|1809|    |-						}
|    |1809|+						
|1810|1810| 						else
|1811|1811| 						{
|1812|1812| 							// 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
|1808|1808| 							this.SetNextState("APPROACHING");
|1809|1809| 						}
|1810|1810| 						else
|1811|    |-						{
|    |1811|+						
|1812|1812| 							// Give up
|1813|1813| 							this.FinishOrder();
|1814|    |-						}
|    |1814|+						
|1815|1815| 					}
|1816|1816| 				},
|1817|1817| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1829|1829| 					}
|1830|1830| 					// Check the target is still alive and attackable
|1831|1831| 					if (this.CanAttack(target) && !this.CheckTargetAttackRange(target, this.order.data.attackType))
|1832|    |-					{
|    |1832|+					
|1833|1833| 						// Can't reach it - try to chase after it
|1834|1834| 						if (this.ShouldChaseTargetedEntity(target, this.order.data.force))
|1835|1835| 						{
|1844|1844| 								return;
|1845|1845| 							}
|1846|1846| 						}
|1847|    |-					}
|    |1847|+					
|1848|1848| 
|1849|1849| 					this.StopMoving();
|1850|1850| 
|    | [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
|1877|1877| 					// TODO: we should probably only bother syncing projectile attacks, not melee
|1878|1878| 
|1879|1879| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|1880|    |-					this.resyncAnimation = (prepare != this.attackTimers.prepare) ? true : false;
|    |1880|+					this.resyncAnimation = (prepare != this.attackTimers.prepare);
|1881|1881| 
|1882|1882| 					this.FaceTowardsTarget(this.order.data.target);
|1883|1883| 
|    | [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
|2006|2006| 
|2007|2007| 				"Attacked": function(msg) {
|2008|2008| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2009|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2010|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2009|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2010|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2011|2011| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2012|2012| 				},
|2013|2013| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2026|2026| 					this.SelectAnimation("move");
|2027|2027| 					var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|2028|2028| 					if (cmpUnitAI && cmpUnitAI.IsFleeing())
|2029|    |-					{
|    |2029|+					
|2030|2030| 						// Run after a fleeing target
|2031|2031| 						this.SetSpeedMultiplier(this.GetRunMultiplier());
|2032|    |-					}
|    |2032|+					
|2033|2033| 					this.StartTimer(1000, 1000);
|2034|2034| 				},
|2035|2035| 
|    | [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
|2085|2085| 						// Also don't switch to a different type of huntable animal
|2086|2086| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2087|2087| 							return (
|2088|    |-								ent != oldTarget
|2089|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2088|+								ent != oldTarget &&
|    |2089|+								 ((type.generic == "treasure" && oldType.generic == "treasure")
|2090|2090| 								 || (type.specific == oldType.specific
|2091|2091| 								 && (type.specific != "meat" || oldTemplate == template)))
|2092|2092| 							);
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2086|2086| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2087|2087| 							return (
|2088|2088| 								ent != oldTarget
|2089|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2090|    |-								 || (type.specific == oldType.specific
|    |2089|+								 && ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2090|+								 (type.specific == oldType.specific
|2091|2091| 								 && (type.specific != "meat" || oldTemplate == template)))
|2092|2092| 							);
|2093|2093| 						}, 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
|2087|2087| 							return (
|2088|2088| 								ent != oldTarget
|2089|2089| 								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2090|    |-								 || (type.specific == oldType.specific
|2091|    |-								 && (type.specific != "meat" || oldTemplate == template)))
|    |2090|+								 || (type.specific == oldType.specific &&
|    |2091|+								 (type.specific != "meat" || oldTemplate == template)))
|2092|2092| 							);
|2093|2093| 						}, oldTarget);
|2094|2094| 						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
|2096|2096| 							this.PerformGather(nearby, false, false);
|2097|2097| 							return true;
|2098|2098| 						}
|2099|    |-						else
|2100|    |-						{
|    |2099|+						
|2101|2100| 							// It's probably better in this case, to avoid units getting stuck around a dropsite
|2102|2101| 							// in a "Target is far away, full, nearby are no good resources, return to dropsite" loop
|2103|2102| 							// to order it to GatherNear the resource position.
|2118|2117| 									return true;
|2119|2118| 								}
|2120|2119| 							}
|2121|    |-						}
|    |2120|+						
|2122|2121| 						return true;
|2123|2122| 					}
|2124|2123| 
|    | [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
|2108|2108| 								this.GatherNearPosition(pos.x, pos.z, oldType, oldTemplate);
|2109|2109| 								return true;
|2110|2110| 							}
|2111|    |-							else
|2112|    |-							{
|    |2111|+							
|2113|2112| 								// we're kind of stuck here. Return resource.
|2114|2113| 								var nearby = this.FindNearestDropsite(oldType.generic);
|2115|2114| 								if (nearby)
|2117|2116| 									this.PushOrderFront("ReturnResource", { "target": nearby, "force": false });
|2118|2117| 									return true;
|2119|2118| 								}
|2120|    |-							}
|    |2119|+							
|2121|2120| 						}
|2122|2121| 						return true;
|2123|2122| 					}
|    | [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
|2160|2160| 						// Also don't switch to a different type of huntable animal
|2161|2161| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2162|2162| 							return (
|2163|    |-								ent != oldTarget
|2164|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2163|+								ent != oldTarget &&
|    |2164|+								((type.generic == "treasure" && oldType.generic == "treasure")
|2165|2165| 								|| (type.specific == oldType.specific
|2166|2166| 								&& (type.specific != "meat" || oldTemplate == template)))
|2167|2167| 							);
|    | [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
|2161|2161| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2162|2162| 							return (
|2163|2163| 								ent != oldTarget
|2164|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2165|    |-								|| (type.specific == oldType.specific
|    |2164|+								&& ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2165|+								(type.specific == oldType.specific
|2166|2166| 								&& (type.specific != "meat" || oldTemplate == template)))
|2167|2167| 							);
|2168|2168| 						});
|    | [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
|2162|2162| 							return (
|2163|2163| 								ent != oldTarget
|2164|2164| 								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2165|    |-								|| (type.specific == oldType.specific
|2166|    |-								&& (type.specific != "meat" || oldTemplate == template)))
|    |2165|+								|| (type.specific == oldType.specific &&
|    |2166|+								(type.specific != "meat" || oldTemplate == template)))
|2167|2167| 							);
|2168|2168| 						});
|2169|2169| 						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
|2220|2220| 					// Also don't switch to a different type of huntable animal
|2221|2221| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2222|2222| 						return (
|2223|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2224|    |-							|| (type.specific == resourceType.specific
|    |2223|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2224|+							(type.specific == resourceType.specific
|2225|2225| 							&& (type.specific != "meat" || resourceTemplate == template))
|2226|2226| 						);
|2227|2227| 					});
|    | [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
|2221|2221| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2222|2222| 						return (
|2223|2223| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2224|    |-							|| (type.specific == resourceType.specific
|2225|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2224|+							|| (type.specific == resourceType.specific &&
|    |2225|+							(type.specific != "meat" || resourceTemplate == template))
|2226|2226| 						);
|2227|2227| 					});
|2228|2228| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2340|2340| 
|2341|2341| 					let cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply);
|2342|2342| 					if (cmpSupply && cmpSupply.IsAvailable(cmpOwnership.GetOwner(), this.entity))
|2343|    |-					{
|    |2343|+					
|2344|2344| 						// Check we can still reach and gather from the target
|2345|2345| 						if (this.CanGather(this.gatheringTarget) && this.CheckTargetRange(this.gatheringTarget, IID_ResourceGatherer))
|2346|2346| 						{
|2403|2403| 								return;
|2404|2404| 							}
|2405|2405| 						}
|2406|    |-					}
|    |2406|+					
|2407|2407| 
|2408|2408| 					// We're already in range, can't get anywhere near it or the target is exhausted.
|2409|2409| 
|    | [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
|2429|2429| 					// Also don't switch to a different type of huntable animal
|2430|2430| 					let nearbyResource = this.FindNearbyResource(function(ent, type, template) {
|2431|2431| 						return (
|2432|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2433|    |-							|| (type.specific == resourceType.specific
|    |2432|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2433|+							(type.specific == resourceType.specific
|2434|2434| 							&& (type.specific != "meat" || resourceTemplate == template))
|2435|2435| 						);
|2436|2436| 					});
|    | [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
|2430|2430| 					let nearbyResource = this.FindNearbyResource(function(ent, type, template) {
|2431|2431| 						return (
|2432|2432| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2433|    |-							|| (type.specific == resourceType.specific
|2434|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2433|+							|| (type.specific == resourceType.specific &&
|    |2434|+							(type.specific != "meat" || resourceTemplate == template))
|2435|2435| 						);
|2436|2436| 					});
|2437|2437| 					if (nearbyResource)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2495|2495| 
|2496|2496| 				"Timer": function(msg) {
|2497|2497| 					if (this.ShouldAbandonChase(this.order.data.target, this.order.data.force, IID_Heal, null))
|2498|    |-					{
|    |2498|+					
|2499|2499| 						// Return to our original position unless we have a better order.
|2500|2500| 						if (!this.FinishOrder() && this.GetStance().respondHoldGround)
|2501|2501| 							this.WalkToHeldPosition();
|2502|    |-					}
|    |2502|+					
|2503|2503| 				},
|2504|2504| 
|2505|2505| 				"MoveCompleted": function() {
|    | [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
|2529|2529| 					this.StartTimer(prepare, this.healTimers.repeat);
|2530|2530| 
|2531|2531| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2532|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2532|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2533|2533| 
|2534|2534| 					this.FaceTowardsTarget(this.order.data.target);
|2535|2535| 				},
|    | [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
|2741|2741| 					{
|2742|2742| 						// The building was already finished/fully repaired before we arrived;
|2743|2743| 						// let the ConstructionFinished handler handle this.
|2744|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2744|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2745|2745| 						return true;
|2746|2746| 					}
|2747|2747| 
|    | [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
|2741|2741| 					{
|2742|2742| 						// The building was already finished/fully repaired before we arrived;
|2743|2743| 						// let the ConstructionFinished handler handle this.
|2744|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2744|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2745|2745| 						return true;
|2746|2746| 					}
|2747|2747| 
|    | [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
|2784|2784| 					if (!inRange && this.MoveToTargetRange(this.repairTarget, IID_Builder))
|2785|2785| 						this.SetNextState("APPROACHING");
|2786|2786| 					else if (!inRange)
|2787|    |-						this.FinishOrder(); //can't approach and isn't in reach
|    |2787|+						this.FinishOrder(); // can't approach and isn't in reach
|2788|2788| 				},
|2789|2789| 			},
|2790|2790| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2871|2871| 
|2872|2872| 				// Unit was approaching and there's nothing to do now, so switch to walking
|2873|2873| 				if (oldState === "INDIVIDUAL.REPAIR.APPROACHING")
|2874|    |-				{
|    |2874|+				
|2875|2875| 					// We're already walking to the given point, so add this as a order.
|2876|2876| 					this.WalkToTarget(msg.data.newentity, true);
|2877|    |-				}
|    |2877|+				
|2878|2878| 			},
|2879|2879| 		},
|2880|2880| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2933|2933| 
|2934|2934| 					// Check that we can garrison here
|2935|2935| 					if (this.CanGarrison(target))
|2936|    |-					{
|    |2936|+					
|2937|2937| 						// Check that we're in range of the garrison target
|2938|2938| 						if (this.CheckGarrisonRange(target))
|2939|2939| 						{
|3009|3009| 								return false;
|3010|3010| 							}
|3011|3011| 						}
|3012|    |-					}
|    |3012|+					
|3013|3013| 					// Garrisoning failed for some reason, so finish the order
|3014|3014| 					this.FinishOrder();
|3015|3015| 					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
|3130|3130| 		"Attacked": function(msg) {
|3131|3131| 			if (this.template.NaturalBehaviour == "skittish" ||
|3132|3132| 			    this.template.NaturalBehaviour == "passive")
|3133|    |-			{
|    |3133|+			
|3134|3134| 				this.Flee(msg.data.attacker, false);
|3135|    |-			}
|    |3135|+			
|3136|3136| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|3137|3137| 			{
|3138|3138| 				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
|3139|3139| 					this.Attack(msg.data.attacker, false);
|3140|3140| 			}
|3141|3141| 			else if (this.template.NaturalBehaviour == "domestic")
|3142|    |-			{
|    |3142|+			
|3143|3143| 				// Never flee, stop what we were doing
|3144|3144| 				this.SetNextState("IDLE");
|3145|    |-			}
|    |3145|+			
|3146|3146| 		},
|3147|3147| 
|3148|3148| 		"Order.LeaveFoundation": function(msg) {
|    | [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
|3153|3153| 				this.FinishOrder();
|3154|3154| 				return;
|3155|3155| 			}
|3156|    |-			else
|3157|    |-			{
|    |3156|+			
|3158|3157| 				this.order.data.min = range;
|3159|3158| 				this.SetNextState("WALKING");
|3160|    |-			}
|    |3159|+			
|3161|3160| 		},
|3162|3161| 
|3163|3162| 		"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
|3197|3197| 				}
|3198|3198| 				// Start attacking one of the newly-seen enemy (if any)
|3199|3199| 				else if (this.IsDangerousAnimal())
|3200|    |-				{
|    |3200|+				
|3201|3201| 					this.AttackVisibleEntity(msg.data.added);
|3202|    |-				}
|    |3202|+				
|3203|3203| 
|3204|3204| 				// TODO: if two units enter our range together, we'll attack the
|3205|3205| 				// 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
|3240|3240| 				}
|3241|3241| 				// Start attacking one of the newly-seen enemy (if any)
|3242|3242| 				else if (this.template.NaturalBehaviour == "violent")
|3243|    |-				{
|    |3243|+				
|3244|3244| 					this.AttackVisibleEntity(msg.data.added);
|3245|    |-				}
|    |3245|+				
|3246|3246| 			},
|3247|3247| 
|3248|3248| 			"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
|3257|3257| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3258|3258| 
|3259|3259| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3260|    |-							// only used for domestic animals
|    |3260|+		// only used for domestic animals
|3261|3261| 	},
|3262|3262| };
|3263|3263| 
|    | [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
|3314|3314| 
|3315|3315| UnitAI.prototype.IsAnimal = function()
|3316|3316| {
|3317|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3317|+	return (!!this.template.NaturalBehaviour);
|3318|3318| };
|3319|3319| 
|3320|3320| 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
|3352|3352| UnitAI.prototype.GetGarrisonHolder = function()
|3353|3353| {
|3354|3354| 	if (this.IsGarrisoned())
|3355|    |-	{
|    |3355|+	
|3356|3356| 		for (let order of this.orderQueue)
|3357|3357| 			if (order.type == "Garrison")
|3358|3358| 				return order.data.target;
|3359|    |-	}
|    |3359|+	
|3360|3360| 	return INVALID_ENTITY;
|3361|3361| };
|3362|3362| 
|    | [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
|3430|3430| 		{
|3431|3431| 			let index = this.GetCurrentState().indexOf(".");
|3432|3432| 			if (index != -1)
|3433|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3433|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3434|3434| 			this.Stop(false);
|3435|3435| 		}
|3436|3436| 
|    | [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
|3486|3486| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3487|3487| 			continue;
|3488|3488| 		if (i == 0)
|3489|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3489|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3490|3490| 		else
|3491|3491| 			this.orderQueue.splice(i, 1);
|3492|3492| 		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
|3486|3486| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3487|3487| 			continue;
|3488|3488| 		if (i == 0)
|3489|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3489|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3490|3490| 		else
|3491|3491| 			this.orderQueue.splice(i, 1);
|3492|3492| 		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
|3570|3570| };
|3571|3571| 
|3572|3572| 
|3573|    |-//// FSM linkage functions ////
|    |3573|+// // FSM linkage functions ////
|3574|3574| 
|3575|3575| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3576|3576| UnitAI.prototype.SetNextState = function(state)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3742|3742| 				continue;
|3743|3743| 			if (this.orderQueue[i].type == type)
|3744|3744| 				continue;
|3745|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3745|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3746|3746| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3747|3747| 			return;
|3748|3748| 		}
|    | [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
|3742|3742| 				continue;
|3743|3743| 			if (this.orderQueue[i].type == type)
|3744|3744| 				continue;
|3745|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3745|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3746|3746| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3747|3747| 			return;
|3748|3748| 		}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3756|3756| {
|3757|3757| 	// Remember the previous work orders to be able to go back to them later if required
|3758|3758| 	if (data && data.force)
|3759|    |-	{
|    |3759|+	
|3760|3760| 		if (this.IsFormationController())
|3761|3761| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3762|3762| 		else
|3763|3763| 			this.UpdateWorkOrders(type);
|3764|    |-	}
|    |3764|+	
|3765|3765| 
|3766|3766| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3767|3767| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3833|3833| 	{
|3834|3834| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3835|3835| 		if (cmpUnitAI)
|3836|    |-		{
|    |3836|+		
|3837|3837| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3838|3838| 			{
|3839|3839| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3842|3842| 					return;
|3843|3843| 				}
|3844|3844| 			}
|3845|    |-		}
|    |3845|+		
|3846|3846| 	}
|3847|3847| 
|3848|3848| 	// 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
|3835|3835| 		if (cmpUnitAI)
|3836|3836| 		{
|3837|3837| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3838|    |-			{
|    |3838|+			
|3839|3839| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3840|3840| 				{
|3841|3841| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3842|3842| 					return;
|3843|3843| 				}
|3844|    |-			}
|    |3844|+			
|3845|3845| 		}
|3846|3846| 	}
|3847|3847| 
|    | [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
|3847|3847| 
|3848|3848| 	// If nothing found, take the unit orders
|3849|3849| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3850|    |-	{
|    |3850|+	
|3851|3851| 		if (isWorkType(this.orderQueue[i].type))
|3852|3852| 		{
|3853|3853| 			this.workOrders = this.orderQueue.slice(i);
|3854|3854| 			return;
|3855|3855| 		}
|3856|    |-	}
|    |3856|+	
|3857|3857| };
|3858|3858| 
|3859|3859| 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
|3913|3913| 	if (data.timerRepeat === undefined)
|3914|3914| 		this.timer = undefined;
|3915|3915| 
|3916|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3916|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3917|3917| };
|3918|3918| 
|3919|3919| /**
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3913|3913| 	if (data.timerRepeat === undefined)
|3914|3914| 		this.timer = undefined;
|3915|3915| 
|3916|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3916|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3917|3917| };
|3918|3918| 
|3919|3919| /**
|    | [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
|3948|3948| 	this.timer = undefined;
|3949|3949| };
|3950|3950| 
|3951|    |-//// Message handlers /////
|    |3951|+// // Message handlers /////
|3952|3952| 
|3953|3953| UnitAI.prototype.OnMotionChanged = function(msg)
|3954|3954| {
|    | [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| UnitAI.prototype.OnMotionChanged = function(msg)
|3954|3954| {
|3955|3955| 	if (msg.starting && !msg.error)
|3956|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3956|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveStarted", "data": msg});
|3957|3957| 	else if (!msg.starting || msg.error)
|3958|3958| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3959|3959| };
|    | [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| UnitAI.prototype.OnMotionChanged = function(msg)
|3954|3954| {
|3955|3955| 	if (msg.starting && !msg.error)
|3956|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3956|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg });
|3957|3957| 	else if (!msg.starting || msg.error)
|3958|3958| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3959|3959| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3955|3955| 	if (msg.starting && !msg.error)
|3956|3956| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3957|3957| 	else if (!msg.starting || msg.error)
|3958|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3958|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveCompleted", "data": msg});
|3959|3959| };
|3960|3960| 
|3961|3961| 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
|3955|3955| 	if (msg.starting && !msg.error)
|3956|3956| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3957|3957| 	else if (!msg.starting || msg.error)
|3958|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3958|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg });
|3959|3959| };
|3960|3960| 
|3961|3961| 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
|3963|3963| 	// TODO: This is a bit inefficient since every unit listens to every
|3964|3964| 	// construction message - ideally we could scope it to only the one we're building
|3965|3965| 
|3966|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3966|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3967|3967| };
|3968|3968| 
|3969|3969| 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
|3963|3963| 	// TODO: This is a bit inefficient since every unit listens to every
|3964|3964| 	// construction message - ideally we could scope it to only the one we're building
|3965|3965| 
|3966|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3966|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3967|3967| };
|3968|3968| 
|3969|3969| 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
|3988|3988| 
|3989|3989| UnitAI.prototype.OnAttacked = function(msg)
|3990|3990| {
|3991|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3991|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3992|3992| };
|3993|3993| 
|3994|3994| 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
|3988|3988| 
|3989|3989| UnitAI.prototype.OnAttacked = function(msg)
|3990|3990| {
|3991|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3991|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3992|3992| };
|3993|3993| 
|3994|3994| 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
|3993|3993| 
|3994|3994| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3995|3995| {
|3996|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3996|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|3997|3997| };
|3998|3998| 
|3999|3999| 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
|3993|3993| 
|3994|3994| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3995|3995| {
|3996|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3996|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|3997|3997| };
|3998|3998| 
|3999|3999| 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
|3998|3998| 
|3999|3999| UnitAI.prototype.OnHealthChanged = function(msg)
|4000|4000| {
|4001|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4001|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4002|4002| };
|4003|4003| 
|4004|4004| 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
|3998|3998| 
|3999|3999| UnitAI.prototype.OnHealthChanged = function(msg)
|4000|4000| {
|4001|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4001|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4002|4002| };
|4003|4003| 
|4004|4004| 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
|4004|4004| UnitAI.prototype.OnRangeUpdate = function(msg)
|4005|4005| {
|4006|4006| 	if (msg.tag == this.losRangeQuery)
|4007|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4007|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4008|4008| 	else if (msg.tag == this.losHealRangeQuery)
|4009|4009| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4010|4010| };
|    | [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
|4004|4004| UnitAI.prototype.OnRangeUpdate = function(msg)
|4005|4005| {
|4006|4006| 	if (msg.tag == this.losRangeQuery)
|4007|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4007|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4008|4008| 	else if (msg.tag == this.losHealRangeQuery)
|4009|4009| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4010|4010| };
|    | [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
|4006|4006| 	if (msg.tag == this.losRangeQuery)
|4007|4007| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4008|4008| 	else if (msg.tag == this.losHealRangeQuery)
|4009|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4009|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4010|4010| };
|4011|4011| 
|4012|4012| 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
|4006|4006| 	if (msg.tag == this.losRangeQuery)
|4007|4007| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4008|4008| 	else if (msg.tag == this.losHealRangeQuery)
|4009|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4009|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4010|4010| };
|4011|4011| 
|4012|4012| 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
|4011|4011| 
|4012|4012| UnitAI.prototype.OnPackFinished = function(msg)
|4013|4013| {
|4014|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4014|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4015|4015| };
|4016|4016| 
|4017|4017| //// 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
|4011|4011| 
|4012|4012| UnitAI.prototype.OnPackFinished = function(msg)
|4013|4013| {
|4014|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4014|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4015|4015| };
|4016|4016| 
|4017|4017| //// 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
|4014|4014| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4015|4015| };
|4016|4016| 
|4017|    |-//// Helper functions to be called by the FSM ////
|    |4017|+// // Helper functions to be called by the FSM ////
|4018|4018| 
|4019|4019| UnitAI.prototype.GetWalkSpeed = function()
|4020|4020| {
|    | [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
|4116|4116| 	if (!cmpOwnership || cmpOwnership.GetOwner() == INVALID_PLAYER)
|4117|4117| 		return undefined;
|4118|4118| 
|4119|    |-	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position)
|    |4119|+	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
|4120|4120| 	if (!cmpPosition || !cmpPosition.IsInWorld())
|4121|4121| 		return undefined;
|4122|4122| 
|    | [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
|4201|4201| 			PlaySound(name, member);
|4202|4202| 	}
|4203|4203| 	else
|4204|    |-	{
|    |4204|+	
|4205|4205| 		// Otherwise use our own sounds
|4206|4206| 		PlaySound(name, this.entity);
|4207|    |-	}
|    |4207|+	
|4208|4208| };
|4209|4209| 
|4210|4210| /*
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4297|4297| UnitAI.prototype.MoveTo = function(data, iid, type)
|4298|4298| {
|4299|4299| 	if (data["target"])
|4300|    |-	{
|    |4300|+	
|4301|4301| 		if (data["min"] || data["max"])
|4302|4302| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4303|4303| 		else
|4307|4307| 			else
|4308|4308| 				return this.MoveToTargetRange(data.target, iid, type);
|4309|4309| 		}
|4310|    |-	}
|    |4310|+	
|4311|4311| 	else
|4312|4312| 	{
|4313|4313| 		if (data["min"] || data["max"])
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["target"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4296|4296|  */
|4297|4297| UnitAI.prototype.MoveTo = function(data, iid, type)
|4298|4298| {
|4299|    |-	if (data["target"])
|    |4299|+	if (data.target)
|4300|4300| 	{
|4301|4301| 		if (data["min"] || data["max"])
|4302|4302| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["min"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4298|4298| {
|4299|4299| 	if (data["target"])
|4300|4300| 	{
|4301|    |-		if (data["min"] || data["max"])
|    |4301|+		if (data.min || data["max"])
|4302|4302| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4303|4303| 		else
|4304|4304| 		{
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["max"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4298|4298| {
|4299|4299| 	if (data["target"])
|4300|4300| 	{
|4301|    |-		if (data["min"] || data["max"])
|    |4301|+		if (data["min"] || data.max)
|4302|4302| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4303|4303| 		else
|4304|4304| 		{
|    | [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
|4301|4301| 		if (data["min"] || data["max"])
|4302|4302| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4303|4303| 		else
|4304|    |-		{
|    |4304|+		
|4305|4305| 			if (!iid)
|4306|4306| 				return this.MoveToTarget(data.target);
|4307|4307| 			else
|4308|4308| 				return this.MoveToTargetRange(data.target, iid, type);
|4309|    |-		}
|    |4309|+		
|4310|4310| 	}
|4311|4311| 	else
|4312|4312| 	{
|    | [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
|4300|4300| 	{
|4301|4301| 		if (data["min"] || data["max"])
|4302|4302| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4303|    |-		else
|4304|    |-		{
|    |4303|+		
|4305|4304| 			if (!iid)
|4306|4305| 				return this.MoveToTarget(data.target);
|4307|4306| 			else
|4308|4307| 				return this.MoveToTargetRange(data.target, iid, type);
|4309|    |-		}
|    |4308|+		
|4310|4309| 	}
|4311|4310| 	else
|4312|4311| 	{
|    | [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
|4304|4304| 		{
|4305|4305| 			if (!iid)
|4306|4306| 				return this.MoveToTarget(data.target);
|4307|    |-			else
|4308|    |-				return this.MoveToTargetRange(data.target, iid, type);
|    |4307|+			return this.MoveToTargetRange(data.target, iid, type);
|4309|4308| 		}
|4310|4309| 	}
|4311|4310| 	else
|    | [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
|4309|4309| 		}
|4310|4310| 	}
|4311|4311| 	else
|4312|    |-	{
|    |4312|+	
|4313|4313| 		if (data["min"] || data["max"])
|4314|4314| 			return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1);
|4315|4315| 		else
|4316|4316| 			return this.MoveToPoint(data.x, data.z);
|4317|    |-	}
|    |4317|+	
|4318|4318| }
|4319|4319| 
|4320|4320| UnitAI.prototype.MoveToPoint = function(x, z)
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["min"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4310|4310| 	}
|4311|4311| 	else
|4312|4312| 	{
|4313|    |-		if (data["min"] || data["max"])
|    |4313|+		if (data.min || data["max"])
|4314|4314| 			return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1);
|4315|4315| 		else
|4316|4316| 			return this.MoveToPoint(data.x, data.z);
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["max"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4310|4310| 	}
|4311|4311| 	else
|4312|4312| 	{
|4313|    |-		if (data["min"] || data["max"])
|    |4313|+		if (data["min"] || data.max)
|4314|4314| 			return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1);
|4315|4315| 		else
|4316|4316| 			return this.MoveToPoint(data.x, data.z);
|    | [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
|4312|4312| 	{
|4313|4313| 		if (data["min"] || data["max"])
|4314|4314| 			return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1);
|4315|    |-		else
|4316|    |-			return this.MoveToPoint(data.x, data.z);
|    |4315|+		return this.MoveToPoint(data.x, data.z);
|4317|4316| 	}
|4318|4317| }
|4319|4318| 
|    | [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
|4315|4315| 		else
|4316|4316| 			return this.MoveToPoint(data.x, data.z);
|4317|4317| 	}
|4318|    |-}
|    |4318|+};
|4319|4319| 
|4320|4320| UnitAI.prototype.MoveToPoint = function(x, z)
|4321|4321| {
|    | [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
|4399|4399| 	else
|4400|4400| 		// return false? Or hope you come close enough?
|4401|4401| 		var parabolicMaxRange = 0;
|4402|    |-		//return false;
|    |4402|+		// return false;
|4403|4403| 
|4404|4404| 	// the parabole changes while walking, take something in the middle
|4405|4405| 	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
|4464|4464| 	if (this.IsFormationMember())
|4465|4465| 	{
|4466|4466| 		var cmpFormationUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|4467|    |-		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation()
|4468|    |-			&& cmpFormationUnitAI.order.data.target == target)
|    |4467|+		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation() &&
|    |4468|+			cmpFormationUnitAI.order.data.target == target)
|4469|4469| 			return true;
|4470|4470| 	}
|4471|4471| 
|    | [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
|4632|4632| UnitAI.prototype.AttackEntityInZone = function(ents)
|4633|4633| {
|4634|4634| 	var target = ents.find(target =>
|4635|    |-		this.CanAttack(target)
|4636|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4635|+		this.CanAttack(target) &&
|    |4636|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4637|4637| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4638|4638| 	);
|4639|4639| 	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
|4633|4633| {
|4634|4634| 	var target = ents.find(target =>
|4635|4635| 		this.CanAttack(target)
|4636|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4637|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4636|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4637|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4638|4638| 	);
|4639|4639| 	if (!target)
|4640|4640| 		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
|4697|4697| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4698|4698| 	if (this.isGuardOf)
|4699|4699| 	{
|4700|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4700|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4701|4701| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4702|4702| 		if (cmpUnitAI && cmpAttack &&
|4703|4703| 		    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
|4701|4701| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4702|4702| 		if (cmpUnitAI && cmpAttack &&
|4703|4703| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4704|    |-				return false;
|    |4704|+			return false;
|4705|4705| 	}
|4706|4706| 
|4707|4707| 	// 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
|4706|4706| 
|4707|4707| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4708|4708| 	if (this.GetStance().respondHoldGround)
|4709|    |-	{
|    |4709|+	
|4710|4710| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4711|4711| 			return true;
|4712|    |-	}
|    |4712|+	
|4713|4713| 
|4714|4714| 	// Stop if it's left our vision range, unless we're especially persistent
|4715|4715| 	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
|4713|4713| 
|4714|4714| 	// Stop if it's left our vision range, unless we're especially persistent
|4715|4715| 	if (!this.GetStance().respondChaseBeyondVision)
|4716|    |-	{
|    |4716|+	
|4717|4717| 		if (!this.CheckTargetIsInVisionRange(target))
|4718|4718| 			return true;
|4719|    |-	}
|    |4719|+	
|4720|4720| 
|4721|4721| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4722|4722| 	// 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
|4739|4739| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4740|4740| 	if (this.isGuardOf)
|4741|4741| 	{
|4742|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4742|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4743|4743| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4744|4744| 		if (cmpUnitAI && cmpAttack &&
|4745|4745| 		    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
|4752|4752| 	return false;
|4753|4753| };
|4754|4754| 
|4755|    |-//// External interface functions ////
|    |4755|+// // External interface functions ////
|4756|4756| 
|4757|4757| UnitAI.prototype.SetFormationController = function(ent)
|4758|4758| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4762|4762| 	// of our own formation (or ourself if not in formation)
|4763|4763| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4764|4764| 	if (cmpObstruction)
|4765|    |-	{
|    |4765|+	
|4766|4766| 		if (ent == INVALID_ENTITY)
|4767|4767| 			cmpObstruction.SetControlGroup(this.entity);
|4768|4768| 		else
|4769|4769| 			cmpObstruction.SetControlGroup(ent);
|4770|    |-	}
|    |4770|+	
|4771|4771| 
|4772|4772| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4773|4773| 	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
|4905|4905| 	// if we already had an old guard order, do nothing if the target is the same
|4906|4906| 	// and the order is running, otherwise remove the previous order
|4907|4907| 	if (this.isGuardOf)
|4908|    |-	{
|    |4908|+	
|4909|4909| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4910|4910| 			return;
|4911|4911| 		else
|4912|4912| 			this.RemoveGuard();
|4913|    |-	}
|    |4913|+	
|4914|4914| 
|4915|4915| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4916|4916| };
|    | [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
|4908|4908| 	{
|4909|4909| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4910|4910| 			return;
|4911|    |-		else
|4912|    |-			this.RemoveGuard();
|    |4911|+		this.RemoveGuard();
|4913|4912| 	}
|4914|4913| 
|4915|4914| 	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
|5079|5079| 			this.WalkToTarget(target, queued);
|5080|5080| 		return;
|5081|5081| 	}
|5082|    |-	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture}, queued);
|    |5082|+	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture }, queued);
|5083|5083| };
|5084|5084| 
|5085|5085| /**
|    | [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
|5228|5228| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5229|5229| 	{
|5230|5230| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5231|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5231|+		if (cmpTrader.HasBothMarkets() &&
|5232|5232| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5233|5233| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5234|5234| 		{
|    | [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
|5509|5509| 				{
|5510|5510| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5511|5511| 					var targetClasses = this.order.data.targetClasses;
|5512|    |-					if (targetClasses.attack && cmpIdentity
|5513|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5512|+					if (targetClasses.attack && cmpIdentity &&
|    |5513|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5514|5514| 						continue;
|5515|5515| 					if (targetClasses.avoid && cmpIdentity
|5516|5516| 						&& 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
|5512|5512| 					if (targetClasses.attack && cmpIdentity
|5513|5513| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5514|5514| 						continue;
|5515|    |-					if (targetClasses.avoid && cmpIdentity
|5516|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5515|+					if (targetClasses.avoid && cmpIdentity &&
|    |5516|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5517|5517| 						continue;
|5518|5518| 					// Only used by the AIs to prevent some choices of targets
|5519|5519| 					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
|5535|5535| 		{
|5536|5536| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5537|5537| 			var targetClasses = this.order.data.targetClasses;
|5538|    |-			if (cmpIdentity && targetClasses.attack
|5539|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5538|+			if (cmpIdentity && targetClasses.attack &&
|    |5539|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5540|5540| 				continue;
|5541|5541| 			if (cmpIdentity && targetClasses.avoid
|5542|5542| 				&& 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
|5538|5538| 			if (cmpIdentity && targetClasses.attack
|5539|5539| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5540|5540| 				continue;
|5541|    |-			if (cmpIdentity && targetClasses.avoid
|5542|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5541|+			if (cmpIdentity && targetClasses.avoid &&
|    |5542|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5543|5543| 				continue;
|5544|5544| 			// Only used by the AIs to prevent some choices of targets
|5545|5545| 			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
|5681|5681| 
|5682|5682| UnitAI.prototype.SetHeldPosition = function(x, z)
|5683|5683| {
|5684|    |-	this.heldPosition = {"x": x, "z": z};
|    |5684|+	this.heldPosition = { "x": x, "z": z};
|5685|5685| };
|5686|5686| 
|5687|5687| 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
|5681|5681| 
|5682|5682| UnitAI.prototype.SetHeldPosition = function(x, z)
|5683|5683| {
|5684|    |-	this.heldPosition = {"x": x, "z": z};
|    |5684|+	this.heldPosition = {"x": x, "z": z };
|5685|5685| };
|5686|5686| 
|5687|5687| 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
|5708|5708| 	return false;
|5709|5709| };
|5710|5710| 
|5711|    |-//// Helper functions ////
|    |5711|+// // Helper functions ////
|5712|5712| 
|5713|5713| UnitAI.prototype.CanAttack = function(target)
|5714|5714| {
|    | [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
|5912|5912| 	return cmpPack && cmpPack.IsPacking();
|5913|5913| };
|5914|5914| 
|5915|    |-//// Formation specific functions ////
|    |5915|+// // Formation specific functions ////
|5916|5916| 
|5917|5917| UnitAI.prototype.IsAttackingAsFormation = function()
|5918|5918| {
|    | [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
|5917|5917| UnitAI.prototype.IsAttackingAsFormation = function()
|5918|5918| {
|5919|5919| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5920|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5921|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5920|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5921|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5922|5922| };
|5923|5923| 
|5924|5924| //// 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
|5921|5921| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5922|5922| };
|5923|5923| 
|5924|    |-//// Animal specific functions ////
|    |5924|+// // Animal specific functions ////
|5925|5925| 
|5926|5926| UnitAI.prototype.MoveRandomly = function(distance)
|5927|5927| {

binaries/data/mods/public/simulation/components/UnitAI.js
| 331| »   »   »   return·true;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'Order.WalkToTarget' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
| 895| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
| 920| »   »   »   "enter":·function(msg)·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
| 938| »   »   »   "leave":·function(msg)·{
|    | [NORMAL] ESLintBear (no-dupe-keys):
|    | Duplicate key 'leave'.

binaries/data/mods/public/simulation/components/UnitAI.js
| 973| »   »   »   »   »   return·true;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'enter' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
|1036| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1074| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1107| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1320| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1616| »   »   »   »   »   return·false;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'enter' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
|2270| »   »   »   »   »   »   »   return·false;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'enter' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
|2291| »   »   »   »   »   »   »   return·false;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'enter' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
|2296| »   »   »   »   »   »   return·true;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'enter' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
|2316| »   »   »   »   »   return·false;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'enter' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
|2474| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2592| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2694| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2903| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|3086| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|3818| »   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
|4619| »   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
|4634| »   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
|4680| »   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
|4703| »   »   ····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
|5159| »   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
| 358| »   »   ····&&·(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
| 938| »   »   »   "leave":·function(msg)·{
|    | [NORMAL] JSHintBear:
|    | Duplicate key 'leave'.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4299| »   if·(data["target"])
|    | [NORMAL] JSHintBear:
|    | ['target'] is better written in dot notation.

binaries/data/mods/public/simulation/components/UnitAI.js
|4301| »   »   if·(data["min"]·||·data["max"])
|    | [NORMAL] JSHintBear:
|    | ['min'] is better written in dot notation.

binaries/data/mods/public/simulation/components/UnitAI.js
|4301| »   »   if·(data["min"]·||·data["max"])
|    | [NORMAL] JSHintBear:
|    | ['max'] is better written in dot notation.

binaries/data/mods/public/simulation/components/UnitAI.js
|4313| »   »   if·(data["min"]·||·data["max"])
|    | [NORMAL] JSHintBear:
|    | ['min'] is better written in dot notation.

binaries/data/mods/public/simulation/components/UnitAI.js
|4313| »   »   if·(data["min"]·||·data["max"])
|    | [NORMAL] JSHintBear:
|    | ['max'] is better written in dot notation.

binaries/data/mods/public/simulation/components/UnitAI.js
|4318| }
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4412| »   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
|4468| »   »   »   &&·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
|4636| »   »   &&·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
|4637| »   »   &&·(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
|5159| »   var·lastPos·=·undefined;
|    | [NORMAL] JSHintBear:
|    | It's not necessary to initialize 'lastPos' to 'undefined'.

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|5539| »   »   »   »   &&·!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
|5539| »   »   »   »   &&·!MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.attack))
|    | [MAJOR] JSHintBear:
|    | Too many errors. (91% scanned).
Executing section cli...

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

Stan added a subscriber: Stan.May 31 2019, 7:22 PM
Stan added inline comments.
binaries/data/mods/public/simulation/components/UnitAI.js
2301 ↗(On Diff #8243)

Spaces.

2400 ↗(On Diff #8243)

Why 8 ? There is a range variable that's usually 4 also for some reason and should be a global.

2430 ↗(On Diff #8243)

arrow function ?

Silier added inline comments.May 31 2019, 7:28 PM
binaries/data/mods/public/simulation/components/UnitAI.js
2400 ↗(On Diff #8243)

looks like 4 represents distance of one tile, so here are 2 tiles ? you would need to ask philip

Stan added inline comments.May 31 2019, 7:30 PM
binaries/data/mods/public/simulation/components/UnitAI.js
2400 ↗(On Diff #8243)

Maybe then instead make the range/tilesize = 4 a global variable, then use it * 2 here ?

Silier updated this revision to Diff 8251.May 31 2019, 8:05 PM

revert stupidity

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 356| 356| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 357| 357| 		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 358| 358| 		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 359|    |-		{
|    | 359|+		
| 360| 360| 			// we were already on the shoreline, and have not moved since
| 361| 361| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
| 362| 362| 				needToMove = false;
| 363|    |-		}
|    | 363|+		
| 364| 364| 
| 365| 365| 		if (needToMove)
| 366| 366| 			this.SetNextState("INDIVIDUAL.PICKUP.APPROACHING");
|    | [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
| 354| 354| 		// Check if we need to move     TODO implement a better way to know if we are on the shoreline
| 355| 355| 		var needToMove = true;
| 356| 356| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 357|    |-		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 358|    |-		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
|    | 357|+		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x) &&
|    | 358|+		    (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 359| 359| 		{
| 360| 360| 			// we were already on the shoreline, and have not moved since
| 361| 361| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
|    | [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
| 519| 519| 					this.PushOrderFront("Walk", this.order.data.lastPos);
| 520| 520| 				}
| 521| 521| 				else
| 522|    |-				{
|    | 522|+				
| 523| 523| 					// We couldn't move there, or the target moved away
| 524| 524| 					this.FinishOrder();
| 525|    |-				}
|    | 525|+				
| 526| 526| 				return;
| 527| 527| 			}
| 528| 528| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 734| 734| 			}
| 735| 735| 			// Check if we are already in range, otherwise walk there
| 736| 736| 			if (!this.CheckGarrisonRange(msg.data.target))
| 737|    |-			{
|    | 737|+			
| 738| 738| 				if (!this.CheckTargetVisible(msg.data.target))
| 739| 739| 				{
| 740| 740| 					this.FinishOrder();
| 745| 745| 					this.SetNextState("GARRISON.APPROACHING");
| 746| 746| 					return;
| 747| 747| 				}
| 748|    |-			}
|    | 748|+			
| 749| 749| 
| 750| 750| 			this.SetNextState("GARRISON.GARRISONING");
| 751| 751| 		},
|    | [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
| 740| 740| 					this.FinishOrder();
| 741| 741| 					return;
| 742| 742| 				}
| 743|    |-				else
| 744|    |-				{
|    | 743|+				
| 745| 744| 					this.SetNextState("GARRISON.APPROACHING");
| 746| 745| 					return;
| 747|    |-				}
|    | 746|+				
| 748| 747| 			}
| 749| 748| 
| 750| 749| 			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
| 763| 763| 						this.PushOrderFront("Walk", msg.data.lastPos);
| 764| 764| 					}
| 765| 765| 					else
| 766|    |-					{
|    | 766|+					
| 767| 767| 						// We couldn't move there, or the target moved away
| 768| 768| 						this.FinishOrder();
| 769|    |-					}
|    | 769|+					
| 770| 770| 					return;
| 771| 771| 				}
| 772| 772| 
|    | [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
|1011|1011| 			},
|1012|1012| 		},
|1013|1013| 
|1014|    |-		"GARRISON":{
|    |1014|+		"GARRISON": {
|1015|1015| 			"enter": function() {
|1016|1016| 				// If the garrisonholder should pickup, warn it so it can take needed action
|1017|1017| 				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
|1231|1231| 			// If the controller handled an order but some members rejected it,
|1232|1232| 			// they will have no orders and be in the FORMATIONMEMBER.IDLE state.
|1233|1233| 			if (this.orderQueue.length)
|1234|    |-			{
|    |1234|+			
|1235|1235| 				// We're leaving the formation, so stop our FormationWalk order
|1236|1236| 				if (this.FinishOrder())
|1237|1237| 					return;
|1238|    |-			}
|    |1238|+			
|1239|1239| 
|1240|1240| 			// No orders left, we're an individual now
|1241|1241| 			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
|1259|1259| 			// Move a tile outside the building
|1260|1260| 			let range = 4;
|1261|1261| 			if (this.CheckTargetRangeExplicit(msg.data.target, range, range))
|1262|    |-			{
|    |1262|+			
|1263|1263| 				// We are already at the target, or can't move at all
|1264|1264| 				this.FinishOrder();
|1265|    |-			}
|    |1265|+			
|1266|1266| 			else
|1267|1267| 			{
|1268|1268| 				this.order.data.min = range;
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1474|1474| 
|1475|1475| 			"LosRangeUpdate": function(msg) {
|1476|1476| 				if (this.GetStance().targetVisibleEnemies)
|1477|    |-				{
|    |1477|+				
|1478|1478| 					// Start attacking one of the newly-seen enemy (if any)
|1479|1479| 					this.AttackEntitiesByPreference(msg.data.added);
|1480|    |-				}
|    |1480|+				
|1481|1481| 			},
|1482|1482| 
|1483|1483| 			"LosHealRangeUpdate": function(msg) {
|    | [NORMAL] ESLintBear (space-before-function-paren):
|    | Unexpected space before function parentheses.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1511|1511| 				this.SelectAnimation("move");
|1512|1512| 			},
|1513|1513| 
|1514|    |-			"leave": function () {
|    |1514|+			"leave": function() {
|1515|1515| 				this.SelectAnimation("idle");
|1516|1516| 				this.StopMoving();
|1517|1517| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1688|1688| 						// if nothing better to do, check if the guarded needs to be healed or repaired
|1689|1689| 						var cmpHealth = Engine.QueryInterface(this.isGuardOf, IID_Health);
|1690|1690| 						if (cmpHealth && cmpHealth.IsInjured())
|1691|    |-						{
|    |1691|+						
|1692|1692| 							if (this.CanHeal(this.isGuardOf))
|1693|1693| 								this.PushOrderFront("Heal", { "target": this.isGuardOf, "force": false });
|1694|1694| 							else if (this.CanRepair(this.isGuardOf))
|1695|1695| 								this.PushOrderFront("Repair", { "target": this.isGuardOf, "autocontinue": false, "force": false });
|1696|    |-						}
|    |1696|+						
|1697|1697| 					}
|1698|1698| 				},
|1699|1699| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1791|1791| 				"MoveCompleted": function() {
|1792|1792| 
|1793|1793| 					if (this.CheckTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1794|    |-					{
|    |1794|+					
|1795|1795| 						// If the unit needs to unpack, do so
|1796|1796| 						if (this.CanUnpack())
|1797|1797| 						{
|1800|1800| 						}
|1801|1801| 						else
|1802|1802| 							this.SetNextState("ATTACKING");
|1803|    |-					}
|    |1803|+					
|1804|1804| 					else
|1805|1805| 					{
|1806|1806| 						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
|1798|1798| 							this.PushOrderFront("Unpack", { "force": true });
|1799|1799| 							return;
|1800|1800| 						}
|1801|    |-						else
|1802|    |-							this.SetNextState("ATTACKING");
|    |1801|+						this.SetNextState("ATTACKING");
|1803|1802| 					}
|1804|1803| 					else
|1805|1804| 					{
|    | [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
|1802|1802| 							this.SetNextState("ATTACKING");
|1803|1803| 					}
|1804|1804| 					else
|1805|    |-					{
|    |1805|+					
|1806|1806| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1807|1807| 						{
|1808|1808| 							this.SetNextState("APPROACHING");
|1812|1812| 							// Give up
|1813|1813| 							this.FinishOrder();
|1814|1814| 						}
|1815|    |-					}
|    |1815|+					
|1816|1816| 				},
|1817|1817| 			},
|1818|1818| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1804|1804| 					else
|1805|1805| 					{
|1806|1806| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1807|    |-						{
|    |1807|+						
|1808|1808| 							this.SetNextState("APPROACHING");
|1809|    |-						}
|    |1809|+						
|1810|1810| 						else
|1811|1811| 						{
|1812|1812| 							// 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
|1808|1808| 							this.SetNextState("APPROACHING");
|1809|1809| 						}
|1810|1810| 						else
|1811|    |-						{
|    |1811|+						
|1812|1812| 							// Give up
|1813|1813| 							this.FinishOrder();
|1814|    |-						}
|    |1814|+						
|1815|1815| 					}
|1816|1816| 				},
|1817|1817| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1829|1829| 					}
|1830|1830| 					// Check the target is still alive and attackable
|1831|1831| 					if (this.CanAttack(target) && !this.CheckTargetAttackRange(target, this.order.data.attackType))
|1832|    |-					{
|    |1832|+					
|1833|1833| 						// Can't reach it - try to chase after it
|1834|1834| 						if (this.ShouldChaseTargetedEntity(target, this.order.data.force))
|1835|1835| 						{
|1844|1844| 								return;
|1845|1845| 							}
|1846|1846| 						}
|1847|    |-					}
|    |1847|+					
|1848|1848| 
|1849|1849| 					this.StopMoving();
|1850|1850| 
|    | [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
|1877|1877| 					// TODO: we should probably only bother syncing projectile attacks, not melee
|1878|1878| 
|1879|1879| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|1880|    |-					this.resyncAnimation = (prepare != this.attackTimers.prepare) ? true : false;
|    |1880|+					this.resyncAnimation = (prepare != this.attackTimers.prepare);
|1881|1881| 
|1882|1882| 					this.FaceTowardsTarget(this.order.data.target);
|1883|1883| 
|    | [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
|2006|2006| 
|2007|2007| 				"Attacked": function(msg) {
|2008|2008| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2009|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2010|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2009|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2010|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2011|2011| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2012|2012| 				},
|2013|2013| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2026|2026| 					this.SelectAnimation("move");
|2027|2027| 					var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|2028|2028| 					if (cmpUnitAI && cmpUnitAI.IsFleeing())
|2029|    |-					{
|    |2029|+					
|2030|2030| 						// Run after a fleeing target
|2031|2031| 						this.SetSpeedMultiplier(this.GetRunMultiplier());
|2032|    |-					}
|    |2032|+					
|2033|2033| 					this.StartTimer(1000, 1000);
|2034|2034| 				},
|2035|2035| 
|    | [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
|2085|2085| 						// Also don't switch to a different type of huntable animal
|2086|2086| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2087|2087| 							return (
|2088|    |-								ent != oldTarget
|2089|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2088|+								ent != oldTarget &&
|    |2089|+								 ((type.generic == "treasure" && oldType.generic == "treasure")
|2090|2090| 								 || (type.specific == oldType.specific
|2091|2091| 								 && (type.specific != "meat" || oldTemplate == template)))
|2092|2092| 							);
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2086|2086| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2087|2087| 							return (
|2088|2088| 								ent != oldTarget
|2089|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2090|    |-								 || (type.specific == oldType.specific
|    |2089|+								 && ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2090|+								 (type.specific == oldType.specific
|2091|2091| 								 && (type.specific != "meat" || oldTemplate == template)))
|2092|2092| 							);
|2093|2093| 						}, 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
|2087|2087| 							return (
|2088|2088| 								ent != oldTarget
|2089|2089| 								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2090|    |-								 || (type.specific == oldType.specific
|2091|    |-								 && (type.specific != "meat" || oldTemplate == template)))
|    |2090|+								 || (type.specific == oldType.specific &&
|    |2091|+								 (type.specific != "meat" || oldTemplate == template)))
|2092|2092| 							);
|2093|2093| 						}, oldTarget);
|2094|2094| 						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
|2096|2096| 							this.PerformGather(nearby, false, false);
|2097|2097| 							return true;
|2098|2098| 						}
|2099|    |-						else
|2100|    |-						{
|    |2099|+						
|2101|2100| 							// It's probably better in this case, to avoid units getting stuck around a dropsite
|2102|2101| 							// in a "Target is far away, full, nearby are no good resources, return to dropsite" loop
|2103|2102| 							// to order it to GatherNear the resource position.
|2118|2117| 									return true;
|2119|2118| 								}
|2120|2119| 							}
|2121|    |-						}
|    |2120|+						
|2122|2121| 						return true;
|2123|2122| 					}
|2124|2123| 
|    | [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
|2108|2108| 								this.GatherNearPosition(pos.x, pos.z, oldType, oldTemplate);
|2109|2109| 								return true;
|2110|2110| 							}
|2111|    |-							else
|2112|    |-							{
|    |2111|+							
|2113|2112| 								// we're kind of stuck here. Return resource.
|2114|2113| 								var nearby = this.FindNearestDropsite(oldType.generic);
|2115|2114| 								if (nearby)
|2117|2116| 									this.PushOrderFront("ReturnResource", { "target": nearby, "force": false });
|2118|2117| 									return true;
|2119|2118| 								}
|2120|    |-							}
|    |2119|+							
|2121|2120| 						}
|2122|2121| 						return true;
|2123|2122| 					}
|    | [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
|2160|2160| 						// Also don't switch to a different type of huntable animal
|2161|2161| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2162|2162| 							return (
|2163|    |-								ent != oldTarget
|2164|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2163|+								ent != oldTarget &&
|    |2164|+								((type.generic == "treasure" && oldType.generic == "treasure")
|2165|2165| 								|| (type.specific == oldType.specific
|2166|2166| 								&& (type.specific != "meat" || oldTemplate == template)))
|2167|2167| 							);
|    | [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
|2161|2161| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2162|2162| 							return (
|2163|2163| 								ent != oldTarget
|2164|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2165|    |-								|| (type.specific == oldType.specific
|    |2164|+								&& ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2165|+								(type.specific == oldType.specific
|2166|2166| 								&& (type.specific != "meat" || oldTemplate == template)))
|2167|2167| 							);
|2168|2168| 						});
|    | [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
|2162|2162| 							return (
|2163|2163| 								ent != oldTarget
|2164|2164| 								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2165|    |-								|| (type.specific == oldType.specific
|2166|    |-								&& (type.specific != "meat" || oldTemplate == template)))
|    |2165|+								|| (type.specific == oldType.specific &&
|    |2166|+								(type.specific != "meat" || oldTemplate == template)))
|2167|2167| 							);
|2168|2168| 						});
|2169|2169| 						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
|2220|2220| 					// Also don't switch to a different type of huntable animal
|2221|2221| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2222|2222| 						return (
|2223|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2224|    |-							|| (type.specific == resourceType.specific
|    |2223|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2224|+							(type.specific == resourceType.specific
|2225|2225| 							&& (type.specific != "meat" || resourceTemplate == template))
|2226|2226| 						);
|2227|2227| 					});
|    | [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
|2221|2221| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2222|2222| 						return (
|2223|2223| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2224|    |-							|| (type.specific == resourceType.specific
|2225|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2224|+							|| (type.specific == resourceType.specific &&
|    |2225|+							(type.specific != "meat" || resourceTemplate == template))
|2226|2226| 						);
|2227|2227| 					});
|2228|2228| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2337|2337| 
|2338|2338| 					let cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply);
|2339|2339| 					if (cmpSupply && cmpSupply.IsAvailable(cmpOwnership.GetOwner(), this.entity))
|2340|    |-					{
|    |2340|+					
|2341|2341| 						// Check we can still reach and gather from the target
|2342|2342| 						if (this.CanGather(this.gatheringTarget) && this.CheckTargetRange(this.gatheringTarget, IID_ResourceGatherer))
|2343|2343| 						{
|2400|2400| 								return;
|2401|2401| 							}
|2402|2402| 						}
|2403|    |-					}
|    |2403|+					
|2404|2404| 
|2405|2405| 					// We're already in range, can't get anywhere near it or the target is exhausted.
|2406|2406| 
|    | [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
|2426|2426| 					// Also don't switch to a different type of huntable animal
|2427|2427| 					let nearbyResource = this.FindNearbyResource(function(ent, type, template) {
|2428|2428| 						return (
|2429|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2430|    |-							|| (type.specific == resourceType.specific
|    |2429|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2430|+							(type.specific == resourceType.specific
|2431|2431| 							&& (type.specific != "meat" || resourceTemplate == template))
|2432|2432| 						);
|2433|2433| 					});
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2427|2427| 					let nearbyResource = this.FindNearbyResource(function(ent, type, template) {
|2428|2428| 						return (
|2429|2429| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2430|    |-							|| (type.specific == resourceType.specific
|2431|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2430|+							|| (type.specific == resourceType.specific &&
|    |2431|+							(type.specific != "meat" || resourceTemplate == template))
|2432|2432| 						);
|2433|2433| 					});
|2434|2434| 					if (nearbyResource)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2492|2492| 
|2493|2493| 				"Timer": function(msg) {
|2494|2494| 					if (this.ShouldAbandonChase(this.order.data.target, this.order.data.force, IID_Heal, null))
|2495|    |-					{
|    |2495|+					
|2496|2496| 						// Return to our original position unless we have a better order.
|2497|2497| 						if (!this.FinishOrder() && this.GetStance().respondHoldGround)
|2498|2498| 							this.WalkToHeldPosition();
|2499|    |-					}
|    |2499|+					
|2500|2500| 				},
|2501|2501| 
|2502|2502| 				"MoveCompleted": function() {
|    | [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
|2526|2526| 					this.StartTimer(prepare, this.healTimers.repeat);
|2527|2527| 
|2528|2528| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2529|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2529|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2530|2530| 
|2531|2531| 					this.FaceTowardsTarget(this.order.data.target);
|2532|2532| 				},
|    | [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
|2738|2738| 					{
|2739|2739| 						// The building was already finished/fully repaired before we arrived;
|2740|2740| 						// let the ConstructionFinished handler handle this.
|2741|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2741|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2742|2742| 						return true;
|2743|2743| 					}
|2744|2744| 
|    | [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
|2738|2738| 					{
|2739|2739| 						// The building was already finished/fully repaired before we arrived;
|2740|2740| 						// let the ConstructionFinished handler handle this.
|2741|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2741|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2742|2742| 						return true;
|2743|2743| 					}
|2744|2744| 
|    | [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
|2781|2781| 					if (!inRange && this.MoveToTargetRange(this.repairTarget, IID_Builder))
|2782|2782| 						this.SetNextState("APPROACHING");
|2783|2783| 					else if (!inRange)
|2784|    |-						this.FinishOrder(); //can't approach and isn't in reach
|    |2784|+						this.FinishOrder(); // can't approach and isn't in reach
|2785|2785| 				},
|2786|2786| 			},
|2787|2787| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2868|2868| 
|2869|2869| 				// Unit was approaching and there's nothing to do now, so switch to walking
|2870|2870| 				if (oldState === "INDIVIDUAL.REPAIR.APPROACHING")
|2871|    |-				{
|    |2871|+				
|2872|2872| 					// We're already walking to the given point, so add this as a order.
|2873|2873| 					this.WalkToTarget(msg.data.newentity, true);
|2874|    |-				}
|    |2874|+				
|2875|2875| 			},
|2876|2876| 		},
|2877|2877| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2930|2930| 
|2931|2931| 					// Check that we can garrison here
|2932|2932| 					if (this.CanGarrison(target))
|2933|    |-					{
|    |2933|+					
|2934|2934| 						// Check that we're in range of the garrison target
|2935|2935| 						if (this.CheckGarrisonRange(target))
|2936|2936| 						{
|3006|3006| 								return false;
|3007|3007| 							}
|3008|3008| 						}
|3009|    |-					}
|    |3009|+					
|3010|3010| 					// Garrisoning failed for some reason, so finish the order
|3011|3011| 					this.FinishOrder();
|3012|3012| 					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
|3127|3127| 		"Attacked": function(msg) {
|3128|3128| 			if (this.template.NaturalBehaviour == "skittish" ||
|3129|3129| 			    this.template.NaturalBehaviour == "passive")
|3130|    |-			{
|    |3130|+			
|3131|3131| 				this.Flee(msg.data.attacker, false);
|3132|    |-			}
|    |3132|+			
|3133|3133| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|3134|3134| 			{
|3135|3135| 				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
|3136|3136| 					this.Attack(msg.data.attacker, false);
|3137|3137| 			}
|3138|3138| 			else if (this.template.NaturalBehaviour == "domestic")
|3139|    |-			{
|    |3139|+			
|3140|3140| 				// Never flee, stop what we were doing
|3141|3141| 				this.SetNextState("IDLE");
|3142|    |-			}
|    |3142|+			
|3143|3143| 		},
|3144|3144| 
|3145|3145| 		"Order.LeaveFoundation": function(msg) {
|    | [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
|3150|3150| 				this.FinishOrder();
|3151|3151| 				return;
|3152|3152| 			}
|3153|    |-			else
|3154|    |-			{
|    |3153|+			
|3155|3154| 				this.order.data.min = range;
|3156|3155| 				this.SetNextState("WALKING");
|3157|    |-			}
|    |3156|+			
|3158|3157| 		},
|3159|3158| 
|3160|3159| 		"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
|3194|3194| 				}
|3195|3195| 				// Start attacking one of the newly-seen enemy (if any)
|3196|3196| 				else if (this.IsDangerousAnimal())
|3197|    |-				{
|    |3197|+				
|3198|3198| 					this.AttackVisibleEntity(msg.data.added);
|3199|    |-				}
|    |3199|+				
|3200|3200| 
|3201|3201| 				// TODO: if two units enter our range together, we'll attack the
|3202|3202| 				// 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
|3237|3237| 				}
|3238|3238| 				// Start attacking one of the newly-seen enemy (if any)
|3239|3239| 				else if (this.template.NaturalBehaviour == "violent")
|3240|    |-				{
|    |3240|+				
|3241|3241| 					this.AttackVisibleEntity(msg.data.added);
|3242|    |-				}
|    |3242|+				
|3243|3243| 			},
|3244|3244| 
|3245|3245| 			"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
|3254|3254| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3255|3255| 
|3256|3256| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3257|    |-							// only used for domestic animals
|    |3257|+		// only used for domestic animals
|3258|3258| 	},
|3259|3259| };
|3260|3260| 
|    | [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
|3311|3311| 
|3312|3312| UnitAI.prototype.IsAnimal = function()
|3313|3313| {
|3314|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3314|+	return (!!this.template.NaturalBehaviour);
|3315|3315| };
|3316|3316| 
|3317|3317| 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
|3349|3349| UnitAI.prototype.GetGarrisonHolder = function()
|3350|3350| {
|3351|3351| 	if (this.IsGarrisoned())
|3352|    |-	{
|    |3352|+	
|3353|3353| 		for (let order of this.orderQueue)
|3354|3354| 			if (order.type == "Garrison")
|3355|3355| 				return order.data.target;
|3356|    |-	}
|    |3356|+	
|3357|3357| 	return INVALID_ENTITY;
|3358|3358| };
|3359|3359| 
|    | [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
|3427|3427| 		{
|3428|3428| 			let index = this.GetCurrentState().indexOf(".");
|3429|3429| 			if (index != -1)
|3430|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3430|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3431|3431| 			this.Stop(false);
|3432|3432| 		}
|3433|3433| 
|    | [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
|3483|3483| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3484|3484| 			continue;
|3485|3485| 		if (i == 0)
|3486|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3486|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3487|3487| 		else
|3488|3488| 			this.orderQueue.splice(i, 1);
|3489|3489| 		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
|3483|3483| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3484|3484| 			continue;
|3485|3485| 		if (i == 0)
|3486|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3486|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3487|3487| 		else
|3488|3488| 			this.orderQueue.splice(i, 1);
|3489|3489| 		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
|3567|3567| };
|3568|3568| 
|3569|3569| 
|3570|    |-//// FSM linkage functions ////
|    |3570|+// // FSM linkage functions ////
|3571|3571| 
|3572|3572| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3573|3573| UnitAI.prototype.SetNextState = function(state)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3739|3739| 				continue;
|3740|3740| 			if (this.orderQueue[i].type == type)
|3741|3741| 				continue;
|3742|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3742|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3743|3743| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3744|3744| 			return;
|3745|3745| 		}
|    | [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
|3739|3739| 				continue;
|3740|3740| 			if (this.orderQueue[i].type == type)
|3741|3741| 				continue;
|3742|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3742|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3743|3743| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3744|3744| 			return;
|3745|3745| 		}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3753|3753| {
|3754|3754| 	// Remember the previous work orders to be able to go back to them later if required
|3755|3755| 	if (data && data.force)
|3756|    |-	{
|    |3756|+	
|3757|3757| 		if (this.IsFormationController())
|3758|3758| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3759|3759| 		else
|3760|3760| 			this.UpdateWorkOrders(type);
|3761|    |-	}
|    |3761|+	
|3762|3762| 
|3763|3763| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3764|3764| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3830|3830| 	{
|3831|3831| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3832|3832| 		if (cmpUnitAI)
|3833|    |-		{
|    |3833|+		
|3834|3834| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3835|3835| 			{
|3836|3836| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3839|3839| 					return;
|3840|3840| 				}
|3841|3841| 			}
|3842|    |-		}
|    |3842|+		
|3843|3843| 	}
|3844|3844| 
|3845|3845| 	// 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
|3832|3832| 		if (cmpUnitAI)
|3833|3833| 		{
|3834|3834| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3835|    |-			{
|    |3835|+			
|3836|3836| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3837|3837| 				{
|3838|3838| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3839|3839| 					return;
|3840|3840| 				}
|3841|    |-			}
|    |3841|+			
|3842|3842| 		}
|3843|3843| 	}
|3844|3844| 
|    | [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
|3844|3844| 
|3845|3845| 	// If nothing found, take the unit orders
|3846|3846| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3847|    |-	{
|    |3847|+	
|3848|3848| 		if (isWorkType(this.orderQueue[i].type))
|3849|3849| 		{
|3850|3850| 			this.workOrders = this.orderQueue.slice(i);
|3851|3851| 			return;
|3852|3852| 		}
|3853|    |-	}
|    |3853|+	
|3854|3854| };
|3855|3855| 
|3856|3856| 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
|3910|3910| 	if (data.timerRepeat === undefined)
|3911|3911| 		this.timer = undefined;
|3912|3912| 
|3913|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3913|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3914|3914| };
|3915|3915| 
|3916|3916| /**
|    | [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
|3910|3910| 	if (data.timerRepeat === undefined)
|3911|3911| 		this.timer = undefined;
|3912|3912| 
|3913|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3913|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3914|3914| };
|3915|3915| 
|3916|3916| /**
|    | [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
|3945|3945| 	this.timer = undefined;
|3946|3946| };
|3947|3947| 
|3948|    |-//// Message handlers /////
|    |3948|+// // Message handlers /////
|3949|3949| 
|3950|3950| UnitAI.prototype.OnMotionChanged = function(msg)
|3951|3951| {
|    | [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
|3950|3950| UnitAI.prototype.OnMotionChanged = function(msg)
|3951|3951| {
|3952|3952| 	if (msg.starting && !msg.error)
|3953|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3953|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveStarted", "data": msg});
|3954|3954| 	else if (!msg.starting || msg.error)
|3955|3955| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3956|3956| };
|    | [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
|3950|3950| UnitAI.prototype.OnMotionChanged = function(msg)
|3951|3951| {
|3952|3952| 	if (msg.starting && !msg.error)
|3953|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3953|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg });
|3954|3954| 	else if (!msg.starting || msg.error)
|3955|3955| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3956|3956| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3952|3952| 	if (msg.starting && !msg.error)
|3953|3953| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3954|3954| 	else if (!msg.starting || msg.error)
|3955|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3955|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveCompleted", "data": msg});
|3956|3956| };
|3957|3957| 
|3958|3958| 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
|3952|3952| 	if (msg.starting && !msg.error)
|3953|3953| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3954|3954| 	else if (!msg.starting || msg.error)
|3955|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3955|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg });
|3956|3956| };
|3957|3957| 
|3958|3958| 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
|3960|3960| 	// TODO: This is a bit inefficient since every unit listens to every
|3961|3961| 	// construction message - ideally we could scope it to only the one we're building
|3962|3962| 
|3963|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3963|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3964|3964| };
|3965|3965| 
|3966|3966| 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
|3960|3960| 	// TODO: This is a bit inefficient since every unit listens to every
|3961|3961| 	// construction message - ideally we could scope it to only the one we're building
|3962|3962| 
|3963|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3963|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3964|3964| };
|3965|3965| 
|3966|3966| 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
|3985|3985| 
|3986|3986| UnitAI.prototype.OnAttacked = function(msg)
|3987|3987| {
|3988|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3988|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3989|3989| };
|3990|3990| 
|3991|3991| 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
|3985|3985| 
|3986|3986| UnitAI.prototype.OnAttacked = function(msg)
|3987|3987| {
|3988|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3988|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3989|3989| };
|3990|3990| 
|3991|3991| 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
|3990|3990| 
|3991|3991| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3992|3992| {
|3993|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3993|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|3994|3994| };
|3995|3995| 
|3996|3996| 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
|3990|3990| 
|3991|3991| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3992|3992| {
|3993|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3993|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|3994|3994| };
|3995|3995| 
|3996|3996| 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
|3995|3995| 
|3996|3996| UnitAI.prototype.OnHealthChanged = function(msg)
|3997|3997| {
|3998|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3998|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|3999|3999| };
|4000|4000| 
|4001|4001| 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
|3995|3995| 
|3996|3996| UnitAI.prototype.OnHealthChanged = function(msg)
|3997|3997| {
|3998|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3998|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|3999|3999| };
|4000|4000| 
|4001|4001| 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
|4001|4001| UnitAI.prototype.OnRangeUpdate = function(msg)
|4002|4002| {
|4003|4003| 	if (msg.tag == this.losRangeQuery)
|4004|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4004|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4005|4005| 	else if (msg.tag == this.losHealRangeQuery)
|4006|4006| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4007|4007| };
|    | [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
|4001|4001| UnitAI.prototype.OnRangeUpdate = function(msg)
|4002|4002| {
|4003|4003| 	if (msg.tag == this.losRangeQuery)
|4004|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4004|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4005|4005| 	else if (msg.tag == this.losHealRangeQuery)
|4006|4006| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4007|4007| };
|    | [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
|4003|4003| 	if (msg.tag == this.losRangeQuery)
|4004|4004| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4005|4005| 	else if (msg.tag == this.losHealRangeQuery)
|4006|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4006|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4007|4007| };
|4008|4008| 
|4009|4009| 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
|4003|4003| 	if (msg.tag == this.losRangeQuery)
|4004|4004| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4005|4005| 	else if (msg.tag == this.losHealRangeQuery)
|4006|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4006|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4007|4007| };
|4008|4008| 
|4009|4009| 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
|4008|4008| 
|4009|4009| UnitAI.prototype.OnPackFinished = function(msg)
|4010|4010| {
|4011|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4011|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4012|4012| };
|4013|4013| 
|4014|4014| //// 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
|4008|4008| 
|4009|4009| UnitAI.prototype.OnPackFinished = function(msg)
|4010|4010| {
|4011|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4011|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4012|4012| };
|4013|4013| 
|4014|4014| //// 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
|4011|4011| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4012|4012| };
|4013|4013| 
|4014|    |-//// Helper functions to be called by the FSM ////
|    |4014|+// // Helper functions to be called by the FSM ////
|4015|4015| 
|4016|4016| UnitAI.prototype.GetWalkSpeed = function()
|4017|4017| {
|    | [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
|4113|4113| 	if (!cmpOwnership || cmpOwnership.GetOwner() == INVALID_PLAYER)
|4114|4114| 		return undefined;
|4115|4115| 
|4116|    |-	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position)
|    |4116|+	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
|4117|4117| 	if (!cmpPosition || !cmpPosition.IsInWorld())
|4118|4118| 		return undefined;
|4119|4119| 
|    | [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
|4198|4198| 			PlaySound(name, member);
|4199|4199| 	}
|4200|4200| 	else
|4201|    |-	{
|    |4201|+	
|4202|4202| 		// Otherwise use our own sounds
|4203|4203| 		PlaySound(name, this.entity);
|4204|    |-	}
|    |4204|+	
|4205|4205| };
|4206|4206| 
|4207|4207| /*
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4294|4294| UnitAI.prototype.MoveTo = function(data, iid, type)
|4295|4295| {
|4296|4296| 	if (data["target"])
|4297|    |-	{
|    |4297|+	
|4298|4298| 		if (data["min"] || data["max"])
|4299|4299| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4300|4300| 		else
|4304|4304| 			else
|4305|4305| 				return this.MoveToTargetRange(data.target, iid, type);
|4306|4306| 		}
|4307|    |-	}
|    |4307|+	
|4308|4308| 	else
|4309|4309| 	{
|4310|4310| 		if (data["min"] || data["max"])
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["target"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4293|4293|  */
|4294|4294| UnitAI.prototype.MoveTo = function(data, iid, type)
|4295|4295| {
|4296|    |-	if (data["target"])
|    |4296|+	if (data.target)
|4297|4297| 	{
|4298|4298| 		if (data["min"] || data["max"])
|4299|4299| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["min"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4295|4295| {
|4296|4296| 	if (data["target"])
|4297|4297| 	{
|4298|    |-		if (data["min"] || data["max"])
|    |4298|+		if (data.min || data["max"])
|4299|4299| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4300|4300| 		else
|4301|4301| 		{
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["max"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4295|4295| {
|4296|4296| 	if (data["target"])
|4297|4297| 	{
|4298|    |-		if (data["min"] || data["max"])
|    |4298|+		if (data["min"] || data.max)
|4299|4299| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4300|4300| 		else
|4301|4301| 		{
|    | [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
|4298|4298| 		if (data["min"] || data["max"])
|4299|4299| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4300|4300| 		else
|4301|    |-		{
|    |4301|+		
|4302|4302| 			if (!iid)
|4303|4303| 				return this.MoveToTarget(data.target);
|4304|4304| 			else
|4305|4305| 				return this.MoveToTargetRange(data.target, iid, type);
|4306|    |-		}
|    |4306|+		
|4307|4307| 	}
|4308|4308| 	else
|4309|4309| 	{
|    | [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
|4297|4297| 	{
|4298|4298| 		if (data["min"] || data["max"])
|4299|4299| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4300|    |-		else
|4301|    |-		{
|    |4300|+		
|4302|4301| 			if (!iid)
|4303|4302| 				return this.MoveToTarget(data.target);
|4304|4303| 			else
|4305|4304| 				return this.MoveToTargetRange(data.target, iid, type);
|4306|    |-		}
|    |4305|+		
|4307|4306| 	}
|4308|4307| 	else
|4309|4308| 	{
|    | [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
|4301|4301| 		{
|4302|4302| 			if (!iid)
|4303|4303| 				return this.MoveToTarget(data.target);
|4304|    |-			else
|4305|    |-				return this.MoveToTargetRange(data.target, iid, type);
|    |4304|+			return this.MoveToTargetRange(data.target, iid, type);
|4306|4305| 		}
|4307|4306| 	}
|4308|4307| 	else
|    | [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
|4306|4306| 		}
|4307|4307| 	}
|4308|4308| 	else
|4309|    |-	{
|    |4309|+	
|4310|4310| 		if (data["min"] || data["max"])
|4311|4311| 			return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1);
|4312|4312| 		else
|4313|4313| 			return this.MoveToPoint(data.x, data.z);
|4314|    |-	}
|    |4314|+	
|4315|4315| }
|4316|4316| 
|4317|4317| UnitAI.prototype.MoveToPoint = function(x, z)
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["min"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4307|4307| 	}
|4308|4308| 	else
|4309|4309| 	{
|4310|    |-		if (data["min"] || data["max"])
|    |4310|+		if (data.min || data["max"])
|4311|4311| 			return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1);
|4312|4312| 		else
|4313|4313| 			return this.MoveToPoint(data.x, data.z);
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["max"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4307|4307| 	}
|4308|4308| 	else
|4309|4309| 	{
|4310|    |-		if (data["min"] || data["max"])
|    |4310|+		if (data["min"] || data.max)
|4311|4311| 			return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1);
|4312|4312| 		else
|4313|4313| 			return this.MoveToPoint(data.x, data.z);
|    | [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
|4309|4309| 	{
|4310|4310| 		if (data["min"] || data["max"])
|4311|4311| 			return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1);
|4312|    |-		else
|4313|    |-			return this.MoveToPoint(data.x, data.z);
|    |4312|+		return this.MoveToPoint(data.x, data.z);
|4314|4313| 	}
|4315|4314| }
|4316|4315| 
|    | [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
|4312|4312| 		else
|4313|4313| 			return this.MoveToPoint(data.x, data.z);
|4314|4314| 	}
|4315|    |-}
|    |4315|+};
|4316|4316| 
|4317|4317| UnitAI.prototype.MoveToPoint = function(x, z)
|4318|4318| {
|    | [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
|4396|4396| 	else
|4397|4397| 		// return false? Or hope you come close enough?
|4398|4398| 		var parabolicMaxRange = 0;
|4399|    |-		//return false;
|    |4399|+		// return false;
|4400|4400| 
|4401|4401| 	// the parabole changes while walking, take something in the middle
|4402|4402| 	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
|4461|4461| 	if (this.IsFormationMember())
|4462|4462| 	{
|4463|4463| 		var cmpFormationUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|4464|    |-		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation()
|4465|    |-			&& cmpFormationUnitAI.order.data.target == target)
|    |4464|+		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation() &&
|    |4465|+			cmpFormationUnitAI.order.data.target == target)
|4466|4466| 			return true;
|4467|4467| 	}
|4468|4468| 
|    | [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
|4629|4629| UnitAI.prototype.AttackEntityInZone = function(ents)
|4630|4630| {
|4631|4631| 	var target = ents.find(target =>
|4632|    |-		this.CanAttack(target)
|4633|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4632|+		this.CanAttack(target) &&
|    |4633|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4634|4634| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4635|4635| 	);
|4636|4636| 	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
|4630|4630| {
|4631|4631| 	var target = ents.find(target =>
|4632|4632| 		this.CanAttack(target)
|4633|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4634|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4633|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4634|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4635|4635| 	);
|4636|4636| 	if (!target)
|4637|4637| 		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
|4694|4694| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4695|4695| 	if (this.isGuardOf)
|4696|4696| 	{
|4697|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4697|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4698|4698| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4699|4699| 		if (cmpUnitAI && cmpAttack &&
|4700|4700| 		    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
|4698|4698| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4699|4699| 		if (cmpUnitAI && cmpAttack &&
|4700|4700| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4701|    |-				return false;
|    |4701|+			return false;
|4702|4702| 	}
|4703|4703| 
|4704|4704| 	// 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
|4703|4703| 
|4704|4704| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4705|4705| 	if (this.GetStance().respondHoldGround)
|4706|    |-	{
|    |4706|+	
|4707|4707| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4708|4708| 			return true;
|4709|    |-	}
|    |4709|+	
|4710|4710| 
|4711|4711| 	// Stop if it's left our vision range, unless we're especially persistent
|4712|4712| 	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
|4710|4710| 
|4711|4711| 	// Stop if it's left our vision range, unless we're especially persistent
|4712|4712| 	if (!this.GetStance().respondChaseBeyondVision)
|4713|    |-	{
|    |4713|+	
|4714|4714| 		if (!this.CheckTargetIsInVisionRange(target))
|4715|4715| 			return true;
|4716|    |-	}
|    |4716|+	
|4717|4717| 
|4718|4718| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4719|4719| 	// 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
|4736|4736| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4737|4737| 	if (this.isGuardOf)
|4738|4738| 	{
|4739|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4739|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4740|4740| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4741|4741| 		if (cmpUnitAI && cmpAttack &&
|4742|4742| 		    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
|4749|4749| 	return false;
|4750|4750| };
|4751|4751| 
|4752|    |-//// External interface functions ////
|    |4752|+// // External interface functions ////
|4753|4753| 
|4754|4754| UnitAI.prototype.SetFormationController = function(ent)
|4755|4755| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4759|4759| 	// of our own formation (or ourself if not in formation)
|4760|4760| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4761|4761| 	if (cmpObstruction)
|4762|    |-	{
|    |4762|+	
|4763|4763| 		if (ent == INVALID_ENTITY)
|4764|4764| 			cmpObstruction.SetControlGroup(this.entity);
|4765|4765| 		else
|4766|4766| 			cmpObstruction.SetControlGroup(ent);
|4767|    |-	}
|    |4767|+	
|4768|4768| 
|4769|4769| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4770|4770| 	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
|4902|4902| 	// if we already had an old guard order, do nothing if the target is the same
|4903|4903| 	// and the order is running, otherwise remove the previous order
|4904|4904| 	if (this.isGuardOf)
|4905|    |-	{
|    |4905|+	
|4906|4906| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4907|4907| 			return;
|4908|4908| 		else
|4909|4909| 			this.RemoveGuard();
|4910|    |-	}
|    |4910|+	
|4911|4911| 
|4912|4912| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4913|4913| };
|    | [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
|4905|4905| 	{
|4906|4906| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4907|4907| 			return;
|4908|    |-		else
|4909|    |-			this.RemoveGuard();
|    |4908|+		this.RemoveGuard();
|4910|4909| 	}
|4911|4910| 
|4912|4911| 	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
|5076|5076| 			this.WalkToTarget(target, queued);
|5077|5077| 		return;
|5078|5078| 	}
|5079|    |-	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture}, queued);
|    |5079|+	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture }, queued);
|5080|5080| };
|5081|5081| 
|5082|5082| /**
|    | [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
|5225|5225| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5226|5226| 	{
|5227|5227| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5228|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5228|+		if (cmpTrader.HasBothMarkets() &&
|5229|5229| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5230|5230| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5231|5231| 		{
|    | [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
|5506|5506| 				{
|5507|5507| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5508|5508| 					var targetClasses = this.order.data.targetClasses;
|5509|    |-					if (targetClasses.attack && cmpIdentity
|5510|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5509|+					if (targetClasses.attack && cmpIdentity &&
|    |5510|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5511|5511| 						continue;
|5512|5512| 					if (targetClasses.avoid && cmpIdentity
|5513|5513| 						&& 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
|5509|5509| 					if (targetClasses.attack && cmpIdentity
|5510|5510| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5511|5511| 						continue;
|5512|    |-					if (targetClasses.avoid && cmpIdentity
|5513|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5512|+					if (targetClasses.avoid && cmpIdentity &&
|    |5513|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5514|5514| 						continue;
|5515|5515| 					// Only used by the AIs to prevent some choices of targets
|5516|5516| 					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
|5532|5532| 		{
|5533|5533| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5534|5534| 			var targetClasses = this.order.data.targetClasses;
|5535|    |-			if (cmpIdentity && targetClasses.attack
|5536|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5535|+			if (cmpIdentity && targetClasses.attack &&
|    |5536|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5537|5537| 				continue;
|5538|5538| 			if (cmpIdentity && targetClasses.avoid
|5539|5539| 				&& 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
|5535|5535| 			if (cmpIdentity && targetClasses.attack
|5536|5536| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5537|5537| 				continue;
|5538|    |-			if (cmpIdentity && targetClasses.avoid
|5539|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5538|+			if (cmpIdentity && targetClasses.avoid &&
|    |5539|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5540|5540| 				continue;
|5541|5541| 			// Only used by the AIs to prevent some choices of targets
|5542|5542| 			if (targetClasses.vetoEntities && targetClasses.vetoEntities[targ])
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5678|5678| 
|5679|5679| UnitAI.prototype.SetHeldPosition = function(x, z)
|5680|5680| {
|5681|    |-	this.heldPosition = {"x": x, "z": z};
|    |5681|+	this.heldPosition = { "x": x, "z": z};
|5682|5682| };
|5683|5683| 
|5684|5684| UnitAI.prototype.SetHeldPositionOnEntity = function(entity)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5678|5678| 
|5679|5679| UnitAI.prototype.SetHeldPosition = function(x, z)
|5680|5680| {
|5681|    |-	this.heldPosition = {"x": x, "z": z};
|    |5681|+	this.heldPosition = {"x": x, "z": z };
|5682|5682| };
|5683|5683| 
|5684|5684| UnitAI.prototype.SetHeldPositionOnEntity = function(entity)
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5705|5705| 	return false;
|5706|5706| };
|5707|5707| 
|5708|    |-//// Helper functions ////
|    |5708|+// // Helper functions ////
|5709|5709| 
|5710|5710| UnitAI.prototype.CanAttack = function(target)
|5711|5711| {
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5909|5909| 	return cmpPack && cmpPack.IsPacking();
|5910|5910| };
|5911|5911| 
|5912|    |-//// Formation specific functions ////
|    |5912|+// // Formation specific functions ////
|5913|5913| 
|5914|5914| UnitAI.prototype.IsAttackingAsFormation = function()
|5915|5915| {
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5914|5914| UnitAI.prototype.IsAttackingAsFormation = function()
|5915|5915| {
|5916|5916| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5917|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5918|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5917|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5918|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5919|5919| };
|5920|5920| 
|5921|5921| //// Animal specific functions ////
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5918|5918| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5919|5919| };
|5920|5920| 
|5921|    |-//// Animal specific functions ////
|    |5921|+// // Animal specific functions ////
|5922|5922| 
|5923|5923| UnitAI.prototype.MoveRandomly = function(distance)
|5924|5924| {

binaries/data/mods/public/simulation/components/UnitAI.js
| 331| »   »   »   return·true;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'Order.WalkToTarget' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
| 895| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
| 920| »   »   »   "enter":·function(msg)·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
| 938| »   »   »   "leave":·function(msg)·{
|    | [NORMAL] ESLintBear (no-dupe-keys):
|    | Duplicate key 'leave'.

binaries/data/mods/public/simulation/components/UnitAI.js
| 973| »   »   »   »   »   return·true;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'enter' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
|1036| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1074| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1107| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1320| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1616| »   »   »   »   »   return·false;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'enter' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
|2471| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2589| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2691| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2900| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|3083| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|3815| »   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
|4616| »   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
|4631| »   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
|4677| »   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
|4700| »   »   ····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
|5156| »   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
| 358| »   »   ····&&·(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
| 938| »   »   »   "leave":·function(msg)·{
|    | [NORMAL] JSHintBear:
|    | Duplicate key 'leave'.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4296| »   if·(data["target"])
|    | [NORMAL] JSHintBear:
|    | ['target'] is better written in dot notation.

binaries/data/mods/public/simulation/components/UnitAI.js
|4298| »   »   if·(data["min"]·||·data["max"])
|    | [NORMAL] JSHintBear:
|    | ['min'] is better written in dot notation.

binaries/data/mods/public/simulation/components/UnitAI.js
|4298| »   »   if·(data["min"]·||·data["max"])
|    | [NORMAL] JSHintBear:
|    | ['max'] is better written in dot notation.

binaries/data/mods/public/simulation/components/UnitAI.js
|4310| »   »   if·(data["min"]·||·data["max"])
|    | [NORMAL] JSHintBear:
|    | ['min'] is better written in dot notation.

binaries/data/mods/public/simulation/components/UnitAI.js
|4310| »   »   if·(data["min"]·||·data["max"])
|    | [NORMAL] JSHintBear:
|    | ['max'] is better written in dot notation.

binaries/data/mods/public/simulation/components/UnitAI.js
|4315| }
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4409| »   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
|4465| »   »   »   &&·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
|4633| »   »   &&·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
|4634| »   »   &&·(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
|5156| »   var·lastPos·=·undefined;
|    | [NORMAL] JSHintBear:
|    | It's not necessary to initialize 'lastPos' to 'undefined'.

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|5536| »   »   »   »   &&·!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
|5536| »   »   »   »   &&·!MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.attack))
|    | [MAJOR] JSHintBear:
|    | Too many errors. (91% scanned).
Executing section cli...

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

Polakrity added inline comments.
binaries/data/mods/public/simulation/components/UnitAI.js
2300 ↗(On Diff #8243)

Maybe u can change this comment now.

2322 ↗(On Diff #8243)

Uppercase.

2400 ↗(On Diff #8243)

He is better to avoid magic number, no?

2419 ↗(On Diff #8243)

nearestDropsite like above.

Stan added inline comments.May 31 2019, 8:08 PM
binaries/data/mods/public/simulation/components/UnitAI.js
2400 ↗(On Diff #8243)

Well I don't know if we can get the tilesize from the engine :)

Silier updated this revision to Diff 8253.May 31 2019, 9:26 PM

upercase and one more rename

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

no, comment is still correct because parameters usage in StartTimer

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 356| 356| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 357| 357| 		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 358| 358| 		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 359|    |-		{
|    | 359|+		
| 360| 360| 			// we were already on the shoreline, and have not moved since
| 361| 361| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
| 362| 362| 				needToMove = false;
| 363|    |-		}
|    | 363|+		
| 364| 364| 
| 365| 365| 		if (needToMove)
| 366| 366| 			this.SetNextState("INDIVIDUAL.PICKUP.APPROACHING");
|    | [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
| 354| 354| 		// Check if we need to move     TODO implement a better way to know if we are on the shoreline
| 355| 355| 		var needToMove = true;
| 356| 356| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 357|    |-		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 358|    |-		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
|    | 357|+		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x) &&
|    | 358|+		    (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 359| 359| 		{
| 360| 360| 			// we were already on the shoreline, and have not moved since
| 361| 361| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
|    | [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
| 519| 519| 					this.PushOrderFront("Walk", this.order.data.lastPos);
| 520| 520| 				}
| 521| 521| 				else
| 522|    |-				{
|    | 522|+				
| 523| 523| 					// We couldn't move there, or the target moved away
| 524| 524| 					this.FinishOrder();
| 525|    |-				}
|    | 525|+				
| 526| 526| 				return;
| 527| 527| 			}
| 528| 528| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 734| 734| 			}
| 735| 735| 			// Check if we are already in range, otherwise walk there
| 736| 736| 			if (!this.CheckGarrisonRange(msg.data.target))
| 737|    |-			{
|    | 737|+			
| 738| 738| 				if (!this.CheckTargetVisible(msg.data.target))
| 739| 739| 				{
| 740| 740| 					this.FinishOrder();
| 745| 745| 					this.SetNextState("GARRISON.APPROACHING");
| 746| 746| 					return;
| 747| 747| 				}
| 748|    |-			}
|    | 748|+			
| 749| 749| 
| 750| 750| 			this.SetNextState("GARRISON.GARRISONING");
| 751| 751| 		},
|    | [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
| 740| 740| 					this.FinishOrder();
| 741| 741| 					return;
| 742| 742| 				}
| 743|    |-				else
| 744|    |-				{
|    | 743|+				
| 745| 744| 					this.SetNextState("GARRISON.APPROACHING");
| 746| 745| 					return;
| 747|    |-				}
|    | 746|+				
| 748| 747| 			}
| 749| 748| 
| 750| 749| 			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
| 763| 763| 						this.PushOrderFront("Walk", msg.data.lastPos);
| 764| 764| 					}
| 765| 765| 					else
| 766|    |-					{
|    | 766|+					
| 767| 767| 						// We couldn't move there, or the target moved away
| 768| 768| 						this.FinishOrder();
| 769|    |-					}
|    | 769|+					
| 770| 770| 					return;
| 771| 771| 				}
| 772| 772| 
|    | [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
|1011|1011| 			},
|1012|1012| 		},
|1013|1013| 
|1014|    |-		"GARRISON":{
|    |1014|+		"GARRISON": {
|1015|1015| 			"enter": function() {
|1016|1016| 				// If the garrisonholder should pickup, warn it so it can take needed action
|1017|1017| 				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
|1231|1231| 			// If the controller handled an order but some members rejected it,
|1232|1232| 			// they will have no orders and be in the FORMATIONMEMBER.IDLE state.
|1233|1233| 			if (this.orderQueue.length)
|1234|    |-			{
|    |1234|+			
|1235|1235| 				// We're leaving the formation, so stop our FormationWalk order
|1236|1236| 				if (this.FinishOrder())
|1237|1237| 					return;
|1238|    |-			}
|    |1238|+			
|1239|1239| 
|1240|1240| 			// No orders left, we're an individual now
|1241|1241| 			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
|1259|1259| 			// Move a tile outside the building
|1260|1260| 			let range = 4;
|1261|1261| 			if (this.CheckTargetRangeExplicit(msg.data.target, range, range))
|1262|    |-			{
|    |1262|+			
|1263|1263| 				// We are already at the target, or can't move at all
|1264|1264| 				this.FinishOrder();
|1265|    |-			}
|    |1265|+			
|1266|1266| 			else
|1267|1267| 			{
|1268|1268| 				this.order.data.min = range;
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1474|1474| 
|1475|1475| 			"LosRangeUpdate": function(msg) {
|1476|1476| 				if (this.GetStance().targetVisibleEnemies)
|1477|    |-				{
|    |1477|+				
|1478|1478| 					// Start attacking one of the newly-seen enemy (if any)
|1479|1479| 					this.AttackEntitiesByPreference(msg.data.added);
|1480|    |-				}
|    |1480|+				
|1481|1481| 			},
|1482|1482| 
|1483|1483| 			"LosHealRangeUpdate": function(msg) {
|    | [NORMAL] ESLintBear (space-before-function-paren):
|    | Unexpected space before function parentheses.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1511|1511| 				this.SelectAnimation("move");
|1512|1512| 			},
|1513|1513| 
|1514|    |-			"leave": function () {
|    |1514|+			"leave": function() {
|1515|1515| 				this.SelectAnimation("idle");
|1516|1516| 				this.StopMoving();
|1517|1517| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1688|1688| 						// if nothing better to do, check if the guarded needs to be healed or repaired
|1689|1689| 						var cmpHealth = Engine.QueryInterface(this.isGuardOf, IID_Health);
|1690|1690| 						if (cmpHealth && cmpHealth.IsInjured())
|1691|    |-						{
|    |1691|+						
|1692|1692| 							if (this.CanHeal(this.isGuardOf))
|1693|1693| 								this.PushOrderFront("Heal", { "target": this.isGuardOf, "force": false });
|1694|1694| 							else if (this.CanRepair(this.isGuardOf))
|1695|1695| 								this.PushOrderFront("Repair", { "target": this.isGuardOf, "autocontinue": false, "force": false });
|1696|    |-						}
|    |1696|+						
|1697|1697| 					}
|1698|1698| 				},
|1699|1699| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1791|1791| 				"MoveCompleted": function() {
|1792|1792| 
|1793|1793| 					if (this.CheckTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1794|    |-					{
|    |1794|+					
|1795|1795| 						// If the unit needs to unpack, do so
|1796|1796| 						if (this.CanUnpack())
|1797|1797| 						{
|1800|1800| 						}
|1801|1801| 						else
|1802|1802| 							this.SetNextState("ATTACKING");
|1803|    |-					}
|    |1803|+					
|1804|1804| 					else
|1805|1805| 					{
|1806|1806| 						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
|1798|1798| 							this.PushOrderFront("Unpack", { "force": true });
|1799|1799| 							return;
|1800|1800| 						}
|1801|    |-						else
|1802|    |-							this.SetNextState("ATTACKING");
|    |1801|+						this.SetNextState("ATTACKING");
|1803|1802| 					}
|1804|1803| 					else
|1805|1804| 					{
|    | [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
|1802|1802| 							this.SetNextState("ATTACKING");
|1803|1803| 					}
|1804|1804| 					else
|1805|    |-					{
|    |1805|+					
|1806|1806| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1807|1807| 						{
|1808|1808| 							this.SetNextState("APPROACHING");
|1812|1812| 							// Give up
|1813|1813| 							this.FinishOrder();
|1814|1814| 						}
|1815|    |-					}
|    |1815|+					
|1816|1816| 				},
|1817|1817| 			},
|1818|1818| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1804|1804| 					else
|1805|1805| 					{
|1806|1806| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1807|    |-						{
|    |1807|+						
|1808|1808| 							this.SetNextState("APPROACHING");
|1809|    |-						}
|    |1809|+						
|1810|1810| 						else
|1811|1811| 						{
|1812|1812| 							// 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
|1808|1808| 							this.SetNextState("APPROACHING");
|1809|1809| 						}
|1810|1810| 						else
|1811|    |-						{
|    |1811|+						
|1812|1812| 							// Give up
|1813|1813| 							this.FinishOrder();
|1814|    |-						}
|    |1814|+						
|1815|1815| 					}
|1816|1816| 				},
|1817|1817| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1829|1829| 					}
|1830|1830| 					// Check the target is still alive and attackable
|1831|1831| 					if (this.CanAttack(target) && !this.CheckTargetAttackRange(target, this.order.data.attackType))
|1832|    |-					{
|    |1832|+					
|1833|1833| 						// Can't reach it - try to chase after it
|1834|1834| 						if (this.ShouldChaseTargetedEntity(target, this.order.data.force))
|1835|1835| 						{
|1844|1844| 								return;
|1845|1845| 							}
|1846|1846| 						}
|1847|    |-					}
|    |1847|+					
|1848|1848| 
|1849|1849| 					this.StopMoving();
|1850|1850| 
|    | [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
|1877|1877| 					// TODO: we should probably only bother syncing projectile attacks, not melee
|1878|1878| 
|1879|1879| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|1880|    |-					this.resyncAnimation = (prepare != this.attackTimers.prepare) ? true : false;
|    |1880|+					this.resyncAnimation = (prepare != this.attackTimers.prepare);
|1881|1881| 
|1882|1882| 					this.FaceTowardsTarget(this.order.data.target);
|1883|1883| 
|    | [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
|2006|2006| 
|2007|2007| 				"Attacked": function(msg) {
|2008|2008| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2009|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2010|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2009|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2010|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2011|2011| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2012|2012| 				},
|2013|2013| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2026|2026| 					this.SelectAnimation("move");
|2027|2027| 					var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|2028|2028| 					if (cmpUnitAI && cmpUnitAI.IsFleeing())
|2029|    |-					{
|    |2029|+					
|2030|2030| 						// Run after a fleeing target
|2031|2031| 						this.SetSpeedMultiplier(this.GetRunMultiplier());
|2032|    |-					}
|    |2032|+					
|2033|2033| 					this.StartTimer(1000, 1000);
|2034|2034| 				},
|2035|2035| 
|    | [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
|2085|2085| 						// Also don't switch to a different type of huntable animal
|2086|2086| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2087|2087| 							return (
|2088|    |-								ent != oldTarget
|2089|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2088|+								ent != oldTarget &&
|    |2089|+								 ((type.generic == "treasure" && oldType.generic == "treasure")
|2090|2090| 								 || (type.specific == oldType.specific
|2091|2091| 								 && (type.specific != "meat" || oldTemplate == template)))
|2092|2092| 							);
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2086|2086| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2087|2087| 							return (
|2088|2088| 								ent != oldTarget
|2089|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2090|    |-								 || (type.specific == oldType.specific
|    |2089|+								 && ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2090|+								 (type.specific == oldType.specific
|2091|2091| 								 && (type.specific != "meat" || oldTemplate == template)))
|2092|2092| 							);
|2093|2093| 						}, 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
|2087|2087| 							return (
|2088|2088| 								ent != oldTarget
|2089|2089| 								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2090|    |-								 || (type.specific == oldType.specific
|2091|    |-								 && (type.specific != "meat" || oldTemplate == template)))
|    |2090|+								 || (type.specific == oldType.specific &&
|    |2091|+								 (type.specific != "meat" || oldTemplate == template)))
|2092|2092| 							);
|2093|2093| 						}, oldTarget);
|2094|2094| 						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
|2096|2096| 							this.PerformGather(nearby, false, false);
|2097|2097| 							return true;
|2098|2098| 						}
|2099|    |-						else
|2100|    |-						{
|    |2099|+						
|2101|2100| 							// It's probably better in this case, to avoid units getting stuck around a dropsite
|2102|2101| 							// in a "Target is far away, full, nearby are no good resources, return to dropsite" loop
|2103|2102| 							// to order it to GatherNear the resource position.
|2118|2117| 									return true;
|2119|2118| 								}
|2120|2119| 							}
|2121|    |-						}
|    |2120|+						
|2122|2121| 						return true;
|2123|2122| 					}
|2124|2123| 
|    | [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
|2108|2108| 								this.GatherNearPosition(pos.x, pos.z, oldType, oldTemplate);
|2109|2109| 								return true;
|2110|2110| 							}
|2111|    |-							else
|2112|    |-							{
|    |2111|+							
|2113|2112| 								// we're kind of stuck here. Return resource.
|2114|2113| 								var nearby = this.FindNearestDropsite(oldType.generic);
|2115|2114| 								if (nearby)
|2117|2116| 									this.PushOrderFront("ReturnResource", { "target": nearby, "force": false });
|2118|2117| 									return true;
|2119|2118| 								}
|2120|    |-							}
|    |2119|+							
|2121|2120| 						}
|2122|2121| 						return true;
|2123|2122| 					}
|    | [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
|2160|2160| 						// Also don't switch to a different type of huntable animal
|2161|2161| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2162|2162| 							return (
|2163|    |-								ent != oldTarget
|2164|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2163|+								ent != oldTarget &&
|    |2164|+								((type.generic == "treasure" && oldType.generic == "treasure")
|2165|2165| 								|| (type.specific == oldType.specific
|2166|2166| 								&& (type.specific != "meat" || oldTemplate == template)))
|2167|2167| 							);
|    | [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
|2161|2161| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2162|2162| 							return (
|2163|2163| 								ent != oldTarget
|2164|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2165|    |-								|| (type.specific == oldType.specific
|    |2164|+								&& ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2165|+								(type.specific == oldType.specific
|2166|2166| 								&& (type.specific != "meat" || oldTemplate == template)))
|2167|2167| 							);
|2168|2168| 						});
|    | [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
|2162|2162| 							return (
|2163|2163| 								ent != oldTarget
|2164|2164| 								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2165|    |-								|| (type.specific == oldType.specific
|2166|    |-								&& (type.specific != "meat" || oldTemplate == template)))
|    |2165|+								|| (type.specific == oldType.specific &&
|    |2166|+								(type.specific != "meat" || oldTemplate == template)))
|2167|2167| 							);
|2168|2168| 						});
|2169|2169| 						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
|2220|2220| 					// Also don't switch to a different type of huntable animal
|2221|2221| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2222|2222| 						return (
|2223|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2224|    |-							|| (type.specific == resourceType.specific
|    |2223|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2224|+							(type.specific == resourceType.specific
|2225|2225| 							&& (type.specific != "meat" || resourceTemplate == template))
|2226|2226| 						);
|2227|2227| 					});
|    | [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
|2221|2221| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2222|2222| 						return (
|2223|2223| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2224|    |-							|| (type.specific == resourceType.specific
|2225|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2224|+							|| (type.specific == resourceType.specific &&
|    |2225|+							(type.specific != "meat" || resourceTemplate == template))
|2226|2226| 						);
|2227|2227| 					});
|2228|2228| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2337|2337| 
|2338|2338| 					let cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply);
|2339|2339| 					if (cmpSupply && cmpSupply.IsAvailable(cmpOwnership.GetOwner(), this.entity))
|2340|    |-					{
|    |2340|+					
|2341|2341| 						// Check we can still reach and gather from the target
|2342|2342| 						if (this.CanGather(this.gatheringTarget) && this.CheckTargetRange(this.gatheringTarget, IID_ResourceGatherer))
|2343|2343| 						{
|2400|2400| 								return;
|2401|2401| 							}
|2402|2402| 						}
|2403|    |-					}
|    |2403|+					
|2404|2404| 
|2405|2405| 					// We're already in range, can't get anywhere near it or the target is exhausted.
|2406|2406| 
|    | [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
|2426|2426| 					// Also don't switch to a different type of huntable animal
|2427|2427| 					let nearbyResource = this.FindNearbyResource(function(ent, type, template) {
|2428|2428| 						return (
|2429|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2430|    |-							|| (type.specific == resourceType.specific
|    |2429|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2430|+							(type.specific == resourceType.specific
|2431|2431| 							&& (type.specific != "meat" || resourceTemplate == template))
|2432|2432| 						);
|2433|2433| 					});
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2427|2427| 					let nearbyResource = this.FindNearbyResource(function(ent, type, template) {
|2428|2428| 						return (
|2429|2429| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2430|    |-							|| (type.specific == resourceType.specific
|2431|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2430|+							|| (type.specific == resourceType.specific &&
|    |2431|+							(type.specific != "meat" || resourceTemplate == template))
|2432|2432| 						);
|2433|2433| 					});
|2434|2434| 					if (nearbyResource)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2492|2492| 
|2493|2493| 				"Timer": function(msg) {
|2494|2494| 					if (this.ShouldAbandonChase(this.order.data.target, this.order.data.force, IID_Heal, null))
|2495|    |-					{
|    |2495|+					
|2496|2496| 						// Return to our original position unless we have a better order.
|2497|2497| 						if (!this.FinishOrder() && this.GetStance().respondHoldGround)
|2498|2498| 							this.WalkToHeldPosition();
|2499|    |-					}
|    |2499|+					
|2500|2500| 				},
|2501|2501| 
|2502|2502| 				"MoveCompleted": function() {
|    | [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
|2526|2526| 					this.StartTimer(prepare, this.healTimers.repeat);
|2527|2527| 
|2528|2528| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2529|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2529|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2530|2530| 
|2531|2531| 					this.FaceTowardsTarget(this.order.data.target);
|2532|2532| 				},
|    | [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
|2738|2738| 					{
|2739|2739| 						// The building was already finished/fully repaired before we arrived;
|2740|2740| 						// let the ConstructionFinished handler handle this.
|2741|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2741|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2742|2742| 						return true;
|2743|2743| 					}
|2744|2744| 
|    | [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
|2738|2738| 					{
|2739|2739| 						// The building was already finished/fully repaired before we arrived;
|2740|2740| 						// let the ConstructionFinished handler handle this.
|2741|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2741|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2742|2742| 						return true;
|2743|2743| 					}
|2744|2744| 
|    | [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
|2781|2781| 					if (!inRange && this.MoveToTargetRange(this.repairTarget, IID_Builder))
|2782|2782| 						this.SetNextState("APPROACHING");
|2783|2783| 					else if (!inRange)
|2784|    |-						this.FinishOrder(); //can't approach and isn't in reach
|    |2784|+						this.FinishOrder(); // can't approach and isn't in reach
|2785|2785| 				},
|2786|2786| 			},
|2787|2787| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2868|2868| 
|2869|2869| 				// Unit was approaching and there's nothing to do now, so switch to walking
|2870|2870| 				if (oldState === "INDIVIDUAL.REPAIR.APPROACHING")
|2871|    |-				{
|    |2871|+				
|2872|2872| 					// We're already walking to the given point, so add this as a order.
|2873|2873| 					this.WalkToTarget(msg.data.newentity, true);
|2874|    |-				}
|    |2874|+				
|2875|2875| 			},
|2876|2876| 		},
|2877|2877| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2930|2930| 
|2931|2931| 					// Check that we can garrison here
|2932|2932| 					if (this.CanGarrison(target))
|2933|    |-					{
|    |2933|+					
|2934|2934| 						// Check that we're in range of the garrison target
|2935|2935| 						if (this.CheckGarrisonRange(target))
|2936|2936| 						{
|3006|3006| 								return false;
|3007|3007| 							}
|3008|3008| 						}
|3009|    |-					}
|    |3009|+					
|3010|3010| 					// Garrisoning failed for some reason, so finish the order
|3011|3011| 					this.FinishOrder();
|3012|3012| 					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
|3127|3127| 		"Attacked": function(msg) {
|3128|3128| 			if (this.template.NaturalBehaviour == "skittish" ||
|3129|3129| 			    this.template.NaturalBehaviour == "passive")
|3130|    |-			{
|    |3130|+			
|3131|3131| 				this.Flee(msg.data.attacker, false);
|3132|    |-			}
|    |3132|+			
|3133|3133| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|3134|3134| 			{
|3135|3135| 				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
|3136|3136| 					this.Attack(msg.data.attacker, false);
|3137|3137| 			}
|3138|3138| 			else if (this.template.NaturalBehaviour == "domestic")
|3139|    |-			{
|    |3139|+			
|3140|3140| 				// Never flee, stop what we were doing
|3141|3141| 				this.SetNextState("IDLE");
|3142|    |-			}
|    |3142|+			
|3143|3143| 		},
|3144|3144| 
|3145|3145| 		"Order.LeaveFoundation": function(msg) {
|    | [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
|3150|3150| 				this.FinishOrder();
|3151|3151| 				return;
|3152|3152| 			}
|3153|    |-			else
|3154|    |-			{
|    |3153|+			
|3155|3154| 				this.order.data.min = range;
|3156|3155| 				this.SetNextState("WALKING");
|3157|    |-			}
|    |3156|+			
|3158|3157| 		},
|3159|3158| 
|3160|3159| 		"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
|3194|3194| 				}
|3195|3195| 				// Start attacking one of the newly-seen enemy (if any)
|3196|3196| 				else if (this.IsDangerousAnimal())
|3197|    |-				{
|    |3197|+				
|3198|3198| 					this.AttackVisibleEntity(msg.data.added);
|3199|    |-				}
|    |3199|+				
|3200|3200| 
|3201|3201| 				// TODO: if two units enter our range together, we'll attack the
|3202|3202| 				// 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
|3237|3237| 				}
|3238|3238| 				// Start attacking one of the newly-seen enemy (if any)
|3239|3239| 				else if (this.template.NaturalBehaviour == "violent")
|3240|    |-				{
|    |3240|+				
|3241|3241| 					this.AttackVisibleEntity(msg.data.added);
|3242|    |-				}
|    |3242|+				
|3243|3243| 			},
|3244|3244| 
|3245|3245| 			"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
|3254|3254| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3255|3255| 
|3256|3256| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3257|    |-							// only used for domestic animals
|    |3257|+		// only used for domestic animals
|3258|3258| 	},
|3259|3259| };
|3260|3260| 
|    | [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
|3311|3311| 
|3312|3312| UnitAI.prototype.IsAnimal = function()
|3313|3313| {
|3314|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3314|+	return (!!this.template.NaturalBehaviour);
|3315|3315| };
|3316|3316| 
|3317|3317| 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
|3349|3349| UnitAI.prototype.GetGarrisonHolder = function()
|3350|3350| {
|3351|3351| 	if (this.IsGarrisoned())
|3352|    |-	{
|    |3352|+	
|3353|3353| 		for (let order of this.orderQueue)
|3354|3354| 			if (order.type == "Garrison")
|3355|3355| 				return order.data.target;
|3356|    |-	}
|    |3356|+	
|3357|3357| 	return INVALID_ENTITY;
|3358|3358| };
|3359|3359| 
|    | [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
|3427|3427| 		{
|3428|3428| 			let index = this.GetCurrentState().indexOf(".");
|3429|3429| 			if (index != -1)
|3430|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3430|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3431|3431| 			this.Stop(false);
|3432|3432| 		}
|3433|3433| 
|    | [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
|3483|3483| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3484|3484| 			continue;
|3485|3485| 		if (i == 0)
|3486|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3486|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3487|3487| 		else
|3488|3488| 			this.orderQueue.splice(i, 1);
|3489|3489| 		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
|3483|3483| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3484|3484| 			continue;
|3485|3485| 		if (i == 0)
|3486|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3486|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3487|3487| 		else
|3488|3488| 			this.orderQueue.splice(i, 1);
|3489|3489| 		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
|3567|3567| };
|3568|3568| 
|3569|3569| 
|3570|    |-//// FSM linkage functions ////
|    |3570|+// // FSM linkage functions ////
|3571|3571| 
|3572|3572| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3573|3573| UnitAI.prototype.SetNextState = function(state)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3739|3739| 				continue;
|3740|3740| 			if (this.orderQueue[i].type == type)
|3741|3741| 				continue;
|3742|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3742|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3743|3743| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3744|3744| 			return;
|3745|3745| 		}
|    | [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
|3739|3739| 				continue;
|3740|3740| 			if (this.orderQueue[i].type == type)
|3741|3741| 				continue;
|3742|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3742|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3743|3743| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3744|3744| 			return;
|3745|3745| 		}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3753|3753| {
|3754|3754| 	// Remember the previous work orders to be able to go back to them later if required
|3755|3755| 	if (data && data.force)
|3756|    |-	{
|    |3756|+	
|3757|3757| 		if (this.IsFormationController())
|3758|3758| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3759|3759| 		else
|3760|3760| 			this.UpdateWorkOrders(type);
|3761|    |-	}
|    |3761|+	
|3762|3762| 
|3763|3763| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3764|3764| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3830|3830| 	{
|3831|3831| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3832|3832| 		if (cmpUnitAI)
|3833|    |-		{
|    |3833|+		
|3834|3834| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3835|3835| 			{
|3836|3836| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3839|3839| 					return;
|3840|3840| 				}
|3841|3841| 			}
|3842|    |-		}
|    |3842|+		
|3843|3843| 	}
|3844|3844| 
|3845|3845| 	// 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
|3832|3832| 		if (cmpUnitAI)
|3833|3833| 		{
|3834|3834| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3835|    |-			{
|    |3835|+			
|3836|3836| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3837|3837| 				{
|3838|3838| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3839|3839| 					return;
|3840|3840| 				}
|3841|    |-			}
|    |3841|+			
|3842|3842| 		}
|3843|3843| 	}
|3844|3844| 
|    | [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
|3844|3844| 
|3845|3845| 	// If nothing found, take the unit orders
|3846|3846| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3847|    |-	{
|    |3847|+	
|3848|3848| 		if (isWorkType(this.orderQueue[i].type))
|3849|3849| 		{
|3850|3850| 			this.workOrders = this.orderQueue.slice(i);
|3851|3851| 			return;
|3852|3852| 		}
|3853|    |-	}
|    |3853|+	
|3854|3854| };
|3855|3855| 
|3856|3856| 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
|3910|3910| 	if (data.timerRepeat === undefined)
|3911|3911| 		this.timer = undefined;
|3912|3912| 
|3913|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3913|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3914|3914| };
|3915|3915| 
|3916|3916| /**
|    | [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
|3910|3910| 	if (data.timerRepeat === undefined)
|3911|3911| 		this.timer = undefined;
|3912|3912| 
|3913|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3913|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3914|3914| };
|3915|3915| 
|3916|3916| /**
|    | [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
|3945|3945| 	this.timer = undefined;
|3946|3946| };
|3947|3947| 
|3948|    |-//// Message handlers /////
|    |3948|+// // Message handlers /////
|3949|3949| 
|3950|3950| UnitAI.prototype.OnMotionChanged = function(msg)
|3951|3951| {
|    | [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
|3950|3950| UnitAI.prototype.OnMotionChanged = function(msg)
|3951|3951| {
|3952|3952| 	if (msg.starting && !msg.error)
|3953|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3953|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveStarted", "data": msg});
|3954|3954| 	else if (!msg.starting || msg.error)
|3955|3955| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3956|3956| };
|    | [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
|3950|3950| UnitAI.prototype.OnMotionChanged = function(msg)
|3951|3951| {
|3952|3952| 	if (msg.starting && !msg.error)
|3953|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3953|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg });
|3954|3954| 	else if (!msg.starting || msg.error)
|3955|3955| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3956|3956| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3952|3952| 	if (msg.starting && !msg.error)
|3953|3953| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3954|3954| 	else if (!msg.starting || msg.error)
|3955|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3955|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveCompleted", "data": msg});
|3956|3956| };
|3957|3957| 
|3958|3958| 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
|3952|3952| 	if (msg.starting && !msg.error)
|3953|3953| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3954|3954| 	else if (!msg.starting || msg.error)
|3955|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3955|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg });
|3956|3956| };
|3957|3957| 
|3958|3958| 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
|3960|3960| 	// TODO: This is a bit inefficient since every unit listens to every
|3961|3961| 	// construction message - ideally we could scope it to only the one we're building
|3962|3962| 
|3963|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3963|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3964|3964| };
|3965|3965| 
|3966|3966| 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
|3960|3960| 	// TODO: This is a bit inefficient since every unit listens to every
|3961|3961| 	// construction message - ideally we could scope it to only the one we're building
|3962|3962| 
|3963|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3963|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3964|3964| };
|3965|3965| 
|3966|3966| 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
|3985|3985| 
|3986|3986| UnitAI.prototype.OnAttacked = function(msg)
|3987|3987| {
|3988|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3988|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3989|3989| };
|3990|3990| 
|3991|3991| 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
|3985|3985| 
|3986|3986| UnitAI.prototype.OnAttacked = function(msg)
|3987|3987| {
|3988|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3988|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3989|3989| };
|3990|3990| 
|3991|3991| 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
|3990|3990| 
|3991|3991| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3992|3992| {
|3993|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3993|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|3994|3994| };
|3995|3995| 
|3996|3996| 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
|3990|3990| 
|3991|3991| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3992|3992| {
|3993|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3993|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|3994|3994| };
|3995|3995| 
|3996|3996| 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
|3995|3995| 
|3996|3996| UnitAI.prototype.OnHealthChanged = function(msg)
|3997|3997| {
|3998|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3998|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|3999|3999| };
|4000|4000| 
|4001|4001| 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
|3995|3995| 
|3996|3996| UnitAI.prototype.OnHealthChanged = function(msg)
|3997|3997| {
|3998|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3998|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|3999|3999| };
|4000|4000| 
|4001|4001| 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
|4001|4001| UnitAI.prototype.OnRangeUpdate = function(msg)
|4002|4002| {
|4003|4003| 	if (msg.tag == this.losRangeQuery)
|4004|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4004|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4005|4005| 	else if (msg.tag == this.losHealRangeQuery)
|4006|4006| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4007|4007| };
|    | [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
|4001|4001| UnitAI.prototype.OnRangeUpdate = function(msg)
|4002|4002| {
|4003|4003| 	if (msg.tag == this.losRangeQuery)
|4004|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4004|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4005|4005| 	else if (msg.tag == this.losHealRangeQuery)
|4006|4006| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4007|4007| };
|    | [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
|4003|4003| 	if (msg.tag == this.losRangeQuery)
|4004|4004| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4005|4005| 	else if (msg.tag == this.losHealRangeQuery)
|4006|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4006|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4007|4007| };
|4008|4008| 
|4009|4009| 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
|4003|4003| 	if (msg.tag == this.losRangeQuery)
|4004|4004| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4005|4005| 	else if (msg.tag == this.losHealRangeQuery)
|4006|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4006|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4007|4007| };
|4008|4008| 
|4009|4009| 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
|4008|4008| 
|4009|4009| UnitAI.prototype.OnPackFinished = function(msg)
|4010|4010| {
|4011|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4011|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4012|4012| };
|4013|4013| 
|4014|4014| //// 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
|4008|4008| 
|4009|4009| UnitAI.prototype.OnPackFinished = function(msg)
|4010|4010| {
|4011|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4011|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4012|4012| };
|4013|4013| 
|4014|4014| //// 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
|4011|4011| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4012|4012| };
|4013|4013| 
|4014|    |-//// Helper functions to be called by the FSM ////
|    |4014|+// // Helper functions to be called by the FSM ////
|4015|4015| 
|4016|4016| UnitAI.prototype.GetWalkSpeed = function()
|4017|4017| {
|    | [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
|4113|4113| 	if (!cmpOwnership || cmpOwnership.GetOwner() == INVALID_PLAYER)
|4114|4114| 		return undefined;
|4115|4115| 
|4116|    |-	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position)
|    |4116|+	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
|4117|4117| 	if (!cmpPosition || !cmpPosition.IsInWorld())
|4118|4118| 		return undefined;
|4119|4119| 
|    | [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
|4198|4198| 			PlaySound(name, member);
|4199|4199| 	}
|4200|4200| 	else
|4201|    |-	{
|    |4201|+	
|4202|4202| 		// Otherwise use our own sounds
|4203|4203| 		PlaySound(name, this.entity);
|4204|    |-	}
|    |4204|+	
|4205|4205| };
|4206|4206| 
|4207|4207| /*
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4294|4294| UnitAI.prototype.MoveTo = function(data, iid, type)
|4295|4295| {
|4296|4296| 	if (data["target"])
|4297|    |-	{
|    |4297|+	
|4298|4298| 		if (data["min"] || data["max"])
|4299|4299| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4300|4300| 		else
|4304|4304| 			else
|4305|4305| 				return this.MoveToTargetRange(data.target, iid, type);
|4306|4306| 		}
|4307|    |-	}
|    |4307|+	
|4308|4308| 	else
|4309|4309| 	{
|4310|4310| 		if (data["min"] || data["max"])
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["target"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4293|4293|  */
|4294|4294| UnitAI.prototype.MoveTo = function(data, iid, type)
|4295|4295| {
|4296|    |-	if (data["target"])
|    |4296|+	if (data.target)
|4297|4297| 	{
|4298|4298| 		if (data["min"] || data["max"])
|4299|4299| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["min"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4295|4295| {
|4296|4296| 	if (data["target"])
|4297|4297| 	{
|4298|    |-		if (data["min"] || data["max"])
|    |4298|+		if (data.min || data["max"])
|4299|4299| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4300|4300| 		else
|4301|4301| 		{
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["max"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4295|4295| {
|4296|4296| 	if (data["target"])
|4297|4297| 	{
|4298|    |-		if (data["min"] || data["max"])
|    |4298|+		if (data["min"] || data.max)
|4299|4299| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4300|4300| 		else
|4301|4301| 		{
|    | [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
|4298|4298| 		if (data["min"] || data["max"])
|4299|4299| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4300|4300| 		else
|4301|    |-		{
|    |4301|+		
|4302|4302| 			if (!iid)
|4303|4303| 				return this.MoveToTarget(data.target);
|4304|4304| 			else
|4305|4305| 				return this.MoveToTargetRange(data.target, iid, type);
|4306|    |-		}
|    |4306|+		
|4307|4307| 	}
|4308|4308| 	else
|4309|4309| 	{
|    | [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
|4297|4297| 	{
|4298|4298| 		if (data["min"] || data["max"])
|4299|4299| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4300|    |-		else
|4301|    |-		{
|    |4300|+		
|4302|4301| 			if (!iid)
|4303|4302| 				return this.MoveToTarget(data.target);
|4304|4303| 			else
|4305|4304| 				return this.MoveToTargetRange(data.target, iid, type);
|4306|    |-		}
|    |4305|+		
|4307|4306| 	}
|4308|4307| 	else
|4309|4308| 	{
|    | [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
|4301|4301| 		{
|4302|4302| 			if (!iid)
|4303|4303| 				return this.MoveToTarget(data.target);
|4304|    |-			else
|4305|    |-				return this.MoveToTargetRange(data.target, iid, type);
|    |4304|+			return this.MoveToTargetRange(data.target, iid, type);
|4306|4305| 		}
|4307|4306| 	}
|4308|4307| 	else
|    | [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
|4306|4306| 		}
|4307|4307| 	}
|4308|4308| 	else
|4309|    |-	{
|    |4309|+	
|4310|4310| 		if (data["min"] || data["max"])
|4311|4311| 			return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1);
|4312|4312| 		else
|4313|4313| 			return this.MoveToPoint(data.x, data.z);
|4314|    |-	}
|    |4314|+	
|4315|4315| }
|4316|4316| 
|4317|4317| UnitAI.prototype.MoveToPoint = function(x, z)
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["min"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4307|4307| 	}
|4308|4308| 	else
|4309|4309| 	{
|4310|    |-		if (data["min"] || data["max"])
|    |4310|+		if (data.min || data["max"])
|4311|4311| 			return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1);
|4312|4312| 		else
|4313|4313| 			return this.MoveToPoint(data.x, data.z);
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["max"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4307|4307| 	}
|4308|4308| 	else
|4309|4309| 	{
|4310|    |-		if (data["min"] || data["max"])
|    |4310|+		if (data["min"] || data.max)
|4311|4311| 			return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1);
|4312|4312| 		else
|4313|4313| 			return this.MoveToPoint(data.x, data.z);
|    | [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
|4309|4309| 	{
|4310|4310| 		if (data["min"] || data["max"])
|4311|4311| 			return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1);
|4312|    |-		else
|4313|    |-			return this.MoveToPoint(data.x, data.z);
|    |4312|+		return this.MoveToPoint(data.x, data.z);
|4314|4313| 	}
|4315|4314| }
|4316|4315| 
|    | [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
|4312|4312| 		else
|4313|4313| 			return this.MoveToPoint(data.x, data.z);
|4314|4314| 	}
|4315|    |-}
|    |4315|+};
|4316|4316| 
|4317|4317| UnitAI.prototype.MoveToPoint = function(x, z)
|4318|4318| {
|    | [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
|4396|4396| 	else
|4397|4397| 		// return false? Or hope you come close enough?
|4398|4398| 		var parabolicMaxRange = 0;
|4399|    |-		//return false;
|    |4399|+		// return false;
|4400|4400| 
|4401|4401| 	// the parabole changes while walking, take something in the middle
|4402|4402| 	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
|4461|4461| 	if (this.IsFormationMember())
|4462|4462| 	{
|4463|4463| 		var cmpFormationUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|4464|    |-		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation()
|4465|    |-			&& cmpFormationUnitAI.order.data.target == target)
|    |4464|+		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation() &&
|    |4465|+			cmpFormationUnitAI.order.data.target == target)
|4466|4466| 			return true;
|4467|4467| 	}
|4468|4468| 
|    | [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
|4629|4629| UnitAI.prototype.AttackEntityInZone = function(ents)
|4630|4630| {
|4631|4631| 	var target = ents.find(target =>
|4632|    |-		this.CanAttack(target)
|4633|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4632|+		this.CanAttack(target) &&
|    |4633|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4634|4634| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4635|4635| 	);
|4636|4636| 	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
|4630|4630| {
|4631|4631| 	var target = ents.find(target =>
|4632|4632| 		this.CanAttack(target)
|4633|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4634|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4633|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4634|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4635|4635| 	);
|4636|4636| 	if (!target)
|4637|4637| 		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
|4694|4694| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4695|4695| 	if (this.isGuardOf)
|4696|4696| 	{
|4697|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4697|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4698|4698| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4699|4699| 		if (cmpUnitAI && cmpAttack &&
|4700|4700| 		    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
|4698|4698| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4699|4699| 		if (cmpUnitAI && cmpAttack &&
|4700|4700| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4701|    |-				return false;
|    |4701|+			return false;
|4702|4702| 	}
|4703|4703| 
|4704|4704| 	// 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
|4703|4703| 
|4704|4704| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4705|4705| 	if (this.GetStance().respondHoldGround)
|4706|    |-	{
|    |4706|+	
|4707|4707| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4708|4708| 			return true;
|4709|    |-	}
|    |4709|+	
|4710|4710| 
|4711|4711| 	// Stop if it's left our vision range, unless we're especially persistent
|4712|4712| 	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
|4710|4710| 
|4711|4711| 	// Stop if it's left our vision range, unless we're especially persistent
|4712|4712| 	if (!this.GetStance().respondChaseBeyondVision)
|4713|    |-	{
|    |4713|+	
|4714|4714| 		if (!this.CheckTargetIsInVisionRange(target))
|4715|4715| 			return true;
|4716|    |-	}
|    |4716|+	
|4717|4717| 
|4718|4718| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4719|4719| 	// 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
|4736|4736| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4737|4737| 	if (this.isGuardOf)
|4738|4738| 	{
|4739|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4739|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4740|4740| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4741|4741| 		if (cmpUnitAI && cmpAttack &&
|4742|4742| 		    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
|4749|4749| 	return false;
|4750|4750| };
|4751|4751| 
|4752|    |-//// External interface functions ////
|    |4752|+// // External interface functions ////
|4753|4753| 
|4754|4754| UnitAI.prototype.SetFormationController = function(ent)
|4755|4755| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4759|4759| 	// of our own formation (or ourself if not in formation)
|4760|4760| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4761|4761| 	if (cmpObstruction)
|4762|    |-	{
|    |4762|+	
|4763|4763| 		if (ent == INVALID_ENTITY)
|4764|4764| 			cmpObstruction.SetControlGroup(this.entity);
|4765|4765| 		else
|4766|4766| 			cmpObstruction.SetControlGroup(ent);
|4767|    |-	}
|    |4767|+	
|4768|4768| 
|4769|4769| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4770|4770| 	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
|4902|4902| 	// if we already had an old guard order, do nothing if the target is the same
|4903|4903| 	// and the order is running, otherwise remove the previous order
|4904|4904| 	if (this.isGuardOf)
|4905|    |-	{
|    |4905|+	
|4906|4906| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4907|4907| 			return;
|4908|4908| 		else
|4909|4909| 			this.RemoveGuard();
|4910|    |-	}
|    |4910|+	
|4911|4911| 
|4912|4912| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4913|4913| };
|    | [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
|4905|4905| 	{
|4906|4906| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4907|4907| 			return;
|4908|    |-		else
|4909|    |-			this.RemoveGuard();
|    |4908|+		this.RemoveGuard();
|4910|4909| 	}
|4911|4910| 
|4912|4911| 	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
|5076|5076| 			this.WalkToTarget(target, queued);
|5077|5077| 		return;
|5078|5078| 	}
|5079|    |-	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture}, queued);
|    |5079|+	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture }, queued);
|5080|5080| };
|5081|5081| 
|5082|5082| /**
|    | [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
|5225|5225| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5226|5226| 	{
|5227|5227| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5228|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5228|+		if (cmpTrader.HasBothMarkets() &&
|5229|5229| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5230|5230| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5231|5231| 		{
|    | [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
|5506|5506| 				{
|5507|5507| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5508|5508| 					var targetClasses = this.order.data.targetClasses;
|5509|    |-					if (targetClasses.attack && cmpIdentity
|5510|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5509|+					if (targetClasses.attack && cmpIdentity &&
|    |5510|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5511|5511| 						continue;
|5512|5512| 					if (targetClasses.avoid && cmpIdentity
|5513|5513| 						&& 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
|5509|5509| 					if (targetClasses.attack && cmpIdentity
|5510|5510| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5511|5511| 						continue;
|5512|    |-					if (targetClasses.avoid && cmpIdentity
|5513|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5512|+					if (targetClasses.avoid && cmpIdentity &&
|    |5513|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5514|5514| 						continue;
|5515|5515| 					// Only used by the AIs to prevent some choices of targets
|5516|5516| 					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
|5532|5532| 		{
|5533|5533| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5534|5534| 			var targetClasses = this.order.data.targetClasses;
|5535|    |-			if (cmpIdentity && targetClasses.attack
|5536|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5535|+			if (cmpIdentity && targetClasses.attack &&
|    |5536|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5537|5537| 				continue;
|5538|5538| 			if (cmpIdentity && targetClasses.avoid
|5539|5539| 				&& 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
|5535|5535| 			if (cmpIdentity && targetClasses.attack
|5536|5536| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5537|5537| 				continue;
|5538|    |-			if (cmpIdentity && targetClasses.avoid
|5539|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5538|+			if (cmpIdentity && targetClasses.avoid &&
|    |5539|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5540|5540| 				continue;
|5541|5541| 			// Only used by the AIs to prevent some choices of targets
|5542|5542| 			if (targetClasses.vetoEntities && targetClasses.vetoEntities[targ])
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5678|5678| 
|5679|5679| UnitAI.prototype.SetHeldPosition = function(x, z)
|5680|5680| {
|5681|    |-	this.heldPosition = {"x": x, "z": z};
|    |5681|+	this.heldPosition = { "x": x, "z": z};
|5682|5682| };
|5683|5683| 
|5684|5684| UnitAI.prototype.SetHeldPositionOnEntity = function(entity)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5678|5678| 
|5679|5679| UnitAI.prototype.SetHeldPosition = function(x, z)
|5680|5680| {
|5681|    |-	this.heldPosition = {"x": x, "z": z};
|    |5681|+	this.heldPosition = {"x": x, "z": z };
|5682|5682| };
|5683|5683| 
|5684|5684| UnitAI.prototype.SetHeldPositionOnEntity = function(entity)
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5705|5705| 	return false;
|5706|5706| };
|5707|5707| 
|5708|    |-//// Helper functions ////
|    |5708|+// // Helper functions ////
|5709|5709| 
|5710|5710| UnitAI.prototype.CanAttack = function(target)
|5711|5711| {
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5909|5909| 	return cmpPack && cmpPack.IsPacking();
|5910|5910| };
|5911|5911| 
|5912|    |-//// Formation specific functions ////
|    |5912|+// // Formation specific functions ////
|5913|5913| 
|5914|5914| UnitAI.prototype.IsAttackingAsFormation = function()
|5915|5915| {
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5914|5914| UnitAI.prototype.IsAttackingAsFormation = function()
|5915|5915| {
|5916|5916| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5917|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5918|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5917|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5918|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5919|5919| };
|5920|5920| 
|5921|5921| //// Animal specific functions ////
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5918|5918| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5919|5919| };
|5920|5920| 
|5921|    |-//// Animal specific functions ////
|    |5921|+// // Animal specific functions ////
|5922|5922| 
|5923|5923| UnitAI.prototype.MoveRandomly = function(distance)
|5924|5924| {

binaries/data/mods/public/simulation/components/UnitAI.js
| 331| »   »   »   return·true;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'Order.WalkToTarget' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
| 895| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
| 920| »   »   »   "enter":·function(msg)·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
| 938| »   »   »   "leave":·function(msg)·{
|    | [NORMAL] ESLintBear (no-dupe-keys):
|    | Duplicate key 'leave'.

binaries/data/mods/public/simulation/components/UnitAI.js
| 973| »   »   »   »   »   return·true;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'enter' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
|1036| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1074| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1107| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1320| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1616| »   »   »   »   »   return·false;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'enter' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
|2471| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2589| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2691| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2900| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|3083| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|3815| »   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
|4616| »   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
|4631| »   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
|4677| »   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
|4700| »   »   ····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
|5156| »   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
| 358| »   »   ····&&·(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
| 938| »   »   »   "leave":·function(msg)·{
|    | [NORMAL] JSHintBear:
|    | Duplicate key 'leave'.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4296| »   if·(data["target"])
|    | [NORMAL] JSHintBear:
|    | ['target'] is better written in dot notation.

binaries/data/mods/public/simulation/components/UnitAI.js
|4298| »   »   if·(data["min"]·||·data["max"])
|    | [NORMAL] JSHintBear:
|    | ['min'] is better written in dot notation.

binaries/data/mods/public/simulation/components/UnitAI.js
|4298| »   »   if·(data["min"]·||·data["max"])
|    | [NORMAL] JSHintBear:
|    | ['max'] is better written in dot notation.

binaries/data/mods/public/simulation/components/UnitAI.js
|4310| »   »   if·(data["min"]·||·data["max"])
|    | [NORMAL] JSHintBear:
|    | ['min'] is better written in dot notation.

binaries/data/mods/public/simulation/components/UnitAI.js
|4310| »   »   if·(data["min"]·||·data["max"])
|    | [NORMAL] JSHintBear:
|    | ['max'] is better written in dot notation.

binaries/data/mods/public/simulation/components/UnitAI.js
|4315| }
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4409| »   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
|4465| »   »   »   &&·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
|4633| »   »   &&·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
|4634| »   »   &&·(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
|5156| »   var·lastPos·=·undefined;
|    | [NORMAL] JSHintBear:
|    | It's not necessary to initialize 'lastPos' to 'undefined'.

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|5536| »   »   »   »   &&·!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
|5536| »   »   »   »   &&·!MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.attack))
|    | [MAJOR] JSHintBear:
|    | Too many errors. (91% scanned).
Executing section cli...

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

Silier retitled this revision from UnitAI cleanup [Gathering] to UnitAI cleanup [GATHER].May 31 2019, 10:54 PM

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 356| 356| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 357| 357| 		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 358| 358| 		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 359|    |-		{
|    | 359|+		
| 360| 360| 			// we were already on the shoreline, and have not moved since
| 361| 361| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
| 362| 362| 				needToMove = false;
| 363|    |-		}
|    | 363|+		
| 364| 364| 
| 365| 365| 		if (needToMove)
| 366| 366| 			this.SetNextState("INDIVIDUAL.PICKUP.APPROACHING");
|    | [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
| 354| 354| 		// Check if we need to move     TODO implement a better way to know if we are on the shoreline
| 355| 355| 		var needToMove = true;
| 356| 356| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 357|    |-		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 358|    |-		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
|    | 357|+		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x) &&
|    | 358|+		    (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 359| 359| 		{
| 360| 360| 			// we were already on the shoreline, and have not moved since
| 361| 361| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
|    | [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
| 519| 519| 					this.PushOrderFront("Walk", this.order.data.lastPos);
| 520| 520| 				}
| 521| 521| 				else
| 522|    |-				{
|    | 522|+				
| 523| 523| 					// We couldn't move there, or the target moved away
| 524| 524| 					this.FinishOrder();
| 525|    |-				}
|    | 525|+				
| 526| 526| 				return;
| 527| 527| 			}
| 528| 528| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 734| 734| 			}
| 735| 735| 			// Check if we are already in range, otherwise walk there
| 736| 736| 			if (!this.CheckGarrisonRange(msg.data.target))
| 737|    |-			{
|    | 737|+			
| 738| 738| 				if (!this.CheckTargetVisible(msg.data.target))
| 739| 739| 				{
| 740| 740| 					this.FinishOrder();
| 745| 745| 					this.SetNextState("GARRISON.APPROACHING");
| 746| 746| 					return;
| 747| 747| 				}
| 748|    |-			}
|    | 748|+			
| 749| 749| 
| 750| 750| 			this.SetNextState("GARRISON.GARRISONING");
| 751| 751| 		},
|    | [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
| 740| 740| 					this.FinishOrder();
| 741| 741| 					return;
| 742| 742| 				}
| 743|    |-				else
| 744|    |-				{
|    | 743|+				
| 745| 744| 					this.SetNextState("GARRISON.APPROACHING");
| 746| 745| 					return;
| 747|    |-				}
|    | 746|+				
| 748| 747| 			}
| 749| 748| 
| 750| 749| 			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
| 763| 763| 						this.PushOrderFront("Walk", msg.data.lastPos);
| 764| 764| 					}
| 765| 765| 					else
| 766|    |-					{
|    | 766|+					
| 767| 767| 						// We couldn't move there, or the target moved away
| 768| 768| 						this.FinishOrder();
| 769|    |-					}
|    | 769|+					
| 770| 770| 					return;
| 771| 771| 				}
| 772| 772| 
|    | [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
|1011|1011| 			},
|1012|1012| 		},
|1013|1013| 
|1014|    |-		"GARRISON":{
|    |1014|+		"GARRISON": {
|1015|1015| 			"enter": function() {
|1016|1016| 				// If the garrisonholder should pickup, warn it so it can take needed action
|1017|1017| 				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
|1231|1231| 			// If the controller handled an order but some members rejected it,
|1232|1232| 			// they will have no orders and be in the FORMATIONMEMBER.IDLE state.
|1233|1233| 			if (this.orderQueue.length)
|1234|    |-			{
|    |1234|+			
|1235|1235| 				// We're leaving the formation, so stop our FormationWalk order
|1236|1236| 				if (this.FinishOrder())
|1237|1237| 					return;
|1238|    |-			}
|    |1238|+			
|1239|1239| 
|1240|1240| 			// No orders left, we're an individual now
|1241|1241| 			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
|1259|1259| 			// Move a tile outside the building
|1260|1260| 			let range = 4;
|1261|1261| 			if (this.CheckTargetRangeExplicit(msg.data.target, range, range))
|1262|    |-			{
|    |1262|+			
|1263|1263| 				// We are already at the target, or can't move at all
|1264|1264| 				this.FinishOrder();
|1265|    |-			}
|    |1265|+			
|1266|1266| 			else
|1267|1267| 			{
|1268|1268| 				this.order.data.min = range;
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1474|1474| 
|1475|1475| 			"LosRangeUpdate": function(msg) {
|1476|1476| 				if (this.GetStance().targetVisibleEnemies)
|1477|    |-				{
|    |1477|+				
|1478|1478| 					// Start attacking one of the newly-seen enemy (if any)
|1479|1479| 					this.AttackEntitiesByPreference(msg.data.added);
|1480|    |-				}
|    |1480|+				
|1481|1481| 			},
|1482|1482| 
|1483|1483| 			"LosHealRangeUpdate": function(msg) {
|    | [NORMAL] ESLintBear (space-before-function-paren):
|    | Unexpected space before function parentheses.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1511|1511| 				this.SelectAnimation("move");
|1512|1512| 			},
|1513|1513| 
|1514|    |-			"leave": function () {
|    |1514|+			"leave": function() {
|1515|1515| 				this.SelectAnimation("idle");
|1516|1516| 				this.StopMoving();
|1517|1517| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1688|1688| 						// if nothing better to do, check if the guarded needs to be healed or repaired
|1689|1689| 						var cmpHealth = Engine.QueryInterface(this.isGuardOf, IID_Health);
|1690|1690| 						if (cmpHealth && cmpHealth.IsInjured())
|1691|    |-						{
|    |1691|+						
|1692|1692| 							if (this.CanHeal(this.isGuardOf))
|1693|1693| 								this.PushOrderFront("Heal", { "target": this.isGuardOf, "force": false });
|1694|1694| 							else if (this.CanRepair(this.isGuardOf))
|1695|1695| 								this.PushOrderFront("Repair", { "target": this.isGuardOf, "autocontinue": false, "force": false });
|1696|    |-						}
|    |1696|+						
|1697|1697| 					}
|1698|1698| 				},
|1699|1699| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1791|1791| 				"MoveCompleted": function() {
|1792|1792| 
|1793|1793| 					if (this.CheckTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1794|    |-					{
|    |1794|+					
|1795|1795| 						// If the unit needs to unpack, do so
|1796|1796| 						if (this.CanUnpack())
|1797|1797| 						{
|1800|1800| 						}
|1801|1801| 						else
|1802|1802| 							this.SetNextState("ATTACKING");
|1803|    |-					}
|    |1803|+					
|1804|1804| 					else
|1805|1805| 					{
|1806|1806| 						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
|1798|1798| 							this.PushOrderFront("Unpack", { "force": true });
|1799|1799| 							return;
|1800|1800| 						}
|1801|    |-						else
|1802|    |-							this.SetNextState("ATTACKING");
|    |1801|+						this.SetNextState("ATTACKING");
|1803|1802| 					}
|1804|1803| 					else
|1805|1804| 					{
|    | [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
|1802|1802| 							this.SetNextState("ATTACKING");
|1803|1803| 					}
|1804|1804| 					else
|1805|    |-					{
|    |1805|+					
|1806|1806| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1807|1807| 						{
|1808|1808| 							this.SetNextState("APPROACHING");
|1812|1812| 							// Give up
|1813|1813| 							this.FinishOrder();
|1814|1814| 						}
|1815|    |-					}
|    |1815|+					
|1816|1816| 				},
|1817|1817| 			},
|1818|1818| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1804|1804| 					else
|1805|1805| 					{
|1806|1806| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1807|    |-						{
|    |1807|+						
|1808|1808| 							this.SetNextState("APPROACHING");
|1809|    |-						}
|    |1809|+						
|1810|1810| 						else
|1811|1811| 						{
|1812|1812| 							// 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
|1808|1808| 							this.SetNextState("APPROACHING");
|1809|1809| 						}
|1810|1810| 						else
|1811|    |-						{
|    |1811|+						
|1812|1812| 							// Give up
|1813|1813| 							this.FinishOrder();
|1814|    |-						}
|    |1814|+						
|1815|1815| 					}
|1816|1816| 				},
|1817|1817| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1829|1829| 					}
|1830|1830| 					// Check the target is still alive and attackable
|1831|1831| 					if (this.CanAttack(target) && !this.CheckTargetAttackRange(target, this.order.data.attackType))
|1832|    |-					{
|    |1832|+					
|1833|1833| 						// Can't reach it - try to chase after it
|1834|1834| 						if (this.ShouldChaseTargetedEntity(target, this.order.data.force))
|1835|1835| 						{
|1844|1844| 								return;
|1845|1845| 							}
|1846|1846| 						}
|1847|    |-					}
|    |1847|+					
|1848|1848| 
|1849|1849| 					this.StopMoving();
|1850|1850| 
|    | [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
|1877|1877| 					// TODO: we should probably only bother syncing projectile attacks, not melee
|1878|1878| 
|1879|1879| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|1880|    |-					this.resyncAnimation = (prepare != this.attackTimers.prepare) ? true : false;
|    |1880|+					this.resyncAnimation = (prepare != this.attackTimers.prepare);
|1881|1881| 
|1882|1882| 					this.FaceTowardsTarget(this.order.data.target);
|1883|1883| 
|    | [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
|2006|2006| 
|2007|2007| 				"Attacked": function(msg) {
|2008|2008| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2009|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2010|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2009|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2010|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2011|2011| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2012|2012| 				},
|2013|2013| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2026|2026| 					this.SelectAnimation("move");
|2027|2027| 					var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|2028|2028| 					if (cmpUnitAI && cmpUnitAI.IsFleeing())
|2029|    |-					{
|    |2029|+					
|2030|2030| 						// Run after a fleeing target
|2031|2031| 						this.SetSpeedMultiplier(this.GetRunMultiplier());
|2032|    |-					}
|    |2032|+					
|2033|2033| 					this.StartTimer(1000, 1000);
|2034|2034| 				},
|2035|2035| 
|    | [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
|2085|2085| 						// Also don't switch to a different type of huntable animal
|2086|2086| 						let nearbyResource = this.FindNearbyResource(function(ent, type, template) {
|2087|2087| 							return (
|2088|    |-								ent != oldTarget
|2089|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2088|+								ent != oldTarget &&
|    |2089|+								 ((type.generic == "treasure" && oldType.generic == "treasure")
|2090|2090| 								 || (type.specific == oldType.specific
|2091|2091| 								 && (type.specific != "meat" || oldTemplate == template)))
|2092|2092| 							);
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2086|2086| 						let nearbyResource = this.FindNearbyResource(function(ent, type, template) {
|2087|2087| 							return (
|2088|2088| 								ent != oldTarget
|2089|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2090|    |-								 || (type.specific == oldType.specific
|    |2089|+								 && ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2090|+								 (type.specific == oldType.specific
|2091|2091| 								 && (type.specific != "meat" || oldTemplate == template)))
|2092|2092| 							);
|2093|2093| 						}, 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
|2087|2087| 							return (
|2088|2088| 								ent != oldTarget
|2089|2089| 								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2090|    |-								 || (type.specific == oldType.specific
|2091|    |-								 && (type.specific != "meat" || oldTemplate == template)))
|    |2090|+								 || (type.specific == oldType.specific &&
|    |2091|+								 (type.specific != "meat" || oldTemplate == template)))
|2092|2092| 							);
|2093|2093| 						}, oldTarget);
|2094|2094| 						if (nearbyResource)
|    | [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
|2096|2096| 							this.PerformGather(nearbyResource, false, false);
|2097|2097| 							return true;
|2098|2098| 						}
|2099|    |-						else
|2100|    |-						{
|    |2099|+						
|2101|2100| 							// It's probably better in this case, to avoid units getting stuck around a dropsite
|2102|2101| 							// in a "Target is far away, full, nearby are no good resources, return to dropsite" loop
|2103|2102| 							// to order it to GatherNear the resource position.
|2118|2117| 									return true;
|2119|2118| 								}
|2120|2119| 							}
|2121|    |-						}
|    |2120|+						
|2122|2121| 						return true;
|2123|2122| 					}
|2124|2123| 
|    | [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
|2108|2108| 								this.GatherNearPosition(pos.x, pos.z, oldType, oldTemplate);
|2109|2109| 								return true;
|2110|2110| 							}
|2111|    |-							else
|2112|    |-							{
|    |2111|+							
|2113|2112| 								// we're kind of stuck here. Return resource.
|2114|2113| 								let nearestDropsite = this.FindNearestDropsite(oldType.generic);
|2115|2114| 								if (nearestDropsite)
|2117|2116| 									this.PushOrderFront("ReturnResource", { "target": nearestDropsite, "force": false });
|2118|2117| 									return true;
|2119|2118| 								}
|2120|    |-							}
|    |2119|+							
|2121|2120| 						}
|2122|2121| 						return true;
|2123|2122| 					}
|    | [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
|2160|2160| 						// Also don't switch to a different type of huntable animal
|2161|2161| 						let nearbyResource = this.FindNearbyResource(function(ent, type, template) {
|2162|2162| 							return (
|2163|    |-								ent != oldTarget
|2164|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2163|+								ent != oldTarget &&
|    |2164|+								((type.generic == "treasure" && oldType.generic == "treasure")
|2165|2165| 								|| (type.specific == oldType.specific
|2166|2166| 								&& (type.specific != "meat" || oldTemplate == template)))
|2167|2167| 							);
|    | [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
|2161|2161| 						let nearbyResource = this.FindNearbyResource(function(ent, type, template) {
|2162|2162| 							return (
|2163|2163| 								ent != oldTarget
|2164|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2165|    |-								|| (type.specific == oldType.specific
|    |2164|+								&& ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2165|+								(type.specific == oldType.specific
|2166|2166| 								&& (type.specific != "meat" || oldTemplate == template)))
|2167|2167| 							);
|2168|2168| 						});
|    | [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
|2162|2162| 							return (
|2163|2163| 								ent != oldTarget
|2164|2164| 								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2165|    |-								|| (type.specific == oldType.specific
|2166|    |-								&& (type.specific != "meat" || oldTemplate == template)))
|    |2165|+								|| (type.specific == oldType.specific &&
|    |2166|+								(type.specific != "meat" || oldTemplate == template)))
|2167|2167| 							);
|2168|2168| 						});
|2169|2169| 						if (nearbyResource)
|    | [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
|2220|2220| 					// Also don't switch to a different type of huntable animal
|2221|2221| 					let nearbyResource = this.FindNearbyResource(function(ent, type, template) {
|2222|2222| 						return (
|2223|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2224|    |-							|| (type.specific == resourceType.specific
|    |2223|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2224|+							(type.specific == resourceType.specific
|2225|2225| 							&& (type.specific != "meat" || resourceTemplate == template))
|2226|2226| 						);
|2227|2227| 					});
|    | [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
|2221|2221| 					let nearbyResource = this.FindNearbyResource(function(ent, type, template) {
|2222|2222| 						return (
|2223|2223| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2224|    |-							|| (type.specific == resourceType.specific
|2225|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2224|+							|| (type.specific == resourceType.specific &&
|    |2225|+							(type.specific != "meat" || resourceTemplate == template))
|2226|2226| 						);
|2227|2227| 					});
|2228|2228| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2337|2337| 
|2338|2338| 					let cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply);
|2339|2339| 					if (cmpSupply && cmpSupply.IsAvailable(cmpOwnership.GetOwner(), this.entity))
|2340|    |-					{
|    |2340|+					
|2341|2341| 						// Check we can still reach and gather from the target
|2342|2342| 						if (this.CanGather(this.gatheringTarget) && this.CheckTargetRange(this.gatheringTarget, IID_ResourceGatherer))
|2343|2343| 						{
|2400|2400| 								return;
|2401|2401| 							}
|2402|2402| 						}
|2403|    |-					}
|    |2403|+					
|2404|2404| 
|2405|2405| 					// We're already in range, can't get anywhere near it or the target is exhausted.
|2406|2406| 
|    | [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
|2426|2426| 					// Also don't switch to a different type of huntable animal
|2427|2427| 					let nearbyResource = this.FindNearbyResource(function(ent, type, template) {
|2428|2428| 						return (
|2429|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2430|    |-							|| (type.specific == resourceType.specific
|    |2429|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2430|+							(type.specific == resourceType.specific
|2431|2431| 							&& (type.specific != "meat" || resourceTemplate == template))
|2432|2432| 						);
|2433|2433| 					});
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2427|2427| 					let nearbyResource = this.FindNearbyResource(function(ent, type, template) {
|2428|2428| 						return (
|2429|2429| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2430|    |-							|| (type.specific == resourceType.specific
|2431|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2430|+							|| (type.specific == resourceType.specific &&
|    |2431|+							(type.specific != "meat" || resourceTemplate == template))
|2432|2432| 						);
|2433|2433| 					});
|2434|2434| 					if (nearbyResource)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2492|2492| 
|2493|2493| 				"Timer": function(msg) {
|2494|2494| 					if (this.ShouldAbandonChase(this.order.data.target, this.order.data.force, IID_Heal, null))
|2495|    |-					{
|    |2495|+					
|2496|2496| 						// Return to our original position unless we have a better order.
|2497|2497| 						if (!this.FinishOrder() && this.GetStance().respondHoldGround)
|2498|2498| 							this.WalkToHeldPosition();
|2499|    |-					}
|    |2499|+					
|2500|2500| 				},
|2501|2501| 
|2502|2502| 				"MoveCompleted": function() {
|    | [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
|2526|2526| 					this.StartTimer(prepare, this.healTimers.repeat);
|2527|2527| 
|2528|2528| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2529|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2529|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2530|2530| 
|2531|2531| 					this.FaceTowardsTarget(this.order.data.target);
|2532|2532| 				},
|    | [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
|2738|2738| 					{
|2739|2739| 						// The building was already finished/fully repaired before we arrived;
|2740|2740| 						// let the ConstructionFinished handler handle this.
|2741|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2741|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2742|2742| 						return true;
|2743|2743| 					}
|2744|2744| 
|    | [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
|2738|2738| 					{
|2739|2739| 						// The building was already finished/fully repaired before we arrived;
|2740|2740| 						// let the ConstructionFinished handler handle this.
|2741|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2741|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2742|2742| 						return true;
|2743|2743| 					}
|2744|2744| 
|    | [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
|2781|2781| 					if (!inRange && this.MoveToTargetRange(this.repairTarget, IID_Builder))
|2782|2782| 						this.SetNextState("APPROACHING");
|2783|2783| 					else if (!inRange)
|2784|    |-						this.FinishOrder(); //can't approach and isn't in reach
|    |2784|+						this.FinishOrder(); // can't approach and isn't in reach
|2785|2785| 				},
|2786|2786| 			},
|2787|2787| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2868|2868| 
|2869|2869| 				// Unit was approaching and there's nothing to do now, so switch to walking
|2870|2870| 				if (oldState === "INDIVIDUAL.REPAIR.APPROACHING")
|2871|    |-				{
|    |2871|+				
|2872|2872| 					// We're already walking to the given point, so add this as a order.
|2873|2873| 					this.WalkToTarget(msg.data.newentity, true);
|2874|    |-				}
|    |2874|+				
|2875|2875| 			},
|2876|2876| 		},
|2877|2877| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2930|2930| 
|2931|2931| 					// Check that we can garrison here
|2932|2932| 					if (this.CanGarrison(target))
|2933|    |-					{
|    |2933|+					
|2934|2934| 						// Check that we're in range of the garrison target
|2935|2935| 						if (this.CheckGarrisonRange(target))
|2936|2936| 						{
|3006|3006| 								return false;
|3007|3007| 							}
|3008|3008| 						}
|3009|    |-					}
|    |3009|+					
|3010|3010| 					// Garrisoning failed for some reason, so finish the order
|3011|3011| 					this.FinishOrder();
|3012|3012| 					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
|3127|3127| 		"Attacked": function(msg) {
|3128|3128| 			if (this.template.NaturalBehaviour == "skittish" ||
|3129|3129| 			    this.template.NaturalBehaviour == "passive")
|3130|    |-			{
|    |3130|+			
|3131|3131| 				this.Flee(msg.data.attacker, false);
|3132|    |-			}
|    |3132|+			
|3133|3133| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|3134|3134| 			{
|3135|3135| 				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
|3136|3136| 					this.Attack(msg.data.attacker, false);
|3137|3137| 			}
|3138|3138| 			else if (this.template.NaturalBehaviour == "domestic")
|3139|    |-			{
|    |3139|+			
|3140|3140| 				// Never flee, stop what we were doing
|3141|3141| 				this.SetNextState("IDLE");
|3142|    |-			}
|    |3142|+			
|3143|3143| 		},
|3144|3144| 
|3145|3145| 		"Order.LeaveFoundation": function(msg) {
|    | [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
|3150|3150| 				this.FinishOrder();
|3151|3151| 				return;
|3152|3152| 			}
|3153|    |-			else
|3154|    |-			{
|    |3153|+			
|3155|3154| 				this.order.data.min = range;
|3156|3155| 				this.SetNextState("WALKING");
|3157|    |-			}
|    |3156|+			
|3158|3157| 		},
|3159|3158| 
|3160|3159| 		"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
|3194|3194| 				}
|3195|3195| 				// Start attacking one of the newly-seen enemy (if any)
|3196|3196| 				else if (this.IsDangerousAnimal())
|3197|    |-				{
|    |3197|+				
|3198|3198| 					this.AttackVisibleEntity(msg.data.added);
|3199|    |-				}
|    |3199|+				
|3200|3200| 
|3201|3201| 				// TODO: if two units enter our range together, we'll attack the
|3202|3202| 				// 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
|3237|3237| 				}
|3238|3238| 				// Start attacking one of the newly-seen enemy (if any)
|3239|3239| 				else if (this.template.NaturalBehaviour == "violent")
|3240|    |-				{
|    |3240|+				
|3241|3241| 					this.AttackVisibleEntity(msg.data.added);
|3242|    |-				}
|    |3242|+				
|3243|3243| 			},
|3244|3244| 
|3245|3245| 			"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
|3254|3254| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3255|3255| 
|3256|3256| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3257|    |-							// only used for domestic animals
|    |3257|+		// only used for domestic animals
|3258|3258| 	},
|3259|3259| };
|3260|3260| 
|    | [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
|3311|3311| 
|3312|3312| UnitAI.prototype.IsAnimal = function()
|3313|3313| {
|3314|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3314|+	return (!!this.template.NaturalBehaviour);
|3315|3315| };
|3316|3316| 
|3317|3317| 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
|3349|3349| UnitAI.prototype.GetGarrisonHolder = function()
|3350|3350| {
|3351|3351| 	if (this.IsGarrisoned())
|3352|    |-	{
|    |3352|+	
|3353|3353| 		for (let order of this.orderQueue)
|3354|3354| 			if (order.type == "Garrison")
|3355|3355| 				return order.data.target;
|3356|    |-	}
|    |3356|+	
|3357|3357| 	return INVALID_ENTITY;
|3358|3358| };
|3359|3359| 
|    | [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
|3427|3427| 		{
|3428|3428| 			let index = this.GetCurrentState().indexOf(".");
|3429|3429| 			if (index != -1)
|3430|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3430|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3431|3431| 			this.Stop(false);
|3432|3432| 		}
|3433|3433| 
|    | [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
|3483|3483| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3484|3484| 			continue;
|3485|3485| 		if (i == 0)
|3486|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3486|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3487|3487| 		else
|3488|3488| 			this.orderQueue.splice(i, 1);
|3489|3489| 		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
|3483|3483| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3484|3484| 			continue;
|3485|3485| 		if (i == 0)
|3486|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3486|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3487|3487| 		else
|3488|3488| 			this.orderQueue.splice(i, 1);
|3489|3489| 		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
|3567|3567| };
|3568|3568| 
|3569|3569| 
|3570|    |-//// FSM linkage functions ////
|    |3570|+// // FSM linkage functions ////
|3571|3571| 
|3572|3572| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3573|3573| UnitAI.prototype.SetNextState = function(state)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3739|3739| 				continue;
|3740|3740| 			if (this.orderQueue[i].type == type)
|3741|3741| 				continue;
|3742|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3742|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3743|3743| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3744|3744| 			return;
|3745|3745| 		}
|    | [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
|3739|3739| 				continue;
|3740|3740| 			if (this.orderQueue[i].type == type)
|3741|3741| 				continue;
|3742|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3742|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3743|3743| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3744|3744| 			return;
|3745|3745| 		}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3753|3753| {
|3754|3754| 	// Remember the previous work orders to be able to go back to them later if required
|3755|3755| 	if (data && data.force)
|3756|    |-	{
|    |3756|+	
|3757|3757| 		if (this.IsFormationController())
|3758|3758| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3759|3759| 		else
|3760|3760| 			this.UpdateWorkOrders(type);
|3761|    |-	}
|    |3761|+	
|3762|3762| 
|3763|3763| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3764|3764| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3830|3830| 	{
|3831|3831| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3832|3832| 		if (cmpUnitAI)
|3833|    |-		{
|    |3833|+		
|3834|3834| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3835|3835| 			{
|3836|3836| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3839|3839| 					return;
|3840|3840| 				}
|3841|3841| 			}
|3842|    |-		}
|    |3842|+		
|3843|3843| 	}
|3844|3844| 
|3845|3845| 	// 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
|3832|3832| 		if (cmpUnitAI)
|3833|3833| 		{
|3834|3834| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3835|    |-			{
|    |3835|+			
|3836|3836| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3837|3837| 				{
|3838|3838| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3839|3839| 					return;
|3840|3840| 				}
|3841|    |-			}
|    |3841|+			
|3842|3842| 		}
|3843|3843| 	}
|3844|3844| 
|    | [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
|3844|3844| 
|3845|3845| 	// If nothing found, take the unit orders
|3846|3846| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3847|    |-	{
|    |3847|+	
|3848|3848| 		if (isWorkType(this.orderQueue[i].type))
|3849|3849| 		{
|3850|3850| 			this.workOrders = this.orderQueue.slice(i);
|3851|3851| 			return;
|3852|3852| 		}
|3853|    |-	}
|    |3853|+	
|3854|3854| };
|3855|3855| 
|3856|3856| 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
|3910|3910| 	if (data.timerRepeat === undefined)
|3911|3911| 		this.timer = undefined;
|3912|3912| 
|3913|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3913|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3914|3914| };
|3915|3915| 
|3916|3916| /**
|    | [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
|3910|3910| 	if (data.timerRepeat === undefined)
|3911|3911| 		this.timer = undefined;
|3912|3912| 
|3913|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3913|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3914|3914| };
|3915|3915| 
|3916|3916| /**
|    | [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
|3945|3945| 	this.timer = undefined;
|3946|3946| };
|3947|3947| 
|3948|    |-//// Message handlers /////
|    |3948|+// // Message handlers /////
|3949|3949| 
|3950|3950| UnitAI.prototype.OnMotionChanged = function(msg)
|3951|3951| {
|    | [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
|3950|3950| UnitAI.prototype.OnMotionChanged = function(msg)
|3951|3951| {
|3952|3952| 	if (msg.starting && !msg.error)
|3953|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3953|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveStarted", "data": msg});
|3954|3954| 	else if (!msg.starting || msg.error)
|3955|3955| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3956|3956| };
|    | [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
|3950|3950| UnitAI.prototype.OnMotionChanged = function(msg)
|3951|3951| {
|3952|3952| 	if (msg.starting && !msg.error)
|3953|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3953|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg });
|3954|3954| 	else if (!msg.starting || msg.error)
|3955|3955| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3956|3956| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3952|3952| 	if (msg.starting && !msg.error)
|3953|3953| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3954|3954| 	else if (!msg.starting || msg.error)
|3955|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3955|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveCompleted", "data": msg});
|3956|3956| };
|3957|3957| 
|3958|3958| 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
|3952|3952| 	if (msg.starting && !msg.error)
|3953|3953| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3954|3954| 	else if (!msg.starting || msg.error)
|3955|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3955|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg });
|3956|3956| };
|3957|3957| 
|3958|3958| 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
|3960|3960| 	// TODO: This is a bit inefficient since every unit listens to every
|3961|3961| 	// construction message - ideally we could scope it to only the one we're building
|3962|3962| 
|3963|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3963|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3964|3964| };
|3965|3965| 
|3966|3966| 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
|3960|3960| 	// TODO: This is a bit inefficient since every unit listens to every
|3961|3961| 	// construction message - ideally we could scope it to only the one we're building
|3962|3962| 
|3963|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3963|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3964|3964| };
|3965|3965| 
|3966|3966| 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
|3985|3985| 
|3986|3986| UnitAI.prototype.OnAttacked = function(msg)
|3987|3987| {
|3988|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3988|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3989|3989| };
|3990|3990| 
|3991|3991| 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
|3985|3985| 
|3986|3986| UnitAI.prototype.OnAttacked = function(msg)
|3987|3987| {
|3988|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3988|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3989|3989| };
|3990|3990| 
|3991|3991| 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
|3990|3990| 
|3991|3991| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3992|3992| {
|3993|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3993|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|3994|3994| };
|3995|3995| 
|3996|3996| 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
|3990|3990| 
|3991|3991| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3992|3992| {
|3993|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3993|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|3994|3994| };
|3995|3995| 
|3996|3996| 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
|3995|3995| 
|3996|3996| UnitAI.prototype.OnHealthChanged = function(msg)
|3997|3997| {
|3998|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3998|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|3999|3999| };
|4000|4000| 
|4001|4001| 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
|3995|3995| 
|3996|3996| UnitAI.prototype.OnHealthChanged = function(msg)
|3997|3997| {
|3998|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3998|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|3999|3999| };
|4000|4000| 
|4001|4001| 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
|4001|4001| UnitAI.prototype.OnRangeUpdate = function(msg)
|4002|4002| {
|4003|4003| 	if (msg.tag == this.losRangeQuery)
|4004|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4004|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4005|4005| 	else if (msg.tag == this.losHealRangeQuery)
|4006|4006| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4007|4007| };
|    | [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
|4001|4001| UnitAI.prototype.OnRangeUpdate = function(msg)
|4002|4002| {
|4003|4003| 	if (msg.tag == this.losRangeQuery)
|4004|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4004|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4005|4005| 	else if (msg.tag == this.losHealRangeQuery)
|4006|4006| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4007|4007| };
|    | [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
|4003|4003| 	if (msg.tag == this.losRangeQuery)
|4004|4004| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4005|4005| 	else if (msg.tag == this.losHealRangeQuery)
|4006|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4006|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4007|4007| };
|4008|4008| 
|4009|4009| 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
|4003|4003| 	if (msg.tag == this.losRangeQuery)
|4004|4004| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4005|4005| 	else if (msg.tag == this.losHealRangeQuery)
|4006|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4006|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4007|4007| };
|4008|4008| 
|4009|4009| 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
|4008|4008| 
|4009|4009| UnitAI.prototype.OnPackFinished = function(msg)
|4010|4010| {
|4011|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4011|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4012|4012| };
|4013|4013| 
|4014|4014| //// 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
|4008|4008| 
|4009|4009| UnitAI.prototype.OnPackFinished = function(msg)
|4010|4010| {
|4011|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4011|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4012|4012| };
|4013|4013| 
|4014|4014| //// 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
|4011|4011| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4012|4012| };
|4013|4013| 
|4014|    |-//// Helper functions to be called by the FSM ////
|    |4014|+// // Helper functions to be called by the FSM ////
|4015|4015| 
|4016|4016| UnitAI.prototype.GetWalkSpeed = function()
|4017|4017| {
|    | [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
|4113|4113| 	if (!cmpOwnership || cmpOwnership.GetOwner() == INVALID_PLAYER)
|4114|4114| 		return undefined;
|4115|4115| 
|4116|    |-	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position)
|    |4116|+	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
|4117|4117| 	if (!cmpPosition || !cmpPosition.IsInWorld())
|4118|4118| 		return undefined;
|4119|4119| 
|    | [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
|4198|4198| 			PlaySound(name, member);
|4199|4199| 	}
|4200|4200| 	else
|4201|    |-	{
|    |4201|+	
|4202|4202| 		// Otherwise use our own sounds
|4203|4203| 		PlaySound(name, this.entity);
|4204|    |-	}
|    |4204|+	
|4205|4205| };
|4206|4206| 
|4207|4207| /*
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4294|4294| UnitAI.prototype.MoveTo = function(data, iid, type)
|4295|4295| {
|4296|4296| 	if (data["target"])
|4297|    |-	{
|    |4297|+	
|4298|4298| 		if (data["min"] || data["max"])
|4299|4299| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4300|4300| 		else
|4304|4304| 			else
|4305|4305| 				return this.MoveToTargetRange(data.target, iid, type);
|4306|4306| 		}
|4307|    |-	}
|    |4307|+	
|4308|4308| 	else
|4309|4309| 	{
|4310|4310| 		if (data["min"] || data["max"])
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["target"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4293|4293|  */
|4294|4294| UnitAI.prototype.MoveTo = function(data, iid, type)
|4295|4295| {
|4296|    |-	if (data["target"])
|    |4296|+	if (data.target)
|4297|4297| 	{
|4298|4298| 		if (data["min"] || data["max"])
|4299|4299| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["min"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4295|4295| {
|4296|4296| 	if (data["target"])
|4297|4297| 	{
|4298|    |-		if (data["min"] || data["max"])
|    |4298|+		if (data.min || data["max"])
|4299|4299| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4300|4300| 		else
|4301|4301| 		{
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["max"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4295|4295| {
|4296|4296| 	if (data["target"])
|4297|4297| 	{
|4298|    |-		if (data["min"] || data["max"])
|    |4298|+		if (data["min"] || data.max)
|4299|4299| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4300|4300| 		else
|4301|4301| 		{
|    | [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
|4298|4298| 		if (data["min"] || data["max"])
|4299|4299| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4300|4300| 		else
|4301|    |-		{
|    |4301|+		
|4302|4302| 			if (!iid)
|4303|4303| 				return this.MoveToTarget(data.target);
|4304|4304| 			else
|4305|4305| 				return this.MoveToTargetRange(data.target, iid, type);
|4306|    |-		}
|    |4306|+		
|4307|4307| 	}
|4308|4308| 	else
|4309|4309| 	{
|    | [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
|4297|4297| 	{
|4298|4298| 		if (data["min"] || data["max"])
|4299|4299| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4300|    |-		else
|4301|    |-		{
|    |4300|+		
|4302|4301| 			if (!iid)
|4303|4302| 				return this.MoveToTarget(data.target);
|4304|4303| 			else
|4305|4304| 				return this.MoveToTargetRange(data.target, iid, type);
|4306|    |-		}
|    |4305|+		
|4307|4306| 	}
|4308|4307| 	else
|4309|4308| 	{
|    | [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
|4301|4301| 		{
|4302|4302| 			if (!iid)
|4303|4303| 				return this.MoveToTarget(data.target);
|4304|    |-			else
|4305|    |-				return this.MoveToTargetRange(data.target, iid, type);
|    |4304|+			return this.MoveToTargetRange(data.target, iid, type);
|4306|4305| 		}
|4307|4306| 	}
|4308|4307| 	else
|    | [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
|4306|4306| 		}
|4307|4307| 	}
|4308|4308| 	else
|4309|    |-	{
|    |4309|+	
|4310|4310| 		if (data["min"] || data["max"])
|4311|4311| 			return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1);
|4312|4312| 		else
|4313|4313| 			return this.MoveToPoint(data.x, data.z);
|4314|    |-	}
|    |4314|+	
|4315|4315| }
|4316|4316| 
|4317|4317| UnitAI.prototype.MoveToPoint = function(x, z)
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["min"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4307|4307| 	}
|4308|4308| 	else
|4309|4309| 	{
|4310|    |-		if (data["min"] || data["max"])
|    |4310|+		if (data.min || data["max"])
|4311|4311| 			return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1);
|4312|4312| 		else
|4313|4313| 			return this.MoveToPoint(data.x, data.z);
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["max"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4307|4307| 	}
|4308|4308| 	else
|4309|4309| 	{
|4310|    |-		if (data["min"] || data["max"])
|    |4310|+		if (data["min"] || data.max)
|4311|4311| 			return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1);
|4312|4312| 		else
|4313|4313| 			return this.MoveToPoint(data.x, data.z);
|    | [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
|4309|4309| 	{
|4310|4310| 		if (data["min"] || data["max"])
|4311|4311| 			return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1);
|4312|    |-		else
|4313|    |-			return this.MoveToPoint(data.x, data.z);
|    |4312|+		return this.MoveToPoint(data.x, data.z);
|4314|4313| 	}
|4315|4314| }
|4316|4315| 
|    | [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
|4312|4312| 		else
|4313|4313| 			return this.MoveToPoint(data.x, data.z);
|4314|4314| 	}
|4315|    |-}
|    |4315|+};
|4316|4316| 
|4317|4317| UnitAI.prototype.MoveToPoint = function(x, z)
|4318|4318| {
|    | [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
|4396|4396| 	else
|4397|4397| 		// return false? Or hope you come close enough?
|4398|4398| 		var parabolicMaxRange = 0;
|4399|    |-		//return false;
|    |4399|+		// return false;
|4400|4400| 
|4401|4401| 	// the parabole changes while walking, take something in the middle
|4402|4402| 	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
|4461|4461| 	if (this.IsFormationMember())
|4462|4462| 	{
|4463|4463| 		var cmpFormationUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|4464|    |-		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation()
|4465|    |-			&& cmpFormationUnitAI.order.data.target == target)
|    |4464|+		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation() &&
|    |4465|+			cmpFormationUnitAI.order.data.target == target)
|4466|4466| 			return true;
|4467|4467| 	}
|4468|4468| 
|    | [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
|4629|4629| UnitAI.prototype.AttackEntityInZone = function(ents)
|4630|4630| {
|4631|4631| 	var target = ents.find(target =>
|4632|    |-		this.CanAttack(target)
|4633|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4632|+		this.CanAttack(target) &&
|    |4633|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4634|4634| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4635|4635| 	);
|4636|4636| 	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
|4630|4630| {
|4631|4631| 	var target = ents.find(target =>
|4632|4632| 		this.CanAttack(target)
|4633|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4634|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4633|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4634|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4635|4635| 	);
|4636|4636| 	if (!target)
|4637|4637| 		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
|4694|4694| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4695|4695| 	if (this.isGuardOf)
|4696|4696| 	{
|4697|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4697|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4698|4698| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4699|4699| 		if (cmpUnitAI && cmpAttack &&
|4700|4700| 		    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
|4698|4698| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4699|4699| 		if (cmpUnitAI && cmpAttack &&
|4700|4700| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4701|    |-				return false;
|    |4701|+			return false;
|4702|4702| 	}
|4703|4703| 
|4704|4704| 	// 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
|4703|4703| 
|4704|4704| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4705|4705| 	if (this.GetStance().respondHoldGround)
|4706|    |-	{
|    |4706|+	
|4707|4707| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4708|4708| 			return true;
|4709|    |-	}
|    |4709|+	
|4710|4710| 
|4711|4711| 	// Stop if it's left our vision range, unless we're especially persistent
|4712|4712| 	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
|4710|4710| 
|4711|4711| 	// Stop if it's left our vision range, unless we're especially persistent
|4712|4712| 	if (!this.GetStance().respondChaseBeyondVision)
|4713|    |-	{
|    |4713|+	
|4714|4714| 		if (!this.CheckTargetIsInVisionRange(target))
|4715|4715| 			return true;
|4716|    |-	}
|    |4716|+	
|4717|4717| 
|4718|4718| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4719|4719| 	// 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
|4736|4736| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4737|4737| 	if (this.isGuardOf)
|4738|4738| 	{
|4739|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4739|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4740|4740| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4741|4741| 		if (cmpUnitAI && cmpAttack &&
|4742|4742| 		    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
|4749|4749| 	return false;
|4750|4750| };
|4751|4751| 
|4752|    |-//// External interface functions ////
|    |4752|+// // External interface functions ////
|4753|4753| 
|4754|4754| UnitAI.prototype.SetFormationController = function(ent)
|4755|4755| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4759|4759| 	// of our own formation (or ourself if not in formation)
|4760|4760| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4761|4761| 	if (cmpObstruction)
|4762|    |-	{
|    |4762|+	
|4763|4763| 		if (ent == INVALID_ENTITY)
|4764|4764| 			cmpObstruction.SetControlGroup(this.entity);
|4765|4765| 		else
|4766|4766| 			cmpObstruction.SetControlGroup(ent);
|4767|    |-	}
|    |4767|+	
|4768|4768| 
|4769|4769| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4770|4770| 	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
|4902|4902| 	// if we already had an old guard order, do nothing if the target is the same
|4903|4903| 	// and the order is running, otherwise remove the previous order
|4904|4904| 	if (this.isGuardOf)
|4905|    |-	{
|    |4905|+	
|4906|4906| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4907|4907| 			return;
|4908|4908| 		else
|4909|4909| 			this.RemoveGuard();
|4910|    |-	}
|    |4910|+	
|4911|4911| 
|4912|4912| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4913|4913| };
|    | [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
|4905|4905| 	{
|4906|4906| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4907|4907| 			return;
|4908|    |-		else
|4909|    |-			this.RemoveGuard();
|    |4908|+		this.RemoveGuard();
|4910|4909| 	}
|4911|4910| 
|4912|4911| 	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
|5076|5076| 			this.WalkToTarget(target, queued);
|5077|5077| 		return;
|5078|5078| 	}
|5079|    |-	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture}, queued);
|    |5079|+	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture }, queued);
|5080|5080| };
|5081|5081| 
|5082|5082| /**
|    | [NORMAL] ESLintBear (no-undef-init):
|    | It's not necessary to initialize 'lastPos' to undefined.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5153|5153| 
|5154|5154| 	// Remember the position of our target, if any, in case it disappears
|5155|5155| 	// later and we want to head to its last known position
|5156|    |-	let lastPos = undefined;
|    |5156|+	let lastPos;
|5157|5157| 	let cmpPosition = Engine.QueryInterface(target, IID_Position);
|5158|5158| 	if (cmpPosition && cmpPosition.IsInWorld())
|5159|5159| 		lastPos = cmpPosition.GetPosition();
|    | [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
|5225|5225| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5226|5226| 	{
|5227|5227| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5228|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5228|+		if (cmpTrader.HasBothMarkets() &&
|5229|5229| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5230|5230| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5231|5231| 		{
|    | [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
|5506|5506| 				{
|5507|5507| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5508|5508| 					var targetClasses = this.order.data.targetClasses;
|5509|    |-					if (targetClasses.attack && cmpIdentity
|5510|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5509|+					if (targetClasses.attack && cmpIdentity &&
|    |5510|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5511|5511| 						continue;
|5512|5512| 					if (targetClasses.avoid && cmpIdentity
|5513|5513| 						&& 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
|5509|5509| 					if (targetClasses.attack && cmpIdentity
|5510|5510| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5511|5511| 						continue;
|5512|    |-					if (targetClasses.avoid && cmpIdentity
|5513|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5512|+					if (targetClasses.avoid && cmpIdentity &&
|    |5513|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5514|5514| 						continue;
|5515|5515| 					// Only used by the AIs to prevent some choices of targets
|5516|5516| 					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
|5532|5532| 		{
|5533|5533| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5534|5534| 			var targetClasses = this.order.data.targetClasses;
|5535|    |-			if (cmpIdentity && targetClasses.attack
|5536|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5535|+			if (cmpIdentity && targetClasses.attack &&
|    |5536|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5537|5537| 				continue;
|5538|5538| 			if (cmpIdentity && targetClasses.avoid
|5539|5539| 				&& 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
|5535|5535| 			if (cmpIdentity && targetClasses.attack
|5536|5536| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5537|5537| 				continue;
|5538|    |-			if (cmpIdentity && targetClasses.avoid
|5539|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5538|+			if (cmpIdentity && targetClasses.avoid &&
|    |5539|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5540|5540| 				continue;
|5541|5541| 			// Only used by the AIs to prevent some choices of targets
|5542|5542| 			if (targetClasses.vetoEntities && targetClasses.vetoEntities[targ])
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5678|5678| 
|5679|5679| UnitAI.prototype.SetHeldPosition = function(x, z)
|5680|5680| {
|5681|    |-	this.heldPosition = {"x": x, "z": z};
|    |5681|+	this.heldPosition = { "x": x, "z": z};
|5682|5682| };
|5683|5683| 
|5684|5684| UnitAI.prototype.SetHeldPositionOnEntity = function(entity)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5678|5678| 
|5679|5679| UnitAI.prototype.SetHeldPosition = function(x, z)
|5680|5680| {
|5681|    |-	this.heldPosition = {"x": x, "z": z};
|    |5681|+	this.heldPosition = {"x": x, "z": z };
|5682|5682| };
|5683|5683| 
|5684|5684| UnitAI.prototype.SetHeldPositionOnEntity = function(entity)
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5705|5705| 	return false;
|5706|5706| };
|5707|5707| 
|5708|    |-//// Helper functions ////
|    |5708|+// // Helper functions ////
|5709|5709| 
|5710|5710| UnitAI.prototype.CanAttack = function(target)
|5711|5711| {
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5909|5909| 	return cmpPack && cmpPack.IsPacking();
|5910|5910| };
|5911|5911| 
|5912|    |-//// Formation specific functions ////
|    |5912|+// // Formation specific functions ////
|5913|5913| 
|5914|5914| UnitAI.prototype.IsAttackingAsFormation = function()
|5915|5915| {
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5914|5914| UnitAI.prototype.IsAttackingAsFormation = function()
|5915|5915| {
|5916|5916| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5917|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5918|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5917|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5918|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5919|5919| };
|5920|5920| 
|5921|5921| //// Animal specific functions ////
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5918|5918| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5919|5919| };
|5920|5920| 
|5921|    |-//// Animal specific functions ////
|    |5921|+// // Animal specific functions ////
|5922|5922| 
|5923|5923| UnitAI.prototype.MoveRandomly = function(distance)
|5924|5924| {

binaries/data/mods/public/simulation/components/UnitAI.js
| 331| »   »   »   return·true;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'Order.WalkToTarget' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
| 895| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
| 920| »   »   »   "enter":·function(msg)·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
| 938| »   »   »   "leave":·function(msg)·{
|    | [NORMAL] ESLintBear (no-dupe-keys):
|    | Duplicate key 'leave'.

binaries/data/mods/public/simulation/components/UnitAI.js
| 973| »   »   »   »   »   return·true;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'enter' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
|1036| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1074| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1107| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1320| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1616| »   »   »   »   »   return·false;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'enter' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
|2471| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2589| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2691| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2900| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|3083| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|3815| »   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
|4616| »   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
|4631| »   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
|4677| »   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
|4700| »   »   ····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
| 358| »   »   ····&&·(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
| 938| »   »   »   "leave":·function(msg)·{
|    | [NORMAL] JSHintBear:
|    | Duplicate key 'leave'.

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

binaries/data/mods/public/simulation/components/UnitAI.js
|2010| »   »   »   »   »   »   &&·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
|2089| »   »   »   »   »   »   »   »   ·&&·((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
|2090| »   »   »   »   »   »   »   »   ·||·(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
|2091| »   »   »   »   »   »   »   »   ·&&·(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
|2164| »   »   »   »   »   »   »   »   &&·((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
|2165| »   »   »   »   »   »   »   »   ||·(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
|2166| »   »   »   »   »   »   »   »   &&·(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
|2224| »   »   »   »   »   »   »   ||·(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
|2225| »   »   »   »   »   »   »   &&·(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
|2430| »   »   »   »   »   »   »   ||·(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
|2431| »   »   »   »   »   »   »   &&·(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
|2631| »   »   »   »   »   var·cmpResourceGatherer·=·Engine.QueryInterface(this.entity,·IID_ResourceGatherer);
|    | [NORMAL] JSHintBear:
|    | 'cmpResourceGatherer' is already defined.

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

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

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

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

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

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

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4296| »   if·(data["target"])
|    | [NORMAL] JSHintBear:
|    | ['target'] is better written in dot notation.

binaries/data/mods/public/simulation/components/UnitAI.js
|4298| »   »   if·(data["min"]·||·data["max"])
|    | [NORMAL] JSHintBear:
|    | ['min'] is better written in dot notation.

binaries/data/mods/public/simulation/components/UnitAI.js
|4298| »   »   if·(data["min"]·||·data["max"])
|    | [NORMAL] JSHintBear:
|    | ['max'] is better written in dot notation.

binaries/data/mods/public/simulation/components/UnitAI.js
|4310| »   »   if·(data["min"]·||·data["max"])
|    | [NORMAL] JSHintBear:
|    | ['min'] is better written in dot notation.

binaries/data/mods/public/simulation/components/UnitAI.js
|4310| »   »   if·(data["min"]·||·data["max"])
|    | [NORMAL] JSHintBear:
|    | ['max'] is better written in dot notation.

binaries/data/mods/public/simulation/components/UnitAI.js
|4315| }
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4409| »   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
|4465| »   »   »   &&·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
|4633| »   »   &&·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
|4634| »   »   &&·(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
|5156| »   let·lastPos·=·undefined;
|    | [NORMAL] JSHintBear:
|    | It's not necessary to initialize 'lastPos' to 'undefined'.

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

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

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

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

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

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

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

Stan added inline comments.May 31 2019, 11:32 PM
binaries/data/mods/public/simulation/components/UnitAI.js
2146 ↗(On Diff #8257)

What's the point of this if else ? Both case remove the entity no ?

2248 ↗(On Diff #8257)

shoudln't we delete this.gatheringTarget like above ?

Silier added inline comments.May 31 2019, 11:41 PM
binaries/data/mods/public/simulation/components/UnitAI.js
2146 ↗(On Diff #8257)

when you have ownership, it deletes directly from that player, if you have not, it tries to delete from every player

2248 ↗(On Diff #8257)

not defined in WALKING branch so there is nothing to delete :)

You can remove some return true.

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

From there.

2191 ↗(On Diff #8257)

Uppercase.

Silier updated this revision to Diff 8271.Jun 1 2019, 11:06 AM

Acording to FSM return false = return (void) or no return
Only found behaviour was that if return true somethings happen or return true and discard order

as in the code there is mixed return false and return (void) calls, we should decide for one way of doing it
I would be rather to have return (void) -> return false and do not return at the end of scope if it is not return true

after calling this.FinishOrder in "enter" there should be return true because we need to abort this state

"enter": function() {
				// This is a special function called when transitioning
				// into this state, or into a substate of this state.
				//
				// If it returns true, the transition will be aborted:
				// do this if you've called SetNextState inside this enter
				// handler, because otherwise the new state transition
				// will get mixed up with the previous ongoing one.
				// In normal cases, you can return false or nothing.
			},

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 356| 356| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 357| 357| 		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 358| 358| 		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 359|    |-		{
|    | 359|+		
| 360| 360| 			// we were already on the shoreline, and have not moved since
| 361| 361| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
| 362| 362| 				needToMove = false;
| 363|    |-		}
|    | 363|+		
| 364| 364| 
| 365| 365| 		if (needToMove)
| 366| 366| 			this.SetNextState("INDIVIDUAL.PICKUP.APPROACHING");
|    | [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
| 354| 354| 		// Check if we need to move     TODO implement a better way to know if we are on the shoreline
| 355| 355| 		var needToMove = true;
| 356| 356| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 357|    |-		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 358|    |-		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
|    | 357|+		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x) &&
|    | 358|+		    (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 359| 359| 		{
| 360| 360| 			// we were already on the shoreline, and have not moved since
| 361| 361| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
|    | [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
| 519| 519| 					this.PushOrderFront("Walk", this.order.data.lastPos);
| 520| 520| 				}
| 521| 521| 				else
| 522|    |-				{
|    | 522|+				
| 523| 523| 					// We couldn't move there, or the target moved away
| 524| 524| 					this.FinishOrder();
| 525|    |-				}
|    | 525|+				
| 526| 526| 				return;
| 527| 527| 			}
| 528| 528| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 734| 734| 			}
| 735| 735| 			// Check if we are already in range, otherwise walk there
| 736| 736| 			if (!this.CheckGarrisonRange(msg.data.target))
| 737|    |-			{
|    | 737|+			
| 738| 738| 				if (!this.CheckTargetVisible(msg.data.target))
| 739| 739| 				{
| 740| 740| 					this.FinishOrder();
| 745| 745| 					this.SetNextState("GARRISON.APPROACHING");
| 746| 746| 					return;
| 747| 747| 				}
| 748|    |-			}
|    | 748|+			
| 749| 749| 
| 750| 750| 			this.SetNextState("GARRISON.GARRISONING");
| 751| 751| 		},
|    | [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
| 740| 740| 					this.FinishOrder();
| 741| 741| 					return;
| 742| 742| 				}
| 743|    |-				else
| 744|    |-				{
|    | 743|+				
| 745| 744| 					this.SetNextState("GARRISON.APPROACHING");
| 746| 745| 					return;
| 747|    |-				}
|    | 746|+				
| 748| 747| 			}
| 749| 748| 
| 750| 749| 			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
| 763| 763| 						this.PushOrderFront("Walk", msg.data.lastPos);
| 764| 764| 					}
| 765| 765| 					else
| 766|    |-					{
|    | 766|+					
| 767| 767| 						// We couldn't move there, or the target moved away
| 768| 768| 						this.FinishOrder();
| 769|    |-					}
|    | 769|+					
| 770| 770| 					return;
| 771| 771| 				}
| 772| 772| 
|    | [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
|1011|1011| 			},
|1012|1012| 		},
|1013|1013| 
|1014|    |-		"GARRISON":{
|    |1014|+		"GARRISON": {
|1015|1015| 			"enter": function() {
|1016|1016| 				// If the garrisonholder should pickup, warn it so it can take needed action
|1017|1017| 				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
|1231|1231| 			// If the controller handled an order but some members rejected it,
|1232|1232| 			// they will have no orders and be in the FORMATIONMEMBER.IDLE state.
|1233|1233| 			if (this.orderQueue.length)
|1234|    |-			{
|    |1234|+			
|1235|1235| 				// We're leaving the formation, so stop our FormationWalk order
|1236|1236| 				if (this.FinishOrder())
|1237|1237| 					return;
|1238|    |-			}
|    |1238|+			
|1239|1239| 
|1240|1240| 			// No orders left, we're an individual now
|1241|1241| 			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
|1259|1259| 			// Move a tile outside the building
|1260|1260| 			let range = 4;
|1261|1261| 			if (this.CheckTargetRangeExplicit(msg.data.target, range, range))
|1262|    |-			{
|    |1262|+			
|1263|1263| 				// We are already at the target, or can't move at all
|1264|1264| 				this.FinishOrder();
|1265|    |-			}
|    |1265|+			
|1266|1266| 			else
|1267|1267| 			{
|1268|1268| 				this.order.data.min = range;
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1474|1474| 
|1475|1475| 			"LosRangeUpdate": function(msg) {
|1476|1476| 				if (this.GetStance().targetVisibleEnemies)
|1477|    |-				{
|    |1477|+				
|1478|1478| 					// Start attacking one of the newly-seen enemy (if any)
|1479|1479| 					this.AttackEntitiesByPreference(msg.data.added);
|1480|    |-				}
|    |1480|+				
|1481|1481| 			},
|1482|1482| 
|1483|1483| 			"LosHealRangeUpdate": function(msg) {
|    | [NORMAL] ESLintBear (space-before-function-paren):
|    | Unexpected space before function parentheses.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1511|1511| 				this.SelectAnimation("move");
|1512|1512| 			},
|1513|1513| 
|1514|    |-			"leave": function () {
|    |1514|+			"leave": function() {
|1515|1515| 				this.SelectAnimation("idle");
|1516|1516| 				this.StopMoving();
|1517|1517| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1688|1688| 						// if nothing better to do, check if the guarded needs to be healed or repaired
|1689|1689| 						var cmpHealth = Engine.QueryInterface(this.isGuardOf, IID_Health);
|1690|1690| 						if (cmpHealth && cmpHealth.IsInjured())
|1691|    |-						{
|    |1691|+						
|1692|1692| 							if (this.CanHeal(this.isGuardOf))
|1693|1693| 								this.PushOrderFront("Heal", { "target": this.isGuardOf, "force": false });
|1694|1694| 							else if (this.CanRepair(this.isGuardOf))
|1695|1695| 								this.PushOrderFront("Repair", { "target": this.isGuardOf, "autocontinue": false, "force": false });
|1696|    |-						}
|    |1696|+						
|1697|1697| 					}
|1698|1698| 				},
|1699|1699| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1791|1791| 				"MoveCompleted": function() {
|1792|1792| 
|1793|1793| 					if (this.CheckTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1794|    |-					{
|    |1794|+					
|1795|1795| 						// If the unit needs to unpack, do so
|1796|1796| 						if (this.CanUnpack())
|1797|1797| 						{
|1800|1800| 						}
|1801|1801| 						else
|1802|1802| 							this.SetNextState("ATTACKING");
|1803|    |-					}
|    |1803|+					
|1804|1804| 					else
|1805|1805| 					{
|1806|1806| 						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
|1798|1798| 							this.PushOrderFront("Unpack", { "force": true });
|1799|1799| 							return;
|1800|1800| 						}
|1801|    |-						else
|1802|    |-							this.SetNextState("ATTACKING");
|    |1801|+						this.SetNextState("ATTACKING");
|1803|1802| 					}
|1804|1803| 					else
|1805|1804| 					{
|    | [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
|1802|1802| 							this.SetNextState("ATTACKING");
|1803|1803| 					}
|1804|1804| 					else
|1805|    |-					{
|    |1805|+					
|1806|1806| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1807|1807| 						{
|1808|1808| 							this.SetNextState("APPROACHING");
|1812|1812| 							// Give up
|1813|1813| 							this.FinishOrder();
|1814|1814| 						}
|1815|    |-					}
|    |1815|+					
|1816|1816| 				},
|1817|1817| 			},
|1818|1818| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1804|1804| 					else
|1805|1805| 					{
|1806|1806| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1807|    |-						{
|    |1807|+						
|1808|1808| 							this.SetNextState("APPROACHING");
|1809|    |-						}
|    |1809|+						
|1810|1810| 						else
|1811|1811| 						{
|1812|1812| 							// 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
|1808|1808| 							this.SetNextState("APPROACHING");
|1809|1809| 						}
|1810|1810| 						else
|1811|    |-						{
|    |1811|+						
|1812|1812| 							// Give up
|1813|1813| 							this.FinishOrder();
|1814|    |-						}
|    |1814|+						
|1815|1815| 					}
|1816|1816| 				},
|1817|1817| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1829|1829| 					}
|1830|1830| 					// Check the target is still alive and attackable
|1831|1831| 					if (this.CanAttack(target) && !this.CheckTargetAttackRange(target, this.order.data.attackType))
|1832|    |-					{
|    |1832|+					
|1833|1833| 						// Can't reach it - try to chase after it
|1834|1834| 						if (this.ShouldChaseTargetedEntity(target, this.order.data.force))
|1835|1835| 						{
|1844|1844| 								return;
|1845|1845| 							}
|1846|1846| 						}
|1847|    |-					}
|    |1847|+					
|1848|1848| 
|1849|1849| 					this.StopMoving();
|1850|1850| 
|    | [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
|1877|1877| 					// TODO: we should probably only bother syncing projectile attacks, not melee
|1878|1878| 
|1879|1879| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|1880|    |-					this.resyncAnimation = (prepare != this.attackTimers.prepare) ? true : false;
|    |1880|+					this.resyncAnimation = (prepare != this.attackTimers.prepare);
|1881|1881| 
|1882|1882| 					this.FaceTowardsTarget(this.order.data.target);
|1883|1883| 
|    | [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
|2006|2006| 
|2007|2007| 				"Attacked": function(msg) {
|2008|2008| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2009|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2010|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2009|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2010|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2011|2011| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2012|2012| 				},
|2013|2013| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2026|2026| 					this.SelectAnimation("move");
|2027|2027| 					var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|2028|2028| 					if (cmpUnitAI && cmpUnitAI.IsFleeing())
|2029|    |-					{
|    |2029|+					
|2030|2030| 						// Run after a fleeing target
|2031|2031| 						this.SetSpeedMultiplier(this.GetRunMultiplier());
|2032|    |-					}
|    |2032|+					
|2033|2033| 					this.StartTimer(1000, 1000);
|2034|2034| 				},
|2035|2035| 
|    | [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
|2085|2085| 						// Also don't switch to a different type of huntable animal
|2086|2086| 						let nearbyResource = this.FindNearbyResource(function(ent, type, template) {
|2087|2087| 							return (
|2088|    |-								ent != oldTarget
|2089|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2088|+								ent != oldTarget &&
|    |2089|+								 ((type.generic == "treasure" && oldType.generic == "treasure")
|2090|2090| 								 || (type.specific == oldType.specific
|2091|2091| 								 && (type.specific != "meat" || oldTemplate == template)))
|2092|2092| 							);
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2086|2086| 						let nearbyResource = this.FindNearbyResource(function(ent, type, template) {
|2087|2087| 							return (
|2088|2088| 								ent != oldTarget
|2089|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2090|    |-								 || (type.specific == oldType.specific
|    |2089|+								 && ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2090|+								 (type.specific == oldType.specific
|2091|2091| 								 && (type.specific != "meat" || oldTemplate == template)))
|2092|2092| 							);
|2093|2093| 						}, 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
|2087|2087| 							return (
|2088|2088| 								ent != oldTarget
|2089|2089| 								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2090|    |-								 || (type.specific == oldType.specific
|2091|    |-								 && (type.specific != "meat" || oldTemplate == template)))
|    |2090|+								 || (type.specific == oldType.specific &&
|    |2091|+								 (type.specific != "meat" || oldTemplate == template)))
|2092|2092| 							);
|2093|2093| 						}, oldTarget);
|2094|2094| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2152|2152| 						// Also don't switch to a different type of huntable animal
|2153|2153| 						let nearbyResource = this.FindNearbyResource(function(ent, type, template) {
|2154|2154| 							return (
|2155|    |-								ent != oldTarget
|2156|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2155|+								ent != oldTarget &&
|    |2156|+								((type.generic == "treasure" && oldType.generic == "treasure")
|2157|2157| 								|| (type.specific == oldType.specific
|2158|2158| 								&& (type.specific != "meat" || oldTemplate == template)))
|2159|2159| 							);
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2153|2153| 						let nearbyResource = this.FindNearbyResource(function(ent, type, template) {
|2154|2154| 							return (
|2155|2155| 								ent != oldTarget
|2156|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2157|    |-								|| (type.specific == oldType.specific
|    |2156|+								&& ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2157|+								(type.specific == oldType.specific
|2158|2158| 								&& (type.specific != "meat" || oldTemplate == template)))
|2159|2159| 							);
|2160|2160| 						});
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2154|2154| 							return (
|2155|2155| 								ent != oldTarget
|2156|2156| 								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2157|    |-								|| (type.specific == oldType.specific
|2158|    |-								&& (type.specific != "meat" || oldTemplate == template)))
|    |2157|+								|| (type.specific == oldType.specific &&
|    |2158|+								(type.specific != "meat" || oldTemplate == template)))
|2159|2159| 							);
|2160|2160| 						});
|2161|2161| 						if (nearbyResource)
|    | [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
|2212|2212| 					// Also don't switch to a different type of huntable animal
|2213|2213| 					let nearbyResource = this.FindNearbyResource(function(ent, type, template) {
|2214|2214| 						return (
|2215|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2216|    |-							|| (type.specific == resourceType.specific
|    |2215|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2216|+							(type.specific == resourceType.specific
|2217|2217| 							&& (type.specific != "meat" || resourceTemplate == template))
|2218|2218| 						);
|2219|2219| 					});
|    | [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
|2213|2213| 					let nearbyResource = this.FindNearbyResource(function(ent, type, template) {
|2214|2214| 						return (
|2215|2215| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2216|    |-							|| (type.specific == resourceType.specific
|2217|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2216|+							|| (type.specific == resourceType.specific &&
|    |2217|+							(type.specific != "meat" || resourceTemplate == template))
|2218|2218| 						);
|2219|2219| 					});
|2220|2220| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2329|2329| 
|2330|2330| 					let cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply);
|2331|2331| 					if (cmpSupply && cmpSupply.IsAvailable(cmpOwnership.GetOwner(), this.entity))
|2332|    |-					{
|    |2332|+					
|2333|2333| 						// Check we can still reach and gather from the target
|2334|2334| 						if (this.CanGather(this.gatheringTarget) && this.CheckTargetRange(this.gatheringTarget, IID_ResourceGatherer))
|2335|2335| 						{
|2392|2392| 								return false;
|2393|2393| 							}
|2394|2394| 						}
|2395|    |-					}
|    |2395|+					
|2396|2396| 
|2397|2397| 					// We're already in range, can't get anywhere near it or the target is exhausted.
|2398|2398| 
|    | [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
|2418|2418| 					// Also don't switch to a different type of huntable animal
|2419|2419| 					let nearbyResource = this.FindNearbyResource(function(ent, type, template) {
|2420|2420| 						return (
|2421|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2422|    |-							|| (type.specific == resourceType.specific
|    |2421|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2422|+							(type.specific == resourceType.specific
|2423|2423| 							&& (type.specific != "meat" || resourceTemplate == template))
|2424|2424| 						);
|2425|2425| 					});
|    | [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
|2419|2419| 					let nearbyResource = this.FindNearbyResource(function(ent, type, template) {
|2420|2420| 						return (
|2421|2421| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2422|    |-							|| (type.specific == resourceType.specific
|2423|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2422|+							|| (type.specific == resourceType.specific &&
|    |2423|+							(type.specific != "meat" || resourceTemplate == template))
|2424|2424| 						);
|2425|2425| 					});
|2426|2426| 					if (nearbyResource)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2484|2484| 
|2485|2485| 				"Timer": function(msg) {
|2486|2486| 					if (this.ShouldAbandonChase(this.order.data.target, this.order.data.force, IID_Heal, null))
|2487|    |-					{
|    |2487|+					
|2488|2488| 						// Return to our original position unless we have a better order.
|2489|2489| 						if (!this.FinishOrder() && this.GetStance().respondHoldGround)
|2490|2490| 							this.WalkToHeldPosition();
|2491|    |-					}
|    |2491|+					
|2492|2492| 				},
|2493|2493| 
|2494|2494| 				"MoveCompleted": function() {
|    | [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
|2518|2518| 					this.StartTimer(prepare, this.healTimers.repeat);
|2519|2519| 
|2520|2520| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2521|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2521|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2522|2522| 
|2523|2523| 					this.FaceTowardsTarget(this.order.data.target);
|2524|2524| 				},
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2730|2730| 					{
|2731|2731| 						// The building was already finished/fully repaired before we arrived;
|2732|2732| 						// let the ConstructionFinished handler handle this.
|2733|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2733|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2734|2734| 						return true;
|2735|2735| 					}
|2736|2736| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2730|2730| 					{
|2731|2731| 						// The building was already finished/fully repaired before we arrived;
|2732|2732| 						// let the ConstructionFinished handler handle this.
|2733|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2733|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2734|2734| 						return true;
|2735|2735| 					}
|2736|2736| 
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2773|2773| 					if (!inRange && this.MoveToTargetRange(this.repairTarget, IID_Builder))
|2774|2774| 						this.SetNextState("APPROACHING");
|2775|2775| 					else if (!inRange)
|2776|    |-						this.FinishOrder(); //can't approach and isn't in reach
|    |2776|+						this.FinishOrder(); // can't approach and isn't in reach
|2777|2777| 				},
|2778|2778| 			},
|2779|2779| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2860|2860| 
|2861|2861| 				// Unit was approaching and there's nothing to do now, so switch to walking
|2862|2862| 				if (oldState === "INDIVIDUAL.REPAIR.APPROACHING")
|2863|    |-				{
|    |2863|+				
|2864|2864| 					// We're already walking to the given point, so add this as a order.
|2865|2865| 					this.WalkToTarget(msg.data.newentity, true);
|2866|    |-				}
|    |2866|+				
|2867|2867| 			},
|2868|2868| 		},
|2869|2869| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2922|2922| 
|2923|2923| 					// Check that we can garrison here
|2924|2924| 					if (this.CanGarrison(target))
|2925|    |-					{
|    |2925|+					
|2926|2926| 						// Check that we're in range of the garrison target
|2927|2927| 						if (this.CheckGarrisonRange(target))
|2928|2928| 						{
|2998|2998| 								return false;
|2999|2999| 							}
|3000|3000| 						}
|3001|    |-					}
|    |3001|+					
|3002|3002| 					// Garrisoning failed for some reason, so finish the order
|3003|3003| 					this.FinishOrder();
|3004|3004| 					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
|3119|3119| 		"Attacked": function(msg) {
|3120|3120| 			if (this.template.NaturalBehaviour == "skittish" ||
|3121|3121| 			    this.template.NaturalBehaviour == "passive")
|3122|    |-			{
|    |3122|+			
|3123|3123| 				this.Flee(msg.data.attacker, false);
|3124|    |-			}
|    |3124|+			
|3125|3125| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|3126|3126| 			{
|3127|3127| 				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
|3128|3128| 					this.Attack(msg.data.attacker, false);
|3129|3129| 			}
|3130|3130| 			else if (this.template.NaturalBehaviour == "domestic")
|3131|    |-			{
|    |3131|+			
|3132|3132| 				// Never flee, stop what we were doing
|3133|3133| 				this.SetNextState("IDLE");
|3134|    |-			}
|    |3134|+			
|3135|3135| 		},
|3136|3136| 
|3137|3137| 		"Order.LeaveFoundation": function(msg) {
|    | [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
|3142|3142| 				this.FinishOrder();
|3143|3143| 				return;
|3144|3144| 			}
|3145|    |-			else
|3146|    |-			{
|    |3145|+			
|3147|3146| 				this.order.data.min = range;
|3148|3147| 				this.SetNextState("WALKING");
|3149|    |-			}
|    |3148|+			
|3150|3149| 		},
|3151|3150| 
|3152|3151| 		"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
|3186|3186| 				}
|3187|3187| 				// Start attacking one of the newly-seen enemy (if any)
|3188|3188| 				else if (this.IsDangerousAnimal())
|3189|    |-				{
|    |3189|+				
|3190|3190| 					this.AttackVisibleEntity(msg.data.added);
|3191|    |-				}
|    |3191|+				
|3192|3192| 
|3193|3193| 				// TODO: if two units enter our range together, we'll attack the
|3194|3194| 				// 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
|3229|3229| 				}
|3230|3230| 				// Start attacking one of the newly-seen enemy (if any)
|3231|3231| 				else if (this.template.NaturalBehaviour == "violent")
|3232|    |-				{
|    |3232|+				
|3233|3233| 					this.AttackVisibleEntity(msg.data.added);
|3234|    |-				}
|    |3234|+				
|3235|3235| 			},
|3236|3236| 
|3237|3237| 			"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
|3246|3246| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3247|3247| 
|3248|3248| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3249|    |-							// only used for domestic animals
|    |3249|+		// only used for domestic animals
|3250|3250| 	},
|3251|3251| };
|3252|3252| 
|    | [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
|3303|3303| 
|3304|3304| UnitAI.prototype.IsAnimal = function()
|3305|3305| {
|3306|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3306|+	return (!!this.template.NaturalBehaviour);
|3307|3307| };
|3308|3308| 
|3309|3309| 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
|3341|3341| UnitAI.prototype.GetGarrisonHolder = function()
|3342|3342| {
|3343|3343| 	if (this.IsGarrisoned())
|3344|    |-	{
|    |3344|+	
|3345|3345| 		for (let order of this.orderQueue)
|3346|3346| 			if (order.type == "Garrison")
|3347|3347| 				return order.data.target;
|3348|    |-	}
|    |3348|+	
|3349|3349| 	return INVALID_ENTITY;
|3350|3350| };
|3351|3351| 
|    | [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
|3419|3419| 		{
|3420|3420| 			let index = this.GetCurrentState().indexOf(".");
|3421|3421| 			if (index != -1)
|3422|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3422|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3423|3423| 			this.Stop(false);
|3424|3424| 		}
|3425|3425| 
|    | [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
|3475|3475| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3476|3476| 			continue;
|3477|3477| 		if (i == 0)
|3478|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3478|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3479|3479| 		else
|3480|3480| 			this.orderQueue.splice(i, 1);
|3481|3481| 		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
|3475|3475| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3476|3476| 			continue;
|3477|3477| 		if (i == 0)
|3478|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3478|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3479|3479| 		else
|3480|3480| 			this.orderQueue.splice(i, 1);
|3481|3481| 		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
|3559|3559| };
|3560|3560| 
|3561|3561| 
|3562|    |-//// FSM linkage functions ////
|    |3562|+// // FSM linkage functions ////
|3563|3563| 
|3564|3564| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3565|3565| UnitAI.prototype.SetNextState = function(state)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3731|3731| 				continue;
|3732|3732| 			if (this.orderQueue[i].type == type)
|3733|3733| 				continue;
|3734|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3734|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3735|3735| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3736|3736| 			return;
|3737|3737| 		}
|    | [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
|3731|3731| 				continue;
|3732|3732| 			if (this.orderQueue[i].type == type)
|3733|3733| 				continue;
|3734|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3734|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3735|3735| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3736|3736| 			return;
|3737|3737| 		}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3745|3745| {
|3746|3746| 	// Remember the previous work orders to be able to go back to them later if required
|3747|3747| 	if (data && data.force)
|3748|    |-	{
|    |3748|+	
|3749|3749| 		if (this.IsFormationController())
|3750|3750| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3751|3751| 		else
|3752|3752| 			this.UpdateWorkOrders(type);
|3753|    |-	}
|    |3753|+	
|3754|3754| 
|3755|3755| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3756|3756| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3822|3822| 	{
|3823|3823| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3824|3824| 		if (cmpUnitAI)
|3825|    |-		{
|    |3825|+		
|3826|3826| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3827|3827| 			{
|3828|3828| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3831|3831| 					return;
|3832|3832| 				}
|3833|3833| 			}
|3834|    |-		}
|    |3834|+		
|3835|3835| 	}
|3836|3836| 
|3837|3837| 	// 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
|3824|3824| 		if (cmpUnitAI)
|3825|3825| 		{
|3826|3826| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3827|    |-			{
|    |3827|+			
|3828|3828| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3829|3829| 				{
|3830|3830| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3831|3831| 					return;
|3832|3832| 				}
|3833|    |-			}
|    |3833|+			
|3834|3834| 		}
|3835|3835| 	}
|3836|3836| 
|    | [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
|3836|3836| 
|3837|3837| 	// If nothing found, take the unit orders
|3838|3838| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3839|    |-	{
|    |3839|+	
|3840|3840| 		if (isWorkType(this.orderQueue[i].type))
|3841|3841| 		{
|3842|3842| 			this.workOrders = this.orderQueue.slice(i);
|3843|3843| 			return;
|3844|3844| 		}
|3845|    |-	}
|    |3845|+	
|3846|3846| };
|3847|3847| 
|3848|3848| 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
|3902|3902| 	if (data.timerRepeat === undefined)
|3903|3903| 		this.timer = undefined;
|3904|3904| 
|3905|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3905|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3906|3906| };
|3907|3907| 
|3908|3908| /**
|    | [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
|3902|3902| 	if (data.timerRepeat === undefined)
|3903|3903| 		this.timer = undefined;
|3904|3904| 
|3905|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3905|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3906|3906| };
|3907|3907| 
|3908|3908| /**
|    | [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
|3937|3937| 	this.timer = undefined;
|3938|3938| };
|3939|3939| 
|3940|    |-//// Message handlers /////
|    |3940|+// // Message handlers /////
|3941|3941| 
|3942|3942| UnitAI.prototype.OnMotionChanged = function(msg)
|3943|3943| {
|    | [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
|3942|3942| UnitAI.prototype.OnMotionChanged = function(msg)
|3943|3943| {
|3944|3944| 	if (msg.starting && !msg.error)
|3945|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3945|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveStarted", "data": msg});
|3946|3946| 	else if (!msg.starting || msg.error)
|3947|3947| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3948|3948| };
|    | [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
|3942|3942| UnitAI.prototype.OnMotionChanged = function(msg)
|3943|3943| {
|3944|3944| 	if (msg.starting && !msg.error)
|3945|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3945|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg });
|3946|3946| 	else if (!msg.starting || msg.error)
|3947|3947| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3948|3948| };
|    | [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
|3944|3944| 	if (msg.starting && !msg.error)
|3945|3945| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3946|3946| 	else if (!msg.starting || msg.error)
|3947|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3947|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveCompleted", "data": msg});
|3948|3948| };
|3949|3949| 
|3950|3950| 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
|3944|3944| 	if (msg.starting && !msg.error)
|3945|3945| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3946|3946| 	else if (!msg.starting || msg.error)
|3947|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3947|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg });
|3948|3948| };
|3949|3949| 
|3950|3950| 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
|3952|3952| 	// TODO: This is a bit inefficient since every unit listens to every
|3953|3953| 	// construction message - ideally we could scope it to only the one we're building
|3954|3954| 
|3955|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3955|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3956|3956| };
|3957|3957| 
|3958|3958| 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
|3952|3952| 	// TODO: This is a bit inefficient since every unit listens to every
|3953|3953| 	// construction message - ideally we could scope it to only the one we're building
|3954|3954| 
|3955|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3955|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3956|3956| };
|3957|3957| 
|3958|3958| 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
|3977|3977| 
|3978|3978| UnitAI.prototype.OnAttacked = function(msg)
|3979|3979| {
|3980|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3980|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3981|3981| };
|3982|3982| 
|3983|3983| 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
|3977|3977| 
|3978|3978| UnitAI.prototype.OnAttacked = function(msg)
|3979|3979| {
|3980|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3980|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3981|3981| };
|3982|3982| 
|3983|3983| 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
|3982|3982| 
|3983|3983| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3984|3984| {
|3985|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3985|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|3986|3986| };
|3987|3987| 
|3988|3988| 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
|3982|3982| 
|3983|3983| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3984|3984| {
|3985|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3985|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|3986|3986| };
|3987|3987| 
|3988|3988| 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
|3987|3987| 
|3988|3988| UnitAI.prototype.OnHealthChanged = function(msg)
|3989|3989| {
|3990|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3990|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|3991|3991| };
|3992|3992| 
|3993|3993| 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
|3987|3987| 
|3988|3988| UnitAI.prototype.OnHealthChanged = function(msg)
|3989|3989| {
|3990|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3990|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|3991|3991| };
|3992|3992| 
|3993|3993| 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
|3993|3993| UnitAI.prototype.OnRangeUpdate = function(msg)
|3994|3994| {
|3995|3995| 	if (msg.tag == this.losRangeQuery)
|3996|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3996|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|3997|3997| 	else if (msg.tag == this.losHealRangeQuery)
|3998|3998| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3999|3999| };
|    | [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
|3993|3993| UnitAI.prototype.OnRangeUpdate = function(msg)
|3994|3994| {
|3995|3995| 	if (msg.tag == this.losRangeQuery)
|3996|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3996|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|3997|3997| 	else if (msg.tag == this.losHealRangeQuery)
|3998|3998| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3999|3999| };
|    | [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
|3995|3995| 	if (msg.tag == this.losRangeQuery)
|3996|3996| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3997|3997| 	else if (msg.tag == this.losHealRangeQuery)
|3998|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3998|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|3999|3999| };
|4000|4000| 
|4001|4001| 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
|3995|3995| 	if (msg.tag == this.losRangeQuery)
|3996|3996| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3997|3997| 	else if (msg.tag == this.losHealRangeQuery)
|3998|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3998|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|3999|3999| };
|4000|4000| 
|4001|4001| 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
|4000|4000| 
|4001|4001| UnitAI.prototype.OnPackFinished = function(msg)
|4002|4002| {
|4003|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4003|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4004|4004| };
|4005|4005| 
|4006|4006| //// 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
|4000|4000| 
|4001|4001| UnitAI.prototype.OnPackFinished = function(msg)
|4002|4002| {
|4003|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4003|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4004|4004| };
|4005|4005| 
|4006|4006| //// 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
|4003|4003| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4004|4004| };
|4005|4005| 
|4006|    |-//// Helper functions to be called by the FSM ////
|    |4006|+// // Helper functions to be called by the FSM ////
|4007|4007| 
|4008|4008| UnitAI.prototype.GetWalkSpeed = function()
|4009|4009| {
|    | [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
|4105|4105| 	if (!cmpOwnership || cmpOwnership.GetOwner() == INVALID_PLAYER)
|4106|4106| 		return undefined;
|4107|4107| 
|4108|    |-	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position)
|    |4108|+	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
|4109|4109| 	if (!cmpPosition || !cmpPosition.IsInWorld())
|4110|4110| 		return undefined;
|4111|4111| 
|    | [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
|4190|4190| 			PlaySound(name, member);
|4191|4191| 	}
|4192|4192| 	else
|4193|    |-	{
|    |4193|+	
|4194|4194| 		// Otherwise use our own sounds
|4195|4195| 		PlaySound(name, this.entity);
|4196|    |-	}
|    |4196|+	
|4197|4197| };
|4198|4198| 
|4199|4199| /*
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4286|4286| UnitAI.prototype.MoveTo = function(data, iid, type)
|4287|4287| {
|4288|4288| 	if (data["target"])
|4289|    |-	{
|    |4289|+	
|4290|4290| 		if (data["min"] || data["max"])
|4291|4291| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4292|4292| 		else
|4296|4296| 			else
|4297|4297| 				return this.MoveToTargetRange(data.target, iid, type);
|4298|4298| 		}
|4299|    |-	}
|    |4299|+	
|4300|4300| 	else
|4301|4301| 	{
|4302|4302| 		if (data["min"] || data["max"])
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["target"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4285|4285|  */
|4286|4286| UnitAI.prototype.MoveTo = function(data, iid, type)
|4287|4287| {
|4288|    |-	if (data["target"])
|    |4288|+	if (data.target)
|4289|4289| 	{
|4290|4290| 		if (data["min"] || data["max"])
|4291|4291| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["min"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4287|4287| {
|4288|4288| 	if (data["target"])
|4289|4289| 	{
|4290|    |-		if (data["min"] || data["max"])
|    |4290|+		if (data.min || data["max"])
|4291|4291| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4292|4292| 		else
|4293|4293| 		{
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["max"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4287|4287| {
|4288|4288| 	if (data["target"])
|4289|4289| 	{
|4290|    |-		if (data["min"] || data["max"])
|    |4290|+		if (data["min"] || data.max)
|4291|4291| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4292|4292| 		else
|4293|4293| 		{
|    | [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
|4290|4290| 		if (data["min"] || data["max"])
|4291|4291| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4292|4292| 		else
|4293|    |-		{
|    |4293|+		
|4294|4294| 			if (!iid)
|4295|4295| 				return this.MoveToTarget(data.target);
|4296|4296| 			else
|4297|4297| 				return this.MoveToTargetRange(data.target, iid, type);
|4298|    |-		}
|    |4298|+		
|4299|4299| 	}
|4300|4300| 	else
|4301|4301| 	{
|    | [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
|4289|4289| 	{
|4290|4290| 		if (data["min"] || data["max"])
|4291|4291| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4292|    |-		else
|4293|    |-		{
|    |4292|+		
|4294|4293| 			if (!iid)
|4295|4294| 				return this.MoveToTarget(data.target);
|4296|4295| 			else
|4297|4296| 				return this.MoveToTargetRange(data.target, iid, type);
|4298|    |-		}
|    |4297|+		
|4299|4298| 	}
|4300|4299| 	else
|4301|4300| 	{
|    | [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
|4293|4293| 		{
|4294|4294| 			if (!iid)
|4295|4295| 				return this.MoveToTarget(data.target);
|4296|    |-			else
|4297|    |-				return this.MoveToTargetRange(data.target, iid, type);
|    |4296|+			return this.MoveToTargetRange(data.target, iid, type);
|4298|4297| 		}
|4299|4298| 	}
|4300|4299| 	else
|    | [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
|4298|4298| 		}
|4299|4299| 	}
|4300|4300| 	else
|4301|    |-	{
|    |4301|+	
|4302|4302| 		if (data["min"] || data["max"])
|4303|4303| 			return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1);
|4304|4304| 		else
|4305|4305| 			return this.MoveToPoint(data.x, data.z);
|4306|    |-	}
|    |4306|+	
|4307|4307| }
|4308|4308| 
|4309|4309| UnitAI.prototype.MoveToPoint = function(x, z)
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["min"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4299|4299| 	}
|4300|4300| 	else
|4301|4301| 	{
|4302|    |-		if (data["min"] || data["max"])
|    |4302|+		if (data.min || data["max"])
|4303|4303| 			return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1);
|4304|4304| 		else
|4305|4305| 			return this.MoveToPoint(data.x, data.z);
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["max"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4299|4299| 	}
|4300|4300| 	else
|4301|4301| 	{
|4302|    |-		if (data["min"] || data["max"])
|    |4302|+		if (data["min"] || data.max)
|4303|4303| 			return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1);
|4304|4304| 		else
|4305|4305| 			return this.MoveToPoint(data.x, data.z);
|    | [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
|4301|4301| 	{
|4302|4302| 		if (data["min"] || data["max"])
|4303|4303| 			return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1);
|4304|    |-		else
|4305|    |-			return this.MoveToPoint(data.x, data.z);
|    |4304|+		return this.MoveToPoint(data.x, data.z);
|4306|4305| 	}
|4307|4306| }
|4308|4307| 
|    | [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
|4304|4304| 		else
|4305|4305| 			return this.MoveToPoint(data.x, data.z);
|4306|4306| 	}
|4307|    |-}
|    |4307|+};
|4308|4308| 
|4309|4309| UnitAI.prototype.MoveToPoint = function(x, z)
|4310|4310| {
|    | [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
|4388|4388| 	else
|4389|4389| 		// return false? Or hope you come close enough?
|4390|4390| 		var parabolicMaxRange = 0;
|4391|    |-		//return false;
|    |4391|+		// return false;
|4392|4392| 
|4393|4393| 	// the parabole changes while walking, take something in the middle
|4394|4394| 	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
|4453|4453| 	if (this.IsFormationMember())
|4454|4454| 	{
|4455|4455| 		var cmpFormationUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|4456|    |-		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation()
|4457|    |-			&& cmpFormationUnitAI.order.data.target == target)
|    |4456|+		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation() &&
|    |4457|+			cmpFormationUnitAI.order.data.target == target)
|4458|4458| 			return true;
|4459|4459| 	}
|4460|4460| 
|    | [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
|4621|4621| UnitAI.prototype.AttackEntityInZone = function(ents)
|4622|4622| {
|4623|4623| 	var target = ents.find(target =>
|4624|    |-		this.CanAttack(target)
|4625|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4624|+		this.CanAttack(target) &&
|    |4625|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4626|4626| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4627|4627| 	);
|4628|4628| 	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
|4622|4622| {
|4623|4623| 	var target = ents.find(target =>
|4624|4624| 		this.CanAttack(target)
|4625|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4626|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4625|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4626|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4627|4627| 	);
|4628|4628| 	if (!target)
|4629|4629| 		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
|4686|4686| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4687|4687| 	if (this.isGuardOf)
|4688|4688| 	{
|4689|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4689|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4690|4690| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4691|4691| 		if (cmpUnitAI && cmpAttack &&
|4692|4692| 		    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
|4690|4690| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4691|4691| 		if (cmpUnitAI && cmpAttack &&
|4692|4692| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4693|    |-				return false;
|    |4693|+			return false;
|4694|4694| 	}
|4695|4695| 
|4696|4696| 	// 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
|4695|4695| 
|4696|4696| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4697|4697| 	if (this.GetStance().respondHoldGround)
|4698|    |-	{
|    |4698|+	
|4699|4699| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4700|4700| 			return true;
|4701|    |-	}
|    |4701|+	
|4702|4702| 
|4703|4703| 	// Stop if it's left our vision range, unless we're especially persistent
|4704|4704| 	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
|4702|4702| 
|4703|4703| 	// Stop if it's left our vision range, unless we're especially persistent
|4704|4704| 	if (!this.GetStance().respondChaseBeyondVision)
|4705|    |-	{
|    |4705|+	
|4706|4706| 		if (!this.CheckTargetIsInVisionRange(target))
|4707|4707| 			return true;
|4708|    |-	}
|    |4708|+	
|4709|4709| 
|4710|4710| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4711|4711| 	// 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
|4728|4728| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4729|4729| 	if (this.isGuardOf)
|4730|4730| 	{
|4731|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4731|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4732|4732| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4733|4733| 		if (cmpUnitAI && cmpAttack &&
|4734|4734| 		    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
|4741|4741| 	return false;
|4742|4742| };
|4743|4743| 
|4744|    |-//// External interface functions ////
|    |4744|+// // External interface functions ////
|4745|4745| 
|4746|4746| UnitAI.prototype.SetFormationController = function(ent)
|4747|4747| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4751|4751| 	// of our own formation (or ourself if not in formation)
|4752|4752| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4753|4753| 	if (cmpObstruction)
|4754|    |-	{
|    |4754|+	
|4755|4755| 		if (ent == INVALID_ENTITY)
|4756|4756| 			cmpObstruction.SetControlGroup(this.entity);
|4757|4757| 		else
|4758|4758| 			cmpObstruction.SetControlGroup(ent);
|4759|    |-	}
|    |4759|+	
|4760|4760| 
|4761|4761| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4762|4762| 	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
|4894|4894| 	// if we already had an old guard order, do nothing if the target is the same
|4895|4895| 	// and the order is running, otherwise remove the previous order
|4896|4896| 	if (this.isGuardOf)
|4897|    |-	{
|    |4897|+	
|4898|4898| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4899|4899| 			return;
|4900|4900| 		else
|4901|4901| 			this.RemoveGuard();
|4902|    |-	}
|    |4902|+	
|4903|4903| 
|4904|4904| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4905|4905| };
|    | [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
|4897|4897| 	{
|4898|4898| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4899|4899| 			return;
|4900|    |-		else
|4901|    |-			this.RemoveGuard();
|    |4900|+		this.RemoveGuard();
|4902|4901| 	}
|4903|4902| 
|4904|4903| 	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
|5068|5068| 			this.WalkToTarget(target, queued);
|5069|5069| 		return;
|5070|5070| 	}
|5071|    |-	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture}, queued);
|    |5071|+	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture }, queued);
|5072|5072| };
|5073|5073| 
|5074|5074| /**
|    | [NORMAL] ESLintBear (no-undef-init):
|    | It's not necessary to initialize 'lastPos' to undefined.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5145|5145| 
|5146|5146| 	// Remember the position of our target, if any, in case it disappears
|5147|5147| 	// later and we want to head to its last known position
|5148|    |-	let lastPos = undefined;
|    |5148|+	let lastPos;
|5149|5149| 	let cmpPosition = Engine.QueryInterface(target, IID_Position);
|5150|5150| 	if (cmpPosition && cmpPosition.IsInWorld())
|5151|5151| 		lastPos = cmpPosition.GetPosition();
|    | [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
|5217|5217| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5218|5218| 	{
|5219|5219| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5220|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5220|+		if (cmpTrader.HasBothMarkets() &&
|5221|5221| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5222|5222| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5223|5223| 		{
|    | [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
|5498|5498| 				{
|5499|5499| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5500|5500| 					var targetClasses = this.order.data.targetClasses;
|5501|    |-					if (targetClasses.attack && cmpIdentity
|5502|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5501|+					if (targetClasses.attack && cmpIdentity &&
|    |5502|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5503|5503| 						continue;
|5504|5504| 					if (targetClasses.avoid && cmpIdentity
|5505|5505| 						&& 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
|5501|5501| 					if (targetClasses.attack && cmpIdentity
|5502|5502| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5503|5503| 						continue;
|5504|    |-					if (targetClasses.avoid && cmpIdentity
|5505|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5504|+					if (targetClasses.avoid && cmpIdentity &&
|    |5505|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5506|5506| 						continue;
|5507|5507| 					// Only used by the AIs to prevent some choices of targets
|5508|5508| 					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
|5524|5524| 		{
|5525|5525| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5526|5526| 			var targetClasses = this.order.data.targetClasses;
|5527|    |-			if (cmpIdentity && targetClasses.attack
|5528|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5527|+			if (cmpIdentity && targetClasses.attack &&
|    |5528|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5529|5529| 				continue;
|5530|5530| 			if (cmpIdentity && targetClasses.avoid
|5531|5531| 				&& 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
|5527|5527| 			if (cmpIdentity && targetClasses.attack
|5528|5528| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5529|5529| 				continue;
|5530|    |-			if (cmpIdentity && targetClasses.avoid
|5531|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5530|+			if (cmpIdentity && targetClasses.avoid &&
|    |5531|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5532|5532| 				continue;
|5533|5533| 			// Only used by the AIs to prevent some choices of targets
|5534|5534| 			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
|5670|5670| 
|5671|5671| UnitAI.prototype.SetHeldPosition = function(x, z)
|5672|5672| {
|5673|    |-	this.heldPosition = {"x": x, "z": z};
|    |5673|+	this.heldPosition = { "x": x, "z": z};
|5674|5674| };
|5675|5675| 
|5676|5676| 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
|5670|5670| 
|5671|5671| UnitAI.prototype.SetHeldPosition = function(x, z)
|5672|5672| {
|5673|    |-	this.heldPosition = {"x": x, "z": z};
|    |5673|+	this.heldPosition = {"x": x, "z": z };
|5674|5674| };
|5675|5675| 
|5676|5676| 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
|5697|5697| 	return false;
|5698|5698| };
|5699|5699| 
|5700|    |-//// Helper functions ////
|    |5700|+// // Helper functions ////
|5701|5701| 
|5702|5702| UnitAI.prototype.CanAttack = function(target)
|5703|5703| {
|    | [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
|5901|5901| 	return cmpPack && cmpPack.IsPacking();
|5902|5902| };
|5903|5903| 
|5904|    |-//// Formation specific functions ////
|    |5904|+// // Formation specific functions ////
|5905|5905| 
|5906|5906| UnitAI.prototype.IsAttackingAsFormation = function()
|5907|5907| {
|    | [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
|5906|5906| UnitAI.prototype.IsAttackingAsFormation = function()
|5907|5907| {
|5908|5908| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5909|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5910|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5909|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5910|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5911|5911| };
|5912|5912| 
|5913|5913| //// 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
|5910|5910| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5911|5911| };
|5912|5912| 
|5913|    |-//// Animal specific functions ////
|    |5913|+// // Animal specific functions ////
|5914|5914| 
|5915|5915| UnitAI.prototype.MoveRandomly = function(distance)
|5916|5916| {

binaries/data/mods/public/simulation/components/UnitAI.js
| 331| »   »   »   return·true;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'Order.WalkToTarget' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
| 895| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
| 920| »   »   »   "enter":·function(msg)·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
| 938| »   »   »   "leave":·function(msg)·{
|    | [NORMAL] ESLintBear (no-dupe-keys):
|    | Duplicate key 'leave'.

binaries/data/mods/public/simulation/components/UnitAI.js
| 973| »   »   »   »   »   return·true;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'enter' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
|1036| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1074| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1107| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1320| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1616| »   »   »   »   »   return·false;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'enter' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
|2065| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2129| »   »   »   »   "MoveCompleted":·function(msg)·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'MoveCompleted'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2177| »   »   »   »   "leave":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'leave'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2194| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2207| »   »   »   »   "MoveCompleted":·function(msg)·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'MoveCompleted'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2322| »   »   »   »   "Timer":·function(msg)·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'Timer'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2463| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2581| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2683| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2892| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|3075| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|3807| »   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
|4608| »   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
|4623| »   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
|4669| »   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
|4692| »   »   ····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
| 358| »   »   ····&&·(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
| 938| »   »   »   "leave":·function(msg)·{
|    | [NORMAL] JSHintBear:
|    | Duplicate key 'leave'.

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

binaries/data/mods/public/simulation/components/UnitAI.js
|2010| »   »   »   »   »   »   &&·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
|2089| »   »   »   »   »   »   »   »   ·&&·((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
|2090| »   »   »   »   »   »   »   »   ·||·(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
|2091| »   »   »   »   »   »   »   »   ·&&·(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
|2156| »   »   »   »   »   »   »   »   &&·((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
|2157| »   »   »   »   »   »   »   »   ||·(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
|2158| »   »   »   »   »   »   »   »   &&·(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
|2216| »   »   »   »   »   »   »   ||·(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
|2217| »   »   »   »   »   »   »   &&·(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
|2422| »   »   »   »   »   »   »   ||·(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
|2423| »   »   »   »   »   »   »   &&·(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
|2623| »   »   »   »   »   var·cmpResourceGatherer·=·Engine.QueryInterface(this.entity,·IID_ResourceGatherer);
|    | [NORMAL] JSHintBear:
|    | 'cmpResourceGatherer' is already defined.

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

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

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

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

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

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

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4288| »   if·(data["target"])
|    | [NORMAL] JSHintBear:
|    | ['target'] is better written in dot notation.

binaries/data/mods/public/simulation/components/UnitAI.js
|4290| »   »   if·(data["min"]·||·data["max"])
|    | [NORMAL] JSHintBear:
|    | ['min'] is better written in dot notation.

binaries/data/mods/public/simulation/components/UnitAI.js
|4290| »   »   if·(data["min"]·||·data["max"])
|    | [NORMAL] JSHintBear:
|    | ['max'] is better written in dot notation.

binaries/data/mods/public/simulation/components/UnitAI.js
|4302| »   »   if·(data["min"]·||·data["max"])
|    | [NORMAL] JSHintBear:
|    | ['min'] is better written in dot notation.

binaries/data/mods/public/simulation/components/UnitAI.js
|4302| »   »   if·(data["min"]·||·data["max"])
|    | [NORMAL] JSHintBear:
|    | ['max'] is better written in dot notation.

binaries/data/mods/public/simulation/components/UnitAI.js
|4307| }
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4401| »   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
|4457| »   »   »   &&·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
|4625| »   »   &&·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
|4626| »   »   &&·(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
|5148| »   let·lastPos·=·undefined;
|    | [NORMAL] JSHintBear:
|    | It's not necessary to initialize 'lastPos' to 'undefined'.

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

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

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

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

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

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

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

wraitii added a reviewer: Restricted Owners Package.Jun 2 2019, 6:36 PM
Silier planned changes to this revision.Jun 5 2019, 10:51 PM

needs rebase

Silier updated this revision to Diff 10348.Nov 17 2019, 6:41 PM

rebased, something was kicked out from diff

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

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/596/display/redirect

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 762| 762| 					this.FinishOrder();
| 763| 763| 					return;
| 764| 764| 				}
| 765|    |-				else
| 766|    |-				{
|    | 765|+				
| 767| 766| 					this.SetNextState("GARRISON.APPROACHING");
| 768| 767| 					return;
| 769|    |-				}
|    | 768|+				
| 770| 769| 			}
| 771| 770| 
| 772| 771| 			this.SetNextState("GARRISON.GARRISONING");
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'GARRISON'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1030|1030| 			},
|1031|1031| 		},
|1032|1032| 
|1033|    |-		"GARRISON":{
|    |1033|+		"GARRISON": {
|1034|1034| 			"enter": function() {
|1035|1035| 				// If the garrisonholder should pickup, warn it so it can take needed action
|1036|1036| 				var cmpGarrisonHolder = Engine.QueryInterface(this.order.data.target, IID_GarrisonHolder);
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1979|1979| 
|1980|1980| 				"Attacked": function(msg) {
|1981|1981| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|1982|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|1983|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |1982|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |1983|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|1984|1984| 						this.RespondToTargetedEntities([msg.data.attacker]);
|1985|1985| 				},
|1986|1986| 			},
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2706|2706| 					{
|2707|2707| 						// The building was already finished/fully repaired before we arrived;
|2708|2708| 						// let the ConstructionFinished handler handle this.
|2709|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2709|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2710|2710| 						return true;
|2711|2711| 					}
|2712|2712| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2706|2706| 					{
|2707|2707| 						// The building was already finished/fully repaired before we arrived;
|2708|2708| 						// let the ConstructionFinished handler handle this.
|2709|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2709|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2710|2710| 						return true;
|2711|2711| 					}
|2712|2712| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 7.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3219|3219| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3220|3220| 
|3221|3221| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3222|    |-							// only used for domestic animals
|    |3222|+		// only used for domestic animals
|3223|3223| 	},
|3224|3224| };
|3225|3225| 
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3276|3276| 
|3277|3277| UnitAI.prototype.IsAnimal = function()
|3278|3278| {
|3279|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3279|+	return (!!this.template.NaturalBehaviour);
|3280|3280| };
|3281|3281| 
|3282|3282| UnitAI.prototype.IsDangerousAnimal = function()
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3392|3392| 		{
|3393|3393| 			let index = this.GetCurrentState().indexOf(".");
|3394|3394| 			if (index != -1)
|3395|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3395|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3396|3396| 			this.Stop(false);
|3397|3397| 		}
|3398|3398| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3448|3448| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3449|3449| 			continue;
|3450|3450| 		if (i == 0)
|3451|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3451|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3452|3452| 		else
|3453|3453| 			this.orderQueue.splice(i, 1);
|3454|3454| 		Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3448|3448| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3449|3449| 			continue;
|3450|3450| 		if (i == 0)
|3451|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3451|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3452|3452| 		else
|3453|3453| 			this.orderQueue.splice(i, 1);
|3454|3454| 		Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3532|3532| };
|3533|3533| 
|3534|3534| 
|3535|    |-//// FSM linkage functions ////
|    |3535|+// // FSM linkage functions ////
|3536|3536| 
|3537|3537| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3538|3538| UnitAI.prototype.SetNextState = function(state)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3702|3702| 				continue;
|3703|3703| 			if (this.orderQueue[i].type == type)
|3704|3704| 				continue;
|3705|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3705|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3706|3706| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3707|3707| 			return;
|3708|3708| 		}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3702|3702| 				continue;
|3703|3703| 			if (this.orderQueue[i].type == type)
|3704|3704| 				continue;
|3705|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3705|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3706|3706| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3707|3707| 			return;
|3708|3708| 		}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3873|3873| 	if (data.timerRepeat === undefined)
|3874|3874| 		this.timer = undefined;
|3875|3875| 
|3876|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3876|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3877|3877| };
|3878|3878| 
|3879|3879| /**
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3873|3873| 	if (data.timerRepeat === undefined)
|3874|3874| 		this.timer = undefined;
|3875|3875| 
|3876|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3876|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3877|3877| };
|3878|3878| 
|3879|3879| /**
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3918|3918| 	// TODO: This is a bit inefficient since every unit listens to every
|3919|3919| 	// construction message - ideally we could scope it to only the one we're building
|3920|3920| 
|3921|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3921|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3922|3922| };
|3923|3923| 
|3924|3924| UnitAI.prototype.OnGlobalEntityRenamed = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3918|3918| 	// TODO: This is a bit inefficient since every unit listens to every
|3919|3919| 	// construction message - ideally we could scope it to only the one we're building
|3920|3920| 
|3921|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3921|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3922|3922| };
|3923|3923| 
|3924|3924| UnitAI.prototype.OnGlobalEntityRenamed = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3943|3943| 
|3944|3944| UnitAI.prototype.OnAttacked = function(msg)
|3945|3945| {
|3946|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3946|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3947|3947| };
|3948|3948| 
|3949|3949| UnitAI.prototype.OnGuardedAttacked = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3943|3943| 
|3944|3944| UnitAI.prototype.OnAttacked = function(msg)
|3945|3945| {
|3946|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3946|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3947|3947| };
|3948|3948| 
|3949|3949| UnitAI.prototype.OnGuardedAttacked = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3948|3948| 
|3949|3949| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3950|3950| {
|3951|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3951|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|3952|3952| };
|3953|3953| 
|3954|3954| UnitAI.prototype.OnHealthChanged = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3948|3948| 
|3949|3949| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3950|3950| {
|3951|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3951|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|3952|3952| };
|3953|3953| 
|3954|3954| UnitAI.prototype.OnHealthChanged = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3953|3953| 
|3954|3954| UnitAI.prototype.OnHealthChanged = function(msg)
|3955|3955| {
|3956|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3956|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|3957|3957| };
|3958|3958| 
|3959|3959| UnitAI.prototype.OnRangeUpdate = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3953|3953| 
|3954|3954| UnitAI.prototype.OnHealthChanged = function(msg)
|3955|3955| {
|3956|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3956|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|3957|3957| };
|3958|3958| 
|3959|3959| UnitAI.prototype.OnRangeUpdate = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3959|3959| UnitAI.prototype.OnRangeUpdate = function(msg)
|3960|3960| {
|3961|3961| 	if (msg.tag == this.losRangeQuery)
|3962|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3962|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|3963|3963| 	else if (msg.tag == this.losHealRangeQuery)
|3964|3964| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3965|3965| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3959|3959| UnitAI.prototype.OnRangeUpdate = function(msg)
|3960|3960| {
|3961|3961| 	if (msg.tag == this.losRangeQuery)
|3962|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3962|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|3963|3963| 	else if (msg.tag == this.losHealRangeQuery)
|3964|3964| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3965|3965| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3961|3961| 	if (msg.tag == this.losRangeQuery)
|3962|3962| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3963|3963| 	else if (msg.tag == this.losHealRangeQuery)
|3964|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3964|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|3965|3965| };
|3966|3966| 
|3967|3967| UnitAI.prototype.OnPackFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3961|3961| 	if (msg.tag == this.losRangeQuery)
|3962|3962| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3963|3963| 	else if (msg.tag == this.losHealRangeQuery)
|3964|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3964|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|3965|3965| };
|3966|3966| 
|3967|3967| UnitAI.prototype.OnPackFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3966|3966| 
|3967|3967| UnitAI.prototype.OnPackFinished = function(msg)
|3968|3968| {
|3969|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3969|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|3970|3970| };
|3971|3971| 
|3972|3972| //// Helper functions to be called by the FSM ////
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3966|3966| 
|3967|3967| UnitAI.prototype.OnPackFinished = function(msg)
|3968|3968| {
|3969|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3969|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|3970|3970| };
|3971|3971| 
|3972|3972| //// Helper functions to be called by the FSM ////
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3969|3969| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|3970|3970| };
|3971|3971| 
|3972|    |-//// Helper functions to be called by the FSM ////
|    |3972|+// // Helper functions to be called by the FSM ////
|3973|3973| 
|3974|3974| UnitAI.prototype.GetWalkSpeed = function()
|3975|3975| {
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4638|4638| UnitAI.prototype.AttackEntityInZone = function(ents)
|4639|4639| {
|4640|4640| 	var target = ents.find(target =>
|4641|    |-		this.CanAttack(target)
|4642|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4641|+		this.CanAttack(target) &&
|    |4642|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4643|4643| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4644|4644| 	);
|4645|4645| 	if (!target)
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4639|4639| {
|4640|4640| 	var target = ents.find(target =>
|4641|4641| 		this.CanAttack(target)
|4642|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4643|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4642|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4643|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4644|4644| 	);
|4645|4645| 	if (!target)
|4646|4646| 		return false;
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before 'Engine'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4703|4703| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4704|4704| 	if (this.isGuardOf)
|4705|4705| 	{
|4706|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4706|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4707|4707| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4708|4708| 		if (cmpUnitAI && cmpAttack &&
|4709|4709| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 4.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4707|4707| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4708|4708| 		if (cmpUnitAI && cmpAttack &&
|4709|4709| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4710|    |-				return false;
|    |4710|+			return false;
|4711|4711| 	}
|4712|4712| 
|4713|4713| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before 'Engine'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4745|4745| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4746|4746| 	if (this.isGuardOf)
|4747|4747| 	{
|4748|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4748|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4749|4749| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4750|4750| 		if (cmpUnitAI && cmpAttack &&
|4751|4751| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4758|4758| 	return false;
|4759|4759| };
|4760|4760| 
|4761|    |-//// External interface functions ////
|    |4761|+// // External interface functions ////
|4762|4762| 
|4763|4763| UnitAI.prototype.SetFormationController = function(ent)
|4764|4764| {
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4914|4914| 	{
|4915|4915| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4916|4916| 			return;
|4917|    |-		else
|4918|    |-			this.RemoveGuard();
|    |4917|+		this.RemoveGuard();
|4919|4918| 	}
|4920|4919| 
|4921|4920| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|    | [NORMAL] ESLintBear (no-trailing-spaces):
|    | Trailing spaces not allowed.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5246|5246| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5247|5247| 	{
|5248|5248| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5249|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5249|+		if (cmpTrader.HasBothMarkets() &&
|5250|5250| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5251|5251| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5252|5252| 		{
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5527|5527| 				{
|5528|5528| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5529|5529| 					var targetClasses = this.order.data.targetClasses;
|5530|    |-					if (targetClasses.attack && cmpIdentity
|5531|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5530|+					if (targetClasses.attack && cmpIdentity &&
|    |5531|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5532|5532| 						continue;
|5533|5533| 					if (targetClasses.avoid && cmpIdentity
|5534|5534| 						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5530|5530| 					if (targetClasses.attack && cmpIdentity
|5531|5531| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5532|5532| 						continue;
|5533|    |-					if (targetClasses.avoid && cmpIdentity
|5534|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5533|+					if (targetClasses.avoid && cmpIdentity &&
|    |5534|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5535|5535| 						continue;
|5536|5536| 					// Only used by the AIs to prevent some choices of targets
|5537|5537| 					if (targetClasses.vetoEntities && targetClasses.vetoEntities[targ])
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5553|5553| 		{
|5554|5554| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5555|5555| 			var targetClasses = this.order.data.targetClasses;
|5556|    |-			if (cmpIdentity && targetClasses.attack
|5557|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5556|+			if (cmpIdentity && targetClasses.attack &&
|    |5557|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5558|5558| 				continue;
|5559|5559| 			if (cmpIdentity && targetClasses.avoid
|5560|5560| 				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5556|5556| 			if (cmpIdentity && targetClasses.attack
|5557|5557| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5558|5558| 				continue;
|5559|    |-			if (cmpIdentity && targetClasses.avoid
|5560|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5559|+			if (cmpIdentity && targetClasses.avoid &&
|    |5560|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5561|5561| 				continue;
|5562|5562| 			// Only used by the AIs to prevent some choices of targets
|5563|5563| 			if (targetClasses.vetoEntities && targetClasses.vetoEntities[targ])
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5713|5713| 
|5714|5714| UnitAI.prototype.SetHeldPosition = function(x, z)
|5715|5715| {
|5716|    |-	this.heldPosition = {"x": x, "z": z};
|    |5716|+	this.heldPosition = { "x": x, "z": z};
|5717|5717| };
|5718|5718| 
|5719|5719| UnitAI.prototype.SetHeldPositionOnEntity = function(entity)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5713|5713| 
|5714|5714| UnitAI.prototype.SetHeldPosition = function(x, z)
|5715|5715| {
|5716|    |-	this.heldPosition = {"x": x, "z": z};
|    |5716|+	this.heldPosition = {"x": x, "z": z };
|5717|5717| };
|5718|5718| 
|5719|5719| UnitAI.prototype.SetHeldPositionOnEntity = function(entity)
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5740|5740| 	return false;
|5741|5741| };
|5742|5742| 
|5743|    |-//// Helper functions ////
|    |5743|+// // Helper functions ////
|5744|5744| 
|5745|5745| UnitAI.prototype.CanAttack = function(target)
|5746|5746| {
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5944|5944| 	return cmpPack && cmpPack.IsPacking();
|5945|5945| };
|5946|5946| 
|5947|    |-//// Formation specific functions ////
|    |5947|+// // Formation specific functions ////
|5948|5948| 
|5949|5949| UnitAI.prototype.IsAttackingAsFormation = function()
|5950|5950| {
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5949|5949| UnitAI.prototype.IsAttackingAsFormation = function()
|5950|5950| {
|5951|5951| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5952|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5953|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5952|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5953|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5954|5954| };
|5955|5955| 
|5956|5956| //// Animal specific functions ////
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5953|5953| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5954|5954| };
|5955|5955| 
|5956|    |-//// Animal specific functions ////
|    |5956|+// // Animal specific functions ////
|5957|5957| 
|5958|5958| UnitAI.prototype.MoveRandomly = function(distance)
|5959|5959| {

binaries/data/mods/public/simulation/components/UnitAI.js
| 331| »   »   »   return·true;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'Order.WalkToTarget' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
| 917| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
| 942| »   »   »   "enter":·function(msg)·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
| 992| »   »   »   »   »   return·true;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'enter' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
|1055| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1091| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1123| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1283| »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1340| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1515| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1537| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1569| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1723| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1773| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1851| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2028| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2144| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2418| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2451| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2557| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2623| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2662| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2873| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|3054| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|3778| »   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
|4625| »   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
|4640| »   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
|4686| »   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
|4709| »   »   ····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
|1983| »   »   »   »   »   »   &&·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
|3740| »   »   var·order·=·{·"type":·type,·"data":·data·};
|    | [NORMAL] JSHintBear:
|    | 'order' is already defined.

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

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

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

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

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

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|5953| »   »   &&·this.GetCurrentState()·==·"FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1112/display/redirect

Silier updated this revision to Diff 11249.Feb 1 2020, 2:53 PM

nearbyDropsite -> nearestDropsite

Vulcan added a comment.Feb 1 2020, 2:55 PM

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1694/display/redirect

Nescio added a subscriber: Nescio.Feb 1 2020, 2:56 PM

nearbyDropsite -> nearestDropsite

As the crow flies or walking distance?

Silier added a comment.Feb 1 2020, 3:04 PM

Derived from this.FindNearestDropsite, waking distance without obstacles

Nescio removed a subscriber: Nescio.Feb 1 2020, 3:12 PM
Silier edited the summary of this revision. (Show Details)Feb 8 2020, 2:36 PM
This revision was not accepted when it landed; it landed in state Needs Review.Feb 13 2020, 9:25 PM
This revision was landed with ongoing or failed builds.
Closed by commit rP23497: UnitAI cleanup [GATHER] (authored by Silier). · Explain Why
This revision was automatically updated to reflect the committed changes.