Page MenuHomeWildfire Games

First try of an automated exploring method.
Needs ReviewPublic

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

Details

Reviewers
Angen
Trac Tickets
#29
Summary

This is a rather quick and dirty 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 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 is 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 7554
Build 12318: Vulcan BuildJenkins
Build 12317: arc lint + arc unit

Event Timeline

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

Also I saw the ticket

Yeah, that doesn't always have a meaning ;)

In D1851#76566, @Imarok wrote:

Yeah, that doesn't always have a meaning ;)

I know, but since I had an idea about how to do it, I thought I could just share it with the community and perhaps get some feedback in the process. It is not that I *expect* this to come into the main game, I think it is merely a start ;) And perhaps a help to others.
It would be a shame if bad ideas get lost ;)

In D1851#76566, @Imarok wrote:

Yeah, that doesn't always have a meaning ;)

I know, but since I had an idea about how to do it, I thought I could just share it with the community and perhaps get some feedback in the process. It is not that I *expect* this to come into the main game, I think it is merely a start ;) And perhaps a help to others.
It would be a shame if bad ideas get lost ;)

Sure, no criticism intended.
I just didn't want you to invest precious time in the believe it will get straight into the main game. ;)

Freagarach planned changes to this revision.Mon, Apr 29, 7:37 PM
In D1851#76627, @Imarok wrote:

Sure, no criticism intended.
I just didn't want you to invest precious time in the believe it will get straight into the main game. ;)

None taken :D
It's mainly a reference for myself (and maybe others). Perhaps someday it matures to something that *might* be added to the game for the lazy noobs like me, haha ;)

Thank you for your concern :)

Stan added a subscriber: Stan.Tue, Apr 30, 8:35 PM

Apparently it was a planned feature. https://trac.wildfiregames.com/wiki/XML.Entity.Actions.Scout

What I'd like to see as well is when some units go idle their vision range slightly increase to an extent like in AOM

In D1851#76653, @Stan wrote:

Apparently it was a planned feature. https://trac.wildfiregames.com/wiki/XML.Entity.Actions.Scout
What I'd like to see as well is when some units go idle their vision range slightly increase to an extent like in AOM

The start of this and #3634? Which I would think is awesome!

Stan added a comment.Tue, Apr 30, 11:08 PM

Yeah why not. was mostly thinking of this:
https://youtu.be/KqnZFKX65to?t=23

Freagarach updated this revision to Diff 8050.Sat, May 18, 7:50 AM
Freagarach edited the summary of this revision. (Show Details)
Freagarach added a subscriber: Angen.

Added a button to activate the scouting. Now going to try to use the code provided by @Angen (link).

