Page MenuHomeWildfire Games

Automated exploring.
Changes PlannedPublic

Authored by Freagarach on Apr 28 2019, 4:10 PM.

Details

Reviewers
Silier
Trac Tickets
#29
Summary

This is a try to let units explore automated. Feedback is appreciated.
The entity chooses a direction and heads to the first unexplored location, when arrived, it looks for a second one. Enemy territory is not chosen, but the unit will pass through it when trying to get to the other side.

There are still some cases in which this fails:

  • When the position is unreachable (e.g. on the other side of a sea), the unit keeps picking that location to walk to it. So a check needs to be added if the position is reachable.
  • Formations are not (yet) able to scout.

ToDo:

  • If a target could not be reached, skip that one in this and following iterations (until "order.Scout" is given again). How?
Test Plan

Select a unit and click the scout button (the scroll for now).

Diff Detail

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

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

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

Linter detected issues:
Executing section Source...

source/simulation2/components/ICmpRangeManager.h
|   1| /*·Copyright·(C)·2017·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2019" year instead of "2017"

source/simulation2/components/ICmpRangeManager.cpp
|   1| /*·Copyright·(C)·2017·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2019" year instead of "2017"

source/simulation2/components/CCmpRangeManager.cpp
|   1| /*·Copyright·(C)·2018·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2019" year instead of "2018"
Executing section JS...
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-of'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/selection_panels_helpers.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/selection_panels_helpers.js
| 423| 423| 	let otherEnts = [];
| 424| 424| 
| 425| 425| 	for (let ent of garrisonHolders)
| 426|    |-	{
|    | 426|+	
| 427| 427| 		if (controlsPlayer(GetEntityState(ent).player))
| 428| 428| 			ownEnts.push(ent);
| 429| 429| 		else
| 430| 430| 			otherEnts.push(ent);
| 431|    |-	}
|    | 431|+	
| 432| 432| 
| 433| 433| 	if (ownEnts.length)
| 434| 434| 		Engine.PostNetworkCommand({

binaries/data/mods/public/gui/session/unit_actions.js
| 557| »   »   »   switch·(tradingDetails.type)
|    | [NORMAL] ESLintBear (default-case):
|    | Expected a default case.
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
| 330| 330| 			{
| 331| 331| 				var list = queue.GetEntitiesList();
| 332| 332| 				if (list.indexOf(cmd.template) === -1 && cmd.promoted)
| 333|    |-				{
|    | 333|+				
| 334| 334| 					for (var promoted of cmd.promoted)
| 335| 335| 					{
| 336| 336| 						if (list.indexOf(promoted) === -1)
| 338| 338| 						cmd.template = promoted;
| 339| 339| 						break;
| 340| 340| 					}
| 341|    |-				}
|    | 341|+				
| 342| 342| 			}
| 343| 343| 			if (queue && queue.GetEntitiesList().indexOf(cmd.template) != -1)
| 344| 344| 				if ("metadata" in cmd)
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
| 544| 544| 			if (cmpGarrisonHolder)
| 545| 545| 			{
| 546| 546| 				// Only the owner of the garrisonHolder may unload entities from any owners
| 547|    |-				if (!IsOwnedByPlayer(player, garrisonHolder) && !data.controlAllUnits
| 548|    |-				    && player != +cmd.owner)
|    | 547|+				if (!IsOwnedByPlayer(player, garrisonHolder) && !data.controlAllUnits &&
|    | 548|+				    player != +cmd.owner)
| 549| 549| 						continue;
| 550| 550| 
| 551| 551| 				if (!cmpGarrisonHolder.UnloadTemplate(cmd.template, cmd.owner, cmd.all))
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
| 546| 546| 				// Only the owner of the garrisonHolder may unload entities from any owners
| 547| 547| 				if (!IsOwnedByPlayer(player, garrisonHolder) && !data.controlAllUnits
| 548| 548| 				    && player != +cmd.owner)
| 549|    |-						continue;
|    | 549|+					continue;
| 550| 550| 
| 551| 551| 				if (!cmpGarrisonHolder.UnloadTemplate(cmd.template, cmd.owner, cmd.all))
| 552| 552| 					notifyUnloadFailure(player, garrisonHolder);
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
| 956| 956| 		{
| 957| 957| 			var count = 0;
| 958| 958| 			for (let j = 0; j < length - 1; ++j)
| 959|    |-			{
|    | 959|+			
| 960| 960| 				if ((waterPoints[(i + j) % length] + 1) % numPoints == waterPoints[(i + j + 1) % length])
| 961| 961| 					++count;
| 962| 962| 				else
| 963| 963| 					break;
| 964|    |-			}
|    | 964|+			
| 965| 965| 			consec[i] = count;
| 966| 966| 		}
| 967| 967| 		var start = 0;
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-in'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
| 967| 967| 		var start = 0;
| 968| 968| 		var count = 0;
| 969| 969| 		for (var c in consec)
| 970|    |-		{
|    | 970|+		
| 971| 971| 			if (consec[c] > count)
| 972| 972| 			{
| 973| 973| 				start = c;
| 974| 974| 				count = consec[c];
| 975| 975| 			}
| 976|    |-		}
|    | 976|+		
| 977| 977| 
| 978| 978| 		// If we've found a shoreline, stop searching
| 979| 979| 		if (count != numPoints-1)
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space after key 'metadata'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1150|1150| 
|1151|1151| 	// send Metadata info if any
|1152|1152| 	if (cmd.metadata)
|1153|    |-		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player } );
|    |1153|+		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata": cmd.metadata, "owner" : player } );
|1154|1154| 
|1155|1155| 	// Tell the units to start building this new entity
|1156|1156| 	if (cmd.autorepair)
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space after key 'owner'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1150|1150| 
|1151|1151| 	// send Metadata info if any
|1152|1152| 	if (cmd.metadata)
|1153|    |-		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player } );
|    |1153|+		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner": player } );
|1154|1154| 
|1155|1155| 	// Tell the units to start building this new entity
|1156|1156| 	if (cmd.autorepair)
|    | [NORMAL] ESLintBear (space-in-parens):
|    | There should be no spaces inside this paren.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1150|1150| 
|1151|1151| 	// send Metadata info if any
|1152|1152| 	if (cmd.metadata)
|1153|    |-		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player } );
|    |1153|+		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player });
|1154|1154| 
|1155|1155| 	// Tell the units to start building this new entity
|1156|1156| 	if (cmd.autorepair)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1154|1154| 
|1155|1155| 	// Tell the units to start building this new entity
|1156|1156| 	if (cmd.autorepair)
|1157|    |-	{
|    |1157|+	
|1158|1158| 		ProcessCommand(player, {
|1159|1159| 			"type": "repair",
|1160|1160| 			"entities": entities,
|1162|1162| 			"autocontinue": cmd.autocontinue,
|1163|1163| 			"queued": cmd.queued
|1164|1164| 		});
|1165|    |-	}
|    |1165|+	
|1166|1166| 
|1167|1167| 	return ent;
|1168|1168| }
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1258|1258| 		}
|1259|1259| 
|1260|1260| 		lastTowerControlGroup = cmpSnappedStartObstruction.GetControlGroup();
|1261|    |-		//warn("setting lastTowerControlGroup to control group of start snapped entity " + cmd.startSnappedEntity + ": " + lastTowerControlGroup);
|    |1261|+		// warn("setting lastTowerControlGroup to control group of start snapped entity " + cmd.startSnappedEntity + ": " + lastTowerControlGroup);
|1262|1262| 	}
|1263|1263| 
|1264|1264| 	var i = 0;
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1275|1275| 		// 'lastTowerControlGroup' must always be defined and valid here, except if we're at the first piece and we didn't do
|1276|1276| 		// start position snapping (implying that the first entity we build must be a tower)
|1277|1277| 		if (lastTowerControlGroup === null || lastTowerControlGroup == INVALID_ENTITY)
|1278|    |-		{
|    |1278|+		
|1279|1279| 			if (!(i == 0 && piece.template == cmd.wallSet.templates.tower && !cmd.startSnappedEntity))
|1280|1280| 			{
|1281|1281|     			error("[TryConstructWall] Expected last tower control group to be available, none found (1st pass, iteration " + i + ")");
|1282|1282|     			break;
|1283|1283| 			}
|1284|    |-		}
|    |1284|+		
|1285|1285| 
|1286|1286| 		var constructPieceCmd = {
|1287|1287| 			"type": "construct",
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1322|1322| 
|1323|1323| 				if (i > 0)
|1324|1324| 				{
|1325|    |-					//warn("   updating previous wall piece's secondary control group to " + newTowerControlGroup);
|    |1325|+					// warn("   updating previous wall piece's secondary control group to " + newTowerControlGroup);
|1326|1326| 					var cmpPreviousObstruction = Engine.QueryInterface(pieces[i-1].ent, IID_Obstruction);
|1327|1327| 					// TODO: ensure that cmpPreviousObstruction exists
|1328|1328| 					// TODO: ensure that the previous obstruction does not yet have a secondary control group set
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1380|1380| 		}
|1381|1381| 
|1382|1382| 		if (piece.template == cmd.wallSet.templates.tower)
|1383|    |-		{
|    |1383|+		
|1384|1384| 			// encountered a tower entity, update the last tower control group
|1385|1385| 			lastTowerControlGroup = cmpPieceObstruction.GetControlGroup();
|1386|    |-		}
|    |1386|+		
|1387|1387| 		else
|1388|1388| 		{
|1389|1389| 			// Encountered a non-tower entity, update its secondary control group to 'lastTowerControlGroup'.
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1394|1394| 			if (existingSecondaryControlGroup == INVALID_ENTITY)
|1395|1395| 			{
|1396|1396| 				if (lastTowerControlGroup != null && lastTowerControlGroup != INVALID_ENTITY)
|1397|    |-				{
|    |1397|+				
|1398|1398| 					cmpPieceObstruction.SetControlGroup2(lastTowerControlGroup);
|1399|    |-				}
|    |1399|+				
|1400|1400| 			}
|1401|1401| 			else if (existingSecondaryControlGroup != lastTowerControlGroup)
|1402|1402| 			{
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1469|1469| 	}
|1470|1470| 
|1471|1471| 	if (formedEnts.length == 0)
|1472|    |-	{
|    |1472|+	
|1473|1473| 		// No units support the formation - return all the others
|1474|1474| 		return nonformedUnitAIs;
|1475|    |-	}
|    |1475|+	
|1476|1476| 
|1477|1477| 	// Find what formations the formationable selected entities are currently in
|1478|1478| 	var formation = ExtractFormations(formedEnts);
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1485|1485| 		// Check that all its members are selected
|1486|1486| 		var fid = formationIds[0];
|1487|1487| 		var cmpFormation = Engine.QueryInterface(+fid, IID_Formation);
|1488|    |-		if (cmpFormation && cmpFormation.GetMemberCount() == formation.members[fid].length
|1489|    |-			&& cmpFormation.GetMemberCount() == formation.entities.length)
|    |1488|+		if (cmpFormation && cmpFormation.GetMemberCount() == formation.members[fid].length &&
|    |1489|+			cmpFormation.GetMemberCount() == formation.entities.length)
|1490|1490| 		{
|1491|1491| 			cmpFormation.DeleteTwinFormations();
|1492|1492| 			// The whole formation was selected, so reuse its controller for this command
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1517|1517| 					{
|1518|1518| 						var template = cmpUnitAI.GetFormationTemplate();
|1519|1519| 						if (lastFormationTemplate === undefined)
|1520|    |-						{
|    |1520|+						
|1521|1521| 							lastFormationTemplate = template;
|1522|    |-						}
|    |1522|+						
|1523|1523| 						else if (lastFormationTemplate != template)
|1524|1524| 						{
|1525|1525| 							lastFormationTemplate = undefined;
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1593|1593| 		for (var i = matrix.length - 1; i >= 0 && !closeClusters; --i)
|1594|1594| 			for (var j = i - 1; j >= 0 && !closeClusters; --j)
|1595|1595| 				if (matrix[i][j] < distSq)
|1596|    |-					closeClusters = [i,j];
|    |1596|+					closeClusters = [i, j];
|1597|1597| 
|1598|1598| 		// if no more close clusters found, just return all found clusters so far
|1599|1599| 		if (!closeClusters)
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1615|1615| 		}
|1616|1616| 		// remove the rows and columns in the matrix for the merged clusters,
|1617|1617| 		// and the clusters themselves from the cluster list
|1618|    |-		clusters.splice(closeClusters[0],1);
|    |1618|+		clusters.splice(closeClusters[0], 1);
|1619|1619| 		clusters.splice(closeClusters[1],1);
|1620|1620| 		matrix.splice(closeClusters[0],1);
|1621|1621| 		matrix.splice(closeClusters[1],1);
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1616|1616| 		// remove the rows and columns in the matrix for the merged clusters,
|1617|1617| 		// and the clusters themselves from the cluster list
|1618|1618| 		clusters.splice(closeClusters[0],1);
|1619|    |-		clusters.splice(closeClusters[1],1);
|    |1619|+		clusters.splice(closeClusters[1], 1);
|1620|1620| 		matrix.splice(closeClusters[0],1);
|1621|1621| 		matrix.splice(closeClusters[1],1);
|1622|1622| 		for (let i = 0; i < matrix.length; ++i)
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1617|1617| 		// and the clusters themselves from the cluster list
|1618|1618| 		clusters.splice(closeClusters[0],1);
|1619|1619| 		clusters.splice(closeClusters[1],1);
|1620|    |-		matrix.splice(closeClusters[0],1);
|    |1620|+		matrix.splice(closeClusters[0], 1);
|1621|1621| 		matrix.splice(closeClusters[1],1);
|1622|1622| 		for (let i = 0; i < matrix.length; ++i)
|1623|1623| 		{
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1618|1618| 		clusters.splice(closeClusters[0],1);
|1619|1619| 		clusters.splice(closeClusters[1],1);
|1620|1620| 		matrix.splice(closeClusters[0],1);
|1621|    |-		matrix.splice(closeClusters[1],1);
|    |1621|+		matrix.splice(closeClusters[1], 1);
|1622|1622| 		for (let i = 0; i < matrix.length; ++i)
|1623|1623| 		{
|1624|1624| 			if (matrix[i].length > closeClusters[0])
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1622|1622| 		for (let i = 0; i < matrix.length; ++i)
|1623|1623| 		{
|1624|1624| 			if (matrix[i].length > closeClusters[0])
|1625|    |-				matrix[i].splice(closeClusters[0],1);
|    |1625|+				matrix[i].splice(closeClusters[0], 1);
|1626|1626| 			if (matrix[i].length > closeClusters[1])
|1627|1627| 				matrix[i].splice(closeClusters[1],1);
|1628|1628| 		}
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1624|1624| 			if (matrix[i].length > closeClusters[0])
|1625|1625| 				matrix[i].splice(closeClusters[0],1);
|1626|1626| 			if (matrix[i].length > closeClusters[1])
|1627|    |-				matrix[i].splice(closeClusters[1],1);
|    |1627|+				matrix[i].splice(closeClusters[1], 1);
|1628|1628| 		}
|1629|1629| 		// add a new row of distances to the matrix and the new cluster
|1630|1630| 		clusters.push(newCluster);

binaries/data/mods/public/simulation/helpers/Commands.js
| 796| »   »   let·ent·=·pickRandom(cmpRangeManager.GetEntitiesByPlayer(cmd.player).filter(ent·=>·{
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'ent' is already declared in the upper scope.

binaries/data/mods/public/simulation/helpers/Commands.js
|1281| ····»   »   »   error("[TryConstructWall]·Expected·last·tower·control·group·to·be·available,·none·found·(1st·pass,·iteration·"·+·i·+·")");
|    | [NORMAL] ESLintBear (no-mixed-spaces-and-tabs):
|    | Mixed spaces and tabs.

binaries/data/mods/public/simulation/helpers/Commands.js
|1282| ····»   »   »   break;
|    | [NORMAL] ESLintBear (no-mixed-spaces-and-tabs):
|    | Mixed spaces and tabs.

binaries/data/mods/public/simulation/helpers/Commands.js
|1512| »   »   »   »   var·lastFormationTemplate·=·undefined;
|    | [NORMAL] ESLintBear (no-undef-init):
|    | It's not necessary to initialize 'lastFormationTemplate' to undefined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1591| »   »   var·closeClusters·=·undefined;
|    | [NORMAL] ESLintBear (no-undef-init):
|    | It's not necessary to initialize 'closeClusters' to undefined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1608| »   »   for·(let·i·=·0;·i·<·clusters.length;·++i)
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'i' is already declared in the upper scope.

binaries/data/mods/public/simulation/helpers/Commands.js
|1622| »   »   for·(let·i·=·0;·i·<·matrix.length;·++i)
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'i' is already declared in the upper scope.

binaries/data/mods/public/simulation/helpers/Commands.js
|  53| var·g_Commands·=·{
|    | [NORMAL] JSHintBear:
|    | 'g_Commands' was used before it was defined.

binaries/data/mods/public/simulation/helpers/Commands.js
| 548| »   »   »   »   ····&&·player·!=·+cmd.owner)
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/helpers/Commands.js
| 736| »   »   »   »   var·cmpGUIInterface·=·Engine.QueryInterface(SYSTEM_ENTITY,·IID_GuiInterface);
|    | [NORMAL] JSHintBear:
|    | 'cmpGUIInterface' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
| 955| »   »   for·(var·i·=·0;·i·<·length;·++i)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
| 968| »   »   var·count·=·0;
|    | [NORMAL] JSHintBear:
|    | 'count' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1115| »   »   var·cmpGuiInterface·=·Engine.QueryInterface(SYSTEM_ENTITY,·IID_GuiInterface);
|    | [NORMAL] JSHintBear:
|    | 'cmpGuiInterface' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1367| »   »   var·piece·=·pieces[j];
|    | [NORMAL] JSHintBear:
|    | 'piece' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1450| »   »   var·cmpUnitAI·=·Engine.QueryInterface(ent,·IID_UnitAI);
|    | [NORMAL] JSHintBear:
|    | 'cmpUnitAI' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1489| »   »   »   &&·cmpFormation.GetMemberCount()·==·formation.entities.length)
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/helpers/Commands.js
|1515| »   »   »   »   »   var·cmpUnitAI·=·Engine.QueryInterface(ent,·IID_UnitAI);
|    | [NORMAL] JSHintBear:
|    | 'cmpUnitAI' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1548| »   »   »   var·cmpFormation·=·Engine.QueryInterface(formationEnt,·IID_Formation);
|    | [NORMAL] JSHintBear:
|    | 'cmpFormation' is already defined.
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 228| 228| 		// Move a tile outside the building
| 229| 229| 		let range = 4;
| 230| 230| 		if (this.MoveToTargetRangeExplicit(msg.data.target, range, range))
| 231|    |-		{
|    | 231|+		
| 232| 232| 			// We've started walking to the given point
| 233| 233| 			this.SetNextState("INDIVIDUAL.WALKING");
| 234|    |-		}
|    | 234|+		
| 235| 235| 		else
| 236| 236| 		{
| 237| 237| 			// We are already at the target, or can't move at all
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 233| 233| 			this.SetNextState("INDIVIDUAL.WALKING");
| 234| 234| 		}
| 235| 235| 		else
| 236|    |-		{
|    | 236|+		
| 237| 237| 			// We are already at the target, or can't move at all
| 238| 238| 			this.FinishOrder();
| 239|    |-		}
|    | 239|+		
| 240| 240| 	},
| 241| 241| 
| 242| 242| 	// Individual orders:
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 335| 335| 
| 336| 336| 		var ok = this.MoveToTarget(this.order.data.target);
| 337| 337| 		if (ok)
| 338|    |-		{
|    | 338|+		
| 339| 339| 			// We've started walking to the given point
| 340| 340| 			if (this.IsAnimal())
| 341| 341| 				this.SetNextState("ANIMAL.WALKING");
| 342| 342| 			else
| 343| 343| 				this.SetNextState("INDIVIDUAL.WALKING");
| 344|    |-		}
|    | 344|+		
| 345| 345| 		else
| 346| 346| 		{
| 347| 347| 			// We are already at the target, or can't move at all
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 363| 363| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 364| 364| 		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 365| 365| 		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 366|    |-		{
|    | 366|+		
| 367| 367| 			// we were already on the shoreline, and have not moved since
| 368| 368| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
| 369| 369| 				needToMove = false;
| 370|    |-		}
|    | 370|+		
| 371| 371| 
| 372| 372| 		// TODO: what if the units are on a cliff ? the ship will go below the cliff
| 373| 373| 		// and the units won't be able to garrison. Should go to the nearest (accessible) shore
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 361| 361| 		// Check if we need to move     TODO implement a better way to know if we are on the shoreline
| 362| 362| 		var needToMove = true;
| 363| 363| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 364|    |-		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 365|    |-		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
|    | 364|+		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x) &&
|    | 365|+		    (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 366| 366| 		{
| 367| 367| 			// we were already on the shoreline, and have not moved since
| 368| 368| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 372| 372| 		// TODO: what if the units are on a cliff ? the ship will go below the cliff
| 373| 373| 		// and the units won't be able to garrison. Should go to the nearest (accessible) shore
| 374| 374| 		if (needToMove && this.MoveToTarget(this.order.data.target))
| 375|    |-		{
|    | 375|+		
| 376| 376| 			this.SetNextState("INDIVIDUAL.PICKUP.APPROACHING");
| 377|    |-		}
|    | 377|+		
| 378| 378| 		else
| 379| 379| 		{
| 380| 380| 			// We are already at the target, or can't move at all
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 401| 401| 		var distance = DistanceBetweenEntities(this.entity, this.order.data.target) + (+this.template.FleeDistance);
| 402| 402| 		var cmpUnitMotion = Engine.QueryInterface(this.entity, IID_UnitMotion);
| 403| 403| 		if (cmpUnitMotion.MoveToTargetRange(this.order.data.target, distance, -1))
| 404|    |-		{
|    | 404|+		
| 405| 405| 			// We've started fleeing from the given target
| 406| 406| 			if (this.IsAnimal())
| 407| 407| 				this.SetNextState("ANIMAL.FLEEING");
| 408| 408| 			else
| 409| 409| 				this.SetNextState("INDIVIDUAL.FLEEING");
| 410|    |-		}
|    | 410|+		
| 411| 411| 		else
| 412| 412| 		{
| 413| 413| 			// We are already at the target, or can't move at all
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 448| 448| 			}
| 449| 449| 
| 450| 450| 			if (this.order.data.attackType == this.oldAttackType)
| 451|    |-			{
|    | 451|+			
| 452| 452| 				if (this.IsAnimal())
| 453| 453| 					this.SetNextState("ANIMAL.COMBAT.ATTACKING");
| 454| 454| 				else
| 455| 455| 					this.SetNextState("INDIVIDUAL.COMBAT.ATTACKING");
| 456|    |-			}
|    | 456|+			
| 457| 457| 			else
| 458| 458| 			{
| 459| 459| 				if (this.IsAnimal())
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 455| 455| 					this.SetNextState("INDIVIDUAL.COMBAT.ATTACKING");
| 456| 456| 			}
| 457| 457| 			else
| 458|    |-			{
|    | 458|+			
| 459| 459| 				if (this.IsAnimal())
| 460| 460| 					this.SetNextState("ANIMAL.COMBAT.ATTACKING");
| 461| 461| 				else
| 462| 462| 					this.SetNextState("INDIVIDUAL.COMBAT.ATTACKING");
| 463|    |-			}
|    | 463|+			
| 464| 464| 			return;
| 465| 465| 		}
| 466| 466| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 580| 580| 					this.PushOrderFront("Walk", this.order.data.lastPos);
| 581| 581| 				}
| 582| 582| 				else
| 583|    |-				{
|    | 583|+				
| 584| 584| 					// We couldn't move there, or the target moved away
| 585| 585| 					this.FinishOrder();
| 586|    |-				}
|    | 586|+				
| 587| 587| 				return;
| 588| 588| 			}
| 589| 589| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 593| 593| 
| 594| 594| 		// Try to move within range
| 595| 595| 		if (this.MoveToTargetRange(this.order.data.target, IID_ResourceGatherer))
| 596|    |-		{
|    | 596|+		
| 597| 597| 			// We've started walking to the given point
| 598| 598| 			this.SetNextState("INDIVIDUAL.GATHER.APPROACHING");
| 599|    |-		}
|    | 599|+		
| 600| 600| 		else
| 601| 601| 		{
| 602| 602| 			// We are already at the target, or can't move at all,
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 670| 670| 	"Order.Repair": function(msg) {
| 671| 671| 		// Try to move within range
| 672| 672| 		if (this.MoveToTargetRange(this.order.data.target, IID_Builder))
| 673|    |-		{
|    | 673|+		
| 674| 674| 			// We've started walking to the given point
| 675| 675| 			this.SetNextState("INDIVIDUAL.REPAIR.APPROACHING");
| 676|    |-		}
|    | 676|+		
| 677| 677| 		else
| 678| 678| 		{
| 679| 679| 			// We are already at the target, or can't move at all,
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 706| 706| 		}
| 707| 707| 
| 708| 708| 		if (this.MoveToGarrisonRange(this.order.data.target))
| 709|    |-		{
|    | 709|+		
| 710| 710| 			this.SetNextState("INDIVIDUAL.GARRISON.APPROACHING");
| 711|    |-		}
|    | 711|+		
| 712| 712| 		else
| 713| 713| 		{
| 714| 714| 			// We do a range check before actually garrisoning
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 838| 838| 			if (!this.CheckTargetAttackRange(target, target))
| 839| 839| 			{
| 840| 840| 				if (this.TargetIsAlive(target) && this.CheckTargetVisible(target))
| 841|    |-				{
|    | 841|+				
| 842| 842| 					if (this.MoveToTargetAttackRange(target, target))
| 843| 843| 					{
| 844| 844| 						this.SetNextState("COMBAT.APPROACHING");
| 845| 845| 						return;
| 846| 846| 					}
| 847|    |-				}
|    | 847|+				
| 848| 848| 				this.FinishOrder();
| 849| 849| 				return;
| 850| 850| 			}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 863| 863| 			}
| 864| 864| 			// Check if we are already in range, otherwise walk there
| 865| 865| 			if (!this.CheckGarrisonRange(msg.data.target))
| 866|    |-			{
|    | 866|+			
| 867| 867| 				if (!this.CheckTargetVisible(msg.data.target))
| 868| 868| 				{
| 869| 869| 					this.FinishOrder();
| 878| 878| 						return;
| 879| 879| 					}
| 880| 880| 				}
| 881|    |-			}
|    | 881|+			
| 882| 882| 
| 883| 883| 			this.SetNextState("GARRISON.GARRISONING");
| 884| 884| 		},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 870| 870| 					return;
| 871| 871| 				}
| 872| 872| 				else
| 873|    |-				{
|    | 873|+				
| 874| 874| 					// Out of range; move there in formation
| 875| 875| 					if (this.MoveToGarrisonRange(msg.data.target))
| 876| 876| 					{
| 877| 877| 						this.SetNextState("GARRISON.APPROACHING");
| 878| 878| 						return;
| 879| 879| 					}
| 880|    |-				}
|    | 880|+				
| 881| 881| 			}
| 882| 882| 
| 883| 883| 			this.SetNextState("GARRISON.GARRISONING");
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 869| 869| 					this.FinishOrder();
| 870| 870| 					return;
| 871| 871| 				}
| 872|    |-				else
| 873|    |-				{
|    | 872|+				
| 874| 873| 					// Out of range; move there in formation
| 875| 874| 					if (this.MoveToGarrisonRange(msg.data.target))
| 876| 875| 					{
| 877| 876| 						this.SetNextState("GARRISON.APPROACHING");
| 878| 877| 						return;
| 879| 878| 					}
| 880|    |-				}
|    | 879|+				
| 881| 880| 			}
| 882| 881| 
| 883| 882| 			this.SetNextState("GARRISON.GARRISONING");
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 896| 896| 						this.PushOrderFront("Walk", msg.data.lastPos);
| 897| 897| 					}
| 898| 898| 					else
| 899|    |-					{
|    | 899|+					
| 900| 900| 						// We couldn't move there, or the target moved away
| 901| 901| 						this.FinishOrder();
| 902|    |-					}
|    | 902|+					
| 903| 903| 					return;
| 904| 904| 				}
| 905| 905| 
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'GARRISON'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1117|1117| 			},
|1118|1118| 		},
|1119|1119| 
|1120|    |-		"GARRISON":{
|    |1120|+		"GARRISON": {
|1121|1121| 			"enter": function() {
|1122|1122| 				// If the garrisonholder should pickup, warn it so it can take needed action
|1123|1123| 				var cmpGarrisonHolder = Engine.QueryInterface(this.order.data.target, IID_GarrisonHolder);
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1301|1301| 			// If the controller handled an order but some members rejected it,
|1302|1302| 			// they will have no orders and be in the FORMATIONMEMBER.IDLE state.
|1303|1303| 			if (this.orderQueue.length)
|1304|    |-			{
|    |1304|+			
|1305|1305| 				// We're leaving the formation, so stop our FormationWalk order
|1306|1306| 				if (this.FinishOrder())
|1307|1307| 					return;
|1308|    |-			}
|    |1308|+			
|1309|1309| 
|1310|1310| 			// No orders left, we're an individual now
|1311|1311| 			if (this.IsAnimal())
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1329|1329| 			// Move a tile outside the building
|1330|1330| 			let range = 4;
|1331|1331| 			if (this.MoveToTargetRangeExplicit(msg.data.target, range, range))
|1332|    |-			{
|    |1332|+			
|1333|1333| 				// We've started walking to the given point
|1334|1334| 				this.SetNextState("WALKINGTOPOINT");
|1335|    |-			}
|    |1335|+			
|1336|1336| 			else
|1337|1337| 			{
|1338|1338| 				// We are already at the target, or can't move at all
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1334|1334| 				this.SetNextState("WALKINGTOPOINT");
|1335|1335| 			}
|1336|1336| 			else
|1337|    |-			{
|    |1337|+			
|1338|1338| 				// We are already at the target, or can't move at all
|1339|1339| 				this.FinishOrder();
|1340|    |-			}
|    |1340|+			
|1341|1341| 		},
|1342|1342| 
|1343|1343| 
|    | [NORMAL] ESLintBear (no-undef-init):
|    | It's not necessary to initialize 'targetPos' to undefined.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1485|1485| 				if (!cmpPosition || !cmpPosition.IsInWorld())
|1486|1486| 					return;
|1487|1487| 				let pos = cmpPosition.GetPosition2D();
|1488|    |-				let targetPos = undefined;
|    |1488|+				let targetPos;
|1489|1489| 
|1490|1490| 				warn("Phase 2."); // Remove when done.
|1491|1491| 
|    | [NORMAL] ESLintBear (no-undef-init):
|    | It's not necessary to initialize 'target' to undefined.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1492|1492| 				let players = [];
|1493|1493| 				players.push(0); // player 0 = GAIA
|1494|1494| 				let nearEnts = this.EntitiesNearPoint(pos, 500, players); // Radius ought to be large
|1495|    |-				let target = undefined;
|    |1495|+				let target;
|1496|1496| 
|1497|1497| 				// Cycle through all the nearby GAIA entities and pick the first entity that is hidden from sight
|1498|1498| 				let cmpRangeManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager);
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 4 tabs but found 0.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1496|1496| 
|1497|1497| 				// Cycle through all the nearby GAIA entities and pick the first entity that is hidden from sight
|1498|1498| 				let cmpRangeManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager);
|1499|    |-//cmpRangeManager ? error("Trying function: " + uneval(cmpRangeManager.IsTileExplored(pos, 1) ) ) : error("Nothing");
|    |1499|+				//cmpRangeManager ? error("Trying function: " + uneval(cmpRangeManager.IsTileExplored(pos, 1) ) ) : error("Nothing");
|1500|1500| 				for (let ent of nearEnts)
|1501|1501| 				{
|1502|1502| 					warn("Cycling nearby entities. "+ uneval(ent)); // Remove when done.
|    | [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
|1496|1496| 
|1497|1497| 				// Cycle through all the nearby GAIA entities and pick the first entity that is hidden from sight
|1498|1498| 				let cmpRangeManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager);
|1499|    |-//cmpRangeManager ? error("Trying function: " + uneval(cmpRangeManager.IsTileExplored(pos, 1) ) ) : error("Nothing");
|    |1499|+// cmpRangeManager ? error("Trying function: " + uneval(cmpRangeManager.IsTileExplored(pos, 1) ) ) : error("Nothing");
|1500|1500| 				for (let ent of nearEnts)
|1501|1501| 				{
|1502|1502| 					warn("Cycling nearby entities. "+ uneval(ent)); // Remove when done.
|    | [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
|1537|1537| 
|1538|1538| 			"Attacked": function(msg) {
|1539|1539| 				this.SetSpeedMultiplier(this.GetRunMultiplier());
|1540|    |-				//this.Flee(msg.data.attacker, false);
|    |1540|+				// this.Flee(msg.data.attacker, false);
|1541|1541| 			},
|1542|1542| 
|1543|1543| 			// This does not work apparently.
|    | [NORMAL] ESLintBear (no-undef-init):
|    | It's not necessary to initialize 'targetPos' to undefined.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1568|1568| 				if (!cmpPosition || !cmpPosition.IsInWorld())
|1569|1569| 					return;
|1570|1570| 				let pos = cmpPosition.GetPosition2D();
|1571|    |-				let targetPos = undefined;
|    |1571|+				let targetPos;
|1572|1572| 
|1573|1573| 				warn("Phase 2 again."); // Remove when done.
|1574|1574| 
|    | [NORMAL] ESLintBear (no-undef-init):
|    | It's not necessary to initialize 'target' to undefined.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1575|1575| 				let players = [];
|1576|1576| 				players.push(0); // player 0 = GAIA
|1577|1577| 				let nearEnts = this.EntitiesNearPoint(pos, 200, players); // Radius ought to be large
|1578|    |-				let target = undefined;
|    |1578|+				let target;
|1579|1579| 
|1580|1580| 				let cmpRangeManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager);
|1581|1581| 				// Cycle through all the nearby entities and pick the first entity that is hidden from sight
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1687|1687| 
|1688|1688| 			"LosRangeUpdate": function(msg) {
|1689|1689| 				if (this.GetStance().targetVisibleEnemies)
|1690|    |-				{
|    |1690|+				
|1691|1691| 					// Start attacking one of the newly-seen enemy (if any)
|1692|1692| 					this.AttackEntitiesByPreference(msg.data.added);
|1693|    |-				}
|    |1693|+				
|1694|1694| 			},
|1695|1695| 
|1696|1696| 			"LosHealRangeUpdate": function(msg) {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1873|1873| 						// if nothing better to do, check if the guarded needs to be healed or repaired
|1874|1874| 						var cmpHealth = Engine.QueryInterface(this.isGuardOf, IID_Health);
|1875|1875| 						if (cmpHealth && (cmpHealth.GetHitpoints() < cmpHealth.GetMaxHitpoints()))
|1876|    |-						{
|    |1876|+						
|1877|1877| 							if (this.CanHeal(this.isGuardOf))
|1878|1878| 								this.PushOrderFront("Heal", { "target": this.isGuardOf, "force": false });
|1879|1879| 							else if (this.CanRepair(this.isGuardOf))
|1880|1880| 								this.PushOrderFront("Repair", { "target": this.isGuardOf, "autocontinue": false, "force": false });
|1881|    |-						}
|    |1881|+						
|1882|1882| 					}
|1883|1883| 				},
|1884|1884| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1958|1958| 				"MoveCompleted": function() {
|1959|1959| 
|1960|1960| 					if (this.CheckTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1961|    |-					{
|    |1961|+					
|1962|1962| 						// If the unit needs to unpack, do so
|1963|1963| 						if (this.CanUnpack())
|1964|1964| 						{
|1967|1967| 						}
|1968|1968| 						else
|1969|1969| 							this.SetNextState("ATTACKING");
|1970|    |-					}
|    |1970|+					
|1971|1971| 					else
|1972|1972| 					{
|1973|1973| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1965|1965| 							this.PushOrderFront("Unpack", { "force": true });
|1966|1966| 							return;
|1967|1967| 						}
|1968|    |-						else
|1969|    |-							this.SetNextState("ATTACKING");
|    |1968|+						this.SetNextState("ATTACKING");
|1970|1969| 					}
|1971|1970| 					else
|1972|1971| 					{
|    | [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
|1969|1969| 							this.SetNextState("ATTACKING");
|1970|1970| 					}
|1971|1971| 					else
|1972|    |-					{
|    |1972|+					
|1973|1973| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1974|1974| 						{
|1975|1975| 							this.SetNextState("APPROACHING");
|1979|1979| 							// Give up
|1980|1980| 							this.FinishOrder();
|1981|1981| 						}
|1982|    |-					}
|    |1982|+					
|1983|1983| 				},
|1984|1984| 			},
|1985|1985| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1971|1971| 					else
|1972|1972| 					{
|1973|1973| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1974|    |-						{
|    |1974|+						
|1975|1975| 							this.SetNextState("APPROACHING");
|1976|    |-						}
|    |1976|+						
|1977|1977| 						else
|1978|1978| 						{
|1979|1979| 							// Give up
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1975|1975| 							this.SetNextState("APPROACHING");
|1976|1976| 						}
|1977|1977| 						else
|1978|    |-						{
|    |1978|+						
|1979|1979| 							// Give up
|1980|1980| 							this.FinishOrder();
|1981|    |-						}
|    |1981|+						
|1982|1982| 					}
|1983|1983| 				},
|1984|1984| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1996|1996| 					}
|1997|1997| 					// Check the target is still alive and attackable
|1998|1998| 					if (this.CanAttack(target) && !this.CheckTargetAttackRange(target, this.order.data.attackType))
|1999|    |-					{
|    |1999|+					
|2000|2000| 						// Can't reach it - try to chase after it
|2001|2001| 						if (this.ShouldChaseTargetedEntity(target, this.order.data.force))
|2002|2002| 						{
|2011|2011| 								return;
|2012|2012| 							}
|2013|2013| 						}
|2014|    |-					}
|    |2014|+					
|2015|2015| 
|2016|2016| 					var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|2017|2017| 					this.attackTimers = cmpAttack.GetTimers(this.order.data.attackType);
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2042|2042| 					// TODO: we should probably only bother syncing projectile attacks, not melee
|2043|2043| 
|2044|2044| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2045|    |-					this.resyncAnimation = (prepare != this.attackTimers.prepare) ? true : false;
|    |2045|+					this.resyncAnimation = (prepare != this.attackTimers.prepare);
|2046|2046| 
|2047|2047| 					this.FaceTowardsTarget(this.order.data.target);
|2048|2048| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2171|2171| 
|2172|2172| 				"Attacked": function(msg) {
|2173|2173| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2174|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2175|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2174|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2175|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2176|2176| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2177|2177| 				},
|2178|2178| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2185|2185| 					this.SelectAnimation("move");
|2186|2186| 					var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|2187|2187| 					if (cmpUnitAI && cmpUnitAI.IsFleeing())
|2188|    |-					{
|    |2188|+					
|2189|2189| 						// Run after a fleeing target
|2190|2190| 						this.SetSpeedMultiplier(this.GetRunMultiplier());
|2191|    |-					}
|    |2191|+					
|2192|2192| 					this.StartTimer(1000, 1000);
|2193|2193| 				},
|2194|2194| 
|    | [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
|2246|2246| 						// Also don't switch to a different type of huntable animal
|2247|2247| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2248|2248| 							return (
|2249|    |-								ent != oldTarget
|2250|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2249|+								ent != oldTarget &&
|    |2250|+								 ((type.generic == "treasure" && oldType.generic == "treasure")
|2251|2251| 								 || (type.specific == oldType.specific
|2252|2252| 								 && (type.specific != "meat" || oldTemplate == template)))
|2253|2253| 							);
|    | [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| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2248|2248| 							return (
|2249|2249| 								ent != oldTarget
|2250|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2251|    |-								 || (type.specific == oldType.specific
|    |2250|+								 && ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2251|+								 (type.specific == oldType.specific
|2252|2252| 								 && (type.specific != "meat" || oldTemplate == template)))
|2253|2253| 							);
|2254|2254| 						}, oldTarget);
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2248|2248| 							return (
|2249|2249| 								ent != oldTarget
|2250|2250| 								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2251|    |-								 || (type.specific == oldType.specific
|2252|    |-								 && (type.specific != "meat" || oldTemplate == template)))
|    |2251|+								 || (type.specific == oldType.specific &&
|    |2252|+								 (type.specific != "meat" || oldTemplate == template)))
|2253|2253| 							);
|2254|2254| 						}, oldTarget);
|2255|2255| 						if (nearby)
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2257|2257| 							this.PerformGather(nearby, false, false);
|2258|2258| 							return true;
|2259|2259| 						}
|2260|    |-						else
|2261|    |-						{
|    |2260|+						
|2262|2261| 							// It's probably better in this case, to avoid units getting stuck around a dropsite
|2263|2262| 							// in a "Target is far away, full, nearby are no good resources, return to dropsite" loop
|2264|2263| 							// to order it to GatherNear the resource position.
|2279|2278| 									return true;
|2280|2279| 								}
|2281|2280| 							}
|2282|    |-						}
|    |2281|+						
|2283|2282| 						return true;
|2284|2283| 					}
|2285|2284| 					return false;
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2269|2269| 								this.GatherNearPosition(pos.x, pos.z, oldType, oldTemplate);
|2270|2270| 								return true;
|2271|2271| 							}
|2272|    |-							else
|2273|    |-							{
|    |2272|+							
|2274|2273| 								// we're kind of stuck here. Return resource.
|2275|2274| 								var nearby = this.FindNearestDropsite(oldType.generic);
|2276|2275| 								if (nearby)
|2278|2277| 									this.PushOrderFront("ReturnResource", { "target": nearby, "force": false });
|2279|2278| 									return true;
|2280|2279| 								}
|2281|    |-							}
|    |2280|+							
|2282|2281| 						}
|2283|2282| 						return true;
|2284|2283| 					}
|    | [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
|2311|2311| 						// Also don't switch to a different type of huntable animal
|2312|2312| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2313|2313| 							return (
|2314|    |-								ent != oldTarget
|2315|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2314|+								ent != oldTarget &&
|    |2315|+								((type.generic == "treasure" && oldType.generic == "treasure")
|2316|2316| 								|| (type.specific == oldType.specific
|2317|2317| 								&& (type.specific != "meat" || oldTemplate == template)))
|2318|2318| 							);
|    | [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
|2312|2312| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2313|2313| 							return (
|2314|2314| 								ent != oldTarget
|2315|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2316|    |-								|| (type.specific == oldType.specific
|    |2315|+								&& ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2316|+								(type.specific == oldType.specific
|2317|2317| 								&& (type.specific != "meat" || oldTemplate == template)))
|2318|2318| 							);
|2319|2319| 						});
|    | [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
|2313|2313| 							return (
|2314|2314| 								ent != oldTarget
|2315|2315| 								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2316|    |-								|| (type.specific == oldType.specific
|2317|    |-								&& (type.specific != "meat" || oldTemplate == template)))
|    |2316|+								|| (type.specific == oldType.specific &&
|    |2317|+								(type.specific != "meat" || oldTemplate == template)))
|2318|2318| 							);
|2319|2319| 						});
|2320|2320| 						if (nearby)
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2358|2358| 					// Also don't switch to a different type of huntable animal
|2359|2359| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2360|2360| 						return (
|2361|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2362|    |-							|| (type.specific == resourceType.specific
|    |2361|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2362|+							(type.specific == resourceType.specific
|2363|2363| 							&& (type.specific != "meat" || resourceTemplate == template))
|2364|2364| 						);
|2365|2365| 					});
|    | [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
|2359|2359| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2360|2360| 						return (
|2361|2361| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2362|    |-							|| (type.specific == resourceType.specific
|2363|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2362|+							|| (type.specific == resourceType.specific &&
|    |2363|+							(type.specific != "meat" || resourceTemplate == template))
|2364|2364| 						);
|2365|2365| 					});
|2366|2366| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2475|2475| 
|2476|2476| 					var cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply);
|2477|2477| 					if (cmpSupply && cmpSupply.IsAvailable(cmpOwnership.GetOwner(), this.entity))
|2478|    |-					{
|    |2478|+					
|2479|2479| 						// Check we can still reach and gather from the target
|2480|2480| 						if (this.CheckTargetRange(this.gatheringTarget, IID_ResourceGatherer) && this.CanGather(this.gatheringTarget))
|2481|2481| 						{
|2541|2541| 								return;
|2542|2542| 							}
|2543|2543| 						}
|2544|    |-					}
|    |2544|+					
|2545|2545| 
|2546|2546| 					// We're already in range, can't get anywhere near it or the target is exhausted.
|2547|2547| 
|    | [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
|2567|2567| 					// Also don't switch to a different type of huntable animal
|2568|2568| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2569|2569| 						return (
|2570|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2571|    |-							|| (type.specific == resourceType.specific
|    |2570|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2571|+							(type.specific == resourceType.specific
|2572|2572| 							&& (type.specific != "meat" || resourceTemplate == template))
|2573|2573| 						);
|2574|2574| 					});
|    | [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
|2568|2568| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2569|2569| 						return (
|2570|2570| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2571|    |-							|| (type.specific == resourceType.specific
|2572|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2571|+							|| (type.specific == resourceType.specific &&
|    |2572|+							(type.specific != "meat" || resourceTemplate == template))
|2573|2573| 						);
|2574|2574| 					});
|2575|2575| 					if (nearby)
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2655|2655| 					this.StartTimer(prepare, this.healTimers.repeat);
|2656|2656| 
|2657|2657| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2658|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2658|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2659|2659| 
|2660|2660| 					this.FaceTowardsTarget(this.order.data.target);
|2661|2661| 				},
|    | [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
|2870|2870| 					{
|2871|2871| 						// The building was already finished/fully repaired before we arrived;
|2872|2872| 						// let the ConstructionFinished handler handle this.
|2873|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2873|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2874|2874| 						return true;
|2875|2875| 					}
|2876|2876| 
|    | [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
|2870|2870| 					{
|2871|2871| 						// The building was already finished/fully repaired before we arrived;
|2872|2872| 						// let the ConstructionFinished handler handle this.
|2873|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2873|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2874|2874| 						return true;
|2875|2875| 					}
|2876|2876| 
|    | [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
|2910|2910| 					if (this.MoveToTargetRange(this.repairTarget, IID_Builder))
|2911|2911| 						this.SetNextState("APPROACHING");
|2912|2912| 					else if (!this.CheckTargetRange(this.repairTarget, IID_Builder))
|2913|    |-						this.FinishOrder(); //can't approach and isn't in reach
|    |2913|+						this.FinishOrder(); // can't approach and isn't in reach
|2914|2914| 				},
|2915|2915| 			},
|2916|2916| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2997|2997| 
|2998|2998| 				// Unit was approaching and there's nothing to do now, so switch to walking
|2999|2999| 				if (oldState === "INDIVIDUAL.REPAIR.APPROACHING")
|3000|    |-				{
|    |3000|+				
|3001|3001| 					// We're already walking to the given point, so add this as a order.
|3002|3002| 					this.WalkToTarget(msg.data.newentity, true);
|3003|    |-				}
|    |3003|+				
|3004|3004| 			},
|3005|3005| 		},
|3006|3006| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3050|3050| 
|3051|3051| 					// Check that we can garrison here
|3052|3052| 					if (this.CanGarrison(target))
|3053|    |-					{
|    |3053|+					
|3054|3054| 						// Check that we're in range of the garrison target
|3055|3055| 						if (this.CheckGarrisonRange(target))
|3056|3056| 						{
|3126|3126| 								return false;
|3127|3127| 							}
|3128|3128| 						}
|3129|    |-					}
|    |3129|+					
|3130|3130| 					// Garrisoning failed for some reason, so finish the order
|3131|3131| 					this.FinishOrder();
|3132|3132| 					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
|3233|3233| 		"Attacked": function(msg) {
|3234|3234| 			if (this.template.NaturalBehaviour == "skittish" ||
|3235|3235| 			    this.template.NaturalBehaviour == "passive")
|3236|    |-			{
|    |3236|+			
|3237|3237| 				this.Flee(msg.data.attacker, false);
|3238|    |-			}
|    |3238|+			
|3239|3239| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|3240|3240| 			{
|3241|3241| 				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
|3242|3242| 					this.Attack(msg.data.attacker, false);
|3243|3243| 			}
|3244|3244| 			else if (this.template.NaturalBehaviour == "domestic")
|3245|    |-			{
|    |3245|+			
|3246|3246| 				// Never flee, stop what we were doing
|3247|3247| 				this.SetNextState("IDLE");
|3248|    |-			}
|    |3248|+			
|3249|3249| 		},
|3250|3250| 
|3251|3251| 		"Order.LeaveFoundation": function(msg) {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3252|3252| 			// Move a tile outside the building
|3253|3253| 			var range = 4;
|3254|3254| 			if (this.MoveToTargetRangeExplicit(msg.data.target, range, range))
|3255|    |-			{
|    |3255|+			
|3256|3256| 				// We've started walking to the given point
|3257|3257| 				this.SetNextState("WALKING");
|3258|    |-			}
|    |3258|+			
|3259|3259| 			else
|3260|3260| 			{
|3261|3261| 				// We are already at the target, or can't move at all
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3257|3257| 				this.SetNextState("WALKING");
|3258|3258| 			}
|3259|3259| 			else
|3260|    |-			{
|    |3260|+			
|3261|3261| 				// We are already at the target, or can't move at all
|3262|3262| 				this.FinishOrder();
|3263|    |-			}
|    |3263|+			
|3264|3264| 		},
|3265|3265| 
|3266|3266| 		"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
|3299|3299| 				}
|3300|3300| 				// Start attacking one of the newly-seen enemy (if any)
|3301|3301| 				else if (this.IsDangerousAnimal())
|3302|    |-				{
|    |3302|+				
|3303|3303| 					this.AttackVisibleEntity(msg.data.added);
|3304|    |-				}
|    |3304|+				
|3305|3305| 
|3306|3306| 				// TODO: if two units enter our range together, we'll attack the
|3307|3307| 				// 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
|3342|3342| 				}
|3343|3343| 				// Start attacking one of the newly-seen enemy (if any)
|3344|3344| 				else if (this.template.NaturalBehaviour == "violent")
|3345|    |-				{
|    |3345|+				
|3346|3346| 					this.AttackVisibleEntity(msg.data.added);
|3347|    |-				}
|    |3347|+				
|3348|3348| 			},
|3349|3349| 
|3350|3350| 			"MoveCompleted": function() { },
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 7.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3359|3359| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3360|3360| 
|3361|3361| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3362|    |-							// only used for domestic animals
|    |3362|+		// only used for domestic animals
|3363|3363| 	},
|3364|3364| };
|3365|3365| 
|    | [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
|3416|3416| 
|3417|3417| UnitAI.prototype.IsAnimal = function()
|3418|3418| {
|3419|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3419|+	return (!!this.template.NaturalBehaviour);
|3420|3420| };
|3421|3421| 
|3422|3422| 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
|3454|3454| UnitAI.prototype.GetGarrisonHolder = function()
|3455|3455| {
|3456|3456| 	if (this.IsGarrisoned())
|3457|    |-	{
|    |3457|+	
|3458|3458| 		for (let order of this.orderQueue)
|3459|3459| 			if (order.type == "Garrison")
|3460|3460| 				return order.data.target;
|3461|    |-	}
|    |3461|+	
|3462|3462| 	return INVALID_ENTITY;
|3463|3463| };
|3464|3464| 
|    | [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
|3532|3532| 		{
|3533|3533| 			let index = this.GetCurrentState().indexOf(".");
|3534|3534| 			if (index != -1)
|3535|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3535|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3536|3536| 			this.Stop(false);
|3537|3537| 		}
|3538|3538| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3588|3588| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3589|3589| 			continue;
|3590|3590| 		if (i == 0)
|3591|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3591|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3592|3592| 		else
|3593|3593| 			this.orderQueue.splice(i, 1);
|3594|3594| 		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
|3588|3588| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3589|3589| 			continue;
|3590|3590| 		if (i == 0)
|3591|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3591|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3592|3592| 		else
|3593|3593| 			this.orderQueue.splice(i, 1);
|3594|3594| 		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
|3672|3672| };
|3673|3673| 
|3674|3674| 
|3675|    |-//// FSM linkage functions ////
|    |3675|+// // FSM linkage functions ////
|3676|3676| 
|3677|3677| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3678|3678| 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
|3844|3844| 				continue;
|3845|3845| 			if (this.orderQueue[i].type == type)
|3846|3846| 				continue;
|3847|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3847|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3848|3848| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3849|3849| 			return;
|3850|3850| 		}
|    | [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
|3844|3844| 				continue;
|3845|3845| 			if (this.orderQueue[i].type == type)
|3846|3846| 				continue;
|3847|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3847|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3848|3848| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3849|3849| 			return;
|3850|3850| 		}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3858|3858| {
|3859|3859| 	// Remember the previous work orders to be able to go back to them later if required
|3860|3860| 	if (data && data.force)
|3861|    |-	{
|    |3861|+	
|3862|3862| 		if (this.IsFormationController())
|3863|3863| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3864|3864| 		else
|3865|3865| 			this.UpdateWorkOrders(type);
|3866|    |-	}
|    |3866|+	
|3867|3867| 
|3868|3868| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3869|3869| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3935|3935| 	{
|3936|3936| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3937|3937| 		if (cmpUnitAI)
|3938|    |-		{
|    |3938|+		
|3939|3939| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3940|3940| 			{
|3941|3941| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3944|3944| 					return;
|3945|3945| 				}
|3946|3946| 			}
|3947|    |-		}
|    |3947|+		
|3948|3948| 	}
|3949|3949| 
|3950|3950| 	// 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
|3937|3937| 		if (cmpUnitAI)
|3938|3938| 		{
|3939|3939| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3940|    |-			{
|    |3940|+			
|3941|3941| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3942|3942| 				{
|3943|3943| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3944|3944| 					return;
|3945|3945| 				}
|3946|    |-			}
|    |3946|+			
|3947|3947| 		}
|3948|3948| 	}
|3949|3949| 
|    | [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
|3949|3949| 
|3950|3950| 	// If nothing found, take the unit orders
|3951|3951| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3952|    |-	{
|    |3952|+	
|3953|3953| 		if (isWorkType(this.orderQueue[i].type))
|3954|3954| 		{
|3955|3955| 			this.workOrders = this.orderQueue.slice(i);
|3956|3956| 			return;
|3957|3957| 		}
|3958|    |-	}
|    |3958|+	
|3959|3959| };
|3960|3960| 
|3961|3961| 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
|4015|4015| 	if (data.timerRepeat === undefined)
|4016|4016| 		this.timer = undefined;
|4017|4017| 
|4018|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4018|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4019|4019| };
|4020|4020| 
|4021|4021| /**
|    | [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
|4015|4015| 	if (data.timerRepeat === undefined)
|4016|4016| 		this.timer = undefined;
|4017|4017| 
|4018|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4018|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4019|4019| };
|4020|4020| 
|4021|4021| /**
|    | [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
|4050|4050| 	this.timer = undefined;
|4051|4051| };
|4052|4052| 
|4053|    |-//// Message handlers /////
|    |4053|+// // Message handlers /////
|4054|4054| 
|4055|4055| UnitAI.prototype.OnMotionChanged = function(msg)
|4056|4056| {
|    | [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
|4055|4055| UnitAI.prototype.OnMotionChanged = function(msg)
|4056|4056| {
|4057|4057| 	if (msg.starting && !msg.error)
|4058|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |4058|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveStarted", "data": msg});
|4059|4059| 	else if (!msg.starting || msg.error)
|4060|4060| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|4061|4061| };
|    | [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
|4055|4055| UnitAI.prototype.OnMotionChanged = function(msg)
|4056|4056| {
|4057|4057| 	if (msg.starting && !msg.error)
|4058|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |4058|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg });
|4059|4059| 	else if (!msg.starting || msg.error)
|4060|4060| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|4061|4061| };
|    | [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
|4057|4057| 	if (msg.starting && !msg.error)
|4058|4058| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|4059|4059| 	else if (!msg.starting || msg.error)
|4060|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |4060|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveCompleted", "data": msg});
|4061|4061| };
|4062|4062| 
|4063|4063| UnitAI.prototype.OnGlobalConstructionFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4057|4057| 	if (msg.starting && !msg.error)
|4058|4058| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|4059|4059| 	else if (!msg.starting || msg.error)
|4060|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |4060|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg });
|4061|4061| };
|4062|4062| 
|4063|4063| UnitAI.prototype.OnGlobalConstructionFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4065|4065| 	// TODO: This is a bit inefficient since every unit listens to every
|4066|4066| 	// construction message - ideally we could scope it to only the one we're building
|4067|4067| 
|4068|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4068|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4069|4069| };
|4070|4070| 
|4071|4071| 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
|4065|4065| 	// TODO: This is a bit inefficient since every unit listens to every
|4066|4066| 	// construction message - ideally we could scope it to only the one we're building
|4067|4067| 
|4068|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4068|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4069|4069| };
|4070|4070| 
|4071|4071| 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
|4090|4090| 
|4091|4091| UnitAI.prototype.OnAttacked = function(msg)
|4092|4092| {
|4093|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4093|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4094|4094| };
|4095|4095| 
|4096|4096| 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
|4090|4090| 
|4091|4091| UnitAI.prototype.OnAttacked = function(msg)
|4092|4092| {
|4093|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4093|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4094|4094| };
|4095|4095| 
|4096|4096| 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
|4095|4095| 
|4096|4096| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4097|4097| {
|4098|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4098|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4099|4099| };
|4100|4100| 
|4101|4101| 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
|4095|4095| 
|4096|4096| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4097|4097| {
|4098|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4098|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4099|4099| };
|4100|4100| 
|4101|4101| 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
|4100|4100| 
|4101|4101| UnitAI.prototype.OnHealthChanged = function(msg)
|4102|4102| {
|4103|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4103|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4104|4104| };
|4105|4105| 
|4106|4106| 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
|4100|4100| 
|4101|4101| UnitAI.prototype.OnHealthChanged = function(msg)
|4102|4102| {
|4103|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4103|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4104|4104| };
|4105|4105| 
|4106|4106| 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
|4106|4106| UnitAI.prototype.OnRangeUpdate = function(msg)
|4107|4107| {
|4108|4108| 	if (msg.tag == this.losRangeQuery)
|4109|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4109|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4110|4110| 	else if (msg.tag == this.losHealRangeQuery)
|4111|4111| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4112|4112| };
|    | [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
|4106|4106| UnitAI.prototype.OnRangeUpdate = function(msg)
|4107|4107| {
|4108|4108| 	if (msg.tag == this.losRangeQuery)
|4109|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4109|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4110|4110| 	else if (msg.tag == this.losHealRangeQuery)
|4111|4111| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4112|4112| };
|    | [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
|4108|4108| 	if (msg.tag == this.losRangeQuery)
|4109|4109| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4110|4110| 	else if (msg.tag == this.losHealRangeQuery)
|4111|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4111|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4112|4112| };
|4113|4113| 
|4114|4114| 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
|4108|4108| 	if (msg.tag == this.losRangeQuery)
|4109|4109| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4110|4110| 	else if (msg.tag == this.losHealRangeQuery)
|4111|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4111|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4112|4112| };
|4113|4113| 
|4114|4114| 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
|4113|4113| 
|4114|4114| UnitAI.prototype.OnPackFinished = function(msg)
|4115|4115| {
|4116|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4116|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4117|4117| };
|4118|4118| 
|4119|4119| //// 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
|4113|4113| 
|4114|4114| UnitAI.prototype.OnPackFinished = function(msg)
|4115|4115| {
|4116|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4116|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4117|4117| };
|4118|4118| 
|4119|4119| //// 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
|4116|4116| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4117|4117| };
|4118|4118| 
|4119|    |-//// Helper functions to be called by the FSM ////
|    |4119|+// // Helper functions to be called by the FSM ////
|4120|4120| 
|4121|4121| UnitAI.prototype.GetWalkSpeed = function()
|4122|4122| {
|    | [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
|4218|4218| 	if (!cmpOwnership || cmpOwnership.GetOwner() == INVALID_PLAYER)
|4219|4219| 		return undefined;
|4220|4220| 
|4221|    |-	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position)
|    |4221|+	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
|4222|4222| 	if (!cmpPosition || !cmpPosition.IsInWorld())
|4223|4223| 		return undefined;
|4224|4224| 
|    | [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
|4303|4303| 			PlaySound(name, member);
|4304|4304| 	}
|4305|4305| 	else
|4306|    |-	{
|    |4306|+	
|4307|4307| 		// Otherwise use our own sounds
|4308|4308| 		PlaySound(name, this.entity);
|4309|    |-	}
|    |4309|+	
|4310|4310| };
|4311|4311| 
|4312|4312| /*
|    | [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
|4472|4472| 	else
|4473|4473| 		// return false? Or hope you come close enough?
|4474|4474| 		var parabolicMaxRange = 0;
|4475|    |-		//return false;
|    |4475|+		// return false;
|4476|4476| 
|4477|4477| 	// the parabole changes while walking, take something in the middle
|4478|4478| 	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
|4537|4537| 	if (this.IsFormationMember())
|4538|4538| 	{
|4539|4539| 		var cmpFormationUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|4540|    |-		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation()
|4541|    |-			&& cmpFormationUnitAI.order.data.target == target)
|    |4540|+		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation() &&
|    |4541|+			cmpFormationUnitAI.order.data.target == target)
|4542|4542| 			return true;
|4543|4543| 	}
|4544|4544| 
|    | [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
|4705|4705| UnitAI.prototype.AttackEntityInZone = function(ents)
|4706|4706| {
|4707|4707| 	var target = ents.find(target =>
|4708|    |-		this.CanAttack(target)
|4709|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4708|+		this.CanAttack(target) &&
|    |4709|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4710|4710| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4711|4711| 	);
|4712|4712| 	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
|4706|4706| {
|4707|4707| 	var target = ents.find(target =>
|4708|4708| 		this.CanAttack(target)
|4709|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4710|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4709|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4710|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4711|4711| 	);
|4712|4712| 	if (!target)
|4713|4713| 		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
|4770|4770| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4771|4771| 	if (this.isGuardOf)
|4772|4772| 	{
|4773|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4773|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4774|4774| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4775|4775| 		if (cmpUnitAI && cmpAttack &&
|4776|4776| 		    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
|4774|4774| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4775|4775| 		if (cmpUnitAI && cmpAttack &&
|4776|4776| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4777|    |-				return false;
|    |4777|+			return false;
|4778|4778| 	}
|4779|4779| 
|4780|4780| 	// 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
|4779|4779| 
|4780|4780| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4781|4781| 	if (this.GetStance().respondHoldGround)
|4782|    |-	{
|    |4782|+	
|4783|4783| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4784|4784| 			return true;
|4785|    |-	}
|    |4785|+	
|4786|4786| 
|4787|4787| 	// Stop if it's left our vision range, unless we're especially persistent
|4788|4788| 	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
|4786|4786| 
|4787|4787| 	// Stop if it's left our vision range, unless we're especially persistent
|4788|4788| 	if (!this.GetStance().respondChaseBeyondVision)
|4789|    |-	{
|    |4789|+	
|4790|4790| 		if (!this.CheckTargetIsInVisionRange(target))
|4791|4791| 			return true;
|4792|    |-	}
|    |4792|+	
|4793|4793| 
|4794|4794| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4795|4795| 	// 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
|4812|4812| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4813|4813| 	if (this.isGuardOf)
|4814|4814| 	{
|4815|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4815|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4816|4816| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4817|4817| 		if (cmpUnitAI && cmpAttack &&
|4818|4818| 		    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
|4825|4825| 	return false;
|4826|4826| };
|4827|4827| 
|4828|    |-//// External interface functions ////
|    |4828|+// // External interface functions ////
|4829|4829| 
|4830|4830| UnitAI.prototype.SetFormationController = function(ent)
|4831|4831| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4835|4835| 	// of our own formation (or ourself if not in formation)
|4836|4836| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4837|4837| 	if (cmpObstruction)
|4838|    |-	{
|    |4838|+	
|4839|4839| 		if (ent == INVALID_ENTITY)
|4840|4840| 			cmpObstruction.SetControlGroup(this.entity);
|4841|4841| 		else
|4842|4842| 			cmpObstruction.SetControlGroup(ent);
|4843|    |-	}
|    |4843|+	
|4844|4844| 
|4845|4845| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4846|4846| 	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
|4979|4979| 	// if we already had an old guard order, do nothing if the target is the same
|4980|4980| 	// and the order is running, otherwise remove the previous order
|4981|4981| 	if (this.isGuardOf)
|4982|    |-	{
|    |4982|+	
|4983|4983| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4984|4984| 			return;
|4985|4985| 		else
|4986|4986| 			this.RemoveGuard();
|4987|    |-	}
|    |4987|+	
|4988|4988| 
|4989|4989| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4990|4990| };
|    | [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
|4982|4982| 	{
|4983|4983| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4984|4984| 			return;
|4985|    |-		else
|4986|    |-			this.RemoveGuard();
|    |4985|+		this.RemoveGuard();
|4987|4986| 	}
|4988|4987| 
|4989|4988| 	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
|5162|5162| 			this.WalkToTarget(target, queued);
|5163|5163| 		return;
|5164|5164| 	}
|5165|    |-	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture}, queued);
|    |5165|+	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture }, queued);
|5166|5166| };
|5167|5167| 
|5168|5168| /**
|    | [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
|5311|5311| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5312|5312| 	{
|5313|5313| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5314|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5314|+		if (cmpTrader.HasBothMarkets() &&
|5315|5315| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5316|5316| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5317|5317| 		{
|    | [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
|5592|5592| 				{
|5593|5593| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5594|5594| 					var targetClasses = this.order.data.targetClasses;
|5595|    |-					if (targetClasses.attack && cmpIdentity
|5596|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5595|+					if (targetClasses.attack && cmpIdentity &&
|    |5596|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5597|5597| 						continue;
|5598|5598| 					if (targetClasses.avoid && cmpIdentity
|5599|5599| 						&& 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
|5595|5595| 					if (targetClasses.attack && cmpIdentity
|5596|5596| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5597|5597| 						continue;
|5598|    |-					if (targetClasses.avoid && cmpIdentity
|5599|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5598|+					if (targetClasses.avoid && cmpIdentity &&
|    |5599|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5600|5600| 						continue;
|5601|5601| 					// Only used by the AIs to prevent some choices of targets
|5602|5602| 					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
|5618|5618| 		{
|5619|5619| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5620|5620| 			var targetClasses = this.order.data.targetClasses;
|5621|    |-			if (cmpIdentity && targetClasses.attack
|5622|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5621|+			if (cmpIdentity && targetClasses.attack &&
|    |5622|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5623|5623| 				continue;
|5624|5624| 			if (cmpIdentity && targetClasses.avoid
|5625|5625| 				&& 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
|5621|5621| 			if (cmpIdentity && targetClasses.attack
|5622|5622| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5623|5623| 				continue;
|5624|    |-			if (cmpIdentity && targetClasses.avoid
|5625|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5624|+			if (cmpIdentity && targetClasses.avoid &&
|    |5625|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5626|5626| 				continue;
|5627|5627| 			// Only used by the AIs to prevent some choices of targets
|5628|5628| 			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
|5780|5780| 
|5781|5781| UnitAI.prototype.SetHeldPosition = function(x, z)
|5782|5782| {
|5783|    |-	this.heldPosition = {"x": x, "z": z};
|    |5783|+	this.heldPosition = { "x": x, "z": z};
|5784|5784| };
|5785|5785| 
|5786|5786| 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
|5780|5780| 
|5781|5781| UnitAI.prototype.SetHeldPosition = function(x, z)
|5782|5782| {
|5783|    |-	this.heldPosition = {"x": x, "z": z};
|    |5783|+	this.heldPosition = {"x": x, "z": z };
|5784|5784| };
|5785|5785| 
|5786|5786| 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
|5807|5807| 	return false;
|5808|5808| };
|5809|5809| 
|5810|    |-//// Helper functions ////
|    |5810|+// // Helper functions ////
|5811|5811| 
|5812|5812| UnitAI.prototype.CanAttack = function(target)
|5813|5813| {
|    | [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
|6011|6011| 	return cmpPack && cmpPack.IsPacking();
|6012|6012| };
|6013|6013| 
|6014|    |-//// Formation specific functions ////
|    |6014|+// // Formation specific functions ////
|6015|6015| 
|6016|6016| UnitAI.prototype.IsAttackingAsFormation = function()
|6017|6017| {
|    | [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
|6016|6016| UnitAI.prototype.IsAttackingAsFormation = function()
|6017|6017| {
|6018|6018| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6019|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6020|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6019|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6020|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6021|6021| };
|6022|6022| 
|6023|6023| //// 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
|6020|6020| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6021|6021| };
|6022|6022| 
|6023|    |-//// Animal specific functions ////
|    |6023|+// // Animal specific functions ////
|6024|6024| 
|6025|6025| UnitAI.prototype.MoveRandomly = function(distance)
|6026|6026| {

binaries/data/mods/public/simulation/components/UnitAI.js
|2557| »   »   »   »   »   »   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
|3920| »   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
|4692| »   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
|4707| »   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
|4753| »   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
|4776| »   »   ····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
|5242| »   var·lastPos·=·undefined;
|    | [NORMAL] ESLintBear (no-undef-init):
|    | It's not necessary to initialize 'lastPos' to undefined.

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

binaries/data/mods/public/simulation/components/UnitAI.js
|1488| »   »   »   »   let·targetPos·=·undefined;
|    | [NORMAL] JSHintBear:
|    | It's not necessary to initialize 'targetPos' to 'undefined'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1495| »   »   »   »   let·target·=·undefined;
|    | [NORMAL] JSHintBear:
|    | It's not necessary to initialize 'target' to 'undefined'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1571| »   »   »   »   let·targetPos·=·undefined;
|    | [NORMAL] JSHintBear:
|    | It's not necessary to initialize 'targetPos' to 'undefined'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1578| »   »   »   »   let·target·=·undefined;
|    | [NORMAL] JSHintBear:
|    | It's not necessary to initialize 'target' to 'undefined'.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4485| »   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
|4541| »   »   »   &&·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
|4709| »   »   &&·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
|4710| »   »   &&·(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
|5242| »   var·lastPos·=·undefined;
|    | [NORMAL] JSHintBear:
|    | It's not necessary to initialize 'lastPos' to 'undefined'.

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

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

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

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

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

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

I would stay with x, y. As it is 2d not 3d positioning system.

source/simulation2/components/CCmpRangeManager.cpp
1

2019

source/simulation2/components/ICmpRangeManager.cpp
1

2019

source/simulation2/components/ICmpRangeManager.h
1

2019

423

actually this should be is position explored as you are passing position in the world and this converts it to tile system

Stan added inline comments.May 19 2019, 10:22 AM
source/simulation2/components/CCmpRangeManager.cpp
2441

static_cast<int> Though I'm not sure the cast is needed at all.

Silier requested changes to this revision.EditedMay 19 2019, 10:27 AM

On the second thought you should probably change it to ShouldPlayerExplorePosition and return true if tile is not explored and is in the world. Use funtions IsLosOfWorld else entity will try to reach unreachable area out of world.

Freagarach marked 6 inline comments as done.May 19 2019, 11:58 AM
In D1851#78567, @Angen wrote:

On the second thought you should probably change it to ShouldPlayerExplorePosition and return true if tile is not explored and is in the world. Use funtions IsLosOfWorld else entity will try to reach unreachable area out of world.

Can't I just rename it to "IsPositionExplored" and still do the check whether it is in world? Because I think it would be odd to ever check for a position off-world. Then we just assume that every position off-world is explored. If we do want to keep it generic I would name it: "CanPlayerExplorePosition".

source/simulation2/components/CCmpRangeManager.cpp
2441

I've got no clue as to what that means ;)

Silier added a comment.EditedMay 19 2019, 12:53 PM

Maybe now you will not send position which is out of world but the function itself should return correct answer with any parameters given.

To have name Ispositionexplored and return true if out of world while positions out of world are not explored is not correct.

Canplayerexploreposition is basicly saying if it is allowed for player to explore it so maybe this.

My point is this is going to be called from js so name should state clearly what is the result. It should have not hidden behaviour.

Another side of this approach picking position based on gaia entities.

What if it picks wolf or lion and goes there and dies stupidly because there will be group of them waiting?

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

SelectAnimation("move")

Stan added inline comments.May 19 2019, 1:02 PM
source/simulation2/components/CCmpRangeManager.cpp
2441

In JavaScript you don't have to bother much which types as even if you do sometehing stupid most of the time it will fix it for you. In C++ one has to be careful as to not make divisions on int because 1 /2 = 0

(type)(number) is a C- style cast which mean it will try static_cast<type>(number), then reinterpret_cast<type>(number), then const_cast<type>(number) to make the conversion.

In this case though .ToInt_RoundToNearest(); will probably cast the result to int anyway. @Angen might tell you more about it :)

Freagarach marked an inline comment as done.May 19 2019, 1:12 PM
In D1851#78605, @Angen wrote:

Maybe now you will not send position which is out of world but the function itself should return correct answer with any parameters given.

To have name Ispositionexplored and return true if out of world while positions out of world are not explored is not correct.

Canplayerexploreposition is basicly saying if it is allowed for player to explore it so maybe this.

My point is this is going to be called from js so name should state clearly what is the result. It should have not hidden behaviour.

Another side of this approach picking position based on gaia entities.

What if it picks wolf or lion and goes there and dies stupidly because there will be group of them waiting?

Okay, I agree!
The reason I needed the function to check whether a position is explored was because I wanted to shift from picking GAIA-entities to picking positions. As of now I have reached that stage and I am trying to make it kind of logical ;) Besides, automatic scouting should always be worse than player initiated scouting, I guess. But that is a design decision ;)

Silier added inline comments.
source/simulation2/components/CCmpRangeManager.cpp
2441

first one is enity_post type so result of / is basicly float with fixed floating point so result represents float number but with type entity_pos_t
to nearest means 0.6 -> 1 not 0, not sure for 0.5.

This formula is used to convert position to tiles when determining if player sees entity. (so nothing made up)

Terrain_tile_size is integer number but macro does not know types.
What it does is that before compilation it is replaced by 8 for example, so I think cast is not needed here as that macro should always be integer

@vladislavbelov?

Stan added inline comments.May 19 2019, 1:45 PM
source/simulation2/components/CCmpRangeManager.cpp
2441

I meant int a = 1 int b = 2 int c = a / b // 0

not the round to nearest :)

Silier added inline comments.May 19 2019, 2:18 PM
source/simulation2/components/CCmpRangeManager.cpp
2441

I know :) I was reacting to

ToInt_RoundToNearest(); will probably cast the result to int anyway. @Angen might tell you more about it :)

and to be correct 0.5 -> 1

Back to the point
(int)TERRAIN_TILE_SIZE is the same as to have (int)6

I have a question on how to proceed. I have basically three options now:

  1. Use the point at which the scout command is given as a reference point and scout in ever increasing circles. (Note that this will not use the hard-fought new function.)
  2. Use the entity's current location and move (semi-)randomly to the nearest unexplored territory.
  3. Just randomly pick unexplored locations in the map and try to move to it, even if the first point is very far away.

There may be other options, which I would love to hear ;) I currently am trying to implement the second method.

Freagarach updated this revision to Diff 8064.May 19 2019, 4:34 PM
Freagarach edited the summary of this revision. (Show Details)
Freagarach edited the test plan for this revision. (Show Details)
  • Let the method use positions rather than GAIA-entities
  • Changed C-function name
  • Changed years in C-files

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 'for-of'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/selection_panels_helpers.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/selection_panels_helpers.js
| 423| 423| 	let otherEnts = [];
| 424| 424| 
| 425| 425| 	for (let ent of garrisonHolders)
| 426|    |-	{
|    | 426|+	
| 427| 427| 		if (controlsPlayer(GetEntityState(ent).player))
| 428| 428| 			ownEnts.push(ent);
| 429| 429| 		else
| 430| 430| 			otherEnts.push(ent);
| 431|    |-	}
|    | 431|+	
| 432| 432| 
| 433| 433| 	if (ownEnts.length)
| 434| 434| 		Engine.PostNetworkCommand({

binaries/data/mods/public/gui/session/unit_actions.js
| 557| »   »   »   switch·(tradingDetails.type)
|    | [NORMAL] ESLintBear (default-case):
|    | Expected a default case.
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
| 330| 330| 			{
| 331| 331| 				var list = queue.GetEntitiesList();
| 332| 332| 				if (list.indexOf(cmd.template) === -1 && cmd.promoted)
| 333|    |-				{
|    | 333|+				
| 334| 334| 					for (var promoted of cmd.promoted)
| 335| 335| 					{
| 336| 336| 						if (list.indexOf(promoted) === -1)
| 338| 338| 						cmd.template = promoted;
| 339| 339| 						break;
| 340| 340| 					}
| 341|    |-				}
|    | 341|+				
| 342| 342| 			}
| 343| 343| 			if (queue && queue.GetEntitiesList().indexOf(cmd.template) != -1)
| 344| 344| 				if ("metadata" in cmd)
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
| 544| 544| 			if (cmpGarrisonHolder)
| 545| 545| 			{
| 546| 546| 				// Only the owner of the garrisonHolder may unload entities from any owners
| 547|    |-				if (!IsOwnedByPlayer(player, garrisonHolder) && !data.controlAllUnits
| 548|    |-				    && player != +cmd.owner)
|    | 547|+				if (!IsOwnedByPlayer(player, garrisonHolder) && !data.controlAllUnits &&
|    | 548|+				    player != +cmd.owner)
| 549| 549| 						continue;
| 550| 550| 
| 551| 551| 				if (!cmpGarrisonHolder.UnloadTemplate(cmd.template, cmd.owner, cmd.all))
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
| 546| 546| 				// Only the owner of the garrisonHolder may unload entities from any owners
| 547| 547| 				if (!IsOwnedByPlayer(player, garrisonHolder) && !data.controlAllUnits
| 548| 548| 				    && player != +cmd.owner)
| 549|    |-						continue;
|    | 549|+					continue;
| 550| 550| 
| 551| 551| 				if (!cmpGarrisonHolder.UnloadTemplate(cmd.template, cmd.owner, cmd.all))
| 552| 552| 					notifyUnloadFailure(player, garrisonHolder);
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
| 956| 956| 		{
| 957| 957| 			var count = 0;
| 958| 958| 			for (let j = 0; j < length - 1; ++j)
| 959|    |-			{
|    | 959|+			
| 960| 960| 				if ((waterPoints[(i + j) % length] + 1) % numPoints == waterPoints[(i + j + 1) % length])
| 961| 961| 					++count;
| 962| 962| 				else
| 963| 963| 					break;
| 964|    |-			}
|    | 964|+			
| 965| 965| 			consec[i] = count;
| 966| 966| 		}
| 967| 967| 		var start = 0;
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-in'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
| 967| 967| 		var start = 0;
| 968| 968| 		var count = 0;
| 969| 969| 		for (var c in consec)
| 970|    |-		{
|    | 970|+		
| 971| 971| 			if (consec[c] > count)
| 972| 972| 			{
| 973| 973| 				start = c;
| 974| 974| 				count = consec[c];
| 975| 975| 			}
| 976|    |-		}
|    | 976|+		
| 977| 977| 
| 978| 978| 		// If we've found a shoreline, stop searching
| 979| 979| 		if (count != numPoints-1)
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space after key 'metadata'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1150|1150| 
|1151|1151| 	// send Metadata info if any
|1152|1152| 	if (cmd.metadata)
|1153|    |-		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player } );
|    |1153|+		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata": cmd.metadata, "owner" : player } );
|1154|1154| 
|1155|1155| 	// Tell the units to start building this new entity
|1156|1156| 	if (cmd.autorepair)
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space after key 'owner'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1150|1150| 
|1151|1151| 	// send Metadata info if any
|1152|1152| 	if (cmd.metadata)
|1153|    |-		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player } );
|    |1153|+		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner": player } );
|1154|1154| 
|1155|1155| 	// Tell the units to start building this new entity
|1156|1156| 	if (cmd.autorepair)
|    | [NORMAL] ESLintBear (space-in-parens):
|    | There should be no spaces inside this paren.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1150|1150| 
|1151|1151| 	// send Metadata info if any
|1152|1152| 	if (cmd.metadata)
|1153|    |-		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player } );
|    |1153|+		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player });
|1154|1154| 
|1155|1155| 	// Tell the units to start building this new entity
|1156|1156| 	if (cmd.autorepair)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1154|1154| 
|1155|1155| 	// Tell the units to start building this new entity
|1156|1156| 	if (cmd.autorepair)
|1157|    |-	{
|    |1157|+	
|1158|1158| 		ProcessCommand(player, {
|1159|1159| 			"type": "repair",
|1160|1160| 			"entities": entities,
|1162|1162| 			"autocontinue": cmd.autocontinue,
|1163|1163| 			"queued": cmd.queued
|1164|1164| 		});
|1165|    |-	}
|    |1165|+	
|1166|1166| 
|1167|1167| 	return ent;
|1168|1168| }
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1258|1258| 		}
|1259|1259| 
|1260|1260| 		lastTowerControlGroup = cmpSnappedStartObstruction.GetControlGroup();
|1261|    |-		//warn("setting lastTowerControlGroup to control group of start snapped entity " + cmd.startSnappedEntity + ": " + lastTowerControlGroup);
|    |1261|+		// warn("setting lastTowerControlGroup to control group of start snapped entity " + cmd.startSnappedEntity + ": " + lastTowerControlGroup);
|1262|1262| 	}
|1263|1263| 
|1264|1264| 	var i = 0;
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1275|1275| 		// 'lastTowerControlGroup' must always be defined and valid here, except if we're at the first piece and we didn't do
|1276|1276| 		// start position snapping (implying that the first entity we build must be a tower)
|1277|1277| 		if (lastTowerControlGroup === null || lastTowerControlGroup == INVALID_ENTITY)
|1278|    |-		{
|    |1278|+		
|1279|1279| 			if (!(i == 0 && piece.template == cmd.wallSet.templates.tower && !cmd.startSnappedEntity))
|1280|1280| 			{
|1281|1281|     			error("[TryConstructWall] Expected last tower control group to be available, none found (1st pass, iteration " + i + ")");
|1282|1282|     			break;
|1283|1283| 			}
|1284|    |-		}
|    |1284|+		
|1285|1285| 
|1286|1286| 		var constructPieceCmd = {
|1287|1287| 			"type": "construct",
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1322|1322| 
|1323|1323| 				if (i > 0)
|1324|1324| 				{
|1325|    |-					//warn("   updating previous wall piece's secondary control group to " + newTowerControlGroup);
|    |1325|+					// warn("   updating previous wall piece's secondary control group to " + newTowerControlGroup);
|1326|1326| 					var cmpPreviousObstruction = Engine.QueryInterface(pieces[i-1].ent, IID_Obstruction);
|1327|1327| 					// TODO: ensure that cmpPreviousObstruction exists
|1328|1328| 					// TODO: ensure that the previous obstruction does not yet have a secondary control group set
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1380|1380| 		}
|1381|1381| 
|1382|1382| 		if (piece.template == cmd.wallSet.templates.tower)
|1383|    |-		{
|    |1383|+		
|1384|1384| 			// encountered a tower entity, update the last tower control group
|1385|1385| 			lastTowerControlGroup = cmpPieceObstruction.GetControlGroup();
|1386|    |-		}
|    |1386|+		
|1387|1387| 		else
|1388|1388| 		{
|1389|1389| 			// Encountered a non-tower entity, update its secondary control group to 'lastTowerControlGroup'.
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1394|1394| 			if (existingSecondaryControlGroup == INVALID_ENTITY)
|1395|1395| 			{
|1396|1396| 				if (lastTowerControlGroup != null && lastTowerControlGroup != INVALID_ENTITY)
|1397|    |-				{
|    |1397|+				
|1398|1398| 					cmpPieceObstruction.SetControlGroup2(lastTowerControlGroup);
|1399|    |-				}
|    |1399|+				
|1400|1400| 			}
|1401|1401| 			else if (existingSecondaryControlGroup != lastTowerControlGroup)
|1402|1402| 			{
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1469|1469| 	}
|1470|1470| 
|1471|1471| 	if (formedEnts.length == 0)
|1472|    |-	{
|    |1472|+	
|1473|1473| 		// No units support the formation - return all the others
|1474|1474| 		return nonformedUnitAIs;
|1475|    |-	}
|    |1475|+	
|1476|1476| 
|1477|1477| 	// Find what formations the formationable selected entities are currently in
|1478|1478| 	var formation = ExtractFormations(formedEnts);
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1485|1485| 		// Check that all its members are selected
|1486|1486| 		var fid = formationIds[0];
|1487|1487| 		var cmpFormation = Engine.QueryInterface(+fid, IID_Formation);
|1488|    |-		if (cmpFormation && cmpFormation.GetMemberCount() == formation.members[fid].length
|1489|    |-			&& cmpFormation.GetMemberCount() == formation.entities.length)
|    |1488|+		if (cmpFormation && cmpFormation.GetMemberCount() == formation.members[fid].length &&
|    |1489|+			cmpFormation.GetMemberCount() == formation.entities.length)
|1490|1490| 		{
|1491|1491| 			cmpFormation.DeleteTwinFormations();
|1492|1492| 			// The whole formation was selected, so reuse its controller for this command
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1517|1517| 					{
|1518|1518| 						var template = cmpUnitAI.GetFormationTemplate();
|1519|1519| 						if (lastFormationTemplate === undefined)
|1520|    |-						{
|    |1520|+						
|1521|1521| 							lastFormationTemplate = template;
|1522|    |-						}
|    |1522|+						
|1523|1523| 						else if (lastFormationTemplate != template)
|1524|1524| 						{
|1525|1525| 							lastFormationTemplate = undefined;
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1593|1593| 		for (var i = matrix.length - 1; i >= 0 && !closeClusters; --i)
|1594|1594| 			for (var j = i - 1; j >= 0 && !closeClusters; --j)
|1595|1595| 				if (matrix[i][j] < distSq)
|1596|    |-					closeClusters = [i,j];
|    |1596|+					closeClusters = [i, j];
|1597|1597| 
|1598|1598| 		// if no more close clusters found, just return all found clusters so far
|1599|1599| 		if (!closeClusters)
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1615|1615| 		}
|1616|1616| 		// remove the rows and columns in the matrix for the merged clusters,
|1617|1617| 		// and the clusters themselves from the cluster list
|1618|    |-		clusters.splice(closeClusters[0],1);
|    |1618|+		clusters.splice(closeClusters[0], 1);
|1619|1619| 		clusters.splice(closeClusters[1],1);
|1620|1620| 		matrix.splice(closeClusters[0],1);
|1621|1621| 		matrix.splice(closeClusters[1],1);
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1616|1616| 		// remove the rows and columns in the matrix for the merged clusters,
|1617|1617| 		// and the clusters themselves from the cluster list
|1618|1618| 		clusters.splice(closeClusters[0],1);
|1619|    |-		clusters.splice(closeClusters[1],1);
|    |1619|+		clusters.splice(closeClusters[1], 1);
|1620|1620| 		matrix.splice(closeClusters[0],1);
|1621|1621| 		matrix.splice(closeClusters[1],1);
|1622|1622| 		for (let i = 0; i < matrix.length; ++i)
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1617|1617| 		// and the clusters themselves from the cluster list
|1618|1618| 		clusters.splice(closeClusters[0],1);
|1619|1619| 		clusters.splice(closeClusters[1],1);
|1620|    |-		matrix.splice(closeClusters[0],1);
|    |1620|+		matrix.splice(closeClusters[0], 1);
|1621|1621| 		matrix.splice(closeClusters[1],1);
|1622|1622| 		for (let i = 0; i < matrix.length; ++i)
|1623|1623| 		{
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1618|1618| 		clusters.splice(closeClusters[0],1);
|1619|1619| 		clusters.splice(closeClusters[1],1);
|1620|1620| 		matrix.splice(closeClusters[0],1);
|1621|    |-		matrix.splice(closeClusters[1],1);
|    |1621|+		matrix.splice(closeClusters[1], 1);
|1622|1622| 		for (let i = 0; i < matrix.length; ++i)
|1623|1623| 		{
|1624|1624| 			if (matrix[i].length > closeClusters[0])
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1622|1622| 		for (let i = 0; i < matrix.length; ++i)
|1623|1623| 		{
|1624|1624| 			if (matrix[i].length > closeClusters[0])
|1625|    |-				matrix[i].splice(closeClusters[0],1);
|    |1625|+				matrix[i].splice(closeClusters[0], 1);
|1626|1626| 			if (matrix[i].length > closeClusters[1])
|1627|1627| 				matrix[i].splice(closeClusters[1],1);
|1628|1628| 		}
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1624|1624| 			if (matrix[i].length > closeClusters[0])
|1625|1625| 				matrix[i].splice(closeClusters[0],1);
|1626|1626| 			if (matrix[i].length > closeClusters[1])
|1627|    |-				matrix[i].splice(closeClusters[1],1);
|    |1627|+				matrix[i].splice(closeClusters[1], 1);
|1628|1628| 		}
|1629|1629| 		// add a new row of distances to the matrix and the new cluster
|1630|1630| 		clusters.push(newCluster);

binaries/data/mods/public/simulation/helpers/Commands.js
| 796| »   »   let·ent·=·pickRandom(cmpRangeManager.GetEntitiesByPlayer(cmd.player).filter(ent·=>·{
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'ent' is already declared in the upper scope.

binaries/data/mods/public/simulation/helpers/Commands.js
|1281| ····»   »   »   error("[TryConstructWall]·Expected·last·tower·control·group·to·be·available,·none·found·(1st·pass,·iteration·"·+·i·+·")");
|    | [NORMAL] ESLintBear (no-mixed-spaces-and-tabs):
|    | Mixed spaces and tabs.

binaries/data/mods/public/simulation/helpers/Commands.js
|1282| ····»   »   »   break;
|    | [NORMAL] ESLintBear (no-mixed-spaces-and-tabs):
|    | Mixed spaces and tabs.

binaries/data/mods/public/simulation/helpers/Commands.js
|1512| »   »   »   »   var·lastFormationTemplate·=·undefined;
|    | [NORMAL] ESLintBear (no-undef-init):
|    | It's not necessary to initialize 'lastFormationTemplate' to undefined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1591| »   »   var·closeClusters·=·undefined;
|    | [NORMAL] ESLintBear (no-undef-init):
|    | It's not necessary to initialize 'closeClusters' to undefined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1608| »   »   for·(let·i·=·0;·i·<·clusters.length;·++i)
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'i' is already declared in the upper scope.

binaries/data/mods/public/simulation/helpers/Commands.js
|1622| »   »   for·(let·i·=·0;·i·<·matrix.length;·++i)
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'i' is already declared in the upper scope.

binaries/data/mods/public/simulation/helpers/Commands.js
|  53| var·g_Commands·=·{
|    | [NORMAL] JSHintBear:
|    | 'g_Commands' was used before it was defined.

binaries/data/mods/public/simulation/helpers/Commands.js
| 548| »   »   »   »   ····&&·player·!=·+cmd.owner)
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/helpers/Commands.js
| 736| »   »   »   »   var·cmpGUIInterface·=·Engine.QueryInterface(SYSTEM_ENTITY,·IID_GuiInterface);
|    | [NORMAL] JSHintBear:
|    | 'cmpGUIInterface' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
| 955| »   »   for·(var·i·=·0;·i·<·length;·++i)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
| 968| »   »   var·count·=·0;
|    | [NORMAL] JSHintBear:
|    | 'count' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1115| »   »   var·cmpGuiInterface·=·Engine.QueryInterface(SYSTEM_ENTITY,·IID_GuiInterface);
|    | [NORMAL] JSHintBear:
|    | 'cmpGuiInterface' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1367| »   »   var·piece·=·pieces[j];
|    | [NORMAL] JSHintBear:
|    | 'piece' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1450| »   »   var·cmpUnitAI·=·Engine.QueryInterface(ent,·IID_UnitAI);
|    | [NORMAL] JSHintBear:
|    | 'cmpUnitAI' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1489| »   »   »   &&·cmpFormation.GetMemberCount()·==·formation.entities.length)
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/helpers/Commands.js
|1515| »   »   »   »   »   var·cmpUnitAI·=·Engine.QueryInterface(ent,·IID_UnitAI);
|    | [NORMAL] JSHintBear:
|    | 'cmpUnitAI' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1548| »   »   »   var·cmpFormation·=·Engine.QueryInterface(formationEnt,·IID_Formation);
|    | [NORMAL] JSHintBear:
|    | 'cmpFormation' is already defined.
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 228| 228| 		// Move a tile outside the building
| 229| 229| 		let range = 4;
| 230| 230| 		if (this.MoveToTargetRangeExplicit(msg.data.target, range, range))
| 231|    |-		{
|    | 231|+		
| 232| 232| 			// We've started walking to the given point
| 233| 233| 			this.SetNextState("INDIVIDUAL.WALKING");
| 234|    |-		}
|    | 234|+		
| 235| 235| 		else
| 236| 236| 		{
| 237| 237| 			// We are already at the target, or can't move at all
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 233| 233| 			this.SetNextState("INDIVIDUAL.WALKING");
| 234| 234| 		}
| 235| 235| 		else
| 236|    |-		{
|    | 236|+		
| 237| 237| 			// We are already at the target, or can't move at all
| 238| 238| 			this.FinishOrder();
| 239|    |-		}
|    | 239|+		
| 240| 240| 	},
| 241| 241| 
| 242| 242| 	// Individual orders:
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 335| 335| 
| 336| 336| 		var ok = this.MoveToTarget(this.order.data.target);
| 337| 337| 		if (ok)
| 338|    |-		{
|    | 338|+		
| 339| 339| 			// We've started walking to the given point
| 340| 340| 			if (this.IsAnimal())
| 341| 341| 				this.SetNextState("ANIMAL.WALKING");
| 342| 342| 			else
| 343| 343| 				this.SetNextState("INDIVIDUAL.WALKING");
| 344|    |-		}
|    | 344|+		
| 345| 345| 		else
| 346| 346| 		{
| 347| 347| 			// We are already at the target, or can't move at all
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 363| 363| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 364| 364| 		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 365| 365| 		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 366|    |-		{
|    | 366|+		
| 367| 367| 			// we were already on the shoreline, and have not moved since
| 368| 368| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
| 369| 369| 				needToMove = false;
| 370|    |-		}
|    | 370|+		
| 371| 371| 
| 372| 372| 		// TODO: what if the units are on a cliff ? the ship will go below the cliff
| 373| 373| 		// and the units won't be able to garrison. Should go to the nearest (accessible) shore
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 361| 361| 		// Check if we need to move     TODO implement a better way to know if we are on the shoreline
| 362| 362| 		var needToMove = true;
| 363| 363| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 364|    |-		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 365|    |-		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
|    | 364|+		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x) &&
|    | 365|+		    (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 366| 366| 		{
| 367| 367| 			// we were already on the shoreline, and have not moved since
| 368| 368| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 372| 372| 		// TODO: what if the units are on a cliff ? the ship will go below the cliff
| 373| 373| 		// and the units won't be able to garrison. Should go to the nearest (accessible) shore
| 374| 374| 		if (needToMove && this.MoveToTarget(this.order.data.target))
| 375|    |-		{
|    | 375|+		
| 376| 376| 			this.SetNextState("INDIVIDUAL.PICKUP.APPROACHING");
| 377|    |-		}
|    | 377|+		
| 378| 378| 		else
| 379| 379| 		{
| 380| 380| 			// We are already at the target, or can't move at all
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 401| 401| 		var distance = DistanceBetweenEntities(this.entity, this.order.data.target) + (+this.template.FleeDistance);
| 402| 402| 		var cmpUnitMotion = Engine.QueryInterface(this.entity, IID_UnitMotion);
| 403| 403| 		if (cmpUnitMotion.MoveToTargetRange(this.order.data.target, distance, -1))
| 404|    |-		{
|    | 404|+		
| 405| 405| 			// We've started fleeing from the given target
| 406| 406| 			if (this.IsAnimal())
| 407| 407| 				this.SetNextState("ANIMAL.FLEEING");
| 408| 408| 			else
| 409| 409| 				this.SetNextState("INDIVIDUAL.FLEEING");
| 410|    |-		}
|    | 410|+		
| 411| 411| 		else
| 412| 412| 		{
| 413| 413| 			// We are already at the target, or can't move at all
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 448| 448| 			}
| 449| 449| 
| 450| 450| 			if (this.order.data.attackType == this.oldAttackType)
| 451|    |-			{
|    | 451|+			
| 452| 452| 				if (this.IsAnimal())
| 453| 453| 					this.SetNextState("ANIMAL.COMBAT.ATTACKING");
| 454| 454| 				else
| 455| 455| 					this.SetNextState("INDIVIDUAL.COMBAT.ATTACKING");
| 456|    |-			}
|    | 456|+			
| 457| 457| 			else
| 458| 458| 			{
| 459| 459| 				if (this.IsAnimal())
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 455| 455| 					this.SetNextState("INDIVIDUAL.COMBAT.ATTACKING");
| 456| 456| 			}
| 457| 457| 			else
| 458|    |-			{
|    | 458|+			
| 459| 459| 				if (this.IsAnimal())
| 460| 460| 					this.SetNextState("ANIMAL.COMBAT.ATTACKING");
| 461| 461| 				else
| 462| 462| 					this.SetNextState("INDIVIDUAL.COMBAT.ATTACKING");
| 463|    |-			}
|    | 463|+			
| 464| 464| 			return;
| 465| 465| 		}
| 466| 466| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 580| 580| 					this.PushOrderFront("Walk", this.order.data.lastPos);
| 581| 581| 				}
| 582| 582| 				else
| 583|    |-				{
|    | 583|+				
| 584| 584| 					// We couldn't move there, or the target moved away
| 585| 585| 					this.FinishOrder();
| 586|    |-				}
|    | 586|+				
| 587| 587| 				return;
| 588| 588| 			}
| 589| 589| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 593| 593| 
| 594| 594| 		// Try to move within range
| 595| 595| 		if (this.MoveToTargetRange(this.order.data.target, IID_ResourceGatherer))
| 596|    |-		{
|    | 596|+		
| 597| 597| 			// We've started walking to the given point
| 598| 598| 			this.SetNextState("INDIVIDUAL.GATHER.APPROACHING");
| 599|    |-		}
|    | 599|+		
| 600| 600| 		else
| 601| 601| 		{
| 602| 602| 			// We are already at the target, or can't move at all,
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 670| 670| 	"Order.Repair": function(msg) {
| 671| 671| 		// Try to move within range
| 672| 672| 		if (this.MoveToTargetRange(this.order.data.target, IID_Builder))
| 673|    |-		{
|    | 673|+		
| 674| 674| 			// We've started walking to the given point
| 675| 675| 			this.SetNextState("INDIVIDUAL.REPAIR.APPROACHING");
| 676|    |-		}
|    | 676|+		
| 677| 677| 		else
| 678| 678| 		{
| 679| 679| 			// We are already at the target, or can't move at all,
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 706| 706| 		}
| 707| 707| 
| 708| 708| 		if (this.MoveToGarrisonRange(this.order.data.target))
| 709|    |-		{
|    | 709|+		
| 710| 710| 			this.SetNextState("INDIVIDUAL.GARRISON.APPROACHING");
| 711|    |-		}
|    | 711|+		
| 712| 712| 		else
| 713| 713| 		{
| 714| 714| 			// We do a range check before actually garrisoning
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 838| 838| 			if (!this.CheckTargetAttackRange(target, target))
| 839| 839| 			{
| 840| 840| 				if (this.TargetIsAlive(target) && this.CheckTargetVisible(target))
| 841|    |-				{
|    | 841|+				
| 842| 842| 					if (this.MoveToTargetAttackRange(target, target))
| 843| 843| 					{
| 844| 844| 						this.SetNextState("COMBAT.APPROACHING");
| 845| 845| 						return;
| 846| 846| 					}
| 847|    |-				}
|    | 847|+				
| 848| 848| 				this.FinishOrder();
| 849| 849| 				return;
| 850| 850| 			}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 863| 863| 			}
| 864| 864| 			// Check if we are already in range, otherwise walk there
| 865| 865| 			if (!this.CheckGarrisonRange(msg.data.target))
| 866|    |-			{
|    | 866|+			
| 867| 867| 				if (!this.CheckTargetVisible(msg.data.target))
| 868| 868| 				{
| 869| 869| 					this.FinishOrder();
| 878| 878| 						return;
| 879| 879| 					}
| 880| 880| 				}
| 881|    |-			}
|    | 881|+			
| 882| 882| 
| 883| 883| 			this.SetNextState("GARRISON.GARRISONING");
| 884| 884| 		},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 870| 870| 					return;
| 871| 871| 				}
| 872| 872| 				else
| 873|    |-				{
|    | 873|+				
| 874| 874| 					// Out of range; move there in formation
| 875| 875| 					if (this.MoveToGarrisonRange(msg.data.target))
| 876| 876| 					{
| 877| 877| 						this.SetNextState("GARRISON.APPROACHING");
| 878| 878| 						return;
| 879| 879| 					}
| 880|    |-				}
|    | 880|+				
| 881| 881| 			}
| 882| 882| 
| 883| 883| 			this.SetNextState("GARRISON.GARRISONING");
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 869| 869| 					this.FinishOrder();
| 870| 870| 					return;
| 871| 871| 				}
| 872|    |-				else
| 873|    |-				{
|    | 872|+				
| 874| 873| 					// Out of range; move there in formation
| 875| 874| 					if (this.MoveToGarrisonRange(msg.data.target))
| 876| 875| 					{
| 877| 876| 						this.SetNextState("GARRISON.APPROACHING");
| 878| 877| 						return;
| 879| 878| 					}
| 880|    |-				}
|    | 879|+				
| 881| 880| 			}
| 882| 881| 
| 883| 882| 			this.SetNextState("GARRISON.GARRISONING");
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 896| 896| 						this.PushOrderFront("Walk", msg.data.lastPos);
| 897| 897| 					}
| 898| 898| 					else
| 899|    |-					{
|    | 899|+					
| 900| 900| 						// We couldn't move there, or the target moved away
| 901| 901| 						this.FinishOrder();
| 902|    |-					}
|    | 902|+					
| 903| 903| 					return;
| 904| 904| 				}
| 905| 905| 
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'GARRISON'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1117|1117| 			},
|1118|1118| 		},
|1119|1119| 
|1120|    |-		"GARRISON":{
|    |1120|+		"GARRISON": {
|1121|1121| 			"enter": function() {
|1122|1122| 				// If the garrisonholder should pickup, warn it so it can take needed action
|1123|1123| 				var cmpGarrisonHolder = Engine.QueryInterface(this.order.data.target, IID_GarrisonHolder);
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1301|1301| 			// If the controller handled an order but some members rejected it,
|1302|1302| 			// they will have no orders and be in the FORMATIONMEMBER.IDLE state.
|1303|1303| 			if (this.orderQueue.length)
|1304|    |-			{
|    |1304|+			
|1305|1305| 				// We're leaving the formation, so stop our FormationWalk order
|1306|1306| 				if (this.FinishOrder())
|1307|1307| 					return;
|1308|    |-			}
|    |1308|+			
|1309|1309| 
|1310|1310| 			// No orders left, we're an individual now
|1311|1311| 			if (this.IsAnimal())
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1329|1329| 			// Move a tile outside the building
|1330|1330| 			let range = 4;
|1331|1331| 			if (this.MoveToTargetRangeExplicit(msg.data.target, range, range))
|1332|    |-			{
|    |1332|+			
|1333|1333| 				// We've started walking to the given point
|1334|1334| 				this.SetNextState("WALKINGTOPOINT");
|1335|    |-			}
|    |1335|+			
|1336|1336| 			else
|1337|1337| 			{
|1338|1338| 				// We are already at the target, or can't move at all
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1334|1334| 				this.SetNextState("WALKINGTOPOINT");
|1335|1335| 			}
|1336|1336| 			else
|1337|    |-			{
|    |1337|+			
|1338|1338| 				// We are already at the target, or can't move at all
|1339|1339| 				this.FinishOrder();
|1340|    |-			}
|    |1340|+			
|1341|1341| 		},
|1342|1342| 
|1343|1343| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 6 tabs but found 0.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1511|1511| 						x = pos.x + Math.sin(ang) * dist;
|1512|1512| 						y = pos.y + Math.cos(ang) * dist;
|1513|1513| 
|1514|    |-warn("Can position ("+uneval(x)+","+uneval(y)+") be explored? " + uneval(cmpRangeManager.CanPlayerExplorePosition(x, y, owner) ) );
|    |1514|+						warn("Can position ("+uneval(x)+","+uneval(y)+") be explored? " + uneval(cmpRangeManager.CanPlayerExplorePosition(x, y, owner) ) );
|1515|1515| 
|1516|1516| 						if (cmpRangeManager.CanPlayerExplorePosition(x, y, owner))
|1517|1517| 							break;
|    | [NORMAL] ESLintBear (space-in-parens):
|    | There should be no spaces inside this paren.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1511|1511| 						x = pos.x + Math.sin(ang) * dist;
|1512|1512| 						y = pos.y + Math.cos(ang) * dist;
|1513|1513| 
|1514|    |-warn("Can position ("+uneval(x)+","+uneval(y)+") be explored? " + uneval(cmpRangeManager.CanPlayerExplorePosition(x, y, owner) ) );
|    |1514|+warn("Can position ("+uneval(x)+","+uneval(y)+") be explored? " + uneval(cmpRangeManager.CanPlayerExplorePosition(x, y, owner)) );
|1515|1515| 
|1516|1516| 						if (cmpRangeManager.CanPlayerExplorePosition(x, y, owner))
|1517|1517| 							break;
|    | [NORMAL] ESLintBear (space-in-parens):
|    | There should be no spaces inside this paren.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1511|1511| 						x = pos.x + Math.sin(ang) * dist;
|1512|1512| 						y = pos.y + Math.cos(ang) * dist;
|1513|1513| 
|1514|    |-warn("Can position ("+uneval(x)+","+uneval(y)+") be explored? " + uneval(cmpRangeManager.CanPlayerExplorePosition(x, y, owner) ) );
|    |1514|+warn("Can position ("+uneval(x)+","+uneval(y)+") be explored? " + uneval(cmpRangeManager.CanPlayerExplorePosition(x, y, owner) ));
|1515|1515| 
|1516|1516| 						if (cmpRangeManager.CanPlayerExplorePosition(x, y, owner))
|1517|1517| 							break;
|    | [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
|1551|1551| 
|1552|1552| 			"Attacked": function(msg) {
|1553|1553| 				this.SetSpeedMultiplier(this.GetRunMultiplier());
|1554|    |-				//this.Flee(msg.data.attacker, false);
|    |1554|+				// this.Flee(msg.data.attacker, false);
|1555|1555| 			},
|1556|1556| 
|1557|1557| 			// This does not work apparently.
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1640|1640| 
|1641|1641| 			"LosRangeUpdate": function(msg) {
|1642|1642| 				if (this.GetStance().targetVisibleEnemies)
|1643|    |-				{
|    |1643|+				
|1644|1644| 					// Start attacking one of the newly-seen enemy (if any)
|1645|1645| 					this.AttackEntitiesByPreference(msg.data.added);
|1646|    |-				}
|    |1646|+				
|1647|1647| 			},
|1648|1648| 
|1649|1649| 			"LosHealRangeUpdate": function(msg) {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1826|1826| 						// if nothing better to do, check if the guarded needs to be healed or repaired
|1827|1827| 						var cmpHealth = Engine.QueryInterface(this.isGuardOf, IID_Health);
|1828|1828| 						if (cmpHealth && (cmpHealth.GetHitpoints() < cmpHealth.GetMaxHitpoints()))
|1829|    |-						{
|    |1829|+						
|1830|1830| 							if (this.CanHeal(this.isGuardOf))
|1831|1831| 								this.PushOrderFront("Heal", { "target": this.isGuardOf, "force": false });
|1832|1832| 							else if (this.CanRepair(this.isGuardOf))
|1833|1833| 								this.PushOrderFront("Repair", { "target": this.isGuardOf, "autocontinue": false, "force": false });
|1834|    |-						}
|    |1834|+						
|1835|1835| 					}
|1836|1836| 				},
|1837|1837| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1911|1911| 				"MoveCompleted": function() {
|1912|1912| 
|1913|1913| 					if (this.CheckTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1914|    |-					{
|    |1914|+					
|1915|1915| 						// If the unit needs to unpack, do so
|1916|1916| 						if (this.CanUnpack())
|1917|1917| 						{
|1920|1920| 						}
|1921|1921| 						else
|1922|1922| 							this.SetNextState("ATTACKING");
|1923|    |-					}
|    |1923|+					
|1924|1924| 					else
|1925|1925| 					{
|1926|1926| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1918|1918| 							this.PushOrderFront("Unpack", { "force": true });
|1919|1919| 							return;
|1920|1920| 						}
|1921|    |-						else
|1922|    |-							this.SetNextState("ATTACKING");
|    |1921|+						this.SetNextState("ATTACKING");
|1923|1922| 					}
|1924|1923| 					else
|1925|1924| 					{
|    | [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
|1922|1922| 							this.SetNextState("ATTACKING");
|1923|1923| 					}
|1924|1924| 					else
|1925|    |-					{
|    |1925|+					
|1926|1926| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1927|1927| 						{
|1928|1928| 							this.SetNextState("APPROACHING");
|1932|1932| 							// Give up
|1933|1933| 							this.FinishOrder();
|1934|1934| 						}
|1935|    |-					}
|    |1935|+					
|1936|1936| 				},
|1937|1937| 			},
|1938|1938| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1924|1924| 					else
|1925|1925| 					{
|1926|1926| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1927|    |-						{
|    |1927|+						
|1928|1928| 							this.SetNextState("APPROACHING");
|1929|    |-						}
|    |1929|+						
|1930|1930| 						else
|1931|1931| 						{
|1932|1932| 							// Give up
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1928|1928| 							this.SetNextState("APPROACHING");
|1929|1929| 						}
|1930|1930| 						else
|1931|    |-						{
|    |1931|+						
|1932|1932| 							// Give up
|1933|1933| 							this.FinishOrder();
|1934|    |-						}
|    |1934|+						
|1935|1935| 					}
|1936|1936| 				},
|1937|1937| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1949|1949| 					}
|1950|1950| 					// Check the target is still alive and attackable
|1951|1951| 					if (this.CanAttack(target) && !this.CheckTargetAttackRange(target, this.order.data.attackType))
|1952|    |-					{
|    |1952|+					
|1953|1953| 						// Can't reach it - try to chase after it
|1954|1954| 						if (this.ShouldChaseTargetedEntity(target, this.order.data.force))
|1955|1955| 						{
|1964|1964| 								return;
|1965|1965| 							}
|1966|1966| 						}
|1967|    |-					}
|    |1967|+					
|1968|1968| 
|1969|1969| 					var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|1970|1970| 					this.attackTimers = cmpAttack.GetTimers(this.order.data.attackType);
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1995|1995| 					// TODO: we should probably only bother syncing projectile attacks, not melee
|1996|1996| 
|1997|1997| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|1998|    |-					this.resyncAnimation = (prepare != this.attackTimers.prepare) ? true : false;
|    |1998|+					this.resyncAnimation = (prepare != this.attackTimers.prepare);
|1999|1999| 
|2000|2000| 					this.FaceTowardsTarget(this.order.data.target);
|2001|2001| 
|    | [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
|2124|2124| 
|2125|2125| 				"Attacked": function(msg) {
|2126|2126| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2127|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2128|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2127|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2128|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2129|2129| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2130|2130| 				},
|2131|2131| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2138|2138| 					this.SelectAnimation("move");
|2139|2139| 					var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|2140|2140| 					if (cmpUnitAI && cmpUnitAI.IsFleeing())
|2141|    |-					{
|    |2141|+					
|2142|2142| 						// Run after a fleeing target
|2143|2143| 						this.SetSpeedMultiplier(this.GetRunMultiplier());
|2144|    |-					}
|    |2144|+					
|2145|2145| 					this.StartTimer(1000, 1000);
|2146|2146| 				},
|2147|2147| 
|    | [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
|2199|2199| 						// Also don't switch to a different type of huntable animal
|2200|2200| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2201|2201| 							return (
|2202|    |-								ent != oldTarget
|2203|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2202|+								ent != oldTarget &&
|    |2203|+								 ((type.generic == "treasure" && oldType.generic == "treasure")
|2204|2204| 								 || (type.specific == oldType.specific
|2205|2205| 								 && (type.specific != "meat" || oldTemplate == template)))
|2206|2206| 							);
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2200|2200| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2201|2201| 							return (
|2202|2202| 								ent != oldTarget
|2203|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2204|    |-								 || (type.specific == oldType.specific
|    |2203|+								 && ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2204|+								 (type.specific == oldType.specific
|2205|2205| 								 && (type.specific != "meat" || oldTemplate == template)))
|2206|2206| 							);
|2207|2207| 						}, oldTarget);
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2201|2201| 							return (
|2202|2202| 								ent != oldTarget
|2203|2203| 								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2204|    |-								 || (type.specific == oldType.specific
|2205|    |-								 && (type.specific != "meat" || oldTemplate == template)))
|    |2204|+								 || (type.specific == oldType.specific &&
|    |2205|+								 (type.specific != "meat" || oldTemplate == template)))
|2206|2206| 							);
|2207|2207| 						}, oldTarget);
|2208|2208| 						if (nearby)
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2210|2210| 							this.PerformGather(nearby, false, false);
|2211|2211| 							return true;
|2212|2212| 						}
|2213|    |-						else
|2214|    |-						{
|    |2213|+						
|2215|2214| 							// It's probably better in this case, to avoid units getting stuck around a dropsite
|2216|2215| 							// in a "Target is far away, full, nearby are no good resources, return to dropsite" loop
|2217|2216| 							// to order it to GatherNear the resource position.
|2232|2231| 									return true;
|2233|2232| 								}
|2234|2233| 							}
|2235|    |-						}
|    |2234|+						
|2236|2235| 						return true;
|2237|2236| 					}
|2238|2237| 					return false;
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2222|2222| 								this.GatherNearPosition(pos.x, pos.z, oldType, oldTemplate);
|2223|2223| 								return true;
|2224|2224| 							}
|2225|    |-							else
|2226|    |-							{
|    |2225|+							
|2227|2226| 								// we're kind of stuck here. Return resource.
|2228|2227| 								var nearby = this.FindNearestDropsite(oldType.generic);
|2229|2228| 								if (nearby)
|2231|2230| 									this.PushOrderFront("ReturnResource", { "target": nearby, "force": false });
|2232|2231| 									return true;
|2233|2232| 								}
|2234|    |-							}
|    |2233|+							
|2235|2234| 						}
|2236|2235| 						return true;
|2237|2236| 					}
|    | [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
|2264|2264| 						// Also don't switch to a different type of huntable animal
|2265|2265| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2266|2266| 							return (
|2267|    |-								ent != oldTarget
|2268|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2267|+								ent != oldTarget &&
|    |2268|+								((type.generic == "treasure" && oldType.generic == "treasure")
|2269|2269| 								|| (type.specific == oldType.specific
|2270|2270| 								&& (type.specific != "meat" || oldTemplate == template)))
|2271|2271| 							);
|    | [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
|2265|2265| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2266|2266| 							return (
|2267|2267| 								ent != oldTarget
|2268|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2269|    |-								|| (type.specific == oldType.specific
|    |2268|+								&& ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2269|+								(type.specific == oldType.specific
|2270|2270| 								&& (type.specific != "meat" || oldTemplate == template)))
|2271|2271| 							);
|2272|2272| 						});
|    | [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
|2266|2266| 							return (
|2267|2267| 								ent != oldTarget
|2268|2268| 								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2269|    |-								|| (type.specific == oldType.specific
|2270|    |-								&& (type.specific != "meat" || oldTemplate == template)))
|    |2269|+								|| (type.specific == oldType.specific &&
|    |2270|+								(type.specific != "meat" || oldTemplate == template)))
|2271|2271| 							);
|2272|2272| 						});
|2273|2273| 						if (nearby)
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2311|2311| 					// Also don't switch to a different type of huntable animal
|2312|2312| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2313|2313| 						return (
|2314|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2315|    |-							|| (type.specific == resourceType.specific
|    |2314|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2315|+							(type.specific == resourceType.specific
|2316|2316| 							&& (type.specific != "meat" || resourceTemplate == template))
|2317|2317| 						);
|2318|2318| 					});
|    | [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
|2312|2312| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2313|2313| 						return (
|2314|2314| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2315|    |-							|| (type.specific == resourceType.specific
|2316|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2315|+							|| (type.specific == resourceType.specific &&
|    |2316|+							(type.specific != "meat" || resourceTemplate == template))
|2317|2317| 						);
|2318|2318| 					});
|2319|2319| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2428|2428| 
|2429|2429| 					var cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply);
|2430|2430| 					if (cmpSupply && cmpSupply.IsAvailable(cmpOwnership.GetOwner(), this.entity))
|2431|    |-					{
|    |2431|+					
|2432|2432| 						// Check we can still reach and gather from the target
|2433|2433| 						if (this.CheckTargetRange(this.gatheringTarget, IID_ResourceGatherer) && this.CanGather(this.gatheringTarget))
|2434|2434| 						{
|2494|2494| 								return;
|2495|2495| 							}
|2496|2496| 						}
|2497|    |-					}
|    |2497|+					
|2498|2498| 
|2499|2499| 					// We're already in range, can't get anywhere near it or the target is exhausted.
|2500|2500| 
|    | [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
|2520|2520| 					// Also don't switch to a different type of huntable animal
|2521|2521| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2522|2522| 						return (
|2523|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2524|    |-							|| (type.specific == resourceType.specific
|    |2523|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2524|+							(type.specific == resourceType.specific
|2525|2525| 							&& (type.specific != "meat" || resourceTemplate == template))
|2526|2526| 						);
|2527|2527| 					});
|    | [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
|2521|2521| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2522|2522| 						return (
|2523|2523| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2524|    |-							|| (type.specific == resourceType.specific
|2525|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2524|+							|| (type.specific == resourceType.specific &&
|    |2525|+							(type.specific != "meat" || resourceTemplate == template))
|2526|2526| 						);
|2527|2527| 					});
|2528|2528| 					if (nearby)
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2608|2608| 					this.StartTimer(prepare, this.healTimers.repeat);
|2609|2609| 
|2610|2610| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2611|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2611|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2612|2612| 
|2613|2613| 					this.FaceTowardsTarget(this.order.data.target);
|2614|2614| 				},
|    | [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
|2823|2823| 					{
|2824|2824| 						// The building was already finished/fully repaired before we arrived;
|2825|2825| 						// let the ConstructionFinished handler handle this.
|2826|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2826|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2827|2827| 						return true;
|2828|2828| 					}
|2829|2829| 
|    | [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
|2823|2823| 					{
|2824|2824| 						// The building was already finished/fully repaired before we arrived;
|2825|2825| 						// let the ConstructionFinished handler handle this.
|2826|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2826|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2827|2827| 						return true;
|2828|2828| 					}
|2829|2829| 
|    | [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
|2863|2863| 					if (this.MoveToTargetRange(this.repairTarget, IID_Builder))
|2864|2864| 						this.SetNextState("APPROACHING");
|2865|2865| 					else if (!this.CheckTargetRange(this.repairTarget, IID_Builder))
|2866|    |-						this.FinishOrder(); //can't approach and isn't in reach
|    |2866|+						this.FinishOrder(); // can't approach and isn't in reach
|2867|2867| 				},
|2868|2868| 			},
|2869|2869| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2950|2950| 
|2951|2951| 				// Unit was approaching and there's nothing to do now, so switch to walking
|2952|2952| 				if (oldState === "INDIVIDUAL.REPAIR.APPROACHING")
|2953|    |-				{
|    |2953|+				
|2954|2954| 					// We're already walking to the given point, so add this as a order.
|2955|2955| 					this.WalkToTarget(msg.data.newentity, true);
|2956|    |-				}
|    |2956|+				
|2957|2957| 			},
|2958|2958| 		},
|2959|2959| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3003|3003| 
|3004|3004| 					// Check that we can garrison here
|3005|3005| 					if (this.CanGarrison(target))
|3006|    |-					{
|    |3006|+					
|3007|3007| 						// Check that we're in range of the garrison target
|3008|3008| 						if (this.CheckGarrisonRange(target))
|3009|3009| 						{
|3079|3079| 								return false;
|3080|3080| 							}
|3081|3081| 						}
|3082|    |-					}
|    |3082|+					
|3083|3083| 					// Garrisoning failed for some reason, so finish the order
|3084|3084| 					this.FinishOrder();
|3085|3085| 					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
|3186|3186| 		"Attacked": function(msg) {
|3187|3187| 			if (this.template.NaturalBehaviour == "skittish" ||
|3188|3188| 			    this.template.NaturalBehaviour == "passive")
|3189|    |-			{
|    |3189|+			
|3190|3190| 				this.Flee(msg.data.attacker, false);
|3191|    |-			}
|    |3191|+			
|3192|3192| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|3193|3193| 			{
|3194|3194| 				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
|3195|3195| 					this.Attack(msg.data.attacker, false);
|3196|3196| 			}
|3197|3197| 			else if (this.template.NaturalBehaviour == "domestic")
|3198|    |-			{
|    |3198|+			
|3199|3199| 				// Never flee, stop what we were doing
|3200|3200| 				this.SetNextState("IDLE");
|3201|    |-			}
|    |3201|+			
|3202|3202| 		},
|3203|3203| 
|3204|3204| 		"Order.LeaveFoundation": function(msg) {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3205|3205| 			// Move a tile outside the building
|3206|3206| 			var range = 4;
|3207|3207| 			if (this.MoveToTargetRangeExplicit(msg.data.target, range, range))
|3208|    |-			{
|    |3208|+			
|3209|3209| 				// We've started walking to the given point
|3210|3210| 				this.SetNextState("WALKING");
|3211|    |-			}
|    |3211|+			
|3212|3212| 			else
|3213|3213| 			{
|3214|3214| 				// We are already at the target, or can't move at all
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3210|3210| 				this.SetNextState("WALKING");
|3211|3211| 			}
|3212|3212| 			else
|3213|    |-			{
|    |3213|+			
|3214|3214| 				// We are already at the target, or can't move at all
|3215|3215| 				this.FinishOrder();
|3216|    |-			}
|    |3216|+			
|3217|3217| 		},
|3218|3218| 
|3219|3219| 		"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
|3252|3252| 				}
|3253|3253| 				// Start attacking one of the newly-seen enemy (if any)
|3254|3254| 				else if (this.IsDangerousAnimal())
|3255|    |-				{
|    |3255|+				
|3256|3256| 					this.AttackVisibleEntity(msg.data.added);
|3257|    |-				}
|    |3257|+				
|3258|3258| 
|3259|3259| 				// TODO: if two units enter our range together, we'll attack the
|3260|3260| 				// 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
|3295|3295| 				}
|3296|3296| 				// Start attacking one of the newly-seen enemy (if any)
|3297|3297| 				else if (this.template.NaturalBehaviour == "violent")
|3298|    |-				{
|    |3298|+				
|3299|3299| 					this.AttackVisibleEntity(msg.data.added);
|3300|    |-				}
|    |3300|+				
|3301|3301| 			},
|3302|3302| 
|3303|3303| 			"MoveCompleted": function() { },
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 7.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3312|3312| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3313|3313| 
|3314|3314| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3315|    |-							// only used for domestic animals
|    |3315|+		// only used for domestic animals
|3316|3316| 	},
|3317|3317| };
|3318|3318| 
|    | [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
|3369|3369| 
|3370|3370| UnitAI.prototype.IsAnimal = function()
|3371|3371| {
|3372|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3372|+	return (!!this.template.NaturalBehaviour);
|3373|3373| };
|3374|3374| 
|3375|3375| 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
|3407|3407| UnitAI.prototype.GetGarrisonHolder = function()
|3408|3408| {
|3409|3409| 	if (this.IsGarrisoned())
|3410|    |-	{
|    |3410|+	
|3411|3411| 		for (let order of this.orderQueue)
|3412|3412| 			if (order.type == "Garrison")
|3413|3413| 				return order.data.target;
|3414|    |-	}
|    |3414|+	
|3415|3415| 	return INVALID_ENTITY;
|3416|3416| };
|3417|3417| 
|    | [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
|3485|3485| 		{
|3486|3486| 			let index = this.GetCurrentState().indexOf(".");
|3487|3487| 			if (index != -1)
|3488|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3488|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3489|3489| 			this.Stop(false);
|3490|3490| 		}
|3491|3491| 
|    | [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
|3541|3541| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3542|3542| 			continue;
|3543|3543| 		if (i == 0)
|3544|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3544|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3545|3545| 		else
|3546|3546| 			this.orderQueue.splice(i, 1);
|3547|3547| 		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
|3541|3541| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3542|3542| 			continue;
|3543|3543| 		if (i == 0)
|3544|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3544|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3545|3545| 		else
|3546|3546| 			this.orderQueue.splice(i, 1);
|3547|3547| 		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
|3625|3625| };
|3626|3626| 
|3627|3627| 
|3628|    |-//// FSM linkage functions ////
|    |3628|+// // FSM linkage functions ////
|3629|3629| 
|3630|3630| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3631|3631| 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
|3797|3797| 				continue;
|3798|3798| 			if (this.orderQueue[i].type == type)
|3799|3799| 				continue;
|3800|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3800|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3801|3801| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3802|3802| 			return;
|3803|3803| 		}
|    | [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| 				continue;
|3798|3798| 			if (this.orderQueue[i].type == type)
|3799|3799| 				continue;
|3800|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3800|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3801|3801| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3802|3802| 			return;
|3803|3803| 		}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3811|3811| {
|3812|3812| 	// Remember the previous work orders to be able to go back to them later if required
|3813|3813| 	if (data && data.force)
|3814|    |-	{
|    |3814|+	
|3815|3815| 		if (this.IsFormationController())
|3816|3816| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3817|3817| 		else
|3818|3818| 			this.UpdateWorkOrders(type);
|3819|    |-	}
|    |3819|+	
|3820|3820| 
|3821|3821| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3822|3822| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3888|3888| 	{
|3889|3889| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3890|3890| 		if (cmpUnitAI)
|3891|    |-		{
|    |3891|+		
|3892|3892| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3893|3893| 			{
|3894|3894| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3897|3897| 					return;
|3898|3898| 				}
|3899|3899| 			}
|3900|    |-		}
|    |3900|+		
|3901|3901| 	}
|3902|3902| 
|3903|3903| 	// 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
|3890|3890| 		if (cmpUnitAI)
|3891|3891| 		{
|3892|3892| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3893|    |-			{
|    |3893|+			
|3894|3894| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3895|3895| 				{
|3896|3896| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3897|3897| 					return;
|3898|3898| 				}
|3899|    |-			}
|    |3899|+			
|3900|3900| 		}
|3901|3901| 	}
|3902|3902| 
|    | [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
|3902|3902| 
|3903|3903| 	// If nothing found, take the unit orders
|3904|3904| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3905|    |-	{
|    |3905|+	
|3906|3906| 		if (isWorkType(this.orderQueue[i].type))
|3907|3907| 		{
|3908|3908| 			this.workOrders = this.orderQueue.slice(i);
|3909|3909| 			return;
|3910|3910| 		}
|3911|    |-	}
|    |3911|+	
|3912|3912| };
|3913|3913| 
|3914|3914| 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
|3968|3968| 	if (data.timerRepeat === undefined)
|3969|3969| 		this.timer = undefined;
|3970|3970| 
|3971|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3971|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3972|3972| };
|3973|3973| 
|3974|3974| /**
|    | [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
|3968|3968| 	if (data.timerRepeat === undefined)
|3969|3969| 		this.timer = undefined;
|3970|3970| 
|3971|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3971|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3972|3972| };
|3973|3973| 
|3974|3974| /**
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4003|4003| 	this.timer = undefined;
|4004|4004| };
|4005|4005| 
|4006|    |-//// Message handlers /////
|    |4006|+// // Message handlers /////
|4007|4007| 
|4008|4008| UnitAI.prototype.OnMotionChanged = function(msg)
|4009|4009| {
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4008|4008| UnitAI.prototype.OnMotionChanged = function(msg)
|4009|4009| {
|4010|4010| 	if (msg.starting && !msg.error)
|4011|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |4011|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveStarted", "data": msg});
|4012|4012| 	else if (!msg.starting || msg.error)
|4013|4013| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|4014|4014| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4008|4008| UnitAI.prototype.OnMotionChanged = function(msg)
|4009|4009| {
|4010|4010| 	if (msg.starting && !msg.error)
|4011|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |4011|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg });
|4012|4012| 	else if (!msg.starting || msg.error)
|4013|4013| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|4014|4014| };
|    | [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
|4010|4010| 	if (msg.starting && !msg.error)
|4011|4011| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|4012|4012| 	else if (!msg.starting || msg.error)
|4013|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |4013|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveCompleted", "data": msg});
|4014|4014| };
|4015|4015| 
|4016|4016| UnitAI.prototype.OnGlobalConstructionFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4010|4010| 	if (msg.starting && !msg.error)
|4011|4011| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|4012|4012| 	else if (!msg.starting || msg.error)
|4013|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |4013|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg });
|4014|4014| };
|4015|4015| 
|4016|4016| UnitAI.prototype.OnGlobalConstructionFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4018|4018| 	// TODO: This is a bit inefficient since every unit listens to every
|4019|4019| 	// construction message - ideally we could scope it to only the one we're building
|4020|4020| 
|4021|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4021|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4022|4022| };
|4023|4023| 
|4024|4024| 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
|4018|4018| 	// TODO: This is a bit inefficient since every unit listens to every
|4019|4019| 	// construction message - ideally we could scope it to only the one we're building
|4020|4020| 
|4021|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4021|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4022|4022| };
|4023|4023| 
|4024|4024| 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
|4043|4043| 
|4044|4044| UnitAI.prototype.OnAttacked = function(msg)
|4045|4045| {
|4046|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4046|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4047|4047| };
|4048|4048| 
|4049|4049| 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
|4043|4043| 
|4044|4044| UnitAI.prototype.OnAttacked = function(msg)
|4045|4045| {
|4046|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4046|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4047|4047| };
|4048|4048| 
|4049|4049| 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
|4048|4048| 
|4049|4049| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4050|4050| {
|4051|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4051|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4052|4052| };
|4053|4053| 
|4054|4054| 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
|4048|4048| 
|4049|4049| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4050|4050| {
|4051|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4051|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4052|4052| };
|4053|4053| 
|4054|4054| 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
|4053|4053| 
|4054|4054| UnitAI.prototype.OnHealthChanged = function(msg)
|4055|4055| {
|4056|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4056|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4057|4057| };
|4058|4058| 
|4059|4059| 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
|4053|4053| 
|4054|4054| UnitAI.prototype.OnHealthChanged = function(msg)
|4055|4055| {
|4056|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4056|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4057|4057| };
|4058|4058| 
|4059|4059| 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
|4059|4059| UnitAI.prototype.OnRangeUpdate = function(msg)
|4060|4060| {
|4061|4061| 	if (msg.tag == this.losRangeQuery)
|4062|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4062|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4063|4063| 	else if (msg.tag == this.losHealRangeQuery)
|4064|4064| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4065|4065| };
|    | [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
|4059|4059| UnitAI.prototype.OnRangeUpdate = function(msg)
|4060|4060| {
|4061|4061| 	if (msg.tag == this.losRangeQuery)
|4062|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4062|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4063|4063| 	else if (msg.tag == this.losHealRangeQuery)
|4064|4064| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4065|4065| };
|    | [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
|4061|4061| 	if (msg.tag == this.losRangeQuery)
|4062|4062| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4063|4063| 	else if (msg.tag == this.losHealRangeQuery)
|4064|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4064|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4065|4065| };
|4066|4066| 
|4067|4067| 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
|4061|4061| 	if (msg.tag == this.losRangeQuery)
|4062|4062| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4063|4063| 	else if (msg.tag == this.losHealRangeQuery)
|4064|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4064|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4065|4065| };
|4066|4066| 
|4067|4067| 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
|4066|4066| 
|4067|4067| UnitAI.prototype.OnPackFinished = function(msg)
|4068|4068| {
|4069|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4069|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4070|4070| };
|4071|4071| 
|4072|4072| //// 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
|4066|4066| 
|4067|4067| UnitAI.prototype.OnPackFinished = function(msg)
|4068|4068| {
|4069|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4069|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4070|4070| };
|4071|4071| 
|4072|4072| //// 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
|4069|4069| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4070|4070| };
|4071|4071| 
|4072|    |-//// Helper functions to be called by the FSM ////
|    |4072|+// // Helper functions to be called by the FSM ////
|4073|4073| 
|4074|4074| UnitAI.prototype.GetWalkSpeed = function()
|4075|4075| {
|    | [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
|4171|4171| 	if (!cmpOwnership || cmpOwnership.GetOwner() == INVALID_PLAYER)
|4172|4172| 		return undefined;
|4173|4173| 
|4174|    |-	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position)
|    |4174|+	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
|4175|4175| 	if (!cmpPosition || !cmpPosition.IsInWorld())
|4176|4176| 		return undefined;
|4177|4177| 
|    | [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
|4256|4256| 			PlaySound(name, member);
|4257|4257| 	}
|4258|4258| 	else
|4259|    |-	{
|    |4259|+	
|4260|4260| 		// Otherwise use our own sounds
|4261|4261| 		PlaySound(name, this.entity);
|4262|    |-	}
|    |4262|+	
|4263|4263| };
|4264|4264| 
|4265|4265| /*
|    | [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
|4425|4425| 	else
|4426|4426| 		// return false? Or hope you come close enough?
|4427|4427| 		var parabolicMaxRange = 0;
|4428|    |-		//return false;
|    |4428|+		// return false;
|4429|4429| 
|4430|4430| 	// the parabole changes while walking, take something in the middle
|4431|4431| 	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
|4490|4490| 	if (this.IsFormationMember())
|4491|4491| 	{
|4492|4492| 		var cmpFormationUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|4493|    |-		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation()
|4494|    |-			&& cmpFormationUnitAI.order.data.target == target)
|    |4493|+		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation() &&
|    |4494|+			cmpFormationUnitAI.order.data.target == target)
|4495|4495| 			return true;
|4496|4496| 	}
|4497|4497| 
|    | [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
|4658|4658| UnitAI.prototype.AttackEntityInZone = function(ents)
|4659|4659| {
|4660|4660| 	var target = ents.find(target =>
|4661|    |-		this.CanAttack(target)
|4662|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4661|+		this.CanAttack(target) &&
|    |4662|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4663|4663| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4664|4664| 	);
|4665|4665| 	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
|4659|4659| {
|4660|4660| 	var target = ents.find(target =>
|4661|4661| 		this.CanAttack(target)
|4662|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4663|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4662|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4663|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4664|4664| 	);
|4665|4665| 	if (!target)
|4666|4666| 		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
|4723|4723| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4724|4724| 	if (this.isGuardOf)
|4725|4725| 	{
|4726|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4726|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4727|4727| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4728|4728| 		if (cmpUnitAI && cmpAttack &&
|4729|4729| 		    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
|4727|4727| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4728|4728| 		if (cmpUnitAI && cmpAttack &&
|4729|4729| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4730|    |-				return false;
|    |4730|+			return false;
|4731|4731| 	}
|4732|4732| 
|4733|4733| 	// 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
|4732|4732| 
|4733|4733| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4734|4734| 	if (this.GetStance().respondHoldGround)
|4735|    |-	{
|    |4735|+	
|4736|4736| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4737|4737| 			return true;
|4738|    |-	}
|    |4738|+	
|4739|4739| 
|4740|4740| 	// Stop if it's left our vision range, unless we're especially persistent
|4741|4741| 	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
|4739|4739| 
|4740|4740| 	// Stop if it's left our vision range, unless we're especially persistent
|4741|4741| 	if (!this.GetStance().respondChaseBeyondVision)
|4742|    |-	{
|    |4742|+	
|4743|4743| 		if (!this.CheckTargetIsInVisionRange(target))
|4744|4744| 			return true;
|4745|    |-	}
|    |4745|+	
|4746|4746| 
|4747|4747| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4748|4748| 	// 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
|4765|4765| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4766|4766| 	if (this.isGuardOf)
|4767|4767| 	{
|4768|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4768|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4769|4769| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4770|4770| 		if (cmpUnitAI && cmpAttack &&
|4771|4771| 		    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
|4778|4778| 	return false;
|4779|4779| };
|4780|4780| 
|4781|    |-//// External interface functions ////
|    |4781|+// // External interface functions ////
|4782|4782| 
|4783|4783| UnitAI.prototype.SetFormationController = function(ent)
|4784|4784| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4788|4788| 	// of our own formation (or ourself if not in formation)
|4789|4789| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4790|4790| 	if (cmpObstruction)
|4791|    |-	{
|    |4791|+	
|4792|4792| 		if (ent == INVALID_ENTITY)
|4793|4793| 			cmpObstruction.SetControlGroup(this.entity);
|4794|4794| 		else
|4795|4795| 			cmpObstruction.SetControlGroup(ent);
|4796|    |-	}
|    |4796|+	
|4797|4797| 
|4798|4798| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4799|4799| 	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
|4932|4932| 	// if we already had an old guard order, do nothing if the target is the same
|4933|4933| 	// and the order is running, otherwise remove the previous order
|4934|4934| 	if (this.isGuardOf)
|4935|    |-	{
|    |4935|+	
|4936|4936| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4937|4937| 			return;
|4938|4938| 		else
|4939|4939| 			this.RemoveGuard();
|4940|    |-	}
|    |4940|+	
|4941|4941| 
|4942|4942| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4943|4943| };
|    | [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
|4935|4935| 	{
|4936|4936| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4937|4937| 			return;
|4938|    |-		else
|4939|    |-			this.RemoveGuard();
|    |4938|+		this.RemoveGuard();
|4940|4939| 	}
|4941|4940| 
|4942|4941| 	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
|5115|5115| 			this.WalkToTarget(target, queued);
|5116|5116| 		return;
|5117|5117| 	}
|5118|    |-	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture}, queued);
|    |5118|+	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture }, queued);
|5119|5119| };
|5120|5120| 
|5121|5121| /**
|    | [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
|5264|5264| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5265|5265| 	{
|5266|5266| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5267|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5267|+		if (cmpTrader.HasBothMarkets() &&
|5268|5268| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5269|5269| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5270|5270| 		{
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5545|5545| 				{
|5546|5546| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5547|5547| 					var targetClasses = this.order.data.targetClasses;
|5548|    |-					if (targetClasses.attack && cmpIdentity
|5549|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5548|+					if (targetClasses.attack && cmpIdentity &&
|    |5549|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5550|5550| 						continue;
|5551|5551| 					if (targetClasses.avoid && cmpIdentity
|5552|5552| 						&& 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
|5548|5548| 					if (targetClasses.attack && cmpIdentity
|5549|5549| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5550|5550| 						continue;
|5551|    |-					if (targetClasses.avoid && cmpIdentity
|5552|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5551|+					if (targetClasses.avoid && cmpIdentity &&
|    |5552|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5553|5553| 						continue;
|5554|5554| 					// Only used by the AIs to prevent some choices of targets
|5555|5555| 					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
|5571|5571| 		{
|5572|5572| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5573|5573| 			var targetClasses = this.order.data.targetClasses;
|5574|    |-			if (cmpIdentity && targetClasses.attack
|5575|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5574|+			if (cmpIdentity && targetClasses.attack &&
|    |5575|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5576|5576| 				continue;
|5577|5577| 			if (cmpIdentity && targetClasses.avoid
|5578|5578| 				&& 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
|5574|5574| 			if (cmpIdentity && targetClasses.attack
|5575|5575| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5576|5576| 				continue;
|5577|    |-			if (cmpIdentity && targetClasses.avoid
|5578|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5577|+			if (cmpIdentity && targetClasses.avoid &&
|    |5578|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5579|5579| 				continue;
|5580|5580| 			// Only used by the AIs to prevent some choices of targets
|5581|5581| 			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
|5733|5733| 
|5734|5734| UnitAI.prototype.SetHeldPosition = function(x, z)
|5735|5735| {
|5736|    |-	this.heldPosition = {"x": x, "z": z};
|    |5736|+	this.heldPosition = { "x": x, "z": z};
|5737|5737| };
|5738|5738| 
|5739|5739| 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
|5733|5733| 
|5734|5734| UnitAI.prototype.SetHeldPosition = function(x, z)
|5735|5735| {
|5736|    |-	this.heldPosition = {"x": x, "z": z};
|    |5736|+	this.heldPosition = {"x": x, "z": z };
|5737|5737| };
|5738|5738| 
|5739|5739| 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
|5760|5760| 	return false;
|5761|5761| };
|5762|5762| 
|5763|    |-//// Helper functions ////
|    |5763|+// // Helper functions ////
|5764|5764| 
|5765|5765| UnitAI.prototype.CanAttack = function(target)
|5766|5766| {
|    | [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
|5964|5964| 	return cmpPack && cmpPack.IsPacking();
|5965|5965| };
|5966|5966| 
|5967|    |-//// Formation specific functions ////
|    |5967|+// // Formation specific functions ////
|5968|5968| 
|5969|5969| UnitAI.prototype.IsAttackingAsFormation = function()
|5970|5970| {
|    | [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
|5969|5969| UnitAI.prototype.IsAttackingAsFormation = function()
|5970|5970| {
|5971|5971| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5972|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5973|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5972|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5973|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5974|5974| };
|5975|5975| 
|5976|5976| //// 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
|5973|5973| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5974|5974| };
|5975|5975| 
|5976|    |-//// Animal specific functions ////
|    |5976|+// // Animal specific functions ////
|5977|5977| 
|5978|5978| UnitAI.prototype.MoveRandomly = function(distance)
|5979|5979| {

binaries/data/mods/public/simulation/components/UnitAI.js
|2510| »   »   »   »   »   »   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
|3873| »   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
|4645| »   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
|4660| »   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
|4706| »   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
|4729| »   »   ····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
|5195| »   var·lastPos·=·undefined;
|    | [NORMAL] ESLintBear (no-undef-init):
|    | It's not necessary to initialize 'lastPos' to undefined.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4438| »   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
|4494| »   »   »   &&·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
|4662| »   »   &&·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
|4663| »   »   &&·(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
|5195| »   var·lastPos·=·undefined;
|    | [NORMAL] JSHintBear:
|    | It's not necessary to initialize 'lastPos' to 'undefined'.

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

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

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

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

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

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

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

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

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

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

Silier added inline comments.May 19 2019, 5:25 PM
binaries/data/mods/public/simulation/components/UnitAI.js
1465

switch order
tileOwner && IsEnemy

1468

targetPos = {"x": x, "y": y}

Silier added a subscriber: wraitii.EditedMay 19 2019, 6:18 PM
  1. you need to select movement animation for unit
  2. I do not think automatic scouting should avoid to scout enemy territory
  3. when they do not find position to explore they could go into home territory or back to some cc
  4. you can start timer and check if position of unit have changed and if not then is probably moving on place trying to reach something what cannot else I think it would need to implement reagon map as AI has. (see terrain-analysis.js in ai/common-api)

I do not think Pathfinder or unitmotion has something like this. ( @wraitii ?)

Freagarach marked 2 inline comments as done.May 19 2019, 7:54 PM
In D1851#78736, @Angen wrote:
  1. you need to select movement animation for unit
  2. I do not think automatic scouting should avoid to scout enemy territory
  3. when they do not find position to explore they could go into home territory or back to some cc
  4. you can start timer and check if position of unit have changed and if not then is probably moving on place trying to reach something what cannot else I think it would need to implement reagon map as AI has. (see terrain-analysis.js in ai/common-api)

I do not think Pathfinder or unitmotion has something like this. ( @wraitii ?)

  1. Check.
  2. We have a difference in opinion here then ;) What do other devs think? Trac is not very helpfull here. (Although I just saw that was originally intended as a circular motion to discover first the surrounding area in ever expanding circles (basically option 1, which I gave earlier).)
  3. Check. The unit now returns to the position it was given the scout order from.
  4. The unit stops when it cannot reach the position, but if there is a sea between it and another piece of land it keeps trying to reach the other side because it remains unexplored.

Yeah the only definition we have is here https://trac.wildfiregames.com/wiki/XML.Entity.Actions.Scout

I have no big opinion on this, as long as it can't get abused, and it works fine...
Some people might think the player should do it himself though @wowgetoffyourcellphone thoughts ?

Freagarach updated this revision to Diff 8087.May 19 2019, 8:42 PM
Freagarach edited the summary of this revision. (Show Details)
  • Movement animation.
  • Return to beginposition after finishing scouting.
  • Removed redundant function (entities near position in UnitAI)
  • Shrunk targetPos

I have tried not to make the function too smart. I think it should be favourable to scout yourself.

Freagarach edited the summary of this revision. (Show Details)May 19 2019, 8:45 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 'for-of'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/selection_panels_helpers.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/selection_panels_helpers.js
| 423| 423| 	let otherEnts = [];
| 424| 424| 
| 425| 425| 	for (let ent of garrisonHolders)
| 426|    |-	{
|    | 426|+	
| 427| 427| 		if (controlsPlayer(GetEntityState(ent).player))
| 428| 428| 			ownEnts.push(ent);
| 429| 429| 		else
| 430| 430| 			otherEnts.push(ent);
| 431|    |-	}
|    | 431|+	
| 432| 432| 
| 433| 433| 	if (ownEnts.length)
| 434| 434| 		Engine.PostNetworkCommand({

binaries/data/mods/public/gui/session/unit_actions.js
| 557| »   »   »   switch·(tradingDetails.type)
|    | [NORMAL] ESLintBear (default-case):
|    | Expected a default case.
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
| 330| 330| 			{
| 331| 331| 				var list = queue.GetEntitiesList();
| 332| 332| 				if (list.indexOf(cmd.template) === -1 && cmd.promoted)
| 333|    |-				{
|    | 333|+				
| 334| 334| 					for (var promoted of cmd.promoted)
| 335| 335| 					{
| 336| 336| 						if (list.indexOf(promoted) === -1)
| 338| 338| 						cmd.template = promoted;
| 339| 339| 						break;
| 340| 340| 					}
| 341|    |-				}
|    | 341|+				
| 342| 342| 			}
| 343| 343| 			if (queue && queue.GetEntitiesList().indexOf(cmd.template) != -1)
| 344| 344| 				if ("metadata" in cmd)
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
| 544| 544| 			if (cmpGarrisonHolder)
| 545| 545| 			{
| 546| 546| 				// Only the owner of the garrisonHolder may unload entities from any owners
| 547|    |-				if (!IsOwnedByPlayer(player, garrisonHolder) && !data.controlAllUnits
| 548|    |-				    && player != +cmd.owner)
|    | 547|+				if (!IsOwnedByPlayer(player, garrisonHolder) && !data.controlAllUnits &&
|    | 548|+				    player != +cmd.owner)
| 549| 549| 						continue;
| 550| 550| 
| 551| 551| 				if (!cmpGarrisonHolder.UnloadTemplate(cmd.template, cmd.owner, cmd.all))
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
| 546| 546| 				// Only the owner of the garrisonHolder may unload entities from any owners
| 547| 547| 				if (!IsOwnedByPlayer(player, garrisonHolder) && !data.controlAllUnits
| 548| 548| 				    && player != +cmd.owner)
| 549|    |-						continue;
|    | 549|+					continue;
| 550| 550| 
| 551| 551| 				if (!cmpGarrisonHolder.UnloadTemplate(cmd.template, cmd.owner, cmd.all))
| 552| 552| 					notifyUnloadFailure(player, garrisonHolder);
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
| 956| 956| 		{
| 957| 957| 			var count = 0;
| 958| 958| 			for (let j = 0; j < length - 1; ++j)
| 959|    |-			{
|    | 959|+			
| 960| 960| 				if ((waterPoints[(i + j) % length] + 1) % numPoints == waterPoints[(i + j + 1) % length])
| 961| 961| 					++count;
| 962| 962| 				else
| 963| 963| 					break;
| 964|    |-			}
|    | 964|+			
| 965| 965| 			consec[i] = count;
| 966| 966| 		}
| 967| 967| 		var start = 0;
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-in'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
| 967| 967| 		var start = 0;
| 968| 968| 		var count = 0;
| 969| 969| 		for (var c in consec)
| 970|    |-		{
|    | 970|+		
| 971| 971| 			if (consec[c] > count)
| 972| 972| 			{
| 973| 973| 				start = c;
| 974| 974| 				count = consec[c];
| 975| 975| 			}
| 976|    |-		}
|    | 976|+		
| 977| 977| 
| 978| 978| 		// If we've found a shoreline, stop searching
| 979| 979| 		if (count != numPoints-1)
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space after key 'metadata'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1150|1150| 
|1151|1151| 	// send Metadata info if any
|1152|1152| 	if (cmd.metadata)
|1153|    |-		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player } );
|    |1153|+		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata": cmd.metadata, "owner" : player } );
|1154|1154| 
|1155|1155| 	// Tell the units to start building this new entity
|1156|1156| 	if (cmd.autorepair)
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space after key 'owner'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1150|1150| 
|1151|1151| 	// send Metadata info if any
|1152|1152| 	if (cmd.metadata)
|1153|    |-		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player } );
|    |1153|+		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner": player } );
|1154|1154| 
|1155|1155| 	// Tell the units to start building this new entity
|1156|1156| 	if (cmd.autorepair)
|    | [NORMAL] ESLintBear (space-in-parens):
|    | There should be no spaces inside this paren.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1150|1150| 
|1151|1151| 	// send Metadata info if any
|1152|1152| 	if (cmd.metadata)
|1153|    |-		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player } );
|    |1153|+		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player });
|1154|1154| 
|1155|1155| 	// Tell the units to start building this new entity
|1156|1156| 	if (cmd.autorepair)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1154|1154| 
|1155|1155| 	// Tell the units to start building this new entity
|1156|1156| 	if (cmd.autorepair)
|1157|    |-	{
|    |1157|+	
|1158|1158| 		ProcessCommand(player, {
|1159|1159| 			"type": "repair",
|1160|1160| 			"entities": entities,
|1162|1162| 			"autocontinue": cmd.autocontinue,
|1163|1163| 			"queued": cmd.queued
|1164|1164| 		});
|1165|    |-	}
|    |1165|+	
|1166|1166| 
|1167|1167| 	return ent;
|1168|1168| }
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1258|1258| 		}
|1259|1259| 
|1260|1260| 		lastTowerControlGroup = cmpSnappedStartObstruction.GetControlGroup();
|1261|    |-		//warn("setting lastTowerControlGroup to control group of start snapped entity " + cmd.startSnappedEntity + ": " + lastTowerControlGroup);
|    |1261|+		// warn("setting lastTowerControlGroup to control group of start snapped entity " + cmd.startSnappedEntity + ": " + lastTowerControlGroup);
|1262|1262| 	}
|1263|1263| 
|1264|1264| 	var i = 0;
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1275|1275| 		// 'lastTowerControlGroup' must always be defined and valid here, except if we're at the first piece and we didn't do
|1276|1276| 		// start position snapping (implying that the first entity we build must be a tower)
|1277|1277| 		if (lastTowerControlGroup === null || lastTowerControlGroup == INVALID_ENTITY)
|1278|    |-		{
|    |1278|+		
|1279|1279| 			if (!(i == 0 && piece.template == cmd.wallSet.templates.tower && !cmd.startSnappedEntity))
|1280|1280| 			{
|1281|1281|     			error("[TryConstructWall] Expected last tower control group to be available, none found (1st pass, iteration " + i + ")");
|1282|1282|     			break;
|1283|1283| 			}
|1284|    |-		}
|    |1284|+		
|1285|1285| 
|1286|1286| 		var constructPieceCmd = {
|1287|1287| 			"type": "construct",
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1322|1322| 
|1323|1323| 				if (i > 0)
|1324|1324| 				{
|1325|    |-					//warn("   updating previous wall piece's secondary control group to " + newTowerControlGroup);
|    |1325|+					// warn("   updating previous wall piece's secondary control group to " + newTowerControlGroup);
|1326|1326| 					var cmpPreviousObstruction = Engine.QueryInterface(pieces[i-1].ent, IID_Obstruction);
|1327|1327| 					// TODO: ensure that cmpPreviousObstruction exists
|1328|1328| 					// TODO: ensure that the previous obstruction does not yet have a secondary control group set
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1380|1380| 		}
|1381|1381| 
|1382|1382| 		if (piece.template == cmd.wallSet.templates.tower)
|1383|    |-		{
|    |1383|+		
|1384|1384| 			// encountered a tower entity, update the last tower control group
|1385|1385| 			lastTowerControlGroup = cmpPieceObstruction.GetControlGroup();
|1386|    |-		}
|    |1386|+		
|1387|1387| 		else
|1388|1388| 		{
|1389|1389| 			// Encountered a non-tower entity, update its secondary control group to 'lastTowerControlGroup'.
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1394|1394| 			if (existingSecondaryControlGroup == INVALID_ENTITY)
|1395|1395| 			{
|1396|1396| 				if (lastTowerControlGroup != null && lastTowerControlGroup != INVALID_ENTITY)
|1397|    |-				{
|    |1397|+				
|1398|1398| 					cmpPieceObstruction.SetControlGroup2(lastTowerControlGroup);
|1399|    |-				}
|    |1399|+				
|1400|1400| 			}
|1401|1401| 			else if (existingSecondaryControlGroup != lastTowerControlGroup)
|1402|1402| 			{
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1469|1469| 	}
|1470|1470| 
|1471|1471| 	if (formedEnts.length == 0)
|1472|    |-	{
|    |1472|+	
|1473|1473| 		// No units support the formation - return all the others
|1474|1474| 		return nonformedUnitAIs;
|1475|    |-	}
|    |1475|+	
|1476|1476| 
|1477|1477| 	// Find what formations the formationable selected entities are currently in
|1478|1478| 	var formation = ExtractFormations(formedEnts);
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1485|1485| 		// Check that all its members are selected
|1486|1486| 		var fid = formationIds[0];
|1487|1487| 		var cmpFormation = Engine.QueryInterface(+fid, IID_Formation);
|1488|    |-		if (cmpFormation && cmpFormation.GetMemberCount() == formation.members[fid].length
|1489|    |-			&& cmpFormation.GetMemberCount() == formation.entities.length)
|    |1488|+		if (cmpFormation && cmpFormation.GetMemberCount() == formation.members[fid].length &&
|    |1489|+			cmpFormation.GetMemberCount() == formation.entities.length)
|1490|1490| 		{
|1491|1491| 			cmpFormation.DeleteTwinFormations();
|1492|1492| 			// The whole formation was selected, so reuse its controller for this command
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1517|1517| 					{
|1518|1518| 						var template = cmpUnitAI.GetFormationTemplate();
|1519|1519| 						if (lastFormationTemplate === undefined)
|1520|    |-						{
|    |1520|+						
|1521|1521| 							lastFormationTemplate = template;
|1522|    |-						}
|    |1522|+						
|1523|1523| 						else if (lastFormationTemplate != template)
|1524|1524| 						{
|1525|1525| 							lastFormationTemplate = undefined;
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1593|1593| 		for (var i = matrix.length - 1; i >= 0 && !closeClusters; --i)
|1594|1594| 			for (var j = i - 1; j >= 0 && !closeClusters; --j)
|1595|1595| 				if (matrix[i][j] < distSq)
|1596|    |-					closeClusters = [i,j];
|    |1596|+					closeClusters = [i, j];
|1597|1597| 
|1598|1598| 		// if no more close clusters found, just return all found clusters so far
|1599|1599| 		if (!closeClusters)
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1615|1615| 		}
|1616|1616| 		// remove the rows and columns in the matrix for the merged clusters,
|1617|1617| 		// and the clusters themselves from the cluster list
|1618|    |-		clusters.splice(closeClusters[0],1);
|    |1618|+		clusters.splice(closeClusters[0], 1);
|1619|1619| 		clusters.splice(closeClusters[1],1);
|1620|1620| 		matrix.splice(closeClusters[0],1);
|1621|1621| 		matrix.splice(closeClusters[1],1);
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1616|1616| 		// remove the rows and columns in the matrix for the merged clusters,
|1617|1617| 		// and the clusters themselves from the cluster list
|1618|1618| 		clusters.splice(closeClusters[0],1);
|1619|    |-		clusters.splice(closeClusters[1],1);
|    |1619|+		clusters.splice(closeClusters[1], 1);
|1620|1620| 		matrix.splice(closeClusters[0],1);
|1621|1621| 		matrix.splice(closeClusters[1],1);
|1622|1622| 		for (let i = 0; i < matrix.length; ++i)
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1617|1617| 		// and the clusters themselves from the cluster list
|1618|1618| 		clusters.splice(closeClusters[0],1);
|1619|1619| 		clusters.splice(closeClusters[1],1);
|1620|    |-		matrix.splice(closeClusters[0],1);
|    |1620|+		matrix.splice(closeClusters[0], 1);
|1621|1621| 		matrix.splice(closeClusters[1],1);
|1622|1622| 		for (let i = 0; i < matrix.length; ++i)
|1623|1623| 		{
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1618|1618| 		clusters.splice(closeClusters[0],1);
|1619|1619| 		clusters.splice(closeClusters[1],1);
|1620|1620| 		matrix.splice(closeClusters[0],1);
|1621|    |-		matrix.splice(closeClusters[1],1);
|    |1621|+		matrix.splice(closeClusters[1], 1);
|1622|1622| 		for (let i = 0; i < matrix.length; ++i)
|1623|1623| 		{
|1624|1624| 			if (matrix[i].length > closeClusters[0])
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1622|1622| 		for (let i = 0; i < matrix.length; ++i)
|1623|1623| 		{
|1624|1624| 			if (matrix[i].length > closeClusters[0])
|1625|    |-				matrix[i].splice(closeClusters[0],1);
|    |1625|+				matrix[i].splice(closeClusters[0], 1);
|1626|1626| 			if (matrix[i].length > closeClusters[1])
|1627|1627| 				matrix[i].splice(closeClusters[1],1);
|1628|1628| 		}
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1624|1624| 			if (matrix[i].length > closeClusters[0])
|1625|1625| 				matrix[i].splice(closeClusters[0],1);
|1626|1626| 			if (matrix[i].length > closeClusters[1])
|1627|    |-				matrix[i].splice(closeClusters[1],1);
|    |1627|+				matrix[i].splice(closeClusters[1], 1);
|1628|1628| 		}
|1629|1629| 		// add a new row of distances to the matrix and the new cluster
|1630|1630| 		clusters.push(newCluster);

binaries/data/mods/public/simulation/helpers/Commands.js
| 796| »   »   let·ent·=·pickRandom(cmpRangeManager.GetEntitiesByPlayer(cmd.player).filter(ent·=>·{
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'ent' is already declared in the upper scope.

binaries/data/mods/public/simulation/helpers/Commands.js
|1281| ····»   »   »   error("[TryConstructWall]·Expected·last·tower·control·group·to·be·available,·none·found·(1st·pass,·iteration·"·+·i·+·")");
|    | [NORMAL] ESLintBear (no-mixed-spaces-and-tabs):
|    | Mixed spaces and tabs.

binaries/data/mods/public/simulation/helpers/Commands.js
|1282| ····»   »   »   break;
|    | [NORMAL] ESLintBear (no-mixed-spaces-and-tabs):
|    | Mixed spaces and tabs.

binaries/data/mods/public/simulation/helpers/Commands.js
|1512| »   »   »   »   var·lastFormationTemplate·=·undefined;
|    | [NORMAL] ESLintBear (no-undef-init):
|    | It's not necessary to initialize 'lastFormationTemplate' to undefined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1591| »   »   var·closeClusters·=·undefined;
|    | [NORMAL] ESLintBear (no-undef-init):
|    | It's not necessary to initialize 'closeClusters' to undefined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1608| »   »   for·(let·i·=·0;·i·<·clusters.length;·++i)
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'i' is already declared in the upper scope.

binaries/data/mods/public/simulation/helpers/Commands.js
|1622| »   »   for·(let·i·=·0;·i·<·matrix.length;·++i)
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'i' is already declared in the upper scope.

binaries/data/mods/public/simulation/helpers/Commands.js
|  53| var·g_Commands·=·{
|    | [NORMAL] JSHintBear:
|    | 'g_Commands' was used before it was defined.

binaries/data/mods/public/simulation/helpers/Commands.js
| 548| »   »   »   »   ····&&·player·!=·+cmd.owner)
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/helpers/Commands.js
| 736| »   »   »   »   var·cmpGUIInterface·=·Engine.QueryInterface(SYSTEM_ENTITY,·IID_GuiInterface);
|    | [NORMAL] JSHintBear:
|    | 'cmpGUIInterface' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
| 955| »   »   for·(var·i·=·0;·i·<·length;·++i)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
| 968| »   »   var·count·=·0;
|    | [NORMAL] JSHintBear:
|    | 'count' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1115| »   »   var·cmpGuiInterface·=·Engine.QueryInterface(SYSTEM_ENTITY,·IID_GuiInterface);
|    | [NORMAL] JSHintBear:
|    | 'cmpGuiInterface' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1367| »   »   var·piece·=·pieces[j];
|    | [NORMAL] JSHintBear:
|    | 'piece' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1450| »   »   var·cmpUnitAI·=·Engine.QueryInterface(ent,·IID_UnitAI);
|    | [NORMAL] JSHintBear:
|    | 'cmpUnitAI' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1489| »   »   »   &&·cmpFormation.GetMemberCount()·==·formation.entities.length)
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/helpers/Commands.js
|1515| »   »   »   »   »   var·cmpUnitAI·=·Engine.QueryInterface(ent,·IID_UnitAI);
|    | [NORMAL] JSHintBear:
|    | 'cmpUnitAI' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1548| »   »   »   var·cmpFormation·=·Engine.QueryInterface(formationEnt,·IID_Formation);
|    | [NORMAL] JSHintBear:
|    | 'cmpFormation' is already defined.
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 228| 228| 		// Move a tile outside the building
| 229| 229| 		let range = 4;
| 230| 230| 		if (this.MoveToTargetRangeExplicit(msg.data.target, range, range))
| 231|    |-		{
|    | 231|+		
| 232| 232| 			// We've started walking to the given point
| 233| 233| 			this.SetNextState("INDIVIDUAL.WALKING");
| 234|    |-		}
|    | 234|+		
| 235| 235| 		else
| 236| 236| 		{
| 237| 237| 			// We are already at the target, or can't move at all
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 233| 233| 			this.SetNextState("INDIVIDUAL.WALKING");
| 234| 234| 		}
| 235| 235| 		else
| 236|    |-		{
|    | 236|+		
| 237| 237| 			// We are already at the target, or can't move at all
| 238| 238| 			this.FinishOrder();
| 239|    |-		}
|    | 239|+		
| 240| 240| 	},
| 241| 241| 
| 242| 242| 	// Individual orders:
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 335| 335| 
| 336| 336| 		var ok = this.MoveToTarget(this.order.data.target);
| 337| 337| 		if (ok)
| 338|    |-		{
|    | 338|+		
| 339| 339| 			// We've started walking to the given point
| 340| 340| 			if (this.IsAnimal())
| 341| 341| 				this.SetNextState("ANIMAL.WALKING");
| 342| 342| 			else
| 343| 343| 				this.SetNextState("INDIVIDUAL.WALKING");
| 344|    |-		}
|    | 344|+		
| 345| 345| 		else
| 346| 346| 		{
| 347| 347| 			// We are already at the target, or can't move at all
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 363| 363| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 364| 364| 		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 365| 365| 		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 366|    |-		{
|    | 366|+		
| 367| 367| 			// we were already on the shoreline, and have not moved since
| 368| 368| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
| 369| 369| 				needToMove = false;
| 370|    |-		}
|    | 370|+		
| 371| 371| 
| 372| 372| 		// TODO: what if the units are on a cliff ? the ship will go below the cliff
| 373| 373| 		// and the units won't be able to garrison. Should go to the nearest (accessible) shore
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 361| 361| 		// Check if we need to move     TODO implement a better way to know if we are on the shoreline
| 362| 362| 		var needToMove = true;
| 363| 363| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 364|    |-		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 365|    |-		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
|    | 364|+		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x) &&
|    | 365|+		    (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 366| 366| 		{
| 367| 367| 			// we were already on the shoreline, and have not moved since
| 368| 368| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 372| 372| 		// TODO: what if the units are on a cliff ? the ship will go below the cliff
| 373| 373| 		// and the units won't be able to garrison. Should go to the nearest (accessible) shore
| 374| 374| 		if (needToMove && this.MoveToTarget(this.order.data.target))
| 375|    |-		{
|    | 375|+		
| 376| 376| 			this.SetNextState("INDIVIDUAL.PICKUP.APPROACHING");
| 377|    |-		}
|    | 377|+		
| 378| 378| 		else
| 379| 379| 		{
| 380| 380| 			// We are already at the target, or can't move at all
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 401| 401| 		var distance = DistanceBetweenEntities(this.entity, this.order.data.target) + (+this.template.FleeDistance);
| 402| 402| 		var cmpUnitMotion = Engine.QueryInterface(this.entity, IID_UnitMotion);
| 403| 403| 		if (cmpUnitMotion.MoveToTargetRange(this.order.data.target, distance, -1))
| 404|    |-		{
|    | 404|+		
| 405| 405| 			// We've started fleeing from the given target
| 406| 406| 			if (this.IsAnimal())
| 407| 407| 				this.SetNextState("ANIMAL.FLEEING");
| 408| 408| 			else
| 409| 409| 				this.SetNextState("INDIVIDUAL.FLEEING");
| 410|    |-		}
|    | 410|+		
| 411| 411| 		else
| 412| 412| 		{
| 413| 413| 			// We are already at the target, or can't move at all
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 448| 448| 			}
| 449| 449| 
| 450| 450| 			if (this.order.data.attackType == this.oldAttackType)
| 451|    |-			{
|    | 451|+			
| 452| 452| 				if (this.IsAnimal())
| 453| 453| 					this.SetNextState("ANIMAL.COMBAT.ATTACKING");
| 454| 454| 				else
| 455| 455| 					this.SetNextState("INDIVIDUAL.COMBAT.ATTACKING");
| 456|    |-			}
|    | 456|+			
| 457| 457| 			else
| 458| 458| 			{
| 459| 459| 				if (this.IsAnimal())
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 455| 455| 					this.SetNextState("INDIVIDUAL.COMBAT.ATTACKING");
| 456| 456| 			}
| 457| 457| 			else
| 458|    |-			{
|    | 458|+			
| 459| 459| 				if (this.IsAnimal())
| 460| 460| 					this.SetNextState("ANIMAL.COMBAT.ATTACKING");
| 461| 461| 				else
| 462| 462| 					this.SetNextState("INDIVIDUAL.COMBAT.ATTACKING");
| 463|    |-			}
|    | 463|+			
| 464| 464| 			return;
| 465| 465| 		}
| 466| 466| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 580| 580| 					this.PushOrderFront("Walk", this.order.data.lastPos);
| 581| 581| 				}
| 582| 582| 				else
| 583|    |-				{
|    | 583|+				
| 584| 584| 					// We couldn't move there, or the target moved away
| 585| 585| 					this.FinishOrder();
| 586|    |-				}
|    | 586|+				
| 587| 587| 				return;
| 588| 588| 			}
| 589| 589| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 593| 593| 
| 594| 594| 		// Try to move within range
| 595| 595| 		if (this.MoveToTargetRange(this.order.data.target, IID_ResourceGatherer))
| 596|    |-		{
|    | 596|+		
| 597| 597| 			// We've started walking to the given point
| 598| 598| 			this.SetNextState("INDIVIDUAL.GATHER.APPROACHING");
| 599|    |-		}
|    | 599|+		
| 600| 600| 		else
| 601| 601| 		{
| 602| 602| 			// We are already at the target, or can't move at all,
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 670| 670| 	"Order.Repair": function(msg) {
| 671| 671| 		// Try to move within range
| 672| 672| 		if (this.MoveToTargetRange(this.order.data.target, IID_Builder))
| 673|    |-		{
|    | 673|+		
| 674| 674| 			// We've started walking to the given point
| 675| 675| 			this.SetNextState("INDIVIDUAL.REPAIR.APPROACHING");
| 676|    |-		}
|    | 676|+		
| 677| 677| 		else
| 678| 678| 		{
| 679| 679| 			// We are already at the target, or can't move at all,
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 706| 706| 		}
| 707| 707| 
| 708| 708| 		if (this.MoveToGarrisonRange(this.order.data.target))
| 709|    |-		{
|    | 709|+		
| 710| 710| 			this.SetNextState("INDIVIDUAL.GARRISON.APPROACHING");
| 711|    |-		}
|    | 711|+		
| 712| 712| 		else
| 713| 713| 		{
| 714| 714| 			// We do a range check before actually garrisoning
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 838| 838| 			if (!this.CheckTargetAttackRange(target, target))
| 839| 839| 			{
| 840| 840| 				if (this.TargetIsAlive(target) && this.CheckTargetVisible(target))
| 841|    |-				{
|    | 841|+				
| 842| 842| 					if (this.MoveToTargetAttackRange(target, target))
| 843| 843| 					{
| 844| 844| 						this.SetNextState("COMBAT.APPROACHING");
| 845| 845| 						return;
| 846| 846| 					}
| 847|    |-				}
|    | 847|+				
| 848| 848| 				this.FinishOrder();
| 849| 849| 				return;
| 850| 850| 			}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 863| 863| 			}
| 864| 864| 			// Check if we are already in range, otherwise walk there
| 865| 865| 			if (!this.CheckGarrisonRange(msg.data.target))
| 866|    |-			{
|    | 866|+			
| 867| 867| 				if (!this.CheckTargetVisible(msg.data.target))
| 868| 868| 				{
| 869| 869| 					this.FinishOrder();
| 878| 878| 						return;
| 879| 879| 					}
| 880| 880| 				}
| 881|    |-			}
|    | 881|+			
| 882| 882| 
| 883| 883| 			this.SetNextState("GARRISON.GARRISONING");
| 884| 884| 		},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 870| 870| 					return;
| 871| 871| 				}
| 872| 872| 				else
| 873|    |-				{
|    | 873|+				
| 874| 874| 					// Out of range; move there in formation
| 875| 875| 					if (this.MoveToGarrisonRange(msg.data.target))
| 876| 876| 					{
| 877| 877| 						this.SetNextState("GARRISON.APPROACHING");
| 878| 878| 						return;
| 879| 879| 					}
| 880|    |-				}
|    | 880|+				
| 881| 881| 			}
| 882| 882| 
| 883| 883| 			this.SetNextState("GARRISON.GARRISONING");
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 869| 869| 					this.FinishOrder();
| 870| 870| 					return;
| 871| 871| 				}
| 872|    |-				else
| 873|    |-				{
|    | 872|+				
| 874| 873| 					// Out of range; move there in formation
| 875| 874| 					if (this.MoveToGarrisonRange(msg.data.target))
| 876| 875| 					{
| 877| 876| 						this.SetNextState("GARRISON.APPROACHING");
| 878| 877| 						return;
| 879| 878| 					}
| 880|    |-				}
|    | 879|+				
| 881| 880| 			}
| 882| 881| 
| 883| 882| 			this.SetNextState("GARRISON.GARRISONING");
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 896| 896| 						this.PushOrderFront("Walk", msg.data.lastPos);
| 897| 897| 					}
| 898| 898| 					else
| 899|    |-					{
|    | 899|+					
| 900| 900| 						// We couldn't move there, or the target moved away
| 901| 901| 						this.FinishOrder();
| 902|    |-					}
|    | 902|+					
| 903| 903| 					return;
| 904| 904| 				}
| 905| 905| 
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'GARRISON'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1117|1117| 			},
|1118|1118| 		},
|1119|1119| 
|1120|    |-		"GARRISON":{
|    |1120|+		"GARRISON": {
|1121|1121| 			"enter": function() {
|1122|1122| 				// If the garrisonholder should pickup, warn it so it can take needed action
|1123|1123| 				var cmpGarrisonHolder = Engine.QueryInterface(this.order.data.target, IID_GarrisonHolder);
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1301|1301| 			// If the controller handled an order but some members rejected it,
|1302|1302| 			// they will have no orders and be in the FORMATIONMEMBER.IDLE state.
|1303|1303| 			if (this.orderQueue.length)
|1304|    |-			{
|    |1304|+			
|1305|1305| 				// We're leaving the formation, so stop our FormationWalk order
|1306|1306| 				if (this.FinishOrder())
|1307|1307| 					return;
|1308|    |-			}
|    |1308|+			
|1309|1309| 
|1310|1310| 			// No orders left, we're an individual now
|1311|1311| 			if (this.IsAnimal())
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1329|1329| 			// Move a tile outside the building
|1330|1330| 			let range = 4;
|1331|1331| 			if (this.MoveToTargetRangeExplicit(msg.data.target, range, range))
|1332|    |-			{
|    |1332|+			
|1333|1333| 				// We've started walking to the given point
|1334|1334| 				this.SetNextState("WALKINGTOPOINT");
|1335|    |-			}
|    |1335|+			
|1336|1336| 			else
|1337|1337| 			{
|1338|1338| 				// We are already at the target, or can't move at all
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1334|1334| 				this.SetNextState("WALKINGTOPOINT");
|1335|1335| 			}
|1336|1336| 			else
|1337|    |-			{
|    |1337|+			
|1338|1338| 				// We are already at the target, or can't move at all
|1339|1339| 				this.FinishOrder();
|1340|    |-			}
|    |1340|+			
|1341|1341| 		},
|1342|1342| 
|1343|1343| 
|    | [NORMAL] ESLintBear (space-in-parens):
|    | There should be no spaces inside this paren.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1496|1496| 				{warn("Did not scout before!");
|1497|1497| 					this.ScoutingBeginPosition = pos;
|1498|1498| 					this.IsScouting = true;
|1499|    |-				} else warn("Did scout before! From: " + uneval(this.ScoutingBeginPosition) );
|    |1499|+				} else warn("Did scout before! From: " + uneval(this.ScoutingBeginPosition));
|1500|1500| 
|1501|1501| 				warn("Phase 1."); // Remove when done.
|1502|1502| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 6 tabs but found 0.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1520|1520| 						x = pos.x + Math.sin(ang) * dist;
|1521|1521| 						y = pos.y + Math.cos(ang) * dist;
|1522|1522| 
|1523|    |-warn("Can position ("+uneval(x)+","+uneval(y)+") be explored? " + uneval(cmpRangeManager.CanPlayerExplorePosition(x, y, owner) ) );
|    |1523|+						warn("Can position ("+uneval(x)+","+uneval(y)+") be explored? " + uneval(cmpRangeManager.CanPlayerExplorePosition(x, y, owner) ) );
|1524|1524| 
|1525|1525| 						if (cmpRangeManager.CanPlayerExplorePosition(x, y, owner))
|1526|1526| 							break;
|    | [NORMAL] ESLintBear (space-in-parens):
|    | There should be no spaces inside this paren.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1520|1520| 						x = pos.x + Math.sin(ang) * dist;
|1521|1521| 						y = pos.y + Math.cos(ang) * dist;
|1522|1522| 
|1523|    |-warn("Can position ("+uneval(x)+","+uneval(y)+") be explored? " + uneval(cmpRangeManager.CanPlayerExplorePosition(x, y, owner) ) );
|    |1523|+warn("Can position ("+uneval(x)+","+uneval(y)+") be explored? " + uneval(cmpRangeManager.CanPlayerExplorePosition(x, y, owner)) );
|1524|1524| 
|1525|1525| 						if (cmpRangeManager.CanPlayerExplorePosition(x, y, owner))
|1526|1526| 							break;
|    | [NORMAL] ESLintBear (space-in-parens):
|    | There should be no spaces inside this paren.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1520|1520| 						x = pos.x + Math.sin(ang) * dist;
|1521|1521| 						y = pos.y + Math.cos(ang) * dist;
|1522|1522| 
|1523|    |-warn("Can position ("+uneval(x)+","+uneval(y)+") be explored? " + uneval(cmpRangeManager.CanPlayerExplorePosition(x, y, owner) ) );
|    |1523|+warn("Can position ("+uneval(x)+","+uneval(y)+") be explored? " + uneval(cmpRangeManager.CanPlayerExplorePosition(x, y, owner) ));
|1524|1524| 
|1525|1525| 						if (cmpRangeManager.CanPlayerExplorePosition(x, y, owner))
|1526|1526| 							break;
|    | [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
|1536|1536| 							if (tileOwner && cmpPlayer.IsEnemy(tileOwner))
|1537|1537| 								continue;
|1538|1538| 						}
|1539|    |-						targetPos = {"x": x, "y": y};
|    |1539|+						targetPos = { "x": x, "y": y};
|1540|1540| 						break;
|1541|1541| 					}
|1542|1542| 				}
|    | [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
|1536|1536| 							if (tileOwner && cmpPlayer.IsEnemy(tileOwner))
|1537|1537| 								continue;
|1538|1538| 						}
|1539|    |-						targetPos = {"x": x, "y": y};
|    |1539|+						targetPos = {"x": x, "y": y };
|1540|1540| 						break;
|1541|1541| 					}
|1542|1542| 				}
|    | [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
|1560|1560| 
|1561|1561| 			"Attacked": function(msg) {
|1562|1562| 				this.SetSpeedMultiplier(this.GetRunMultiplier());
|1563|    |-				//this.Flee(msg.data.attacker, false);
|    |1563|+				// this.Flee(msg.data.attacker, false);
|1564|1564| 			},
|1565|1565| 
|1566|1566| 			"leave": function(msg) {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1656|1656| 
|1657|1657| 			"LosRangeUpdate": function(msg) {
|1658|1658| 				if (this.GetStance().targetVisibleEnemies)
|1659|    |-				{
|    |1659|+				
|1660|1660| 					// Start attacking one of the newly-seen enemy (if any)
|1661|1661| 					this.AttackEntitiesByPreference(msg.data.added);
|1662|    |-				}
|    |1662|+				
|1663|1663| 			},
|1664|1664| 
|1665|1665| 			"LosHealRangeUpdate": function(msg) {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1842|1842| 						// if nothing better to do, check if the guarded needs to be healed or repaired
|1843|1843| 						var cmpHealth = Engine.QueryInterface(this.isGuardOf, IID_Health);
|1844|1844| 						if (cmpHealth && (cmpHealth.GetHitpoints() < cmpHealth.GetMaxHitpoints()))
|1845|    |-						{
|    |1845|+						
|1846|1846| 							if (this.CanHeal(this.isGuardOf))
|1847|1847| 								this.PushOrderFront("Heal", { "target": this.isGuardOf, "force": false });
|1848|1848| 							else if (this.CanRepair(this.isGuardOf))
|1849|1849| 								this.PushOrderFront("Repair", { "target": this.isGuardOf, "autocontinue": false, "force": false });
|1850|    |-						}
|    |1850|+						
|1851|1851| 					}
|1852|1852| 				},
|1853|1853| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1927|1927| 				"MoveCompleted": function() {
|1928|1928| 
|1929|1929| 					if (this.CheckTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1930|    |-					{
|    |1930|+					
|1931|1931| 						// If the unit needs to unpack, do so
|1932|1932| 						if (this.CanUnpack())
|1933|1933| 						{
|1936|1936| 						}
|1937|1937| 						else
|1938|1938| 							this.SetNextState("ATTACKING");
|1939|    |-					}
|    |1939|+					
|1940|1940| 					else
|1941|1941| 					{
|1942|1942| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1934|1934| 							this.PushOrderFront("Unpack", { "force": true });
|1935|1935| 							return;
|1936|1936| 						}
|1937|    |-						else
|1938|    |-							this.SetNextState("ATTACKING");
|    |1937|+						this.SetNextState("ATTACKING");
|1939|1938| 					}
|1940|1939| 					else
|1941|1940| 					{
|    | [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
|1938|1938| 							this.SetNextState("ATTACKING");
|1939|1939| 					}
|1940|1940| 					else
|1941|    |-					{
|    |1941|+					
|1942|1942| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1943|1943| 						{
|1944|1944| 							this.SetNextState("APPROACHING");
|1948|1948| 							// Give up
|1949|1949| 							this.FinishOrder();
|1950|1950| 						}
|1951|    |-					}
|    |1951|+					
|1952|1952| 				},
|1953|1953| 			},
|1954|1954| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1940|1940| 					else
|1941|1941| 					{
|1942|1942| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1943|    |-						{
|    |1943|+						
|1944|1944| 							this.SetNextState("APPROACHING");
|1945|    |-						}
|    |1945|+						
|1946|1946| 						else
|1947|1947| 						{
|1948|1948| 							// Give up
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1944|1944| 							this.SetNextState("APPROACHING");
|1945|1945| 						}
|1946|1946| 						else
|1947|    |-						{
|    |1947|+						
|1948|1948| 							// Give up
|1949|1949| 							this.FinishOrder();
|1950|    |-						}
|    |1950|+						
|1951|1951| 					}
|1952|1952| 				},
|1953|1953| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1965|1965| 					}
|1966|1966| 					// Check the target is still alive and attackable
|1967|1967| 					if (this.CanAttack(target) && !this.CheckTargetAttackRange(target, this.order.data.attackType))
|1968|    |-					{
|    |1968|+					
|1969|1969| 						// Can't reach it - try to chase after it
|1970|1970| 						if (this.ShouldChaseTargetedEntity(target, this.order.data.force))
|1971|1971| 						{
|1980|1980| 								return;
|1981|1981| 							}
|1982|1982| 						}
|1983|    |-					}
|    |1983|+					
|1984|1984| 
|1985|1985| 					var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|1986|1986| 					this.attackTimers = cmpAttack.GetTimers(this.order.data.attackType);
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2011|2011| 					// TODO: we should probably only bother syncing projectile attacks, not melee
|2012|2012| 
|2013|2013| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2014|    |-					this.resyncAnimation = (prepare != this.attackTimers.prepare) ? true : false;
|    |2014|+					this.resyncAnimation = (prepare != this.attackTimers.prepare);
|2015|2015| 
|2016|2016| 					this.FaceTowardsTarget(this.order.data.target);
|2017|2017| 
|    | [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
|2140|2140| 
|2141|2141| 				"Attacked": function(msg) {
|2142|2142| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2143|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2144|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2143|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2144|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2145|2145| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2146|2146| 				},
|2147|2147| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2154|2154| 					this.SelectAnimation("move");
|2155|2155| 					var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|2156|2156| 					if (cmpUnitAI && cmpUnitAI.IsFleeing())
|2157|    |-					{
|    |2157|+					
|2158|2158| 						// Run after a fleeing target
|2159|2159| 						this.SetSpeedMultiplier(this.GetRunMultiplier());
|2160|    |-					}
|    |2160|+					
|2161|2161| 					this.StartTimer(1000, 1000);
|2162|2162| 				},
|2163|2163| 
|    | [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
|2215|2215| 						// Also don't switch to a different type of huntable animal
|2216|2216| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2217|2217| 							return (
|2218|    |-								ent != oldTarget
|2219|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2218|+								ent != oldTarget &&
|    |2219|+								 ((type.generic == "treasure" && oldType.generic == "treasure")
|2220|2220| 								 || (type.specific == oldType.specific
|2221|2221| 								 && (type.specific != "meat" || oldTemplate == template)))
|2222|2222| 							);
|    | [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
|2216|2216| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2217|2217| 							return (
|2218|2218| 								ent != oldTarget
|2219|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2220|    |-								 || (type.specific == oldType.specific
|    |2219|+								 && ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2220|+								 (type.specific == oldType.specific
|2221|2221| 								 && (type.specific != "meat" || oldTemplate == template)))
|2222|2222| 							);
|2223|2223| 						}, oldTarget);
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2217|2217| 							return (
|2218|2218| 								ent != oldTarget
|2219|2219| 								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2220|    |-								 || (type.specific == oldType.specific
|2221|    |-								 && (type.specific != "meat" || oldTemplate == template)))
|    |2220|+								 || (type.specific == oldType.specific &&
|    |2221|+								 (type.specific != "meat" || oldTemplate == template)))
|2222|2222| 							);
|2223|2223| 						}, oldTarget);
|2224|2224| 						if (nearby)
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2226|2226| 							this.PerformGather(nearby, false, false);
|2227|2227| 							return true;
|2228|2228| 						}
|2229|    |-						else
|2230|    |-						{
|    |2229|+						
|2231|2230| 							// It's probably better in this case, to avoid units getting stuck around a dropsite
|2232|2231| 							// in a "Target is far away, full, nearby are no good resources, return to dropsite" loop
|2233|2232| 							// to order it to GatherNear the resource position.
|2248|2247| 									return true;
|2249|2248| 								}
|2250|2249| 							}
|2251|    |-						}
|    |2250|+						
|2252|2251| 						return true;
|2253|2252| 					}
|2254|2253| 					return false;
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2238|2238| 								this.GatherNearPosition(pos.x, pos.z, oldType, oldTemplate);
|2239|2239| 								return true;
|2240|2240| 							}
|2241|    |-							else
|2242|    |-							{
|    |2241|+							
|2243|2242| 								// we're kind of stuck here. Return resource.
|2244|2243| 								var nearby = this.FindNearestDropsite(oldType.generic);
|2245|2244| 								if (nearby)
|2247|2246| 									this.PushOrderFront("ReturnResource", { "target": nearby, "force": false });
|2248|2247| 									return true;
|2249|2248| 								}
|2250|    |-							}
|    |2249|+							
|2251|2250| 						}
|2252|2251| 						return true;
|2253|2252| 					}
|    | [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
|2280|2280| 						// Also don't switch to a different type of huntable animal
|2281|2281| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2282|2282| 							return (
|2283|    |-								ent != oldTarget
|2284|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2283|+								ent != oldTarget &&
|    |2284|+								((type.generic == "treasure" && oldType.generic == "treasure")
|2285|2285| 								|| (type.specific == oldType.specific
|2286|2286| 								&& (type.specific != "meat" || oldTemplate == template)))
|2287|2287| 							);
|    | [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
|2281|2281| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2282|2282| 							return (
|2283|2283| 								ent != oldTarget
|2284|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2285|    |-								|| (type.specific == oldType.specific
|    |2284|+								&& ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2285|+								(type.specific == oldType.specific
|2286|2286| 								&& (type.specific != "meat" || oldTemplate == template)))
|2287|2287| 							);
|2288|2288| 						});
|    | [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
|2282|2282| 							return (
|2283|2283| 								ent != oldTarget
|2284|2284| 								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2285|    |-								|| (type.specific == oldType.specific
|2286|    |-								&& (type.specific != "meat" || oldTemplate == template)))
|    |2285|+								|| (type.specific == oldType.specific &&
|    |2286|+								(type.specific != "meat" || oldTemplate == template)))
|2287|2287| 							);
|2288|2288| 						});
|2289|2289| 						if (nearby)
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2327|2327| 					// Also don't switch to a different type of huntable animal
|2328|2328| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2329|2329| 						return (
|2330|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2331|    |-							|| (type.specific == resourceType.specific
|    |2330|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2331|+							(type.specific == resourceType.specific
|2332|2332| 							&& (type.specific != "meat" || resourceTemplate == template))
|2333|2333| 						);
|2334|2334| 					});
|    | [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
|2328|2328| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2329|2329| 						return (
|2330|2330| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2331|    |-							|| (type.specific == resourceType.specific
|2332|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2331|+							|| (type.specific == resourceType.specific &&
|    |2332|+							(type.specific != "meat" || resourceTemplate == template))
|2333|2333| 						);
|2334|2334| 					});
|2335|2335| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2444|2444| 
|2445|2445| 					var cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply);
|2446|2446| 					if (cmpSupply && cmpSupply.IsAvailable(cmpOwnership.GetOwner(), this.entity))
|2447|    |-					{
|    |2447|+					
|2448|2448| 						// Check we can still reach and gather from the target
|2449|2449| 						if (this.CheckTargetRange(this.gatheringTarget, IID_ResourceGatherer) && this.CanGather(this.gatheringTarget))
|2450|2450| 						{
|2510|2510| 								return;
|2511|2511| 							}
|2512|2512| 						}
|2513|    |-					}
|    |2513|+					
|2514|2514| 
|2515|2515| 					// We're already in range, can't get anywhere near it or the target is exhausted.
|2516|2516| 
|    | [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
|2536|2536| 					// Also don't switch to a different type of huntable animal
|2537|2537| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2538|2538| 						return (
|2539|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2540|    |-							|| (type.specific == resourceType.specific
|    |2539|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2540|+							(type.specific == resourceType.specific
|2541|2541| 							&& (type.specific != "meat" || resourceTemplate == template))
|2542|2542| 						);
|2543|2543| 					});
|    | [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
|2537|2537| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2538|2538| 						return (
|2539|2539| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2540|    |-							|| (type.specific == resourceType.specific
|2541|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2540|+							|| (type.specific == resourceType.specific &&
|    |2541|+							(type.specific != "meat" || resourceTemplate == template))
|2542|2542| 						);
|2543|2543| 					});
|2544|2544| 					if (nearby)
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2624|2624| 					this.StartTimer(prepare, this.healTimers.repeat);
|2625|2625| 
|2626|2626| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2627|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2627|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2628|2628| 
|2629|2629| 					this.FaceTowardsTarget(this.order.data.target);
|2630|2630| 				},
|    | [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
|2839|2839| 					{
|2840|2840| 						// The building was already finished/fully repaired before we arrived;
|2841|2841| 						// let the ConstructionFinished handler handle this.
|2842|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2842|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2843|2843| 						return true;
|2844|2844| 					}
|2845|2845| 
|    | [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
|2839|2839| 					{
|2840|2840| 						// The building was already finished/fully repaired before we arrived;
|2841|2841| 						// let the ConstructionFinished handler handle this.
|2842|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2842|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2843|2843| 						return true;
|2844|2844| 					}
|2845|2845| 
|    | [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
|2879|2879| 					if (this.MoveToTargetRange(this.repairTarget, IID_Builder))
|2880|2880| 						this.SetNextState("APPROACHING");
|2881|2881| 					else if (!this.CheckTargetRange(this.repairTarget, IID_Builder))
|2882|    |-						this.FinishOrder(); //can't approach and isn't in reach
|    |2882|+						this.FinishOrder(); // can't approach and isn't in reach
|2883|2883| 				},
|2884|2884| 			},
|2885|2885| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2966|2966| 
|2967|2967| 				// Unit was approaching and there's nothing to do now, so switch to walking
|2968|2968| 				if (oldState === "INDIVIDUAL.REPAIR.APPROACHING")
|2969|    |-				{
|    |2969|+				
|2970|2970| 					// We're already walking to the given point, so add this as a order.
|2971|2971| 					this.WalkToTarget(msg.data.newentity, true);
|2972|    |-				}
|    |2972|+				
|2973|2973| 			},
|2974|2974| 		},
|2975|2975| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3019|3019| 
|3020|3020| 					// Check that we can garrison here
|3021|3021| 					if (this.CanGarrison(target))
|3022|    |-					{
|    |3022|+					
|3023|3023| 						// Check that we're in range of the garrison target
|3024|3024| 						if (this.CheckGarrisonRange(target))
|3025|3025| 						{
|3095|3095| 								return false;
|3096|3096| 							}
|3097|3097| 						}
|3098|    |-					}
|    |3098|+					
|3099|3099| 					// Garrisoning failed for some reason, so finish the order
|3100|3100| 					this.FinishOrder();
|3101|3101| 					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
|3202|3202| 		"Attacked": function(msg) {
|3203|3203| 			if (this.template.NaturalBehaviour == "skittish" ||
|3204|3204| 			    this.template.NaturalBehaviour == "passive")
|3205|    |-			{
|    |3205|+			
|3206|3206| 				this.Flee(msg.data.attacker, false);
|3207|    |-			}
|    |3207|+			
|3208|3208| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|3209|3209| 			{
|3210|3210| 				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
|3211|3211| 					this.Attack(msg.data.attacker, false);
|3212|3212| 			}
|3213|3213| 			else if (this.template.NaturalBehaviour == "domestic")
|3214|    |-			{
|    |3214|+			
|3215|3215| 				// Never flee, stop what we were doing
|3216|3216| 				this.SetNextState("IDLE");
|3217|    |-			}
|    |3217|+			
|3218|3218| 		},
|3219|3219| 
|3220|3220| 		"Order.LeaveFoundation": function(msg) {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3221|3221| 			// Move a tile outside the building
|3222|3222| 			var range = 4;
|3223|3223| 			if (this.MoveToTargetRangeExplicit(msg.data.target, range, range))
|3224|    |-			{
|    |3224|+			
|3225|3225| 				// We've started walking to the given point
|3226|3226| 				this.SetNextState("WALKING");
|3227|    |-			}
|    |3227|+			
|3228|3228| 			else
|3229|3229| 			{
|3230|3230| 				// We are already at the target, or can't move at all
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3226|3226| 				this.SetNextState("WALKING");
|3227|3227| 			}
|3228|3228| 			else
|3229|    |-			{
|    |3229|+			
|3230|3230| 				// We are already at the target, or can't move at all
|3231|3231| 				this.FinishOrder();
|3232|    |-			}
|    |3232|+			
|3233|3233| 		},
|3234|3234| 
|3235|3235| 		"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
|3268|3268| 				}
|3269|3269| 				// Start attacking one of the newly-seen enemy (if any)
|3270|3270| 				else if (this.IsDangerousAnimal())
|3271|    |-				{
|    |3271|+				
|3272|3272| 					this.AttackVisibleEntity(msg.data.added);
|3273|    |-				}
|    |3273|+				
|3274|3274| 
|3275|3275| 				// TODO: if two units enter our range together, we'll attack the
|3276|3276| 				// 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
|3311|3311| 				}
|3312|3312| 				// Start attacking one of the newly-seen enemy (if any)
|3313|3313| 				else if (this.template.NaturalBehaviour == "violent")
|3314|    |-				{
|    |3314|+				
|3315|3315| 					this.AttackVisibleEntity(msg.data.added);
|3316|    |-				}
|    |3316|+				
|3317|3317| 			},
|3318|3318| 
|3319|3319| 			"MoveCompleted": function() { },
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 7.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3328|3328| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3329|3329| 
|3330|3330| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3331|    |-							// only used for domestic animals
|    |3331|+		// only used for domestic animals
|3332|3332| 	},
|3333|3333| };
|3334|3334| 
|    | [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
|3385|3385| 
|3386|3386| UnitAI.prototype.IsAnimal = function()
|3387|3387| {
|3388|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3388|+	return (!!this.template.NaturalBehaviour);
|3389|3389| };
|3390|3390| 
|3391|3391| 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
|3423|3423| UnitAI.prototype.GetGarrisonHolder = function()
|3424|3424| {
|3425|3425| 	if (this.IsGarrisoned())
|3426|    |-	{
|    |3426|+	
|3427|3427| 		for (let order of this.orderQueue)
|3428|3428| 			if (order.type == "Garrison")
|3429|3429| 				return order.data.target;
|3430|    |-	}
|    |3430|+	
|3431|3431| 	return INVALID_ENTITY;
|3432|3432| };
|3433|3433| 
|    | [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
|3501|3501| 		{
|3502|3502| 			let index = this.GetCurrentState().indexOf(".");
|3503|3503| 			if (index != -1)
|3504|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3504|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3505|3505| 			this.Stop(false);
|3506|3506| 		}
|3507|3507| 
|    | [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
|3557|3557| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3558|3558| 			continue;
|3559|3559| 		if (i == 0)
|3560|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3560|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3561|3561| 		else
|3562|3562| 			this.orderQueue.splice(i, 1);
|3563|3563| 		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
|3557|3557| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3558|3558| 			continue;
|3559|3559| 		if (i == 0)
|3560|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3560|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3561|3561| 		else
|3562|3562| 			this.orderQueue.splice(i, 1);
|3563|3563| 		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
|3641|3641| };
|3642|3642| 
|3643|3643| 
|3644|    |-//// FSM linkage functions ////
|    |3644|+// // FSM linkage functions ////
|3645|3645| 
|3646|3646| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3647|3647| 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
|3813|3813| 				continue;
|3814|3814| 			if (this.orderQueue[i].type == type)
|3815|3815| 				continue;
|3816|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3816|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3817|3817| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3818|3818| 			return;
|3819|3819| 		}
|    | [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
|3813|3813| 				continue;
|3814|3814| 			if (this.orderQueue[i].type == type)
|3815|3815| 				continue;
|3816|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3816|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3817|3817| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3818|3818| 			return;
|3819|3819| 		}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3827|3827| {
|3828|3828| 	// Remember the previous work orders to be able to go back to them later if required
|3829|3829| 	if (data && data.force)
|3830|    |-	{
|    |3830|+	
|3831|3831| 		if (this.IsFormationController())
|3832|3832| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3833|3833| 		else
|3834|3834| 			this.UpdateWorkOrders(type);
|3835|    |-	}
|    |3835|+	
|3836|3836| 
|3837|3837| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3838|3838| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3904|3904| 	{
|3905|3905| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3906|3906| 		if (cmpUnitAI)
|3907|    |-		{
|    |3907|+		
|3908|3908| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3909|3909| 			{
|3910|3910| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3913|3913| 					return;
|3914|3914| 				}
|3915|3915| 			}
|3916|    |-		}
|    |3916|+		
|3917|3917| 	}
|3918|3918| 
|3919|3919| 	// 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
|3906|3906| 		if (cmpUnitAI)
|3907|3907| 		{
|3908|3908| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3909|    |-			{
|    |3909|+			
|3910|3910| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3911|3911| 				{
|3912|3912| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3913|3913| 					return;
|3914|3914| 				}
|3915|    |-			}
|    |3915|+			
|3916|3916| 		}
|3917|3917| 	}
|3918|3918| 
|    | [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
|3918|3918| 
|3919|3919| 	// If nothing found, take the unit orders
|3920|3920| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3921|    |-	{
|    |3921|+	
|3922|3922| 		if (isWorkType(this.orderQueue[i].type))
|3923|3923| 		{
|3924|3924| 			this.workOrders = this.orderQueue.slice(i);
|3925|3925| 			return;
|3926|3926| 		}
|3927|    |-	}
|    |3927|+	
|3928|3928| };
|3929|3929| 
|3930|3930| 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
|3984|3984| 	if (data.timerRepeat === undefined)
|3985|3985| 		this.timer = undefined;
|3986|3986| 
|3987|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3987|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3988|3988| };
|3989|3989| 
|3990|3990| /**
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3984|3984| 	if (data.timerRepeat === undefined)
|3985|3985| 		this.timer = undefined;
|3986|3986| 
|3987|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3987|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3988|3988| };
|3989|3989| 
|3990|3990| /**
|    | [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
|4019|4019| 	this.timer = undefined;
|4020|4020| };
|4021|4021| 
|4022|    |-//// Message handlers /////
|    |4022|+// // Message handlers /////
|4023|4023| 
|4024|4024| UnitAI.prototype.OnMotionChanged = function(msg)
|4025|4025| {
|    | [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
|4024|4024| UnitAI.prototype.OnMotionChanged = function(msg)
|4025|4025| {
|4026|4026| 	if (msg.starting && !msg.error)
|4027|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |4027|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveStarted", "data": msg});
|4028|4028| 	else if (!msg.starting || msg.error)
|4029|4029| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|4030|4030| };
|    | [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
|4024|4024| UnitAI.prototype.OnMotionChanged = function(msg)
|4025|4025| {
|4026|4026| 	if (msg.starting && !msg.error)
|4027|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |4027|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg });
|4028|4028| 	else if (!msg.starting || msg.error)
|4029|4029| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|4030|4030| };
|    | [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
|4026|4026| 	if (msg.starting && !msg.error)
|4027|4027| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|4028|4028| 	else if (!msg.starting || msg.error)
|4029|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |4029|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveCompleted", "data": msg});
|4030|4030| };
|4031|4031| 
|4032|4032| UnitAI.prototype.OnGlobalConstructionFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4026|4026| 	if (msg.starting && !msg.error)
|4027|4027| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|4028|4028| 	else if (!msg.starting || msg.error)
|4029|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |4029|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg });
|4030|4030| };
|4031|4031| 
|4032|4032| UnitAI.prototype.OnGlobalConstructionFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4034|4034| 	// TODO: This is a bit inefficient since every unit listens to every
|4035|4035| 	// construction message - ideally we could scope it to only the one we're building
|4036|4036| 
|4037|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4037|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4038|4038| };
|4039|4039| 
|4040|4040| 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
|4034|4034| 	// TODO: This is a bit inefficient since every unit listens to every
|4035|4035| 	// construction message - ideally we could scope it to only the one we're building
|4036|4036| 
|4037|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4037|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4038|4038| };
|4039|4039| 
|4040|4040| 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
|4059|4059| 
|4060|4060| UnitAI.prototype.OnAttacked = function(msg)
|4061|4061| {
|4062|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4062|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4063|4063| };
|4064|4064| 
|4065|4065| 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
|4059|4059| 
|4060|4060| UnitAI.prototype.OnAttacked = function(msg)
|4061|4061| {
|4062|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4062|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4063|4063| };
|4064|4064| 
|4065|4065| 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
|4064|4064| 
|4065|4065| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4066|4066| {
|4067|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4067|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4068|4068| };
|4069|4069| 
|4070|4070| 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
|4064|4064| 
|4065|4065| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4066|4066| {
|4067|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4067|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4068|4068| };
|4069|4069| 
|4070|4070| 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
|4069|4069| 
|4070|4070| UnitAI.prototype.OnHealthChanged = function(msg)
|4071|4071| {
|4072|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4072|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4073|4073| };
|4074|4074| 
|4075|4075| 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
|4069|4069| 
|4070|4070| UnitAI.prototype.OnHealthChanged = function(msg)
|4071|4071| {
|4072|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4072|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4073|4073| };
|4074|4074| 
|4075|4075| 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
|4075|4075| UnitAI.prototype.OnRangeUpdate = function(msg)
|4076|4076| {
|4077|4077| 	if (msg.tag == this.losRangeQuery)
|4078|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4078|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4079|4079| 	else if (msg.tag == this.losHealRangeQuery)
|4080|4080| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4081|4081| };
|    | [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
|4075|4075| UnitAI.prototype.OnRangeUpdate = function(msg)
|4076|4076| {
|4077|4077| 	if (msg.tag == this.losRangeQuery)
|4078|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4078|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4079|4079| 	else if (msg.tag == this.losHealRangeQuery)
|4080|4080| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4081|4081| };
|    | [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
|4077|4077| 	if (msg.tag == this.losRangeQuery)
|4078|4078| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4079|4079| 	else if (msg.tag == this.losHealRangeQuery)
|4080|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4080|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4081|4081| };
|4082|4082| 
|4083|4083| 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
|4077|4077| 	if (msg.tag == this.losRangeQuery)
|4078|4078| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4079|4079| 	else if (msg.tag == this.losHealRangeQuery)
|4080|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4080|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4081|4081| };
|4082|4082| 
|4083|4083| 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
|4082|4082| 
|4083|4083| UnitAI.prototype.OnPackFinished = function(msg)
|4084|4084| {
|4085|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4085|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4086|4086| };
|4087|4087| 
|4088|4088| //// 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
|4082|4082| 
|4083|4083| UnitAI.prototype.OnPackFinished = function(msg)
|4084|4084| {
|4085|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4085|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4086|4086| };
|4087|4087| 
|4088|4088| //// 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
|4085|4085| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4086|4086| };
|4087|4087| 
|4088|    |-//// Helper functions to be called by the FSM ////
|    |4088|+// // Helper functions to be called by the FSM ////
|4089|4089| 
|4090|4090| UnitAI.prototype.GetWalkSpeed = function()
|4091|4091| {
|    | [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
|4187|4187| 	if (!cmpOwnership || cmpOwnership.GetOwner() == INVALID_PLAYER)
|4188|4188| 		return undefined;
|4189|4189| 
|4190|    |-	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position)
|    |4190|+	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
|4191|4191| 	if (!cmpPosition || !cmpPosition.IsInWorld())
|4192|4192| 		return undefined;
|4193|4193| 
|    | [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
|4272|4272| 			PlaySound(name, member);
|4273|4273| 	}
|4274|4274| 	else
|4275|    |-	{
|    |4275|+	
|4276|4276| 		// Otherwise use our own sounds
|4277|4277| 		PlaySound(name, this.entity);
|4278|    |-	}
|    |4278|+	
|4279|4279| };
|4280|4280| 
|4281|4281| /*
|    | [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
|4441|4441| 	else
|4442|4442| 		// return false? Or hope you come close enough?
|4443|4443| 		var parabolicMaxRange = 0;
|4444|    |-		//return false;
|    |4444|+		// return false;
|4445|4445| 
|4446|4446| 	// the parabole changes while walking, take something in the middle
|4447|4447| 	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
|4506|4506| 	if (this.IsFormationMember())
|4507|4507| 	{
|4508|4508| 		var cmpFormationUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|4509|    |-		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation()
|4510|    |-			&& cmpFormationUnitAI.order.data.target == target)
|    |4509|+		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation() &&
|    |4510|+			cmpFormationUnitAI.order.data.target == target)
|4511|4511| 			return true;
|4512|4512| 	}
|4513|4513| 
|    | [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
|4674|4674| UnitAI.prototype.AttackEntityInZone = function(ents)
|4675|4675| {
|4676|4676| 	var target = ents.find(target =>
|4677|    |-		this.CanAttack(target)
|4678|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4677|+		this.CanAttack(target) &&
|    |4678|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4679|4679| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4680|4680| 	);
|4681|4681| 	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
|4675|4675| {
|4676|4676| 	var target = ents.find(target =>
|4677|4677| 		this.CanAttack(target)
|4678|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4679|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4678|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4679|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4680|4680| 	);
|4681|4681| 	if (!target)
|4682|4682| 		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
|4739|4739| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4740|4740| 	if (this.isGuardOf)
|4741|4741| 	{
|4742|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4742|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4743|4743| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4744|4744| 		if (cmpUnitAI && cmpAttack &&
|4745|4745| 		    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
|4743|4743| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4744|4744| 		if (cmpUnitAI && cmpAttack &&
|4745|4745| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4746|    |-				return false;
|    |4746|+			return false;
|4747|4747| 	}
|4748|4748| 
|4749|4749| 	// 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
|4748|4748| 
|4749|4749| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4750|4750| 	if (this.GetStance().respondHoldGround)
|4751|    |-	{
|    |4751|+	
|4752|4752| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4753|4753| 			return true;
|4754|    |-	}
|    |4754|+	
|4755|4755| 
|4756|4756| 	// Stop if it's left our vision range, unless we're especially persistent
|4757|4757| 	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
|4755|4755| 
|4756|4756| 	// Stop if it's left our vision range, unless we're especially persistent
|4757|4757| 	if (!this.GetStance().respondChaseBeyondVision)
|4758|    |-	{
|    |4758|+	
|4759|4759| 		if (!this.CheckTargetIsInVisionRange(target))
|4760|4760| 			return true;
|4761|    |-	}
|    |4761|+	
|4762|4762| 
|4763|4763| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4764|4764| 	// 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
|4781|4781| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4782|4782| 	if (this.isGuardOf)
|4783|4783| 	{
|4784|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4784|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4785|4785| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4786|4786| 		if (cmpUnitAI && cmpAttack &&
|4787|4787| 		    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
|4794|4794| 	return false;
|4795|4795| };
|4796|4796| 
|4797|    |-//// External interface functions ////
|    |4797|+// // External interface functions ////
|4798|4798| 
|4799|4799| UnitAI.prototype.SetFormationController = function(ent)
|4800|4800| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4804|4804| 	// of our own formation (or ourself if not in formation)
|4805|4805| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4806|4806| 	if (cmpObstruction)
|4807|    |-	{
|    |4807|+	
|4808|4808| 		if (ent == INVALID_ENTITY)
|4809|4809| 			cmpObstruction.SetControlGroup(this.entity);
|4810|4810| 		else
|4811|4811| 			cmpObstruction.SetControlGroup(ent);
|4812|    |-	}
|    |4812|+	
|4813|4813| 
|4814|4814| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4815|4815| 	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
|4948|4948| 	// if we already had an old guard order, do nothing if the target is the same
|4949|4949| 	// and the order is running, otherwise remove the previous order
|4950|4950| 	if (this.isGuardOf)
|4951|    |-	{
|    |4951|+	
|4952|4952| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4953|4953| 			return;
|4954|4954| 		else
|4955|4955| 			this.RemoveGuard();
|4956|    |-	}
|    |4956|+	
|4957|4957| 
|4958|4958| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4959|4959| };
|    | [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
|4951|4951| 	{
|4952|4952| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4953|4953| 			return;
|4954|    |-		else
|4955|    |-			this.RemoveGuard();
|    |4954|+		this.RemoveGuard();
|4956|4955| 	}
|4957|4956| 
|4958|4957| 	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
|5131|5131| 			this.WalkToTarget(target, queued);
|5132|5132| 		return;
|5133|5133| 	}
|5134|    |-	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture}, queued);
|    |5134|+	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture }, queued);
|5135|5135| };
|5136|5136| 
|5137|5137| /**
|    | [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
|5280|5280| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5281|5281| 	{
|5282|5282| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5283|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5283|+		if (cmpTrader.HasBothMarkets() &&
|5284|5284| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5285|5285| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5286|5286| 		{
|    | [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
|5561|5561| 				{
|5562|5562| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5563|5563| 					var targetClasses = this.order.data.targetClasses;
|5564|    |-					if (targetClasses.attack && cmpIdentity
|5565|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5564|+					if (targetClasses.attack && cmpIdentity &&
|    |5565|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5566|5566| 						continue;
|5567|5567| 					if (targetClasses.avoid && cmpIdentity
|5568|5568| 						&& 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
|5564|5564| 					if (targetClasses.attack && cmpIdentity
|5565|5565| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5566|5566| 						continue;
|5567|    |-					if (targetClasses.avoid && cmpIdentity
|5568|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5567|+					if (targetClasses.avoid && cmpIdentity &&
|    |5568|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5569|5569| 						continue;
|5570|5570| 					// Only used by the AIs to prevent some choices of targets
|5571|5571| 					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
|5587|5587| 		{
|5588|5588| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5589|5589| 			var targetClasses = this.order.data.targetClasses;
|5590|    |-			if (cmpIdentity && targetClasses.attack
|5591|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5590|+			if (cmpIdentity && targetClasses.attack &&
|    |5591|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5592|5592| 				continue;
|5593|5593| 			if (cmpIdentity && targetClasses.avoid
|5594|5594| 				&& 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
|5590|5590| 			if (cmpIdentity && targetClasses.attack
|5591|5591| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5592|5592| 				continue;
|5593|    |-			if (cmpIdentity && targetClasses.avoid
|5594|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5593|+			if (cmpIdentity && targetClasses.avoid &&
|    |5594|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5595|5595| 				continue;
|5596|5596| 			// Only used by the AIs to prevent some choices of targets
|5597|5597| 			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
|5733|5733| 
|5734|5734| UnitAI.prototype.SetHeldPosition = function(x, z)
|5735|5735| {
|5736|    |-	this.heldPosition = {"x": x, "z": z};
|    |5736|+	this.heldPosition = { "x": x, "z": z};
|5737|5737| };
|5738|5738| 
|5739|5739| 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
|5733|5733| 
|5734|5734| UnitAI.prototype.SetHeldPosition = function(x, z)
|5735|5735| {
|5736|    |-	this.heldPosition = {"x": x, "z": z};
|    |5736|+	this.heldPosition = {"x": x, "z": z };
|5737|5737| };
|5738|5738| 
|5739|5739| 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
|5760|5760| 	return false;
|5761|5761| };
|5762|5762| 
|5763|    |-//// Helper functions ////
|    |5763|+// // Helper functions ////
|5764|5764| 
|5765|5765| UnitAI.prototype.CanAttack = function(target)
|5766|5766| {
|    | [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
|5964|5964| 	return cmpPack && cmpPack.IsPacking();
|5965|5965| };
|5966|5966| 
|5967|    |-//// Formation specific functions ////
|    |5967|+// // Formation specific functions ////
|5968|5968| 
|5969|5969| UnitAI.prototype.IsAttackingAsFormation = function()
|5970|5970| {
|    | [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
|5969|5969| UnitAI.prototype.IsAttackingAsFormation = function()
|5970|5970| {
|5971|5971| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5972|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5973|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5972|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5973|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5974|5974| };
|5975|5975| 
|5976|5976| //// 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
|5973|5973| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5974|5974| };
|5975|5975| 
|5976|    |-//// Animal specific functions ////
|    |5976|+// // Animal specific functions ////
|5977|5977| 
|5978|5978| UnitAI.prototype.MoveRandomly = function(distance)
|5979|5979| {

binaries/data/mods/public/simulation/components/UnitAI.js
|1496| »   »   »   »   {warn("Did·not·scout·before!");
|    | [NORMAL] ESLintBear (brace-rules/brace-on-same-line):
|    | Statement inside of curly braces should be on next line.

binaries/data/mods/public/simulation/components/UnitAI.js
|1499| »   »   »   »   }·else·warn("Did·scout·before!·From:·"·+·uneval(this.ScoutingBeginPosition)·);
|    | [NORMAL] ESLintBear (brace-rules/brace-on-same-line):
|    | Closing curly brace appears on the same line as the subsequent block.

binaries/data/mods/public/simulation/components/UnitAI.js
|2526| »   »   »   »   »   »   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
|3889| »   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
|4661| »   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
|4676| »   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
|4722| »   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
|4745| »   »   ····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
|5211| »   var·lastPos·=·undefined;
|    | [NORMAL] ESLintBear (no-undef-init):
|    | It's not necessary to initialize 'lastPos' to undefined.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4454| »   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
|4510| »   »   »   &&·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
|4678| »   »   &&·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
|4679| »   »   &&·(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
|5211| »   var·lastPos·=·undefined;
|    | [NORMAL] JSHintBear:
|    | It's not necessary to initialize 'lastPos' to 'undefined'.

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

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

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

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

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

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

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

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

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

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

Silier added inline comments.May 19 2019, 9:08 PM
binaries/data/mods/public/simulation/components/UnitAI.js
1435

move this to Order.Scout and delete this.IsScouting and this.WasScouting

1488

This is wrong state, should be walking

In D1851#78736, @Angen wrote:
  1. you need to select movement animation for unit
  2. I do not think automatic scouting should avoid to scout enemy territory
  3. when they do not find position to explore they could go into home territory or back to some cc
  4. you can start timer and check if position of unit have changed and if not then is probably moving on place trying to reach something what cannot else I think it would need to implement reagon map as AI has. (see terrain-analysis.js in ai/common-api)

I do not think Pathfinder or unitmotion has something like this. ( @wraitii ?)

It doesn't and it probably shouldn't have. We could have an "auto-explore" per-player (or maybe system, depending) component that can tell any unit where to go.

It doesn't and it probably shouldn't have. We could have an "auto-explore" per-player (or maybe system, depending) component that can tell any unit where to go.

Would not pathfinder benefit from the knowing if tile is on another island?

In D1851#78803, @Angen wrote:

It doesn't and it probably shouldn't have. We could have an "auto-explore" per-player (or maybe system, depending) component that can tell any unit where to go.

Would not pathfinder benefit from the knowing if tile is on another island?

the pathfinder only cares insofar as it knows it won't be reachable. UnitAI will definitely care though, but that's unrelated.

Freagarach updated this revision to Diff 8091.May 20 2019, 8:57 PM
Freagarach marked 2 inline comments as done.
Freagarach edited the summary of this revision. (Show Details)
  • Moved position remembering to the order.
  • Walking state after finishing.

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 'for-of'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/selection_panels_helpers.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/selection_panels_helpers.js
| 423| 423| 	let otherEnts = [];
| 424| 424| 
| 425| 425| 	for (let ent of garrisonHolders)
| 426|    |-	{
|    | 426|+	
| 427| 427| 		if (controlsPlayer(GetEntityState(ent).player))
| 428| 428| 			ownEnts.push(ent);
| 429| 429| 		else
| 430| 430| 			otherEnts.push(ent);
| 431|    |-	}
|    | 431|+	
| 432| 432| 
| 433| 433| 	if (ownEnts.length)
| 434| 434| 		Engine.PostNetworkCommand({

binaries/data/mods/public/gui/session/unit_actions.js
| 557| »   »   »   switch·(tradingDetails.type)
|    | [NORMAL] ESLintBear (default-case):
|    | Expected a default case.
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
| 330| 330| 			{
| 331| 331| 				var list = queue.GetEntitiesList();
| 332| 332| 				if (list.indexOf(cmd.template) === -1 && cmd.promoted)
| 333|    |-				{
|    | 333|+				
| 334| 334| 					for (var promoted of cmd.promoted)
| 335| 335| 					{
| 336| 336| 						if (list.indexOf(promoted) === -1)
| 338| 338| 						cmd.template = promoted;
| 339| 339| 						break;
| 340| 340| 					}
| 341|    |-				}
|    | 341|+				
| 342| 342| 			}
| 343| 343| 			if (queue && queue.GetEntitiesList().indexOf(cmd.template) != -1)
| 344| 344| 				if ("metadata" in cmd)
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
| 544| 544| 			if (cmpGarrisonHolder)
| 545| 545| 			{
| 546| 546| 				// Only the owner of the garrisonHolder may unload entities from any owners
| 547|    |-				if (!IsOwnedByPlayer(player, garrisonHolder) && !data.controlAllUnits
| 548|    |-				    && player != +cmd.owner)
|    | 547|+				if (!IsOwnedByPlayer(player, garrisonHolder) && !data.controlAllUnits &&
|    | 548|+				    player != +cmd.owner)
| 549| 549| 						continue;
| 550| 550| 
| 551| 551| 				if (!cmpGarrisonHolder.UnloadTemplate(cmd.template, cmd.owner, cmd.all))
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
| 546| 546| 				// Only the owner of the garrisonHolder may unload entities from any owners
| 547| 547| 				if (!IsOwnedByPlayer(player, garrisonHolder) && !data.controlAllUnits
| 548| 548| 				    && player != +cmd.owner)
| 549|    |-						continue;
|    | 549|+					continue;
| 550| 550| 
| 551| 551| 				if (!cmpGarrisonHolder.UnloadTemplate(cmd.template, cmd.owner, cmd.all))
| 552| 552| 					notifyUnloadFailure(player, garrisonHolder);
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
| 956| 956| 		{
| 957| 957| 			var count = 0;
| 958| 958| 			for (let j = 0; j < length - 1; ++j)
| 959|    |-			{
|    | 959|+			
| 960| 960| 				if ((waterPoints[(i + j) % length] + 1) % numPoints == waterPoints[(i + j + 1) % length])
| 961| 961| 					++count;
| 962| 962| 				else
| 963| 963| 					break;
| 964|    |-			}
|    | 964|+			
| 965| 965| 			consec[i] = count;
| 966| 966| 		}
| 967| 967| 		var start = 0;
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-in'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
| 967| 967| 		var start = 0;
| 968| 968| 		var count = 0;
| 969| 969| 		for (var c in consec)
| 970|    |-		{
|    | 970|+		
| 971| 971| 			if (consec[c] > count)
| 972| 972| 			{
| 973| 973| 				start = c;
| 974| 974| 				count = consec[c];
| 975| 975| 			}
| 976|    |-		}
|    | 976|+		
| 977| 977| 
| 978| 978| 		// If we've found a shoreline, stop searching
| 979| 979| 		if (count != numPoints-1)
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space after key 'metadata'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1150|1150| 
|1151|1151| 	// send Metadata info if any
|1152|1152| 	if (cmd.metadata)
|1153|    |-		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player } );
|    |1153|+		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata": cmd.metadata, "owner" : player } );
|1154|1154| 
|1155|1155| 	// Tell the units to start building this new entity
|1156|1156| 	if (cmd.autorepair)
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space after key 'owner'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1150|1150| 
|1151|1151| 	// send Metadata info if any
|1152|1152| 	if (cmd.metadata)
|1153|    |-		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player } );
|    |1153|+		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner": player } );
|1154|1154| 
|1155|1155| 	// Tell the units to start building this new entity
|1156|1156| 	if (cmd.autorepair)
|    | [NORMAL] ESLintBear (space-in-parens):
|    | There should be no spaces inside this paren.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1150|1150| 
|1151|1151| 	// send Metadata info if any
|1152|1152| 	if (cmd.metadata)
|1153|    |-		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player } );
|    |1153|+		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player });
|1154|1154| 
|1155|1155| 	// Tell the units to start building this new entity
|1156|1156| 	if (cmd.autorepair)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1154|1154| 
|1155|1155| 	// Tell the units to start building this new entity
|1156|1156| 	if (cmd.autorepair)
|1157|    |-	{
|    |1157|+	
|1158|1158| 		ProcessCommand(player, {
|1159|1159| 			"type": "repair",
|1160|1160| 			"entities": entities,
|1162|1162| 			"autocontinue": cmd.autocontinue,
|1163|1163| 			"queued": cmd.queued
|1164|1164| 		});
|1165|    |-	}
|    |1165|+	
|1166|1166| 
|1167|1167| 	return ent;
|1168|1168| }
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1258|1258| 		}
|1259|1259| 
|1260|1260| 		lastTowerControlGroup = cmpSnappedStartObstruction.GetControlGroup();
|1261|    |-		//warn("setting lastTowerControlGroup to control group of start snapped entity " + cmd.startSnappedEntity + ": " + lastTowerControlGroup);
|    |1261|+		// warn("setting lastTowerControlGroup to control group of start snapped entity " + cmd.startSnappedEntity + ": " + lastTowerControlGroup);
|1262|1262| 	}
|1263|1263| 
|1264|1264| 	var i = 0;
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1275|1275| 		// 'lastTowerControlGroup' must always be defined and valid here, except if we're at the first piece and we didn't do
|1276|1276| 		// start position snapping (implying that the first entity we build must be a tower)
|1277|1277| 		if (lastTowerControlGroup === null || lastTowerControlGroup == INVALID_ENTITY)
|1278|    |-		{
|    |1278|+		
|1279|1279| 			if (!(i == 0 && piece.template == cmd.wallSet.templates.tower && !cmd.startSnappedEntity))
|1280|1280| 			{
|1281|1281|     			error("[TryConstructWall] Expected last tower control group to be available, none found (1st pass, iteration " + i + ")");
|1282|1282|     			break;
|1283|1283| 			}
|1284|    |-		}
|    |1284|+		
|1285|1285| 
|1286|1286| 		var constructPieceCmd = {
|1287|1287| 			"type": "construct",
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1322|1322| 
|1323|1323| 				if (i > 0)
|1324|1324| 				{
|1325|    |-					//warn("   updating previous wall piece's secondary control group to " + newTowerControlGroup);
|    |1325|+					// warn("   updating previous wall piece's secondary control group to " + newTowerControlGroup);
|1326|1326| 					var cmpPreviousObstruction = Engine.QueryInterface(pieces[i-1].ent, IID_Obstruction);
|1327|1327| 					// TODO: ensure that cmpPreviousObstruction exists
|1328|1328| 					// TODO: ensure that the previous obstruction does not yet have a secondary control group set
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1380|1380| 		}
|1381|1381| 
|1382|1382| 		if (piece.template == cmd.wallSet.templates.tower)
|1383|    |-		{
|    |1383|+		
|1384|1384| 			// encountered a tower entity, update the last tower control group
|1385|1385| 			lastTowerControlGroup = cmpPieceObstruction.GetControlGroup();
|1386|    |-		}
|    |1386|+		
|1387|1387| 		else
|1388|1388| 		{
|1389|1389| 			// Encountered a non-tower entity, update its secondary control group to 'lastTowerControlGroup'.
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1394|1394| 			if (existingSecondaryControlGroup == INVALID_ENTITY)
|1395|1395| 			{
|1396|1396| 				if (lastTowerControlGroup != null && lastTowerControlGroup != INVALID_ENTITY)
|1397|    |-				{
|    |1397|+				
|1398|1398| 					cmpPieceObstruction.SetControlGroup2(lastTowerControlGroup);
|1399|    |-				}
|    |1399|+				
|1400|1400| 			}
|1401|1401| 			else if (existingSecondaryControlGroup != lastTowerControlGroup)
|1402|1402| 			{
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1469|1469| 	}
|1470|1470| 
|1471|1471| 	if (formedEnts.length == 0)
|1472|    |-	{
|    |1472|+	
|1473|1473| 		// No units support the formation - return all the others
|1474|1474| 		return nonformedUnitAIs;
|1475|    |-	}
|    |1475|+	
|1476|1476| 
|1477|1477| 	// Find what formations the formationable selected entities are currently in
|1478|1478| 	var formation = ExtractFormations(formedEnts);
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1485|1485| 		// Check that all its members are selected
|1486|1486| 		var fid = formationIds[0];
|1487|1487| 		var cmpFormation = Engine.QueryInterface(+fid, IID_Formation);
|1488|    |-		if (cmpFormation && cmpFormation.GetMemberCount() == formation.members[fid].length
|1489|    |-			&& cmpFormation.GetMemberCount() == formation.entities.length)
|    |1488|+		if (cmpFormation && cmpFormation.GetMemberCount() == formation.members[fid].length &&
|    |1489|+			cmpFormation.GetMemberCount() == formation.entities.length)
|1490|1490| 		{
|1491|1491| 			cmpFormation.DeleteTwinFormations();
|1492|1492| 			// The whole formation was selected, so reuse its controller for this command
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1517|1517| 					{
|1518|1518| 						var template = cmpUnitAI.GetFormationTemplate();
|1519|1519| 						if (lastFormationTemplate === undefined)
|1520|    |-						{
|    |1520|+						
|1521|1521| 							lastFormationTemplate = template;
|1522|    |-						}
|    |1522|+						
|1523|1523| 						else if (lastFormationTemplate != template)
|1524|1524| 						{
|1525|1525| 							lastFormationTemplate = undefined;
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1593|1593| 		for (var i = matrix.length - 1; i >= 0 && !closeClusters; --i)
|1594|1594| 			for (var j = i - 1; j >= 0 && !closeClusters; --j)
|1595|1595| 				if (matrix[i][j] < distSq)
|1596|    |-					closeClusters = [i,j];
|    |1596|+					closeClusters = [i, j];
|1597|1597| 
|1598|1598| 		// if no more close clusters found, just return all found clusters so far
|1599|1599| 		if (!closeClusters)
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1615|1615| 		}
|1616|1616| 		// remove the rows and columns in the matrix for the merged clusters,
|1617|1617| 		// and the clusters themselves from the cluster list
|1618|    |-		clusters.splice(closeClusters[0],1);
|    |1618|+		clusters.splice(closeClusters[0], 1);
|1619|1619| 		clusters.splice(closeClusters[1],1);
|1620|1620| 		matrix.splice(closeClusters[0],1);
|1621|1621| 		matrix.splice(closeClusters[1],1);
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1616|1616| 		// remove the rows and columns in the matrix for the merged clusters,
|1617|1617| 		// and the clusters themselves from the cluster list
|1618|1618| 		clusters.splice(closeClusters[0],1);
|1619|    |-		clusters.splice(closeClusters[1],1);
|    |1619|+		clusters.splice(closeClusters[1], 1);
|1620|1620| 		matrix.splice(closeClusters[0],1);
|1621|1621| 		matrix.splice(closeClusters[1],1);
|1622|1622| 		for (let i = 0; i < matrix.length; ++i)
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1617|1617| 		// and the clusters themselves from the cluster list
|1618|1618| 		clusters.splice(closeClusters[0],1);
|1619|1619| 		clusters.splice(closeClusters[1],1);
|1620|    |-		matrix.splice(closeClusters[0],1);
|    |1620|+		matrix.splice(closeClusters[0], 1);
|1621|1621| 		matrix.splice(closeClusters[1],1);
|1622|1622| 		for (let i = 0; i < matrix.length; ++i)
|1623|1623| 		{
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1618|1618| 		clusters.splice(closeClusters[0],1);
|1619|1619| 		clusters.splice(closeClusters[1],1);
|1620|1620| 		matrix.splice(closeClusters[0],1);
|1621|    |-		matrix.splice(closeClusters[1],1);
|    |1621|+		matrix.splice(closeClusters[1], 1);
|1622|1622| 		for (let i = 0; i < matrix.length; ++i)
|1623|1623| 		{
|1624|1624| 			if (matrix[i].length > closeClusters[0])
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1622|1622| 		for (let i = 0; i < matrix.length; ++i)
|1623|1623| 		{
|1624|1624| 			if (matrix[i].length > closeClusters[0])
|1625|    |-				matrix[i].splice(closeClusters[0],1);
|    |1625|+				matrix[i].splice(closeClusters[0], 1);
|1626|1626| 			if (matrix[i].length > closeClusters[1])
|1627|1627| 				matrix[i].splice(closeClusters[1],1);
|1628|1628| 		}
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1624|1624| 			if (matrix[i].length > closeClusters[0])
|1625|1625| 				matrix[i].splice(closeClusters[0],1);
|1626|1626| 			if (matrix[i].length > closeClusters[1])
|1627|    |-				matrix[i].splice(closeClusters[1],1);
|    |1627|+				matrix[i].splice(closeClusters[1], 1);
|1628|1628| 		}
|1629|1629| 		// add a new row of distances to the matrix and the new cluster
|1630|1630| 		clusters.push(newCluster);

binaries/data/mods/public/simulation/helpers/Commands.js
| 796| »   »   let·ent·=·pickRandom(cmpRangeManager.GetEntitiesByPlayer(cmd.player).filter(ent·=>·{
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'ent' is already declared in the upper scope.

binaries/data/mods/public/simulation/helpers/Commands.js
|1281| ····»   »   »   error("[TryConstructWall]·Expected·last·tower·control·group·to·be·available,·none·found·(1st·pass,·iteration·"·+·i·+·")");
|    | [NORMAL] ESLintBear (no-mixed-spaces-and-tabs):
|    | Mixed spaces and tabs.

binaries/data/mods/public/simulation/helpers/Commands.js
|1282| ····»   »   »   break;
|    | [NORMAL] ESLintBear (no-mixed-spaces-and-tabs):
|    | Mixed spaces and tabs.

binaries/data/mods/public/simulation/helpers/Commands.js
|1512| »   »   »   »   var·lastFormationTemplate·=·undefined;
|    | [NORMAL] ESLintBear (no-undef-init):
|    | It's not necessary to initialize 'lastFormationTemplate' to undefined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1591| »   »   var·closeClusters·=·undefined;
|    | [NORMAL] ESLintBear (no-undef-init):
|    | It's not necessary to initialize 'closeClusters' to undefined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1608| »   »   for·(let·i·=·0;·i·<·clusters.length;·++i)
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'i' is already declared in the upper scope.

binaries/data/mods/public/simulation/helpers/Commands.js
|1622| »   »   for·(let·i·=·0;·i·<·matrix.length;·++i)
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'i' is already declared in the upper scope.

binaries/data/mods/public/simulation/helpers/Commands.js
|  53| var·g_Commands·=·{
|    | [NORMAL] JSHintBear:
|    | 'g_Commands' was used before it was defined.

binaries/data/mods/public/simulation/helpers/Commands.js
| 548| »   »   »   »   ····&&·player·!=·+cmd.owner)
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/helpers/Commands.js
| 736| »   »   »   »   var·cmpGUIInterface·=·Engine.QueryInterface(SYSTEM_ENTITY,·IID_GuiInterface);
|    | [NORMAL] JSHintBear:
|    | 'cmpGUIInterface' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
| 955| »   »   for·(var·i·=·0;·i·<·length;·++i)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
| 968| »   »   var·count·=·0;
|    | [NORMAL] JSHintBear:
|    | 'count' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1115| »   »   var·cmpGuiInterface·=·Engine.QueryInterface(SYSTEM_ENTITY,·IID_GuiInterface);
|    | [NORMAL] JSHintBear:
|    | 'cmpGuiInterface' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1367| »   »   var·piece·=·pieces[j];
|    | [NORMAL] JSHintBear:
|    | 'piece' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1450| »   »   var·cmpUnitAI·=·Engine.QueryInterface(ent,·IID_UnitAI);
|    | [NORMAL] JSHintBear:
|    | 'cmpUnitAI' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1489| »   »   »   &&·cmpFormation.GetMemberCount()·==·formation.entities.length)
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/helpers/Commands.js
|1515| »   »   »   »   »   var·cmpUnitAI·=·Engine.QueryInterface(ent,·IID_UnitAI);
|    | [NORMAL] JSHintBear:
|    | 'cmpUnitAI' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1548| »   »   »   var·cmpFormation·=·Engine.QueryInterface(formationEnt,·IID_Formation);
|    | [NORMAL] JSHintBear:
|    | 'cmpFormation' is already defined.
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 228| 228| 		// Move a tile outside the building
| 229| 229| 		let range = 4;
| 230| 230| 		if (this.MoveToTargetRangeExplicit(msg.data.target, range, range))
| 231|    |-		{
|    | 231|+		
| 232| 232| 			// We've started walking to the given point
| 233| 233| 			this.SetNextState("INDIVIDUAL.WALKING");
| 234|    |-		}
|    | 234|+		
| 235| 235| 		else
| 236| 236| 		{
| 237| 237| 			// We are already at the target, or can't move at all
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 233| 233| 			this.SetNextState("INDIVIDUAL.WALKING");
| 234| 234| 		}
| 235| 235| 		else
| 236|    |-		{
|    | 236|+		
| 237| 237| 			// We are already at the target, or can't move at all
| 238| 238| 			this.FinishOrder();
| 239|    |-		}
|    | 239|+		
| 240| 240| 	},
| 241| 241| 
| 242| 242| 	// Individual orders:
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 335| 335| 
| 336| 336| 		var ok = this.MoveToTarget(this.order.data.target);
| 337| 337| 		if (ok)
| 338|    |-		{
|    | 338|+		
| 339| 339| 			// We've started walking to the given point
| 340| 340| 			if (this.IsAnimal())
| 341| 341| 				this.SetNextState("ANIMAL.WALKING");
| 342| 342| 			else
| 343| 343| 				this.SetNextState("INDIVIDUAL.WALKING");
| 344|    |-		}
|    | 344|+		
| 345| 345| 		else
| 346| 346| 		{
| 347| 347| 			// We are already at the target, or can't move at all
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 363| 363| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 364| 364| 		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 365| 365| 		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 366|    |-		{
|    | 366|+		
| 367| 367| 			// we were already on the shoreline, and have not moved since
| 368| 368| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
| 369| 369| 				needToMove = false;
| 370|    |-		}
|    | 370|+		
| 371| 371| 
| 372| 372| 		// TODO: what if the units are on a cliff ? the ship will go below the cliff
| 373| 373| 		// and the units won't be able to garrison. Should go to the nearest (accessible) shore
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 361| 361| 		// Check if we need to move     TODO implement a better way to know if we are on the shoreline
| 362| 362| 		var needToMove = true;
| 363| 363| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 364|    |-		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 365|    |-		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
|    | 364|+		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x) &&
|    | 365|+		    (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 366| 366| 		{
| 367| 367| 			// we were already on the shoreline, and have not moved since
| 368| 368| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 372| 372| 		// TODO: what if the units are on a cliff ? the ship will go below the cliff
| 373| 373| 		// and the units won't be able to garrison. Should go to the nearest (accessible) shore
| 374| 374| 		if (needToMove && this.MoveToTarget(this.order.data.target))
| 375|    |-		{
|    | 375|+		
| 376| 376| 			this.SetNextState("INDIVIDUAL.PICKUP.APPROACHING");
| 377|    |-		}
|    | 377|+		
| 378| 378| 		else
| 379| 379| 		{
| 380| 380| 			// We are already at the target, or can't move at all
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 401| 401| 		var distance = DistanceBetweenEntities(this.entity, this.order.data.target) + (+this.template.FleeDistance);
| 402| 402| 		var cmpUnitMotion = Engine.QueryInterface(this.entity, IID_UnitMotion);
| 403| 403| 		if (cmpUnitMotion.MoveToTargetRange(this.order.data.target, distance, -1))
| 404|    |-		{
|    | 404|+		
| 405| 405| 			// We've started fleeing from the given target
| 406| 406| 			if (this.IsAnimal())
| 407| 407| 				this.SetNextState("ANIMAL.FLEEING");
| 408| 408| 			else
| 409| 409| 				this.SetNextState("INDIVIDUAL.FLEEING");
| 410|    |-		}
|    | 410|+		
| 411| 411| 		else
| 412| 412| 		{
| 413| 413| 			// We are already at the target, or can't move at all
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 448| 448| 			}
| 449| 449| 
| 450| 450| 			if (this.order.data.attackType == this.oldAttackType)
| 451|    |-			{
|    | 451|+			
| 452| 452| 				if (this.IsAnimal())
| 453| 453| 					this.SetNextState("ANIMAL.COMBAT.ATTACKING");
| 454| 454| 				else
| 455| 455| 					this.SetNextState("INDIVIDUAL.COMBAT.ATTACKING");
| 456|    |-			}
|    | 456|+			
| 457| 457| 			else
| 458| 458| 			{
| 459| 459| 				if (this.IsAnimal())
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 455| 455| 					this.SetNextState("INDIVIDUAL.COMBAT.ATTACKING");
| 456| 456| 			}
| 457| 457| 			else
| 458|    |-			{
|    | 458|+			
| 459| 459| 				if (this.IsAnimal())
| 460| 460| 					this.SetNextState("ANIMAL.COMBAT.ATTACKING");
| 461| 461| 				else
| 462| 462| 					this.SetNextState("INDIVIDUAL.COMBAT.ATTACKING");
| 463|    |-			}
|    | 463|+			
| 464| 464| 			return;
| 465| 465| 		}
| 466| 466| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 580| 580| 					this.PushOrderFront("Walk", this.order.data.lastPos);
| 581| 581| 				}
| 582| 582| 				else
| 583|    |-				{
|    | 583|+				
| 584| 584| 					// We couldn't move there, or the target moved away
| 585| 585| 					this.FinishOrder();
| 586|    |-				}
|    | 586|+				
| 587| 587| 				return;
| 588| 588| 			}
| 589| 589| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 593| 593| 
| 594| 594| 		// Try to move within range
| 595| 595| 		if (this.MoveToTargetRange(this.order.data.target, IID_ResourceGatherer))
| 596|    |-		{
|    | 596|+		
| 597| 597| 			// We've started walking to the given point
| 598| 598| 			this.SetNextState("INDIVIDUAL.GATHER.APPROACHING");
| 599|    |-		}
|    | 599|+		
| 600| 600| 		else
| 601| 601| 		{
| 602| 602| 			// We are already at the target, or can't move at all,
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 670| 670| 	"Order.Repair": function(msg) {
| 671| 671| 		// Try to move within range
| 672| 672| 		if (this.MoveToTargetRange(this.order.data.target, IID_Builder))
| 673|    |-		{
|    | 673|+		
| 674| 674| 			// We've started walking to the given point
| 675| 675| 			this.SetNextState("INDIVIDUAL.REPAIR.APPROACHING");
| 676|    |-		}
|    | 676|+		
| 677| 677| 		else
| 678| 678| 		{
| 679| 679| 			// We are already at the target, or can't move at all,
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 706| 706| 		}
| 707| 707| 
| 708| 708| 		if (this.MoveToGarrisonRange(this.order.data.target))
| 709|    |-		{
|    | 709|+		
| 710| 710| 			this.SetNextState("INDIVIDUAL.GARRISON.APPROACHING");
| 711|    |-		}
|    | 711|+		
| 712| 712| 		else
| 713| 713| 		{
| 714| 714| 			// We do a range check before actually garrisoning
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 843| 843| 			if (!this.CheckTargetAttackRange(target, target))
| 844| 844| 			{
| 845| 845| 				if (this.TargetIsAlive(target) && this.CheckTargetVisible(target))
| 846|    |-				{
|    | 846|+				
| 847| 847| 					if (this.MoveToTargetAttackRange(target, target))
| 848| 848| 					{
| 849| 849| 						this.SetNextState("COMBAT.APPROACHING");
| 850| 850| 						return;
| 851| 851| 					}
| 852|    |-				}
|    | 852|+				
| 853| 853| 				this.FinishOrder();
| 854| 854| 				return;
| 855| 855| 			}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 868| 868| 			}
| 869| 869| 			// Check if we are already in range, otherwise walk there
| 870| 870| 			if (!this.CheckGarrisonRange(msg.data.target))
| 871|    |-			{
|    | 871|+			
| 872| 872| 				if (!this.CheckTargetVisible(msg.data.target))
| 873| 873| 				{
| 874| 874| 					this.FinishOrder();
| 883| 883| 						return;
| 884| 884| 					}
| 885| 885| 				}
| 886|    |-			}
|    | 886|+			
| 887| 887| 
| 888| 888| 			this.SetNextState("GARRISON.GARRISONING");
| 889| 889| 		},
|    | [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
| 875| 875| 					return;
| 876| 876| 				}
| 877| 877| 				else
| 878|    |-				{
|    | 878|+				
| 879| 879| 					// Out of range; move there in formation
| 880| 880| 					if (this.MoveToGarrisonRange(msg.data.target))
| 881| 881| 					{
| 882| 882| 						this.SetNextState("GARRISON.APPROACHING");
| 883| 883| 						return;
| 884| 884| 					}
| 885|    |-				}
|    | 885|+				
| 886| 886| 			}
| 887| 887| 
| 888| 888| 			this.SetNextState("GARRISON.GARRISONING");
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 874| 874| 					this.FinishOrder();
| 875| 875| 					return;
| 876| 876| 				}
| 877|    |-				else
| 878|    |-				{
|    | 877|+				
| 879| 878| 					// Out of range; move there in formation
| 880| 879| 					if (this.MoveToGarrisonRange(msg.data.target))
| 881| 880| 					{
| 882| 881| 						this.SetNextState("GARRISON.APPROACHING");
| 883| 882| 						return;
| 884| 883| 					}
| 885|    |-				}
|    | 884|+				
| 886| 885| 			}
| 887| 886| 
| 888| 887| 			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
| 901| 901| 						this.PushOrderFront("Walk", msg.data.lastPos);
| 902| 902| 					}
| 903| 903| 					else
| 904|    |-					{
|    | 904|+					
| 905| 905| 						// We couldn't move there, or the target moved away
| 906| 906| 						this.FinishOrder();
| 907|    |-					}
|    | 907|+					
| 908| 908| 					return;
| 909| 909| 				}
| 910| 910| 
|    | [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
|1122|1122| 			},
|1123|1123| 		},
|1124|1124| 
|1125|    |-		"GARRISON":{
|    |1125|+		"GARRISON": {
|1126|1126| 			"enter": function() {
|1127|1127| 				// If the garrisonholder should pickup, warn it so it can take needed action
|1128|1128| 				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
|1306|1306| 			// If the controller handled an order but some members rejected it,
|1307|1307| 			// they will have no orders and be in the FORMATIONMEMBER.IDLE state.
|1308|1308| 			if (this.orderQueue.length)
|1309|    |-			{
|    |1309|+			
|1310|1310| 				// We're leaving the formation, so stop our FormationWalk order
|1311|1311| 				if (this.FinishOrder())
|1312|1312| 					return;
|1313|    |-			}
|    |1313|+			
|1314|1314| 
|1315|1315| 			// No orders left, we're an individual now
|1316|1316| 			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
|1334|1334| 			// Move a tile outside the building
|1335|1335| 			let range = 4;
|1336|1336| 			if (this.MoveToTargetRangeExplicit(msg.data.target, range, range))
|1337|    |-			{
|    |1337|+			
|1338|1338| 				// We've started walking to the given point
|1339|1339| 				this.SetNextState("WALKINGTOPOINT");
|1340|    |-			}
|    |1340|+			
|1341|1341| 			else
|1342|1342| 			{
|1343|1343| 				// We are already at the target, or can't move at all
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1339|1339| 				this.SetNextState("WALKINGTOPOINT");
|1340|1340| 			}
|1341|1341| 			else
|1342|    |-			{
|    |1342|+			
|1343|1343| 				// We are already at the target, or can't move at all
|1344|1344| 				this.FinishOrder();
|1345|    |-			}
|    |1345|+			
|1346|1346| 		},
|1347|1347| 
|1348|1348| 
|    | [NORMAL] ESLintBear (space-in-parens):
|    | There should be no spaces inside this paren.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1473|1473| 
|1474|1474| 		"SCOUTING": {
|1475|1475| 			"enter": function() {
|1476|    |-				warn("From: " + uneval(this.ScoutingBeginPosition) );
|    |1476|+				warn("From: " + uneval(this.ScoutingBeginPosition));
|1477|1477| 
|1478|1478| 				this.SelectAnimation("move");
|1479|1479| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 6 tabs but found 0.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1519|1519| 						x = pos.x + Math.sin(ang) * dist;
|1520|1520| 						y = pos.y + Math.cos(ang) * dist;
|1521|1521| 
|1522|    |-warn("Can position ("+uneval(x)+","+uneval(y)+") be explored? " + uneval(cmpRangeManager.CanPlayerExplorePosition(x, y, owner) ) );
|    |1522|+						warn("Can position ("+uneval(x)+","+uneval(y)+") be explored? " + uneval(cmpRangeManager.CanPlayerExplorePosition(x, y, owner) ) );
|1523|1523| 
|1524|1524| 						if (cmpRangeManager.CanPlayerExplorePosition(x, y, owner))
|1525|1525| 							break;
|    | [NORMAL] ESLintBear (space-in-parens):
|    | There should be no spaces inside this paren.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1519|1519| 						x = pos.x + Math.sin(ang) * dist;
|1520|1520| 						y = pos.y + Math.cos(ang) * dist;
|1521|1521| 
|1522|    |-warn("Can position ("+uneval(x)+","+uneval(y)+") be explored? " + uneval(cmpRangeManager.CanPlayerExplorePosition(x, y, owner) ) );
|    |1522|+warn("Can position ("+uneval(x)+","+uneval(y)+") be explored? " + uneval(cmpRangeManager.CanPlayerExplorePosition(x, y, owner)) );
|1523|1523| 
|1524|1524| 						if (cmpRangeManager.CanPlayerExplorePosition(x, y, owner))
|1525|1525| 							break;
|    | [NORMAL] ESLintBear (space-in-parens):
|    | There should be no spaces inside this paren.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1519|1519| 						x = pos.x + Math.sin(ang) * dist;
|1520|1520| 						y = pos.y + Math.cos(ang) * dist;
|1521|1521| 
|1522|    |-warn("Can position ("+uneval(x)+","+uneval(y)+") be explored? " + uneval(cmpRangeManager.CanPlayerExplorePosition(x, y, owner) ) );
|    |1522|+warn("Can position ("+uneval(x)+","+uneval(y)+") be explored? " + uneval(cmpRangeManager.CanPlayerExplorePosition(x, y, owner) ));
|1523|1523| 
|1524|1524| 						if (cmpRangeManager.CanPlayerExplorePosition(x, y, owner))
|1525|1525| 							break;
|    | [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
|1535|1535| 							if (tileOwner && cmpPlayer.IsEnemy(tileOwner))
|1536|1536| 								continue;
|1537|1537| 						}
|1538|    |-						targetPos = {"x": x, "y": y};
|    |1538|+						targetPos = { "x": x, "y": y};
|1539|1539| 						break;
|1540|1540| 					}
|1541|1541| 				}
|    | [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
|1535|1535| 							if (tileOwner && cmpPlayer.IsEnemy(tileOwner))
|1536|1536| 								continue;
|1537|1537| 						}
|1538|    |-						targetPos = {"x": x, "y": y};
|    |1538|+						targetPos = {"x": x, "y": y };
|1539|1539| 						break;
|1540|1540| 					}
|1541|1541| 				}
|    | [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
|1558|1558| 
|1559|1559| 			"Attacked": function(msg) {
|1560|1560| 				this.SetSpeedMultiplier(this.GetRunMultiplier());
|1561|    |-				//this.Flee(msg.data.attacker, false);
|    |1561|+				// this.Flee(msg.data.attacker, false);
|1562|1562| 			},
|1563|1563| 
|1564|1564| 			"leave": function(msg) {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1651|1651| 
|1652|1652| 			"LosRangeUpdate": function(msg) {
|1653|1653| 				if (this.GetStance().targetVisibleEnemies)
|1654|    |-				{
|    |1654|+				
|1655|1655| 					// Start attacking one of the newly-seen enemy (if any)
|1656|1656| 					this.AttackEntitiesByPreference(msg.data.added);
|1657|    |-				}
|    |1657|+				
|1658|1658| 			},
|1659|1659| 
|1660|1660| 			"LosHealRangeUpdate": function(msg) {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1837|1837| 						// if nothing better to do, check if the guarded needs to be healed or repaired
|1838|1838| 						var cmpHealth = Engine.QueryInterface(this.isGuardOf, IID_Health);
|1839|1839| 						if (cmpHealth && (cmpHealth.GetHitpoints() < cmpHealth.GetMaxHitpoints()))
|1840|    |-						{
|    |1840|+						
|1841|1841| 							if (this.CanHeal(this.isGuardOf))
|1842|1842| 								this.PushOrderFront("Heal", { "target": this.isGuardOf, "force": false });
|1843|1843| 							else if (this.CanRepair(this.isGuardOf))
|1844|1844| 								this.PushOrderFront("Repair", { "target": this.isGuardOf, "autocontinue": false, "force": false });
|1845|    |-						}
|    |1845|+						
|1846|1846| 					}
|1847|1847| 				},
|1848|1848| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1922|1922| 				"MoveCompleted": function() {
|1923|1923| 
|1924|1924| 					if (this.CheckTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1925|    |-					{
|    |1925|+					
|1926|1926| 						// If the unit needs to unpack, do so
|1927|1927| 						if (this.CanUnpack())
|1928|1928| 						{
|1931|1931| 						}
|1932|1932| 						else
|1933|1933| 							this.SetNextState("ATTACKING");
|1934|    |-					}
|    |1934|+					
|1935|1935| 					else
|1936|1936| 					{
|1937|1937| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1929|1929| 							this.PushOrderFront("Unpack", { "force": true });
|1930|1930| 							return;
|1931|1931| 						}
|1932|    |-						else
|1933|    |-							this.SetNextState("ATTACKING");
|    |1932|+						this.SetNextState("ATTACKING");
|1934|1933| 					}
|1935|1934| 					else
|1936|1935| 					{
|    | [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
|1933|1933| 							this.SetNextState("ATTACKING");
|1934|1934| 					}
|1935|1935| 					else
|1936|    |-					{
|    |1936|+					
|1937|1937| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1938|1938| 						{
|1939|1939| 							this.SetNextState("APPROACHING");
|1943|1943| 							// Give up
|1944|1944| 							this.FinishOrder();
|1945|1945| 						}
|1946|    |-					}
|    |1946|+					
|1947|1947| 				},
|1948|1948| 			},
|1949|1949| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1935|1935| 					else
|1936|1936| 					{
|1937|1937| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1938|    |-						{
|    |1938|+						
|1939|1939| 							this.SetNextState("APPROACHING");
|1940|    |-						}
|    |1940|+						
|1941|1941| 						else
|1942|1942| 						{
|1943|1943| 							// Give up
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1939|1939| 							this.SetNextState("APPROACHING");
|1940|1940| 						}
|1941|1941| 						else
|1942|    |-						{
|    |1942|+						
|1943|1943| 							// Give up
|1944|1944| 							this.FinishOrder();
|1945|    |-						}
|    |1945|+						
|1946|1946| 					}
|1947|1947| 				},
|1948|1948| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1960|1960| 					}
|1961|1961| 					// Check the target is still alive and attackable
|1962|1962| 					if (this.CanAttack(target) && !this.CheckTargetAttackRange(target, this.order.data.attackType))
|1963|    |-					{
|    |1963|+					
|1964|1964| 						// Can't reach it - try to chase after it
|1965|1965| 						if (this.ShouldChaseTargetedEntity(target, this.order.data.force))
|1966|1966| 						{
|1975|1975| 								return;
|1976|1976| 							}
|1977|1977| 						}
|1978|    |-					}
|    |1978|+					
|1979|1979| 
|1980|1980| 					var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|1981|1981| 					this.attackTimers = cmpAttack.GetTimers(this.order.data.attackType);
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2006|2006| 					// TODO: we should probably only bother syncing projectile attacks, not melee
|2007|2007| 
|2008|2008| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2009|    |-					this.resyncAnimation = (prepare != this.attackTimers.prepare) ? true : false;
|    |2009|+					this.resyncAnimation = (prepare != this.attackTimers.prepare);
|2010|2010| 
|2011|2011| 					this.FaceTowardsTarget(this.order.data.target);
|2012|2012| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2135|2135| 
|2136|2136| 				"Attacked": function(msg) {
|2137|2137| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2138|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2139|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2138|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2139|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2140|2140| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2141|2141| 				},
|2142|2142| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2149|2149| 					this.SelectAnimation("move");
|2150|2150| 					var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|2151|2151| 					if (cmpUnitAI && cmpUnitAI.IsFleeing())
|2152|    |-					{
|    |2152|+					
|2153|2153| 						// Run after a fleeing target
|2154|2154| 						this.SetSpeedMultiplier(this.GetRunMultiplier());
|2155|    |-					}
|    |2155|+					
|2156|2156| 					this.StartTimer(1000, 1000);
|2157|2157| 				},
|2158|2158| 
|    | [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
|2210|2210| 						// Also don't switch to a different type of huntable animal
|2211|2211| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2212|2212| 							return (
|2213|    |-								ent != oldTarget
|2214|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2213|+								ent != oldTarget &&
|    |2214|+								 ((type.generic == "treasure" && oldType.generic == "treasure")
|2215|2215| 								 || (type.specific == oldType.specific
|2216|2216| 								 && (type.specific != "meat" || oldTemplate == template)))
|2217|2217| 							);
|    | [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
|2211|2211| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2212|2212| 							return (
|2213|2213| 								ent != oldTarget
|2214|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2215|    |-								 || (type.specific == oldType.specific
|    |2214|+								 && ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2215|+								 (type.specific == oldType.specific
|2216|2216| 								 && (type.specific != "meat" || oldTemplate == template)))
|2217|2217| 							);
|2218|2218| 						}, oldTarget);
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2212|2212| 							return (
|2213|2213| 								ent != oldTarget
|2214|2214| 								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2215|    |-								 || (type.specific == oldType.specific
|2216|    |-								 && (type.specific != "meat" || oldTemplate == template)))
|    |2215|+								 || (type.specific == oldType.specific &&
|    |2216|+								 (type.specific != "meat" || oldTemplate == template)))
|2217|2217| 							);
|2218|2218| 						}, oldTarget);
|2219|2219| 						if (nearby)
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2221|2221| 							this.PerformGather(nearby, false, false);
|2222|2222| 							return true;
|2223|2223| 						}
|2224|    |-						else
|2225|    |-						{
|    |2224|+						
|2226|2225| 							// It's probably better in this case, to avoid units getting stuck around a dropsite
|2227|2226| 							// in a "Target is far away, full, nearby are no good resources, return to dropsite" loop
|2228|2227| 							// to order it to GatherNear the resource position.
|2243|2242| 									return true;
|2244|2243| 								}
|2245|2244| 							}
|2246|    |-						}
|    |2245|+						
|2247|2246| 						return true;
|2248|2247| 					}
|2249|2248| 					return false;
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2233|2233| 								this.GatherNearPosition(pos.x, pos.z, oldType, oldTemplate);
|2234|2234| 								return true;
|2235|2235| 							}
|2236|    |-							else
|2237|    |-							{
|    |2236|+							
|2238|2237| 								// we're kind of stuck here. Return resource.
|2239|2238| 								var nearby = this.FindNearestDropsite(oldType.generic);
|2240|2239| 								if (nearby)
|2242|2241| 									this.PushOrderFront("ReturnResource", { "target": nearby, "force": false });
|2243|2242| 									return true;
|2244|2243| 								}
|2245|    |-							}
|    |2244|+							
|2246|2245| 						}
|2247|2246| 						return true;
|2248|2247| 					}
|    | [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
|2275|2275| 						// Also don't switch to a different type of huntable animal
|2276|2276| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2277|2277| 							return (
|2278|    |-								ent != oldTarget
|2279|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2278|+								ent != oldTarget &&
|    |2279|+								((type.generic == "treasure" && oldType.generic == "treasure")
|2280|2280| 								|| (type.specific == oldType.specific
|2281|2281| 								&& (type.specific != "meat" || oldTemplate == template)))
|2282|2282| 							);
|    | [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
|2276|2276| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2277|2277| 							return (
|2278|2278| 								ent != oldTarget
|2279|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2280|    |-								|| (type.specific == oldType.specific
|    |2279|+								&& ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2280|+								(type.specific == oldType.specific
|2281|2281| 								&& (type.specific != "meat" || oldTemplate == template)))
|2282|2282| 							);
|2283|2283| 						});
|    | [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
|2277|2277| 							return (
|2278|2278| 								ent != oldTarget
|2279|2279| 								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2280|    |-								|| (type.specific == oldType.specific
|2281|    |-								&& (type.specific != "meat" || oldTemplate == template)))
|    |2280|+								|| (type.specific == oldType.specific &&
|    |2281|+								(type.specific != "meat" || oldTemplate == template)))
|2282|2282| 							);
|2283|2283| 						});
|2284|2284| 						if (nearby)
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2322|2322| 					// Also don't switch to a different type of huntable animal
|2323|2323| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2324|2324| 						return (
|2325|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2326|    |-							|| (type.specific == resourceType.specific
|    |2325|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2326|+							(type.specific == resourceType.specific
|2327|2327| 							&& (type.specific != "meat" || resourceTemplate == template))
|2328|2328| 						);
|2329|2329| 					});
|    | [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
|2323|2323| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2324|2324| 						return (
|2325|2325| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2326|    |-							|| (type.specific == resourceType.specific
|2327|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2326|+							|| (type.specific == resourceType.specific &&
|    |2327|+							(type.specific != "meat" || resourceTemplate == template))
|2328|2328| 						);
|2329|2329| 					});
|2330|2330| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2439|2439| 
|2440|2440| 					var cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply);
|2441|2441| 					if (cmpSupply && cmpSupply.IsAvailable(cmpOwnership.GetOwner(), this.entity))
|2442|    |-					{
|    |2442|+					
|2443|2443| 						// Check we can still reach and gather from the target
|2444|2444| 						if (this.CheckTargetRange(this.gatheringTarget, IID_ResourceGatherer) && this.CanGather(this.gatheringTarget))
|2445|2445| 						{
|2505|2505| 								return;
|2506|2506| 							}
|2507|2507| 						}
|2508|    |-					}
|    |2508|+					
|2509|2509| 
|2510|2510| 					// We're already in range, can't get anywhere near it or the target is exhausted.
|2511|2511| 
|    | [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
|2531|2531| 					// Also don't switch to a different type of huntable animal
|2532|2532| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2533|2533| 						return (
|2534|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2535|    |-							|| (type.specific == resourceType.specific
|    |2534|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2535|+							(type.specific == resourceType.specific
|2536|2536| 							&& (type.specific != "meat" || resourceTemplate == template))
|2537|2537| 						);
|2538|2538| 					});
|    | [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
|2532|2532| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2533|2533| 						return (
|2534|2534| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2535|    |-							|| (type.specific == resourceType.specific
|2536|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2535|+							|| (type.specific == resourceType.specific &&
|    |2536|+							(type.specific != "meat" || resourceTemplate == template))
|2537|2537| 						);
|2538|2538| 					});
|2539|2539| 					if (nearby)
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2619|2619| 					this.StartTimer(prepare, this.healTimers.repeat);
|2620|2620| 
|2621|2621| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2622|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2622|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2623|2623| 
|2624|2624| 					this.FaceTowardsTarget(this.order.data.target);
|2625|2625| 				},
|    | [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
|2834|2834| 					{
|2835|2835| 						// The building was already finished/fully repaired before we arrived;
|2836|2836| 						// let the ConstructionFinished handler handle this.
|2837|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2837|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2838|2838| 						return true;
|2839|2839| 					}
|2840|2840| 
|    | [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
|2834|2834| 					{
|2835|2835| 						// The building was already finished/fully repaired before we arrived;
|2836|2836| 						// let the ConstructionFinished handler handle this.
|2837|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2837|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2838|2838| 						return true;
|2839|2839| 					}
|2840|2840| 
|    | [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
|2874|2874| 					if (this.MoveToTargetRange(this.repairTarget, IID_Builder))
|2875|2875| 						this.SetNextState("APPROACHING");
|2876|2876| 					else if (!this.CheckTargetRange(this.repairTarget, IID_Builder))
|2877|    |-						this.FinishOrder(); //can't approach and isn't in reach
|    |2877|+						this.FinishOrder(); // can't approach and isn't in reach
|2878|2878| 				},
|2879|2879| 			},
|2880|2880| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2961|2961| 
|2962|2962| 				// Unit was approaching and there's nothing to do now, so switch to walking
|2963|2963| 				if (oldState === "INDIVIDUAL.REPAIR.APPROACHING")
|2964|    |-				{
|    |2964|+				
|2965|2965| 					// We're already walking to the given point, so add this as a order.
|2966|2966| 					this.WalkToTarget(msg.data.newentity, true);
|2967|    |-				}
|    |2967|+				
|2968|2968| 			},
|2969|2969| 		},
|2970|2970| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3014|3014| 
|3015|3015| 					// Check that we can garrison here
|3016|3016| 					if (this.CanGarrison(target))
|3017|    |-					{
|    |3017|+					
|3018|3018| 						// Check that we're in range of the garrison target
|3019|3019| 						if (this.CheckGarrisonRange(target))
|3020|3020| 						{
|3090|3090| 								return false;
|3091|3091| 							}
|3092|3092| 						}
|3093|    |-					}
|    |3093|+					
|3094|3094| 					// Garrisoning failed for some reason, so finish the order
|3095|3095| 					this.FinishOrder();
|3096|3096| 					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
|3197|3197| 		"Attacked": function(msg) {
|3198|3198| 			if (this.template.NaturalBehaviour == "skittish" ||
|3199|3199| 			    this.template.NaturalBehaviour == "passive")
|3200|    |-			{
|    |3200|+			
|3201|3201| 				this.Flee(msg.data.attacker, false);
|3202|    |-			}
|    |3202|+			
|3203|3203| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|3204|3204| 			{
|3205|3205| 				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
|3206|3206| 					this.Attack(msg.data.attacker, false);
|3207|3207| 			}
|3208|3208| 			else if (this.template.NaturalBehaviour == "domestic")
|3209|    |-			{
|    |3209|+			
|3210|3210| 				// Never flee, stop what we were doing
|3211|3211| 				this.SetNextState("IDLE");
|3212|    |-			}
|    |3212|+			
|3213|3213| 		},
|3214|3214| 
|3215|3215| 		"Order.LeaveFoundation": function(msg) {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3216|3216| 			// Move a tile outside the building
|3217|3217| 			var range = 4;
|3218|3218| 			if (this.MoveToTargetRangeExplicit(msg.data.target, range, range))
|3219|    |-			{
|    |3219|+			
|3220|3220| 				// We've started walking to the given point
|3221|3221| 				this.SetNextState("WALKING");
|3222|    |-			}
|    |3222|+			
|3223|3223| 			else
|3224|3224| 			{
|3225|3225| 				// We are already at the target, or can't move at all
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3221|3221| 				this.SetNextState("WALKING");
|3222|3222| 			}
|3223|3223| 			else
|3224|    |-			{
|    |3224|+			
|3225|3225| 				// We are already at the target, or can't move at all
|3226|3226| 				this.FinishOrder();
|3227|    |-			}
|    |3227|+			
|3228|3228| 		},
|3229|3229| 
|3230|3230| 		"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
|3263|3263| 				}
|3264|3264| 				// Start attacking one of the newly-seen enemy (if any)
|3265|3265| 				else if (this.IsDangerousAnimal())
|3266|    |-				{
|    |3266|+				
|3267|3267| 					this.AttackVisibleEntity(msg.data.added);
|3268|    |-				}
|    |3268|+				
|3269|3269| 
|3270|3270| 				// TODO: if two units enter our range together, we'll attack the
|3271|3271| 				// 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
|3306|3306| 				}
|3307|3307| 				// Start attacking one of the newly-seen enemy (if any)
|3308|3308| 				else if (this.template.NaturalBehaviour == "violent")
|3309|    |-				{
|    |3309|+				
|3310|3310| 					this.AttackVisibleEntity(msg.data.added);
|3311|    |-				}
|    |3311|+				
|3312|3312| 			},
|3313|3313| 
|3314|3314| 			"MoveCompleted": function() { },
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 7.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3323|3323| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3324|3324| 
|3325|3325| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3326|    |-							// only used for domestic animals
|    |3326|+		// only used for domestic animals
|3327|3327| 	},
|3328|3328| };
|3329|3329| 
|    | [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
|3380|3380| 
|3381|3381| UnitAI.prototype.IsAnimal = function()
|3382|3382| {
|3383|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3383|+	return (!!this.template.NaturalBehaviour);
|3384|3384| };
|3385|3385| 
|3386|3386| 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
|3418|3418| UnitAI.prototype.GetGarrisonHolder = function()
|3419|3419| {
|3420|3420| 	if (this.IsGarrisoned())
|3421|    |-	{
|    |3421|+	
|3422|3422| 		for (let order of this.orderQueue)
|3423|3423| 			if (order.type == "Garrison")
|3424|3424| 				return order.data.target;
|3425|    |-	}
|    |3425|+	
|3426|3426| 	return INVALID_ENTITY;
|3427|3427| };
|3428|3428| 
|    | [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
|3496|3496| 		{
|3497|3497| 			let index = this.GetCurrentState().indexOf(".");
|3498|3498| 			if (index != -1)
|3499|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3499|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3500|3500| 			this.Stop(false);
|3501|3501| 		}
|3502|3502| 
|    | [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
|3552|3552| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3553|3553| 			continue;
|3554|3554| 		if (i == 0)
|3555|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3555|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3556|3556| 		else
|3557|3557| 			this.orderQueue.splice(i, 1);
|3558|3558| 		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
|3552|3552| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3553|3553| 			continue;
|3554|3554| 		if (i == 0)
|3555|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3555|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3556|3556| 		else
|3557|3557| 			this.orderQueue.splice(i, 1);
|3558|3558| 		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
|3636|3636| };
|3637|3637| 
|3638|3638| 
|3639|    |-//// FSM linkage functions ////
|    |3639|+// // FSM linkage functions ////
|3640|3640| 
|3641|3641| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3642|3642| 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
|3808|3808| 				continue;
|3809|3809| 			if (this.orderQueue[i].type == type)
|3810|3810| 				continue;
|3811|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3811|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3812|3812| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3813|3813| 			return;
|3814|3814| 		}
|    | [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
|3808|3808| 				continue;
|3809|3809| 			if (this.orderQueue[i].type == type)
|3810|3810| 				continue;
|3811|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3811|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3812|3812| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3813|3813| 			return;
|3814|3814| 		}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3822|3822| {
|3823|3823| 	// Remember the previous work orders to be able to go back to them later if required
|3824|3824| 	if (data && data.force)
|3825|    |-	{
|    |3825|+	
|3826|3826| 		if (this.IsFormationController())
|3827|3827| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3828|3828| 		else
|3829|3829| 			this.UpdateWorkOrders(type);
|3830|    |-	}
|    |3830|+	
|3831|3831| 
|3832|3832| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3833|3833| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3899|3899| 	{
|3900|3900| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3901|3901| 		if (cmpUnitAI)
|3902|    |-		{
|    |3902|+		
|3903|3903| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3904|3904| 			{
|3905|3905| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3908|3908| 					return;
|3909|3909| 				}
|3910|3910| 			}
|3911|    |-		}
|    |3911|+		
|3912|3912| 	}
|3913|3913| 
|3914|3914| 	// 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
|3901|3901| 		if (cmpUnitAI)
|3902|3902| 		{
|3903|3903| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3904|    |-			{
|    |3904|+			
|3905|3905| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3906|3906| 				{
|3907|3907| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3908|3908| 					return;
|3909|3909| 				}
|3910|    |-			}
|    |3910|+			
|3911|3911| 		}
|3912|3912| 	}
|3913|3913| 
|    | [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
|3913|3913| 
|3914|3914| 	// If nothing found, take the unit orders
|3915|3915| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3916|    |-	{
|    |3916|+	
|3917|3917| 		if (isWorkType(this.orderQueue[i].type))
|3918|3918| 		{
|3919|3919| 			this.workOrders = this.orderQueue.slice(i);
|3920|3920| 			return;
|3921|3921| 		}
|3922|    |-	}
|    |3922|+	
|3923|3923| };
|3924|3924| 
|3925|3925| 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
|3979|3979| 	if (data.timerRepeat === undefined)
|3980|3980| 		this.timer = undefined;
|3981|3981| 
|3982|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3982|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3983|3983| };
|3984|3984| 
|3985|3985| /**
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3979|3979| 	if (data.timerRepeat === undefined)
|3980|3980| 		this.timer = undefined;
|3981|3981| 
|3982|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3982|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3983|3983| };
|3984|3984| 
|3985|3985| /**
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4014|4014| 	this.timer = undefined;
|4015|4015| };
|4016|4016| 
|4017|    |-//// Message handlers /////
|    |4017|+// // Message handlers /////
|4018|4018| 
|4019|4019| UnitAI.prototype.OnMotionChanged = function(msg)
|4020|4020| {
|    | [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
|4019|4019| UnitAI.prototype.OnMotionChanged = function(msg)
|4020|4020| {
|4021|4021| 	if (msg.starting && !msg.error)
|4022|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |4022|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveStarted", "data": msg});
|4023|4023| 	else if (!msg.starting || msg.error)
|4024|4024| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|4025|4025| };
|    | [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
|4019|4019| UnitAI.prototype.OnMotionChanged = function(msg)
|4020|4020| {
|4021|4021| 	if (msg.starting && !msg.error)
|4022|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |4022|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg });
|4023|4023| 	else if (!msg.starting || msg.error)
|4024|4024| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|4025|4025| };
|    | [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
|4021|4021| 	if (msg.starting && !msg.error)
|4022|4022| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|4023|4023| 	else if (!msg.starting || msg.error)
|4024|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |4024|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveCompleted", "data": msg});
|4025|4025| };
|4026|4026| 
|4027|4027| UnitAI.prototype.OnGlobalConstructionFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4021|4021| 	if (msg.starting && !msg.error)
|4022|4022| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|4023|4023| 	else if (!msg.starting || msg.error)
|4024|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |4024|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg });
|4025|4025| };
|4026|4026| 
|4027|4027| UnitAI.prototype.OnGlobalConstructionFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4029|4029| 	// TODO: This is a bit inefficient since every unit listens to every
|4030|4030| 	// construction message - ideally we could scope it to only the one we're building
|4031|4031| 
|4032|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4032|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4033|4033| };
|4034|4034| 
|4035|4035| 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
|4029|4029| 	// TODO: This is a bit inefficient since every unit listens to every
|4030|4030| 	// construction message - ideally we could scope it to only the one we're building
|4031|4031| 
|4032|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4032|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4033|4033| };
|4034|4034| 
|4035|4035| 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
|4054|4054| 
|4055|4055| UnitAI.prototype.OnAttacked = function(msg)
|4056|4056| {
|4057|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4057|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4058|4058| };
|4059|4059| 
|4060|4060| 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
|4054|4054| 
|4055|4055| UnitAI.prototype.OnAttacked = function(msg)
|4056|4056| {
|4057|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4057|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4058|4058| };
|4059|4059| 
|4060|4060| 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
|4059|4059| 
|4060|4060| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4061|4061| {
|4062|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4062|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4063|4063| };
|4064|4064| 
|4065|4065| 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
|4059|4059| 
|4060|4060| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4061|4061| {
|4062|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4062|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4063|4063| };
|4064|4064| 
|4065|4065| 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
|4064|4064| 
|4065|4065| UnitAI.prototype.OnHealthChanged = function(msg)
|4066|4066| {
|4067|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4067|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4068|4068| };
|4069|4069| 
|4070|4070| 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
|4064|4064| 
|4065|4065| UnitAI.prototype.OnHealthChanged = function(msg)
|4066|4066| {
|4067|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4067|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4068|4068| };
|4069|4069| 
|4070|4070| 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
|4070|4070| UnitAI.prototype.OnRangeUpdate = function(msg)
|4071|4071| {
|4072|4072| 	if (msg.tag == this.losRangeQuery)
|4073|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4073|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4074|4074| 	else if (msg.tag == this.losHealRangeQuery)
|4075|4075| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4076|4076| };
|    | [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
|4070|4070| UnitAI.prototype.OnRangeUpdate = function(msg)
|4071|4071| {
|4072|4072| 	if (msg.tag == this.losRangeQuery)
|4073|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4073|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4074|4074| 	else if (msg.tag == this.losHealRangeQuery)
|4075|4075| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4076|4076| };
|    | [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
|4072|4072| 	if (msg.tag == this.losRangeQuery)
|4073|4073| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4074|4074| 	else if (msg.tag == this.losHealRangeQuery)
|4075|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4075|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4076|4076| };
|4077|4077| 
|4078|4078| 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
|4072|4072| 	if (msg.tag == this.losRangeQuery)
|4073|4073| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4074|4074| 	else if (msg.tag == this.losHealRangeQuery)
|4075|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4075|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4076|4076| };
|4077|4077| 
|4078|4078| 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
|4077|4077| 
|4078|4078| UnitAI.prototype.OnPackFinished = function(msg)
|4079|4079| {
|4080|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4080|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4081|4081| };
|4082|4082| 
|4083|4083| //// 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
|4077|4077| 
|4078|4078| UnitAI.prototype.OnPackFinished = function(msg)
|4079|4079| {
|4080|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4080|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4081|4081| };
|4082|4082| 
|4083|4083| //// 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
|4080|4080| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4081|4081| };
|4082|4082| 
|4083|    |-//// Helper functions to be called by the FSM ////
|    |4083|+// // Helper functions to be called by the FSM ////
|4084|4084| 
|4085|4085| UnitAI.prototype.GetWalkSpeed = function()
|4086|4086| {
|    | [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
|4182|4182| 	if (!cmpOwnership || cmpOwnership.GetOwner() == INVALID_PLAYER)
|4183|4183| 		return undefined;
|4184|4184| 
|4185|    |-	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position)
|    |4185|+	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
|4186|4186| 	if (!cmpPosition || !cmpPosition.IsInWorld())
|4187|4187| 		return undefined;
|4188|4188| 
|    | [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
|4267|4267| 			PlaySound(name, member);
|4268|4268| 	}
|4269|4269| 	else
|4270|    |-	{
|    |4270|+	
|4271|4271| 		// Otherwise use our own sounds
|4272|4272| 		PlaySound(name, this.entity);
|4273|    |-	}
|    |4273|+	
|4274|4274| };
|4275|4275| 
|4276|4276| /*
|    | [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
|4436|4436| 	else
|4437|4437| 		// return false? Or hope you come close enough?
|4438|4438| 		var parabolicMaxRange = 0;
|4439|    |-		//return false;
|    |4439|+		// return false;
|4440|4440| 
|4441|4441| 	// the parabole changes while walking, take something in the middle
|4442|4442| 	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
|4501|4501| 	if (this.IsFormationMember())
|4502|4502| 	{
|4503|4503| 		var cmpFormationUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|4504|    |-		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation()
|4505|    |-			&& cmpFormationUnitAI.order.data.target == target)
|    |4504|+		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation() &&
|    |4505|+			cmpFormationUnitAI.order.data.target == target)
|4506|4506| 			return true;
|4507|4507| 	}
|4508|4508| 
|    | [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
|4669|4669| UnitAI.prototype.AttackEntityInZone = function(ents)
|4670|4670| {
|4671|4671| 	var target = ents.find(target =>
|4672|    |-		this.CanAttack(target)
|4673|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4672|+		this.CanAttack(target) &&
|    |4673|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4674|4674| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4675|4675| 	);
|4676|4676| 	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
|4670|4670| {
|4671|4671| 	var target = ents.find(target =>
|4672|4672| 		this.CanAttack(target)
|4673|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4674|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4673|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4674|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4675|4675| 	);
|4676|4676| 	if (!target)
|4677|4677| 		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
|4734|4734| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4735|4735| 	if (this.isGuardOf)
|4736|4736| 	{
|4737|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4737|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4738|4738| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4739|4739| 		if (cmpUnitAI && cmpAttack &&
|4740|4740| 		    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
|4738|4738| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4739|4739| 		if (cmpUnitAI && cmpAttack &&
|4740|4740| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4741|    |-				return false;
|    |4741|+			return false;
|4742|4742| 	}
|4743|4743| 
|4744|4744| 	// 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
|4743|4743| 
|4744|4744| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4745|4745| 	if (this.GetStance().respondHoldGround)
|4746|    |-	{
|    |4746|+	
|4747|4747| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4748|4748| 			return true;
|4749|    |-	}
|    |4749|+	
|4750|4750| 
|4751|4751| 	// Stop if it's left our vision range, unless we're especially persistent
|4752|4752| 	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
|4750|4750| 
|4751|4751| 	// Stop if it's left our vision range, unless we're especially persistent
|4752|4752| 	if (!this.GetStance().respondChaseBeyondVision)
|4753|    |-	{
|    |4753|+	
|4754|4754| 		if (!this.CheckTargetIsInVisionRange(target))
|4755|4755| 			return true;
|4756|    |-	}
|    |4756|+	
|4757|4757| 
|4758|4758| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4759|4759| 	// 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
|4776|4776| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4777|4777| 	if (this.isGuardOf)
|4778|4778| 	{
|4779|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4779|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4780|4780| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4781|4781| 		if (cmpUnitAI && cmpAttack &&
|4782|4782| 		    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
|4789|4789| 	return false;
|4790|4790| };
|4791|4791| 
|4792|    |-//// External interface functions ////
|    |4792|+// // External interface functions ////
|4793|4793| 
|4794|4794| UnitAI.prototype.SetFormationController = function(ent)
|4795|4795| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4799|4799| 	// of our own formation (or ourself if not in formation)
|4800|4800| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4801|4801| 	if (cmpObstruction)
|4802|    |-	{
|    |4802|+	
|4803|4803| 		if (ent == INVALID_ENTITY)
|4804|4804| 			cmpObstruction.SetControlGroup(this.entity);
|4805|4805| 		else
|4806|4806| 			cmpObstruction.SetControlGroup(ent);
|4807|    |-	}
|    |4807|+	
|4808|4808| 
|4809|4809| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4810|4810| 	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
|4943|4943| 	// if we already had an old guard order, do nothing if the target is the same
|4944|4944| 	// and the order is running, otherwise remove the previous order
|4945|4945| 	if (this.isGuardOf)
|4946|    |-	{
|    |4946|+	
|4947|4947| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4948|4948| 			return;
|4949|4949| 		else
|4950|4950| 			this.RemoveGuard();
|4951|    |-	}
|    |4951|+	
|4952|4952| 
|4953|4953| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4954|4954| };
|    | [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
|4946|4946| 	{
|4947|4947| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4948|4948| 			return;
|4949|    |-		else
|4950|    |-			this.RemoveGuard();
|    |4949|+		this.RemoveGuard();
|4951|4950| 	}
|4952|4951| 
|4953|4952| 	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
|5126|5126| 			this.WalkToTarget(target, queued);
|5127|5127| 		return;
|5128|5128| 	}
|5129|    |-	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture}, queued);
|    |5129|+	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture }, queued);
|5130|5130| };
|5131|5131| 
|5132|5132| /**
|    | [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
|5275|5275| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5276|5276| 	{
|5277|5277| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5278|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5278|+		if (cmpTrader.HasBothMarkets() &&
|5279|5279| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5280|5280| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5281|5281| 		{
|    | [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
|5556|5556| 				{
|5557|5557| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5558|5558| 					var targetClasses = this.order.data.targetClasses;
|5559|    |-					if (targetClasses.attack && cmpIdentity
|5560|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5559|+					if (targetClasses.attack && cmpIdentity &&
|    |5560|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5561|5561| 						continue;
|5562|5562| 					if (targetClasses.avoid && cmpIdentity
|5563|5563| 						&& 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
|5559|5559| 					if (targetClasses.attack && cmpIdentity
|5560|5560| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5561|5561| 						continue;
|5562|    |-					if (targetClasses.avoid && cmpIdentity
|5563|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5562|+					if (targetClasses.avoid && cmpIdentity &&
|    |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 (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
|5582|5582| 		{
|5583|5583| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5584|5584| 			var targetClasses = this.order.data.targetClasses;
|5585|    |-			if (cmpIdentity && targetClasses.attack
|5586|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5585|+			if (cmpIdentity && targetClasses.attack &&
|    |5586|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5587|5587| 				continue;
|5588|5588| 			if (cmpIdentity && targetClasses.avoid
|5589|5589| 				&& 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
|5585|5585| 			if (cmpIdentity && targetClasses.attack
|5586|5586| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5587|5587| 				continue;
|5588|    |-			if (cmpIdentity && targetClasses.avoid
|5589|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5588|+			if (cmpIdentity && targetClasses.avoid &&
|    |5589|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5590|5590| 				continue;
|5591|5591| 			// Only used by the AIs to prevent some choices of targets
|5592|5592| 			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
|5728|5728| 
|5729|5729| UnitAI.prototype.SetHeldPosition = function(x, z)
|5730|5730| {
|5731|    |-	this.heldPosition = {"x": x, "z": z};
|    |5731|+	this.heldPosition = { "x": x, "z": z};
|5732|5732| };
|5733|5733| 
|5734|5734| 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
|5728|5728| 
|5729|5729| UnitAI.prototype.SetHeldPosition = function(x, z)
|5730|5730| {
|5731|    |-	this.heldPosition = {"x": x, "z": z};
|    |5731|+	this.heldPosition = {"x": x, "z": z };
|5732|5732| };
|5733|5733| 
|5734|5734| 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
|5755|5755| 	return false;
|5756|5756| };
|5757|5757| 
|5758|    |-//// Helper functions ////
|    |5758|+// // Helper functions ////
|5759|5759| 
|5760|5760| UnitAI.prototype.CanAttack = function(target)
|5761|5761| {
|    | [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
|5959|5959| 	return cmpPack && cmpPack.IsPacking();
|5960|5960| };
|5961|5961| 
|5962|    |-//// Formation specific functions ////
|    |5962|+// // Formation specific functions ////
|5963|5963| 
|5964|5964| UnitAI.prototype.IsAttackingAsFormation = function()
|5965|5965| {
|    | [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
|5964|5964| UnitAI.prototype.IsAttackingAsFormation = function()
|5965|5965| {
|5966|5966| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5967|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5968|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5967|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5968|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5969|5969| };
|5970|5970| 
|5971|5971| //// 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
|5968|5968| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5969|5969| };
|5970|5970| 
|5971|    |-//// Animal specific functions ////
|    |5971|+// // Animal specific functions ////
|5972|5972| 
|5973|5973| UnitAI.prototype.MoveRandomly = function(distance)
|5974|5974| {

binaries/data/mods/public/simulation/components/UnitAI.js
|2521| »   »   »   »   »   »   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
|3884| »   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
|4656| »   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
|4671| »   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
|4717| »   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
|4740| »   »   ····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
|5206| »   var·lastPos·=·undefined;
|    | [NORMAL] ESLintBear (no-undef-init):
|    | It's not necessary to initialize 'lastPos' to undefined.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4449| »   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
|4505| »   »   »   &&·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
|4673| »   »   &&·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
|4674| »   »   &&·(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
|5206| »   var·lastPos·=·undefined;
|    | [NORMAL] JSHintBear:
|    | It's not necessary to initialize 'lastPos' to 'undefined'.

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
|5576| »   var·targets·=·this.GetTargetsFromUnit();
|    | [NORMAL] JSHintBear:
|    | 'targets' is already defined.

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

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

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

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

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

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

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

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

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

Freagarach added inline comments.May 26 2019, 9:32 PM
source/simulation2/components/CCmpRangeManager.cpp
2441

So it is correct as is?

Silier requested changes to this revision.Jun 3 2019, 12:37 PM

aside from comments needs rebase

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

Set animation when unit starts to walk

1418

this.FinishOrder(); return true;

1426

the same as above

1480

due to current unit motion changes you should do something like this as walking state check if can move to point given by order
if (!this.CheckPointRangeExplicit()) {

this.order.data = {"x": this.ScoutingBeginPosition.x, "z":  this.ScoutingBeginPosition.y}
this.SetNextState("WALKING");
return true;

}

1487

if (!this.MoveToPoint()) {
unreachable do something here
} else {
set animation
}

source/simulation2/components/CCmpRangeManager.cpp
2441

static_cast<int>(TERRAIN_TILE_SIZE)

This revision now requires changes to proceed.Jun 3 2019, 12:37 PM
Freagarach updated this revision to Diff 8314.Jun 5 2019, 10:44 AM
Freagarach marked 9 inline comments as done.
Freagarach edited the summary of this revision. (Show Details)
  • Some more randomisation in the scouting.
  • Applied some of @Angen's comments.
  • Better location for the territory check.
In D1851#80680, @Angen wrote:

aside from comments needs rebase

I'm sorry but with rebase you mean the "due to current unit motion changes" part?

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 'for-of'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/selection_panels_helpers.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/selection_panels_helpers.js
| 423| 423| 	let otherEnts = [];
| 424| 424| 
| 425| 425| 	for (let ent of garrisonHolders)
| 426|    |-	{
|    | 426|+	
| 427| 427| 		if (controlsPlayer(GetEntityState(ent).player))
| 428| 428| 			ownEnts.push(ent);
| 429| 429| 		else
| 430| 430| 			otherEnts.push(ent);
| 431|    |-	}
|    | 431|+	
| 432| 432| 
| 433| 433| 	if (ownEnts.length)
| 434| 434| 		Engine.PostNetworkCommand({

binaries/data/mods/public/gui/session/unit_actions.js
| 557| »   »   »   switch·(tradingDetails.type)
|    | [NORMAL] ESLintBear (default-case):
|    | Expected a default case.
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
| 330| 330| 			{
| 331| 331| 				var list = queue.GetEntitiesList();
| 332| 332| 				if (list.indexOf(cmd.template) === -1 && cmd.promoted)
| 333|    |-				{
|    | 333|+				
| 334| 334| 					for (var promoted of cmd.promoted)
| 335| 335| 					{
| 336| 336| 						if (list.indexOf(promoted) === -1)
| 338| 338| 						cmd.template = promoted;
| 339| 339| 						break;
| 340| 340| 					}
| 341|    |-				}
|    | 341|+				
| 342| 342| 			}
| 343| 343| 			if (queue && queue.GetEntitiesList().indexOf(cmd.template) != -1)
| 344| 344| 				if ("metadata" in cmd)
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
| 544| 544| 			if (cmpGarrisonHolder)
| 545| 545| 			{
| 546| 546| 				// Only the owner of the garrisonHolder may unload entities from any owners
| 547|    |-				if (!IsOwnedByPlayer(player, garrisonHolder) && !data.controlAllUnits
| 548|    |-				    && player != +cmd.owner)
|    | 547|+				if (!IsOwnedByPlayer(player, garrisonHolder) && !data.controlAllUnits &&
|    | 548|+				    player != +cmd.owner)
| 549| 549| 						continue;
| 550| 550| 
| 551| 551| 				if (!cmpGarrisonHolder.UnloadTemplate(cmd.template, cmd.owner, cmd.all))
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
| 546| 546| 				// Only the owner of the garrisonHolder may unload entities from any owners
| 547| 547| 				if (!IsOwnedByPlayer(player, garrisonHolder) && !data.controlAllUnits
| 548| 548| 				    && player != +cmd.owner)
| 549|    |-						continue;
|    | 549|+					continue;
| 550| 550| 
| 551| 551| 				if (!cmpGarrisonHolder.UnloadTemplate(cmd.template, cmd.owner, cmd.all))
| 552| 552| 					notifyUnloadFailure(player, garrisonHolder);
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
| 956| 956| 		{
| 957| 957| 			var count = 0;
| 958| 958| 			for (let j = 0; j < length - 1; ++j)
| 959|    |-			{
|    | 959|+			
| 960| 960| 				if ((waterPoints[(i + j) % length] + 1) % numPoints == waterPoints[(i + j + 1) % length])
| 961| 961| 					++count;
| 962| 962| 				else
| 963| 963| 					break;
| 964|    |-			}
|    | 964|+			
| 965| 965| 			consec[i] = count;
| 966| 966| 		}
| 967| 967| 		var start = 0;
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-in'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
| 967| 967| 		var start = 0;
| 968| 968| 		var count = 0;
| 969| 969| 		for (var c in consec)
| 970|    |-		{
|    | 970|+		
| 971| 971| 			if (consec[c] > count)
| 972| 972| 			{
| 973| 973| 				start = c;
| 974| 974| 				count = consec[c];
| 975| 975| 			}
| 976|    |-		}
|    | 976|+		
| 977| 977| 
| 978| 978| 		// If we've found a shoreline, stop searching
| 979| 979| 		if (count != numPoints-1)
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space after key 'metadata'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1150|1150| 
|1151|1151| 	// send Metadata info if any
|1152|1152| 	if (cmd.metadata)
|1153|    |-		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player } );
|    |1153|+		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata": cmd.metadata, "owner" : player } );
|1154|1154| 
|1155|1155| 	// Tell the units to start building this new entity
|1156|1156| 	if (cmd.autorepair)
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space after key 'owner'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1150|1150| 
|1151|1151| 	// send Metadata info if any
|1152|1152| 	if (cmd.metadata)
|1153|    |-		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player } );
|    |1153|+		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner": player } );
|1154|1154| 
|1155|1155| 	// Tell the units to start building this new entity
|1156|1156| 	if (cmd.autorepair)
|    | [NORMAL] ESLintBear (space-in-parens):
|    | There should be no spaces inside this paren.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1150|1150| 
|1151|1151| 	// send Metadata info if any
|1152|1152| 	if (cmd.metadata)
|1153|    |-		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player } );
|    |1153|+		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player });
|1154|1154| 
|1155|1155| 	// Tell the units to start building this new entity
|1156|1156| 	if (cmd.autorepair)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1154|1154| 
|1155|1155| 	// Tell the units to start building this new entity
|1156|1156| 	if (cmd.autorepair)
|1157|    |-	{
|    |1157|+	
|1158|1158| 		ProcessCommand(player, {
|1159|1159| 			"type": "repair",
|1160|1160| 			"entities": entities,
|1162|1162| 			"autocontinue": cmd.autocontinue,
|1163|1163| 			"queued": cmd.queued
|1164|1164| 		});
|1165|    |-	}
|    |1165|+	
|1166|1166| 
|1167|1167| 	return ent;
|1168|1168| }
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1258|1258| 		}
|1259|1259| 
|1260|1260| 		lastTowerControlGroup = cmpSnappedStartObstruction.GetControlGroup();
|1261|    |-		//warn("setting lastTowerControlGroup to control group of start snapped entity " + cmd.startSnappedEntity + ": " + lastTowerControlGroup);
|    |1261|+		// warn("setting lastTowerControlGroup to control group of start snapped entity " + cmd.startSnappedEntity + ": " + lastTowerControlGroup);
|1262|1262| 	}
|1263|1263| 
|1264|1264| 	var i = 0;
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1275|1275| 		// 'lastTowerControlGroup' must always be defined and valid here, except if we're at the first piece and we didn't do
|1276|1276| 		// start position snapping (implying that the first entity we build must be a tower)
|1277|1277| 		if (lastTowerControlGroup === null || lastTowerControlGroup == INVALID_ENTITY)
|1278|    |-		{
|    |1278|+		
|1279|1279| 			if (!(i == 0 && piece.template == cmd.wallSet.templates.tower && !cmd.startSnappedEntity))
|1280|1280| 			{
|1281|1281|     			error("[TryConstructWall] Expected last tower control group to be available, none found (1st pass, iteration " + i + ")");
|1282|1282|     			break;
|1283|1283| 			}
|1284|    |-		}
|    |1284|+		
|1285|1285| 
|1286|1286| 		var constructPieceCmd = {
|1287|1287| 			"type": "construct",
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1322|1322| 
|1323|1323| 				if (i > 0)
|1324|1324| 				{
|1325|    |-					//warn("   updating previous wall piece's secondary control group to " + newTowerControlGroup);
|    |1325|+					// warn("   updating previous wall piece's secondary control group to " + newTowerControlGroup);
|1326|1326| 					var cmpPreviousObstruction = Engine.QueryInterface(pieces[i-1].ent, IID_Obstruction);
|1327|1327| 					// TODO: ensure that cmpPreviousObstruction exists
|1328|1328| 					// TODO: ensure that the previous obstruction does not yet have a secondary control group set
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1380|1380| 		}
|1381|1381| 
|1382|1382| 		if (piece.template == cmd.wallSet.templates.tower)
|1383|    |-		{
|    |1383|+		
|1384|1384| 			// encountered a tower entity, update the last tower control group
|1385|1385| 			lastTowerControlGroup = cmpPieceObstruction.GetControlGroup();
|1386|    |-		}
|    |1386|+		
|1387|1387| 		else
|1388|1388| 		{
|1389|1389| 			// Encountered a non-tower entity, update its secondary control group to 'lastTowerControlGroup'.
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1394|1394| 			if (existingSecondaryControlGroup == INVALID_ENTITY)
|1395|1395| 			{
|1396|1396| 				if (lastTowerControlGroup != null && lastTowerControlGroup != INVALID_ENTITY)
|1397|    |-				{
|    |1397|+				
|1398|1398| 					cmpPieceObstruction.SetControlGroup2(lastTowerControlGroup);
|1399|    |-				}
|    |1399|+				
|1400|1400| 			}
|1401|1401| 			else if (existingSecondaryControlGroup != lastTowerControlGroup)
|1402|1402| 			{
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1469|1469| 	}
|1470|1470| 
|1471|1471| 	if (formedEnts.length == 0)
|1472|    |-	{
|    |1472|+	
|1473|1473| 		// No units support the formation - return all the others
|1474|1474| 		return nonformedUnitAIs;
|1475|    |-	}
|    |1475|+	
|1476|1476| 
|1477|1477| 	// Find what formations the formationable selected entities are currently in
|1478|1478| 	var formation = ExtractFormations(formedEnts);
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1485|1485| 		// Check that all its members are selected
|1486|1486| 		var fid = formationIds[0];
|1487|1487| 		var cmpFormation = Engine.QueryInterface(+fid, IID_Formation);
|1488|    |-		if (cmpFormation && cmpFormation.GetMemberCount() == formation.members[fid].length
|1489|    |-			&& cmpFormation.GetMemberCount() == formation.entities.length)
|    |1488|+		if (cmpFormation && cmpFormation.GetMemberCount() == formation.members[fid].length &&
|    |1489|+			cmpFormation.GetMemberCount() == formation.entities.length)
|1490|1490| 		{
|1491|1491| 			cmpFormation.DeleteTwinFormations();
|1492|1492| 			// The whole formation was selected, so reuse its controller for this command
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1517|1517| 					{
|1518|1518| 						var template = cmpUnitAI.GetFormationTemplate();
|1519|1519| 						if (lastFormationTemplate === undefined)
|1520|    |-						{
|    |1520|+						
|1521|1521| 							lastFormationTemplate = template;
|1522|    |-						}
|    |1522|+						
|1523|1523| 						else if (lastFormationTemplate != template)
|1524|1524| 						{
|1525|1525| 							lastFormationTemplate = undefined;
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1593|1593| 		for (var i = matrix.length - 1; i >= 0 && !closeClusters; --i)
|1594|1594| 			for (var j = i - 1; j >= 0 && !closeClusters; --j)
|1595|1595| 				if (matrix[i][j] < distSq)
|1596|    |-					closeClusters = [i,j];
|    |1596|+					closeClusters = [i, j];
|1597|1597| 
|1598|1598| 		// if no more close clusters found, just return all found clusters so far
|1599|1599| 		if (!closeClusters)
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1615|1615| 		}
|1616|1616| 		// remove the rows and columns in the matrix for the merged clusters,
|1617|1617| 		// and the clusters themselves from the cluster list
|1618|    |-		clusters.splice(closeClusters[0],1);
|    |1618|+		clusters.splice(closeClusters[0], 1);
|1619|1619| 		clusters.splice(closeClusters[1],1);
|1620|1620| 		matrix.splice(closeClusters[0],1);
|1621|1621| 		matrix.splice(closeClusters[1],1);
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1616|1616| 		// remove the rows and columns in the matrix for the merged clusters,
|1617|1617| 		// and the clusters themselves from the cluster list
|1618|1618| 		clusters.splice(closeClusters[0],1);
|1619|    |-		clusters.splice(closeClusters[1],1);
|    |1619|+		clusters.splice(closeClusters[1], 1);
|1620|1620| 		matrix.splice(closeClusters[0],1);
|1621|1621| 		matrix.splice(closeClusters[1],1);
|1622|1622| 		for (let i = 0; i < matrix.length; ++i)
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1617|1617| 		// and the clusters themselves from the cluster list
|1618|1618| 		clusters.splice(closeClusters[0],1);
|1619|1619| 		clusters.splice(closeClusters[1],1);
|1620|    |-		matrix.splice(closeClusters[0],1);
|    |1620|+		matrix.splice(closeClusters[0], 1);
|1621|1621| 		matrix.splice(closeClusters[1],1);
|1622|1622| 		for (let i = 0; i < matrix.length; ++i)
|1623|1623| 		{
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1618|1618| 		clusters.splice(closeClusters[0],1);
|1619|1619| 		clusters.splice(closeClusters[1],1);
|1620|1620| 		matrix.splice(closeClusters[0],1);
|1621|    |-		matrix.splice(closeClusters[1],1);
|    |1621|+		matrix.splice(closeClusters[1], 1);
|1622|1622| 		for (let i = 0; i < matrix.length; ++i)
|1623|1623| 		{
|1624|1624| 			if (matrix[i].length > closeClusters[0])
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1622|1622| 		for (let i = 0; i < matrix.length; ++i)
|1623|1623| 		{
|1624|1624| 			if (matrix[i].length > closeClusters[0])
|1625|    |-				matrix[i].splice(closeClusters[0],1);
|    |1625|+				matrix[i].splice(closeClusters[0], 1);
|1626|1626| 			if (matrix[i].length > closeClusters[1])
|1627|1627| 				matrix[i].splice(closeClusters[1],1);
|1628|1628| 		}
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1624|1624| 			if (matrix[i].length > closeClusters[0])
|1625|1625| 				matrix[i].splice(closeClusters[0],1);
|1626|1626| 			if (matrix[i].length > closeClusters[1])
|1627|    |-				matrix[i].splice(closeClusters[1],1);
|    |1627|+				matrix[i].splice(closeClusters[1], 1);
|1628|1628| 		}
|1629|1629| 		// add a new row of distances to the matrix and the new cluster
|1630|1630| 		clusters.push(newCluster);

binaries/data/mods/public/simulation/helpers/Commands.js
| 796| »   »   let·ent·=·pickRandom(cmpRangeManager.GetEntitiesByPlayer(cmd.player).filter(ent·=>·{
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'ent' is already declared in the upper scope.

binaries/data/mods/public/simulation/helpers/Commands.js
|1281| ····»   »   »   error("[TryConstructWall]·Expected·last·tower·control·group·to·be·available,·none·found·(1st·pass,·iteration·"·+·i·+·")");
|    | [NORMAL] ESLintBear (no-mixed-spaces-and-tabs):
|    | Mixed spaces and tabs.

binaries/data/mods/public/simulation/helpers/Commands.js
|1282| ····»   »   »   break;
|    | [NORMAL] ESLintBear (no-mixed-spaces-and-tabs):
|    | Mixed spaces and tabs.

binaries/data/mods/public/simulation/helpers/Commands.js
|1512| »   »   »   »   var·lastFormationTemplate·=·undefined;
|    | [NORMAL] ESLintBear (no-undef-init):
|    | It's not necessary to initialize 'lastFormationTemplate' to undefined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1591| »   »   var·closeClusters·=·undefined;
|    | [NORMAL] ESLintBear (no-undef-init):
|    | It's not necessary to initialize 'closeClusters' to undefined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1608| »   »   for·(let·i·=·0;·i·<·clusters.length;·++i)
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'i' is already declared in the upper scope.

binaries/data/mods/public/simulation/helpers/Commands.js
|1622| »   »   for·(let·i·=·0;·i·<·matrix.length;·++i)
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'i' is already declared in the upper scope.

binaries/data/mods/public/simulation/helpers/Commands.js
|  53| var·g_Commands·=·{
|    | [NORMAL] JSHintBear:
|    | 'g_Commands' was used before it was defined.

binaries/data/mods/public/simulation/helpers/Commands.js
| 548| »   »   »   »   ····&&·player·!=·+cmd.owner)
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/helpers/Commands.js
| 736| »   »   »   »   var·cmpGUIInterface·=·Engine.QueryInterface(SYSTEM_ENTITY,·IID_GuiInterface);
|    | [NORMAL] JSHintBear:
|    | 'cmpGUIInterface' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
| 955| »   »   for·(var·i·=·0;·i·<·length;·++i)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
| 968| »   »   var·count·=·0;
|    | [NORMAL] JSHintBear:
|    | 'count' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1115| »   »   var·cmpGuiInterface·=·Engine.QueryInterface(SYSTEM_ENTITY,·IID_GuiInterface);
|    | [NORMAL] JSHintBear:
|    | 'cmpGuiInterface' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1367| »   »   var·piece·=·pieces[j];
|    | [NORMAL] JSHintBear:
|    | 'piece' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1450| »   »   var·cmpUnitAI·=·Engine.QueryInterface(ent,·IID_UnitAI);
|    | [NORMAL] JSHintBear:
|    | 'cmpUnitAI' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1489| »   »   »   &&·cmpFormation.GetMemberCount()·==·formation.entities.length)
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/helpers/Commands.js
|1515| »   »   »   »   »   var·cmpUnitAI·=·Engine.QueryInterface(ent,·IID_UnitAI);
|    | [NORMAL] JSHintBear:
|    | 'cmpUnitAI' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1548| »   »   »   var·cmpFormation·=·Engine.QueryInterface(formationEnt,·IID_Formation);
|    | [NORMAL] JSHintBear:
|    | 'cmpFormation' is already defined.
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 356| 356| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 357| 357| 		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 358| 358| 		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 359|    |-		{
|    | 359|+		
| 360| 360| 			// we were already on the shoreline, and have not moved since
| 361| 361| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
| 362| 362| 				needToMove = false;
| 363|    |-		}
|    | 363|+		
| 364| 364| 
| 365| 365| 		if (needToMove)
| 366| 366| 			this.SetNextState("INDIVIDUAL.PICKUP.APPROACHING");
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 354| 354| 		// Check if we need to move     TODO implement a better way to know if we are on the shoreline
| 355| 355| 		var needToMove = true;
| 356| 356| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 357|    |-		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 358|    |-		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
|    | 357|+		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x) &&
|    | 358|+		    (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 359| 359| 		{
| 360| 360| 			// we were already on the shoreline, and have not moved since
| 361| 361| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 519| 519| 					this.PushOrderFront("Walk", this.order.data.lastPos);
| 520| 520| 				}
| 521| 521| 				else
| 522|    |-				{
|    | 522|+				
| 523| 523| 					// We couldn't move there, or the target moved away
| 524| 524| 					this.FinishOrder();
| 525|    |-				}
|    | 525|+				
| 526| 526| 				return;
| 527| 527| 			}
| 528| 528| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 743| 743| 			}
| 744| 744| 			// Check if we are already in range, otherwise walk there
| 745| 745| 			if (!this.CheckGarrisonRange(msg.data.target))
| 746|    |-			{
|    | 746|+			
| 747| 747| 				if (!this.CheckTargetVisible(msg.data.target))
| 748| 748| 				{
| 749| 749| 					this.FinishOrder();
| 754| 754| 					this.SetNextState("GARRISON.APPROACHING");
| 755| 755| 					return;
| 756| 756| 				}
| 757|    |-			}
|    | 757|+			
| 758| 758| 
| 759| 759| 			this.SetNextState("GARRISON.GARRISONING");
| 760| 760| 		},
|    | [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
| 749| 749| 					this.FinishOrder();
| 750| 750| 					return;
| 751| 751| 				}
| 752|    |-				else
| 753|    |-				{
|    | 752|+				
| 754| 753| 					this.SetNextState("GARRISON.APPROACHING");
| 755| 754| 					return;
| 756|    |-				}
|    | 755|+				
| 757| 756| 			}
| 758| 757| 
| 759| 758| 			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
| 772| 772| 						this.PushOrderFront("Walk", msg.data.lastPos);
| 773| 773| 					}
| 774| 774| 					else
| 775|    |-					{
|    | 775|+					
| 776| 776| 						// We couldn't move there, or the target moved away
| 777| 777| 						this.FinishOrder();
| 778|    |-					}
|    | 778|+					
| 779| 779| 					return;
| 780| 780| 				}
| 781| 781| 
|    | [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
|1020|1020| 			},
|1021|1021| 		},
|1022|1022| 
|1023|    |-		"GARRISON":{
|    |1023|+		"GARRISON": {
|1024|1024| 			"enter": function() {
|1025|1025| 				// If the garrisonholder should pickup, warn it so it can take needed action
|1026|1026| 				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
|1240|1240| 			// If the controller handled an order but some members rejected it,
|1241|1241| 			// they will have no orders and be in the FORMATIONMEMBER.IDLE state.
|1242|1242| 			if (this.orderQueue.length)
|1243|    |-			{
|    |1243|+			
|1244|1244| 				// We're leaving the formation, so stop our FormationWalk order
|1245|1245| 				if (this.FinishOrder())
|1246|1246| 					return;
|1247|    |-			}
|    |1247|+			
|1248|1248| 
|1249|1249| 			// No orders left, we're an individual now
|1250|1250| 			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
|1268|1268| 			// Move a tile outside the building
|1269|1269| 			let range = 4;
|1270|1270| 			if (this.CheckTargetRangeExplicit(msg.data.target, range, range))
|1271|    |-			{
|    |1271|+			
|1272|1272| 				// We are already at the target, or can't move at all
|1273|1273| 				this.FinishOrder();
|1274|    |-			}
|    |1274|+			
|1275|1275| 			else
|1276|1276| 			{
|1277|1277| 				this.order.data.min = range;
|    | [NORMAL] ESLintBear (space-in-parens):
|    | There should be no spaces inside this paren.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1416|1416| 
|1417|1417| 		"SCOUTING": {
|1418|1418| 			"enter": function() {
|1419|    |-				warn("Entered scouting state from: " + uneval(this.ScoutingBeginPosition) ); // Remove when done
|    |1419|+				warn("Entered scouting state from: " + uneval(this.ScoutingBeginPosition)); // Remove when done
|1420|1420| 
|1421|1421| 				// Set up variables
|1422|1422| 				let cmpOwnership = Engine.QueryInterface(this.entity, IID_Ownership);
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 6 tabs but found 0.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1469|1469| 						x = pos.x + Math.sin(ang) * dist;
|1470|1470| 						y = pos.y + Math.cos(ang) * dist;
|1471|1471| 
|1472|    |-warn("Can position ("+uneval(x)+","+uneval(y)+") be explored? " + uneval(cmpRangeManager.CanPlayerExplorePosition(x, y, owner) ) );
|    |1472|+						warn("Can position ("+uneval(x)+","+uneval(y)+") be explored? " + uneval(cmpRangeManager.CanPlayerExplorePosition(x, y, owner) ) );
|1473|1473| 
|1474|1474| 						if (cmpRangeManager.CanPlayerExplorePosition(x, y, owner))
|1475|1475| 						{
|    | [NORMAL] ESLintBear (space-in-parens):
|    | There should be no spaces inside this paren.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1469|1469| 						x = pos.x + Math.sin(ang) * dist;
|1470|1470| 						y = pos.y + Math.cos(ang) * dist;
|1471|1471| 
|1472|    |-warn("Can position ("+uneval(x)+","+uneval(y)+") be explored? " + uneval(cmpRangeManager.CanPlayerExplorePosition(x, y, owner) ) );
|    |1472|+warn("Can position ("+uneval(x)+","+uneval(y)+") be explored? " + uneval(cmpRangeManager.CanPlayerExplorePosition(x, y, owner)) );
|1473|1473| 
|1474|1474| 						if (cmpRangeManager.CanPlayerExplorePosition(x, y, owner))
|1475|1475| 						{
|    | [NORMAL] ESLintBear (space-in-parens):
|    | There should be no spaces inside this paren.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1469|1469| 						x = pos.x + Math.sin(ang) * dist;
|1470|1470| 						y = pos.y + Math.cos(ang) * dist;
|1471|1471| 
|1472|    |-warn("Can position ("+uneval(x)+","+uneval(y)+") be explored? " + uneval(cmpRangeManager.CanPlayerExplorePosition(x, y, owner) ) );
|    |1472|+warn("Can position ("+uneval(x)+","+uneval(y)+") be explored? " + uneval(cmpRangeManager.CanPlayerExplorePosition(x, y, owner) ));
|1473|1473| 
|1474|1474| 						if (cmpRangeManager.CanPlayerExplorePosition(x, y, owner))
|1475|1475| 						{
|    | [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
|1480|1480| 								let tileOwner = cmpTerritoryManager.GetOwner(x, y);
|1481|1481| 								if (!tileOwner || !cmpPlayer.IsEnemy(tileOwner))
|1482|1482| 								{
|1483|    |-									targetPos = {"x": x, "y": y};
|    |1483|+									targetPos = { "x": x, "y": y};
|1484|1484| 									break;
|1485|1485| 								}
|1486|1486| 							}
|    | [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
|1480|1480| 								let tileOwner = cmpTerritoryManager.GetOwner(x, y);
|1481|1481| 								if (!tileOwner || !cmpPlayer.IsEnemy(tileOwner))
|1482|1482| 								{
|1483|    |-									targetPos = {"x": x, "y": y};
|    |1483|+									targetPos = {"x": x, "y": y };
|1484|1484| 									break;
|1485|1485| 								}
|1486|1486| 							}
|    | [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
|1498|1498| 					if (!this.CheckPointRangeExplicit(this.ScoutingBeginPosition.x, this.ScoutingBeginPosition.y))
|1499|1499| 					{
|1500|1500| 						this.MoveToPoint(this.ScoutingBeginPosition.x, this.ScoutingBeginPosition.y);
|1501|    |-						this.order.data = {"x": this.ScoutingBeginPosition.x, "z":  this.ScoutingBeginPosition.y};
|    |1501|+						this.order.data = { "x": this.ScoutingBeginPosition.x, "z":  this.ScoutingBeginPosition.y};
|1502|1502| 						this.SetNextState("WALKING");
|1503|1503| 						return true;
|1504|1504| 					}
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space before value for key 'z'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1498|1498| 					if (!this.CheckPointRangeExplicit(this.ScoutingBeginPosition.x, this.ScoutingBeginPosition.y))
|1499|1499| 					{
|1500|1500| 						this.MoveToPoint(this.ScoutingBeginPosition.x, this.ScoutingBeginPosition.y);
|1501|    |-						this.order.data = {"x": this.ScoutingBeginPosition.x, "z":  this.ScoutingBeginPosition.y};
|    |1501|+						this.order.data = {"x": this.ScoutingBeginPosition.x, "z": this.ScoutingBeginPosition.y};
|1502|1502| 						this.SetNextState("WALKING");
|1503|1503| 						return true;
|1504|1504| 					}
|    | [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
|1498|1498| 					if (!this.CheckPointRangeExplicit(this.ScoutingBeginPosition.x, this.ScoutingBeginPosition.y))
|1499|1499| 					{
|1500|1500| 						this.MoveToPoint(this.ScoutingBeginPosition.x, this.ScoutingBeginPosition.y);
|1501|    |-						this.order.data = {"x": this.ScoutingBeginPosition.x, "z":  this.ScoutingBeginPosition.y};
|    |1501|+						this.order.data = {"x": this.ScoutingBeginPosition.x, "z":  this.ScoutingBeginPosition.y };
|1502|1502| 						this.SetNextState("WALKING");
|1503|1503| 						return true;
|1504|1504| 					}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1508|1508| 					warn("Sent on the move. "+ uneval(targetPos)); // Remove when done.
|1509|1509| 
|1510|1510| 					if (!this.MoveToPoint(targetPos.x, targetPos.y))
|1511|    |-					{
|    |1511|+					
|1512|1512| 						warn("Target not reachable!")
|1513|    |-					}
|    |1513|+					
|1514|1514| 				}
|1515|1515| 
|1516|1516| 			},
|    | [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
|1509|1509| 
|1510|1510| 					if (!this.MoveToPoint(targetPos.x, targetPos.y))
|1511|1511| 					{
|1512|    |-						warn("Target not reachable!")
|    |1512|+						warn("Target not reachable!");
|1513|1513| 					}
|1514|1514| 				}
|1515|1515| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1613|1613| 
|1614|1614| 			"LosRangeUpdate": function(msg) {
|1615|1615| 				if (this.GetStance().targetVisibleEnemies)
|1616|    |-				{
|    |1616|+				
|1617|1617| 					// Start attacking one of the newly-seen enemy (if any)
|1618|1618| 					this.AttackEntitiesByPreference(msg.data.added);
|1619|    |-				}
|    |1619|+				
|1620|1620| 			},
|1621|1621| 
|1622|1622| 			"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
|1650|1650| 				this.SelectAnimation("move");
|1651|1651| 			},
|1652|1652| 
|1653|    |-			"leave": function () {
|    |1653|+			"leave": function() {
|1654|1654| 				this.SelectAnimation("idle");
|1655|1655| 				this.StopMoving();
|1656|1656| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1827|1827| 						// if nothing better to do, check if the guarded needs to be healed or repaired
|1828|1828| 						var cmpHealth = Engine.QueryInterface(this.isGuardOf, IID_Health);
|1829|1829| 						if (cmpHealth && cmpHealth.IsInjured())
|1830|    |-						{
|    |1830|+						
|1831|1831| 							if (this.CanHeal(this.isGuardOf))
|1832|1832| 								this.PushOrderFront("Heal", { "target": this.isGuardOf, "force": false });
|1833|1833| 							else if (this.CanRepair(this.isGuardOf))
|1834|1834| 								this.PushOrderFront("Repair", { "target": this.isGuardOf, "autocontinue": false, "force": false });
|1835|    |-						}
|    |1835|+						
|1836|1836| 					}
|1837|1837| 				},
|1838|1838| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1930|1930| 				"MoveCompleted": function() {
|1931|1931| 
|1932|1932| 					if (this.CheckTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1933|    |-					{
|    |1933|+					
|1934|1934| 						// If the unit needs to unpack, do so
|1935|1935| 						if (this.CanUnpack())
|1936|1936| 						{
|1939|1939| 						}
|1940|1940| 						else
|1941|1941| 							this.SetNextState("ATTACKING");
|1942|    |-					}
|    |1942|+					
|1943|1943| 					else
|1944|1944| 					{
|1945|1945| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1937|1937| 							this.PushOrderFront("Unpack", { "force": true });
|1938|1938| 							return;
|1939|1939| 						}
|1940|    |-						else
|1941|    |-							this.SetNextState("ATTACKING");
|    |1940|+						this.SetNextState("ATTACKING");
|1942|1941| 					}
|1943|1942| 					else
|1944|1943| 					{
|    | [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
|1941|1941| 							this.SetNextState("ATTACKING");
|1942|1942| 					}
|1943|1943| 					else
|1944|    |-					{
|    |1944|+					
|1945|1945| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1946|1946| 						{
|1947|1947| 							this.SetNextState("APPROACHING");
|1951|1951| 							// Give up
|1952|1952| 							this.FinishOrder();
|1953|1953| 						}
|1954|    |-					}
|    |1954|+					
|1955|1955| 				},
|1956|1956| 			},
|1957|1957| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1943|1943| 					else
|1944|1944| 					{
|1945|1945| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1946|    |-						{
|    |1946|+						
|1947|1947| 							this.SetNextState("APPROACHING");
|1948|    |-						}
|    |1948|+						
|1949|1949| 						else
|1950|1950| 						{
|1951|1951| 							// Give up
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1947|1947| 							this.SetNextState("APPROACHING");
|1948|1948| 						}
|1949|1949| 						else
|1950|    |-						{
|    |1950|+						
|1951|1951| 							// Give up
|1952|1952| 							this.FinishOrder();
|1953|    |-						}
|    |1953|+						
|1954|1954| 					}
|1955|1955| 				},
|1956|1956| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/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| 					// Check the target is still alive and attackable
|1970|1970| 					if (this.CanAttack(target) && !this.CheckTargetAttackRange(target, this.order.data.attackType))
|1971|    |-					{
|    |1971|+					
|1972|1972| 						// Can't reach it - try to chase after it
|1973|1973| 						if (this.ShouldChaseTargetedEntity(target, this.order.data.force))
|1974|1974| 						{
|1983|1983| 								return;
|1984|1984| 							}
|1985|1985| 						}
|1986|    |-					}
|    |1986|+					
|1987|1987| 
|1988|1988| 					this.StopMoving();
|1989|1989| 
|    | [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
|2016|2016| 					// TODO: we should probably only bother syncing projectile attacks, not melee
|2017|2017| 
|2018|2018| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2019|    |-					this.resyncAnimation = (prepare != this.attackTimers.prepare) ? true : false;
|    |2019|+					this.resyncAnimation = (prepare != this.attackTimers.prepare);
|2020|2020| 
|2021|2021| 					this.FaceTowardsTarget(this.order.data.target);
|2022|2022| 
|    | [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
|2145|2145| 
|2146|2146| 				"Attacked": function(msg) {
|2147|2147| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2148|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2149|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2148|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2149|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2150|2150| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2151|2151| 				},
|2152|2152| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2165|2165| 					this.SelectAnimation("move");
|2166|2166| 					var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|2167|2167| 					if (cmpUnitAI && cmpUnitAI.IsFleeing())
|2168|    |-					{
|    |2168|+					
|2169|2169| 						// Run after a fleeing target
|2170|2170| 						this.SetSpeedMultiplier(this.GetRunMultiplier());
|2171|    |-					}
|    |2171|+					
|2172|2172| 					this.StartTimer(1000, 1000);
|2173|2173| 				},
|2174|2174| 
|    | [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
|2224|2224| 						// Also don't switch to a different type of huntable animal
|2225|2225| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2226|2226| 							return (
|2227|    |-								ent != oldTarget
|2228|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2227|+								ent != oldTarget &&
|    |2228|+								 ((type.generic == "treasure" && oldType.generic == "treasure")
|2229|2229| 								 || (type.specific == oldType.specific
|2230|2230| 								 && (type.specific != "meat" || oldTemplate == template)))
|2231|2231| 							);
|    | [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
|2225|2225| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2226|2226| 							return (
|2227|2227| 								ent != oldTarget
|2228|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2229|    |-								 || (type.specific == oldType.specific
|    |2228|+								 && ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2229|+								 (type.specific == oldType.specific
|2230|2230| 								 && (type.specific != "meat" || oldTemplate == template)))
|2231|2231| 							);
|2232|2232| 						}, oldTarget);
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2226|2226| 							return (
|2227|2227| 								ent != oldTarget
|2228|2228| 								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2229|    |-								 || (type.specific == oldType.specific
|2230|    |-								 && (type.specific != "meat" || oldTemplate == template)))
|    |2229|+								 || (type.specific == oldType.specific &&
|    |2230|+								 (type.specific != "meat" || oldTemplate == template)))
|2231|2231| 							);
|2232|2232| 						}, oldTarget);
|2233|2233| 						if (nearby)
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2235|2235| 							this.PerformGather(nearby, false, false);
|2236|2236| 							return true;
|2237|2237| 						}
|2238|    |-						else
|2239|    |-						{
|    |2238|+						
|2240|2239| 							// It's probably better in this case, to avoid units getting stuck around a dropsite
|2241|2240| 							// in a "Target is far away, full, nearby are no good resources, return to dropsite" loop
|2242|2241| 							// to order it to GatherNear the resource position.
|2257|2256| 									return true;
|2258|2257| 								}
|2259|2258| 							}
|2260|    |-						}
|    |2259|+						
|2261|2260| 						return true;
|2262|2261| 					}
|2263|2262| 
|    | [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
|2247|2247| 								this.GatherNearPosition(pos.x, pos.z, oldType, oldTemplate);
|2248|2248| 								return true;
|2249|2249| 							}
|2250|    |-							else
|2251|    |-							{
|    |2250|+							
|2252|2251| 								// we're kind of stuck here. Return resource.
|2253|2252| 								var nearby = this.FindNearestDropsite(oldType.generic);
|2254|2253| 								if (nearby)
|2256|2255| 									this.PushOrderFront("ReturnResource", { "target": nearby, "force": false });
|2257|2256| 									return true;
|2258|2257| 								}
|2259|    |-							}
|    |2258|+							
|2260|2259| 						}
|2261|2260| 						return true;
|2262|2261| 					}
|    | [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
|2299|2299| 						// Also don't switch to a different type of huntable animal
|2300|2300| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2301|2301| 							return (
|2302|    |-								ent != oldTarget
|2303|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2302|+								ent != oldTarget &&
|    |2303|+								((type.generic == "treasure" && oldType.generic == "treasure")
|2304|2304| 								|| (type.specific == oldType.specific
|2305|2305| 								&& (type.specific != "meat" || oldTemplate == template)))
|2306|2306| 							);
|    | [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
|2300|2300| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2301|2301| 							return (
|2302|2302| 								ent != oldTarget
|2303|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2304|    |-								|| (type.specific == oldType.specific
|    |2303|+								&& ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2304|+								(type.specific == oldType.specific
|2305|2305| 								&& (type.specific != "meat" || oldTemplate == template)))
|2306|2306| 							);
|2307|2307| 						});
|    | [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
|2301|2301| 							return (
|2302|2302| 								ent != oldTarget
|2303|2303| 								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2304|    |-								|| (type.specific == oldType.specific
|2305|    |-								&& (type.specific != "meat" || oldTemplate == template)))
|    |2304|+								|| (type.specific == oldType.specific &&
|    |2305|+								(type.specific != "meat" || oldTemplate == template)))
|2306|2306| 							);
|2307|2307| 						});
|2308|2308| 						if (nearby)
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2359|2359| 					// Also don't switch to a different type of huntable animal
|2360|2360| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2361|2361| 						return (
|2362|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2363|    |-							|| (type.specific == resourceType.specific
|    |2362|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2363|+							(type.specific == resourceType.specific
|2364|2364| 							&& (type.specific != "meat" || resourceTemplate == template))
|2365|2365| 						);
|2366|2366| 					});
|    | [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
|2360|2360| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2361|2361| 						return (
|2362|2362| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2363|    |-							|| (type.specific == resourceType.specific
|2364|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2363|+							|| (type.specific == resourceType.specific &&
|    |2364|+							(type.specific != "meat" || resourceTemplate == template))
|2365|2365| 						);
|2366|2366| 					});
|2367|2367| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2477|2477| 
|2478|2478| 					var cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply);
|2479|2479| 					if (cmpSupply && cmpSupply.IsAvailable(cmpOwnership.GetOwner(), this.entity))
|2480|    |-					{
|    |2480|+					
|2481|2481| 						// Check we can still reach and gather from the target
|2482|2482| 						if (this.CheckTargetRange(this.gatheringTarget, IID_ResourceGatherer) && this.CanGather(this.gatheringTarget))
|2483|2483| 						{
|2542|2542| 								return;
|2543|2543| 							}
|2544|2544| 						}
|2545|    |-					}
|    |2545|+					
|2546|2546| 
|2547|2547| 					// We're already in range, can't get anywhere near it or the target is exhausted.
|2548|2548| 
|    | [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
|2568|2568| 					// Also don't switch to a different type of huntable animal
|2569|2569| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2570|2570| 						return (
|2571|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2572|    |-							|| (type.specific == resourceType.specific
|    |2571|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2572|+							(type.specific == resourceType.specific
|2573|2573| 							&& (type.specific != "meat" || resourceTemplate == template))
|2574|2574| 						);
|2575|2575| 					});
|    | [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
|2569|2569| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2570|2570| 						return (
|2571|2571| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2572|    |-							|| (type.specific == resourceType.specific
|2573|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2572|+							|| (type.specific == resourceType.specific &&
|    |2573|+							(type.specific != "meat" || resourceTemplate == template))
|2574|2574| 						);
|2575|2575| 					});
|2576|2576| 					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
|2634|2634| 
|2635|2635| 				"Timer": function(msg) {
|2636|2636| 					if (this.ShouldAbandonChase(this.order.data.target, this.order.data.force, IID_Heal, null))
|2637|    |-					{
|    |2637|+					
|2638|2638| 						// Return to our original position unless we have a better order.
|2639|2639| 						if (!this.FinishOrder() && this.GetStance().respondHoldGround)
|2640|2640| 							this.WalkToHeldPosition();
|2641|    |-					}
|    |2641|+					
|2642|2642| 				},
|2643|2643| 
|2644|2644| 				"MoveCompleted": function() {
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2668|2668| 					this.StartTimer(prepare, this.healTimers.repeat);
|2669|2669| 
|2670|2670| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2671|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2671|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2672|2672| 
|2673|2673| 					this.FaceTowardsTarget(this.order.data.target);
|2674|2674| 				},
|    | [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
|2880|2880| 					{
|2881|2881| 						// The building was already finished/fully repaired before we arrived;
|2882|2882| 						// let the ConstructionFinished handler handle this.
|2883|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2883|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2884|2884| 						return true;
|2885|2885| 					}
|2886|2886| 
|    | [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
|2880|2880| 					{
|2881|2881| 						// The building was already finished/fully repaired before we arrived;
|2882|2882| 						// let the ConstructionFinished handler handle this.
|2883|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2883|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2884|2884| 						return true;
|2885|2885| 					}
|2886|2886| 
|    | [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
|2923|2923| 					if (!inRange && this.MoveToTargetRange(this.repairTarget, IID_Builder))
|2924|2924| 						this.SetNextState("APPROACHING");
|2925|2925| 					else if (!inRange)
|2926|    |-						this.FinishOrder(); //can't approach and isn't in reach
|    |2926|+						this.FinishOrder(); // can't approach and isn't in reach
|2927|2927| 				},
|2928|2928| 			},
|2929|2929| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/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| 				// Unit was approaching and there's nothing to do now, so switch to walking
|3012|3012| 				if (oldState === "INDIVIDUAL.REPAIR.APPROACHING")
|3013|    |-				{
|    |3013|+				
|3014|3014| 					// We're already walking to the given point, so add this as a order.
|3015|3015| 					this.WalkToTarget(msg.data.newentity, true);
|3016|    |-				}
|    |3016|+				
|3017|3017| 			},
|3018|3018| 		},
|3019|3019| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3072|3072| 
|3073|3073| 					// Check that we can garrison here
|3074|3074| 					if (this.CanGarrison(target))
|3075|    |-					{
|    |3075|+					
|3076|3076| 						// Check that we're in range of the garrison target
|3077|3077| 						if (this.CheckGarrisonRange(target))
|3078|3078| 						{
|3148|3148| 								return false;
|3149|3149| 							}
|3150|3150| 						}
|3151|    |-					}
|    |3151|+					
|3152|3152| 					// Garrisoning failed for some reason, so finish the order
|3153|3153| 					this.FinishOrder();
|3154|3154| 					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
|3269|3269| 		"Attacked": function(msg) {
|3270|3270| 			if (this.template.NaturalBehaviour == "skittish" ||
|3271|3271| 			    this.template.NaturalBehaviour == "passive")
|3272|    |-			{
|    |3272|+			
|3273|3273| 				this.Flee(msg.data.attacker, false);
|3274|    |-			}
|    |3274|+			
|3275|3275| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|3276|3276| 			{
|3277|3277| 				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
|3278|3278| 					this.Attack(msg.data.attacker, false);
|3279|3279| 			}
|3280|3280| 			else if (this.template.NaturalBehaviour == "domestic")
|3281|    |-			{
|    |3281|+			
|3282|3282| 				// Never flee, stop what we were doing
|3283|3283| 				this.SetNextState("IDLE");
|3284|    |-			}
|    |3284|+			
|3285|3285| 		},
|3286|3286| 
|3287|3287| 		"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
|3292|3292| 				this.FinishOrder();
|3293|3293| 				return;
|3294|3294| 			}
|3295|    |-			else
|3296|    |-			{
|    |3295|+			
|3297|3296| 				this.order.data.min = range;
|3298|3297| 				this.SetNextState("WALKING");
|3299|    |-			}
|    |3298|+			
|3300|3299| 		},
|3301|3300| 
|3302|3301| 		"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
|3336|3336| 				}
|3337|3337| 				// Start attacking one of the newly-seen enemy (if any)
|3338|3338| 				else if (this.IsDangerousAnimal())
|3339|    |-				{
|    |3339|+				
|3340|3340| 					this.AttackVisibleEntity(msg.data.added);
|3341|    |-				}
|    |3341|+				
|3342|3342| 
|3343|3343| 				// TODO: if two units enter our range together, we'll attack the
|3344|3344| 				// 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
|3379|3379| 				}
|3380|3380| 				// Start attacking one of the newly-seen enemy (if any)
|3381|3381| 				else if (this.template.NaturalBehaviour == "violent")
|3382|    |-				{
|    |3382|+				
|3383|3383| 					this.AttackVisibleEntity(msg.data.added);
|3384|    |-				}
|    |3384|+				
|3385|3385| 			},
|3386|3386| 
|3387|3387| 			"MoveCompleted": function() { },
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 7.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3396|3396| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3397|3397| 
|3398|3398| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3399|    |-							// only used for domestic animals
|    |3399|+		// only used for domestic animals
|3400|3400| 	},
|3401|3401| };
|3402|3402| 
|    | [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
|3453|3453| 
|3454|3454| UnitAI.prototype.IsAnimal = function()
|3455|3455| {
|3456|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3456|+	return (!!this.template.NaturalBehaviour);
|3457|3457| };
|3458|3458| 
|3459|3459| 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
|3491|3491| UnitAI.prototype.GetGarrisonHolder = function()
|3492|3492| {
|3493|3493| 	if (this.IsGarrisoned())
|3494|    |-	{
|    |3494|+	
|3495|3495| 		for (let order of this.orderQueue)
|3496|3496| 			if (order.type == "Garrison")
|3497|3497| 				return order.data.target;
|3498|    |-	}
|    |3498|+	
|3499|3499| 	return INVALID_ENTITY;
|3500|3500| };
|3501|3501| 
|    | [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
|3569|3569| 		{
|3570|3570| 			let index = this.GetCurrentState().indexOf(".");
|3571|3571| 			if (index != -1)
|3572|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3572|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3573|3573| 			this.Stop(false);
|3574|3574| 		}
|3575|3575| 
|    | [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
|3625|3625| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3626|3626| 			continue;
|3627|3627| 		if (i == 0)
|3628|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3628|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3629|3629| 		else
|3630|3630| 			this.orderQueue.splice(i, 1);
|3631|3631| 		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
|3625|3625| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3626|3626| 			continue;
|3627|3627| 		if (i == 0)
|3628|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3628|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3629|3629| 		else
|3630|3630| 			this.orderQueue.splice(i, 1);
|3631|3631| 		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
|3709|3709| };
|3710|3710| 
|3711|3711| 
|3712|    |-//// FSM linkage functions ////
|    |3712|+// // FSM linkage functions ////
|3713|3713| 
|3714|3714| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3715|3715| 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
|3881|3881| 				continue;
|3882|3882| 			if (this.orderQueue[i].type == type)
|3883|3883| 				continue;
|3884|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3884|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3885|3885| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3886|3886| 			return;
|3887|3887| 		}
|    | [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
|3881|3881| 				continue;
|3882|3882| 			if (this.orderQueue[i].type == type)
|3883|3883| 				continue;
|3884|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3884|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3885|3885| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3886|3886| 			return;
|3887|3887| 		}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3895|3895| {
|3896|3896| 	// Remember the previous work orders to be able to go back to them later if required
|3897|3897| 	if (data && data.force)
|3898|    |-	{
|    |3898|+	
|3899|3899| 		if (this.IsFormationController())
|3900|3900| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3901|3901| 		else
|3902|3902| 			this.UpdateWorkOrders(type);
|3903|    |-	}
|    |3903|+	
|3904|3904| 
|3905|3905| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3906|3906| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3972|3972| 	{
|3973|3973| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3974|3974| 		if (cmpUnitAI)
|3975|    |-		{
|    |3975|+		
|3976|3976| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3977|3977| 			{
|3978|3978| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3981|3981| 					return;
|3982|3982| 				}
|3983|3983| 			}
|3984|    |-		}
|    |3984|+		
|3985|3985| 	}
|3986|3986| 
|3987|3987| 	// 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
|3974|3974| 		if (cmpUnitAI)
|3975|3975| 		{
|3976|3976| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3977|    |-			{
|    |3977|+			
|3978|3978| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3979|3979| 				{
|3980|3980| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3981|3981| 					return;
|3982|3982| 				}
|3983|    |-			}
|    |3983|+			
|3984|3984| 		}
|3985|3985| 	}
|3986|3986| 
|    | [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
|3986|3986| 
|3987|3987| 	// If nothing found, take the unit orders
|3988|3988| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3989|    |-	{
|    |3989|+	
|3990|3990| 		if (isWorkType(this.orderQueue[i].type))
|3991|3991| 		{
|3992|3992| 			this.workOrders = this.orderQueue.slice(i);
|3993|3993| 			return;
|3994|3994| 		}
|3995|    |-	}
|    |3995|+	
|3996|3996| };
|3997|3997| 
|3998|3998| 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
|4052|4052| 	if (data.timerRepeat === undefined)
|4053|4053| 		this.timer = undefined;
|4054|4054| 
|4055|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4055|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4056|4056| };
|4057|4057| 
|4058|4058| /**
|    | [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
|4052|4052| 	if (data.timerRepeat === undefined)
|4053|4053| 		this.timer = undefined;
|4054|4054| 
|4055|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4055|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4056|4056| };
|4057|4057| 
|4058|4058| /**
|    | [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
|4087|4087| 	this.timer = undefined;
|4088|4088| };
|4089|4089| 
|4090|    |-//// Message handlers /////
|    |4090|+// // Message handlers /////
|4091|4091| 
|4092|4092| UnitAI.prototype.OnMotionChanged = function(msg)
|4093|4093| {
|    | [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
|4092|4092| UnitAI.prototype.OnMotionChanged = function(msg)
|4093|4093| {
|4094|4094| 	if (msg.starting && !msg.error)
|4095|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |4095|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveStarted", "data": msg});
|4096|4096| 	else if (!msg.starting || msg.error)
|4097|4097| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|4098|4098| };
|    | [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
|4092|4092| UnitAI.prototype.OnMotionChanged = function(msg)
|4093|4093| {
|4094|4094| 	if (msg.starting && !msg.error)
|4095|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |4095|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg });
|4096|4096| 	else if (!msg.starting || msg.error)
|4097|4097| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|4098|4098| };
|    | [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
|4094|4094| 	if (msg.starting && !msg.error)
|4095|4095| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|4096|4096| 	else if (!msg.starting || msg.error)
|4097|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |4097|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveCompleted", "data": msg});
|4098|4098| };
|4099|4099| 
|4100|4100| UnitAI.prototype.OnGlobalConstructionFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4094|4094| 	if (msg.starting && !msg.error)
|4095|4095| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|4096|4096| 	else if (!msg.starting || msg.error)
|4097|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |4097|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg });
|4098|4098| };
|4099|4099| 
|4100|4100| UnitAI.prototype.OnGlobalConstructionFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4102|4102| 	// TODO: This is a bit inefficient since every unit listens to every
|4103|4103| 	// construction message - ideally we could scope it to only the one we're building
|4104|4104| 
|4105|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4105|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4106|4106| };
|4107|4107| 
|4108|4108| 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
|4102|4102| 	// TODO: This is a bit inefficient since every unit listens to every
|4103|4103| 	// construction message - ideally we could scope it to only the one we're building
|4104|4104| 
|4105|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4105|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4106|4106| };
|4107|4107| 
|4108|4108| 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
|4127|4127| 
|4128|4128| UnitAI.prototype.OnAttacked = function(msg)
|4129|4129| {
|4130|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4130|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4131|4131| };
|4132|4132| 
|4133|4133| 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
|4127|4127| 
|4128|4128| UnitAI.prototype.OnAttacked = function(msg)
|4129|4129| {
|4130|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4130|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4131|4131| };
|4132|4132| 
|4133|4133| 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
|4132|4132| 
|4133|4133| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4134|4134| {
|4135|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4135|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4136|4136| };
|4137|4137| 
|4138|4138| 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
|4132|4132| 
|4133|4133| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4134|4134| {
|4135|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4135|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4136|4136| };
|4137|4137| 
|4138|4138| 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
|4137|4137| 
|4138|4138| UnitAI.prototype.OnHealthChanged = function(msg)
|4139|4139| {
|4140|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4140|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4141|4141| };
|4142|4142| 
|4143|4143| 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
|4137|4137| 
|4138|4138| UnitAI.prototype.OnHealthChanged = function(msg)
|4139|4139| {
|4140|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4140|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4141|4141| };
|4142|4142| 
|4143|4143| 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
|4143|4143| UnitAI.prototype.OnRangeUpdate = function(msg)
|4144|4144| {
|4145|4145| 	if (msg.tag == this.losRangeQuery)
|4146|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4146|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4147|4147| 	else if (msg.tag == this.losHealRangeQuery)
|4148|4148| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4149|4149| };
|    | [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
|4143|4143| UnitAI.prototype.OnRangeUpdate = function(msg)
|4144|4144| {
|4145|4145| 	if (msg.tag == this.losRangeQuery)
|4146|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4146|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4147|4147| 	else if (msg.tag == this.losHealRangeQuery)
|4148|4148| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4149|4149| };
|    | [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
|4145|4145| 	if (msg.tag == this.losRangeQuery)
|4146|4146| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4147|4147| 	else if (msg.tag == this.losHealRangeQuery)
|4148|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4148|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4149|4149| };
|4150|4150| 
|4151|4151| 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
|4145|4145| 	if (msg.tag == this.losRangeQuery)
|4146|4146| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4147|4147| 	else if (msg.tag == this.losHealRangeQuery)
|4148|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4148|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4149|4149| };
|4150|4150| 
|4151|4151| 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
|4150|4150| 
|4151|4151| UnitAI.prototype.OnPackFinished = function(msg)
|4152|4152| {
|4153|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4153|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4154|4154| };
|4155|4155| 
|4156|4156| //// 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
|4150|4150| 
|4151|4151| UnitAI.prototype.OnPackFinished = function(msg)
|4152|4152| {
|4153|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4153|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4154|4154| };
|4155|4155| 
|4156|4156| //// 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
|4153|4153| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4154|4154| };
|4155|4155| 
|4156|    |-//// Helper functions to be called by the FSM ////
|    |4156|+// // Helper functions to be called by the FSM ////
|4157|4157| 
|4158|4158| UnitAI.prototype.GetWalkSpeed = function()
|4159|4159| {
|    | [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
|4255|4255| 	if (!cmpOwnership || cmpOwnership.GetOwner() == INVALID_PLAYER)
|4256|4256| 		return undefined;
|4257|4257| 
|4258|    |-	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position)
|    |4258|+	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
|4259|4259| 	if (!cmpPosition || !cmpPosition.IsInWorld())
|4260|4260| 		return undefined;
|4261|4261| 
|    | [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
|4340|4340| 			PlaySound(name, member);
|4341|4341| 	}
|4342|4342| 	else
|4343|    |-	{
|    |4343|+	
|4344|4344| 		// Otherwise use our own sounds
|4345|4345| 		PlaySound(name, this.entity);
|4346|    |-	}
|    |4346|+	
|4347|4347| };
|4348|4348| 
|4349|4349| /*
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4436|4436| UnitAI.prototype.MoveTo = function(data, iid, type)
|4437|4437| {
|4438|4438| 	if (data["target"])
|4439|    |-	{
|    |4439|+	
|4440|4440| 		if (data["min"] || data["max"])
|4441|4441| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4442|4442| 		else
|4446|4446| 			else
|4447|4447| 				return this.MoveToTargetRange(data.target, iid, type);
|4448|4448| 		}
|4449|    |-	}
|    |4449|+	
|4450|4450| 	else
|4451|4451| 	{
|4452|4452| 		if (data["min"] || data["max"])
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["target"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4435|4435|  */
|4436|4436| UnitAI.prototype.MoveTo = function(data, iid, type)
|4437|4437| {
|4438|    |-	if (data["target"])
|    |4438|+	if (data.target)
|4439|4439| 	{
|4440|4440| 		if (data["min"] || data["max"])
|4441|4441| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["min"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4437|4437| {
|4438|4438| 	if (data["target"])
|4439|4439| 	{
|4440|    |-		if (data["min"] || data["max"])
|    |4440|+		if (data.min || data["max"])
|4441|4441| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4442|4442| 		else
|4443|4443| 		{
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["max"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4437|4437| {
|4438|4438| 	if (data["target"])
|4439|4439| 	{
|4440|    |-		if (data["min"] || data["max"])
|    |4440|+		if (data["min"] || data.max)
|4441|4441| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4442|4442| 		else
|4443|4443| 		{
|    | [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
|4440|4440| 		if (data["min"] || data["max"])
|4441|4441| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4442|4442| 		else
|4443|    |-		{
|    |4443|+		
|4444|4444| 			if (!iid)
|4445|4445| 				return this.MoveToTarget(data.target);
|4446|4446| 			else
|4447|4447| 				return this.MoveToTargetRange(data.target, iid, type);
|4448|    |-		}
|    |4448|+		
|4449|4449| 	}
|4450|4450| 	else
|4451|4451| 	{
|    | [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
|4439|4439| 	{
|4440|4440| 		if (data["min"] || data["max"])
|4441|4441| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4442|    |-		else
|4443|    |-		{
|    |4442|+		
|4444|4443| 			if (!iid)
|4445|4444| 				return this.MoveToTarget(data.target);
|4446|4445| 			else
|4447|4446| 				return this.MoveToTargetRange(data.target, iid, type);
|4448|    |-		}
|    |4447|+		
|4449|4448| 	}
|4450|4449| 	else
|4451|4450| 	{
|    | [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
|4443|4443| 		{
|4444|4444| 			if (!iid)
|4445|4445| 				return this.MoveToTarget(data.target);
|4446|    |-			else
|4447|    |-				return this.MoveToTargetRange(data.target, iid, type);
|    |4446|+			return this.MoveToTargetRange(data.target, iid, type);
|4448|4447| 		}
|4449|4448| 	}
|4450|4449| 	else
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4448|4448| 		}
|4449|4449| 	}
|4450|4450| 	else
|4451|    |-	{
|    |4451|+	
|4452|4452| 		if (data["min"] || data["max"])
|4453|4453| 			return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1);
|4454|4454| 		else
|4455|4455| 			return this.MoveToPoint(data.x, data.z);
|4456|    |-	}
|    |4456|+	
|4457|4457| }
|4458|4458| 
|4459|4459| UnitAI.prototype.MoveToPoint = function(x, z)
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["min"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4449|4449| 	}
|4450|4450| 	else
|4451|4451| 	{
|4452|    |-		if (data["min"] || data["max"])
|    |4452|+		if (data.min || data["max"])
|4453|4453| 			return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1);
|4454|4454| 		else
|4455|4455| 			return this.MoveToPoint(data.x, data.z);
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["max"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4449|4449| 	}
|4450|4450| 	else
|4451|4451| 	{
|4452|    |-		if (data["min"] || data["max"])
|    |4452|+		if (data["min"] || data.max)
|4453|4453| 			return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1);
|4454|4454| 		else
|4455|4455| 			return this.MoveToPoint(data.x, data.z);
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4451|4451| 	{
|4452|4452| 		if (data["min"] || data["max"])
|4453|4453| 			return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1);
|4454|    |-		else
|4455|    |-			return this.MoveToPoint(data.x, data.z);
|    |4454|+		return this.MoveToPoint(data.x, data.z);
|4456|4455| 	}
|4457|4456| }
|4458|4457| 
|    | [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
|4454|4454| 		else
|4455|4455| 			return this.MoveToPoint(data.x, data.z);
|4456|4456| 	}
|4457|    |-}
|    |4457|+};
|4458|4458| 
|4459|4459| UnitAI.prototype.MoveToPoint = function(x, z)
|4460|4460| {
|    | [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
|4538|4538| 	else
|4539|4539| 		// return false? Or hope you come close enough?
|4540|4540| 		var parabolicMaxRange = 0;
|4541|    |-		//return false;
|    |4541|+		// return false;
|4542|4542| 
|4543|4543| 	// the parabole changes while walking, take something in the middle
|4544|4544| 	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
|4603|4603| 	if (this.IsFormationMember())
|4604|4604| 	{
|4605|4605| 		var cmpFormationUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|4606|    |-		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation()
|4607|    |-			&& cmpFormationUnitAI.order.data.target == target)
|    |4606|+		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation() &&
|    |4607|+			cmpFormationUnitAI.order.data.target == target)
|4608|4608| 			return true;
|4609|4609| 	}
|4610|4610| 
|    | [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
|4771|4771| UnitAI.prototype.AttackEntityInZone = function(ents)
|4772|4772| {
|4773|4773| 	var target = ents.find(target =>
|4774|    |-		this.CanAttack(target)
|4775|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4774|+		this.CanAttack(target) &&
|    |4775|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4776|4776| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4777|4777| 	);
|4778|4778| 	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
|4772|4772| {
|4773|4773| 	var target = ents.find(target =>
|4774|4774| 		this.CanAttack(target)
|4775|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4776|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4775|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4776|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4777|4777| 	);
|4778|4778| 	if (!target)
|4779|4779| 		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
|4836|4836| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4837|4837| 	if (this.isGuardOf)
|4838|4838| 	{
|4839|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4839|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4840|4840| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4841|4841| 		if (cmpUnitAI && cmpAttack &&
|4842|4842| 		    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
|4840|4840| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4841|4841| 		if (cmpUnitAI && cmpAttack &&
|4842|4842| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4843|    |-				return false;
|    |4843|+			return false;
|4844|4844| 	}
|4845|4845| 
|4846|4846| 	// 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
|4845|4845| 
|4846|4846| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4847|4847| 	if (this.GetStance().respondHoldGround)
|4848|    |-	{
|    |4848|+	
|4849|4849| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4850|4850| 			return true;
|4851|    |-	}
|    |4851|+	
|4852|4852| 
|4853|4853| 	// Stop if it's left our vision range, unless we're especially persistent
|4854|4854| 	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
|4852|4852| 
|4853|4853| 	// Stop if it's left our vision range, unless we're especially persistent
|4854|4854| 	if (!this.GetStance().respondChaseBeyondVision)
|4855|    |-	{
|    |4855|+	
|4856|4856| 		if (!this.CheckTargetIsInVisionRange(target))
|4857|4857| 			return true;
|4858|    |-	}
|    |4858|+	
|4859|4859| 
|4860|4860| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4861|4861| 	// 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
|4878|4878| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4879|4879| 	if (this.isGuardOf)
|4880|4880| 	{
|4881|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4881|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4882|4882| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4883|4883| 		if (cmpUnitAI && cmpAttack &&
|4884|4884| 		    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
|4891|4891| 	return false;
|4892|4892| };
|4893|4893| 
|4894|    |-//// External interface functions ////
|    |4894|+// // External interface functions ////
|4895|4895| 
|4896|4896| UnitAI.prototype.SetFormationController = function(ent)
|4897|4897| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4901|4901| 	// of our own formation (or ourself if not in formation)
|4902|4902| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4903|4903| 	if (cmpObstruction)
|4904|    |-	{
|    |4904|+	
|4905|4905| 		if (ent == INVALID_ENTITY)
|4906|4906| 			cmpObstruction.SetControlGroup(this.entity);
|4907|4907| 		else
|4908|4908| 			cmpObstruction.SetControlGroup(ent);
|4909|    |-	}
|    |4909|+	
|4910|4910| 
|4911|4911| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4912|4912| 	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
|5045|5045| 	// if we already had an old guard order, do nothing if the target is the same
|5046|5046| 	// and the order is running, otherwise remove the previous order
|5047|5047| 	if (this.isGuardOf)
|5048|    |-	{
|    |5048|+	
|5049|5049| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5050|5050| 			return;
|5051|5051| 		else
|5052|5052| 			this.RemoveGuard();
|5053|    |-	}
|    |5053|+	
|5054|5054| 
|5055|5055| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|5056|5056| };
|    | [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
|5048|5048| 	{
|5049|5049| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5050|5050| 			return;
|5051|    |-		else
|5052|    |-			this.RemoveGuard();
|    |5051|+		this.RemoveGuard();
|5053|5052| 	}
|5054|5053| 
|5055|5054| 	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
|5228|5228| 			this.WalkToTarget(target, queued);
|5229|5229| 		return;
|5230|5230| 	}
|5231|    |-	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture}, queued);
|    |5231|+	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture }, queued);
|5232|5232| };
|5233|5233| 
|5234|5234| /**
|    | [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
|5377|5377| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5378|5378| 	{
|5379|5379| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5380|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5380|+		if (cmpTrader.HasBothMarkets() &&
|5381|5381| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5382|5382| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5383|5383| 		{
|    | [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
|5658|5658| 				{
|5659|5659| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5660|5660| 					var targetClasses = this.order.data.targetClasses;
|5661|    |-					if (targetClasses.attack && cmpIdentity
|5662|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5661|+					if (targetClasses.attack && cmpIdentity &&
|    |5662|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5663|5663| 						continue;
|5664|5664| 					if (targetClasses.avoid && cmpIdentity
|5665|5665| 						&& 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
|5661|5661| 					if (targetClasses.attack && cmpIdentity
|5662|5662| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5663|5663| 						continue;
|5664|    |-					if (targetClasses.avoid && cmpIdentity
|5665|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5664|+					if (targetClasses.avoid && cmpIdentity &&
|    |5665|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5666|5666| 						continue;
|5667|5667| 					// Only used by the AIs to prevent some choices of targets
|5668|5668| 					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
|5684|5684| 		{
|5685|5685| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5686|5686| 			var targetClasses = this.order.data.targetClasses;
|5687|    |-			if (cmpIdentity && targetClasses.attack
|5688|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5687|+			if (cmpIdentity && targetClasses.attack &&
|    |5688|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5689|5689| 				continue;
|5690|5690| 			if (cmpIdentity && targetClasses.avoid
|5691|5691| 				&& 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
|5687|5687| 			if (cmpIdentity && targetClasses.attack
|5688|5688| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5689|5689| 				continue;
|5690|    |-			if (cmpIdentity && targetClasses.avoid
|5691|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5690|+			if (cmpIdentity && targetClasses.avoid &&
|    |5691|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5692|5692| 				continue;
|5693|5693| 			// Only used by the AIs to prevent some choices of targets
|5694|5694| 			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
|5830|5830| 
|5831|5831| UnitAI.prototype.SetHeldPosition = function(x, z)
|5832|5832| {
|5833|    |-	this.heldPosition = {"x": x, "z": z};
|    |5833|+	this.heldPosition = { "x": x, "z": z};
|5834|5834| };
|5835|5835| 
|5836|5836| 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
|5830|5830| 
|5831|5831| UnitAI.prototype.SetHeldPosition = function(x, z)
|5832|5832| {
|5833|    |-	this.heldPosition = {"x": x, "z": z};
|    |5833|+	this.heldPosition = {"x": x, "z": z };
|5834|5834| };
|5835|5835| 
|5836|5836| 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
|5857|5857| 	return false;
|5858|5858| };
|5859|5859| 
|5860|    |-//// Helper functions ////
|    |5860|+// // Helper functions ////
|5861|5861| 
|5862|5862| UnitAI.prototype.CanAttack = function(target)
|5863|5863| {
|    | [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
|6061|6061| 	return cmpPack && cmpPack.IsPacking();
|6062|6062| };
|6063|6063| 
|6064|    |-//// Formation specific functions ////
|    |6064|+// // Formation specific functions ////
|6065|6065| 
|6066|6066| UnitAI.prototype.IsAttackingAsFormation = function()
|6067|6067| {
|    | [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
|6066|6066| UnitAI.prototype.IsAttackingAsFormation = function()
|6067|6067| {
|6068|6068| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6069|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6070|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6069|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6070|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6071|6071| };
|6072|6072| 
|6073|6073| //// 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
|6070|6070| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6071|6071| };
|6072|6072| 
|6073|    |-//// Animal specific functions ////
|    |6073|+// // Animal specific functions ////
|6074|6074| 
|6075|6075| UnitAI.prototype.MoveRandomly = function(distance)
|6076|6076| {

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
| 904| »   »   »   "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
| 929| »   »   »   "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
| 947| »   »   »   "leave":·function(msg)·{
|    | [NORMAL] ESLintBear (no-dupe-keys):
|    | Duplicate key 'leave'.

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

binaries/data/mods/public/simulation/components/UnitAI.js
|1045| »   »   »   »   "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
|1083| »   »   »   "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
|1116| »   »   »   »   "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
|1329| »   »   »   "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
|1418| »   »   »   "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
|1755| »   »   »   »   »   return·false;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'enter' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
|2558| »   »   »   »   »   »   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
|2613| »   »   »   »   "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
|2731| »   »   »   »   "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
|2833| »   »   »   »   "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
|3042| »   »   »   »   "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
|3225| »   »   »   »   "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
|3957| »   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
|4758| »   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
|4773| »   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
|4819| »   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
|4842| »   »   ····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
|5308| »   var·lastPos·=·undefined;
|    | [NORMAL] ESLintBear (no-undef-init):
|    | It's not necessary to initialize 'lastPos' to undefined.

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

binaries/data/mods/public/simulation/components/UnitAI.js
| 947| »   »   »   "leave":·function(msg)·{
|    | [NORMAL] JSHintBear:
|    | Duplicate key 'leave'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1512| »   »   »   »   »   »   warn("Target·not·reachable!")
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|5678| »   var·targets·=·this.GetTargetsFromUnit();
|    | [MAJOR] JSHintBear:
|    | Too many errors. (91% scanned).
Executing section cli...

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

Stan added a comment.Jun 5 2019, 10:56 AM

Would be nice to have a testing map for this / unit tests to check whether the states switch fine.

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

@Angen Why does it return true ?

1516

What happens ?

Freagarach added inline comments.Jun 5 2019, 4:55 PM
binaries/data/mods/public/simulation/components/UnitAI.js
1516

Nothing happens, it is not called at all. Until I change stance, then suddenly it *is* called,,,

Freagarach added inline comments.Jun 5 2019, 4:59 PM
binaries/data/mods/public/simulation/components/UnitAI.js
1516

By the way, I'm not sure that this ought to be in it anyway, I think we can just keep the scouting dumb, it should be more beneficial to scout manually.

Silier added inline comments.Jun 5 2019, 5:12 PM
binaries/data/mods/public/simulation/components/UnitAI.js
1426

this.FinishOrder will change state while we are in enter function, if this was not the most bottom enter function on the root, it would bug

1502

When you plan doing nothing you should call this.FinisOrder and return true;

Silier added inline comments.Jun 7 2019, 8:19 PM
binaries/data/mods/public/simulation/components/UnitAI.js
1467

move cmpPlayer and cmpTerritory before loops

1503

here you are going to move so set ani mation here and remove it from onmovestarted because that is going will be removed as concept to set move animation there

Freagarach updated this revision to Diff 8374.Jun 8 2019, 8:12 AM
Freagarach marked 5 inline comments as done.

Applied @Angen's comments.

Vulcan added a comment.Jun 8 2019, 8:17 AM

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 'for-of'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/selection_panels_helpers.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/selection_panels_helpers.js
| 423| 423| 	let otherEnts = [];
| 424| 424| 
| 425| 425| 	for (let ent of garrisonHolders)
| 426|    |-	{
|    | 426|+	
| 427| 427| 		if (controlsPlayer(GetEntityState(ent).player))
| 428| 428| 			ownEnts.push(ent);
| 429| 429| 		else
| 430| 430| 			otherEnts.push(ent);
| 431|    |-	}
|    | 431|+	
| 432| 432| 
| 433| 433| 	if (ownEnts.length)
| 434| 434| 		Engine.PostNetworkCommand({

binaries/data/mods/public/gui/session/unit_actions.js
| 557| »   »   »   switch·(tradingDetails.type)
|    | [NORMAL] ESLintBear (default-case):
|    | Expected a default case.
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
| 330| 330| 			{
| 331| 331| 				var list = queue.GetEntitiesList();
| 332| 332| 				if (list.indexOf(cmd.template) === -1 && cmd.promoted)
| 333|    |-				{
|    | 333|+				
| 334| 334| 					for (var promoted of cmd.promoted)
| 335| 335| 					{
| 336| 336| 						if (list.indexOf(promoted) === -1)
| 338| 338| 						cmd.template = promoted;
| 339| 339| 						break;
| 340| 340| 					}
| 341|    |-				}
|    | 341|+				
| 342| 342| 			}
| 343| 343| 			if (queue && queue.GetEntitiesList().indexOf(cmd.template) != -1)
| 344| 344| 				if ("metadata" in cmd)
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
| 544| 544| 			if (cmpGarrisonHolder)
| 545| 545| 			{
| 546| 546| 				// Only the owner of the garrisonHolder may unload entities from any owners
| 547|    |-				if (!IsOwnedByPlayer(player, garrisonHolder) && !data.controlAllUnits
| 548|    |-				    && player != +cmd.owner)
|    | 547|+				if (!IsOwnedByPlayer(player, garrisonHolder) && !data.controlAllUnits &&
|    | 548|+				    player != +cmd.owner)
| 549| 549| 						continue;
| 550| 550| 
| 551| 551| 				if (!cmpGarrisonHolder.UnloadTemplate(cmd.template, cmd.owner, cmd.all))
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
| 546| 546| 				// Only the owner of the garrisonHolder may unload entities from any owners
| 547| 547| 				if (!IsOwnedByPlayer(player, garrisonHolder) && !data.controlAllUnits
| 548| 548| 				    && player != +cmd.owner)
| 549|    |-						continue;
|    | 549|+					continue;
| 550| 550| 
| 551| 551| 				if (!cmpGarrisonHolder.UnloadTemplate(cmd.template, cmd.owner, cmd.all))
| 552| 552| 					notifyUnloadFailure(player, garrisonHolder);
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
| 956| 956| 		{
| 957| 957| 			var count = 0;
| 958| 958| 			for (let j = 0; j < length - 1; ++j)
| 959|    |-			{
|    | 959|+			
| 960| 960| 				if ((waterPoints[(i + j) % length] + 1) % numPoints == waterPoints[(i + j + 1) % length])
| 961| 961| 					++count;
| 962| 962| 				else
| 963| 963| 					break;
| 964|    |-			}
|    | 964|+			
| 965| 965| 			consec[i] = count;
| 966| 966| 		}
| 967| 967| 		var start = 0;
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-in'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
| 967| 967| 		var start = 0;
| 968| 968| 		var count = 0;
| 969| 969| 		for (var c in consec)
| 970|    |-		{
|    | 970|+		
| 971| 971| 			if (consec[c] > count)
| 972| 972| 			{
| 973| 973| 				start = c;
| 974| 974| 				count = consec[c];
| 975| 975| 			}
| 976|    |-		}
|    | 976|+		
| 977| 977| 
| 978| 978| 		// If we've found a shoreline, stop searching
| 979| 979| 		if (count != numPoints-1)
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space after key 'metadata'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1150|1150| 
|1151|1151| 	// send Metadata info if any
|1152|1152| 	if (cmd.metadata)
|1153|    |-		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player } );
|    |1153|+		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata": cmd.metadata, "owner" : player } );
|1154|1154| 
|1155|1155| 	// Tell the units to start building this new entity
|1156|1156| 	if (cmd.autorepair)
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space after key 'owner'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1150|1150| 
|1151|1151| 	// send Metadata info if any
|1152|1152| 	if (cmd.metadata)
|1153|    |-		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player } );
|    |1153|+		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner": player } );
|1154|1154| 
|1155|1155| 	// Tell the units to start building this new entity
|1156|1156| 	if (cmd.autorepair)
|    | [NORMAL] ESLintBear (space-in-parens):
|    | There should be no spaces inside this paren.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1150|1150| 
|1151|1151| 	// send Metadata info if any
|1152|1152| 	if (cmd.metadata)
|1153|    |-		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player } );
|    |1153|+		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player });
|1154|1154| 
|1155|1155| 	// Tell the units to start building this new entity
|1156|1156| 	if (cmd.autorepair)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1154|1154| 
|1155|1155| 	// Tell the units to start building this new entity
|1156|1156| 	if (cmd.autorepair)
|1157|    |-	{
|    |1157|+	
|1158|1158| 		ProcessCommand(player, {
|1159|1159| 			"type": "repair",
|1160|1160| 			"entities": entities,
|1162|1162| 			"autocontinue": cmd.autocontinue,
|1163|1163| 			"queued": cmd.queued
|1164|1164| 		});
|1165|    |-	}
|    |1165|+	
|1166|1166| 
|1167|1167| 	return ent;
|1168|1168| }
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1258|1258| 		}
|1259|1259| 
|1260|1260| 		lastTowerControlGroup = cmpSnappedStartObstruction.GetControlGroup();
|1261|    |-		//warn("setting lastTowerControlGroup to control group of start snapped entity " + cmd.startSnappedEntity + ": " + lastTowerControlGroup);
|    |1261|+		// warn("setting lastTowerControlGroup to control group of start snapped entity " + cmd.startSnappedEntity + ": " + lastTowerControlGroup);
|1262|1262| 	}
|1263|1263| 
|1264|1264| 	var i = 0;
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1275|1275| 		// 'lastTowerControlGroup' must always be defined and valid here, except if we're at the first piece and we didn't do
|1276|1276| 		// start position snapping (implying that the first entity we build must be a tower)
|1277|1277| 		if (lastTowerControlGroup === null || lastTowerControlGroup == INVALID_ENTITY)
|1278|    |-		{
|    |1278|+		
|1279|1279| 			if (!(i == 0 && piece.template == cmd.wallSet.templates.tower && !cmd.startSnappedEntity))
|1280|1280| 			{
|1281|1281|     			error("[TryConstructWall] Expected last tower control group to be available, none found (1st pass, iteration " + i + ")");
|1282|1282|     			break;
|1283|1283| 			}
|1284|    |-		}
|    |1284|+		
|1285|1285| 
|1286|1286| 		var constructPieceCmd = {
|1287|1287| 			"type": "construct",
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1322|1322| 
|1323|1323| 				if (i > 0)
|1324|1324| 				{
|1325|    |-					//warn("   updating previous wall piece's secondary control group to " + newTowerControlGroup);
|    |1325|+					// warn("   updating previous wall piece's secondary control group to " + newTowerControlGroup);
|1326|1326| 					var cmpPreviousObstruction = Engine.QueryInterface(pieces[i-1].ent, IID_Obstruction);
|1327|1327| 					// TODO: ensure that cmpPreviousObstruction exists
|1328|1328| 					// TODO: ensure that the previous obstruction does not yet have a secondary control group set
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1380|1380| 		}
|1381|1381| 
|1382|1382| 		if (piece.template == cmd.wallSet.templates.tower)
|1383|    |-		{
|    |1383|+		
|1384|1384| 			// encountered a tower entity, update the last tower control group
|1385|1385| 			lastTowerControlGroup = cmpPieceObstruction.GetControlGroup();
|1386|    |-		}
|    |1386|+		
|1387|1387| 		else
|1388|1388| 		{
|1389|1389| 			// Encountered a non-tower entity, update its secondary control group to 'lastTowerControlGroup'.
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1394|1394| 			if (existingSecondaryControlGroup == INVALID_ENTITY)
|1395|1395| 			{
|1396|1396| 				if (lastTowerControlGroup != null && lastTowerControlGroup != INVALID_ENTITY)
|1397|    |-				{
|    |1397|+				
|1398|1398| 					cmpPieceObstruction.SetControlGroup2(lastTowerControlGroup);
|1399|    |-				}
|    |1399|+				
|1400|1400| 			}
|1401|1401| 			else if (existingSecondaryControlGroup != lastTowerControlGroup)
|1402|1402| 			{
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1469|1469| 	}
|1470|1470| 
|1471|1471| 	if (formedEnts.length == 0)
|1472|    |-	{
|    |1472|+	
|1473|1473| 		// No units support the formation - return all the others
|1474|1474| 		return nonformedUnitAIs;
|1475|    |-	}
|    |1475|+	
|1476|1476| 
|1477|1477| 	// Find what formations the formationable selected entities are currently in
|1478|1478| 	var formation = ExtractFormations(formedEnts);
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1485|1485| 		// Check that all its members are selected
|1486|1486| 		var fid = formationIds[0];
|1487|1487| 		var cmpFormation = Engine.QueryInterface(+fid, IID_Formation);
|1488|    |-		if (cmpFormation && cmpFormation.GetMemberCount() == formation.members[fid].length
|1489|    |-			&& cmpFormation.GetMemberCount() == formation.entities.length)
|    |1488|+		if (cmpFormation && cmpFormation.GetMemberCount() == formation.members[fid].length &&
|    |1489|+			cmpFormation.GetMemberCount() == formation.entities.length)
|1490|1490| 		{
|1491|1491| 			cmpFormation.DeleteTwinFormations();
|1492|1492| 			// The whole formation was selected, so reuse its controller for this command
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1517|1517| 					{
|1518|1518| 						var template = cmpUnitAI.GetFormationTemplate();
|1519|1519| 						if (lastFormationTemplate === undefined)
|1520|    |-						{
|    |1520|+						
|1521|1521| 							lastFormationTemplate = template;
|1522|    |-						}
|    |1522|+						
|1523|1523| 						else if (lastFormationTemplate != template)
|1524|1524| 						{
|1525|1525| 							lastFormationTemplate = undefined;
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1593|1593| 		for (var i = matrix.length - 1; i >= 0 && !closeClusters; --i)
|1594|1594| 			for (var j = i - 1; j >= 0 && !closeClusters; --j)
|1595|1595| 				if (matrix[i][j] < distSq)
|1596|    |-					closeClusters = [i,j];
|    |1596|+					closeClusters = [i, j];
|1597|1597| 
|1598|1598| 		// if no more close clusters found, just return all found clusters so far
|1599|1599| 		if (!closeClusters)
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1615|1615| 		}
|1616|1616| 		// remove the rows and columns in the matrix for the merged clusters,
|1617|1617| 		// and the clusters themselves from the cluster list
|1618|    |-		clusters.splice(closeClusters[0],1);
|    |1618|+		clusters.splice(closeClusters[0], 1);
|1619|1619| 		clusters.splice(closeClusters[1],1);
|1620|1620| 		matrix.splice(closeClusters[0],1);
|1621|1621| 		matrix.splice(closeClusters[1],1);
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1616|1616| 		// remove the rows and columns in the matrix for the merged clusters,
|1617|1617| 		// and the clusters themselves from the cluster list
|1618|1618| 		clusters.splice(closeClusters[0],1);
|1619|    |-		clusters.splice(closeClusters[1],1);
|    |1619|+		clusters.splice(closeClusters[1], 1);
|1620|1620| 		matrix.splice(closeClusters[0],1);
|1621|1621| 		matrix.splice(closeClusters[1],1);
|1622|1622| 		for (let i = 0; i < matrix.length; ++i)
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1617|1617| 		// and the clusters themselves from the cluster list
|1618|1618| 		clusters.splice(closeClusters[0],1);
|1619|1619| 		clusters.splice(closeClusters[1],1);
|1620|    |-		matrix.splice(closeClusters[0],1);
|    |1620|+		matrix.splice(closeClusters[0], 1);
|1621|1621| 		matrix.splice(closeClusters[1],1);
|1622|1622| 		for (let i = 0; i < matrix.length; ++i)
|1623|1623| 		{
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1618|1618| 		clusters.splice(closeClusters[0],1);
|1619|1619| 		clusters.splice(closeClusters[1],1);
|1620|1620| 		matrix.splice(closeClusters[0],1);
|1621|    |-		matrix.splice(closeClusters[1],1);
|    |1621|+		matrix.splice(closeClusters[1], 1);
|1622|1622| 		for (let i = 0; i < matrix.length; ++i)
|1623|1623| 		{
|1624|1624| 			if (matrix[i].length > closeClusters[0])
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1622|1622| 		for (let i = 0; i < matrix.length; ++i)
|1623|1623| 		{
|1624|1624| 			if (matrix[i].length > closeClusters[0])
|1625|    |-				matrix[i].splice(closeClusters[0],1);
|    |1625|+				matrix[i].splice(closeClusters[0], 1);
|1626|1626| 			if (matrix[i].length > closeClusters[1])
|1627|1627| 				matrix[i].splice(closeClusters[1],1);
|1628|1628| 		}
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1624|1624| 			if (matrix[i].length > closeClusters[0])
|1625|1625| 				matrix[i].splice(closeClusters[0],1);
|1626|1626| 			if (matrix[i].length > closeClusters[1])
|1627|    |-				matrix[i].splice(closeClusters[1],1);
|    |1627|+				matrix[i].splice(closeClusters[1], 1);
|1628|1628| 		}
|1629|1629| 		// add a new row of distances to the matrix and the new cluster
|1630|1630| 		clusters.push(newCluster);

binaries/data/mods/public/simulation/helpers/Commands.js
| 796| »   »   let·ent·=·pickRandom(cmpRangeManager.GetEntitiesByPlayer(cmd.player).filter(ent·=>·{
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'ent' is already declared in the upper scope.

binaries/data/mods/public/simulation/helpers/Commands.js
|1281| ····»   »   »   error("[TryConstructWall]·Expected·last·tower·control·group·to·be·available,·none·found·(1st·pass,·iteration·"·+·i·+·")");
|    | [NORMAL] ESLintBear (no-mixed-spaces-and-tabs):
|    | Mixed spaces and tabs.

binaries/data/mods/public/simulation/helpers/Commands.js
|1282| ····»   »   »   break;
|    | [NORMAL] ESLintBear (no-mixed-spaces-and-tabs):
|    | Mixed spaces and tabs.

binaries/data/mods/public/simulation/helpers/Commands.js
|1512| »   »   »   »   var·lastFormationTemplate·=·undefined;
|    | [NORMAL] ESLintBear (no-undef-init):
|    | It's not necessary to initialize 'lastFormationTemplate' to undefined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1591| »   »   var·closeClusters·=·undefined;
|    | [NORMAL] ESLintBear (no-undef-init):
|    | It's not necessary to initialize 'closeClusters' to undefined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1608| »   »   for·(let·i·=·0;·i·<·clusters.length;·++i)
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'i' is already declared in the upper scope.

binaries/data/mods/public/simulation/helpers/Commands.js
|1622| »   »   for·(let·i·=·0;·i·<·matrix.length;·++i)
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'i' is already declared in the upper scope.

binaries/data/mods/public/simulation/helpers/Commands.js
|  53| var·g_Commands·=·{
|    | [NORMAL] JSHintBear:
|    | 'g_Commands' was used before it was defined.

binaries/data/mods/public/simulation/helpers/Commands.js
| 548| »   »   »   »   ····&&·player·!=·+cmd.owner)
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/helpers/Commands.js
| 736| »   »   »   »   var·cmpGUIInterface·=·Engine.QueryInterface(SYSTEM_ENTITY,·IID_GuiInterface);
|    | [NORMAL] JSHintBear:
|    | 'cmpGUIInterface' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
| 955| »   »   for·(var·i·=·0;·i·<·length;·++i)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
| 968| »   »   var·count·=·0;
|    | [NORMAL] JSHintBear:
|    | 'count' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1115| »   »   var·cmpGuiInterface·=·Engine.QueryInterface(SYSTEM_ENTITY,·IID_GuiInterface);
|    | [NORMAL] JSHintBear:
|    | 'cmpGuiInterface' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1367| »   »   var·piece·=·pieces[j];
|    | [NORMAL] JSHintBear:
|    | 'piece' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1450| »   »   var·cmpUnitAI·=·Engine.QueryInterface(ent,·IID_UnitAI);
|    | [NORMAL] JSHintBear:
|    | 'cmpUnitAI' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1489| »   »   »   &&·cmpFormation.GetMemberCount()·==·formation.entities.length)
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/helpers/Commands.js
|1515| »   »   »   »   »   var·cmpUnitAI·=·Engine.QueryInterface(ent,·IID_UnitAI);
|    | [NORMAL] JSHintBear:
|    | 'cmpUnitAI' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1548| »   »   »   var·cmpFormation·=·Engine.QueryInterface(formationEnt,·IID_Formation);
|    | [NORMAL] JSHintBear:
|    | 'cmpFormation' is already defined.
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 356| 356| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 357| 357| 		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 358| 358| 		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 359|    |-		{
|    | 359|+		
| 360| 360| 			// we were already on the shoreline, and have not moved since
| 361| 361| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
| 362| 362| 				needToMove = false;
| 363|    |-		}
|    | 363|+		
| 364| 364| 
| 365| 365| 		if (needToMove)
| 366| 366| 			this.SetNextState("INDIVIDUAL.PICKUP.APPROACHING");
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 354| 354| 		// Check if we need to move     TODO implement a better way to know if we are on the shoreline
| 355| 355| 		var needToMove = true;
| 356| 356| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 357|    |-		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 358|    |-		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
|    | 357|+		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x) &&
|    | 358|+		    (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 359| 359| 		{
| 360| 360| 			// we were already on the shoreline, and have not moved since
| 361| 361| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 519| 519| 					this.PushOrderFront("Walk", this.order.data.lastPos);
| 520| 520| 				}
| 521| 521| 				else
| 522|    |-				{
|    | 522|+				
| 523| 523| 					// We couldn't move there, or the target moved away
| 524| 524| 					this.FinishOrder();
| 525|    |-				}
|    | 525|+				
| 526| 526| 				return;
| 527| 527| 			}
| 528| 528| 
|    | [NORMAL] ESLintBear (space-in-parens):
|    | There should be no spaces inside this paren.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 648| 648| 		if (!cmpPosition || !cmpPosition.IsInWorld())
| 649| 649| 			return;
| 650| 650| 		this.ScoutingBeginPosition = cmpPosition.GetPosition2D();
| 651|    |-		warn("Sent scouting from: " + uneval(this.ScoutingBeginPosition) ); // Remove when done
|    | 651|+		warn("Sent scouting from: " + uneval(this.ScoutingBeginPosition)); // Remove when done
| 652| 652| 		this.SetNextState("INDIVIDUAL.SCOUTING");
| 653| 653| 	},
| 654| 654| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 744| 744| 			}
| 745| 745| 			// Check if we are already in range, otherwise walk there
| 746| 746| 			if (!this.CheckGarrisonRange(msg.data.target))
| 747|    |-			{
|    | 747|+			
| 748| 748| 				if (!this.CheckTargetVisible(msg.data.target))
| 749| 749| 				{
| 750| 750| 					this.FinishOrder();
| 755| 755| 					this.SetNextState("GARRISON.APPROACHING");
| 756| 756| 					return;
| 757| 757| 				}
| 758|    |-			}
|    | 758|+			
| 759| 759| 
| 760| 760| 			this.SetNextState("GARRISON.GARRISONING");
| 761| 761| 		},
|    | [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
| 750| 750| 					this.FinishOrder();
| 751| 751| 					return;
| 752| 752| 				}
| 753|    |-				else
| 754|    |-				{
|    | 753|+				
| 755| 754| 					this.SetNextState("GARRISON.APPROACHING");
| 756| 755| 					return;
| 757|    |-				}
|    | 756|+				
| 758| 757| 			}
| 759| 758| 
| 760| 759| 			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
| 773| 773| 						this.PushOrderFront("Walk", msg.data.lastPos);
| 774| 774| 					}
| 775| 775| 					else
| 776|    |-					{
|    | 776|+					
| 777| 777| 						// We couldn't move there, or the target moved away
| 778| 778| 						this.FinishOrder();
| 779|    |-					}
|    | 779|+					
| 780| 780| 					return;
| 781| 781| 				}
| 782| 782| 
|    | [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
|1021|1021| 			},
|1022|1022| 		},
|1023|1023| 
|1024|    |-		"GARRISON":{
|    |1024|+		"GARRISON": {
|1025|1025| 			"enter": function() {
|1026|1026| 				// If the garrisonholder should pickup, warn it so it can take needed action
|1027|1027| 				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
|1241|1241| 			// If the controller handled an order but some members rejected it,
|1242|1242| 			// they will have no orders and be in the FORMATIONMEMBER.IDLE state.
|1243|1243| 			if (this.orderQueue.length)
|1244|    |-			{
|    |1244|+			
|1245|1245| 				// We're leaving the formation, so stop our FormationWalk order
|1246|1246| 				if (this.FinishOrder())
|1247|1247| 					return;
|1248|    |-			}
|    |1248|+			
|1249|1249| 
|1250|1250| 			// No orders left, we're an individual now
|1251|1251| 			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
|1269|1269| 			// Move a tile outside the building
|1270|1270| 			let range = 4;
|1271|1271| 			if (this.CheckTargetRangeExplicit(msg.data.target, range, range))
|1272|    |-			{
|    |1272|+			
|1273|1273| 				// We are already at the target, or can't move at all
|1274|1274| 				this.FinishOrder();
|1275|    |-			}
|    |1275|+			
|1276|1276| 			else
|1277|1277| 			{
|1278|1278| 				this.order.data.min = range;
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 6 tabs but found 0.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1470|1470| 						x = pos.x + Math.sin(ang) * dist;
|1471|1471| 						y = pos.y + Math.cos(ang) * dist;
|1472|1472| 
|1473|    |-warn("Can position ("+uneval(x)+","+uneval(y)+") be explored? " + uneval(cmpRangeManager.CanPlayerExplorePosition(x, y, owner) ) ); // Remove when done.
|    |1473|+						warn("Can position ("+uneval(x)+","+uneval(y)+") be explored? " + uneval(cmpRangeManager.CanPlayerExplorePosition(x, y, owner) ) ); // Remove when done.
|1474|1474| 
|1475|1475| 						if (cmpRangeManager.CanPlayerExplorePosition(x, y, owner))
|1476|1476| 						{
|    | [NORMAL] ESLintBear (space-in-parens):
|    | There should be no spaces inside this paren.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1470|1470| 						x = pos.x + Math.sin(ang) * dist;
|1471|1471| 						y = pos.y + Math.cos(ang) * dist;
|1472|1472| 
|1473|    |-warn("Can position ("+uneval(x)+","+uneval(y)+") be explored? " + uneval(cmpRangeManager.CanPlayerExplorePosition(x, y, owner) ) ); // Remove when done.
|    |1473|+warn("Can position ("+uneval(x)+","+uneval(y)+") be explored? " + uneval(cmpRangeManager.CanPlayerExplorePosition(x, y, owner)) ); // Remove when done.
|1474|1474| 
|1475|1475| 						if (cmpRangeManager.CanPlayerExplorePosition(x, y, owner))
|1476|1476| 						{
|    | [NORMAL] ESLintBear (space-in-parens):
|    | There should be no spaces inside this paren.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1470|1470| 						x = pos.x + Math.sin(ang) * dist;
|1471|1471| 						y = pos.y + Math.cos(ang) * dist;
|1472|1472| 
|1473|    |-warn("Can position ("+uneval(x)+","+uneval(y)+") be explored? " + uneval(cmpRangeManager.CanPlayerExplorePosition(x, y, owner) ) ); // Remove when done.
|    |1473|+warn("Can position ("+uneval(x)+","+uneval(y)+") be explored? " + uneval(cmpRangeManager.CanPlayerExplorePosition(x, y, owner) )); // Remove when done.
|1474|1474| 
|1475|1475| 						if (cmpRangeManager.CanPlayerExplorePosition(x, y, owner))
|1476|1476| 						{
|    | [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
|1477|1477| 							let tileOwner = cmpTerritoryManager.GetOwner(x, y);
|1478|1478| 							if (!tileOwner || !cmpPlayer.IsEnemy(tileOwner))
|1479|1479| 							{
|1480|    |-								targetPos = {"x": x, "y": y};
|    |1480|+								targetPos = { "x": x, "y": y};
|1481|1481| 								break;
|1482|1482| 							}
|1483|1483| 						}
|    | [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
|1477|1477| 							let tileOwner = cmpTerritoryManager.GetOwner(x, y);
|1478|1478| 							if (!tileOwner || !cmpPlayer.IsEnemy(tileOwner))
|1479|1479| 							{
|1480|    |-								targetPos = {"x": x, "y": y};
|    |1480|+								targetPos = {"x": x, "y": y };
|1481|1481| 								break;
|1482|1482| 							}
|1483|1483| 						}
|    | [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
|1494|1494| 					if (!this.CheckPointRangeExplicit(this.ScoutingBeginPosition.x, this.ScoutingBeginPosition.y))
|1495|1495| 					{
|1496|1496| 						this.MoveToPoint(this.ScoutingBeginPosition.x, this.ScoutingBeginPosition.y);
|1497|    |-						this.order.data = {"x": this.ScoutingBeginPosition.x, "z":  this.ScoutingBeginPosition.y};
|    |1497|+						this.order.data = { "x": this.ScoutingBeginPosition.x, "z":  this.ScoutingBeginPosition.y};
|1498|1498| 						this.SetNextState("WALKING");
|1499|1499| 						this.SelectAnimation("move");
|1500|1500| 						return true;
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space before value for key 'z'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1494|1494| 					if (!this.CheckPointRangeExplicit(this.ScoutingBeginPosition.x, this.ScoutingBeginPosition.y))
|1495|1495| 					{
|1496|1496| 						this.MoveToPoint(this.ScoutingBeginPosition.x, this.ScoutingBeginPosition.y);
|1497|    |-						this.order.data = {"x": this.ScoutingBeginPosition.x, "z":  this.ScoutingBeginPosition.y};
|    |1497|+						this.order.data = {"x": this.ScoutingBeginPosition.x, "z": this.ScoutingBeginPosition.y};
|1498|1498| 						this.SetNextState("WALKING");
|1499|1499| 						this.SelectAnimation("move");
|1500|1500| 						return true;
|    | [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
|1494|1494| 					if (!this.CheckPointRangeExplicit(this.ScoutingBeginPosition.x, this.ScoutingBeginPosition.y))
|1495|1495| 					{
|1496|1496| 						this.MoveToPoint(this.ScoutingBeginPosition.x, this.ScoutingBeginPosition.y);
|1497|    |-						this.order.data = {"x": this.ScoutingBeginPosition.x, "z":  this.ScoutingBeginPosition.y};
|    |1497|+						this.order.data = {"x": this.ScoutingBeginPosition.x, "z":  this.ScoutingBeginPosition.y };
|1498|1498| 						this.SetNextState("WALKING");
|1499|1499| 						this.SelectAnimation("move");
|1500|1500| 						return true;
|    | [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
|1506|1506| 
|1507|1507| 					if (!this.MoveToPoint(targetPos.x, targetPos.y))
|1508|1508| 					{
|1509|    |-						warn("Target not reachable!") // Remove when done
|    |1509|+						warn("Target not reachable!"); // Remove when done
|1510|1510| 						this.FinishOrder();
|1511|1511| 						return true;
|1512|1512| 					}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1609|1609| 
|1610|1610| 			"LosRangeUpdate": function(msg) {
|1611|1611| 				if (this.GetStance().targetVisibleEnemies)
|1612|    |-				{
|    |1612|+				
|1613|1613| 					// Start attacking one of the newly-seen enemy (if any)
|1614|1614| 					this.AttackEntitiesByPreference(msg.data.added);
|1615|    |-				}
|    |1615|+				
|1616|1616| 			},
|1617|1617| 
|1618|1618| 			"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
|1646|1646| 				this.SelectAnimation("move");
|1647|1647| 			},
|1648|1648| 
|1649|    |-			"leave": function () {
|    |1649|+			"leave": function() {
|1650|1650| 				this.SelectAnimation("idle");
|1651|1651| 				this.StopMoving();
|1652|1652| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1823|1823| 						// if nothing better to do, check if the guarded needs to be healed or repaired
|1824|1824| 						var cmpHealth = Engine.QueryInterface(this.isGuardOf, IID_Health);
|1825|1825| 						if (cmpHealth && cmpHealth.IsInjured())
|1826|    |-						{
|    |1826|+						
|1827|1827| 							if (this.CanHeal(this.isGuardOf))
|1828|1828| 								this.PushOrderFront("Heal", { "target": this.isGuardOf, "force": false });
|1829|1829| 							else if (this.CanRepair(this.isGuardOf))
|1830|1830| 								this.PushOrderFront("Repair", { "target": this.isGuardOf, "autocontinue": false, "force": false });
|1831|    |-						}
|    |1831|+						
|1832|1832| 					}
|1833|1833| 				},
|1834|1834| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1926|1926| 				"MoveCompleted": function() {
|1927|1927| 
|1928|1928| 					if (this.CheckTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1929|    |-					{
|    |1929|+					
|1930|1930| 						// If the unit needs to unpack, do so
|1931|1931| 						if (this.CanUnpack())
|1932|1932| 						{
|1935|1935| 						}
|1936|1936| 						else
|1937|1937| 							this.SetNextState("ATTACKING");
|1938|    |-					}
|    |1938|+					
|1939|1939| 					else
|1940|1940| 					{
|1941|1941| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1933|1933| 							this.PushOrderFront("Unpack", { "force": true });
|1934|1934| 							return;
|1935|1935| 						}
|1936|    |-						else
|1937|    |-							this.SetNextState("ATTACKING");
|    |1936|+						this.SetNextState("ATTACKING");
|1938|1937| 					}
|1939|1938| 					else
|1940|1939| 					{
|    | [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
|1937|1937| 							this.SetNextState("ATTACKING");
|1938|1938| 					}
|1939|1939| 					else
|1940|    |-					{
|    |1940|+					
|1941|1941| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1942|1942| 						{
|1943|1943| 							this.SetNextState("APPROACHING");
|1947|1947| 							// Give up
|1948|1948| 							this.FinishOrder();
|1949|1949| 						}
|1950|    |-					}
|    |1950|+					
|1951|1951| 				},
|1952|1952| 			},
|1953|1953| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1939|1939| 					else
|1940|1940| 					{
|1941|1941| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1942|    |-						{
|    |1942|+						
|1943|1943| 							this.SetNextState("APPROACHING");
|1944|    |-						}
|    |1944|+						
|1945|1945| 						else
|1946|1946| 						{
|1947|1947| 							// Give up
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1943|1943| 							this.SetNextState("APPROACHING");
|1944|1944| 						}
|1945|1945| 						else
|1946|    |-						{
|    |1946|+						
|1947|1947| 							// Give up
|1948|1948| 							this.FinishOrder();
|1949|    |-						}
|    |1949|+						
|1950|1950| 					}
|1951|1951| 				},
|1952|1952| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1964|1964| 					}
|1965|1965| 					// Check the target is still alive and attackable
|1966|1966| 					if (this.CanAttack(target) && !this.CheckTargetAttackRange(target, this.order.data.attackType))
|1967|    |-					{
|    |1967|+					
|1968|1968| 						// Can't reach it - try to chase after it
|1969|1969| 						if (this.ShouldChaseTargetedEntity(target, this.order.data.force))
|1970|1970| 						{
|1979|1979| 								return true;
|1980|1980| 							}
|1981|1981| 						}
|1982|    |-					}
|    |1982|+					
|1983|1983| 
|1984|1984| 					this.StopMoving();
|1985|1985| 
|    | [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
|2012|2012| 					// TODO: we should probably only bother syncing projectile attacks, not melee
|2013|2013| 
|2014|2014| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2015|    |-					this.resyncAnimation = (prepare != this.attackTimers.prepare) ? true : false;
|    |2015|+					this.resyncAnimation = (prepare != this.attackTimers.prepare);
|2016|2016| 
|2017|2017| 					this.FaceTowardsTarget(this.order.data.target);
|2018|2018| 
|    | [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
|2141|2141| 
|2142|2142| 				"Attacked": function(msg) {
|2143|2143| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2144|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2145|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2144|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2145|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2146|2146| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2147|2147| 				},
|2148|2148| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2161|2161| 					this.SelectAnimation("move");
|2162|2162| 					var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|2163|2163| 					if (cmpUnitAI && cmpUnitAI.IsFleeing())
|2164|    |-					{
|    |2164|+					
|2165|2165| 						// Run after a fleeing target
|2166|2166| 						this.SetSpeedMultiplier(this.GetRunMultiplier());
|2167|    |-					}
|    |2167|+					
|2168|2168| 					this.StartTimer(1000, 1000);
|2169|2169| 				},
|2170|2170| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2344|2344| 
|2345|2345| 					var cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply);
|2346|2346| 					if (cmpSupply && cmpSupply.IsAvailable(cmpOwnership.GetOwner(), this.entity))
|2347|    |-					{
|    |2347|+					
|2348|2348| 						// Check we can still reach and gather from the target
|2349|2349| 						if (this.CheckTargetRange(this.gatheringTarget, IID_ResourceGatherer) && this.CanGather(this.gatheringTarget))
|2350|2350| 						{
|2409|2409| 								return;
|2410|2410| 							}
|2411|2411| 						}
|2412|    |-					}
|    |2412|+					
|2413|2413| 
|2414|2414| 					// We're already in range, can't get anywhere near it or the target is exhausted.
|2415|2415| 
|    | [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
|2435|2435| 					// Also don't switch to a different type of huntable animal
|2436|2436| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2437|2437| 						return (
|2438|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2439|    |-							|| (type.specific == resourceType.specific
|    |2438|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2439|+							(type.specific == resourceType.specific
|2440|2440| 							&& (type.specific != "meat" || resourceTemplate == template))
|2441|2441| 						);
|2442|2442| 					});
|    | [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
|2436|2436| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2437|2437| 						return (
|2438|2438| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2439|    |-							|| (type.specific == resourceType.specific
|2440|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2439|+							|| (type.specific == resourceType.specific &&
|    |2440|+							(type.specific != "meat" || resourceTemplate == template))
|2441|2441| 						);
|2442|2442| 					});
|2443|2443| 					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
|2501|2501| 
|2502|2502| 				"Timer": function(msg) {
|2503|2503| 					if (this.ShouldAbandonChase(this.order.data.target, this.order.data.force, IID_Heal, null))
|2504|    |-					{
|    |2504|+					
|2505|2505| 						// Return to our original position unless we have a better order.
|2506|2506| 						if (!this.FinishOrder() && this.GetStance().respondHoldGround)
|2507|2507| 							this.WalkToHeldPosition();
|2508|    |-					}
|    |2508|+					
|2509|2509| 				},
|2510|2510| 
|2511|2511| 				"MoveCompleted": function() {
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2535|2535| 					this.StartTimer(prepare, this.healTimers.repeat);
|2536|2536| 
|2537|2537| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2538|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2538|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2539|2539| 
|2540|2540| 					this.FaceTowardsTarget(this.order.data.target);
|2541|2541| 				},
|    | [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
|2747|2747| 					{
|2748|2748| 						// The building was already finished/fully repaired before we arrived;
|2749|2749| 						// let the ConstructionFinished handler handle this.
|2750|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2750|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2751|2751| 						return true;
|2752|2752| 					}
|2753|2753| 
|    | [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
|2747|2747| 					{
|2748|2748| 						// The building was already finished/fully repaired before we arrived;
|2749|2749| 						// let the ConstructionFinished handler handle this.
|2750|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2750|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2751|2751| 						return true;
|2752|2752| 					}
|2753|2753| 
|    | [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
|2790|2790| 					if (!inRange && this.MoveToTargetRange(this.repairTarget, IID_Builder))
|2791|2791| 						this.SetNextState("APPROACHING");
|2792|2792| 					else if (!inRange)
|2793|    |-						this.FinishOrder(); //can't approach and isn't in reach
|    |2793|+						this.FinishOrder(); // can't approach and isn't in reach
|2794|2794| 				},
|2795|2795| 			},
|2796|2796| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2877|2877| 
|2878|2878| 				// Unit was approaching and there's nothing to do now, so switch to walking
|2879|2879| 				if (oldState === "INDIVIDUAL.REPAIR.APPROACHING")
|2880|    |-				{
|    |2880|+				
|2881|2881| 					// We're already walking to the given point, so add this as a order.
|2882|2882| 					this.WalkToTarget(msg.data.newentity, true);
|2883|    |-				}
|    |2883|+				
|2884|2884| 			},
|2885|2885| 		},
|2886|2886| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2939|2939| 
|2940|2940| 					// Check that we can garrison here
|2941|2941| 					if (this.CanGarrison(target))
|2942|    |-					{
|    |2942|+					
|2943|2943| 						// Check that we're in range of the garrison target
|2944|2944| 						if (this.CheckGarrisonRange(target))
|2945|2945| 						{
|3015|3015| 								return false;
|3016|3016| 							}
|3017|3017| 						}
|3018|    |-					}
|    |3018|+					
|3019|3019| 					// Garrisoning failed for some reason, so finish the order
|3020|3020| 					this.FinishOrder();
|3021|3021| 					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
|3136|3136| 		"Attacked": function(msg) {
|3137|3137| 			if (this.template.NaturalBehaviour == "skittish" ||
|3138|3138| 			    this.template.NaturalBehaviour == "passive")
|3139|    |-			{
|    |3139|+			
|3140|3140| 				this.Flee(msg.data.attacker, false);
|3141|    |-			}
|    |3141|+			
|3142|3142| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|3143|3143| 			{
|3144|3144| 				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
|3145|3145| 					this.Attack(msg.data.attacker, false);
|3146|3146| 			}
|3147|3147| 			else if (this.template.NaturalBehaviour == "domestic")
|3148|    |-			{
|    |3148|+			
|3149|3149| 				// Never flee, stop what we were doing
|3150|3150| 				this.SetNextState("IDLE");
|3151|    |-			}
|    |3151|+			
|3152|3152| 		},
|3153|3153| 
|3154|3154| 		"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
|3159|3159| 				this.FinishOrder();
|3160|3160| 				return;
|3161|3161| 			}
|3162|    |-			else
|3163|    |-			{
|    |3162|+			
|3164|3163| 				this.order.data.min = range;
|3165|3164| 				this.SetNextState("WALKING");
|3166|    |-			}
|    |3165|+			
|3167|3166| 		},
|3168|3167| 
|3169|3168| 		"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
|3203|3203| 				}
|3204|3204| 				// Start attacking one of the newly-seen enemy (if any)
|3205|3205| 				else if (this.IsDangerousAnimal())
|3206|    |-				{
|    |3206|+				
|3207|3207| 					this.AttackVisibleEntity(msg.data.added);
|3208|    |-				}
|    |3208|+				
|3209|3209| 
|3210|3210| 				// TODO: if two units enter our range together, we'll attack the
|3211|3211| 				// 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
|3246|3246| 				}
|3247|3247| 				// Start attacking one of the newly-seen enemy (if any)
|3248|3248| 				else if (this.template.NaturalBehaviour == "violent")
|3249|    |-				{
|    |3249|+				
|3250|3250| 					this.AttackVisibleEntity(msg.data.added);
|3251|    |-				}
|    |3251|+				
|3252|3252| 			},
|3253|3253| 
|3254|3254| 			"MoveCompleted": function() { },
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 7.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3263|3263| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3264|3264| 
|3265|3265| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3266|    |-							// only used for domestic animals
|    |3266|+		// only used for domestic animals
|3267|3267| 	},
|3268|3268| };
|3269|3269| 
|    | [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
|3320|3320| 
|3321|3321| UnitAI.prototype.IsAnimal = function()
|3322|3322| {
|3323|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3323|+	return (!!this.template.NaturalBehaviour);
|3324|3324| };
|3325|3325| 
|3326|3326| 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
|3358|3358| UnitAI.prototype.GetGarrisonHolder = function()
|3359|3359| {
|3360|3360| 	if (this.IsGarrisoned())
|3361|    |-	{
|    |3361|+	
|3362|3362| 		for (let order of this.orderQueue)
|3363|3363| 			if (order.type == "Garrison")
|3364|3364| 				return order.data.target;
|3365|    |-	}
|    |3365|+	
|3366|3366| 	return INVALID_ENTITY;
|3367|3367| };
|3368|3368| 
|    | [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
|3436|3436| 		{
|3437|3437| 			let index = this.GetCurrentState().indexOf(".");
|3438|3438| 			if (index != -1)
|3439|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3439|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3440|3440| 			this.Stop(false);
|3441|3441| 		}
|3442|3442| 
|    | [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
|3492|3492| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3493|3493| 			continue;
|3494|3494| 		if (i == 0)
|3495|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3495|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3496|3496| 		else
|3497|3497| 			this.orderQueue.splice(i, 1);
|3498|3498| 		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
|3492|3492| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3493|3493| 			continue;
|3494|3494| 		if (i == 0)
|3495|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3495|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3496|3496| 		else
|3497|3497| 			this.orderQueue.splice(i, 1);
|3498|3498| 		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
|3576|3576| };
|3577|3577| 
|3578|3578| 
|3579|    |-//// FSM linkage functions ////
|    |3579|+// // FSM linkage functions ////
|3580|3580| 
|3581|3581| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3582|3582| 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
|3748|3748| 				continue;
|3749|3749| 			if (this.orderQueue[i].type == type)
|3750|3750| 				continue;
|3751|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3751|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3752|3752| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3753|3753| 			return;
|3754|3754| 		}
|    | [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
|3748|3748| 				continue;
|3749|3749| 			if (this.orderQueue[i].type == type)
|3750|3750| 				continue;
|3751|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3751|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3752|3752| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3753|3753| 			return;
|3754|3754| 		}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3762|3762| {
|3763|3763| 	// Remember the previous work orders to be able to go back to them later if required
|3764|3764| 	if (data && data.force)
|3765|    |-	{
|    |3765|+	
|3766|3766| 		if (this.IsFormationController())
|3767|3767| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3768|3768| 		else
|3769|3769| 			this.UpdateWorkOrders(type);
|3770|    |-	}
|    |3770|+	
|3771|3771| 
|3772|3772| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3773|3773| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3839|3839| 	{
|3840|3840| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3841|3841| 		if (cmpUnitAI)
|3842|    |-		{
|    |3842|+		
|3843|3843| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3844|3844| 			{
|3845|3845| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3848|3848| 					return;
|3849|3849| 				}
|3850|3850| 			}
|3851|    |-		}
|    |3851|+		
|3852|3852| 	}
|3853|3853| 
|3854|3854| 	// 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
|3841|3841| 		if (cmpUnitAI)
|3842|3842| 		{
|3843|3843| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3844|    |-			{
|    |3844|+			
|3845|3845| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3846|3846| 				{
|3847|3847| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3848|3848| 					return;
|3849|3849| 				}
|3850|    |-			}
|    |3850|+			
|3851|3851| 		}
|3852|3852| 	}
|3853|3853| 
|    | [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
|3853|3853| 
|3854|3854| 	// If nothing found, take the unit orders
|3855|3855| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3856|    |-	{
|    |3856|+	
|3857|3857| 		if (isWorkType(this.orderQueue[i].type))
|3858|3858| 		{
|3859|3859| 			this.workOrders = this.orderQueue.slice(i);
|3860|3860| 			return;
|3861|3861| 		}
|3862|    |-	}
|    |3862|+	
|3863|3863| };
|3864|3864| 
|3865|3865| 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
|3919|3919| 	if (data.timerRepeat === undefined)
|3920|3920| 		this.timer = undefined;
|3921|3921| 
|3922|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3922|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3923|3923| };
|3924|3924| 
|3925|3925| /**
|    | [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
|3919|3919| 	if (data.timerRepeat === undefined)
|3920|3920| 		this.timer = undefined;
|3921|3921| 
|3922|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3922|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3923|3923| };
|3924|3924| 
|3925|3925| /**
|    | [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
|3954|3954| 	this.timer = undefined;
|3955|3955| };
|3956|3956| 
|3957|    |-//// Message handlers /////
|    |3957|+// // Message handlers /////
|3958|3958| 
|3959|3959| UnitAI.prototype.OnMotionChanged = function(msg)
|3960|3960| {
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3959|3959| UnitAI.prototype.OnMotionChanged = function(msg)
|3960|3960| {
|3961|3961| 	if (msg.starting && !msg.error)
|3962|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3962|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveStarted", "data": msg});
|3963|3963| 	else if (!msg.starting || msg.error)
|3964|3964| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3965|3965| };
|    | [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
|3959|3959| UnitAI.prototype.OnMotionChanged = function(msg)
|3960|3960| {
|3961|3961| 	if (msg.starting && !msg.error)
|3962|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3962|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg });
|3963|3963| 	else if (!msg.starting || msg.error)
|3964|3964| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3965|3965| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3961|3961| 	if (msg.starting && !msg.error)
|3962|3962| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3963|3963| 	else if (!msg.starting || msg.error)
|3964|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3964|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveCompleted", "data": msg});
|3965|3965| };
|3966|3966| 
|3967|3967| UnitAI.prototype.OnGlobalConstructionFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3961|3961| 	if (msg.starting && !msg.error)
|3962|3962| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3963|3963| 	else if (!msg.starting || msg.error)
|3964|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3964|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg });
|3965|3965| };
|3966|3966| 
|3967|3967| UnitAI.prototype.OnGlobalConstructionFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3969|3969| 	// TODO: This is a bit inefficient since every unit listens to every
|3970|3970| 	// construction message - ideally we could scope it to only the one we're building
|3971|3971| 
|3972|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3972|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3973|3973| };
|3974|3974| 
|3975|3975| 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
|3969|3969| 	// TODO: This is a bit inefficient since every unit listens to every
|3970|3970| 	// construction message - ideally we could scope it to only the one we're building
|3971|3971| 
|3972|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3972|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3973|3973| };
|3974|3974| 
|3975|3975| 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
|3994|3994| 
|3995|3995| UnitAI.prototype.OnAttacked = function(msg)
|3996|3996| {
|3997|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3997|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3998|3998| };
|3999|3999| 
|4000|4000| 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
|3994|3994| 
|3995|3995| UnitAI.prototype.OnAttacked = function(msg)
|3996|3996| {
|3997|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3997|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3998|3998| };
|3999|3999| 
|4000|4000| 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
|3999|3999| 
|4000|4000| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4001|4001| {
|4002|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4002|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4003|4003| };
|4004|4004| 
|4005|4005| 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
|3999|3999| 
|4000|4000| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4001|4001| {
|4002|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4002|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4003|4003| };
|4004|4004| 
|4005|4005| 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
|4004|4004| 
|4005|4005| UnitAI.prototype.OnHealthChanged = function(msg)
|4006|4006| {
|4007|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4007|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4008|4008| };
|4009|4009| 
|4010|4010| 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
|4004|4004| 
|4005|4005| UnitAI.prototype.OnHealthChanged = function(msg)
|4006|4006| {
|4007|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4007|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4008|4008| };
|4009|4009| 
|4010|4010| 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
|4010|4010| UnitAI.prototype.OnRangeUpdate = function(msg)
|4011|4011| {
|4012|4012| 	if (msg.tag == this.losRangeQuery)
|4013|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4013|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4014|4014| 	else if (msg.tag == this.losHealRangeQuery)
|4015|4015| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4016|4016| };
|    | [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
|4010|4010| UnitAI.prototype.OnRangeUpdate = function(msg)
|4011|4011| {
|4012|4012| 	if (msg.tag == this.losRangeQuery)
|4013|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4013|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4014|4014| 	else if (msg.tag == this.losHealRangeQuery)
|4015|4015| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4016|4016| };
|    | [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
|4012|4012| 	if (msg.tag == this.losRangeQuery)
|4013|4013| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4014|4014| 	else if (msg.tag == this.losHealRangeQuery)
|4015|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4015|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4016|4016| };
|4017|4017| 
|4018|4018| 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
|4012|4012| 	if (msg.tag == this.losRangeQuery)
|4013|4013| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4014|4014| 	else if (msg.tag == this.losHealRangeQuery)
|4015|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4015|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4016|4016| };
|4017|4017| 
|4018|4018| 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
|4017|4017| 
|4018|4018| UnitAI.prototype.OnPackFinished = function(msg)
|4019|4019| {
|4020|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4020|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4021|4021| };
|4022|4022| 
|4023|4023| //// 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
|4017|4017| 
|4018|4018| UnitAI.prototype.OnPackFinished = function(msg)
|4019|4019| {
|4020|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4020|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4021|4021| };
|4022|4022| 
|4023|4023| //// 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
|4020|4020| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4021|4021| };
|4022|4022| 
|4023|    |-//// Helper functions to be called by the FSM ////
|    |4023|+// // Helper functions to be called by the FSM ////
|4024|4024| 
|4025|4025| UnitAI.prototype.GetWalkSpeed = function()
|4026|4026| {
|    | [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
|4122|4122| 	if (!cmpOwnership || cmpOwnership.GetOwner() == INVALID_PLAYER)
|4123|4123| 		return undefined;
|4124|4124| 
|4125|    |-	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position)
|    |4125|+	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
|4126|4126| 	if (!cmpPosition || !cmpPosition.IsInWorld())
|4127|4127| 		return undefined;
|4128|4128| 
|    | [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
|4207|4207| 			PlaySound(name, member);
|4208|4208| 	}
|4209|4209| 	else
|4210|    |-	{
|    |4210|+	
|4211|4211| 		// Otherwise use our own sounds
|4212|4212| 		PlaySound(name, this.entity);
|4213|    |-	}
|    |4213|+	
|4214|4214| };
|4215|4215| 
|4216|4216| /*
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4303|4303| UnitAI.prototype.MoveTo = function(data, iid, type)
|4304|4304| {
|4305|4305| 	if (data["target"])
|4306|    |-	{
|    |4306|+	
|4307|4307| 		if (data["min"] || data["max"])
|4308|4308| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4309|4309| 		else
|4313|4313| 			else
|4314|4314| 				return this.MoveToTargetRange(data.target, iid, type);
|4315|4315| 		}
|4316|    |-	}
|    |4316|+	
|4317|4317| 	else
|4318|4318| 	{
|4319|4319| 		if (data["min"] || data["max"])
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["target"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4302|4302|  */
|4303|4303| UnitAI.prototype.MoveTo = function(data, iid, type)
|4304|4304| {
|4305|    |-	if (data["target"])
|    |4305|+	if (data.target)
|4306|4306| 	{
|4307|4307| 		if (data["min"] || data["max"])
|4308|4308| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["min"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4304|4304| {
|4305|4305| 	if (data["target"])
|4306|4306| 	{
|4307|    |-		if (data["min"] || data["max"])
|    |4307|+		if (data.min || data["max"])
|4308|4308| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4309|4309| 		else
|4310|4310| 		{
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["max"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4304|4304| {
|4305|4305| 	if (data["target"])
|4306|4306| 	{
|4307|    |-		if (data["min"] || data["max"])
|    |4307|+		if (data["min"] || data.max)
|4308|4308| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4309|4309| 		else
|4310|4310| 		{
|    | [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
|4307|4307| 		if (data["min"] || data["max"])
|4308|4308| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4309|4309| 		else
|4310|    |-		{
|    |4310|+		
|4311|4311| 			if (!iid)
|4312|4312| 				return this.MoveToTarget(data.target);
|4313|4313| 			else
|4314|4314| 				return this.MoveToTargetRange(data.target, iid, type);
|4315|    |-		}
|    |4315|+		
|4316|4316| 	}
|4317|4317| 	else
|4318|4318| 	{
|    | [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
|4306|4306| 	{
|4307|4307| 		if (data["min"] || data["max"])
|4308|4308| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4309|    |-		else
|4310|    |-		{
|    |4309|+		
|4311|4310| 			if (!iid)
|4312|4311| 				return this.MoveToTarget(data.target);
|4313|4312| 			else
|4314|4313| 				return this.MoveToTargetRange(data.target, iid, type);
|4315|    |-		}
|    |4314|+		
|4316|4315| 	}
|4317|4316| 	else
|4318|4317| 	{
|    | [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
|4310|4310| 		{
|4311|4311| 			if (!iid)
|4312|4312| 				return this.MoveToTarget(data.target);
|4313|    |-			else
|4314|    |-				return this.MoveToTargetRange(data.target, iid, type);
|    |4313|+			return this.MoveToTargetRange(data.target, iid, type);
|4315|4314| 		}
|4316|4315| 	}
|4317|4316| 	else
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4315|4315| 		}
|4316|4316| 	}
|4317|4317| 	else
|4318|    |-	{
|    |4318|+	
|4319|4319| 		if (data["min"] || data["max"])
|4320|4320| 			return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1);
|4321|4321| 		else
|4322|4322| 			return this.MoveToPoint(data.x, data.z);
|4323|    |-	}
|    |4323|+	
|4324|4324| }
|4325|4325| 
|4326|4326| UnitAI.prototype.MoveToPoint = function(x, z)
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["min"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4316|4316| 	}
|4317|4317| 	else
|4318|4318| 	{
|4319|    |-		if (data["min"] || data["max"])
|    |4319|+		if (data.min || data["max"])
|4320|4320| 			return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1);
|4321|4321| 		else
|4322|4322| 			return this.MoveToPoint(data.x, data.z);
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["max"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4316|4316| 	}
|4317|4317| 	else
|4318|4318| 	{
|4319|    |-		if (data["min"] || data["max"])
|    |4319|+		if (data["min"] || data.max)
|4320|4320| 			return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1);
|4321|4321| 		else
|4322|4322| 			return this.MoveToPoint(data.x, data.z);
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4318|4318| 	{
|4319|4319| 		if (data["min"] || data["max"])
|4320|4320| 			return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1);
|4321|    |-		else
|4322|    |-			return this.MoveToPoint(data.x, data.z);
|    |4321|+		return this.MoveToPoint(data.x, data.z);
|4323|4322| 	}
|4324|4323| }
|4325|4324| 
|    | [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
|4321|4321| 		else
|4322|4322| 			return this.MoveToPoint(data.x, data.z);
|4323|4323| 	}
|4324|    |-}
|    |4324|+};
|4325|4325| 
|4326|4326| UnitAI.prototype.MoveToPoint = function(x, z)
|4327|4327| {
|    | [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
|4405|4405| 	else
|4406|4406| 		// return false? Or hope you come close enough?
|4407|4407| 		var parabolicMaxRange = 0;
|4408|    |-		//return false;
|    |4408|+		// return false;
|4409|4409| 
|4410|4410| 	// the parabole changes while walking, take something in the middle
|4411|4411| 	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
|4470|4470| 	if (this.IsFormationMember())
|4471|4471| 	{
|4472|4472| 		var cmpFormationUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|4473|    |-		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation()
|4474|    |-			&& cmpFormationUnitAI.order.data.target == target)
|    |4473|+		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation() &&
|    |4474|+			cmpFormationUnitAI.order.data.target == target)
|4475|4475| 			return true;
|4476|4476| 	}
|4477|4477| 
|    | [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
|4638|4638| UnitAI.prototype.AttackEntityInZone = function(ents)
|4639|4639| {
|4640|4640| 	var target = ents.find(target =>
|4641|    |-		this.CanAttack(target)
|4642|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4641|+		this.CanAttack(target) &&
|    |4642|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4643|4643| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4644|4644| 	);
|4645|4645| 	if (!target)
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4639|4639| {
|4640|4640| 	var target = ents.find(target =>
|4641|4641| 		this.CanAttack(target)
|4642|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4643|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4642|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4643|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4644|4644| 	);
|4645|4645| 	if (!target)
|4646|4646| 		return false;
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before 'Engine'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4703|4703| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4704|4704| 	if (this.isGuardOf)
|4705|4705| 	{
|4706|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4706|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4707|4707| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4708|4708| 		if (cmpUnitAI && cmpAttack &&
|4709|4709| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 4.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4707|4707| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4708|4708| 		if (cmpUnitAI && cmpAttack &&
|4709|4709| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4710|    |-				return false;
|    |4710|+			return false;
|4711|4711| 	}
|4712|4712| 
|4713|4713| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/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| 
|4713|4713| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4714|4714| 	if (this.GetStance().respondHoldGround)
|4715|    |-	{
|    |4715|+	
|4716|4716| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4717|4717| 			return true;
|4718|    |-	}
|    |4718|+	
|4719|4719| 
|4720|4720| 	// Stop if it's left our vision range, unless we're especially persistent
|4721|4721| 	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
|4719|4719| 
|4720|4720| 	// Stop if it's left our vision range, unless we're especially persistent
|4721|4721| 	if (!this.GetStance().respondChaseBeyondVision)
|4722|    |-	{
|    |4722|+	
|4723|4723| 		if (!this.CheckTargetIsInVisionRange(target))
|4724|4724| 			return true;
|4725|    |-	}
|    |4725|+	
|4726|4726| 
|4727|4727| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4728|4728| 	// 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
|4745|4745| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4746|4746| 	if (this.isGuardOf)
|4747|4747| 	{
|4748|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4748|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4749|4749| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4750|4750| 		if (cmpUnitAI && cmpAttack &&
|4751|4751| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4758|4758| 	return false;
|4759|4759| };
|4760|4760| 
|4761|    |-//// External interface functions ////
|    |4761|+// // External interface functions ////
|4762|4762| 
|4763|4763| UnitAI.prototype.SetFormationController = function(ent)
|4764|4764| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4768|4768| 	// of our own formation (or ourself if not in formation)
|4769|4769| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4770|4770| 	if (cmpObstruction)
|4771|    |-	{
|    |4771|+	
|4772|4772| 		if (ent == INVALID_ENTITY)
|4773|4773| 			cmpObstruction.SetControlGroup(this.entity);
|4774|4774| 		else
|4775|4775| 			cmpObstruction.SetControlGroup(ent);
|4776|    |-	}
|    |4776|+	
|4777|4777| 
|4778|4778| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4779|4779| 	if (ent == INVALID_ENTITY)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4912|4912| 	// if we already had an old guard order, do nothing if the target is the same
|4913|4913| 	// and the order is running, otherwise remove the previous order
|4914|4914| 	if (this.isGuardOf)
|4915|    |-	{
|    |4915|+	
|4916|4916| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4917|4917| 			return;
|4918|4918| 		else
|4919|4919| 			this.RemoveGuard();
|4920|    |-	}
|    |4920|+	
|4921|4921| 
|4922|4922| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4923|4923| };
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4915|4915| 	{
|4916|4916| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4917|4917| 			return;
|4918|    |-		else
|4919|    |-			this.RemoveGuard();
|    |4918|+		this.RemoveGuard();
|4920|4919| 	}
|4921|4920| 
|4922|4921| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5095|5095| 			this.WalkToTarget(target, queued);
|5096|5096| 		return;
|5097|5097| 	}
|5098|    |-	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture}, queued);
|    |5098|+	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture }, queued);
|5099|5099| };
|5100|5100| 
|5101|5101| /**
|    | [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
|5244|5244| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5245|5245| 	{
|5246|5246| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5247|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5247|+		if (cmpTrader.HasBothMarkets() &&
|5248|5248| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5249|5249| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5250|5250| 		{
|    | [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
|5525|5525| 				{
|5526|5526| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5527|5527| 					var targetClasses = this.order.data.targetClasses;
|5528|    |-					if (targetClasses.attack && cmpIdentity
|5529|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5528|+					if (targetClasses.attack && cmpIdentity &&
|    |5529|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5530|5530| 						continue;
|5531|5531| 					if (targetClasses.avoid && cmpIdentity
|5532|5532| 						&& 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
|5528|5528| 					if (targetClasses.attack && cmpIdentity
|5529|5529| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5530|5530| 						continue;
|5531|    |-					if (targetClasses.avoid && cmpIdentity
|5532|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5531|+					if (targetClasses.avoid && cmpIdentity &&
|    |5532|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5533|5533| 						continue;
|5534|5534| 					// Only used by the AIs to prevent some choices of targets
|5535|5535| 					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
|5551|5551| 		{
|5552|5552| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5553|5553| 			var targetClasses = this.order.data.targetClasses;
|5554|    |-			if (cmpIdentity && targetClasses.attack
|5555|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5554|+			if (cmpIdentity && targetClasses.attack &&
|    |5555|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5556|5556| 				continue;
|5557|5557| 			if (cmpIdentity && targetClasses.avoid
|5558|5558| 				&& 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
|5554|5554| 			if (cmpIdentity && targetClasses.attack
|5555|5555| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5556|5556| 				continue;
|5557|    |-			if (cmpIdentity && targetClasses.avoid
|5558|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5557|+			if (cmpIdentity && targetClasses.avoid &&
|    |5558|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5559|5559| 				continue;
|5560|5560| 			// Only used by the AIs to prevent some choices of targets
|5561|5561| 			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
|5697|5697| 
|5698|5698| UnitAI.prototype.SetHeldPosition = function(x, z)
|5699|5699| {
|5700|    |-	this.heldPosition = {"x": x, "z": z};
|    |5700|+	this.heldPosition = { "x": x, "z": z};
|5701|5701| };
|5702|5702| 
|5703|5703| 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
|5697|5697| 
|5698|5698| UnitAI.prototype.SetHeldPosition = function(x, z)
|5699|5699| {
|5700|    |-	this.heldPosition = {"x": x, "z": z};
|    |5700|+	this.heldPosition = {"x": x, "z": z };
|5701|5701| };
|5702|5702| 
|5703|5703| 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
|5724|5724| 	return false;
|5725|5725| };
|5726|5726| 
|5727|    |-//// Helper functions ////
|    |5727|+// // Helper functions ////
|5728|5728| 
|5729|5729| UnitAI.prototype.CanAttack = function(target)
|5730|5730| {
|    | [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
|5928|5928| 	return cmpPack && cmpPack.IsPacking();
|5929|5929| };
|5930|5930| 
|5931|    |-//// Formation specific functions ////
|    |5931|+// // Formation specific functions ////
|5932|5932| 
|5933|5933| UnitAI.prototype.IsAttackingAsFormation = function()
|5934|5934| {
|    | [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
|5933|5933| UnitAI.prototype.IsAttackingAsFormation = function()
|5934|5934| {
|5935|5935| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5936|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5937|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5936|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5937|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5938|5938| };
|5939|5939| 
|5940|5940| //// 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
|5937|5937| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5938|5938| };
|5939|5939| 
|5940|    |-//// Animal specific functions ////
|    |5940|+// // Animal specific functions ////
|5941|5941| 
|5942|5942| UnitAI.prototype.MoveRandomly = function(distance)
|5943|5943| {

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
| 905| »   »   »   "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
| 930| »   »   »   "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
| 948| »   »   »   "leave":·function(msg)·{
|    | [NORMAL] ESLintBear (no-dupe-keys):
|    | Duplicate key 'leave'.

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

binaries/data/mods/public/simulation/components/UnitAI.js
|1046| »   »   »   »   "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
|1117| »   »   »   »   "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
|1330| »   »   »   "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
|1419| »   »   »   "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
|1640| »   »   »   "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
|1660| »   »   »   "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
|1689| »   »   »   "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
|1843| »   »   »   "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
|1893| »   »   »   »   "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
|1979| »   »   »   »   »   »   »   »   return·true;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'enter' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
|2151| »   »   »   »   "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
|2242| »   »   »   »   "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| »   »   »   »   »   »   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
|2480| »   »   »   »   "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
|2598| »   »   »   »   "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
|2663| »   »   »   »   "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
|2700| »   »   »   »   "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
|2909| »   »   »   »   "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
|3092| »   »   »   »   "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
|3824| »   var·isWorkType·=·type·=>·type·==·"Gather"·||·type·==·"Trade"·||·type·==·"Repair"·||·type·==·"ReturnResource";
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'type' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|4625| »   var·target·=·ents.find(target·=>·this.CanAttack(target));
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'target' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|4640| »   var·target·=·ents.find(target·=>
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'target' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|4686| »   var·ent·=·ents.find(ent·=>·this.CanHeal(ent));
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'ent' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|4709| »   »   ····cmpAttack.GetAttackTypes().some(type·=>·cmpUnitAI.CheckTargetAttackRange(this.isGuardOf,·type)))
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'type' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|5175| »   var·lastPos·=·undefined;
|    | [NORMAL] ESLintBear (no-undef-init):
|    | It's not necessary to initialize 'lastPos' to undefined.

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

binaries/data/mods/public/simulation/components/UnitAI.js
| 948| »   »   »   "leave":·function(msg)·{
|    | [NORMAL] JSHintBear:
|    | Duplicate key 'leave'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1509| »   »   »   »   »   »   warn("Target·not·reachable!")·//·Remove·when·done
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4418| »   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
|4474| »   »   »   &&·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
|4642| »   »   &&·this.CheckTargetDistanceFromHeldPosition(target,·IID_Attack,·this.GetBestAttackAgainst(target,·true))
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
|4643| »   »   &&·(this.GetStance().respondChaseBeyondVision·||·this.CheckTargetIsInVisionRange(target))
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
|5175| »   var·lastPos·=·undefined;
|    | [NORMAL] JSHintBear:
|    | It's not necessary to initialize 'lastPos' to 'undefined'.

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

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

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

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

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

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

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

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

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

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

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

Freagarach updated this revision to Diff 8380.Jun 8 2019, 1:58 PM
Freagarach edited the summary of this revision. (Show Details)
  • Let #iterations depend on map size.

Did some testing, it takes approximately 10 minutes to explore a "Medium"-sized map and ~40 minutes to fully explore a "Giant"-sized map.

Vulcan added a comment.Jun 8 2019, 2:03 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 'for-of'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/selection_panels_helpers.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/selection_panels_helpers.js
| 423| 423| 	let otherEnts = [];
| 424| 424| 
| 425| 425| 	for (let ent of garrisonHolders)
| 426|    |-	{
|    | 426|+	
| 427| 427| 		if (controlsPlayer(GetEntityState(ent).player))
| 428| 428| 			ownEnts.push(ent);
| 429| 429| 		else
| 430| 430| 			otherEnts.push(ent);
| 431|    |-	}
|    | 431|+	
| 432| 432| 
| 433| 433| 	if (ownEnts.length)
| 434| 434| 		Engine.PostNetworkCommand({

binaries/data/mods/public/gui/session/unit_actions.js
| 557| »   »   »   switch·(tradingDetails.type)
|    | [NORMAL] ESLintBear (default-case):
|    | Expected a default case.
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
| 330| 330| 			{
| 331| 331| 				var list = queue.GetEntitiesList();
| 332| 332| 				if (list.indexOf(cmd.template) === -1 && cmd.promoted)
| 333|    |-				{
|    | 333|+				
| 334| 334| 					for (var promoted of cmd.promoted)
| 335| 335| 					{
| 336| 336| 						if (list.indexOf(promoted) === -1)
| 338| 338| 						cmd.template = promoted;
| 339| 339| 						break;
| 340| 340| 					}
| 341|    |-				}
|    | 341|+				
| 342| 342| 			}
| 343| 343| 			if (queue && queue.GetEntitiesList().indexOf(cmd.template) != -1)
| 344| 344| 				if ("metadata" in cmd)
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
| 544| 544| 			if (cmpGarrisonHolder)
| 545| 545| 			{
| 546| 546| 				// Only the owner of the garrisonHolder may unload entities from any owners
| 547|    |-				if (!IsOwnedByPlayer(player, garrisonHolder) && !data.controlAllUnits
| 548|    |-				    && player != +cmd.owner)
|    | 547|+				if (!IsOwnedByPlayer(player, garrisonHolder) && !data.controlAllUnits &&
|    | 548|+				    player != +cmd.owner)
| 549| 549| 						continue;
| 550| 550| 
| 551| 551| 				if (!cmpGarrisonHolder.UnloadTemplate(cmd.template, cmd.owner, cmd.all))
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
| 546| 546| 				// Only the owner of the garrisonHolder may unload entities from any owners
| 547| 547| 				if (!IsOwnedByPlayer(player, garrisonHolder) && !data.controlAllUnits
| 548| 548| 				    && player != +cmd.owner)
| 549|    |-						continue;
|    | 549|+					continue;
| 550| 550| 
| 551| 551| 				if (!cmpGarrisonHolder.UnloadTemplate(cmd.template, cmd.owner, cmd.all))
| 552| 552| 					notifyUnloadFailure(player, garrisonHolder);
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
| 956| 956| 		{
| 957| 957| 			var count = 0;
| 958| 958| 			for (let j = 0; j < length - 1; ++j)
| 959|    |-			{
|    | 959|+			
| 960| 960| 				if ((waterPoints[(i + j) % length] + 1) % numPoints == waterPoints[(i + j + 1) % length])
| 961| 961| 					++count;
| 962| 962| 				else
| 963| 963| 					break;
| 964|    |-			}
|    | 964|+			
| 965| 965| 			consec[i] = count;
| 966| 966| 		}
| 967| 967| 		var start = 0;
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-in'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
| 967| 967| 		var start = 0;
| 968| 968| 		var count = 0;
| 969| 969| 		for (var c in consec)
| 970|    |-		{
|    | 970|+		
| 971| 971| 			if (consec[c] > count)
| 972| 972| 			{
| 973| 973| 				start = c;
| 974| 974| 				count = consec[c];
| 975| 975| 			}
| 976|    |-		}
|    | 976|+		
| 977| 977| 
| 978| 978| 		// If we've found a shoreline, stop searching
| 979| 979| 		if (count != numPoints-1)
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space after key 'metadata'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1150|1150| 
|1151|1151| 	// send Metadata info if any
|1152|1152| 	if (cmd.metadata)
|1153|    |-		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player } );
|    |1153|+		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata": cmd.metadata, "owner" : player } );
|1154|1154| 
|1155|1155| 	// Tell the units to start building this new entity
|1156|1156| 	if (cmd.autorepair)
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space after key 'owner'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1150|1150| 
|1151|1151| 	// send Metadata info if any
|1152|1152| 	if (cmd.metadata)
|1153|    |-		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player } );
|    |1153|+		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner": player } );
|1154|1154| 
|1155|1155| 	// Tell the units to start building this new entity
|1156|1156| 	if (cmd.autorepair)
|    | [NORMAL] ESLintBear (space-in-parens):
|    | There should be no spaces inside this paren.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1150|1150| 
|1151|1151| 	// send Metadata info if any
|1152|1152| 	if (cmd.metadata)
|1153|    |-		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player } );
|    |1153|+		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player });
|1154|1154| 
|1155|1155| 	// Tell the units to start building this new entity
|1156|1156| 	if (cmd.autorepair)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1154|1154| 
|1155|1155| 	// Tell the units to start building this new entity
|1156|1156| 	if (cmd.autorepair)
|1157|    |-	{
|    |1157|+	
|1158|1158| 		ProcessCommand(player, {
|1159|1159| 			"type": "repair",
|1160|1160| 			"entities": entities,
|1162|1162| 			"autocontinue": cmd.autocontinue,
|1163|1163| 			"queued": cmd.queued
|1164|1164| 		});
|1165|    |-	}
|    |1165|+	
|1166|1166| 
|1167|1167| 	return ent;
|1168|1168| }
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1258|1258| 		}
|1259|1259| 
|1260|1260| 		lastTowerControlGroup = cmpSnappedStartObstruction.GetControlGroup();
|1261|    |-		//warn("setting lastTowerControlGroup to control group of start snapped entity " + cmd.startSnappedEntity + ": " + lastTowerControlGroup);
|    |1261|+		// warn("setting lastTowerControlGroup to control group of start snapped entity " + cmd.startSnappedEntity + ": " + lastTowerControlGroup);
|1262|1262| 	}
|1263|1263| 
|1264|1264| 	var i = 0;
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1275|1275| 		// 'lastTowerControlGroup' must always be defined and valid here, except if we're at the first piece and we didn't do
|1276|1276| 		// start position snapping (implying that the first entity we build must be a tower)
|1277|1277| 		if (lastTowerControlGroup === null || lastTowerControlGroup == INVALID_ENTITY)
|1278|    |-		{
|    |1278|+		
|1279|1279| 			if (!(i == 0 && piece.template == cmd.wallSet.templates.tower && !cmd.startSnappedEntity))
|1280|1280| 			{
|1281|1281|     			error("[TryConstructWall] Expected last tower control group to be available, none found (1st pass, iteration " + i + ")");
|1282|1282|     			break;
|1283|1283| 			}
|1284|    |-		}
|    |1284|+		
|1285|1285| 
|1286|1286| 		var constructPieceCmd = {
|1287|1287| 			"type": "construct",
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1322|1322| 
|1323|1323| 				if (i > 0)
|1324|1324| 				{
|1325|    |-					//warn("   updating previous wall piece's secondary control group to " + newTowerControlGroup);
|    |1325|+					// warn("   updating previous wall piece's secondary control group to " + newTowerControlGroup);
|1326|1326| 					var cmpPreviousObstruction = Engine.QueryInterface(pieces[i-1].ent, IID_Obstruction);
|1327|1327| 					// TODO: ensure that cmpPreviousObstruction exists
|1328|1328| 					// TODO: ensure that the previous obstruction does not yet have a secondary control group set
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1380|1380| 		}
|1381|1381| 
|1382|1382| 		if (piece.template == cmd.wallSet.templates.tower)
|1383|    |-		{
|    |1383|+		
|1384|1384| 			// encountered a tower entity, update the last tower control group
|1385|1385| 			lastTowerControlGroup = cmpPieceObstruction.GetControlGroup();
|1386|    |-		}
|    |1386|+		
|1387|1387| 		else
|1388|1388| 		{
|1389|1389| 			// Encountered a non-tower entity, update its secondary control group to 'lastTowerControlGroup'.
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1394|1394| 			if (existingSecondaryControlGroup == INVALID_ENTITY)
|1395|1395| 			{
|1396|1396| 				if (lastTowerControlGroup != null && lastTowerControlGroup != INVALID_ENTITY)
|1397|    |-				{
|    |1397|+				
|1398|1398| 					cmpPieceObstruction.SetControlGroup2(lastTowerControlGroup);
|1399|    |-				}
|    |1399|+				
|1400|1400| 			}
|1401|1401| 			else if (existingSecondaryControlGroup != lastTowerControlGroup)
|1402|1402| 			{
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1469|1469| 	}
|1470|1470| 
|1471|1471| 	if (formedEnts.length == 0)
|1472|    |-	{
|    |1472|+	
|1473|1473| 		// No units support the formation - return all the others
|1474|1474| 		return nonformedUnitAIs;
|1475|    |-	}
|    |1475|+	
|1476|1476| 
|1477|1477| 	// Find what formations the formationable selected entities are currently in
|1478|1478| 	var formation = ExtractFormations(formedEnts);
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1485|1485| 		// Check that all its members are selected
|1486|1486| 		var fid = formationIds[0];
|1487|1487| 		var cmpFormation = Engine.QueryInterface(+fid, IID_Formation);
|1488|    |-		if (cmpFormation && cmpFormation.GetMemberCount() == formation.members[fid].length
|1489|    |-			&& cmpFormation.GetMemberCount() == formation.entities.length)
|    |1488|+		if (cmpFormation && cmpFormation.GetMemberCount() == formation.members[fid].length &&
|    |1489|+			cmpFormation.GetMemberCount() == formation.entities.length)
|1490|1490| 		{
|1491|1491| 			cmpFormation.DeleteTwinFormations();
|1492|1492| 			// The whole formation was selected, so reuse its controller for this command
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1517|1517| 					{
|1518|1518| 						var template = cmpUnitAI.GetFormationTemplate();
|1519|1519| 						if (lastFormationTemplate === undefined)
|1520|    |-						{
|    |1520|+						
|1521|1521| 							lastFormationTemplate = template;
|1522|    |-						}
|    |1522|+						
|1523|1523| 						else if (lastFormationTemplate != template)
|1524|1524| 						{
|1525|1525| 							lastFormationTemplate = undefined;
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1593|1593| 		for (var i = matrix.length - 1; i >= 0 && !closeClusters; --i)
|1594|1594| 			for (var j = i - 1; j >= 0 && !closeClusters; --j)
|1595|1595| 				if (matrix[i][j] < distSq)
|1596|    |-					closeClusters = [i,j];
|    |1596|+					closeClusters = [i, j];
|1597|1597| 
|1598|1598| 		// if no more close clusters found, just return all found clusters so far
|1599|1599| 		if (!closeClusters)
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1615|1615| 		}
|1616|1616| 		// remove the rows and columns in the matrix for the merged clusters,
|1617|1617| 		// and the clusters themselves from the cluster list
|1618|    |-		clusters.splice(closeClusters[0],1);
|    |1618|+		clusters.splice(closeClusters[0], 1);
|1619|1619| 		clusters.splice(closeClusters[1],1);
|1620|1620| 		matrix.splice(closeClusters[0],1);
|1621|1621| 		matrix.splice(closeClusters[1],1);
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1616|1616| 		// remove the rows and columns in the matrix for the merged clusters,
|1617|1617| 		// and the clusters themselves from the cluster list
|1618|1618| 		clusters.splice(closeClusters[0],1);
|1619|    |-		clusters.splice(closeClusters[1],1);
|    |1619|+		clusters.splice(closeClusters[1], 1);
|1620|1620| 		matrix.splice(closeClusters[0],1);
|1621|1621| 		matrix.splice(closeClusters[1],1);
|1622|1622| 		for (let i = 0; i < matrix.length; ++i)
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1617|1617| 		// and the clusters themselves from the cluster list
|1618|1618| 		clusters.splice(closeClusters[0],1);
|1619|1619| 		clusters.splice(closeClusters[1],1);
|1620|    |-		matrix.splice(closeClusters[0],1);
|    |1620|+		matrix.splice(closeClusters[0], 1);
|1621|1621| 		matrix.splice(closeClusters[1],1);
|1622|1622| 		for (let i = 0; i < matrix.length; ++i)
|1623|1623| 		{
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1618|1618| 		clusters.splice(closeClusters[0],1);
|1619|1619| 		clusters.splice(closeClusters[1],1);
|1620|1620| 		matrix.splice(closeClusters[0],1);
|1621|    |-		matrix.splice(closeClusters[1],1);
|    |1621|+		matrix.splice(closeClusters[1], 1);
|1622|1622| 		for (let i = 0; i < matrix.length; ++i)
|1623|1623| 		{
|1624|1624| 			if (matrix[i].length > closeClusters[0])
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1622|1622| 		for (let i = 0; i < matrix.length; ++i)
|1623|1623| 		{
|1624|1624| 			if (matrix[i].length > closeClusters[0])
|1625|    |-				matrix[i].splice(closeClusters[0],1);
|    |1625|+				matrix[i].splice(closeClusters[0], 1);
|1626|1626| 			if (matrix[i].length > closeClusters[1])
|1627|1627| 				matrix[i].splice(closeClusters[1],1);
|1628|1628| 		}
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/Commands.js
|1624|1624| 			if (matrix[i].length > closeClusters[0])
|1625|1625| 				matrix[i].splice(closeClusters[0],1);
|1626|1626| 			if (matrix[i].length > closeClusters[1])
|1627|    |-				matrix[i].splice(closeClusters[1],1);
|    |1627|+				matrix[i].splice(closeClusters[1], 1);
|1628|1628| 		}
|1629|1629| 		// add a new row of distances to the matrix and the new cluster
|1630|1630| 		clusters.push(newCluster);

binaries/data/mods/public/simulation/helpers/Commands.js
| 796| »   »   let·ent·=·pickRandom(cmpRangeManager.GetEntitiesByPlayer(cmd.player).filter(ent·=>·{
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'ent' is already declared in the upper scope.

binaries/data/mods/public/simulation/helpers/Commands.js
|1281| ····»   »   »   error("[TryConstructWall]·Expected·last·tower·control·group·to·be·available,·none·found·(1st·pass,·iteration·"·+·i·+·")");
|    | [NORMAL] ESLintBear (no-mixed-spaces-and-tabs):
|    | Mixed spaces and tabs.

binaries/data/mods/public/simulation/helpers/Commands.js
|1282| ····»   »   »   break;
|    | [NORMAL] ESLintBear (no-mixed-spaces-and-tabs):
|    | Mixed spaces and tabs.

binaries/data/mods/public/simulation/helpers/Commands.js
|1512| »   »   »   »   var·lastFormationTemplate·=·undefined;
|    | [NORMAL] ESLintBear (no-undef-init):
|    | It's not necessary to initialize 'lastFormationTemplate' to undefined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1591| »   »   var·closeClusters·=·undefined;
|    | [NORMAL] ESLintBear (no-undef-init):
|    | It's not necessary to initialize 'closeClusters' to undefined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1608| »   »   for·(let·i·=·0;·i·<·clusters.length;·++i)
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'i' is already declared in the upper scope.

binaries/data/mods/public/simulation/helpers/Commands.js
|1622| »   »   for·(let·i·=·0;·i·<·matrix.length;·++i)
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'i' is already declared in the upper scope.

binaries/data/mods/public/simulation/helpers/Commands.js
|  53| var·g_Commands·=·{
|    | [NORMAL] JSHintBear:
|    | 'g_Commands' was used before it was defined.

binaries/data/mods/public/simulation/helpers/Commands.js
| 548| »   »   »   »   ····&&·player·!=·+cmd.owner)
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/helpers/Commands.js
| 736| »   »   »   »   var·cmpGUIInterface·=·Engine.QueryInterface(SYSTEM_ENTITY,·IID_GuiInterface);
|    | [NORMAL] JSHintBear:
|    | 'cmpGUIInterface' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
| 955| »   »   for·(var·i·=·0;·i·<·length;·++i)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
| 968| »   »   var·count·=·0;
|    | [NORMAL] JSHintBear:
|    | 'count' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1115| »   »   var·cmpGuiInterface·=·Engine.QueryInterface(SYSTEM_ENTITY,·IID_GuiInterface);
|    | [NORMAL] JSHintBear:
|    | 'cmpGuiInterface' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1367| »   »   var·piece·=·pieces[j];
|    | [NORMAL] JSHintBear:
|    | 'piece' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1450| »   »   var·cmpUnitAI·=·Engine.QueryInterface(ent,·IID_UnitAI);
|    | [NORMAL] JSHintBear:
|    | 'cmpUnitAI' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1489| »   »   »   &&·cmpFormation.GetMemberCount()·==·formation.entities.length)
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/helpers/Commands.js
|1515| »   »   »   »   »   var·cmpUnitAI·=·Engine.QueryInterface(ent,·IID_UnitAI);
|    | [NORMAL] JSHintBear:
|    | 'cmpUnitAI' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1548| »   »   »   var·cmpFormation·=·Engine.QueryInterface(formationEnt,·IID_Formation);
|    | [NORMAL] JSHintBear:
|    | 'cmpFormation' is already defined.
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 356| 356| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 357| 357| 		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 358| 358| 		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 359|    |-		{
|    | 359|+		
| 360| 360| 			// we were already on the shoreline, and have not moved since
| 361| 361| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
| 362| 362| 				needToMove = false;
| 363|    |-		}
|    | 363|+		
| 364| 364| 
| 365| 365| 		if (needToMove)
| 366| 366| 			this.SetNextState("INDIVIDUAL.PICKUP.APPROACHING");
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 354| 354| 		// Check if we need to move     TODO implement a better way to know if we are on the shoreline
| 355| 355| 		var needToMove = true;
| 356| 356| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 357|    |-		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 358|    |-		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
|    | 357|+		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x) &&
|    | 358|+		    (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 359| 359| 		{
| 360| 360| 			// we were already on the shoreline, and have not moved since
| 361| 361| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 519| 519| 					this.PushOrderFront("Walk", this.order.data.lastPos);
| 520| 520| 				}
| 521| 521| 				else
| 522|    |-				{
|    | 522|+				
| 523| 523| 					// We couldn't move there, or the target moved away
| 524| 524| 					this.FinishOrder();
| 525|    |-				}
|    | 525|+				
| 526| 526| 				return;
| 527| 527| 			}
| 528| 528| 
|    | [NORMAL] ESLintBear (space-in-parens):
|    | There should be no spaces inside this paren.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 648| 648| 		if (!cmpPosition || !cmpPosition.IsInWorld())
| 649| 649| 			return;
| 650| 650| 		this.ScoutingBeginPosition = cmpPosition.GetPosition2D();
| 651|    |-		warn("Sent scouting from: " + uneval(this.ScoutingBeginPosition) ); // Remove when done
|    | 651|+		warn("Sent scouting from: " + uneval(this.ScoutingBeginPosition)); // Remove when done
| 652| 652| 		this.SetNextState("INDIVIDUAL.SCOUTING");
| 653| 653| 	},
| 654| 654| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 744| 744| 			}
| 745| 745| 			// Check if we are already in range, otherwise walk there
| 746| 746| 			if (!this.CheckGarrisonRange(msg.data.target))
| 747|    |-			{
|    | 747|+			
| 748| 748| 				if (!this.CheckTargetVisible(msg.data.target))
| 749| 749| 				{
| 750| 750| 					this.FinishOrder();
| 755| 755| 					this.SetNextState("GARRISON.APPROACHING");
| 756| 756| 					return;
| 757| 757| 				}
| 758|    |-			}
|    | 758|+			
| 759| 759| 
| 760| 760| 			this.SetNextState("GARRISON.GARRISONING");
| 761| 761| 		},
|    | [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
| 750| 750| 					this.FinishOrder();
| 751| 751| 					return;
| 752| 752| 				}
| 753|    |-				else
| 754|    |-				{
|    | 753|+				
| 755| 754| 					this.SetNextState("GARRISON.APPROACHING");
| 756| 755| 					return;
| 757|    |-				}
|    | 756|+				
| 758| 757| 			}
| 759| 758| 
| 760| 759| 			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
| 773| 773| 						this.PushOrderFront("Walk", msg.data.lastPos);
| 774| 774| 					}
| 775| 775| 					else
| 776|    |-					{
|    | 776|+					
| 777| 777| 						// We couldn't move there, or the target moved away
| 778| 778| 						this.FinishOrder();
| 779|    |-					}
|    | 779|+					
| 780| 780| 					return;
| 781| 781| 				}
| 782| 782| 
|    | [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
|1021|1021| 			},
|1022|1022| 		},
|1023|1023| 
|1024|    |-		"GARRISON":{
|    |1024|+		"GARRISON": {
|1025|1025| 			"enter": function() {
|1026|1026| 				// If the garrisonholder should pickup, warn it so it can take needed action
|1027|1027| 				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
|1241|1241| 			// If the controller handled an order but some members rejected it,
|1242|1242| 			// they will have no orders and be in the FORMATIONMEMBER.IDLE state.
|1243|1243| 			if (this.orderQueue.length)
|1244|    |-			{
|    |1244|+			
|1245|1245| 				// We're leaving the formation, so stop our FormationWalk order
|1246|1246| 				if (this.FinishOrder())
|1247|1247| 					return;
|1248|    |-			}
|    |1248|+			
|1249|1249| 
|1250|1250| 			// No orders left, we're an individual now
|1251|1251| 			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
|1269|1269| 			// Move a tile outside the building
|1270|1270| 			let range = 4;
|1271|1271| 			if (this.CheckTargetRangeExplicit(msg.data.target, range, range))
|1272|    |-			{
|    |1272|+			
|1273|1273| 				// We are already at the target, or can't move at all
|1274|1274| 				this.FinishOrder();
|1275|    |-			}
|    |1275|+			
|1276|1276| 			else
|1277|1277| 			{
|1278|1278| 				this.order.data.min = range;
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 4 tabs but found 0.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1445|1445| 				let targetPos;
|1446|1446| 				let mapSize = cmpTerrain.GetMapSize();
|1447|1447| 				let distancePerIteration = 20;
|1448|    |-warn(uneval(mapSize)+" "+uneval(cmpTerrain.GetTilesPerSide()) + " " + uneval(Math.ceil(mapSize/distancePerIteration)) );
|    |1448|+				warn(uneval(mapSize)+" "+uneval(cmpTerrain.GetTilesPerSide()) + " " + uneval(Math.ceil(mapSize/distancePerIteration)) );
|1449|1449| 				warn("Phase 1."); // Remove when done.
|1450|1450| 
|1451|1451| 				let imax = Math.ceil(mapSize/distancePerIteration); // Number of primary iterations to be done.
|    | [NORMAL] ESLintBear (space-in-parens):
|    | There should be no spaces inside this paren.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1445|1445| 				let targetPos;
|1446|1446| 				let mapSize = cmpTerrain.GetMapSize();
|1447|1447| 				let distancePerIteration = 20;
|1448|    |-warn(uneval(mapSize)+" "+uneval(cmpTerrain.GetTilesPerSide()) + " " + uneval(Math.ceil(mapSize/distancePerIteration)) );
|    |1448|+warn(uneval(mapSize)+" "+uneval(cmpTerrain.GetTilesPerSide()) + " " + uneval(Math.ceil(mapSize/distancePerIteration)));
|1449|1449| 				warn("Phase 1."); // Remove when done.
|1450|1450| 
|1451|1451| 				let imax = Math.ceil(mapSize/distancePerIteration); // Number of primary iterations to be done.
|    | [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
|1451|1451| 				let imax = Math.ceil(mapSize/distancePerIteration); // Number of primary iterations to be done.
|1452|1452| 				for (let i = 1; i < imax; ++i)
|1453|1453| 				{
|1454|    |-					//warn("Primary Iteration: " + i); // Remove when done.
|    |1454|+					// warn("Primary Iteration: " + i); // Remove when done.
|1455|1455| 
|1456|1456| 					let dist = visionRange + randFloat(0.8, 1.2) * distancePerIteration * i;
|1457|1457| 
|    | [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
|1466|1466| 					let jmax = 5; // Number of secondary iterations to be done.
|1467|1467| 					for (let j = 0; j < jmax*i; ++j)
|1468|1468| 					{
|1469|    |-						//warn("Secondary Iteration: " + j); // Remove when done.
|    |1469|+						// warn("Secondary Iteration: " + j); // Remove when done.
|1470|1470| 
|1471|1471| 						ang = randStartAngle + rotationDirection * 2 * Math.PI * j / jmax * randFloat(0.8, 1.2);
|1472|1472| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 8 tabs but found 0.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1478|1478| 							let tileOwner = cmpTerritoryManager.GetOwner(x, y);
|1479|1479| 							if (!tileOwner || !cmpPlayer.IsEnemy(tileOwner))
|1480|1480| 							{
|1481|    |-warn("Iteration (" + i + ", " + j + ")."); // Remove when done.
|    |1481|+								warn("Iteration (" + i + ", " + j + ")."); // Remove when done.
|1482|1482| 
|1483|1483| 								targetPos = {"x": x, "y": y};
|1484|1484| 								break;
|    | [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
|1480|1480| 							{
|1481|1481| warn("Iteration (" + i + ", " + j + ")."); // Remove when done.
|1482|1482| 
|1483|    |-								targetPos = {"x": x, "y": y};
|    |1483|+								targetPos = { "x": x, "y": y};
|1484|1484| 								break;
|1485|1485| 							}
|1486|1486| 						}
|    | [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
|1480|1480| 							{
|1481|1481| warn("Iteration (" + i + ", " + j + ")."); // Remove when done.
|1482|1482| 
|1483|    |-								targetPos = {"x": x, "y": y};
|    |1483|+								targetPos = {"x": x, "y": y };
|1484|1484| 								break;
|1485|1485| 							}
|1486|1486| 						}
|    | [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
|1497|1497| 					if (!this.CheckPointRangeExplicit(this.ScoutingBeginPosition.x, this.ScoutingBeginPosition.y))
|1498|1498| 					{
|1499|1499| 						this.MoveToPoint(this.ScoutingBeginPosition.x, this.ScoutingBeginPosition.y);
|1500|    |-						this.order.data = {"x": this.ScoutingBeginPosition.x, "z":  this.ScoutingBeginPosition.y};
|    |1500|+						this.order.data = { "x": this.ScoutingBeginPosition.x, "z":  this.ScoutingBeginPosition.y};
|1501|1501| 						this.SetNextState("WALKING");
|1502|1502| 						this.SelectAnimation("move");
|1503|1503| 						return true;
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space before value for key 'z'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1497|1497| 					if (!this.CheckPointRangeExplicit(this.ScoutingBeginPosition.x, this.ScoutingBeginPosition.y))
|1498|1498| 					{
|1499|1499| 						this.MoveToPoint(this.ScoutingBeginPosition.x, this.ScoutingBeginPosition.y);
|1500|    |-						this.order.data = {"x": this.ScoutingBeginPosition.x, "z":  this.ScoutingBeginPosition.y};
|    |1500|+						this.order.data = {"x": this.ScoutingBeginPosition.x, "z": this.ScoutingBeginPosition.y};
|1501|1501| 						this.SetNextState("WALKING");
|1502|1502| 						this.SelectAnimation("move");
|1503|1503| 						return true;
|    | [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
|1497|1497| 					if (!this.CheckPointRangeExplicit(this.ScoutingBeginPosition.x, this.ScoutingBeginPosition.y))
|1498|1498| 					{
|1499|1499| 						this.MoveToPoint(this.ScoutingBeginPosition.x, this.ScoutingBeginPosition.y);
|1500|    |-						this.order.data = {"x": this.ScoutingBeginPosition.x, "z":  this.ScoutingBeginPosition.y};
|    |1500|+						this.order.data = {"x": this.ScoutingBeginPosition.x, "z":  this.ScoutingBeginPosition.y };
|1501|1501| 						this.SetNextState("WALKING");
|1502|1502| 						this.SelectAnimation("move");
|1503|1503| 						return true;
|    | [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
|1509|1509| 
|1510|1510| 					if (!this.MoveToPoint(targetPos.x, targetPos.y))
|1511|1511| 					{
|1512|    |-						warn("Target not reachable!") // Remove when done
|    |1512|+						warn("Target not reachable!"); // Remove when done
|1513|1513| 						this.FinishOrder();
|1514|1514| 						return true;
|1515|1515| 					}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1612|1612| 
|1613|1613| 			"LosRangeUpdate": function(msg) {
|1614|1614| 				if (this.GetStance().targetVisibleEnemies)
|1615|    |-				{
|    |1615|+				
|1616|1616| 					// Start attacking one of the newly-seen enemy (if any)
|1617|1617| 					this.AttackEntitiesByPreference(msg.data.added);
|1618|    |-				}
|    |1618|+				
|1619|1619| 			},
|1620|1620| 
|1621|1621| 			"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
|1649|1649| 				this.SelectAnimation("move");
|1650|1650| 			},
|1651|1651| 
|1652|    |-			"leave": function () {
|    |1652|+			"leave": function() {
|1653|1653| 				this.SelectAnimation("idle");
|1654|1654| 				this.StopMoving();
|1655|1655| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1826|1826| 						// if nothing better to do, check if the guarded needs to be healed or repaired
|1827|1827| 						var cmpHealth = Engine.QueryInterface(this.isGuardOf, IID_Health);
|1828|1828| 						if (cmpHealth && cmpHealth.IsInjured())
|1829|    |-						{
|    |1829|+						
|1830|1830| 							if (this.CanHeal(this.isGuardOf))
|1831|1831| 								this.PushOrderFront("Heal", { "target": this.isGuardOf, "force": false });
|1832|1832| 							else if (this.CanRepair(this.isGuardOf))
|1833|1833| 								this.PushOrderFront("Repair", { "target": this.isGuardOf, "autocontinue": false, "force": false });
|1834|    |-						}
|    |1834|+						
|1835|1835| 					}
|1836|1836| 				},
|1837|1837| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1929|1929| 				"MoveCompleted": function() {
|1930|1930| 
|1931|1931| 					if (this.CheckTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1932|    |-					{
|    |1932|+					
|1933|1933| 						// If the unit needs to unpack, do so
|1934|1934| 						if (this.CanUnpack())
|1935|1935| 						{
|1938|1938| 						}
|1939|1939| 						else
|1940|1940| 							this.SetNextState("ATTACKING");
|1941|    |-					}
|    |1941|+					
|1942|1942| 					else
|1943|1943| 					{
|1944|1944| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1936|1936| 							this.PushOrderFront("Unpack", { "force": true });
|1937|1937| 							return;
|1938|1938| 						}
|1939|    |-						else
|1940|    |-							this.SetNextState("ATTACKING");
|    |1939|+						this.SetNextState("ATTACKING");
|1941|1940| 					}
|1942|1941| 					else
|1943|1942| 					{
|    | [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
|1940|1940| 							this.SetNextState("ATTACKING");
|1941|1941| 					}
|1942|1942| 					else
|1943|    |-					{
|    |1943|+					
|1944|1944| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1945|1945| 						{
|1946|1946| 							this.SetNextState("APPROACHING");
|1950|1950| 							// Give up
|1951|1951| 							this.FinishOrder();
|1952|1952| 						}
|1953|    |-					}
|    |1953|+					
|1954|1954| 				},
|1955|1955| 			},
|1956|1956| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1942|1942| 					else
|1943|1943| 					{
|1944|1944| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1945|    |-						{
|    |1945|+						
|1946|1946| 							this.SetNextState("APPROACHING");
|1947|    |-						}
|    |1947|+						
|1948|1948| 						else
|1949|1949| 						{
|1950|1950| 							// Give up
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1946|1946| 							this.SetNextState("APPROACHING");
|1947|1947| 						}
|1948|1948| 						else
|1949|    |-						{
|    |1949|+						
|1950|1950| 							// Give up
|1951|1951| 							this.FinishOrder();
|1952|    |-						}
|    |1952|+						
|1953|1953| 					}
|1954|1954| 				},
|1955|1955| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1967|1967| 					}
|1968|1968| 					// Check the target is still alive and attackable
|1969|1969| 					if (this.CanAttack(target) && !this.CheckTargetAttackRange(target, this.order.data.attackType))
|1970|    |-					{
|    |1970|+					
|1971|1971| 						// Can't reach it - try to chase after it
|1972|1972| 						if (this.ShouldChaseTargetedEntity(target, this.order.data.force))
|1973|1973| 						{
|1982|1982| 								return true;
|1983|1983| 							}
|1984|1984| 						}
|1985|    |-					}
|    |1985|+					
|1986|1986| 
|1987|1987| 					this.StopMoving();
|1988|1988| 
|    | [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
|2015|2015| 					// TODO: we should probably only bother syncing projectile attacks, not melee
|2016|2016| 
|2017|2017| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2018|    |-					this.resyncAnimation = (prepare != this.attackTimers.prepare) ? true : false;
|    |2018|+					this.resyncAnimation = (prepare != this.attackTimers.prepare);
|2019|2019| 
|2020|2020| 					this.FaceTowardsTarget(this.order.data.target);
|2021|2021| 
|    | [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
|2144|2144| 
|2145|2145| 				"Attacked": function(msg) {
|2146|2146| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2147|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2148|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2147|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2148|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2149|2149| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2150|2150| 				},
|2151|2151| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2164|2164| 					this.SelectAnimation("move");
|2165|2165| 					var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|2166|2166| 					if (cmpUnitAI && cmpUnitAI.IsFleeing())
|2167|    |-					{
|    |2167|+					
|2168|2168| 						// Run after a fleeing target
|2169|2169| 						this.SetSpeedMultiplier(this.GetRunMultiplier());
|2170|    |-					}
|    |2170|+					
|2171|2171| 					this.StartTimer(1000, 1000);
|2172|2172| 				},
|2173|2173| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/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| 
|2348|2348| 					var cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply);
|2349|2349| 					if (cmpSupply && cmpSupply.IsAvailable(cmpOwnership.GetOwner(), this.entity))
|2350|    |-					{
|    |2350|+					
|2351|2351| 						// Check we can still reach and gather from the target
|2352|2352| 						if (this.CheckTargetRange(this.gatheringTarget, IID_ResourceGatherer) && this.CanGather(this.gatheringTarget))
|2353|2353| 						{
|2412|2412| 								return;
|2413|2413| 							}
|2414|2414| 						}
|2415|    |-					}
|    |2415|+					
|2416|2416| 
|2417|2417| 					// We're already in range, can't get anywhere near it or the target is exhausted.
|2418|2418| 
|    | [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
|2438|2438| 					// Also don't switch to a different type of huntable animal
|2439|2439| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2440|2440| 						return (
|2441|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2442|    |-							|| (type.specific == resourceType.specific
|    |2441|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2442|+							(type.specific == resourceType.specific
|2443|2443| 							&& (type.specific != "meat" || resourceTemplate == template))
|2444|2444| 						);
|2445|2445| 					});
|    | [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
|2439|2439| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2440|2440| 						return (
|2441|2441| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2442|    |-							|| (type.specific == resourceType.specific
|2443|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2442|+							|| (type.specific == resourceType.specific &&
|    |2443|+							(type.specific != "meat" || resourceTemplate == template))
|2444|2444| 						);
|2445|2445| 					});
|2446|2446| 					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
|2504|2504| 
|2505|2505| 				"Timer": function(msg) {
|2506|2506| 					if (this.ShouldAbandonChase(this.order.data.target, this.order.data.force, IID_Heal, null))
|2507|    |-					{
|    |2507|+					
|2508|2508| 						// Return to our original position unless we have a better order.
|2509|2509| 						if (!this.FinishOrder() && this.GetStance().respondHoldGround)
|2510|2510| 							this.WalkToHeldPosition();
|2511|    |-					}
|    |2511|+					
|2512|2512| 				},
|2513|2513| 
|2514|2514| 				"MoveCompleted": function() {
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2538|2538| 					this.StartTimer(prepare, this.healTimers.repeat);
|2539|2539| 
|2540|2540| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2541|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2541|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2542|2542| 
|2543|2543| 					this.FaceTowardsTarget(this.order.data.target);
|2544|2544| 				},
|    | [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
|2750|2750| 					{
|2751|2751| 						// The building was already finished/fully repaired before we arrived;
|2752|2752| 						// let the ConstructionFinished handler handle this.
|2753|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2753|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2754|2754| 						return true;
|2755|2755| 					}
|2756|2756| 
|    | [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
|2750|2750| 					{
|2751|2751| 						// The building was already finished/fully repaired before we arrived;
|2752|2752| 						// let the ConstructionFinished handler handle this.
|2753|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2753|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2754|2754| 						return true;
|2755|2755| 					}
|2756|2756| 
|    | [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
|2793|2793| 					if (!inRange && this.MoveToTargetRange(this.repairTarget, IID_Builder))
|2794|2794| 						this.SetNextState("APPROACHING");
|2795|2795| 					else if (!inRange)
|2796|    |-						this.FinishOrder(); //can't approach and isn't in reach
|    |2796|+						this.FinishOrder(); // can't approach and isn't in reach
|2797|2797| 				},
|2798|2798| 			},
|2799|2799| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2880|2880| 
|2881|2881| 				// Unit was approaching and there's nothing to do now, so switch to walking
|2882|2882| 				if (oldState === "INDIVIDUAL.REPAIR.APPROACHING")
|2883|    |-				{
|    |2883|+				
|2884|2884| 					// We're already walking to the given point, so add this as a order.
|2885|2885| 					this.WalkToTarget(msg.data.newentity, true);
|2886|    |-				}
|    |2886|+				
|2887|2887| 			},
|2888|2888| 		},
|2889|2889| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2942|2942| 
|2943|2943| 					// Check that we can garrison here
|2944|2944| 					if (this.CanGarrison(target))
|2945|    |-					{
|    |2945|+					
|2946|2946| 						// Check that we're in range of the garrison target
|2947|2947| 						if (this.CheckGarrisonRange(target))
|2948|2948| 						{
|3018|3018| 								return false;
|3019|3019| 							}
|3020|3020| 						}
|3021|    |-					}
|    |3021|+					
|3022|3022| 					// Garrisoning failed for some reason, so finish the order
|3023|3023| 					this.FinishOrder();
|3024|3024| 					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
|3139|3139| 		"Attacked": function(msg) {
|3140|3140| 			if (this.template.NaturalBehaviour == "skittish" ||
|3141|3141| 			    this.template.NaturalBehaviour == "passive")
|3142|    |-			{
|    |3142|+			
|3143|3143| 				this.Flee(msg.data.attacker, false);
|3144|    |-			}
|    |3144|+			
|3145|3145| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|3146|3146| 			{
|3147|3147| 				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
|3148|3148| 					this.Attack(msg.data.attacker, false);
|3149|3149| 			}
|3150|3150| 			else if (this.template.NaturalBehaviour == "domestic")
|3151|    |-			{
|    |3151|+			
|3152|3152| 				// Never flee, stop what we were doing
|3153|3153| 				this.SetNextState("IDLE");
|3154|    |-			}
|    |3154|+			
|3155|3155| 		},
|3156|3156| 
|3157|3157| 		"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
|3162|3162| 				this.FinishOrder();
|3163|3163| 				return;
|3164|3164| 			}
|3165|    |-			else
|3166|    |-			{
|    |3165|+			
|3167|3166| 				this.order.data.min = range;
|3168|3167| 				this.SetNextState("WALKING");
|3169|    |-			}
|    |3168|+			
|3170|3169| 		},
|3171|3170| 
|3172|3171| 		"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
|3206|3206| 				}
|3207|3207| 				// Start attacking one of the newly-seen enemy (if any)
|3208|3208| 				else if (this.IsDangerousAnimal())
|3209|    |-				{
|    |3209|+				
|3210|3210| 					this.AttackVisibleEntity(msg.data.added);
|3211|    |-				}
|    |3211|+				
|3212|3212| 
|3213|3213| 				// TODO: if two units enter our range together, we'll attack the
|3214|3214| 				// 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
|3249|3249| 				}
|3250|3250| 				// Start attacking one of the newly-seen enemy (if any)
|3251|3251| 				else if (this.template.NaturalBehaviour == "violent")
|3252|    |-				{
|    |3252|+				
|3253|3253| 					this.AttackVisibleEntity(msg.data.added);
|3254|    |-				}
|    |3254|+				
|3255|3255| 			},
|3256|3256| 
|3257|3257| 			"MoveCompleted": function() { },
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 7.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3266|3266| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3267|3267| 
|3268|3268| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3269|    |-							// only used for domestic animals
|    |3269|+		// only used for domestic animals
|3270|3270| 	},
|3271|3271| };
|3272|3272| 
|    | [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
|3323|3323| 
|3324|3324| UnitAI.prototype.IsAnimal = function()
|3325|3325| {
|3326|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3326|+	return (!!this.template.NaturalBehaviour);
|3327|3327| };
|3328|3328| 
|3329|3329| 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
|3361|3361| UnitAI.prototype.GetGarrisonHolder = function()
|3362|3362| {
|3363|3363| 	if (this.IsGarrisoned())
|3364|    |-	{
|    |3364|+	
|3365|3365| 		for (let order of this.orderQueue)
|3366|3366| 			if (order.type == "Garrison")
|3367|3367| 				return order.data.target;
|3368|    |-	}
|    |3368|+	
|3369|3369| 	return INVALID_ENTITY;
|3370|3370| };
|3371|3371| 
|    | [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
|3439|3439| 		{
|3440|3440| 			let index = this.GetCurrentState().indexOf(".");
|3441|3441| 			if (index != -1)
|3442|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3442|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3443|3443| 			this.Stop(false);
|3444|3444| 		}
|3445|3445| 
|    | [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
|3495|3495| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3496|3496| 			continue;
|3497|3497| 		if (i == 0)
|3498|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3498|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3499|3499| 		else
|3500|3500| 			this.orderQueue.splice(i, 1);
|3501|3501| 		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
|3495|3495| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3496|3496| 			continue;
|3497|3497| 		if (i == 0)
|3498|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3498|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3499|3499| 		else
|3500|3500| 			this.orderQueue.splice(i, 1);
|3501|3501| 		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
|3579|3579| };
|3580|3580| 
|3581|3581| 
|3582|    |-//// FSM linkage functions ////
|    |3582|+// // FSM linkage functions ////
|3583|3583| 
|3584|3584| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3585|3585| 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
|3751|3751| 				continue;
|3752|3752| 			if (this.orderQueue[i].type == type)
|3753|3753| 				continue;
|3754|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3754|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3755|3755| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3756|3756| 			return;
|3757|3757| 		}
|    | [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
|3751|3751| 				continue;
|3752|3752| 			if (this.orderQueue[i].type == type)
|3753|3753| 				continue;
|3754|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3754|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3755|3755| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3756|3756| 			return;
|3757|3757| 		}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3765|3765| {
|3766|3766| 	// Remember the previous work orders to be able to go back to them later if required
|3767|3767| 	if (data && data.force)
|3768|    |-	{
|    |3768|+	
|3769|3769| 		if (this.IsFormationController())
|3770|3770| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3771|3771| 		else
|3772|3772| 			this.UpdateWorkOrders(type);
|3773|    |-	}
|    |3773|+	
|3774|3774| 
|3775|3775| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3776|3776| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3842|3842| 	{
|3843|3843| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3844|3844| 		if (cmpUnitAI)
|3845|    |-		{
|    |3845|+		
|3846|3846| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3847|3847| 			{
|3848|3848| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3851|3851| 					return;
|3852|3852| 				}
|3853|3853| 			}
|3854|    |-		}
|    |3854|+		
|3855|3855| 	}
|3856|3856| 
|3857|3857| 	// 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
|3844|3844| 		if (cmpUnitAI)
|3845|3845| 		{
|3846|3846| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3847|    |-			{
|    |3847|+			
|3848|3848| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3849|3849| 				{
|3850|3850| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3851|3851| 					return;
|3852|3852| 				}
|3853|    |-			}
|    |3853|+			
|3854|3854| 		}
|3855|3855| 	}
|3856|3856| 
|    | [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
|3856|3856| 
|3857|3857| 	// If nothing found, take the unit orders
|3858|3858| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3859|    |-	{
|    |3859|+	
|3860|3860| 		if (isWorkType(this.orderQueue[i].type))
|3861|3861| 		{
|3862|3862| 			this.workOrders = this.orderQueue.slice(i);
|3863|3863| 			return;
|3864|3864| 		}
|3865|    |-	}
|    |3865|+	
|3866|3866| };
|3867|3867| 
|3868|3868| 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
|3922|3922| 	if (data.timerRepeat === undefined)
|3923|3923| 		this.timer = undefined;
|3924|3924| 
|3925|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3925|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3926|3926| };
|3927|3927| 
|3928|3928| /**
|    | [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
|3922|3922| 	if (data.timerRepeat === undefined)
|3923|3923| 		this.timer = undefined;
|3924|3924| 
|3925|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3925|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3926|3926| };
|3927|3927| 
|3928|3928| /**
|    | [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
|3957|3957| 	this.timer = undefined;
|3958|3958| };
|3959|3959| 
|3960|    |-//// Message handlers /////
|    |3960|+// // Message handlers /////
|3961|3961| 
|3962|3962| UnitAI.prototype.OnMotionChanged = function(msg)
|3963|3963| {
|    | [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
|3962|3962| UnitAI.prototype.OnMotionChanged = function(msg)
|3963|3963| {
|3964|3964| 	if (msg.starting && !msg.error)
|3965|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3965|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveStarted", "data": msg});
|3966|3966| 	else if (!msg.starting || msg.error)
|3967|3967| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3968|3968| };
|    | [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
|3962|3962| UnitAI.prototype.OnMotionChanged = function(msg)
|3963|3963| {
|3964|3964| 	if (msg.starting && !msg.error)
|3965|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |3965|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg });
|3966|3966| 	else if (!msg.starting || msg.error)
|3967|3967| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|3968|3968| };
|    | [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
|3964|3964| 	if (msg.starting && !msg.error)
|3965|3965| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3966|3966| 	else if (!msg.starting || msg.error)
|3967|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3967|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveCompleted", "data": msg});
|3968|3968| };
|3969|3969| 
|3970|3970| UnitAI.prototype.OnGlobalConstructionFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3964|3964| 	if (msg.starting && !msg.error)
|3965|3965| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|3966|3966| 	else if (!msg.starting || msg.error)
|3967|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |3967|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg });
|3968|3968| };
|3969|3969| 
|3970|3970| UnitAI.prototype.OnGlobalConstructionFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3972|3972| 	// TODO: This is a bit inefficient since every unit listens to every
|3973|3973| 	// construction message - ideally we could scope it to only the one we're building
|3974|3974| 
|3975|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3975|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3976|3976| };
|3977|3977| 
|3978|3978| 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
|3972|3972| 	// TODO: This is a bit inefficient since every unit listens to every
|3973|3973| 	// construction message - ideally we could scope it to only the one we're building
|3974|3974| 
|3975|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3975|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3976|3976| };
|3977|3977| 
|3978|3978| 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
|3997|3997| 
|3998|3998| UnitAI.prototype.OnAttacked = function(msg)
|3999|3999| {
|4000|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4000|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4001|4001| };
|4002|4002| 
|4003|4003| 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
|3997|3997| 
|3998|3998| UnitAI.prototype.OnAttacked = function(msg)
|3999|3999| {
|4000|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4000|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4001|4001| };
|4002|4002| 
|4003|4003| 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
|4002|4002| 
|4003|4003| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4004|4004| {
|4005|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4005|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4006|4006| };
|4007|4007| 
|4008|4008| 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
|4002|4002| 
|4003|4003| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4004|4004| {
|4005|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4005|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4006|4006| };
|4007|4007| 
|4008|4008| 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
|4007|4007| 
|4008|4008| UnitAI.prototype.OnHealthChanged = function(msg)
|4009|4009| {
|4010|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4010|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4011|4011| };
|4012|4012| 
|4013|4013| 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
|4007|4007| 
|4008|4008| UnitAI.prototype.OnHealthChanged = function(msg)
|4009|4009| {
|4010|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4010|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4011|4011| };
|4012|4012| 
|4013|4013| 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
|4013|4013| UnitAI.prototype.OnRangeUpdate = function(msg)
|4014|4014| {
|4015|4015| 	if (msg.tag == this.losRangeQuery)
|4016|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4016|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4017|4017| 	else if (msg.tag == this.losHealRangeQuery)
|4018|4018| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4019|4019| };
|    | [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
|4013|4013| UnitAI.prototype.OnRangeUpdate = function(msg)
|4014|4014| {
|4015|4015| 	if (msg.tag == this.losRangeQuery)
|4016|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4016|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4017|4017| 	else if (msg.tag == this.losHealRangeQuery)
|4018|4018| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4019|4019| };
|    | [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
|4015|4015| 	if (msg.tag == this.losRangeQuery)
|4016|4016| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4017|4017| 	else if (msg.tag == this.losHealRangeQuery)
|4018|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4018|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4019|4019| };
|4020|4020| 
|4021|4021| 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
|4015|4015| 	if (msg.tag == this.losRangeQuery)
|4016|4016| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4017|4017| 	else if (msg.tag == this.losHealRangeQuery)
|4018|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4018|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4019|4019| };
|4020|4020| 
|4021|4021| 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
|4020|4020| 
|4021|4021| UnitAI.prototype.OnPackFinished = function(msg)
|4022|4022| {
|4023|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4023|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4024|4024| };
|4025|4025| 
|4026|4026| //// 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
|4020|4020| 
|4021|4021| UnitAI.prototype.OnPackFinished = function(msg)
|4022|4022| {
|4023|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4023|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4024|4024| };
|4025|4025| 
|4026|4026| //// 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
|4023|4023| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4024|4024| };
|4025|4025| 
|4026|    |-//// Helper functions to be called by the FSM ////
|    |4026|+// // Helper functions to be called by the FSM ////
|4027|4027| 
|4028|4028| UnitAI.prototype.GetWalkSpeed = function()
|4029|4029| {
|    | [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
|4125|4125| 	if (!cmpOwnership || cmpOwnership.GetOwner() == INVALID_PLAYER)
|4126|4126| 		return undefined;
|4127|4127| 
|4128|    |-	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position)
|    |4128|+	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
|4129|4129| 	if (!cmpPosition || !cmpPosition.IsInWorld())
|4130|4130| 		return undefined;
|4131|4131| 
|    | [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
|4210|4210| 			PlaySound(name, member);
|4211|4211| 	}
|4212|4212| 	else
|4213|    |-	{
|    |4213|+	
|4214|4214| 		// Otherwise use our own sounds
|4215|4215| 		PlaySound(name, this.entity);
|4216|    |-	}
|    |4216|+	
|4217|4217| };
|4218|4218| 
|4219|4219| /*
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4306|4306| UnitAI.prototype.MoveTo = function(data, iid, type)
|4307|4307| {
|4308|4308| 	if (data["target"])
|4309|    |-	{
|    |4309|+	
|4310|4310| 		if (data["min"] || data["max"])
|4311|4311| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4312|4312| 		else
|4316|4316| 			else
|4317|4317| 				return this.MoveToTargetRange(data.target, iid, type);
|4318|4318| 		}
|4319|    |-	}
|    |4319|+	
|4320|4320| 	else
|4321|4321| 	{
|4322|4322| 		if (data["min"] || data["max"])
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["target"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4305|4305|  */
|4306|4306| UnitAI.prototype.MoveTo = function(data, iid, type)
|4307|4307| {
|4308|    |-	if (data["target"])
|    |4308|+	if (data.target)
|4309|4309| 	{
|4310|4310| 		if (data["min"] || data["max"])
|4311|4311| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["min"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4307|4307| {
|4308|4308| 	if (data["target"])
|4309|4309| 	{
|4310|    |-		if (data["min"] || data["max"])
|    |4310|+		if (data.min || data["max"])
|4311|4311| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4312|4312| 		else
|4313|4313| 		{
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["max"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4307|4307| {
|4308|4308| 	if (data["target"])
|4309|4309| 	{
|4310|    |-		if (data["min"] || data["max"])
|    |4310|+		if (data["min"] || data.max)
|4311|4311| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4312|4312| 		else
|4313|4313| 		{
|    | [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
|4310|4310| 		if (data["min"] || data["max"])
|4311|4311| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4312|4312| 		else
|4313|    |-		{
|    |4313|+		
|4314|4314| 			if (!iid)
|4315|4315| 				return this.MoveToTarget(data.target);
|4316|4316| 			else
|4317|4317| 				return this.MoveToTargetRange(data.target, iid, type);
|4318|    |-		}
|    |4318|+		
|4319|4319| 	}
|4320|4320| 	else
|4321|4321| 	{
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4309|4309| 	{
|4310|4310| 		if (data["min"] || data["max"])
|4311|4311| 			return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1);
|4312|    |-		else
|4313|    |-		{
|    |4312|+		
|4314|4313| 			if (!iid)
|4315|4314| 				return this.MoveToTarget(data.target);
|4316|4315| 			else
|4317|4316| 				return this.MoveToTargetRange(data.target, iid, type);
|4318|    |-		}
|    |4317|+		
|4319|4318| 	}
|4320|4319| 	else
|4321|4320| 	{
|    | [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
|4313|4313| 		{
|4314|4314| 			if (!iid)
|4315|4315| 				return this.MoveToTarget(data.target);
|4316|    |-			else
|4317|    |-				return this.MoveToTargetRange(data.target, iid, type);
|    |4316|+			return this.MoveToTargetRange(data.target, iid, type);
|4318|4317| 		}
|4319|4318| 	}
|4320|4319| 	else
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4318|4318| 		}
|4319|4319| 	}
|4320|4320| 	else
|4321|    |-	{
|    |4321|+	
|4322|4322| 		if (data["min"] || data["max"])
|4323|4323| 			return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1);
|4324|4324| 		else
|4325|4325| 			return this.MoveToPoint(data.x, data.z);
|4326|    |-	}
|    |4326|+	
|4327|4327| }
|4328|4328| 
|4329|4329| UnitAI.prototype.MoveToPoint = function(x, z)
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["min"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4319|4319| 	}
|4320|4320| 	else
|4321|4321| 	{
|4322|    |-		if (data["min"] || data["max"])
|    |4322|+		if (data.min || data["max"])
|4323|4323| 			return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1);
|4324|4324| 		else
|4325|4325| 			return this.MoveToPoint(data.x, data.z);
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["max"] is better written in dot notation.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4319|4319| 	}
|4320|4320| 	else
|4321|4321| 	{
|4322|    |-		if (data["min"] || data["max"])
|    |4322|+		if (data["min"] || data.max)
|4323|4323| 			return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1);
|4324|4324| 		else
|4325|4325| 			return this.MoveToPoint(data.x, data.z);
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4321|4321| 	{
|4322|4322| 		if (data["min"] || data["max"])
|4323|4323| 			return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1);
|4324|    |-		else
|4325|    |-			return this.MoveToPoint(data.x, data.z);
|    |4324|+		return this.MoveToPoint(data.x, data.z);
|4326|4325| 	}
|4327|4326| }
|4328|4327| 
|    | [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
|4324|4324| 		else
|4325|4325| 			return this.MoveToPoint(data.x, data.z);
|4326|4326| 	}
|4327|    |-}
|    |4327|+};
|4328|4328| 
|4329|4329| UnitAI.prototype.MoveToPoint = function(x, z)
|4330|4330| {
|    | [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
|4408|4408| 	else
|4409|4409| 		// return false? Or hope you come close enough?
|4410|4410| 		var parabolicMaxRange = 0;
|4411|    |-		//return false;
|    |4411|+		// return false;
|4412|4412| 
|4413|4413| 	// the parabole changes while walking, take something in the middle
|4414|4414| 	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
|4473|4473| 	if (this.IsFormationMember())
|4474|4474| 	{
|4475|4475| 		var cmpFormationUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|4476|    |-		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation()
|4477|    |-			&& cmpFormationUnitAI.order.data.target == target)
|    |4476|+		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation() &&
|    |4477|+			cmpFormationUnitAI.order.data.target == target)
|4478|4478| 			return true;
|4479|4479| 	}
|4480|4480| 
|    | [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
|4641|4641| UnitAI.prototype.AttackEntityInZone = function(ents)
|4642|4642| {
|4643|4643| 	var target = ents.find(target =>
|4644|    |-		this.CanAttack(target)
|4645|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4644|+		this.CanAttack(target) &&
|    |4645|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4646|4646| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4647|4647| 	);
|4648|4648| 	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
|4642|4642| {
|4643|4643| 	var target = ents.find(target =>
|4644|4644| 		this.CanAttack(target)
|4645|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4646|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4645|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4646|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4647|4647| 	);
|4648|4648| 	if (!target)
|4649|4649| 		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
|4706|4706| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4707|4707| 	if (this.isGuardOf)
|4708|4708| 	{
|4709|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4709|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4710|4710| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4711|4711| 		if (cmpUnitAI && cmpAttack &&
|4712|4712| 		    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
|4710|4710| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4711|4711| 		if (cmpUnitAI && cmpAttack &&
|4712|4712| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4713|    |-				return false;
|    |4713|+			return false;
|4714|4714| 	}
|4715|4715| 
|4716|4716| 	// 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
|4715|4715| 
|4716|4716| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4717|4717| 	if (this.GetStance().respondHoldGround)
|4718|    |-	{
|    |4718|+	
|4719|4719| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4720|4720| 			return true;
|4721|    |-	}
|    |4721|+	
|4722|4722| 
|4723|4723| 	// Stop if it's left our vision range, unless we're especially persistent
|4724|4724| 	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
|4722|4722| 
|4723|4723| 	// Stop if it's left our vision range, unless we're especially persistent
|4724|4724| 	if (!this.GetStance().respondChaseBeyondVision)
|4725|    |-	{
|    |4725|+	
|4726|4726| 		if (!this.CheckTargetIsInVisionRange(target))
|4727|4727| 			return true;
|4728|    |-	}
|    |4728|+	
|4729|4729| 
|4730|4730| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4731|4731| 	// 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
|4748|4748| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4749|4749| 	if (this.isGuardOf)
|4750|4750| 	{
|4751|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4751|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4752|4752| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4753|4753| 		if (cmpUnitAI && cmpAttack &&
|4754|4754| 		    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
|4761|4761| 	return false;
|4762|4762| };
|4763|4763| 
|4764|    |-//// External interface functions ////
|    |4764|+// // External interface functions ////
|4765|4765| 
|4766|4766| UnitAI.prototype.SetFormationController = function(ent)
|4767|4767| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4771|4771| 	// of our own formation (or ourself if not in formation)
|4772|4772| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4773|4773| 	if (cmpObstruction)
|4774|    |-	{
|    |4774|+	
|4775|4775| 		if (ent == INVALID_ENTITY)
|4776|4776| 			cmpObstruction.SetControlGroup(this.entity);
|4777|4777| 		else
|4778|4778| 			cmpObstruction.SetControlGroup(ent);
|4779|    |-	}
|    |4779|+	
|4780|4780| 
|4781|4781| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4782|4782| 	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
|4915|4915| 	// if we already had an old guard order, do nothing if the target is the same
|4916|4916| 	// and the order is running, otherwise remove the previous order
|4917|4917| 	if (this.isGuardOf)
|4918|    |-	{
|    |4918|+	
|4919|4919| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4920|4920| 			return;
|4921|4921| 		else
|4922|4922| 			this.RemoveGuard();
|4923|    |-	}
|    |4923|+	
|4924|4924| 
|4925|4925| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4926|4926| };
|    | [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
|4918|4918| 	{
|4919|4919| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4920|4920| 			return;
|4921|    |-		else
|4922|    |-			this.RemoveGuard();
|    |4921|+		this.RemoveGuard();
|4923|4922| 	}
|4924|4923| 
|4925|4924| 	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
|5098|5098| 			this.WalkToTarget(target, queued);
|5099|5099| 		return;
|5100|5100| 	}
|5101|    |-	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture}, queued);
|    |5101|+	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture }, queued);
|5102|5102| };
|5103|5103| 
|5104|5104| /**
|    | [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
|5247|5247| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5248|5248| 	{
|5249|5249| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5250|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5250|+		if (cmpTrader.HasBothMarkets() &&
|5251|5251| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5252|5252| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5253|5253| 		{
|    | [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
|5528|5528| 				{
|5529|5529| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5530|5530| 					var targetClasses = this.order.data.targetClasses;
|5531|    |-					if (targetClasses.attack && cmpIdentity
|5532|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5531|+					if (targetClasses.attack && cmpIdentity &&
|    |5532|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5533|5533| 						continue;
|5534|5534| 					if (targetClasses.avoid && cmpIdentity
|5535|5535| 						&& 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
|5531|5531| 					if (targetClasses.attack && cmpIdentity
|5532|5532| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5533|5533| 						continue;
|5534|    |-					if (targetClasses.avoid && cmpIdentity
|5535|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5534|+					if (targetClasses.avoid && cmpIdentity &&
|    |5535|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5536|5536| 						continue;
|5537|5537| 					// Only used by the AIs to prevent some choices of targets
|5538|5538| 					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
|5554|5554| 		{
|5555|5555| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5556|5556| 			var targetClasses = this.order.data.targetClasses;
|5557|    |-			if (cmpIdentity && targetClasses.attack
|5558|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5557|+			if (cmpIdentity && targetClasses.attack &&
|    |5558|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5559|5559| 				continue;
|5560|5560| 			if (cmpIdentity && targetClasses.avoid
|5561|5561| 				&& 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
|5557|5557| 			if (cmpIdentity && targetClasses.attack
|5558|5558| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5559|5559| 				continue;
|5560|    |-			if (cmpIdentity && targetClasses.avoid
|5561|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5560|+			if (cmpIdentity && targetClasses.avoid &&
|    |5561|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5562|5562| 				continue;
|5563|5563| 			// Only used by the AIs to prevent some choices of targets
|5564|5564| 			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
|5700|5700| 
|5701|5701| UnitAI.prototype.SetHeldPosition = function(x, z)
|5702|5702| {
|5703|    |-	this.heldPosition = {"x": x, "z": z};
|    |5703|+	this.heldPosition = { "x": x, "z": z};
|5704|5704| };
|5705|5705| 
|5706|5706| 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
|5700|5700| 
|5701|5701| UnitAI.prototype.SetHeldPosition = function(x, z)
|5702|5702| {
|5703|    |-	this.heldPosition = {"x": x, "z": z};
|    |5703|+	this.heldPosition = {"x": x, "z": z };
|5704|5704| };
|5705|5705| 
|5706|5706| 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
|5727|5727| 	return false;
|5728|5728| };
|5729|5729| 
|5730|    |-//// Helper functions ////
|    |5730|+// // Helper functions ////
|5731|5731| 
|5732|5732| UnitAI.prototype.CanAttack = function(target)
|5733|5733| {
|    | [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
|5931|5931| 	return cmpPack && cmpPack.IsPacking();
|5932|5932| };
|5933|5933| 
|5934|    |-//// Formation specific functions ////
|    |5934|+// // Formation specific functions ////
|5935|5935| 
|5936|5936| UnitAI.prototype.IsAttackingAsFormation = function()
|5937|5937| {
|    | [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
|5936|5936| UnitAI.prototype.IsAttackingAsFormation = function()
|5937|5937| {
|5938|5938| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5939|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5940|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5939|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5940|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5941|5941| };
|5942|5942| 
|5943|5943| //// 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
|5940|5940| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5941|5941| };
|5942|5942| 
|5943|    |-//// Animal specific functions ////
|    |5943|+// // Animal specific functions ////
|5944|5944| 
|5945|5945| UnitAI.prototype.MoveRandomly = function(distance)
|5946|5946| {

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
| 905| »   »   »   "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
| 930| »   »   »   "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
| 948| »   »   »   "leave":·function(msg)·{
|    | [NORMAL] ESLintBear (no-dupe-keys):
|    | Duplicate key 'leave'.

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

binaries/data/mods/public/simulation/components/UnitAI.js
|1046| »   »   »   »   "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
|1117| »   »   »   »   "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
|1330| »   »   »   "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
|1419| »   »   »   "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
|1643| »   »   »   "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
|1663| »   »   »   "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
|1692| »   »   »   "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
|1846| »   »   »   "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
|1896| »   »   »   »   "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
|1982| »   »   »   »   »   »   »   »   return·true;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'enter' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
|2154| »   »   »   »   "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
|2245| »   »   »   »   "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
|2428| »   »   »   »   »   »   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
|2483| »   »   »   »   "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
|2601| »   »   »   »   "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
|2666| »   »   »   »   "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
|2703| »   »   »   »   "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
|2912| »   »   »   »   "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
|3095| »   »   »   »   "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
|3827| »   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
|4628| »   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
|4643| »   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
|4689| »   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
|4712| »   »   ····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
|5178| »   var·lastPos·=·undefined;
|    | [NORMAL] ESLintBear (no-undef-init):
|    | It's not necessary to initialize 'lastPos' to undefined.

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

binaries/data/mods/public/simulation/components/UnitAI.js
| 948| »   »   »   "leave":·function(msg)·{
|    | [NORMAL] JSHintBear:
|    | Duplicate key 'leave'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1512| »   »   »   »   »   »   warn("Target·not·reachable!")·//·Remove·when·done
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4421| »   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
|4477| »   »   »   &&·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
|4645| »   »   &&·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
|4646| »   »   &&·(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
|5178| »   var·lastPos·=·undefined;
|    | [NORMAL] JSHintBear:
|    | It's not necessary to initialize 'lastPos' to 'undefined'.

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

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

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

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

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

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

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

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

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

Should only units with a "Scout"-class be able to use this? (Also prevents cluttering of the already full actions bar at the bottom.)

Freagarach updated this revision to Diff 8999.Jul 19 2019, 10:08 PM
Freagarach retitled this revision from First try of an automated exploring method. to Automated exploring..

Rebased.

Freagarach edited the summary of this revision. (Show Details)Jul 19 2019, 10:08 PM

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

Linter detected issues:
Executing section Source...

source/simulation2/components/ICmpRangeManager.h
|  69| class·ICmpRangeManager·:·public·IComponent
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'classICmpRangeManager:' is invalid C code. Use --std or --language to configure the language.
Executing section JS...
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-of'.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/session/selection_panels_helpers.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/session/selection_panels_helpers.js
| 423| 423| 	let otherEnts = [];
| 424| 424| 
| 425| 425| 	for (let ent of garrisonHolders)
| 426|    |-	{
|    | 426|+	
| 427| 427| 		if (controlsPlayer(GetEntityState(ent).player))
| 428| 428| 			ownEnts.push(ent);
| 429| 429| 		else
| 430| 430| 			otherEnts.push(ent);
| 431|    |-	}
|    | 431|+	
| 432| 432| 
| 433| 433| 	if (ownEnts.length)
| 434| 434| 		Engine.PostNetworkCommand({

binaries/data/mods/public/gui/session/unit_actions.js
| 557| »   »   »   switch·(tradingDetails.type)
|    | [NORMAL] ESLintBear (default-case):
|    | Expected a default case.
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
| 330| 330| 			{
| 331| 331| 				var list = queue.GetEntitiesList();
| 332| 332| 				if (list.indexOf(cmd.template) === -1 && cmd.promoted)
| 333|    |-				{
|    | 333|+				
| 334| 334| 					for (var promoted of cmd.promoted)
| 335| 335| 					{
| 336| 336| 						if (list.indexOf(promoted) === -1)
| 338| 338| 						cmd.template = promoted;
| 339| 339| 						break;
| 340| 340| 					}
| 341|    |-				}
|    | 341|+				
| 342| 342| 			}
| 343| 343| 			if (queue && queue.GetEntitiesList().indexOf(cmd.template) != -1)
| 344| 344| 				if ("metadata" in cmd)
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
| 544| 544| 			if (cmpGarrisonHolder)
| 545| 545| 			{
| 546| 546| 				// Only the owner of the garrisonHolder may unload entities from any owners
| 547|    |-				if (!IsOwnedByPlayer(player, garrisonHolder) && !data.controlAllUnits
| 548|    |-				    && player != +cmd.owner)
|    | 547|+				if (!IsOwnedByPlayer(player, garrisonHolder) && !data.controlAllUnits &&
|    | 548|+				    player != +cmd.owner)
| 549| 549| 						continue;
| 550| 550| 
| 551| 551| 				if (!cmpGarrisonHolder.UnloadTemplate(cmd.template, cmd.owner, cmd.all))
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
| 546| 546| 				// Only the owner of the garrisonHolder may unload entities from any owners
| 547| 547| 				if (!IsOwnedByPlayer(player, garrisonHolder) && !data.controlAllUnits
| 548| 548| 				    && player != +cmd.owner)
| 549|    |-						continue;
|    | 549|+					continue;
| 550| 550| 
| 551| 551| 				if (!cmpGarrisonHolder.UnloadTemplate(cmd.template, cmd.owner, cmd.all))
| 552| 552| 					notifyUnloadFailure(player, garrisonHolder);
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
| 956| 956| 		{
| 957| 957| 			var count = 0;
| 958| 958| 			for (let j = 0; j < length - 1; ++j)
| 959|    |-			{
|    | 959|+			
| 960| 960| 				if ((waterPoints[(i + j) % length] + 1) % numPoints == waterPoints[(i + j + 1) % length])
| 961| 961| 					++count;
| 962| 962| 				else
| 963| 963| 					break;
| 964|    |-			}
|    | 964|+			
| 965| 965| 			consec[i] = count;
| 966| 966| 		}
| 967| 967| 		var start = 0;
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for-in'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
| 967| 967| 		var start = 0;
| 968| 968| 		var count = 0;
| 969| 969| 		for (var c in consec)
| 970|    |-		{
|    | 970|+		
| 971| 971| 			if (consec[c] > count)
| 972| 972| 			{
| 973| 973| 				start = c;
| 974| 974| 				count = consec[c];
| 975| 975| 			}
| 976|    |-		}
|    | 976|+		
| 977| 977| 
| 978| 978| 		// If we've found a shoreline, stop searching
| 979| 979| 		if (count != numPoints-1)
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space after key 'metadata'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1150|1150| 
|1151|1151| 	// send Metadata info if any
|1152|1152| 	if (cmd.metadata)
|1153|    |-		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player } );
|    |1153|+		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata": cmd.metadata, "owner" : player } );
|1154|1154| 
|1155|1155| 	// Tell the units to start building this new entity
|1156|1156| 	if (cmd.autorepair)
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space after key 'owner'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1150|1150| 
|1151|1151| 	// send Metadata info if any
|1152|1152| 	if (cmd.metadata)
|1153|    |-		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player } );
|    |1153|+		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner": player } );
|1154|1154| 
|1155|1155| 	// Tell the units to start building this new entity
|1156|1156| 	if (cmd.autorepair)
|    | [NORMAL] ESLintBear (space-in-parens):
|    | There should be no spaces inside this paren.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1150|1150| 
|1151|1151| 	// send Metadata info if any
|1152|1152| 	if (cmd.metadata)
|1153|    |-		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player } );
|    |1153|+		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player });
|1154|1154| 
|1155|1155| 	// Tell the units to start building this new entity
|1156|1156| 	if (cmd.autorepair)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1154|1154| 
|1155|1155| 	// Tell the units to start building this new entity
|1156|1156| 	if (cmd.autorepair)
|1157|    |-	{
|    |1157|+	
|1158|1158| 		ProcessCommand(player, {
|1159|1159| 			"type": "repair",
|1160|1160| 			"entities": entities,
|1162|1162| 			"autocontinue": cmd.autocontinue,
|1163|1163| 			"queued": cmd.queued
|1164|1164| 		});
|1165|    |-	}
|    |1165|+	
|1166|1166| 
|1167|1167| 	return ent;
|1168|1168| }
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1258|1258| 		}
|1259|1259| 
|1260|1260| 		lastTowerControlGroup = cmpSnappedStartObstruction.GetControlGroup();
|1261|    |-		//warn("setting lastTowerControlGroup to control group of start snapped entity " + cmd.startSnappedEntity + ": " + lastTowerControlGroup);
|    |1261|+		// warn("setting lastTowerControlGroup to control group of start snapped entity " + cmd.startSnappedEntity + ": " + lastTowerControlGroup);
|1262|1262| 	}
|1263|1263| 
|1264|1264| 	var i = 0;
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1275|1275| 		// 'lastTowerControlGroup' must always be defined and valid here, except if we're at the first piece and we didn't do
|1276|1276| 		// start position snapping (implying that the first entity we build must be a tower)
|1277|1277| 		if (lastTowerControlGroup === null || lastTowerControlGroup == INVALID_ENTITY)
|1278|    |-		{
|    |1278|+		
|1279|1279| 			if (!(i == 0 && piece.template == cmd.wallSet.templates.tower && !cmd.startSnappedEntity))
|1280|1280| 			{
|1281|1281|     			error("[TryConstructWall] Expected last tower control group to be available, none found (1st pass, iteration " + i + ")");
|1282|1282|     			break;
|1283|1283| 			}
|1284|    |-		}
|    |1284|+		
|1285|1285| 
|1286|1286| 		var constructPieceCmd = {
|1287|1287| 			"type": "construct",
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1322|1322| 
|1323|1323| 				if (i > 0)
|1324|1324| 				{
|1325|    |-					//warn("   updating previous wall piece's secondary control group to " + newTowerControlGroup);
|    |1325|+					// warn("   updating previous wall piece's secondary control group to " + newTowerControlGroup);
|1326|1326| 					var cmpPreviousObstruction = Engine.QueryInterface(pieces[i-1].ent, IID_Obstruction);
|1327|1327| 					// TODO: ensure that cmpPreviousObstruction exists
|1328|1328| 					// TODO: ensure that the previous obstruction does not yet have a secondary control group set
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1380|1380| 		}
|1381|1381| 
|1382|1382| 		if (piece.template == cmd.wallSet.templates.tower)
|1383|    |-		{
|    |1383|+		
|1384|1384| 			// encountered a tower entity, update the last tower control group
|1385|1385| 			lastTowerControlGroup = cmpPieceObstruction.GetControlGroup();
|1386|    |-		}
|    |1386|+		
|1387|1387| 		else
|1388|1388| 		{
|1389|1389| 			// Encountered a non-tower entity, update its secondary control group to 'lastTowerControlGroup'.
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1394|1394| 			if (existingSecondaryControlGroup == INVALID_ENTITY)
|1395|1395| 			{
|1396|1396| 				if (lastTowerControlGroup != null && lastTowerControlGroup != INVALID_ENTITY)
|1397|    |-				{
|    |1397|+				
|1398|1398| 					cmpPieceObstruction.SetControlGroup2(lastTowerControlGroup);
|1399|    |-				}
|    |1399|+				
|1400|1400| 			}
|1401|1401| 			else if (existingSecondaryControlGroup != lastTowerControlGroup)
|1402|1402| 			{
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1469|1469| 	}
|1470|1470| 
|1471|1471| 	if (formedEnts.length == 0)
|1472|    |-	{
|    |1472|+	
|1473|1473| 		// No units support the formation - return all the others
|1474|1474| 		return nonformedUnitAIs;
|1475|    |-	}
|    |1475|+	
|1476|1476| 
|1477|1477| 	// Find what formations the formationable selected entities are currently in
|1478|1478| 	var formation = ExtractFormations(formedEnts);
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1485|1485| 		// Check that all its members are selected
|1486|1486| 		var fid = formationIds[0];
|1487|1487| 		var cmpFormation = Engine.QueryInterface(+fid, IID_Formation);
|1488|    |-		if (cmpFormation && cmpFormation.GetMemberCount() == formation.members[fid].length
|1489|    |-			&& cmpFormation.GetMemberCount() == formation.entities.length)
|    |1488|+		if (cmpFormation && cmpFormation.GetMemberCount() == formation.members[fid].length &&
|    |1489|+			cmpFormation.GetMemberCount() == formation.entities.length)
|1490|1490| 		{
|1491|1491| 			cmpFormation.DeleteTwinFormations();
|1492|1492| 			// The whole formation was selected, so reuse its controller for this command
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1517|1517| 					{
|1518|1518| 						var template = cmpUnitAI.GetFormationTemplate();
|1519|1519| 						if (lastFormationTemplate === undefined)
|1520|    |-						{
|    |1520|+						
|1521|1521| 							lastFormationTemplate = template;
|1522|    |-						}
|    |1522|+						
|1523|1523| 						else if (lastFormationTemplate != template)
|1524|1524| 						{
|1525|1525| 							lastFormationTemplate = undefined;
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1593|1593| 		for (var i = matrix.length - 1; i >= 0 && !closeClusters; --i)
|1594|1594| 			for (var j = i - 1; j >= 0 && !closeClusters; --j)
|1595|1595| 				if (matrix[i][j] < distSq)
|1596|    |-					closeClusters = [i,j];
|    |1596|+					closeClusters = [i, j];
|1597|1597| 
|1598|1598| 		// if no more close clusters found, just return all found clusters so far
|1599|1599| 		if (!closeClusters)
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1615|1615| 		}
|1616|1616| 		// remove the rows and columns in the matrix for the merged clusters,
|1617|1617| 		// and the clusters themselves from the cluster list
|1618|    |-		clusters.splice(closeClusters[0],1);
|    |1618|+		clusters.splice(closeClusters[0], 1);
|1619|1619| 		clusters.splice(closeClusters[1],1);
|1620|1620| 		matrix.splice(closeClusters[0],1);
|1621|1621| 		matrix.splice(closeClusters[1],1);
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1616|1616| 		// remove the rows and columns in the matrix for the merged clusters,
|1617|1617| 		// and the clusters themselves from the cluster list
|1618|1618| 		clusters.splice(closeClusters[0],1);
|1619|    |-		clusters.splice(closeClusters[1],1);
|    |1619|+		clusters.splice(closeClusters[1], 1);
|1620|1620| 		matrix.splice(closeClusters[0],1);
|1621|1621| 		matrix.splice(closeClusters[1],1);
|1622|1622| 		for (let i = 0; i < matrix.length; ++i)
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1617|1617| 		// and the clusters themselves from the cluster list
|1618|1618| 		clusters.splice(closeClusters[0],1);
|1619|1619| 		clusters.splice(closeClusters[1],1);
|1620|    |-		matrix.splice(closeClusters[0],1);
|    |1620|+		matrix.splice(closeClusters[0], 1);
|1621|1621| 		matrix.splice(closeClusters[1],1);
|1622|1622| 		for (let i = 0; i < matrix.length; ++i)
|1623|1623| 		{
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1618|1618| 		clusters.splice(closeClusters[0],1);
|1619|1619| 		clusters.splice(closeClusters[1],1);
|1620|1620| 		matrix.splice(closeClusters[0],1);
|1621|    |-		matrix.splice(closeClusters[1],1);
|    |1621|+		matrix.splice(closeClusters[1], 1);
|1622|1622| 		for (let i = 0; i < matrix.length; ++i)
|1623|1623| 		{
|1624|1624| 			if (matrix[i].length > closeClusters[0])
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1622|1622| 		for (let i = 0; i < matrix.length; ++i)
|1623|1623| 		{
|1624|1624| 			if (matrix[i].length > closeClusters[0])
|1625|    |-				matrix[i].splice(closeClusters[0],1);
|    |1625|+				matrix[i].splice(closeClusters[0], 1);
|1626|1626| 			if (matrix[i].length > closeClusters[1])
|1627|1627| 				matrix[i].splice(closeClusters[1],1);
|1628|1628| 		}
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1624|1624| 			if (matrix[i].length > closeClusters[0])
|1625|1625| 				matrix[i].splice(closeClusters[0],1);
|1626|1626| 			if (matrix[i].length > closeClusters[1])
|1627|    |-				matrix[i].splice(closeClusters[1],1);
|    |1627|+				matrix[i].splice(closeClusters[1], 1);
|1628|1628| 		}
|1629|1629| 		// add a new row of distances to the matrix and the new cluster
|1630|1630| 		clusters.push(newCluster);

binaries/data/mods/public/simulation/helpers/Commands.js
|  43| »   if·(g_Commands[cmd.type])
|    | [MAJOR] ESLintBear (no-use-before-define):
|    | 'g_Commands' was used before it was defined.

binaries/data/mods/public/simulation/helpers/Commands.js
|  47| »   »   g_Commands[cmd.type](player,·cmd,·data);
|    | [MAJOR] ESLintBear (no-use-before-define):
|    | 'g_Commands' was used before it was defined.

binaries/data/mods/public/simulation/helpers/Commands.js
| 796| »   »   let·ent·=·pickRandom(cmpRangeManager.GetEntitiesByPlayer(cmd.player).filter(ent·=>·{
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'ent' is already declared in the upper scope.

binaries/data/mods/public/simulation/helpers/Commands.js
|1281| ····»   »   »   error("[TryConstructWall]·Expected·last·tower·control·group·to·be·available,·none·found·(1st·pass,·iteration·"·+·i·+·")");
|    | [NORMAL] ESLintBear (no-mixed-spaces-and-tabs):
|    | Mixed spaces and tabs.

binaries/data/mods/public/simulation/helpers/Commands.js
|1282| ····»   »   »   break;
|    | [NORMAL] ESLintBear (no-mixed-spaces-and-tabs):
|    | Mixed spaces and tabs.

binaries/data/mods/public/simulation/helpers/Commands.js
|1512| »   »   »   »   var·lastFormationTemplate·=·undefined;
|    | [NORMAL] ESLintBear (no-undef-init):
|    | It's not necessary to initialize 'lastFormationTemplate' to undefined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1591| »   »   var·closeClusters·=·undefined;
|    | [NORMAL] ESLintBear (no-undef-init):
|    | It's not necessary to initialize 'closeClusters' to undefined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1608| »   »   for·(let·i·=·0;·i·<·clusters.length;·++i)
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'i' is already declared in the upper scope.

binaries/data/mods/public/simulation/helpers/Commands.js
|1622| »   »   for·(let·i·=·0;·i·<·matrix.length;·++i)
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'i' is already declared in the upper scope.

binaries/data/mods/public/simulation/helpers/Commands.js
|  53| var·g_Commands·=·{
|    | [NORMAL] JSHintBear:
|    | 'g_Commands' was used before it was defined.

binaries/data/mods/public/simulation/helpers/Commands.js
| 548| »   »   »   »   ····&&·player·!=·+cmd.owner)
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/helpers/Commands.js
| 736| »   »   »   »   var·cmpGUIInterface·=·Engine.QueryInterface(SYSTEM_ENTITY,·IID_GuiInterface);
|    | [NORMAL] JSHintBear:
|    | 'cmpGUIInterface' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
| 955| »   »   for·(var·i·=·0;·i·<·length;·++i)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
| 968| »   »   var·count·=·0;
|    | [NORMAL] JSHintBear:
|    | 'count' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1115| »   »   var·cmpGuiInterface·=·Engine.QueryInterface(SYSTEM_ENTITY,·IID_GuiInterface);
|    | [NORMAL] JSHintBear:
|    | 'cmpGuiInterface' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1367| »   »   var·piece·=·pieces[j];
|    | [NORMAL] JSHintBear:
|    | 'piece' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1450| »   »   var·cmpUnitAI·=·Engine.QueryInterface(ent,·IID_UnitAI);
|    | [NORMAL] JSHintBear:
|    | 'cmpUnitAI' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1489| »   »   »   &&·cmpFormation.GetMemberCount()·==·formation.entities.length)
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/helpers/Commands.js
|1515| »   »   »   »   »   var·cmpUnitAI·=·Engine.QueryInterface(ent,·IID_UnitAI);
|    | [NORMAL] JSHintBear:
|    | 'cmpUnitAI' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1548| »   »   »   var·cmpFormation·=·Engine.QueryInterface(formationEnt,·IID_Formation);
|    | [NORMAL] JSHintBear:
|    | 'cmpFormation' is already defined.
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 516| 516| 					this.PushOrderFront("Walk", this.order.data.lastPos);
| 517| 517| 				}
| 518| 518| 				else
| 519|    |-				{
|    | 519|+				
| 520| 520| 					// We couldn't move there, or the target moved away
| 521| 521| 					this.FinishOrder();
| 522|    |-				}
|    | 522|+				
| 523| 523| 				return;
| 524| 524| 			}
| 525| 525| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 0.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 650| 650| 		if (!cmpPosition || !cmpPosition.IsInWorld())
| 651| 651| 			return;
| 652| 652| 		this.ScoutingBeginPosition = cmpPosition.GetPosition2D();
| 653|    |-warn("Sent scouting from: " + uneval(this.ScoutingBeginPosition) ); // Remove when done
|    | 653|+		warn("Sent scouting from: " + uneval(this.ScoutingBeginPosition) ); // Remove when done
| 654| 654| 		this.SetNextState("INDIVIDUAL.SCOUTING");
| 655| 655| 	},
| 656| 656| 
|    | [NORMAL] ESLintBear (space-in-parens):
|    | There should be no spaces inside this paren.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 650| 650| 		if (!cmpPosition || !cmpPosition.IsInWorld())
| 651| 651| 			return;
| 652| 652| 		this.ScoutingBeginPosition = cmpPosition.GetPosition2D();
| 653|    |-warn("Sent scouting from: " + uneval(this.ScoutingBeginPosition) ); // Remove when done
|    | 653|+warn("Sent scouting from: " + uneval(this.ScoutingBeginPosition)); // Remove when done
| 654| 654| 		this.SetNextState("INDIVIDUAL.SCOUTING");
| 655| 655| 	},
| 656| 656| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 746| 746| 			}
| 747| 747| 			// Check if we are already in range, otherwise walk there
| 748| 748| 			if (!this.CheckGarrisonRange(msg.data.target))
| 749|    |-			{
|    | 749|+			
| 750| 750| 				if (!this.CheckTargetVisible(msg.data.target))
| 751| 751| 				{
| 752| 752| 					this.FinishOrder();
| 757| 757| 					this.SetNextState("GARRISON.APPROACHING");
| 758| 758| 					return;
| 759| 759| 				}
| 760|    |-			}
|    | 760|+			
| 761| 761| 
| 762| 762| 			this.SetNextState("GARRISON.GARRISONING");
| 763| 763| 		},
|    | [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
| 752| 752| 					this.FinishOrder();
| 753| 753| 					return;
| 754| 754| 				}
| 755|    |-				else
| 756|    |-				{
|    | 755|+				
| 757| 756| 					this.SetNextState("GARRISON.APPROACHING");
| 758| 757| 					return;
| 759|    |-				}
|    | 758|+				
| 760| 759| 			}
| 761| 760| 
| 762| 761| 			this.SetNextState("GARRISON.GARRISONING");
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 775| 775| 						this.PushOrderFront("Walk", msg.data.lastPos);
| 776| 776| 					}
| 777| 777| 					else
| 778|    |-					{
|    | 778|+					
| 779| 779| 						// We couldn't move there, or the target moved away
| 780| 780| 						this.FinishOrder();
| 781|    |-					}
|    | 781|+					
| 782| 782| 					return;
| 783| 783| 				}
| 784| 784| 
|    | [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
|1008|1008| 			},
|1009|1009| 		},
|1010|1010| 
|1011|    |-		"GARRISON":{
|    |1011|+		"GARRISON": {
|1012|1012| 			"enter": function() {
|1013|1013| 				// If the garrisonholder should pickup, warn it so it can take needed action
|1014|1014| 				var cmpGarrisonHolder = Engine.QueryInterface(this.order.data.target, IID_GarrisonHolder);
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1221|1221| 			// If the controller handled an order but some members rejected it,
|1222|1222| 			// they will have no orders and be in the FORMATIONMEMBER.IDLE state.
|1223|1223| 			if (this.orderQueue.length)
|1224|    |-			{
|    |1224|+			
|1225|1225| 				// We're leaving the formation, so stop our FormationWalk order
|1226|1226| 				if (this.FinishOrder())
|1227|1227| 					return;
|1228|    |-			}
|    |1228|+			
|1229|1229| 
|1230|1230| 			// No orders left, we're an individual now
|1231|1231| 			this.SetNextState("INDIVIDUAL.IDLE");
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1246|1246| 			// Move a tile outside the building
|1247|1247| 			let range = 4;
|1248|1248| 			if (this.CheckTargetRangeExplicit(msg.data.target, range, -1))
|1249|    |-			{
|    |1249|+			
|1250|1250| 				// We are already at the target, or can't move at all
|1251|1251| 				this.FinishOrder();
|1252|    |-			}
|    |1252|+			
|1253|1253| 			else
|1254|1254| 			{
|1255|1255| 				this.order.data.min = range;
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 4 tabs but found 0.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1434|1434| 				let targetPos;
|1435|1435| 				let mapSize = cmpTerrain.GetMapSize();
|1436|1436| 				let distancePerIteration = 20;
|1437|    |-warn(uneval(mapSize)+" "+uneval(cmpTerrain.GetTilesPerSide()) + " " + uneval(Math.ceil(mapSize/distancePerIteration)) );
|    |1437|+				warn(uneval(mapSize)+" "+uneval(cmpTerrain.GetTilesPerSide()) + " " + uneval(Math.ceil(mapSize/distancePerIteration)) );
|1438|1438| 				warn("Phase 1."); // Remove when done.
|1439|1439| 
|1440|1440| 				let imax = Math.ceil(mapSize/distancePerIteration); // Number of primary iterations to be done.
|    | [NORMAL] ESLintBear (space-in-parens):
|    | There should be no spaces inside this paren.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1434|1434| 				let targetPos;
|1435|1435| 				let mapSize = cmpTerrain.GetMapSize();
|1436|1436| 				let distancePerIteration = 20;
|1437|    |-warn(uneval(mapSize)+" "+uneval(cmpTerrain.GetTilesPerSide()) + " " + uneval(Math.ceil(mapSize/distancePerIteration)) );
|    |1437|+warn(uneval(mapSize)+" "+uneval(cmpTerrain.GetTilesPerSide()) + " " + uneval(Math.ceil(mapSize/distancePerIteration)));
|1438|1438| 				warn("Phase 1."); // Remove when done.
|1439|1439| 
|1440|1440| 				let imax = Math.ceil(mapSize/distancePerIteration); // Number of primary iterations to be done.
|    | [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
|1440|1440| 				let imax = Math.ceil(mapSize/distancePerIteration); // Number of primary iterations to be done.
|1441|1441| 				for (let i = 1; i < imax; ++i)
|1442|1442| 				{
|1443|    |-					//warn("Primary Iteration: " + i); // Remove when done.
|    |1443|+					// warn("Primary Iteration: " + i); // Remove when done.
|1444|1444| 
|1445|1445| 					let dist = visionRange + randFloat(0.8, 1.2) * distancePerIteration * i;
|1446|1446| 
|    | [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
|1455|1455| 					let jmax = 5; // Number of secondary iterations to be done.
|1456|1456| 					for (let j = 0; j < jmax * i; ++j)
|1457|1457| 					{
|1458|    |-						//warn("Secondary Iteration: " + j); // Remove when done.
|    |1458|+						// warn("Secondary Iteration: " + j); // Remove when done.
|1459|1459| 
|1460|1460| 						ang = randStartAngle + rotationDirection * 2 * Math.PI * j / jmax * randFloat(0.8, 1.2);
|1461|1461| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 8 tabs but found 0.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1467|1467| 							let tileOwner = cmpTerritoryManager.GetOwner(x, z);
|1468|1468| 							if (!tileOwner || !cmpPlayer.IsEnemy(tileOwner))
|1469|1469| 							{
|1470|    |-warn("Iteration (" + i + ", " + j + ")."); // Remove when done.
|    |1470|+								warn("Iteration (" + i + ", " + j + ")."); // Remove when done.
|1471|1471| 
|1472|1472| 								targetPos = {"x": x, "z": z};
|1473|1473| 								break;
|    | [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
|1469|1469| 							{
|1470|1470| warn("Iteration (" + i + ", " + j + ")."); // Remove when done.
|1471|1471| 
|1472|    |-								targetPos = {"x": x, "z": z};
|    |1472|+								targetPos = { "x": x, "z": z};
|1473|1473| 								break;
|1474|1474| 							}
|1475|1475| 						}
|    | [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
|1469|1469| 							{
|1470|1470| warn("Iteration (" + i + ", " + j + ")."); // Remove when done.
|1471|1471| 
|1472|    |-								targetPos = {"x": x, "z": z};
|    |1472|+								targetPos = {"x": x, "z": z };
|1473|1473| 								break;
|1474|1474| 							}
|1475|1475| 						}
|    | [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
|1486|1486| 					if (!this.CheckPointRangeExplicit(this.ScoutingBeginPosition.x, this.ScoutingBeginPosition.y))
|1487|1487| 					{
|1488|1488| 						this.MoveToPoint(this.ScoutingBeginPosition.x, this.ScoutingBeginPosition.y);
|1489|    |-						this.order.data = {"x": this.ScoutingBeginPosition.x, "z":  this.ScoutingBeginPosition.y};
|    |1489|+						this.order.data = { "x": this.ScoutingBeginPosition.x, "z":  this.ScoutingBeginPosition.y};
|1490|1490| 						this.SetNextState("WALKING");
|1491|1491| 						return true;
|1492|1492| 					}
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space before value for key 'z'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1486|1486| 					if (!this.CheckPointRangeExplicit(this.ScoutingBeginPosition.x, this.ScoutingBeginPosition.y))
|1487|1487| 					{
|1488|1488| 						this.MoveToPoint(this.ScoutingBeginPosition.x, this.ScoutingBeginPosition.y);
|1489|    |-						this.order.data = {"x": this.ScoutingBeginPosition.x, "z":  this.ScoutingBeginPosition.y};
|    |1489|+						this.order.data = {"x": this.ScoutingBeginPosition.x, "z": this.ScoutingBeginPosition.y};
|1490|1490| 						this.SetNextState("WALKING");
|1491|1491| 						return true;
|1492|1492| 					}
|    | [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
|1486|1486| 					if (!this.CheckPointRangeExplicit(this.ScoutingBeginPosition.x, this.ScoutingBeginPosition.y))
|1487|1487| 					{
|1488|1488| 						this.MoveToPoint(this.ScoutingBeginPosition.x, this.ScoutingBeginPosition.y);
|1489|    |-						this.order.data = {"x": this.ScoutingBeginPosition.x, "z":  this.ScoutingBeginPosition.y};
|    |1489|+						this.order.data = {"x": this.ScoutingBeginPosition.x, "z":  this.ScoutingBeginPosition.y };
|1490|1490| 						this.SetNextState("WALKING");
|1491|1491| 						return true;
|1492|1492| 					}
|    | [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
|1497|1497| 
|1498|1498| 					if (!this.MoveToPoint(targetPos.x, targetPos.z))
|1499|1499| 					{
|1500|    |-						warn("Target not reachable!") // Remove when done
|    |1500|+						warn("Target not reachable!"); // Remove when done
|1501|1501| 						this.FinishOrder();
|1502|1502| 						return true;
|1503|1503| 					}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1569|1569| 
|1570|1570| 			"LosRangeUpdate": function(msg) {
|1571|1571| 				if (this.GetStance().targetVisibleEnemies)
|1572|    |-				{
|    |1572|+				
|1573|1573| 					// Start attacking one of the newly-seen enemy (if any)
|1574|1574| 					this.AttackEntitiesByPreference(msg.data.added);
|1575|    |-				}
|    |1575|+				
|1576|1576| 			},
|1577|1577| 
|1578|1578| 			"LosHealRangeUpdate": function(msg) {
|    | [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
|1627|1627| 				}
|1628|1628| 			},
|1629|1629| 
|1630|    |-			"leave": function () {
|    |1630|+			"leave": function() {
|1631|1631| 				this.StopMoving();
|1632|1632| 			},
|1633|1633| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1804|1804| 						// if nothing better to do, check if the guarded needs to be healed or repaired
|1805|1805| 						var cmpHealth = Engine.QueryInterface(this.isGuardOf, IID_Health);
|1806|1806| 						if (cmpHealth && cmpHealth.IsInjured())
|1807|    |-						{
|    |1807|+						
|1808|1808| 							if (this.CanHeal(this.isGuardOf))
|1809|1809| 								this.PushOrderFront("Heal", { "target": this.isGuardOf, "force": false });
|1810|1810| 							else if (this.CanRepair(this.isGuardOf))
|1811|1811| 								this.PushOrderFront("Repair", { "target": this.isGuardOf, "autocontinue": false, "force": false });
|1812|    |-						}
|    |1812|+						
|1813|1813| 					}
|1814|1814| 				},
|1815|1815| 
|    | [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
|2086|2086| 
|2087|2087| 				"Attacked": function(msg) {
|2088|2088| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2089|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2090|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2089|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2090|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2091|2091| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2092|2092| 				},
|2093|2093| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2138|2138| 
|2139|2139| 					var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|2140|2140| 					if (cmpUnitAI && cmpUnitAI.IsFleeing())
|2141|    |-					{
|    |2141|+					
|2142|2142| 						// Run after a fleeing target
|2143|2143| 						this.SetSpeedMultiplier(this.GetRunMultiplier());
|2144|    |-					}
|    |2144|+					
|2145|2145| 					this.StartTimer(1000, 1000);
|2146|2146| 				},
|2147|2147| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2491|2491| 
|2492|2492| 				"Timer": function(msg) {
|2493|2493| 					if (this.ShouldAbandonChase(this.order.data.target, this.order.data.force, IID_Heal, null))
|2494|    |-					{
|    |2494|+					
|2495|2495| 						// Return to our original position unless we have a better order.
|2496|2496| 						if (!this.FinishOrder() && this.GetStance().respondHoldGround)
|2497|2497| 							this.WalkToHeldPosition();
|2498|    |-					}
|    |2498|+					
|2499|2499| 				},
|2500|2500| 
|2501|2501| 				"MovementUpdate": function() {
|    | [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
|2525|2525| 					this.StartTimer(prepare, this.healTimers.repeat);
|2526|2526| 
|2527|2527| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2528|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2528|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2529|2529| 
|2530|2530| 					this.FaceTowardsTarget(this.order.data.target);
|2531|2531| 				},
|    | [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
|2733|2733| 					{
|2734|2734| 						// The building was already finished/fully repaired before we arrived;
|2735|2735| 						// let the ConstructionFinished handler handle this.
|2736|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2736|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2737|2737| 						return true;
|2738|2738| 					}
|2739|2739| 
|    | [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
|2733|2733| 					{
|2734|2734| 						// The building was already finished/fully repaired before we arrived;
|2735|2735| 						// let the ConstructionFinished handler handle this.
|2736|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2736|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2737|2737| 						return true;
|2738|2738| 					}
|2739|2739| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3122|3122| 		"Attacked": function(msg) {
|3123|3123| 			if (this.template.NaturalBehaviour == "skittish" ||
|3124|3124| 			    this.template.NaturalBehaviour == "passive")
|3125|    |-			{
|    |3125|+			
|3126|3126| 				this.Flee(msg.data.attacker, false);
|3127|    |-			}
|    |3127|+			
|3128|3128| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|3129|3129| 			{
|3130|3130| 				if (this.CanAttack(msg.data.attacker))
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3131|3131| 					this.Attack(msg.data.attacker, false);
|3132|3132| 			}
|3133|3133| 			else if (this.template.NaturalBehaviour == "domestic")
|3134|    |-			{
|    |3134|+			
|3135|3135| 				// Never flee, stop what we were doing
|3136|3136| 				this.SetNextState("IDLE");
|3137|    |-			}
|    |3137|+			
|3138|3138| 		},
|3139|3139| 
|3140|3140| 		"Order.LeaveFoundation": function(msg) {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3185|3185| 				}
|3186|3186| 				// Start attacking one of the newly-seen enemy (if any)
|3187|3187| 				else if (this.IsDangerousAnimal())
|3188|    |-				{
|    |3188|+				
|3189|3189| 					this.AttackVisibleEntity(msg.data.added);
|3190|    |-				}
|    |3190|+				
|3191|3191| 
|3192|3192| 				// TODO: if two units enter our range together, we'll attack the
|3193|3193| 				// first and then the second won't trigger another LosRangeUpdate
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3229|3229| 				}
|3230|3230| 				// Start attacking one of the newly-seen enemy (if any)
|3231|3231| 				else if (this.template.NaturalBehaviour == "violent")
|3232|    |-				{
|    |3232|+				
|3233|3233| 					this.AttackVisibleEntity(msg.data.added);
|3234|    |-				}
|    |3234|+				
|3235|3235| 			},
|3236|3236| 
|3237|3237| 			"Timer": function(msg) {
|    | [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
|3244|3244| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3245|3245| 
|3246|3246| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3247|    |-							// only used for domestic animals
|    |3247|+		// only used for domestic animals
|3248|3248| 	},
|3249|3249| };
|3250|3250| 
|    | [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
|3301|3301| 
|3302|3302| UnitAI.prototype.IsAnimal = function()
|3303|3303| {
|3304|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3304|+	return (!!this.template.NaturalBehaviour);
|3305|3305| };
|3306|3306| 
|3307|3307| UnitAI.prototype.IsDangerousAnimal = function()
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3339|3339| UnitAI.prototype.GetGarrisonHolder = function()
|3340|3340| {
|3341|3341| 	if (this.IsGarrisoned())
|3342|    |-	{
|    |3342|+	
|3343|3343| 		for (let order of this.orderQueue)
|3344|3344| 			if (order.type == "Garrison")
|3345|3345| 				return order.data.target;
|3346|    |-	}
|    |3346|+	
|3347|3347| 	return INVALID_ENTITY;
|3348|3348| };
|3349|3349| 
|    | [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
|3417|3417| 		{
|3418|3418| 			let index = this.GetCurrentState().indexOf(".");
|3419|3419| 			if (index != -1)
|3420|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3420|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3421|3421| 			this.Stop(false);
|3422|3422| 		}
|3423|3423| 
|    | [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
|3473|3473| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3474|3474| 			continue;
|3475|3475| 		if (i == 0)
|3476|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3476|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3477|3477| 		else
|3478|3478| 			this.orderQueue.splice(i, 1);
|3479|3479| 		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
|3473|3473| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3474|3474| 			continue;
|3475|3475| 		if (i == 0)
|3476|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3476|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3477|3477| 		else
|3478|3478| 			this.orderQueue.splice(i, 1);
|3479|3479| 		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
|3557|3557| };
|3558|3558| 
|3559|3559| 
|3560|    |-//// FSM linkage functions ////
|    |3560|+// // FSM linkage functions ////
|3561|3561| 
|3562|3562| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3563|3563| 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
|3727|3727| 				continue;
|3728|3728| 			if (this.orderQueue[i].type == type)
|3729|3729| 				continue;
|3730|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3730|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3731|3731| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3732|3732| 			return;
|3733|3733| 		}
|    | [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
|3727|3727| 				continue;
|3728|3728| 			if (this.orderQueue[i].type == type)
|3729|3729| 				continue;
|3730|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3730|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3731|3731| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3732|3732| 			return;
|3733|3733| 		}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3741|3741| {
|3742|3742| 	// Remember the previous work orders to be able to go back to them later if required
|3743|3743| 	if (data && data.force)
|3744|    |-	{
|    |3744|+	
|3745|3745| 		if (this.IsFormationController())
|3746|3746| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3747|3747| 		else
|3748|3748| 			this.UpdateWorkOrders(type);
|3749|    |-	}
|    |3749|+	
|3750|3750| 
|3751|3751| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3752|3752| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3818|3818| 	{
|3819|3819| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3820|3820| 		if (cmpUnitAI)
|3821|    |-		{
|    |3821|+		
|3822|3822| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3823|3823| 			{
|3824|3824| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3827|3827| 					return;
|3828|3828| 				}
|3829|3829| 			}
|3830|    |-		}
|    |3830|+		
|3831|3831| 	}
|3832|3832| 
|3833|3833| 	// If nothing found, take the unit orders
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3820|3820| 		if (cmpUnitAI)
|3821|3821| 		{
|3822|3822| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3823|    |-			{
|    |3823|+			
|3824|3824| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3825|3825| 				{
|3826|3826| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3827|3827| 					return;
|3828|3828| 				}
|3829|    |-			}
|    |3829|+			
|3830|3830| 		}
|3831|3831| 	}
|3832|3832| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3832|3832| 
|3833|3833| 	// If nothing found, take the unit orders
|3834|3834| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3835|    |-	{
|    |3835|+	
|3836|3836| 		if (isWorkType(this.orderQueue[i].type))
|3837|3837| 		{
|3838|3838| 			this.workOrders = this.orderQueue.slice(i);
|3839|3839| 			return;
|3840|3840| 		}
|3841|    |-	}
|    |3841|+	
|3842|3842| };
|3843|3843| 
|3844|3844| UnitAI.prototype.BackToWork = function()
|    | [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
|3898|3898| 	if (data.timerRepeat === undefined)
|3899|3899| 		this.timer = undefined;
|3900|3900| 
|3901|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3901|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3902|3902| };
|3903|3903| 
|3904|3904| /**
|    | [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
|3898|3898| 	if (data.timerRepeat === undefined)
|3899|3899| 		this.timer = undefined;
|3900|3900| 
|3901|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3901|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3902|3902| };
|3903|3903| 
|3904|3904| /**
|    | [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
|3933|3933| 	this.timer = undefined;
|3934|3934| };
|3935|3935| 
|3936|    |-//// Message handlers /////
|    |3936|+// // Message handlers /////
|3937|3937| 
|3938|3938| UnitAI.prototype.OnMotionChanged = function(msg)
|3939|3939| {
|    | [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| 	// TODO: This is a bit inefficient since every unit listens to every
|3946|3946| 	// construction message - ideally we could scope it to only the one we're building
|3947|3947| 
|3948|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3948|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3949|3949| };
|3950|3950| 
|3951|3951| 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
|3945|3945| 	// TODO: This is a bit inefficient since every unit listens to every
|3946|3946| 	// construction message - ideally we could scope it to only the one we're building
|3947|3947| 
|3948|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3948|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3949|3949| };
|3950|3950| 
|3951|3951| 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
|3970|3970| 
|3971|3971| UnitAI.prototype.OnAttacked = function(msg)
|3972|3972| {
|3973|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3973|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3974|3974| };
|3975|3975| 
|3976|3976| 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
|3970|3970| 
|3971|3971| UnitAI.prototype.OnAttacked = function(msg)
|3972|3972| {
|3973|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3973|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3974|3974| };
|3975|3975| 
|3976|3976| 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
|3975|3975| 
|3976|3976| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3977|3977| {
|3978|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3978|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|3979|3979| };
|3980|3980| 
|3981|3981| 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
|3975|3975| 
|3976|3976| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3977|3977| {
|3978|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3978|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|3979|3979| };
|3980|3980| 
|3981|3981| 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
|3980|3980| 
|3981|3981| UnitAI.prototype.OnHealthChanged = function(msg)
|3982|3982| {
|3983|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3983|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|3984|3984| };
|3985|3985| 
|3986|3986| 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
|3980|3980| 
|3981|3981| UnitAI.prototype.OnHealthChanged = function(msg)
|3982|3982| {
|3983|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3983|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|3984|3984| };
|3985|3985| 
|3986|3986| 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
|3986|3986| UnitAI.prototype.OnRangeUpdate = function(msg)
|3987|3987| {
|3988|3988| 	if (msg.tag == this.losRangeQuery)
|3989|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3989|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|3990|3990| 	else if (msg.tag == this.losHealRangeQuery)
|3991|3991| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3992|3992| };
|    | [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
|3986|3986| UnitAI.prototype.OnRangeUpdate = function(msg)
|3987|3987| {
|3988|3988| 	if (msg.tag == this.losRangeQuery)
|3989|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3989|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|3990|3990| 	else if (msg.tag == this.losHealRangeQuery)
|3991|3991| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3992|3992| };
|    | [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
|3988|3988| 	if (msg.tag == this.losRangeQuery)
|3989|3989| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3990|3990| 	else if (msg.tag == this.losHealRangeQuery)
|3991|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3991|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|3992|3992| };
|3993|3993| 
|3994|3994| 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
|3988|3988| 	if (msg.tag == this.losRangeQuery)
|3989|3989| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3990|3990| 	else if (msg.tag == this.losHealRangeQuery)
|3991|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3991|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|3992|3992| };
|3993|3993| 
|3994|3994| 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
|3993|3993| 
|3994|3994| UnitAI.prototype.OnPackFinished = function(msg)
|3995|3995| {
|3996|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3996|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|3997|3997| };
|3998|3998| 
|3999|3999| //// 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
|3993|3993| 
|3994|3994| UnitAI.prototype.OnPackFinished = function(msg)
|3995|3995| {
|3996|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3996|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|3997|3997| };
|3998|3998| 
|3999|3999| //// 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
|3996|3996| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|3997|3997| };
|3998|3998| 
|3999|    |-//// Helper functions to be called by the FSM ////
|    |3999|+// // Helper functions to be called by the FSM ////
|4000|4000| 
|4001|4001| UnitAI.prototype.GetWalkSpeed = function()
|4002|4002| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4183|4183| 			PlaySound(name, member);
|4184|4184| 	}
|4185|4185| 	else
|4186|    |-	{
|    |4186|+	
|4187|4187| 		// Otherwise use our own sounds
|4188|4188| 		PlaySound(name, this.entity);
|4189|    |-	}
|    |4189|+	
|4190|4190| };
|4191|4191| 
|4192|4192| /*
|    | [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
|4629|4629| UnitAI.prototype.AttackEntityInZone = function(ents)
|4630|4630| {
|4631|4631| 	var target = ents.find(target =>
|4632|    |-		this.CanAttack(target)
|4633|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4632|+		this.CanAttack(target) &&
|    |4633|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4634|4634| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4635|4635| 	);
|4636|4636| 	if (!target)
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4630|4630| {
|4631|4631| 	var target = ents.find(target =>
|4632|4632| 		this.CanAttack(target)
|4633|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4634|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4633|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4634|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4635|4635| 	);
|4636|4636| 	if (!target)
|4637|4637| 		return false;
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before 'Engine'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4694|4694| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4695|4695| 	if (this.isGuardOf)
|4696|4696| 	{
|4697|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4697|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4698|4698| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4699|4699| 		if (cmpUnitAI && cmpAttack &&
|4700|4700| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 4.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4698|4698| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4699|4699| 		if (cmpUnitAI && cmpAttack &&
|4700|4700| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4701|    |-				return false;
|    |4701|+			return false;
|4702|4702| 	}
|4703|4703| 
|4704|4704| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4703|4703| 
|4704|4704| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4705|4705| 	if (this.GetStance().respondHoldGround)
|4706|    |-	{
|    |4706|+	
|4707|4707| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4708|4708| 			return true;
|4709|    |-	}
|    |4709|+	
|4710|4710| 
|4711|4711| 	// Stop if it's left our vision range, unless we're especially persistent
|4712|4712| 	if (!this.GetStance().respondChaseBeyondVision)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4710|4710| 
|4711|4711| 	// Stop if it's left our vision range, unless we're especially persistent
|4712|4712| 	if (!this.GetStance().respondChaseBeyondVision)
|4713|    |-	{
|    |4713|+	
|4714|4714| 		if (!this.CheckTargetIsInVisionRange(target))
|4715|4715| 			return true;
|4716|    |-	}
|    |4716|+	
|4717|4717| 
|4718|4718| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4719|4719| 	// and will continue moving to its last seen position and then stop)
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before 'Engine'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4736|4736| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4737|4737| 	if (this.isGuardOf)
|4738|4738| 	{
|4739|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4739|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4740|4740| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4741|4741| 		if (cmpUnitAI && cmpAttack &&
|4742|4742| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4749|4749| 	return false;
|4750|4750| };
|4751|4751| 
|4752|    |-//// External interface functions ////
|    |4752|+// // External interface functions ////
|4753|4753| 
|4754|4754| UnitAI.prototype.SetFormationController = function(ent)
|4755|4755| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4759|4759| 	// of our own formation (or ourself if not in formation)
|4760|4760| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4761|4761| 	if (cmpObstruction)
|4762|    |-	{
|    |4762|+	
|4763|4763| 		if (ent == INVALID_ENTITY)
|4764|4764| 			cmpObstruction.SetControlGroup(this.entity);
|4765|4765| 		else
|4766|4766| 			cmpObstruction.SetControlGroup(ent);
|4767|    |-	}
|    |4767|+	
|4768|4768| 
|4769|4769| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4770|4770| 	if (ent == INVALID_ENTITY)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4903|4903| 	// if we already had an old guard order, do nothing if the target is the same
|4904|4904| 	// and the order is running, otherwise remove the previous order
|4905|4905| 	if (this.isGuardOf)
|4906|    |-	{
|    |4906|+	
|4907|4907| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4908|4908| 			return;
|4909|4909| 		else
|4910|4910| 			this.RemoveGuard();
|4911|    |-	}
|    |4911|+	
|4912|4912| 
|4913|4913| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4914|4914| };
|    | [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
|4906|4906| 	{
|4907|4907| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4908|4908| 			return;
|4909|    |-		else
|4910|    |-			this.RemoveGuard();
|    |4909|+		this.RemoveGuard();
|4911|4910| 	}
|4912|4911| 
|4913|4912| 	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
|5247|5247| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5248|5248| 	{
|5249|5249| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5250|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5250|+		if (cmpTrader.HasBothMarkets() &&
|5251|5251| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5252|5252| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5253|5253| 		{
|    | [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
|5528|5528| 				{
|5529|5529| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5530|5530| 					var targetClasses = this.order.data.targetClasses;
|5531|    |-					if (targetClasses.attack && cmpIdentity
|5532|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5531|+					if (targetClasses.attack && cmpIdentity &&
|    |5532|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5533|5533| 						continue;
|5534|5534| 					if (targetClasses.avoid && cmpIdentity
|5535|5535| 						&& 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
|5531|5531| 					if (targetClasses.attack && cmpIdentity
|5532|5532| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5533|5533| 						continue;
|5534|    |-					if (targetClasses.avoid && cmpIdentity
|5535|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5534|+					if (targetClasses.avoid && cmpIdentity &&
|    |5535|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5536|5536| 						continue;
|5537|5537| 					// Only used by the AIs to prevent some choices of targets
|5538|5538| 					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
|5554|5554| 		{
|5555|5555| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5556|5556| 			var targetClasses = this.order.data.targetClasses;
|5557|    |-			if (cmpIdentity && targetClasses.attack
|5558|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5557|+			if (cmpIdentity && targetClasses.attack &&
|    |5558|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5559|5559| 				continue;
|5560|5560| 			if (cmpIdentity && targetClasses.avoid
|5561|5561| 				&& 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
|5557|5557| 			if (cmpIdentity && targetClasses.attack
|5558|5558| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5559|5559| 				continue;
|5560|    |-			if (cmpIdentity && targetClasses.avoid
|5561|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5560|+			if (cmpIdentity && targetClasses.avoid &&
|    |5561|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5562|5562| 				continue;
|5563|5563| 			// Only used by the AIs to prevent some choices of targets
|5564|5564| 			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
|5714|5714| 
|5715|5715| UnitAI.prototype.SetHeldPosition = function(x, z)
|5716|5716| {
|5717|    |-	this.heldPosition = {"x": x, "z": z};
|    |5717|+	this.heldPosition = { "x": x, "z": z};
|5718|5718| };
|5719|5719| 
|5720|5720| 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
|5714|5714| 
|5715|5715| UnitAI.prototype.SetHeldPosition = function(x, z)
|5716|5716| {
|5717|    |-	this.heldPosition = {"x": x, "z": z};
|    |5717|+	this.heldPosition = {"x": x, "z": z };
|5718|5718| };
|5719|5719| 
|5720|5720| 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
|5741|5741| 	return false;
|5742|5742| };
|5743|5743| 
|5744|    |-//// Helper functions ////
|    |5744|+// // Helper functions ////
|5745|5745| 
|5746|5746| UnitAI.prototype.CanAttack = function(target)
|5747|5747| {
|    | [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
|5945|5945| 	return cmpPack && cmpPack.IsPacking();
|5946|5946| };
|5947|5947| 
|5948|    |-//// Formation specific functions ////
|    |5948|+// // Formation specific functions ////
|5949|5949| 
|5950|5950| UnitAI.prototype.IsAttackingAsFormation = function()
|5951|5951| {
|    | [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
|5950|5950| UnitAI.prototype.IsAttackingAsFormation = function()
|5951|5951| {
|5952|5952| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5953|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5954|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5953|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5954|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5955|5955| };
|5956|5956| 
|5957|5957| //// 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
|5954|5954| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5955|5955| };
|5956|5956| 
|5957|    |-//// Animal specific functions ////
|    |5957|+// // Animal specific functions ////
|5958|5958| 
|5959|5959| UnitAI.prototype.MoveRandomly = function(distance)
|5960|5960| {

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
| 901| »   »   »   "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
| 923| »   »   »   "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
| 970| »   »   »   »   »   return·true;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'enter' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
|1033| »   »   »   »   "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
|1068| »   »   »   "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
|1100| »   »   »   »   "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
|1260| »   »   "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
|1317| »   »   »   "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
|1408| »   »   »   "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
|1622| »   »   »   "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
|1641| »   »   »   "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
|1670| »   »   »   "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
|1824| »   »   »   "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
|1874| »   »   »   »   "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
|1949| »   »   »   »   "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
|2113| »   »   »   »   »   »   return·true;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'enter' expected no return value.

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4616| »   var·target·=·ents.find(target·=>·this.CanAttack(target));
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'target' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|4631| »   var·target·=·ents.find(target·=>
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'target' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|4677| »   var·ent·=·ents.find(ent·=>·this.CanHeal(ent));
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'ent' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|4700| »   »   ····cmpAttack.GetAttackTypes().some(type·=>·cmpUnitAI.CheckTargetAttackRange(this.isGuardOf,·type)))
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'type' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|1500| »   »   »   »   »   »   warn("Target·not·reachable!")·//·Remove·when·done
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4633| »   »   &&·this.CheckTargetDistanceFromHeldPosition(target,·IID_Attack,·this.GetBestAttackAgainst(target,·true))
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
|4634| »   »   &&·(this.GetStance().respondChaseBeyondVision·||·this.CheckTargetIsInVisionRange(target))
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

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

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

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

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

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

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

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

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

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

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

Freagarach planned changes to this revision.Apr 19 2020, 10:56 AM
Silier resigned from this revision.Jul 31 2023, 5:25 PM