Page MenuHomeWildfire Games

Use specific walking variants when approaching gathering
ClosedPublic

Authored by Silier on Dec 28 2019, 5:11 PM.

Details

Summary

Switch to citizen walking with working tools when approaching some resource to gather from.

It is nice visual change, it removes visual switching between soldier and citizen when gathering resources.

Test Plan

Agree it is nice to have.
Test unit always has correct visual when approaching resources and it switches back to default.

Diff Detail

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

Event Timeline

Silier created this revision.Dec 28 2019, 5:11 PM
Owners added a subscriber: Restricted Owners Package.Dec 28 2019, 5:11 PM

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

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

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
|2759|2759| 					{
|2760|2760| 						// The building was already finished/fully repaired before we arrived;
|2761|2761| 						// let the ConstructionFinished handler handle this.
|2762|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2762|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2763|2763| 						return true;
|2764|2764| 					}
|2765|2765| 
|    | [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
|2759|2759| 					{
|2760|2760| 						// The building was already finished/fully repaired before we arrived;
|2761|2761| 						// let the ConstructionFinished handler handle this.
|2762|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2762|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2763|2763| 						return true;
|2764|2764| 					}
|2765|2765| 
|    | [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
|3279|3279| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3280|3280| 
|3281|3281| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3282|    |-							// only used for domestic animals
|    |3282|+		// only used for domestic animals
|3283|3283| 	},
|3284|3284| };
|3285|3285| 
|    | [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
|3336|3336| 
|3337|3337| UnitAI.prototype.IsAnimal = function()
|3338|3338| {
|3339|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3339|+	return (!!this.template.NaturalBehaviour);
|3340|3340| };
|3341|3341| 
|3342|3342| 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
|3452|3452| 		{
|3453|3453| 			let index = this.GetCurrentState().indexOf(".");
|3454|3454| 			if (index != -1)
|3455|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3455|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3456|3456| 			this.Stop(false);
|3457|3457| 		}
|3458|3458| 
|    | [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
|3508|3508| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3509|3509| 			continue;
|3510|3510| 		if (i == 0)
|3511|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3511|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3512|3512| 		else
|3513|3513| 			this.orderQueue.splice(i, 1);
|3514|3514| 		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
|3508|3508| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3509|3509| 			continue;
|3510|3510| 		if (i == 0)
|3511|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3511|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3512|3512| 		else
|3513|3513| 			this.orderQueue.splice(i, 1);
|3514|3514| 		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
|3592|3592| };
|3593|3593| 
|3594|3594| 
|3595|    |-//// FSM linkage functions ////
|    |3595|+// // FSM linkage functions ////
|3596|3596| 
|3597|3597| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3598|3598| 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
|3762|3762| 				continue;
|3763|3763| 			if (this.orderQueue[i].type == type)
|3764|3764| 				continue;
|3765|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3765|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3766|3766| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3767|3767| 			return;
|3768|3768| 		}
|    | [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
|3762|3762| 				continue;
|3763|3763| 			if (this.orderQueue[i].type == type)
|3764|3764| 				continue;
|3765|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3765|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3766|3766| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3767|3767| 			return;
|3768|3768| 		}
|    | [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
|4004|4004| 	if (data.timerRepeat === undefined)
|4005|4005| 		this.timer = undefined;
|4006|4006| 
|4007|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4007|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4008|4008| };
|4009|4009| 
|4010|4010| /**
|    | [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
|4004|4004| 	if (data.timerRepeat === undefined)
|4005|4005| 		this.timer = undefined;
|4006|4006| 
|4007|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4007|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4008|4008| };
|4009|4009| 
|4010|4010| /**
|    | [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
|4049|4049| 	// TODO: This is a bit inefficient since every unit listens to every
|4050|4050| 	// construction message - ideally we could scope it to only the one we're building
|4051|4051| 
|4052|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4052|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4053|4053| };
|4054|4054| 
|4055|4055| 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
|4049|4049| 	// TODO: This is a bit inefficient since every unit listens to every
|4050|4050| 	// construction message - ideally we could scope it to only the one we're building
|4051|4051| 
|4052|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4052|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4053|4053| };
|4054|4054| 
|4055|4055| 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
|4074|4074| 
|4075|4075| UnitAI.prototype.OnAttacked = function(msg)
|4076|4076| {
|4077|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4077|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4078|4078| };
|4079|4079| 
|4080|4080| 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
|4074|4074| 
|4075|4075| UnitAI.prototype.OnAttacked = function(msg)
|4076|4076| {
|4077|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4077|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4078|4078| };
|4079|4079| 
|4080|4080| 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
|4079|4079| 
|4080|4080| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4081|4081| {
|4082|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4082|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4083|4083| };
|4084|4084| 
|4085|4085| 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
|4079|4079| 
|4080|4080| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4081|4081| {
|4082|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4082|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4083|4083| };
|4084|4084| 
|4085|4085| 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
|4084|4084| 
|4085|4085| UnitAI.prototype.OnHealthChanged = function(msg)
|4086|4086| {
|4087|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4087|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4088|4088| };
|4089|4089| 
|4090|4090| 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
|4084|4084| 
|4085|4085| UnitAI.prototype.OnHealthChanged = function(msg)
|4086|4086| {
|4087|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4087|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4088|4088| };
|4089|4089| 
|4090|4090| 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
|4090|4090| UnitAI.prototype.OnRangeUpdate = function(msg)
|4091|4091| {
|4092|4092| 	if (msg.tag == this.losRangeQuery)
|4093|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4093|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4094|4094| 	else if (msg.tag == this.losHealRangeQuery)
|4095|4095| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4096|4096| };
|    | [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
|4090|4090| UnitAI.prototype.OnRangeUpdate = function(msg)
|4091|4091| {
|4092|4092| 	if (msg.tag == this.losRangeQuery)
|4093|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4093|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4094|4094| 	else if (msg.tag == this.losHealRangeQuery)
|4095|4095| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4096|4096| };
|    | [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
|4092|4092| 	if (msg.tag == this.losRangeQuery)
|4093|4093| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4094|4094| 	else if (msg.tag == this.losHealRangeQuery)
|4095|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4095|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4096|4096| };
|4097|4097| 
|4098|4098| 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
|4092|4092| 	if (msg.tag == this.losRangeQuery)
|4093|4093| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4094|4094| 	else if (msg.tag == this.losHealRangeQuery)
|4095|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4095|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4096|4096| };
|4097|4097| 
|4098|4098| 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
|4097|4097| 
|4098|4098| UnitAI.prototype.OnPackFinished = function(msg)
|4099|4099| {
|4100|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4100|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4101|4101| };
|4102|4102| 
|4103|4103| //// 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
|4097|4097| 
|4098|4098| UnitAI.prototype.OnPackFinished = function(msg)
|4099|4099| {
|4100|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4100|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4101|4101| };
|4102|4102| 
|4103|4103| //// 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
|4100|4100| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4101|4101| };
|4102|4102| 
|4103|    |-//// Helper functions to be called by the FSM ////
|    |4103|+// // Helper functions to be called by the FSM ////
|4104|4104| 
|4105|4105| UnitAI.prototype.GetWalkSpeed = function()
|4106|4106| {
|    | [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
|3909| »   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
|3856| »   »   var·order·=·{·"type":·type,·"data":·data·};
|    | [NORMAL] JSHintBear:
|    | 'order' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|3940| »   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/1422/display/redirect

Stan added a subscriber: Stan.Dec 28 2019, 10:23 PM

I like the idea.
How do you plan to edit all the actors to support this?
Changes in the example actors look good. Don't forget setting EOL to native.

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

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

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

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

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
|2759|2759| 					{
|2760|2760| 						// The building was already finished/fully repaired before we arrived;
|2761|2761| 						// let the ConstructionFinished handler handle this.
|2762|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2762|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2763|2763| 						return true;
|2764|2764| 					}
|2765|2765| 
|    | [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
|2759|2759| 					{
|2760|2760| 						// The building was already finished/fully repaired before we arrived;
|2761|2761| 						// let the ConstructionFinished handler handle this.
|2762|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2762|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2763|2763| 						return true;
|2764|2764| 					}
|2765|2765| 
|    | [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
|3279|3279| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3280|3280| 
|3281|3281| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3282|    |-							// only used for domestic animals
|    |3282|+		// only used for domestic animals
|3283|3283| 	},
|3284|3284| };
|3285|3285| 
|    | [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
|3336|3336| 
|3337|3337| UnitAI.prototype.IsAnimal = function()
|3338|3338| {
|3339|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3339|+	return (!!this.template.NaturalBehaviour);
|3340|3340| };
|3341|3341| 
|3342|3342| 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
|3452|3452| 		{
|3453|3453| 			let index = this.GetCurrentState().indexOf(".");
|3454|3454| 			if (index != -1)
|3455|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3455|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3456|3456| 			this.Stop(false);
|3457|3457| 		}
|3458|3458| 
|    | [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
|3508|3508| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3509|3509| 			continue;
|3510|3510| 		if (i == 0)
|3511|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3511|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3512|3512| 		else
|3513|3513| 			this.orderQueue.splice(i, 1);
|3514|3514| 		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
|3508|3508| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3509|3509| 			continue;
|3510|3510| 		if (i == 0)
|3511|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3511|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3512|3512| 		else
|3513|3513| 			this.orderQueue.splice(i, 1);
|3514|3514| 		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
|3592|3592| };
|3593|3593| 
|3594|3594| 
|3595|    |-//// FSM linkage functions ////
|    |3595|+// // FSM linkage functions ////
|3596|3596| 
|3597|3597| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3598|3598| 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
|3762|3762| 				continue;
|3763|3763| 			if (this.orderQueue[i].type == type)
|3764|3764| 				continue;
|3765|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3765|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3766|3766| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3767|3767| 			return;
|3768|3768| 		}
|    | [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
|3762|3762| 				continue;
|3763|3763| 			if (this.orderQueue[i].type == type)
|3764|3764| 				continue;
|3765|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3765|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3766|3766| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3767|3767| 			return;
|3768|3768| 		}
|    | [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
|4004|4004| 	if (data.timerRepeat === undefined)
|4005|4005| 		this.timer = undefined;
|4006|4006| 
|4007|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4007|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4008|4008| };
|4009|4009| 
|4010|4010| /**
|    | [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
|4004|4004| 	if (data.timerRepeat === undefined)
|4005|4005| 		this.timer = undefined;
|4006|4006| 
|4007|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4007|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4008|4008| };
|4009|4009| 
|4010|4010| /**
|    | [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
|4049|4049| 	// TODO: This is a bit inefficient since every unit listens to every
|4050|4050| 	// construction message - ideally we could scope it to only the one we're building
|4051|4051| 
|4052|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4052|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4053|4053| };
|4054|4054| 
|4055|4055| 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
|4049|4049| 	// TODO: This is a bit inefficient since every unit listens to every
|4050|4050| 	// construction message - ideally we could scope it to only the one we're building
|4051|4051| 
|4052|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4052|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4053|4053| };
|4054|4054| 
|4055|4055| 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
|4074|4074| 
|4075|4075| UnitAI.prototype.OnAttacked = function(msg)
|4076|4076| {
|4077|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4077|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4078|4078| };
|4079|4079| 
|4080|4080| 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
|4074|4074| 
|4075|4075| UnitAI.prototype.OnAttacked = function(msg)
|4076|4076| {
|4077|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4077|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4078|4078| };
|4079|4079| 
|4080|4080| 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
|4079|4079| 
|4080|4080| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4081|4081| {
|4082|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4082|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4083|4083| };
|4084|4084| 
|4085|4085| 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
|4079|4079| 
|4080|4080| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4081|4081| {
|4082|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4082|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4083|4083| };
|4084|4084| 
|4085|4085| 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
|4084|4084| 
|4085|4085| UnitAI.prototype.OnHealthChanged = function(msg)
|4086|4086| {
|4087|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4087|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4088|4088| };
|4089|4089| 
|4090|4090| 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
|4084|4084| 
|4085|4085| UnitAI.prototype.OnHealthChanged = function(msg)
|4086|4086| {
|4087|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4087|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4088|4088| };
|4089|4089| 
|4090|4090| 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
|4090|4090| UnitAI.prototype.OnRangeUpdate = function(msg)
|4091|4091| {
|4092|4092| 	if (msg.tag == this.losRangeQuery)
|4093|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4093|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4094|4094| 	else if (msg.tag == this.losHealRangeQuery)
|4095|4095| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4096|4096| };
|    | [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
|4090|4090| UnitAI.prototype.OnRangeUpdate = function(msg)
|4091|4091| {
|4092|4092| 	if (msg.tag == this.losRangeQuery)
|4093|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4093|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4094|4094| 	else if (msg.tag == this.losHealRangeQuery)
|4095|4095| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4096|4096| };
|    | [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
|4092|4092| 	if (msg.tag == this.losRangeQuery)
|4093|4093| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4094|4094| 	else if (msg.tag == this.losHealRangeQuery)
|4095|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4095|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4096|4096| };
|4097|4097| 
|4098|4098| 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
|4092|4092| 	if (msg.tag == this.losRangeQuery)
|4093|4093| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4094|4094| 	else if (msg.tag == this.losHealRangeQuery)
|4095|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4095|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4096|4096| };
|4097|4097| 
|4098|4098| 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
|4097|4097| 
|4098|4098| UnitAI.prototype.OnPackFinished = function(msg)
|4099|4099| {
|4100|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4100|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4101|4101| };
|4102|4102| 
|4103|4103| //// 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
|4097|4097| 
|4098|4098| UnitAI.prototype.OnPackFinished = function(msg)
|4099|4099| {
|4100|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4100|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4101|4101| };
|4102|4102| 
|4103|4103| //// 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
|4100|4100| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4101|4101| };
|4102|4102| 
|4103|    |-//// Helper functions to be called by the FSM ////
|    |4103|+// // Helper functions to be called by the FSM ////
|4104|4104| 
|4105|4105| UnitAI.prototype.GetWalkSpeed = function()
|4106|4106| {
|    | [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
|3909| »   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
|3856| »   »   var·order·=·{·"type":·type,·"data":·data·};
|    | [NORMAL] JSHintBear:
|    | 'order' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|3940| »   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/1445/display/redirect

Silier updated this revision to Diff 10849.Jan 3 2020, 1:51 PM

add variations to needed capes

Vulcan added a comment.Jan 3 2020, 1:54 PM

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

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

Vulcan added a comment.Jan 3 2020, 1:56 PM

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

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

Vulcan added a comment.Jan 3 2020, 1:59 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
|2759|2759| 					{
|2760|2760| 						// The building was already finished/fully repaired before we arrived;
|2761|2761| 						// let the ConstructionFinished handler handle this.
|2762|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2762|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2763|2763| 						return true;
|2764|2764| 					}
|2765|2765| 
|    | [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
|2759|2759| 					{
|2760|2760| 						// The building was already finished/fully repaired before we arrived;
|2761|2761| 						// let the ConstructionFinished handler handle this.
|2762|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2762|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2763|2763| 						return true;
|2764|2764| 					}
|2765|2765| 
|    | [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
|3279|3279| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3280|3280| 
|3281|3281| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3282|    |-							// only used for domestic animals
|    |3282|+		// only used for domestic animals
|3283|3283| 	},
|3284|3284| };
|3285|3285| 
|    | [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
|3336|3336| 
|3337|3337| UnitAI.prototype.IsAnimal = function()
|3338|3338| {
|3339|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3339|+	return (!!this.template.NaturalBehaviour);
|3340|3340| };
|3341|3341| 
|3342|3342| 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
|3452|3452| 		{
|3453|3453| 			let index = this.GetCurrentState().indexOf(".");
|3454|3454| 			if (index != -1)
|3455|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3455|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3456|3456| 			this.Stop(false);
|3457|3457| 		}
|3458|3458| 
|    | [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
|3508|3508| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3509|3509| 			continue;
|3510|3510| 		if (i == 0)
|3511|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3511|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3512|3512| 		else
|3513|3513| 			this.orderQueue.splice(i, 1);
|3514|3514| 		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
|3508|3508| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3509|3509| 			continue;
|3510|3510| 		if (i == 0)
|3511|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3511|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3512|3512| 		else
|3513|3513| 			this.orderQueue.splice(i, 1);
|3514|3514| 		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
|3592|3592| };
|3593|3593| 
|3594|3594| 
|3595|    |-//// FSM linkage functions ////
|    |3595|+// // FSM linkage functions ////
|3596|3596| 
|3597|3597| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3598|3598| 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
|3762|3762| 				continue;
|3763|3763| 			if (this.orderQueue[i].type == type)
|3764|3764| 				continue;
|3765|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3765|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3766|3766| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3767|3767| 			return;
|3768|3768| 		}
|    | [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
|3762|3762| 				continue;
|3763|3763| 			if (this.orderQueue[i].type == type)
|3764|3764| 				continue;
|3765|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3765|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3766|3766| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3767|3767| 			return;
|3768|3768| 		}
|    | [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
|4004|4004| 	if (data.timerRepeat === undefined)
|4005|4005| 		this.timer = undefined;
|4006|4006| 
|4007|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4007|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4008|4008| };
|4009|4009| 
|4010|4010| /**
|    | [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
|4004|4004| 	if (data.timerRepeat === undefined)
|4005|4005| 		this.timer = undefined;
|4006|4006| 
|4007|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4007|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4008|4008| };
|4009|4009| 
|4010|4010| /**
|    | [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
|4049|4049| 	// TODO: This is a bit inefficient since every unit listens to every
|4050|4050| 	// construction message - ideally we could scope it to only the one we're building
|4051|4051| 
|4052|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4052|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4053|4053| };
|4054|4054| 
|4055|4055| 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
|4049|4049| 	// TODO: This is a bit inefficient since every unit listens to every
|4050|4050| 	// construction message - ideally we could scope it to only the one we're building
|4051|4051| 
|4052|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4052|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4053|4053| };
|4054|4054| 
|4055|4055| 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
|4074|4074| 
|4075|4075| UnitAI.prototype.OnAttacked = function(msg)
|4076|4076| {
|4077|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4077|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4078|4078| };
|4079|4079| 
|4080|4080| 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
|4074|4074| 
|4075|4075| UnitAI.prototype.OnAttacked = function(msg)
|4076|4076| {
|4077|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4077|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4078|4078| };
|4079|4079| 
|4080|4080| 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
|4079|4079| 
|4080|4080| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4081|4081| {
|4082|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4082|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4083|4083| };
|4084|4084| 
|4085|4085| 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
|4079|4079| 
|4080|4080| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4081|4081| {
|4082|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4082|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4083|4083| };
|4084|4084| 
|4085|4085| 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
|4084|4084| 
|4085|4085| UnitAI.prototype.OnHealthChanged = function(msg)
|4086|4086| {
|4087|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4087|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4088|4088| };
|4089|4089| 
|4090|4090| 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
|4084|4084| 
|4085|4085| UnitAI.prototype.OnHealthChanged = function(msg)
|4086|4086| {
|4087|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4087|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4088|4088| };
|4089|4089| 
|4090|4090| 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
|4090|4090| UnitAI.prototype.OnRangeUpdate = function(msg)
|4091|4091| {
|4092|4092| 	if (msg.tag == this.losRangeQuery)
|4093|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4093|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4094|4094| 	else if (msg.tag == this.losHealRangeQuery)
|4095|4095| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4096|4096| };
|    | [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
|4090|4090| UnitAI.prototype.OnRangeUpdate = function(msg)
|4091|4091| {
|4092|4092| 	if (msg.tag == this.losRangeQuery)
|4093|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4093|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4094|4094| 	else if (msg.tag == this.losHealRangeQuery)
|4095|4095| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4096|4096| };
|    | [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
|4092|4092| 	if (msg.tag == this.losRangeQuery)
|4093|4093| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4094|4094| 	else if (msg.tag == this.losHealRangeQuery)
|4095|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4095|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4096|4096| };
|4097|4097| 
|4098|4098| 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
|4092|4092| 	if (msg.tag == this.losRangeQuery)
|4093|4093| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4094|4094| 	else if (msg.tag == this.losHealRangeQuery)
|4095|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4095|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4096|4096| };
|4097|4097| 
|4098|4098| 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
|4097|4097| 
|4098|4098| UnitAI.prototype.OnPackFinished = function(msg)
|4099|4099| {
|4100|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4100|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4101|4101| };
|4102|4102| 
|4103|4103| //// 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
|4097|4097| 
|4098|4098| UnitAI.prototype.OnPackFinished = function(msg)
|4099|4099| {
|4100|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4100|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4101|4101| };
|4102|4102| 
|4103|4103| //// 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
|4100|4100| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4101|4101| };
|4102|4102| 
|4103|    |-//// Helper functions to be called by the FSM ////
|    |4103|+// // Helper functions to be called by the FSM ////
|4104|4104| 
|4105|4105| UnitAI.prototype.GetWalkSpeed = function()
|4106|4106| {
|    | [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
|3909| »   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
|3856| »   »   var·order·=·{·"type":·type,·"data":·data·};
|    | [NORMAL] JSHintBear:
|    | 'order' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|3940| »   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/1446/display/redirect

Silier edited the summary of this revision. (Show Details)Jan 8 2020, 7:56 AM
Stan added a comment.Jan 8 2020, 9:09 AM

Remind me to make a gif about it.

Silier planned changes to this revision.Jan 10 2020, 11:27 AM

Needs idle variants of approaching animtions because units sometimes stops while walking due obstructions.

In D2518#106786, @Angen wrote:

Needs idle variants of approaching animtions because units sometimes stops while walking due obstructions.

Added in rP23371

Silier updated this revision to Diff 10982.Jan 12 2020, 2:09 PM

use idle animations

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

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

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

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

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
| 782| 782| 					this.FinishOrder();
| 783| 783| 					return;
| 784| 784| 				}
| 785|    |-				else
| 786|    |-				{
|    | 785|+				
| 787| 786| 					this.SetNextState("GARRISON.APPROACHING");
| 788| 787| 					return;
| 789|    |-				}
|    | 788|+				
| 790| 789| 			}
| 791| 790| 
| 792| 791| 			this.SetNextState("GARRISON.GARRISONING");
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'GARRISON'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1054|1054| 			},
|1055|1055| 		},
|1056|1056| 
|1057|    |-		"GARRISON":{
|    |1057|+		"GARRISON": {
|1058|1058| 			"APPROACHING": {
|1059|1059| 				"enter": function() {
|1060|1060| 					if (!this.MoveToGarrisonRange(this.order.data.target))
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2032|2032| 
|2033|2033| 				"Attacked": function(msg) {
|2034|2034| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2035|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2036|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2035|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2036|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2037|2037| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2038|2038| 				},
|2039|2039| 			},
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2768|2768| 					{
|2769|2769| 						// The building was already finished/fully repaired before we arrived;
|2770|2770| 						// let the ConstructionFinished handler handle this.
|2771|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2771|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2772|2772| 						return true;
|2773|2773| 					}
|2774|2774| 
|    | [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
|2768|2768| 					{
|2769|2769| 						// The building was already finished/fully repaired before we arrived;
|2770|2770| 						// let the ConstructionFinished handler handle this.
|2771|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2771|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2772|2772| 						return true;
|2773|2773| 					}
|2774|2774| 
|    | [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
|3066|3066| 				this.StopTimer();
|3067|3067| 				this.ResetAnimation();
|3068|3068| 				if (this.formationAnimationVariant)
|3069|    |-					this.SetAnimationVariant(this.formationAnimationVariant)
|    |3069|+					this.SetAnimationVariant(this.formationAnimationVariant);
|3070|3070| 				else
|3071|3071| 					this.SetDefaultAnimationVariant();
|3072|3072| 				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
|3292|3292| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3293|3293| 
|3294|3294| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3295|    |-							// only used for domestic animals
|    |3295|+		// only used for domestic animals
|3296|3296| 	},
|3297|3297| };
|3298|3298| 
|    | [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
|3351|3351| 
|3352|3352| UnitAI.prototype.IsAnimal = function()
|3353|3353| {
|3354|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3354|+	return (!!this.template.NaturalBehaviour);
|3355|3355| };
|3356|3356| 
|3357|3357| 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
|3467|3467| 		{
|3468|3468| 			let index = this.GetCurrentState().indexOf(".");
|3469|3469| 			if (index != -1)
|3470|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3470|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3471|3471| 			this.Stop(false);
|3472|3472| 		}
|3473|3473| 
|    | [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
|3523|3523| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3524|3524| 			continue;
|3525|3525| 		if (i == 0)
|3526|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3526|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3527|3527| 		else
|3528|3528| 			this.orderQueue.splice(i, 1);
|3529|3529| 		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
|3523|3523| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3524|3524| 			continue;
|3525|3525| 		if (i == 0)
|3526|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3526|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3527|3527| 		else
|3528|3528| 			this.orderQueue.splice(i, 1);
|3529|3529| 		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
|3607|3607| };
|3608|3608| 
|3609|3609| 
|3610|    |-//// FSM linkage functions ////
|    |3610|+// // FSM linkage functions ////
|3611|3611| 
|3612|3612| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3613|3613| 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
|3778|3778| 				continue;
|3779|3779| 			if (this.orderQueue[i].type == type)
|3780|3780| 				continue;
|3781|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3781|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3782|3782| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3783|3783| 			return;
|3784|3784| 		}
|    | [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
|3778|3778| 				continue;
|3779|3779| 			if (this.orderQueue[i].type == type)
|3780|3780| 				continue;
|3781|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3781|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3782|3782| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3783|3783| 			return;
|3784|3784| 		}
|    | [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
|4020|4020| 	if (data.timerRepeat === undefined)
|4021|4021| 		this.timer = undefined;
|4022|4022| 
|4023|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4023|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4024|4024| };
|4025|4025| 
|4026|4026| /**
|    | [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
|4020|4020| 	if (data.timerRepeat === undefined)
|4021|4021| 		this.timer = undefined;
|4022|4022| 
|4023|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4023|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4024|4024| };
|4025|4025| 
|4026|4026| /**
|    | [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
|4065|4065| 	// TODO: This is a bit inefficient since every unit listens to every
|4066|4066| 	// construction message - ideally we could scope it to only the one we're building
|4067|4067| 
|4068|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4068|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4069|4069| };
|4070|4070| 
|4071|4071| 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
|4065|4065| 	// TODO: This is a bit inefficient since every unit listens to every
|4066|4066| 	// construction message - ideally we could scope it to only the one we're building
|4067|4067| 
|4068|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4068|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4069|4069| };
|4070|4070| 
|4071|4071| 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
|4090|4090| 
|4091|4091| UnitAI.prototype.OnAttacked = function(msg)
|4092|4092| {
|4093|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4093|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4094|4094| };
|4095|4095| 
|4096|4096| 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
|4090|4090| 
|4091|4091| UnitAI.prototype.OnAttacked = function(msg)
|4092|4092| {
|4093|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4093|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4094|4094| };
|4095|4095| 
|4096|4096| 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
|4095|4095| 
|4096|4096| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4097|4097| {
|4098|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4098|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4099|4099| };
|4100|4100| 
|4101|4101| 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
|4095|4095| 
|4096|4096| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4097|4097| {
|4098|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4098|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4099|4099| };
|4100|4100| 
|4101|4101| 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
|4100|4100| 
|4101|4101| UnitAI.prototype.OnHealthChanged = function(msg)
|4102|4102| {
|4103|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4103|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4104|4104| };
|4105|4105| 
|4106|4106| 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
|4100|4100| 
|4101|4101| UnitAI.prototype.OnHealthChanged = function(msg)
|4102|4102| {
|4103|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4103|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4104|4104| };
|4105|4105| 
|4106|4106| 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
|4106|4106| UnitAI.prototype.OnRangeUpdate = function(msg)
|4107|4107| {
|4108|4108| 	if (msg.tag == this.losRangeQuery)
|4109|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4109|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4110|4110| 	else if (msg.tag == this.losHealRangeQuery)
|4111|4111| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4112|4112| };
|    | [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
|4106|4106| UnitAI.prototype.OnRangeUpdate = function(msg)
|4107|4107| {
|4108|4108| 	if (msg.tag == this.losRangeQuery)
|4109|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4109|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4110|4110| 	else if (msg.tag == this.losHealRangeQuery)
|4111|4111| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4112|4112| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4108|4108| 	if (msg.tag == this.losRangeQuery)
|4109|4109| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4110|4110| 	else if (msg.tag == this.losHealRangeQuery)
|4111|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4111|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4112|4112| };
|4113|4113| 
|4114|4114| 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
|4108|4108| 	if (msg.tag == this.losRangeQuery)
|4109|4109| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4110|4110| 	else if (msg.tag == this.losHealRangeQuery)
|4111|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4111|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4112|4112| };
|4113|4113| 
|4114|4114| 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
|4113|4113| 
|4114|4114| UnitAI.prototype.OnPackFinished = function(msg)
|4115|4115| {
|4116|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4116|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4117|4117| };
|4118|4118| 
|4119|4119| //// 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
|4113|4113| 
|4114|4114| UnitAI.prototype.OnPackFinished = function(msg)
|4115|4115| {
|4116|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4116|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4117|4117| };
|4118|4118| 
|4119|4119| //// 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
|4116|4116| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4117|4117| };
|4118|4118| 
|4119|    |-//// Helper functions to be called by the FSM ////
|    |4119|+// // Helper functions to be called by the FSM ////
|4120|4120| 
|4121|4121| UnitAI.prototype.GetWalkSpeed = function()
|4122|4122| {
|    | [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
|4781|4781| UnitAI.prototype.AttackEntityInZone = function(ents)
|4782|4782| {
|4783|4783| 	var target = ents.find(target =>
|4784|    |-		this.CanAttack(target)
|4785|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4784|+		this.CanAttack(target) &&
|    |4785|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4786|4786| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4787|4787| 	);
|4788|4788| 	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
|4782|4782| {
|4783|4783| 	var target = ents.find(target =>
|4784|4784| 		this.CanAttack(target)
|4785|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4786|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4785|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4786|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4787|4787| 	);
|4788|4788| 	if (!target)
|4789|4789| 		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
|4846|4846| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4847|4847| 	if (this.isGuardOf)
|4848|4848| 	{
|4849|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4849|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4850|4850| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4851|4851| 		if (cmpUnitAI && cmpAttack &&
|4852|4852| 		    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
|4850|4850| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4851|4851| 		if (cmpUnitAI && cmpAttack &&
|4852|4852| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4853|    |-				return false;
|    |4853|+			return false;
|4854|4854| 	}
|4855|4855| 
|4856|4856| 	// 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
|4888|4888| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4889|4889| 	if (this.isGuardOf)
|4890|4890| 	{
|4891|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4891|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4892|4892| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4893|4893| 		if (cmpUnitAI && cmpAttack &&
|4894|4894| 		    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
|4901|4901| 	return false;
|4902|4902| };
|4903|4903| 
|4904|    |-//// External interface functions ////
|    |4904|+// // External interface functions ////
|4905|4905| 
|4906|4906| UnitAI.prototype.SetFormationController = function(ent)
|4907|4907| {
|    | [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
|5057|5057| 	{
|5058|5058| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5059|5059| 			return;
|5060|    |-		else
|5061|    |-			this.RemoveGuard();
|    |5060|+		this.RemoveGuard();
|5062|5061| 	}
|5063|5062| 
|5064|5063| 	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
|5399|5399| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5400|5400| 	{
|5401|5401| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5402|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5402|+		if (cmpTrader.HasBothMarkets() &&
|5403|5403| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5404|5404| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5405|5405| 		{
|    | [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
|5680|5680| 				{
|5681|5681| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5682|5682| 					var targetClasses = this.order.data.targetClasses;
|5683|    |-					if (targetClasses.attack && cmpIdentity
|5684|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5683|+					if (targetClasses.attack && cmpIdentity &&
|    |5684|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5685|5685| 						continue;
|5686|5686| 					if (targetClasses.avoid && cmpIdentity
|5687|5687| 						&& 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
|5683|5683| 					if (targetClasses.attack && cmpIdentity
|5684|5684| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5685|5685| 						continue;
|5686|    |-					if (targetClasses.avoid && cmpIdentity
|5687|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5686|+					if (targetClasses.avoid && cmpIdentity &&
|    |5687|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5688|5688| 						continue;
|5689|5689| 					// Only used by the AIs to prevent some choices of targets
|5690|5690| 					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
|5706|5706| 		{
|5707|5707| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5708|5708| 			var targetClasses = this.order.data.targetClasses;
|5709|    |-			if (cmpIdentity && targetClasses.attack
|5710|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5709|+			if (cmpIdentity && targetClasses.attack &&
|    |5710|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5711|5711| 				continue;
|5712|5712| 			if (cmpIdentity && targetClasses.avoid
|5713|5713| 				&& 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
|5709|5709| 			if (cmpIdentity && targetClasses.attack
|5710|5710| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5711|5711| 				continue;
|5712|    |-			if (cmpIdentity && targetClasses.avoid
|5713|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5712|+			if (cmpIdentity && targetClasses.avoid &&
|    |5713|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5714|5714| 				continue;
|5715|5715| 			// Only used by the AIs to prevent some choices of targets
|5716|5716| 			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
|5866|5866| 
|5867|5867| UnitAI.prototype.SetHeldPosition = function(x, z)
|5868|5868| {
|5869|    |-	this.heldPosition = {"x": x, "z": z};
|    |5869|+	this.heldPosition = { "x": x, "z": z};
|5870|5870| };
|5871|5871| 
|5872|5872| 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
|5866|5866| 
|5867|5867| UnitAI.prototype.SetHeldPosition = function(x, z)
|5868|5868| {
|5869|    |-	this.heldPosition = {"x": x, "z": z};
|    |5869|+	this.heldPosition = {"x": x, "z": z };
|5870|5870| };
|5871|5871| 
|5872|5872| 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
|5893|5893| 	return false;
|5894|5894| };
|5895|5895| 
|5896|    |-//// Helper functions ////
|    |5896|+// // Helper functions ////
|5897|5897| 
|5898|5898| UnitAI.prototype.CanAttack = function(target)
|5899|5899| {
|    | [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
|6097|6097| 	return cmpPack && cmpPack.IsPacking();
|6098|6098| };
|6099|6099| 
|6100|    |-//// Formation specific functions ////
|    |6100|+// // Formation specific functions ////
|6101|6101| 
|6102|6102| UnitAI.prototype.IsAttackingAsFormation = function()
|6103|6103| {
|    | [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
|6102|6102| UnitAI.prototype.IsAttackingAsFormation = function()
|6103|6103| {
|6104|6104| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6105|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6106|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6105|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6106|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6107|6107| };
|6108|6108| 
|6109|6109| //// 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
|6106|6106| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6107|6107| };
|6108|6108| 
|6109|    |-//// Animal specific functions ////
|    |6109|+// // Animal specific functions ////
|6110|6110| 
|6111|6111| UnitAI.prototype.MoveRandomly = function(distance)
|6112|6112| {

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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
|5810| »   »   var·cmpVision·=·Engine.QueryInterface(this.entity,·IID_Vision);
|    | [NORMAL] JSHintBear:
|    | 'cmpVision' is already defined.

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

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

This revision was not accepted when it landed; it landed in state Needs Review.Jan 12 2020, 2:21 PM
This revision was automatically updated to reflect the committed changes.