Owners added a subscriber: Restricted Owners Package.Sat, May 18, 7:50 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
| 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 entities and pick the first entity that is hidden from sight
|1498|1498| 				let cmpRangeManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager);
|    | [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
|1558|1558| 				if (!cmpPosition || !cmpPosition.IsInWorld())
|1559|1559| 					return;
|1560|1560| 				let pos = cmpPosition.GetPosition2D();
|1561|    |-				let targetPos = undefined;
|    |1561|+				let targetPos;
|1562|1562| 
|1563|1563| 				warn("Phase 2 again."); // Remove when done.
|1564|1564| 
|    | [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
|1565|1565| 				let players = [];
|1566|1566| 				players.push(0); // player 0 = GAIA
|1567|1567| 				let nearEnts = this.EntitiesNearPoint(pos, 200, players); // Radius ought to be large
|1568|    |-				let target = undefined;
|    |1568|+				let target;
|1569|1569| 
|1570|1570| 				let cmpRangeManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager);
|1571|1571| 				// 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
|1670|1670| 
|1671|1671| 			"LosRangeUpdate": function(msg) {
|1672|1672| 				if (this.GetStance().targetVisibleEnemies)
|1673|    |-				{
|    |1673|+				
|1674|1674| 					// Start attacking one of the newly-seen enemy (if any)
|1675|1675| 					this.AttackEntitiesByPreference(msg.data.added);
|1676|    |-				}
|    |1676|+				
|1677|1677| 			},
|1678|1678| 
|1679|1679| 			"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
|1856|1856| 						// if nothing better to do, check if the guarded needs to be healed or repaired
|1857|1857| 						var cmpHealth = Engine.QueryInterface(this.isGuardOf, IID_Health);
|1858|1858| 						if (cmpHealth && (cmpHealth.GetHitpoints() < cmpHealth.GetMaxHitpoints()))
|1859|    |-						{
|    |1859|+						
|1860|1860| 							if (this.CanHeal(this.isGuardOf))
|1861|1861| 								this.PushOrderFront("Heal", { "target": this.isGuardOf, "force": false });
|1862|1862| 							else if (this.CanRepair(this.isGuardOf))
|1863|1863| 								this.PushOrderFront("Repair", { "target": this.isGuardOf, "autocontinue": false, "force": false });
|1864|    |-						}
|    |1864|+						
|1865|1865| 					}
|1866|1866| 				},
|1867|1867| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/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| 				"MoveCompleted": function() {
|1942|1942| 
|1943|1943| 					if (this.CheckTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1944|    |-					{
|    |1944|+					
|1945|1945| 						// If the unit needs to unpack, do so
|1946|1946| 						if (this.CanUnpack())
|1947|1947| 						{
|1950|1950| 						}
|1951|1951| 						else
|1952|1952| 							this.SetNextState("ATTACKING");
|1953|    |-					}
|    |1953|+					
|1954|1954| 					else
|1955|1955| 					{
|1956|1956| 						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
|1948|1948| 							this.PushOrderFront("Unpack", { "force": true });
|1949|1949| 							return;
|1950|1950| 						}
|1951|    |-						else
|1952|    |-							this.SetNextState("ATTACKING");
|    |1951|+						this.SetNextState("ATTACKING");
|1953|1952| 					}
|1954|1953| 					else
|1955|1954| 					{
|    | [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
|1952|1952| 							this.SetNextState("ATTACKING");
|1953|1953| 					}
|1954|1954| 					else
|1955|    |-					{
|    |1955|+					
|1956|1956| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1957|1957| 						{
|1958|1958| 							this.SetNextState("APPROACHING");
|1962|1962| 							// Give up
|1963|1963| 							this.FinishOrder();
|1964|1964| 						}
|1965|    |-					}
|    |1965|+					
|1966|1966| 				},
|1967|1967| 			},
|1968|1968| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1954|1954| 					else
|1955|1955| 					{
|1956|1956| 						if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType))
|1957|    |-						{
|    |1957|+						
|1958|1958| 							this.SetNextState("APPROACHING");
|1959|    |-						}
|    |1959|+						
|1960|1960| 						else
|1961|1961| 						{
|1962|1962| 							// 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
|1958|1958| 							this.SetNextState("APPROACHING");
|1959|1959| 						}
|1960|1960| 						else
|1961|    |-						{
|    |1961|+						
|1962|1962| 							// Give up
|1963|1963| 							this.FinishOrder();
|1964|    |-						}
|    |1964|+						
|1965|1965| 					}
|1966|1966| 				},
|1967|1967| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1979|1979| 					}
|1980|1980| 					// Check the target is still alive and attackable
|1981|1981| 					if (this.CanAttack(target) && !this.CheckTargetAttackRange(target, this.order.data.attackType))
|1982|    |-					{
|    |1982|+					
|1983|1983| 						// Can't reach it - try to chase after it
|1984|1984| 						if (this.ShouldChaseTargetedEntity(target, this.order.data.force))
|1985|1985| 						{
|1994|1994| 								return;
|1995|1995| 							}
|1996|1996| 						}
|1997|    |-					}
|    |1997|+					
|1998|1998| 
|1999|1999| 					var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|2000|2000| 					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
|2025|2025| 					// TODO: we should probably only bother syncing projectile attacks, not melee
|2026|2026| 
|2027|2027| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2028|    |-					this.resyncAnimation = (prepare != this.attackTimers.prepare) ? true : false;
|    |2028|+					this.resyncAnimation = (prepare != this.attackTimers.prepare);
|2029|2029| 
|2030|2030| 					this.FaceTowardsTarget(this.order.data.target);
|2031|2031| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/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| 
|2155|2155| 				"Attacked": function(msg) {
|2156|2156| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2157|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2158|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2157|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2158|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2159|2159| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2160|2160| 				},
|2161|2161| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2168|2168| 					this.SelectAnimation("move");
|2169|2169| 					var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|2170|2170| 					if (cmpUnitAI && cmpUnitAI.IsFleeing())
|2171|    |-					{
|    |2171|+					
|2172|2172| 						// Run after a fleeing target
|2173|2173| 						this.SetSpeedMultiplier(this.GetRunMultiplier());
|2174|    |-					}
|    |2174|+					
|2175|2175| 					this.StartTimer(1000, 1000);
|2176|2176| 				},
|2177|2177| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2229|2229| 						// Also don't switch to a different type of huntable animal
|2230|2230| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2231|2231| 							return (
|2232|    |-								ent != oldTarget
|2233|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2232|+								ent != oldTarget &&
|    |2233|+								 ((type.generic == "treasure" && oldType.generic == "treasure")
|2234|2234| 								 || (type.specific == oldType.specific
|2235|2235| 								 && (type.specific != "meat" || oldTemplate == template)))
|2236|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
|2230|2230| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2231|2231| 							return (
|2232|2232| 								ent != oldTarget
|2233|    |-								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2234|    |-								 || (type.specific == oldType.specific
|    |2233|+								 && ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2234|+								 (type.specific == oldType.specific
|2235|2235| 								 && (type.specific != "meat" || oldTemplate == template)))
|2236|2236| 							);
|2237|2237| 						}, 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
|2231|2231| 							return (
|2232|2232| 								ent != oldTarget
|2233|2233| 								 && ((type.generic == "treasure" && oldType.generic == "treasure")
|2234|    |-								 || (type.specific == oldType.specific
|2235|    |-								 && (type.specific != "meat" || oldTemplate == template)))
|    |2234|+								 || (type.specific == oldType.specific &&
|    |2235|+								 (type.specific != "meat" || oldTemplate == template)))
|2236|2236| 							);
|2237|2237| 						}, oldTarget);
|2238|2238| 						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
|2240|2240| 							this.PerformGather(nearby, false, false);
|2241|2241| 							return true;
|2242|2242| 						}
|2243|    |-						else
|2244|    |-						{
|    |2243|+						
|2245|2244| 							// It's probably better in this case, to avoid units getting stuck around a dropsite
|2246|2245| 							// in a "Target is far away, full, nearby are no good resources, return to dropsite" loop
|2247|2246| 							// to order it to GatherNear the resource position.
|2262|2261| 									return true;
|2263|2262| 								}
|2264|2263| 							}
|2265|    |-						}
|    |2264|+						
|2266|2265| 						return true;
|2267|2266| 					}
|2268|2267| 					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
|2252|2252| 								this.GatherNearPosition(pos.x, pos.z, oldType, oldTemplate);
|2253|2253| 								return true;
|2254|2254| 							}
|2255|    |-							else
|2256|    |-							{
|    |2255|+							
|2257|2256| 								// we're kind of stuck here. Return resource.
|2258|2257| 								var nearby = this.FindNearestDropsite(oldType.generic);
|2259|2258| 								if (nearby)
|2261|2260| 									this.PushOrderFront("ReturnResource", { "target": nearby, "force": false });
|2262|2261| 									return true;
|2263|2262| 								}
|2264|    |-							}
|    |2263|+							
|2265|2264| 						}
|2266|2265| 						return true;
|2267|2266| 					}
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2294|2294| 						// Also don't switch to a different type of huntable animal
|2295|2295| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2296|2296| 							return (
|2297|    |-								ent != oldTarget
|2298|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|    |2297|+								ent != oldTarget &&
|    |2298|+								((type.generic == "treasure" && oldType.generic == "treasure")
|2299|2299| 								|| (type.specific == oldType.specific
|2300|2300| 								&& (type.specific != "meat" || oldTemplate == template)))
|2301|2301| 							);
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2295|2295| 						var nearby = this.FindNearbyResource(function(ent, type, template) {
|2296|2296| 							return (
|2297|2297| 								ent != oldTarget
|2298|    |-								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2299|    |-								|| (type.specific == oldType.specific
|    |2298|+								&& ((type.generic == "treasure" && oldType.generic == "treasure") ||
|    |2299|+								(type.specific == oldType.specific
|2300|2300| 								&& (type.specific != "meat" || oldTemplate == template)))
|2301|2301| 							);
|2302|2302| 						});
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2296|2296| 							return (
|2297|2297| 								ent != oldTarget
|2298|2298| 								&& ((type.generic == "treasure" && oldType.generic == "treasure")
|2299|    |-								|| (type.specific == oldType.specific
|2300|    |-								&& (type.specific != "meat" || oldTemplate == template)))
|    |2299|+								|| (type.specific == oldType.specific &&
|    |2300|+								(type.specific != "meat" || oldTemplate == template)))
|2301|2301| 							);
|2302|2302| 						});
|2303|2303| 						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
|2341|2341| 					// Also don't switch to a different type of huntable animal
|2342|2342| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2343|2343| 						return (
|2344|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2345|    |-							|| (type.specific == resourceType.specific
|    |2344|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2345|+							(type.specific == resourceType.specific
|2346|2346| 							&& (type.specific != "meat" || resourceTemplate == template))
|2347|2347| 						);
|2348|2348| 					});
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2342|2342| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2343|2343| 						return (
|2344|2344| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2345|    |-							|| (type.specific == resourceType.specific
|2346|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2345|+							|| (type.specific == resourceType.specific &&
|    |2346|+							(type.specific != "meat" || resourceTemplate == template))
|2347|2347| 						);
|2348|2348| 					});
|2349|2349| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2458|2458| 
|2459|2459| 					var cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply);
|2460|2460| 					if (cmpSupply && cmpSupply.IsAvailable(cmpOwnership.GetOwner(), this.entity))
|2461|    |-					{
|    |2461|+					
|2462|2462| 						// Check we can still reach and gather from the target
|2463|2463| 						if (this.CheckTargetRange(this.gatheringTarget, IID_ResourceGatherer) && this.CanGather(this.gatheringTarget))
|2464|2464| 						{
|2524|2524| 								return;
|2525|2525| 							}
|2526|2526| 						}
|2527|    |-					}
|    |2527|+					
|2528|2528| 
|2529|2529| 					// We're already in range, can't get anywhere near it or the target is exhausted.
|2530|2530| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '||' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2550|2550| 					// Also don't switch to a different type of huntable animal
|2551|2551| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2552|2552| 						return (
|2553|    |-							(type.generic == "treasure" && resourceType.generic == "treasure")
|2554|    |-							|| (type.specific == resourceType.specific
|    |2553|+							(type.generic == "treasure" && resourceType.generic == "treasure") ||
|    |2554|+							(type.specific == resourceType.specific
|2555|2555| 							&& (type.specific != "meat" || resourceTemplate == template))
|2556|2556| 						);
|2557|2557| 					});
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2551|2551| 					var nearby = this.FindNearbyResource(function(ent, type, template) {
|2552|2552| 						return (
|2553|2553| 							(type.generic == "treasure" && resourceType.generic == "treasure")
|2554|    |-							|| (type.specific == resourceType.specific
|2555|    |-							&& (type.specific != "meat" || resourceTemplate == template))
|    |2554|+							|| (type.specific == resourceType.specific &&
|    |2555|+							(type.specific != "meat" || resourceTemplate == template))
|2556|2556| 						);
|2557|2557| 					});
|2558|2558| 					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
|2638|2638| 					this.StartTimer(prepare, this.healTimers.repeat);
|2639|2639| 
|2640|2640| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2641|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2641|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2642|2642| 
|2643|2643| 					this.FaceTowardsTarget(this.order.data.target);
|2644|2644| 				},
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2853|2853| 					{
|2854|2854| 						// The building was already finished/fully repaired before we arrived;
|2855|2855| 						// let the ConstructionFinished handler handle this.
|2856|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2856|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2857|2857| 						return true;
|2858|2858| 					}
|2859|2859| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2853|2853| 					{
|2854|2854| 						// The building was already finished/fully repaired before we arrived;
|2855|2855| 						// let the ConstructionFinished handler handle this.
|2856|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2856|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2857|2857| 						return true;
|2858|2858| 					}
|2859|2859| 
|    | [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
|2893|2893| 					if (this.MoveToTargetRange(this.repairTarget, IID_Builder))
|2894|2894| 						this.SetNextState("APPROACHING");
|2895|2895| 					else if (!this.CheckTargetRange(this.repairTarget, IID_Builder))
|2896|    |-						this.FinishOrder(); //can't approach and isn't in reach
|    |2896|+						this.FinishOrder(); // can't approach and isn't in reach
|2897|2897| 				},
|2898|2898| 			},
|2899|2899| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2980|2980| 
|2981|2981| 				// Unit was approaching and there's nothing to do now, so switch to walking
|2982|2982| 				if (oldState === "INDIVIDUAL.REPAIR.APPROACHING")
|2983|    |-				{
|    |2983|+				
|2984|2984| 					// We're already walking to the given point, so add this as a order.
|2985|2985| 					this.WalkToTarget(msg.data.newentity, true);
|2986|    |-				}
|    |2986|+				
|2987|2987| 			},
|2988|2988| 		},
|2989|2989| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3033|3033| 
|3034|3034| 					// Check that we can garrison here
|3035|3035| 					if (this.CanGarrison(target))
|3036|    |-					{
|    |3036|+					
|3037|3037| 						// Check that we're in range of the garrison target
|3038|3038| 						if (this.CheckGarrisonRange(target))
|3039|3039| 						{
|3109|3109| 								return false;
|3110|3110| 							}
|3111|3111| 						}
|3112|    |-					}
|    |3112|+					
|3113|3113| 					// Garrisoning failed for some reason, so finish the order
|3114|3114| 					this.FinishOrder();
|3115|3115| 					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
|3216|3216| 		"Attacked": function(msg) {
|3217|3217| 			if (this.template.NaturalBehaviour == "skittish" ||
|3218|3218| 			    this.template.NaturalBehaviour == "passive")
|3219|    |-			{
|    |3219|+			
|3220|3220| 				this.Flee(msg.data.attacker, false);
|3221|    |-			}
|    |3221|+			
|3222|3222| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|3223|3223| 			{
|3224|3224| 				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
|3225|3225| 					this.Attack(msg.data.attacker, false);
|3226|3226| 			}
|3227|3227| 			else if (this.template.NaturalBehaviour == "domestic")
|3228|    |-			{
|    |3228|+			
|3229|3229| 				// Never flee, stop what we were doing
|3230|3230| 				this.SetNextState("IDLE");
|3231|    |-			}
|    |3231|+			
|3232|3232| 		},
|3233|3233| 
|3234|3234| 		"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
|3235|3235| 			// Move a tile outside the building
|3236|3236| 			var range = 4;
|3237|3237| 			if (this.MoveToTargetRangeExplicit(msg.data.target, range, range))
|3238|    |-			{
|    |3238|+			
|3239|3239| 				// We've started walking to the given point
|3240|3240| 				this.SetNextState("WALKING");
|3241|    |-			}
|    |3241|+			
|3242|3242| 			else
|3243|3243| 			{
|3244|3244| 				// 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
|3240|3240| 				this.SetNextState("WALKING");
|3241|3241| 			}
|3242|3242| 			else
|3243|    |-			{
|    |3243|+			
|3244|3244| 				// We are already at the target, or can't move at all
|3245|3245| 				this.FinishOrder();
|3246|    |-			}
|    |3246|+			
|3247|3247| 		},
|3248|3248| 
|3249|3249| 		"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
|3282|3282| 				}
|3283|3283| 				// Start attacking one of the newly-seen enemy (if any)
|3284|3284| 				else if (this.IsDangerousAnimal())
|3285|    |-				{
|    |3285|+				
|3286|3286| 					this.AttackVisibleEntity(msg.data.added);
|3287|    |-				}
|    |3287|+				
|3288|3288| 
|3289|3289| 				// TODO: if two units enter our range together, we'll attack the
|3290|3290| 				// 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
|3325|3325| 				}
|3326|3326| 				// Start attacking one of the newly-seen enemy (if any)
|3327|3327| 				else if (this.template.NaturalBehaviour == "violent")
|3328|    |-				{
|    |3328|+				
|3329|3329| 					this.AttackVisibleEntity(msg.data.added);
|3330|    |-				}
|    |3330|+				
|3331|3331| 			},
|3332|3332| 
|3333|3333| 			"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
|3342|3342| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3343|3343| 
|3344|3344| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3345|    |-							// only used for domestic animals
|    |3345|+		// only used for domestic animals
|3346|3346| 	},
|3347|3347| };
|3348|3348| 
|    | [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
|3399|3399| 
|3400|3400| UnitAI.prototype.IsAnimal = function()
|3401|3401| {
|3402|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3402|+	return (!!this.template.NaturalBehaviour);
|3403|3403| };
|3404|3404| 
|3405|3405| 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
|3437|3437| UnitAI.prototype.GetGarrisonHolder = function()
|3438|3438| {
|3439|3439| 	if (this.IsGarrisoned())
|3440|    |-	{
|    |3440|+	
|3441|3441| 		for (let order of this.orderQueue)
|3442|3442| 			if (order.type == "Garrison")
|3443|3443| 				return order.data.target;
|3444|    |-	}
|    |3444|+	
|3445|3445| 	return INVALID_ENTITY;
|3446|3446| };
|3447|3447| 
|    | [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
|3515|3515| 		{
|3516|3516| 			let index = this.GetCurrentState().indexOf(".");
|3517|3517| 			if (index != -1)
|3518|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3518|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3519|3519| 			this.Stop(false);
|3520|3520| 		}
|3521|3521| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3571|3571| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3572|3572| 			continue;
|3573|3573| 		if (i == 0)
|3574|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3574|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3575|3575| 		else
|3576|3576| 			this.orderQueue.splice(i, 1);
|3577|3577| 		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
|3571|3571| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3572|3572| 			continue;
|3573|3573| 		if (i == 0)
|3574|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3574|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3575|3575| 		else
|3576|3576| 			this.orderQueue.splice(i, 1);
|3577|3577| 		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
|3655|3655| };
|3656|3656| 
|3657|3657| 
|3658|    |-//// FSM linkage functions ////
|    |3658|+// // FSM linkage functions ////
|3659|3659| 
|3660|3660| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3661|3661| 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
|3827|3827| 				continue;
|3828|3828| 			if (this.orderQueue[i].type == type)
|3829|3829| 				continue;
|3830|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3830|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3831|3831| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3832|3832| 			return;
|3833|3833| 		}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/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| 				continue;
|3828|3828| 			if (this.orderQueue[i].type == type)
|3829|3829| 				continue;
|3830|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3830|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3831|3831| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3832|3832| 			return;
|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
|3841|3841| {
|3842|3842| 	// Remember the previous work orders to be able to go back to them later if required
|3843|3843| 	if (data && data.force)
|3844|    |-	{
|    |3844|+	
|3845|3845| 		if (this.IsFormationController())
|3846|3846| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3847|3847| 		else
|3848|3848| 			this.UpdateWorkOrders(type);
|3849|    |-	}
|    |3849|+	
|3850|3850| 
|3851|3851| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3852|3852| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/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| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3920|3920| 		if (cmpUnitAI)
|3921|    |-		{
|    |3921|+		
|3922|3922| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3923|3923| 			{
|3924|3924| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3927|3927| 					return;
|3928|3928| 				}
|3929|3929| 			}
|3930|    |-		}
|    |3930|+		
|3931|3931| 	}
|3932|3932| 
|3933|3933| 	// 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
|3920|3920| 		if (cmpUnitAI)
|3921|3921| 		{
|3922|3922| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3923|    |-			{
|    |3923|+			
|3924|3924| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3925|3925| 				{
|3926|3926| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3927|3927| 					return;
|3928|3928| 				}
|3929|    |-			}
|    |3929|+			
|3930|3930| 		}
|3931|3931| 	}
|3932|3932| 
|    | [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
|3932|3932| 
|3933|3933| 	// If nothing found, take the unit orders
|3934|3934| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3935|    |-	{
|    |3935|+	
|3936|3936| 		if (isWorkType(this.orderQueue[i].type))
|3937|3937| 		{
|3938|3938| 			this.workOrders = this.orderQueue.slice(i);
|3939|3939| 			return;
|3940|3940| 		}
|3941|    |-	}
|    |3941|+	
|3942|3942| };
|3943|3943| 
|3944|3944| 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
|3998|3998| 	if (data.timerRepeat === undefined)
|3999|3999| 		this.timer = undefined;
|4000|4000| 
|4001|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4001|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4002|4002| };
|4003|4003| 
|4004|4004| /**
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3998|3998| 	if (data.timerRepeat === undefined)
|3999|3999| 		this.timer = undefined;
|4000|4000| 
|4001|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4001|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4002|4002| };
|4003|4003| 
|4004|4004| /**
|    | [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
|4033|4033| 	this.timer = undefined;
|4034|4034| };
|4035|4035| 
|4036|    |-//// Message handlers /////
|    |4036|+// // Message handlers /////
|4037|4037| 
|4038|4038| UnitAI.prototype.OnMotionChanged = function(msg)
|4039|4039| {
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4038|4038| UnitAI.prototype.OnMotionChanged = function(msg)
|4039|4039| {
|4040|4040| 	if (msg.starting && !msg.error)
|4041|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |4041|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveStarted", "data": msg});
|4042|4042| 	else if (!msg.starting || msg.error)
|4043|4043| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|4044|4044| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4038|4038| UnitAI.prototype.OnMotionChanged = function(msg)
|4039|4039| {
|4040|4040| 	if (msg.starting && !msg.error)
|4041|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|    |4041|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg });
|4042|4042| 	else if (!msg.starting || msg.error)
|4043|4043| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|4044|4044| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4040|4040| 	if (msg.starting && !msg.error)
|4041|4041| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|4042|4042| 	else if (!msg.starting || msg.error)
|4043|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |4043|+		this.UnitFsm.ProcessMessage(this, { "type": "MoveCompleted", "data": msg});
|4044|4044| };
|4045|4045| 
|4046|4046| 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
|4040|4040| 	if (msg.starting && !msg.error)
|4041|4041| 		this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg});
|4042|4042| 	else if (!msg.starting || msg.error)
|4043|    |-		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg});
|    |4043|+		this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg });
|4044|4044| };
|4045|4045| 
|4046|4046| 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
|4048|4048| 	// TODO: This is a bit inefficient since every unit listens to every
|4049|4049| 	// construction message - ideally we could scope it to only the one we're building
|4050|4050| 
|4051|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4051|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4052|4052| };
|4053|4053| 
|4054|4054| 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
|4048|4048| 	// TODO: This is a bit inefficient since every unit listens to every
|4049|4049| 	// construction message - ideally we could scope it to only the one we're building
|4050|4050| 
|4051|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4051|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4052|4052| };
|4053|4053| 
|4054|4054| 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
|4073|4073| 
|4074|4074| UnitAI.prototype.OnAttacked = function(msg)
|4075|4075| {
|4076|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4076|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4077|4077| };
|4078|4078| 
|4079|4079| 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
|4073|4073| 
|4074|4074| UnitAI.prototype.OnAttacked = function(msg)
|4075|4075| {
|4076|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4076|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4077|4077| };
|4078|4078| 
|4079|4079| 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
|4078|4078| 
|4079|4079| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4080|4080| {
|4081|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4081|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4082|4082| };
|4083|4083| 
|4084|4084| 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
|4078|4078| 
|4079|4079| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4080|4080| {
|4081|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4081|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4082|4082| };
|4083|4083| 
|4084|4084| 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
|4083|4083| 
|4084|4084| UnitAI.prototype.OnHealthChanged = function(msg)
|4085|4085| {
|4086|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4086|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4087|4087| };
|4088|4088| 
|4089|4089| 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
|4083|4083| 
|4084|4084| UnitAI.prototype.OnHealthChanged = function(msg)
|4085|4085| {
|4086|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4086|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4087|4087| };
|4088|4088| 
|4089|4089| 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
|4089|4089| UnitAI.prototype.OnRangeUpdate = function(msg)
|4090|4090| {
|4091|4091| 	if (msg.tag == this.losRangeQuery)
|4092|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4092|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4093|4093| 	else if (msg.tag == this.losHealRangeQuery)
|4094|4094| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4095|4095| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4089|4089| UnitAI.prototype.OnRangeUpdate = function(msg)
|4090|4090| {
|4091|4091| 	if (msg.tag == this.losRangeQuery)
|4092|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4092|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4093|4093| 	else if (msg.tag == this.losHealRangeQuery)
|4094|4094| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4095|4095| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4091|4091| 	if (msg.tag == this.losRangeQuery)
|4092|4092| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4093|4093| 	else if (msg.tag == this.losHealRangeQuery)
|4094|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4094|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4095|4095| };
|4096|4096| 
|4097|4097| 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
|4091|4091| 	if (msg.tag == this.losRangeQuery)
|4092|4092| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4093|4093| 	else if (msg.tag == this.losHealRangeQuery)
|4094|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4094|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4095|4095| };
|4096|4096| 
|4097|4097| 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
|4096|4096| 
|4097|4097| UnitAI.prototype.OnPackFinished = function(msg)
|4098|4098| {
|4099|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4099|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4100|4100| };
|4101|4101| 
|4102|4102| //// 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
|4096|4096| 
|4097|4097| UnitAI.prototype.OnPackFinished = function(msg)
|4098|4098| {
|4099|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4099|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4100|4100| };
|4101|4101| 
|4102|4102| //// 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
|4099|4099| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4100|4100| };
|4101|4101| 
|4102|    |-//// Helper functions to be called by the FSM ////
|    |4102|+// // Helper functions to be called by the FSM ////
|4103|4103| 
|4104|4104| UnitAI.prototype.GetWalkSpeed = function()
|4105|4105| {
|    | [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
|4201|4201| 	if (!cmpOwnership || cmpOwnership.GetOwner() == INVALID_PLAYER)
|4202|4202| 		return undefined;
|4203|4203| 
|4204|    |-	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position)
|    |4204|+	let cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
|4205|4205| 	if (!cmpPosition || !cmpPosition.IsInWorld())
|4206|4206| 		return undefined;
|4207|4207| 
|    | [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
|4286|4286| 			PlaySound(name, member);
|4287|4287| 	}
|4288|4288| 	else
|4289|    |-	{
|    |4289|+	
|4290|4290| 		// Otherwise use our own sounds
|4291|4291| 		PlaySound(name, this.entity);
|4292|    |-	}
|    |4292|+	
|4293|4293| };
|4294|4294| 
|4295|4295| /*
|    | [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
|4455|4455| 	else
|4456|4456| 		// return false? Or hope you come close enough?
|4457|4457| 		var parabolicMaxRange = 0;
|4458|    |-		//return false;
|    |4458|+		// return false;
|4459|4459| 
|4460|4460| 	// the parabole changes while walking, take something in the middle
|4461|4461| 	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
|4520|4520| 	if (this.IsFormationMember())
|4521|4521| 	{
|4522|4522| 		var cmpFormationUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|4523|    |-		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation()
|4524|    |-			&& cmpFormationUnitAI.order.data.target == target)
|    |4523|+		if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation() &&
|    |4524|+			cmpFormationUnitAI.order.data.target == target)
|4525|4525| 			return true;
|4526|4526| 	}
|4527|4527| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4688|4688| UnitAI.prototype.AttackEntityInZone = function(ents)
|4689|4689| {
|4690|4690| 	var target = ents.find(target =>
|4691|    |-		this.CanAttack(target)
|4692|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4691|+		this.CanAttack(target) &&
|    |4692|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4693|4693| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4694|4694| 	);
|4695|4695| 	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
|4689|4689| {
|4690|4690| 	var target = ents.find(target =>
|4691|4691| 		this.CanAttack(target)
|4692|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4693|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4692|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4693|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4694|4694| 	);
|4695|4695| 	if (!target)
|4696|4696| 		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
|4753|4753| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4754|4754| 	if (this.isGuardOf)
|4755|4755| 	{
|4756|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4756|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4757|4757| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4758|4758| 		if (cmpUnitAI && cmpAttack &&
|4759|4759| 		    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
|4757|4757| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4758|4758| 		if (cmpUnitAI && cmpAttack &&
|4759|4759| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4760|    |-				return false;
|    |4760|+			return false;
|4761|4761| 	}
|4762|4762| 
|4763|4763| 	// 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
|4762|4762| 
|4763|4763| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4764|4764| 	if (this.GetStance().respondHoldGround)
|4765|    |-	{
|    |4765|+	
|4766|4766| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4767|4767| 			return true;
|4768|    |-	}
|    |4768|+	
|4769|4769| 
|4770|4770| 	// Stop if it's left our vision range, unless we're especially persistent
|4771|4771| 	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
|4769|4769| 
|4770|4770| 	// Stop if it's left our vision range, unless we're especially persistent
|4771|4771| 	if (!this.GetStance().respondChaseBeyondVision)
|4772|    |-	{
|    |4772|+	
|4773|4773| 		if (!this.CheckTargetIsInVisionRange(target))
|4774|4774| 			return true;
|4775|    |-	}
|    |4775|+	
|4776|4776| 
|4777|4777| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4778|4778| 	// 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
|4795|4795| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4796|4796| 	if (this.isGuardOf)
|4797|4797| 	{
|4798|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4798|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4799|4799| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4800|4800| 		if (cmpUnitAI && cmpAttack &&
|4801|4801| 		    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
|4808|4808| 	return false;
|4809|4809| };
|4810|4810| 
|4811|    |-//// External interface functions ////
|    |4811|+// // External interface functions ////
|4812|4812| 
|4813|4813| UnitAI.prototype.SetFormationController = function(ent)
|4814|4814| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4818|4818| 	// of our own formation (or ourself if not in formation)
|4819|4819| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4820|4820| 	if (cmpObstruction)
|4821|    |-	{
|    |4821|+	
|4822|4822| 		if (ent == INVALID_ENTITY)
|4823|4823| 			cmpObstruction.SetControlGroup(this.entity);
|4824|4824| 		else
|4825|4825| 			cmpObstruction.SetControlGroup(ent);
|4826|    |-	}
|    |4826|+	
|4827|4827| 
|4828|4828| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4829|4829| 	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
|4961|4961| 	// if we already had an old guard order, do nothing if the target is the same
|4962|4962| 	// and the order is running, otherwise remove the previous order
|4963|4963| 	if (this.isGuardOf)
|4964|    |-	{
|    |4964|+	
|4965|4965| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4966|4966| 			return;
|4967|4967| 		else
|4968|4968| 			this.RemoveGuard();
|4969|    |-	}
|    |4969|+	
|4970|4970| 
|4971|4971| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4972|4972| };
|    | [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
|4964|4964| 	{
|4965|4965| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4966|4966| 			return;
|4967|    |-		else
|4968|    |-			this.RemoveGuard();
|    |4967|+		this.RemoveGuard();
|4969|4968| 	}
|4970|4969| 
|4971|4970| 	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
|5144|5144| 			this.WalkToTarget(target, queued);
|5145|5145| 		return;
|5146|5146| 	}
|5147|    |-	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture}, queued);
|    |5147|+	this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture }, queued);
|5148|5148| };
|5149|5149| 
|5150|5150| /**
|    | [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
|5293|5293| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5294|5294| 	{
|5295|5295| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5296|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5296|+		if (cmpTrader.HasBothMarkets() &&
|5297|5297| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5298|5298| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5299|5299| 		{
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/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| 				{
|5575|5575| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5576|5576| 					var targetClasses = this.order.data.targetClasses;
|5577|    |-					if (targetClasses.attack && cmpIdentity
|5578|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5577|+					if (targetClasses.attack && cmpIdentity &&
|    |5578|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5579|5579| 						continue;
|5580|5580| 					if (targetClasses.avoid && cmpIdentity
|5581|5581| 						&& 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
|5577|5577| 					if (targetClasses.attack && cmpIdentity
|5578|5578| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5579|5579| 						continue;
|5580|    |-					if (targetClasses.avoid && cmpIdentity
|5581|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5580|+					if (targetClasses.avoid && cmpIdentity &&
|    |5581|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5582|5582| 						continue;
|5583|5583| 					// Only used by the AIs to prevent some choices of targets
|5584|5584| 					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
|5600|5600| 		{
|5601|5601| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5602|5602| 			var targetClasses = this.order.data.targetClasses;
|5603|    |-			if (cmpIdentity && targetClasses.attack
|5604|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5603|+			if (cmpIdentity && targetClasses.attack &&
|    |5604|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5605|5605| 				continue;
|5606|5606| 			if (cmpIdentity && targetClasses.avoid
|5607|5607| 				&& 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
|5603|5603| 			if (cmpIdentity && targetClasses.attack
|5604|5604| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5605|5605| 				continue;
|5606|    |-			if (cmpIdentity && targetClasses.avoid
|5607|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5606|+			if (cmpIdentity && targetClasses.avoid &&
|    |5607|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5608|5608| 				continue;
|5609|5609| 			// Only used by the AIs to prevent some choices of targets
|5610|5610| 			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
|5762|5762| 
|5763|5763| UnitAI.prototype.SetHeldPosition = function(x, z)
|5764|5764| {
|5765|    |-	this.heldPosition = {"x": x, "z": z};
|    |5765|+	this.heldPosition = { "x": x, "z": z};
|5766|5766| };
|5767|5767| 
|5768|5768| 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
|5762|5762| 
|5763|5763| UnitAI.prototype.SetHeldPosition = function(x, z)
|5764|5764| {
|5765|    |-	this.heldPosition = {"x": x, "z": z};
|    |5765|+	this.heldPosition = {"x": x, "z": z };
|5766|5766| };
|5767|5767| 
|5768|5768| 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
|5789|5789| 	return false;
|5790|5790| };
|5791|5791| 
|5792|    |-//// Helper functions ////
|    |5792|+// // Helper functions ////
|5793|5793| 
|5794|5794| UnitAI.prototype.CanAttack = function(target)
|5795|5795| {
|    | [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
|5993|5993| 	return cmpPack && cmpPack.IsPacking();
|5994|5994| };
|5995|5995| 
|5996|    |-//// Formation specific functions ////
|    |5996|+// // Formation specific functions ////
|5997|5997| 
|5998|5998| UnitAI.prototype.IsAttackingAsFormation = function()
|5999|5999| {
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5998|5998| UnitAI.prototype.IsAttackingAsFormation = function()
|5999|5999| {
|6000|6000| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6001|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6002|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6001|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6002|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6003|6003| };
|6004|6004| 
|6005|6005| //// 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
|6002|6002| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6003|6003| };
|6004|6004| 
|6005|    |-//// Animal specific functions ////
|    |6005|+// // Animal specific functions ////
|6006|6006| 
|6007|6007| UnitAI.prototype.MoveRandomly = function(distance)
|6008|6008| {

binaries/data/mods/public/simulation/components/UnitAI.js
|2540| »   »   »   »   »   »   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
|3903| »   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
|4675| »   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
|4690| »   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
|4736| »   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
|4759| »   »   ····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
|5224| »   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
|1561| »   »   »   »   let·targetPos·=·undefined;
|    | [NORMAL] JSHintBear:
|    | It's not necessary to initialize 'targetPos' to 'undefined'.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Freagarach planned changes to this revision.Sat, May 18, 9:17 AM
Freagarach updated this revision to Diff 8051.Sat, May 18, 10:02 AM
Freagarach edited the summary of this revision. (Show Details)

Ensured that a sea-creature is not targetted, but this is not the way it should be ;)

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 (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/1429/display/redirect

Freagarach planned changes to this revision.Sat, May 18, 10:42 AM
Freagarach updated this revision to Diff 8057.Sat, May 18, 8:23 PM

Added C-changes proposed by @Angen , because I need help getting it buildable.

Owners added a subscriber: Restricted Owners Package.Sat, May 18, 8:23 PM

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

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/1434/display/redirect

Angen added inline comments.Sat, May 18, 8:26 PM
source/simulation2/components/ICmpRangeManager.h
425

const = 0;

Freagarach planned changes to this revision.Sat, May 18, 9:01 PM
Freagarach added inline comments.
source/simulation2/components/ICmpRangeManager.h
425

Gives:

CCmpRangeManager.cpp
In file included from ../../../source/simulation2/components/CCmpRangeManager.cpp:20:0:
../../../source/simulation2/components/CCmpRangeManager.cpp: In static member function ‘static IComponent* CCmpRangeManager::Allocate(const ScriptInterface&, JS::HandleValue)’:
../../../source/simulation2/system/Component.h:45:96: error: invalid new-expression of abstract class type ‘CCmpRangeManager’
  static IComponent* Allocate(const ScriptInterface&, JS::HandleValue) { return new CCmp##cname(); } \

hence I removed the const.

Angen added inline comments.Sat, May 18, 9:04 PM
source/simulation2/components/ICmpRangeManager.h
425

did you had this in CCmpRangeManager.cpp ?

virtual bool IsTileExplored(CFixedVector2D pos, player_id_t player) const
Freagarach updated this revision to Diff 8059.Sat, May 18, 9:30 PM

Add const at ccmps.

Freagarach planned changes to this revision.Sat, May 18, 9:31 PM
Freagarach marked an inline comment as not done.
Freagarach added inline comments.
source/simulation2/components/ICmpRangeManager.h
425

No I hadn't, but it now gives:

ICmpRangeManager.cpp
In file included from ../../../source/simulation2/components/ICmpRangeManager.cpp:22:0:
../../../source/simulation2/system/InterfaceScripted.h:31:2: error: no matches converting function ‘callMethodConst’ to type ‘JSNative {aka bool (*)(struct JSContext*, unsigned int, class JS::Value*)}’
  }; \
  ^

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

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/1436/display/redirect

Change vector to separate variables

virtual bool IsTileExplored(entity_pos_t x, entity_pos_t y, player_id_t player) const = 0;

I dont know something is wrong with vectors but they work in another cases :)

Freagarach updated this revision to Diff 8062.Sun, May 19, 7:46 AM

Thanks @Angen it works now! It is indeed strange that the vector did not work, maybe I'll find out some day.
Just a question: should it not be "entity_pos_t z" instead of "entity_pos_t y"? For I thought that "y" is the height?

Freagarach planned changes to this revision.Sun, May 19, 7:46 AM

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.Sun, May 19, 10:22 AM
source/simulation2/components/CCmpRangeManager.cpp
2442

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

Angen requested changes to this revision.EditedSun, May 19, 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.Sun, May 19, 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
2442

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

Angen added a comment.EditedSun, May 19, 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
1479

SelectAnimation("move")

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

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.Sun, May 19, 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 ;)

Angen added inline comments.
source/simulation2/components/CCmpRangeManager.cpp
2442

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.Sun, May 19, 1:45 PM
source/simulation2/components/CCmpRangeManager.cpp
2442

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

not the round to nearest :)

Angen added inline comments.Sun, May 19, 2:18 PM
source/simulation2/components/CCmpRangeManager.cpp
2442

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.Sun, May 19, 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

Angen added inline comments.Sun, May 19, 5:25 PM
binaries/data/mods/public/simulation/components/UnitAI.js
1532

switch order
tileOwner && IsEnemy

1535

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

Angen added a subscriber: wraitii.EditedSun, May 19, 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.Sun, May 19, 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.Sun, May 19, 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)Sun, May 19, 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.