Page MenuHomeWildfire Games

Allow to cancel trade route setup
ClosedPublic

Authored by Angen on Feb 20 2020, 9:45 PM.

Details

Reviewers
Freagarach
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Commits
rP23521: Allow to cancel trade route setup
Summary

Currently when player starts setting trade route and cannot finish, because second market is too close and no other market is available, only option how to get rid of the origin market is to or delete market or trader.

This allows to cancel route setup when only origin market is set.

Suggest colour if needed.
Discuss need for new icon.

Reported in D2285 by @Freagarach

Test Plan

Check spelling.
Check formulation.

Build market.
Set origin market.
Cancel trade route.

Build second market.
Setup trade route.
Confirm switching markets was not changed.

Check nothing is broken by this diff.

Diff Detail

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

Event Timeline

Angen created this revision.Feb 20 2020, 9:45 PM
Owners added a subscriber: Restricted Owners Package.Feb 20 2020, 9:45 PM
Stan added a subscriber: Stan.Feb 20 2020, 9:46 PM

Do you need an icon with a red cross?

Angen added inline comments.Feb 20 2020, 9:46 PM
binaries/data/mods/public/simulation/components/Trader.js
73 ↗(On Diff #11403)

move it before query

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Trader.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Trader.js
|  75|  75| 	cmpTargetMarket.RemoveTrader(this.entity);
|  76|  76| 	this.index = -1;
|  77|  77| 	this.markets = [];
|  78|    |-}
|    |  78|+};
|  79|  79| 
|  80|  80| // Set target as target market.
|  81|  81| // Return true if at least one of markets was changed.

binaries/data/mods/public/simulation/components/Trader.js
|  68| Trader.prototype.RemoveTargetMarket·=·function(target)
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of function.

