Page MenuHomeWildfire Games

Define auto-gather/-build ranges in template.
Changes PlannedPublic

Authored by Freagarach on Jan 1 2020, 7:42 PM.

Details

Reviewers
None
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Trac Tickets
#5657
Summary

The current range for looking for new gathering targets or foundations to build is hard-coded to 64.

A "problem" with that is that sometimes units don't gather targets while it looks like they should be in range (because the player does not know the 64 only the vision range, although the latter also only empirically.), see #5657. It also means that the value cannot be modded easily.

This patch defines the auto-gather/-build rates in the templates of their respective components, so that they can be tweaked more easily.
The increasing of the range can be done in a seperate patch.

Test Plan

Verify that the unit test map loads as usual (also checkrefs) and that units still auto-gather/-build as usual.

Event Timeline

Freagarach created this revision.Jan 1 2020, 7:42 PM
Vulcan added a comment.Jan 1 2020, 7:44 PM

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

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

Vulcan added a comment.Jan 1 2020, 7:46 PM

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

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

Vulcan added a comment.Jan 1 2020, 7:48 PM

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [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
| 780| 780| 					this.FinishOrder();
| 781| 781| 					return;
| 782| 782| 				}
| 783|    |-				else
| 784|    |-				{
|    | 783|+				
| 785| 784| 					this.SetNextState("GARRISON.APPROACHING");
| 786| 785| 					return;
| 787|    |-				}
|    | 786|+				
| 788| 787| 			}
| 789| 788| 
| 790| 789| 			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
|1052|1052| 			},
|1053|1053| 		},
|1054|1054| 
|1055|    |-		"GARRISON":{
|    |1055|+		"GARRISON": {
|1056|1056| 			"APPROACHING": {
|1057|1057| 				"enter": function() {
|1058|1058| 					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
|2023|2023| 
|2024|2024| 				"Attacked": function(msg) {
|2025|2025| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2026|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2027|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2026|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2027|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2028|2028| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2029|2029| 				},
|2030|2030| 			},
|    | [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
|2758|2758| 					{
|2759|2759| 						// The building was already finished/fully repaired before we arrived;
|2760|2760| 						// let the ConstructionFinished handler handle this.
|2761|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2761|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2762|2762| 						return true;
|2763|2763| 					}
|2764|2764| 
|    | [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
|2758|2758| 					{
|2759|2759| 						// The building was already finished/fully repaired before we arrived;
|2760|2760| 						// let the ConstructionFinished handler handle this.
|2761|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2761|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2762|2762| 						return true;
|2763|2763| 					}
|2764|2764| 
|    | [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
|3278|3278| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3279|3279| 
|3280|3280| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3281|    |-							// only used for domestic animals
|    |3281|+		// only used for domestic animals
|3282|3282| 	},
|3283|3283| };
|3284|3284| 
|    | [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
|3335|3335| 
|3336|3336| UnitAI.prototype.IsAnimal = function()
|3337|3337| {
|3338|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3338|+	return (!!this.template.NaturalBehaviour);
|3339|3339| };
|3340|3340| 
|3341|3341| 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
|3451|3451| 		{
|3452|3452| 			let index = this.GetCurrentState().indexOf(".");
|3453|3453| 			if (index != -1)
|3454|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3454|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3455|3455| 			this.Stop(false);
|3456|3456| 		}
|3457|3457| 
|    | [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
|3507|3507| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3508|3508| 			continue;
|3509|3509| 		if (i == 0)
|3510|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3510|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3511|3511| 		else
|3512|3512| 			this.orderQueue.splice(i, 1);
|3513|3513| 		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
|3507|3507| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3508|3508| 			continue;
|3509|3509| 		if (i == 0)
|3510|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3510|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3511|3511| 		else
|3512|3512| 			this.orderQueue.splice(i, 1);
|3513|3513| 		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
|3591|3591| };
|3592|3592| 
|3593|3593| 
|3594|    |-//// FSM linkage functions ////
|    |3594|+// // FSM linkage functions ////
|3595|3595| 
|3596|3596| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3597|3597| 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
|3761|3761| 				continue;
|3762|3762| 			if (this.orderQueue[i].type == type)
|3763|3763| 				continue;
|3764|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3764|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3765|3765| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3766|3766| 			return;
|3767|3767| 		}
|    | [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
|3761|3761| 				continue;
|3762|3762| 			if (this.orderQueue[i].type == type)
|3763|3763| 				continue;
|3764|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3764|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3765|3765| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3766|3766| 			return;
|3767|3767| 		}
|    | [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
|4003|4003| 	if (data.timerRepeat === undefined)
|4004|4004| 		this.timer = undefined;
|4005|4005| 
|4006|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4006|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4007|4007| };
|4008|4008| 
|4009|4009| /**
|    | [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
|4003|4003| 	if (data.timerRepeat === undefined)
|4004|4004| 		this.timer = undefined;
|4005|4005| 
|4006|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4006|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4007|4007| };
|4008|4008| 
|4009|4009| /**
|    | [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
|4048|4048| 	// TODO: This is a bit inefficient since every unit listens to every
|4049|4049| 	// construction message - ideally we could scope it to only the one we're building
|4050|4050| 
|4051|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4051|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4052|4052| };
|4053|4053| 
|4054|4054| UnitAI.prototype.OnGlobalEntityRenamed = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4048|4048| 	// TODO: This is a bit inefficient since every unit listens to every
|4049|4049| 	// construction message - ideally we could scope it to only the one we're building
|4050|4050| 
|4051|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4051|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4052|4052| };
|4053|4053| 
|4054|4054| UnitAI.prototype.OnGlobalEntityRenamed = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4073|4073| 
|4074|4074| UnitAI.prototype.OnAttacked = function(msg)
|4075|4075| {
|4076|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4076|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4077|4077| };
|4078|4078| 
|4079|4079| UnitAI.prototype.OnGuardedAttacked = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4073|4073| 
|4074|4074| UnitAI.prototype.OnAttacked = function(msg)
|4075|4075| {
|4076|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4076|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4077|4077| };
|4078|4078| 
|4079|4079| UnitAI.prototype.OnGuardedAttacked = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4078|4078| 
|4079|4079| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4080|4080| {
|4081|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4081|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4082|4082| };
|4083|4083| 
|4084|4084| UnitAI.prototype.OnHealthChanged = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4078|4078| 
|4079|4079| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4080|4080| {
|4081|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4081|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4082|4082| };
|4083|4083| 
|4084|4084| UnitAI.prototype.OnHealthChanged = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4083|4083| 
|4084|4084| UnitAI.prototype.OnHealthChanged = function(msg)
|4085|4085| {
|4086|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4086|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4087|4087| };
|4088|4088| 
|4089|4089| UnitAI.prototype.OnRangeUpdate = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4083|4083| 
|4084|4084| UnitAI.prototype.OnHealthChanged = function(msg)
|4085|4085| {
|4086|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4086|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4087|4087| };
|4088|4088| 
|4089|4089| UnitAI.prototype.OnRangeUpdate = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4089|4089| UnitAI.prototype.OnRangeUpdate = function(msg)
|4090|4090| {
|4091|4091| 	if (msg.tag == this.losRangeQuery)
|4092|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4092|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4093|4093| 	else if (msg.tag == this.losHealRangeQuery)
|4094|4094| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4095|4095| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4089|4089| UnitAI.prototype.OnRangeUpdate = function(msg)
|4090|4090| {
|4091|4091| 	if (msg.tag == this.losRangeQuery)
|4092|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4092|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4093|4093| 	else if (msg.tag == this.losHealRangeQuery)
|4094|4094| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4095|4095| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4091|4091| 	if (msg.tag == this.losRangeQuery)
|4092|4092| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4093|4093| 	else if (msg.tag == this.losHealRangeQuery)
|4094|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4094|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4095|4095| };
|4096|4096| 
|4097|4097| UnitAI.prototype.OnPackFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4091|4091| 	if (msg.tag == this.losRangeQuery)
|4092|4092| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4093|4093| 	else if (msg.tag == this.losHealRangeQuery)
|4094|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4094|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4095|4095| };
|4096|4096| 
|4097|4097| UnitAI.prototype.OnPackFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4096|4096| 
|4097|4097| UnitAI.prototype.OnPackFinished = function(msg)
|4098|4098| {
|4099|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4099|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4100|4100| };
|4101|4101| 
|4102|4102| //// Helper functions to be called by the FSM ////
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4096|4096| 
|4097|4097| UnitAI.prototype.OnPackFinished = function(msg)
|4098|4098| {
|4099|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4099|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4100|4100| };
|4101|4101| 
|4102|4102| //// Helper functions to be called by the FSM ////
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4099|4099| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4100|4100| };
|4101|4101| 
|4102|    |-//// Helper functions to be called by the FSM ////
|    |4102|+// // Helper functions to be called by the FSM ////
|4103|4103| 
|4104|4104| UnitAI.prototype.GetWalkSpeed = function()
|4105|4105| {
|    | [NORMAL] ESLintBear (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
|4768|4768| UnitAI.prototype.AttackEntityInZone = function(ents)
|4769|4769| {
|4770|4770| 	var target = ents.find(target =>
|4771|    |-		this.CanAttack(target)
|4772|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4771|+		this.CanAttack(target) &&
|    |4772|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4773|4773| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4774|4774| 	);
|4775|4775| 	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
|4769|4769| {
|4770|4770| 	var target = ents.find(target =>
|4771|4771| 		this.CanAttack(target)
|4772|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4773|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4772|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4773|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4774|4774| 	);
|4775|4775| 	if (!target)
|4776|4776| 		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
|4833|4833| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4834|4834| 	if (this.isGuardOf)
|4835|4835| 	{
|4836|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4836|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4837|4837| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4838|4838| 		if (cmpUnitAI && cmpAttack &&
|4839|4839| 		    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
|4837|4837| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4838|4838| 		if (cmpUnitAI && cmpAttack &&
|4839|4839| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4840|    |-				return false;
|    |4840|+			return false;
|4841|4841| 	}
|4842|4842| 
|4843|4843| 	// 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
|4875|4875| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4876|4876| 	if (this.isGuardOf)
|4877|4877| 	{
|4878|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4878|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4879|4879| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4880|4880| 		if (cmpUnitAI && cmpAttack &&
|4881|4881| 		    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
|4888|4888| 	return false;
|4889|4889| };
|4890|4890| 
|4891|    |-//// External interface functions ////
|    |4891|+// // External interface functions ////
|4892|4892| 
|4893|4893| UnitAI.prototype.SetFormationController = function(ent)
|4894|4894| {
|    | [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
|5044|5044| 	{
|5045|5045| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5046|5046| 			return;
|5047|    |-		else
|5048|    |-			this.RemoveGuard();
|    |5047|+		this.RemoveGuard();
|5049|5048| 	}
|5050|5049| 
|5051|5050| 	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
|5386|5386| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5387|5387| 	{
|5388|5388| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5389|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5389|+		if (cmpTrader.HasBothMarkets() &&
|5390|5390| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5391|5391| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5392|5392| 		{
|    | [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
|5667|5667| 				{
|5668|5668| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5669|5669| 					var targetClasses = this.order.data.targetClasses;
|5670|    |-					if (targetClasses.attack && cmpIdentity
|5671|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5670|+					if (targetClasses.attack && cmpIdentity &&
|    |5671|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5672|5672| 						continue;
|5673|5673| 					if (targetClasses.avoid && cmpIdentity
|5674|5674| 						&& 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
|5670|5670| 					if (targetClasses.attack && cmpIdentity
|5671|5671| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5672|5672| 						continue;
|5673|    |-					if (targetClasses.avoid && cmpIdentity
|5674|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5673|+					if (targetClasses.avoid && cmpIdentity &&
|    |5674|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5675|5675| 						continue;
|5676|5676| 					// Only used by the AIs to prevent some choices of targets
|5677|5677| 					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
|5693|5693| 		{
|5694|5694| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5695|5695| 			var targetClasses = this.order.data.targetClasses;
|5696|    |-			if (cmpIdentity && targetClasses.attack
|5697|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5696|+			if (cmpIdentity && targetClasses.attack &&
|    |5697|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5698|5698| 				continue;
|5699|5699| 			if (cmpIdentity && targetClasses.avoid
|5700|5700| 				&& 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
|5696|5696| 			if (cmpIdentity && targetClasses.attack
|5697|5697| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5698|5698| 				continue;
|5699|    |-			if (cmpIdentity && targetClasses.avoid
|5700|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5699|+			if (cmpIdentity && targetClasses.avoid &&
|    |5700|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5701|5701| 				continue;
|5702|5702| 			// Only used by the AIs to prevent some choices of targets
|5703|5703| 			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
|5853|5853| 
|5854|5854| UnitAI.prototype.SetHeldPosition = function(x, z)
|5855|5855| {
|5856|    |-	this.heldPosition = {"x": x, "z": z};
|    |5856|+	this.heldPosition = { "x": x, "z": z};
|5857|5857| };
|5858|5858| 
|5859|5859| 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
|5853|5853| 
|5854|5854| UnitAI.prototype.SetHeldPosition = function(x, z)
|5855|5855| {
|5856|    |-	this.heldPosition = {"x": x, "z": z};
|    |5856|+	this.heldPosition = {"x": x, "z": z };
|5857|5857| };
|5858|5858| 
|5859|5859| 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
|5880|5880| 	return false;
|5881|5881| };
|5882|5882| 
|5883|    |-//// Helper functions ////
|    |5883|+// // Helper functions ////
|5884|5884| 
|5885|5885| UnitAI.prototype.CanAttack = function(target)
|5886|5886| {
|    | [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
|6084|6084| 	return cmpPack && cmpPack.IsPacking();
|6085|6085| };
|6086|6086| 
|6087|    |-//// Formation specific functions ////
|    |6087|+// // Formation specific functions ////
|6088|6088| 
|6089|6089| UnitAI.prototype.IsAttackingAsFormation = function()
|6090|6090| {
|    | [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
|6089|6089| UnitAI.prototype.IsAttackingAsFormation = function()
|6090|6090| {
|6091|6091| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6092|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6093|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6092|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6093|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6094|6094| };
|6095|6095| 
|6096|6096| //// 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
|6093|6093| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6094|6094| };
|6095|6095| 
|6096|    |-//// Animal specific functions ////
|    |6096|+// // Animal specific functions ////
|6097|6097| 
|6098|6098| UnitAI.prototype.MoveRandomly = function(distance)
|6099|6099| {

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

binaries/data/mods/public/simulation/components/UnitAI.js
|3908| »   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
|4755| »   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
|4770| »   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
|4816| »   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
|4839| »   »   ····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
|2027| »   »   »   »   »   »   &&·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
|3855| »   »   var·order·=·{·"type":·type,·"data":·data·};
|    | [NORMAL] JSHintBear:
|    | 'order' is already defined.

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

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

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

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

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

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

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

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

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

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

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

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

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

Freagarach updated this revision to Diff 10837.Jan 1 2020, 8:34 PM
Freagarach retitled this revision from Use vision range for auto-gather/-build ranges. to Define auto-gather/-build ranges in template..
Freagarach edited the summary of this revision. (Show Details)
Freagarach edited the test plan for this revision. (Show Details)
Freagarach updated the Trac tickets for this revision.
Vulcan added a comment.Jan 1 2020, 8:36 PM

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

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

Vulcan added a comment.Jan 1 2020, 8:37 PM

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

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

Vulcan added a comment.Jan 1 2020, 8:40 PM

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [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
| 780| 780| 					this.FinishOrder();
| 781| 781| 					return;
| 782| 782| 				}
| 783|    |-				else
| 784|    |-				{
|    | 783|+				
| 785| 784| 					this.SetNextState("GARRISON.APPROACHING");
| 786| 785| 					return;
| 787|    |-				}
|    | 786|+				
| 788| 787| 			}
| 789| 788| 
| 790| 789| 			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
|1052|1052| 			},
|1053|1053| 		},
|1054|1054| 
|1055|    |-		"GARRISON":{
|    |1055|+		"GARRISON": {
|1056|1056| 			"APPROACHING": {
|1057|1057| 				"enter": function() {
|1058|1058| 					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
|2023|2023| 
|2024|2024| 				"Attacked": function(msg) {
|2025|2025| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2026|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2027|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2026|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2027|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2028|2028| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2029|2029| 				},
|2030|2030| 			},
|    | [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
|2758|2758| 					{
|2759|2759| 						// The building was already finished/fully repaired before we arrived;
|2760|2760| 						// let the ConstructionFinished handler handle this.
|2761|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2761|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2762|2762| 						return true;
|2763|2763| 					}
|2764|2764| 
|    | [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
|2758|2758| 					{
|2759|2759| 						// The building was already finished/fully repaired before we arrived;
|2760|2760| 						// let the ConstructionFinished handler handle this.
|2761|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2761|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2762|2762| 						return true;
|2763|2763| 					}
|2764|2764| 
|    | [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
|3278|3278| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3279|3279| 
|3280|3280| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3281|    |-							// only used for domestic animals
|    |3281|+		// only used for domestic animals
|3282|3282| 	},
|3283|3283| };
|3284|3284| 
|    | [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
|3335|3335| 
|3336|3336| UnitAI.prototype.IsAnimal = function()
|3337|3337| {
|3338|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3338|+	return (!!this.template.NaturalBehaviour);
|3339|3339| };
|3340|3340| 
|3341|3341| 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
|3451|3451| 		{
|3452|3452| 			let index = this.GetCurrentState().indexOf(".");
|3453|3453| 			if (index != -1)
|3454|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3454|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3455|3455| 			this.Stop(false);
|3456|3456| 		}
|3457|3457| 
|    | [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
|3507|3507| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3508|3508| 			continue;
|3509|3509| 		if (i == 0)
|3510|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3510|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3511|3511| 		else
|3512|3512| 			this.orderQueue.splice(i, 1);
|3513|3513| 		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
|3507|3507| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3508|3508| 			continue;
|3509|3509| 		if (i == 0)
|3510|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3510|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3511|3511| 		else
|3512|3512| 			this.orderQueue.splice(i, 1);
|3513|3513| 		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
|3591|3591| };
|3592|3592| 
|3593|3593| 
|3594|    |-//// FSM linkage functions ////
|    |3594|+// // FSM linkage functions ////
|3595|3595| 
|3596|3596| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3597|3597| 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
|3761|3761| 				continue;
|3762|3762| 			if (this.orderQueue[i].type == type)
|3763|3763| 				continue;
|3764|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3764|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3765|3765| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3766|3766| 			return;
|3767|3767| 		}
|    | [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
|3761|3761| 				continue;
|3762|3762| 			if (this.orderQueue[i].type == type)
|3763|3763| 				continue;
|3764|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3764|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3765|3765| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3766|3766| 			return;
|3767|3767| 		}
|    | [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
|4003|4003| 	if (data.timerRepeat === undefined)
|4004|4004| 		this.timer = undefined;
|4005|4005| 
|4006|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4006|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4007|4007| };
|4008|4008| 
|4009|4009| /**
|    | [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
|4003|4003| 	if (data.timerRepeat === undefined)
|4004|4004| 		this.timer = undefined;
|4005|4005| 
|4006|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4006|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4007|4007| };
|4008|4008| 
|4009|4009| /**
|    | [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
|4048|4048| 	// TODO: This is a bit inefficient since every unit listens to every
|4049|4049| 	// construction message - ideally we could scope it to only the one we're building
|4050|4050| 
|4051|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4051|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4052|4052| };
|4053|4053| 
|4054|4054| UnitAI.prototype.OnGlobalEntityRenamed = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4048|4048| 	// TODO: This is a bit inefficient since every unit listens to every
|4049|4049| 	// construction message - ideally we could scope it to only the one we're building
|4050|4050| 
|4051|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4051|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4052|4052| };
|4053|4053| 
|4054|4054| UnitAI.prototype.OnGlobalEntityRenamed = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4073|4073| 
|4074|4074| UnitAI.prototype.OnAttacked = function(msg)
|4075|4075| {
|4076|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4076|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4077|4077| };
|4078|4078| 
|4079|4079| UnitAI.prototype.OnGuardedAttacked = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4073|4073| 
|4074|4074| UnitAI.prototype.OnAttacked = function(msg)
|4075|4075| {
|4076|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4076|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4077|4077| };
|4078|4078| 
|4079|4079| UnitAI.prototype.OnGuardedAttacked = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4078|4078| 
|4079|4079| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4080|4080| {
|4081|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4081|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4082|4082| };
|4083|4083| 
|4084|4084| UnitAI.prototype.OnHealthChanged = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4078|4078| 
|4079|4079| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4080|4080| {
|4081|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4081|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4082|4082| };
|4083|4083| 
|4084|4084| UnitAI.prototype.OnHealthChanged = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4083|4083| 
|4084|4084| UnitAI.prototype.OnHealthChanged = function(msg)
|4085|4085| {
|4086|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4086|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4087|4087| };
|4088|4088| 
|4089|4089| UnitAI.prototype.OnRangeUpdate = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4083|4083| 
|4084|4084| UnitAI.prototype.OnHealthChanged = function(msg)
|4085|4085| {
|4086|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4086|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4087|4087| };
|4088|4088| 
|4089|4089| UnitAI.prototype.OnRangeUpdate = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4089|4089| UnitAI.prototype.OnRangeUpdate = function(msg)
|4090|4090| {
|4091|4091| 	if (msg.tag == this.losRangeQuery)
|4092|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4092|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4093|4093| 	else if (msg.tag == this.losHealRangeQuery)
|4094|4094| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4095|4095| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4089|4089| UnitAI.prototype.OnRangeUpdate = function(msg)
|4090|4090| {
|4091|4091| 	if (msg.tag == this.losRangeQuery)
|4092|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4092|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4093|4093| 	else if (msg.tag == this.losHealRangeQuery)
|4094|4094| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4095|4095| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4091|4091| 	if (msg.tag == this.losRangeQuery)
|4092|4092| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4093|4093| 	else if (msg.tag == this.losHealRangeQuery)
|4094|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4094|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4095|4095| };
|4096|4096| 
|4097|4097| UnitAI.prototype.OnPackFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4091|4091| 	if (msg.tag == this.losRangeQuery)
|4092|4092| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4093|4093| 	else if (msg.tag == this.losHealRangeQuery)
|4094|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4094|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4095|4095| };
|4096|4096| 
|4097|4097| UnitAI.prototype.OnPackFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4096|4096| 
|4097|4097| UnitAI.prototype.OnPackFinished = function(msg)
|4098|4098| {
|4099|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4099|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4100|4100| };
|4101|4101| 
|4102|4102| //// Helper functions to be called by the FSM ////
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4096|4096| 
|4097|4097| UnitAI.prototype.OnPackFinished = function(msg)
|4098|4098| {
|4099|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4099|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4100|4100| };
|4101|4101| 
|4102|4102| //// Helper functions to be called by the FSM ////
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4099|4099| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4100|4100| };
|4101|4101| 
|4102|    |-//// Helper functions to be called by the FSM ////
|    |4102|+// // Helper functions to be called by the FSM ////
|4103|4103| 
|4104|4104| UnitAI.prototype.GetWalkSpeed = function()
|4105|4105| {
|    | [NORMAL] ESLintBear (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
|4773|4773| UnitAI.prototype.AttackEntityInZone = function(ents)
|4774|4774| {
|4775|4775| 	var target = ents.find(target =>
|4776|    |-		this.CanAttack(target)
|4777|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4776|+		this.CanAttack(target) &&
|    |4777|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4778|4778| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4779|4779| 	);
|4780|4780| 	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
|4774|4774| {
|4775|4775| 	var target = ents.find(target =>
|4776|4776| 		this.CanAttack(target)
|4777|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4778|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4777|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4778|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4779|4779| 	);
|4780|4780| 	if (!target)
|4781|4781| 		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
|4838|4838| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4839|4839| 	if (this.isGuardOf)
|4840|4840| 	{
|4841|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4841|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4842|4842| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4843|4843| 		if (cmpUnitAI && cmpAttack &&
|4844|4844| 		    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
|4842|4842| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4843|4843| 		if (cmpUnitAI && cmpAttack &&
|4844|4844| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4845|    |-				return false;
|    |4845|+			return false;
|4846|4846| 	}
|4847|4847| 
|4848|4848| 	// 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
|4880|4880| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4881|4881| 	if (this.isGuardOf)
|4882|4882| 	{
|4883|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4883|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4884|4884| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4885|4885| 		if (cmpUnitAI && cmpAttack &&
|4886|4886| 		    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
|4893|4893| 	return false;
|4894|4894| };
|4895|4895| 
|4896|    |-//// External interface functions ////
|    |4896|+// // External interface functions ////
|4897|4897| 
|4898|4898| UnitAI.prototype.SetFormationController = function(ent)
|4899|4899| {
|    | [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
|5049|5049| 	{
|5050|5050| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5051|5051| 			return;
|5052|    |-		else
|5053|    |-			this.RemoveGuard();
|    |5052|+		this.RemoveGuard();
|5054|5053| 	}
|5055|5054| 
|5056|5055| 	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
|5391|5391| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5392|5392| 	{
|5393|5393| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5394|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5394|+		if (cmpTrader.HasBothMarkets() &&
|5395|5395| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5396|5396| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5397|5397| 		{
|    | [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
|5672|5672| 				{
|5673|5673| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5674|5674| 					var targetClasses = this.order.data.targetClasses;
|5675|    |-					if (targetClasses.attack && cmpIdentity
|5676|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5675|+					if (targetClasses.attack && cmpIdentity &&
|    |5676|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5677|5677| 						continue;
|5678|5678| 					if (targetClasses.avoid && cmpIdentity
|5679|5679| 						&& 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
|5675|5675| 					if (targetClasses.attack && cmpIdentity
|5676|5676| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5677|5677| 						continue;
|5678|    |-					if (targetClasses.avoid && cmpIdentity
|5679|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5678|+					if (targetClasses.avoid && cmpIdentity &&
|    |5679|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5680|5680| 						continue;
|5681|5681| 					// Only used by the AIs to prevent some choices of targets
|5682|5682| 					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
|5698|5698| 		{
|5699|5699| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5700|5700| 			var targetClasses = this.order.data.targetClasses;
|5701|    |-			if (cmpIdentity && targetClasses.attack
|5702|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5701|+			if (cmpIdentity && targetClasses.attack &&
|    |5702|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5703|5703| 				continue;
|5704|5704| 			if (cmpIdentity && targetClasses.avoid
|5705|5705| 				&& 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
|5701|5701| 			if (cmpIdentity && targetClasses.attack
|5702|5702| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5703|5703| 				continue;
|5704|    |-			if (cmpIdentity && targetClasses.avoid
|5705|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5704|+			if (cmpIdentity && targetClasses.avoid &&
|    |5705|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5706|5706| 				continue;
|5707|5707| 			// Only used by the AIs to prevent some choices of targets
|5708|5708| 			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
|5858|5858| 
|5859|5859| UnitAI.prototype.SetHeldPosition = function(x, z)
|5860|5860| {
|5861|    |-	this.heldPosition = {"x": x, "z": z};
|    |5861|+	this.heldPosition = { "x": x, "z": z};
|5862|5862| };
|5863|5863| 
|5864|5864| 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
|5858|5858| 
|5859|5859| UnitAI.prototype.SetHeldPosition = function(x, z)
|5860|5860| {
|5861|    |-	this.heldPosition = {"x": x, "z": z};
|    |5861|+	this.heldPosition = {"x": x, "z": z };
|5862|5862| };
|5863|5863| 
|5864|5864| 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
|5885|5885| 	return false;
|5886|5886| };
|5887|5887| 
|5888|    |-//// Helper functions ////
|    |5888|+// // Helper functions ////
|5889|5889| 
|5890|5890| UnitAI.prototype.CanAttack = function(target)
|5891|5891| {
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|6089|6089| 	return cmpPack && cmpPack.IsPacking();
|6090|6090| };
|6091|6091| 
|6092|    |-//// Formation specific functions ////
|    |6092|+// // Formation specific functions ////
|6093|6093| 
|6094|6094| UnitAI.prototype.IsAttackingAsFormation = function()
|6095|6095| {
|    | [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
|6094|6094| UnitAI.prototype.IsAttackingAsFormation = function()
|6095|6095| {
|6096|6096| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6097|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6098|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6097|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6098|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6099|6099| };
|6100|6100| 
|6101|6101| //// 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
|6098|6098| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6099|6099| };
|6100|6100| 
|6101|    |-//// Animal specific functions ////
|    |6101|+// // Animal specific functions ////
|6102|6102| 
|6103|6103| UnitAI.prototype.MoveRandomly = function(distance)
|6104|6104| {

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

binaries/data/mods/public/simulation/components/UnitAI.js
|3908| »   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
|4760| »   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
|4775| »   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
|4821| »   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
|4844| »   »   ····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
|2027| »   »   »   »   »   »   &&·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
|3855| »   »   var·order·=·{·"type":·type,·"data":·data·};
|    | [NORMAL] JSHintBear:
|    | 'order' is already defined.

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

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

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

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

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

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

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

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

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

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

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
|6098| »   »   &&·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/1439/display/redirect

elexis updated the Trac tickets for this revision.Jan 1 2020, 8:41 PM
elexis added a subscriber: elexis.Jan 1 2020, 8:45 PM

Perhaps Auto -> Nearby, and I suppose you also wanted to bump the number, otherwise looks good.

binaries/data/mods/public/simulation/components/ResourceGatherer.js
24 ↗(On Diff #10837)

Could also mention where the center is (its not obvious whether it searches at the current unit position or at the last position gathered)

Stan added a subscriber: Stan.Jan 1 2020, 8:58 PM
Stan added inline comments.
binaries/data/mods/public/simulation/components/ResourceGatherer.js
24 ↗(On Diff #10837)

Indeed would be nice to specify. Search for → look for? Maybe

// When switching from a depleted resource, defines the max range around the current resource at which an entity will look for another resource to gather.
156 ↗(On Diff #10837)

I assume that the cost of having a cached variable and a message subscription is less than calling that function all the time?

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

Could be inlined? or done after the check for cmpBuilder?

4267–4268

Same here.

Nescio added a subscriber: Nescio.Jan 1 2020, 10:21 PM

Nice idea, thanks!
For comparison, template_structure_civic_civil_centre.xml has something somewhat similar:

<AlertRaiser>
  <List datatype="tokens">FemaleCitizen</List>
  <RaiseAlertRange>140</RaiseAlertRange>
  <EndOfAlertRange>190</EndOfAlertRange>
  <SearchRange>100</SearchRange>
</AlertRaiser>

So maybe rename <AutoBuildRange> and <AutoGatherRange> to simply <SearchRange>?

Freagarach updated this revision to Diff 10844.Jan 2 2020, 7:48 PM
Freagarach marked 4 inline comments as done.
  • SearchRange.
  • More informative description.
  • Inline range.

I suppose you also wanted to bump the number, otherwise looks good.

I refrained from doing that in this diff intentionally for I think that needs some testing what feels right. If you would still like it in here, I will update that.

Vulcan added a comment.Jan 2 2020, 7:51 PM

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

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

Vulcan added a comment.Jan 2 2020, 7:53 PM

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

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

Vulcan added a comment.Jan 2 2020, 7:53 PM

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [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
| 780| 780| 					this.FinishOrder();
| 781| 781| 					return;
| 782| 782| 				}
| 783|    |-				else
| 784|    |-				{
|    | 783|+				
| 785| 784| 					this.SetNextState("GARRISON.APPROACHING");
| 786| 785| 					return;
| 787|    |-				}
|    | 786|+				
| 788| 787| 			}
| 789| 788| 
| 790| 789| 			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
|1052|1052| 			},
|1053|1053| 		},
|1054|1054| 
|1055|    |-		"GARRISON":{
|    |1055|+		"GARRISON": {
|1056|1056| 			"APPROACHING": {
|1057|1057| 				"enter": function() {
|1058|1058| 					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
|2023|2023| 
|2024|2024| 				"Attacked": function(msg) {
|2025|2025| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2026|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2027|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2026|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2027|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2028|2028| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2029|2029| 				},
|2030|2030| 			},
|    | [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
|2758|2758| 					{
|2759|2759| 						// The building was already finished/fully repaired before we arrived;
|2760|2760| 						// let the ConstructionFinished handler handle this.
|2761|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2761|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2762|2762| 						return true;
|2763|2763| 					}
|2764|2764| 
|    | [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
|2758|2758| 					{
|2759|2759| 						// The building was already finished/fully repaired before we arrived;
|2760|2760| 						// let the ConstructionFinished handler handle this.
|2761|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2761|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2762|2762| 						return true;
|2763|2763| 					}
|2764|2764| 
|    | [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
|3278|3278| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3279|3279| 
|3280|3280| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3281|    |-							// only used for domestic animals
|    |3281|+		// only used for domestic animals
|3282|3282| 	},
|3283|3283| };
|3284|3284| 
|    | [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
|3335|3335| 
|3336|3336| UnitAI.prototype.IsAnimal = function()
|3337|3337| {
|3338|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3338|+	return (!!this.template.NaturalBehaviour);
|3339|3339| };
|3340|3340| 
|3341|3341| 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
|3451|3451| 		{
|3452|3452| 			let index = this.GetCurrentState().indexOf(".");
|3453|3453| 			if (index != -1)
|3454|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3454|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3455|3455| 			this.Stop(false);
|3456|3456| 		}
|3457|3457| 
|    | [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
|3507|3507| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3508|3508| 			continue;
|3509|3509| 		if (i == 0)
|3510|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3510|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3511|3511| 		else
|3512|3512| 			this.orderQueue.splice(i, 1);
|3513|3513| 		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
|3507|3507| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3508|3508| 			continue;
|3509|3509| 		if (i == 0)
|3510|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3510|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3511|3511| 		else
|3512|3512| 			this.orderQueue.splice(i, 1);
|3513|3513| 		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
|3591|3591| };
|3592|3592| 
|3593|3593| 
|3594|    |-//// FSM linkage functions ////
|    |3594|+// // FSM linkage functions ////
|3595|3595| 
|3596|3596| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3597|3597| 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
|3761|3761| 				continue;
|3762|3762| 			if (this.orderQueue[i].type == type)
|3763|3763| 				continue;
|3764|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3764|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3765|3765| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3766|3766| 			return;
|3767|3767| 		}
|    | [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
|3761|3761| 				continue;
|3762|3762| 			if (this.orderQueue[i].type == type)
|3763|3763| 				continue;
|3764|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3764|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3765|3765| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3766|3766| 			return;
|3767|3767| 		}
|    | [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
|4003|4003| 	if (data.timerRepeat === undefined)
|4004|4004| 		this.timer = undefined;
|4005|4005| 
|4006|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4006|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4007|4007| };
|4008|4008| 
|4009|4009| /**
|    | [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
|4003|4003| 	if (data.timerRepeat === undefined)
|4004|4004| 		this.timer = undefined;
|4005|4005| 
|4006|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4006|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4007|4007| };
|4008|4008| 
|4009|4009| /**
|    | [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
|4048|4048| 	// TODO: This is a bit inefficient since every unit listens to every
|4049|4049| 	// construction message - ideally we could scope it to only the one we're building
|4050|4050| 
|4051|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4051|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4052|4052| };
|4053|4053| 
|4054|4054| UnitAI.prototype.OnGlobalEntityRenamed = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4048|4048| 	// TODO: This is a bit inefficient since every unit listens to every
|4049|4049| 	// construction message - ideally we could scope it to only the one we're building
|4050|4050| 
|4051|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4051|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4052|4052| };
|4053|4053| 
|4054|4054| UnitAI.prototype.OnGlobalEntityRenamed = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4073|4073| 
|4074|4074| UnitAI.prototype.OnAttacked = function(msg)
|4075|4075| {
|4076|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4076|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4077|4077| };
|4078|4078| 
|4079|4079| UnitAI.prototype.OnGuardedAttacked = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4073|4073| 
|4074|4074| UnitAI.prototype.OnAttacked = function(msg)
|4075|4075| {
|4076|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4076|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4077|4077| };
|4078|4078| 
|4079|4079| UnitAI.prototype.OnGuardedAttacked = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4078|4078| 
|4079|4079| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4080|4080| {
|4081|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4081|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4082|4082| };
|4083|4083| 
|4084|4084| UnitAI.prototype.OnHealthChanged = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4078|4078| 
|4079|4079| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4080|4080| {
|4081|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4081|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4082|4082| };
|4083|4083| 
|4084|4084| UnitAI.prototype.OnHealthChanged = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4083|4083| 
|4084|4084| UnitAI.prototype.OnHealthChanged = function(msg)
|4085|4085| {
|4086|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4086|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4087|4087| };
|4088|4088| 
|4089|4089| UnitAI.prototype.OnRangeUpdate = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4083|4083| 
|4084|4084| UnitAI.prototype.OnHealthChanged = function(msg)
|4085|4085| {
|4086|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4086|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4087|4087| };
|4088|4088| 
|4089|4089| UnitAI.prototype.OnRangeUpdate = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4089|4089| UnitAI.prototype.OnRangeUpdate = function(msg)
|4090|4090| {
|4091|4091| 	if (msg.tag == this.losRangeQuery)
|4092|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4092|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4093|4093| 	else if (msg.tag == this.losHealRangeQuery)
|4094|4094| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4095|4095| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4089|4089| UnitAI.prototype.OnRangeUpdate = function(msg)
|4090|4090| {
|4091|4091| 	if (msg.tag == this.losRangeQuery)
|4092|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4092|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4093|4093| 	else if (msg.tag == this.losHealRangeQuery)
|4094|4094| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4095|4095| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4091|4091| 	if (msg.tag == this.losRangeQuery)
|4092|4092| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4093|4093| 	else if (msg.tag == this.losHealRangeQuery)
|4094|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4094|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4095|4095| };
|4096|4096| 
|4097|4097| UnitAI.prototype.OnPackFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4091|4091| 	if (msg.tag == this.losRangeQuery)
|4092|4092| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4093|4093| 	else if (msg.tag == this.losHealRangeQuery)
|4094|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4094|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4095|4095| };
|4096|4096| 
|4097|4097| UnitAI.prototype.OnPackFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4096|4096| 
|4097|4097| UnitAI.prototype.OnPackFinished = function(msg)
|4098|4098| {
|4099|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4099|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4100|4100| };
|4101|4101| 
|4102|4102| //// Helper functions to be called by the FSM ////
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4096|4096| 
|4097|4097| UnitAI.prototype.OnPackFinished = function(msg)
|4098|4098| {
|4099|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4099|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4100|4100| };
|4101|4101| 
|4102|4102| //// Helper functions to be called by the FSM ////
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4099|4099| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4100|4100| };
|4101|4101| 
|4102|    |-//// Helper functions to be called by the FSM ////
|    |4102|+// // Helper functions to be called by the FSM ////
|4103|4103| 
|4104|4104| UnitAI.prototype.GetWalkSpeed = function()
|4105|4105| {
|    | [NORMAL] ESLintBear (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
|4770|4770| UnitAI.prototype.AttackEntityInZone = function(ents)
|4771|4771| {
|4772|4772| 	var target = ents.find(target =>
|4773|    |-		this.CanAttack(target)
|4774|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4773|+		this.CanAttack(target) &&
|    |4774|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4775|4775| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4776|4776| 	);
|4777|4777| 	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
|4771|4771| {
|4772|4772| 	var target = ents.find(target =>
|4773|4773| 		this.CanAttack(target)
|4774|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4775|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4774|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4775|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4776|4776| 	);
|4777|4777| 	if (!target)
|4778|4778| 		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
|4835|4835| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4836|4836| 	if (this.isGuardOf)
|4837|4837| 	{
|4838|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4838|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4839|4839| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4840|4840| 		if (cmpUnitAI && cmpAttack &&
|4841|4841| 		    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
|4839|4839| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4840|4840| 		if (cmpUnitAI && cmpAttack &&
|4841|4841| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4842|    |-				return false;
|    |4842|+			return false;
|4843|4843| 	}
|4844|4844| 
|4845|4845| 	// 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
|4877|4877| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4878|4878| 	if (this.isGuardOf)
|4879|4879| 	{
|4880|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4880|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4881|4881| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4882|4882| 		if (cmpUnitAI && cmpAttack &&
|4883|4883| 		    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
|4890|4890| 	return false;
|4891|4891| };
|4892|4892| 
|4893|    |-//// External interface functions ////
|    |4893|+// // External interface functions ////
|4894|4894| 
|4895|4895| UnitAI.prototype.SetFormationController = function(ent)
|4896|4896| {
|    | [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
|5046|5046| 	{
|5047|5047| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5048|5048| 			return;
|5049|    |-		else
|5050|    |-			this.RemoveGuard();
|    |5049|+		this.RemoveGuard();
|5051|5050| 	}
|5052|5051| 
|5053|5052| 	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
|5388|5388| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5389|5389| 	{
|5390|5390| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5391|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5391|+		if (cmpTrader.HasBothMarkets() &&
|5392|5392| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5393|5393| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5394|5394| 		{
|    | [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
|5669|5669| 				{
|5670|5670| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5671|5671| 					var targetClasses = this.order.data.targetClasses;
|5672|    |-					if (targetClasses.attack && cmpIdentity
|5673|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5672|+					if (targetClasses.attack && cmpIdentity &&
|    |5673|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5674|5674| 						continue;
|5675|5675| 					if (targetClasses.avoid && cmpIdentity
|5676|5676| 						&& 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
|5672|5672| 					if (targetClasses.attack && cmpIdentity
|5673|5673| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5674|5674| 						continue;
|5675|    |-					if (targetClasses.avoid && cmpIdentity
|5676|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5675|+					if (targetClasses.avoid && cmpIdentity &&
|    |5676|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5677|5677| 						continue;
|5678|5678| 					// Only used by the AIs to prevent some choices of targets
|5679|5679| 					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
|5695|5695| 		{
|5696|5696| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5697|5697| 			var targetClasses = this.order.data.targetClasses;
|5698|    |-			if (cmpIdentity && targetClasses.attack
|5699|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5698|+			if (cmpIdentity && targetClasses.attack &&
|    |5699|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5700|5700| 				continue;
|5701|5701| 			if (cmpIdentity && targetClasses.avoid
|5702|5702| 				&& 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
|5698|5698| 			if (cmpIdentity && targetClasses.attack
|5699|5699| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5700|5700| 				continue;
|5701|    |-			if (cmpIdentity && targetClasses.avoid
|5702|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5701|+			if (cmpIdentity && targetClasses.avoid &&
|    |5702|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5703|5703| 				continue;
|5704|5704| 			// Only used by the AIs to prevent some choices of targets
|5705|5705| 			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
|5855|5855| 
|5856|5856| UnitAI.prototype.SetHeldPosition = function(x, z)
|5857|5857| {
|5858|    |-	this.heldPosition = {"x": x, "z": z};
|    |5858|+	this.heldPosition = { "x": x, "z": z};
|5859|5859| };
|5860|5860| 
|5861|5861| 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
|5855|5855| 
|5856|5856| UnitAI.prototype.SetHeldPosition = function(x, z)
|5857|5857| {
|5858|    |-	this.heldPosition = {"x": x, "z": z};
|    |5858|+	this.heldPosition = {"x": x, "z": z };
|5859|5859| };
|5860|5860| 
|5861|5861| 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
|5882|5882| 	return false;
|5883|5883| };
|5884|5884| 
|5885|    |-//// Helper functions ////
|    |5885|+// // Helper functions ////
|5886|5886| 
|5887|5887| UnitAI.prototype.CanAttack = function(target)
|5888|5888| {
|    | [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
|6086|6086| 	return cmpPack && cmpPack.IsPacking();
|6087|6087| };
|6088|6088| 
|6089|    |-//// Formation specific functions ////
|    |6089|+// // Formation specific functions ////
|6090|6090| 
|6091|6091| UnitAI.prototype.IsAttackingAsFormation = function()
|6092|6092| {
|    | [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
|6091|6091| UnitAI.prototype.IsAttackingAsFormation = function()
|6092|6092| {
|6093|6093| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6094|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6095|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6094|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6095|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6096|6096| };
|6097|6097| 
|6098|6098| //// 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
|6095|6095| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6096|6096| };
|6097|6097| 
|6098|    |-//// Animal specific functions ////
|    |6098|+// // Animal specific functions ////
|6099|6099| 
|6100|6100| UnitAI.prototype.MoveRandomly = function(distance)
|6101|6101| {

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

binaries/data/mods/public/simulation/components/UnitAI.js
|3908| »   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
|4757| »   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
|4772| »   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
|4818| »   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
|4841| »   »   ····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
|2027| »   »   »   »   »   »   &&·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
|3855| »   »   var·order·=·{·"type":·type,·"data":·data·};
|    | [NORMAL] JSHintBear:
|    | 'order' is already defined.

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

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

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

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

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

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

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

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

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

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

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

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

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

Freagarach updated this revision to Diff 10845.Jan 2 2020, 8:13 PM
  • Cache SearchRange of ResourceGatherer. (Not of Builder for that value is requested less often but the ValueModification-message is sent often.)
Vulcan added a comment.Jan 2 2020, 8:15 PM

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

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

Vulcan added a comment.Jan 2 2020, 8:17 PM

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

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

Vulcan added a comment.Jan 2 2020, 8:17 PM

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [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
| 780| 780| 					this.FinishOrder();
| 781| 781| 					return;
| 782| 782| 				}
| 783|    |-				else
| 784|    |-				{
|    | 783|+				
| 785| 784| 					this.SetNextState("GARRISON.APPROACHING");
| 786| 785| 					return;
| 787|    |-				}
|    | 786|+				
| 788| 787| 			}
| 789| 788| 
| 790| 789| 			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
|1052|1052| 			},
|1053|1053| 		},
|1054|1054| 
|1055|    |-		"GARRISON":{
|    |1055|+		"GARRISON": {
|1056|1056| 			"APPROACHING": {
|1057|1057| 				"enter": function() {
|1058|1058| 					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
|2023|2023| 
|2024|2024| 				"Attacked": function(msg) {
|2025|2025| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2026|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2027|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2026|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2027|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2028|2028| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2029|2029| 				},
|2030|2030| 			},
|    | [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
|2758|2758| 					{
|2759|2759| 						// The building was already finished/fully repaired before we arrived;
|2760|2760| 						// let the ConstructionFinished handler handle this.
|2761|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2761|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2762|2762| 						return true;
|2763|2763| 					}
|2764|2764| 
|    | [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
|2758|2758| 					{
|2759|2759| 						// The building was already finished/fully repaired before we arrived;
|2760|2760| 						// let the ConstructionFinished handler handle this.
|2761|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2761|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2762|2762| 						return true;
|2763|2763| 					}
|2764|2764| 
|    | [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
|3278|3278| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3279|3279| 
|3280|3280| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3281|    |-							// only used for domestic animals
|    |3281|+		// only used for domestic animals
|3282|3282| 	},
|3283|3283| };
|3284|3284| 
|    | [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
|3335|3335| 
|3336|3336| UnitAI.prototype.IsAnimal = function()
|3337|3337| {
|3338|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3338|+	return (!!this.template.NaturalBehaviour);
|3339|3339| };
|3340|3340| 
|3341|3341| 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
|3451|3451| 		{
|3452|3452| 			let index = this.GetCurrentState().indexOf(".");
|3453|3453| 			if (index != -1)
|3454|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3454|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3455|3455| 			this.Stop(false);
|3456|3456| 		}
|3457|3457| 
|    | [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
|3507|3507| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3508|3508| 			continue;
|3509|3509| 		if (i == 0)
|3510|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3510|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3511|3511| 		else
|3512|3512| 			this.orderQueue.splice(i, 1);
|3513|3513| 		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
|3507|3507| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3508|3508| 			continue;
|3509|3509| 		if (i == 0)
|3510|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3510|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3511|3511| 		else
|3512|3512| 			this.orderQueue.splice(i, 1);
|3513|3513| 		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
|3591|3591| };
|3592|3592| 
|3593|3593| 
|3594|    |-//// FSM linkage functions ////
|    |3594|+// // FSM linkage functions ////
|3595|3595| 
|3596|3596| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3597|3597| 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
|3761|3761| 				continue;
|3762|3762| 			if (this.orderQueue[i].type == type)
|3763|3763| 				continue;
|3764|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3764|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3765|3765| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3766|3766| 			return;
|3767|3767| 		}
|    | [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
|3761|3761| 				continue;
|3762|3762| 			if (this.orderQueue[i].type == type)
|3763|3763| 				continue;
|3764|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3764|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3765|3765| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3766|3766| 			return;
|3767|3767| 		}
|    | [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
|4003|4003| 	if (data.timerRepeat === undefined)
|4004|4004| 		this.timer = undefined;
|4005|4005| 
|4006|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4006|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4007|4007| };
|4008|4008| 
|4009|4009| /**
|    | [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
|4003|4003| 	if (data.timerRepeat === undefined)
|4004|4004| 		this.timer = undefined;
|4005|4005| 
|4006|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4006|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4007|4007| };
|4008|4008| 
|4009|4009| /**
|    | [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
|4048|4048| 	// TODO: This is a bit inefficient since every unit listens to every
|4049|4049| 	// construction message - ideally we could scope it to only the one we're building
|4050|4050| 
|4051|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4051|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4052|4052| };
|4053|4053| 
|4054|4054| UnitAI.prototype.OnGlobalEntityRenamed = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4048|4048| 	// TODO: This is a bit inefficient since every unit listens to every
|4049|4049| 	// construction message - ideally we could scope it to only the one we're building
|4050|4050| 
|4051|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4051|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4052|4052| };
|4053|4053| 
|4054|4054| UnitAI.prototype.OnGlobalEntityRenamed = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4073|4073| 
|4074|4074| UnitAI.prototype.OnAttacked = function(msg)
|4075|4075| {
|4076|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4076|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4077|4077| };
|4078|4078| 
|4079|4079| UnitAI.prototype.OnGuardedAttacked = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4073|4073| 
|4074|4074| UnitAI.prototype.OnAttacked = function(msg)
|4075|4075| {
|4076|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4076|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4077|4077| };
|4078|4078| 
|4079|4079| UnitAI.prototype.OnGuardedAttacked = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4078|4078| 
|4079|4079| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4080|4080| {
|4081|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4081|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4082|4082| };
|4083|4083| 
|4084|4084| UnitAI.prototype.OnHealthChanged = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4078|4078| 
|4079|4079| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4080|4080| {
|4081|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4081|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4082|4082| };
|4083|4083| 
|4084|4084| UnitAI.prototype.OnHealthChanged = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4083|4083| 
|4084|4084| UnitAI.prototype.OnHealthChanged = function(msg)
|4085|4085| {
|4086|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4086|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4087|4087| };
|4088|4088| 
|4089|4089| UnitAI.prototype.OnRangeUpdate = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4083|4083| 
|4084|4084| UnitAI.prototype.OnHealthChanged = function(msg)
|4085|4085| {
|4086|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4086|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4087|4087| };
|4088|4088| 
|4089|4089| UnitAI.prototype.OnRangeUpdate = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4089|4089| UnitAI.prototype.OnRangeUpdate = function(msg)
|4090|4090| {
|4091|4091| 	if (msg.tag == this.losRangeQuery)
|4092|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4092|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4093|4093| 	else if (msg.tag == this.losHealRangeQuery)
|4094|4094| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4095|4095| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4089|4089| UnitAI.prototype.OnRangeUpdate = function(msg)
|4090|4090| {
|4091|4091| 	if (msg.tag == this.losRangeQuery)
|4092|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4092|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4093|4093| 	else if (msg.tag == this.losHealRangeQuery)
|4094|4094| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4095|4095| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4091|4091| 	if (msg.tag == this.losRangeQuery)
|4092|4092| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4093|4093| 	else if (msg.tag == this.losHealRangeQuery)
|4094|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4094|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4095|4095| };
|4096|4096| 
|4097|4097| UnitAI.prototype.OnPackFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4091|4091| 	if (msg.tag == this.losRangeQuery)
|4092|4092| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4093|4093| 	else if (msg.tag == this.losHealRangeQuery)
|4094|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4094|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4095|4095| };
|4096|4096| 
|4097|4097| UnitAI.prototype.OnPackFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4096|4096| 
|4097|4097| UnitAI.prototype.OnPackFinished = function(msg)
|4098|4098| {
|4099|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4099|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4100|4100| };
|4101|4101| 
|4102|4102| //// Helper functions to be called by the FSM ////
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4096|4096| 
|4097|4097| UnitAI.prototype.OnPackFinished = function(msg)
|4098|4098| {
|4099|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4099|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4100|4100| };
|4101|4101| 
|4102|4102| //// Helper functions to be called by the FSM ////
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4099|4099| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4100|4100| };
|4101|4101| 
|4102|    |-//// Helper functions to be called by the FSM ////
|    |4102|+// // Helper functions to be called by the FSM ////
|4103|4103| 
|4104|4104| UnitAI.prototype.GetWalkSpeed = function()
|4105|4105| {
|    | [NORMAL] ESLintBear (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
|4770|4770| UnitAI.prototype.AttackEntityInZone = function(ents)
|4771|4771| {
|4772|4772| 	var target = ents.find(target =>
|4773|    |-		this.CanAttack(target)
|4774|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4773|+		this.CanAttack(target) &&
|    |4774|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4775|4775| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4776|4776| 	);
|4777|4777| 	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
|4771|4771| {
|4772|4772| 	var target = ents.find(target =>
|4773|4773| 		this.CanAttack(target)
|4774|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4775|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4774|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4775|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4776|4776| 	);
|4777|4777| 	if (!target)
|4778|4778| 		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
|4835|4835| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4836|4836| 	if (this.isGuardOf)
|4837|4837| 	{
|4838|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4838|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4839|4839| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4840|4840| 		if (cmpUnitAI && cmpAttack &&
|4841|4841| 		    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
|4839|4839| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4840|4840| 		if (cmpUnitAI && cmpAttack &&
|4841|4841| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4842|    |-				return false;
|    |4842|+			return false;
|4843|4843| 	}
|4844|4844| 
|4845|4845| 	// 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
|4877|4877| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4878|4878| 	if (this.isGuardOf)
|4879|4879| 	{
|4880|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4880|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4881|4881| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4882|4882| 		if (cmpUnitAI && cmpAttack &&
|4883|4883| 		    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
|4890|4890| 	return false;
|4891|4891| };
|4892|4892| 
|4893|    |-//// External interface functions ////
|    |4893|+// // External interface functions ////
|4894|4894| 
|4895|4895| UnitAI.prototype.SetFormationController = function(ent)
|4896|4896| {
|    | [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
|5046|5046| 	{
|5047|5047| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5048|5048| 			return;
|5049|    |-		else
|5050|    |-			this.RemoveGuard();
|    |5049|+		this.RemoveGuard();
|5051|5050| 	}
|5052|5051| 
|5053|5052| 	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
|5388|5388| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5389|5389| 	{
|5390|5390| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5391|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5391|+		if (cmpTrader.HasBothMarkets() &&
|5392|5392| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5393|5393| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5394|5394| 		{
|    | [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
|5669|5669| 				{
|5670|5670| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5671|5671| 					var targetClasses = this.order.data.targetClasses;
|5672|    |-					if (targetClasses.attack && cmpIdentity
|5673|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5672|+					if (targetClasses.attack && cmpIdentity &&
|    |5673|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5674|5674| 						continue;
|5675|5675| 					if (targetClasses.avoid && cmpIdentity
|5676|5676| 						&& 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
|5672|5672| 					if (targetClasses.attack && cmpIdentity
|5673|5673| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5674|5674| 						continue;
|5675|    |-					if (targetClasses.avoid && cmpIdentity
|5676|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5675|+					if (targetClasses.avoid && cmpIdentity &&
|    |5676|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5677|5677| 						continue;
|5678|5678| 					// Only used by the AIs to prevent some choices of targets
|5679|5679| 					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
|5695|5695| 		{
|5696|5696| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5697|5697| 			var targetClasses = this.order.data.targetClasses;
|5698|    |-			if (cmpIdentity && targetClasses.attack
|5699|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5698|+			if (cmpIdentity && targetClasses.attack &&
|    |5699|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5700|5700| 				continue;
|5701|5701| 			if (cmpIdentity && targetClasses.avoid
|5702|5702| 				&& 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
|5698|5698| 			if (cmpIdentity && targetClasses.attack
|5699|5699| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5700|5700| 				continue;
|5701|    |-			if (cmpIdentity && targetClasses.avoid
|5702|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5701|+			if (cmpIdentity && targetClasses.avoid &&
|    |5702|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5703|5703| 				continue;
|5704|5704| 			// Only used by the AIs to prevent some choices of targets
|5705|5705| 			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
|5855|5855| 
|5856|5856| UnitAI.prototype.SetHeldPosition = function(x, z)
|5857|5857| {
|5858|    |-	this.heldPosition = {"x": x, "z": z};
|    |5858|+	this.heldPosition = { "x": x, "z": z};
|5859|5859| };
|5860|5860| 
|5861|5861| 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
|5855|5855| 
|5856|5856| UnitAI.prototype.SetHeldPosition = function(x, z)
|5857|5857| {
|5858|    |-	this.heldPosition = {"x": x, "z": z};
|    |5858|+	this.heldPosition = {"x": x, "z": z };
|5859|5859| };
|5860|5860| 
|5861|5861| 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
|5882|5882| 	return false;
|5883|5883| };
|5884|5884| 
|5885|    |-//// Helper functions ////
|    |5885|+// // Helper functions ////
|5886|5886| 
|5887|5887| UnitAI.prototype.CanAttack = function(target)
|5888|5888| {
|    | [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
|6086|6086| 	return cmpPack && cmpPack.IsPacking();
|6087|6087| };
|6088|6088| 
|6089|    |-//// Formation specific functions ////
|    |6089|+// // Formation specific functions ////
|6090|6090| 
|6091|6091| UnitAI.prototype.IsAttackingAsFormation = function()
|6092|6092| {
|    | [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
|6091|6091| UnitAI.prototype.IsAttackingAsFormation = function()
|6092|6092| {
|6093|6093| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6094|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6095|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6094|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6095|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6096|6096| };
|6097|6097| 
|6098|6098| //// 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
|6095|6095| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6096|6096| };
|6097|6097| 
|6098|    |-//// Animal specific functions ////
|    |6098|+// // Animal specific functions ////
|6099|6099| 
|6100|6100| UnitAI.prototype.MoveRandomly = function(distance)
|6101|6101| {

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

binaries/data/mods/public/simulation/components/UnitAI.js
|3908| »   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
|4757| »   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
|4772| »   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
|4818| »   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
|4841| »   »   ····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
|2027| »   »   »   »   »   »   &&·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
|3855| »   »   var·order·=·{·"type":·type,·"data":·data·};
|    | [NORMAL] JSHintBear:
|    | 'order' is already defined.

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

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

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

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

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

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

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

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

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

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

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

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

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

Nescio removed a subscriber: Nescio.Jan 2 2020, 8:52 PM
elexis added a comment.Jan 4 2020, 9:19 PM

I have trouble imagining a use case for auras or techs modifying ResourceGatherer/SearchRange. I guess the only reason to add it is because the modifier can be wrapped around any template value. It makes the code slightly less performant, slightly more complex (it's not obvious whether the value is set correctly in all cases) (and for resourceGatherer it also adds serialization of a new variable per entity), but the valuemodification wrap by default may be a sufficient argument to add it. Perhaps Angen or someone else has an opinion, or perhaps we can construct a use case for any mod that would use this engine.

Stan added a comment.Jan 5 2020, 12:39 AM

Might be useful in a city building mode where as the city grows units automatically start searching farther resources. I don't have a strong opinion against and its nice for modders to have the choice.

binaries/data/mods/public/simulation/components/tests/test_Builder.js
17 ↗(On Diff #10845)

Shouldn't it be a string? To catch conversion errors

Or just that units in the vicinity of an allied CC have a larger search area, because that is "safe"?

@wowgetoffyourcellphone, @Nescio do any of you have a use case for increasing the search range for gathering/building by techs/aura/status effect?

Not at the moment, though it's not inconceivable. E.g. something that increases worker vision range might want to increase gather search range as well. And fast units (e.g. cavalry) probably ought to have a greater search radius than slow units (e.g. pikemen).
It's not terribly important, though, and I doubt many people will modify it if it's in.

bb added a subscriber: bb.Jan 13 2020, 1:52 PM
bb added inline comments.
binaries/data/mods/public/simulation/components/Builder.js
15 ↗(On Diff #10845)

I guess we should do nonNegativeDecimal (allowing 0 to disable searching further)

binaries/data/mods/public/simulation/components/ResourceGatherer.js
24 ↗(On Diff #10845)

not only on depletion, also when the resource has already the max amount of gatherers. Max range to search for a new resource to gather.

binaries/data/mods/public/simulation/components/tests/test_Builder.js
15 ↗(On Diff #10845)

trailing 0

17 ↗(On Diff #10845)

In fact that is a good idea (imo), however it is done nowhere afaik

Stan added inline comments.Jan 13 2020, 2:19 PM
binaries/data/mods/public/simulation/components/tests/test_Builder.js
17 ↗(On Diff #10845)

I usually do it in test I write :D

Freagarach updated this revision to Diff 11164.Jan 23 2020, 7:15 PM
Freagarach marked 6 inline comments as done.

Inlines.

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [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
|2774|2774| 					{
|2775|2775| 						// The building was already finished/fully repaired before we arrived;
|2776|2776| 						// let the ConstructionFinished handler handle this.
|2777|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2777|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2778|2778| 						return true;
|2779|2779| 					}
|2780|2780| 
|    | [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
|2774|2774| 					{
|2775|2775| 						// The building was already finished/fully repaired before we arrived;
|2776|2776| 						// let the ConstructionFinished handler handle this.
|2777|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2777|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2778|2778| 						return true;
|2779|2779| 					}
|2780|2780| 
|    | [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
|3072|3072| 				this.StopTimer();
|3073|3073| 				this.ResetAnimation();
|3074|3074| 				if (this.formationAnimationVariant)
|3075|    |-					this.SetAnimationVariant(this.formationAnimationVariant)
|    |3075|+					this.SetAnimationVariant(this.formationAnimationVariant);
|3076|3076| 				else
|3077|3077| 					this.SetDefaultAnimationVariant();
|3078|3078| 				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
|3298|3298| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3299|3299| 
|3300|3300| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3301|    |-							// only used for domestic animals
|    |3301|+		// only used for domestic animals
|3302|3302| 
|3303|3303| 		// Reuse the same garrison behaviour for animals.
|3304|3304| 		"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
|3360|3360| 
|3361|3361| UnitAI.prototype.IsAnimal = function()
|3362|3362| {
|3363|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3363|+	return (!!this.template.NaturalBehaviour);
|3364|3364| };
|3365|3365| 
|3366|3366| 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
|3476|3476| 		{
|3477|3477| 			let index = this.GetCurrentState().indexOf(".");
|3478|3478| 			if (index != -1)
|3479|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3479|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3480|3480| 			this.Stop(false);
|3481|3481| 		}
|3482|3482| 
|    | [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
|3532|3532| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3533|3533| 			continue;
|3534|3534| 		if (i == 0)
|3535|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3535|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3536|3536| 		else
|3537|3537| 			this.orderQueue.splice(i, 1);
|3538|3538| 		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
|3532|3532| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3533|3533| 			continue;
|3534|3534| 		if (i == 0)
|3535|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3535|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3536|3536| 		else
|3537|3537| 			this.orderQueue.splice(i, 1);
|3538|3538| 		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
|3616|3616| };
|3617|3617| 
|3618|3618| 
|3619|    |-//// FSM linkage functions ////
|    |3619|+// // FSM linkage functions ////
|3620|3620| 
|3621|3621| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3622|3622| 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
|3787|3787| 				continue;
|3788|3788| 			if (this.orderQueue[i].type == type)
|3789|3789| 				continue;
|3790|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3790|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3791|3791| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3792|3792| 			return;
|3793|3793| 		}
|    | [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
|3787|3787| 				continue;
|3788|3788| 			if (this.orderQueue[i].type == type)
|3789|3789| 				continue;
|3790|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3790|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3791|3791| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3792|3792| 			return;
|3793|3793| 		}
|    | [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
|4029|4029| 	if (data.timerRepeat === undefined)
|4030|4030| 		this.timer = undefined;
|4031|4031| 
|4032|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4032|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4033|4033| };
|4034|4034| 
|4035|4035| /**
|    | [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
|4029|4029| 	if (data.timerRepeat === undefined)
|4030|4030| 		this.timer = undefined;
|4031|4031| 
|4032|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4032|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4033|4033| };
|4034|4034| 
|4035|4035| /**
|    | [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
|4074|4074| 	// TODO: This is a bit inefficient since every unit listens to every
|4075|4075| 	// construction message - ideally we could scope it to only the one we're building
|4076|4076| 
|4077|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4077|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4078|4078| };
|4079|4079| 
|4080|4080| 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
|4074|4074| 	// TODO: This is a bit inefficient since every unit listens to every
|4075|4075| 	// construction message - ideally we could scope it to only the one we're building
|4076|4076| 
|4077|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4077|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4078|4078| };
|4079|4079| 
|4080|4080| 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
|4099|4099| 
|4100|4100| UnitAI.prototype.OnAttacked = function(msg)
|4101|4101| {
|4102|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4102|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4103|4103| };
|4104|4104| 
|4105|4105| 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
|4099|4099| 
|4100|4100| UnitAI.prototype.OnAttacked = function(msg)
|4101|4101| {
|4102|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4102|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4103|4103| };
|4104|4104| 
|4105|4105| 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
|4104|4104| 
|4105|4105| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4106|4106| {
|4107|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4107|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4108|4108| };
|4109|4109| 
|4110|4110| 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
|4104|4104| 
|4105|4105| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4106|4106| {
|4107|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4107|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4108|4108| };
|4109|4109| 
|4110|4110| 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
|4109|4109| 
|4110|4110| UnitAI.prototype.OnHealthChanged = function(msg)
|4111|4111| {
|4112|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4112|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4113|4113| };
|4114|4114| 
|4115|4115| 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
|4109|4109| 
|4110|4110| UnitAI.prototype.OnHealthChanged = function(msg)
|4111|4111| {
|4112|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4112|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4113|4113| };
|4114|4114| 
|4115|4115| 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
|4115|4115| UnitAI.prototype.OnRangeUpdate = function(msg)
|4116|4116| {
|4117|4117| 	if (msg.tag == this.losRangeQuery)
|4118|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4118|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4119|4119| 	else if (msg.tag == this.losHealRangeQuery)
|4120|4120| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4121|4121| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4115|4115| UnitAI.prototype.OnRangeUpdate = function(msg)
|4116|4116| {
|4117|4117| 	if (msg.tag == this.losRangeQuery)
|4118|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4118|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4119|4119| 	else if (msg.tag == this.losHealRangeQuery)
|4120|4120| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4121|4121| };
|    | [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
|4117|4117| 	if (msg.tag == this.losRangeQuery)
|4118|4118| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4119|4119| 	else if (msg.tag == this.losHealRangeQuery)
|4120|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4120|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4121|4121| };
|4122|4122| 
|4123|4123| 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
|4117|4117| 	if (msg.tag == this.losRangeQuery)
|4118|4118| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4119|4119| 	else if (msg.tag == this.losHealRangeQuery)
|4120|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4120|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4121|4121| };
|4122|4122| 
|4123|4123| 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
|4122|4122| 
|4123|4123| UnitAI.prototype.OnPackFinished = function(msg)
|4124|4124| {
|4125|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4125|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4126|4126| };
|4127|4127| 
|4128|4128| //// 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
|4122|4122| 
|4123|4123| UnitAI.prototype.OnPackFinished = function(msg)
|4124|4124| {
|4125|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4125|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4126|4126| };
|4127|4127| 
|4128|4128| //// 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
|4125|4125| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4126|4126| };
|4127|4127| 
|4128|    |-//// Helper functions to be called by the FSM ////
|    |4128|+// // Helper functions to be called by the FSM ////
|4129|4129| 
|4130|4130| UnitAI.prototype.GetWalkSpeed = function()
|4131|4131| {
|    | [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
|4793|4793| UnitAI.prototype.AttackEntityInZone = function(ents)
|4794|4794| {
|4795|4795| 	var target = ents.find(target =>
|4796|    |-		this.CanAttack(target)
|4797|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4796|+		this.CanAttack(target) &&
|    |4797|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4798|4798| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4799|4799| 	);
|4800|4800| 	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
|4794|4794| {
|4795|4795| 	var target = ents.find(target =>
|4796|4796| 		this.CanAttack(target)
|4797|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4798|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4797|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4798|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4799|4799| 	);
|4800|4800| 	if (!target)
|4801|4801| 		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
|4858|4858| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4859|4859| 	if (this.isGuardOf)
|4860|4860| 	{
|4861|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4861|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4862|4862| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4863|4863| 		if (cmpUnitAI && cmpAttack &&
|4864|4864| 		    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
|4862|4862| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4863|4863| 		if (cmpUnitAI && cmpAttack &&
|4864|4864| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4865|    |-				return false;
|    |4865|+			return false;
|4866|4866| 	}
|4867|4867| 
|4868|4868| 	// 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
|4900|4900| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4901|4901| 	if (this.isGuardOf)
|4902|4902| 	{
|4903|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4903|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4904|4904| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4905|4905| 		if (cmpUnitAI && cmpAttack &&
|4906|4906| 		    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
|4913|4913| 	return false;
|4914|4914| };
|4915|4915| 
|4916|    |-//// External interface functions ////
|    |4916|+// // External interface functions ////
|4917|4917| 
|4918|4918| UnitAI.prototype.SetFormationController = function(ent)
|4919|4919| {
|    | [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
|5069|5069| 	{
|5070|5070| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5071|5071| 			return;
|5072|    |-		else
|5073|    |-			this.RemoveGuard();
|    |5072|+		this.RemoveGuard();
|5074|5073| 	}
|5075|5074| 
|5076|5075| 	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
|5411|5411| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5412|5412| 	{
|5413|5413| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5414|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5414|+		if (cmpTrader.HasBothMarkets() &&
|5415|5415| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5416|5416| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5417|5417| 		{
|    | [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
|5692|5692| 				{
|5693|5693| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5694|5694| 					var targetClasses = this.order.data.targetClasses;
|5695|    |-					if (targetClasses.attack && cmpIdentity
|5696|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5695|+					if (targetClasses.attack && cmpIdentity &&
|    |5696|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5697|5697| 						continue;
|5698|5698| 					if (targetClasses.avoid && cmpIdentity
|5699|5699| 						&& 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
|5695|5695| 					if (targetClasses.attack && cmpIdentity
|5696|5696| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5697|5697| 						continue;
|5698|    |-					if (targetClasses.avoid && cmpIdentity
|5699|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5698|+					if (targetClasses.avoid && cmpIdentity &&
|    |5699|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5700|5700| 						continue;
|5701|5701| 					// Only used by the AIs to prevent some choices of targets
|5702|5702| 					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
|5718|5718| 		{
|5719|5719| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5720|5720| 			var targetClasses = this.order.data.targetClasses;
|5721|    |-			if (cmpIdentity && targetClasses.attack
|5722|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5721|+			if (cmpIdentity && targetClasses.attack &&
|    |5722|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5723|5723| 				continue;
|5724|5724| 			if (cmpIdentity && targetClasses.avoid
|5725|5725| 				&& 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
|5721|5721| 			if (cmpIdentity && targetClasses.attack
|5722|5722| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5723|5723| 				continue;
|5724|    |-			if (cmpIdentity && targetClasses.avoid
|5725|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5724|+			if (cmpIdentity && targetClasses.avoid &&
|    |5725|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5726|5726| 				continue;
|5727|5727| 			// Only used by the AIs to prevent some choices of targets
|5728|5728| 			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
|5878|5878| 
|5879|5879| UnitAI.prototype.SetHeldPosition = function(x, z)
|5880|5880| {
|5881|    |-	this.heldPosition = {"x": x, "z": z};
|    |5881|+	this.heldPosition = { "x": x, "z": z};
|5882|5882| };
|5883|5883| 
|5884|5884| 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
|5878|5878| 
|5879|5879| UnitAI.prototype.SetHeldPosition = function(x, z)
|5880|5880| {
|5881|    |-	this.heldPosition = {"x": x, "z": z};
|    |5881|+	this.heldPosition = {"x": x, "z": z };
|5882|5882| };
|5883|5883| 
|5884|5884| 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
|5905|5905| 	return false;
|5906|5906| };
|5907|5907| 
|5908|    |-//// Helper functions ////
|    |5908|+// // Helper functions ////
|5909|5909| 
|5910|5910| UnitAI.prototype.CanAttack = function(target)
|5911|5911| {
|    | [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
|6103|6103| 	return cmpPack && cmpPack.IsPacking();
|6104|6104| };
|6105|6105| 
|6106|    |-//// Formation specific functions ////
|    |6106|+// // Formation specific functions ////
|6107|6107| 
|6108|6108| UnitAI.prototype.IsAttackingAsFormation = function()
|6109|6109| {
|    | [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
|6108|6108| UnitAI.prototype.IsAttackingAsFormation = function()
|6109|6109| {
|6110|6110| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6111|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6112|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6111|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6112|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6113|6113| };
|6114|6114| 
|6115|6115| //// 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
|6112|6112| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6113|6113| };
|6114|6114| 
|6115|    |-//// Animal specific functions ////
|    |6115|+// // Animal specific functions ////
|6116|6116| 
|6117|6117| UnitAI.prototype.MoveRandomly = function(distance)
|6118|6118| {

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
|3934| »   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
|4780| »   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
|4795| »   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
|4841| »   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
|4864| »   »   ····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
|3075| »   »   »   »   »   this.SetAnimationVariant(this.formationAnimationVariant)
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

(Instead of defining a search range, one could just use the vision range.)

Nescio removed a subscriber: Nescio.Apr 22 2020, 9:31 AM

It doesn't seem actually worth caching the search range value, since that value is not used that often and further it's rather fast to calculate anyways. You're basically adding a cache on top of the regular modifiers manager cache, as that value probably won't get outdated too often.

The gather rate code is cached because otherwise we'd be running it dozens of time every turn (on every gather), but we're not calling FindNearbyResource _that_ often.

You could measure the perf difference between "inlining+no tech" and "calling a function+tech", and report it profilers show that this is worth doing.

bb added a subscriber: FeXoR.EditedSep 25 2020, 4:38 PM

On the caching: since we already listen to the modifactionUpdate messages adding the cache does not lower much performance. It gains very little performance in execution. But lowers the performance of (de)serialisation and makes the OOS logs unnecessarily larger.

Does it make sense to define this value in the Gatherer/Builder component? If unitAI must make up a unit's mind how to react to orders, then gathering a tree near the ordered one is unitAI decision making, making the value a unitAI thingy? Also considering D2662, this might make more sense: resourceGatherer never uses the value, only unitAI does.

When at @FeXoR's , he argued that the current behaviour is weird: iirc his argument was "When I order a player to gather a tree, it should gather a tree. So either gather just THAT tree, or gather 'tree' wherever it is on the map. Why is there a random value set for it to gather other trees?" I guess the most common answer to the question is "We don't want units to wonder off to far". However the problem at hand did get me thinking: Why is that value randomly set? Why isn't it user definable? (maybe little bit similar to batch-size, but not quite) Moving the value to the template does not change this. Making it user definable, however isn't trivial either, since every player needs to set his value at the start of the game, and any time (s)he changes it (t's not GUI, as batch-size is!!). Or the value should be made gui and thus passed in the commands.

binaries/data/mods/public/simulation/components/ResourceGatherer.js
107 ↗(On Diff #10845)

performance-critical

Freagarach planned changes to this revision.Sep 25 2020, 5:00 PM

Very good points :) What about just using the vision range?
Gather a tree there, is the tree gone, _look_ for another tree.