Page MenuHomeWildfire Games

Fix entities not retaining repair order after target transforms.
ClosedPublic

Authored by Freagarach on Oct 5 2019, 11:20 PM.

Details

Reviewers
Angen
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Commits
rP23449: Fix entities not retaining repair order after target transforms
Summary

rP13541 Introduced a temporary this.repairTarget used to remove builders from a foundation/repairable when the builder changes states.
A problem with that occurs when the target transforms (e.g. (un)packs) for the this.repairTarget is not updated.

The solution used here is to update this.repairTarget OnGlobalEntityRenamed.
When one has fixed the above, another problem rises (also fixed in this diff). Builders are not transferred when an entity transforms, now they do.

Test Plan

Verify that one can repair a siege unit and when it changes states the builder is reassigned (numbers are still correct when hovering the hammer).
Verify that sending an repairing entity another order does not trigger an warning.

Diff Detail

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

Event Timeline

Freagarach created this revision.Oct 5 2019, 11:20 PM
Freagarach added inline comments.
binaries/data/mods/public/simulation/components/UnitAI.js
2734 ↗(On Diff #10092)

Revert accidental order change.

2739 ↗(On Diff #10092)

Comments on top.

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

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

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

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/415/display/redirect

Stan added a subscriber: Stan.Oct 5 2019, 11:43 PM
Stan added inline comments.
binaries/data/mods/public/simulation/components/UnitAI.js
2691 ↗(On Diff #10092)

Comments on top :)

2706 ↗(On Diff #10092)

let ?

binaries/data/mods/public/simulation/helpers/Transform.js
58 ↗(On Diff #10092)

Wonder if there is a way to clone the whole array ? https://www.freecodecamp.org/news/how-to-clone-an-array-in-javascript-1d3183468f6a/

(Might need another function)

Freagarach updated this revision to Diff 10093.Oct 6 2019, 8:19 AM
Freagarach marked 2 inline comments as done.
  • Comments on top.
  • Reverted accidental order change.
  • One var to let.
  • Fixed test.
Vulcan added a comment.Oct 6 2019, 8:22 AM

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

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/416/display/redirect

Vulcan added a comment.Oct 6 2019, 8:31 AM

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

Linter detected issues:
Executing section Source...
Executing section JS...

binaries/data/mods/public/simulation/components/tests/test_Pack.js
|  44| »   "SetInterval":·(ent,·iid,·funcname,·time,·repeattime,·data)·=>·{·timerActivated·=·true;·return·7;·}
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'ent' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/Foundation.js
| 332| »   »   var·pos·=·cmpPosition.GetPosition2D();
|    | [NORMAL] JSHintBear:
|    | 'pos' is already defined.

binaries/data/mods/public/simulation/components/Foundation.js
| 334| »   »   var·rot·=·cmpPosition.GetRotation();
|    | [NORMAL] JSHintBear:
|    | 'rot' 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
| 762| 762| 					this.FinishOrder();
| 763| 763| 					return;
| 764| 764| 				}
| 765|    |-				else
| 766|    |-				{
|    | 765|+				
| 767| 766| 					this.SetNextState("GARRISON.APPROACHING");
| 768| 767| 					return;
| 769|    |-				}
|    | 768|+				
| 770| 769| 			}
| 771| 770| 
| 772| 771| 			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
|1030|1030| 			},
|1031|1031| 		},
|1032|1032| 
|1033|    |-		"GARRISON":{
|    |1033|+		"GARRISON": {
|1034|1034| 			"enter": function() {
|1035|1035| 				// If the garrisonholder should pickup, warn it so it can take needed action
|1036|1036| 				var cmpGarrisonHolder = Engine.QueryInterface(this.order.data.target, IID_GarrisonHolder);
|    | [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
|1979|1979| 
|1980|1980| 				"Attacked": function(msg) {
|1981|1981| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|1982|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|1983|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |1982|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |1983|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|1984|1984| 						this.RespondToTargetedEntities([msg.data.attacker]);
|1985|1985| 				},
|1986|1986| 			},
|    | [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
|2711|2711| 					{
|2712|2712| 						// The building was already finished/fully repaired before we arrived;
|2713|2713| 						// let the ConstructionFinished handler handle this.
|2714|    |-						this.OnGlobalConstructionFinished({"entity": target, "newentity": target});
|    |2714|+						this.OnGlobalConstructionFinished({ "entity": target, "newentity": target});
|2715|2715| 						return true;
|2716|2716| 					}
|2717|2717| 
|    | [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
|2711|2711| 					{
|2712|2712| 						// The building was already finished/fully repaired before we arrived;
|2713|2713| 						// let the ConstructionFinished handler handle this.
|2714|    |-						this.OnGlobalConstructionFinished({"entity": target, "newentity": target});
|    |2714|+						this.OnGlobalConstructionFinished({"entity": target, "newentity": target });
|2715|2715| 						return true;
|2716|2716| 					}
|2717|2717| 
|    | [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
|3229|3229| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3230|3230| 
|3231|3231| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3232|    |-							// only used for domestic animals
|    |3232|+		// only used for domestic animals
|3233|3233| 	},
|3234|3234| };
|3235|3235| 
|    | [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
|3286|3286| 
|3287|3287| UnitAI.prototype.IsAnimal = function()
|3288|3288| {
|3289|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3289|+	return (!!this.template.NaturalBehaviour);
|3290|3290| };
|3291|3291| 
|3292|3292| 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
|3402|3402| 		{
|3403|3403| 			let index = this.GetCurrentState().indexOf(".");
|3404|3404| 			if (index != -1)
|3405|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3405|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3406|3406| 			this.Stop(false);
|3407|3407| 		}
|3408|3408| 
|    | [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
|3458|3458| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3459|3459| 			continue;
|3460|3460| 		if (i == 0)
|3461|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3461|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3462|3462| 		else
|3463|3463| 			this.orderQueue.splice(i, 1);
|3464|3464| 		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
|3458|3458| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3459|3459| 			continue;
|3460|3460| 		if (i == 0)
|3461|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3461|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3462|3462| 		else
|3463|3463| 			this.orderQueue.splice(i, 1);
|3464|3464| 		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
|3542|3542| };
|3543|3543| 
|3544|3544| 
|3545|    |-//// FSM linkage functions ////
|    |3545|+// // FSM linkage functions ////
|3546|3546| 
|3547|3547| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3548|3548| 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
|3712|3712| 				continue;
|3713|3713| 			if (this.orderQueue[i].type == type)
|3714|3714| 				continue;
|3715|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3715|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3716|3716| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3717|3717| 			return;
|3718|3718| 		}
|    | [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
|3712|3712| 				continue;
|3713|3713| 			if (this.orderQueue[i].type == type)
|3714|3714| 				continue;
|3715|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3715|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3716|3716| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3717|3717| 			return;
|3718|3718| 		}
|    | [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
|3883|3883| 	if (data.timerRepeat === undefined)
|3884|3884| 		this.timer = undefined;
|3885|3885| 
|3886|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3886|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3887|3887| };
|3888|3888| 
|3889|3889| /**
|    | [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
|3883|3883| 	if (data.timerRepeat === undefined)
|3884|3884| 		this.timer = undefined;
|3885|3885| 
|3886|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3886|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3887|3887| };
|3888|3888| 
|3889|3889| /**
|    | [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
|3928|3928| 	// TODO: This is a bit inefficient since every unit listens to every
|3929|3929| 	// construction message - ideally we could scope it to only the one we're building
|3930|3930| 
|3931|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3931|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3932|3932| };
|3933|3933| 
|3934|3934| 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
|3928|3928| 	// TODO: This is a bit inefficient since every unit listens to every
|3929|3929| 	// construction message - ideally we could scope it to only the one we're building
|3930|3930| 
|3931|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3931|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3932|3932| };
|3933|3933| 
|3934|3934| 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
|3953|3953| 
|3954|3954| UnitAI.prototype.OnAttacked = function(msg)
|3955|3955| {
|3956|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3956|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3957|3957| };
|3958|3958| 
|3959|3959| 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
|3953|3953| 
|3954|3954| UnitAI.prototype.OnAttacked = function(msg)
|3955|3955| {
|3956|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3956|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3957|3957| };
|3958|3958| 
|3959|3959| 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
|3958|3958| 
|3959|3959| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3960|3960| {
|3961|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3961|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|3962|3962| };
|3963|3963| 
|3964|3964| 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
|3958|3958| 
|3959|3959| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3960|3960| {
|3961|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3961|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|3962|3962| };
|3963|3963| 
|3964|3964| 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
|3963|3963| 
|3964|3964| UnitAI.prototype.OnHealthChanged = function(msg)
|3965|3965| {
|3966|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3966|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|3967|3967| };
|3968|3968| 
|3969|3969| 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
|3963|3963| 
|3964|3964| UnitAI.prototype.OnHealthChanged = function(msg)
|3965|3965| {
|3966|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3966|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|3967|3967| };
|3968|3968| 
|3969|3969| 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
|3969|3969| UnitAI.prototype.OnRangeUpdate = function(msg)
|3970|3970| {
|3971|3971| 	if (msg.tag == this.losRangeQuery)
|3972|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3972|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|3973|3973| 	else if (msg.tag == this.losHealRangeQuery)
|3974|3974| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3975|3975| };
|    | [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
|3969|3969| UnitAI.prototype.OnRangeUpdate = function(msg)
|3970|3970| {
|3971|3971| 	if (msg.tag == this.losRangeQuery)
|3972|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3972|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|3973|3973| 	else if (msg.tag == this.losHealRangeQuery)
|3974|3974| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3975|3975| };
|    | [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
|3971|3971| 	if (msg.tag == this.losRangeQuery)
|3972|3972| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3973|3973| 	else if (msg.tag == this.losHealRangeQuery)
|3974|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3974|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|3975|3975| };
|3976|3976| 
|3977|3977| 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
|3971|3971| 	if (msg.tag == this.losRangeQuery)
|3972|3972| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3973|3973| 	else if (msg.tag == this.losHealRangeQuery)
|3974|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3974|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|3975|3975| };
|3976|3976| 
|3977|3977| 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
|3976|3976| 
|3977|3977| UnitAI.prototype.OnPackFinished = function(msg)
|3978|3978| {
|3979|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3979|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|3980|3980| };
|3981|3981| 
|3982|3982| //// 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
|3976|3976| 
|3977|3977| UnitAI.prototype.OnPackFinished = function(msg)
|3978|3978| {
|3979|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3979|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|3980|3980| };
|3981|3981| 
|3982|3982| //// 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
|3979|3979| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|3980|3980| };
|3981|3981| 
|3982|    |-//// Helper functions to be called by the FSM ////
|    |3982|+// // Helper functions to be called by the FSM ////
|3983|3983| 
|3984|3984| UnitAI.prototype.GetWalkSpeed = function()
|3985|3985| {
|    | [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
|4648|4648| UnitAI.prototype.AttackEntityInZone = function(ents)
|4649|4649| {
|4650|4650| 	var target = ents.find(target =>
|4651|    |-		this.CanAttack(target)
|4652|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4651|+		this.CanAttack(target) &&
|    |4652|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4653|4653| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4654|4654| 	);
|4655|4655| 	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
|4649|4649| {
|4650|4650| 	var target = ents.find(target =>
|4651|4651| 		this.CanAttack(target)
|4652|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4653|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4652|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4653|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4654|4654| 	);
|4655|4655| 	if (!target)
|4656|4656| 		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
|4713|4713| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4714|4714| 	if (this.isGuardOf)
|4715|4715| 	{
|4716|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4716|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4717|4717| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4718|4718| 		if (cmpUnitAI && cmpAttack &&
|4719|4719| 		    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
|4717|4717| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4718|4718| 		if (cmpUnitAI && cmpAttack &&
|4719|4719| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4720|    |-				return false;
|    |4720|+			return false;
|4721|4721| 	}
|4722|4722| 
|4723|4723| 	// 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
|4755|4755| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4756|4756| 	if (this.isGuardOf)
|4757|4757| 	{
|4758|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4758|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4759|4759| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4760|4760| 		if (cmpUnitAI && cmpAttack &&
|4761|4761| 		    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
|4768|4768| 	return false;
|4769|4769| };
|4770|4770| 
|4771|    |-//// External interface functions ////
|    |4771|+// // External interface functions ////
|4772|4772| 
|4773|4773| UnitAI.prototype.SetFormationController = function(ent)
|4774|4774| {
|    | [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
|4924|4924| 	{
|4925|4925| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4926|4926| 			return;
|4927|    |-		else
|4928|    |-			this.RemoveGuard();
|    |4927|+		this.RemoveGuard();
|4929|4928| 	}
|4930|4929| 
|4931|4930| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|    | [NORMAL] ESLintBear (no-trailing-spaces):
|    | Trailing spaces not allowed.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5256|5256| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5257|5257| 	{
|5258|5258| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5259|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5259|+		if (cmpTrader.HasBothMarkets() &&
|5260|5260| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5261|5261| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5262|5262| 		{
|    | [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
|5537|5537| 				{
|5538|5538| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5539|5539| 					var targetClasses = this.order.data.targetClasses;
|5540|    |-					if (targetClasses.attack && cmpIdentity
|5541|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5540|+					if (targetClasses.attack && cmpIdentity &&
|    |5541|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5542|5542| 						continue;
|5543|5543| 					if (targetClasses.avoid && cmpIdentity
|5544|5544| 						&& 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
|5540|5540| 					if (targetClasses.attack && cmpIdentity
|5541|5541| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5542|5542| 						continue;
|5543|    |-					if (targetClasses.avoid && cmpIdentity
|5544|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5543|+					if (targetClasses.avoid && cmpIdentity &&
|    |5544|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5545|5545| 						continue;
|5546|5546| 					// Only used by the AIs to prevent some choices of targets
|5547|5547| 					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
|5563|5563| 		{
|5564|5564| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5565|5565| 			var targetClasses = this.order.data.targetClasses;
|5566|    |-			if (cmpIdentity && targetClasses.attack
|5567|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5566|+			if (cmpIdentity && targetClasses.attack &&
|    |5567|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5568|5568| 				continue;
|5569|5569| 			if (cmpIdentity && targetClasses.avoid
|5570|5570| 				&& 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
|5566|5566| 			if (cmpIdentity && targetClasses.attack
|5567|5567| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5568|5568| 				continue;
|5569|    |-			if (cmpIdentity && targetClasses.avoid
|5570|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5569|+			if (cmpIdentity && targetClasses.avoid &&
|    |5570|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5571|5571| 				continue;
|5572|5572| 			// Only used by the AIs to prevent some choices of targets
|5573|5573| 			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
|5723|5723| 
|5724|5724| UnitAI.prototype.SetHeldPosition = function(x, z)
|5725|5725| {
|5726|    |-	this.heldPosition = {"x": x, "z": z};
|    |5726|+	this.heldPosition = { "x": x, "z": z};
|5727|5727| };
|5728|5728| 
|5729|5729| 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
|5723|5723| 
|5724|5724| UnitAI.prototype.SetHeldPosition = function(x, z)
|5725|5725| {
|5726|    |-	this.heldPosition = {"x": x, "z": z};
|    |5726|+	this.heldPosition = {"x": x, "z": z };
|5727|5727| };
|5728|5728| 
|5729|5729| 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
|5750|5750| 	return false;
|5751|5751| };
|5752|5752| 
|5753|    |-//// Helper functions ////
|    |5753|+// // Helper functions ////
|5754|5754| 
|5755|5755| UnitAI.prototype.CanAttack = function(target)
|5756|5756| {
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5954|5954| 	return cmpPack && cmpPack.IsPacking();
|5955|5955| };
|5956|5956| 
|5957|    |-//// Formation specific functions ////
|    |5957|+// // Formation specific functions ////
|5958|5958| 
|5959|5959| UnitAI.prototype.IsAttackingAsFormation = function()
|5960|5960| {
|    | [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
|5959|5959| UnitAI.prototype.IsAttackingAsFormation = function()
|5960|5960| {
|5961|5961| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5962|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5963|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5962|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5963|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5964|5964| };
|5965|5965| 
|5966|5966| //// 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
|5963|5963| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5964|5964| };
|5965|5965| 
|5966|    |-//// Animal specific functions ////
|    |5966|+// // Animal specific functions ////
|5967|5967| 
|5968|5968| UnitAI.prototype.MoveRandomly = function(distance)
|5969|5969| {

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|3788| »   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
|4635| »   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
|4650| »   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
|4696| »   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
|4719| »   »   ····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
|1983| »   »   »   »   »   »   &&·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
|3750| »   »   var·order·=·{·"type":·type,·"data":·data·};
|    | [NORMAL] JSHintBear:
|    | 'order' is already defined.

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

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

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

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

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

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

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/helpers/Transform.js
| 216| »   »   »   »   for·(let·ent·of·cmpNewObstruction.GetEntitiesDeletedUponConstruction())
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'ent' is already declared in the upper scope.
Executing section cli...

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

Angen added a subscriber: Angen.Oct 31 2019, 7:35 PM

variable let target is super redundant in that code, not just introducing one more not needed declaration of variable also one more assignment back to this.repairTarge which can be avoided

Freagarach updated this revision to Diff 10233.Nov 1 2019, 9:22 AM

Remove redundant variable.

Vulcan added a comment.Nov 1 2019, 9:23 AM

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

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/504/display/redirect

Vulcan added a comment.Nov 1 2019, 9:33 AM

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

Linter detected issues:
Executing section Source...
Executing section JS...

binaries/data/mods/public/simulation/components/tests/test_Pack.js
|  44| »   "SetInterval":·(ent,·iid,·funcname,·time,·repeattime,·data)·=>·{·timerActivated·=·true;·return·7;·}
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'ent' is already declared in the upper scope.

binaries/data/mods/public/simulation/helpers/Transform.js
| 216| »   »   »   »   for·(let·ent·of·cmpNewObstruction.GetEntitiesDeletedUponConstruction())
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'ent' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/Foundation.js
| 332| »   »   var·pos·=·cmpPosition.GetPosition2D();
|    | [NORMAL] JSHintBear:
|    | 'pos' is already defined.

binaries/data/mods/public/simulation/components/Foundation.js
| 334| »   »   var·rot·=·cmpPosition.GetRotation();
|    | [NORMAL] JSHintBear:
|    | 'rot' 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
| 762| 762| 					this.FinishOrder();
| 763| 763| 					return;
| 764| 764| 				}
| 765|    |-				else
| 766|    |-				{
|    | 765|+				
| 767| 766| 					this.SetNextState("GARRISON.APPROACHING");
| 768| 767| 					return;
| 769|    |-				}
|    | 768|+				
| 770| 769| 			}
| 771| 770| 
| 772| 771| 			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
|1030|1030| 			},
|1031|1031| 		},
|1032|1032| 
|1033|    |-		"GARRISON":{
|    |1033|+		"GARRISON": {
|1034|1034| 			"enter": function() {
|1035|1035| 				// If the garrisonholder should pickup, warn it so it can take needed action
|1036|1036| 				var cmpGarrisonHolder = Engine.QueryInterface(this.order.data.target, IID_GarrisonHolder);
|    | [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
|1979|1979| 
|1980|1980| 				"Attacked": function(msg) {
|1981|1981| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|1982|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|1983|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |1982|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |1983|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|1984|1984| 						this.RespondToTargetedEntities([msg.data.attacker]);
|1985|1985| 				},
|1986|1986| 			},
|    | [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
|2709|2709| 					{
|2710|2710| 						// The building was already finished/fully repaired before we arrived;
|2711|2711| 						// let the ConstructionFinished handler handle this.
|2712|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2712|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2713|2713| 						return true;
|2714|2714| 					}
|2715|2715| 
|    | [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
|2709|2709| 					{
|2710|2710| 						// The building was already finished/fully repaired before we arrived;
|2711|2711| 						// let the ConstructionFinished handler handle this.
|2712|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2712|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2713|2713| 						return true;
|2714|2714| 					}
|2715|2715| 
|    | [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
|3225|3225| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3226|3226| 
|3227|3227| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3228|    |-							// only used for domestic animals
|    |3228|+		// only used for domestic animals
|3229|3229| 	},
|3230|3230| };
|3231|3231| 
|    | [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
|3282|3282| 
|3283|3283| UnitAI.prototype.IsAnimal = function()
|3284|3284| {
|3285|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3285|+	return (!!this.template.NaturalBehaviour);
|3286|3286| };
|3287|3287| 
|3288|3288| 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
|3398|3398| 		{
|3399|3399| 			let index = this.GetCurrentState().indexOf(".");
|3400|3400| 			if (index != -1)
|3401|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3401|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3402|3402| 			this.Stop(false);
|3403|3403| 		}
|3404|3404| 
|    | [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
|3454|3454| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3455|3455| 			continue;
|3456|3456| 		if (i == 0)
|3457|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3457|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3458|3458| 		else
|3459|3459| 			this.orderQueue.splice(i, 1);
|3460|3460| 		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
|3454|3454| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3455|3455| 			continue;
|3456|3456| 		if (i == 0)
|3457|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3457|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3458|3458| 		else
|3459|3459| 			this.orderQueue.splice(i, 1);
|3460|3460| 		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
|3538|3538| };
|3539|3539| 
|3540|3540| 
|3541|    |-//// FSM linkage functions ////
|    |3541|+// // FSM linkage functions ////
|3542|3542| 
|3543|3543| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3544|3544| 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
|3708|3708| 				continue;
|3709|3709| 			if (this.orderQueue[i].type == type)
|3710|3710| 				continue;
|3711|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3711|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3712|3712| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3713|3713| 			return;
|3714|3714| 		}
|    | [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
|3708|3708| 				continue;
|3709|3709| 			if (this.orderQueue[i].type == type)
|3710|3710| 				continue;
|3711|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3711|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3712|3712| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3713|3713| 			return;
|3714|3714| 		}
|    | [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
|3879|3879| 	if (data.timerRepeat === undefined)
|3880|3880| 		this.timer = undefined;
|3881|3881| 
|3882|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3882|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3883|3883| };
|3884|3884| 
|3885|3885| /**
|    | [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
|3879|3879| 	if (data.timerRepeat === undefined)
|3880|3880| 		this.timer = undefined;
|3881|3881| 
|3882|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3882|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3883|3883| };
|3884|3884| 
|3885|3885| /**
|    | [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
|3924|3924| 	// TODO: This is a bit inefficient since every unit listens to every
|3925|3925| 	// construction message - ideally we could scope it to only the one we're building
|3926|3926| 
|3927|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3927|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3928|3928| };
|3929|3929| 
|3930|3930| 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
|3924|3924| 	// TODO: This is a bit inefficient since every unit listens to every
|3925|3925| 	// construction message - ideally we could scope it to only the one we're building
|3926|3926| 
|3927|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3927|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3928|3928| };
|3929|3929| 
|3930|3930| 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
|3949|3949| 
|3950|3950| UnitAI.prototype.OnAttacked = function(msg)
|3951|3951| {
|3952|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3952|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3953|3953| };
|3954|3954| 
|3955|3955| 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
|3949|3949| 
|3950|3950| UnitAI.prototype.OnAttacked = function(msg)
|3951|3951| {
|3952|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3952|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3953|3953| };
|3954|3954| 
|3955|3955| 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
|3954|3954| 
|3955|3955| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3956|3956| {
|3957|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3957|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|3958|3958| };
|3959|3959| 
|3960|3960| 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
|3954|3954| 
|3955|3955| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3956|3956| {
|3957|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3957|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|3958|3958| };
|3959|3959| 
|3960|3960| 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
|3959|3959| 
|3960|3960| UnitAI.prototype.OnHealthChanged = function(msg)
|3961|3961| {
|3962|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3962|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|3963|3963| };
|3964|3964| 
|3965|3965| 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
|3959|3959| 
|3960|3960| UnitAI.prototype.OnHealthChanged = function(msg)
|3961|3961| {
|3962|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3962|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|3963|3963| };
|3964|3964| 
|3965|3965| 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
|3965|3965| UnitAI.prototype.OnRangeUpdate = function(msg)
|3966|3966| {
|3967|3967| 	if (msg.tag == this.losRangeQuery)
|3968|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3968|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|3969|3969| 	else if (msg.tag == this.losHealRangeQuery)
|3970|3970| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3971|3971| };
|    | [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
|3965|3965| UnitAI.prototype.OnRangeUpdate = function(msg)
|3966|3966| {
|3967|3967| 	if (msg.tag == this.losRangeQuery)
|3968|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3968|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|3969|3969| 	else if (msg.tag == this.losHealRangeQuery)
|3970|3970| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3971|3971| };
|    | [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
|3967|3967| 	if (msg.tag == this.losRangeQuery)
|3968|3968| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3969|3969| 	else if (msg.tag == this.losHealRangeQuery)
|3970|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3970|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|3971|3971| };
|3972|3972| 
|3973|3973| 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
|3967|3967| 	if (msg.tag == this.losRangeQuery)
|3968|3968| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3969|3969| 	else if (msg.tag == this.losHealRangeQuery)
|3970|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3970|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|3971|3971| };
|3972|3972| 
|3973|3973| 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
|3972|3972| 
|3973|3973| UnitAI.prototype.OnPackFinished = function(msg)
|3974|3974| {
|3975|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3975|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|3976|3976| };
|3977|3977| 
|3978|3978| //// 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
|3972|3972| 
|3973|3973| UnitAI.prototype.OnPackFinished = function(msg)
|3974|3974| {
|3975|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3975|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|3976|3976| };
|3977|3977| 
|3978|3978| //// 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
|3975|3975| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|3976|3976| };
|3977|3977| 
|3978|    |-//// Helper functions to be called by the FSM ////
|    |3978|+// // Helper functions to be called by the FSM ////
|3979|3979| 
|3980|3980| UnitAI.prototype.GetWalkSpeed = function()
|3981|3981| {
|    | [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
|4644|4644| UnitAI.prototype.AttackEntityInZone = function(ents)
|4645|4645| {
|4646|4646| 	var target = ents.find(target =>
|4647|    |-		this.CanAttack(target)
|4648|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4647|+		this.CanAttack(target) &&
|    |4648|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4649|4649| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4650|4650| 	);
|4651|4651| 	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
|4645|4645| {
|4646|4646| 	var target = ents.find(target =>
|4647|4647| 		this.CanAttack(target)
|4648|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4649|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4648|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4649|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4650|4650| 	);
|4651|4651| 	if (!target)
|4652|4652| 		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
|4709|4709| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4710|4710| 	if (this.isGuardOf)
|4711|4711| 	{
|4712|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4712|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4713|4713| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4714|4714| 		if (cmpUnitAI && cmpAttack &&
|4715|4715| 		    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
|4713|4713| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4714|4714| 		if (cmpUnitAI && cmpAttack &&
|4715|4715| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4716|    |-				return false;
|    |4716|+			return false;
|4717|4717| 	}
|4718|4718| 
|4719|4719| 	// 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
|4751|4751| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4752|4752| 	if (this.isGuardOf)
|4753|4753| 	{
|4754|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4754|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4755|4755| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4756|4756| 		if (cmpUnitAI && cmpAttack &&
|4757|4757| 		    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
|4764|4764| 	return false;
|4765|4765| };
|4766|4766| 
|4767|    |-//// External interface functions ////
|    |4767|+// // External interface functions ////
|4768|4768| 
|4769|4769| UnitAI.prototype.SetFormationController = function(ent)
|4770|4770| {
|    | [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
|4920|4920| 	{
|4921|4921| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4922|4922| 			return;
|4923|    |-		else
|4924|    |-			this.RemoveGuard();
|    |4923|+		this.RemoveGuard();
|4925|4924| 	}
|4926|4925| 
|4927|4926| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|    | [NORMAL] ESLintBear (no-trailing-spaces):
|    | Trailing spaces not allowed.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5252|5252| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5253|5253| 	{
|5254|5254| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5255|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5255|+		if (cmpTrader.HasBothMarkets() &&
|5256|5256| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5257|5257| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5258|5258| 		{
|    | [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
|5533|5533| 				{
|5534|5534| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5535|5535| 					var targetClasses = this.order.data.targetClasses;
|5536|    |-					if (targetClasses.attack && cmpIdentity
|5537|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5536|+					if (targetClasses.attack && cmpIdentity &&
|    |5537|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5538|5538| 						continue;
|5539|5539| 					if (targetClasses.avoid && cmpIdentity
|5540|5540| 						&& 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
|5536|5536| 					if (targetClasses.attack && cmpIdentity
|5537|5537| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5538|5538| 						continue;
|5539|    |-					if (targetClasses.avoid && cmpIdentity
|5540|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5539|+					if (targetClasses.avoid && cmpIdentity &&
|    |5540|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5541|5541| 						continue;
|5542|5542| 					// Only used by the AIs to prevent some choices of targets
|5543|5543| 					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
|5559|5559| 		{
|5560|5560| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5561|5561| 			var targetClasses = this.order.data.targetClasses;
|5562|    |-			if (cmpIdentity && targetClasses.attack
|5563|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5562|+			if (cmpIdentity && targetClasses.attack &&
|    |5563|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5564|5564| 				continue;
|5565|5565| 			if (cmpIdentity && targetClasses.avoid
|5566|5566| 				&& 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
|5562|5562| 			if (cmpIdentity && targetClasses.attack
|5563|5563| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5564|5564| 				continue;
|5565|    |-			if (cmpIdentity && targetClasses.avoid
|5566|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5565|+			if (cmpIdentity && targetClasses.avoid &&
|    |5566|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5567|5567| 				continue;
|5568|5568| 			// Only used by the AIs to prevent some choices of targets
|5569|5569| 			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
|5719|5719| 
|5720|5720| UnitAI.prototype.SetHeldPosition = function(x, z)
|5721|5721| {
|5722|    |-	this.heldPosition = {"x": x, "z": z};
|    |5722|+	this.heldPosition = { "x": x, "z": z};
|5723|5723| };
|5724|5724| 
|5725|5725| 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
|5719|5719| 
|5720|5720| UnitAI.prototype.SetHeldPosition = function(x, z)
|5721|5721| {
|5722|    |-	this.heldPosition = {"x": x, "z": z};
|    |5722|+	this.heldPosition = {"x": x, "z": z };
|5723|5723| };
|5724|5724| 
|5725|5725| 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
|5746|5746| 	return false;
|5747|5747| };
|5748|5748| 
|5749|    |-//// Helper functions ////
|    |5749|+// // Helper functions ////
|5750|5750| 
|5751|5751| UnitAI.prototype.CanAttack = function(target)
|5752|5752| {
|    | [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
|5950|5950| 	return cmpPack && cmpPack.IsPacking();
|5951|5951| };
|5952|5952| 
|5953|    |-//// Formation specific functions ////
|    |5953|+// // Formation specific functions ////
|5954|5954| 
|5955|5955| UnitAI.prototype.IsAttackingAsFormation = function()
|5956|5956| {
|    | [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
|5955|5955| UnitAI.prototype.IsAttackingAsFormation = function()
|5956|5956| {
|5957|5957| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5958|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5959|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5958|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5959|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5960|5960| };
|5961|5961| 
|5962|5962| //// 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
|5959|5959| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5960|5960| };
|5961|5961| 
|5962|    |-//// Animal specific functions ////
|    |5962|+// // Animal specific functions ////
|5963|5963| 
|5964|5964| UnitAI.prototype.MoveRandomly = function(distance)
|5965|5965| {

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|3784| »   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
|4631| »   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
|4646| »   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
|4692| »   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
|4715| »   »   ····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
|1983| »   »   »   »   »   »   &&·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
|3746| »   »   var·order·=·{·"type":·type,·"data":·data·};
|    | [NORMAL] JSHintBear:
|    | 'order' is already defined.

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

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

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

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

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

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

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

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

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

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

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

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

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

Angen added a comment.EditedJan 16 2020, 9:57 AM

It would be better to write new function SetBuilders and pass whole array at once.
Next advantage is that all builders would be added at once and there will be just one message send.

Writing this down makes me think I should use the first approach

Yes

It would be better to write new function SetBuilders and pass whole array at once.

Perhaps one can pass the Map or Map keys instead of creating an array as well.
Just have to be careful then, since the object reference might be taken over in case of assigning it directly, instead of getting a copy.
(I suppose that shouldn't break serialization, since object references are serialized as well, but checking would be better than assuming.
Also two entities having the same object reference in their state means that they cant modify it as if they owned it exclusively, as every modification to the object would change the state of both entities. In this case the old entity is destructed, so that might not be a problem.)

Freagarach planned changes to this revision.Jan 16 2020, 8:29 PM
Freagarach edited the summary of this revision. (Show Details)
  • SetBuilders.
  • Send only one message when adding multiple builders.

Perhaps one can pass the Map or Map keys instead of creating an array as well.

I chose using an array because IMHO that is what people expect from this function.

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

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/1066/display/redirect

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

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

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

Linter detected issues:
Executing section Source...
Executing section JS...

binaries/data/mods/public/simulation/helpers/Transform.js
| 216| »   »   »   »   for·(let·ent·of·cmpNewObstruction.GetEntitiesDeletedUponConstruction())
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'ent' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/tests/test_Pack.js
|  44| »   "SetInterval":·(ent,·iid,·funcname,·time,·repeattime,·data)·=>·{·timerActivated·=·true;·return·7;·}
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'ent' is already declared in the upper scope.
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Foundation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Foundation.js
| 158| 158| 	let cmpVisual = Engine.QueryInterface(this.entity, IID_Visual);
| 159| 159| 	if (cmpVisual)
| 160| 160| 		cmpVisual.SetVariable("numbuilders", this.builders.size);
| 161|    |-}
|    | 161|+};
| 162| 162| 
| 163| 163| /**
| 164| 164|  * Adds a builder to the counter.

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

binaries/data/mods/public/simulation/components/Foundation.js
| 356| »   »   var·pos·=·cmpPosition.GetPosition2D();
|    | [NORMAL] JSHintBear:
|    | 'pos' is already defined.

binaries/data/mods/public/simulation/components/Foundation.js
| 358| »   »   var·rot·=·cmpPosition.GetRotation();
|    | [NORMAL] JSHintBear:
|    | 'rot' is already defined.
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Repairable.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Repairable.js
|  57|  57| {
|  58|  58| 	for (let builder of builders)
|  59|  59| 		this.AddBuilder(builder);
|  60|    |-}
|    |  60|+};
|  61|  61| 
|  62|  62| Repairable.prototype.AddBuilder = function(builderEnt)
|  63|  63| {

binaries/data/mods/public/simulation/components/Repairable.js
|  60| }
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 782| 782| 					this.FinishOrder();
| 783| 783| 					return;
| 784| 784| 				}
| 785|    |-				else
| 786|    |-				{
|    | 785|+				
| 787| 786| 					this.SetNextState("GARRISON.APPROACHING");
| 788| 787| 					return;
| 789|    |-				}
|    | 788|+				
| 790| 789| 			}
| 791| 790| 
| 792| 791| 			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
|1054|1054| 			},
|1055|1055| 		},
|1056|1056| 
|1057|    |-		"GARRISON":{
|    |1057|+		"GARRISON": {
|1058|1058| 			"APPROACHING": {
|1059|1059| 				"enter": function() {
|1060|1060| 					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
|2032|2032| 
|2033|2033| 				"Attacked": function(msg) {
|2034|2034| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2035|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2036|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2035|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2036|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2037|2037| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2038|2038| 				},
|2039|2039| 			},
|    | [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
|2770|2770| 					{
|2771|2771| 						// The building was already finished/fully repaired before we arrived;
|2772|2772| 						// let the ConstructionFinished handler handle this.
|2773|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2773|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2774|2774| 						return true;
|2775|2775| 					}
|2776|2776| 
|    | [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
|2770|2770| 					{
|2771|2771| 						// The building was already finished/fully repaired before we arrived;
|2772|2772| 						// let the ConstructionFinished handler handle this.
|2773|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2773|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2774|2774| 						return true;
|2775|2775| 					}
|2776|2776| 
|    | [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
|3068|3068| 				this.StopTimer();
|3069|3069| 				this.ResetAnimation();
|3070|3070| 				if (this.formationAnimationVariant)
|3071|    |-					this.SetAnimationVariant(this.formationAnimationVariant)
|    |3071|+					this.SetAnimationVariant(this.formationAnimationVariant);
|3072|3072| 				else
|3073|3073| 					this.SetDefaultAnimationVariant();
|3074|3074| 				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
|3294|3294| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3295|3295| 
|3296|3296| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3297|    |-							// only used for domestic animals
|    |3297|+		// only used for domestic animals
|3298|3298| 	},
|3299|3299| };
|3300|3300| 
|    | [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
|3353|3353| 
|3354|3354| UnitAI.prototype.IsAnimal = function()
|3355|3355| {
|3356|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3356|+	return (!!this.template.NaturalBehaviour);
|3357|3357| };
|3358|3358| 
|3359|3359| 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
|3469|3469| 		{
|3470|3470| 			let index = this.GetCurrentState().indexOf(".");
|3471|3471| 			if (index != -1)
|3472|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3472|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3473|3473| 			this.Stop(false);
|3474|3474| 		}
|3475|3475| 
|    | [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
|3525|3525| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3526|3526| 			continue;
|3527|3527| 		if (i == 0)
|3528|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3528|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3529|3529| 		else
|3530|3530| 			this.orderQueue.splice(i, 1);
|3531|3531| 		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
|3525|3525| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3526|3526| 			continue;
|3527|3527| 		if (i == 0)
|3528|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3528|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3529|3529| 		else
|3530|3530| 			this.orderQueue.splice(i, 1);
|3531|3531| 		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
|3609|3609| };
|3610|3610| 
|3611|3611| 
|3612|    |-//// FSM linkage functions ////
|    |3612|+// // FSM linkage functions ////
|3613|3613| 
|3614|3614| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3615|3615| 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
|3780|3780| 				continue;
|3781|3781| 			if (this.orderQueue[i].type == type)
|3782|3782| 				continue;
|3783|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3783|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3784|3784| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3785|3785| 			return;
|3786|3786| 		}
|    | [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
|3780|3780| 				continue;
|3781|3781| 			if (this.orderQueue[i].type == type)
|3782|3782| 				continue;
|3783|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3783|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3784|3784| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3785|3785| 			return;
|3786|3786| 		}
|    | [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
|4022|4022| 	if (data.timerRepeat === undefined)
|4023|4023| 		this.timer = undefined;
|4024|4024| 
|4025|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4025|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4026|4026| };
|4027|4027| 
|4028|4028| /**
|    | [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
|4022|4022| 	if (data.timerRepeat === undefined)
|4023|4023| 		this.timer = undefined;
|4024|4024| 
|4025|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4025|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4026|4026| };
|4027|4027| 
|4028|4028| /**
|    | [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
|4067|4067| 	// TODO: This is a bit inefficient since every unit listens to every
|4068|4068| 	// construction message - ideally we could scope it to only the one we're building
|4069|4069| 
|4070|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4070|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4071|4071| };
|4072|4072| 
|4073|4073| 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
|4067|4067| 	// TODO: This is a bit inefficient since every unit listens to every
|4068|4068| 	// construction message - ideally we could scope it to only the one we're building
|4069|4069| 
|4070|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4070|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4071|4071| };
|4072|4072| 
|4073|4073| 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
|4098|4098| 
|4099|4099| UnitAI.prototype.OnAttacked = function(msg)
|4100|4100| {
|4101|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4101|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4102|4102| };
|4103|4103| 
|4104|4104| 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
|4098|4098| 
|4099|4099| UnitAI.prototype.OnAttacked = function(msg)
|4100|4100| {
|4101|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4101|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4102|4102| };
|4103|4103| 
|4104|4104| 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
|4103|4103| 
|4104|4104| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4105|4105| {
|4106|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4106|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4107|4107| };
|4108|4108| 
|4109|4109| 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
|4103|4103| 
|4104|4104| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4105|4105| {
|4106|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4106|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4107|4107| };
|4108|4108| 
|4109|4109| 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
|4108|4108| 
|4109|4109| UnitAI.prototype.OnHealthChanged = function(msg)
|4110|4110| {
|4111|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4111|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4112|4112| };
|4113|4113| 
|4114|4114| 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
|4108|4108| 
|4109|4109| UnitAI.prototype.OnHealthChanged = function(msg)
|4110|4110| {
|4111|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4111|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4112|4112| };
|4113|4113| 
|4114|4114| 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
|4114|4114| UnitAI.prototype.OnRangeUpdate = function(msg)
|4115|4115| {
|4116|4116| 	if (msg.tag == this.losRangeQuery)
|4117|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4117|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4118|4118| 	else if (msg.tag == this.losHealRangeQuery)
|4119|4119| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4120|4120| };
|    | [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
|4114|4114| UnitAI.prototype.OnRangeUpdate = function(msg)
|4115|4115| {
|4116|4116| 	if (msg.tag == this.losRangeQuery)
|4117|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4117|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4118|4118| 	else if (msg.tag == this.losHealRangeQuery)
|4119|4119| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4120|4120| };
|    | [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
|4116|4116| 	if (msg.tag == this.losRangeQuery)
|4117|4117| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4118|4118| 	else if (msg.tag == this.losHealRangeQuery)
|4119|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4119|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4120|4120| };
|4121|4121| 
|4122|4122| 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
|4116|4116| 	if (msg.tag == this.losRangeQuery)
|4117|4117| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4118|4118| 	else if (msg.tag == this.losHealRangeQuery)
|4119|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4119|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4120|4120| };
|4121|4121| 
|4122|4122| 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
|4121|4121| 
|4122|4122| UnitAI.prototype.OnPackFinished = function(msg)
|4123|4123| {
|4124|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4124|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4125|4125| };
|4126|4126| 
|4127|4127| //// 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
|4121|4121| 
|4122|4122| UnitAI.prototype.OnPackFinished = function(msg)
|4123|4123| {
|4124|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4124|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4125|4125| };
|4126|4126| 
|4127|4127| //// 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
|4124|4124| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4125|4125| };
|4126|4126| 
|4127|    |-//// Helper functions to be called by the FSM ////
|    |4127|+// // Helper functions to be called by the FSM ////
|4128|4128| 
|4129|4129| UnitAI.prototype.GetWalkSpeed = function()
|4130|4130| {
|    | [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
|4789|4789| UnitAI.prototype.AttackEntityInZone = function(ents)
|4790|4790| {
|4791|4791| 	var target = ents.find(target =>
|4792|    |-		this.CanAttack(target)
|4793|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4792|+		this.CanAttack(target) &&
|    |4793|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4794|4794| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4795|4795| 	);
|4796|4796| 	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
|4790|4790| {
|4791|4791| 	var target = ents.find(target =>
|4792|4792| 		this.CanAttack(target)
|4793|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4794|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4793|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4794|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4795|4795| 	);
|4796|4796| 	if (!target)
|4797|4797| 		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
|4854|4854| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4855|4855| 	if (this.isGuardOf)
|4856|4856| 	{
|4857|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4857|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4858|4858| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4859|4859| 		if (cmpUnitAI && cmpAttack &&
|4860|4860| 		    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
|4858|4858| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4859|4859| 		if (cmpUnitAI && cmpAttack &&
|4860|4860| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4861|    |-				return false;
|    |4861|+			return false;
|4862|4862| 	}
|4863|4863| 
|4864|4864| 	// 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
|4896|4896| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4897|4897| 	if (this.isGuardOf)
|4898|4898| 	{
|4899|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4899|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4900|4900| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4901|4901| 		if (cmpUnitAI && cmpAttack &&
|4902|4902| 		    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
|4909|4909| 	return false;
|4910|4910| };
|4911|4911| 
|4912|    |-//// External interface functions ////
|    |4912|+// // External interface functions ////
|4913|4913| 
|4914|4914| UnitAI.prototype.SetFormationController = function(ent)
|4915|4915| {
|    | [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
|5065|5065| 	{
|5066|5066| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5067|5067| 			return;
|5068|    |-		else
|5069|    |-			this.RemoveGuard();
|    |5068|+		this.RemoveGuard();
|5070|5069| 	}
|5071|5070| 
|5072|5071| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|    | [NORMAL] ESLintBear (no-trailing-spaces):
|    | Trailing spaces not allowed.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5407|5407| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5408|5408| 	{
|5409|5409| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5410|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5410|+		if (cmpTrader.HasBothMarkets() &&
|5411|5411| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5412|5412| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5413|5413| 		{
|    | [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
|5688|5688| 				{
|5689|5689| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5690|5690| 					var targetClasses = this.order.data.targetClasses;
|5691|    |-					if (targetClasses.attack && cmpIdentity
|5692|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5691|+					if (targetClasses.attack && cmpIdentity &&
|    |5692|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5693|5693| 						continue;
|5694|5694| 					if (targetClasses.avoid && cmpIdentity
|5695|5695| 						&& 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
|5691|5691| 					if (targetClasses.attack && cmpIdentity
|5692|5692| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5693|5693| 						continue;
|5694|    |-					if (targetClasses.avoid && cmpIdentity
|5695|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5694|+					if (targetClasses.avoid && cmpIdentity &&
|    |5695|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5696|5696| 						continue;
|5697|5697| 					// Only used by the AIs to prevent some choices of targets
|5698|5698| 					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
|5714|5714| 		{
|5715|5715| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5716|5716| 			var targetClasses = this.order.data.targetClasses;
|5717|    |-			if (cmpIdentity && targetClasses.attack
|5718|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5717|+			if (cmpIdentity && targetClasses.attack &&
|    |5718|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5719|5719| 				continue;
|5720|5720| 			if (cmpIdentity && targetClasses.avoid
|5721|5721| 				&& 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
|5717|5717| 			if (cmpIdentity && targetClasses.attack
|5718|5718| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5719|5719| 				continue;
|5720|    |-			if (cmpIdentity && targetClasses.avoid
|5721|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5720|+			if (cmpIdentity && targetClasses.avoid &&
|    |5721|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5722|5722| 				continue;
|5723|5723| 			// Only used by the AIs to prevent some choices of targets
|5724|5724| 			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
|5874|5874| 
|5875|5875| UnitAI.prototype.SetHeldPosition = function(x, z)
|5876|5876| {
|5877|    |-	this.heldPosition = {"x": x, "z": z};
|    |5877|+	this.heldPosition = { "x": x, "z": z};
|5878|5878| };
|5879|5879| 
|5880|5880| 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
|5874|5874| 
|5875|5875| UnitAI.prototype.SetHeldPosition = function(x, z)
|5876|5876| {
|5877|    |-	this.heldPosition = {"x": x, "z": z};
|    |5877|+	this.heldPosition = {"x": x, "z": z };
|5878|5878| };
|5879|5879| 
|5880|5880| 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
|5901|5901| 	return false;
|5902|5902| };
|5903|5903| 
|5904|    |-//// Helper functions ////
|    |5904|+// // Helper functions ////
|5905|5905| 
|5906|5906| UnitAI.prototype.CanAttack = function(target)
|5907|5907| {
|    | [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
|6105|6105| 	return cmpPack && cmpPack.IsPacking();
|6106|6106| };
|6107|6107| 
|6108|    |-//// Formation specific functions ////
|    |6108|+// // Formation specific functions ////
|6109|6109| 
|6110|6110| UnitAI.prototype.IsAttackingAsFormation = function()
|6111|6111| {
|    | [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
|6110|6110| UnitAI.prototype.IsAttackingAsFormation = function()
|6111|6111| {
|6112|6112| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6113|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6114|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6113|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6114|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6115|6115| };
|6116|6116| 
|6117|6117| //// 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
|6114|6114| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6115|6115| };
|6116|6116| 
|6117|    |-//// Animal specific functions ////
|    |6117|+// // Animal specific functions ////
|6118|6118| 
|6119|6119| UnitAI.prototype.MoveRandomly = function(distance)
|6120|6120| {

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

binaries/data/mods/public/simulation/components/UnitAI.js
|3927| »   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
|4776| »   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
|4791| »   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
|4837| »   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
|4860| »   »   ····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
|2036| »   »   »   »   »   »   &&·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
|3071| »   »   »   »   »   this.SetAnimationVariant(this.formationAnimationVariant)
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Stan added inline comments.Jan 16 2020, 10:16 PM
binaries/data/mods/public/simulation/components/Foundation.js
166 ↗(On Diff #11059)

Documentation for the param?

Angen requested changes to this revision.Jan 17 2020, 9:12 AM

some small things

binaries/data/mods/public/simulation/components/Foundation.js
145 ↗(On Diff #11059)

remove one but

155 ↗(On Diff #11059)

while here, reuse Engine.QueryInterface(builderEnt, IID_Builder).GetRate()

156 ↗(On Diff #11059)

this can be computed once per inserting too, move it to functions calling this one pls

168 ↗(On Diff #11059)

better to return true/false and send message below only when true

This revision now requires changes to proceed.Jan 17 2020, 9:12 AM
Freagarach updated this revision to Diff 11076.Jan 17 2020, 8:53 PM
Freagarach marked 6 inline comments as done.
  • Handle builders changed function in Foundation.js.
  • Comment for @param.

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

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/1073/display/redirect

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

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

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

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

Angen added inline comments.Jan 19 2020, 1:32 PM
binaries/data/mods/public/simulation/components/Foundation.js
138 ↗(On Diff #11076)

just wondering if changed = changed && this.AddSingleBuilder(builder) would not be better than if here

147 ↗(On Diff #11076)

ideally this should not be here, but instead inform that function calling this needs to send message, or something in way that this one is not sending the message

153 ↗(On Diff #11076)

just thinking maybe AddBuilderHelper ?

binaries/data/mods/public/simulation/components/UnitAI.js
4101 ↗(On Diff #11076)

probably no, because this did not changed order data and would be already true anyway because looping above and this is not changing order data

unless you can brake it somehow, but i dont see it currenlty

Freagarach marked 4 inline comments as done.Jan 21 2020, 8:38 PM
Freagarach added inline comments.
binaries/data/mods/public/simulation/components/Foundation.js
138 ↗(On Diff #11076)

It won't ever become true then, right?

147 ↗(On Diff #11076)

The message wasn't sent here anymore anyway :)

153 ↗(On Diff #11076)

Sounds wonky but still better than AddSingleBuilder ;)

Freagarach updated this revision to Diff 11140.Jan 21 2020, 8:38 PM
Freagarach marked 3 inline comments as done.
  • Remove if in addBuilder.
  • AddSingleBuilder -> AddBuilderHelper.
  • Don't say orders have changed when they might have not been.

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

Linter detected issues:
Executing section Source...
Executing section JS...

binaries/data/mods/public/simulation/components/tests/test_Pack.js
|  44| »   "SetInterval":·(ent,·iid,·funcname,·time,·repeattime,·data)·=>·{·timerActivated·=·true;·return·7;·}
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'ent' is already declared in the upper scope.
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Foundation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Foundation.js
| 157| 157| 	this.totalBuilderRate += buildRate;
| 158| 158| 
| 159| 159| 	return true;
| 160|    |-}
|    | 160|+};
| 161| 161| 
| 162| 162| /**
| 163| 163|  * Adds a builder to the counter.
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Foundation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Foundation.js
| 192| 192| 		cmpVisual.SetVariable("numbuilders", this.builders.size);
| 193| 193| 
| 194| 194| 	Engine.PostMessage(this.entity, MT_FoundationBuildersChanged, { "to": this.GetBuilders() });
| 195|    |-}
|    | 195|+};
| 196| 196| 
| 197| 197| /**
| 198| 198|  * The build multiplier is a penalty that is applied to each builder.

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

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

binaries/data/mods/public/simulation/components/Foundation.js
| 365| »   »   var·pos·=·cmpPosition.GetPosition2D();
|    | [NORMAL] JSHintBear:
|    | 'pos' is already defined.

binaries/data/mods/public/simulation/components/Foundation.js
| 367| »   »   var·rot·=·cmpPosition.GetRotation();
|    | [NORMAL] JSHintBear:
|    | 'rot' is already defined.

binaries/data/mods/public/simulation/helpers/Transform.js
| 216| »   »   »   »   for·(let·ent·of·cmpNewObstruction.GetEntitiesDeletedUponConstruction())
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'ent' is already declared in the upper scope.
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Repairable.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Repairable.js
|  57|  57| {
|  58|  58| 	for (let builder of builders)
|  59|  59| 		this.AddBuilder(builder);
|  60|    |-}
|    |  60|+};
|  61|  61| 
|  62|  62| Repairable.prototype.AddBuilder = function(builderEnt)
|  63|  63| {

binaries/data/mods/public/simulation/components/Repairable.js
|  60| }
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 788| 788| 					this.FinishOrder();
| 789| 789| 					return;
| 790| 790| 				}
| 791|    |-				else
| 792|    |-				{
|    | 791|+				
| 793| 792| 					this.SetNextState("GARRISON.APPROACHING");
| 794| 793| 					return;
| 795|    |-				}
|    | 794|+				
| 796| 795| 			}
| 797| 796| 
| 798| 797| 			this.SetNextState("GARRISON.GARRISONING");
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'GARRISON'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1060|1060| 			},
|1061|1061| 		},
|1062|1062| 
|1063|    |-		"GARRISON":{
|    |1063|+		"GARRISON": {
|1064|1064| 			"APPROACHING": {
|1065|1065| 				"enter": function() {
|1066|1066| 					if (!this.MoveToGarrisonRange(this.order.data.target))
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2038|2038| 
|2039|2039| 				"Attacked": function(msg) {
|2040|2040| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2041|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2042|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2041|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2042|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2043|2043| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2044|2044| 				},
|2045|2045| 			},
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2776|2776| 					{
|2777|2777| 						// The building was already finished/fully repaired before we arrived;
|2778|2778| 						// let the ConstructionFinished handler handle this.
|2779|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2779|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2780|2780| 						return true;
|2781|2781| 					}
|2782|2782| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2776|2776| 					{
|2777|2777| 						// The building was already finished/fully repaired before we arrived;
|2778|2778| 						// let the ConstructionFinished handler handle this.
|2779|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2779|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2780|2780| 						return true;
|2781|2781| 					}
|2782|2782| 
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3074|3074| 				this.StopTimer();
|3075|3075| 				this.ResetAnimation();
|3076|3076| 				if (this.formationAnimationVariant)
|3077|    |-					this.SetAnimationVariant(this.formationAnimationVariant)
|    |3077|+					this.SetAnimationVariant(this.formationAnimationVariant);
|3078|3078| 				else
|3079|3079| 					this.SetDefaultAnimationVariant();
|3080|3080| 				var cmpResistance = Engine.QueryInterface(this.entity, IID_Resistance);
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 7.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3300|3300| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3301|3301| 
|3302|3302| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3303|    |-							// only used for domestic animals
|    |3303|+		// only used for domestic animals
|3304|3304| 
|3305|3305| 		// Reuse the same garrison behaviour for animals.
|3306|3306| 		"GARRISON": "INDIVIDUAL.GARRISON",
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3362|3362| 
|3363|3363| UnitAI.prototype.IsAnimal = function()
|3364|3364| {
|3365|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3365|+	return (!!this.template.NaturalBehaviour);
|3366|3366| };
|3367|3367| 
|3368|3368| UnitAI.prototype.IsDangerousAnimal = function()
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3478|3478| 		{
|3479|3479| 			let index = this.GetCurrentState().indexOf(".");
|3480|3480| 			if (index != -1)
|3481|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3481|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3482|3482| 			this.Stop(false);
|3483|3483| 		}
|3484|3484| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3534|3534| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3535|3535| 			continue;
|3536|3536| 		if (i == 0)
|3537|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3537|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3538|3538| 		else
|3539|3539| 			this.orderQueue.splice(i, 1);
|3540|3540| 		Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3534|3534| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3535|3535| 			continue;
|3536|3536| 		if (i == 0)
|3537|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3537|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3538|3538| 		else
|3539|3539| 			this.orderQueue.splice(i, 1);
|3540|3540| 		Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3618|3618| };
|3619|3619| 
|3620|3620| 
|3621|    |-//// FSM linkage functions ////
|    |3621|+// // FSM linkage functions ////
|3622|3622| 
|3623|3623| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3624|3624| 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
|3789|3789| 				continue;
|3790|3790| 			if (this.orderQueue[i].type == type)
|3791|3791| 				continue;
|3792|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3792|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3793|3793| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3794|3794| 			return;
|3795|3795| 		}
|    | [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
|3789|3789| 				continue;
|3790|3790| 			if (this.orderQueue[i].type == type)
|3791|3791| 				continue;
|3792|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3792|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3793|3793| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3794|3794| 			return;
|3795|3795| 		}
|    | [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
|4031|4031| 	if (data.timerRepeat === undefined)
|4032|4032| 		this.timer = undefined;
|4033|4033| 
|4034|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4034|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4035|4035| };
|4036|4036| 
|4037|4037| /**
|    | [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
|4031|4031| 	if (data.timerRepeat === undefined)
|4032|4032| 		this.timer = undefined;
|4033|4033| 
|4034|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4034|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4035|4035| };
|4036|4036| 
|4037|4037| /**
|    | [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
|4076|4076| 	// TODO: This is a bit inefficient since every unit listens to every
|4077|4077| 	// construction message - ideally we could scope it to only the one we're building
|4078|4078| 
|4079|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4079|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4080|4080| };
|4081|4081| 
|4082|4082| 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
|4076|4076| 	// TODO: This is a bit inefficient since every unit listens to every
|4077|4077| 	// construction message - ideally we could scope it to only the one we're building
|4078|4078| 
|4079|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4079|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4080|4080| };
|4081|4081| 
|4082|4082| 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
|4104|4104| 
|4105|4105| UnitAI.prototype.OnAttacked = function(msg)
|4106|4106| {
|4107|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4107|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4108|4108| };
|4109|4109| 
|4110|4110| 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
|4104|4104| 
|4105|4105| UnitAI.prototype.OnAttacked = function(msg)
|4106|4106| {
|4107|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4107|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4108|4108| };
|4109|4109| 
|4110|4110| 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
|4109|4109| 
|4110|4110| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4111|4111| {
|4112|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4112|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4113|4113| };
|4114|4114| 
|4115|4115| 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
|4109|4109| 
|4110|4110| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4111|4111| {
|4112|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4112|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4113|4113| };
|4114|4114| 
|4115|4115| 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
|4114|4114| 
|4115|4115| UnitAI.prototype.OnHealthChanged = function(msg)
|4116|4116| {
|4117|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4117|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4118|4118| };
|4119|4119| 
|4120|4120| 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
|4114|4114| 
|4115|4115| UnitAI.prototype.OnHealthChanged = function(msg)
|4116|4116| {
|4117|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4117|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4118|4118| };
|4119|4119| 
|4120|4120| 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
|4120|4120| UnitAI.prototype.OnRangeUpdate = function(msg)
|4121|4121| {
|4122|4122| 	if (msg.tag == this.losRangeQuery)
|4123|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4123|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4124|4124| 	else if (msg.tag == this.losHealRangeQuery)
|4125|4125| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4126|4126| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4120|4120| UnitAI.prototype.OnRangeUpdate = function(msg)
|4121|4121| {
|4122|4122| 	if (msg.tag == this.losRangeQuery)
|4123|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4123|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4124|4124| 	else if (msg.tag == this.losHealRangeQuery)
|4125|4125| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4126|4126| };
|    | [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
|4122|4122| 	if (msg.tag == this.losRangeQuery)
|4123|4123| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4124|4124| 	else if (msg.tag == this.losHealRangeQuery)
|4125|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4125|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4126|4126| };
|4127|4127| 
|4128|4128| 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
|4122|4122| 	if (msg.tag == this.losRangeQuery)
|4123|4123| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4124|4124| 	else if (msg.tag == this.losHealRangeQuery)
|4125|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4125|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4126|4126| };
|4127|4127| 
|4128|4128| 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
|4127|4127| 
|4128|4128| UnitAI.prototype.OnPackFinished = function(msg)
|4129|4129| {
|4130|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4130|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4131|4131| };
|4132|4132| 
|4133|4133| //// 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
|4127|4127| 
|4128|4128| UnitAI.prototype.OnPackFinished = function(msg)
|4129|4129| {
|4130|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4130|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4131|4131| };
|4132|4132| 
|4133|4133| //// 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
|4130|4130| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4131|4131| };
|4132|4132| 
|4133|    |-//// Helper functions to be called by the FSM ////
|    |4133|+// // Helper functions to be called by the FSM ////
|4134|4134| 
|4135|4135| UnitAI.prototype.GetWalkSpeed = function()
|4136|4136| {
|    | [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
|4795|4795| UnitAI.prototype.AttackEntityInZone = function(ents)
|4796|4796| {
|4797|4797| 	var target = ents.find(target =>
|4798|    |-		this.CanAttack(target)
|4799|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4798|+		this.CanAttack(target) &&
|    |4799|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4800|4800| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4801|4801| 	);
|4802|4802| 	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
|4796|4796| {
|4797|4797| 	var target = ents.find(target =>
|4798|4798| 		this.CanAttack(target)
|4799|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4800|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4799|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4800|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4801|4801| 	);
|4802|4802| 	if (!target)
|4803|4803| 		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
|4860|4860| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4861|4861| 	if (this.isGuardOf)
|4862|4862| 	{
|4863|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4863|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4864|4864| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4865|4865| 		if (cmpUnitAI && cmpAttack &&
|4866|4866| 		    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
|4864|4864| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4865|4865| 		if (cmpUnitAI && cmpAttack &&
|4866|4866| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4867|    |-				return false;
|    |4867|+			return false;
|4868|4868| 	}
|4869|4869| 
|4870|4870| 	// 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
|4902|4902| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4903|4903| 	if (this.isGuardOf)
|4904|4904| 	{
|4905|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4905|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4906|4906| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4907|4907| 		if (cmpUnitAI && cmpAttack &&
|4908|4908| 		    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
|4915|4915| 	return false;
|4916|4916| };
|4917|4917| 
|4918|    |-//// External interface functions ////
|    |4918|+// // External interface functions ////
|4919|4919| 
|4920|4920| UnitAI.prototype.SetFormationController = function(ent)
|4921|4921| {
|    | [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
|5071|5071| 	{
|5072|5072| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5073|5073| 			return;
|5074|    |-		else
|5075|    |-			this.RemoveGuard();
|    |5074|+		this.RemoveGuard();
|5076|5075| 	}
|5077|5076| 
|5078|5077| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|    | [NORMAL] ESLintBear (no-trailing-spaces):
|    | Trailing spaces not allowed.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5413|5413| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5414|5414| 	{
|5415|5415| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5416|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5416|+		if (cmpTrader.HasBothMarkets() &&
|5417|5417| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5418|5418| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5419|5419| 		{
|    | [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
|5694|5694| 				{
|5695|5695| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5696|5696| 					var targetClasses = this.order.data.targetClasses;
|5697|    |-					if (targetClasses.attack && cmpIdentity
|5698|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5697|+					if (targetClasses.attack && cmpIdentity &&
|    |5698|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5699|5699| 						continue;
|5700|5700| 					if (targetClasses.avoid && cmpIdentity
|5701|5701| 						&& 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
|5697|5697| 					if (targetClasses.attack && cmpIdentity
|5698|5698| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5699|5699| 						continue;
|5700|    |-					if (targetClasses.avoid && cmpIdentity
|5701|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5700|+					if (targetClasses.avoid && cmpIdentity &&
|    |5701|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5702|5702| 						continue;
|5703|5703| 					// Only used by the AIs to prevent some choices of targets
|5704|5704| 					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
|5720|5720| 		{
|5721|5721| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5722|5722| 			var targetClasses = this.order.data.targetClasses;
|5723|    |-			if (cmpIdentity && targetClasses.attack
|5724|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5723|+			if (cmpIdentity && targetClasses.attack &&
|    |5724|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5725|5725| 				continue;
|5726|5726| 			if (cmpIdentity && targetClasses.avoid
|5727|5727| 				&& 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
|5723|5723| 			if (cmpIdentity && targetClasses.attack
|5724|5724| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5725|5725| 				continue;
|5726|    |-			if (cmpIdentity && targetClasses.avoid
|5727|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5726|+			if (cmpIdentity && targetClasses.avoid &&
|    |5727|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5728|5728| 				continue;
|5729|5729| 			// Only used by the AIs to prevent some choices of targets
|5730|5730| 			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
|5880|5880| 
|5881|5881| UnitAI.prototype.SetHeldPosition = function(x, z)
|5882|5882| {
|5883|    |-	this.heldPosition = {"x": x, "z": z};
|    |5883|+	this.heldPosition = { "x": x, "z": z};
|5884|5884| };
|5885|5885| 
|5886|5886| 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
|5880|5880| 
|5881|5881| UnitAI.prototype.SetHeldPosition = function(x, z)
|5882|5882| {
|5883|    |-	this.heldPosition = {"x": x, "z": z};
|    |5883|+	this.heldPosition = {"x": x, "z": z };
|5884|5884| };
|5885|5885| 
|5886|5886| 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
|5907|5907| 	return false;
|5908|5908| };
|5909|5909| 
|5910|    |-//// Helper functions ////
|    |5910|+// // Helper functions ////
|5911|5911| 
|5912|5912| UnitAI.prototype.CanAttack = function(target)
|5913|5913| {
|    | [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
|6105|6105| 	return cmpPack && cmpPack.IsPacking();
|6106|6106| };
|6107|6107| 
|6108|    |-//// Formation specific functions ////
|    |6108|+// // Formation specific functions ////
|6109|6109| 
|6110|6110| UnitAI.prototype.IsAttackingAsFormation = function()
|6111|6111| {
|    | [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
|6110|6110| UnitAI.prototype.IsAttackingAsFormation = function()
|6111|6111| {
|6112|6112| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6113|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6114|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6113|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6114|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6115|6115| };
|6116|6116| 
|6117|6117| //// 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
|6114|6114| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6115|6115| };
|6116|6116| 
|6117|    |-//// Animal specific functions ////
|    |6117|+// // Animal specific functions ////
|6118|6118| 
|6119|6119| UnitAI.prototype.MoveRandomly = function(distance)
|6120|6120| {

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|3936| »   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
|4782| »   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
|4797| »   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
|4843| »   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
|4866| »   »   ····cmpAttack.GetAttackTypes().some(type·=>·cmpUnitAI.CheckTargetAttackRange(this.isGuardOf,·type)))
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'type' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|2042| »   »   »   »   »   »   &&·this.order.data.target·!=·msg.data.attacker·&&·this.GetBestAttackAgainst(msg.data.attacker,·true)·!=·"Capture")
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
|3077| »   »   »   »   »   this.SetAnimationVariant(this.formationAnimationVariant)
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Angen added inline comments.Jan 22 2020, 8:57 AM
binaries/data/mods/public/simulation/components/Foundation.js
138 ↗(On Diff #11076)

yeah, my bad :) || is correct

Angen accepted this revision.Thu, Jan 23, 6:52 PM

Changed code is good.
Number of builders is correctly updated when repaired entity is transformed.
Builders continue to repair/construct when target is renamed.

This revision is now accepted and ready to land.Thu, Jan 23, 6:52 PM
Freagarach marked an inline comment as done.Thu, Jan 23, 6:54 PM
Freagarach added inline comments.
binaries/data/mods/public/simulation/components/Foundation.js
138 ↗(On Diff #11076)

Oh, sorry my comment was not supposed to be placed ;)

This revision was automatically updated to reflect the committed changes.
Angen added a comment.Mon, Jan 27, 6:16 PM

Thank you for patch :)

Freagarach marked an inline comment as done.Mon, Jan 27, 7:19 PM

Thanks @Angen for the review :)