Page MenuHomeWildfire Games

Commit resources at a target rather than per type.
ClosedPublic

Authored by Freagarach on Mar 24 2020, 10:55 AM.

Details

Reviewers
wraitii
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Commits
rP23733: Make CommitResources accept a target, not a type.
Summary

This moves some resource committing logic from UnitAI to ResourceGatherer.
This would allow easier modification by modders, e.g. share resources with allies when dropping at an allied storehouse, since that change only has to be done in one place instead of scattered in the UnitAI-beast.

This also enables a check to only send a resource carrying changed message when it actually changes.

Test Plan

Verify that:

  • Entities can ordinarily return resources.
  • Entities carrying resources and finish constructing a dropsite with the correct type drop off resources.
  • Entities carrying resources and finish constructing a dropsite with the wrong type do not drop off resources.
  • Entities garrisoning in a dropsite drop the right types of resources.

Diff Detail

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

Event Timeline

Freagarach created this revision.Mar 24 2020, 10:55 AM

A test can be added (after D2662).

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

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1889/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
| 786| 786| 					this.FinishOrder();
| 787| 787| 					return;
| 788| 788| 				}
| 789|    |-				else
| 790|    |-				{
|    | 789|+				
| 791| 790| 					this.SetNextState("GARRISON.APPROACHING");
| 792| 791| 					return;
| 793|    |-				}
|    | 792|+				
| 794| 793| 			}
| 795| 794| 
| 796| 795| 			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
|1058|1058| 			},
|1059|1059| 		},
|1060|1060| 
|1061|    |-		"GARRISON":{
|    |1061|+		"GARRISON": {
|1062|1062| 			"APPROACHING": {
|1063|1063| 				"enter": function() {
|1064|1064| 					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
|2036|2036| 
|2037|2037| 				"Attacked": function(msg) {
|2038|2038| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2039|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2040|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2039|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2040|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2041|2041| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2042|2042| 				},
|2043|2043| 			},
|    | [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
|2771|2771| 					{
|2772|2772| 						// The building was already finished/fully repaired before we arrived;
|2773|2773| 						// let the ConstructionFinished handler handle this.
|2774|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2774|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2775|2775| 						return true;
|2776|2776| 					}
|2777|2777| 
|    | [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
|2771|2771| 					{
|2772|2772| 						// The building was already finished/fully repaired before we arrived;
|2773|2773| 						// let the ConstructionFinished handler handle this.
|2774|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2774|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2775|2775| 						return true;
|2776|2776| 					}
|2777|2777| 
|    | [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
|3062|3062| 				this.StopTimer();
|3063|3063| 				this.ResetAnimation();
|3064|3064| 				if (this.formationAnimationVariant)
|3065|    |-					this.SetAnimationVariant(this.formationAnimationVariant)
|    |3065|+					this.SetAnimationVariant(this.formationAnimationVariant);
|3066|3066| 				else
|3067|3067| 					this.SetDefaultAnimationVariant();
|3068|3068| 				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
|3288|3288| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3289|3289| 
|3290|3290| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3291|    |-							// only used for domestic animals
|    |3291|+		// only used for domestic animals
|3292|3292| 
|3293|3293| 		// Reuse the same garrison behaviour for animals.
|3294|3294| 		"GARRISON": "INDIVIDUAL.GARRISON",
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3350|3350| 
|3351|3351| UnitAI.prototype.IsAnimal = function()
|3352|3352| {
|3353|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3353|+	return (!!this.template.NaturalBehaviour);
|3354|3354| };
|3355|3355| 
|3356|3356| 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
|3466|3466| 		{
|3467|3467| 			let index = this.GetCurrentState().indexOf(".");
|3468|3468| 			if (index != -1)
|3469|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3469|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3470|3470| 			this.Stop(false);
|3471|3471| 		}
|3472|3472| 
|    | [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
|3522|3522| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3523|3523| 			continue;
|3524|3524| 		if (i == 0)
|3525|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3525|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3526|3526| 		else
|3527|3527| 			this.orderQueue.splice(i, 1);
|3528|3528| 		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
|3522|3522| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3523|3523| 			continue;
|3524|3524| 		if (i == 0)
|3525|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3525|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3526|3526| 		else
|3527|3527| 			this.orderQueue.splice(i, 1);
|3528|3528| 		Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3609|3609| };
|3610|3610| 
|3611|3611| 
|3612|    |-//// FSM linkage functions ////
|    |3612|+// // FSM linkage functions ////
|3613|3613| 
|3614|3614| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3615|3615| UnitAI.prototype.SetNextState = function(state)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3780|3780| 				continue;
|3781|3781| 			if (this.orderQueue[i].type == type)
|3782|3782| 				continue;
|3783|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3783|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3784|3784| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3785|3785| 			return;
|3786|3786| 		}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3780|3780| 				continue;
|3781|3781| 			if (this.orderQueue[i].type == type)
|3782|3782| 				continue;
|3783|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3783|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3784|3784| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3785|3785| 			return;
|3786|3786| 		}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4022|4022| 	if (data.timerRepeat === undefined)
|4023|4023| 		this.timer = undefined;
|4024|4024| 
|4025|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4025|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4026|4026| };
|4027|4027| 
|4028|4028| /**
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4022|4022| 	if (data.timerRepeat === undefined)
|4023|4023| 		this.timer = undefined;
|4024|4024| 
|4025|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4025|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4026|4026| };
|4027|4027| 
|4028|4028| /**
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4067|4067| 	// TODO: This is a bit inefficient since every unit listens to every
|4068|4068| 	// construction message - ideally we could scope it to only the one we're building
|4069|4069| 
|4070|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4070|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4071|4071| };
|4072|4072| 
|4073|4073| UnitAI.prototype.OnGlobalEntityRenamed = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4067|4067| 	// TODO: This is a bit inefficient since every unit listens to every
|4068|4068| 	// construction message - ideally we could scope it to only the one we're building
|4069|4069| 
|4070|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4070|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4071|4071| };
|4072|4072| 
|4073|4073| UnitAI.prototype.OnGlobalEntityRenamed = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4098|4098| 	if (msg.fromStatusEffect)
|4099|4099| 		return;
|4100|4100| 
|4101|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4101|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4102|4102| };
|4103|4103| 
|4104|4104| UnitAI.prototype.OnGuardedAttacked = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4098|4098| 	if (msg.fromStatusEffect)
|4099|4099| 		return;
|4100|4100| 
|4101|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4101|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4102|4102| };
|4103|4103| 
|4104|4104| UnitAI.prototype.OnGuardedAttacked = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4103|4103| 
|4104|4104| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4105|4105| {
|4106|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4106|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4107|4107| };
|4108|4108| 
|4109|4109| UnitAI.prototype.OnHealthChanged = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4103|4103| 
|4104|4104| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4105|4105| {
|4106|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4106|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4107|4107| };
|4108|4108| 
|4109|4109| UnitAI.prototype.OnHealthChanged = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4108|4108| 
|4109|4109| UnitAI.prototype.OnHealthChanged = function(msg)
|4110|4110| {
|4111|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4111|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4112|4112| };
|4113|4113| 
|4114|4114| UnitAI.prototype.OnRangeUpdate = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4108|4108| 
|4109|4109| UnitAI.prototype.OnHealthChanged = function(msg)
|4110|4110| {
|4111|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4111|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4112|4112| };
|4113|4113| 
|4114|4114| UnitAI.prototype.OnRangeUpdate = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4114|4114| UnitAI.prototype.OnRangeUpdate = function(msg)
|4115|4115| {
|4116|4116| 	if (msg.tag == this.losRangeQuery)
|4117|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4117|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4118|4118| 	else if (msg.tag == this.losHealRangeQuery)
|4119|4119| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4120|4120| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4114|4114| UnitAI.prototype.OnRangeUpdate = function(msg)
|4115|4115| {
|4116|4116| 	if (msg.tag == this.losRangeQuery)
|4117|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4117|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4118|4118| 	else if (msg.tag == this.losHealRangeQuery)
|4119|4119| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4120|4120| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4116|4116| 	if (msg.tag == this.losRangeQuery)
|4117|4117| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4118|4118| 	else if (msg.tag == this.losHealRangeQuery)
|4119|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4119|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4120|4120| };
|4121|4121| 
|4122|4122| UnitAI.prototype.OnPackFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4116|4116| 	if (msg.tag == this.losRangeQuery)
|4117|4117| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4118|4118| 	else if (msg.tag == this.losHealRangeQuery)
|4119|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4119|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4120|4120| };
|4121|4121| 
|4122|4122| UnitAI.prototype.OnPackFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4121|4121| 
|4122|4122| UnitAI.prototype.OnPackFinished = function(msg)
|4123|4123| {
|4124|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4124|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4125|4125| };
|4126|4126| 
|4127|4127| //// Helper functions to be called by the FSM ////
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4121|4121| 
|4122|4122| UnitAI.prototype.OnPackFinished = function(msg)
|4123|4123| {
|4124|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4124|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4125|4125| };
|4126|4126| 
|4127|4127| //// Helper functions to be called by the FSM ////
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4124|4124| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4125|4125| };
|4126|4126| 
|4127|    |-//// Helper functions to be called by the FSM ////
|    |4127|+// // Helper functions to be called by the FSM ////
|4128|4128| 
|4129|4129| UnitAI.prototype.GetWalkSpeed = function()
|4130|4130| {
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4791|4791| UnitAI.prototype.AttackEntityInZone = function(ents)
|4792|4792| {
|4793|4793| 	var target = ents.find(target =>
|4794|    |-		this.CanAttack(target)
|4795|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4794|+		this.CanAttack(target) &&
|    |4795|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4796|4796| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4797|4797| 	);
|4798|4798| 	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
|4792|4792| {
|4793|4793| 	var target = ents.find(target =>
|4794|4794| 		this.CanAttack(target)
|4795|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4796|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4795|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4796|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4797|4797| 	);
|4798|4798| 	if (!target)
|4799|4799| 		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
|4856|4856| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4857|4857| 	if (this.isGuardOf)
|4858|4858| 	{
|4859|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4859|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4860|4860| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4861|4861| 		if (cmpUnitAI && cmpAttack &&
|4862|4862| 		    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
|4860|4860| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4861|4861| 		if (cmpUnitAI && cmpAttack &&
|4862|4862| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4863|    |-				return false;
|    |4863|+			return false;
|4864|4864| 	}
|4865|4865| 
|4866|4866| 	// 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
|4898|4898| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4899|4899| 	if (this.isGuardOf)
|4900|4900| 	{
|4901|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4901|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4902|4902| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4903|4903| 		if (cmpUnitAI && cmpAttack &&
|4904|4904| 		    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
|4911|4911| 	return false;
|4912|4912| };
|4913|4913| 
|4914|    |-//// External interface functions ////
|    |4914|+// // External interface functions ////
|4915|4915| 
|4916|4916| UnitAI.prototype.SetFormationController = function(ent)
|4917|4917| {
|    | [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
|5067|5067| 	{
|5068|5068| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5069|5069| 			return;
|5070|    |-		else
|5071|    |-			this.RemoveGuard();
|    |5070|+		this.RemoveGuard();
|5072|5071| 	}
|5073|5072| 
|5074|5073| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5398|5398| 
|5399|5399| 	if (this.IsFormationController())
|5400|5400| 		this.CallMemberFunction("CancelSetupTradeRoute", [target]);
|5401|    |-}
|    |5401|+};
|5402|5402| /**
|5403|5403|  * Adds trade order to the queue. Either walk to the first market, or
|5404|5404|  * start a new route. Not forced, so it can be interrupted by attacks.
|    | [NORMAL] ESLintBear (no-trailing-spaces):
|    | Trailing spaces not allowed.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5419|5419| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5420|5420| 	{
|5421|5421| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5422|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5422|+		if (cmpTrader.HasBothMarkets() &&
|5423|5423| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5424|5424| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5425|5425| 		{
|    | [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
|5700|5700| 				{
|5701|5701| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5702|5702| 					var targetClasses = this.order.data.targetClasses;
|5703|    |-					if (targetClasses.attack && cmpIdentity
|5704|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5703|+					if (targetClasses.attack && cmpIdentity &&
|    |5704|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5705|5705| 						continue;
|5706|5706| 					if (targetClasses.avoid && cmpIdentity
|5707|5707| 						&& 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
|5703|5703| 					if (targetClasses.attack && cmpIdentity
|5704|5704| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5705|5705| 						continue;
|5706|    |-					if (targetClasses.avoid && cmpIdentity
|5707|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5706|+					if (targetClasses.avoid && cmpIdentity &&
|    |5707|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5708|5708| 						continue;
|5709|5709| 					// Only used by the AIs to prevent some choices of targets
|5710|5710| 					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
|5726|5726| 		{
|5727|5727| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5728|5728| 			var targetClasses = this.order.data.targetClasses;
|5729|    |-			if (cmpIdentity && targetClasses.attack
|5730|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5729|+			if (cmpIdentity && targetClasses.attack &&
|    |5730|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5731|5731| 				continue;
|5732|5732| 			if (cmpIdentity && targetClasses.avoid
|5733|5733| 				&& 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
|5729|5729| 			if (cmpIdentity && targetClasses.attack
|5730|5730| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5731|5731| 				continue;
|5732|    |-			if (cmpIdentity && targetClasses.avoid
|5733|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5732|+			if (cmpIdentity && targetClasses.avoid &&
|    |5733|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5734|5734| 				continue;
|5735|5735| 			// Only used by the AIs to prevent some choices of targets
|5736|5736| 			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
|5872|5872| 
|5873|5873| UnitAI.prototype.SetHeldPosition = function(x, z)
|5874|5874| {
|5875|    |-	this.heldPosition = {"x": x, "z": z};
|    |5875|+	this.heldPosition = { "x": x, "z": z};
|5876|5876| };
|5877|5877| 
|5878|5878| 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
|5872|5872| 
|5873|5873| UnitAI.prototype.SetHeldPosition = function(x, z)
|5874|5874| {
|5875|    |-	this.heldPosition = {"x": x, "z": z};
|    |5875|+	this.heldPosition = {"x": x, "z": z };
|5876|5876| };
|5877|5877| 
|5878|5878| 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
|5899|5899| 	return false;
|5900|5900| };
|5901|5901| 
|5902|    |-//// Helper functions ////
|    |5902|+// // Helper functions ////
|5903|5903| 
|5904|5904| /**
|5905|5905|  * General getter for ranges.
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5918|5918| 		return undefined;
|5919|5919| 
|5920|5920| 	return component.GetRange(type);
|5921|    |-}
|    |5921|+};
|5922|5922| 
|5923|5923| UnitAI.prototype.CanAttack = function(target)
|5924|5924| {
|    | [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
|6116|6116| 	return cmpPack && cmpPack.IsPacking();
|6117|6117| };
|6118|6118| 
|6119|    |-//// Formation specific functions ////
|    |6119|+// // Formation specific functions ////
|6120|6120| 
|6121|6121| UnitAI.prototype.IsAttackingAsFormation = function()
|6122|6122| {
|    | [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
|6121|6121| UnitAI.prototype.IsAttackingAsFormation = function()
|6122|6122| {
|6123|6123| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6124|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6125|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6124|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6125|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6126|6126| };
|6127|6127| 
|6128|6128| //// 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
|6125|6125| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6126|6126| };
|6127|6127| 
|6128|    |-//// Animal specific functions ////
|    |6128|+// // Animal specific functions ////
|6129|6129| 
|6130|6130| UnitAI.prototype.MoveRandomly = function(distance)
|6131|6131| {

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

binaries/data/mods/public/simulation/components/UnitAI.js
|3927| »   var·isWorkType·=·type·=>·type·==·"Gather"·||·type·==·"Trade"·||·type·==·"Repair"·||·type·==·"ReturnResource";
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'type' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|4778| »   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
|4793| »   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
|4839| »   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
|4862| »   »   ····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
|2040| »   »   »   »   »   »   &&·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
|3065| »   »   »   »   »   this.SetAnimationVariant(this.formationAnimationVariant)
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

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

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

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

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

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

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

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

Freagarach updated this revision to Diff 11815.May 9 2020, 8:31 AM

Early return when no cmpPlayer when committing resources.

Vulcan added a comment.May 9 2020, 8:32 AM

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

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

Vulcan added a comment.May 9 2020, 8:39 AM

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
| 786| 786| 					this.FinishOrder();
| 787| 787| 					return;
| 788| 788| 				}
| 789|    |-				else
| 790|    |-				{
|    | 789|+				
| 791| 790| 					this.SetNextState("GARRISON.APPROACHING");
| 792| 791| 					return;
| 793|    |-				}
|    | 792|+				
| 794| 793| 			}
| 795| 794| 
| 796| 795| 			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
|1058|1058| 			},
|1059|1059| 		},
|1060|1060| 
|1061|    |-		"GARRISON":{
|    |1061|+		"GARRISON": {
|1062|1062| 			"APPROACHING": {
|1063|1063| 				"enter": function() {
|1064|1064| 					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
|2040|2040| 
|2041|2041| 				"Attacked": function(msg) {
|2042|2042| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2043|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2044|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2043|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2044|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2045|2045| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2046|2046| 				},
|2047|2047| 			},
|    | [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
|2199|2199| 					"MovementUpdate": function(msg) {
|2200|2200| 						// If it looks like the path is failing, and we are close enough (3 tiles) from wanted range
|2201|2201| 						// stop anyways. This avoids pathing for an unreachable goal and reduces lag considerably.
|2202|    |-						if (msg.likelyFailure || 
|    |2202|+						if (msg.likelyFailure ||
|2203|2203| 							msg.obstructed && this.RelaxedMaxRangeCheck(this.order.data, this.order.data.max + this.DefaultRelaxedMaxRange) ||
|2204|2204| 							!msg.obstructed && this.CheckRange(this.order.data))
|2205|2205| 							this.FinishOrder();
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2837|2837| 					{
|2838|2838| 						// The building was already finished/fully repaired before we arrived;
|2839|2839| 						// let the ConstructionFinished handler handle this.
|2840|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2840|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2841|2841| 						return true;
|2842|2842| 					}
|2843|2843| 
|    | [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
|2837|2837| 					{
|2838|2838| 						// The building was already finished/fully repaired before we arrived;
|2839|2839| 						// let the ConstructionFinished handler handle this.
|2840|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2840|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2841|2841| 						return true;
|2842|2842| 					}
|2843|2843| 
|    | [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
|3128|3128| 				this.StopTimer();
|3129|3129| 				this.ResetAnimation();
|3130|3130| 				if (this.formationAnimationVariant)
|3131|    |-					this.SetAnimationVariant(this.formationAnimationVariant)
|    |3131|+					this.SetAnimationVariant(this.formationAnimationVariant);
|3132|3132| 				else
|3133|3133| 					this.SetDefaultAnimationVariant();
|3134|3134| 				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
|3354|3354| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3355|3355| 
|3356|3356| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3357|    |-							// only used for domestic animals
|    |3357|+		// only used for domestic animals
|3358|3358| 
|3359|3359| 		// Reuse the same garrison behaviour for animals.
|3360|3360| 		"GARRISON": "INDIVIDUAL.GARRISON",
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3416|3416| 
|3417|3417| UnitAI.prototype.IsAnimal = function()
|3418|3418| {
|3419|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3419|+	return (!!this.template.NaturalBehaviour);
|3420|3420| };
|3421|3421| 
|3422|3422| 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
|3532|3532| 		{
|3533|3533| 			let index = this.GetCurrentState().indexOf(".");
|3534|3534| 			if (index != -1)
|3535|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3535|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3536|3536| 			this.Stop(false);
|3537|3537| 		}
|3538|3538| 
|    | [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
|3588|3588| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3589|3589| 			continue;
|3590|3590| 		if (i == 0)
|3591|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3591|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3592|3592| 		else
|3593|3593| 			this.orderQueue.splice(i, 1);
|3594|3594| 		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
|3588|3588| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3589|3589| 			continue;
|3590|3590| 		if (i == 0)
|3591|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3591|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3592|3592| 		else
|3593|3593| 			this.orderQueue.splice(i, 1);
|3594|3594| 		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
|3675|3675| };
|3676|3676| 
|3677|3677| 
|3678|    |-//// FSM linkage functions ////
|    |3678|+// // FSM linkage functions ////
|3679|3679| 
|3680|3680| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3681|3681| 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
|3846|3846| 				continue;
|3847|3847| 			if (this.orderQueue[i].type == type)
|3848|3848| 				continue;
|3849|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3849|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3850|3850| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3851|3851| 			return;
|3852|3852| 		}
|    | [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
|3846|3846| 				continue;
|3847|3847| 			if (this.orderQueue[i].type == type)
|3848|3848| 				continue;
|3849|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3849|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3850|3850| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3851|3851| 			return;
|3852|3852| 		}
|    | [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
|4088|4088| 	if (data.timerRepeat === undefined)
|4089|4089| 		this.timer = undefined;
|4090|4090| 
|4091|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4091|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4092|4092| };
|4093|4093| 
|4094|4094| /**
|    | [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
|4088|4088| 	if (data.timerRepeat === undefined)
|4089|4089| 		this.timer = undefined;
|4090|4090| 
|4091|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4091|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4092|4092| };
|4093|4093| 
|4094|4094| /**
|    | [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
|4133|4133| 	// TODO: This is a bit inefficient since every unit listens to every
|4134|4134| 	// construction message - ideally we could scope it to only the one we're building
|4135|4135| 
|4136|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4136|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4137|4137| };
|4138|4138| 
|4139|4139| 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
|4133|4133| 	// TODO: This is a bit inefficient since every unit listens to every
|4134|4134| 	// construction message - ideally we could scope it to only the one we're building
|4135|4135| 
|4136|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4136|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4137|4137| };
|4138|4138| 
|4139|4139| 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
|4164|4164| 	if (msg.fromStatusEffect)
|4165|4165| 		return;
|4166|4166| 
|4167|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4167|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4168|4168| };
|4169|4169| 
|4170|4170| 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
|4164|4164| 	if (msg.fromStatusEffect)
|4165|4165| 		return;
|4166|4166| 
|4167|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4167|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4168|4168| };
|4169|4169| 
|4170|4170| 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
|4169|4169| 
|4170|4170| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4171|4171| {
|4172|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4172|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4173|4173| };
|4174|4174| 
|4175|4175| 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
|4169|4169| 
|4170|4170| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4171|4171| {
|4172|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4172|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4173|4173| };
|4174|4174| 
|4175|4175| 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
|4174|4174| 
|4175|4175| UnitAI.prototype.OnHealthChanged = function(msg)
|4176|4176| {
|4177|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4177|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4178|4178| };
|4179|4179| 
|4180|4180| 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
|4174|4174| 
|4175|4175| UnitAI.prototype.OnHealthChanged = function(msg)
|4176|4176| {
|4177|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4177|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4178|4178| };
|4179|4179| 
|4180|4180| 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
|4180|4180| UnitAI.prototype.OnRangeUpdate = function(msg)
|4181|4181| {
|4182|4182| 	if (msg.tag == this.losRangeQuery)
|4183|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4183|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4184|4184| 	else if (msg.tag == this.losHealRangeQuery)
|4185|4185| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4186|4186| };
|    | [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
|4180|4180| UnitAI.prototype.OnRangeUpdate = function(msg)
|4181|4181| {
|4182|4182| 	if (msg.tag == this.losRangeQuery)
|4183|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4183|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4184|4184| 	else if (msg.tag == this.losHealRangeQuery)
|4185|4185| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4186|4186| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4182|4182| 	if (msg.tag == this.losRangeQuery)
|4183|4183| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4184|4184| 	else if (msg.tag == this.losHealRangeQuery)
|4185|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4185|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4186|4186| };
|4187|4187| 
|4188|4188| 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
|4182|4182| 	if (msg.tag == this.losRangeQuery)
|4183|4183| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4184|4184| 	else if (msg.tag == this.losHealRangeQuery)
|4185|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4185|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4186|4186| };
|4187|4187| 
|4188|4188| 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
|4187|4187| 
|4188|4188| UnitAI.prototype.OnPackFinished = function(msg)
|4189|4189| {
|4190|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4190|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4191|4191| };
|4192|4192| 
|4193|4193| //// 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
|4187|4187| 
|4188|4188| UnitAI.prototype.OnPackFinished = function(msg)
|4189|4189| {
|4190|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4190|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4191|4191| };
|4192|4192| 
|4193|4193| //// 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
|4190|4190| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4191|4191| };
|4192|4192| 
|4193|    |-//// Helper functions to be called by the FSM ////
|    |4193|+// // Helper functions to be called by the FSM ////
|4194|4194| 
|4195|4195| UnitAI.prototype.GetWalkSpeed = function()
|4196|4196| {
|    | [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
|4902|4902| UnitAI.prototype.AttackEntityInZone = function(ents)
|4903|4903| {
|4904|4904| 	var target = ents.find(target =>
|4905|    |-		this.CanAttack(target)
|4906|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4905|+		this.CanAttack(target) &&
|    |4906|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4907|4907| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4908|4908| 	);
|4909|4909| 	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
|4903|4903| {
|4904|4904| 	var target = ents.find(target =>
|4905|4905| 		this.CanAttack(target)
|4906|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4907|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4906|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4907|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4908|4908| 	);
|4909|4909| 	if (!target)
|4910|4910| 		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
|4969|4969| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4970|4970| 	if (this.isGuardOf)
|4971|4971| 	{
|4972|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4972|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4973|4973| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4974|4974| 		if (cmpUnitAI && cmpAttack &&
|4975|4975| 		    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
|4973|4973| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4974|4974| 		if (cmpUnitAI && cmpAttack &&
|4975|4975| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4976|    |-				return false;
|    |4976|+			return false;
|4977|4977| 	}
|4978|4978| 
|4979|4979| 	// 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
|5011|5011| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|5012|5012| 	if (this.isGuardOf)
|5013|5013| 	{
|5014|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |5014|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|5015|5015| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|5016|5016| 		if (cmpUnitAI && cmpAttack &&
|5017|5017| 		    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
|5024|5024| 	return false;
|5025|5025| };
|5026|5026| 
|5027|    |-//// External interface functions ////
|    |5027|+// // External interface functions ////
|5028|5028| 
|5029|5029| UnitAI.prototype.SetFormationController = function(ent)
|5030|5030| {
|    | [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
|5180|5180| 	{
|5181|5181| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5182|5182| 			return;
|5183|    |-		else
|5184|    |-			this.RemoveGuard();
|    |5183|+		this.RemoveGuard();
|5185|5184| 	}
|5186|5185| 
|5187|5186| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5511|5511| 
|5512|5512| 	if (this.IsFormationController())
|5513|5513| 		this.CallMemberFunction("CancelSetupTradeRoute", [target]);
|5514|    |-}
|    |5514|+};
|5515|5515| /**
|5516|5516|  * Adds trade order to the queue. Either walk to the first market, or
|5517|5517|  * start a new route. Not forced, so it can be interrupted by attacks.
|    | [NORMAL] ESLintBear (no-trailing-spaces):
|    | Trailing spaces not allowed.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5532|5532| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5533|5533| 	{
|5534|5534| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5535|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5535|+		if (cmpTrader.HasBothMarkets() &&
|5536|5536| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5537|5537| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5538|5538| 		{
|    | [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
|5813|5813| 				{
|5814|5814| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5815|5815| 					var targetClasses = this.order.data.targetClasses;
|5816|    |-					if (targetClasses.attack && cmpIdentity
|5817|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5816|+					if (targetClasses.attack && cmpIdentity &&
|    |5817|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5818|5818| 						continue;
|5819|5819| 					if (targetClasses.avoid && cmpIdentity
|5820|5820| 						&& 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
|5816|5816| 					if (targetClasses.attack && cmpIdentity
|5817|5817| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5818|5818| 						continue;
|5819|    |-					if (targetClasses.avoid && cmpIdentity
|5820|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5819|+					if (targetClasses.avoid && cmpIdentity &&
|    |5820|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5821|5821| 						continue;
|5822|5822| 					// Only used by the AIs to prevent some choices of targets
|5823|5823| 					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
|5839|5839| 		{
|5840|5840| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5841|5841| 			var targetClasses = this.order.data.targetClasses;
|5842|    |-			if (cmpIdentity && targetClasses.attack
|5843|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5842|+			if (cmpIdentity && targetClasses.attack &&
|    |5843|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5844|5844| 				continue;
|5845|5845| 			if (cmpIdentity && targetClasses.avoid
|5846|5846| 				&& 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
|5842|5842| 			if (cmpIdentity && targetClasses.attack
|5843|5843| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5844|5844| 				continue;
|5845|    |-			if (cmpIdentity && targetClasses.avoid
|5846|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5845|+			if (cmpIdentity && targetClasses.avoid &&
|    |5846|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5847|5847| 				continue;
|5848|5848| 			// Only used by the AIs to prevent some choices of targets
|5849|5849| 			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
|5985|5985| 
|5986|5986| UnitAI.prototype.SetHeldPosition = function(x, z)
|5987|5987| {
|5988|    |-	this.heldPosition = {"x": x, "z": z};
|    |5988|+	this.heldPosition = { "x": x, "z": z};
|5989|5989| };
|5990|5990| 
|5991|5991| 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
|5985|5985| 
|5986|5986| UnitAI.prototype.SetHeldPosition = function(x, z)
|5987|5987| {
|5988|    |-	this.heldPosition = {"x": x, "z": z};
|    |5988|+	this.heldPosition = {"x": x, "z": z };
|5989|5989| };
|5990|5990| 
|5991|5991| 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
|6012|6012| 	return false;
|6013|6013| };
|6014|6014| 
|6015|    |-//// Helper functions ////
|    |6015|+// // Helper functions ////
|6016|6016| 
|6017|6017| /**
|6018|6018|  * General getter for ranges.
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|6031|6031| 		return undefined;
|6032|6032| 
|6033|6033| 	return component.GetRange(type);
|6034|    |-}
|    |6034|+};
|6035|6035| 
|6036|6036| UnitAI.prototype.CanAttack = function(target)
|6037|6037| {
|    | [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
|6229|6229| 	return cmpPack && cmpPack.IsPacking();
|6230|6230| };
|6231|6231| 
|6232|    |-//// Formation specific functions ////
|    |6232|+// // Formation specific functions ////
|6233|6233| 
|6234|6234| UnitAI.prototype.IsAttackingAsFormation = function()
|6235|6235| {
|    | [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
|6234|6234| UnitAI.prototype.IsAttackingAsFormation = function()
|6235|6235| {
|6236|6236| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6237|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6238|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6237|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6238|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6239|6239| };
|6240|6240| 
|6241|6241| //// 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
|6238|6238| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6239|6239| };
|6240|6240| 
|6241|    |-//// Animal specific functions ////
|    |6241|+// // Animal specific functions ////
|6242|6242| 
|6243|6243| UnitAI.prototype.MoveRandomly = function(distance)
|6244|6244| {

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

binaries/data/mods/public/simulation/components/UnitAI.js
|3993| »   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
|4889| »   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
|4904| »   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
|4952| »   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
|4975| »   »   ····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
|2044| »   »   »   »   »   »   &&·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
|3131| »   »   »   »   »   this.SetAnimationVariant(this.formationAnimationVariant)
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

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

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

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

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

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

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

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

wraitii added a subscriber: wraitii.

Adding to my review queue, this seems like a move in the right direction

Quick review inline, but I'm doing the changes myself since they're mostly straightforward.

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

This is already check by CanReturnResource (in fact the existing check is already redundant it seems).

2704 ↗(On Diff #11815)

Likewise.

2904 ↗(On Diff #11815)

Likewise :p

3064 ↗(On Diff #11815)

you can move the interface call inside

Edit -> for that matter there's a ton of redundancy here.

wraitii updated this revision to Diff 12105.Jun 2 2020, 7:29 PM

Quick cleanup by passing CmpResourceGatherer.

Also clean up the "CanReturnResources" duplication in Construction Finished, and also make the entity return resources in all cases. Currently, they wouldn't if they had no particular order after and could gather something nearby, which seems odd. I think it was simply missed in rP16581

wraitii accepted this revision.Jun 2 2020, 7:30 PM

As for the rest this is a good change imo, that cleans up UnitAI logic a little.

This revision is now accepted and ready to land.Jun 2 2020, 7:30 PM
Vulcan added a comment.Jun 2 2020, 7:33 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
| 784| 784| 					this.FinishOrder();
| 785| 785| 					return;
| 786| 786| 				}
| 787|    |-				else
| 788|    |-				{
|    | 787|+				
| 789| 788| 					this.SetNextState("GARRISON.APPROACHING");
| 790| 789| 					return;
| 791|    |-				}
|    | 790|+				
| 792| 791| 			}
| 793| 792| 
| 794| 793| 			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
|1056|1056| 			},
|1057|1057| 		},
|1058|1058| 
|1059|    |-		"GARRISON":{
|    |1059|+		"GARRISON": {
|1060|1060| 			"APPROACHING": {
|1061|1061| 				"enter": function() {
|1062|1062| 					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
|2030|2030| 
|2031|2031| 				"Attacked": function(msg) {
|2032|2032| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2033|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2034|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2033|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2034|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2035|2035| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2036|2036| 				},
|2037|2037| 			},
|    | [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
|2189|2189| 					"MovementUpdate": function(msg) {
|2190|2190| 						// If it looks like the path is failing, and we are close enough (3 tiles) from wanted range
|2191|2191| 						// stop anyways. This avoids pathing for an unreachable goal and reduces lag considerably.
|2192|    |-						if (msg.likelyFailure || 
|    |2192|+						if (msg.likelyFailure ||
|2193|2193| 							msg.obstructed && this.RelaxedMaxRangeCheck(this.order.data, this.order.data.max + this.DefaultRelaxedMaxRange) ||
|2194|2194| 							!msg.obstructed && this.CheckRange(this.order.data))
|2195|2195| 							this.FinishOrder();
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2823|2823| 					{
|2824|2824| 						// The building was already finished/fully repaired before we arrived;
|2825|2825| 						// let the ConstructionFinished handler handle this.
|2826|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2826|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2827|2827| 						return true;
|2828|2828| 					}
|2829|2829| 
|    | [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
|2823|2823| 					{
|2824|2824| 						// The building was already finished/fully repaired before we arrived;
|2825|2825| 						// let the ConstructionFinished handler handle this.
|2826|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2826|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2827|2827| 						return true;
|2828|2828| 					}
|2829|2829| 
|    | [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
|3110|3110| 				this.StopTimer();
|3111|3111| 				this.ResetAnimation();
|3112|3112| 				if (this.formationAnimationVariant)
|3113|    |-					this.SetAnimationVariant(this.formationAnimationVariant)
|    |3113|+					this.SetAnimationVariant(this.formationAnimationVariant);
|3114|3114| 				else
|3115|3115| 					this.SetDefaultAnimationVariant();
|3116|3116| 				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
|3336|3336| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3337|3337| 
|3338|3338| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3339|    |-							// only used for domestic animals
|    |3339|+		// only used for domestic animals
|3340|3340| 
|3341|3341| 		// Reuse the same garrison behaviour for animals.
|3342|3342| 		"GARRISON": "INDIVIDUAL.GARRISON",
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3399|3399| 
|3400|3400| UnitAI.prototype.IsAnimal = function()
|3401|3401| {
|3402|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3402|+	return (!!this.template.NaturalBehaviour);
|3403|3403| };
|3404|3404| 
|3405|3405| 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
|3539|3539| 		{
|3540|3540| 			let index = this.GetCurrentState().indexOf(".");
|3541|3541| 			if (index != -1)
|3542|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3542|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3543|3543| 			this.Stop(false);
|3544|3544| 		}
|3545|3545| 
|    | [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
|3595|3595| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3596|3596| 			continue;
|3597|3597| 		if (i == 0)
|3598|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3598|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3599|3599| 		else
|3600|3600| 			this.orderQueue.splice(i, 1);
|3601|3601| 		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
|3595|3595| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3596|3596| 			continue;
|3597|3597| 		if (i == 0)
|3598|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3598|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3599|3599| 		else
|3600|3600| 			this.orderQueue.splice(i, 1);
|3601|3601| 		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
|3682|3682| };
|3683|3683| 
|3684|3684| 
|3685|    |-//// FSM linkage functions ////
|    |3685|+// // FSM linkage functions ////
|3686|3686| 
|3687|3687| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3688|3688| 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
|3853|3853| 				continue;
|3854|3854| 			if (this.orderQueue[i].type == type)
|3855|3855| 				continue;
|3856|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3856|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3857|3857| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3858|3858| 			return;
|3859|3859| 		}
|    | [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
|3853|3853| 				continue;
|3854|3854| 			if (this.orderQueue[i].type == type)
|3855|3855| 				continue;
|3856|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3856|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3857|3857| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3858|3858| 			return;
|3859|3859| 		}
|    | [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
|4094|4094| 	if (data.timerRepeat === undefined)
|4095|4095| 		this.timer = undefined;
|4096|4096| 
|4097|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4097|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4098|4098| };
|4099|4099| 
|4100|4100| /**
|    | [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
|4094|4094| 	if (data.timerRepeat === undefined)
|4095|4095| 		this.timer = undefined;
|4096|4096| 
|4097|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4097|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4098|4098| };
|4099|4099| 
|4100|4100| /**
|    | [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
|4139|4139| 	// TODO: This is a bit inefficient since every unit listens to every
|4140|4140| 	// construction message - ideally we could scope it to only the one we're building
|4141|4141| 
|4142|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4142|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4143|4143| };
|4144|4144| 
|4145|4145| 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
|4139|4139| 	// TODO: This is a bit inefficient since every unit listens to every
|4140|4140| 	// construction message - ideally we could scope it to only the one we're building
|4141|4141| 
|4142|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4142|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4143|4143| };
|4144|4144| 
|4145|4145| 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
|4170|4170| 	if (msg.fromStatusEffect)
|4171|4171| 		return;
|4172|4172| 
|4173|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4173|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4174|4174| };
|4175|4175| 
|4176|4176| 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
|4170|4170| 	if (msg.fromStatusEffect)
|4171|4171| 		return;
|4172|4172| 
|4173|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4173|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4174|4174| };
|4175|4175| 
|4176|4176| 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
|4175|4175| 
|4176|4176| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4177|4177| {
|4178|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4178|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4179|4179| };
|4180|4180| 
|4181|4181| 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
|4175|4175| 
|4176|4176| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4177|4177| {
|4178|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4178|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4179|4179| };
|4180|4180| 
|4181|4181| 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
|4180|4180| 
|4181|4181| UnitAI.prototype.OnHealthChanged = function(msg)
|4182|4182| {
|4183|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4183|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4184|4184| };
|4185|4185| 
|4186|4186| 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
|4180|4180| 
|4181|4181| UnitAI.prototype.OnHealthChanged = function(msg)
|4182|4182| {
|4183|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4183|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4184|4184| };
|4185|4185| 
|4186|4186| 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
|4186|4186| UnitAI.prototype.OnRangeUpdate = function(msg)
|4187|4187| {
|4188|4188| 	if (msg.tag == this.losRangeQuery)
|4189|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4189|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4190|4190| 	else if (msg.tag == this.losHealRangeQuery)
|4191|4191| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4192|4192| };
|    | [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
|4186|4186| UnitAI.prototype.OnRangeUpdate = function(msg)
|4187|4187| {
|4188|4188| 	if (msg.tag == this.losRangeQuery)
|4189|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4189|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4190|4190| 	else if (msg.tag == this.losHealRangeQuery)
|4191|4191| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4192|4192| };
|    | [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
|4188|4188| 	if (msg.tag == this.losRangeQuery)
|4189|4189| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4190|4190| 	else if (msg.tag == this.losHealRangeQuery)
|4191|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4191|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4192|4192| };
|4193|4193| 
|4194|4194| 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
|4188|4188| 	if (msg.tag == this.losRangeQuery)
|4189|4189| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4190|4190| 	else if (msg.tag == this.losHealRangeQuery)
|4191|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4191|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4192|4192| };
|4193|4193| 
|4194|4194| 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
|4193|4193| 
|4194|4194| UnitAI.prototype.OnPackFinished = function(msg)
|4195|4195| {
|4196|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4196|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4197|4197| };
|4198|4198| 
|4199|4199| //// 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
|4193|4193| 
|4194|4194| UnitAI.prototype.OnPackFinished = function(msg)
|4195|4195| {
|4196|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4196|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4197|4197| };
|4198|4198| 
|4199|4199| //// 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
|4196|4196| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4197|4197| };
|4198|4198| 
|4199|    |-//// Helper functions to be called by the FSM ////
|    |4199|+// // Helper functions to be called by the FSM ////
|4200|4200| 
|4201|4201| UnitAI.prototype.GetWalkSpeed = function()
|4202|4202| {
|    | [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
|4911|4911| UnitAI.prototype.AttackEntityInZone = function(ents)
|4912|4912| {
|4913|4913| 	var target = ents.find(target =>
|4914|    |-		this.CanAttack(target)
|4915|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4914|+		this.CanAttack(target) &&
|    |4915|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4916|4916| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4917|4917| 	);
|4918|4918| 	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
|4912|4912| {
|4913|4913| 	var target = ents.find(target =>
|4914|4914| 		this.CanAttack(target)
|4915|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4916|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4915|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4916|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4917|4917| 	);
|4918|4918| 	if (!target)
|4919|4919| 		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
|4978|4978| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4979|4979| 	if (this.isGuardOf)
|4980|4980| 	{
|4981|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4981|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4982|4982| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4983|4983| 		if (cmpUnitAI && cmpAttack &&
|4984|4984| 		    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
|4982|4982| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4983|4983| 		if (cmpUnitAI && cmpAttack &&
|4984|4984| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4985|    |-				return false;
|    |4985|+			return false;
|4986|4986| 	}
|4987|4987| 
|4988|4988| 	// 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
|5020|5020| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|5021|5021| 	if (this.isGuardOf)
|5022|5022| 	{
|5023|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |5023|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|5024|5024| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|5025|5025| 		if (cmpUnitAI && cmpAttack &&
|5026|5026| 		    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
|5033|5033| 	return false;
|5034|5034| };
|5035|5035| 
|5036|    |-//// External interface functions ////
|    |5036|+// // External interface functions ////
|5037|5037| 
|5038|5038| UnitAI.prototype.SetFormationController = function(ent)
|5039|5039| {
|    | [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
|5189|5189| 	{
|5190|5190| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5191|5191| 			return;
|5192|    |-		else
|5193|    |-			this.RemoveGuard();
|    |5192|+		this.RemoveGuard();
|5194|5193| 	}
|5195|5194| 
|5196|5195| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5523|5523| 
|5524|5524| 	if (this.IsFormationController())
|5525|5525| 		this.CallMemberFunction("CancelSetupTradeRoute", [target]);
|5526|    |-}
|    |5526|+};
|5527|5527| /**
|5528|5528|  * Adds trade order to the queue. Either walk to the first market, or
|5529|5529|  * start a new route. Not forced, so it can be interrupted by attacks.
|    | [NORMAL] ESLintBear (no-trailing-spaces):
|    | Trailing spaces not allowed.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5544|5544| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5545|5545| 	{
|5546|5546| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5547|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5547|+		if (cmpTrader.HasBothMarkets() &&
|5548|5548| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5549|5549| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5550|5550| 		{
|    | [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
|5825|5825| 				{
|5826|5826| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5827|5827| 					var targetClasses = this.order.data.targetClasses;
|5828|    |-					if (targetClasses.attack && cmpIdentity
|5829|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5828|+					if (targetClasses.attack && cmpIdentity &&
|    |5829|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5830|5830| 						continue;
|5831|5831| 					if (targetClasses.avoid && cmpIdentity
|5832|5832| 						&& 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
|5828|5828| 					if (targetClasses.attack && cmpIdentity
|5829|5829| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5830|5830| 						continue;
|5831|    |-					if (targetClasses.avoid && cmpIdentity
|5832|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5831|+					if (targetClasses.avoid && cmpIdentity &&
|    |5832|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5833|5833| 						continue;
|5834|5834| 					// Only used by the AIs to prevent some choices of targets
|5835|5835| 					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
|5851|5851| 		{
|5852|5852| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5853|5853| 			var targetClasses = this.order.data.targetClasses;
|5854|    |-			if (cmpIdentity && targetClasses.attack
|5855|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5854|+			if (cmpIdentity && targetClasses.attack &&
|    |5855|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5856|5856| 				continue;
|5857|5857| 			if (cmpIdentity && targetClasses.avoid
|5858|5858| 				&& 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
|5854|5854| 			if (cmpIdentity && targetClasses.attack
|5855|5855| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5856|5856| 				continue;
|5857|    |-			if (cmpIdentity && targetClasses.avoid
|5858|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5857|+			if (cmpIdentity && targetClasses.avoid &&
|    |5858|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5859|5859| 				continue;
|5860|5860| 			// Only used by the AIs to prevent some choices of targets
|5861|5861| 			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
|6014|6014| 
|6015|6015| UnitAI.prototype.SetHeldPosition = function(x, z)
|6016|6016| {
|6017|    |-	this.heldPosition = {"x": x, "z": z};
|    |6017|+	this.heldPosition = { "x": x, "z": z};
|6018|6018| };
|6019|6019| 
|6020|6020| 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
|6014|6014| 
|6015|6015| UnitAI.prototype.SetHeldPosition = function(x, z)
|6016|6016| {
|6017|    |-	this.heldPosition = {"x": x, "z": z};
|    |6017|+	this.heldPosition = {"x": x, "z": z };
|6018|6018| };
|6019|6019| 
|6020|6020| 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
|6041|6041| 	return false;
|6042|6042| };
|6043|6043| 
|6044|    |-//// Helper functions ////
|    |6044|+// // Helper functions ////
|6045|6045| 
|6046|6046| /**
|6047|6047|  * General getter for ranges.
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|6060|6060| 		return undefined;
|6061|6061| 
|6062|6062| 	return component.GetRange(type);
|6063|    |-}
|    |6063|+};
|6064|6064| 
|6065|6065| UnitAI.prototype.CanAttack = function(target)
|6066|6066| {
|    | [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
|6236|6236| 	return cmpPack && cmpPack.IsPacking();
|6237|6237| };
|6238|6238| 
|6239|    |-//// Formation specific functions ////
|    |6239|+// // Formation specific functions ////
|6240|6240| 
|6241|6241| UnitAI.prototype.IsAttackingAsFormation = function()
|6242|6242| {
|    | [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
|6241|6241| UnitAI.prototype.IsAttackingAsFormation = function()
|6242|6242| {
|6243|6243| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6244|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6245|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6244|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6245|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6246|6246| };
|6247|6247| 
|6248|6248| //// 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
|6245|6245| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6246|6246| };
|6247|6247| 
|6248|    |-//// Animal specific functions ////
|    |6248|+// // Animal specific functions ////
|6249|6249| 
|6250|6250| UnitAI.prototype.MoveRandomly = function(distance)
|6251|6251| {

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|3999| »   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
|4898| »   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
|4913| »   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
|4961| »   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
|4984| »   »   ····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
|2034| »   »   »   »   »   »   &&·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
|3113| »   »   »   »   »   this.SetAnimationVariant(this.formationAnimationVariant)
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

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

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

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

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

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

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

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

Angen added a subscriber: Angen.Jun 3 2020, 11:08 AM
Angen added inline comments.
binaries/data/mods/public/simulation/components/UnitAI.js
2904 ↗(On Diff #12105)

does not this invalidate PushOrderFront ?
PushOrderFront calls this.UnitFsm.ProcessMessage but FinishOrder too.

wraitii updated this revision to Diff 12115.Jun 3 2020, 1:53 PM

Fix issue noted by Angen.

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

Hm, you're right, PushOrderFront immediately executes the order.

Vulcan added a comment.Jun 3 2020, 2:07 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
| 784| 784| 					this.FinishOrder();
| 785| 785| 					return;
| 786| 786| 				}
| 787|    |-				else
| 788|    |-				{
|    | 787|+				
| 789| 788| 					this.SetNextState("GARRISON.APPROACHING");
| 790| 789| 					return;
| 791|    |-				}
|    | 790|+				
| 792| 791| 			}
| 793| 792| 
| 794| 793| 			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
|1056|1056| 			},
|1057|1057| 		},
|1058|1058| 
|1059|    |-		"GARRISON":{
|    |1059|+		"GARRISON": {
|1060|1060| 			"APPROACHING": {
|1061|1061| 				"enter": function() {
|1062|1062| 					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
|2030|2030| 
|2031|2031| 				"Attacked": function(msg) {
|2032|2032| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2033|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2034|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2033|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2034|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2035|2035| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2036|2036| 				},
|2037|2037| 			},
|    | [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
|2189|2189| 					"MovementUpdate": function(msg) {
|2190|2190| 						// If it looks like the path is failing, and we are close enough (3 tiles) from wanted range
|2191|2191| 						// stop anyways. This avoids pathing for an unreachable goal and reduces lag considerably.
|2192|    |-						if (msg.likelyFailure || 
|    |2192|+						if (msg.likelyFailure ||
|2193|2193| 							msg.obstructed && this.RelaxedMaxRangeCheck(this.order.data, this.order.data.max + this.DefaultRelaxedMaxRange) ||
|2194|2194| 							!msg.obstructed && this.CheckRange(this.order.data))
|2195|2195| 							this.FinishOrder();
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2823|2823| 					{
|2824|2824| 						// The building was already finished/fully repaired before we arrived;
|2825|2825| 						// let the ConstructionFinished handler handle this.
|2826|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2826|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2827|2827| 						return true;
|2828|2828| 					}
|2829|2829| 
|    | [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
|2823|2823| 					{
|2824|2824| 						// The building was already finished/fully repaired before we arrived;
|2825|2825| 						// let the ConstructionFinished handler handle this.
|2826|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2826|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2827|2827| 						return true;
|2828|2828| 					}
|2829|2829| 
|    | [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
|3119|3119| 				this.StopTimer();
|3120|3120| 				this.ResetAnimation();
|3121|3121| 				if (this.formationAnimationVariant)
|3122|    |-					this.SetAnimationVariant(this.formationAnimationVariant)
|    |3122|+					this.SetAnimationVariant(this.formationAnimationVariant);
|3123|3123| 				else
|3124|3124| 					this.SetDefaultAnimationVariant();
|3125|3125| 				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
|3345|3345| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3346|3346| 
|3347|3347| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3348|    |-							// only used for domestic animals
|    |3348|+		// only used for domestic animals
|3349|3349| 
|3350|3350| 		// Reuse the same garrison behaviour for animals.
|3351|3351| 		"GARRISON": "INDIVIDUAL.GARRISON",
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3408|3408| 
|3409|3409| UnitAI.prototype.IsAnimal = function()
|3410|3410| {
|3411|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3411|+	return (!!this.template.NaturalBehaviour);
|3412|3412| };
|3413|3413| 
|3414|3414| 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
|3548|3548| 		{
|3549|3549| 			let index = this.GetCurrentState().indexOf(".");
|3550|3550| 			if (index != -1)
|3551|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3551|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3552|3552| 			this.Stop(false);
|3553|3553| 		}
|3554|3554| 
|    | [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
|3604|3604| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3605|3605| 			continue;
|3606|3606| 		if (i == 0)
|3607|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3607|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3608|3608| 		else
|3609|3609| 			this.orderQueue.splice(i, 1);
|3610|3610| 		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
|3604|3604| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3605|3605| 			continue;
|3606|3606| 		if (i == 0)
|3607|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3607|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3608|3608| 		else
|3609|3609| 			this.orderQueue.splice(i, 1);
|3610|3610| 		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
|3691|3691| };
|3692|3692| 
|3693|3693| 
|3694|    |-//// FSM linkage functions ////
|    |3694|+// // FSM linkage functions ////
|3695|3695| 
|3696|3696| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3697|3697| 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
|3862|3862| 				continue;
|3863|3863| 			if (this.orderQueue[i].type == type)
|3864|3864| 				continue;
|3865|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3865|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3866|3866| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3867|3867| 			return;
|3868|3868| 		}
|    | [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
|3862|3862| 				continue;
|3863|3863| 			if (this.orderQueue[i].type == type)
|3864|3864| 				continue;
|3865|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3865|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3866|3866| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3867|3867| 			return;
|3868|3868| 		}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4103|4103| 	if (data.timerRepeat === undefined)
|4104|4104| 		this.timer = undefined;
|4105|4105| 
|4106|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4106|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4107|4107| };
|4108|4108| 
|4109|4109| /**
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4103|4103| 	if (data.timerRepeat === undefined)
|4104|4104| 		this.timer = undefined;
|4105|4105| 
|4106|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4106|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4107|4107| };
|4108|4108| 
|4109|4109| /**
|    | [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
|4148|4148| 	// TODO: This is a bit inefficient since every unit listens to every
|4149|4149| 	// construction message - ideally we could scope it to only the one we're building
|4150|4150| 
|4151|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4151|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4152|4152| };
|4153|4153| 
|4154|4154| 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
|4148|4148| 	// TODO: This is a bit inefficient since every unit listens to every
|4149|4149| 	// construction message - ideally we could scope it to only the one we're building
|4150|4150| 
|4151|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4151|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4152|4152| };
|4153|4153| 
|4154|4154| 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
|4179|4179| 	if (msg.fromStatusEffect)
|4180|4180| 		return;
|4181|4181| 
|4182|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4182|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4183|4183| };
|4184|4184| 
|4185|4185| 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
|4179|4179| 	if (msg.fromStatusEffect)
|4180|4180| 		return;
|4181|4181| 
|4182|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4182|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4183|4183| };
|4184|4184| 
|4185|4185| 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
|4184|4184| 
|4185|4185| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4186|4186| {
|4187|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4187|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4188|4188| };
|4189|4189| 
|4190|4190| 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
|4184|4184| 
|4185|4185| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4186|4186| {
|4187|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4187|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4188|4188| };
|4189|4189| 
|4190|4190| 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
|4189|4189| 
|4190|4190| UnitAI.prototype.OnHealthChanged = function(msg)
|4191|4191| {
|4192|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4192|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4193|4193| };
|4194|4194| 
|4195|4195| 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
|4189|4189| 
|4190|4190| UnitAI.prototype.OnHealthChanged = function(msg)
|4191|4191| {
|4192|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4192|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4193|4193| };
|4194|4194| 
|4195|4195| 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
|4195|4195| UnitAI.prototype.OnRangeUpdate = function(msg)
|4196|4196| {
|4197|4197| 	if (msg.tag == this.losRangeQuery)
|4198|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4198|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4199|4199| 	else if (msg.tag == this.losHealRangeQuery)
|4200|4200| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4201|4201| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4195|4195| UnitAI.prototype.OnRangeUpdate = function(msg)
|4196|4196| {
|4197|4197| 	if (msg.tag == this.losRangeQuery)
|4198|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4198|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4199|4199| 	else if (msg.tag == this.losHealRangeQuery)
|4200|4200| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4201|4201| };
|    | [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
|4197|4197| 	if (msg.tag == this.losRangeQuery)
|4198|4198| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4199|4199| 	else if (msg.tag == this.losHealRangeQuery)
|4200|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4200|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4201|4201| };
|4202|4202| 
|4203|4203| 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
|4197|4197| 	if (msg.tag == this.losRangeQuery)
|4198|4198| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4199|4199| 	else if (msg.tag == this.losHealRangeQuery)
|4200|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4200|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4201|4201| };
|4202|4202| 
|4203|4203| 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
|4202|4202| 
|4203|4203| UnitAI.prototype.OnPackFinished = function(msg)
|4204|4204| {
|4205|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4205|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4206|4206| };
|4207|4207| 
|4208|4208| //// 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
|4202|4202| 
|4203|4203| UnitAI.prototype.OnPackFinished = function(msg)
|4204|4204| {
|4205|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4205|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4206|4206| };
|4207|4207| 
|4208|4208| //// 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
|4205|4205| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4206|4206| };
|4207|4207| 
|4208|    |-//// Helper functions to be called by the FSM ////
|    |4208|+// // Helper functions to be called by the FSM ////
|4209|4209| 
|4210|4210| UnitAI.prototype.GetWalkSpeed = function()
|4211|4211| {
|    | [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
|4920|4920| UnitAI.prototype.AttackEntityInZone = function(ents)
|4921|4921| {
|4922|4922| 	var target = ents.find(target =>
|4923|    |-		this.CanAttack(target)
|4924|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4923|+		this.CanAttack(target) &&
|    |4924|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4925|4925| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4926|4926| 	);
|4927|4927| 	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
|4921|4921| {
|4922|4922| 	var target = ents.find(target =>
|4923|4923| 		this.CanAttack(target)
|4924|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4925|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4924|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4925|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4926|4926| 	);
|4927|4927| 	if (!target)
|4928|4928| 		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
|4987|4987| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4988|4988| 	if (this.isGuardOf)
|4989|4989| 	{
|4990|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4990|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4991|4991| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4992|4992| 		if (cmpUnitAI && cmpAttack &&
|4993|4993| 		    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
|4991|4991| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4992|4992| 		if (cmpUnitAI && cmpAttack &&
|4993|4993| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4994|    |-				return false;
|    |4994|+			return false;
|4995|4995| 	}
|4996|4996| 
|4997|4997| 	// 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
|5029|5029| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|5030|5030| 	if (this.isGuardOf)
|5031|5031| 	{
|5032|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |5032|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|5033|5033| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|5034|5034| 		if (cmpUnitAI && cmpAttack &&
|5035|5035| 		    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
|5042|5042| 	return false;
|5043|5043| };
|5044|5044| 
|5045|    |-//// External interface functions ////
|    |5045|+// // External interface functions ////
|5046|5046| 
|5047|5047| UnitAI.prototype.SetFormationController = function(ent)
|5048|5048| {
|    | [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
|5198|5198| 	{
|5199|5199| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5200|5200| 			return;
|5201|    |-		else
|5202|    |-			this.RemoveGuard();
|    |5201|+		this.RemoveGuard();
|5203|5202| 	}
|5204|5203| 
|5205|5204| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5532|5532| 
|5533|5533| 	if (this.IsFormationController())
|5534|5534| 		this.CallMemberFunction("CancelSetupTradeRoute", [target]);
|5535|    |-}
|    |5535|+};
|5536|5536| /**
|5537|5537|  * Adds trade order to the queue. Either walk to the first market, or
|5538|5538|  * start a new route. Not forced, so it can be interrupted by attacks.
|    | [NORMAL] ESLintBear (no-trailing-spaces):
|    | Trailing spaces not allowed.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5553|5553| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5554|5554| 	{
|5555|5555| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5556|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5556|+		if (cmpTrader.HasBothMarkets() &&
|5557|5557| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5558|5558| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5559|5559| 		{
|    | [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
|5834|5834| 				{
|5835|5835| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5836|5836| 					var targetClasses = this.order.data.targetClasses;
|5837|    |-					if (targetClasses.attack && cmpIdentity
|5838|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5837|+					if (targetClasses.attack && cmpIdentity &&
|    |5838|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5839|5839| 						continue;
|5840|5840| 					if (targetClasses.avoid && cmpIdentity
|5841|5841| 						&& 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
|5837|5837| 					if (targetClasses.attack && cmpIdentity
|5838|5838| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5839|5839| 						continue;
|5840|    |-					if (targetClasses.avoid && cmpIdentity
|5841|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5840|+					if (targetClasses.avoid && cmpIdentity &&
|    |5841|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5842|5842| 						continue;
|5843|5843| 					// Only used by the AIs to prevent some choices of targets
|5844|5844| 					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
|5860|5860| 		{
|5861|5861| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5862|5862| 			var targetClasses = this.order.data.targetClasses;
|5863|    |-			if (cmpIdentity && targetClasses.attack
|5864|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5863|+			if (cmpIdentity && targetClasses.attack &&
|    |5864|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5865|5865| 				continue;
|5866|5866| 			if (cmpIdentity && targetClasses.avoid
|5867|5867| 				&& 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
|5863|5863| 			if (cmpIdentity && targetClasses.attack
|5864|5864| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5865|5865| 				continue;
|5866|    |-			if (cmpIdentity && targetClasses.avoid
|5867|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5866|+			if (cmpIdentity && targetClasses.avoid &&
|    |5867|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5868|5868| 				continue;
|5869|5869| 			// Only used by the AIs to prevent some choices of targets
|5870|5870| 			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
|6023|6023| 
|6024|6024| UnitAI.prototype.SetHeldPosition = function(x, z)
|6025|6025| {
|6026|    |-	this.heldPosition = {"x": x, "z": z};
|    |6026|+	this.heldPosition = { "x": x, "z": z};
|6027|6027| };
|6028|6028| 
|6029|6029| 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
|6023|6023| 
|6024|6024| UnitAI.prototype.SetHeldPosition = function(x, z)
|6025|6025| {
|6026|    |-	this.heldPosition = {"x": x, "z": z};
|    |6026|+	this.heldPosition = {"x": x, "z": z };
|6027|6027| };
|6028|6028| 
|6029|6029| 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
|6050|6050| 	return false;
|6051|6051| };
|6052|6052| 
|6053|    |-//// Helper functions ////
|    |6053|+// // Helper functions ////
|6054|6054| 
|6055|6055| /**
|6056|6056|  * General getter for ranges.
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|6069|6069| 		return undefined;
|6070|6070| 
|6071|6071| 	return component.GetRange(type);
|6072|    |-}
|    |6072|+};
|6073|6073| 
|6074|6074| UnitAI.prototype.CanAttack = function(target)
|6075|6075| {
|    | [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
|6245|6245| 	return cmpPack && cmpPack.IsPacking();
|6246|6246| };
|6247|6247| 
|6248|    |-//// Formation specific functions ////
|    |6248|+// // Formation specific functions ////
|6249|6249| 
|6250|6250| UnitAI.prototype.IsAttackingAsFormation = function()
|6251|6251| {
|    | [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
|6250|6250| UnitAI.prototype.IsAttackingAsFormation = function()
|6251|6251| {
|6252|6252| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6253|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6254|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6253|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6254|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6255|6255| };
|6256|6256| 
|6257|6257| //// 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
|6254|6254| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6255|6255| };
|6256|6256| 
|6257|    |-//// Animal specific functions ////
|    |6257|+// // Animal specific functions ////
|6258|6258| 
|6259|6259| UnitAI.prototype.MoveRandomly = function(distance)
|6260|6260| {

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4008| »   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
|4907| »   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
|4922| »   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
|4970| »   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
|4993| »   »   ····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
|2034| »   »   »   »   »   »   &&·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
|3122| »   »   »   »   »   this.SetAnimationVariant(this.formationAnimationVariant)
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

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

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

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

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

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

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

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

This revision was automatically updated to reflect the committed changes.

Thanks for the review, changes and commit @wraitii!