Page MenuHomeWildfire Games

Remove some variables from serialisation and update this.animations name to reflect what it actually holds [Formations.js]
ClosedPublic

Authored by Silier on Apr 25 2020, 8:41 PM.

Details

Reviewers
None
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Commits
rP23694: Remove some variables from serialisation and update this.animations name to…
Summary

Removed variables were not needed to be serialised or stored inside component.
Removing unused variable from recomputing offsets.
this.template.Animations does not hold animation names but names of animation variants what is misleading.
do not create timer when deserializing as that would cause oos
this.Init has to be called from Deserialize because it is not called by default

Test Plan

Save game with active formations
Load game and confirm nothing is broken when tasking formation again or formation is finishing tasks (no errors, no warnings)
test multiplayer oos

Diff Detail

Repository
rP 0 A.D. Public Repository
Branch
/ps/trunk
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 11539
Build 21143: arc lint + arc unit

Event Timeline

Silier created this revision.Apr 25 2020, 8:41 PM
Stan added a subscriber: Stan.Apr 25 2020, 8:47 PM
Stan added inline comments.
binaries/data/mods/public/simulation/components/Formation.js
90

Why serialize it at all?

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
| 122| 122| 	this.formationMembersWithAura = []; // Members with a formation aura
| 123| 123| 	this.width = 0;
| 124| 124| 	this.depth = 0;
| 125|    |-	this.oldOrientation = {"sin": 0, "cos": 0};
|    | 125|+	this.oldOrientation = { "sin": 0, "cos": 0};
| 126| 126| 	this.twinFormations = [];
| 127| 127| 	// distance from which two twin formations will merge into one.
| 128| 128| 	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
| 122| 122| 	this.formationMembersWithAura = []; // Members with a formation aura
| 123| 123| 	this.width = 0;
| 124| 124| 	this.depth = 0;
| 125|    |-	this.oldOrientation = {"sin": 0, "cos": 0};
|    | 125|+	this.oldOrientation = {"sin": 0, "cos": 0 };
| 126| 126| 	this.twinFormations = [];
| 127| 127| 	// distance from which two twin formations will merge into one.
| 128| 128| 	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
| 140| 140| 
| 141| 141| Formation.prototype.GetSize = function()
| 142| 142| {
| 143|    |-	return {"width": this.width, "depth": this.depth};
|    | 143|+	return { "width": this.width, "depth": this.depth};
| 144| 144| };
| 145| 145| 
| 146| 146| 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
| 140| 140| 
| 141| 141| Formation.prototype.GetSize = function()
| 142| 142| {
| 143|    |-	return {"width": this.width, "depth": this.depth};
|    | 143|+	return {"width": this.width, "depth": this.depth };
| 144| 144| };
| 145| 145| 
| 146| 146| 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
| 573| 573| 			footprints.push(cmpFootprint.GetShape());
| 574| 574| 	}
| 575| 575| 	if (!footprints.length)
| 576|    |-		return {"width":1, "depth": 1};
|    | 576|+		return { "width":1, "depth": 1};
| 577| 577| 
| 578| 578| 	var r = {"width": 0, "depth": 0};
| 579| 579| 	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
| 573| 573| 			footprints.push(cmpFootprint.GetShape());
| 574| 574| 	}
| 575| 575| 	if (!footprints.length)
| 576|    |-		return {"width":1, "depth": 1};
|    | 576|+		return {"width": 1, "depth": 1};
| 577| 577| 
| 578| 578| 	var r = {"width": 0, "depth": 0};
| 579| 579| 	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
| 573| 573| 			footprints.push(cmpFootprint.GetShape());
| 574| 574| 	}
| 575| 575| 	if (!footprints.length)
| 576|    |-		return {"width":1, "depth": 1};
|    | 576|+		return {"width":1, "depth": 1 };
| 577| 577| 
| 578| 578| 	var r = {"width": 0, "depth": 0};
| 579| 579| 	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
| 575| 575| 	if (!footprints.length)
| 576| 576| 		return {"width":1, "depth": 1};
| 577| 577| 
| 578|    |-	var r = {"width": 0, "depth": 0};
|    | 578|+	var r = { "width": 0, "depth": 0};
| 579| 579| 	for (var shape of footprints)
| 580| 580| 	{
| 581| 581| 		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
| 575| 575| 	if (!footprints.length)
| 576| 576| 		return {"width":1, "depth": 1};
| 577| 577| 
| 578|    |-	var r = {"width": 0, "depth": 0};
|    | 578|+	var r = {"width": 0, "depth": 0 };
| 579| 579| 	for (var shape of footprints)
| 580| 580| 	{
| 581| 581| 		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
| 601| 601| 	separation.depth *= this.separationMultiplier.depth;
| 602| 602| 
| 603| 603| 	if (this.columnar)
| 604|    |-		var sortingClasses = ["Cavalry","Infantry"];
|    | 604|+		var sortingClasses = ["Cavalry", "Infantry"];
| 605| 605| 	else
| 606| 606| 		var sortingClasses = this.sortingClasses.slice();
| 607| 607| 	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
| 621| 621| 		{
| 622| 622| 			if (classes.indexOf(sortingClasses[c]) > -1)
| 623| 623| 			{
| 624|    |-				types[sortingClasses[c]].push({"ent": active[i], "pos": positions[i]});
|    | 624|+				types[sortingClasses[c]].push({ "ent": active[i], "pos": positions[i]});
| 625| 625| 				done = true;
| 626| 626| 				break;
| 627| 627| 			}
|    | [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
| 621| 621| 		{
| 622| 622| 			if (classes.indexOf(sortingClasses[c]) > -1)
| 623| 623| 			{
| 624|    |-				types[sortingClasses[c]].push({"ent": active[i], "pos": positions[i]});
|    | 624|+				types[sortingClasses[c]].push({"ent": active[i], "pos": positions[i] });
| 625| 625| 				done = true;
| 626| 626| 				break;
| 627| 627| 			}
|    | [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
| 627| 627| 			}
| 628| 628| 		}
| 629| 629| 		if (!done)
| 630|    |-			types["Unknown"].push({"ent": active[i], "pos": positions[i]});
|    | 630|+			types.Unknown.push({"ent": active[i], "pos": positions[i]});
| 631| 631| 	}
| 632| 632| 
| 633| 633| 	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
| 627| 627| 			}
| 628| 628| 		}
| 629| 629| 		if (!done)
| 630|    |-			types["Unknown"].push({"ent": active[i], "pos": positions[i]});
|    | 630|+			types["Unknown"].push({ "ent": active[i], "pos": positions[i]});
| 631| 631| 	}
| 632| 632| 
| 633| 633| 	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
| 627| 627| 			}
| 628| 628| 		}
| 629| 629| 		if (!done)
| 630|    |-			types["Unknown"].push({"ent": active[i], "pos": positions[i]});
|    | 630|+			types["Unknown"].push({"ent": active[i], "pos": positions[i] });
| 631| 631| 	}
| 632| 632| 
| 633| 633| 	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
| 644| 644| 	if (this.columnar)
| 645| 645| 	{
| 646| 646| 		shape = "square";
| 647|    |-		cols = Math.min(count,3);
|    | 647|+		cols = Math.min(count, 3);
| 648| 648| 		shiftRows = false;
| 649| 649| 		centerGap = 0;
| 650| 650| 	}
|    | [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
| 740| 740| 	// calculating offset distances without a zero average makes no sense, as the formation
| 741| 741| 	// will jump to a different position any time
| 742| 742| 	var avgoffset = Vector2D.average(offsets);
| 743|    |-	offsets.forEach(function (o) {o.sub(avgoffset);});
|    | 743|+	offsets.forEach(function(o) {o.sub(avgoffset);});
| 744| 744| 
| 745| 745| 	// sort the available places in certain ways
| 746| 746| 	// 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
| 799| 799| 			closestOffsetId = i;
| 800| 800| 		}
| 801| 801| 	}
| 802|    |-	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
|    | 802|+	this.memberPositions[entPos.ent] = { "row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
| 803| 803| 	return closestOffsetId;
| 804| 804| };
| 805| 805| 
|    | [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
| 799| 799| 			closestOffsetId = i;
| 800| 800| 		}
| 801| 801| 	}
| 802|    |-	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
|    | 802|+	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column": offsets[closestOffsetId].column};
| 803| 803| 	return closestOffsetId;
| 804| 804| };
| 805| 805| 
|    | [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
| 799| 799| 			closestOffsetId = i;
| 800| 800| 		}
| 801| 801| 	}
| 802|    |-	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
|    | 802|+	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column };
| 803| 803| 	return closestOffsetId;
| 804| 804| };
| 805| 805| 
|    | [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
| 809| 809| Formation.prototype.GetRealOffsetPositions = function(offsets, pos)
| 810| 810| {
| 811| 811| 	var offsetPositions = [];
| 812|    |-	var {sin, cos} = this.GetEstimatedOrientation(pos);
|    | 812|+	var { sin, cos} = this.GetEstimatedOrientation(pos);
| 813| 813| 	// calculate the world positions
| 814| 814| 	for (var o of offsets)
| 815| 815| 		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
| 809| 809| Formation.prototype.GetRealOffsetPositions = function(offsets, pos)
| 810| 810| {
| 811| 811| 	var offsetPositions = [];
| 812|    |-	var {sin, cos} = this.GetEstimatedOrientation(pos);
|    | 812|+	var {sin, cos } = this.GetEstimatedOrientation(pos);
| 813| 813| 	// calculate the world positions
| 814| 814| 	for (var o of offsets)
| 815| 815| 		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
| 826| 826| Formation.prototype.GetEstimatedOrientation = function(pos)
| 827| 827| {
| 828| 828| 	var cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI);
| 829|    |-	var r = {"sin": 0, "cos": 1};
|    | 829|+	var r = { "sin": 0, "cos": 1};
| 830| 830| 	var unitAIState = cmpUnitAI.GetCurrentState();
| 831| 831| 	if (unitAIState == "FORMATIONCONTROLLER.WALKING" || unitAIState == "FORMATIONCONTROLLER.COMBAT.APPROACHING")
| 832| 832| 	{
|    | [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
| 826| 826| Formation.prototype.GetEstimatedOrientation = function(pos)
| 827| 827| {
| 828| 828| 	var cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI);
| 829|    |-	var r = {"sin": 0, "cos": 1};
|    | 829|+	var r = {"sin": 0, "cos": 1 };
| 830| 830| 	var unitAIState = cmpUnitAI.GetCurrentState();
| 831| 831| 	if (unitAIState == "FORMATIONCONTROLLER.WALKING" || unitAIState == "FORMATIONCONTROLLER.COMBAT.APPROACHING")
| 832| 832| 	{
|    | [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
| 908| 908| 		cmpOtherFormation.RemoveMembers(otherMembers);
| 909| 909| 		this.AddMembers(otherMembers);
| 910| 910| 		Engine.DestroyEntity(this.twinFormations[i]);
| 911|    |-		this.twinFormations.splice(i,1);
|    | 911|+		this.twinFormations.splice(i, 1);
| 912| 912| 	}
| 913| 913| 	// Switch between column and box if necessary
| 914| 914| 	var cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI);

binaries/data/mods/public/simulation/components/Formation.js
|  88| »   this.animationvariants;
|    | [NORMAL] ESLintBear (no-unused-expressions):
|    | Expected an assignment or function call and instead saw an expression.

binaries/data/mods/public/simulation/components/Formation.js
|  88| »   this.animationvariants;
|    | [NORMAL] JSHintBear:
|    | Expected an assignment or function call and instead saw an expression.

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/Formation.js
| 630| »   »   »   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
| 669| »   »   for·(var·i·=·0;·i·<·count;·++i)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

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

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

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

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

binaries/data/mods/public/simulation/components/Formation.js
| 719| »   »   »   »   »   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
| 721| »   »   »   »   »   x·+=·side·*·centerGap·/·2;
|    | [NORMAL] JSHintBear:
|    | 'x' used out of scope.

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

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

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

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

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

binaries/data/mods/public/simulation/components/Formation.js
| 723| »   »   »   »   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
| 734| »   »   »   this.maxColumnsUsed[r]·=·n;
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/Formation.js
| 624| »   »   »   »   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
| 763| »   for·(var·i·=·sortingClasses.length;·i;·--i)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

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

binaries/data/mods/public/simulation/components/Formation.js
| 870| »   var·cmpUnitMotion·=·Engine.QueryInterface(this.entity,·IID_UnitMotion);
|    | [NORMAL] JSHintBear:
|    | 'cmpUnitMotion' is already defined.
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 788| 788| 					this.FinishOrder();
| 789| 789| 					return;
| 790| 790| 				}
| 791|    |-				else
| 792|    |-				{
|    | 791|+				
| 793| 792| 					this.SetNextState("GARRISON.APPROACHING");
| 794| 793| 					return;
| 795|    |-				}
|    | 794|+				
| 796| 795| 			}
| 797| 796| 
| 798| 797| 			this.SetNextState("GARRISON.GARRISONING");
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'GARRISON'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1060|1060| 			},
|1061|1061| 		},
|1062|1062| 
|1063|    |-		"GARRISON":{
|    |1063|+		"GARRISON": {
|1064|1064| 			"APPROACHING": {
|1065|1065| 				"enter": function() {
|1066|1066| 					if (!this.MoveToGarrisonRange(this.order.data.target))
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2042|2042| 
|2043|2043| 				"Attacked": function(msg) {
|2044|2044| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2045|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2046|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2045|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2046|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2047|2047| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2048|2048| 				},
|2049|2049| 			},
|    | [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
|2201|2201| 					"MovementUpdate": function(msg) {
|2202|2202| 						// If it looks like the path is failing, and we are close enough (3 tiles) from wanted range
|2203|2203| 						// stop anyways. This avoids pathing for an unreachable goal and reduces lag considerably.
|2204|    |-						if (msg.likelyFailure || 
|    |2204|+						if (msg.likelyFailure ||
|2205|2205| 							msg.obstructed && this.RelaxedMaxRangeCheck(this.order.data, this.order.data.max + this.DefaultRelaxedMaxRange) ||
|2206|2206| 							!msg.obstructed && this.CheckRange(this.order.data))
|2207|2207| 							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
|2843|2843| 					{
|2844|2844| 						// The building was already finished/fully repaired before we arrived;
|2845|2845| 						// let the ConstructionFinished handler handle this.
|2846|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2846|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2847|2847| 						return true;
|2848|2848| 					}
|2849|2849| 
|    | [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
|2843|2843| 					{
|2844|2844| 						// The building was already finished/fully repaired before we arrived;
|2845|2845| 						// let the ConstructionFinished handler handle this.
|2846|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2846|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2847|2847| 						return true;
|2848|2848| 					}
|2849|2849| 
|    | [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
|3141|3141| 				this.StopTimer();
|3142|3142| 				this.ResetAnimation();
|3143|3143| 				if (this.formationAnimationVariant)
|3144|    |-					this.SetAnimationVariant(this.formationAnimationVariant)
|    |3144|+					this.SetAnimationVariant(this.formationAnimationVariant);
|3145|3145| 				else
|3146|3146| 					this.SetDefaultAnimationVariant();
|3147|3147| 				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
|3367|3367| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3368|3368| 
|3369|3369| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3370|    |-							// only used for domestic animals
|    |3370|+		// only used for domestic animals
|3371|3371| 
|3372|3372| 		// Reuse the same garrison behaviour for animals.
|3373|3373| 		"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
|3429|3429| 
|3430|3430| UnitAI.prototype.IsAnimal = function()
|3431|3431| {
|3432|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3432|+	return (!!this.template.NaturalBehaviour);
|3433|3433| };
|3434|3434| 
|3435|3435| 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
|3545|3545| 		{
|3546|3546| 			let index = this.GetCurrentState().indexOf(".");
|3547|3547| 			if (index != -1)
|3548|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3548|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3549|3549| 			this.Stop(false);
|3550|3550| 		}
|3551|3551| 
|    | [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
|3601|3601| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3602|3602| 			continue;
|3603|3603| 		if (i == 0)
|3604|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3604|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3605|3605| 		else
|3606|3606| 			this.orderQueue.splice(i, 1);
|3607|3607| 		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
|3601|3601| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3602|3602| 			continue;
|3603|3603| 		if (i == 0)
|3604|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3604|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3605|3605| 		else
|3606|3606| 			this.orderQueue.splice(i, 1);
|3607|3607| 		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
|3688|3688| };
|3689|3689| 
|3690|3690| 
|3691|    |-//// FSM linkage functions ////
|    |3691|+// // FSM linkage functions ////
|3692|3692| 
|3693|3693| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3694|3694| 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
|3859|3859| 				continue;
|3860|3860| 			if (this.orderQueue[i].type == type)
|3861|3861| 				continue;
|3862|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3862|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3863|3863| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3864|3864| 			return;
|3865|3865| 		}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3859|3859| 				continue;
|3860|3860| 			if (this.orderQueue[i].type == type)
|3861|3861| 				continue;
|3862|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3862|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3863|3863| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3864|3864| 			return;
|3865|3865| 		}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4101|4101| 	if (data.timerRepeat === undefined)
|4102|4102| 		this.timer = undefined;
|4103|4103| 
|4104|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4104|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4105|4105| };
|4106|4106| 
|4107|4107| /**
|    | [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
|4101|4101| 	if (data.timerRepeat === undefined)
|4102|4102| 		this.timer = undefined;
|4103|4103| 
|4104|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4104|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4105|4105| };
|4106|4106| 
|4107|4107| /**
|    | [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
|4146|4146| 	// TODO: This is a bit inefficient since every unit listens to every
|4147|4147| 	// construction message - ideally we could scope it to only the one we're building
|4148|4148| 
|4149|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4149|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4150|4150| };
|4151|4151| 
|4152|4152| 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
|4146|4146| 	// TODO: This is a bit inefficient since every unit listens to every
|4147|4147| 	// construction message - ideally we could scope it to only the one we're building
|4148|4148| 
|4149|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4149|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4150|4150| };
|4151|4151| 
|4152|4152| 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
|4177|4177| 	if (msg.fromStatusEffect)
|4178|4178| 		return;
|4179|4179| 
|4180|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4180|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4181|4181| };
|4182|4182| 
|4183|4183| 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
|4177|4177| 	if (msg.fromStatusEffect)
|4178|4178| 		return;
|4179|4179| 
|4180|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4180|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4181|4181| };
|4182|4182| 
|4183|4183| 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
|4182|4182| 
|4183|4183| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4184|4184| {
|4185|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4185|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4186|4186| };
|4187|4187| 
|4188|4188| 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
|4182|4182| 
|4183|4183| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4184|4184| {
|4185|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4185|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4186|4186| };
|4187|4187| 
|4188|4188| 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
|4187|4187| 
|4188|4188| UnitAI.prototype.OnHealthChanged = function(msg)
|4189|4189| {
|4190|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4190|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4191|4191| };
|4192|4192| 
|4193|4193| 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
|4187|4187| 
|4188|4188| UnitAI.prototype.OnHealthChanged = function(msg)
|4189|4189| {
|4190|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4190|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4191|4191| };
|4192|4192| 
|4193|4193| 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
|4193|4193| UnitAI.prototype.OnRangeUpdate = function(msg)
|4194|4194| {
|4195|4195| 	if (msg.tag == this.losRangeQuery)
|4196|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4196|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4197|4197| 	else if (msg.tag == this.losHealRangeQuery)
|4198|4198| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4199|4199| };
|    | [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
|4193|4193| UnitAI.prototype.OnRangeUpdate = function(msg)
|4194|4194| {
|4195|4195| 	if (msg.tag == this.losRangeQuery)
|4196|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4196|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4197|4197| 	else if (msg.tag == this.losHealRangeQuery)
|4198|4198| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4199|4199| };
|    | [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
|4195|4195| 	if (msg.tag == this.losRangeQuery)
|4196|4196| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4197|4197| 	else if (msg.tag == this.losHealRangeQuery)
|4198|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4198|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4199|4199| };
|4200|4200| 
|4201|4201| 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
|4195|4195| 	if (msg.tag == this.losRangeQuery)
|4196|4196| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4197|4197| 	else if (msg.tag == this.losHealRangeQuery)
|4198|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4198|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4199|4199| };
|4200|4200| 
|4201|4201| 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
|4200|4200| 
|4201|4201| UnitAI.prototype.OnPackFinished = function(msg)
|4202|4202| {
|4203|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4203|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4204|4204| };
|4205|4205| 
|4206|4206| //// 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
|4200|4200| 
|4201|4201| UnitAI.prototype.OnPackFinished = function(msg)
|4202|4202| {
|4203|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4203|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4204|4204| };
|4205|4205| 
|4206|4206| //// 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
|4203|4203| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4204|4204| };
|4205|4205| 
|4206|    |-//// Helper functions to be called by the FSM ////
|    |4206|+// // Helper functions to be called by the FSM ////
|4207|4207| 
|4208|4208| UnitAI.prototype.GetWalkSpeed = function()
|4209|4209| {
|    | [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
|4915|4915| UnitAI.prototype.AttackEntityInZone = function(ents)
|4916|4916| {
|4917|4917| 	var target = ents.find(target =>
|4918|    |-		this.CanAttack(target)
|4919|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4918|+		this.CanAttack(target) &&
|    |4919|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4920|4920| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4921|4921| 	);
|4922|4922| 	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
|4916|4916| {
|4917|4917| 	var target = ents.find(target =>
|4918|4918| 		this.CanAttack(target)
|4919|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4920|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4919|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4920|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4921|4921| 	);
|4922|4922| 	if (!target)
|4923|4923| 		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
|4980|4980| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4981|4981| 	if (this.isGuardOf)
|4982|4982| 	{
|4983|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4983|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4984|4984| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4985|4985| 		if (cmpUnitAI && cmpAttack &&
|4986|4986| 		    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
|4984|4984| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4985|4985| 		if (cmpUnitAI && cmpAttack &&
|4986|4986| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4987|    |-				return false;
|    |4987|+			return false;
|4988|4988| 	}
|4989|4989| 
|4990|4990| 	// 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
|5022|5022| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|5023|5023| 	if (this.isGuardOf)
|5024|5024| 	{
|5025|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |5025|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|5026|5026| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|5027|5027| 		if (cmpUnitAI && cmpAttack &&
|5028|5028| 		    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
|5035|5035| 	return false;
|5036|5036| };
|5037|5037| 
|5038|    |-//// External interface functions ////
|    |5038|+// // External interface functions ////
|5039|5039| 
|5040|5040| UnitAI.prototype.SetFormationController = function(ent)
|5041|5041| {
|    | [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
|5191|5191| 	{
|5192|5192| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5193|5193| 			return;
|5194|    |-		else
|5195|    |-			this.RemoveGuard();
|    |5194|+		this.RemoveGuard();
|5196|5195| 	}
|5197|5196| 
|5198|5197| 	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
|5522|5522| 
|5523|5523| 	if (this.IsFormationController())
|5524|5524| 		this.CallMemberFunction("CancelSetupTradeRoute", [target]);
|5525|    |-}
|    |5525|+};
|5526|5526| /**
|5527|5527|  * Adds trade order to the queue. Either walk to the first market, or
|5528|5528|  * 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
|5543|5543| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5544|5544| 	{
|5545|5545| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5546|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5546|+		if (cmpTrader.HasBothMarkets() &&
|5547|5547| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5548|5548| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5549|5549| 		{
|    | [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
|5824|5824| 				{
|5825|5825| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5826|5826| 					var targetClasses = this.order.data.targetClasses;
|5827|    |-					if (targetClasses.attack && cmpIdentity
|5828|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5827|+					if (targetClasses.attack && cmpIdentity &&
|    |5828|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5829|5829| 						continue;
|5830|5830| 					if (targetClasses.avoid && cmpIdentity
|5831|5831| 						&& 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
|5827|5827| 					if (targetClasses.attack && cmpIdentity
|5828|5828| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5829|5829| 						continue;
|5830|    |-					if (targetClasses.avoid && cmpIdentity
|5831|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5830|+					if (targetClasses.avoid && cmpIdentity &&
|    |5831|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5832|5832| 						continue;
|5833|5833| 					// Only used by the AIs to prevent some choices of targets
|5834|5834| 					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
|5850|5850| 		{
|5851|5851| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5852|5852| 			var targetClasses = this.order.data.targetClasses;
|5853|    |-			if (cmpIdentity && targetClasses.attack
|5854|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5853|+			if (cmpIdentity && targetClasses.attack &&
|    |5854|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5855|5855| 				continue;
|5856|5856| 			if (cmpIdentity && targetClasses.avoid
|5857|5857| 				&& 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
|5853|5853| 			if (cmpIdentity && targetClasses.attack
|5854|5854| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5855|5855| 				continue;
|5856|    |-			if (cmpIdentity && targetClasses.avoid
|5857|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5856|+			if (cmpIdentity && targetClasses.avoid &&
|    |5857|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5858|5858| 				continue;
|5859|5859| 			// Only used by the AIs to prevent some choices of targets
|5860|5860| 			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
|5996|5996| 
|5997|5997| UnitAI.prototype.SetHeldPosition = function(x, z)
|5998|5998| {
|5999|    |-	this.heldPosition = {"x": x, "z": z};
|    |5999|+	this.heldPosition = { "x": x, "z": z};
|6000|6000| };
|6001|6001| 
|6002|6002| 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
|5996|5996| 
|5997|5997| UnitAI.prototype.SetHeldPosition = function(x, z)
|5998|5998| {
|5999|    |-	this.heldPosition = {"x": x, "z": z};
|    |5999|+	this.heldPosition = {"x": x, "z": z };
|6000|6000| };
|6001|6001| 
|6002|6002| 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
|6023|6023| 	return false;
|6024|6024| };
|6025|6025| 
|6026|    |-//// Helper functions ////
|    |6026|+// // Helper functions ////
|6027|6027| 
|6028|6028| /**
|6029|6029|  * 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
|6042|6042| 		return undefined;
|6043|6043| 
|6044|6044| 	return component.GetRange(type);
|6045|    |-}
|    |6045|+};
|6046|6046| 
|6047|6047| UnitAI.prototype.CanAttack = function(target)
|6048|6048| {
|    | [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
|6240|6240| 	return cmpPack && cmpPack.IsPacking();
|6241|6241| };
|6242|6242| 
|6243|    |-//// Formation specific functions ////
|    |6243|+// // Formation specific functions ////
|6244|6244| 
|6245|6245| UnitAI.prototype.IsAttackingAsFormation = function()
|6246|6246| {
|    | [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
|6245|6245| UnitAI.prototype.IsAttackingAsFormation = function()
|6246|6246| {
|6247|6247| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6248|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6249|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6248|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6249|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6250|6250| };
|6251|6251| 
|6252|6252| //// 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
|6249|6249| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6250|6250| };
|6251|6251| 
|6252|    |-//// Animal specific functions ////
|    |6252|+// // Animal specific functions ////
|6253|6253| 
|6254|6254| UnitAI.prototype.MoveRandomly = function(distance)
|6255|6255| {

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4006| »   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
|4902| »   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
|4917| »   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
|4963| »   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
|4986| »   »   ····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
|2046| »   »   »   »   »   »   &&·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
|3144| »   »   »   »   »   this.SetAnimationVariant(this.formationAnimationVariant)
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

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

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

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

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

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

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

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

elexis added a subscriber: elexis.Apr 25 2020, 10:17 PM

I didnt see write to this.animations other than the one here (only took a superficial look), then it could be removed from serialization by providing a custom Serialize function that returns an object with all this properties except this one (there are existing components doing that).
Removal from serialization has the benefit of smaller savegames, faster rejoin transmissions and is mentioned at #3834.
The disadvantage of replacing this.foo = +this.template.someNumber by evaluating the +foo every call can be that it's slower, and I guess the number is written into memory again and again somewhere whereas in the other case its kept in memory.
If one provides a custom serialzation method one can keep the cache variables and not serialize them.
That again has the disadvantage of using a bit more memory.
So it's a tradeoff.
So I guess not serializing is the most important goal, and the secondary goal is to either optimize for runtime performance or memory use.
(One can estimate memory use by estimating the max amount of entities having that component, I guess its negligible or insignificant here, but I also wouldn't be surprised if it's a pattern that could add up. Then again JS components are supposed to be the ones that arent as performance critical as the C++ ones.)
(One could split the template rename from the serialization removal if one wanted to, but doesn't matter)
(So patch seems okay except for the missing = [] and cache is considerable.).
(Test plan should probably include dynamic testing, or be used to make the implied dynamic testing explicit)

binaries/data/mods/public/simulation/components/Formation.js
655

(behavior change, code now relies on templates not specifying sortingOrder for column formations, or it supports sorting order for column formations now which would be a design change that should be mentioned then)

683

inline

Silier added inline comments.Apr 25 2020, 10:28 PM
binaries/data/mods/public/simulation/components/Formation.js
655

that variable is actually not used

Silier added inline comments.Apr 25 2020, 10:43 PM
binaries/data/mods/public/simulation/components/Formation.js
752

looks like rP14524 wanted to not this. but it did
on the other hand it added sortingclasses for columnar so now this remains misstery what was intended

@elexis what do you mean by So patch seems okay except for the missing = [] and cache is considerable. where are [] missing?

In D2707#114153, @Angen wrote:

@elexis what do you mean by So patch seems okay except for the missing = [] and cache is considerable. where are [] missing?

L88
this.animationvariants;
-> this.animationvariants = [];
at least it sounds like that was intended, wasn't it? Perhaps it should be assigned to a different value, or left not defined, then the line should be removed, the line doesn't do anything currently I guess.

Stan added a comment.Apr 26 2020, 3:38 PM
In D2707#114153, @Angen wrote:

@elexis what do you mean by So patch seems okay except for the missing = [] and cache is considerable. where are [] missing?

L88
this.animationvariants;
-> this.animationvariants = [];
at least it sounds like that was intended, wasn't it? Perhaps it should be assigned to a different value, or left not defined, then the line should be removed, the line doesn't do anything currently I guess.

It's defined in the if. The question was whether serialization would occur for undefined variables. If it does it should be moved in the if

y, should be removed
reason why it is empty is L91 to not create empty object

Silier updated this revision to Diff 11760.May 1 2020, 12:17 PM

rebase
custom serialize, deserialize function

Owners added a subscriber: Restricted Owners Package.May 1 2020, 12:17 PM
Stan added inline comments.May 1 2020, 12:29 PM
binaries/data/mods/public/simulation/components/Formation.js
136

I guess one could not serialize undefined values, but not sure it's worth going through all the keys.

751

let here too?

binaries/data/mods/public/simulation/templates/special/formations/anti_cavalry.xml
17

Breaking change for all mods. Should be reported on the forums.

Silier added inline comments.May 1 2020, 12:40 PM
binaries/data/mods/public/simulation/components/Formation.js
751

will do when cleaning this file, actually i forgot to revert let back to var as i am not changing lines below anymore but i ll not do update just to revert that :)

Silier edited the summary of this revision. (Show Details)May 1 2020, 12:42 PM
Silier edited the test plan for this revision. (Show Details)
Silier added a reviewer: Restricted Owners Package.
Silier removed a subscriber: Restricted Owners Package.
elexis added inline comments.May 1 2020, 12:58 PM
binaries/data/mods/public/simulation/components/Formation.js
152

duplicaiton once per line, could put the serializable property names on an array of the prototype and iterate over those. Perhaps its easier to make a blacklist instead of a whitelist (serialize each property except one of them?) (Changing serialization should warrant a rejoin test)

159

Isn't this the default Deserialize i.e. redundant?
(missing semicolon)

Silier added inline comments.May 1 2020, 1:04 PM
binaries/data/mods/public/simulation/components/Formation.js
152

would not be better local variable for that instead of keeping it in memory whole time ?
I think iterating whitelist would be faster

159

possibly, i did not check

elexis added inline comments.May 1 2020, 1:34 PM
binaries/data/mods/public/simulation/components/Formation.js
152

Serialize is called at least every time a client(observer) rejoins. It also must be called every N turns to compute the full hash unless I miss something. I guess creating one array has little performance impact in comparison to the rest of Serialization code (then again who wants to neglect performance differences while writing code).

Whitelist may be faster because it avoids the condition testing whether the property is blacklisted, but thats string comparison and probably (?) quicker than creating a garbage-collection tracked JS object. How many blacklisted items are there? If its only 1-2 then it seems much more practical in terms of code maintenance and duplication-antipattern to test against the blacklist (for...x..in; if x != "blacklisted" ...).

159

(pretty sure thats the default, the default script de/serialization code is found in simulation(2)/system/)

Silier added inline comments.May 1 2020, 2:04 PM
binaries/data/mods/public/simulation/components/Formation.js
152

11 blacklisted, 14 whitelisted

elexis added a comment.May 1 2020, 2:38 PM

11 blacklisted, 14 whitelisted

I see, from init at least 9 template cache variables. Then its fine to use whitelist (and author or reviewer need to become certain that the code still works deterministically (for rejoining clients), easy to have some difference, too late or missing init for rejoiner etc.).

	this.sortingClasses = this.template.SortingClasses.split(/\s+/g);
	this.shiftRows = this.template.ShiftRows == "true";
	this.separationMultiplier = {
	this.sloppyness = +this.template.Sloppyness;
	this.widthDepthRatio = +this.template.WidthDepthRatio;
	this.minColumns = +(this.template.MinColumns || 0);
	this.maxColumns = +(this.template.MaxColumns || 0);
	this.maxRows = +(this.template.MaxRows || 0);
	this.centerGap = +(this.template.CenterGap || 0);

	this.animationvariants = [];
	this.lastOrderVariant = undefined;
	this.members = []; // entity IDs currently belonging to this formation
	this.memberPositions = {};
	this.maxRowsUsed = 0;
	this.maxColumnsUsed = [];
	this.inPosition = []; // entities that have reached their final position
	this.columnar = false; // whether we're travelling in column (vs box) formation
	this.rearrange = true; // whether we should rearrange all formation members
	this.formationMembersWithAura = []; // Members with a formation aura
	this.width = 0;
	this.depth = 0;
	this.oldOrientation = {"sin": 0, "cos": 0};
	this.twinFormations = [];
	this.formationSeparation = 0;

(Another way to make the serialization shorter and perhaps less error prone would be to prefix the template caching variables with template, or perhaps to make an object this.templateValues or this.formationTemplate.)

Silier planned changes to this revision.May 3 2020, 12:17 PM

timer oos

Silier updated this revision to Diff 11790.May 3 2020, 1:46 PM
Owners added a subscriber: Restricted Owners Package.May 3 2020, 1:46 PM
Vulcan added a comment.May 3 2020, 1:49 PM

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

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

Silier added inline comments.May 3 2020, 1:49 PM
binaries/data/mods/public/simulation/components/Formation.js
159

it is not, nuking that will cause errors

Silier edited the summary of this revision. (Show Details)May 3 2020, 1:50 PM
Silier edited the test plan for this revision. (Show Details)
Silier planned changes to this revision.May 11 2020, 6:34 PM
Silier added inline comments.
binaries/data/mods/public/simulation/components/Formation.js
903

ups, remove this

Silier updated this revision to Diff 11942.May 20 2020, 7:34 PM

move variablesToSerialize to prototype to avoid global as we do not like globals, locale variable as it would be recreated by every serialisation call and declaration in Init as it would be recreated for every entity.

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 (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
| 946| 946| 		cmpOtherFormation.RemoveMembers(otherMembers);
| 947| 947| 		this.AddMembers(otherMembers);
| 948| 948| 		Engine.DestroyEntity(this.twinFormations[i]);
| 949|    |-		this.twinFormations.splice(i,1);
|    | 949|+		this.twinFormations.splice(i, 1);
| 950| 950| 	}
| 951| 951| 	// Switch between column and box if necessary
| 952| 952| 	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
| 908| »   var·cmpUnitMotion·=·Engine.QueryInterface(this.entity,·IID_UnitMotion);
|    | [NORMAL] JSHintBear:
|    | 'cmpUnitMotion' is already defined.
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 788| 788| 					this.FinishOrder();
| 789| 789| 					return;
| 790| 790| 				}
| 791|    |-				else
| 792|    |-				{
|    | 791|+				
| 793| 792| 					this.SetNextState("GARRISON.APPROACHING");
| 794| 793| 					return;
| 795|    |-				}
|    | 794|+				
| 796| 795| 			}
| 797| 796| 
| 798| 797| 			this.SetNextState("GARRISON.GARRISONING");
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'GARRISON'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1060|1060| 			},
|1061|1061| 		},
|1062|1062| 
|1063|    |-		"GARRISON":{
|    |1063|+		"GARRISON": {
|1064|1064| 			"APPROACHING": {
|1065|1065| 				"enter": function() {
|1066|1066| 					if (!this.MoveToGarrisonRange(this.order.data.target))
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2042|2042| 
|2043|2043| 				"Attacked": function(msg) {
|2044|2044| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2045|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2046|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2045|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2046|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2047|2047| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2048|2048| 				},
|2049|2049| 			},
|    | [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
|2201|2201| 					"MovementUpdate": function(msg) {
|2202|2202| 						// If it looks like the path is failing, and we are close enough (3 tiles) from wanted range
|2203|2203| 						// stop anyways. This avoids pathing for an unreachable goal and reduces lag considerably.
|2204|    |-						if (msg.likelyFailure || 
|    |2204|+						if (msg.likelyFailure ||
|2205|2205| 							msg.obstructed && this.RelaxedMaxRangeCheck(this.order.data, this.order.data.max + this.DefaultRelaxedMaxRange) ||
|2206|2206| 							!msg.obstructed && this.CheckRange(this.order.data))
|2207|2207| 							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
|2843|2843| 					{
|2844|2844| 						// The building was already finished/fully repaired before we arrived;
|2845|2845| 						// let the ConstructionFinished handler handle this.
|2846|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2846|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2847|2847| 						return true;
|2848|2848| 					}
|2849|2849| 
|    | [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
|2843|2843| 					{
|2844|2844| 						// The building was already finished/fully repaired before we arrived;
|2845|2845| 						// let the ConstructionFinished handler handle this.
|2846|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2846|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2847|2847| 						return true;
|2848|2848| 					}
|2849|2849| 
|    | [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
|3141|3141| 				this.StopTimer();
|3142|3142| 				this.ResetAnimation();
|3143|3143| 				if (this.formationAnimationVariant)
|3144|    |-					this.SetAnimationVariant(this.formationAnimationVariant)
|    |3144|+					this.SetAnimationVariant(this.formationAnimationVariant);
|3145|3145| 				else
|3146|3146| 					this.SetDefaultAnimationVariant();
|3147|3147| 				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
|3367|3367| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3368|3368| 
|3369|3369| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3370|    |-							// only used for domestic animals
|    |3370|+		// only used for domestic animals
|3371|3371| 
|3372|3372| 		// Reuse the same garrison behaviour for animals.
|3373|3373| 		"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
|3429|3429| 
|3430|3430| UnitAI.prototype.IsAnimal = function()
|3431|3431| {
|3432|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3432|+	return (!!this.template.NaturalBehaviour);
|3433|3433| };
|3434|3434| 
|3435|3435| 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
|3545|3545| 		{
|3546|3546| 			let index = this.GetCurrentState().indexOf(".");
|3547|3547| 			if (index != -1)
|3548|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3548|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3549|3549| 			this.Stop(false);
|3550|3550| 		}
|3551|3551| 
|    | [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
|3601|3601| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3602|3602| 			continue;
|3603|3603| 		if (i == 0)
|3604|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3604|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3605|3605| 		else
|3606|3606| 			this.orderQueue.splice(i, 1);
|3607|3607| 		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
|3601|3601| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3602|3602| 			continue;
|3603|3603| 		if (i == 0)
|3604|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3604|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3605|3605| 		else
|3606|3606| 			this.orderQueue.splice(i, 1);
|3607|3607| 		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
|3688|3688| };
|3689|3689| 
|3690|3690| 
|3691|    |-//// FSM linkage functions ////
|    |3691|+// // FSM linkage functions ////
|3692|3692| 
|3693|3693| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3694|3694| 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
|3859|3859| 				continue;
|3860|3860| 			if (this.orderQueue[i].type == type)
|3861|3861| 				continue;
|3862|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3862|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3863|3863| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3864|3864| 			return;
|3865|3865| 		}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3859|3859| 				continue;
|3860|3860| 			if (this.orderQueue[i].type == type)
|3861|3861| 				continue;
|3862|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3862|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3863|3863| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3864|3864| 			return;
|3865|3865| 		}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4101|4101| 	if (data.timerRepeat === undefined)
|4102|4102| 		this.timer = undefined;
|4103|4103| 
|4104|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4104|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4105|4105| };
|4106|4106| 
|4107|4107| /**
|    | [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
|4101|4101| 	if (data.timerRepeat === undefined)
|4102|4102| 		this.timer = undefined;
|4103|4103| 
|4104|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4104|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4105|4105| };
|4106|4106| 
|4107|4107| /**
|    | [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
|4146|4146| 	// TODO: This is a bit inefficient since every unit listens to every
|4147|4147| 	// construction message - ideally we could scope it to only the one we're building
|4148|4148| 
|4149|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4149|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4150|4150| };
|4151|4151| 
|4152|4152| 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
|4146|4146| 	// TODO: This is a bit inefficient since every unit listens to every
|4147|4147| 	// construction message - ideally we could scope it to only the one we're building
|4148|4148| 
|4149|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4149|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4150|4150| };
|4151|4151| 
|4152|4152| 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
|4177|4177| 	if (msg.fromStatusEffect)
|4178|4178| 		return;
|4179|4179| 
|4180|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4180|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4181|4181| };
|4182|4182| 
|4183|4183| 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
|4177|4177| 	if (msg.fromStatusEffect)
|4178|4178| 		return;
|4179|4179| 
|4180|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4180|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4181|4181| };
|4182|4182| 
|4183|4183| 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
|4182|4182| 
|4183|4183| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4184|4184| {
|4185|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4185|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4186|4186| };
|4187|4187| 
|4188|4188| 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
|4182|4182| 
|4183|4183| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4184|4184| {
|4185|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4185|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4186|4186| };
|4187|4187| 
|4188|4188| 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
|4187|4187| 
|4188|4188| UnitAI.prototype.OnHealthChanged = function(msg)
|4189|4189| {
|4190|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4190|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4191|4191| };
|4192|4192| 
|4193|4193| 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
|4187|4187| 
|4188|4188| UnitAI.prototype.OnHealthChanged = function(msg)
|4189|4189| {
|4190|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4190|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4191|4191| };
|4192|4192| 
|4193|4193| 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
|4193|4193| UnitAI.prototype.OnRangeUpdate = function(msg)
|4194|4194| {
|4195|4195| 	if (msg.tag == this.losRangeQuery)
|4196|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4196|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4197|4197| 	else if (msg.tag == this.losHealRangeQuery)
|4198|4198| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4199|4199| };
|    | [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
|4193|4193| UnitAI.prototype.OnRangeUpdate = function(msg)
|4194|4194| {
|4195|4195| 	if (msg.tag == this.losRangeQuery)
|4196|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4196|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4197|4197| 	else if (msg.tag == this.losHealRangeQuery)
|4198|4198| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4199|4199| };
|    | [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
|4195|4195| 	if (msg.tag == this.losRangeQuery)
|4196|4196| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4197|4197| 	else if (msg.tag == this.losHealRangeQuery)
|4198|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4198|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4199|4199| };
|4200|4200| 
|4201|4201| 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
|4195|4195| 	if (msg.tag == this.losRangeQuery)
|4196|4196| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4197|4197| 	else if (msg.tag == this.losHealRangeQuery)
|4198|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4198|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4199|4199| };
|4200|4200| 
|4201|4201| 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
|4200|4200| 
|4201|4201| UnitAI.prototype.OnPackFinished = function(msg)
|4202|4202| {
|4203|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4203|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4204|4204| };
|4205|4205| 
|4206|4206| //// 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
|4200|4200| 
|4201|4201| UnitAI.prototype.OnPackFinished = function(msg)
|4202|4202| {
|4203|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4203|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4204|4204| };
|4205|4205| 
|4206|4206| //// 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
|4203|4203| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4204|4204| };
|4205|4205| 
|4206|    |-//// Helper functions to be called by the FSM ////
|    |4206|+// // Helper functions to be called by the FSM ////
|4207|4207| 
|4208|4208| UnitAI.prototype.GetWalkSpeed = function()
|4209|4209| {
|    | [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
|4915|4915| UnitAI.prototype.AttackEntityInZone = function(ents)
|4916|4916| {
|4917|4917| 	var target = ents.find(target =>
|4918|    |-		this.CanAttack(target)
|4919|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4918|+		this.CanAttack(target) &&
|    |4919|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4920|4920| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4921|4921| 	);
|4922|4922| 	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
|4916|4916| {
|4917|4917| 	var target = ents.find(target =>
|4918|4918| 		this.CanAttack(target)
|4919|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4920|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4919|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4920|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4921|4921| 	);
|4922|4922| 	if (!target)
|4923|4923| 		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
|4982|4982| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4983|4983| 	if (this.isGuardOf)
|4984|4984| 	{
|4985|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4985|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4986|4986| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4987|4987| 		if (cmpUnitAI && cmpAttack &&
|4988|4988| 		    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
|4986|4986| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4987|4987| 		if (cmpUnitAI && cmpAttack &&
|4988|4988| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4989|    |-				return false;
|    |4989|+			return false;
|4990|4990| 	}
|4991|4991| 
|4992|4992| 	// 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
|5024|5024| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|5025|5025| 	if (this.isGuardOf)
|5026|5026| 	{
|5027|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |5027|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|5028|5028| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|5029|5029| 		if (cmpUnitAI && cmpAttack &&
|5030|5030| 		    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
|5037|5037| 	return false;
|5038|5038| };
|5039|5039| 
|5040|    |-//// External interface functions ////
|    |5040|+// // External interface functions ////
|5041|5041| 
|5042|5042| UnitAI.prototype.SetFormationController = function(ent)
|5043|5043| {
|    | [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
|5193|5193| 	{
|5194|5194| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5195|5195| 			return;
|5196|    |-		else
|5197|    |-			this.RemoveGuard();
|    |5196|+		this.RemoveGuard();
|5198|5197| 	}
|5199|5198| 
|5200|5199| 	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
|5524|5524| 
|5525|5525| 	if (this.IsFormationController())
|5526|5526| 		this.CallMemberFunction("CancelSetupTradeRoute", [target]);
|5527|    |-}
|    |5527|+};
|5528|5528| /**
|5529|5529|  * Adds trade order to the queue. Either walk to the first market, or
|5530|5530|  * 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
|5545|5545| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5546|5546| 	{
|5547|5547| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5548|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5548|+		if (cmpTrader.HasBothMarkets() &&
|5549|5549| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5550|5550| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5551|5551| 		{
|    | [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
|5826|5826| 				{
|5827|5827| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5828|5828| 					var targetClasses = this.order.data.targetClasses;
|5829|    |-					if (targetClasses.attack && cmpIdentity
|5830|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5829|+					if (targetClasses.attack && cmpIdentity &&
|    |5830|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5831|5831| 						continue;
|5832|5832| 					if (targetClasses.avoid && cmpIdentity
|5833|5833| 						&& 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
|5829|5829| 					if (targetClasses.attack && cmpIdentity
|5830|5830| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5831|5831| 						continue;
|5832|    |-					if (targetClasses.avoid && cmpIdentity
|5833|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5832|+					if (targetClasses.avoid && cmpIdentity &&
|    |5833|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5834|5834| 						continue;
|5835|5835| 					// Only used by the AIs to prevent some choices of targets
|5836|5836| 					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
|5852|5852| 		{
|5853|5853| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5854|5854| 			var targetClasses = this.order.data.targetClasses;
|5855|    |-			if (cmpIdentity && targetClasses.attack
|5856|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5855|+			if (cmpIdentity && targetClasses.attack &&
|    |5856|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5857|5857| 				continue;
|5858|5858| 			if (cmpIdentity && targetClasses.avoid
|5859|5859| 				&& 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
|5855|5855| 			if (cmpIdentity && targetClasses.attack
|5856|5856| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5857|5857| 				continue;
|5858|    |-			if (cmpIdentity && targetClasses.avoid
|5859|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5858|+			if (cmpIdentity && targetClasses.avoid &&
|    |5859|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5860|5860| 				continue;
|5861|5861| 			// Only used by the AIs to prevent some choices of targets
|5862|5862| 			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
|5998|5998| 
|5999|5999| UnitAI.prototype.SetHeldPosition = function(x, z)
|6000|6000| {
|6001|    |-	this.heldPosition = {"x": x, "z": z};
|    |6001|+	this.heldPosition = { "x": x, "z": z};
|6002|6002| };
|6003|6003| 
|6004|6004| 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
|5998|5998| 
|5999|5999| UnitAI.prototype.SetHeldPosition = function(x, z)
|6000|6000| {
|6001|    |-	this.heldPosition = {"x": x, "z": z};
|    |6001|+	this.heldPosition = {"x": x, "z": z };
|6002|6002| };
|6003|6003| 
|6004|6004| 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
|6025|6025| 	return false;
|6026|6026| };
|6027|6027| 
|6028|    |-//// Helper functions ////
|    |6028|+// // Helper functions ////
|6029|6029| 
|6030|6030| /**
|6031|6031|  * 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
|6044|6044| 		return undefined;
|6045|6045| 
|6046|6046| 	return component.GetRange(type);
|6047|    |-}
|    |6047|+};
|6048|6048| 
|6049|6049| UnitAI.prototype.CanAttack = function(target)
|6050|6050| {
|    | [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
|6212|6212| 	return cmpPack && cmpPack.IsPacking();
|6213|6213| };
|6214|6214| 
|6215|    |-//// Formation specific functions ////
|    |6215|+// // Formation specific functions ////
|6216|6216| 
|6217|6217| UnitAI.prototype.IsAttackingAsFormation = function()
|6218|6218| {
|    | [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
|6217|6217| UnitAI.prototype.IsAttackingAsFormation = function()
|6218|6218| {
|6219|6219| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6220|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6221|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6220|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6221|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6222|6222| };
|6223|6223| 
|6224|6224| //// 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
|6221|6221| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6222|6222| };
|6223|6223| 
|6224|    |-//// Animal specific functions ////
|    |6224|+// // Animal specific functions ////
|6225|6225| 
|6226|6226| UnitAI.prototype.MoveRandomly = function(distance)
|6227|6227| {

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4006| »   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
|4902| »   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
|4917| »   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
|4965| »   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
|4988| »   »   ····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
|2046| »   »   »   »   »   »   &&·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
|3144| »   »   »   »   »   this.SetAnimationVariant(this.formationAnimationVariant)
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

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

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

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

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

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

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

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

This revision was not accepted when it landed; it landed in state Needs Review.May 23 2020, 3:03 PM
This revision was automatically updated to reflect the committed changes.