Page MenuHomeWildfire Games

Stop dodging arrows by spamclicking or patrol: Lower speed at short distances
AbandonedPublic

Authored by bb on May 24 2020, 11:10 PM.

Details

Reviewers
wraitii
Silier
Trac Tickets
#5106
Summary

When giving repeated movement orders or patrolling a short distance, one can dodge arrows (commonly called "dancing"). This patch makes units walk slower on short distances, when given a walk, walkAndFight or patrol order. Hereby it stops dodging arrows.

At longer distances and for other orders nothing ought to be changed.

Test Plan

Fail to dance, fail to dance using formations.
Give short ranged gather or attack orders, and see nothing has changed.
Give long range walk, walkAndFight and patrol orders and see nothing has changed.

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
Silier added a subscriber: Silier.May 24 2020, 11:30 PM

Looks good, but I have one concern. Player does not have to click in small distance from unit. Player can click further away in direction to dance so distance to target position will not be short.

bb added a comment.May 24 2020, 11:54 PM

For sure one can do this, but is it valuable? one needs 100% attention from the player to do so (one can't shift click anymore), so moving other troops got impossible and such

bb updated this revision to Diff 12014.May 25 2020, 10:13 PM

Don't create Vector2D for performance

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

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

bb updated this revision to Diff 12016.May 25 2020, 10:21 PM

Persist => Ensure

bb added a comment.May 25 2020, 10:25 PM

One could wonder if rP17208 is still required

Stan added a subscriber: Stan.May 25 2020, 10:27 PM
Stan added inline comments.
binaries/data/mods/public/simulation/components/Formation.js
901

Strange that doesn't throw a warning that it's defined in the outer scope, I guess js doesn't care. Maybe it could be defined before and reused.

906

check for unitmotion?
Can we use this.member instead of functions?

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

Maybe query it later if needed?

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 141| 141| 	this.formationMembersWithAura = []; // Members with a formation aura
| 142| 142| 	this.width = 0;
| 143| 143| 	this.depth = 0;
| 144|    |-	this.oldOrientation = {"sin": 0, "cos": 0};
|    | 144|+	this.oldOrientation = { "sin": 0, "cos": 0};
| 145| 145| 	this.twinFormations = [];
| 146| 146| 	// distance from which two twin formations will merge into one.
| 147| 147| 	this.formationSeparation = 0;
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 141| 141| 	this.formationMembersWithAura = []; // Members with a formation aura
| 142| 142| 	this.width = 0;
| 143| 143| 	this.depth = 0;
| 144|    |-	this.oldOrientation = {"sin": 0, "cos": 0};
|    | 144|+	this.oldOrientation = {"sin": 0, "cos": 0 };
| 145| 145| 	this.twinFormations = [];
| 146| 146| 	// distance from which two twin formations will merge into one.
| 147| 147| 	this.formationSeparation = 0;
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 179| 179| 
| 180| 180| Formation.prototype.GetSize = function()
| 181| 181| {
| 182|    |-	return {"width": this.width, "depth": this.depth};
|    | 182|+	return { "width": this.width, "depth": this.depth};
| 183| 183| };
| 184| 184| 
| 185| 185| Formation.prototype.GetSpeedMultiplier = function()
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 179| 179| 
| 180| 180| Formation.prototype.GetSize = function()
| 181| 181| {
| 182|    |-	return {"width": this.width, "depth": this.depth};
|    | 182|+	return {"width": this.width, "depth": this.depth };
| 183| 183| };
| 184| 184| 
| 185| 185| Formation.prototype.GetSpeedMultiplier = function()
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 612| 612| 			footprints.push(cmpFootprint.GetShape());
| 613| 613| 	}
| 614| 614| 	if (!footprints.length)
| 615|    |-		return {"width":1, "depth": 1};
|    | 615|+		return { "width":1, "depth": 1};
| 616| 616| 
| 617| 617| 	var r = {"width": 0, "depth": 0};
| 618| 618| 	for (var shape of footprints)
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'width'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 612| 612| 			footprints.push(cmpFootprint.GetShape());
| 613| 613| 	}
| 614| 614| 	if (!footprints.length)
| 615|    |-		return {"width":1, "depth": 1};
|    | 615|+		return {"width": 1, "depth": 1};
| 616| 616| 
| 617| 617| 	var r = {"width": 0, "depth": 0};
| 618| 618| 	for (var shape of footprints)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 612| 612| 			footprints.push(cmpFootprint.GetShape());
| 613| 613| 	}
| 614| 614| 	if (!footprints.length)
| 615|    |-		return {"width":1, "depth": 1};
|    | 615|+		return {"width":1, "depth": 1 };
| 616| 616| 
| 617| 617| 	var r = {"width": 0, "depth": 0};
| 618| 618| 	for (var shape of footprints)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 614| 614| 	if (!footprints.length)
| 615| 615| 		return {"width":1, "depth": 1};
| 616| 616| 
| 617|    |-	var r = {"width": 0, "depth": 0};
|    | 617|+	var r = { "width": 0, "depth": 0};
| 618| 618| 	for (var shape of footprints)
| 619| 619| 	{
| 620| 620| 		if (shape.type == "circle")
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 614| 614| 	if (!footprints.length)
| 615| 615| 		return {"width":1, "depth": 1};
| 616| 616| 
| 617|    |-	var r = {"width": 0, "depth": 0};
|    | 617|+	var r = {"width": 0, "depth": 0 };
| 618| 618| 	for (var shape of footprints)
| 619| 619| 	{
| 620| 620| 		if (shape.type == "circle")
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 640| 640| 	separation.depth *= this.separationMultiplier.depth;
| 641| 641| 
| 642| 642| 	if (this.columnar)
| 643|    |-		var sortingClasses = ["Cavalry","Infantry"];
|    | 643|+		var sortingClasses = ["Cavalry", "Infantry"];
| 644| 644| 	else
| 645| 645| 		var sortingClasses = this.sortingClasses.slice();
| 646| 646| 	sortingClasses.push("Unknown");
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 660| 660| 		{
| 661| 661| 			if (classes.indexOf(sortingClasses[c]) > -1)
| 662| 662| 			{
| 663|    |-				types[sortingClasses[c]].push({"ent": active[i], "pos": positions[i]});
|    | 663|+				types[sortingClasses[c]].push({ "ent": active[i], "pos": positions[i]});
| 664| 664| 				done = true;
| 665| 665| 				break;
| 666| 666| 			}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 660| 660| 		{
| 661| 661| 			if (classes.indexOf(sortingClasses[c]) > -1)
| 662| 662| 			{
| 663|    |-				types[sortingClasses[c]].push({"ent": active[i], "pos": positions[i]});
|    | 663|+				types[sortingClasses[c]].push({"ent": active[i], "pos": positions[i] });
| 664| 664| 				done = true;
| 665| 665| 				break;
| 666| 666| 			}
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["Unknown"] is better written in dot notation.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 666| 666| 			}
| 667| 667| 		}
| 668| 668| 		if (!done)
| 669|    |-			types["Unknown"].push({"ent": active[i], "pos": positions[i]});
|    | 669|+			types.Unknown.push({"ent": active[i], "pos": positions[i]});
| 670| 670| 	}
| 671| 671| 
| 672| 672| 	var count = active.length;
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 666| 666| 			}
| 667| 667| 		}
| 668| 668| 		if (!done)
| 669|    |-			types["Unknown"].push({"ent": active[i], "pos": positions[i]});
|    | 669|+			types["Unknown"].push({ "ent": active[i], "pos": positions[i]});
| 670| 670| 	}
| 671| 671| 
| 672| 672| 	var count = active.length;
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 666| 666| 			}
| 667| 667| 		}
| 668| 668| 		if (!done)
| 669|    |-			types["Unknown"].push({"ent": active[i], "pos": positions[i]});
|    | 669|+			types["Unknown"].push({"ent": active[i], "pos": positions[i] });
| 670| 670| 	}
| 671| 671| 
| 672| 672| 	var count = active.length;
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 683| 683| 	if (this.columnar)
| 684| 684| 	{
| 685| 685| 		shape = "square";
| 686|    |-		cols = Math.min(count,3);
|    | 686|+		cols = Math.min(count, 3);
| 687| 687| 		shiftRows = false;
| 688| 688| 		centerGap = 0;
| 689| 689| 		sortingOrder = null;
|    | [NORMAL] ESLintBear (space-before-function-paren):
|    | Unexpected space before function parentheses.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 778| 778| 	// calculating offset distances without a zero average makes no sense, as the formation
| 779| 779| 	// will jump to a different position any time
| 780| 780| 	var avgoffset = Vector2D.average(offsets);
| 781|    |-	offsets.forEach(function (o) {o.sub(avgoffset);});
|    | 781|+	offsets.forEach(function(o) {o.sub(avgoffset);});
| 782| 782| 
| 783| 783| 	// sort the available places in certain ways
| 784| 784| 	// the places first in the list will contain the heaviest units as defined by the order
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 837| 837| 			closestOffsetId = i;
| 838| 838| 		}
| 839| 839| 	}
| 840|    |-	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
|    | 840|+	this.memberPositions[entPos.ent] = { "row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
| 841| 841| 	return closestOffsetId;
| 842| 842| };
| 843| 843| 
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'column'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 837| 837| 			closestOffsetId = i;
| 838| 838| 		}
| 839| 839| 	}
| 840|    |-	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
|    | 840|+	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column": offsets[closestOffsetId].column};
| 841| 841| 	return closestOffsetId;
| 842| 842| };
| 843| 843| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 837| 837| 			closestOffsetId = i;
| 838| 838| 		}
| 839| 839| 	}
| 840|    |-	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
|    | 840|+	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column };
| 841| 841| 	return closestOffsetId;
| 842| 842| };
| 843| 843| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 847| 847| Formation.prototype.GetRealOffsetPositions = function(offsets, pos)
| 848| 848| {
| 849| 849| 	var offsetPositions = [];
| 850|    |-	var {sin, cos} = this.GetEstimatedOrientation(pos);
|    | 850|+	var { sin, cos} = this.GetEstimatedOrientation(pos);
| 851| 851| 	// calculate the world positions
| 852| 852| 	for (var o of offsets)
| 853| 853| 		offsetPositions.push(new Vector2D(pos.x + o.y * sin + o.x * cos, pos.y + o.y * cos - o.x * sin));
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 847| 847| Formation.prototype.GetRealOffsetPositions = function(offsets, pos)
| 848| 848| {
| 849| 849| 	var offsetPositions = [];
| 850|    |-	var {sin, cos} = this.GetEstimatedOrientation(pos);
|    | 850|+	var {sin, cos } = this.GetEstimatedOrientation(pos);
| 851| 851| 	// calculate the world positions
| 852| 852| 	for (var o of offsets)
| 853| 853| 		offsetPositions.push(new Vector2D(pos.x + o.y * sin + o.x * cos, pos.y + o.y * cos - o.x * sin));
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 864| 864| Formation.prototype.GetEstimatedOrientation = function(pos)
| 865| 865| {
| 866| 866| 	var cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI);
| 867|    |-	var r = {"sin": 0, "cos": 1};
|    | 867|+	var r = { "sin": 0, "cos": 1};
| 868| 868| 	var unitAIState = cmpUnitAI.GetCurrentState();
| 869| 869| 	if (unitAIState == "FORMATIONCONTROLLER.WALKING" || unitAIState == "FORMATIONCONTROLLER.COMBAT.APPROACHING")
| 870| 870| 	{
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 864| 864| Formation.prototype.GetEstimatedOrientation = function(pos)
| 865| 865| {
| 866| 866| 	var cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI);
| 867|    |-	var r = {"sin": 0, "cos": 1};
|    | 867|+	var r = {"sin": 0, "cos": 1 };
| 868| 868| 	var unitAIState = cmpUnitAI.GetCurrentState();
| 869| 869| 	if (unitAIState == "FORMATIONCONTROLLER.WALKING" || unitAIState == "FORMATIONCONTROLLER.COMBAT.APPROACHING")
| 870| 870| 	{
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 904| 904| 	}
| 905| 905| 	let cmpUnitMotion = Engine.QueryInterface(this.entity, IID_UnitMotion);
| 906| 906| 	return minSpeed * this.GetSpeedMultiplier() / cmpUnitMotion.GetWalkSpeed();
| 907|    |-}
|    | 907|+};
| 908| 908| 
| 909| 909| /**
| 910| 910|  * Set formation controller's speed based on its current members.
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 952| 952| 		cmpOtherFormation.RemoveMembers(otherMembers);
| 953| 953| 		this.AddMembers(otherMembers);
| 954| 954| 		Engine.DestroyEntity(this.twinFormations[i]);
| 955|    |-		this.twinFormations.splice(i,1);
|    | 955|+		this.twinFormations.splice(i, 1);
| 956| 956| 	}
| 957| 957| 	// Switch between column and box if necessary
| 958| 958| 	var cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI);

binaries/data/mods/public/simulation/components/Formation.js
| 463| »   for·(var·ent·of·this.formationMembersWithAura)
|    | [NORMAL] JSHintBear:
|    | 'ent' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 510| »   var·cmpPosition·=·Engine.QueryInterface(this.entity,·IID_Position);
|    | [NORMAL] JSHintBear:
|    | 'cmpPosition' is already defined.

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

binaries/data/mods/public/simulation/components/Formation.js
| 593| »   var·cmpPosition·=·Engine.QueryInterface(this.entity,·IID_Position);
|    | [NORMAL] JSHintBear:
|    | 'cmpPosition' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 645| »   »   var·sortingClasses·=·this.sortingClasses.slice();
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 654| »   for·(var·i·in·active)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 669| »   »   »   types["Unknown"].push({"ent":·active[i],·"pos":·positions[i]});
|    | [NORMAL] JSHintBear:
|    | ['Unknown'] is better written in dot notation.

binaries/data/mods/public/simulation/components/Formation.js
| 708| »   »   for·(var·i·=·0;·i·<·count;·++i)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 742| »   »   »   »   »   var·n·=·r·+·1;
|    | [NORMAL] JSHintBear:
|    | 'n' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 744| »   »   »   »   »   var·n·=·r·*·2·+·1;
|    | [NORMAL] JSHintBear:
|    | 'n' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 748| »   »   »   for·(var·c·=·0;·c·<·n·&&·left·>·0;·++c)
|    | [NORMAL] JSHintBear:
|    | 'c' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 755| »   »   »   »   »   var·x·=·side·*·Math.ceil(c/2)·*·separation.width;
|    | [NORMAL] JSHintBear:
|    | 'x' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 758| »   »   »   »   »   if·(x·==·0)·//·don't·use·the·center·position·with·a·center·gap
|    | [NORMAL] JSHintBear:
|    | 'x' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 760| »   »   »   »   »   x·+=·side·*·centerGap·/·2;
|    | [NORMAL] JSHintBear:
|    | 'x' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 766| »   »   »   »   offsets.push(new·Vector2D(x·+·r1,·z·+·r2));
|    | [NORMAL] JSHintBear:
|    | 'x' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 746| »   »   »   if·(!shiftRows·&&·n·>·left)
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 747| »   »   »   »   n·=·left;
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 748| »   »   »   for·(var·c·=·0;·c·<·n·&&·left·>·0;·++c)
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 752| »   »   »   »   if·(n%2·==·0)
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 762| »   »   »   »   var·column·=·Math.ceil(n/2)·+·Math.ceil(c/2)·*·side;
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 772| »   »   »   this.maxColumnsUsed[r]·=·n;
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 801| »   for·(var·i·=·sortingClasses.length;·i;·--i)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 646| »   sortingClasses.push("Unknown");
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 651| »   for·(var·i·=·0;·i·<·sortingClasses.length;·++i)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 652| »   »   types[sortingClasses[i]]·=·[];
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 659| »   »   for·(var·c·=·0;·c·<·sortingClasses.length;·++c)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 661| »   »   »   if·(classes.indexOf(sortingClasses[c])·>·-1)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 663| »   »   »   »   types[sortingClasses[c]].push({"ent":·active[i],·"pos":·positions[i]});
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 801| »   for·(var·i·=·sortingClasses.length;·i;·--i)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 803| »   »   var·t·=·types[sortingClasses[i-1]];
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 907| }
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.
|    | [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
|1072|1072| 			},
|1073|1073| 		},
|1074|1074| 
|1075|    |-		"GARRISON":{
|    |1075|+		"GARRISON": {
|1076|1076| 			"APPROACHING": {
|1077|1077| 				"enter": function() {
|1078|1078| 					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
|2054|2054| 
|2055|2055| 				"Attacked": function(msg) {
|2056|2056| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2057|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2058|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2057|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2058|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2059|2059| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2060|2060| 				},
|2061|2061| 			},
|    | [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
|2213|2213| 					"MovementUpdate": function(msg) {
|2214|2214| 						// If it looks like the path is failing, and we are close enough (3 tiles) from wanted range
|2215|2215| 						// stop anyways. This avoids pathing for an unreachable goal and reduces lag considerably.
|2216|    |-						if (msg.likelyFailure || 
|    |2216|+						if (msg.likelyFailure ||
|2217|2217| 							msg.obstructed && this.RelaxedMaxRangeCheck(this.order.data, this.order.data.max + this.DefaultRelaxedMaxRange) ||
|2218|2218| 							!msg.obstructed && this.CheckRange(this.order.data))
|2219|2219| 							this.FinishOrder();
|    | [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
|2855|2855| 					{
|2856|2856| 						// The building was already finished/fully repaired before we arrived;
|2857|2857| 						// let the ConstructionFinished handler handle this.
|2858|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2858|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2859|2859| 						return true;
|2860|2860| 					}
|2861|2861| 
|    | [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
|2855|2855| 					{
|2856|2856| 						// The building was already finished/fully repaired before we arrived;
|2857|2857| 						// let the ConstructionFinished handler handle this.
|2858|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2858|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2859|2859| 						return true;
|2860|2860| 					}
|2861|2861| 
|    | [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
|3153|3153| 				this.StopTimer();
|3154|3154| 				this.ResetAnimation();
|3155|3155| 				if (this.formationAnimationVariant)
|3156|    |-					this.SetAnimationVariant(this.formationAnimationVariant)
|    |3156|+					this.SetAnimationVariant(this.formationAnimationVariant);
|3157|3157| 				else
|3158|3158| 					this.SetDefaultAnimationVariant();
|3159|3159| 				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
|3379|3379| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3380|3380| 
|3381|3381| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3382|    |-							// only used for domestic animals
|    |3382|+		// only used for domestic animals
|3383|3383| 
|3384|3384| 		// Reuse the same garrison behaviour for animals.
|3385|3385| 		"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
|3441|3441| 
|3442|3442| UnitAI.prototype.IsAnimal = function()
|3443|3443| {
|3444|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3444|+	return (!!this.template.NaturalBehaviour);
|3445|3445| };
|3446|3446| 
|3447|3447| 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
|3557|3557| 		{
|3558|3558| 			let index = this.GetCurrentState().indexOf(".");
|3559|3559| 			if (index != -1)
|3560|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3560|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3561|3561| 			this.Stop(false);
|3562|3562| 		}
|3563|3563| 
|    | [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
|3613|3613| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3614|3614| 			continue;
|3615|3615| 		if (i == 0)
|3616|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3616|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3617|3617| 		else
|3618|3618| 			this.orderQueue.splice(i, 1);
|3619|3619| 		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
|3613|3613| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3614|3614| 			continue;
|3615|3615| 		if (i == 0)
|3616|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3616|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3617|3617| 		else
|3618|3618| 			this.orderQueue.splice(i, 1);
|3619|3619| 		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
|3700|3700| };
|3701|3701| 
|3702|3702| 
|3703|    |-//// FSM linkage functions ////
|    |3703|+// // FSM linkage functions ////
|3704|3704| 
|3705|3705| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3706|3706| 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
|3871|3871| 				continue;
|3872|3872| 			if (this.orderQueue[i].type == type)
|3873|3873| 				continue;
|3874|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3874|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3875|3875| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3876|3876| 			return;
|3877|3877| 		}
|    | [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
|3871|3871| 				continue;
|3872|3872| 			if (this.orderQueue[i].type == type)
|3873|3873| 				continue;
|3874|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3874|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3875|3875| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3876|3876| 			return;
|3877|3877| 		}
|    | [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
|4113|4113| 	if (data.timerRepeat === undefined)
|4114|4114| 		this.timer = undefined;
|4115|4115| 
|4116|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4116|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4117|4117| };
|4118|4118| 
|4119|4119| /**
|    | [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
|4113|4113| 	if (data.timerRepeat === undefined)
|4114|4114| 		this.timer = undefined;
|4115|4115| 
|4116|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4116|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4117|4117| };
|4118|4118| 
|4119|4119| /**
|    | [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
|4158|4158| 	// TODO: This is a bit inefficient since every unit listens to every
|4159|4159| 	// construction message - ideally we could scope it to only the one we're building
|4160|4160| 
|4161|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4161|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4162|4162| };
|4163|4163| 
|4164|4164| 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
|4158|4158| 	// TODO: This is a bit inefficient since every unit listens to every
|4159|4159| 	// construction message - ideally we could scope it to only the one we're building
|4160|4160| 
|4161|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4161|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4162|4162| };
|4163|4163| 
|4164|4164| 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
|4189|4189| 	if (msg.fromStatusEffect)
|4190|4190| 		return;
|4191|4191| 
|4192|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4192|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4193|4193| };
|4194|4194| 
|4195|4195| 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
|4189|4189| 	if (msg.fromStatusEffect)
|4190|4190| 		return;
|4191|4191| 
|4192|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4192|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4193|4193| };
|4194|4194| 
|4195|4195| 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
|4194|4194| 
|4195|4195| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4196|4196| {
|4197|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4197|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4198|4198| };
|4199|4199| 
|4200|4200| 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
|4194|4194| 
|4195|4195| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4196|4196| {
|4197|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4197|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4198|4198| };
|4199|4199| 
|4200|4200| 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
|4199|4199| 
|4200|4200| UnitAI.prototype.OnHealthChanged = function(msg)
|4201|4201| {
|4202|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4202|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4203|4203| };
|4204|4204| 
|4205|4205| 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
|4199|4199| 
|4200|4200| UnitAI.prototype.OnHealthChanged = function(msg)
|4201|4201| {
|4202|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4202|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4203|4203| };
|4204|4204| 
|4205|4205| 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
|4205|4205| UnitAI.prototype.OnRangeUpdate = function(msg)
|4206|4206| {
|4207|4207| 	if (msg.tag == this.losRangeQuery)
|4208|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4208|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4209|4209| 	else if (msg.tag == this.losHealRangeQuery)
|4210|4210| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4211|4211| };
|    | [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
|4205|4205| UnitAI.prototype.OnRangeUpdate = function(msg)
|4206|4206| {
|4207|4207| 	if (msg.tag == this.losRangeQuery)
|4208|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4208|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4209|4209| 	else if (msg.tag == this.losHealRangeQuery)
|4210|4210| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4211|4211| };
|    | [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
|4207|4207| 	if (msg.tag == this.losRangeQuery)
|4208|4208| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4209|4209| 	else if (msg.tag == this.losHealRangeQuery)
|4210|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4210|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4211|4211| };
|4212|4212| 
|4213|4213| 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
|4207|4207| 	if (msg.tag == this.losRangeQuery)
|4208|4208| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4209|4209| 	else if (msg.tag == this.losHealRangeQuery)
|4210|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4210|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4211|4211| };
|4212|4212| 
|4213|4213| 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
|4212|4212| 
|4213|4213| UnitAI.prototype.OnPackFinished = function(msg)
|4214|4214| {
|4215|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4215|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4216|4216| };
|4217|4217| 
|4218|4218| //// 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
|4212|4212| 
|4213|4213| UnitAI.prototype.OnPackFinished = function(msg)
|4214|4214| {
|4215|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4215|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4216|4216| };
|4217|4217| 
|4218|4218| //// 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
|4215|4215| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4216|4216| };
|4217|4217| 
|4218|    |-//// Helper functions to be called by the FSM ////
|    |4218|+// // Helper functions to be called by the FSM ////
|4219|4219| 
|4220|4220| UnitAI.prototype.GetWalkSpeed = function()
|4221|4221| {
|    | [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
|4927|4927| UnitAI.prototype.AttackEntityInZone = function(ents)
|4928|4928| {
|4929|4929| 	var target = ents.find(target =>
|4930|    |-		this.CanAttack(target)
|4931|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4930|+		this.CanAttack(target) &&
|    |4931|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4932|4932| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4933|4933| 	);
|4934|4934| 	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
|4928|4928| {
|4929|4929| 	var target = ents.find(target =>
|4930|4930| 		this.CanAttack(target)
|4931|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4932|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4931|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4932|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4933|4933| 	);
|4934|4934| 	if (!target)
|4935|4935| 		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
|4994|4994| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4995|4995| 	if (this.isGuardOf)
|4996|4996| 	{
|4997|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4997|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4998|4998| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4999|4999| 		if (cmpUnitAI && cmpAttack &&
|5000|5000| 		    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
|4998|4998| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4999|4999| 		if (cmpUnitAI && cmpAttack &&
|5000|5000| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|5001|    |-				return false;
|    |5001|+			return false;
|5002|5002| 	}
|5003|5003| 
|5004|5004| 	// 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
|5036|5036| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|5037|5037| 	if (this.isGuardOf)
|5038|5038| 	{
|5039|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |5039|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|5040|5040| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|5041|5041| 		if (cmpUnitAI && cmpAttack &&
|5042|5042| 		    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
|5049|5049| 	return false;
|5050|5050| };
|5051|5051| 
|5052|    |-//// External interface functions ////
|    |5052|+// // External interface functions ////
|5053|5053| 
|5054|5054| UnitAI.prototype.SetFormationController = function(ent)
|5055|5055| {
|    | [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
|5205|5205| 	{
|5206|5206| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5207|5207| 			return;
|5208|    |-		else
|5209|    |-			this.RemoveGuard();
|    |5208|+		this.RemoveGuard();
|5210|5209| 	}
|5211|5210| 
|5212|5211| 	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
|5536|5536| 
|5537|5537| 	if (this.IsFormationController())
|5538|5538| 		this.CallMemberFunction("CancelSetupTradeRoute", [target]);
|5539|    |-}
|    |5539|+};
|5540|5540| /**
|5541|5541|  * Adds trade order to the queue. Either walk to the first market, or
|5542|5542|  * 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
|5557|5557| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5558|5558| 	{
|5559|5559| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5560|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5560|+		if (cmpTrader.HasBothMarkets() &&
|5561|5561| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5562|5562| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5563|5563| 		{
|    | [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
|5838|5838| 				{
|5839|5839| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5840|5840| 					var targetClasses = this.order.data.targetClasses;
|5841|    |-					if (targetClasses.attack && cmpIdentity
|5842|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5841|+					if (targetClasses.attack && cmpIdentity &&
|    |5842|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5843|5843| 						continue;
|5844|5844| 					if (targetClasses.avoid && cmpIdentity
|5845|5845| 						&& 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
|5841|5841| 					if (targetClasses.attack && cmpIdentity
|5842|5842| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5843|5843| 						continue;
|5844|    |-					if (targetClasses.avoid && cmpIdentity
|5845|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5844|+					if (targetClasses.avoid && cmpIdentity &&
|    |5845|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5846|5846| 						continue;
|5847|5847| 					// Only used by the AIs to prevent some choices of targets
|5848|5848| 					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
|5864|5864| 		{
|5865|5865| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5866|5866| 			var targetClasses = this.order.data.targetClasses;
|5867|    |-			if (cmpIdentity && targetClasses.attack
|5868|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5867|+			if (cmpIdentity && targetClasses.attack &&
|    |5868|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5869|5869| 				continue;
|5870|5870| 			if (cmpIdentity && targetClasses.avoid
|5871|5871| 				&& 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
|5867|5867| 			if (cmpIdentity && targetClasses.attack
|5868|5868| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5869|5869| 				continue;
|5870|    |-			if (cmpIdentity && targetClasses.avoid
|5871|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5870|+			if (cmpIdentity && targetClasses.avoid &&
|    |5871|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5872|5872| 				continue;
|5873|5873| 			// Only used by the AIs to prevent some choices of targets
|5874|5874| 			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
|6062|6062| 
|6063|6063| UnitAI.prototype.SetHeldPosition = function(x, z)
|6064|6064| {
|6065|    |-	this.heldPosition = {"x": x, "z": z};
|    |6065|+	this.heldPosition = { "x": x, "z": z};
|6066|6066| };
|6067|6067| 
|6068|6068| 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
|6062|6062| 
|6063|6063| UnitAI.prototype.SetHeldPosition = function(x, z)
|6064|6064| {
|6065|    |-	this.heldPosition = {"x": x, "z": z};
|    |6065|+	this.heldPosition = {"x": x, "z": z };
|6066|6066| };
|6067|6067| 
|6068|6068| 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
|6089|6089| 	return false;
|6090|6090| };
|6091|6091| 
|6092|    |-//// Helper functions ////
|    |6092|+// // Helper functions ////
|6093|6093| 
|6094|6094| /**
|6095|6095|  * 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
|6108|6108| 		return undefined;
|6109|6109| 
|6110|6110| 	return component.GetRange(type);
|6111|    |-}
|    |6111|+};
|6112|6112| 
|6113|6113| UnitAI.prototype.CanAttack = function(target)
|6114|6114| {
|    | [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
|6276|6276| 	return cmpPack && cmpPack.IsPacking();
|6277|6277| };
|6278|6278| 
|6279|    |-//// Formation specific functions ////
|    |6279|+// // Formation specific functions ////
|6280|6280| 
|6281|6281| UnitAI.prototype.IsAttackingAsFormation = function()
|6282|6282| {
|    | [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
|6281|6281| UnitAI.prototype.IsAttackingAsFormation = function()
|6282|6282| {
|6283|6283| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6284|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6285|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6284|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6285|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6286|6286| };
|6287|6287| 
|6288|6288| //// 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
|6285|6285| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6286|6286| };
|6287|6287| 
|6288|    |-//// Animal specific functions ////
|    |6288|+// // Animal specific functions ////
|6289|6289| 
|6290|6290| UnitAI.prototype.MoveRandomly = function(distance)
|6291|6291| {

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
|1264| »   »   »   »   return·false;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'Timer' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
|4018| »   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
|4914| »   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
|4929| »   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
|4977| »   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
|5000| »   »   ····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
|2058| »   »   »   »   »   »   &&·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
|3156| »   »   »   »   »   this.SetAnimationVariant(this.formationAnimationVariant)
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

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

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

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

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

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

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

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

bb marked an inline comment as done.May 25 2020, 10:37 PM
bb added inline comments.
binaries/data/mods/public/simulation/components/Formation.js
901

the one in the outer scope is different though (this are the members, outer scope is the formation ent), probably doesn't error since that is defined later (thus this one forgotten),
did a rename

906

I guess a formation is assumed to have a unitMotion, it is never checked in this component.

What member function you want to use?

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

whatever happens we need it, so better return early if we can't use it (ok in case there is no position component, then we don't need it, but probably we don't have a unitMotion then anyways)

bb updated this revision to Diff 12017.May 25 2020, 10:41 PM
bb marked an inline comment as done.

Name unitMotion components of members of a formation memberUnitMotions

Stan added inline comments.May 25 2020, 10:45 PM
binaries/data/mods/public/simulation/components/Formation.js
906

+this.template.SpeedMultiplier; But I guess it should be cached first so meh (I believe member access is faster than function call. Dunno how often this is called.

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

Alright :)

6014

Only used in the elseif?

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 141| 141| 	this.formationMembersWithAura = []; // Members with a formation aura
| 142| 142| 	this.width = 0;
| 143| 143| 	this.depth = 0;
| 144|    |-	this.oldOrientation = {"sin": 0, "cos": 0};
|    | 144|+	this.oldOrientation = { "sin": 0, "cos": 0};
| 145| 145| 	this.twinFormations = [];
| 146| 146| 	// distance from which two twin formations will merge into one.
| 147| 147| 	this.formationSeparation = 0;
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 141| 141| 	this.formationMembersWithAura = []; // Members with a formation aura
| 142| 142| 	this.width = 0;
| 143| 143| 	this.depth = 0;
| 144|    |-	this.oldOrientation = {"sin": 0, "cos": 0};
|    | 144|+	this.oldOrientation = {"sin": 0, "cos": 0 };
| 145| 145| 	this.twinFormations = [];
| 146| 146| 	// distance from which two twin formations will merge into one.
| 147| 147| 	this.formationSeparation = 0;
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 179| 179| 
| 180| 180| Formation.prototype.GetSize = function()
| 181| 181| {
| 182|    |-	return {"width": this.width, "depth": this.depth};
|    | 182|+	return { "width": this.width, "depth": this.depth};
| 183| 183| };
| 184| 184| 
| 185| 185| Formation.prototype.GetSpeedMultiplier = function()
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 179| 179| 
| 180| 180| Formation.prototype.GetSize = function()
| 181| 181| {
| 182|    |-	return {"width": this.width, "depth": this.depth};
|    | 182|+	return {"width": this.width, "depth": this.depth };
| 183| 183| };
| 184| 184| 
| 185| 185| Formation.prototype.GetSpeedMultiplier = function()
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 612| 612| 			footprints.push(cmpFootprint.GetShape());
| 613| 613| 	}
| 614| 614| 	if (!footprints.length)
| 615|    |-		return {"width":1, "depth": 1};
|    | 615|+		return { "width":1, "depth": 1};
| 616| 616| 
| 617| 617| 	var r = {"width": 0, "depth": 0};
| 618| 618| 	for (var shape of footprints)
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'width'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 612| 612| 			footprints.push(cmpFootprint.GetShape());
| 613| 613| 	}
| 614| 614| 	if (!footprints.length)
| 615|    |-		return {"width":1, "depth": 1};
|    | 615|+		return {"width": 1, "depth": 1};
| 616| 616| 
| 617| 617| 	var r = {"width": 0, "depth": 0};
| 618| 618| 	for (var shape of footprints)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 612| 612| 			footprints.push(cmpFootprint.GetShape());
| 613| 613| 	}
| 614| 614| 	if (!footprints.length)
| 615|    |-		return {"width":1, "depth": 1};
|    | 615|+		return {"width":1, "depth": 1 };
| 616| 616| 
| 617| 617| 	var r = {"width": 0, "depth": 0};
| 618| 618| 	for (var shape of footprints)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 614| 614| 	if (!footprints.length)
| 615| 615| 		return {"width":1, "depth": 1};
| 616| 616| 
| 617|    |-	var r = {"width": 0, "depth": 0};
|    | 617|+	var r = { "width": 0, "depth": 0};
| 618| 618| 	for (var shape of footprints)
| 619| 619| 	{
| 620| 620| 		if (shape.type == "circle")
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 614| 614| 	if (!footprints.length)
| 615| 615| 		return {"width":1, "depth": 1};
| 616| 616| 
| 617|    |-	var r = {"width": 0, "depth": 0};
|    | 617|+	var r = {"width": 0, "depth": 0 };
| 618| 618| 	for (var shape of footprints)
| 619| 619| 	{
| 620| 620| 		if (shape.type == "circle")
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 640| 640| 	separation.depth *= this.separationMultiplier.depth;
| 641| 641| 
| 642| 642| 	if (this.columnar)
| 643|    |-		var sortingClasses = ["Cavalry","Infantry"];
|    | 643|+		var sortingClasses = ["Cavalry", "Infantry"];
| 644| 644| 	else
| 645| 645| 		var sortingClasses = this.sortingClasses.slice();
| 646| 646| 	sortingClasses.push("Unknown");
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 660| 660| 		{
| 661| 661| 			if (classes.indexOf(sortingClasses[c]) > -1)
| 662| 662| 			{
| 663|    |-				types[sortingClasses[c]].push({"ent": active[i], "pos": positions[i]});
|    | 663|+				types[sortingClasses[c]].push({ "ent": active[i], "pos": positions[i]});
| 664| 664| 				done = true;
| 665| 665| 				break;
| 666| 666| 			}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 660| 660| 		{
| 661| 661| 			if (classes.indexOf(sortingClasses[c]) > -1)
| 662| 662| 			{
| 663|    |-				types[sortingClasses[c]].push({"ent": active[i], "pos": positions[i]});
|    | 663|+				types[sortingClasses[c]].push({"ent": active[i], "pos": positions[i] });
| 664| 664| 				done = true;
| 665| 665| 				break;
| 666| 666| 			}
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["Unknown"] is better written in dot notation.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 666| 666| 			}
| 667| 667| 		}
| 668| 668| 		if (!done)
| 669|    |-			types["Unknown"].push({"ent": active[i], "pos": positions[i]});
|    | 669|+			types.Unknown.push({"ent": active[i], "pos": positions[i]});
| 670| 670| 	}
| 671| 671| 
| 672| 672| 	var count = active.length;
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 666| 666| 			}
| 667| 667| 		}
| 668| 668| 		if (!done)
| 669|    |-			types["Unknown"].push({"ent": active[i], "pos": positions[i]});
|    | 669|+			types["Unknown"].push({ "ent": active[i], "pos": positions[i]});
| 670| 670| 	}
| 671| 671| 
| 672| 672| 	var count = active.length;
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 666| 666| 			}
| 667| 667| 		}
| 668| 668| 		if (!done)
| 669|    |-			types["Unknown"].push({"ent": active[i], "pos": positions[i]});
|    | 669|+			types["Unknown"].push({"ent": active[i], "pos": positions[i] });
| 670| 670| 	}
| 671| 671| 
| 672| 672| 	var count = active.length;
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 683| 683| 	if (this.columnar)
| 684| 684| 	{
| 685| 685| 		shape = "square";
| 686|    |-		cols = Math.min(count,3);
|    | 686|+		cols = Math.min(count, 3);
| 687| 687| 		shiftRows = false;
| 688| 688| 		centerGap = 0;
| 689| 689| 		sortingOrder = null;
|    | [NORMAL] ESLintBear (space-before-function-paren):
|    | Unexpected space before function parentheses.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 778| 778| 	// calculating offset distances without a zero average makes no sense, as the formation
| 779| 779| 	// will jump to a different position any time
| 780| 780| 	var avgoffset = Vector2D.average(offsets);
| 781|    |-	offsets.forEach(function (o) {o.sub(avgoffset);});
|    | 781|+	offsets.forEach(function(o) {o.sub(avgoffset);});
| 782| 782| 
| 783| 783| 	// sort the available places in certain ways
| 784| 784| 	// the places first in the list will contain the heaviest units as defined by the order
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 837| 837| 			closestOffsetId = i;
| 838| 838| 		}
| 839| 839| 	}
| 840|    |-	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
|    | 840|+	this.memberPositions[entPos.ent] = { "row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
| 841| 841| 	return closestOffsetId;
| 842| 842| };
| 843| 843| 
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'column'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 837| 837| 			closestOffsetId = i;
| 838| 838| 		}
| 839| 839| 	}
| 840|    |-	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
|    | 840|+	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column": offsets[closestOffsetId].column};
| 841| 841| 	return closestOffsetId;
| 842| 842| };
| 843| 843| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 837| 837| 			closestOffsetId = i;
| 838| 838| 		}
| 839| 839| 	}
| 840|    |-	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
|    | 840|+	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column };
| 841| 841| 	return closestOffsetId;
| 842| 842| };
| 843| 843| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 847| 847| Formation.prototype.GetRealOffsetPositions = function(offsets, pos)
| 848| 848| {
| 849| 849| 	var offsetPositions = [];
| 850|    |-	var {sin, cos} = this.GetEstimatedOrientation(pos);
|    | 850|+	var { sin, cos} = this.GetEstimatedOrientation(pos);
| 851| 851| 	// calculate the world positions
| 852| 852| 	for (var o of offsets)
| 853| 853| 		offsetPositions.push(new Vector2D(pos.x + o.y * sin + o.x * cos, pos.y + o.y * cos - o.x * sin));
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 847| 847| Formation.prototype.GetRealOffsetPositions = function(offsets, pos)
| 848| 848| {
| 849| 849| 	var offsetPositions = [];
| 850|    |-	var {sin, cos} = this.GetEstimatedOrientation(pos);
|    | 850|+	var {sin, cos } = this.GetEstimatedOrientation(pos);
| 851| 851| 	// calculate the world positions
| 852| 852| 	for (var o of offsets)
| 853| 853| 		offsetPositions.push(new Vector2D(pos.x + o.y * sin + o.x * cos, pos.y + o.y * cos - o.x * sin));
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 864| 864| Formation.prototype.GetEstimatedOrientation = function(pos)
| 865| 865| {
| 866| 866| 	var cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI);
| 867|    |-	var r = {"sin": 0, "cos": 1};
|    | 867|+	var r = { "sin": 0, "cos": 1};
| 868| 868| 	var unitAIState = cmpUnitAI.GetCurrentState();
| 869| 869| 	if (unitAIState == "FORMATIONCONTROLLER.WALKING" || unitAIState == "FORMATIONCONTROLLER.COMBAT.APPROACHING")
| 870| 870| 	{
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 864| 864| Formation.prototype.GetEstimatedOrientation = function(pos)
| 865| 865| {
| 866| 866| 	var cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI);
| 867|    |-	var r = {"sin": 0, "cos": 1};
|    | 867|+	var r = {"sin": 0, "cos": 1 };
| 868| 868| 	var unitAIState = cmpUnitAI.GetCurrentState();
| 869| 869| 	if (unitAIState == "FORMATIONCONTROLLER.WALKING" || unitAIState == "FORMATIONCONTROLLER.COMBAT.APPROACHING")
| 870| 870| 	{
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 904| 904| 	}
| 905| 905| 	let cmpUnitMotion = Engine.QueryInterface(this.entity, IID_UnitMotion);
| 906| 906| 	return minSpeed * this.GetSpeedMultiplier() / cmpUnitMotion.GetWalkSpeed();
| 907|    |-}
|    | 907|+};
| 908| 908| 
| 909| 909| /**
| 910| 910|  * Set formation controller's speed based on its current members.
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 952| 952| 		cmpOtherFormation.RemoveMembers(otherMembers);
| 953| 953| 		this.AddMembers(otherMembers);
| 954| 954| 		Engine.DestroyEntity(this.twinFormations[i]);
| 955|    |-		this.twinFormations.splice(i,1);
|    | 955|+		this.twinFormations.splice(i, 1);
| 956| 956| 	}
| 957| 957| 	// Switch between column and box if necessary
| 958| 958| 	var cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI);

binaries/data/mods/public/simulation/components/Formation.js
| 463| »   for·(var·ent·of·this.formationMembersWithAura)
|    | [NORMAL] JSHintBear:
|    | 'ent' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 510| »   var·cmpPosition·=·Engine.QueryInterface(this.entity,·IID_Position);
|    | [NORMAL] JSHintBear:
|    | 'cmpPosition' is already defined.

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

binaries/data/mods/public/simulation/components/Formation.js
| 593| »   var·cmpPosition·=·Engine.QueryInterface(this.entity,·IID_Position);
|    | [NORMAL] JSHintBear:
|    | 'cmpPosition' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 645| »   »   var·sortingClasses·=·this.sortingClasses.slice();
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 654| »   for·(var·i·in·active)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 669| »   »   »   types["Unknown"].push({"ent":·active[i],·"pos":·positions[i]});
|    | [NORMAL] JSHintBear:
|    | ['Unknown'] is better written in dot notation.

binaries/data/mods/public/simulation/components/Formation.js
| 708| »   »   for·(var·i·=·0;·i·<·count;·++i)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 742| »   »   »   »   »   var·n·=·r·+·1;
|    | [NORMAL] JSHintBear:
|    | 'n' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 744| »   »   »   »   »   var·n·=·r·*·2·+·1;
|    | [NORMAL] JSHintBear:
|    | 'n' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 748| »   »   »   for·(var·c·=·0;·c·<·n·&&·left·>·0;·++c)
|    | [NORMAL] JSHintBear:
|    | 'c' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 755| »   »   »   »   »   var·x·=·side·*·Math.ceil(c/2)·*·separation.width;
|    | [NORMAL] JSHintBear:
|    | 'x' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 758| »   »   »   »   »   if·(x·==·0)·//·don't·use·the·center·position·with·a·center·gap
|    | [NORMAL] JSHintBear:
|    | 'x' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 760| »   »   »   »   »   x·+=·side·*·centerGap·/·2;
|    | [NORMAL] JSHintBear:
|    | 'x' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 766| »   »   »   »   offsets.push(new·Vector2D(x·+·r1,·z·+·r2));
|    | [NORMAL] JSHintBear:
|    | 'x' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 746| »   »   »   if·(!shiftRows·&&·n·>·left)
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 747| »   »   »   »   n·=·left;
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 748| »   »   »   for·(var·c·=·0;·c·<·n·&&·left·>·0;·++c)
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 752| »   »   »   »   if·(n%2·==·0)
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 762| »   »   »   »   var·column·=·Math.ceil(n/2)·+·Math.ceil(c/2)·*·side;
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 772| »   »   »   this.maxColumnsUsed[r]·=·n;
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 801| »   for·(var·i·=·sortingClasses.length;·i;·--i)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 646| »   sortingClasses.push("Unknown");
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 651| »   for·(var·i·=·0;·i·<·sortingClasses.length;·++i)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 652| »   »   types[sortingClasses[i]]·=·[];
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 659| »   »   for·(var·c·=·0;·c·<·sortingClasses.length;·++c)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 661| »   »   »   if·(classes.indexOf(sortingClasses[c])·>·-1)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 663| »   »   »   »   types[sortingClasses[c]].push({"ent":·active[i],·"pos":·positions[i]});
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 801| »   for·(var·i·=·sortingClasses.length;·i;·--i)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 803| »   »   var·t·=·types[sortingClasses[i-1]];
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 907| }
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.
|    | [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
|1072|1072| 			},
|1073|1073| 		},
|1074|1074| 
|1075|    |-		"GARRISON":{
|    |1075|+		"GARRISON": {
|1076|1076| 			"APPROACHING": {
|1077|1077| 				"enter": function() {
|1078|1078| 					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
|2054|2054| 
|2055|2055| 				"Attacked": function(msg) {
|2056|2056| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2057|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2058|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2057|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2058|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2059|2059| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2060|2060| 				},
|2061|2061| 			},
|    | [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
|2213|2213| 					"MovementUpdate": function(msg) {
|2214|2214| 						// If it looks like the path is failing, and we are close enough (3 tiles) from wanted range
|2215|2215| 						// stop anyways. This avoids pathing for an unreachable goal and reduces lag considerably.
|2216|    |-						if (msg.likelyFailure || 
|    |2216|+						if (msg.likelyFailure ||
|2217|2217| 							msg.obstructed && this.RelaxedMaxRangeCheck(this.order.data, this.order.data.max + this.DefaultRelaxedMaxRange) ||
|2218|2218| 							!msg.obstructed && this.CheckRange(this.order.data))
|2219|2219| 							this.FinishOrder();
|    | [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
|2855|2855| 					{
|2856|2856| 						// The building was already finished/fully repaired before we arrived;
|2857|2857| 						// let the ConstructionFinished handler handle this.
|2858|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2858|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2859|2859| 						return true;
|2860|2860| 					}
|2861|2861| 
|    | [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
|2855|2855| 					{
|2856|2856| 						// The building was already finished/fully repaired before we arrived;
|2857|2857| 						// let the ConstructionFinished handler handle this.
|2858|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2858|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2859|2859| 						return true;
|2860|2860| 					}
|2861|2861| 
|    | [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
|3153|3153| 				this.StopTimer();
|3154|3154| 				this.ResetAnimation();
|3155|3155| 				if (this.formationAnimationVariant)
|3156|    |-					this.SetAnimationVariant(this.formationAnimationVariant)
|    |3156|+					this.SetAnimationVariant(this.formationAnimationVariant);
|3157|3157| 				else
|3158|3158| 					this.SetDefaultAnimationVariant();
|3159|3159| 				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
|3379|3379| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3380|3380| 
|3381|3381| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3382|    |-							// only used for domestic animals
|    |3382|+		// only used for domestic animals
|3383|3383| 
|3384|3384| 		// Reuse the same garrison behaviour for animals.
|3385|3385| 		"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
|3441|3441| 
|3442|3442| UnitAI.prototype.IsAnimal = function()
|3443|3443| {
|3444|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3444|+	return (!!this.template.NaturalBehaviour);
|3445|3445| };
|3446|3446| 
|3447|3447| 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
|3557|3557| 		{
|3558|3558| 			let index = this.GetCurrentState().indexOf(".");
|3559|3559| 			if (index != -1)
|3560|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3560|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3561|3561| 			this.Stop(false);
|3562|3562| 		}
|3563|3563| 
|    | [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
|3613|3613| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3614|3614| 			continue;
|3615|3615| 		if (i == 0)
|3616|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3616|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3617|3617| 		else
|3618|3618| 			this.orderQueue.splice(i, 1);
|3619|3619| 		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
|3613|3613| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3614|3614| 			continue;
|3615|3615| 		if (i == 0)
|3616|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3616|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3617|3617| 		else
|3618|3618| 			this.orderQueue.splice(i, 1);
|3619|3619| 		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
|3700|3700| };
|3701|3701| 
|3702|3702| 
|3703|    |-//// FSM linkage functions ////
|    |3703|+// // FSM linkage functions ////
|3704|3704| 
|3705|3705| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3706|3706| 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
|3871|3871| 				continue;
|3872|3872| 			if (this.orderQueue[i].type == type)
|3873|3873| 				continue;
|3874|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3874|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3875|3875| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3876|3876| 			return;
|3877|3877| 		}
|    | [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
|3871|3871| 				continue;
|3872|3872| 			if (this.orderQueue[i].type == type)
|3873|3873| 				continue;
|3874|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3874|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3875|3875| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3876|3876| 			return;
|3877|3877| 		}
|    | [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
|4113|4113| 	if (data.timerRepeat === undefined)
|4114|4114| 		this.timer = undefined;
|4115|4115| 
|4116|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4116|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4117|4117| };
|4118|4118| 
|4119|4119| /**
|    | [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
|4113|4113| 	if (data.timerRepeat === undefined)
|4114|4114| 		this.timer = undefined;
|4115|4115| 
|4116|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4116|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4117|4117| };
|4118|4118| 
|4119|4119| /**
|    | [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
|4158|4158| 	// TODO: This is a bit inefficient since every unit listens to every
|4159|4159| 	// construction message - ideally we could scope it to only the one we're building
|4160|4160| 
|4161|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4161|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4162|4162| };
|4163|4163| 
|4164|4164| 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
|4158|4158| 	// TODO: This is a bit inefficient since every unit listens to every
|4159|4159| 	// construction message - ideally we could scope it to only the one we're building
|4160|4160| 
|4161|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4161|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4162|4162| };
|4163|4163| 
|4164|4164| 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
|4189|4189| 	if (msg.fromStatusEffect)
|4190|4190| 		return;
|4191|4191| 
|4192|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4192|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4193|4193| };
|4194|4194| 
|4195|4195| 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
|4189|4189| 	if (msg.fromStatusEffect)
|4190|4190| 		return;
|4191|4191| 
|4192|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4192|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4193|4193| };
|4194|4194| 
|4195|4195| 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
|4194|4194| 
|4195|4195| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4196|4196| {
|4197|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4197|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4198|4198| };
|4199|4199| 
|4200|4200| 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
|4194|4194| 
|4195|4195| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4196|4196| {
|4197|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4197|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4198|4198| };
|4199|4199| 
|4200|4200| 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
|4199|4199| 
|4200|4200| UnitAI.prototype.OnHealthChanged = function(msg)
|4201|4201| {
|4202|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4202|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4203|4203| };
|4204|4204| 
|4205|4205| 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
|4199|4199| 
|4200|4200| UnitAI.prototype.OnHealthChanged = function(msg)
|4201|4201| {
|4202|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4202|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4203|4203| };
|4204|4204| 
|4205|4205| 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
|4205|4205| UnitAI.prototype.OnRangeUpdate = function(msg)
|4206|4206| {
|4207|4207| 	if (msg.tag == this.losRangeQuery)
|4208|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4208|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4209|4209| 	else if (msg.tag == this.losHealRangeQuery)
|4210|4210| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4211|4211| };
|    | [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
|4205|4205| UnitAI.prototype.OnRangeUpdate = function(msg)
|4206|4206| {
|4207|4207| 	if (msg.tag == this.losRangeQuery)
|4208|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4208|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4209|4209| 	else if (msg.tag == this.losHealRangeQuery)
|4210|4210| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4211|4211| };
|    | [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
|4207|4207| 	if (msg.tag == this.losRangeQuery)
|4208|4208| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4209|4209| 	else if (msg.tag == this.losHealRangeQuery)
|4210|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4210|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4211|4211| };
|4212|4212| 
|4213|4213| 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
|4207|4207| 	if (msg.tag == this.losRangeQuery)
|4208|4208| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4209|4209| 	else if (msg.tag == this.losHealRangeQuery)
|4210|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4210|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4211|4211| };
|4212|4212| 
|4213|4213| 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
|4212|4212| 
|4213|4213| UnitAI.prototype.OnPackFinished = function(msg)
|4214|4214| {
|4215|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4215|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4216|4216| };
|4217|4217| 
|4218|4218| //// 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
|4212|4212| 
|4213|4213| UnitAI.prototype.OnPackFinished = function(msg)
|4214|4214| {
|4215|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4215|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4216|4216| };
|4217|4217| 
|4218|4218| //// 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
|4215|4215| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4216|4216| };
|4217|4217| 
|4218|    |-//// Helper functions to be called by the FSM ////
|    |4218|+// // Helper functions to be called by the FSM ////
|4219|4219| 
|4220|4220| UnitAI.prototype.GetWalkSpeed = function()
|4221|4221| {
|    | [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
|4927|4927| UnitAI.prototype.AttackEntityInZone = function(ents)
|4928|4928| {
|4929|4929| 	var target = ents.find(target =>
|4930|    |-		this.CanAttack(target)
|4931|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4930|+		this.CanAttack(target) &&
|    |4931|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4932|4932| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4933|4933| 	);
|4934|4934| 	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
|4928|4928| {
|4929|4929| 	var target = ents.find(target =>
|4930|4930| 		this.CanAttack(target)
|4931|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4932|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4931|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4932|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4933|4933| 	);
|4934|4934| 	if (!target)
|4935|4935| 		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
|4994|4994| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4995|4995| 	if (this.isGuardOf)
|4996|4996| 	{
|4997|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4997|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4998|4998| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4999|4999| 		if (cmpUnitAI && cmpAttack &&
|5000|5000| 		    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
|4998|4998| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4999|4999| 		if (cmpUnitAI && cmpAttack &&
|5000|5000| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|5001|    |-				return false;
|    |5001|+			return false;
|5002|5002| 	}
|5003|5003| 
|5004|5004| 	// 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
|5036|5036| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|5037|5037| 	if (this.isGuardOf)
|5038|5038| 	{
|5039|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |5039|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|5040|5040| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|5041|5041| 		if (cmpUnitAI && cmpAttack &&
|5042|5042| 		    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
|5049|5049| 	return false;
|5050|5050| };
|5051|5051| 
|5052|    |-//// External interface functions ////
|    |5052|+// // External interface functions ////
|5053|5053| 
|5054|5054| UnitAI.prototype.SetFormationController = function(ent)
|5055|5055| {
|    | [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
|5205|5205| 	{
|5206|5206| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5207|5207| 			return;
|5208|    |-		else
|5209|    |-			this.RemoveGuard();
|    |5208|+		this.RemoveGuard();
|5210|5209| 	}
|5211|5210| 
|5212|5211| 	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
|5536|5536| 
|5537|5537| 	if (this.IsFormationController())
|5538|5538| 		this.CallMemberFunction("CancelSetupTradeRoute", [target]);
|5539|    |-}
|    |5539|+};
|5540|5540| /**
|5541|5541|  * Adds trade order to the queue. Either walk to the first market, or
|5542|5542|  * 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
|5557|5557| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5558|5558| 	{
|5559|5559| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5560|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5560|+		if (cmpTrader.HasBothMarkets() &&
|5561|5561| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5562|5562| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5563|5563| 		{
|    | [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
|5838|5838| 				{
|5839|5839| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5840|5840| 					var targetClasses = this.order.data.targetClasses;
|5841|    |-					if (targetClasses.attack && cmpIdentity
|5842|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5841|+					if (targetClasses.attack && cmpIdentity &&
|    |5842|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5843|5843| 						continue;
|5844|5844| 					if (targetClasses.avoid && cmpIdentity
|5845|5845| 						&& 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
|5841|5841| 					if (targetClasses.attack && cmpIdentity
|5842|5842| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5843|5843| 						continue;
|5844|    |-					if (targetClasses.avoid && cmpIdentity
|5845|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5844|+					if (targetClasses.avoid && cmpIdentity &&
|    |5845|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5846|5846| 						continue;
|5847|5847| 					// Only used by the AIs to prevent some choices of targets
|5848|5848| 					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
|5864|5864| 		{
|5865|5865| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5866|5866| 			var targetClasses = this.order.data.targetClasses;
|5867|    |-			if (cmpIdentity && targetClasses.attack
|5868|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5867|+			if (cmpIdentity && targetClasses.attack &&
|    |5868|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5869|5869| 				continue;
|5870|5870| 			if (cmpIdentity && targetClasses.avoid
|5871|5871| 				&& 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
|5867|5867| 			if (cmpIdentity && targetClasses.attack
|5868|5868| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5869|5869| 				continue;
|5870|    |-			if (cmpIdentity && targetClasses.avoid
|5871|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5870|+			if (cmpIdentity && targetClasses.avoid &&
|    |5871|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5872|5872| 				continue;
|5873|5873| 			// Only used by the AIs to prevent some choices of targets
|5874|5874| 			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
|6062|6062| 
|6063|6063| UnitAI.prototype.SetHeldPosition = function(x, z)
|6064|6064| {
|6065|    |-	this.heldPosition = {"x": x, "z": z};
|    |6065|+	this.heldPosition = { "x": x, "z": z};
|6066|6066| };
|6067|6067| 
|6068|6068| 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
|6062|6062| 
|6063|6063| UnitAI.prototype.SetHeldPosition = function(x, z)
|6064|6064| {
|6065|    |-	this.heldPosition = {"x": x, "z": z};
|    |6065|+	this.heldPosition = {"x": x, "z": z };
|6066|6066| };
|6067|6067| 
|6068|6068| 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
|6089|6089| 	return false;
|6090|6090| };
|6091|6091| 
|6092|    |-//// Helper functions ////
|    |6092|+// // Helper functions ////
|6093|6093| 
|6094|6094| /**
|6095|6095|  * 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
|6108|6108| 		return undefined;
|6109|6109| 
|6110|6110| 	return component.GetRange(type);
|6111|    |-}
|    |6111|+};
|6112|6112| 
|6113|6113| UnitAI.prototype.CanAttack = function(target)
|6114|6114| {
|    | [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
|6276|6276| 	return cmpPack && cmpPack.IsPacking();
|6277|6277| };
|6278|6278| 
|6279|    |-//// Formation specific functions ////
|    |6279|+// // Formation specific functions ////
|6280|6280| 
|6281|6281| UnitAI.prototype.IsAttackingAsFormation = function()
|6282|6282| {
|    | [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
|6281|6281| UnitAI.prototype.IsAttackingAsFormation = function()
|6282|6282| {
|6283|6283| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6284|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6285|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6284|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6285|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6286|6286| };
|6287|6287| 
|6288|6288| //// 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
|6285|6285| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6286|6286| };
|6287|6287| 
|6288|    |-//// Animal specific functions ////
|    |6288|+// // Animal specific functions ////
|6289|6289| 
|6290|6290| UnitAI.prototype.MoveRandomly = function(distance)
|6291|6291| {

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
|1264| »   »   »   »   return·false;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'Timer' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
|4018| »   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
|4914| »   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
|4929| »   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
|4977| »   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
|5000| »   »   ····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
|2058| »   »   »   »   »   »   &&·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
|3156| »   »   »   »   »   this.SetAnimationVariant(this.formationAnimationVariant)
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

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

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

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

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

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

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

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

bb marked an inline comment as done.May 25 2020, 10:49 PM
bb added inline comments.
binaries/data/mods/public/simulation/components/Formation.js
906

It is called every time a walk of a formation is started/ended and when members leave/join/update speed etc.

Though I did be in favour of the function call, since this.template.SpeedMultiplier should probably be exposed to OnValueModifications (some tech speeding up all formations, or even a hero speeding up his own formation)

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

No

Silier added inline comments.May 26 2020, 4:11 PM
binaries/data/mods/public/simulation/components/Formation.js
895

Result of this function does not change unless member is removed or added. Computing it with every call from unitai is wasteful, because it needs to loop over every member.

wraitii accepted this revision.May 26 2020, 4:27 PM
wraitii added a subscriber: wraitii.

Have to say this feels pretty good and it works perfectly -> in my test setup from #5106 all 4 units were killed in under 15 seconds, which is as good as I got by speeding arrows up 4 times.

Think it's a brilliant fix.

This revision is now accepted and ready to land.May 26 2020, 4:27 PM
Stan added a comment.May 26 2020, 5:17 PM

Can we have some tests?

What a nice find :)
(Perhaps a notion to remove this hack when unit acceleration/deceration is implemented?)

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

Double ternary is a bit difficult to read IMHO.

bb updated this revision to Diff 12029.May 26 2020, 9:30 PM
bb marked an inline comment as done.

fix data.x(z) === 0
Don't recompute formation speeds
Make ternary more readable

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

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/842/display/redirect

bb added inline comments.May 26 2020, 9:33 PM
binaries/data/mods/public/simulation/components/Formation.js
895

Also changes (or at least should change) onValueModification, can be subject of a new patch

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

Never got them to a nice form

6032

@wraitii did you also test changing this 2 into something smaller (the smaller it is, the more of dancing is allowed, but the less this affects gameplay).

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 141| 141| 	this.formationMembersWithAura = []; // Members with a formation aura
| 142| 142| 	this.width = 0;
| 143| 143| 	this.depth = 0;
| 144|    |-	this.oldOrientation = {"sin": 0, "cos": 0};
|    | 144|+	this.oldOrientation = { "sin": 0, "cos": 0};
| 145| 145| 	this.twinFormations = [];
| 146| 146| 	// distance from which two twin formations will merge into one.
| 147| 147| 	this.formationSeparation = 0;
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 141| 141| 	this.formationMembersWithAura = []; // Members with a formation aura
| 142| 142| 	this.width = 0;
| 143| 143| 	this.depth = 0;
| 144|    |-	this.oldOrientation = {"sin": 0, "cos": 0};
|    | 144|+	this.oldOrientation = {"sin": 0, "cos": 0 };
| 145| 145| 	this.twinFormations = [];
| 146| 146| 	// distance from which two twin formations will merge into one.
| 147| 147| 	this.formationSeparation = 0;
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 179| 179| 
| 180| 180| Formation.prototype.GetSize = function()
| 181| 181| {
| 182|    |-	return {"width": this.width, "depth": this.depth};
|    | 182|+	return { "width": this.width, "depth": this.depth};
| 183| 183| };
| 184| 184| 
| 185| 185| Formation.prototype.GetSpeedMultiplier = function()
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 179| 179| 
| 180| 180| Formation.prototype.GetSize = function()
| 181| 181| {
| 182|    |-	return {"width": this.width, "depth": this.depth};
|    | 182|+	return {"width": this.width, "depth": this.depth };
| 183| 183| };
| 184| 184| 
| 185| 185| Formation.prototype.GetSpeedMultiplier = function()
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 612| 612| 			footprints.push(cmpFootprint.GetShape());
| 613| 613| 	}
| 614| 614| 	if (!footprints.length)
| 615|    |-		return {"width":1, "depth": 1};
|    | 615|+		return { "width":1, "depth": 1};
| 616| 616| 
| 617| 617| 	var r = {"width": 0, "depth": 0};
| 618| 618| 	for (var shape of footprints)
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'width'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 612| 612| 			footprints.push(cmpFootprint.GetShape());
| 613| 613| 	}
| 614| 614| 	if (!footprints.length)
| 615|    |-		return {"width":1, "depth": 1};
|    | 615|+		return {"width": 1, "depth": 1};
| 616| 616| 
| 617| 617| 	var r = {"width": 0, "depth": 0};
| 618| 618| 	for (var shape of footprints)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 612| 612| 			footprints.push(cmpFootprint.GetShape());
| 613| 613| 	}
| 614| 614| 	if (!footprints.length)
| 615|    |-		return {"width":1, "depth": 1};
|    | 615|+		return {"width":1, "depth": 1 };
| 616| 616| 
| 617| 617| 	var r = {"width": 0, "depth": 0};
| 618| 618| 	for (var shape of footprints)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 614| 614| 	if (!footprints.length)
| 615| 615| 		return {"width":1, "depth": 1};
| 616| 616| 
| 617|    |-	var r = {"width": 0, "depth": 0};
|    | 617|+	var r = { "width": 0, "depth": 0};
| 618| 618| 	for (var shape of footprints)
| 619| 619| 	{
| 620| 620| 		if (shape.type == "circle")
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 614| 614| 	if (!footprints.length)
| 615| 615| 		return {"width":1, "depth": 1};
| 616| 616| 
| 617|    |-	var r = {"width": 0, "depth": 0};
|    | 617|+	var r = {"width": 0, "depth": 0 };
| 618| 618| 	for (var shape of footprints)
| 619| 619| 	{
| 620| 620| 		if (shape.type == "circle")
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 640| 640| 	separation.depth *= this.separationMultiplier.depth;
| 641| 641| 
| 642| 642| 	if (this.columnar)
| 643|    |-		var sortingClasses = ["Cavalry","Infantry"];
|    | 643|+		var sortingClasses = ["Cavalry", "Infantry"];
| 644| 644| 	else
| 645| 645| 		var sortingClasses = this.sortingClasses.slice();
| 646| 646| 	sortingClasses.push("Unknown");
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 660| 660| 		{
| 661| 661| 			if (classes.indexOf(sortingClasses[c]) > -1)
| 662| 662| 			{
| 663|    |-				types[sortingClasses[c]].push({"ent": active[i], "pos": positions[i]});
|    | 663|+				types[sortingClasses[c]].push({ "ent": active[i], "pos": positions[i]});
| 664| 664| 				done = true;
| 665| 665| 				break;
| 666| 666| 			}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 660| 660| 		{
| 661| 661| 			if (classes.indexOf(sortingClasses[c]) > -1)
| 662| 662| 			{
| 663|    |-				types[sortingClasses[c]].push({"ent": active[i], "pos": positions[i]});
|    | 663|+				types[sortingClasses[c]].push({"ent": active[i], "pos": positions[i] });
| 664| 664| 				done = true;
| 665| 665| 				break;
| 666| 666| 			}
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["Unknown"] is better written in dot notation.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 666| 666| 			}
| 667| 667| 		}
| 668| 668| 		if (!done)
| 669|    |-			types["Unknown"].push({"ent": active[i], "pos": positions[i]});
|    | 669|+			types.Unknown.push({"ent": active[i], "pos": positions[i]});
| 670| 670| 	}
| 671| 671| 
| 672| 672| 	var count = active.length;
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 666| 666| 			}
| 667| 667| 		}
| 668| 668| 		if (!done)
| 669|    |-			types["Unknown"].push({"ent": active[i], "pos": positions[i]});
|    | 669|+			types["Unknown"].push({ "ent": active[i], "pos": positions[i]});
| 670| 670| 	}
| 671| 671| 
| 672| 672| 	var count = active.length;
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 666| 666| 			}
| 667| 667| 		}
| 668| 668| 		if (!done)
| 669|    |-			types["Unknown"].push({"ent": active[i], "pos": positions[i]});
|    | 669|+			types["Unknown"].push({"ent": active[i], "pos": positions[i] });
| 670| 670| 	}
| 671| 671| 
| 672| 672| 	var count = active.length;
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 683| 683| 	if (this.columnar)
| 684| 684| 	{
| 685| 685| 		shape = "square";
| 686|    |-		cols = Math.min(count,3);
|    | 686|+		cols = Math.min(count, 3);
| 687| 687| 		shiftRows = false;
| 688| 688| 		centerGap = 0;
| 689| 689| 		sortingOrder = null;
|    | [NORMAL] ESLintBear (space-before-function-paren):
|    | Unexpected space before function parentheses.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 778| 778| 	// calculating offset distances without a zero average makes no sense, as the formation
| 779| 779| 	// will jump to a different position any time
| 780| 780| 	var avgoffset = Vector2D.average(offsets);
| 781|    |-	offsets.forEach(function (o) {o.sub(avgoffset);});
|    | 781|+	offsets.forEach(function(o) {o.sub(avgoffset);});
| 782| 782| 
| 783| 783| 	// sort the available places in certain ways
| 784| 784| 	// the places first in the list will contain the heaviest units as defined by the order
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 837| 837| 			closestOffsetId = i;
| 838| 838| 		}
| 839| 839| 	}
| 840|    |-	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
|    | 840|+	this.memberPositions[entPos.ent] = { "row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
| 841| 841| 	return closestOffsetId;
| 842| 842| };
| 843| 843| 
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'column'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 837| 837| 			closestOffsetId = i;
| 838| 838| 		}
| 839| 839| 	}
| 840|    |-	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
|    | 840|+	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column": offsets[closestOffsetId].column};
| 841| 841| 	return closestOffsetId;
| 842| 842| };
| 843| 843| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 837| 837| 			closestOffsetId = i;
| 838| 838| 		}
| 839| 839| 	}
| 840|    |-	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
|    | 840|+	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column };
| 841| 841| 	return closestOffsetId;
| 842| 842| };
| 843| 843| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 847| 847| Formation.prototype.GetRealOffsetPositions = function(offsets, pos)
| 848| 848| {
| 849| 849| 	var offsetPositions = [];
| 850|    |-	var {sin, cos} = this.GetEstimatedOrientation(pos);
|    | 850|+	var { sin, cos} = this.GetEstimatedOrientation(pos);
| 851| 851| 	// calculate the world positions
| 852| 852| 	for (var o of offsets)
| 853| 853| 		offsetPositions.push(new Vector2D(pos.x + o.y * sin + o.x * cos, pos.y + o.y * cos - o.x * sin));
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 847| 847| Formation.prototype.GetRealOffsetPositions = function(offsets, pos)
| 848| 848| {
| 849| 849| 	var offsetPositions = [];
| 850|    |-	var {sin, cos} = this.GetEstimatedOrientation(pos);
|    | 850|+	var {sin, cos } = this.GetEstimatedOrientation(pos);
| 851| 851| 	// calculate the world positions
| 852| 852| 	for (var o of offsets)
| 853| 853| 		offsetPositions.push(new Vector2D(pos.x + o.y * sin + o.x * cos, pos.y + o.y * cos - o.x * sin));
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 864| 864| Formation.prototype.GetEstimatedOrientation = function(pos)
| 865| 865| {
| 866| 866| 	var cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI);
| 867|    |-	var r = {"sin": 0, "cos": 1};
|    | 867|+	var r = { "sin": 0, "cos": 1};
| 868| 868| 	var unitAIState = cmpUnitAI.GetCurrentState();
| 869| 869| 	if (unitAIState == "FORMATIONCONTROLLER.WALKING" || unitAIState == "FORMATIONCONTROLLER.COMBAT.APPROACHING")
| 870| 870| 	{
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 864| 864| Formation.prototype.GetEstimatedOrientation = function(pos)
| 865| 865| {
| 866| 866| 	var cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI);
| 867|    |-	var r = {"sin": 0, "cos": 1};
|    | 867|+	var r = {"sin": 0, "cos": 1 };
| 868| 868| 	var unitAIState = cmpUnitAI.GetCurrentState();
| 869| 869| 	if (unitAIState == "FORMATIONCONTROLLER.WALKING" || unitAIState == "FORMATIONCONTROLLER.COMBAT.APPROACHING")
| 870| 870| 	{
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 895| 895| Formation.prototype.GetCurrentSpeedMultiplier = function()
| 896| 896| {
| 897| 897| 	return this.currentSpeedMultiplier;
| 898|    |-}
|    | 898|+};
| 899| 899| 
| 900| 900| /**
| 901| 901|  * Set formation controller's speed based on its current members.
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 953| 953| 		cmpOtherFormation.RemoveMembers(otherMembers);
| 954| 954| 		this.AddMembers(otherMembers);
| 955| 955| 		Engine.DestroyEntity(this.twinFormations[i]);
| 956|    |-		this.twinFormations.splice(i,1);
|    | 956|+		this.twinFormations.splice(i, 1);
| 957| 957| 	}
| 958| 958| 	// Switch between column and box if necessary
| 959| 959| 	var cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI);

binaries/data/mods/public/simulation/components/Formation.js
| 463| »   for·(var·ent·of·this.formationMembersWithAura)
|    | [NORMAL] JSHintBear:
|    | 'ent' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 510| »   var·cmpPosition·=·Engine.QueryInterface(this.entity,·IID_Position);
|    | [NORMAL] JSHintBear:
|    | 'cmpPosition' is already defined.

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

binaries/data/mods/public/simulation/components/Formation.js
| 593| »   var·cmpPosition·=·Engine.QueryInterface(this.entity,·IID_Position);
|    | [NORMAL] JSHintBear:
|    | 'cmpPosition' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 645| »   »   var·sortingClasses·=·this.sortingClasses.slice();
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 654| »   for·(var·i·in·active)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 669| »   »   »   types["Unknown"].push({"ent":·active[i],·"pos":·positions[i]});
|    | [NORMAL] JSHintBear:
|    | ['Unknown'] is better written in dot notation.

binaries/data/mods/public/simulation/components/Formation.js
| 708| »   »   for·(var·i·=·0;·i·<·count;·++i)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 742| »   »   »   »   »   var·n·=·r·+·1;
|    | [NORMAL] JSHintBear:
|    | 'n' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 744| »   »   »   »   »   var·n·=·r·*·2·+·1;
|    | [NORMAL] JSHintBear:
|    | 'n' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 748| »   »   »   for·(var·c·=·0;·c·<·n·&&·left·>·0;·++c)
|    | [NORMAL] JSHintBear:
|    | 'c' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 755| »   »   »   »   »   var·x·=·side·*·Math.ceil(c/2)·*·separation.width;
|    | [NORMAL] JSHintBear:
|    | 'x' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 758| »   »   »   »   »   if·(x·==·0)·//·don't·use·the·center·position·with·a·center·gap
|    | [NORMAL] JSHintBear:
|    | 'x' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 760| »   »   »   »   »   x·+=·side·*·centerGap·/·2;
|    | [NORMAL] JSHintBear:
|    | 'x' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 766| »   »   »   »   offsets.push(new·Vector2D(x·+·r1,·z·+·r2));
|    | [NORMAL] JSHintBear:
|    | 'x' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 746| »   »   »   if·(!shiftRows·&&·n·>·left)
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 747| »   »   »   »   n·=·left;
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 748| »   »   »   for·(var·c·=·0;·c·<·n·&&·left·>·0;·++c)
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 752| »   »   »   »   if·(n%2·==·0)
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 762| »   »   »   »   var·column·=·Math.ceil(n/2)·+·Math.ceil(c/2)·*·side;
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 772| »   »   »   this.maxColumnsUsed[r]·=·n;
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 801| »   for·(var·i·=·sortingClasses.length;·i;·--i)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 646| »   sortingClasses.push("Unknown");
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 651| »   for·(var·i·=·0;·i·<·sortingClasses.length;·++i)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 652| »   »   types[sortingClasses[i]]·=·[];
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 659| »   »   for·(var·c·=·0;·c·<·sortingClasses.length;·++c)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 661| »   »   »   if·(classes.indexOf(sortingClasses[c])·>·-1)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 663| »   »   »   »   types[sortingClasses[c]].push({"ent":·active[i],·"pos":·positions[i]});
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 801| »   for·(var·i·=·sortingClasses.length;·i;·--i)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 803| »   »   var·t·=·types[sortingClasses[i-1]];
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 898| }
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.
|    | [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
|1072|1072| 			},
|1073|1073| 		},
|1074|1074| 
|1075|    |-		"GARRISON":{
|    |1075|+		"GARRISON": {
|1076|1076| 			"APPROACHING": {
|1077|1077| 				"enter": function() {
|1078|1078| 					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
|2054|2054| 
|2055|2055| 				"Attacked": function(msg) {
|2056|2056| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2057|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2058|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2057|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2058|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2059|2059| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2060|2060| 				},
|2061|2061| 			},
|    | [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
|2213|2213| 					"MovementUpdate": function(msg) {
|2214|2214| 						// If it looks like the path is failing, and we are close enough (3 tiles) from wanted range
|2215|2215| 						// stop anyways. This avoids pathing for an unreachable goal and reduces lag considerably.
|2216|    |-						if (msg.likelyFailure || 
|    |2216|+						if (msg.likelyFailure ||
|2217|2217| 							msg.obstructed && this.RelaxedMaxRangeCheck(this.order.data, this.order.data.max + this.DefaultRelaxedMaxRange) ||
|2218|2218| 							!msg.obstructed && this.CheckRange(this.order.data))
|2219|2219| 							this.FinishOrder();
|    | [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
|2855|2855| 					{
|2856|2856| 						// The building was already finished/fully repaired before we arrived;
|2857|2857| 						// let the ConstructionFinished handler handle this.
|2858|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2858|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2859|2859| 						return true;
|2860|2860| 					}
|2861|2861| 
|    | [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
|2855|2855| 					{
|2856|2856| 						// The building was already finished/fully repaired before we arrived;
|2857|2857| 						// let the ConstructionFinished handler handle this.
|2858|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2858|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2859|2859| 						return true;
|2860|2860| 					}
|2861|2861| 
|    | [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
|3153|3153| 				this.StopTimer();
|3154|3154| 				this.ResetAnimation();
|3155|3155| 				if (this.formationAnimationVariant)
|3156|    |-					this.SetAnimationVariant(this.formationAnimationVariant)
|    |3156|+					this.SetAnimationVariant(this.formationAnimationVariant);
|3157|3157| 				else
|3158|3158| 					this.SetDefaultAnimationVariant();
|3159|3159| 				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
|3379|3379| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3380|3380| 
|3381|3381| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3382|    |-							// only used for domestic animals
|    |3382|+		// only used for domestic animals
|3383|3383| 
|3384|3384| 		// Reuse the same garrison behaviour for animals.
|3385|3385| 		"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
|3441|3441| 
|3442|3442| UnitAI.prototype.IsAnimal = function()
|3443|3443| {
|3444|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3444|+	return (!!this.template.NaturalBehaviour);
|3445|3445| };
|3446|3446| 
|3447|3447| 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
|3557|3557| 		{
|3558|3558| 			let index = this.GetCurrentState().indexOf(".");
|3559|3559| 			if (index != -1)
|3560|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3560|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3561|3561| 			this.Stop(false);
|3562|3562| 		}
|3563|3563| 
|    | [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
|3613|3613| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3614|3614| 			continue;
|3615|3615| 		if (i == 0)
|3616|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3616|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3617|3617| 		else
|3618|3618| 			this.orderQueue.splice(i, 1);
|3619|3619| 		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
|3613|3613| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3614|3614| 			continue;
|3615|3615| 		if (i == 0)
|3616|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3616|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3617|3617| 		else
|3618|3618| 			this.orderQueue.splice(i, 1);
|3619|3619| 		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
|3700|3700| };
|3701|3701| 
|3702|3702| 
|3703|    |-//// FSM linkage functions ////
|    |3703|+// // FSM linkage functions ////
|3704|3704| 
|3705|3705| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3706|3706| 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
|3871|3871| 				continue;
|3872|3872| 			if (this.orderQueue[i].type == type)
|3873|3873| 				continue;
|3874|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3874|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3875|3875| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3876|3876| 			return;
|3877|3877| 		}
|    | [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
|3871|3871| 				continue;
|3872|3872| 			if (this.orderQueue[i].type == type)
|3873|3873| 				continue;
|3874|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3874|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3875|3875| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3876|3876| 			return;
|3877|3877| 		}
|    | [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
|4113|4113| 	if (data.timerRepeat === undefined)
|4114|4114| 		this.timer = undefined;
|4115|4115| 
|4116|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4116|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4117|4117| };
|4118|4118| 
|4119|4119| /**
|    | [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
|4113|4113| 	if (data.timerRepeat === undefined)
|4114|4114| 		this.timer = undefined;
|4115|4115| 
|4116|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4116|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4117|4117| };
|4118|4118| 
|4119|4119| /**
|    | [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
|4158|4158| 	// TODO: This is a bit inefficient since every unit listens to every
|4159|4159| 	// construction message - ideally we could scope it to only the one we're building
|4160|4160| 
|4161|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4161|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4162|4162| };
|4163|4163| 
|4164|4164| 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
|4158|4158| 	// TODO: This is a bit inefficient since every unit listens to every
|4159|4159| 	// construction message - ideally we could scope it to only the one we're building
|4160|4160| 
|4161|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4161|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4162|4162| };
|4163|4163| 
|4164|4164| 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
|4189|4189| 	if (msg.fromStatusEffect)
|4190|4190| 		return;
|4191|4191| 
|4192|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4192|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4193|4193| };
|4194|4194| 
|4195|4195| 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
|4189|4189| 	if (msg.fromStatusEffect)
|4190|4190| 		return;
|4191|4191| 
|4192|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4192|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4193|4193| };
|4194|4194| 
|4195|4195| 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
|4194|4194| 
|4195|4195| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4196|4196| {
|4197|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4197|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4198|4198| };
|4199|4199| 
|4200|4200| 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
|4194|4194| 
|4195|4195| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4196|4196| {
|4197|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4197|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4198|4198| };
|4199|4199| 
|4200|4200| 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
|4199|4199| 
|4200|4200| UnitAI.prototype.OnHealthChanged = function(msg)
|4201|4201| {
|4202|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4202|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4203|4203| };
|4204|4204| 
|4205|4205| 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
|4199|4199| 
|4200|4200| UnitAI.prototype.OnHealthChanged = function(msg)
|4201|4201| {
|4202|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4202|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4203|4203| };
|4204|4204| 
|4205|4205| 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
|4205|4205| UnitAI.prototype.OnRangeUpdate = function(msg)
|4206|4206| {
|4207|4207| 	if (msg.tag == this.losRangeQuery)
|4208|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4208|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4209|4209| 	else if (msg.tag == this.losHealRangeQuery)
|4210|4210| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4211|4211| };
|    | [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
|4205|4205| UnitAI.prototype.OnRangeUpdate = function(msg)
|4206|4206| {
|4207|4207| 	if (msg.tag == this.losRangeQuery)
|4208|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4208|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4209|4209| 	else if (msg.tag == this.losHealRangeQuery)
|4210|4210| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4211|4211| };
|    | [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
|4207|4207| 	if (msg.tag == this.losRangeQuery)
|4208|4208| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4209|4209| 	else if (msg.tag == this.losHealRangeQuery)
|4210|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4210|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4211|4211| };
|4212|4212| 
|4213|4213| 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
|4207|4207| 	if (msg.tag == this.losRangeQuery)
|4208|4208| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4209|4209| 	else if (msg.tag == this.losHealRangeQuery)
|4210|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4210|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4211|4211| };
|4212|4212| 
|4213|4213| 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
|4212|4212| 
|4213|4213| UnitAI.prototype.OnPackFinished = function(msg)
|4214|4214| {
|4215|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4215|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4216|4216| };
|4217|4217| 
|4218|4218| //// 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
|4212|4212| 
|4213|4213| UnitAI.prototype.OnPackFinished = function(msg)
|4214|4214| {
|4215|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4215|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4216|4216| };
|4217|4217| 
|4218|4218| //// 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
|4215|4215| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4216|4216| };
|4217|4217| 
|4218|    |-//// Helper functions to be called by the FSM ////
|    |4218|+// // Helper functions to be called by the FSM ////
|4219|4219| 
|4220|4220| UnitAI.prototype.GetWalkSpeed = function()
|4221|4221| {
|    | [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
|4927|4927| UnitAI.prototype.AttackEntityInZone = function(ents)
|4928|4928| {
|4929|4929| 	var target = ents.find(target =>
|4930|    |-		this.CanAttack(target)
|4931|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4930|+		this.CanAttack(target) &&
|    |4931|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4932|4932| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4933|4933| 	);
|4934|4934| 	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
|4928|4928| {
|4929|4929| 	var target = ents.find(target =>
|4930|4930| 		this.CanAttack(target)
|4931|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4932|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4931|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4932|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4933|4933| 	);
|4934|4934| 	if (!target)
|4935|4935| 		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
|4994|4994| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4995|4995| 	if (this.isGuardOf)
|4996|4996| 	{
|4997|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4997|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4998|4998| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4999|4999| 		if (cmpUnitAI && cmpAttack &&
|5000|5000| 		    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
|4998|4998| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4999|4999| 		if (cmpUnitAI && cmpAttack &&
|5000|5000| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|5001|    |-				return false;
|    |5001|+			return false;
|5002|5002| 	}
|5003|5003| 
|5004|5004| 	// 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
|5036|5036| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|5037|5037| 	if (this.isGuardOf)
|5038|5038| 	{
|5039|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |5039|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|5040|5040| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|5041|5041| 		if (cmpUnitAI && cmpAttack &&
|5042|5042| 		    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
|5049|5049| 	return false;
|5050|5050| };
|5051|5051| 
|5052|    |-//// External interface functions ////
|    |5052|+// // External interface functions ////
|5053|5053| 
|5054|5054| UnitAI.prototype.SetFormationController = function(ent)
|5055|5055| {
|    | [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
|5205|5205| 	{
|5206|5206| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5207|5207| 			return;
|5208|    |-		else
|5209|    |-			this.RemoveGuard();
|    |5208|+		this.RemoveGuard();
|5210|5209| 	}
|5211|5210| 
|5212|5211| 	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
|5536|5536| 
|5537|5537| 	if (this.IsFormationController())
|5538|5538| 		this.CallMemberFunction("CancelSetupTradeRoute", [target]);
|5539|    |-}
|    |5539|+};
|5540|5540| /**
|5541|5541|  * Adds trade order to the queue. Either walk to the first market, or
|5542|5542|  * 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
|5557|5557| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5558|5558| 	{
|5559|5559| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5560|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5560|+		if (cmpTrader.HasBothMarkets() &&
|5561|5561| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5562|5562| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5563|5563| 		{
|    | [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
|5838|5838| 				{
|5839|5839| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5840|5840| 					var targetClasses = this.order.data.targetClasses;
|5841|    |-					if (targetClasses.attack && cmpIdentity
|5842|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5841|+					if (targetClasses.attack && cmpIdentity &&
|    |5842|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5843|5843| 						continue;
|5844|5844| 					if (targetClasses.avoid && cmpIdentity
|5845|5845| 						&& 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
|5841|5841| 					if (targetClasses.attack && cmpIdentity
|5842|5842| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5843|5843| 						continue;
|5844|    |-					if (targetClasses.avoid && cmpIdentity
|5845|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5844|+					if (targetClasses.avoid && cmpIdentity &&
|    |5845|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5846|5846| 						continue;
|5847|5847| 					// Only used by the AIs to prevent some choices of targets
|5848|5848| 					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
|5864|5864| 		{
|5865|5865| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5866|5866| 			var targetClasses = this.order.data.targetClasses;
|5867|    |-			if (cmpIdentity && targetClasses.attack
|5868|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5867|+			if (cmpIdentity && targetClasses.attack &&
|    |5868|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5869|5869| 				continue;
|5870|5870| 			if (cmpIdentity && targetClasses.avoid
|5871|5871| 				&& 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
|5867|5867| 			if (cmpIdentity && targetClasses.attack
|5868|5868| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5869|5869| 				continue;
|5870|    |-			if (cmpIdentity && targetClasses.avoid
|5871|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5870|+			if (cmpIdentity && targetClasses.avoid &&
|    |5871|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5872|5872| 				continue;
|5873|5873| 			// Only used by the AIs to prevent some choices of targets
|5874|5874| 			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
|6066|6066| 
|6067|6067| UnitAI.prototype.SetHeldPosition = function(x, z)
|6068|6068| {
|6069|    |-	this.heldPosition = {"x": x, "z": z};
|    |6069|+	this.heldPosition = { "x": x, "z": z};
|6070|6070| };
|6071|6071| 
|6072|6072| 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
|6066|6066| 
|6067|6067| UnitAI.prototype.SetHeldPosition = function(x, z)
|6068|6068| {
|6069|    |-	this.heldPosition = {"x": x, "z": z};
|    |6069|+	this.heldPosition = {"x": x, "z": z };
|6070|6070| };
|6071|6071| 
|6072|6072| 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
|6093|6093| 	return false;
|6094|6094| };
|6095|6095| 
|6096|    |-//// Helper functions ////
|    |6096|+// // Helper functions ////
|6097|6097| 
|6098|6098| /**
|6099|6099|  * 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
|6112|6112| 		return undefined;
|6113|6113| 
|6114|6114| 	return component.GetRange(type);
|6115|    |-}
|    |6115|+};
|6116|6116| 
|6117|6117| UnitAI.prototype.CanAttack = function(target)
|6118|6118| {
|    | [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
|6280|6280| 	return cmpPack && cmpPack.IsPacking();
|6281|6281| };
|6282|6282| 
|6283|    |-//// Formation specific functions ////
|    |6283|+// // Formation specific functions ////
|6284|6284| 
|6285|6285| UnitAI.prototype.IsAttackingAsFormation = function()
|6286|6286| {
|    | [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
|6285|6285| UnitAI.prototype.IsAttackingAsFormation = function()
|6286|6286| {
|6287|6287| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6288|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6289|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6288|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6289|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6290|6290| };
|6291|6291| 
|6292|6292| //// 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
|6289|6289| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6290|6290| };
|6291|6291| 
|6292|    |-//// Animal specific functions ////
|    |6292|+// // Animal specific functions ////
|6293|6293| 
|6294|6294| UnitAI.prototype.MoveRandomly = function(distance)
|6295|6295| {

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
|1264| »   »   »   »   return·false;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'Timer' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
|4018| »   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
|4914| »   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
|4929| »   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
|4977| »   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
|5000| »   »   ····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
|2058| »   »   »   »   »   »   &&·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
|3156| »   »   »   »   »   this.SetAnimationVariant(this.formationAnimationVariant)
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

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

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

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

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

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

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

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

bb updated this revision to Diff 12030.May 26 2020, 9:44 PM

Comment by Freagarach

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

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/843/display/redirect

wraitii added inline comments.May 26 2020, 9:48 PM
binaries/data/mods/public/simulation/components/UnitAI.js
6032

I did not. The value of 2 felt pretty good to me.

That being said, I think you might want to clamp this so that it's never below a speed of like 3 or so.

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 141| 141| 	this.formationMembersWithAura = []; // Members with a formation aura
| 142| 142| 	this.width = 0;
| 143| 143| 	this.depth = 0;
| 144|    |-	this.oldOrientation = {"sin": 0, "cos": 0};
|    | 144|+	this.oldOrientation = { "sin": 0, "cos": 0};
| 145| 145| 	this.twinFormations = [];
| 146| 146| 	// distance from which two twin formations will merge into one.
| 147| 147| 	this.formationSeparation = 0;
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 141| 141| 	this.formationMembersWithAura = []; // Members with a formation aura
| 142| 142| 	this.width = 0;
| 143| 143| 	this.depth = 0;
| 144|    |-	this.oldOrientation = {"sin": 0, "cos": 0};
|    | 144|+	this.oldOrientation = {"sin": 0, "cos": 0 };
| 145| 145| 	this.twinFormations = [];
| 146| 146| 	// distance from which two twin formations will merge into one.
| 147| 147| 	this.formationSeparation = 0;
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 179| 179| 
| 180| 180| Formation.prototype.GetSize = function()
| 181| 181| {
| 182|    |-	return {"width": this.width, "depth": this.depth};
|    | 182|+	return { "width": this.width, "depth": this.depth};
| 183| 183| };
| 184| 184| 
| 185| 185| Formation.prototype.GetSpeedMultiplier = function()
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 179| 179| 
| 180| 180| Formation.prototype.GetSize = function()
| 181| 181| {
| 182|    |-	return {"width": this.width, "depth": this.depth};
|    | 182|+	return {"width": this.width, "depth": this.depth };
| 183| 183| };
| 184| 184| 
| 185| 185| Formation.prototype.GetSpeedMultiplier = function()
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 612| 612| 			footprints.push(cmpFootprint.GetShape());
| 613| 613| 	}
| 614| 614| 	if (!footprints.length)
| 615|    |-		return {"width":1, "depth": 1};
|    | 615|+		return { "width":1, "depth": 1};
| 616| 616| 
| 617| 617| 	var r = {"width": 0, "depth": 0};
| 618| 618| 	for (var shape of footprints)
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'width'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 612| 612| 			footprints.push(cmpFootprint.GetShape());
| 613| 613| 	}
| 614| 614| 	if (!footprints.length)
| 615|    |-		return {"width":1, "depth": 1};
|    | 615|+		return {"width": 1, "depth": 1};
| 616| 616| 
| 617| 617| 	var r = {"width": 0, "depth": 0};
| 618| 618| 	for (var shape of footprints)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 612| 612| 			footprints.push(cmpFootprint.GetShape());
| 613| 613| 	}
| 614| 614| 	if (!footprints.length)
| 615|    |-		return {"width":1, "depth": 1};
|    | 615|+		return {"width":1, "depth": 1 };
| 616| 616| 
| 617| 617| 	var r = {"width": 0, "depth": 0};
| 618| 618| 	for (var shape of footprints)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 614| 614| 	if (!footprints.length)
| 615| 615| 		return {"width":1, "depth": 1};
| 616| 616| 
| 617|    |-	var r = {"width": 0, "depth": 0};
|    | 617|+	var r = { "width": 0, "depth": 0};
| 618| 618| 	for (var shape of footprints)
| 619| 619| 	{
| 620| 620| 		if (shape.type == "circle")
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 614| 614| 	if (!footprints.length)
| 615| 615| 		return {"width":1, "depth": 1};
| 616| 616| 
| 617|    |-	var r = {"width": 0, "depth": 0};
|    | 617|+	var r = {"width": 0, "depth": 0 };
| 618| 618| 	for (var shape of footprints)
| 619| 619| 	{
| 620| 620| 		if (shape.type == "circle")
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 640| 640| 	separation.depth *= this.separationMultiplier.depth;
| 641| 641| 
| 642| 642| 	if (this.columnar)
| 643|    |-		var sortingClasses = ["Cavalry","Infantry"];
|    | 643|+		var sortingClasses = ["Cavalry", "Infantry"];
| 644| 644| 	else
| 645| 645| 		var sortingClasses = this.sortingClasses.slice();
| 646| 646| 	sortingClasses.push("Unknown");
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 660| 660| 		{
| 661| 661| 			if (classes.indexOf(sortingClasses[c]) > -1)
| 662| 662| 			{
| 663|    |-				types[sortingClasses[c]].push({"ent": active[i], "pos": positions[i]});
|    | 663|+				types[sortingClasses[c]].push({ "ent": active[i], "pos": positions[i]});
| 664| 664| 				done = true;
| 665| 665| 				break;
| 666| 666| 			}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 660| 660| 		{
| 661| 661| 			if (classes.indexOf(sortingClasses[c]) > -1)
| 662| 662| 			{
| 663|    |-				types[sortingClasses[c]].push({"ent": active[i], "pos": positions[i]});
|    | 663|+				types[sortingClasses[c]].push({"ent": active[i], "pos": positions[i] });
| 664| 664| 				done = true;
| 665| 665| 				break;
| 666| 666| 			}
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["Unknown"] is better written in dot notation.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 666| 666| 			}
| 667| 667| 		}
| 668| 668| 		if (!done)
| 669|    |-			types["Unknown"].push({"ent": active[i], "pos": positions[i]});
|    | 669|+			types.Unknown.push({"ent": active[i], "pos": positions[i]});
| 670| 670| 	}
| 671| 671| 
| 672| 672| 	var count = active.length;
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 666| 666| 			}
| 667| 667| 		}
| 668| 668| 		if (!done)
| 669|    |-			types["Unknown"].push({"ent": active[i], "pos": positions[i]});
|    | 669|+			types["Unknown"].push({ "ent": active[i], "pos": positions[i]});
| 670| 670| 	}
| 671| 671| 
| 672| 672| 	var count = active.length;
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 666| 666| 			}
| 667| 667| 		}
| 668| 668| 		if (!done)
| 669|    |-			types["Unknown"].push({"ent": active[i], "pos": positions[i]});
|    | 669|+			types["Unknown"].push({"ent": active[i], "pos": positions[i] });
| 670| 670| 	}
| 671| 671| 
| 672| 672| 	var count = active.length;
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 683| 683| 	if (this.columnar)
| 684| 684| 	{
| 685| 685| 		shape = "square";
| 686|    |-		cols = Math.min(count,3);
|    | 686|+		cols = Math.min(count, 3);
| 687| 687| 		shiftRows = false;
| 688| 688| 		centerGap = 0;
| 689| 689| 		sortingOrder = null;
|    | [NORMAL] ESLintBear (space-before-function-paren):
|    | Unexpected space before function parentheses.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 778| 778| 	// calculating offset distances without a zero average makes no sense, as the formation
| 779| 779| 	// will jump to a different position any time
| 780| 780| 	var avgoffset = Vector2D.average(offsets);
| 781|    |-	offsets.forEach(function (o) {o.sub(avgoffset);});
|    | 781|+	offsets.forEach(function(o) {o.sub(avgoffset);});
| 782| 782| 
| 783| 783| 	// sort the available places in certain ways
| 784| 784| 	// the places first in the list will contain the heaviest units as defined by the order
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 837| 837| 			closestOffsetId = i;
| 838| 838| 		}
| 839| 839| 	}
| 840|    |-	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
|    | 840|+	this.memberPositions[entPos.ent] = { "row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
| 841| 841| 	return closestOffsetId;
| 842| 842| };
| 843| 843| 
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'column'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 837| 837| 			closestOffsetId = i;
| 838| 838| 		}
| 839| 839| 	}
| 840|    |-	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
|    | 840|+	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column": offsets[closestOffsetId].column};
| 841| 841| 	return closestOffsetId;
| 842| 842| };
| 843| 843| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 837| 837| 			closestOffsetId = i;
| 838| 838| 		}
| 839| 839| 	}
| 840|    |-	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
|    | 840|+	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column };
| 841| 841| 	return closestOffsetId;
| 842| 842| };
| 843| 843| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 847| 847| Formation.prototype.GetRealOffsetPositions = function(offsets, pos)
| 848| 848| {
| 849| 849| 	var offsetPositions = [];
| 850|    |-	var {sin, cos} = this.GetEstimatedOrientation(pos);
|    | 850|+	var { sin, cos} = this.GetEstimatedOrientation(pos);
| 851| 851| 	// calculate the world positions
| 852| 852| 	for (var o of offsets)
| 853| 853| 		offsetPositions.push(new Vector2D(pos.x + o.y * sin + o.x * cos, pos.y + o.y * cos - o.x * sin));
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 847| 847| Formation.prototype.GetRealOffsetPositions = function(offsets, pos)
| 848| 848| {
| 849| 849| 	var offsetPositions = [];
| 850|    |-	var {sin, cos} = this.GetEstimatedOrientation(pos);
|    | 850|+	var {sin, cos } = this.GetEstimatedOrientation(pos);
| 851| 851| 	// calculate the world positions
| 852| 852| 	for (var o of offsets)
| 853| 853| 		offsetPositions.push(new Vector2D(pos.x + o.y * sin + o.x * cos, pos.y + o.y * cos - o.x * sin));
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 864| 864| Formation.prototype.GetEstimatedOrientation = function(pos)
| 865| 865| {
| 866| 866| 	var cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI);
| 867|    |-	var r = {"sin": 0, "cos": 1};
|    | 867|+	var r = { "sin": 0, "cos": 1};
| 868| 868| 	var unitAIState = cmpUnitAI.GetCurrentState();
| 869| 869| 	if (unitAIState == "FORMATIONCONTROLLER.WALKING" || unitAIState == "FORMATIONCONTROLLER.COMBAT.APPROACHING")
| 870| 870| 	{
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 864| 864| Formation.prototype.GetEstimatedOrientation = function(pos)
| 865| 865| {
| 866| 866| 	var cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI);
| 867|    |-	var r = {"sin": 0, "cos": 1};
|    | 867|+	var r = {"sin": 0, "cos": 1 };
| 868| 868| 	var unitAIState = cmpUnitAI.GetCurrentState();
| 869| 869| 	if (unitAIState == "FORMATIONCONTROLLER.WALKING" || unitAIState == "FORMATIONCONTROLLER.COMBAT.APPROACHING")
| 870| 870| 	{
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 895| 895| Formation.prototype.GetCurrentSpeedMultiplier = function()
| 896| 896| {
| 897| 897| 	return this.currentSpeedMultiplier;
| 898|    |-}
|    | 898|+};
| 899| 899| 
| 900| 900| /**
| 901| 901|  * Set formation controller's speed based on its current members.
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 953| 953| 		cmpOtherFormation.RemoveMembers(otherMembers);
| 954| 954| 		this.AddMembers(otherMembers);
| 955| 955| 		Engine.DestroyEntity(this.twinFormations[i]);
| 956|    |-		this.twinFormations.splice(i,1);
|    | 956|+		this.twinFormations.splice(i, 1);
| 957| 957| 	}
| 958| 958| 	// Switch between column and box if necessary
| 959| 959| 	var cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI);

binaries/data/mods/public/simulation/components/Formation.js
| 463| »   for·(var·ent·of·this.formationMembersWithAura)
|    | [NORMAL] JSHintBear:
|    | 'ent' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 510| »   var·cmpPosition·=·Engine.QueryInterface(this.entity,·IID_Position);
|    | [NORMAL] JSHintBear:
|    | 'cmpPosition' is already defined.

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

binaries/data/mods/public/simulation/components/Formation.js
| 593| »   var·cmpPosition·=·Engine.QueryInterface(this.entity,·IID_Position);
|    | [NORMAL] JSHintBear:
|    | 'cmpPosition' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 645| »   »   var·sortingClasses·=·this.sortingClasses.slice();
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 654| »   for·(var·i·in·active)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 669| »   »   »   types["Unknown"].push({"ent":·active[i],·"pos":·positions[i]});
|    | [NORMAL] JSHintBear:
|    | ['Unknown'] is better written in dot notation.

binaries/data/mods/public/simulation/components/Formation.js
| 708| »   »   for·(var·i·=·0;·i·<·count;·++i)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 742| »   »   »   »   »   var·n·=·r·+·1;
|    | [NORMAL] JSHintBear:
|    | 'n' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 744| »   »   »   »   »   var·n·=·r·*·2·+·1;
|    | [NORMAL] JSHintBear:
|    | 'n' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 748| »   »   »   for·(var·c·=·0;·c·<·n·&&·left·>·0;·++c)
|    | [NORMAL] JSHintBear:
|    | 'c' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 755| »   »   »   »   »   var·x·=·side·*·Math.ceil(c/2)·*·separation.width;
|    | [NORMAL] JSHintBear:
|    | 'x' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 758| »   »   »   »   »   if·(x·==·0)·//·don't·use·the·center·position·with·a·center·gap
|    | [NORMAL] JSHintBear:
|    | 'x' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 760| »   »   »   »   »   x·+=·side·*·centerGap·/·2;
|    | [NORMAL] JSHintBear:
|    | 'x' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 766| »   »   »   »   offsets.push(new·Vector2D(x·+·r1,·z·+·r2));
|    | [NORMAL] JSHintBear:
|    | 'x' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 746| »   »   »   if·(!shiftRows·&&·n·>·left)
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 747| »   »   »   »   n·=·left;
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 748| »   »   »   for·(var·c·=·0;·c·<·n·&&·left·>·0;·++c)
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 752| »   »   »   »   if·(n%2·==·0)
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 762| »   »   »   »   var·column·=·Math.ceil(n/2)·+·Math.ceil(c/2)·*·side;
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 772| »   »   »   this.maxColumnsUsed[r]·=·n;
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 801| »   for·(var·i·=·sortingClasses.length;·i;·--i)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 646| »   sortingClasses.push("Unknown");
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 651| »   for·(var·i·=·0;·i·<·sortingClasses.length;·++i)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 652| »   »   types[sortingClasses[i]]·=·[];
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 659| »   »   for·(var·c·=·0;·c·<·sortingClasses.length;·++c)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 661| »   »   »   if·(classes.indexOf(sortingClasses[c])·>·-1)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 663| »   »   »   »   types[sortingClasses[c]].push({"ent":·active[i],·"pos":·positions[i]});
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 801| »   for·(var·i·=·sortingClasses.length;·i;·--i)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 803| »   »   var·t·=·types[sortingClasses[i-1]];
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 898| }
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.
|    | [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
|1072|1072| 			},
|1073|1073| 		},
|1074|1074| 
|1075|    |-		"GARRISON":{
|    |1075|+		"GARRISON": {
|1076|1076| 			"APPROACHING": {
|1077|1077| 				"enter": function() {
|1078|1078| 					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
|2054|2054| 
|2055|2055| 				"Attacked": function(msg) {
|2056|2056| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2057|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2058|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2057|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2058|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2059|2059| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2060|2060| 				},
|2061|2061| 			},
|    | [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
|2213|2213| 					"MovementUpdate": function(msg) {
|2214|2214| 						// If it looks like the path is failing, and we are close enough (3 tiles) from wanted range
|2215|2215| 						// stop anyways. This avoids pathing for an unreachable goal and reduces lag considerably.
|2216|    |-						if (msg.likelyFailure || 
|    |2216|+						if (msg.likelyFailure ||
|2217|2217| 							msg.obstructed && this.RelaxedMaxRangeCheck(this.order.data, this.order.data.max + this.DefaultRelaxedMaxRange) ||
|2218|2218| 							!msg.obstructed && this.CheckRange(this.order.data))
|2219|2219| 							this.FinishOrder();
|    | [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
|2855|2855| 					{
|2856|2856| 						// The building was already finished/fully repaired before we arrived;
|2857|2857| 						// let the ConstructionFinished handler handle this.
|2858|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2858|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2859|2859| 						return true;
|2860|2860| 					}
|2861|2861| 
|    | [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
|2855|2855| 					{
|2856|2856| 						// The building was already finished/fully repaired before we arrived;
|2857|2857| 						// let the ConstructionFinished handler handle this.
|2858|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2858|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2859|2859| 						return true;
|2860|2860| 					}
|2861|2861| 
|    | [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
|3153|3153| 				this.StopTimer();
|3154|3154| 				this.ResetAnimation();
|3155|3155| 				if (this.formationAnimationVariant)
|3156|    |-					this.SetAnimationVariant(this.formationAnimationVariant)
|    |3156|+					this.SetAnimationVariant(this.formationAnimationVariant);
|3157|3157| 				else
|3158|3158| 					this.SetDefaultAnimationVariant();
|3159|3159| 				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
|3379|3379| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3380|3380| 
|3381|3381| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3382|    |-							// only used for domestic animals
|    |3382|+		// only used for domestic animals
|3383|3383| 
|3384|3384| 		// Reuse the same garrison behaviour for animals.
|3385|3385| 		"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
|3441|3441| 
|3442|3442| UnitAI.prototype.IsAnimal = function()
|3443|3443| {
|3444|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3444|+	return (!!this.template.NaturalBehaviour);
|3445|3445| };
|3446|3446| 
|3447|3447| 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
|3557|3557| 		{
|3558|3558| 			let index = this.GetCurrentState().indexOf(".");
|3559|3559| 			if (index != -1)
|3560|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3560|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3561|3561| 			this.Stop(false);
|3562|3562| 		}
|3563|3563| 
|    | [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
|3613|3613| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3614|3614| 			continue;
|3615|3615| 		if (i == 0)
|3616|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3616|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3617|3617| 		else
|3618|3618| 			this.orderQueue.splice(i, 1);
|3619|3619| 		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
|3613|3613| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3614|3614| 			continue;
|3615|3615| 		if (i == 0)
|3616|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3616|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3617|3617| 		else
|3618|3618| 			this.orderQueue.splice(i, 1);
|3619|3619| 		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
|3700|3700| };
|3701|3701| 
|3702|3702| 
|3703|    |-//// FSM linkage functions ////
|    |3703|+// // FSM linkage functions ////
|3704|3704| 
|3705|3705| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3706|3706| 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
|3871|3871| 				continue;
|3872|3872| 			if (this.orderQueue[i].type == type)
|3873|3873| 				continue;
|3874|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3874|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3875|3875| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3876|3876| 			return;
|3877|3877| 		}
|    | [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
|3871|3871| 				continue;
|3872|3872| 			if (this.orderQueue[i].type == type)
|3873|3873| 				continue;
|3874|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3874|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3875|3875| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3876|3876| 			return;
|3877|3877| 		}
|    | [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
|4113|4113| 	if (data.timerRepeat === undefined)
|4114|4114| 		this.timer = undefined;
|4115|4115| 
|4116|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4116|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4117|4117| };
|4118|4118| 
|4119|4119| /**
|    | [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
|4113|4113| 	if (data.timerRepeat === undefined)
|4114|4114| 		this.timer = undefined;
|4115|4115| 
|4116|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4116|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4117|4117| };
|4118|4118| 
|4119|4119| /**
|    | [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
|4158|4158| 	// TODO: This is a bit inefficient since every unit listens to every
|4159|4159| 	// construction message - ideally we could scope it to only the one we're building
|4160|4160| 
|4161|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4161|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4162|4162| };
|4163|4163| 
|4164|4164| 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
|4158|4158| 	// TODO: This is a bit inefficient since every unit listens to every
|4159|4159| 	// construction message - ideally we could scope it to only the one we're building
|4160|4160| 
|4161|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4161|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4162|4162| };
|4163|4163| 
|4164|4164| 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
|4189|4189| 	if (msg.fromStatusEffect)
|4190|4190| 		return;
|4191|4191| 
|4192|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4192|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4193|4193| };
|4194|4194| 
|4195|4195| 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
|4189|4189| 	if (msg.fromStatusEffect)
|4190|4190| 		return;
|4191|4191| 
|4192|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4192|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4193|4193| };
|4194|4194| 
|4195|4195| 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
|4194|4194| 
|4195|4195| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4196|4196| {
|4197|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4197|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4198|4198| };
|4199|4199| 
|4200|4200| 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
|4194|4194| 
|4195|4195| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4196|4196| {
|4197|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4197|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4198|4198| };
|4199|4199| 
|4200|4200| 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
|4199|4199| 
|4200|4200| UnitAI.prototype.OnHealthChanged = function(msg)
|4201|4201| {
|4202|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4202|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4203|4203| };
|4204|4204| 
|4205|4205| 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
|4199|4199| 
|4200|4200| UnitAI.prototype.OnHealthChanged = function(msg)
|4201|4201| {
|4202|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4202|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4203|4203| };
|4204|4204| 
|4205|4205| 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
|4205|4205| UnitAI.prototype.OnRangeUpdate = function(msg)
|4206|4206| {
|4207|4207| 	if (msg.tag == this.losRangeQuery)
|4208|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4208|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4209|4209| 	else if (msg.tag == this.losHealRangeQuery)
|4210|4210| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4211|4211| };
|    | [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
|4205|4205| UnitAI.prototype.OnRangeUpdate = function(msg)
|4206|4206| {
|4207|4207| 	if (msg.tag == this.losRangeQuery)
|4208|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4208|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4209|4209| 	else if (msg.tag == this.losHealRangeQuery)
|4210|4210| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4211|4211| };
|    | [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
|4207|4207| 	if (msg.tag == this.losRangeQuery)
|4208|4208| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4209|4209| 	else if (msg.tag == this.losHealRangeQuery)
|4210|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4210|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4211|4211| };
|4212|4212| 
|4213|4213| 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
|4207|4207| 	if (msg.tag == this.losRangeQuery)
|4208|4208| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4209|4209| 	else if (msg.tag == this.losHealRangeQuery)
|4210|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4210|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4211|4211| };
|4212|4212| 
|4213|4213| 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
|4212|4212| 
|4213|4213| UnitAI.prototype.OnPackFinished = function(msg)
|4214|4214| {
|4215|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4215|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4216|4216| };
|4217|4217| 
|4218|4218| //// 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
|4212|4212| 
|4213|4213| UnitAI.prototype.OnPackFinished = function(msg)
|4214|4214| {
|4215|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4215|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4216|4216| };
|4217|4217| 
|4218|4218| //// 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
|4215|4215| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4216|4216| };
|4217|4217| 
|4218|    |-//// Helper functions to be called by the FSM ////
|    |4218|+// // Helper functions to be called by the FSM ////
|4219|4219| 
|4220|4220| UnitAI.prototype.GetWalkSpeed = function()
|4221|4221| {
|    | [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
|4927|4927| UnitAI.prototype.AttackEntityInZone = function(ents)
|4928|4928| {
|4929|4929| 	var target = ents.find(target =>
|4930|    |-		this.CanAttack(target)
|4931|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4930|+		this.CanAttack(target) &&
|    |4931|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4932|4932| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4933|4933| 	);
|4934|4934| 	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
|4928|4928| {
|4929|4929| 	var target = ents.find(target =>
|4930|4930| 		this.CanAttack(target)
|4931|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4932|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4931|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4932|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4933|4933| 	);
|4934|4934| 	if (!target)
|4935|4935| 		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
|4994|4994| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4995|4995| 	if (this.isGuardOf)
|4996|4996| 	{
|4997|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4997|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4998|4998| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4999|4999| 		if (cmpUnitAI && cmpAttack &&
|5000|5000| 		    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
|4998|4998| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4999|4999| 		if (cmpUnitAI && cmpAttack &&
|5000|5000| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|5001|    |-				return false;
|    |5001|+			return false;
|5002|5002| 	}
|5003|5003| 
|5004|5004| 	// 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
|5036|5036| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|5037|5037| 	if (this.isGuardOf)
|5038|5038| 	{
|5039|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |5039|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|5040|5040| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|5041|5041| 		if (cmpUnitAI && cmpAttack &&
|5042|5042| 		    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
|5049|5049| 	return false;
|5050|5050| };
|5051|5051| 
|5052|    |-//// External interface functions ////
|    |5052|+// // External interface functions ////
|5053|5053| 
|5054|5054| UnitAI.prototype.SetFormationController = function(ent)
|5055|5055| {
|    | [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
|5205|5205| 	{
|5206|5206| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5207|5207| 			return;
|5208|    |-		else
|5209|    |-			this.RemoveGuard();
|    |5208|+		this.RemoveGuard();
|5210|5209| 	}
|5211|5210| 
|5212|5211| 	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
|5536|5536| 
|5537|5537| 	if (this.IsFormationController())
|5538|5538| 		this.CallMemberFunction("CancelSetupTradeRoute", [target]);
|5539|    |-}
|    |5539|+};
|5540|5540| /**
|5541|5541|  * Adds trade order to the queue. Either walk to the first market, or
|5542|5542|  * 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
|5557|5557| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5558|5558| 	{
|5559|5559| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5560|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5560|+		if (cmpTrader.HasBothMarkets() &&
|5561|5561| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5562|5562| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5563|5563| 		{
|    | [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
|5838|5838| 				{
|5839|5839| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5840|5840| 					var targetClasses = this.order.data.targetClasses;
|5841|    |-					if (targetClasses.attack && cmpIdentity
|5842|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5841|+					if (targetClasses.attack && cmpIdentity &&
|    |5842|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5843|5843| 						continue;
|5844|5844| 					if (targetClasses.avoid && cmpIdentity
|5845|5845| 						&& 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
|5841|5841| 					if (targetClasses.attack && cmpIdentity
|5842|5842| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5843|5843| 						continue;
|5844|    |-					if (targetClasses.avoid && cmpIdentity
|5845|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5844|+					if (targetClasses.avoid && cmpIdentity &&
|    |5845|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5846|5846| 						continue;
|5847|5847| 					// Only used by the AIs to prevent some choices of targets
|5848|5848| 					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
|5864|5864| 		{
|5865|5865| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5866|5866| 			var targetClasses = this.order.data.targetClasses;
|5867|    |-			if (cmpIdentity && targetClasses.attack
|5868|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5867|+			if (cmpIdentity && targetClasses.attack &&
|    |5868|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5869|5869| 				continue;
|5870|5870| 			if (cmpIdentity && targetClasses.avoid
|5871|5871| 				&& 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
|5867|5867| 			if (cmpIdentity && targetClasses.attack
|5868|5868| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5869|5869| 				continue;
|5870|    |-			if (cmpIdentity && targetClasses.avoid
|5871|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5870|+			if (cmpIdentity && targetClasses.avoid &&
|    |5871|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5872|5872| 				continue;
|5873|5873| 			// Only used by the AIs to prevent some choices of targets
|5874|5874| 			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
|6067|6067| 
|6068|6068| UnitAI.prototype.SetHeldPosition = function(x, z)
|6069|6069| {
|6070|    |-	this.heldPosition = {"x": x, "z": z};
|    |6070|+	this.heldPosition = { "x": x, "z": z};
|6071|6071| };
|6072|6072| 
|6073|6073| 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
|6067|6067| 
|6068|6068| UnitAI.prototype.SetHeldPosition = function(x, z)
|6069|6069| {
|6070|    |-	this.heldPosition = {"x": x, "z": z};
|    |6070|+	this.heldPosition = {"x": x, "z": z };
|6071|6071| };
|6072|6072| 
|6073|6073| 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
|6094|6094| 	return false;
|6095|6095| };
|6096|6096| 
|6097|    |-//// Helper functions ////
|    |6097|+// // Helper functions ////
|6098|6098| 
|6099|6099| /**
|6100|6100|  * 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
|6113|6113| 		return undefined;
|6114|6114| 
|6115|6115| 	return component.GetRange(type);
|6116|    |-}
|    |6116|+};
|6117|6117| 
|6118|6118| UnitAI.prototype.CanAttack = function(target)
|6119|6119| {
|    | [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
|6281|6281| 	return cmpPack && cmpPack.IsPacking();
|6282|6282| };
|6283|6283| 
|6284|    |-//// Formation specific functions ////
|    |6284|+// // Formation specific functions ////
|6285|6285| 
|6286|6286| UnitAI.prototype.IsAttackingAsFormation = function()
|6287|6287| {
|    | [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
|6286|6286| UnitAI.prototype.IsAttackingAsFormation = function()
|6287|6287| {
|6288|6288| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6289|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6290|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6289|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6290|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6291|6291| };
|6292|6292| 
|6293|6293| //// 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
|6290|6290| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6291|6291| };
|6292|6292| 
|6293|    |-//// Animal specific functions ////
|    |6293|+// // Animal specific functions ////
|6294|6294| 
|6295|6295| UnitAI.prototype.MoveRandomly = function(distance)
|6296|6296| {

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
|1264| »   »   »   »   return·false;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'Timer' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
|4018| »   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
|4914| »   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
|4929| »   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
|4977| »   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
|5000| »   »   ····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
|2058| »   »   »   »   »   »   &&·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
|3156| »   »   »   »   »   this.SetAnimationVariant(this.formationAnimationVariant)
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

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

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

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

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

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

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

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

Silier requested changes to this revision.May 27 2020, 8:43 AM
Silier added inline comments.
binaries/data/mods/public/simulation/components/Formation.js
90

need to add currentSpeedMultiplier here

This revision now requires changes to proceed.May 27 2020, 8:43 AM
wraitii added inline comments.May 27 2020, 8:56 AM
binaries/data/mods/public/simulation/components/Formation.js
90

This might be why a "don't serialize this" exception list is a better idea.

elexis added a subscriber: elexis.May 27 2020, 11:40 AM
elexis added inline comments.
binaries/data/mods/public/simulation/components/Formation.js
90

So that one can add new member variables without making an error if one didnt check whether or not its getting serialized?

Stan added inline comments.May 27 2020, 11:45 AM
binaries/data/mods/public/simulation/components/Formation.js
90

Well that's currently the case with implicit serialization :)

wraitii added inline comments.May 27 2020, 12:42 PM
binaries/data/mods/public/simulation/components/Formation.js
90

So that one can add new member variables without making an error if one didnt check whether or not its getting serialized?

Yes, the serialisation-list is an optimisation, so it should be safe-by-default imo.

bb updated this revision to Diff 12033.May 27 2020, 3:44 PM

Fix serialisation

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

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/845/display/redirect

Silier resigned from this revision.May 27 2020, 3:50 PM
This revision is now accepted and ready to land.May 27 2020, 3:51 PM

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

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/846/display/redirect

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 142| 142| 	this.formationMembersWithAura = []; // Members with a formation aura
| 143| 143| 	this.width = 0;
| 144| 144| 	this.depth = 0;
| 145|    |-	this.oldOrientation = {"sin": 0, "cos": 0};
|    | 145|+	this.oldOrientation = { "sin": 0, "cos": 0};
| 146| 146| 	this.twinFormations = [];
| 147| 147| 	// distance from which two twin formations will merge into one.
| 148| 148| 	this.formationSeparation = 0;
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 142| 142| 	this.formationMembersWithAura = []; // Members with a formation aura
| 143| 143| 	this.width = 0;
| 144| 144| 	this.depth = 0;
| 145|    |-	this.oldOrientation = {"sin": 0, "cos": 0};
|    | 145|+	this.oldOrientation = {"sin": 0, "cos": 0 };
| 146| 146| 	this.twinFormations = [];
| 147| 147| 	// distance from which two twin formations will merge into one.
| 148| 148| 	this.formationSeparation = 0;
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 180| 180| 
| 181| 181| Formation.prototype.GetSize = function()
| 182| 182| {
| 183|    |-	return {"width": this.width, "depth": this.depth};
|    | 183|+	return { "width": this.width, "depth": this.depth};
| 184| 184| };
| 185| 185| 
| 186| 186| Formation.prototype.GetSpeedMultiplier = function()
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 180| 180| 
| 181| 181| Formation.prototype.GetSize = function()
| 182| 182| {
| 183|    |-	return {"width": this.width, "depth": this.depth};
|    | 183|+	return {"width": this.width, "depth": this.depth };
| 184| 184| };
| 185| 185| 
| 186| 186| Formation.prototype.GetSpeedMultiplier = function()
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 613| 613| 			footprints.push(cmpFootprint.GetShape());
| 614| 614| 	}
| 615| 615| 	if (!footprints.length)
| 616|    |-		return {"width":1, "depth": 1};
|    | 616|+		return { "width":1, "depth": 1};
| 617| 617| 
| 618| 618| 	var r = {"width": 0, "depth": 0};
| 619| 619| 	for (var shape of footprints)
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'width'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 613| 613| 			footprints.push(cmpFootprint.GetShape());
| 614| 614| 	}
| 615| 615| 	if (!footprints.length)
| 616|    |-		return {"width":1, "depth": 1};
|    | 616|+		return {"width": 1, "depth": 1};
| 617| 617| 
| 618| 618| 	var r = {"width": 0, "depth": 0};
| 619| 619| 	for (var shape of footprints)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 613| 613| 			footprints.push(cmpFootprint.GetShape());
| 614| 614| 	}
| 615| 615| 	if (!footprints.length)
| 616|    |-		return {"width":1, "depth": 1};
|    | 616|+		return {"width":1, "depth": 1 };
| 617| 617| 
| 618| 618| 	var r = {"width": 0, "depth": 0};
| 619| 619| 	for (var shape of footprints)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 615| 615| 	if (!footprints.length)
| 616| 616| 		return {"width":1, "depth": 1};
| 617| 617| 
| 618|    |-	var r = {"width": 0, "depth": 0};
|    | 618|+	var r = { "width": 0, "depth": 0};
| 619| 619| 	for (var shape of footprints)
| 620| 620| 	{
| 621| 621| 		if (shape.type == "circle")
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 615| 615| 	if (!footprints.length)
| 616| 616| 		return {"width":1, "depth": 1};
| 617| 617| 
| 618|    |-	var r = {"width": 0, "depth": 0};
|    | 618|+	var r = {"width": 0, "depth": 0 };
| 619| 619| 	for (var shape of footprints)
| 620| 620| 	{
| 621| 621| 		if (shape.type == "circle")
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 641| 641| 	separation.depth *= this.separationMultiplier.depth;
| 642| 642| 
| 643| 643| 	if (this.columnar)
| 644|    |-		var sortingClasses = ["Cavalry","Infantry"];
|    | 644|+		var sortingClasses = ["Cavalry", "Infantry"];
| 645| 645| 	else
| 646| 646| 		var sortingClasses = this.sortingClasses.slice();
| 647| 647| 	sortingClasses.push("Unknown");
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 661| 661| 		{
| 662| 662| 			if (classes.indexOf(sortingClasses[c]) > -1)
| 663| 663| 			{
| 664|    |-				types[sortingClasses[c]].push({"ent": active[i], "pos": positions[i]});
|    | 664|+				types[sortingClasses[c]].push({ "ent": active[i], "pos": positions[i]});
| 665| 665| 				done = true;
| 666| 666| 				break;
| 667| 667| 			}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 661| 661| 		{
| 662| 662| 			if (classes.indexOf(sortingClasses[c]) > -1)
| 663| 663| 			{
| 664|    |-				types[sortingClasses[c]].push({"ent": active[i], "pos": positions[i]});
|    | 664|+				types[sortingClasses[c]].push({"ent": active[i], "pos": positions[i] });
| 665| 665| 				done = true;
| 666| 666| 				break;
| 667| 667| 			}
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["Unknown"] is better written in dot notation.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 667| 667| 			}
| 668| 668| 		}
| 669| 669| 		if (!done)
| 670|    |-			types["Unknown"].push({"ent": active[i], "pos": positions[i]});
|    | 670|+			types.Unknown.push({"ent": active[i], "pos": positions[i]});
| 671| 671| 	}
| 672| 672| 
| 673| 673| 	var count = active.length;
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 667| 667| 			}
| 668| 668| 		}
| 669| 669| 		if (!done)
| 670|    |-			types["Unknown"].push({"ent": active[i], "pos": positions[i]});
|    | 670|+			types["Unknown"].push({ "ent": active[i], "pos": positions[i]});
| 671| 671| 	}
| 672| 672| 
| 673| 673| 	var count = active.length;
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 667| 667| 			}
| 668| 668| 		}
| 669| 669| 		if (!done)
| 670|    |-			types["Unknown"].push({"ent": active[i], "pos": positions[i]});
|    | 670|+			types["Unknown"].push({"ent": active[i], "pos": positions[i] });
| 671| 671| 	}
| 672| 672| 
| 673| 673| 	var count = active.length;
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 684| 684| 	if (this.columnar)
| 685| 685| 	{
| 686| 686| 		shape = "square";
| 687|    |-		cols = Math.min(count,3);
|    | 687|+		cols = Math.min(count, 3);
| 688| 688| 		shiftRows = false;
| 689| 689| 		centerGap = 0;
| 690| 690| 		sortingOrder = null;
|    | [NORMAL] ESLintBear (space-before-function-paren):
|    | Unexpected space before function parentheses.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 779| 779| 	// calculating offset distances without a zero average makes no sense, as the formation
| 780| 780| 	// will jump to a different position any time
| 781| 781| 	var avgoffset = Vector2D.average(offsets);
| 782|    |-	offsets.forEach(function (o) {o.sub(avgoffset);});
|    | 782|+	offsets.forEach(function(o) {o.sub(avgoffset);});
| 783| 783| 
| 784| 784| 	// sort the available places in certain ways
| 785| 785| 	// the places first in the list will contain the heaviest units as defined by the order
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 838| 838| 			closestOffsetId = i;
| 839| 839| 		}
| 840| 840| 	}
| 841|    |-	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
|    | 841|+	this.memberPositions[entPos.ent] = { "row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
| 842| 842| 	return closestOffsetId;
| 843| 843| };
| 844| 844| 
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'column'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 838| 838| 			closestOffsetId = i;
| 839| 839| 		}
| 840| 840| 	}
| 841|    |-	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
|    | 841|+	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column": offsets[closestOffsetId].column};
| 842| 842| 	return closestOffsetId;
| 843| 843| };
| 844| 844| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 838| 838| 			closestOffsetId = i;
| 839| 839| 		}
| 840| 840| 	}
| 841|    |-	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
|    | 841|+	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column };
| 842| 842| 	return closestOffsetId;
| 843| 843| };
| 844| 844| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 848| 848| Formation.prototype.GetRealOffsetPositions = function(offsets, pos)
| 849| 849| {
| 850| 850| 	var offsetPositions = [];
| 851|    |-	var {sin, cos} = this.GetEstimatedOrientation(pos);
|    | 851|+	var { sin, cos} = this.GetEstimatedOrientation(pos);
| 852| 852| 	// calculate the world positions
| 853| 853| 	for (var o of offsets)
| 854| 854| 		offsetPositions.push(new Vector2D(pos.x + o.y * sin + o.x * cos, pos.y + o.y * cos - o.x * sin));
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 848| 848| Formation.prototype.GetRealOffsetPositions = function(offsets, pos)
| 849| 849| {
| 850| 850| 	var offsetPositions = [];
| 851|    |-	var {sin, cos} = this.GetEstimatedOrientation(pos);
|    | 851|+	var {sin, cos } = this.GetEstimatedOrientation(pos);
| 852| 852| 	// calculate the world positions
| 853| 853| 	for (var o of offsets)
| 854| 854| 		offsetPositions.push(new Vector2D(pos.x + o.y * sin + o.x * cos, pos.y + o.y * cos - o.x * sin));
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 865| 865| Formation.prototype.GetEstimatedOrientation = function(pos)
| 866| 866| {
| 867| 867| 	var cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI);
| 868|    |-	var r = {"sin": 0, "cos": 1};
|    | 868|+	var r = { "sin": 0, "cos": 1};
| 869| 869| 	var unitAIState = cmpUnitAI.GetCurrentState();
| 870| 870| 	if (unitAIState == "FORMATIONCONTROLLER.WALKING" || unitAIState == "FORMATIONCONTROLLER.COMBAT.APPROACHING")
| 871| 871| 	{
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 865| 865| Formation.prototype.GetEstimatedOrientation = function(pos)
| 866| 866| {
| 867| 867| 	var cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI);
| 868|    |-	var r = {"sin": 0, "cos": 1};
|    | 868|+	var r = {"sin": 0, "cos": 1 };
| 869| 869| 	var unitAIState = cmpUnitAI.GetCurrentState();
| 870| 870| 	if (unitAIState == "FORMATIONCONTROLLER.WALKING" || unitAIState == "FORMATIONCONTROLLER.COMBAT.APPROACHING")
| 871| 871| 	{
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 896| 896| Formation.prototype.GetCurrentSpeedMultiplier = function()
| 897| 897| {
| 898| 898| 	return this.currentSpeedMultiplier;
| 899|    |-}
|    | 899|+};
| 900| 900| 
| 901| 901| /**
| 902| 902|  * Set formation controller's speed based on its current members.
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 954| 954| 		cmpOtherFormation.RemoveMembers(otherMembers);
| 955| 955| 		this.AddMembers(otherMembers);
| 956| 956| 		Engine.DestroyEntity(this.twinFormations[i]);
| 957|    |-		this.twinFormations.splice(i,1);
|    | 957|+		this.twinFormations.splice(i, 1);
| 958| 958| 	}
| 959| 959| 	// Switch between column and box if necessary
| 960| 960| 	var cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI);

binaries/data/mods/public/simulation/components/Formation.js
| 464| »   for·(var·ent·of·this.formationMembersWithAura)
|    | [NORMAL] JSHintBear:
|    | 'ent' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 511| »   var·cmpPosition·=·Engine.QueryInterface(this.entity,·IID_Position);
|    | [NORMAL] JSHintBear:
|    | 'cmpPosition' is already defined.

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

binaries/data/mods/public/simulation/components/Formation.js
| 594| »   var·cmpPosition·=·Engine.QueryInterface(this.entity,·IID_Position);
|    | [NORMAL] JSHintBear:
|    | 'cmpPosition' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 646| »   »   var·sortingClasses·=·this.sortingClasses.slice();
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 655| »   for·(var·i·in·active)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 670| »   »   »   types["Unknown"].push({"ent":·active[i],·"pos":·positions[i]});
|    | [NORMAL] JSHintBear:
|    | ['Unknown'] is better written in dot notation.

binaries/data/mods/public/simulation/components/Formation.js
| 709| »   »   for·(var·i·=·0;·i·<·count;·++i)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 743| »   »   »   »   »   var·n·=·r·+·1;
|    | [NORMAL] JSHintBear:
|    | 'n' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 745| »   »   »   »   »   var·n·=·r·*·2·+·1;
|    | [NORMAL] JSHintBear:
|    | 'n' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 749| »   »   »   for·(var·c·=·0;·c·<·n·&&·left·>·0;·++c)
|    | [NORMAL] JSHintBear:
|    | 'c' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 756| »   »   »   »   »   var·x·=·side·*·Math.ceil(c/2)·*·separation.width;
|    | [NORMAL] JSHintBear:
|    | 'x' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 759| »   »   »   »   »   if·(x·==·0)·//·don't·use·the·center·position·with·a·center·gap
|    | [NORMAL] JSHintBear:
|    | 'x' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 761| »   »   »   »   »   x·+=·side·*·centerGap·/·2;
|    | [NORMAL] JSHintBear:
|    | 'x' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 767| »   »   »   »   offsets.push(new·Vector2D(x·+·r1,·z·+·r2));
|    | [NORMAL] JSHintBear:
|    | 'x' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 747| »   »   »   if·(!shiftRows·&&·n·>·left)
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 748| »   »   »   »   n·=·left;
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 749| »   »   »   for·(var·c·=·0;·c·<·n·&&·left·>·0;·++c)
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 753| »   »   »   »   if·(n%2·==·0)
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 763| »   »   »   »   var·column·=·Math.ceil(n/2)·+·Math.ceil(c/2)·*·side;
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 773| »   »   »   this.maxColumnsUsed[r]·=·n;
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 802| »   for·(var·i·=·sortingClasses.length;·i;·--i)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 647| »   sortingClasses.push("Unknown");
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 652| »   for·(var·i·=·0;·i·<·sortingClasses.length;·++i)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 653| »   »   types[sortingClasses[i]]·=·[];
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 660| »   »   for·(var·c·=·0;·c·<·sortingClasses.length;·++c)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 662| »   »   »   if·(classes.indexOf(sortingClasses[c])·>·-1)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 664| »   »   »   »   types[sortingClasses[c]].push({"ent":·active[i],·"pos":·positions[i]});
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 802| »   for·(var·i·=·sortingClasses.length;·i;·--i)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 804| »   »   var·t·=·types[sortingClasses[i-1]];
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 899| }
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.
|    | [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
|1072|1072| 			},
|1073|1073| 		},
|1074|1074| 
|1075|    |-		"GARRISON":{
|    |1075|+		"GARRISON": {
|1076|1076| 			"APPROACHING": {
|1077|1077| 				"enter": function() {
|1078|1078| 					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
|2054|2054| 
|2055|2055| 				"Attacked": function(msg) {
|2056|2056| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2057|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2058|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2057|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2058|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2059|2059| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2060|2060| 				},
|2061|2061| 			},
|    | [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
|2213|2213| 					"MovementUpdate": function(msg) {
|2214|2214| 						// If it looks like the path is failing, and we are close enough (3 tiles) from wanted range
|2215|2215| 						// stop anyways. This avoids pathing for an unreachable goal and reduces lag considerably.
|2216|    |-						if (msg.likelyFailure || 
|    |2216|+						if (msg.likelyFailure ||
|2217|2217| 							msg.obstructed && this.RelaxedMaxRangeCheck(this.order.data, this.order.data.max + this.DefaultRelaxedMaxRange) ||
|2218|2218| 							!msg.obstructed && this.CheckRange(this.order.data))
|2219|2219| 							this.FinishOrder();
|    | [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
|2855|2855| 					{
|2856|2856| 						// The building was already finished/fully repaired before we arrived;
|2857|2857| 						// let the ConstructionFinished handler handle this.
|2858|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2858|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2859|2859| 						return true;
|2860|2860| 					}
|2861|2861| 
|    | [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
|2855|2855| 					{
|2856|2856| 						// The building was already finished/fully repaired before we arrived;
|2857|2857| 						// let the ConstructionFinished handler handle this.
|2858|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2858|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2859|2859| 						return true;
|2860|2860| 					}
|2861|2861| 
|    | [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
|3153|3153| 				this.StopTimer();
|3154|3154| 				this.ResetAnimation();
|3155|3155| 				if (this.formationAnimationVariant)
|3156|    |-					this.SetAnimationVariant(this.formationAnimationVariant)
|    |3156|+					this.SetAnimationVariant(this.formationAnimationVariant);
|3157|3157| 				else
|3158|3158| 					this.SetDefaultAnimationVariant();
|3159|3159| 				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
|3379|3379| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3380|3380| 
|3381|3381| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3382|    |-							// only used for domestic animals
|    |3382|+		// only used for domestic animals
|3383|3383| 
|3384|3384| 		// Reuse the same garrison behaviour for animals.
|3385|3385| 		"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
|3441|3441| 
|3442|3442| UnitAI.prototype.IsAnimal = function()
|3443|3443| {
|3444|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3444|+	return (!!this.template.NaturalBehaviour);
|3445|3445| };
|3446|3446| 
|3447|3447| 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
|3557|3557| 		{
|3558|3558| 			let index = this.GetCurrentState().indexOf(".");
|3559|3559| 			if (index != -1)
|3560|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3560|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3561|3561| 			this.Stop(false);
|3562|3562| 		}
|3563|3563| 
|    | [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
|3613|3613| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3614|3614| 			continue;
|3615|3615| 		if (i == 0)
|3616|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3616|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3617|3617| 		else
|3618|3618| 			this.orderQueue.splice(i, 1);
|3619|3619| 		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
|3613|3613| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3614|3614| 			continue;
|3615|3615| 		if (i == 0)
|3616|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3616|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3617|3617| 		else
|3618|3618| 			this.orderQueue.splice(i, 1);
|3619|3619| 		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
|3700|3700| };
|3701|3701| 
|3702|3702| 
|3703|    |-//// FSM linkage functions ////
|    |3703|+// // FSM linkage functions ////
|3704|3704| 
|3705|3705| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3706|3706| 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
|3871|3871| 				continue;
|3872|3872| 			if (this.orderQueue[i].type == type)
|3873|3873| 				continue;
|3874|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3874|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3875|3875| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3876|3876| 			return;
|3877|3877| 		}
|    | [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
|3871|3871| 				continue;
|3872|3872| 			if (this.orderQueue[i].type == type)
|3873|3873| 				continue;
|3874|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3874|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3875|3875| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3876|3876| 			return;
|3877|3877| 		}
|    | [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
|4113|4113| 	if (data.timerRepeat === undefined)
|4114|4114| 		this.timer = undefined;
|4115|4115| 
|4116|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4116|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4117|4117| };
|4118|4118| 
|4119|4119| /**
|    | [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
|4113|4113| 	if (data.timerRepeat === undefined)
|4114|4114| 		this.timer = undefined;
|4115|4115| 
|4116|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4116|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4117|4117| };
|4118|4118| 
|4119|4119| /**
|    | [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
|4158|4158| 	// TODO: This is a bit inefficient since every unit listens to every
|4159|4159| 	// construction message - ideally we could scope it to only the one we're building
|4160|4160| 
|4161|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4161|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4162|4162| };
|4163|4163| 
|4164|4164| 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
|4158|4158| 	// TODO: This is a bit inefficient since every unit listens to every
|4159|4159| 	// construction message - ideally we could scope it to only the one we're building
|4160|4160| 
|4161|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4161|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4162|4162| };
|4163|4163| 
|4164|4164| 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
|4189|4189| 	if (msg.fromStatusEffect)
|4190|4190| 		return;
|4191|4191| 
|4192|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4192|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4193|4193| };
|4194|4194| 
|4195|4195| 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
|4189|4189| 	if (msg.fromStatusEffect)
|4190|4190| 		return;
|4191|4191| 
|4192|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4192|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4193|4193| };
|4194|4194| 
|4195|4195| 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
|4194|4194| 
|4195|4195| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4196|4196| {
|4197|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4197|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4198|4198| };
|4199|4199| 
|4200|4200| 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
|4194|4194| 
|4195|4195| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4196|4196| {
|4197|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4197|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4198|4198| };
|4199|4199| 
|4200|4200| 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
|4199|4199| 
|4200|4200| UnitAI.prototype.OnHealthChanged = function(msg)
|4201|4201| {
|4202|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4202|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4203|4203| };
|4204|4204| 
|4205|4205| 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
|4199|4199| 
|4200|4200| UnitAI.prototype.OnHealthChanged = function(msg)
|4201|4201| {
|4202|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4202|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4203|4203| };
|4204|4204| 
|4205|4205| 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
|4205|4205| UnitAI.prototype.OnRangeUpdate = function(msg)
|4206|4206| {
|4207|4207| 	if (msg.tag == this.losRangeQuery)
|4208|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4208|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4209|4209| 	else if (msg.tag == this.losHealRangeQuery)
|4210|4210| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4211|4211| };
|    | [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
|4205|4205| UnitAI.prototype.OnRangeUpdate = function(msg)
|4206|4206| {
|4207|4207| 	if (msg.tag == this.losRangeQuery)
|4208|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4208|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4209|4209| 	else if (msg.tag == this.losHealRangeQuery)
|4210|4210| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4211|4211| };
|    | [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
|4207|4207| 	if (msg.tag == this.losRangeQuery)
|4208|4208| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4209|4209| 	else if (msg.tag == this.losHealRangeQuery)
|4210|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4210|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4211|4211| };
|4212|4212| 
|4213|4213| 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
|4207|4207| 	if (msg.tag == this.losRangeQuery)
|4208|4208| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4209|4209| 	else if (msg.tag == this.losHealRangeQuery)
|4210|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4210|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4211|4211| };
|4212|4212| 
|4213|4213| 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
|4212|4212| 
|4213|4213| UnitAI.prototype.OnPackFinished = function(msg)
|4214|4214| {
|4215|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4215|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4216|4216| };
|4217|4217| 
|4218|4218| //// 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
|4212|4212| 
|4213|4213| UnitAI.prototype.OnPackFinished = function(msg)
|4214|4214| {
|4215|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4215|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4216|4216| };
|4217|4217| 
|4218|4218| //// 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
|4215|4215| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4216|4216| };
|4217|4217| 
|4218|    |-//// Helper functions to be called by the FSM ////
|    |4218|+// // Helper functions to be called by the FSM ////
|4219|4219| 
|4220|4220| UnitAI.prototype.GetWalkSpeed = function()
|4221|4221| {
|    | [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
|4927|4927| UnitAI.prototype.AttackEntityInZone = function(ents)
|4928|4928| {
|4929|4929| 	var target = ents.find(target =>
|4930|    |-		this.CanAttack(target)
|4931|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4930|+		this.CanAttack(target) &&
|    |4931|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4932|4932| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4933|4933| 	);
|4934|4934| 	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
|4928|4928| {
|4929|4929| 	var target = ents.find(target =>
|4930|4930| 		this.CanAttack(target)
|4931|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4932|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4931|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4932|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4933|4933| 	);
|4934|4934| 	if (!target)
|4935|4935| 		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
|4994|4994| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4995|4995| 	if (this.isGuardOf)
|4996|4996| 	{
|4997|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4997|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4998|4998| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4999|4999| 		if (cmpUnitAI && cmpAttack &&
|5000|5000| 		    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
|4998|4998| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4999|4999| 		if (cmpUnitAI && cmpAttack &&
|5000|5000| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|5001|    |-				return false;
|    |5001|+			return false;
|5002|5002| 	}
|5003|5003| 
|5004|5004| 	// 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
|5036|5036| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|5037|5037| 	if (this.isGuardOf)
|5038|5038| 	{
|5039|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |5039|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|5040|5040| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|5041|5041| 		if (cmpUnitAI && cmpAttack &&
|5042|5042| 		    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
|5049|5049| 	return false;
|5050|5050| };
|5051|5051| 
|5052|    |-//// External interface functions ////
|    |5052|+// // External interface functions ////
|5053|5053| 
|5054|5054| UnitAI.prototype.SetFormationController = function(ent)
|5055|5055| {
|    | [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
|5205|5205| 	{
|5206|5206| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5207|5207| 			return;
|5208|    |-		else
|5209|    |-			this.RemoveGuard();
|    |5208|+		this.RemoveGuard();
|5210|5209| 	}
|5211|5210| 
|5212|5211| 	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
|5536|5536| 
|5537|5537| 	if (this.IsFormationController())
|5538|5538| 		this.CallMemberFunction("CancelSetupTradeRoute", [target]);
|5539|    |-}
|    |5539|+};
|5540|5540| /**
|5541|5541|  * Adds trade order to the queue. Either walk to the first market, or
|5542|5542|  * 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
|5557|5557| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5558|5558| 	{
|5559|5559| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5560|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5560|+		if (cmpTrader.HasBothMarkets() &&
|5561|5561| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5562|5562| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5563|5563| 		{
|    | [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
|5838|5838| 				{
|5839|5839| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5840|5840| 					var targetClasses = this.order.data.targetClasses;
|5841|    |-					if (targetClasses.attack && cmpIdentity
|5842|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5841|+					if (targetClasses.attack && cmpIdentity &&
|    |5842|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5843|5843| 						continue;
|5844|5844| 					if (targetClasses.avoid && cmpIdentity
|5845|5845| 						&& 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
|5841|5841| 					if (targetClasses.attack && cmpIdentity
|5842|5842| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5843|5843| 						continue;
|5844|    |-					if (targetClasses.avoid && cmpIdentity
|5845|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5844|+					if (targetClasses.avoid && cmpIdentity &&
|    |5845|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5846|5846| 						continue;
|5847|5847| 					// Only used by the AIs to prevent some choices of targets
|5848|5848| 					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
|5864|5864| 		{
|5865|5865| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5866|5866| 			var targetClasses = this.order.data.targetClasses;
|5867|    |-			if (cmpIdentity && targetClasses.attack
|5868|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5867|+			if (cmpIdentity && targetClasses.attack &&
|    |5868|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5869|5869| 				continue;
|5870|5870| 			if (cmpIdentity && targetClasses.avoid
|5871|5871| 				&& 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
|5867|5867| 			if (cmpIdentity && targetClasses.attack
|5868|5868| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5869|5869| 				continue;
|5870|    |-			if (cmpIdentity && targetClasses.avoid
|5871|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5870|+			if (cmpIdentity && targetClasses.avoid &&
|    |5871|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5872|5872| 				continue;
|5873|5873| 			// Only used by the AIs to prevent some choices of targets
|5874|5874| 			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
|6067|6067| 
|6068|6068| UnitAI.prototype.SetHeldPosition = function(x, z)
|6069|6069| {
|6070|    |-	this.heldPosition = {"x": x, "z": z};
|    |6070|+	this.heldPosition = { "x": x, "z": z};
|6071|6071| };
|6072|6072| 
|6073|6073| 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
|6067|6067| 
|6068|6068| UnitAI.prototype.SetHeldPosition = function(x, z)
|6069|6069| {
|6070|    |-	this.heldPosition = {"x": x, "z": z};
|    |6070|+	this.heldPosition = {"x": x, "z": z };
|6071|6071| };
|6072|6072| 
|6073|6073| 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
|6094|6094| 	return false;
|6095|6095| };
|6096|6096| 
|6097|    |-//// Helper functions ////
|    |6097|+// // Helper functions ////
|6098|6098| 
|6099|6099| /**
|6100|6100|  * 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
|6113|6113| 		return undefined;
|6114|6114| 
|6115|6115| 	return component.GetRange(type);
|6116|    |-}
|    |6116|+};
|6117|6117| 
|6118|6118| UnitAI.prototype.CanAttack = function(target)
|6119|6119| {
|    | [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
|6281|6281| 	return cmpPack && cmpPack.IsPacking();
|6282|6282| };
|6283|6283| 
|6284|    |-//// Formation specific functions ////
|    |6284|+// // Formation specific functions ////
|6285|6285| 
|6286|6286| UnitAI.prototype.IsAttackingAsFormation = function()
|6287|6287| {
|    | [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
|6286|6286| UnitAI.prototype.IsAttackingAsFormation = function()
|6287|6287| {
|6288|6288| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6289|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6290|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6289|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6290|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6291|6291| };
|6292|6292| 
|6293|6293| //// 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
|6290|6290| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6291|6291| };
|6292|6292| 
|6293|    |-//// Animal specific functions ////
|    |6293|+// // Animal specific functions ////
|6294|6294| 
|6295|6295| UnitAI.prototype.MoveRandomly = function(distance)
|6296|6296| {

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
|1264| »   »   »   »   return·false;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'Timer' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
|4018| »   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
|4914| »   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
|4929| »   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
|4977| »   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
|5000| »   »   ····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
|2058| »   »   »   »   »   »   &&·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
|3156| »   »   »   »   »   this.SetAnimationVariant(this.formationAnimationVariant)
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

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

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

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

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

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

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

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

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 142| 142| 	this.formationMembersWithAura = []; // Members with a formation aura
| 143| 143| 	this.width = 0;
| 144| 144| 	this.depth = 0;
| 145|    |-	this.oldOrientation = {"sin": 0, "cos": 0};
|    | 145|+	this.oldOrientation = { "sin": 0, "cos": 0};
| 146| 146| 	this.twinFormations = [];
| 147| 147| 	// distance from which two twin formations will merge into one.
| 148| 148| 	this.formationSeparation = 0;
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 142| 142| 	this.formationMembersWithAura = []; // Members with a formation aura
| 143| 143| 	this.width = 0;
| 144| 144| 	this.depth = 0;
| 145|    |-	this.oldOrientation = {"sin": 0, "cos": 0};
|    | 145|+	this.oldOrientation = {"sin": 0, "cos": 0 };
| 146| 146| 	this.twinFormations = [];
| 147| 147| 	// distance from which two twin formations will merge into one.
| 148| 148| 	this.formationSeparation = 0;
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 180| 180| 
| 181| 181| Formation.prototype.GetSize = function()
| 182| 182| {
| 183|    |-	return {"width": this.width, "depth": this.depth};
|    | 183|+	return { "width": this.width, "depth": this.depth};
| 184| 184| };
| 185| 185| 
| 186| 186| Formation.prototype.GetSpeedMultiplier = function()
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 180| 180| 
| 181| 181| Formation.prototype.GetSize = function()
| 182| 182| {
| 183|    |-	return {"width": this.width, "depth": this.depth};
|    | 183|+	return {"width": this.width, "depth": this.depth };
| 184| 184| };
| 185| 185| 
| 186| 186| Formation.prototype.GetSpeedMultiplier = function()
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 613| 613| 			footprints.push(cmpFootprint.GetShape());
| 614| 614| 	}
| 615| 615| 	if (!footprints.length)
| 616|    |-		return {"width":1, "depth": 1};
|    | 616|+		return { "width":1, "depth": 1};
| 617| 617| 
| 618| 618| 	var r = {"width": 0, "depth": 0};
| 619| 619| 	for (var shape of footprints)
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'width'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 613| 613| 			footprints.push(cmpFootprint.GetShape());
| 614| 614| 	}
| 615| 615| 	if (!footprints.length)
| 616|    |-		return {"width":1, "depth": 1};
|    | 616|+		return {"width": 1, "depth": 1};
| 617| 617| 
| 618| 618| 	var r = {"width": 0, "depth": 0};
| 619| 619| 	for (var shape of footprints)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 613| 613| 			footprints.push(cmpFootprint.GetShape());
| 614| 614| 	}
| 615| 615| 	if (!footprints.length)
| 616|    |-		return {"width":1, "depth": 1};
|    | 616|+		return {"width":1, "depth": 1 };
| 617| 617| 
| 618| 618| 	var r = {"width": 0, "depth": 0};
| 619| 619| 	for (var shape of footprints)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 615| 615| 	if (!footprints.length)
| 616| 616| 		return {"width":1, "depth": 1};
| 617| 617| 
| 618|    |-	var r = {"width": 0, "depth": 0};
|    | 618|+	var r = { "width": 0, "depth": 0};
| 619| 619| 	for (var shape of footprints)
| 620| 620| 	{
| 621| 621| 		if (shape.type == "circle")
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 615| 615| 	if (!footprints.length)
| 616| 616| 		return {"width":1, "depth": 1};
| 617| 617| 
| 618|    |-	var r = {"width": 0, "depth": 0};
|    | 618|+	var r = {"width": 0, "depth": 0 };
| 619| 619| 	for (var shape of footprints)
| 620| 620| 	{
| 621| 621| 		if (shape.type == "circle")
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 641| 641| 	separation.depth *= this.separationMultiplier.depth;
| 642| 642| 
| 643| 643| 	if (this.columnar)
| 644|    |-		var sortingClasses = ["Cavalry","Infantry"];
|    | 644|+		var sortingClasses = ["Cavalry", "Infantry"];
| 645| 645| 	else
| 646| 646| 		var sortingClasses = this.sortingClasses.slice();
| 647| 647| 	sortingClasses.push("Unknown");
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 661| 661| 		{
| 662| 662| 			if (classes.indexOf(sortingClasses[c]) > -1)
| 663| 663| 			{
| 664|    |-				types[sortingClasses[c]].push({"ent": active[i], "pos": positions[i]});
|    | 664|+				types[sortingClasses[c]].push({ "ent": active[i], "pos": positions[i]});
| 665| 665| 				done = true;
| 666| 666| 				break;
| 667| 667| 			}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 661| 661| 		{
| 662| 662| 			if (classes.indexOf(sortingClasses[c]) > -1)
| 663| 663| 			{
| 664|    |-				types[sortingClasses[c]].push({"ent": active[i], "pos": positions[i]});
|    | 664|+				types[sortingClasses[c]].push({"ent": active[i], "pos": positions[i] });
| 665| 665| 				done = true;
| 666| 666| 				break;
| 667| 667| 			}
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["Unknown"] is better written in dot notation.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 667| 667| 			}
| 668| 668| 		}
| 669| 669| 		if (!done)
| 670|    |-			types["Unknown"].push({"ent": active[i], "pos": positions[i]});
|    | 670|+			types.Unknown.push({"ent": active[i], "pos": positions[i]});
| 671| 671| 	}
| 672| 672| 
| 673| 673| 	var count = active.length;
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 667| 667| 			}
| 668| 668| 		}
| 669| 669| 		if (!done)
| 670|    |-			types["Unknown"].push({"ent": active[i], "pos": positions[i]});
|    | 670|+			types["Unknown"].push({ "ent": active[i], "pos": positions[i]});
| 671| 671| 	}
| 672| 672| 
| 673| 673| 	var count = active.length;
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 667| 667| 			}
| 668| 668| 		}
| 669| 669| 		if (!done)
| 670|    |-			types["Unknown"].push({"ent": active[i], "pos": positions[i]});
|    | 670|+			types["Unknown"].push({"ent": active[i], "pos": positions[i] });
| 671| 671| 	}
| 672| 672| 
| 673| 673| 	var count = active.length;
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 684| 684| 	if (this.columnar)
| 685| 685| 	{
| 686| 686| 		shape = "square";
| 687|    |-		cols = Math.min(count,3);
|    | 687|+		cols = Math.min(count, 3);
| 688| 688| 		shiftRows = false;
| 689| 689| 		centerGap = 0;
| 690| 690| 		sortingOrder = null;
|    | [NORMAL] ESLintBear (space-before-function-paren):
|    | Unexpected space before function parentheses.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 779| 779| 	// calculating offset distances without a zero average makes no sense, as the formation
| 780| 780| 	// will jump to a different position any time
| 781| 781| 	var avgoffset = Vector2D.average(offsets);
| 782|    |-	offsets.forEach(function (o) {o.sub(avgoffset);});
|    | 782|+	offsets.forEach(function(o) {o.sub(avgoffset);});
| 783| 783| 
| 784| 784| 	// sort the available places in certain ways
| 785| 785| 	// the places first in the list will contain the heaviest units as defined by the order
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 838| 838| 			closestOffsetId = i;
| 839| 839| 		}
| 840| 840| 	}
| 841|    |-	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
|    | 841|+	this.memberPositions[entPos.ent] = { "row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
| 842| 842| 	return closestOffsetId;
| 843| 843| };
| 844| 844| 
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'column'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 838| 838| 			closestOffsetId = i;
| 839| 839| 		}
| 840| 840| 	}
| 841|    |-	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
|    | 841|+	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column": offsets[closestOffsetId].column};
| 842| 842| 	return closestOffsetId;
| 843| 843| };
| 844| 844| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 838| 838| 			closestOffsetId = i;
| 839| 839| 		}
| 840| 840| 	}
| 841|    |-	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
|    | 841|+	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column };
| 842| 842| 	return closestOffsetId;
| 843| 843| };
| 844| 844| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 848| 848| Formation.prototype.GetRealOffsetPositions = function(offsets, pos)
| 849| 849| {
| 850| 850| 	var offsetPositions = [];
| 851|    |-	var {sin, cos} = this.GetEstimatedOrientation(pos);
|    | 851|+	var { sin, cos} = this.GetEstimatedOrientation(pos);
| 852| 852| 	// calculate the world positions
| 853| 853| 	for (var o of offsets)
| 854| 854| 		offsetPositions.push(new Vector2D(pos.x + o.y * sin + o.x * cos, pos.y + o.y * cos - o.x * sin));
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 848| 848| Formation.prototype.GetRealOffsetPositions = function(offsets, pos)
| 849| 849| {
| 850| 850| 	var offsetPositions = [];
| 851|    |-	var {sin, cos} = this.GetEstimatedOrientation(pos);
|    | 851|+	var {sin, cos } = this.GetEstimatedOrientation(pos);
| 852| 852| 	// calculate the world positions
| 853| 853| 	for (var o of offsets)
| 854| 854| 		offsetPositions.push(new Vector2D(pos.x + o.y * sin + o.x * cos, pos.y + o.y * cos - o.x * sin));
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 865| 865| Formation.prototype.GetEstimatedOrientation = function(pos)
| 866| 866| {
| 867| 867| 	var cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI);
| 868|    |-	var r = {"sin": 0, "cos": 1};
|    | 868|+	var r = { "sin": 0, "cos": 1};
| 869| 869| 	var unitAIState = cmpUnitAI.GetCurrentState();
| 870| 870| 	if (unitAIState == "FORMATIONCONTROLLER.WALKING" || unitAIState == "FORMATIONCONTROLLER.COMBAT.APPROACHING")
| 871| 871| 	{
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 865| 865| Formation.prototype.GetEstimatedOrientation = function(pos)
| 866| 866| {
| 867| 867| 	var cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI);
| 868|    |-	var r = {"sin": 0, "cos": 1};
|    | 868|+	var r = {"sin": 0, "cos": 1 };
| 869| 869| 	var unitAIState = cmpUnitAI.GetCurrentState();
| 870| 870| 	if (unitAIState == "FORMATIONCONTROLLER.WALKING" || unitAIState == "FORMATIONCONTROLLER.COMBAT.APPROACHING")
| 871| 871| 	{
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 954| 954| 		cmpOtherFormation.RemoveMembers(otherMembers);
| 955| 955| 		this.AddMembers(otherMembers);
| 956| 956| 		Engine.DestroyEntity(this.twinFormations[i]);
| 957|    |-		this.twinFormations.splice(i,1);
|    | 957|+		this.twinFormations.splice(i, 1);
| 958| 958| 	}
| 959| 959| 	// Switch between column and box if necessary
| 960| 960| 	var cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI);

binaries/data/mods/public/simulation/components/Formation.js
| 464| »   for·(var·ent·of·this.formationMembersWithAura)
|    | [NORMAL] JSHintBear:
|    | 'ent' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 511| »   var·cmpPosition·=·Engine.QueryInterface(this.entity,·IID_Position);
|    | [NORMAL] JSHintBear:
|    | 'cmpPosition' is already defined.

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

binaries/data/mods/public/simulation/components/Formation.js
| 594| »   var·cmpPosition·=·Engine.QueryInterface(this.entity,·IID_Position);
|    | [NORMAL] JSHintBear:
|    | 'cmpPosition' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 646| »   »   var·sortingClasses·=·this.sortingClasses.slice();
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 655| »   for·(var·i·in·active)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 670| »   »   »   types["Unknown"].push({"ent":·active[i],·"pos":·positions[i]});
|    | [NORMAL] JSHintBear:
|    | ['Unknown'] is better written in dot notation.

binaries/data/mods/public/simulation/components/Formation.js
| 709| »   »   for·(var·i·=·0;·i·<·count;·++i)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 743| »   »   »   »   »   var·n·=·r·+·1;
|    | [NORMAL] JSHintBear:
|    | 'n' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 745| »   »   »   »   »   var·n·=·r·*·2·+·1;
|    | [NORMAL] JSHintBear:
|    | 'n' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 749| »   »   »   for·(var·c·=·0;·c·<·n·&&·left·>·0;·++c)
|    | [NORMAL] JSHintBear:
|    | 'c' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 756| »   »   »   »   »   var·x·=·side·*·Math.ceil(c/2)·*·separation.width;
|    | [NORMAL] JSHintBear:
|    | 'x' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 759| »   »   »   »   »   if·(x·==·0)·//·don't·use·the·center·position·with·a·center·gap
|    | [NORMAL] JSHintBear:
|    | 'x' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 761| »   »   »   »   »   x·+=·side·*·centerGap·/·2;
|    | [NORMAL] JSHintBear:
|    | 'x' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 767| »   »   »   »   offsets.push(new·Vector2D(x·+·r1,·z·+·r2));
|    | [NORMAL] JSHintBear:
|    | 'x' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 747| »   »   »   if·(!shiftRows·&&·n·>·left)
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 748| »   »   »   »   n·=·left;
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 749| »   »   »   for·(var·c·=·0;·c·<·n·&&·left·>·0;·++c)
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 753| »   »   »   »   if·(n%2·==·0)
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 763| »   »   »   »   var·column·=·Math.ceil(n/2)·+·Math.ceil(c/2)·*·side;
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 773| »   »   »   this.maxColumnsUsed[r]·=·n;
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 802| »   for·(var·i·=·sortingClasses.length;·i;·--i)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 647| »   sortingClasses.push("Unknown");
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 652| »   for·(var·i·=·0;·i·<·sortingClasses.length;·++i)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 653| »   »   types[sortingClasses[i]]·=·[];
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 660| »   »   for·(var·c·=·0;·c·<·sortingClasses.length;·++c)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 662| »   »   »   if·(classes.indexOf(sortingClasses[c])·>·-1)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 664| »   »   »   »   types[sortingClasses[c]].push({"ent":·active[i],·"pos":·positions[i]});
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 802| »   for·(var·i·=·sortingClasses.length;·i;·--i)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 804| »   »   var·t·=·types[sortingClasses[i-1]];
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.
|    | [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
|1072|1072| 			},
|1073|1073| 		},
|1074|1074| 
|1075|    |-		"GARRISON":{
|    |1075|+		"GARRISON": {
|1076|1076| 			"APPROACHING": {
|1077|1077| 				"enter": function() {
|1078|1078| 					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
|2054|2054| 
|2055|2055| 				"Attacked": function(msg) {
|2056|2056| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2057|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2058|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2057|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2058|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2059|2059| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2060|2060| 				},
|2061|2061| 			},
|    | [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
|2213|2213| 					"MovementUpdate": function(msg) {
|2214|2214| 						// If it looks like the path is failing, and we are close enough (3 tiles) from wanted range
|2215|2215| 						// stop anyways. This avoids pathing for an unreachable goal and reduces lag considerably.
|2216|    |-						if (msg.likelyFailure || 
|    |2216|+						if (msg.likelyFailure ||
|2217|2217| 							msg.obstructed && this.RelaxedMaxRangeCheck(this.order.data, this.order.data.max + this.DefaultRelaxedMaxRange) ||
|2218|2218| 							!msg.obstructed && this.CheckRange(this.order.data))
|2219|2219| 							this.FinishOrder();
|    | [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
|2855|2855| 					{
|2856|2856| 						// The building was already finished/fully repaired before we arrived;
|2857|2857| 						// let the ConstructionFinished handler handle this.
|2858|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2858|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2859|2859| 						return true;
|2860|2860| 					}
|2861|2861| 
|    | [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
|2855|2855| 					{
|2856|2856| 						// The building was already finished/fully repaired before we arrived;
|2857|2857| 						// let the ConstructionFinished handler handle this.
|2858|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2858|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2859|2859| 						return true;
|2860|2860| 					}
|2861|2861| 
|    | [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
|3153|3153| 				this.StopTimer();
|3154|3154| 				this.ResetAnimation();
|3155|3155| 				if (this.formationAnimationVariant)
|3156|    |-					this.SetAnimationVariant(this.formationAnimationVariant)
|    |3156|+					this.SetAnimationVariant(this.formationAnimationVariant);
|3157|3157| 				else
|3158|3158| 					this.SetDefaultAnimationVariant();
|3159|3159| 				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
|3379|3379| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3380|3380| 
|3381|3381| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3382|    |-							// only used for domestic animals
|    |3382|+		// only used for domestic animals
|3383|3383| 
|3384|3384| 		// Reuse the same garrison behaviour for animals.
|3385|3385| 		"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
|3441|3441| 
|3442|3442| UnitAI.prototype.IsAnimal = function()
|3443|3443| {
|3444|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3444|+	return (!!this.template.NaturalBehaviour);
|3445|3445| };
|3446|3446| 
|3447|3447| 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
|3557|3557| 		{
|3558|3558| 			let index = this.GetCurrentState().indexOf(".");
|3559|3559| 			if (index != -1)
|3560|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3560|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3561|3561| 			this.Stop(false);
|3562|3562| 		}
|3563|3563| 
|    | [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
|3613|3613| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3614|3614| 			continue;
|3615|3615| 		if (i == 0)
|3616|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3616|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3617|3617| 		else
|3618|3618| 			this.orderQueue.splice(i, 1);
|3619|3619| 		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
|3613|3613| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3614|3614| 			continue;
|3615|3615| 		if (i == 0)
|3616|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3616|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3617|3617| 		else
|3618|3618| 			this.orderQueue.splice(i, 1);
|3619|3619| 		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
|3700|3700| };
|3701|3701| 
|3702|3702| 
|3703|    |-//// FSM linkage functions ////
|    |3703|+// // FSM linkage functions ////
|3704|3704| 
|3705|3705| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3706|3706| 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
|3871|3871| 				continue;
|3872|3872| 			if (this.orderQueue[i].type == type)
|3873|3873| 				continue;
|3874|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3874|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3875|3875| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3876|3876| 			return;
|3877|3877| 		}
|    | [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
|3871|3871| 				continue;
|3872|3872| 			if (this.orderQueue[i].type == type)
|3873|3873| 				continue;
|3874|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3874|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3875|3875| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3876|3876| 			return;
|3877|3877| 		}
|    | [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
|4113|4113| 	if (data.timerRepeat === undefined)
|4114|4114| 		this.timer = undefined;
|4115|4115| 
|4116|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4116|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4117|4117| };
|4118|4118| 
|4119|4119| /**
|    | [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
|4113|4113| 	if (data.timerRepeat === undefined)
|4114|4114| 		this.timer = undefined;
|4115|4115| 
|4116|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4116|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4117|4117| };
|4118|4118| 
|4119|4119| /**
|    | [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
|4158|4158| 	// TODO: This is a bit inefficient since every unit listens to every
|4159|4159| 	// construction message - ideally we could scope it to only the one we're building
|4160|4160| 
|4161|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4161|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4162|4162| };
|4163|4163| 
|4164|4164| 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
|4158|4158| 	// TODO: This is a bit inefficient since every unit listens to every
|4159|4159| 	// construction message - ideally we could scope it to only the one we're building
|4160|4160| 
|4161|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4161|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4162|4162| };
|4163|4163| 
|4164|4164| 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
|4189|4189| 	if (msg.fromStatusEffect)
|4190|4190| 		return;
|4191|4191| 
|4192|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4192|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4193|4193| };
|4194|4194| 
|4195|4195| 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
|4189|4189| 	if (msg.fromStatusEffect)
|4190|4190| 		return;
|4191|4191| 
|4192|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4192|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4193|4193| };
|4194|4194| 
|4195|4195| 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
|4194|4194| 
|4195|4195| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4196|4196| {
|4197|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4197|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4198|4198| };
|4199|4199| 
|4200|4200| 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
|4194|4194| 
|4195|4195| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4196|4196| {
|4197|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4197|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4198|4198| };
|4199|4199| 
|4200|4200| 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
|4199|4199| 
|4200|4200| UnitAI.prototype.OnHealthChanged = function(msg)
|4201|4201| {
|4202|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4202|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4203|4203| };
|4204|4204| 
|4205|4205| 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
|4199|4199| 
|4200|4200| UnitAI.prototype.OnHealthChanged = function(msg)
|4201|4201| {
|4202|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4202|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4203|4203| };
|4204|4204| 
|4205|4205| 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
|4205|4205| UnitAI.prototype.OnRangeUpdate = function(msg)
|4206|4206| {
|4207|4207| 	if (msg.tag == this.losRangeQuery)
|4208|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4208|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4209|4209| 	else if (msg.tag == this.losHealRangeQuery)
|4210|4210| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4211|4211| };
|    | [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
|4205|4205| UnitAI.prototype.OnRangeUpdate = function(msg)
|4206|4206| {
|4207|4207| 	if (msg.tag == this.losRangeQuery)
|4208|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4208|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4209|4209| 	else if (msg.tag == this.losHealRangeQuery)
|4210|4210| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4211|4211| };
|    | [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
|4207|4207| 	if (msg.tag == this.losRangeQuery)
|4208|4208| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4209|4209| 	else if (msg.tag == this.losHealRangeQuery)
|4210|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4210|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4211|4211| };
|4212|4212| 
|4213|4213| 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
|4207|4207| 	if (msg.tag == this.losRangeQuery)
|4208|4208| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4209|4209| 	else if (msg.tag == this.losHealRangeQuery)
|4210|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4210|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4211|4211| };
|4212|4212| 
|4213|4213| 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
|4212|4212| 
|4213|4213| UnitAI.prototype.OnPackFinished = function(msg)
|4214|4214| {
|4215|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4215|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4216|4216| };
|4217|4217| 
|4218|4218| //// 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
|4212|4212| 
|4213|4213| UnitAI.prototype.OnPackFinished = function(msg)
|4214|4214| {
|4215|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4215|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4216|4216| };
|4217|4217| 
|4218|4218| //// 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
|4215|4215| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4216|4216| };
|4217|4217| 
|4218|    |-//// Helper functions to be called by the FSM ////
|    |4218|+// // Helper functions to be called by the FSM ////
|4219|4219| 
|4220|4220| UnitAI.prototype.GetWalkSpeed = function()
|4221|4221| {
|    | [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
|4927|4927| UnitAI.prototype.AttackEntityInZone = function(ents)
|4928|4928| {
|4929|4929| 	var target = ents.find(target =>
|4930|    |-		this.CanAttack(target)
|4931|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4930|+		this.CanAttack(target) &&
|    |4931|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4932|4932| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4933|4933| 	);
|4934|4934| 	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
|4928|4928| {
|4929|4929| 	var target = ents.find(target =>
|4930|4930| 		this.CanAttack(target)
|4931|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4932|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4931|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4932|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4933|4933| 	);
|4934|4934| 	if (!target)
|4935|4935| 		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
|4994|4994| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4995|4995| 	if (this.isGuardOf)
|4996|4996| 	{
|4997|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4997|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4998|4998| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4999|4999| 		if (cmpUnitAI && cmpAttack &&
|5000|5000| 		    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
|4998|4998| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4999|4999| 		if (cmpUnitAI && cmpAttack &&
|5000|5000| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|5001|    |-				return false;
|    |5001|+			return false;
|5002|5002| 	}
|5003|5003| 
|5004|5004| 	// 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
|5036|5036| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|5037|5037| 	if (this.isGuardOf)
|5038|5038| 	{
|5039|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |5039|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|5040|5040| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|5041|5041| 		if (cmpUnitAI && cmpAttack &&
|5042|5042| 		    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
|5049|5049| 	return false;
|5050|5050| };
|5051|5051| 
|5052|    |-//// External interface functions ////
|    |5052|+// // External interface functions ////
|5053|5053| 
|5054|5054| UnitAI.prototype.SetFormationController = function(ent)
|5055|5055| {
|    | [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
|5205|5205| 	{
|5206|5206| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5207|5207| 			return;
|5208|    |-		else
|5209|    |-			this.RemoveGuard();
|    |5208|+		this.RemoveGuard();
|5210|5209| 	}
|5211|5210| 
|5212|5211| 	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
|5536|5536| 
|5537|5537| 	if (this.IsFormationController())
|5538|5538| 		this.CallMemberFunction("CancelSetupTradeRoute", [target]);
|5539|    |-}
|    |5539|+};
|5540|5540| /**
|5541|5541|  * Adds trade order to the queue. Either walk to the first market, or
|5542|5542|  * 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
|5557|5557| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5558|5558| 	{
|5559|5559| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5560|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5560|+		if (cmpTrader.HasBothMarkets() &&
|5561|5561| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5562|5562| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5563|5563| 		{
|    | [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
|5838|5838| 				{
|5839|5839| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5840|5840| 					var targetClasses = this.order.data.targetClasses;
|5841|    |-					if (targetClasses.attack && cmpIdentity
|5842|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5841|+					if (targetClasses.attack && cmpIdentity &&
|    |5842|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5843|5843| 						continue;
|5844|5844| 					if (targetClasses.avoid && cmpIdentity
|5845|5845| 						&& 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
|5841|5841| 					if (targetClasses.attack && cmpIdentity
|5842|5842| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5843|5843| 						continue;
|5844|    |-					if (targetClasses.avoid && cmpIdentity
|5845|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5844|+					if (targetClasses.avoid && cmpIdentity &&
|    |5845|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5846|5846| 						continue;
|5847|5847| 					// Only used by the AIs to prevent some choices of targets
|5848|5848| 					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
|5864|5864| 		{
|5865|5865| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5866|5866| 			var targetClasses = this.order.data.targetClasses;
|5867|    |-			if (cmpIdentity && targetClasses.attack
|5868|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5867|+			if (cmpIdentity && targetClasses.attack &&
|    |5868|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5869|5869| 				continue;
|5870|5870| 			if (cmpIdentity && targetClasses.avoid
|5871|5871| 				&& 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
|5867|5867| 			if (cmpIdentity && targetClasses.attack
|5868|5868| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5869|5869| 				continue;
|5870|    |-			if (cmpIdentity && targetClasses.avoid
|5871|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5870|+			if (cmpIdentity && targetClasses.avoid &&
|    |5871|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5872|5872| 				continue;
|5873|5873| 			// Only used by the AIs to prevent some choices of targets
|5874|5874| 			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
|6067|6067| 
|6068|6068| UnitAI.prototype.SetHeldPosition = function(x, z)
|6069|6069| {
|6070|    |-	this.heldPosition = {"x": x, "z": z};
|    |6070|+	this.heldPosition = { "x": x, "z": z};
|6071|6071| };
|6072|6072| 
|6073|6073| 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
|6067|6067| 
|6068|6068| UnitAI.prototype.SetHeldPosition = function(x, z)
|6069|6069| {
|6070|    |-	this.heldPosition = {"x": x, "z": z};
|    |6070|+	this.heldPosition = {"x": x, "z": z };
|6071|6071| };
|6072|6072| 
|6073|6073| 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
|6094|6094| 	return false;
|6095|6095| };
|6096|6096| 
|6097|    |-//// Helper functions ////
|    |6097|+// // Helper functions ////
|6098|6098| 
|6099|6099| /**
|6100|6100|  * 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
|6113|6113| 		return undefined;
|6114|6114| 
|6115|6115| 	return component.GetRange(type);
|6116|    |-}
|    |6116|+};
|6117|6117| 
|6118|6118| UnitAI.prototype.CanAttack = function(target)
|6119|6119| {
|    | [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
|6281|6281| 	return cmpPack && cmpPack.IsPacking();
|6282|6282| };
|6283|6283| 
|6284|    |-//// Formation specific functions ////
|    |6284|+// // Formation specific functions ////
|6285|6285| 
|6286|6286| UnitAI.prototype.IsAttackingAsFormation = function()
|6287|6287| {
|    | [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
|6286|6286| UnitAI.prototype.IsAttackingAsFormation = function()
|6287|6287| {
|6288|6288| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6289|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6290|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6289|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6290|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6291|6291| };
|6292|6292| 
|6293|6293| //// 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
|6290|6290| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6291|6291| };
|6292|6292| 
|6293|    |-//// Animal specific functions ////
|    |6293|+// // Animal specific functions ////
|6294|6294| 
|6295|6295| UnitAI.prototype.MoveRandomly = function(distance)
|6296|6296| {

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
|1264| »   »   »   »   return·false;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'Timer' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
|4018| »   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
|4914| »   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
|4929| »   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
|4977| »   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
|5000| »   »   ····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
|2058| »   »   »   »   »   »   &&·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
|3156| »   »   »   »   »   this.SetAnimationVariant(this.formationAnimationVariant)
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

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

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

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

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

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

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

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

ValihrAnt added a subscriber: ValihrAnt.EditedMay 27 2020, 6:19 PM

This solves dancing with patrol, but I can still easily dance other than that. It takes a quick second to adapt to having to click further apart or click in the minimap but other than that I can go for a long time until the unit finally gets hit.
It also will be very annoying when trying to micro and probably in other scenarios, I can't foresee right away. First thing is when I'm raiding with cavalry. I want to be quick and not have my cavalry suddenly slow down because I didn't click far enough in front of them. When I find an exposed group of units whilst raiding I want to position my cavalry in the retreat route to make them go a longer distance and also right by my units, this patch makes it very hard to do so as I generally will be clicking my units forward small distances. With the patch, I will have to click further away, hope the pathfinder doesn't do something dumb, and then use the "Stop" hotkey.
So currently to me, it feels like a solution that won't solve the problem entirely and will also harm other aspects of the game.

EDIT: I didn't test formation patrol dance when posting this. Still very possible and easy to dance with formations. Take however big a group of units (Smaller is better (2 works great)) and patrol right in the middle of the formation. They'll move just as quick as before.

bb added a comment.May 27 2020, 6:30 PM

This solves dancing with patrol, but I can still easily dance other than that. It takes a quick second to adapt to having to click further apart or click in the minimap but other than that I can go for a long time until the unit finally gets hit.

Do you have a replay, showing you can actually move your attention away from the dancing unit, without it getting hit?

It also will be very annoying when trying to micro and probably in other scenarios, I can't foresee right away. First thing is when I'm raiding with cavalry. I want to be quick and not have my cavalry suddenly slow down because I didn't click far enough in front of them. When I find an exposed group of units whilst raiding I want to position my cavalry in the retreat route to make them go a longer distance and also right by my units, this patch makes it very hard to do so as I generally will be clicking my units forward small distances. With the patch, I will have to click further away, hope the pathfinder doesn't do something dumb, and then use the "Stop" hotkey.

Again do you have a replay where these short distances are actually used?

EDIT: I didn't test formation patrol dance when posting this. Still very possible and easy to dance with formations. Take however big a group of units (Smaller is better (2 works great)) and patrol right in the middle of the formation. They'll move just as quick as before.

Formations have got the same treatment and short moves in the formation will also move slower, so that ought to not work.

ValihrAnt added a comment.EditedMay 27 2020, 6:51 PM

Do you have a replay, showing you can actually move your attention away from the dancing unit, without it getting hit?

I can't do something else and keep the unit dancing. Doesn't mean it won't be annoying and also a huge advantage whilst I do dance.

Again do you have a replay where these short distances are actually used?

I haven't played a real match with this. I just went in and tried to dance, whilst setting up units I got annoyed by the movement and tried to think of scenarios where it would be detrimental.

Formations have got the same treatment and short moves in the formation will also move slower, so that ought to not work.

Short moves don' work, doesn't mean formations don't work as showcased in this gif
https://giphy.com/gifs/ZYWff3jaidKSwM4RLB

I think the concerns about annoyance with regards to micro are valid.
The formation gif is pretty egregious, but that's the result of formations adjusting improperly when patrolling (check out the behaviour of more units.

In general, I think we might test with this, and bump it up a little. There remains the option of making arrows faster, which helps too.

wraitii requested changes to this revision.May 29 2020, 7:23 AM

Ayyy, just thought of an issue with this. It completely breaks if the "bird-flight" distance is not the right estimator.

Simply order a unit to go across a wall.

This revision now requires changes to proceed.May 29 2020, 7:23 AM
bb retitled this revision from Stop dodging arrows by spamclicking or patrol to Stop dodging arrows by spamclicking or patrol: Lower speed at short distances.Jun 23 2020, 11:09 PM

Ayyy, just thought of an issue with this. It completely breaks if the "bird-flight" distance is not the right estimator.

Simply order a unit to go across a wall.

Not sure if this issue is worth fixing, since one needs to be rather close to the wall, and give a rather stupid command

wraitii resigned from this revision.Jun 24 2020, 8:45 AM
In D2767#121427, @bb wrote:

Not sure if this issue is worth fixing, since one needs to be rather close to the wall, and give a rather stupid command

Yeah, I request changes so it wouldn't be buried, but I kind of agree. I can't really think of too many situations where this would happen.

I think this change is worth trying to get some player feedback, it's rather easy to revert.

This revision now requires review to proceed.Jun 24 2020, 8:45 AM
bb abandoned this revision.Sep 28 2020, 12:22 PM

This patch has maximal gameplay impact and minimal fixed compared to D2837, D2913 and D3021