binaries/data/mods/public/simulation/components/Trader.js
|  78| }
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'execute'.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/session/unit_actions.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/session/unit_actions.js
| 530| 530| 
| 531| 531| 	"cancel-setup-trade-route":
| 532| 532| 	{
| 533|    |-		"execute":function(target, action, selection, queued)
|    | 533|+		"execute": function(target, action, selection, queued)
| 534| 534| 		{
| 535| 535| 			Engine.PostNetworkCommand({
| 536| 536| 				"type": "cancel-setup-trade-route",
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 4.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/session/unit_actions.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/session/unit_actions.js
| 560| 560| 			let tooltip;
| 561| 561| 			switch (tradingDetails.type)
| 562| 562| 			{
| 563|    |-				case "is first":
|    | 563|+			case "is first":
| 564| 564| 					if (!tradingDetails.hasBothMarkets)
| 565| 565| 						return {
| 566| 566| 							"possible": true,
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 4 tabs but found 5.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/session/unit_actions.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/session/unit_actions.js
| 561| 561| 			switch (tradingDetails.type)
| 562| 562| 			{
| 563| 563| 				case "is first":
| 564|    |-					if (!tradingDetails.hasBothMarkets)
|    | 564|+				if (!tradingDetails.hasBothMarkets)
| 565| 565| 						return {
| 566| 566| 							"possible": true,
| 567| 567| 							"tooltip": translate("This is the origin trade market.\n Right-click to cancel trade route.")
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/session/unit_actions.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/session/unit_actions.js
| 562| 562| 			{
| 563| 563| 				case "is first":
| 564| 564| 					if (!tradingDetails.hasBothMarkets)
| 565|    |-						return {
|    | 565|+					return {
| 566| 566| 							"possible": true,
| 567| 567| 							"tooltip": translate("This is the origin trade market.\n Right-click to cancel trade route.")
| 568| 568| 						};
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 6 tabs but found 7.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/session/unit_actions.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/session/unit_actions.js
| 563| 563| 				case "is first":
| 564| 564| 					if (!tradingDetails.hasBothMarkets)
| 565| 565| 						return {
| 566|    |-							"possible": true,
|    | 566|+						"possible": true,
| 567| 567| 							"tooltip": translate("This is the origin trade market.\n Right-click to cancel trade route.")
| 568| 568| 						};
| 569| 569| 				break;
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 6 tabs but found 7.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/session/unit_actions.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/session/unit_actions.js
| 564| 564| 					if (!tradingDetails.hasBothMarkets)
| 565| 565| 						return {
| 566| 566| 							"possible": true,
| 567|    |-							"tooltip": translate("This is the origin trade market.\n Right-click to cancel trade route.")
|    | 567|+						"tooltip": translate("This is the origin trade market.\n Right-click to cancel trade route.")
| 568| 568| 						};
| 569| 569| 				break;
| 570| 570| 			}
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/session/unit_actions.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/session/unit_actions.js
| 565| 565| 						return {
| 566| 566| 							"possible": true,
| 567| 567| 							"tooltip": translate("This is the origin trade market.\n Right-click to cancel trade route.")
| 568|    |-						};
|    | 568|+					};
| 569| 569| 				break;
| 570| 570| 			}
| 571| 571| 			return false;
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/session/unit_actions.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/session/unit_actions.js
| 581| 581| 				"cursor": "action-setup-trade-route-disabled",
| 582| 582| 				"tooltip": actionInfo.tooltip,
| 583| 583| 				"target": target
| 584|    |-			}
|    | 584|+			};
| 585| 585| 		},
| 586| 586| 		"specificness": 2,
| 587| 587| 	},

binaries/data/mods/public/gui/session/unit_actions.js
| 561| »   »   »   switch·(tradingDetails.type)
|    | [NORMAL] ESLintBear (default-case):
|    | Expected a default case.

binaries/data/mods/public/gui/session/unit_actions.js
| 626| »   »   »   switch·(tradingDetails.type)
|    | [NORMAL] ESLintBear (default-case):
|    | Expected a default case.

binaries/data/mods/public/gui/session/unit_actions.js
| 584| »   »   »   }
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
| 527| 527| 			if (cmpGarrisonHolder)
| 528| 528| 			{
| 529| 529| 				// Only the owner of the garrisonHolder may unload entities from any owners
| 530|    |-				if (!IsOwnedByPlayer(player, garrisonHolder) && !data.controlAllUnits
| 531|    |-				    && player != +cmd.owner)
|    | 530|+				if (!IsOwnedByPlayer(player, garrisonHolder) && !data.controlAllUnits &&
|    | 531|+				    player != +cmd.owner)
| 532| 532| 						continue;
| 533| 533| 
| 534| 534| 				if (!cmpGarrisonHolder.UnloadTemplate(cmd.template, cmd.owner, cmd.all))
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
| 529| 529| 				// Only the owner of the garrisonHolder may unload entities from any owners
| 530| 530| 				if (!IsOwnedByPlayer(player, garrisonHolder) && !data.controlAllUnits
| 531| 531| 				    && player != +cmd.owner)
| 532|    |-						continue;
|    | 532|+					continue;
| 533| 533| 
| 534| 534| 				if (!cmpGarrisonHolder.UnloadTemplate(cmd.template, cmd.owner, cmd.all))
| 535| 535| 					notifyUnloadFailure(player, garrisonHolder);
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space after key 'metadata'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1142|1142| 
|1143|1143| 	// send Metadata info if any
|1144|1144| 	if (cmd.metadata)
|1145|    |-		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player } );
|    |1145|+		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata": cmd.metadata, "owner" : player } );
|1146|1146| 
|1147|1147| 	// Tell the units to start building this new entity
|1148|1148| 	if (cmd.autorepair)
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space after key 'owner'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1142|1142| 
|1143|1143| 	// send Metadata info if any
|1144|1144| 	if (cmd.metadata)
|1145|    |-		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player } );
|    |1145|+		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner": player } );
|1146|1146| 
|1147|1147| 	// Tell the units to start building this new entity
|1148|1148| 	if (cmd.autorepair)
|    | [NORMAL] ESLintBear (space-in-parens):
|    | There should be no spaces inside this paren.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1142|1142| 
|1143|1143| 	// send Metadata info if any
|1144|1144| 	if (cmd.metadata)
|1145|    |-		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player } );
|    |1145|+		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player });
|1146|1146| 
|1147|1147| 	// Tell the units to start building this new entity
|1148|1148| 	if (cmd.autorepair)
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1250|1250| 		}
|1251|1251| 
|1252|1252| 		lastTowerControlGroup = cmpSnappedStartObstruction.GetControlGroup();
|1253|    |-		//warn("setting lastTowerControlGroup to control group of start snapped entity " + cmd.startSnappedEntity + ": " + lastTowerControlGroup);
|    |1253|+		// warn("setting lastTowerControlGroup to control group of start snapped entity " + cmd.startSnappedEntity + ": " + lastTowerControlGroup);
|1254|1254| 	}
|1255|1255| 
|1256|1256| 	var i = 0;
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1314|1314| 
|1315|1315| 				if (i > 0)
|1316|1316| 				{
|1317|    |-					//warn("   updating previous wall piece's secondary control group to " + newTowerControlGroup);
|    |1317|+					// warn("   updating previous wall piece's secondary control group to " + newTowerControlGroup);
|1318|1318| 					var cmpPreviousObstruction = Engine.QueryInterface(pieces[i-1].ent, IID_Obstruction);
|1319|1319| 					// TODO: ensure that cmpPreviousObstruction exists
|1320|1320| 					// TODO: ensure that the previous obstruction does not yet have a secondary control group set
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1477|1477| 		// Check that all its members are selected
|1478|1478| 		var fid = formationIds[0];
|1479|1479| 		var cmpFormation = Engine.QueryInterface(+fid, IID_Formation);
|1480|    |-		if (cmpFormation && cmpFormation.GetMemberCount() == formation.members[fid].length
|1481|    |-			&& cmpFormation.GetMemberCount() == formation.entities.length)
|    |1480|+		if (cmpFormation && cmpFormation.GetMemberCount() == formation.members[fid].length &&
|    |1481|+			cmpFormation.GetMemberCount() == formation.entities.length)
|1482|1482| 		{
|1483|1483| 			cmpFormation.DeleteTwinFormations();
|1484|1484| 			// The whole formation was selected, so reuse its controller for this command
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1585|1585| 		for (var i = matrix.length - 1; i >= 0 && !closeClusters; --i)
|1586|1586| 			for (var j = i - 1; j >= 0 && !closeClusters; --j)
|1587|1587| 				if (matrix[i][j] < distSq)
|1588|    |-					closeClusters = [i,j];
|    |1588|+					closeClusters = [i, j];
|1589|1589| 
|1590|1590| 		// if no more close clusters found, just return all found clusters so far
|1591|1591| 		if (!closeClusters)
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1607|1607| 		}
|1608|1608| 		// remove the rows and columns in the matrix for the merged clusters,
|1609|1609| 		// and the clusters themselves from the cluster list
|1610|    |-		clusters.splice(closeClusters[0],1);
|    |1610|+		clusters.splice(closeClusters[0], 1);
|1611|1611| 		clusters.splice(closeClusters[1],1);
|1612|1612| 		matrix.splice(closeClusters[0],1);
|1613|1613| 		matrix.splice(closeClusters[1],1);
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1608|1608| 		// remove the rows and columns in the matrix for the merged clusters,
|1609|1609| 		// and the clusters themselves from the cluster list
|1610|1610| 		clusters.splice(closeClusters[0],1);
|1611|    |-		clusters.splice(closeClusters[1],1);
|    |1611|+		clusters.splice(closeClusters[1], 1);
|1612|1612| 		matrix.splice(closeClusters[0],1);
|1613|1613| 		matrix.splice(closeClusters[1],1);
|1614|1614| 		for (let i = 0; i < matrix.length; ++i)
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1609|1609| 		// and the clusters themselves from the cluster list
|1610|1610| 		clusters.splice(closeClusters[0],1);
|1611|1611| 		clusters.splice(closeClusters[1],1);
|1612|    |-		matrix.splice(closeClusters[0],1);
|    |1612|+		matrix.splice(closeClusters[0], 1);
|1613|1613| 		matrix.splice(closeClusters[1],1);
|1614|1614| 		for (let i = 0; i < matrix.length; ++i)
|1615|1615| 		{
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1610|1610| 		clusters.splice(closeClusters[0],1);
|1611|1611| 		clusters.splice(closeClusters[1],1);
|1612|1612| 		matrix.splice(closeClusters[0],1);
|1613|    |-		matrix.splice(closeClusters[1],1);
|    |1613|+		matrix.splice(closeClusters[1], 1);
|1614|1614| 		for (let i = 0; i < matrix.length; ++i)
|1615|1615| 		{
|1616|1616| 			if (matrix[i].length > closeClusters[0])
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1614|1614| 		for (let i = 0; i < matrix.length; ++i)
|1615|1615| 		{
|1616|1616| 			if (matrix[i].length > closeClusters[0])
|1617|    |-				matrix[i].splice(closeClusters[0],1);
|    |1617|+				matrix[i].splice(closeClusters[0], 1);
|1618|1618| 			if (matrix[i].length > closeClusters[1])
|1619|1619| 				matrix[i].splice(closeClusters[1],1);
|1620|1620| 		}
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1616|1616| 			if (matrix[i].length > closeClusters[0])
|1617|1617| 				matrix[i].splice(closeClusters[0],1);
|1618|1618| 			if (matrix[i].length > closeClusters[1])
|1619|    |-				matrix[i].splice(closeClusters[1],1);
|    |1619|+				matrix[i].splice(closeClusters[1], 1);
|1620|1620| 		}
|1621|1621| 		// add a new row of distances to the matrix and the new cluster
|1622|1622| 		clusters.push(newCluster);

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

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

binaries/data/mods/public/simulation/helpers/Commands.js
| 788| »   »   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
|1273| ····»   »   »   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
|1274| ····»   »   »   break;
|    | [NORMAL] ESLintBear (no-mixed-spaces-and-tabs):
|    | Mixed spaces and tabs.

binaries/data/mods/public/simulation/helpers/Commands.js
|1504| »   »   »   »   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
|1583| »   »   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
|1600| »   »   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
|1614| »   »   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
| 531| »   »   »   »   ····&&·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
| 726| »   »   »   »   var·cmpGUIInterface·=·Engine.QueryInterface(SYSTEM_ENTITY,·IID_GuiInterface);
|    | [NORMAL] JSHintBear:
|    | 'cmpGUIInterface' is already defined.

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

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

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

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

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

binaries/data/mods/public/simulation/helpers/Commands.js
|1481| »   »   »   &&·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
|1507| »   »   »   »   »   var·cmpUnitAI·=·Engine.QueryInterface(ent,·IID_UnitAI);
|    | [NORMAL] JSHintBear:
|    | 'cmpUnitAI' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1540| »   »   »   var·cmpFormation·=·Engine.QueryInterface(formationEnt,·IID_Formation);
|    | [NORMAL] JSHintBear:
|    | 'cmpFormation' is already defined.
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 788| 788| 					this.FinishOrder();
| 789| 789| 					return;
| 790| 790| 				}
| 791|    |-				else
| 792|    |-				{
|    | 791|+				
| 793| 792| 					this.SetNextState("GARRISON.APPROACHING");
| 794| 793| 					return;
| 795|    |-				}
|    | 794|+				
| 796| 795| 			}
| 797| 796| 
| 798| 797| 			this.SetNextState("GARRISON.GARRISONING");
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'GARRISON'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1060|1060| 			},
|1061|1061| 		},
|1062|1062| 
|1063|    |-		"GARRISON":{
|    |1063|+		"GARRISON": {
|1064|1064| 			"APPROACHING": {
|1065|1065| 				"enter": function() {
|1066|1066| 					if (!this.MoveToGarrisonRange(this.order.data.target))
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2038|2038| 
|2039|2039| 				"Attacked": function(msg) {
|2040|2040| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2041|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2042|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2041|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2042|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2043|2043| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2044|2044| 				},
|2045|2045| 			},
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2776|2776| 					{
|2777|2777| 						// The building was already finished/fully repaired before we arrived;
|2778|2778| 						// let the ConstructionFinished handler handle this.
|2779|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2779|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2780|2780| 						return true;
|2781|2781| 					}
|2782|2782| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2776|2776| 					{
|2777|2777| 						// The building was already finished/fully repaired before we arrived;
|2778|2778| 						// let the ConstructionFinished handler handle this.
|2779|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2779|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2780|2780| 						return true;
|2781|2781| 					}
|2782|2782| 
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3074|3074| 				this.StopTimer();
|3075|3075| 				this.ResetAnimation();
|3076|3076| 				if (this.formationAnimationVariant)
|3077|    |-					this.SetAnimationVariant(this.formationAnimationVariant)
|    |3077|+					this.SetAnimationVariant(this.formationAnimationVariant);
|3078|3078| 				else
|3079|3079| 					this.SetDefaultAnimationVariant();
|3080|3080| 				var cmpResistance = Engine.QueryInterface(this.entity, IID_Resistance);
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 7.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3300|3300| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3301|3301| 
|3302|3302| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3303|    |-							// only used for domestic animals
|    |3303|+		// only used for domestic animals
|3304|3304| 
|3305|3305| 		// Reuse the same garrison behaviour for animals.
|3306|3306| 		"GARRISON": "INDIVIDUAL.GARRISON",
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3362|3362| 
|3363|3363| UnitAI.prototype.IsAnimal = function()
|3364|3364| {
|3365|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3365|+	return (!!this.template.NaturalBehaviour);
|3366|3366| };
|3367|3367| 
|3368|3368| UnitAI.prototype.IsDangerousAnimal = function()
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3478|3478| 		{
|3479|3479| 			let index = this.GetCurrentState().indexOf(".");
|3480|3480| 			if (index != -1)
|3481|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3481|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3482|3482| 			this.Stop(false);
|3483|3483| 		}
|3484|3484| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3534|3534| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3535|3535| 			continue;
|3536|3536| 		if (i == 0)
|3537|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3537|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3538|3538| 		else
|3539|3539| 			this.orderQueue.splice(i, 1);
|3540|3540| 		Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3534|3534| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3535|3535| 			continue;
|3536|3536| 		if (i == 0)
|3537|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3537|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3538|3538| 		else
|3539|3539| 			this.orderQueue.splice(i, 1);
|3540|3540| 		Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3621|3621| };
|3622|3622| 
|3623|3623| 
|3624|    |-//// FSM linkage functions ////
|    |3624|+// // FSM linkage functions ////
|3625|3625| 
|3626|3626| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3627|3627| UnitAI.prototype.SetNextState = function(state)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3792|3792| 				continue;
|3793|3793| 			if (this.orderQueue[i].type == type)
|3794|3794| 				continue;
|3795|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3795|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3796|3796| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3797|3797| 			return;
|3798|3798| 		}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3792|3792| 				continue;
|3793|3793| 			if (this.orderQueue[i].type == type)
|3794|3794| 				continue;
|3795|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3795|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3796|3796| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3797|3797| 			return;
|3798|3798| 		}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4034|4034| 	if (data.timerRepeat === undefined)
|4035|4035| 		this.timer = undefined;
|4036|4036| 
|4037|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4037|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4038|4038| };
|4039|4039| 
|4040|4040| /**
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4034|4034| 	if (data.timerRepeat === undefined)
|4035|4035| 		this.timer = undefined;
|4036|4036| 
|4037|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4037|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4038|4038| };
|4039|4039| 
|4040|4040| /**
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4079|4079| 	// TODO: This is a bit inefficient since every unit listens to every
|4080|4080| 	// construction message - ideally we could scope it to only the one we're building
|4081|4081| 
|4082|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4082|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4083|4083| };
|4084|4084| 
|4085|4085| UnitAI.prototype.OnGlobalEntityRenamed = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4079|4079| 	// TODO: This is a bit inefficient since every unit listens to every
|4080|4080| 	// construction message - ideally we could scope it to only the one we're building
|4081|4081| 
|4082|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4082|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4083|4083| };
|4084|4084| 
|4085|4085| UnitAI.prototype.OnGlobalEntityRenamed = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4110|4110| 	if (msg.fromStatusEffect)
|4111|4111| 		return;
|4112|4112| 
|4113|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4113|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4114|4114| };
|4115|4115| 
|4116|4116| UnitAI.prototype.OnGuardedAttacked = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4110|4110| 	if (msg.fromStatusEffect)
|4111|4111| 		return;
|4112|4112| 
|4113|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4113|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4114|4114| };
|4115|4115| 
|4116|4116| UnitAI.prototype.OnGuardedAttacked = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4115|4115| 
|4116|4116| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4117|4117| {
|4118|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4118|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4119|4119| };
|4120|4120| 
|4121|4121| UnitAI.prototype.OnHealthChanged = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4115|4115| 
|4116|4116| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4117|4117| {
|4118|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4118|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4119|4119| };
|4120|4120| 
|4121|4121| UnitAI.prototype.OnHealthChanged = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4120|4120| 
|4121|4121| UnitAI.prototype.OnHealthChanged = function(msg)
|4122|4122| {
|4123|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4123|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4124|4124| };
|4125|4125| 
|4126|4126| UnitAI.prototype.OnRangeUpdate = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4120|4120| 
|4121|4121| UnitAI.prototype.OnHealthChanged = function(msg)
|4122|4122| {
|4123|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4123|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4124|4124| };
|4125|4125| 
|4126|4126| UnitAI.prototype.OnRangeUpdate = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4126|4126| UnitAI.prototype.OnRangeUpdate = function(msg)
|4127|4127| {
|4128|4128| 	if (msg.tag == this.losRangeQuery)
|4129|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4129|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4130|4130| 	else if (msg.tag == this.losHealRangeQuery)
|4131|4131| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4132|4132| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4126|4126| UnitAI.prototype.OnRangeUpdate = function(msg)
|4127|4127| {
|4128|4128| 	if (msg.tag == this.losRangeQuery)
|4129|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4129|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4130|4130| 	else if (msg.tag == this.losHealRangeQuery)
|4131|4131| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4132|4132| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4128|4128| 	if (msg.tag == this.losRangeQuery)
|4129|4129| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4130|4130| 	else if (msg.tag == this.losHealRangeQuery)
|4131|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4131|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4132|4132| };
|4133|4133| 
|4134|4134| UnitAI.prototype.OnPackFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4128|4128| 	if (msg.tag == this.losRangeQuery)
|4129|4129| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4130|4130| 	else if (msg.tag == this.losHealRangeQuery)
|4131|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4131|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4132|4132| };
|4133|4133| 
|4134|4134| UnitAI.prototype.OnPackFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4133|4133| 
|4134|4134| UnitAI.prototype.OnPackFinished = function(msg)
|4135|4135| {
|4136|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4136|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4137|4137| };
|4138|4138| 
|4139|4139| //// Helper functions to be called by the FSM ////
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4133|4133| 
|4134|4134| UnitAI.prototype.OnPackFinished = function(msg)
|4135|4135| {
|4136|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4136|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4137|4137| };
|4138|4138| 
|4139|4139| //// Helper functions to be called by the FSM ////
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4136|4136| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4137|4137| };
|4138|4138| 
|4139|    |-//// Helper functions to be called by the FSM ////
|    |4139|+// // Helper functions to be called by the FSM ////
|4140|4140| 
|4141|4141| UnitAI.prototype.GetWalkSpeed = function()
|4142|4142| {
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4802|4802| UnitAI.prototype.AttackEntityInZone = function(ents)
|4803|4803| {
|4804|4804| 	var target = ents.find(target =>
|4805|    |-		this.CanAttack(target)
|4806|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4805|+		this.CanAttack(target) &&
|    |4806|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4807|4807| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4808|4808| 	);
|4809|4809| 	if (!target)
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4803|4803| {
|4804|4804| 	var target = ents.find(target =>
|4805|4805| 		this.CanAttack(target)
|4806|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4807|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4806|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4807|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4808|4808| 	);
|4809|4809| 	if (!target)
|4810|4810| 		return false;
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before 'Engine'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4867|4867| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4868|4868| 	if (this.isGuardOf)
|4869|4869| 	{
|4870|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4870|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4871|4871| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4872|4872| 		if (cmpUnitAI && cmpAttack &&
|4873|4873| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 4.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4871|4871| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4872|4872| 		if (cmpUnitAI && cmpAttack &&
|4873|4873| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4874|    |-				return false;
|    |4874|+			return false;
|4875|4875| 	}
|4876|4876| 
|4877|4877| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before 'Engine'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4909|4909| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4910|4910| 	if (this.isGuardOf)
|4911|4911| 	{
|4912|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4912|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4913|4913| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4914|4914| 		if (cmpUnitAI && cmpAttack &&
|4915|4915| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4922|4922| 	return false;
|4923|4923| };
|4924|4924| 
|4925|    |-//// External interface functions ////
|    |4925|+// // External interface functions ////
|4926|4926| 
|4927|4927| UnitAI.prototype.SetFormationController = function(ent)
|4928|4928| {
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5078|5078| 	{
|5079|5079| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5080|5080| 			return;
|5081|    |-		else
|5082|    |-			this.RemoveGuard();
|    |5081|+		this.RemoveGuard();
|5083|5082| 	}
|5084|5083| 
|5085|5084| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5409|5409| 
|5410|5410| 	if (this.IsFormationController())
|5411|5411| 		this.CallMemberFunction("CancelSetupTradeRoute", [target]);
|5412|    |-}
|    |5412|+};
|5413|5413| /**
|5414|5414|  * Adds trade order to the queue. Either walk to the first market, or
|5415|5415|  * start a new route. Not forced, so it can be interrupted by attacks.
|    | [NORMAL] ESLintBear (no-trailing-spaces):
|    | Trailing spaces not allowed.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5430|5430| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5431|5431| 	{
|5432|5432| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5433|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5433|+		if (cmpTrader.HasBothMarkets() &&
|5434|5434| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5435|5435| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5436|5436| 		{
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5711|5711| 				{
|5712|5712| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5713|5713| 					var targetClasses = this.order.data.targetClasses;
|5714|    |-					if (targetClasses.attack && cmpIdentity
|5715|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5714|+					if (targetClasses.attack && cmpIdentity &&
|    |5715|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5716|5716| 						continue;
|5717|5717| 					if (targetClasses.avoid && cmpIdentity
|5718|5718| 						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5714|5714| 					if (targetClasses.attack && cmpIdentity
|5715|5715| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5716|5716| 						continue;
|5717|    |-					if (targetClasses.avoid && cmpIdentity
|5718|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5717|+					if (targetClasses.avoid && cmpIdentity &&
|    |5718|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5719|5719| 						continue;
|5720|5720| 					// Only used by the AIs to prevent some choices of targets
|5721|5721| 					if (targetClasses.vetoEntities && targetClasses.vetoEntities[targ])
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5737|5737| 		{
|5738|5738| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5739|5739| 			var targetClasses = this.order.data.targetClasses;
|5740|    |-			if (cmpIdentity && targetClasses.attack
|5741|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5740|+			if (cmpIdentity && targetClasses.attack &&
|    |5741|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5742|5742| 				continue;
|5743|5743| 			if (cmpIdentity && targetClasses.avoid
|5744|5744| 				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5740|5740| 			if (cmpIdentity && targetClasses.attack
|5741|5741| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5742|5742| 				continue;
|5743|    |-			if (cmpIdentity && targetClasses.avoid
|5744|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5743|+			if (cmpIdentity && targetClasses.avoid &&
|    |5744|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5745|5745| 				continue;
|5746|5746| 			// Only used by the AIs to prevent some choices of targets
|5747|5747| 			if (targetClasses.vetoEntities && targetClasses.vetoEntities[targ])
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5883|5883| 
|5884|5884| UnitAI.prototype.SetHeldPosition = function(x, z)
|5885|5885| {
|5886|    |-	this.heldPosition = {"x": x, "z": z};
|    |5886|+	this.heldPosition = { "x": x, "z": z};
|5887|5887| };
|5888|5888| 
|5889|5889| UnitAI.prototype.SetHeldPositionOnEntity = function(entity)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5883|5883| 
|5884|5884| UnitAI.prototype.SetHeldPosition = function(x, z)
|5885|5885| {
|5886|    |-	this.heldPosition = {"x": x, "z": z};
|    |5886|+	this.heldPosition = {"x": x, "z": z };
|5887|5887| };
|5888|5888| 
|5889|5889| UnitAI.prototype.SetHeldPositionOnEntity = function(entity)
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5910|5910| 	return false;
|5911|5911| };
|5912|5912| 
|5913|    |-//// Helper functions ////
|    |5913|+// // Helper functions ////
|5914|5914| 
|5915|5915| /**
|5916|5916|  * General getter for ranges.
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5929|5929| 		return undefined;
|5930|5930| 
|5931|5931| 	return component.GetRange(type);
|5932|    |-}
|    |5932|+};
|5933|5933| 
|5934|5934| UnitAI.prototype.CanAttack = function(target)
|5935|5935| {
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|6127|6127| 	return cmpPack && cmpPack.IsPacking();
|6128|6128| };
|6129|6129| 
|6130|    |-//// Formation specific functions ////
|    |6130|+// // Formation specific functions ////
|6131|6131| 
|6132|6132| UnitAI.prototype.IsAttackingAsFormation = function()
|6133|6133| {
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|6132|6132| UnitAI.prototype.IsAttackingAsFormation = function()
|6133|6133| {
|6134|6134| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6135|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6136|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6135|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6136|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6137|6137| };
|6138|6138| 
|6139|6139| //// Animal specific functions ////
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|6136|6136| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6137|6137| };
|6138|6138| 
|6139|    |-//// Animal specific functions ////
|    |6139|+// // Animal specific functions ////
|6140|6140| 
|6141|6141| UnitAI.prototype.MoveRandomly = function(distance)
|6142|6142| {

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|3939| »   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
|4789| »   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
|4804| »   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
|4850| »   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
|4873| »   »   ····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
|2042| »   »   »   »   »   »   &&·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
|3077| »   »   »   »   »   this.SetAnimationVariant(this.formationAnimationVariant)
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|5741| »   »   »   »   &&·!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
|5744| »   »   »   »   &&·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
|5932| }
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

Angen updated this revision to Diff 11417.Feb 23 2020, 7:41 PM

remove switch

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Trader.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Trader.js
|  81|  81| 	this.index = -1;
|  82|  82| 	this.markets = [];
|  83|  83| 	return true;
|  84|    |-}
|    |  84|+};
|  85|  85| 
|  86|  86| // Set target as target market.
|  87|  87| // Return true if at least one of markets was changed.

binaries/data/mods/public/simulation/components/Trader.js
|  84| }
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'execute'.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/session/unit_actions.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/session/unit_actions.js
| 530| 530| 
| 531| 531| 	"cancel-setup-trade-route":
| 532| 532| 	{
| 533|    |-		"execute":function(target, action, selection, queued)
|    | 533|+		"execute": function(target, action, selection, queued)
| 534| 534| 		{
| 535| 535| 			Engine.PostNetworkCommand({
| 536| 536| 				"type": "cancel-setup-trade-route",
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/session/unit_actions.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/session/unit_actions.js
| 575| 575| 				"cursor": "action-setup-trade-route-disabled",
| 576| 576| 				"tooltip": actionInfo.tooltip,
| 577| 577| 				"target": target
| 578|    |-			}
|    | 578|+			};
| 579| 579| 		},
| 580| 580| 		"specificness": 2,
| 581| 581| 	},

binaries/data/mods/public/gui/session/unit_actions.js
| 620| »   »   »   switch·(tradingDetails.type)
|    | [NORMAL] ESLintBear (default-case):
|    | Expected a default case.

binaries/data/mods/public/gui/session/unit_actions.js
| 578| »   »   »   }
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
| 527| 527| 			if (cmpGarrisonHolder)
| 528| 528| 			{
| 529| 529| 				// Only the owner of the garrisonHolder may unload entities from any owners
| 530|    |-				if (!IsOwnedByPlayer(player, garrisonHolder) && !data.controlAllUnits
| 531|    |-				    && player != +cmd.owner)
|    | 530|+				if (!IsOwnedByPlayer(player, garrisonHolder) && !data.controlAllUnits &&
|    | 531|+				    player != +cmd.owner)
| 532| 532| 						continue;
| 533| 533| 
| 534| 534| 				if (!cmpGarrisonHolder.UnloadTemplate(cmd.template, cmd.owner, cmd.all))
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
| 529| 529| 				// Only the owner of the garrisonHolder may unload entities from any owners
| 530| 530| 				if (!IsOwnedByPlayer(player, garrisonHolder) && !data.controlAllUnits
| 531| 531| 				    && player != +cmd.owner)
| 532|    |-						continue;
|    | 532|+					continue;
| 533| 533| 
| 534| 534| 				if (!cmpGarrisonHolder.UnloadTemplate(cmd.template, cmd.owner, cmd.all))
| 535| 535| 					notifyUnloadFailure(player, garrisonHolder);
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space after key 'metadata'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1142|1142| 
|1143|1143| 	// send Metadata info if any
|1144|1144| 	if (cmd.metadata)
|1145|    |-		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player } );
|    |1145|+		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata": cmd.metadata, "owner" : player } );
|1146|1146| 
|1147|1147| 	// Tell the units to start building this new entity
|1148|1148| 	if (cmd.autorepair)
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space after key 'owner'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1142|1142| 
|1143|1143| 	// send Metadata info if any
|1144|1144| 	if (cmd.metadata)
|1145|    |-		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player } );
|    |1145|+		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner": player } );
|1146|1146| 
|1147|1147| 	// Tell the units to start building this new entity
|1148|1148| 	if (cmd.autorepair)
|    | [NORMAL] ESLintBear (space-in-parens):
|    | There should be no spaces inside this paren.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1142|1142| 
|1143|1143| 	// send Metadata info if any
|1144|1144| 	if (cmd.metadata)
|1145|    |-		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player } );
|    |1145|+		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player });
|1146|1146| 
|1147|1147| 	// Tell the units to start building this new entity
|1148|1148| 	if (cmd.autorepair)
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1250|1250| 		}
|1251|1251| 
|1252|1252| 		lastTowerControlGroup = cmpSnappedStartObstruction.GetControlGroup();
|1253|    |-		//warn("setting lastTowerControlGroup to control group of start snapped entity " + cmd.startSnappedEntity + ": " + lastTowerControlGroup);
|    |1253|+		// warn("setting lastTowerControlGroup to control group of start snapped entity " + cmd.startSnappedEntity + ": " + lastTowerControlGroup);
|1254|1254| 	}
|1255|1255| 
|1256|1256| 	var i = 0;
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1314|1314| 
|1315|1315| 				if (i > 0)
|1316|1316| 				{
|1317|    |-					//warn("   updating previous wall piece's secondary control group to " + newTowerControlGroup);
|    |1317|+					// warn("   updating previous wall piece's secondary control group to " + newTowerControlGroup);
|1318|1318| 					var cmpPreviousObstruction = Engine.QueryInterface(pieces[i-1].ent, IID_Obstruction);
|1319|1319| 					// TODO: ensure that cmpPreviousObstruction exists
|1320|1320| 					// TODO: ensure that the previous obstruction does not yet have a secondary control group set
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1477|1477| 		// Check that all its members are selected
|1478|1478| 		var fid = formationIds[0];
|1479|1479| 		var cmpFormation = Engine.QueryInterface(+fid, IID_Formation);
|1480|    |-		if (cmpFormation && cmpFormation.GetMemberCount() == formation.members[fid].length
|1481|    |-			&& cmpFormation.GetMemberCount() == formation.entities.length)
|    |1480|+		if (cmpFormation && cmpFormation.GetMemberCount() == formation.members[fid].length &&
|    |1481|+			cmpFormation.GetMemberCount() == formation.entities.length)
|1482|1482| 		{
|1483|1483| 			cmpFormation.DeleteTwinFormations();
|1484|1484| 			// The whole formation was selected, so reuse its controller for this command
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1585|1585| 		for (var i = matrix.length - 1; i >= 0 && !closeClusters; --i)
|1586|1586| 			for (var j = i - 1; j >= 0 && !closeClusters; --j)
|1587|1587| 				if (matrix[i][j] < distSq)
|1588|    |-					closeClusters = [i,j];
|    |1588|+					closeClusters = [i, j];
|1589|1589| 
|1590|1590| 		// if no more close clusters found, just return all found clusters so far
|1591|1591| 		if (!closeClusters)
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1607|1607| 		}
|1608|1608| 		// remove the rows and columns in the matrix for the merged clusters,
|1609|1609| 		// and the clusters themselves from the cluster list
|1610|    |-		clusters.splice(closeClusters[0],1);
|    |1610|+		clusters.splice(closeClusters[0], 1);
|1611|1611| 		clusters.splice(closeClusters[1],1);
|1612|1612| 		matrix.splice(closeClusters[0],1);
|1613|1613| 		matrix.splice(closeClusters[1],1);
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1608|1608| 		// remove the rows and columns in the matrix for the merged clusters,
|1609|1609| 		// and the clusters themselves from the cluster list
|1610|1610| 		clusters.splice(closeClusters[0],1);
|1611|    |-		clusters.splice(closeClusters[1],1);
|    |1611|+		clusters.splice(closeClusters[1], 1);
|1612|1612| 		matrix.splice(closeClusters[0],1);
|1613|1613| 		matrix.splice(closeClusters[1],1);
|1614|1614| 		for (let i = 0; i < matrix.length; ++i)
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1609|1609| 		// and the clusters themselves from the cluster list
|1610|1610| 		clusters.splice(closeClusters[0],1);
|1611|1611| 		clusters.splice(closeClusters[1],1);
|1612|    |-		matrix.splice(closeClusters[0],1);
|    |1612|+		matrix.splice(closeClusters[0], 1);
|1613|1613| 		matrix.splice(closeClusters[1],1);
|1614|1614| 		for (let i = 0; i < matrix.length; ++i)
|1615|1615| 		{
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1610|1610| 		clusters.splice(closeClusters[0],1);
|1611|1611| 		clusters.splice(closeClusters[1],1);
|1612|1612| 		matrix.splice(closeClusters[0],1);
|1613|    |-		matrix.splice(closeClusters[1],1);
|    |1613|+		matrix.splice(closeClusters[1], 1);
|1614|1614| 		for (let i = 0; i < matrix.length; ++i)
|1615|1615| 		{
|1616|1616| 			if (matrix[i].length > closeClusters[0])
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1614|1614| 		for (let i = 0; i < matrix.length; ++i)
|1615|1615| 		{
|1616|1616| 			if (matrix[i].length > closeClusters[0])
|1617|    |-				matrix[i].splice(closeClusters[0],1);
|    |1617|+				matrix[i].splice(closeClusters[0], 1);
|1618|1618| 			if (matrix[i].length > closeClusters[1])
|1619|1619| 				matrix[i].splice(closeClusters[1],1);
|1620|1620| 		}
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1616|1616| 			if (matrix[i].length > closeClusters[0])
|1617|1617| 				matrix[i].splice(closeClusters[0],1);
|1618|1618| 			if (matrix[i].length > closeClusters[1])
|1619|    |-				matrix[i].splice(closeClusters[1],1);
|    |1619|+				matrix[i].splice(closeClusters[1], 1);
|1620|1620| 		}
|1621|1621| 		// add a new row of distances to the matrix and the new cluster
|1622|1622| 		clusters.push(newCluster);

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

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

binaries/data/mods/public/simulation/helpers/Commands.js
| 788| »   »   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
|1273| ····»   »   »   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
|1274| ····»   »   »   break;
|    | [NORMAL] ESLintBear (no-mixed-spaces-and-tabs):
|    | Mixed spaces and tabs.

binaries/data/mods/public/simulation/helpers/Commands.js
|1504| »   »   »   »   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
|1583| »   »   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
|1600| »   »   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
|1614| »   »   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
| 531| »   »   »   »   ····&&·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
| 726| »   »   »   »   var·cmpGUIInterface·=·Engine.QueryInterface(SYSTEM_ENTITY,·IID_GuiInterface);
|    | [NORMAL] JSHintBear:
|    | 'cmpGUIInterface' is already defined.

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

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

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

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

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

binaries/data/mods/public/simulation/helpers/Commands.js
|1481| »   »   »   &&·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
|1507| »   »   »   »   »   var·cmpUnitAI·=·Engine.QueryInterface(ent,·IID_UnitAI);
|    | [NORMAL] JSHintBear:
|    | 'cmpUnitAI' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1540| »   »   »   var·cmpFormation·=·Engine.QueryInterface(formationEnt,·IID_Formation);
|    | [NORMAL] JSHintBear:
|    | 'cmpFormation' is already defined.
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 788| 788| 					this.FinishOrder();
| 789| 789| 					return;
| 790| 790| 				}
| 791|    |-				else
| 792|    |-				{
|    | 791|+				
| 793| 792| 					this.SetNextState("GARRISON.APPROACHING");
| 794| 793| 					return;
| 795|    |-				}
|    | 794|+				
| 796| 795| 			}
| 797| 796| 
| 798| 797| 			this.SetNextState("GARRISON.GARRISONING");
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'GARRISON'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1060|1060| 			},
|1061|1061| 		},
|1062|1062| 
|1063|    |-		"GARRISON":{
|    |1063|+		"GARRISON": {
|1064|1064| 			"APPROACHING": {
|1065|1065| 				"enter": function() {
|1066|1066| 					if (!this.MoveToGarrisonRange(this.order.data.target))
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2038|2038| 
|2039|2039| 				"Attacked": function(msg) {
|2040|2040| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2041|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2042|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2041|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2042|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2043|2043| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2044|2044| 				},
|2045|2045| 			},
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2776|2776| 					{
|2777|2777| 						// The building was already finished/fully repaired before we arrived;
|2778|2778| 						// let the ConstructionFinished handler handle this.
|2779|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2779|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2780|2780| 						return true;
|2781|2781| 					}
|2782|2782| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2776|2776| 					{
|2777|2777| 						// The building was already finished/fully repaired before we arrived;
|2778|2778| 						// let the ConstructionFinished handler handle this.
|2779|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2779|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2780|2780| 						return true;
|2781|2781| 					}
|2782|2782| 
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3074|3074| 				this.StopTimer();
|3075|3075| 				this.ResetAnimation();
|3076|3076| 				if (this.formationAnimationVariant)
|3077|    |-					this.SetAnimationVariant(this.formationAnimationVariant)
|    |3077|+					this.SetAnimationVariant(this.formationAnimationVariant);
|3078|3078| 				else
|3079|3079| 					this.SetDefaultAnimationVariant();
|3080|3080| 				var cmpResistance = Engine.QueryInterface(this.entity, IID_Resistance);
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 7.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3300|3300| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3301|3301| 
|3302|3302| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3303|    |-							// only used for domestic animals
|    |3303|+		// only used for domestic animals
|3304|3304| 
|3305|3305| 		// Reuse the same garrison behaviour for animals.
|3306|3306| 		"GARRISON": "INDIVIDUAL.GARRISON",
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3362|3362| 
|3363|3363| UnitAI.prototype.IsAnimal = function()
|3364|3364| {
|3365|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3365|+	return (!!this.template.NaturalBehaviour);
|3366|3366| };
|3367|3367| 
|3368|3368| UnitAI.prototype.IsDangerousAnimal = function()
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3478|3478| 		{
|3479|3479| 			let index = this.GetCurrentState().indexOf(".");
|3480|3480| 			if (index != -1)
|3481|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3481|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3482|3482| 			this.Stop(false);
|3483|3483| 		}
|3484|3484| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3534|3534| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3535|3535| 			continue;
|3536|3536| 		if (i == 0)
|3537|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3537|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3538|3538| 		else
|3539|3539| 			this.orderQueue.splice(i, 1);
|3540|3540| 		Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3534|3534| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3535|3535| 			continue;
|3536|3536| 		if (i == 0)
|3537|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3537|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3538|3538| 		else
|3539|3539| 			this.orderQueue.splice(i, 1);
|3540|3540| 		Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3621|3621| };
|3622|3622| 
|3623|3623| 
|3624|    |-//// FSM linkage functions ////
|    |3624|+// // FSM linkage functions ////
|3625|3625| 
|3626|3626| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3627|3627| UnitAI.prototype.SetNextState = function(state)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3792|3792| 				continue;
|3793|3793| 			if (this.orderQueue[i].type == type)
|3794|3794| 				continue;
|3795|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3795|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3796|3796| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3797|3797| 			return;
|3798|3798| 		}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3792|3792| 				continue;
|3793|3793| 			if (this.orderQueue[i].type == type)
|3794|3794| 				continue;
|3795|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3795|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3796|3796| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3797|3797| 			return;
|3798|3798| 		}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4034|4034| 	if (data.timerRepeat === undefined)
|4035|4035| 		this.timer = undefined;
|4036|4036| 
|4037|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4037|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4038|4038| };
|4039|4039| 
|4040|4040| /**
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4034|4034| 	if (data.timerRepeat === undefined)
|4035|4035| 		this.timer = undefined;
|4036|4036| 
|4037|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4037|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4038|4038| };
|4039|4039| 
|4040|4040| /**
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4079|4079| 	// TODO: This is a bit inefficient since every unit listens to every
|4080|4080| 	// construction message - ideally we could scope it to only the one we're building
|4081|4081| 
|4082|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4082|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4083|4083| };
|4084|4084| 
|4085|4085| UnitAI.prototype.OnGlobalEntityRenamed = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4079|4079| 	// TODO: This is a bit inefficient since every unit listens to every
|4080|4080| 	// construction message - ideally we could scope it to only the one we're building
|4081|4081| 
|4082|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4082|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4083|4083| };
|4084|4084| 
|4085|4085| UnitAI.prototype.OnGlobalEntityRenamed = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4110|4110| 	if (msg.fromStatusEffect)
|4111|4111| 		return;
|4112|4112| 
|4113|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4113|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4114|4114| };
|4115|4115| 
|4116|4116| UnitAI.prototype.OnGuardedAttacked = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4110|4110| 	if (msg.fromStatusEffect)
|4111|4111| 		return;
|4112|4112| 
|4113|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4113|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4114|4114| };
|4115|4115| 
|4116|4116| UnitAI.prototype.OnGuardedAttacked = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4115|4115| 
|4116|4116| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4117|4117| {
|4118|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4118|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4119|4119| };
|4120|4120| 
|4121|4121| UnitAI.prototype.OnHealthChanged = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4115|4115| 
|4116|4116| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4117|4117| {
|4118|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4118|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4119|4119| };
|4120|4120| 
|4121|4121| UnitAI.prototype.OnHealthChanged = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4120|4120| 
|4121|4121| UnitAI.prototype.OnHealthChanged = function(msg)
|4122|4122| {
|4123|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4123|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4124|4124| };
|4125|4125| 
|4126|4126| UnitAI.prototype.OnRangeUpdate = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4120|4120| 
|4121|4121| UnitAI.prototype.OnHealthChanged = function(msg)
|4122|4122| {
|4123|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4123|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4124|4124| };
|4125|4125| 
|4126|4126| UnitAI.prototype.OnRangeUpdate = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4126|4126| UnitAI.prototype.OnRangeUpdate = function(msg)
|4127|4127| {
|4128|4128| 	if (msg.tag == this.losRangeQuery)
|4129|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4129|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4130|4130| 	else if (msg.tag == this.losHealRangeQuery)
|4131|4131| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4132|4132| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4126|4126| UnitAI.prototype.OnRangeUpdate = function(msg)
|4127|4127| {
|4128|4128| 	if (msg.tag == this.losRangeQuery)
|4129|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4129|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4130|4130| 	else if (msg.tag == this.losHealRangeQuery)
|4131|4131| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4132|4132| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4128|4128| 	if (msg.tag == this.losRangeQuery)
|4129|4129| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4130|4130| 	else if (msg.tag == this.losHealRangeQuery)
|4131|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4131|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4132|4132| };
|4133|4133| 
|4134|4134| UnitAI.prototype.OnPackFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4128|4128| 	if (msg.tag == this.losRangeQuery)
|4129|4129| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4130|4130| 	else if (msg.tag == this.losHealRangeQuery)
|4131|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4131|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4132|4132| };
|4133|4133| 
|4134|4134| UnitAI.prototype.OnPackFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4133|4133| 
|4134|4134| UnitAI.prototype.OnPackFinished = function(msg)
|4135|4135| {
|4136|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4136|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4137|4137| };
|4138|4138| 
|4139|4139| //// Helper functions to be called by the FSM ////
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4133|4133| 
|4134|4134| UnitAI.prototype.OnPackFinished = function(msg)
|4135|4135| {
|4136|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4136|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4137|4137| };
|4138|4138| 
|4139|4139| //// Helper functions to be called by the FSM ////
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4136|4136| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4137|4137| };
|4138|4138| 
|4139|    |-//// Helper functions to be called by the FSM ////
|    |4139|+// // Helper functions to be called by the FSM ////
|4140|4140| 
|4141|4141| UnitAI.prototype.GetWalkSpeed = function()
|4142|4142| {
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4802|4802| UnitAI.prototype.AttackEntityInZone = function(ents)
|4803|4803| {
|4804|4804| 	var target = ents.find(target =>
|4805|    |-		this.CanAttack(target)
|4806|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4805|+		this.CanAttack(target) &&
|    |4806|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4807|4807| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4808|4808| 	);
|4809|4809| 	if (!target)
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4803|4803| {
|4804|4804| 	var target = ents.find(target =>
|4805|4805| 		this.CanAttack(target)
|4806|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4807|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4806|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4807|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4808|4808| 	);
|4809|4809| 	if (!target)
|4810|4810| 		return false;
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before 'Engine'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4867|4867| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4868|4868| 	if (this.isGuardOf)
|4869|4869| 	{
|4870|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4870|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4871|4871| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4872|4872| 		if (cmpUnitAI && cmpAttack &&
|4873|4873| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 4.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4871|4871| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4872|4872| 		if (cmpUnitAI && cmpAttack &&
|4873|4873| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4874|    |-				return false;
|    |4874|+			return false;
|4875|4875| 	}
|4876|4876| 
|4877|4877| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before 'Engine'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4909|4909| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4910|4910| 	if (this.isGuardOf)
|4911|4911| 	{
|4912|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4912|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4913|4913| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4914|4914| 		if (cmpUnitAI && cmpAttack &&
|4915|4915| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4922|4922| 	return false;
|4923|4923| };
|4924|4924| 
|4925|    |-//// External interface functions ////
|    |4925|+// // External interface functions ////
|4926|4926| 
|4927|4927| UnitAI.prototype.SetFormationController = function(ent)
|4928|4928| {
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5078|5078| 	{
|5079|5079| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5080|5080| 			return;
|5081|    |-		else
|5082|    |-			this.RemoveGuard();
|    |5081|+		this.RemoveGuard();
|5083|5082| 	}
|5084|5083| 
|5085|5084| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5409|5409| 
|5410|5410| 	if (this.IsFormationController())
|5411|5411| 		this.CallMemberFunction("CancelSetupTradeRoute", [target]);
|5412|    |-}
|    |5412|+};
|5413|5413| /**
|5414|5414|  * Adds trade order to the queue. Either walk to the first market, or
|5415|5415|  * start a new route. Not forced, so it can be interrupted by attacks.
|    | [NORMAL] ESLintBear (no-trailing-spaces):
|    | Trailing spaces not allowed.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5430|5430| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5431|5431| 	{
|5432|5432| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5433|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5433|+		if (cmpTrader.HasBothMarkets() &&
|5434|5434| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5435|5435| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5436|5436| 		{
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5711|5711| 				{
|5712|5712| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5713|5713| 					var targetClasses = this.order.data.targetClasses;
|5714|    |-					if (targetClasses.attack && cmpIdentity
|5715|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5714|+					if (targetClasses.attack && cmpIdentity &&
|    |5715|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5716|5716| 						continue;
|5717|5717| 					if (targetClasses.avoid && cmpIdentity
|5718|5718| 						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5714|5714| 					if (targetClasses.attack && cmpIdentity
|5715|5715| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5716|5716| 						continue;
|5717|    |-					if (targetClasses.avoid && cmpIdentity
|5718|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5717|+					if (targetClasses.avoid && cmpIdentity &&
|    |5718|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5719|5719| 						continue;
|5720|5720| 					// Only used by the AIs to prevent some choices of targets
|5721|5721| 					if (targetClasses.vetoEntities && targetClasses.vetoEntities[targ])
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5737|5737| 		{
|5738|5738| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5739|5739| 			var targetClasses = this.order.data.targetClasses;
|5740|    |-			if (cmpIdentity && targetClasses.attack
|5741|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5740|+			if (cmpIdentity && targetClasses.attack &&
|    |5741|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5742|5742| 				continue;
|5743|5743| 			if (cmpIdentity && targetClasses.avoid
|5744|5744| 				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5740|5740| 			if (cmpIdentity && targetClasses.attack
|5741|5741| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5742|5742| 				continue;
|5743|    |-			if (cmpIdentity && targetClasses.avoid
|5744|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5743|+			if (cmpIdentity && targetClasses.avoid &&
|    |5744|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5745|5745| 				continue;
|5746|5746| 			// Only used by the AIs to prevent some choices of targets
|5747|5747| 			if (targetClasses.vetoEntities && targetClasses.vetoEntities[targ])
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5883|5883| 
|5884|5884| UnitAI.prototype.SetHeldPosition = function(x, z)
|5885|5885| {
|5886|    |-	this.heldPosition = {"x": x, "z": z};
|    |5886|+	this.heldPosition = { "x": x, "z": z};
|5887|5887| };
|5888|5888| 
|5889|5889| UnitAI.prototype.SetHeldPositionOnEntity = function(entity)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5883|5883| 
|5884|5884| UnitAI.prototype.SetHeldPosition = function(x, z)
|5885|5885| {
|5886|    |-	this.heldPosition = {"x": x, "z": z};
|    |5886|+	this.heldPosition = {"x": x, "z": z };
|5887|5887| };
|5888|5888| 
|5889|5889| UnitAI.prototype.SetHeldPositionOnEntity = function(entity)
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5910|5910| 	return false;
|5911|5911| };
|5912|5912| 
|5913|    |-//// Helper functions ////
|    |5913|+// // Helper functions ////
|5914|5914| 
|5915|5915| /**
|5916|5916|  * General getter for ranges.
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5929|5929| 		return undefined;
|5930|5930| 
|5931|5931| 	return component.GetRange(type);
|5932|    |-}
|    |5932|+};
|5933|5933| 
|5934|5934| UnitAI.prototype.CanAttack = function(target)
|5935|5935| {
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|6127|6127| 	return cmpPack && cmpPack.IsPacking();
|6128|6128| };
|6129|6129| 
|6130|    |-//// Formation specific functions ////
|    |6130|+// // Formation specific functions ////
|6131|6131| 
|6132|6132| UnitAI.prototype.IsAttackingAsFormation = function()
|6133|6133| {
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|6132|6132| UnitAI.prototype.IsAttackingAsFormation = function()
|6133|6133| {
|6134|6134| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6135|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6136|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6135|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6136|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6137|6137| };
|6138|6138| 
|6139|6139| //// Animal specific functions ////
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|6136|6136| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6137|6137| };
|6138|6138| 
|6139|    |-//// Animal specific functions ////
|    |6139|+// // Animal specific functions ////
|6140|6140| 
|6141|6141| UnitAI.prototype.MoveRandomly = function(distance)
|6142|6142| {

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|3939| »   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
|4789| »   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
|4804| »   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
|4850| »   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
|4873| »   »   ····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
|2042| »   »   »   »   »   »   &&·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
|3077| »   »   »   »   »   this.SetAnimationVariant(this.formationAnimationVariant)
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|5741| »   »   »   »   &&·!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
|5744| »   »   »   »   &&·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
|5932| }
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

Angen added a comment.Feb 24 2020, 1:41 PM
In D2643#110822, @Stan wrote:

Do you need an icon with a red cross?

yes, it would be nice :)

Angen added a reviewer: Restricted Owners Package.Feb 24 2020, 1:42 PM
Freagarach added inline comments.Feb 27 2020, 8:53 PM
binaries/data/mods/public/gui/session/unit_actions.js
563 ↗(On Diff #11417)

You can ditch the after the \n :)

binaries/data/mods/public/simulation/components/Trader.js
70–71 ↗(On Diff #11417)

Captitals, . and iff -> if.

Angen added inline comments.Feb 27 2020, 9:00 PM
binaries/data/mods/public/simulation/components/Trader.js
70–71 ↗(On Diff #11417)

no, iff is correct https://en.wikipedia.org/wiki/If_and_only_if
@param and @return are not capitalised nor do have dots https://trac.wildfiregames.com/wiki/Coding_Conventions#Documentation

Freagarach added inline comments.Feb 27 2020, 9:07 PM
binaries/data/mods/public/simulation/components/Trader.js
70–71 ↗(On Diff #11417)

/me learned a new word :) But why use that above a normal if here, if I may ask?
(Dots are present in CC.)

Angen added inline comments.Feb 27 2020, 9:14 PM
binaries/data/mods/public/simulation/components/Trader.js
70–71 ↗(On Diff #11417)

+1 for dots (tired eyes)
I should probably reformulate that one. Its falsy right now.

Angen updated this revision to Diff 11450.Mar 1 2020, 10:16 AM

add .
reformulate comment
use new icon

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Trader.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Trader.js
|  81|  81| 	this.index = -1;
|  82|  82| 	this.markets = [];
|  83|  83| 	return true;
|  84|    |-}
|    |  84|+};
|  85|  85| 
|  86|  86| // Set target as target market.
|  87|  87| // Return true if at least one of markets was changed.

binaries/data/mods/public/simulation/components/Trader.js
|  84| }
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'execute'.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/session/unit_actions.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/session/unit_actions.js
| 530| 530| 
| 531| 531| 	"cancel-setup-trade-route":
| 532| 532| 	{
| 533|    |-		"execute":function(target, action, selection, queued)
|    | 533|+		"execute": function(target, action, selection, queued)
| 534| 534| 		{
| 535| 535| 			Engine.PostNetworkCommand({
| 536| 536| 				"type": "cancel-setup-trade-route",
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/session/unit_actions.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/session/unit_actions.js
| 575| 575| 				"cursor": "action-cancel-setup-trade-route",
| 576| 576| 				"tooltip": actionInfo.tooltip,
| 577| 577| 				"target": target
| 578|    |-			}
|    | 578|+			};
| 579| 579| 		},
| 580| 580| 		"specificness": 2,
| 581| 581| 	},

binaries/data/mods/public/gui/session/unit_actions.js
| 620| »   »   »   switch·(tradingDetails.type)
|    | [NORMAL] ESLintBear (default-case):
|    | Expected a default case.

binaries/data/mods/public/gui/session/unit_actions.js
| 578| »   »   »   }
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
| 527| 527| 			if (cmpGarrisonHolder)
| 528| 528| 			{
| 529| 529| 				// Only the owner of the garrisonHolder may unload entities from any owners
| 530|    |-				if (!IsOwnedByPlayer(player, garrisonHolder) && !data.controlAllUnits
| 531|    |-				    && player != +cmd.owner)
|    | 530|+				if (!IsOwnedByPlayer(player, garrisonHolder) && !data.controlAllUnits &&
|    | 531|+				    player != +cmd.owner)
| 532| 532| 						continue;
| 533| 533| 
| 534| 534| 				if (!cmpGarrisonHolder.UnloadTemplate(cmd.template, cmd.owner, cmd.all))
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 5 tabs but found 6.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
| 529| 529| 				// Only the owner of the garrisonHolder may unload entities from any owners
| 530| 530| 				if (!IsOwnedByPlayer(player, garrisonHolder) && !data.controlAllUnits
| 531| 531| 				    && player != +cmd.owner)
| 532|    |-						continue;
|    | 532|+					continue;
| 533| 533| 
| 534| 534| 				if (!cmpGarrisonHolder.UnloadTemplate(cmd.template, cmd.owner, cmd.all))
| 535| 535| 					notifyUnloadFailure(player, garrisonHolder);
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space after key 'metadata'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1142|1142| 
|1143|1143| 	// send Metadata info if any
|1144|1144| 	if (cmd.metadata)
|1145|    |-		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player } );
|    |1145|+		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata": cmd.metadata, "owner" : player } );
|1146|1146| 
|1147|1147| 	// Tell the units to start building this new entity
|1148|1148| 	if (cmd.autorepair)
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space after key 'owner'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1142|1142| 
|1143|1143| 	// send Metadata info if any
|1144|1144| 	if (cmd.metadata)
|1145|    |-		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player } );
|    |1145|+		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner": player } );
|1146|1146| 
|1147|1147| 	// Tell the units to start building this new entity
|1148|1148| 	if (cmd.autorepair)
|    | [NORMAL] ESLintBear (space-in-parens):
|    | There should be no spaces inside this paren.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1142|1142| 
|1143|1143| 	// send Metadata info if any
|1144|1144| 	if (cmd.metadata)
|1145|    |-		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player } );
|    |1145|+		Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player });
|1146|1146| 
|1147|1147| 	// Tell the units to start building this new entity
|1148|1148| 	if (cmd.autorepair)
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1250|1250| 		}
|1251|1251| 
|1252|1252| 		lastTowerControlGroup = cmpSnappedStartObstruction.GetControlGroup();
|1253|    |-		//warn("setting lastTowerControlGroup to control group of start snapped entity " + cmd.startSnappedEntity + ": " + lastTowerControlGroup);
|    |1253|+		// warn("setting lastTowerControlGroup to control group of start snapped entity " + cmd.startSnappedEntity + ": " + lastTowerControlGroup);
|1254|1254| 	}
|1255|1255| 
|1256|1256| 	var i = 0;
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1314|1314| 
|1315|1315| 				if (i > 0)
|1316|1316| 				{
|1317|    |-					//warn("   updating previous wall piece's secondary control group to " + newTowerControlGroup);
|    |1317|+					// warn("   updating previous wall piece's secondary control group to " + newTowerControlGroup);
|1318|1318| 					var cmpPreviousObstruction = Engine.QueryInterface(pieces[i-1].ent, IID_Obstruction);
|1319|1319| 					// TODO: ensure that cmpPreviousObstruction exists
|1320|1320| 					// TODO: ensure that the previous obstruction does not yet have a secondary control group set
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1477|1477| 		// Check that all its members are selected
|1478|1478| 		var fid = formationIds[0];
|1479|1479| 		var cmpFormation = Engine.QueryInterface(+fid, IID_Formation);
|1480|    |-		if (cmpFormation && cmpFormation.GetMemberCount() == formation.members[fid].length
|1481|    |-			&& cmpFormation.GetMemberCount() == formation.entities.length)
|    |1480|+		if (cmpFormation && cmpFormation.GetMemberCount() == formation.members[fid].length &&
|    |1481|+			cmpFormation.GetMemberCount() == formation.entities.length)
|1482|1482| 		{
|1483|1483| 			cmpFormation.DeleteTwinFormations();
|1484|1484| 			// The whole formation was selected, so reuse its controller for this command
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1585|1585| 		for (var i = matrix.length - 1; i >= 0 && !closeClusters; --i)
|1586|1586| 			for (var j = i - 1; j >= 0 && !closeClusters; --j)
|1587|1587| 				if (matrix[i][j] < distSq)
|1588|    |-					closeClusters = [i,j];
|    |1588|+					closeClusters = [i, j];
|1589|1589| 
|1590|1590| 		// if no more close clusters found, just return all found clusters so far
|1591|1591| 		if (!closeClusters)
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1607|1607| 		}
|1608|1608| 		// remove the rows and columns in the matrix for the merged clusters,
|1609|1609| 		// and the clusters themselves from the cluster list
|1610|    |-		clusters.splice(closeClusters[0],1);
|    |1610|+		clusters.splice(closeClusters[0], 1);
|1611|1611| 		clusters.splice(closeClusters[1],1);
|1612|1612| 		matrix.splice(closeClusters[0],1);
|1613|1613| 		matrix.splice(closeClusters[1],1);
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1608|1608| 		// remove the rows and columns in the matrix for the merged clusters,
|1609|1609| 		// and the clusters themselves from the cluster list
|1610|1610| 		clusters.splice(closeClusters[0],1);
|1611|    |-		clusters.splice(closeClusters[1],1);
|    |1611|+		clusters.splice(closeClusters[1], 1);
|1612|1612| 		matrix.splice(closeClusters[0],1);
|1613|1613| 		matrix.splice(closeClusters[1],1);
|1614|1614| 		for (let i = 0; i < matrix.length; ++i)
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1609|1609| 		// and the clusters themselves from the cluster list
|1610|1610| 		clusters.splice(closeClusters[0],1);
|1611|1611| 		clusters.splice(closeClusters[1],1);
|1612|    |-		matrix.splice(closeClusters[0],1);
|    |1612|+		matrix.splice(closeClusters[0], 1);
|1613|1613| 		matrix.splice(closeClusters[1],1);
|1614|1614| 		for (let i = 0; i < matrix.length; ++i)
|1615|1615| 		{
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1610|1610| 		clusters.splice(closeClusters[0],1);
|1611|1611| 		clusters.splice(closeClusters[1],1);
|1612|1612| 		matrix.splice(closeClusters[0],1);
|1613|    |-		matrix.splice(closeClusters[1],1);
|    |1613|+		matrix.splice(closeClusters[1], 1);
|1614|1614| 		for (let i = 0; i < matrix.length; ++i)
|1615|1615| 		{
|1616|1616| 			if (matrix[i].length > closeClusters[0])
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1614|1614| 		for (let i = 0; i < matrix.length; ++i)
|1615|1615| 		{
|1616|1616| 			if (matrix[i].length > closeClusters[0])
|1617|    |-				matrix[i].splice(closeClusters[0],1);
|    |1617|+				matrix[i].splice(closeClusters[0], 1);
|1618|1618| 			if (matrix[i].length > closeClusters[1])
|1619|1619| 				matrix[i].splice(closeClusters[1],1);
|1620|1620| 		}
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
|1616|1616| 			if (matrix[i].length > closeClusters[0])
|1617|1617| 				matrix[i].splice(closeClusters[0],1);
|1618|1618| 			if (matrix[i].length > closeClusters[1])
|1619|    |-				matrix[i].splice(closeClusters[1],1);
|    |1619|+				matrix[i].splice(closeClusters[1], 1);
|1620|1620| 		}
|1621|1621| 		// add a new row of distances to the matrix and the new cluster
|1622|1622| 		clusters.push(newCluster);

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

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

binaries/data/mods/public/simulation/helpers/Commands.js
| 788| »   »   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
|1273| ····»   »   »   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
|1274| ····»   »   »   break;
|    | [NORMAL] ESLintBear (no-mixed-spaces-and-tabs):
|    | Mixed spaces and tabs.

binaries/data/mods/public/simulation/helpers/Commands.js
|1504| »   »   »   »   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
|1583| »   »   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
|1600| »   »   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
|1614| »   »   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
| 531| »   »   »   »   ····&&·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
| 726| »   »   »   »   var·cmpGUIInterface·=·Engine.QueryInterface(SYSTEM_ENTITY,·IID_GuiInterface);
|    | [NORMAL] JSHintBear:
|    | 'cmpGUIInterface' is already defined.

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

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

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

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

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

binaries/data/mods/public/simulation/helpers/Commands.js
|1481| »   »   »   &&·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
|1507| »   »   »   »   »   var·cmpUnitAI·=·Engine.QueryInterface(ent,·IID_UnitAI);
|    | [NORMAL] JSHintBear:
|    | 'cmpUnitAI' is already defined.

binaries/data/mods/public/simulation/helpers/Commands.js
|1540| »   »   »   var·cmpFormation·=·Engine.QueryInterface(formationEnt,·IID_Formation);
|    | [NORMAL] JSHintBear:
|    | 'cmpFormation' is already defined.
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 788| 788| 					this.FinishOrder();
| 789| 789| 					return;
| 790| 790| 				}
| 791|    |-				else
| 792|    |-				{
|    | 791|+				
| 793| 792| 					this.SetNextState("GARRISON.APPROACHING");
| 794| 793| 					return;
| 795|    |-				}
|    | 794|+				
| 796| 795| 			}
| 797| 796| 
| 798| 797| 			this.SetNextState("GARRISON.GARRISONING");
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'GARRISON'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1060|1060| 			},
|1061|1061| 		},
|1062|1062| 
|1063|    |-		"GARRISON":{
|    |1063|+		"GARRISON": {
|1064|1064| 			"APPROACHING": {
|1065|1065| 				"enter": function() {
|1066|1066| 					if (!this.MoveToGarrisonRange(this.order.data.target))
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2038|2038| 
|2039|2039| 				"Attacked": function(msg) {
|2040|2040| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2041|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2042|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2041|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2042|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2043|2043| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2044|2044| 				},
|2045|2045| 			},
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2776|2776| 					{
|2777|2777| 						// The building was already finished/fully repaired before we arrived;
|2778|2778| 						// let the ConstructionFinished handler handle this.
|2779|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2779|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2780|2780| 						return true;
|2781|2781| 					}
|2782|2782| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2776|2776| 					{
|2777|2777| 						// The building was already finished/fully repaired before we arrived;
|2778|2778| 						// let the ConstructionFinished handler handle this.
|2779|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2779|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2780|2780| 						return true;
|2781|2781| 					}
|2782|2782| 
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3074|3074| 				this.StopTimer();
|3075|3075| 				this.ResetAnimation();
|3076|3076| 				if (this.formationAnimationVariant)
|3077|    |-					this.SetAnimationVariant(this.formationAnimationVariant)
|    |3077|+					this.SetAnimationVariant(this.formationAnimationVariant);
|3078|3078| 				else
|3079|3079| 					this.SetDefaultAnimationVariant();
|3080|3080| 				var cmpResistance = Engine.QueryInterface(this.entity, IID_Resistance);
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 7.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3300|3300| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3301|3301| 
|3302|3302| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3303|    |-							// only used for domestic animals
|    |3303|+		// only used for domestic animals
|3304|3304| 
|3305|3305| 		// Reuse the same garrison behaviour for animals.
|3306|3306| 		"GARRISON": "INDIVIDUAL.GARRISON",
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3362|3362| 
|3363|3363| UnitAI.prototype.IsAnimal = function()
|3364|3364| {
|3365|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3365|+	return (!!this.template.NaturalBehaviour);
|3366|3366| };
|3367|3367| 
|3368|3368| UnitAI.prototype.IsDangerousAnimal = function()
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3478|3478| 		{
|3479|3479| 			let index = this.GetCurrentState().indexOf(".");
|3480|3480| 			if (index != -1)
|3481|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3481|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3482|3482| 			this.Stop(false);
|3483|3483| 		}
|3484|3484| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3534|3534| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3535|3535| 			continue;
|3536|3536| 		if (i == 0)
|3537|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3537|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3538|3538| 		else
|3539|3539| 			this.orderQueue.splice(i, 1);
|3540|3540| 		Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3534|3534| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3535|3535| 			continue;
|3536|3536| 		if (i == 0)
|3537|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3537|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3538|3538| 		else
|3539|3539| 			this.orderQueue.splice(i, 1);
|3540|3540| 		Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3621|3621| };
|3622|3622| 
|3623|3623| 
|3624|    |-//// FSM linkage functions ////
|    |3624|+// // FSM linkage functions ////
|3625|3625| 
|3626|3626| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3627|3627| UnitAI.prototype.SetNextState = function(state)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3792|3792| 				continue;
|3793|3793| 			if (this.orderQueue[i].type == type)
|3794|3794| 				continue;
|3795|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3795|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3796|3796| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3797|3797| 			return;
|3798|3798| 		}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3792|3792| 				continue;
|3793|3793| 			if (this.orderQueue[i].type == type)
|3794|3794| 				continue;
|3795|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3795|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3796|3796| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3797|3797| 			return;
|3798|3798| 		}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4034|4034| 	if (data.timerRepeat === undefined)
|4035|4035| 		this.timer = undefined;
|4036|4036| 
|4037|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4037|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4038|4038| };
|4039|4039| 
|4040|4040| /**
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4034|4034| 	if (data.timerRepeat === undefined)
|4035|4035| 		this.timer = undefined;
|4036|4036| 
|4037|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4037|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4038|4038| };
|4039|4039| 
|4040|4040| /**
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4079|4079| 	// TODO: This is a bit inefficient since every unit listens to every
|4080|4080| 	// construction message - ideally we could scope it to only the one we're building
|4081|4081| 
|4082|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4082|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4083|4083| };
|4084|4084| 
|4085|4085| UnitAI.prototype.OnGlobalEntityRenamed = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4079|4079| 	// TODO: This is a bit inefficient since every unit listens to every
|4080|4080| 	// construction message - ideally we could scope it to only the one we're building
|4081|4081| 
|4082|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4082|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4083|4083| };
|4084|4084| 
|4085|4085| UnitAI.prototype.OnGlobalEntityRenamed = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4110|4110| 	if (msg.fromStatusEffect)
|4111|4111| 		return;
|4112|4112| 
|4113|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4113|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4114|4114| };
|4115|4115| 
|4116|4116| UnitAI.prototype.OnGuardedAttacked = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4110|4110| 	if (msg.fromStatusEffect)
|4111|4111| 		return;
|4112|4112| 
|4113|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4113|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4114|4114| };
|4115|4115| 
|4116|4116| UnitAI.prototype.OnGuardedAttacked = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4115|4115| 
|4116|4116| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4117|4117| {
|4118|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4118|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4119|4119| };
|4120|4120| 
|4121|4121| UnitAI.prototype.OnHealthChanged = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4115|4115| 
|4116|4116| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4117|4117| {
|4118|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4118|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4119|4119| };
|4120|4120| 
|4121|4121| UnitAI.prototype.OnHealthChanged = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4120|4120| 
|4121|4121| UnitAI.prototype.OnHealthChanged = function(msg)
|4122|4122| {
|4123|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4123|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4124|4124| };
|4125|4125| 
|4126|4126| UnitAI.prototype.OnRangeUpdate = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4120|4120| 
|4121|4121| UnitAI.prototype.OnHealthChanged = function(msg)
|4122|4122| {
|4123|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4123|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4124|4124| };
|4125|4125| 
|4126|4126| UnitAI.prototype.OnRangeUpdate = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4126|4126| UnitAI.prototype.OnRangeUpdate = function(msg)
|4127|4127| {
|4128|4128| 	if (msg.tag == this.losRangeQuery)
|4129|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4129|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4130|4130| 	else if (msg.tag == this.losHealRangeQuery)
|4131|4131| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4132|4132| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4126|4126| UnitAI.prototype.OnRangeUpdate = function(msg)
|4127|4127| {
|4128|4128| 	if (msg.tag == this.losRangeQuery)
|4129|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4129|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4130|4130| 	else if (msg.tag == this.losHealRangeQuery)
|4131|4131| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4132|4132| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4128|4128| 	if (msg.tag == this.losRangeQuery)
|4129|4129| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4130|4130| 	else if (msg.tag == this.losHealRangeQuery)
|4131|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4131|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4132|4132| };
|4133|4133| 
|4134|4134| UnitAI.prototype.OnPackFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4128|4128| 	if (msg.tag == this.losRangeQuery)
|4129|4129| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4130|4130| 	else if (msg.tag == this.losHealRangeQuery)
|4131|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4131|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4132|4132| };
|4133|4133| 
|4134|4134| UnitAI.prototype.OnPackFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4133|4133| 
|4134|4134| UnitAI.prototype.OnPackFinished = function(msg)
|4135|4135| {
|4136|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4136|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4137|4137| };
|4138|4138| 
|4139|4139| //// Helper functions to be called by the FSM ////
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4133|4133| 
|4134|4134| UnitAI.prototype.OnPackFinished = function(msg)
|4135|4135| {
|4136|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4136|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4137|4137| };
|4138|4138| 
|4139|4139| //// Helper functions to be called by the FSM ////
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4136|4136| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4137|4137| };
|4138|4138| 
|4139|    |-//// Helper functions to be called by the FSM ////
|    |4139|+// // Helper functions to be called by the FSM ////
|4140|4140| 
|4141|4141| UnitAI.prototype.GetWalkSpeed = function()
|4142|4142| {
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4802|4802| UnitAI.prototype.AttackEntityInZone = function(ents)
|4803|4803| {
|4804|4804| 	var target = ents.find(target =>
|4805|    |-		this.CanAttack(target)
|4806|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4805|+		this.CanAttack(target) &&
|    |4806|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4807|4807| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4808|4808| 	);
|4809|4809| 	if (!target)
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4803|4803| {
|4804|4804| 	var target = ents.find(target =>
|4805|4805| 		this.CanAttack(target)
|4806|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4807|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4806|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4807|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4808|4808| 	);
|4809|4809| 	if (!target)
|4810|4810| 		return false;
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before 'Engine'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4867|4867| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4868|4868| 	if (this.isGuardOf)
|4869|4869| 	{
|4870|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4870|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4871|4871| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4872|4872| 		if (cmpUnitAI && cmpAttack &&
|4873|4873| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 4.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4871|4871| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4872|4872| 		if (cmpUnitAI && cmpAttack &&
|4873|4873| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4874|    |-				return false;
|    |4874|+			return false;
|4875|4875| 	}
|4876|4876| 
|4877|4877| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before 'Engine'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4909|4909| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4910|4910| 	if (this.isGuardOf)
|4911|4911| 	{
|4912|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4912|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4913|4913| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4914|4914| 		if (cmpUnitAI && cmpAttack &&
|4915|4915| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4922|4922| 	return false;
|4923|4923| };
|4924|4924| 
|4925|    |-//// External interface functions ////
|    |4925|+// // External interface functions ////
|4926|4926| 
|4927|4927| UnitAI.prototype.SetFormationController = function(ent)
|4928|4928| {
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5078|5078| 	{
|5079|5079| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5080|5080| 			return;
|5081|    |-		else
|5082|    |-			this.RemoveGuard();
|    |5081|+		this.RemoveGuard();
|5083|5082| 	}
|5084|5083| 
|5085|5084| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5409|5409| 
|5410|5410| 	if (this.IsFormationController())
|5411|5411| 		this.CallMemberFunction("CancelSetupTradeRoute", [target]);
|5412|    |-}
|    |5412|+};
|5413|5413| /**
|5414|5414|  * Adds trade order to the queue. Either walk to the first market, or
|5415|5415|  * start a new route. Not forced, so it can be interrupted by attacks.
|    | [NORMAL] ESLintBear (no-trailing-spaces):
|    | Trailing spaces not allowed.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5430|5430| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5431|5431| 	{
|5432|5432| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5433|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5433|+		if (cmpTrader.HasBothMarkets() &&
|5434|5434| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5435|5435| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5436|5436| 		{
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5711|5711| 				{
|5712|5712| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5713|5713| 					var targetClasses = this.order.data.targetClasses;
|5714|    |-					if (targetClasses.attack && cmpIdentity
|5715|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5714|+					if (targetClasses.attack && cmpIdentity &&
|    |5715|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5716|5716| 						continue;
|5717|5717| 					if (targetClasses.avoid && cmpIdentity
|5718|5718| 						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5714|5714| 					if (targetClasses.attack && cmpIdentity
|5715|5715| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5716|5716| 						continue;
|5717|    |-					if (targetClasses.avoid && cmpIdentity
|5718|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5717|+					if (targetClasses.avoid && cmpIdentity &&
|    |5718|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5719|5719| 						continue;
|5720|5720| 					// Only used by the AIs to prevent some choices of targets
|5721|5721| 					if (targetClasses.vetoEntities && targetClasses.vetoEntities[targ])
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5737|5737| 		{
|5738|5738| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5739|5739| 			var targetClasses = this.order.data.targetClasses;
|5740|    |-			if (cmpIdentity && targetClasses.attack
|5741|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5740|+			if (cmpIdentity && targetClasses.attack &&
|    |5741|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5742|5742| 				continue;
|5743|5743| 			if (cmpIdentity && targetClasses.avoid
|5744|5744| 				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5740|5740| 			if (cmpIdentity && targetClasses.attack
|5741|5741| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5742|5742| 				continue;
|5743|    |-			if (cmpIdentity && targetClasses.avoid
|5744|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5743|+			if (cmpIdentity && targetClasses.avoid &&
|    |5744|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5745|5745| 				continue;
|5746|5746| 			// Only used by the AIs to prevent some choices of targets
|5747|5747| 			if (targetClasses.vetoEntities && targetClasses.vetoEntities[targ])
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5883|5883| 
|5884|5884| UnitAI.prototype.SetHeldPosition = function(x, z)
|5885|5885| {
|5886|    |-	this.heldPosition = {"x": x, "z": z};
|    |5886|+	this.heldPosition = { "x": x, "z": z};
|5887|5887| };
|5888|5888| 
|5889|5889| UnitAI.prototype.SetHeldPositionOnEntity = function(entity)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5883|5883| 
|5884|5884| UnitAI.prototype.SetHeldPosition = function(x, z)
|5885|5885| {
|5886|    |-	this.heldPosition = {"x": x, "z": z};
|    |5886|+	this.heldPosition = {"x": x, "z": z };
|5887|5887| };
|5888|5888| 
|5889|5889| UnitAI.prototype.SetHeldPositionOnEntity = function(entity)
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5910|5910| 	return false;
|5911|5911| };
|5912|5912| 
|5913|    |-//// Helper functions ////
|    |5913|+// // Helper functions ////
|5914|5914| 
|5915|5915| /**
|5916|5916|  * General getter for ranges.
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5929|5929| 		return undefined;
|5930|5930| 
|5931|5931| 	return component.GetRange(type);
|5932|    |-}
|    |5932|+};
|5933|5933| 
|5934|5934| UnitAI.prototype.CanAttack = function(target)
|5935|5935| {
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|6127|6127| 	return cmpPack && cmpPack.IsPacking();
|6128|6128| };
|6129|6129| 
|6130|    |-//// Formation specific functions ////
|    |6130|+// // Formation specific functions ////
|6131|6131| 
|6132|6132| UnitAI.prototype.IsAttackingAsFormation = function()
|6133|6133| {
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|6132|6132| UnitAI.prototype.IsAttackingAsFormation = function()
|6133|6133| {
|6134|6134| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6135|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6136|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6135|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6136|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6137|6137| };
|6138|6138| 
|6139|6139| //// Animal specific functions ////
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|6136|6136| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6137|6137| };
|6138|6138| 
|6139|    |-//// Animal specific functions ////
|    |6139|+// // Animal specific functions ////
|6140|6140| 
|6141|6141| UnitAI.prototype.MoveRandomly = function(distance)
|6142|6142| {

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|3939| »   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
|4789| »   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
|4804| »   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
|4850| »   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
|4873| »   »   ····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
|2042| »   »   »   »   »   »   &&·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
|3077| »   »   »   »   »   this.SetAnimationVariant(this.formationAnimationVariant)
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|5741| »   »   »   »   &&·!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
|5744| »   »   »   »   &&·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
|5932| }
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

Freagarach accepted this revision.Mar 6 2020, 7:38 PM
  • Works as intended.
  • Text looks good.

Check nothing is broken by this diff.

  • I couldn't break it at least.
This revision is now accepted and ready to land.Mar 6 2020, 7:38 PM
Angen added a comment.Mar 7 2020, 12:31 PM

http://irclogs.wildfiregames.com/2020-03/2020-03-06-QuakeNet-%230ad-dev.log

16:02 < elexis> I dont know why forEach was used there other than consistency, with the function above, perhaps there is a reason, but if there is, its not clear to me
16:03 < elexis> otherwise I dont see any syntax error
16:03 < elexis> no objections that is
16:04 < elexis> (performance doesnt matter here since its only one call per click, but the difference might be relevant in areas that are called per entity per turn)
16:06 < elexis> (for (let cmpUnitAI of GetFormationUnitAIs(data.entities, player)) would be the alternative)

mainly for that, whole file is using .forEach with GetFormationUnitAIs

This revision was automatically updated to reflect the committed changes.