Page MenuHomeWildfire Games

Change Cheering
Needs ReviewPublic

Authored by Angen on Jun 15 2019, 7:31 PM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

Cheering as is done now is highly unfair and illogical. Cheering units are immune to all damage for 2.8 seconds.
That means unit A attacking cheering unit B is wasting its attack and doing 0 damage while taking damage from anyone attacking it (unit A).
That can save cheering unit with 1 HP from being killed what is not fair to the attacker.

In this diff I am:

  1. removing immunity to damage while cheering
  2. do not forcing cheering order so unit can respond to attacks
  3. removing cheering from promotion
  4. cheering after unit cannot find more targets while in combat and has nothing else to do
Test Plan

Check cheering unit can respond to attacks and orders while in combat and is cheering.

Event Timeline

Angen created this revision.Jun 15 2019, 7:31 PM

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

Linter detected issues:
Executing section Source...
Executing section JS...

binaries/data/mods/public/simulation/components/UnitAI.js
|1393| »   »   »   "enter":·function()·{
|    | [MAJOR] ESLintBear:
|    | Parsing error: Unexpected token "enter"

binaries/data/mods/public/simulation/components/UnitAI.js
| 354| »   »   ····&&·(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
|1393| »   »   »   "enter":·function()·{
|    | [MAJOR] JSHintBear:
|    | Expected '}' to match '{' from line 1389 and instead saw 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1393| »   »   »   "enter":·function()·{
|    | [MAJOR] JSHintBear:
|    | Expected '}' to match '{' from line 1322 and instead saw ':'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1393| »   »   »   "enter":·function()·{
|    | [MAJOR] JSHintBear:
|    | Expected '}' to match '{' from line 136 and instead saw 'function'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1393| »   »   »   "enter":·function()·{
|    | [NORMAL] JSHintBear:
|    | Bad invocation.

binaries/data/mods/public/simulation/components/UnitAI.js
|1393| »   »   »   "enter":·function()·{
|    | [MAJOR] JSHintBear:
|    | Missing semicolon.

binaries/data/mods/public/simulation/components/UnitAI.js
|1441| »   »   »   },
|    | [MAJOR] JSHintBear:
|    | Expected an identifier and instead saw ','.

binaries/data/mods/public/simulation/components/UnitAI.js
|1441| »   »   »   },
|    | [NORMAL] JSHintBear:
|    | Expected an assignment or function call and instead saw an expression.

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

binaries/data/mods/public/simulation/components/UnitAI.js
|1443| »   »   »   "leave":·function()·{
|    | [NORMAL] JSHintBear:
|    | Expected an assignment or function call and instead saw an expression.

binaries/data/mods/public/simulation/components/UnitAI.js
|1443| »   »   »   "leave":·function()·{
|    | [MAJOR] JSHintBear:
|    | Missing semicolon.

binaries/data/mods/public/simulation/components/UnitAI.js
|1443| »   »   »   "leave":·function()·{
|    | [MAJOR] JSHintBear:
|    | Unrecoverable syntax error. (24% scanned).
Executing section cli...

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

Angen added inline comments.Jun 15 2019, 8:06 PM
binaries/data/mods/public/simulation/components/UnitAI.js
1436

comma

Angen updated this revision to Diff 8491.Jun 15 2019, 8:51 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
| 352| 352| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 353| 353| 		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 354| 354| 		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 355|    |-		{
|    | 355|+		
| 356| 356| 			// we were already on the shoreline, and have not moved since
| 357| 357| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
| 358| 358| 				needToMove = false;
| 359|    |-		}
|    | 359|+		
| 360| 360| 
| 361| 361| 		if (needToMove)
| 362| 362| 			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
| 350| 350| 		// Check if we need to move     TODO implement a better way to know if we are on the shoreline
| 351| 351| 		var needToMove = true;
| 352| 352| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 353|    |-		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 354|    |-		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
|    | 353|+		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x) &&
|    | 354|+		    (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 355| 355| 		{
| 356| 356| 			// we were already on the shoreline, and have not moved since
| 357| 357| 			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
| 515| 515| 					this.PushOrderFront("Walk", this.order.data.lastPos);
| 516| 516| 				}
| 517| 517| 				else
| 518|    |-				{
|    | 518|+				
| 519| 519| 					// We couldn't move there, or the target moved away
| 520| 520| 					this.FinishOrder();
| 521|    |-				}
|    | 521|+				
| 522| 522| 				return;
| 523| 523| 			}
| 524| 524| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 731| 731| 			}
| 732| 732| 			// Check if we are already in range, otherwise walk there
| 733| 733| 			if (!this.CheckGarrisonRange(msg.data.target))
| 734|    |-			{
|    | 734|+			
| 735| 735| 				if (!this.CheckTargetVisible(msg.data.target))
| 736| 736| 				{
| 737| 737| 					this.FinishOrder();
| 742| 742| 					this.SetNextState("GARRISON.APPROACHING");
| 743| 743| 					return;
| 744| 744| 				}
| 745|    |-			}
|    | 745|+			
| 746| 746| 
| 747| 747| 			this.SetNextState("GARRISON.GARRISONING");
| 748| 748| 		},
|    | [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
| 737| 737| 					this.FinishOrder();
| 738| 738| 					return;
| 739| 739| 				}
| 740|    |-				else
| 741|    |-				{
|    | 740|+				
| 742| 741| 					this.SetNextState("GARRISON.APPROACHING");
| 743| 742| 					return;
| 744|    |-				}
|    | 743|+				
| 745| 744| 			}
| 746| 745| 
| 747| 746| 			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
| 760| 760| 						this.PushOrderFront("Walk", msg.data.lastPos);
| 761| 761| 					}
| 762| 762| 					else
| 763|    |-					{
|    | 763|+					
| 764| 764| 						// We couldn't move there, or the target moved away
| 765| 765| 						this.FinishOrder();
| 766|    |-					}
|    | 766|+					
| 767| 767| 					return;
| 768| 768| 				}
| 769| 769| 
|    | [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
| 993| 993| 			},
| 994| 994| 		},
| 995| 995| 
| 996|    |-		"GARRISON":{
|    | 996|+		"GARRISON": {
| 997| 997| 			"enter": function() {
| 998| 998| 				// If the garrisonholder should pickup, warn it so it can take needed action
| 999| 999| 				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
|1206|1206| 			// If the controller handled an order but some members rejected it,
|1207|1207| 			// they will have no orders and be in the FORMATIONMEMBER.IDLE state.
|1208|1208| 			if (this.orderQueue.length)
|1209|    |-			{
|    |1209|+			
|1210|1210| 				// We're leaving the formation, so stop our FormationWalk order
|1211|1211| 				if (this.FinishOrder())
|1212|1212| 					return;
|1213|    |-			}
|    |1213|+			
|1214|1214| 
|1215|1215| 			// No orders left, we're an individual now
|1216|1216| 			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
|1234|1234| 			// Move a tile outside the building
|1235|1235| 			let range = 4;
|1236|1236| 			if (this.CheckTargetRangeExplicit(msg.data.target, range, range))
|1237|    |-			{
|    |1237|+			
|1238|1238| 				// We are already at the target, or can't move at all
|1239|1239| 				this.FinishOrder();
|1240|    |-			}
|    |1240|+			
|1241|1241| 			else
|1242|1242| 			{
|1243|1243| 				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
|1458|1458| 
|1459|1459| 			"LosRangeUpdate": function(msg) {
|1460|1460| 				if (this.GetStance().targetVisibleEnemies)
|1461|    |-				{
|    |1461|+				
|1462|1462| 					// Start attacking one of the newly-seen enemy (if any)
|1463|1463| 					this.AttackEntitiesByPreference(msg.data.added);
|1464|    |-				}
|    |1464|+				
|1465|1465| 			},
|1466|1466| 
|1467|1467| 			"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
|1491|1491| 				this.SelectAnimation("move");
|1492|1492| 			},
|1493|1493| 
|1494|    |-			"leave": function () {
|    |1494|+			"leave": function() {
|1495|1495| 				this.SelectAnimation("idle");
|1496|1496| 				this.StopMoving();
|1497|1497| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1671|1671| 						// if nothing better to do, check if the guarded needs to be healed or repaired
|1672|1672| 						var cmpHealth = Engine.QueryInterface(this.isGuardOf, IID_Health);
|1673|1673| 						if (cmpHealth && cmpHealth.IsInjured())
|1674|    |-						{
|    |1674|+						
|1675|1675| 							if (this.CanHeal(this.isGuardOf))
|1676|1676| 								this.PushOrderFront("Heal", { "target": this.isGuardOf, "force": false });
|1677|1677| 							else if (this.CanRepair(this.isGuardOf))
|1678|1678| 								this.PushOrderFront("Repair", { "target": this.isGuardOf, "autocontinue": false, "force": false });
|1679|    |-						}
|    |1679|+						
|1680|1680| 					}
|1681|1681| 				},
|1682|1682| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/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| 					}
|1799|1799| 					// Check the target is still alive and attackable
|1800|1800| 					if (this.CanAttack(target) && !this.CheckTargetAttackRange(target, this.order.data.attackType))
|1801|    |-					{
|    |1801|+					
|1802|1802| 						// Can't reach it - try to chase after it
|1803|1803| 						if (this.ShouldChaseTargetedEntity(target, this.order.data.force))
|1804|1804| 						{
|1811|1811| 							this.SetNextState("COMBAT.CHASING");
|1812|1812| 							return true;
|1813|1813| 						}
|1814|    |-					}
|    |1814|+					
|1815|1815| 
|1816|1816| 					this.StopMoving();
|1817|1817| 
|    | [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
|1844|1844| 					// TODO: we should probably only bother syncing projectile attacks, not melee
|1845|1845| 
|1846|1846| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|1847|    |-					this.resyncAnimation = (prepare != this.attackTimers.prepare) ? true : false;
|    |1847|+					this.resyncAnimation = (prepare != this.attackTimers.prepare);
|1848|1848| 
|1849|1849| 					this.FaceTowardsTarget(this.order.data.target);
|1850|1850| 
|    | [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
|1970|1970| 
|1971|1971| 				"Attacked": function(msg) {
|1972|1972| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|1973|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|1974|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |1973|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |1974|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|1975|1975| 						this.RespondToTargetedEntities([msg.data.attacker]);
|1976|1976| 				},
|1977|1977| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1990|1990| 					this.SelectAnimation("move");
|1991|1991| 					var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|1992|1992| 					if (cmpUnitAI && cmpUnitAI.IsFleeing())
|1993|    |-					{
|    |1993|+					
|1994|1994| 						// Run after a fleeing target
|1995|1995| 						this.SetSpeedMultiplier(this.GetRunMultiplier());
|1996|    |-					}
|    |1996|+					
|1997|1997| 					this.StartTimer(1000, 1000);
|1998|1998| 				},
|1999|1999| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2172|2172| 
|2173|2173| 					var cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply);
|2174|2174| 					if (cmpSupply && cmpSupply.IsAvailable(cmpOwnership.GetOwner(), this.entity))
|2175|    |-					{
|    |2175|+					
|2176|2176| 						// Check we can still reach and gather from the target
|2177|2177| 						if (this.CheckTargetRange(this.gatheringTarget, IID_ResourceGatherer) && this.CanGather(this.gatheringTarget))
|2178|2178| 						{
|2223|2223| 								return;
|2224|2224| 							}
|2225|2225| 						}
|2226|    |-					}
|    |2226|+					
|2227|2227| 
|2228|2228| 					// We're already in range, can't get anywhere near it or the target is exhausted.
|2229|2229| 
|    | [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
|2215|2215| 								return;
|2216|2216| 						}
|2217|2217| 						else
|2218|    |-						{
|    |2218|+						
|2219|2219| 							// Try to follow the target
|2220|2220| 							if (this.MoveToTargetRange(this.gatheringTarget, IID_ResourceGatherer))
|2221|2221| 							{
|2222|2222| 								this.SetNextState("APPROACHING");
|2223|2223| 								return;
|2224|2224| 							}
|2225|    |-						}
|    |2225|+						
|2226|2226| 					}
|2227|2227| 
|2228|2228| 					// We're already in range, can't get anywhere near it or the target is exhausted.
|    | [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
|2249|2249| 					// Also don't switch to a different type of huntable animal
|2250|2250| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2251|2251| 						return (
|2252|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2253|    |-							|| (type.specific == resourceType.specific
|    |2252|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2253|+							(type.specific == resourceType.specific
|2254|2254| 							&& (type.specific != "meat" || resourceTemplate == template))
|2255|2255| 						);
|2256|2256| 					});
|    | [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
|2250|2250| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2251|2251| 						return (
|2252|2252| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2253|    |-							|| (type.specific == resourceType.specific
|2254|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2253|+							|| (type.specific == resourceType.specific &&
|    |2254|+							(type.specific != "meat" || resourceTemplate == template))
|2255|2255| 						);
|2256|2256| 					});
|2257|2257| 					if (nearby)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2315|2315| 
|2316|2316| 				"Timer": function(msg) {
|2317|2317| 					if (this.ShouldAbandonChase(this.order.data.target, this.order.data.force, IID_Heal, null))
|2318|    |-					{
|    |2318|+					
|2319|2319| 						// Return to our original position unless we have a better order.
|2320|2320| 						if (!this.FinishOrder() && this.GetStance().respondHoldGround)
|2321|2321| 							this.WalkToHeldPosition();
|2322|    |-					}
|    |2322|+					
|2323|2323| 				},
|2324|2324| 
|2325|2325| 				"MovementUpdate": 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
|2349|2349| 					this.StartTimer(prepare, this.healTimers.repeat);
|2350|2350| 
|2351|2351| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2352|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2352|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2353|2353| 
|2354|2354| 					this.FaceTowardsTarget(this.order.data.target);
|2355|2355| 				},
|    | [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
|2562|2562| 					{
|2563|2563| 						// The building was already finished/fully repaired before we arrived;
|2564|2564| 						// let the ConstructionFinished handler handle this.
|2565|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2565|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2566|2566| 						return true;
|2567|2567| 					}
|2568|2568| 
|    | [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
|2562|2562| 					{
|2563|2563| 						// The building was already finished/fully repaired before we arrived;
|2564|2564| 						// let the ConstructionFinished handler handle this.
|2565|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2565|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2566|2566| 						return true;
|2567|2567| 					}
|2568|2568| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2689|2689| 
|2690|2690| 				// Unit was approaching and there's nothing to do now, so switch to walking
|2691|2691| 				if (oldState === "INDIVIDUAL.REPAIR.APPROACHING")
|2692|    |-				{
|    |2692|+				
|2693|2693| 					// We're already walking to the given point, so add this as a order.
|2694|2694| 					this.WalkToTarget(msg.data.newentity, true);
|2695|    |-				}
|    |2695|+				
|2696|2696| 			},
|2697|2697| 		},
|2698|2698| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2752|2752| 
|2753|2753| 					// Check that we can garrison here
|2754|2754| 					if (this.CanGarrison(target))
|2755|    |-					{
|    |2755|+					
|2756|2756| 						// Check that we're in range of the garrison target
|2757|2757| 						if (this.CheckGarrisonRange(target))
|2758|2758| 						{
|2828|2828| 								return false;
|2829|2829| 							}
|2830|2830| 						}
|2831|    |-					}
|    |2831|+					
|2832|2832| 					// Garrisoning failed for some reason, so finish the order
|2833|2833| 					this.FinishOrder();
|2834|2834| 					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
|2945|2945| 		"Attacked": function(msg) {
|2946|2946| 			if (this.template.NaturalBehaviour == "skittish" ||
|2947|2947| 			    this.template.NaturalBehaviour == "passive")
|2948|    |-			{
|    |2948|+			
|2949|2949| 				this.Flee(msg.data.attacker, false);
|2950|    |-			}
|    |2950|+			
|2951|2951| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|2952|2952| 			{
|2953|2953| 				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
|2954|2954| 					this.Attack(msg.data.attacker, false);
|2955|2955| 			}
|2956|2956| 			else if (this.template.NaturalBehaviour == "domestic")
|2957|    |-			{
|    |2957|+			
|2958|2958| 				// Never flee, stop what we were doing
|2959|2959| 				this.SetNextState("IDLE");
|2960|    |-			}
|    |2960|+			
|2961|2961| 		},
|2962|2962| 
|2963|2963| 		"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
|2968|2968| 				this.FinishOrder();
|2969|2969| 				return;
|2970|2970| 			}
|2971|    |-			else
|2972|    |-			{
|    |2971|+			
|2973|2972| 				this.order.data.min = range;
|2974|2973| 				this.SetNextState("WALKING");
|2975|    |-			}
|    |2974|+			
|2976|2975| 		},
|2977|2976| 
|2978|2977| 		"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
|3012|3012| 				}
|3013|3013| 				// Start attacking one of the newly-seen enemy (if any)
|3014|3014| 				else if (this.IsDangerousAnimal())
|3015|    |-				{
|    |3015|+				
|3016|3016| 					this.AttackVisibleEntity(msg.data.added);
|3017|    |-				}
|    |3017|+				
|3018|3018| 
|3019|3019| 				// TODO: if two units enter our range together, we'll attack the
|3020|3020| 				// 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
|3055|3055| 				}
|3056|3056| 				// Start attacking one of the newly-seen enemy (if any)
|3057|3057| 				else if (this.template.NaturalBehaviour == "violent")
|3058|    |-				{
|    |3058|+				
|3059|3059| 					this.AttackVisibleEntity(msg.data.added);
|3060|    |-				}
|    |3060|+				
|3061|3061| 			},
|3062|3062| 
|3063|3063| 			"Timer": function(msg) {
|    | [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
|3070|3070| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3071|3071| 
|3072|3072| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3073|    |-							// only used for domestic animals
|    |3073|+		// only used for domestic animals
|3074|3074| 	},
|3075|3075| };
|3076|3076| 
|    | [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
|3127|3127| 
|3128|3128| UnitAI.prototype.IsAnimal = function()
|3129|3129| {
|3130|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3130|+	return (!!this.template.NaturalBehaviour);
|3131|3131| };
|3132|3132| 
|3133|3133| 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
|3165|3165| UnitAI.prototype.GetGarrisonHolder = function()
|3166|3166| {
|3167|3167| 	if (this.IsGarrisoned())
|3168|    |-	{
|    |3168|+	
|3169|3169| 		for (let order of this.orderQueue)
|3170|3170| 			if (order.type == "Garrison")
|3171|3171| 				return order.data.target;
|3172|    |-	}
|    |3172|+	
|3173|3173| 	return INVALID_ENTITY;
|3174|3174| };
|3175|3175| 
|    | [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
|3243|3243| 		{
|3244|3244| 			let index = this.GetCurrentState().indexOf(".");
|3245|3245| 			if (index != -1)
|3246|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3246|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3247|3247| 			this.Stop(false);
|3248|3248| 		}
|3249|3249| 
|    | [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
|3299|3299| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3300|3300| 			continue;
|3301|3301| 		if (i == 0)
|3302|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3302|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3303|3303| 		else
|3304|3304| 			this.orderQueue.splice(i, 1);
|3305|3305| 		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
|3299|3299| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3300|3300| 			continue;
|3301|3301| 		if (i == 0)
|3302|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3302|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3303|3303| 		else
|3304|3304| 			this.orderQueue.splice(i, 1);
|3305|3305| 		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
|3383|3383| };
|3384|3384| 
|3385|3385| 
|3386|    |-//// FSM linkage functions ////
|    |3386|+// // FSM linkage functions ////
|3387|3387| 
|3388|3388| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3389|3389| 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
|3549|3549| 				continue;
|3550|3550| 			if (this.orderQueue[i].type == type)
|3551|3551| 				continue;
|3552|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3552|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3553|3553| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3554|3554| 			return;
|3555|3555| 		}
|    | [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
|3549|3549| 				continue;
|3550|3550| 			if (this.orderQueue[i].type == type)
|3551|3551| 				continue;
|3552|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3552|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3553|3553| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3554|3554| 			return;
|3555|3555| 		}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3563|3563| {
|3564|3564| 	// Remember the previous work orders to be able to go back to them later if required
|3565|3565| 	if (data && data.force)
|3566|    |-	{
|    |3566|+	
|3567|3567| 		if (this.IsFormationController())
|3568|3568| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3569|3569| 		else
|3570|3570| 			this.UpdateWorkOrders(type);
|3571|    |-	}
|    |3571|+	
|3572|3572| 
|3573|3573| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3574|3574| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3633|3633| 	{
|3634|3634| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3635|3635| 		if (cmpUnitAI)
|3636|    |-		{
|    |3636|+		
|3637|3637| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3638|3638| 			{
|3639|3639| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3642|3642| 					return;
|3643|3643| 				}
|3644|3644| 			}
|3645|    |-		}
|    |3645|+		
|3646|3646| 	}
|3647|3647| 
|3648|3648| 	// 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
|3635|3635| 		if (cmpUnitAI)
|3636|3636| 		{
|3637|3637| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3638|    |-			{
|    |3638|+			
|3639|3639| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3640|3640| 				{
|3641|3641| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3642|3642| 					return;
|3643|3643| 				}
|3644|    |-			}
|    |3644|+			
|3645|3645| 		}
|3646|3646| 	}
|3647|3647| 
|    | [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
|3647|3647| 
|3648|3648| 	// If nothing found, take the unit orders
|3649|3649| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3650|    |-	{
|    |3650|+	
|3651|3651| 		if (isWorkType(this.orderQueue[i].type))
|3652|3652| 		{
|3653|3653| 			this.workOrders = this.orderQueue.slice(i);
|3654|3654| 			return;
|3655|3655| 		}
|3656|    |-	}
|    |3656|+	
|3657|3657| };
|3658|3658| 
|3659|3659| 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
|3707|3707| 	if (data.timerRepeat === undefined)
|3708|3708| 		this.timer = undefined;
|3709|3709| 
|3710|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3710|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3711|3711| };
|3712|3712| 
|3713|3713| /**
|    | [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
|3707|3707| 	if (data.timerRepeat === undefined)
|3708|3708| 		this.timer = undefined;
|3709|3709| 
|3710|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3710|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3711|3711| };
|3712|3712| 
|3713|3713| /**
|    | [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
|3742|3742| 	this.timer = undefined;
|3743|3743| };
|3744|3744| 
|3745|    |-//// Message handlers /////
|    |3745|+// // Message handlers /////
|3746|3746| 
|3747|3747| UnitAI.prototype.OnMotionChanged = function(msg)
|3748|3748| {
|    | [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
|3754|3754| 	// TODO: This is a bit inefficient since every unit listens to every
|3755|3755| 	// construction message - ideally we could scope it to only the one we're building
|3756|3756| 
|3757|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3757|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3758|3758| };
|3759|3759| 
|3760|3760| 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
|3754|3754| 	// TODO: This is a bit inefficient since every unit listens to every
|3755|3755| 	// construction message - ideally we could scope it to only the one we're building
|3756|3756| 
|3757|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3757|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3758|3758| };
|3759|3759| 
|3760|3760| 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
|3779|3779| 
|3780|3780| UnitAI.prototype.OnAttacked = function(msg)
|3781|3781| {
|3782|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3782|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3783|3783| };
|3784|3784| 
|3785|3785| 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
|3779|3779| 
|3780|3780| UnitAI.prototype.OnAttacked = function(msg)
|3781|3781| {
|3782|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3782|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3783|3783| };
|3784|3784| 
|3785|3785| 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
|3784|3784| 
|3785|3785| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3786|3786| {
|3787|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3787|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|3788|3788| };
|3789|3789| 
|3790|3790| 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
|3784|3784| 
|3785|3785| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3786|3786| {
|3787|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3787|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|3788|3788| };
|3789|3789| 
|3790|3790| 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
|3789|3789| 
|3790|3790| UnitAI.prototype.OnHealthChanged = function(msg)
|3791|3791| {
|3792|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3792|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|3793|3793| };
|3794|3794| 
|3795|3795| 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
|3789|3789| 
|3790|3790| UnitAI.prototype.OnHealthChanged = function(msg)
|3791|3791| {
|3792|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3792|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|3793|3793| };
|3794|3794| 
|3795|3795| 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
|3795|3795| UnitAI.prototype.OnRangeUpdate = function(msg)
|3796|3796| {
|3797|3797| 	if (msg.tag == this.losRangeQuery)
|3798|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3798|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|3799|3799| 	else if (msg.tag == this.losHealRangeQuery)
|3800|3800| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3801|3801| };
|    | [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
|3795|3795| UnitAI.prototype.OnRangeUpdate = function(msg)
|3796|3796| {
|3797|3797| 	if (msg.tag == this.losRangeQuery)
|3798|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3798|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|3799|3799| 	else if (msg.tag == this.losHealRangeQuery)
|3800|3800| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3801|3801| };
|    | [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
|3797|3797| 	if (msg.tag == this.losRangeQuery)
|3798|3798| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3799|3799| 	else if (msg.tag == this.losHealRangeQuery)
|3800|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3800|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|3801|3801| };
|3802|3802| 
|3803|3803| 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
|3797|3797| 	if (msg.tag == this.losRangeQuery)
|3798|3798| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3799|3799| 	else if (msg.tag == this.losHealRangeQuery)
|3800|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3800|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|3801|3801| };
|3802|3802| 
|3803|3803| 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
|3802|3802| 
|3803|3803| UnitAI.prototype.OnPackFinished = function(msg)
|3804|3804| {
|3805|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3805|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|3806|3806| };
|3807|3807| 
|3808|3808| //// 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
|3802|3802| 
|3803|3803| UnitAI.prototype.OnPackFinished = function(msg)
|3804|3804| {
|3805|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3805|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|3806|3806| };
|3807|3807| 
|3808|3808| //// 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
|3805|3805| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|3806|3806| };
|3807|3807| 
|3808|    |-//// Helper functions to be called by the FSM ////
|    |3808|+// // Helper functions to be called by the FSM ////
|3809|3809| 
|3810|3810| UnitAI.prototype.GetWalkSpeed = function()
|3811|3811| {
|    | [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
|3907|3907| 	if (!cmpOwnership || cmpOwnership.GetOwner() == INVALID_PLAYER)
|3908|3908| 		return undefined;
|3909|3909| 
|3910|    |-	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position)
|    |3910|+	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
|3911|3911| 	if (!cmpPosition || !cmpPosition.IsInWorld())
|3912|3912| 		return undefined;
|3913|3913| 
|    | [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
|3992|3992| 			PlaySound(name, member);
|3993|3993| 	}
|3994|3994| 	else
|3995|    |-	{
|    |3995|+	
|3996|3996| 		// Otherwise use our own sounds
|3997|3997| 		PlaySound(name, this.entity);
|3998|    |-	}
|    |3998|+	
|3999|3999| };
|4000|4000| 
|4001|4001| /*
|    | [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
|4184|4184| 	else
|4185|4185| 		// return false? Or hope you come close enough?
|4186|4186| 		var parabolicMaxRange = 0;
|4187|    |-		//return false;
|    |4187|+		// return false;
|4188|4188| 
|4189|4189| 	// the parabole changes while walking, take something in the middle
|4190|4190| 	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
|4271|4271| 	if (this.IsFormationMember())
|4272|4272| 	{
|4273|4273| 		var cmpFormationUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|4274|    |-		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation()
|4275|    |-			&& cmpFormationUnitAI.order.data.target == target)
|    |4274|+		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation() &&
|    |4275|+			cmpFormationUnitAI.order.data.target == target)
|4276|4276| 			return true;
|4277|4277| 	}
|4278|4278| 
|    | [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
|4439|4439| UnitAI.prototype.AttackEntityInZone = function(ents)
|4440|4440| {
|4441|4441| 	var target = ents.find(target =>
|4442|    |-		this.CanAttack(target)
|4443|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4442|+		this.CanAttack(target) &&
|    |4443|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4444|4444| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4445|4445| 	);
|4446|4446| 	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
|4440|4440| {
|4441|4441| 	var target = ents.find(target =>
|4442|4442| 		this.CanAttack(target)
|4443|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4444|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4443|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4444|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4445|4445| 	);
|4446|4446| 	if (!target)
|4447|4447| 		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
|4504|4504| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4505|4505| 	if (this.isGuardOf)
|4506|4506| 	{
|4507|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4507|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4508|4508| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4509|4509| 		if (cmpUnitAI && cmpAttack &&
|4510|4510| 		    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
|4508|4508| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4509|4509| 		if (cmpUnitAI && cmpAttack &&
|4510|4510| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4511|    |-				return false;
|    |4511|+			return false;
|4512|4512| 	}
|4513|4513| 
|4514|4514| 	// 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
|4513|4513| 
|4514|4514| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4515|4515| 	if (this.GetStance().respondHoldGround)
|4516|    |-	{
|    |4516|+	
|4517|4517| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4518|4518| 			return true;
|4519|    |-	}
|    |4519|+	
|4520|4520| 
|4521|4521| 	// Stop if it's left our vision range, unless we're especially persistent
|4522|4522| 	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
|4520|4520| 
|4521|4521| 	// Stop if it's left our vision range, unless we're especially persistent
|4522|4522| 	if (!this.GetStance().respondChaseBeyondVision)
|4523|    |-	{
|    |4523|+	
|4524|4524| 		if (!this.CheckTargetIsInVisionRange(target))
|4525|4525| 			return true;
|4526|    |-	}
|    |4526|+	
|4527|4527| 
|4528|4528| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4529|4529| 	// 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
|4546|4546| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4547|4547| 	if (this.isGuardOf)
|4548|4548| 	{
|4549|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4549|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4550|4550| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4551|4551| 		if (cmpUnitAI && cmpAttack &&
|4552|4552| 		    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
|4559|4559| 	return false;
|4560|4560| };
|4561|4561| 
|4562|    |-//// External interface functions ////
|    |4562|+// // External interface functions ////
|4563|4563| 
|4564|4564| UnitAI.prototype.SetFormationController = function(ent)
|4565|4565| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4569|4569| 	// of our own formation (or ourself if not in formation)
|4570|4570| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4571|4571| 	if (cmpObstruction)
|4572|    |-	{
|    |4572|+	
|4573|4573| 		if (ent == INVALID_ENTITY)
|4574|4574| 			cmpObstruction.SetControlGroup(this.entity);
|4575|4575| 		else
|4576|4576| 			cmpObstruction.SetControlGroup(ent);
|4577|    |-	}
|    |4577|+	
|4578|4578| 
|4579|4579| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4580|4580| 	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
|4712|4712| 	// if we already had an old guard order, do nothing if the target is the same
|4713|4713| 	// and the order is running, otherwise remove the previous order
|4714|4714| 	if (this.isGuardOf)
|4715|    |-	{
|    |4715|+	
|4716|4716| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4717|4717| 			return;
|4718|4718| 		else
|4719|4719| 			this.RemoveGuard();
|4720|    |-	}
|    |4720|+	
|4721|4721| 
|4722|4722| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4723|4723| };
|    | [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
|4715|4715| 	{
|4716|4716| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4717|4717| 			return;
|4718|    |-		else
|4719|    |-			this.RemoveGuard();
|    |4718|+		this.RemoveGuard();
|4720|4719| 	}
|4721|4720| 
|4722|4721| 	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
|4886|4886| 			this.WalkToTarget(target, queued);
|4887|4887| 		return;
|4888|4888| 	}
|4889|    |-	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture}, queued);
|    |4889|+	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture }, queued);
|4890|4890| };
|4891|4891| 
|4892|4892| /**
|    | [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
|5035|5035| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5036|5036| 	{
|5037|5037| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5038|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5038|+		if (cmpTrader.HasBothMarkets() &&
|5039|5039| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5040|5040| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5041|5041| 		{
|    | [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
|5316|5316| 				{
|5317|5317| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5318|5318| 					var targetClasses = this.order.data.targetClasses;
|5319|    |-					if (targetClasses.attack && cmpIdentity
|5320|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5319|+					if (targetClasses.attack && cmpIdentity &&
|    |5320|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5321|5321| 						continue;
|5322|5322| 					if (targetClasses.avoid && cmpIdentity
|5323|5323| 						&& 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
|5319|5319| 					if (targetClasses.attack && cmpIdentity
|5320|5320| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5321|5321| 						continue;
|5322|    |-					if (targetClasses.avoid && cmpIdentity
|5323|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5322|+					if (targetClasses.avoid && cmpIdentity &&
|    |5323|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5324|5324| 						continue;
|5325|5325| 					// Only used by the AIs to prevent some choices of targets
|5326|5326| 					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
|5342|5342| 		{
|5343|5343| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5344|5344| 			var targetClasses = this.order.data.targetClasses;
|5345|    |-			if (cmpIdentity && targetClasses.attack
|5346|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5345|+			if (cmpIdentity && targetClasses.attack &&
|    |5346|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5347|5347| 				continue;
|5348|5348| 			if (cmpIdentity && targetClasses.avoid
|5349|5349| 				&& 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
|5345|5345| 			if (cmpIdentity && targetClasses.attack
|5346|5346| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5347|5347| 				continue;
|5348|    |-			if (cmpIdentity && targetClasses.avoid
|5349|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5348|+			if (cmpIdentity && targetClasses.avoid &&
|    |5349|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5350|5350| 				continue;
|5351|5351| 			// Only used by the AIs to prevent some choices of targets
|5352|5352| 			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
|5488|5488| 
|5489|5489| UnitAI.prototype.SetHeldPosition = function(x, z)
|5490|5490| {
|5491|    |-	this.heldPosition = {"x": x, "z": z};
|    |5491|+	this.heldPosition = { "x": x, "z": z};
|5492|5492| };
|5493|5493| 
|5494|5494| 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
|5488|5488| 
|5489|5489| UnitAI.prototype.SetHeldPosition = function(x, z)
|5490|5490| {
|5491|    |-	this.heldPosition = {"x": x, "z": z};
|    |5491|+	this.heldPosition = {"x": x, "z": z };
|5492|5492| };
|5493|5493| 
|5494|5494| 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
|5515|5515| 	return false;
|5516|5516| };
|5517|5517| 
|5518|    |-//// Helper functions ////
|    |5518|+// // Helper functions ////
|5519|5519| 
|5520|5520| UnitAI.prototype.CanAttack = function(target)
|5521|5521| {
|    | [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
|5719|5719| 	return cmpPack && cmpPack.IsPacking();
|5720|5720| };
|5721|5721| 
|5722|    |-//// Formation specific functions ////
|    |5722|+// // Formation specific functions ////
|5723|5723| 
|5724|5724| UnitAI.prototype.IsAttackingAsFormation = function()
|5725|5725| {
|    | [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
|5724|5724| UnitAI.prototype.IsAttackingAsFormation = function()
|5725|5725| {
|5726|5726| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5727|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5728|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5727|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5728|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5729|5729| };
|5730|5730| 
|5731|5731| //// 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
|5728|5728| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5729|5729| };
|5730|5730| 
|5731|    |-//// Animal specific functions ////
|    |5731|+// // Animal specific functions ////
|5732|5732| 
|5733|5733| UnitAI.prototype.MoveRandomly = function(distance)
|5734|5734| {

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

binaries/data/mods/public/simulation/components/UnitAI.js
| 886| »   »   »   "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
| 908| »   »   »   "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
| 955| »   »   »   »   »   return·true;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'enter' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
|1018| »   »   »   »   "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
|1053| »   »   »   "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
|1085| »   »   »   »   "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
|1299| »   »   »   "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
|1485| »   »   »   "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
|1506| »   »   »   "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
|1536| »   »   »   "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
|1691| »   »   »   "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
|1742| »   »   »   »   "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
|1812| »   »   »   »   »   »   »   return·true;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'enter' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
|1980| »   »   »   »   "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
|2070| »   »   »   »   "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
|2239| »   »   »   »   »   »   let·nearby·=·this.FindNearestDropsite(resourceType.generic);
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'nearby' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|2294| »   »   »   »   "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
|2412| »   »   »   »   "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
|2477| »   »   »   »   "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
|2517| »   »   »   »   "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
|2721| »   »   »   »   "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
|3618| »   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
|4426| »   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
|4441| »   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
|4487| »   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
|4510| »   »   ····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
|4966| »   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
| 354| »   »   ····&&·(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
|1836| »   »   »   »   »   »   var·cmpFormation·=·Engine.QueryInterface(this.formationController,·IID_Formation);
|    | [NORMAL] JSHintBear:
|    | 'cmpFormation' is already defined.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4197| »   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
|4275| »   »   »   &&·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
|4443| »   »   &&·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
|4444| »   »   &&·(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
|4966| »   var·lastPos·=·undefined;
|    | [NORMAL] JSHintBear:
|    | It's not necessary to initialize 'lastPos' to 'undefined'.

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

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

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

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

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|5728| »   »   &&·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/differential/1731/display/redirect

Relevant discussion starts here: https://wildfiregames.com/forum/index.php?/topic/24587-wows-and-wow-jrs-awesome-gameplay-wishes/&tab=comments#comment-358266

I find myself agreeing that our current cheering is kind of crap. Only cheering when the unit was fighting, and returns to idle, and there are no enemies around might work better (without the invulnerability).

Angen planned changes to this revision.Jun 15 2019, 9:09 PM

cheering after won combat, removing cheering on promotion

Angen updated this revision to Diff 8503.Jun 16 2019, 10:27 AM
Angen edited the summary of this revision. (Show Details)
Angen edited the test plan for this revision. (Show Details)
Angen updated this revision to Diff 8504.EditedJun 16 2019, 10:31 AM

forgot to remove part of condition related to cheering at line 3235

Overall I like this. It cleans up UnitAI nicely too. I've tested it quickly and it works OK in some cases, weirdly in others (check out combat demo).

What we should probably change:

  • Units that get fired upon by archers might still cheer if they kill an enemy.
  • Should probably happen in leave, not in timer.

Things I'm wondering:

  • should we try to get units close to us to cheer too? In a large-scale battles, not all units would be fighting when the last enemy dies.

Possibly you want a Cheering state that waits for a bit to make sure there's no enemy before actually cheering to fix the archer thing above - or it's possible to handle right now, not sure.

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

Think you want this to be in the "leave" call, if we don't have a next order or something like that, rather.

3728

I think you can clear these two comments and just say something like Packing/Unpacking shouldn't be replaced unless we're explicitly doing that or something.

3823–3824

this comment can be changed too.

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
| 352| 352| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 353| 353| 		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 354| 354| 		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 355|    |-		{
|    | 355|+		
| 356| 356| 			// we were already on the shoreline, and have not moved since
| 357| 357| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
| 358| 358| 				needToMove = false;
| 359|    |-		}
|    | 359|+		
| 360| 360| 
| 361| 361| 		if (needToMove)
| 362| 362| 			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
| 350| 350| 		// Check if we need to move     TODO implement a better way to know if we are on the shoreline
| 351| 351| 		var needToMove = true;
| 352| 352| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 353|    |-		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 354|    |-		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
|    | 353|+		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x) &&
|    | 354|+		    (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 355| 355| 		{
| 356| 356| 			// we were already on the shoreline, and have not moved since
| 357| 357| 			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
| 515| 515| 					this.PushOrderFront("Walk", this.order.data.lastPos);
| 516| 516| 				}
| 517| 517| 				else
| 518|    |-				{
|    | 518|+				
| 519| 519| 					// We couldn't move there, or the target moved away
| 520| 520| 					this.FinishOrder();
| 521|    |-				}
|    | 521|+				
| 522| 522| 				return;
| 523| 523| 			}
| 524| 524| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 730| 730| 			}
| 731| 731| 			// Check if we are already in range, otherwise walk there
| 732| 732| 			if (!this.CheckGarrisonRange(msg.data.target))
| 733|    |-			{
|    | 733|+			
| 734| 734| 				if (!this.CheckTargetVisible(msg.data.target))
| 735| 735| 				{
| 736| 736| 					this.FinishOrder();
| 741| 741| 					this.SetNextState("GARRISON.APPROACHING");
| 742| 742| 					return;
| 743| 743| 				}
| 744|    |-			}
|    | 744|+			
| 745| 745| 
| 746| 746| 			this.SetNextState("GARRISON.GARRISONING");
| 747| 747| 		},
|    | [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
| 736| 736| 					this.FinishOrder();
| 737| 737| 					return;
| 738| 738| 				}
| 739|    |-				else
| 740|    |-				{
|    | 739|+				
| 741| 740| 					this.SetNextState("GARRISON.APPROACHING");
| 742| 741| 					return;
| 743|    |-				}
|    | 742|+				
| 744| 743| 			}
| 745| 744| 
| 746| 745| 			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
| 759| 759| 						this.PushOrderFront("Walk", msg.data.lastPos);
| 760| 760| 					}
| 761| 761| 					else
| 762|    |-					{
|    | 762|+					
| 763| 763| 						// We couldn't move there, or the target moved away
| 764| 764| 						this.FinishOrder();
| 765|    |-					}
|    | 765|+					
| 766| 766| 					return;
| 767| 767| 				}
| 768| 768| 
|    | [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
| 992| 992| 			},
| 993| 993| 		},
| 994| 994| 
| 995|    |-		"GARRISON":{
|    | 995|+		"GARRISON": {
| 996| 996| 			"enter": function() {
| 997| 997| 				// If the garrisonholder should pickup, warn it so it can take needed action
| 998| 998| 				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
|1205|1205| 			// If the controller handled an order but some members rejected it,
|1206|1206| 			// they will have no orders and be in the FORMATIONMEMBER.IDLE state.
|1207|1207| 			if (this.orderQueue.length)
|1208|    |-			{
|    |1208|+			
|1209|1209| 				// We're leaving the formation, so stop our FormationWalk order
|1210|1210| 				if (this.FinishOrder())
|1211|1211| 					return;
|1212|    |-			}
|    |1212|+			
|1213|1213| 
|1214|1214| 			// No orders left, we're an individual now
|1215|1215| 			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
|1233|1233| 			// Move a tile outside the building
|1234|1234| 			let range = 4;
|1235|1235| 			if (this.CheckTargetRangeExplicit(msg.data.target, range, range))
|1236|    |-			{
|    |1236|+			
|1237|1237| 				// We are already at the target, or can't move at all
|1238|1238| 				this.FinishOrder();
|1239|    |-			}
|    |1239|+			
|1240|1240| 			else
|1241|1241| 			{
|1242|1242| 				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
|1454|1454| 
|1455|1455| 			"LosRangeUpdate": function(msg) {
|1456|1456| 				if (this.GetStance().targetVisibleEnemies)
|1457|    |-				{
|    |1457|+				
|1458|1458| 					// Start attacking one of the newly-seen enemy (if any)
|1459|1459| 					this.AttackEntitiesByPreference(msg.data.added);
|1460|    |-				}
|    |1460|+				
|1461|1461| 			},
|1462|1462| 
|1463|1463| 			"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
|1487|1487| 				this.SelectAnimation("move");
|1488|1488| 			},
|1489|1489| 
|1490|    |-			"leave": function () {
|    |1490|+			"leave": function() {
|1491|1491| 				this.SelectAnimation("idle");
|1492|1492| 				this.StopMoving();
|1493|1493| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1667|1667| 						// if nothing better to do, check if the guarded needs to be healed or repaired
|1668|1668| 						var cmpHealth = Engine.QueryInterface(this.isGuardOf, IID_Health);
|1669|1669| 						if (cmpHealth && cmpHealth.IsInjured())
|1670|    |-						{
|    |1670|+						
|1671|1671| 							if (this.CanHeal(this.isGuardOf))
|1672|1672| 								this.PushOrderFront("Heal", { "target": this.isGuardOf, "force": false });
|1673|1673| 							else if (this.CanRepair(this.isGuardOf))
|1674|1674| 								this.PushOrderFront("Repair", { "target": this.isGuardOf, "autocontinue": false, "force": false });
|1675|    |-						}
|    |1675|+						
|1676|1676| 					}
|1677|1677| 				},
|1678|1678| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1794|1794| 					}
|1795|1795| 					// Check the target is still alive and attackable
|1796|1796| 					if (this.CanAttack(target) && !this.CheckTargetAttackRange(target, this.order.data.attackType))
|1797|    |-					{
|    |1797|+					
|1798|1798| 						// Can't reach it - try to chase after it
|1799|1799| 						if (this.ShouldChaseTargetedEntity(target, this.order.data.force))
|1800|1800| 						{
|1807|1807| 							this.SetNextState("COMBAT.CHASING");
|1808|1808| 							return true;
|1809|1809| 						}
|1810|    |-					}
|    |1810|+					
|1811|1811| 
|1812|1812| 					this.StopMoving();
|1813|1813| 
|    | [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
|1840|1840| 					// TODO: we should probably only bother syncing projectile attacks, not melee
|1841|1841| 
|1842|1842| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|1843|    |-					this.resyncAnimation = (prepare != this.attackTimers.prepare) ? true : false;
|    |1843|+					this.resyncAnimation = (prepare != this.attackTimers.prepare);
|1844|1844| 
|1845|1845| 					this.FaceTowardsTarget(this.order.data.target);
|1846|1846| 
|    | [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
|1968|1968| 
|1969|1969| 				"Attacked": function(msg) {
|1970|1970| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|1971|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|1972|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |1971|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |1972|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|1973|1973| 						this.RespondToTargetedEntities([msg.data.attacker]);
|1974|1974| 				},
|1975|1975| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1988|1988| 					this.SelectAnimation("move");
|1989|1989| 					var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|1990|1990| 					if (cmpUnitAI && cmpUnitAI.IsFleeing())
|1991|    |-					{
|    |1991|+					
|1992|1992| 						// Run after a fleeing target
|1993|1993| 						this.SetSpeedMultiplier(this.GetRunMultiplier());
|1994|    |-					}
|    |1994|+					
|1995|1995| 					this.StartTimer(1000, 1000);
|1996|1996| 				},
|1997|1997| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2170|2170| 
|2171|2171| 					var cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply);
|2172|2172| 					if (cmpSupply && cmpSupply.IsAvailable(cmpOwnership.GetOwner(), this.entity))
|2173|    |-					{
|    |2173|+					
|2174|2174| 						// Check we can still reach and gather from the target
|2175|2175| 						if (this.CheckTargetRange(this.gatheringTarget, IID_ResourceGatherer) && this.CanGather(this.gatheringTarget))
|2176|2176| 						{
|2221|2221| 								return;
|2222|2222| 							}
|2223|2223| 						}
|2224|    |-					}
|    |2224|+					
|2225|2225| 
|2226|2226| 					// We're already in range, can't get anywhere near it or the target is exhausted.
|2227|2227| 
|    | [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
|2213|2213| 								return;
|2214|2214| 						}
|2215|2215| 						else
|2216|    |-						{
|    |2216|+						
|2217|2217| 							// Try to follow the target
|2218|2218| 							if (this.MoveToTargetRange(this.gatheringTarget, IID_ResourceGatherer))
|2219|2219| 							{
|2220|2220| 								this.SetNextState("APPROACHING");
|2221|2221| 								return;
|2222|2222| 							}
|2223|    |-						}
|    |2223|+						
|2224|2224| 					}
|2225|2225| 
|2226|2226| 					// We're already in range, can't get anywhere near it or the target is exhausted.
|    | [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
|2247|2247| 					// Also don't switch to a different type of huntable animal
|2248|2248| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2249|2249| 						return (
|2250|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2251|    |-							|| (type.specific == resourceType.specific
|    |2250|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2251|+							(type.specific == resourceType.specific
|2252|2252| 							&& (type.specific != "meat" || resourceTemplate == template))
|2253|2253| 						);
|2254|2254| 					});
|    | [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
|2248|2248| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2249|2249| 						return (
|2250|2250| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2251|    |-							|| (type.specific == resourceType.specific
|2252|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2251|+							|| (type.specific == resourceType.specific &&
|    |2252|+							(type.specific != "meat" || resourceTemplate == template))
|2253|2253| 						);
|2254|2254| 					});
|2255|2255| 					if (nearby)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2313|2313| 
|2314|2314| 				"Timer": function(msg) {
|2315|2315| 					if (this.ShouldAbandonChase(this.order.data.target, this.order.data.force, IID_Heal, null))
|2316|    |-					{
|    |2316|+					
|2317|2317| 						// Return to our original position unless we have a better order.
|2318|2318| 						if (!this.FinishOrder() && this.GetStance().respondHoldGround)
|2319|2319| 							this.WalkToHeldPosition();
|2320|    |-					}
|    |2320|+					
|2321|2321| 				},
|2322|2322| 
|2323|2323| 				"MovementUpdate": 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
|2347|2347| 					this.StartTimer(prepare, this.healTimers.repeat);
|2348|2348| 
|2349|2349| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2350|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2350|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2351|2351| 
|2352|2352| 					this.FaceTowardsTarget(this.order.data.target);
|2353|2353| 				},
|    | [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
|2560|2560| 					{
|2561|2561| 						// The building was already finished/fully repaired before we arrived;
|2562|2562| 						// let the ConstructionFinished handler handle this.
|2563|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2563|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2564|2564| 						return true;
|2565|2565| 					}
|2566|2566| 
|    | [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
|2560|2560| 					{
|2561|2561| 						// The building was already finished/fully repaired before we arrived;
|2562|2562| 						// let the ConstructionFinished handler handle this.
|2563|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2563|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2564|2564| 						return true;
|2565|2565| 					}
|2566|2566| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2687|2687| 
|2688|2688| 				// Unit was approaching and there's nothing to do now, so switch to walking
|2689|2689| 				if (oldState === "INDIVIDUAL.REPAIR.APPROACHING")
|2690|    |-				{
|    |2690|+				
|2691|2691| 					// We're already walking to the given point, so add this as a order.
|2692|2692| 					this.WalkToTarget(msg.data.newentity, true);
|2693|    |-				}
|    |2693|+				
|2694|2694| 			},
|2695|2695| 		},
|2696|2696| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2750|2750| 
|2751|2751| 					// Check that we can garrison here
|2752|2752| 					if (this.CanGarrison(target))
|2753|    |-					{
|    |2753|+					
|2754|2754| 						// Check that we're in range of the garrison target
|2755|2755| 						if (this.CheckGarrisonRange(target))
|2756|2756| 						{
|2826|2826| 								return false;
|2827|2827| 							}
|2828|2828| 						}
|2829|    |-					}
|    |2829|+					
|2830|2830| 					// Garrisoning failed for some reason, so finish the order
|2831|2831| 					this.FinishOrder();
|2832|2832| 					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
|2943|2943| 		"Attacked": function(msg) {
|2944|2944| 			if (this.template.NaturalBehaviour == "skittish" ||
|2945|2945| 			    this.template.NaturalBehaviour == "passive")
|2946|    |-			{
|    |2946|+			
|2947|2947| 				this.Flee(msg.data.attacker, false);
|2948|    |-			}
|    |2948|+			
|2949|2949| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|2950|2950| 			{
|2951|2951| 				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
|2952|2952| 					this.Attack(msg.data.attacker, false);
|2953|2953| 			}
|2954|2954| 			else if (this.template.NaturalBehaviour == "domestic")
|2955|    |-			{
|    |2955|+			
|2956|2956| 				// Never flee, stop what we were doing
|2957|2957| 				this.SetNextState("IDLE");
|2958|    |-			}
|    |2958|+			
|2959|2959| 		},
|2960|2960| 
|2961|2961| 		"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
|2966|2966| 				this.FinishOrder();
|2967|2967| 				return;
|2968|2968| 			}
|2969|    |-			else
|2970|    |-			{
|    |2969|+			
|2971|2970| 				this.order.data.min = range;
|2972|2971| 				this.SetNextState("WALKING");
|2973|    |-			}
|    |2972|+			
|2974|2973| 		},
|2975|2974| 
|2976|2975| 		"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
|3010|3010| 				}
|3011|3011| 				// Start attacking one of the newly-seen enemy (if any)
|3012|3012| 				else if (this.IsDangerousAnimal())
|3013|    |-				{
|    |3013|+				
|3014|3014| 					this.AttackVisibleEntity(msg.data.added);
|3015|    |-				}
|    |3015|+				
|3016|3016| 
|3017|3017| 				// TODO: if two units enter our range together, we'll attack the
|3018|3018| 				// 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
|3053|3053| 				}
|3054|3054| 				// Start attacking one of the newly-seen enemy (if any)
|3055|3055| 				else if (this.template.NaturalBehaviour == "violent")
|3056|    |-				{
|    |3056|+				
|3057|3057| 					this.AttackVisibleEntity(msg.data.added);
|3058|    |-				}
|    |3058|+				
|3059|3059| 			},
|3060|3060| 
|3061|3061| 			"Timer": function(msg) {
|    | [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
|3068|3068| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3069|3069| 
|3070|3070| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3071|    |-							// only used for domestic animals
|    |3071|+		// only used for domestic animals
|3072|3072| 	},
|3073|3073| };
|3074|3074| 
|    | [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
|3125|3125| 
|3126|3126| UnitAI.prototype.IsAnimal = function()
|3127|3127| {
|3128|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3128|+	return (!!this.template.NaturalBehaviour);
|3129|3129| };
|3130|3130| 
|3131|3131| 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
|3163|3163| UnitAI.prototype.GetGarrisonHolder = function()
|3164|3164| {
|3165|3165| 	if (this.IsGarrisoned())
|3166|    |-	{
|    |3166|+	
|3167|3167| 		for (let order of this.orderQueue)
|3168|3168| 			if (order.type == "Garrison")
|3169|3169| 				return order.data.target;
|3170|    |-	}
|    |3170|+	
|3171|3171| 	return INVALID_ENTITY;
|3172|3172| };
|3173|3173| 
|    | [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
|3241|3241| 		{
|3242|3242| 			let index = this.GetCurrentState().indexOf(".");
|3243|3243| 			if (index != -1)
|3244|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3244|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3245|3245| 			this.Stop(false);
|3246|3246| 		}
|3247|3247| 
|    | [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
|3297|3297| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3298|3298| 			continue;
|3299|3299| 		if (i == 0)
|3300|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3300|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3301|3301| 		else
|3302|3302| 			this.orderQueue.splice(i, 1);
|3303|3303| 		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
|3297|3297| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3298|3298| 			continue;
|3299|3299| 		if (i == 0)
|3300|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3300|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3301|3301| 		else
|3302|3302| 			this.orderQueue.splice(i, 1);
|3303|3303| 		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
|3381|3381| };
|3382|3382| 
|3383|3383| 
|3384|    |-//// FSM linkage functions ////
|    |3384|+// // FSM linkage functions ////
|3385|3385| 
|3386|3386| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3387|3387| 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
|3547|3547| 				continue;
|3548|3548| 			if (this.orderQueue[i].type == type)
|3549|3549| 				continue;
|3550|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3550|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3551|3551| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3552|3552| 			return;
|3553|3553| 		}
|    | [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
|3547|3547| 				continue;
|3548|3548| 			if (this.orderQueue[i].type == type)
|3549|3549| 				continue;
|3550|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3550|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3551|3551| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3552|3552| 			return;
|3553|3553| 		}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3561|3561| {
|3562|3562| 	// Remember the previous work orders to be able to go back to them later if required
|3563|3563| 	if (data && data.force)
|3564|    |-	{
|    |3564|+	
|3565|3565| 		if (this.IsFormationController())
|3566|3566| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3567|3567| 		else
|3568|3568| 			this.UpdateWorkOrders(type);
|3569|    |-	}
|    |3569|+	
|3570|3570| 
|3571|3571| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3572|3572| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3631|3631| 	{
|3632|3632| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3633|3633| 		if (cmpUnitAI)
|3634|    |-		{
|    |3634|+		
|3635|3635| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3636|3636| 			{
|3637|3637| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3640|3640| 					return;
|3641|3641| 				}
|3642|3642| 			}
|3643|    |-		}
|    |3643|+		
|3644|3644| 	}
|3645|3645| 
|3646|3646| 	// 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
|3633|3633| 		if (cmpUnitAI)
|3634|3634| 		{
|3635|3635| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3636|    |-			{
|    |3636|+			
|3637|3637| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3638|3638| 				{
|3639|3639| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3640|3640| 					return;
|3641|3641| 				}
|3642|    |-			}
|    |3642|+			
|3643|3643| 		}
|3644|3644| 	}
|3645|3645| 
|    | [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
|3645|3645| 
|3646|3646| 	// If nothing found, take the unit orders
|3647|3647| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3648|    |-	{
|    |3648|+	
|3649|3649| 		if (isWorkType(this.orderQueue[i].type))
|3650|3650| 		{
|3651|3651| 			this.workOrders = this.orderQueue.slice(i);
|3652|3652| 			return;
|3653|3653| 		}
|3654|    |-	}
|    |3654|+	
|3655|3655| };
|3656|3656| 
|3657|3657| 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
|3705|3705| 	if (data.timerRepeat === undefined)
|3706|3706| 		this.timer = undefined;
|3707|3707| 
|3708|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3708|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3709|3709| };
|3710|3710| 
|3711|3711| /**
|    | [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
|3705|3705| 	if (data.timerRepeat === undefined)
|3706|3706| 		this.timer = undefined;
|3707|3707| 
|3708|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3708|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3709|3709| };
|3710|3710| 
|3711|3711| /**
|    | [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
|3740|3740| 	this.timer = undefined;
|3741|3741| };
|3742|3742| 
|3743|    |-//// Message handlers /////
|    |3743|+// // Message handlers /////
|3744|3744| 
|3745|3745| UnitAI.prototype.OnMotionChanged = function(msg)
|3746|3746| {
|    | [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
|3752|3752| 	// TODO: This is a bit inefficient since every unit listens to every
|3753|3753| 	// construction message - ideally we could scope it to only the one we're building
|3754|3754| 
|3755|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3755|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3756|3756| };
|3757|3757| 
|3758|3758| 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
|3752|3752| 	// TODO: This is a bit inefficient since every unit listens to every
|3753|3753| 	// construction message - ideally we could scope it to only the one we're building
|3754|3754| 
|3755|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3755|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3756|3756| };
|3757|3757| 
|3758|3758| 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
|3777|3777| 
|3778|3778| UnitAI.prototype.OnAttacked = function(msg)
|3779|3779| {
|3780|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3780|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3781|3781| };
|3782|3782| 
|3783|3783| 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
|3777|3777| 
|3778|3778| UnitAI.prototype.OnAttacked = function(msg)
|3779|3779| {
|3780|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3780|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3781|3781| };
|3782|3782| 
|3783|3783| 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
|3782|3782| 
|3783|3783| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3784|3784| {
|3785|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3785|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|3786|3786| };
|3787|3787| 
|3788|3788| 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
|3782|3782| 
|3783|3783| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3784|3784| {
|3785|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3785|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|3786|3786| };
|3787|3787| 
|3788|3788| 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
|3787|3787| 
|3788|3788| UnitAI.prototype.OnHealthChanged = function(msg)
|3789|3789| {
|3790|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3790|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|3791|3791| };
|3792|3792| 
|3793|3793| 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
|3787|3787| 
|3788|3788| UnitAI.prototype.OnHealthChanged = function(msg)
|3789|3789| {
|3790|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3790|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|3791|3791| };
|3792|3792| 
|3793|3793| 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
|3793|3793| UnitAI.prototype.OnRangeUpdate = function(msg)
|3794|3794| {
|3795|3795| 	if (msg.tag == this.losRangeQuery)
|3796|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3796|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|3797|3797| 	else if (msg.tag == this.losHealRangeQuery)
|3798|3798| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3799|3799| };
|    | [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
|3793|3793| UnitAI.prototype.OnRangeUpdate = function(msg)
|3794|3794| {
|3795|3795| 	if (msg.tag == this.losRangeQuery)
|3796|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3796|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|3797|3797| 	else if (msg.tag == this.losHealRangeQuery)
|3798|3798| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3799|3799| };
|    | [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
|3795|3795| 	if (msg.tag == this.losRangeQuery)
|3796|3796| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3797|3797| 	else if (msg.tag == this.losHealRangeQuery)
|3798|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3798|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|3799|3799| };
|3800|3800| 
|3801|3801| 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
|3795|3795| 	if (msg.tag == this.losRangeQuery)
|3796|3796| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3797|3797| 	else if (msg.tag == this.losHealRangeQuery)
|3798|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3798|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|3799|3799| };
|3800|3800| 
|3801|3801| 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
|3800|3800| 
|3801|3801| UnitAI.prototype.OnPackFinished = function(msg)
|3802|3802| {
|3803|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3803|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|3804|3804| };
|3805|3805| 
|3806|3806| //// 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
|3800|3800| 
|3801|3801| UnitAI.prototype.OnPackFinished = function(msg)
|3802|3802| {
|3803|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3803|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|3804|3804| };
|3805|3805| 
|3806|3806| //// 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
|3803|3803| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|3804|3804| };
|3805|3805| 
|3806|    |-//// Helper functions to be called by the FSM ////
|    |3806|+// // Helper functions to be called by the FSM ////
|3807|3807| 
|3808|3808| UnitAI.prototype.GetWalkSpeed = function()
|3809|3809| {
|    | [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
|3905|3905| 	if (!cmpOwnership || cmpOwnership.GetOwner() == INVALID_PLAYER)
|3906|3906| 		return undefined;
|3907|3907| 
|3908|    |-	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position)
|    |3908|+	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
|3909|3909| 	if (!cmpPosition || !cmpPosition.IsInWorld())
|3910|3910| 		return undefined;
|3911|3911| 
|    | [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
|3990|3990| 			PlaySound(name, member);
|3991|3991| 	}
|3992|3992| 	else
|3993|    |-	{
|    |3993|+	
|3994|3994| 		// Otherwise use our own sounds
|3995|3995| 		PlaySound(name, this.entity);
|3996|    |-	}
|    |3996|+	
|3997|3997| };
|3998|3998| 
|3999|3999| /*
|    | [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
|4182|4182| 	else
|4183|4183| 		// return false? Or hope you come close enough?
|4184|4184| 		var parabolicMaxRange = 0;
|4185|    |-		//return false;
|    |4185|+		// return false;
|4186|4186| 
|4187|4187| 	// the parabole changes while walking, take something in the middle
|4188|4188| 	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
|4269|4269| 	if (this.IsFormationMember())
|4270|4270| 	{
|4271|4271| 		var cmpFormationUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|4272|    |-		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation()
|4273|    |-			&& cmpFormationUnitAI.order.data.target == target)
|    |4272|+		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation() &&
|    |4273|+			cmpFormationUnitAI.order.data.target == target)
|4274|4274| 			return true;
|4275|4275| 	}
|4276|4276| 
|    | [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
|4437|4437| UnitAI.prototype.AttackEntityInZone = function(ents)
|4438|4438| {
|4439|4439| 	var target = ents.find(target =>
|4440|    |-		this.CanAttack(target)
|4441|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4440|+		this.CanAttack(target) &&
|    |4441|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4442|4442| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4443|4443| 	);
|4444|4444| 	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
|4438|4438| {
|4439|4439| 	var target = ents.find(target =>
|4440|4440| 		this.CanAttack(target)
|4441|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4442|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4441|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4442|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4443|4443| 	);
|4444|4444| 	if (!target)
|4445|4445| 		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
|4502|4502| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4503|4503| 	if (this.isGuardOf)
|4504|4504| 	{
|4505|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4505|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4506|4506| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4507|4507| 		if (cmpUnitAI && cmpAttack &&
|4508|4508| 		    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
|4506|4506| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4507|4507| 		if (cmpUnitAI && cmpAttack &&
|4508|4508| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4509|    |-				return false;
|    |4509|+			return false;
|4510|4510| 	}
|4511|4511| 
|4512|4512| 	// 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
|4511|4511| 
|4512|4512| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4513|4513| 	if (this.GetStance().respondHoldGround)
|4514|    |-	{
|    |4514|+	
|4515|4515| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4516|4516| 			return true;
|4517|    |-	}
|    |4517|+	
|4518|4518| 
|4519|4519| 	// Stop if it's left our vision range, unless we're especially persistent
|4520|4520| 	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
|4518|4518| 
|4519|4519| 	// Stop if it's left our vision range, unless we're especially persistent
|4520|4520| 	if (!this.GetStance().respondChaseBeyondVision)
|4521|    |-	{
|    |4521|+	
|4522|4522| 		if (!this.CheckTargetIsInVisionRange(target))
|4523|4523| 			return true;
|4524|    |-	}
|    |4524|+	
|4525|4525| 
|4526|4526| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4527|4527| 	// 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
|4544|4544| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4545|4545| 	if (this.isGuardOf)
|4546|4546| 	{
|4547|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4547|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4548|4548| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4549|4549| 		if (cmpUnitAI && cmpAttack &&
|4550|4550| 		    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
|4557|4557| 	return false;
|4558|4558| };
|4559|4559| 
|4560|    |-//// External interface functions ////
|    |4560|+// // External interface functions ////
|4561|4561| 
|4562|4562| UnitAI.prototype.SetFormationController = function(ent)
|4563|4563| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4567|4567| 	// of our own formation (or ourself if not in formation)
|4568|4568| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4569|4569| 	if (cmpObstruction)
|4570|    |-	{
|    |4570|+	
|4571|4571| 		if (ent == INVALID_ENTITY)
|4572|4572| 			cmpObstruction.SetControlGroup(this.entity);
|4573|4573| 		else
|4574|4574| 			cmpObstruction.SetControlGroup(ent);
|4575|    |-	}
|    |4575|+	
|4576|4576| 
|4577|4577| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4578|4578| 	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
|4710|4710| 	// if we already had an old guard order, do nothing if the target is the same
|4711|4711| 	// and the order is running, otherwise remove the previous order
|4712|4712| 	if (this.isGuardOf)
|4713|    |-	{
|    |4713|+	
|4714|4714| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4715|4715| 			return;
|4716|4716| 		else
|4717|4717| 			this.RemoveGuard();
|4718|    |-	}
|    |4718|+	
|4719|4719| 
|4720|4720| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4721|4721| };
|    | [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
|4713|4713| 	{
|4714|4714| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4715|4715| 			return;
|4716|    |-		else
|4717|    |-			this.RemoveGuard();
|    |4716|+		this.RemoveGuard();
|4718|4717| 	}
|4719|4718| 
|4720|4719| 	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
|4884|4884| 			this.WalkToTarget(target, queued);
|4885|4885| 		return;
|4886|4886| 	}
|4887|    |-	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture}, queued);
|    |4887|+	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture }, queued);
|4888|4888| };
|4889|4889| 
|4890|4890| /**
|    | [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
|5033|5033| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5034|5034| 	{
|5035|5035| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5036|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5036|+		if (cmpTrader.HasBothMarkets() &&
|5037|5037| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5038|5038| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5039|5039| 		{
|    | [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
|5314|5314| 				{
|5315|5315| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5316|5316| 					var targetClasses = this.order.data.targetClasses;
|5317|    |-					if (targetClasses.attack && cmpIdentity
|5318|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5317|+					if (targetClasses.attack && cmpIdentity &&
|    |5318|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5319|5319| 						continue;
|5320|5320| 					if (targetClasses.avoid && cmpIdentity
|5321|5321| 						&& 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
|5317|5317| 					if (targetClasses.attack && cmpIdentity
|5318|5318| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5319|5319| 						continue;
|5320|    |-					if (targetClasses.avoid && cmpIdentity
|5321|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5320|+					if (targetClasses.avoid && cmpIdentity &&
|    |5321|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5322|5322| 						continue;
|5323|5323| 					// Only used by the AIs to prevent some choices of targets
|5324|5324| 					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
|5340|5340| 		{
|5341|5341| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5342|5342| 			var targetClasses = this.order.data.targetClasses;
|5343|    |-			if (cmpIdentity && targetClasses.attack
|5344|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5343|+			if (cmpIdentity && targetClasses.attack &&
|    |5344|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5345|5345| 				continue;
|5346|5346| 			if (cmpIdentity && targetClasses.avoid
|5347|5347| 				&& 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
|5343|5343| 			if (cmpIdentity && targetClasses.attack
|5344|5344| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5345|5345| 				continue;
|5346|    |-			if (cmpIdentity && targetClasses.avoid
|5347|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5346|+			if (cmpIdentity && targetClasses.avoid &&
|    |5347|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5348|5348| 				continue;
|5349|5349| 			// Only used by the AIs to prevent some choices of targets
|5350|5350| 			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
|5486|5486| 
|5487|5487| UnitAI.prototype.SetHeldPosition = function(x, z)
|5488|5488| {
|5489|    |-	this.heldPosition = {"x": x, "z": z};
|    |5489|+	this.heldPosition = { "x": x, "z": z};
|5490|5490| };
|5491|5491| 
|5492|5492| 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
|5486|5486| 
|5487|5487| UnitAI.prototype.SetHeldPosition = function(x, z)
|5488|5488| {
|5489|    |-	this.heldPosition = {"x": x, "z": z};
|    |5489|+	this.heldPosition = {"x": x, "z": z };
|5490|5490| };
|5491|5491| 
|5492|5492| 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
|5513|5513| 	return false;
|5514|5514| };
|5515|5515| 
|5516|    |-//// Helper functions ////
|    |5516|+// // Helper functions ////
|5517|5517| 
|5518|5518| UnitAI.prototype.CanAttack = function(target)
|5519|5519| {
|    | [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
|5717|5717| 	return cmpPack && cmpPack.IsPacking();
|5718|5718| };
|5719|5719| 
|5720|    |-//// Formation specific functions ////
|    |5720|+// // Formation specific functions ////
|5721|5721| 
|5722|5722| UnitAI.prototype.IsAttackingAsFormation = function()
|5723|5723| {
|    | [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
|5722|5722| UnitAI.prototype.IsAttackingAsFormation = function()
|5723|5723| {
|5724|5724| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5725|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5726|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5725|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5726|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5727|5727| };
|5728|5728| 
|5729|5729| //// 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
|5726|5726| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5727|5727| };
|5728|5728| 
|5729|    |-//// Animal specific functions ////
|    |5729|+// // Animal specific functions ////
|5730|5730| 
|5731|5731| UnitAI.prototype.MoveRandomly = function(distance)
|5732|5732| {

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

binaries/data/mods/public/simulation/components/UnitAI.js
| 885| »   »   »   "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
| 907| »   »   »   "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
| 954| »   »   »   »   »   return·true;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'enter' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
|1017| »   »   »   »   "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
|1052| »   »   »   "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
|1084| »   »   »   »   "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
|1298| »   »   »   "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
|1481| »   »   »   "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
|1502| »   »   »   "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
|1532| »   »   »   "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
|1687| »   »   »   "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
|1738| »   »   »   »   "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
|1808| »   »   »   »   »   »   »   return·true;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'enter' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
|1978| »   »   »   »   "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
|2068| »   »   »   »   "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
|2237| »   »   »   »   »   »   let·nearby·=·this.FindNearestDropsite(resourceType.generic);
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'nearby' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|2292| »   »   »   »   "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
|2410| »   »   »   »   "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
|2475| »   »   »   »   "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
|2515| »   »   »   »   "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
|2719| »   »   »   »   "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
|2898| »   »   »   »   "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
|3616| »   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
|4424| »   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
|4439| »   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
|4485| »   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
|4508| »   »   ····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
|4964| »   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
| 354| »   »   ····&&·(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
|1832| »   »   »   »   »   »   var·cmpFormation·=·Engine.QueryInterface(this.formationController,·IID_Formation);
|    | [NORMAL] JSHintBear:
|    | 'cmpFormation' is already defined.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4195| »   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
|4273| »   »   »   &&·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
|4441| »   »   &&·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
|4442| »   »   &&·(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
|4964| »   var·lastPos·=·undefined;
|    | [NORMAL] JSHintBear:
|    | It's not necessary to initialize 'lastPos' to 'undefined'.

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

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

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

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

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|5726| »   »   &&·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/differential/1740/display/redirect

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
| 352| 352| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 353| 353| 		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 354| 354| 		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 355|    |-		{
|    | 355|+		
| 356| 356| 			// we were already on the shoreline, and have not moved since
| 357| 357| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
| 358| 358| 				needToMove = false;
| 359|    |-		}
|    | 359|+		
| 360| 360| 
| 361| 361| 		if (needToMove)
| 362| 362| 			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
| 350| 350| 		// Check if we need to move     TODO implement a better way to know if we are on the shoreline
| 351| 351| 		var needToMove = true;
| 352| 352| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 353|    |-		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 354|    |-		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
|    | 353|+		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x) &&
|    | 354|+		    (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 355| 355| 		{
| 356| 356| 			// we were already on the shoreline, and have not moved since
| 357| 357| 			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
| 515| 515| 					this.PushOrderFront("Walk", this.order.data.lastPos);
| 516| 516| 				}
| 517| 517| 				else
| 518|    |-				{
|    | 518|+				
| 519| 519| 					// We couldn't move there, or the target moved away
| 520| 520| 					this.FinishOrder();
| 521|    |-				}
|    | 521|+				
| 522| 522| 				return;
| 523| 523| 			}
| 524| 524| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 730| 730| 			}
| 731| 731| 			// Check if we are already in range, otherwise walk there
| 732| 732| 			if (!this.CheckGarrisonRange(msg.data.target))
| 733|    |-			{
|    | 733|+			
| 734| 734| 				if (!this.CheckTargetVisible(msg.data.target))
| 735| 735| 				{
| 736| 736| 					this.FinishOrder();
| 741| 741| 					this.SetNextState("GARRISON.APPROACHING");
| 742| 742| 					return;
| 743| 743| 				}
| 744|    |-			}
|    | 744|+			
| 745| 745| 
| 746| 746| 			this.SetNextState("GARRISON.GARRISONING");
| 747| 747| 		},
|    | [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
| 736| 736| 					this.FinishOrder();
| 737| 737| 					return;
| 738| 738| 				}
| 739|    |-				else
| 740|    |-				{
|    | 739|+				
| 741| 740| 					this.SetNextState("GARRISON.APPROACHING");
| 742| 741| 					return;
| 743|    |-				}
|    | 742|+				
| 744| 743| 			}
| 745| 744| 
| 746| 745| 			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
| 759| 759| 						this.PushOrderFront("Walk", msg.data.lastPos);
| 760| 760| 					}
| 761| 761| 					else
| 762|    |-					{
|    | 762|+					
| 763| 763| 						// We couldn't move there, or the target moved away
| 764| 764| 						this.FinishOrder();
| 765|    |-					}
|    | 765|+					
| 766| 766| 					return;
| 767| 767| 				}
| 768| 768| 
|    | [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
| 992| 992| 			},
| 993| 993| 		},
| 994| 994| 
| 995|    |-		"GARRISON":{
|    | 995|+		"GARRISON": {
| 996| 996| 			"enter": function() {
| 997| 997| 				// If the garrisonholder should pickup, warn it so it can take needed action
| 998| 998| 				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
|1205|1205| 			// If the controller handled an order but some members rejected it,
|1206|1206| 			// they will have no orders and be in the FORMATIONMEMBER.IDLE state.
|1207|1207| 			if (this.orderQueue.length)
|1208|    |-			{
|    |1208|+			
|1209|1209| 				// We're leaving the formation, so stop our FormationWalk order
|1210|1210| 				if (this.FinishOrder())
|1211|1211| 					return;
|1212|    |-			}
|    |1212|+			
|1213|1213| 
|1214|1214| 			// No orders left, we're an individual now
|1215|1215| 			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
|1233|1233| 			// Move a tile outside the building
|1234|1234| 			let range = 4;
|1235|1235| 			if (this.CheckTargetRangeExplicit(msg.data.target, range, range))
|1236|    |-			{
|    |1236|+			
|1237|1237| 				// We are already at the target, or can't move at all
|1238|1238| 				this.FinishOrder();
|1239|    |-			}
|    |1239|+			
|1240|1240| 			else
|1241|1241| 			{
|1242|1242| 				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
|1454|1454| 
|1455|1455| 			"LosRangeUpdate": function(msg) {
|1456|1456| 				if (this.GetStance().targetVisibleEnemies)
|1457|    |-				{
|    |1457|+				
|1458|1458| 					// Start attacking one of the newly-seen enemy (if any)
|1459|1459| 					this.AttackEntitiesByPreference(msg.data.added);
|1460|    |-				}
|    |1460|+				
|1461|1461| 			},
|1462|1462| 
|1463|1463| 			"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
|1487|1487| 				this.SelectAnimation("move");
|1488|1488| 			},
|1489|1489| 
|1490|    |-			"leave": function () {
|    |1490|+			"leave": function() {
|1491|1491| 				this.SelectAnimation("idle");
|1492|1492| 				this.StopMoving();
|1493|1493| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1667|1667| 						// if nothing better to do, check if the guarded needs to be healed or repaired
|1668|1668| 						var cmpHealth = Engine.QueryInterface(this.isGuardOf, IID_Health);
|1669|1669| 						if (cmpHealth && cmpHealth.IsInjured())
|1670|    |-						{
|    |1670|+						
|1671|1671| 							if (this.CanHeal(this.isGuardOf))
|1672|1672| 								this.PushOrderFront("Heal", { "target": this.isGuardOf, "force": false });
|1673|1673| 							else if (this.CanRepair(this.isGuardOf))
|1674|1674| 								this.PushOrderFront("Repair", { "target": this.isGuardOf, "autocontinue": false, "force": false });
|1675|    |-						}
|    |1675|+						
|1676|1676| 					}
|1677|1677| 				},
|1678|1678| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1794|1794| 					}
|1795|1795| 					// Check the target is still alive and attackable
|1796|1796| 					if (this.CanAttack(target) && !this.CheckTargetAttackRange(target, this.order.data.attackType))
|1797|    |-					{
|    |1797|+					
|1798|1798| 						// Can't reach it - try to chase after it
|1799|1799| 						if (this.ShouldChaseTargetedEntity(target, this.order.data.force))
|1800|1800| 						{
|1807|1807| 							this.SetNextState("COMBAT.CHASING");
|1808|1808| 							return true;
|1809|1809| 						}
|1810|    |-					}
|    |1810|+					
|1811|1811| 
|1812|1812| 					this.StopMoving();
|1813|1813| 
|    | [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
|1840|1840| 					// TODO: we should probably only bother syncing projectile attacks, not melee
|1841|1841| 
|1842|1842| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|1843|    |-					this.resyncAnimation = (prepare != this.attackTimers.prepare) ? true : false;
|    |1843|+					this.resyncAnimation = (prepare != this.attackTimers.prepare);
|1844|1844| 
|1845|1845| 					this.FaceTowardsTarget(this.order.data.target);
|1846|1846| 
|    | [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
|1968|1968| 
|1969|1969| 				"Attacked": function(msg) {
|1970|1970| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|1971|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|1972|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |1971|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |1972|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|1973|1973| 						this.RespondToTargetedEntities([msg.data.attacker]);
|1974|1974| 				},
|1975|1975| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1988|1988| 					this.SelectAnimation("move");
|1989|1989| 					var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|1990|1990| 					if (cmpUnitAI && cmpUnitAI.IsFleeing())
|1991|    |-					{
|    |1991|+					
|1992|1992| 						// Run after a fleeing target
|1993|1993| 						this.SetSpeedMultiplier(this.GetRunMultiplier());
|1994|    |-					}
|    |1994|+					
|1995|1995| 					this.StartTimer(1000, 1000);
|1996|1996| 				},
|1997|1997| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2170|2170| 
|2171|2171| 					var cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply);
|2172|2172| 					if (cmpSupply && cmpSupply.IsAvailable(cmpOwnership.GetOwner(), this.entity))
|2173|    |-					{
|    |2173|+					
|2174|2174| 						// Check we can still reach and gather from the target
|2175|2175| 						if (this.CheckTargetRange(this.gatheringTarget, IID_ResourceGatherer) && this.CanGather(this.gatheringTarget))
|2176|2176| 						{
|2221|2221| 								return;
|2222|2222| 							}
|2223|2223| 						}
|2224|    |-					}
|    |2224|+					
|2225|2225| 
|2226|2226| 					// We're already in range, can't get anywhere near it or the target is exhausted.
|2227|2227| 
|    | [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
|2213|2213| 								return;
|2214|2214| 						}
|2215|2215| 						else
|2216|    |-						{
|    |2216|+						
|2217|2217| 							// Try to follow the target
|2218|2218| 							if (this.MoveToTargetRange(this.gatheringTarget, IID_ResourceGatherer))
|2219|2219| 							{
|2220|2220| 								this.SetNextState("APPROACHING");
|2221|2221| 								return;
|2222|2222| 							}
|2223|    |-						}
|    |2223|+						
|2224|2224| 					}
|2225|2225| 
|2226|2226| 					// We're already in range, can't get anywhere near it or the target is exhausted.
|    | [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
|2247|2247| 					// Also don't switch to a different type of huntable animal
|2248|2248| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2249|2249| 						return (
|2250|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2251|    |-							|| (type.specific == resourceType.specific
|    |2250|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2251|+							(type.specific == resourceType.specific
|2252|2252| 							&& (type.specific != "meat" || resourceTemplate == template))
|2253|2253| 						);
|2254|2254| 					});
|    | [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
|2248|2248| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2249|2249| 						return (
|2250|2250| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2251|    |-							|| (type.specific == resourceType.specific
|2252|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2251|+							|| (type.specific == resourceType.specific &&
|    |2252|+							(type.specific != "meat" || resourceTemplate == template))
|2253|2253| 						);
|2254|2254| 					});
|2255|2255| 					if (nearby)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2313|2313| 
|2314|2314| 				"Timer": function(msg) {
|2315|2315| 					if (this.ShouldAbandonChase(this.order.data.target, this.order.data.force, IID_Heal, null))
|2316|    |-					{
|    |2316|+					
|2317|2317| 						// Return to our original position unless we have a better order.
|2318|2318| 						if (!this.FinishOrder() && this.GetStance().respondHoldGround)
|2319|2319| 							this.WalkToHeldPosition();
|2320|    |-					}
|    |2320|+					
|2321|2321| 				},
|2322|2322| 
|2323|2323| 				"MovementUpdate": 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
|2347|2347| 					this.StartTimer(prepare, this.healTimers.repeat);
|2348|2348| 
|2349|2349| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2350|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2350|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2351|2351| 
|2352|2352| 					this.FaceTowardsTarget(this.order.data.target);
|2353|2353| 				},
|    | [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
|2560|2560| 					{
|2561|2561| 						// The building was already finished/fully repaired before we arrived;
|2562|2562| 						// let the ConstructionFinished handler handle this.
|2563|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2563|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2564|2564| 						return true;
|2565|2565| 					}
|2566|2566| 
|    | [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
|2560|2560| 					{
|2561|2561| 						// The building was already finished/fully repaired before we arrived;
|2562|2562| 						// let the ConstructionFinished handler handle this.
|2563|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2563|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2564|2564| 						return true;
|2565|2565| 					}
|2566|2566| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2687|2687| 
|2688|2688| 				// Unit was approaching and there's nothing to do now, so switch to walking
|2689|2689| 				if (oldState === "INDIVIDUAL.REPAIR.APPROACHING")
|2690|    |-				{
|    |2690|+				
|2691|2691| 					// We're already walking to the given point, so add this as a order.
|2692|2692| 					this.WalkToTarget(msg.data.newentity, true);
|2693|    |-				}
|    |2693|+				
|2694|2694| 			},
|2695|2695| 		},
|2696|2696| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2750|2750| 
|2751|2751| 					// Check that we can garrison here
|2752|2752| 					if (this.CanGarrison(target))
|2753|    |-					{
|    |2753|+					
|2754|2754| 						// Check that we're in range of the garrison target
|2755|2755| 						if (this.CheckGarrisonRange(target))
|2756|2756| 						{
|2826|2826| 								return false;
|2827|2827| 							}
|2828|2828| 						}
|2829|    |-					}
|    |2829|+					
|2830|2830| 					// Garrisoning failed for some reason, so finish the order
|2831|2831| 					this.FinishOrder();
|2832|2832| 					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
|2943|2943| 		"Attacked": function(msg) {
|2944|2944| 			if (this.template.NaturalBehaviour == "skittish" ||
|2945|2945| 			    this.template.NaturalBehaviour == "passive")
|2946|    |-			{
|    |2946|+			
|2947|2947| 				this.Flee(msg.data.attacker, false);
|2948|    |-			}
|    |2948|+			
|2949|2949| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|2950|2950| 			{
|2951|2951| 				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
|2952|2952| 					this.Attack(msg.data.attacker, false);
|2953|2953| 			}
|2954|2954| 			else if (this.template.NaturalBehaviour == "domestic")
|2955|    |-			{
|    |2955|+			
|2956|2956| 				// Never flee, stop what we were doing
|2957|2957| 				this.SetNextState("IDLE");
|2958|    |-			}
|    |2958|+			
|2959|2959| 		},
|2960|2960| 
|2961|2961| 		"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
|2966|2966| 				this.FinishOrder();
|2967|2967| 				return;
|2968|2968| 			}
|2969|    |-			else
|2970|    |-			{
|    |2969|+			
|2971|2970| 				this.order.data.min = range;
|2972|2971| 				this.SetNextState("WALKING");
|2973|    |-			}
|    |2972|+			
|2974|2973| 		},
|2975|2974| 
|2976|2975| 		"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
|3010|3010| 				}
|3011|3011| 				// Start attacking one of the newly-seen enemy (if any)
|3012|3012| 				else if (this.IsDangerousAnimal())
|3013|    |-				{
|    |3013|+				
|3014|3014| 					this.AttackVisibleEntity(msg.data.added);
|3015|    |-				}
|    |3015|+				
|3016|3016| 
|3017|3017| 				// TODO: if two units enter our range together, we'll attack the
|3018|3018| 				// 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
|3053|3053| 				}
|3054|3054| 				// Start attacking one of the newly-seen enemy (if any)
|3055|3055| 				else if (this.template.NaturalBehaviour == "violent")
|3056|    |-				{
|    |3056|+				
|3057|3057| 					this.AttackVisibleEntity(msg.data.added);
|3058|    |-				}
|    |3058|+				
|3059|3059| 			},
|3060|3060| 
|3061|3061| 			"Timer": function(msg) {
|    | [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
|3068|3068| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3069|3069| 
|3070|3070| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3071|    |-							// only used for domestic animals
|    |3071|+		// only used for domestic animals
|3072|3072| 	},
|3073|3073| };
|3074|3074| 
|    | [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
|3125|3125| 
|3126|3126| UnitAI.prototype.IsAnimal = function()
|3127|3127| {
|3128|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3128|+	return (!!this.template.NaturalBehaviour);
|3129|3129| };
|3130|3130| 
|3131|3131| 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
|3163|3163| UnitAI.prototype.GetGarrisonHolder = function()
|3164|3164| {
|3165|3165| 	if (this.IsGarrisoned())
|3166|    |-	{
|    |3166|+	
|3167|3167| 		for (let order of this.orderQueue)
|3168|3168| 			if (order.type == "Garrison")
|3169|3169| 				return order.data.target;
|3170|    |-	}
|    |3170|+	
|3171|3171| 	return INVALID_ENTITY;
|3172|3172| };
|3173|3173| 
|    | [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
|3241|3241| 		{
|3242|3242| 			let index = this.GetCurrentState().indexOf(".");
|3243|3243| 			if (index != -1)
|3244|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3244|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3245|3245| 			this.Stop(false);
|3246|3246| 		}
|3247|3247| 
|    | [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
|3297|3297| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3298|3298| 			continue;
|3299|3299| 		if (i == 0)
|3300|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3300|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3301|3301| 		else
|3302|3302| 			this.orderQueue.splice(i, 1);
|3303|3303| 		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
|3297|3297| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3298|3298| 			continue;
|3299|3299| 		if (i == 0)
|3300|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3300|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3301|3301| 		else
|3302|3302| 			this.orderQueue.splice(i, 1);
|3303|3303| 		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
|3381|3381| };
|3382|3382| 
|3383|3383| 
|3384|    |-//// FSM linkage functions ////
|    |3384|+// // FSM linkage functions ////
|3385|3385| 
|3386|3386| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3387|3387| 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
|3547|3547| 				continue;
|3548|3548| 			if (this.orderQueue[i].type == type)
|3549|3549| 				continue;
|3550|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3550|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3551|3551| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3552|3552| 			return;
|3553|3553| 		}
|    | [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
|3547|3547| 				continue;
|3548|3548| 			if (this.orderQueue[i].type == type)
|3549|3549| 				continue;
|3550|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3550|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3551|3551| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3552|3552| 			return;
|3553|3553| 		}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3561|3561| {
|3562|3562| 	// Remember the previous work orders to be able to go back to them later if required
|3563|3563| 	if (data && data.force)
|3564|    |-	{
|    |3564|+	
|3565|3565| 		if (this.IsFormationController())
|3566|3566| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3567|3567| 		else
|3568|3568| 			this.UpdateWorkOrders(type);
|3569|    |-	}
|    |3569|+	
|3570|3570| 
|3571|3571| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3572|3572| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3631|3631| 	{
|3632|3632| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3633|3633| 		if (cmpUnitAI)
|3634|    |-		{
|    |3634|+		
|3635|3635| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3636|3636| 			{
|3637|3637| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3640|3640| 					return;
|3641|3641| 				}
|3642|3642| 			}
|3643|    |-		}
|    |3643|+		
|3644|3644| 	}
|3645|3645| 
|3646|3646| 	// 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
|3633|3633| 		if (cmpUnitAI)
|3634|3634| 		{
|3635|3635| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3636|    |-			{
|    |3636|+			
|3637|3637| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3638|3638| 				{
|3639|3639| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3640|3640| 					return;
|3641|3641| 				}
|3642|    |-			}
|    |3642|+			
|3643|3643| 		}
|3644|3644| 	}
|3645|3645| 
|    | [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
|3645|3645| 
|3646|3646| 	// If nothing found, take the unit orders
|3647|3647| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3648|    |-	{
|    |3648|+	
|3649|3649| 		if (isWorkType(this.orderQueue[i].type))
|3650|3650| 		{
|3651|3651| 			this.workOrders = this.orderQueue.slice(i);
|3652|3652| 			return;
|3653|3653| 		}
|3654|    |-	}
|    |3654|+	
|3655|3655| };
|3656|3656| 
|3657|3657| 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
|3705|3705| 	if (data.timerRepeat === undefined)
|3706|3706| 		this.timer = undefined;
|3707|3707| 
|3708|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3708|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3709|3709| };
|3710|3710| 
|3711|3711| /**
|    | [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
|3705|3705| 	if (data.timerRepeat === undefined)
|3706|3706| 		this.timer = undefined;
|3707|3707| 
|3708|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3708|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3709|3709| };
|3710|3710| 
|3711|3711| /**
|    | [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
|3740|3740| 	this.timer = undefined;
|3741|3741| };
|3742|3742| 
|3743|    |-//// Message handlers /////
|    |3743|+// // Message handlers /////
|3744|3744| 
|3745|3745| UnitAI.prototype.OnMotionChanged = function(msg)
|3746|3746| {
|    | [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
|3752|3752| 	// TODO: This is a bit inefficient since every unit listens to every
|3753|3753| 	// construction message - ideally we could scope it to only the one we're building
|3754|3754| 
|3755|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3755|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3756|3756| };
|3757|3757| 
|3758|3758| 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
|3752|3752| 	// TODO: This is a bit inefficient since every unit listens to every
|3753|3753| 	// construction message - ideally we could scope it to only the one we're building
|3754|3754| 
|3755|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3755|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3756|3756| };
|3757|3757| 
|3758|3758| 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
|3777|3777| 
|3778|3778| UnitAI.prototype.OnAttacked = function(msg)
|3779|3779| {
|3780|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3780|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3781|3781| };
|3782|3782| 
|3783|3783| 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
|3777|3777| 
|3778|3778| UnitAI.prototype.OnAttacked = function(msg)
|3779|3779| {
|3780|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3780|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3781|3781| };
|3782|3782| 
|3783|3783| 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
|3782|3782| 
|3783|3783| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3784|3784| {
|3785|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3785|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|3786|3786| };
|3787|3787| 
|3788|3788| 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
|3782|3782| 
|3783|3783| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3784|3784| {
|3785|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3785|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|3786|3786| };
|3787|3787| 
|3788|3788| 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
|3787|3787| 
|3788|3788| UnitAI.prototype.OnHealthChanged = function(msg)
|3789|3789| {
|3790|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3790|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|3791|3791| };
|3792|3792| 
|3793|3793| 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
|3787|3787| 
|3788|3788| UnitAI.prototype.OnHealthChanged = function(msg)
|3789|3789| {
|3790|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3790|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|3791|3791| };
|3792|3792| 
|3793|3793| 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
|3793|3793| UnitAI.prototype.OnRangeUpdate = function(msg)
|3794|3794| {
|3795|3795| 	if (msg.tag == this.losRangeQuery)
|3796|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3796|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|3797|3797| 	else if (msg.tag == this.losHealRangeQuery)
|3798|3798| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3799|3799| };
|    | [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
|3793|3793| UnitAI.prototype.OnRangeUpdate = function(msg)
|3794|3794| {
|3795|3795| 	if (msg.tag == this.losRangeQuery)
|3796|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3796|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|3797|3797| 	else if (msg.tag == this.losHealRangeQuery)
|3798|3798| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3799|3799| };
|    | [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
|3795|3795| 	if (msg.tag == this.losRangeQuery)
|3796|3796| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3797|3797| 	else if (msg.tag == this.losHealRangeQuery)
|3798|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3798|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|3799|3799| };
|3800|3800| 
|3801|3801| 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
|3795|3795| 	if (msg.tag == this.losRangeQuery)
|3796|3796| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3797|3797| 	else if (msg.tag == this.losHealRangeQuery)
|3798|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3798|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|3799|3799| };
|3800|3800| 
|3801|3801| 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
|3800|3800| 
|3801|3801| UnitAI.prototype.OnPackFinished = function(msg)
|3802|3802| {
|3803|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3803|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|3804|3804| };
|3805|3805| 
|3806|3806| //// 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
|3800|3800| 
|3801|3801| UnitAI.prototype.OnPackFinished = function(msg)
|3802|3802| {
|3803|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3803|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|3804|3804| };
|3805|3805| 
|3806|3806| //// 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
|3803|3803| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|3804|3804| };
|3805|3805| 
|3806|    |-//// Helper functions to be called by the FSM ////
|    |3806|+// // Helper functions to be called by the FSM ////
|3807|3807| 
|3808|3808| UnitAI.prototype.GetWalkSpeed = function()
|3809|3809| {
|    | [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
|3905|3905| 	if (!cmpOwnership || cmpOwnership.GetOwner() == INVALID_PLAYER)
|3906|3906| 		return undefined;
|3907|3907| 
|3908|    |-	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position)
|    |3908|+	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
|3909|3909| 	if (!cmpPosition || !cmpPosition.IsInWorld())
|3910|3910| 		return undefined;
|3911|3911| 
|    | [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
|3990|3990| 			PlaySound(name, member);
|3991|3991| 	}
|3992|3992| 	else
|3993|    |-	{
|    |3993|+	
|3994|3994| 		// Otherwise use our own sounds
|3995|3995| 		PlaySound(name, this.entity);
|3996|    |-	}
|    |3996|+	
|3997|3997| };
|3998|3998| 
|3999|3999| /*
|    | [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
|4182|4182| 	else
|4183|4183| 		// return false? Or hope you come close enough?
|4184|4184| 		var parabolicMaxRange = 0;
|4185|    |-		//return false;
|    |4185|+		// return false;
|4186|4186| 
|4187|4187| 	// the parabole changes while walking, take something in the middle
|4188|4188| 	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
|4269|4269| 	if (this.IsFormationMember())
|4270|4270| 	{
|4271|4271| 		var cmpFormationUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|4272|    |-		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation()
|4273|    |-			&& cmpFormationUnitAI.order.data.target == target)
|    |4272|+		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation() &&
|    |4273|+			cmpFormationUnitAI.order.data.target == target)
|4274|4274| 			return true;
|4275|4275| 	}
|4276|4276| 
|    | [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
|4437|4437| UnitAI.prototype.AttackEntityInZone = function(ents)
|4438|4438| {
|4439|4439| 	var target = ents.find(target =>
|4440|    |-		this.CanAttack(target)
|4441|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4440|+		this.CanAttack(target) &&
|    |4441|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4442|4442| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4443|4443| 	);
|4444|4444| 	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
|4438|4438| {
|4439|4439| 	var target = ents.find(target =>
|4440|4440| 		this.CanAttack(target)
|4441|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4442|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4441|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4442|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4443|4443| 	);
|4444|4444| 	if (!target)
|4445|4445| 		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
|4502|4502| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4503|4503| 	if (this.isGuardOf)
|4504|4504| 	{
|4505|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4505|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4506|4506| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4507|4507| 		if (cmpUnitAI && cmpAttack &&
|4508|4508| 		    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
|4506|4506| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4507|4507| 		if (cmpUnitAI && cmpAttack &&
|4508|4508| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4509|    |-				return false;
|    |4509|+			return false;
|4510|4510| 	}
|4511|4511| 
|4512|4512| 	// 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
|4511|4511| 
|4512|4512| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4513|4513| 	if (this.GetStance().respondHoldGround)
|4514|    |-	{
|    |4514|+	
|4515|4515| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4516|4516| 			return true;
|4517|    |-	}
|    |4517|+	
|4518|4518| 
|4519|4519| 	// Stop if it's left our vision range, unless we're especially persistent
|4520|4520| 	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
|4518|4518| 
|4519|4519| 	// Stop if it's left our vision range, unless we're especially persistent
|4520|4520| 	if (!this.GetStance().respondChaseBeyondVision)
|4521|    |-	{
|    |4521|+	
|4522|4522| 		if (!this.CheckTargetIsInVisionRange(target))
|4523|4523| 			return true;
|4524|    |-	}
|    |4524|+	
|4525|4525| 
|4526|4526| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4527|4527| 	// 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
|4544|4544| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4545|4545| 	if (this.isGuardOf)
|4546|4546| 	{
|4547|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4547|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4548|4548| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4549|4549| 		if (cmpUnitAI && cmpAttack &&
|4550|4550| 		    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
|4557|4557| 	return false;
|4558|4558| };
|4559|4559| 
|4560|    |-//// External interface functions ////
|    |4560|+// // External interface functions ////
|4561|4561| 
|4562|4562| UnitAI.prototype.SetFormationController = function(ent)
|4563|4563| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4567|4567| 	// of our own formation (or ourself if not in formation)
|4568|4568| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4569|4569| 	if (cmpObstruction)
|4570|    |-	{
|    |4570|+	
|4571|4571| 		if (ent == INVALID_ENTITY)
|4572|4572| 			cmpObstruction.SetControlGroup(this.entity);
|4573|4573| 		else
|4574|4574| 			cmpObstruction.SetControlGroup(ent);
|4575|    |-	}
|    |4575|+	
|4576|4576| 
|4577|4577| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4578|4578| 	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
|4710|4710| 	// if we already had an old guard order, do nothing if the target is the same
|4711|4711| 	// and the order is running, otherwise remove the previous order
|4712|4712| 	if (this.isGuardOf)
|4713|    |-	{
|    |4713|+	
|4714|4714| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4715|4715| 			return;
|4716|4716| 		else
|4717|4717| 			this.RemoveGuard();
|4718|    |-	}
|    |4718|+	
|4719|4719| 
|4720|4720| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4721|4721| };
|    | [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
|4713|4713| 	{
|4714|4714| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4715|4715| 			return;
|4716|    |-		else
|4717|    |-			this.RemoveGuard();
|    |4716|+		this.RemoveGuard();
|4718|4717| 	}
|4719|4718| 
|4720|4719| 	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
|4884|4884| 			this.WalkToTarget(target, queued);
|4885|4885| 		return;
|4886|4886| 	}
|4887|    |-	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture}, queued);
|    |4887|+	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture }, queued);
|4888|4888| };
|4889|4889| 
|4890|4890| /**
|    | [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
|5033|5033| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5034|5034| 	{
|5035|5035| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5036|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5036|+		if (cmpTrader.HasBothMarkets() &&
|5037|5037| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5038|5038| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5039|5039| 		{
|    | [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
|5314|5314| 				{
|5315|5315| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5316|5316| 					var targetClasses = this.order.data.targetClasses;
|5317|    |-					if (targetClasses.attack && cmpIdentity
|5318|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5317|+					if (targetClasses.attack && cmpIdentity &&
|    |5318|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5319|5319| 						continue;
|5320|5320| 					if (targetClasses.avoid && cmpIdentity
|5321|5321| 						&& 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
|5317|5317| 					if (targetClasses.attack && cmpIdentity
|5318|5318| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5319|5319| 						continue;
|5320|    |-					if (targetClasses.avoid && cmpIdentity
|5321|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5320|+					if (targetClasses.avoid && cmpIdentity &&
|    |5321|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5322|5322| 						continue;
|5323|5323| 					// Only used by the AIs to prevent some choices of targets
|5324|5324| 					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
|5340|5340| 		{
|5341|5341| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5342|5342| 			var targetClasses = this.order.data.targetClasses;
|5343|    |-			if (cmpIdentity && targetClasses.attack
|5344|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5343|+			if (cmpIdentity && targetClasses.attack &&
|    |5344|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5345|5345| 				continue;
|5346|5346| 			if (cmpIdentity && targetClasses.avoid
|5347|5347| 				&& 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
|5343|5343| 			if (cmpIdentity && targetClasses.attack
|5344|5344| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5345|5345| 				continue;
|5346|    |-			if (cmpIdentity && targetClasses.avoid
|5347|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5346|+			if (cmpIdentity && targetClasses.avoid &&
|    |5347|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5348|5348| 				continue;
|5349|5349| 			// Only used by the AIs to prevent some choices of targets
|5350|5350| 			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
|5486|5486| 
|5487|5487| UnitAI.prototype.SetHeldPosition = function(x, z)
|5488|5488| {
|5489|    |-	this.heldPosition = {"x": x, "z": z};
|    |5489|+	this.heldPosition = { "x": x, "z": z};
|5490|5490| };
|5491|5491| 
|5492|5492| 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
|5486|5486| 
|5487|5487| UnitAI.prototype.SetHeldPosition = function(x, z)
|5488|5488| {
|5489|    |-	this.heldPosition = {"x": x, "z": z};
|    |5489|+	this.heldPosition = {"x": x, "z": z };
|5490|5490| };
|5491|5491| 
|5492|5492| 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
|5513|5513| 	return false;
|5514|5514| };
|5515|5515| 
|5516|    |-//// Helper functions ////
|    |5516|+// // Helper functions ////
|5517|5517| 
|5518|5518| UnitAI.prototype.CanAttack = function(target)
|5519|5519| {
|    | [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
|5717|5717| 	return cmpPack && cmpPack.IsPacking();
|5718|5718| };
|5719|5719| 
|5720|    |-//// Formation specific functions ////
|    |5720|+// // Formation specific functions ////
|5721|5721| 
|5722|5722| UnitAI.prototype.IsAttackingAsFormation = function()
|5723|5723| {
|    | [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
|5722|5722| UnitAI.prototype.IsAttackingAsFormation = function()
|5723|5723| {
|5724|5724| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5725|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5726|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5725|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5726|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5727|5727| };
|5728|5728| 
|5729|5729| //// 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
|5726|5726| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5727|5727| };
|5728|5728| 
|5729|    |-//// Animal specific functions ////
|    |5729|+// // Animal specific functions ////
|5730|5730| 
|5731|5731| UnitAI.prototype.MoveRandomly = function(distance)
|5732|5732| {

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

binaries/data/mods/public/simulation/components/UnitAI.js
| 885| »   »   »   "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
| 907| »   »   »   "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
| 954| »   »   »   »   »   return·true;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'enter' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
|1017| »   »   »   »   "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
|1052| »   »   »   "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
|1084| »   »   »   »   "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
|1298| »   »   »   "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
|1481| »   »   »   "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
|1502| »   »   »   "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
|1532| »   »   »   "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
|1687| »   »   »   "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
|1738| »   »   »   »   "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
|1808| »   »   »   »   »   »   »   return·true;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'enter' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
|1978| »   »   »   »   "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
|2068| »   »   »   »   "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
|2237| »   »   »   »   »   »   let·nearby·=·this.FindNearestDropsite(resourceType.generic);
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'nearby' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|2292| »   »   »   »   "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
|2410| »   »   »   »   "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
|2475| »   »   »   »   "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
|2515| »   »   »   »   "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
|2719| »   »   »   »   "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
|2898| »   »   »   »   "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
|3616| »   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
|4424| »   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
|4439| »   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
|4485| »   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
|4508| »   »   ····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
|4964| »   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
| 354| »   »   ····&&·(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
|1832| »   »   »   »   »   »   var·cmpFormation·=·Engine.QueryInterface(this.formationController,·IID_Formation);
|    | [NORMAL] JSHintBear:
|    | 'cmpFormation' is already defined.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4195| »   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
|4273| »   »   »   &&·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
|4441| »   »   &&·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
|4442| »   »   &&·(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
|4964| »   var·lastPos·=·undefined;
|    | [NORMAL] JSHintBear:
|    | It's not necessary to initialize 'lastPos' to 'undefined'.

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

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

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

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

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|5726| »   »   &&·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/differential/1741/display/redirect

A lot actually depends on stance which defines LOS of unit which dictates if it will find new targets or not.
Unit will probably not cheer if is in defensive stance and will move back to held position.

Units that get fired upon by archers might still cheer if they kill an enemy

If you mean that when unit gets hit by arrow should keep cheering, do not think so

Probably unit could cheer if is approaching / chasing and target is killed and nothing to attack.

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

Actually I think this is the best place, If this would be in leave, that would be called even when you would give order to stop or you change order to walk

In D1977#82718, @Angen wrote:

Units that get fired upon by archers might still cheer if they kill an enemy

If you mean that when unit gets hit by arrow should keep cheering, do not think so

I think what he meant is that when an entity kills its direct opponent it will cheer, but it might be the case that while cheering (s)he is under arrow fire from afar.

Angen planned changes to this revision.Jul 11 2019, 5:59 PM

after unitai is stable

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
|2709|2709| 					{
|2710|2710| 						// The building was already finished/fully repaired before we arrived;
|2711|2711| 						// let the ConstructionFinished handler handle this.
|2712|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2712|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2713|2713| 						return true;
|2714|2714| 					}
|2715|2715| 
|    | [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
|2709|2709| 					{
|2710|2710| 						// The building was already finished/fully repaired before we arrived;
|2711|2711| 						// let the ConstructionFinished handler handle this.
|2712|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2712|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2713|2713| 						return true;
|2714|2714| 					}
|2715|2715| 
|    | [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
|3217|3217| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3218|3218| 
|3219|3219| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3220|    |-							// only used for domestic animals
|    |3220|+		// only used for domestic animals
|3221|3221| 	},
|3222|3222| };
|3223|3223| 
|    | [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
|3274|3274| 
|3275|3275| UnitAI.prototype.IsAnimal = function()
|3276|3276| {
|3277|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3277|+	return (!!this.template.NaturalBehaviour);
|3278|3278| };
|3279|3279| 
|3280|3280| 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
|3390|3390| 		{
|3391|3391| 			let index = this.GetCurrentState().indexOf(".");
|3392|3392| 			if (index != -1)
|3393|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3393|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3394|3394| 			this.Stop(false);
|3395|3395| 		}
|3396|3396| 
|    | [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
|3446|3446| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3447|3447| 			continue;
|3448|3448| 		if (i == 0)
|3449|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3449|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3450|3450| 		else
|3451|3451| 			this.orderQueue.splice(i, 1);
|3452|3452| 		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
|3446|3446| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3447|3447| 			continue;
|3448|3448| 		if (i == 0)
|3449|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3449|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3450|3450| 		else
|3451|3451| 			this.orderQueue.splice(i, 1);
|3452|3452| 		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
|3530|3530| };
|3531|3531| 
|3532|3532| 
|3533|    |-//// FSM linkage functions ////
|    |3533|+// // FSM linkage functions ////
|3534|3534| 
|3535|3535| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3536|3536| 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
|3694|3694| 				continue;
|3695|3695| 			if (this.orderQueue[i].type == type)
|3696|3696| 				continue;
|3697|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3697|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3698|3698| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3699|3699| 			return;
|3700|3700| 		}
|    | [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
|3694|3694| 				continue;
|3695|3695| 			if (this.orderQueue[i].type == type)
|3696|3696| 				continue;
|3697|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3697|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3698|3698| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3699|3699| 			return;
|3700|3700| 		}
|    | [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
|3852|3852| 	if (data.timerRepeat === undefined)
|3853|3853| 		this.timer = undefined;
|3854|3854| 
|3855|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3855|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3856|3856| };
|3857|3857| 
|3858|3858| /**
|    | [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
|3852|3852| 	if (data.timerRepeat === undefined)
|3853|3853| 		this.timer = undefined;
|3854|3854| 
|3855|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3855|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3856|3856| };
|3857|3857| 
|3858|3858| /**
|    | [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
|3897|3897| 	// TODO: This is a bit inefficient since every unit listens to every
|3898|3898| 	// construction message - ideally we could scope it to only the one we're building
|3899|3899| 
|3900|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3900|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3901|3901| };
|3902|3902| 
|3903|3903| 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
|3897|3897| 	// TODO: This is a bit inefficient since every unit listens to every
|3898|3898| 	// construction message - ideally we could scope it to only the one we're building
|3899|3899| 
|3900|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3900|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3901|3901| };
|3902|3902| 
|3903|3903| 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
|3922|3922| 
|3923|3923| UnitAI.prototype.OnAttacked = function(msg)
|3924|3924| {
|3925|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3925|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3926|3926| };
|3927|3927| 
|3928|3928| 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
|3922|3922| 
|3923|3923| UnitAI.prototype.OnAttacked = function(msg)
|3924|3924| {
|3925|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3925|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3926|3926| };
|3927|3927| 
|3928|3928| 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
|3927|3927| 
|3928|3928| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3929|3929| {
|3930|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3930|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|3931|3931| };
|3932|3932| 
|3933|3933| 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
|3927|3927| 
|3928|3928| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3929|3929| {
|3930|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3930|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|3931|3931| };
|3932|3932| 
|3933|3933| 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
|3932|3932| 
|3933|3933| UnitAI.prototype.OnHealthChanged = function(msg)
|3934|3934| {
|3935|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3935|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|3936|3936| };
|3937|3937| 
|3938|3938| 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
|3932|3932| 
|3933|3933| UnitAI.prototype.OnHealthChanged = function(msg)
|3934|3934| {
|3935|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3935|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|3936|3936| };
|3937|3937| 
|3938|3938| 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
|3938|3938| UnitAI.prototype.OnRangeUpdate = function(msg)
|3939|3939| {
|3940|3940| 	if (msg.tag == this.losRangeQuery)
|3941|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3941|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|3942|3942| 	else if (msg.tag == this.losHealRangeQuery)
|3943|3943| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3944|3944| };
|    | [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
|3938|3938| UnitAI.prototype.OnRangeUpdate = function(msg)
|3939|3939| {
|3940|3940| 	if (msg.tag == this.losRangeQuery)
|3941|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3941|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|3942|3942| 	else if (msg.tag == this.losHealRangeQuery)
|3943|3943| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3944|3944| };
|    | [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
|3940|3940| 	if (msg.tag == this.losRangeQuery)
|3941|3941| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3942|3942| 	else if (msg.tag == this.losHealRangeQuery)
|3943|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3943|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|3944|3944| };
|3945|3945| 
|3946|3946| 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
|3940|3940| 	if (msg.tag == this.losRangeQuery)
|3941|3941| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3942|3942| 	else if (msg.tag == this.losHealRangeQuery)
|3943|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3943|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|3944|3944| };
|3945|3945| 
|3946|3946| 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
|3945|3945| 
|3946|3946| UnitAI.prototype.OnPackFinished = function(msg)
|3947|3947| {
|3948|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3948|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|3949|3949| };
|3950|3950| 
|3951|3951| //// 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
|3945|3945| 
|3946|3946| UnitAI.prototype.OnPackFinished = function(msg)
|3947|3947| {
|3948|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3948|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|3949|3949| };
|3950|3950| 
|3951|3951| //// 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
|3948|3948| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|3949|3949| };
|3950|3950| 
|3951|    |-//// Helper functions to be called by the FSM ////
|    |3951|+// // Helper functions to be called by the FSM ////
|3952|3952| 
|3953|3953| UnitAI.prototype.GetWalkSpeed = function()
|3954|3954| {
|    | [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
|4617|4617| UnitAI.prototype.AttackEntityInZone = function(ents)
|4618|4618| {
|4619|4619| 	var target = ents.find(target =>
|4620|    |-		this.CanAttack(target)
|4621|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4620|+		this.CanAttack(target) &&
|    |4621|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4622|4622| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4623|4623| 	);
|4624|4624| 	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
|4618|4618| {
|4619|4619| 	var target = ents.find(target =>
|4620|4620| 		this.CanAttack(target)
|4621|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4622|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4621|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4622|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4623|4623| 	);
|4624|4624| 	if (!target)
|4625|4625| 		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
|4682|4682| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4683|4683| 	if (this.isGuardOf)
|4684|4684| 	{
|4685|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4685|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4686|4686| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4687|4687| 		if (cmpUnitAI && cmpAttack &&
|4688|4688| 		    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
|4686|4686| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4687|4687| 		if (cmpUnitAI && cmpAttack &&
|4688|4688| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4689|    |-				return false;
|    |4689|+			return false;
|4690|4690| 	}
|4691|4691| 
|4692|4692| 	// 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
|4724|4724| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4725|4725| 	if (this.isGuardOf)
|4726|4726| 	{
|4727|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4727|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4728|4728| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4729|4729| 		if (cmpUnitAI && cmpAttack &&
|4730|4730| 		    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
|4737|4737| 	return false;
|4738|4738| };
|4739|4739| 
|4740|    |-//// External interface functions ////
|    |4740|+// // External interface functions ////
|4741|4741| 
|4742|4742| UnitAI.prototype.SetFormationController = function(ent)
|4743|4743| {
|    | [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
|4893|4893| 	{
|4894|4894| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4895|4895| 			return;
|4896|    |-		else
|4897|    |-			this.RemoveGuard();
|    |4896|+		this.RemoveGuard();
|4898|4897| 	}
|4899|4898| 
|4900|4899| 	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
|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.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/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.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/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.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/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.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/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 '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5692|5692| 
|5693|5693| UnitAI.prototype.SetHeldPosition = function(x, z)
|5694|5694| {
|5695|    |-	this.heldPosition = {"x": x, "z": z};
|    |5695|+	this.heldPosition = { "x": x, "z": z};
|5696|5696| };
|5697|5697| 
|5698|5698| 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
|5692|5692| 
|5693|5693| UnitAI.prototype.SetHeldPosition = function(x, z)
|5694|5694| {
|5695|    |-	this.heldPosition = {"x": x, "z": z};
|    |5695|+	this.heldPosition = {"x": x, "z": z };
|5696|5696| };
|5697|5697| 
|5698|5698| 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
|5719|5719| 	return false;
|5720|5720| };
|5721|5721| 
|5722|    |-//// Helper functions ////
|    |5722|+// // Helper functions ////
|5723|5723| 
|5724|5724| UnitAI.prototype.CanAttack = function(target)
|5725|5725| {
|    | [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
|5923|5923| 	return cmpPack && cmpPack.IsPacking();
|5924|5924| };
|5925|5925| 
|5926|    |-//// Formation specific functions ////
|    |5926|+// // Formation specific functions ////
|5927|5927| 
|5928|5928| UnitAI.prototype.IsAttackingAsFormation = function()
|5929|5929| {
|    | [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
|5928|5928| UnitAI.prototype.IsAttackingAsFormation = function()
|5929|5929| {
|5930|5930| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5931|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5932|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5931|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5932|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5933|5933| };
|5934|5934| 
|5935|5935| //// 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
|5932|5932| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5933|5933| };
|5934|5934| 
|5935|    |-//// Animal specific functions ////
|    |5935|+// // Animal specific functions ////
|5936|5936| 
|5937|5937| UnitAI.prototype.MoveRandomly = function(distance)
|5938|5938| {

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
|2030| »   »   »   »   "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
|2146| »   »   »   »   "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
|2421| »   »   »   »   "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
|2454| »   »   »   »   "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
|2560| »   »   »   »   "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
|2626| »   »   »   »   "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
|2665| »   »   »   »   "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
|2876| »   »   »   »   "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
|3052| »   »   »   »   "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
|3763| »   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
|4604| »   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
|4619| »   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
|4665| »   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
|4688| »   »   ····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
|3794| »   for·(var·i·=·0;·i·<·this.orderQueue.length;·++i)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|4621| »   »   &&·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
|4622| »   »   &&·(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
|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
|5617| »   »   var·range·=·cmpVision.GetRange();
|    | [NORMAL] JSHintBear:
|    | 'range' is already defined.

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|5932| »   »   &&·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/1067/display/redirect

Angen updated this revision to Diff 10294.Sun, Nov 10, 1:36 PM

add Cheering order for nearby units so they cheer together if not in combat

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

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

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

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/554/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
|1982|1982| 
|1983|1983| 				"Attacked": function(msg) {
|1984|1984| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|1985|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|1986|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |1985|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |1986|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|1987|1987| 						this.RespondToTargetedEntities([msg.data.attacker]);
|1988|1988| 				},
|1989|1989| 			},
|    | [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
|2713|2713| 					{
|2714|2714| 						// The building was already finished/fully repaired before we arrived;
|2715|2715| 						// let the ConstructionFinished handler handle this.
|2716|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2716|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2717|2717| 						return true;
|2718|2718| 					}
|2719|2719| 
|    | [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
|2713|2713| 					{
|2714|2714| 						// The building was already finished/fully repaired before we arrived;
|2715|2715| 						// let the ConstructionFinished handler handle this.
|2716|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2716|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2717|2717| 						return true;
|2718|2718| 					}
|2719|2719| 
|    | [NORMAL] ESLintBear (space-before-function-paren):
|    | Unexpected space before function parentheses.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2995|2995| 		},
|2996|2996| 
|2997|2997| 		"CHEERING": {
|2998|    |-			"Order.Cheering": function () {
|    |2998|+			"Order.Cheering": function() {
|2999|2999| 				// ingore
|3000|3000| 			},
|3001|3001| 			"enter": function() {
|    | [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
|3224|3224| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3225|3225| 
|3226|3226| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3227|    |-							// only used for domestic animals
|    |3227|+		// only used for domestic animals
|3228|3228| 	},
|3229|3229| };
|3230|3230| 
|    | [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
|3281|3281| 
|3282|3282| UnitAI.prototype.IsAnimal = function()
|3283|3283| {
|3284|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3284|+	return (!!this.template.NaturalBehaviour);
|3285|3285| };
|3286|3286| 
|3287|3287| 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
|3397|3397| 		{
|3398|3398| 			let index = this.GetCurrentState().indexOf(".");
|3399|3399| 			if (index != -1)
|3400|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3400|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3401|3401| 			this.Stop(false);
|3402|3402| 		}
|3403|3403| 
|    | [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
|3453|3453| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3454|3454| 			continue;
|3455|3455| 		if (i == 0)
|3456|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3456|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3457|3457| 		else
|3458|3458| 			this.orderQueue.splice(i, 1);
|3459|3459| 		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
|3453|3453| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3454|3454| 			continue;
|3455|3455| 		if (i == 0)
|3456|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3456|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3457|3457| 		else
|3458|3458| 			this.orderQueue.splice(i, 1);
|3459|3459| 		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
|3537|3537| };
|3538|3538| 
|3539|3539| 
|3540|    |-//// FSM linkage functions ////
|    |3540|+// // FSM linkage functions ////
|3541|3541| 
|3542|3542| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3543|3543| 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
|3701|3701| 				continue;
|3702|3702| 			if (this.orderQueue[i].type == type)
|3703|3703| 				continue;
|3704|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3704|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3705|3705| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3706|3706| 			return;
|3707|3707| 		}
|    | [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
|3701|3701| 				continue;
|3702|3702| 			if (this.orderQueue[i].type == type)
|3703|3703| 				continue;
|3704|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3704|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3705|3705| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3706|3706| 			return;
|3707|3707| 		}
|    | [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
|3859|3859| 	if (data.timerRepeat === undefined)
|3860|3860| 		this.timer = undefined;
|3861|3861| 
|3862|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3862|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3863|3863| };
|3864|3864| 
|3865|3865| /**
|    | [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
|3859|3859| 	if (data.timerRepeat === undefined)
|3860|3860| 		this.timer = undefined;
|3861|3861| 
|3862|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3862|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3863|3863| };
|3864|3864| 
|3865|3865| /**
|    | [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
|3904|3904| 	// TODO: This is a bit inefficient since every unit listens to every
|3905|3905| 	// construction message - ideally we could scope it to only the one we're building
|3906|3906| 
|3907|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3907|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3908|3908| };
|3909|3909| 
|3910|3910| 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
|3904|3904| 	// TODO: This is a bit inefficient since every unit listens to every
|3905|3905| 	// construction message - ideally we could scope it to only the one we're building
|3906|3906| 
|3907|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3907|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3908|3908| };
|3909|3909| 
|3910|3910| 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
|3929|3929| 
|3930|3930| UnitAI.prototype.OnAttacked = function(msg)
|3931|3931| {
|3932|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3932|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3933|3933| };
|3934|3934| 
|3935|3935| 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
|3929|3929| 
|3930|3930| UnitAI.prototype.OnAttacked = function(msg)
|3931|3931| {
|3932|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3932|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3933|3933| };
|3934|3934| 
|3935|3935| 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
|3934|3934| 
|3935|3935| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3936|3936| {
|3937|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3937|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|3938|3938| };
|3939|3939| 
|3940|3940| 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
|3934|3934| 
|3935|3935| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3936|3936| {
|3937|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3937|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|3938|3938| };
|3939|3939| 
|3940|3940| 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
|3939|3939| 
|3940|3940| UnitAI.prototype.OnHealthChanged = function(msg)
|3941|3941| {
|3942|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3942|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|3943|3943| };
|3944|3944| 
|3945|3945| 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
|3939|3939| 
|3940|3940| UnitAI.prototype.OnHealthChanged = function(msg)
|3941|3941| {
|3942|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3942|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|3943|3943| };
|3944|3944| 
|3945|3945| 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
|3945|3945| UnitAI.prototype.OnRangeUpdate = function(msg)
|3946|3946| {
|3947|3947| 	if (msg.tag == this.losRangeQuery)
|3948|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3948|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|3949|3949| 	else if (msg.tag == this.losHealRangeQuery)
|3950|3950| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3951|3951| };
|    | [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
|3945|3945| UnitAI.prototype.OnRangeUpdate = function(msg)
|3946|3946| {
|3947|3947| 	if (msg.tag == this.losRangeQuery)
|3948|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3948|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|3949|3949| 	else if (msg.tag == this.losHealRangeQuery)
|3950|3950| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3951|3951| };
|    | [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
|3947|3947| 	if (msg.tag == this.losRangeQuery)
|3948|3948| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3949|3949| 	else if (msg.tag == this.losHealRangeQuery)
|3950|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3950|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|3951|3951| };
|3952|3952| 
|3953|3953| 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
|3947|3947| 	if (msg.tag == this.losRangeQuery)
|3948|3948| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3949|3949| 	else if (msg.tag == this.losHealRangeQuery)
|3950|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3950|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|3951|3951| };
|3952|3952| 
|3953|3953| 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
|3952|3952| 
|3953|3953| UnitAI.prototype.OnPackFinished = function(msg)
|3954|3954| {
|3955|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3955|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|3956|3956| };
|3957|3957| 
|3958|3958| //// 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
|3952|3952| 
|3953|3953| UnitAI.prototype.OnPackFinished = function(msg)
|3954|3954| {
|3955|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3955|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|3956|3956| };
|3957|3957| 
|3958|3958| //// 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
|3955|3955| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|3956|3956| };
|3957|3957| 
|3958|    |-//// Helper functions to be called by the FSM ////
|    |3958|+// // Helper functions to be called by the FSM ////
|3959|3959| 
|3960|3960| UnitAI.prototype.GetWalkSpeed = function()
|3961|3961| {
|    | [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
|4624|4624| UnitAI.prototype.AttackEntityInZone = function(ents)
|4625|4625| {
|4626|4626| 	var target = ents.find(target =>
|4627|    |-		this.CanAttack(target)
|4628|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4627|+		this.CanAttack(target) &&
|    |4628|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4629|4629| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4630|4630| 	);
|4631|4631| 	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
|4625|4625| {
|4626|4626| 	var target = ents.find(target =>
|4627|4627| 		this.CanAttack(target)
|4628|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4629|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4628|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4629|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4630|4630| 	);
|4631|4631| 	if (!target)
|4632|4632| 		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
|4689|4689| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4690|4690| 	if (this.isGuardOf)
|4691|4691| 	{
|4692|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4692|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4693|4693| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4694|4694| 		if (cmpUnitAI && cmpAttack &&
|4695|4695| 		    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
|4693|4693| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4694|4694| 		if (cmpUnitAI && cmpAttack &&
|4695|4695| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4696|    |-				return false;
|    |4696|+			return false;
|4697|4697| 	}
|4698|4698| 
|4699|4699| 	// 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
|4731|4731| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4732|4732| 	if (this.isGuardOf)
|4733|4733| 	{
|4734|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4734|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4735|4735| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4736|4736| 		if (cmpUnitAI && cmpAttack &&
|4737|4737| 		    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
|4744|4744| 	return false;
|4745|4745| };
|4746|4746| 
|4747|    |-//// External interface functions ////
|    |4747|+// // External interface functions ////
|4748|4748| 
|4749|4749| UnitAI.prototype.SetFormationController = function(ent)
|4750|4750| {
|    | [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
|4900|4900| 	{
|4901|4901| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4902|4902| 			return;
|4903|    |-		else
|4904|    |-			this.RemoveGuard();
|    |4903|+		this.RemoveGuard();
|4905|4904| 	}
|4906|4905| 
|4907|4906| 	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
|5232|5232| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5233|5233| 	{
|5234|5234| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5235|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5235|+		if (cmpTrader.HasBothMarkets() &&
|5236|5236| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5237|5237| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5238|5238| 		{
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5405|5405| 		if (cmpUnitAI)
|5406|5406| 			cmpUnitAI.Cheer();
|5407|5407| 	}
|5408|    |-}
|    |5408|+};
|5409|5409| 
|5410|5410| /**
|5411|5411|  * Adds cheer order to the queue. Do not force so it can be interrupted by attacks.
|    | [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| 				{
|5531|5531| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5532|5532| 					var targetClasses = this.order.data.targetClasses;
|5533|    |-					if (targetClasses.attack && cmpIdentity
|5534|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5533|+					if (targetClasses.attack && cmpIdentity &&
|    |5534|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5535|5535| 						continue;
|5536|5536| 					if (targetClasses.avoid && cmpIdentity
|5537|5537| 						&& 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
|5533|5533| 					if (targetClasses.attack && cmpIdentity
|5534|5534| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5535|5535| 						continue;
|5536|    |-					if (targetClasses.avoid && cmpIdentity
|5537|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5536|+					if (targetClasses.avoid && cmpIdentity &&
|    |5537|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5538|5538| 						continue;
|5539|5539| 					// Only used by the AIs to prevent some choices of targets
|5540|5540| 					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
|5556|5556| 		{
|5557|5557| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5558|5558| 			var targetClasses = this.order.data.targetClasses;
|5559|    |-			if (cmpIdentity && targetClasses.attack
|5560|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5559|+			if (cmpIdentity && targetClasses.attack &&
|    |5560|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5561|5561| 				continue;
|5562|5562| 			if (cmpIdentity && targetClasses.avoid
|5563|5563| 				&& 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
|5559|5559| 			if (cmpIdentity && targetClasses.attack
|5560|5560| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5561|5561| 				continue;
|5562|    |-			if (cmpIdentity && targetClasses.avoid
|5563|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5562|+			if (cmpIdentity && targetClasses.avoid &&
|    |5563|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5564|5564| 				continue;
|5565|5565| 			// Only used by the AIs to prevent some choices of targets
|5566|5566| 			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
|5716|5716| 
|5717|5717| UnitAI.prototype.SetHeldPosition = function(x, z)
|5718|5718| {
|5719|    |-	this.heldPosition = {"x": x, "z": z};
|    |5719|+	this.heldPosition = { "x": x, "z": z};
|5720|5720| };
|5721|5721| 
|5722|5722| 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
|5716|5716| 
|5717|5717| UnitAI.prototype.SetHeldPosition = function(x, z)
|5718|5718| {
|5719|    |-	this.heldPosition = {"x": x, "z": z};
|    |5719|+	this.heldPosition = {"x": x, "z": z };
|5720|5720| };
|5721|5721| 
|5722|5722| 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
|5743|5743| 	return false;
|5744|5744| };
|5745|5745| 
|5746|    |-//// Helper functions ////
|    |5746|+// // Helper functions ////
|5747|5747| 
|5748|5748| UnitAI.prototype.CanAttack = function(target)
|5749|5749| {
|    | [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
|5947|5947| 	return cmpPack && cmpPack.IsPacking();
|5948|5948| };
|5949|5949| 
|5950|    |-//// Formation specific functions ////
|    |5950|+// // Formation specific functions ////
|5951|5951| 
|5952|5952| UnitAI.prototype.IsAttackingAsFormation = function()
|5953|5953| {
|    | [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
|5952|5952| UnitAI.prototype.IsAttackingAsFormation = function()
|5953|5953| {
|5954|5954| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5955|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5956|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5955|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5956|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5957|5957| };
|5958|5958| 
|5959|5959| //// 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
|5956|5956| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5957|5957| };
|5958|5958| 
|5959|    |-//// Animal specific functions ////
|    |5959|+// // Animal specific functions ////
|5960|5960| 
|5961|5961| UnitAI.prototype.MoveRandomly = function(distance)
|5962|5962| {

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
|1126| »   »   »   »   "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
|1286| »   »   "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
|1343| »   »   »   "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
|1518| »   »   »   "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
|1540| »   »   »   "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
|1572| »   »   »   "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
|1726| »   »   »   "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
|1776| »   »   »   »   "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
|1854| »   »   »   »   "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
|2034| »   »   »   »   "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
|2150| »   »   »   »   "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
|2425| »   »   »   »   "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
|2458| »   »   »   »   "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
|2564| »   »   »   »   "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
|2630| »   »   »   »   "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
|2669| »   »   »   »   "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
|2880| »   »   »   »   "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
|3059| »   »   »   »   "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
|3770| »   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
|4611| »   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
|4626| »   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
|4672| »   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
|4695| »   »   ····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
|5403| »   for·(let·ent·of·nearby)·{
|    | [NORMAL] ESLintBear (brace-rules/brace-on-same-line):
|    | Opening curly brace appears on the same line as controlling statement.

binaries/data/mods/public/simulation/components/UnitAI.js
|1986| »   »   »   »   »   »   &&·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
|3801| »   for·(var·i·=·0;·i·<·this.orderQueue.length;·++i)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|4628| »   »   &&·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
|4629| »   »   &&·(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
|5408| }
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

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

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

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|5956| »   »   &&·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/1068/display/redirect