Page MenuHomeWildfire Games

Don't store the gatherers per player.
ClosedPublic

Authored by Freagarach on May 21 2020, 5:14 PM.

Details

Summary

Its use was deprecated in rP14848, but not compleately removed. This does that, thus (slightly) increasing performance :)

Test Plan

Verify that:

  • Entities can still gather.
  • Entties autogather when their first target is exhausted.
  • The GUI still functions as should.

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.May 21 2020, 5:14 PM
Angen added a subscriber: Angen.May 21 2020, 6:35 PM

just want to note that you just went from o(1*n) to o(m*n) where n is maximum from all this. gatherers[x]. length and m is number of players need to be checked what is 8 in worst case right now

True, but I did ditch some Engine.QueryInterface-calls, so I do not know what is to be preferred ^^ (One can measure obviously.)

Angen added inline comments.May 21 2020, 6:42 PM
binaries/data/mods/public/simulation/components/ResourceSupply.js
148 ↗(On Diff #11952)

also when asking if available isgatheringus is called and here again, that looks like double work

Freagarach added inline comments.May 21 2020, 6:43 PM
binaries/data/mods/public/simulation/components/ResourceSupply.js
148 ↗(On Diff #11952)

Yeah, I guess more refactoring is needed yet again,,,

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 788| 788| 					this.FinishOrder();
| 789| 789| 					return;
| 790| 790| 				}
| 791|    |-				else
| 792|    |-				{
|    | 791|+				
| 793| 792| 					this.SetNextState("GARRISON.APPROACHING");
| 794| 793| 					return;
| 795|    |-				}
|    | 794|+				
| 796| 795| 			}
| 797| 796| 
| 798| 797| 			this.SetNextState("GARRISON.GARRISONING");
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'GARRISON'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1060|1060| 			},
|1061|1061| 		},
|1062|1062| 
|1063|    |-		"GARRISON":{
|    |1063|+		"GARRISON": {
|1064|1064| 			"APPROACHING": {
|1065|1065| 				"enter": function() {
|1066|1066| 					if (!this.MoveToGarrisonRange(this.order.data.target))
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2034|2034| 
|2035|2035| 				"Attacked": function(msg) {
|2036|2036| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2037|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2038|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2037|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2038|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2039|2039| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2040|2040| 				},
|2041|2041| 			},
|    | [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
|2193|2193| 					"MovementUpdate": function(msg) {
|2194|2194| 						// If it looks like the path is failing, and we are close enough (3 tiles) from wanted range
|2195|2195| 						// stop anyways. This avoids pathing for an unreachable goal and reduces lag considerably.
|2196|    |-						if (msg.likelyFailure || 
|    |2196|+						if (msg.likelyFailure ||
|2197|2197| 							msg.obstructed && this.RelaxedMaxRangeCheck(this.order.data, this.order.data.max + this.DefaultRelaxedMaxRange) ||
|2198|2198| 							!msg.obstructed && this.CheckRange(this.order.data))
|2199|2199| 							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
|2827|2827| 					{
|2828|2828| 						// The building was already finished/fully repaired before we arrived;
|2829|2829| 						// let the ConstructionFinished handler handle this.
|2830|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2830|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2831|2831| 						return true;
|2832|2832| 					}
|2833|2833| 
|    | [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
|2827|2827| 					{
|2828|2828| 						// The building was already finished/fully repaired before we arrived;
|2829|2829| 						// let the ConstructionFinished handler handle this.
|2830|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2830|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2831|2831| 						return true;
|2832|2832| 					}
|2833|2833| 
|    | [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
|3125|3125| 				this.StopTimer();
|3126|3126| 				this.ResetAnimation();
|3127|3127| 				if (this.formationAnimationVariant)
|3128|    |-					this.SetAnimationVariant(this.formationAnimationVariant)
|    |3128|+					this.SetAnimationVariant(this.formationAnimationVariant);
|3129|3129| 				else
|3130|3130| 					this.SetDefaultAnimationVariant();
|3131|3131| 				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
|3351|3351| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3352|3352| 
|3353|3353| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3354|    |-							// only used for domestic animals
|    |3354|+		// only used for domestic animals
|3355|3355| 
|3356|3356| 		// Reuse the same garrison behaviour for animals.
|3357|3357| 		"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
|3413|3413| 
|3414|3414| UnitAI.prototype.IsAnimal = function()
|3415|3415| {
|3416|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3416|+	return (!!this.template.NaturalBehaviour);
|3417|3417| };
|3418|3418| 
|3419|3419| 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
|3529|3529| 		{
|3530|3530| 			let index = this.GetCurrentState().indexOf(".");
|3531|3531| 			if (index != -1)
|3532|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3532|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3533|3533| 			this.Stop(false);
|3534|3534| 		}
|3535|3535| 
|    | [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
|3585|3585| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3586|3586| 			continue;
|3587|3587| 		if (i == 0)
|3588|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3588|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3589|3589| 		else
|3590|3590| 			this.orderQueue.splice(i, 1);
|3591|3591| 		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
|3585|3585| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3586|3586| 			continue;
|3587|3587| 		if (i == 0)
|3588|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3588|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3589|3589| 		else
|3590|3590| 			this.orderQueue.splice(i, 1);
|3591|3591| 		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
|3672|3672| };
|3673|3673| 
|3674|3674| 
|3675|    |-//// FSM linkage functions ////
|    |3675|+// // FSM linkage functions ////
|3676|3676| 
|3677|3677| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3678|3678| 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
|3843|3843| 				continue;
|3844|3844| 			if (this.orderQueue[i].type == type)
|3845|3845| 				continue;
|3846|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3846|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3847|3847| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3848|3848| 			return;
|3849|3849| 		}
|    | [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
|3843|3843| 				continue;
|3844|3844| 			if (this.orderQueue[i].type == type)
|3845|3845| 				continue;
|3846|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3846|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3847|3847| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3848|3848| 			return;
|3849|3849| 		}
|    | [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
|4085|4085| 	if (data.timerRepeat === undefined)
|4086|4086| 		this.timer = undefined;
|4087|4087| 
|4088|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4088|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4089|4089| };
|4090|4090| 
|4091|4091| /**
|    | [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
|4085|4085| 	if (data.timerRepeat === undefined)
|4086|4086| 		this.timer = undefined;
|4087|4087| 
|4088|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4088|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4089|4089| };
|4090|4090| 
|4091|4091| /**
|    | [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
|4130|4130| 	// TODO: This is a bit inefficient since every unit listens to every
|4131|4131| 	// construction message - ideally we could scope it to only the one we're building
|4132|4132| 
|4133|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4133|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4134|4134| };
|4135|4135| 
|4136|4136| 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
|4130|4130| 	// TODO: This is a bit inefficient since every unit listens to every
|4131|4131| 	// construction message - ideally we could scope it to only the one we're building
|4132|4132| 
|4133|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4133|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4134|4134| };
|4135|4135| 
|4136|4136| 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
|4161|4161| 	if (msg.fromStatusEffect)
|4162|4162| 		return;
|4163|4163| 
|4164|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4164|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4165|4165| };
|4166|4166| 
|4167|4167| 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
|4161|4161| 	if (msg.fromStatusEffect)
|4162|4162| 		return;
|4163|4163| 
|4164|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4164|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4165|4165| };
|4166|4166| 
|4167|4167| 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
|4166|4166| 
|4167|4167| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4168|4168| {
|4169|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4169|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4170|4170| };
|4171|4171| 
|4172|4172| 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
|4166|4166| 
|4167|4167| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4168|4168| {
|4169|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4169|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4170|4170| };
|4171|4171| 
|4172|4172| 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
|4171|4171| 
|4172|4172| UnitAI.prototype.OnHealthChanged = function(msg)
|4173|4173| {
|4174|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4174|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4175|4175| };
|4176|4176| 
|4177|4177| 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
|4171|4171| 
|4172|4172| UnitAI.prototype.OnHealthChanged = function(msg)
|4173|4173| {
|4174|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4174|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4175|4175| };
|4176|4176| 
|4177|4177| 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
|4177|4177| UnitAI.prototype.OnRangeUpdate = function(msg)
|4178|4178| {
|4179|4179| 	if (msg.tag == this.losRangeQuery)
|4180|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4180|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4181|4181| 	else if (msg.tag == this.losHealRangeQuery)
|4182|4182| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4183|4183| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4177|4177| UnitAI.prototype.OnRangeUpdate = function(msg)
|4178|4178| {
|4179|4179| 	if (msg.tag == this.losRangeQuery)
|4180|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4180|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4181|4181| 	else if (msg.tag == this.losHealRangeQuery)
|4182|4182| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4183|4183| };
|    | [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.tag == this.losRangeQuery)
|4180|4180| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4181|4181| 	else if (msg.tag == this.losHealRangeQuery)
|4182|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4182|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4183|4183| };
|4184|4184| 
|4185|4185| 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
|4179|4179| 	if (msg.tag == this.losRangeQuery)
|4180|4180| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4181|4181| 	else if (msg.tag == this.losHealRangeQuery)
|4182|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4182|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4183|4183| };
|4184|4184| 
|4185|4185| 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
|4184|4184| 
|4185|4185| UnitAI.prototype.OnPackFinished = function(msg)
|4186|4186| {
|4187|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4187|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4188|4188| };
|4189|4189| 
|4190|4190| //// 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
|4184|4184| 
|4185|4185| UnitAI.prototype.OnPackFinished = function(msg)
|4186|4186| {
|4187|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4187|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4188|4188| };
|4189|4189| 
|4190|4190| //// 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
|4187|4187| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4188|4188| };
|4189|4189| 
|4190|    |-//// Helper functions to be called by the FSM ////
|    |4190|+// // Helper functions to be called by the FSM ////
|4191|4191| 
|4192|4192| UnitAI.prototype.GetWalkSpeed = function()
|4193|4193| {
|    | [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
|4898|4898| UnitAI.prototype.AttackEntityInZone = function(ents)
|4899|4899| {
|4900|4900| 	var target = ents.find(target =>
|4901|    |-		this.CanAttack(target)
|4902|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4901|+		this.CanAttack(target) &&
|    |4902|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4903|4903| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4904|4904| 	);
|4905|4905| 	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
|4899|4899| {
|4900|4900| 	var target = ents.find(target =>
|4901|4901| 		this.CanAttack(target)
|4902|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4903|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4902|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4903|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4904|4904| 	);
|4905|4905| 	if (!target)
|4906|4906| 		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
|4965|4965| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4966|4966| 	if (this.isGuardOf)
|4967|4967| 	{
|4968|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4968|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4969|4969| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4970|4970| 		if (cmpUnitAI && cmpAttack &&
|4971|4971| 		    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
|4969|4969| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4970|4970| 		if (cmpUnitAI && cmpAttack &&
|4971|4971| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4972|    |-				return false;
|    |4972|+			return false;
|4973|4973| 	}
|4974|4974| 
|4975|4975| 	// 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
|5007|5007| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|5008|5008| 	if (this.isGuardOf)
|5009|5009| 	{
|5010|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |5010|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|5011|5011| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|5012|5012| 		if (cmpUnitAI && cmpAttack &&
|5013|5013| 		    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
|5020|5020| 	return false;
|5021|5021| };
|5022|5022| 
|5023|    |-//// External interface functions ////
|    |5023|+// // External interface functions ////
|5024|5024| 
|5025|5025| UnitAI.prototype.SetFormationController = function(ent)
|5026|5026| {
|    | [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
|5176|5176| 	{
|5177|5177| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5178|5178| 			return;
|5179|    |-		else
|5180|    |-			this.RemoveGuard();
|    |5179|+		this.RemoveGuard();
|5181|5180| 	}
|5182|5181| 
|5183|5182| 	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
|5507|5507| 
|5508|5508| 	if (this.IsFormationController())
|5509|5509| 		this.CallMemberFunction("CancelSetupTradeRoute", [target]);
|5510|    |-}
|    |5510|+};
|5511|5511| /**
|5512|5512|  * Adds trade order to the queue. Either walk to the first market, or
|5513|5513|  * 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
|5528|5528| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5529|5529| 	{
|5530|5530| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5531|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5531|+		if (cmpTrader.HasBothMarkets() &&
|5532|5532| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5533|5533| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5534|5534| 		{
|    | [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
|5809|5809| 				{
|5810|5810| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5811|5811| 					var targetClasses = this.order.data.targetClasses;
|5812|    |-					if (targetClasses.attack && cmpIdentity
|5813|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5812|+					if (targetClasses.attack && cmpIdentity &&
|    |5813|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5814|5814| 						continue;
|5815|5815| 					if (targetClasses.avoid && cmpIdentity
|5816|5816| 						&& 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
|5812|5812| 					if (targetClasses.attack && cmpIdentity
|5813|5813| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5814|5814| 						continue;
|5815|    |-					if (targetClasses.avoid && cmpIdentity
|5816|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5815|+					if (targetClasses.avoid && cmpIdentity &&
|    |5816|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5817|5817| 						continue;
|5818|5818| 					// Only used by the AIs to prevent some choices of targets
|5819|5819| 					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
|5835|5835| 		{
|5836|5836| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5837|5837| 			var targetClasses = this.order.data.targetClasses;
|5838|    |-			if (cmpIdentity && targetClasses.attack
|5839|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5838|+			if (cmpIdentity && targetClasses.attack &&
|    |5839|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5840|5840| 				continue;
|5841|5841| 			if (cmpIdentity && targetClasses.avoid
|5842|5842| 				&& 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
|5838|5838| 			if (cmpIdentity && targetClasses.attack
|5839|5839| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5840|5840| 				continue;
|5841|    |-			if (cmpIdentity && targetClasses.avoid
|5842|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5841|+			if (cmpIdentity && targetClasses.avoid &&
|    |5842|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5843|5843| 				continue;
|5844|5844| 			// Only used by the AIs to prevent some choices of targets
|5845|5845| 			if (targetClasses.vetoEntities && targetClasses.vetoEntities[targ])
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5998|5998| 
|5999|5999| UnitAI.prototype.SetHeldPosition = function(x, z)
|6000|6000| {
|6001|    |-	this.heldPosition = {"x": x, "z": z};
|    |6001|+	this.heldPosition = { "x": x, "z": z};
|6002|6002| };
|6003|6003| 
|6004|6004| UnitAI.prototype.SetHeldPositionOnEntity = function(entity)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5998|5998| 
|5999|5999| UnitAI.prototype.SetHeldPosition = function(x, z)
|6000|6000| {
|6001|    |-	this.heldPosition = {"x": x, "z": z};
|    |6001|+	this.heldPosition = {"x": x, "z": z };
|6002|6002| };
|6003|6003| 
|6004|6004| UnitAI.prototype.SetHeldPositionOnEntity = function(entity)
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|6025|6025| 	return false;
|6026|6026| };
|6027|6027| 
|6028|    |-//// Helper functions ////
|    |6028|+// // Helper functions ////
|6029|6029| 
|6030|6030| /**
|6031|6031|  * General getter for ranges.
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|6044|6044| 		return undefined;
|6045|6045| 
|6046|6046| 	return component.GetRange(type);
|6047|    |-}
|    |6047|+};
|6048|6048| 
|6049|6049| UnitAI.prototype.CanAttack = function(target)
|6050|6050| {
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|6212|6212| 	return cmpPack && cmpPack.IsPacking();
|6213|6213| };
|6214|6214| 
|6215|    |-//// Formation specific functions ////
|    |6215|+// // Formation specific functions ////
|6216|6216| 
|6217|6217| UnitAI.prototype.IsAttackingAsFormation = function()
|6218|6218| {
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|6217|6217| UnitAI.prototype.IsAttackingAsFormation = function()
|6218|6218| {
|6219|6219| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6220|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6221|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6220|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6221|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6222|6222| };
|6223|6223| 
|6224|6224| //// Animal specific functions ////
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|6221|6221| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6222|6222| };
|6223|6223| 
|6224|    |-//// Animal specific functions ////
|    |6224|+// // Animal specific functions ////
|6225|6225| 
|6226|6226| UnitAI.prototype.MoveRandomly = function(distance)
|6227|6227| {

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|3990| »   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
|4885| »   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
|4900| »   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
|4948| »   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
|4971| »   »   ····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
|2038| »   »   »   »   »   »   &&·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
|3128| »   »   »   »   »   this.SetAnimationVariant(this.formationAnimationVariant)
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|5839| »   »   »   »   &&·!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
|5842| »   »   »   »   &&·MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.avoid))
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

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

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

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

Freagarach planned changes to this revision.Jun 4 2020, 8:12 AM
Freagarach updated this revision to Diff 12462.Jun 26 2020, 3:51 PM
Freagarach marked an inline comment as done.

Remove duplicate call.

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
| 791| 791| 					this.FinishOrder();
| 792| 792| 					return;
| 793| 793| 				}
| 794|    |-				else
| 795|    |-				{
|    | 794|+				
| 796| 795| 					this.SetNextState("GARRISON.APPROACHING");
| 797| 796| 					return;
| 798|    |-				}
|    | 797|+				
| 799| 798| 			}
| 800| 799| 
| 801| 800| 			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
|1057|1057| 			},
|1058|1058| 		},
|1059|1059| 
|1060|    |-		"GARRISON":{
|    |1060|+		"GARRISON": {
|1061|1061| 			"APPROACHING": {
|1062|1062| 				"enter": function() {
|1063|1063| 					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
|2027|2027| 
|2028|2028| 				"Attacked": function(msg) {
|2029|2029| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2030|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2031|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2030|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2031|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2032|2032| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2033|2033| 				},
|2034|2034| 			},
|    | [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
|2186|2186| 					"MovementUpdate": function(msg) {
|2187|2187| 						// If it looks like the path is failing, and we are close enough (3 tiles) from wanted range
|2188|2188| 						// stop anyways. This avoids pathing for an unreachable goal and reduces lag considerably.
|2189|    |-						if (msg.likelyFailure || 
|    |2189|+						if (msg.likelyFailure ||
|2190|2190| 							msg.obstructed && this.RelaxedMaxRangeCheck(this.order.data, this.order.data.max + this.DefaultRelaxedMaxRange) ||
|2191|2191| 							!msg.obstructed && this.CheckRange(this.order.data))
|2192|2192| 							this.FinishOrder();
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 7 tabs but found 6.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2481|2481| 
|2482|2482| 								return type.specific == resourceType.specific &&
|2483|2483| 								    (type.specific != "meat" || resourceTemplate == template);
|2484|    |-						});
|    |2484|+							});
|2485|2485| 
|2486|2486| 						if (nearbyResource)
|2487|2487| 						{
|    | [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
|2813|2813| 					{
|2814|2814| 						// The building was already finished/fully repaired before we arrived;
|2815|2815| 						// let the ConstructionFinished handler handle this.
|2816|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2816|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2817|2817| 						return true;
|2818|2818| 					}
|2819|2819| 
|    | [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
|2813|2813| 					{
|2814|2814| 						// The building was already finished/fully repaired before we arrived;
|2815|2815| 						// let the ConstructionFinished handler handle this.
|2816|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2816|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2817|2817| 						return true;
|2818|2818| 					}
|2819|2819| 
|    | [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
|3103|3103| 				this.StopTimer();
|3104|3104| 				this.ResetAnimation();
|3105|3105| 				if (this.formationAnimationVariant)
|3106|    |-					this.SetAnimationVariant(this.formationAnimationVariant)
|    |3106|+					this.SetAnimationVariant(this.formationAnimationVariant);
|3107|3107| 				else
|3108|3108| 					this.SetDefaultAnimationVariant();
|3109|3109| 				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
|3329|3329| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3330|3330| 
|3331|3331| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3332|    |-							// only used for domestic animals
|    |3332|+		// only used for domestic animals
|3333|3333| 
|3334|3334| 		// Reuse the same garrison behaviour for animals.
|3335|3335| 		"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
|3381|3381| 
|3382|3382| UnitAI.prototype.IsAnimal = function()
|3383|3383| {
|3384|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3384|+	return (!!this.template.NaturalBehaviour);
|3385|3385| };
|3386|3386| 
|3387|3387| 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
|3521|3521| 		{
|3522|3522| 			let index = this.GetCurrentState().indexOf(".");
|3523|3523| 			if (index != -1)
|3524|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3524|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3525|3525| 			this.Stop(false);
|3526|3526| 		}
|3527|3527| 
|    | [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
|3577|3577| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3578|3578| 			continue;
|3579|3579| 		if (i == 0)
|3580|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3580|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3581|3581| 		else
|3582|3582| 			this.orderQueue.splice(i, 1);
|3583|3583| 		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
|3577|3577| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3578|3578| 			continue;
|3579|3579| 		if (i == 0)
|3580|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3580|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3581|3581| 		else
|3582|3582| 			this.orderQueue.splice(i, 1);
|3583|3583| 		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
|3664|3664| };
|3665|3665| 
|3666|3666| 
|3667|    |-//// FSM linkage functions ////
|    |3667|+// // FSM linkage functions ////
|3668|3668| 
|3669|3669| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3670|3670| 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
|3836|3836| 				continue;
|3837|3837| 			if (this.orderQueue[i].type == type)
|3838|3838| 				continue;
|3839|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3839|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3840|3840| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3841|3841| 			return;
|3842|3842| 		}
|    | [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
|3836|3836| 				continue;
|3837|3837| 			if (this.orderQueue[i].type == type)
|3838|3838| 				continue;
|3839|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3839|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3840|3840| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3841|3841| 			return;
|3842|3842| 		}
|    | [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
|4077|4077| 	if (data.timerRepeat === undefined)
|4078|4078| 		this.timer = undefined;
|4079|4079| 
|4080|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4080|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4081|4081| };
|4082|4082| 
|4083|4083| /**
|    | [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
|4077|4077| 	if (data.timerRepeat === undefined)
|4078|4078| 		this.timer = undefined;
|4079|4079| 
|4080|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4080|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4081|4081| };
|4082|4082| 
|4083|4083| /**
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4122|4122| 	// TODO: This is a bit inefficient since every unit listens to every
|4123|4123| 	// construction message - ideally we could scope it to only the one we're building
|4124|4124| 
|4125|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4125|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4126|4126| };
|4127|4127| 
|4128|4128| 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
|4122|4122| 	// TODO: This is a bit inefficient since every unit listens to every
|4123|4123| 	// construction message - ideally we could scope it to only the one we're building
|4124|4124| 
|4125|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4125|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4126|4126| };
|4127|4127| 
|4128|4128| 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
|4161|4161| 	if (msg.fromStatusEffect)
|4162|4162| 		return;
|4163|4163| 
|4164|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4164|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4165|4165| };
|4166|4166| 
|4167|4167| 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
|4161|4161| 	if (msg.fromStatusEffect)
|4162|4162| 		return;
|4163|4163| 
|4164|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4164|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4165|4165| };
|4166|4166| 
|4167|4167| 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
|4166|4166| 
|4167|4167| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4168|4168| {
|4169|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4169|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4170|4170| };
|4171|4171| 
|4172|4172| 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
|4166|4166| 
|4167|4167| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4168|4168| {
|4169|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4169|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4170|4170| };
|4171|4171| 
|4172|4172| 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
|4171|4171| 
|4172|4172| UnitAI.prototype.OnHealthChanged = function(msg)
|4173|4173| {
|4174|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4174|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4175|4175| };
|4176|4176| 
|4177|4177| 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
|4171|4171| 
|4172|4172| UnitAI.prototype.OnHealthChanged = function(msg)
|4173|4173| {
|4174|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4174|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4175|4175| };
|4176|4176| 
|4177|4177| 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
|4177|4177| UnitAI.prototype.OnRangeUpdate = function(msg)
|4178|4178| {
|4179|4179| 	if (msg.tag == this.losRangeQuery)
|4180|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4180|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4181|4181| 	else if (msg.tag == this.losHealRangeQuery)
|4182|4182| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4183|4183| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4177|4177| UnitAI.prototype.OnRangeUpdate = function(msg)
|4178|4178| {
|4179|4179| 	if (msg.tag == this.losRangeQuery)
|4180|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4180|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4181|4181| 	else if (msg.tag == this.losHealRangeQuery)
|4182|4182| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4183|4183| };
|    | [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.tag == this.losRangeQuery)
|4180|4180| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4181|4181| 	else if (msg.tag == this.losHealRangeQuery)
|4182|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4182|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4183|4183| };
|4184|4184| 
|4185|4185| 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
|4179|4179| 	if (msg.tag == this.losRangeQuery)
|4180|4180| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4181|4181| 	else if (msg.tag == this.losHealRangeQuery)
|4182|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4182|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4183|4183| };
|4184|4184| 
|4185|4185| 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
|4184|4184| 
|4185|4185| UnitAI.prototype.OnPackFinished = function(msg)
|4186|4186| {
|4187|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4187|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4188|4188| };
|4189|4189| 
|4190|4190| //// 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
|4184|4184| 
|4185|4185| UnitAI.prototype.OnPackFinished = function(msg)
|4186|4186| {
|4187|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4187|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4188|4188| };
|4189|4189| 
|4190|4190| //// 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
|4187|4187| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4188|4188| };
|4189|4189| 
|4190|    |-//// Helper functions to be called by the FSM ////
|    |4190|+// // Helper functions to be called by the FSM ////
|4191|4191| 
|4192|4192| UnitAI.prototype.GetWalkSpeed = function()
|4193|4193| {
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4916|4916| UnitAI.prototype.AttackEntityInZone = function(ents)
|4917|4917| {
|4918|4918| 	var target = ents.find(target =>
|4919|    |-		this.CanAttack(target)
|4920|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4919|+		this.CanAttack(target) &&
|    |4920|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4921|4921| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4922|4922| 	);
|4923|4923| 	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
|4917|4917| {
|4918|4918| 	var target = ents.find(target =>
|4919|4919| 		this.CanAttack(target)
|4920|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4921|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4920|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4921|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4922|4922| 	);
|4923|4923| 	if (!target)
|4924|4924| 		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
|4983|4983| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4984|4984| 	if (this.isGuardOf)
|4985|4985| 	{
|4986|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4986|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4987|4987| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4988|4988| 		if (cmpUnitAI && cmpAttack &&
|4989|4989| 		    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
|4987|4987| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4988|4988| 		if (cmpUnitAI && cmpAttack &&
|4989|4989| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4990|    |-				return false;
|    |4990|+			return false;
|4991|4991| 	}
|4992|4992| 
|4993|4993| 	// 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
|5025|5025| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|5026|5026| 	if (this.isGuardOf)
|5027|5027| 	{
|5028|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |5028|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|5029|5029| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|5030|5030| 		if (cmpUnitAI && cmpAttack &&
|5031|5031| 		    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
|5038|5038| 	return false;
|5039|5039| };
|5040|5040| 
|5041|    |-//// External interface functions ////
|    |5041|+// // External interface functions ////
|5042|5042| 
|5043|5043| UnitAI.prototype.SetFormationController = function(ent)
|5044|5044| {
|    | [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
|5194|5194| 	{
|5195|5195| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5196|5196| 			return;
|5197|    |-		else
|5198|    |-			this.RemoveGuard();
|    |5197|+		this.RemoveGuard();
|5199|5198| 	}
|5200|5199| 
|5201|5200| 	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
|5528|5528| 
|5529|5529| 	if (this.IsFormationController())
|5530|5530| 		this.CallMemberFunction("CancelSetupTradeRoute", [target]);
|5531|    |-}
|    |5531|+};
|5532|5532| /**
|5533|5533|  * Adds trade order to the queue. Either walk to the first market, or
|5534|5534|  * 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
|5549|5549| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5550|5550| 	{
|5551|5551| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5552|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5552|+		if (cmpTrader.HasBothMarkets() &&
|5553|5553| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5554|5554| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5555|5555| 		{
|    | [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
|5830|5830| 				{
|5831|5831| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5832|5832| 					var targetClasses = this.order.data.targetClasses;
|5833|    |-					if (targetClasses.attack && cmpIdentity
|5834|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5833|+					if (targetClasses.attack && cmpIdentity &&
|    |5834|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5835|5835| 						continue;
|5836|5836| 					if (targetClasses.avoid && cmpIdentity
|5837|5837| 						&& 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
|5833|5833| 					if (targetClasses.attack && cmpIdentity
|5834|5834| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5835|5835| 						continue;
|5836|    |-					if (targetClasses.avoid && cmpIdentity
|5837|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5836|+					if (targetClasses.avoid && cmpIdentity &&
|    |5837|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5838|5838| 						continue;
|5839|5839| 					// Only used by the AIs to prevent some choices of targets
|5840|5840| 					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
|5856|5856| 		{
|5857|5857| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5858|5858| 			var targetClasses = this.order.data.targetClasses;
|5859|    |-			if (cmpIdentity && targetClasses.attack
|5860|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5859|+			if (cmpIdentity && targetClasses.attack &&
|    |5860|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5861|5861| 				continue;
|5862|5862| 			if (cmpIdentity && targetClasses.avoid
|5863|5863| 				&& 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
|5859|5859| 			if (cmpIdentity && targetClasses.attack
|5860|5860| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5861|5861| 				continue;
|5862|    |-			if (cmpIdentity && targetClasses.avoid
|5863|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5862|+			if (cmpIdentity && targetClasses.avoid &&
|    |5863|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5864|5864| 				continue;
|5865|5865| 			// Only used by the AIs to prevent some choices of targets
|5866|5866| 			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
|6019|6019| 
|6020|6020| UnitAI.prototype.SetHeldPosition = function(x, z)
|6021|6021| {
|6022|    |-	this.heldPosition = {"x": x, "z": z};
|    |6022|+	this.heldPosition = { "x": x, "z": z};
|6023|6023| };
|6024|6024| 
|6025|6025| 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
|6019|6019| 
|6020|6020| UnitAI.prototype.SetHeldPosition = function(x, z)
|6021|6021| {
|6022|    |-	this.heldPosition = {"x": x, "z": z};
|    |6022|+	this.heldPosition = {"x": x, "z": z };
|6023|6023| };
|6024|6024| 
|6025|6025| 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
|6046|6046| 	return false;
|6047|6047| };
|6048|6048| 
|6049|    |-//// Helper functions ////
|    |6049|+// // Helper functions ////
|6050|6050| 
|6051|6051| /**
|6052|6052|  * 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
|6065|6065| 		return undefined;
|6066|6066| 
|6067|6067| 	return component.GetRange(type);
|6068|    |-}
|    |6068|+};
|6069|6069| 
|6070|6070| UnitAI.prototype.CanAttack = function(target)
|6071|6071| {
|    | [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
|6241|6241| 	return cmpPack && cmpPack.IsPacking();
|6242|6242| };
|6243|6243| 
|6244|    |-//// Formation specific functions ////
|    |6244|+// // Formation specific functions ////
|6245|6245| 
|6246|6246| UnitAI.prototype.IsAttackingAsFormation = function()
|6247|6247| {
|    | [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
|6246|6246| UnitAI.prototype.IsAttackingAsFormation = function()
|6247|6247| {
|6248|6248| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6249|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6250|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6249|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6250|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6251|6251| };
|6252|6252| 
|6253|6253| //// 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
|6250|6250| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6251|6251| };
|6252|6252| 
|6253|    |-//// Animal specific functions ////
|    |6253|+// // Animal specific functions ////
|6254|6254| 
|6255|6255| UnitAI.prototype.MoveRandomly = function(distance)
|6256|6256| {

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|3982| »   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
|4903| »   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
|4918| »   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
|4966| »   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
|4989| »   »   ····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
|2031| »   »   »   »   »   »   &&·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
|3106| »   »   »   »   »   this.SetAnimationVariant(this.formationAnimationVariant)
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

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

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

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

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

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

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

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

bb added a subscriber: bb.Jul 21 2020, 10:56 PM
bb added inline comments.
binaries/data/mods/public/simulation/components/ResourceSupply.js
160 ↗(On Diff #12462)

Shouldn't we exclude INVALID_PLAYER (-1)

201 ↗(On Diff #12462)

for (let gatherers of this.gatherers) ?
Will only run into trouble if someone adds an entity for owner == -1

binaries/data/mods/public/simulation/components/UnitAI.js
4266–4268 ↗(On Diff #12462)

Why keep all this? Shouldn't happen often so probably causes more performance downtime than it gains

wraitii added inline comments.
binaries/data/mods/public/simulation/components/UnitAI.js
4266–4268 ↗(On Diff #12462)

Agreed, seems useless.

wraitii requested changes to this revision.Aug 5 2020, 11:40 AM
This revision now requires changes to proceed.Aug 5 2020, 11:40 AM
Freagarach updated this revision to Diff 13172.Aug 11 2020, 5:25 PM
Freagarach marked 4 inline comments as done.
  • Exclude INVALID_PLAYER when adding a gatherer.
  • Use for-of-loop.
  • Don't check for ownership in UnitAI FindNearbyResource.

@bb, @wraitii anything left to do here?

Stan added a subscriber: Stan.EditedThu, Sep 3, 11:48 AM

Are there any of the function calls that can be replaced by member access?

eg.

this.GetAmount();
// vs
this.amount;

I remember elexis used to ask for it.

Freagarach updated this revision to Diff 13370.Thu, Sep 3, 11:56 AM

Use member for amount.

Stan added a comment.Thu, Sep 3, 12:51 PM

Is that the only function that can be replaced by a member ? (i didn't check)

this.GetMaxGatherers() could also, but that would become +this.template.maxgatherers then, which means an operation and not only a member anymore.

bb added inline comments.Thu, Sep 3, 1:06 PM
binaries/data/mods/public/simulation/components/ResourceSupply.js
206–210 ↗(On Diff #13370)

If one is interested one can check whether return this.gatherers.some((gatherers) => gatherers.indexOf(entity) != -1); has better performance.
Another question one can ask is why we store the gatherers per player.

Freagarach added inline comments.Thu, Sep 3, 1:25 PM
binaries/data/mods/public/simulation/components/ResourceSupply.js
206–210 ↗(On Diff #13370)

Another question one can ask is why we store the gatherers per player.

Unnecessary after rP14848.
But after some cleanup we'd still want that because we want to limit what you can see of the enemy?

I can obviously ditch that here and reintroduce when needed.

Freagarach updated this revision to Diff 13376.Thu, Sep 3, 1:53 PM

Compleat removal of storing gatherers per player.

Freagarach retitled this revision from Do not pass owner when trying to add gatherer. to Don't store the gatherers per player..Thu, Sep 3, 1:56 PM
Freagarach edited the summary of this revision. (Show Details)
Freagarach edited the test plan for this revision. (Show Details)
Stan added inline comments.Thu, Sep 3, 2:36 PM
binaries/data/mods/public/simulation/components/ResourceSupply.js
93 ↗(On Diff #13376)
185 ↗(On Diff #13376)

Maybe?

Freagarach updated this revision to Diff 13387.Fri, Sep 4, 8:34 AM
Freagarach marked 2 inline comments as done.
  • this.gatherers.length.
  • Explicit type checking.
  • Add explanation why we return true when we're not added.
bb accepted this revision.Tue, Sep 8, 1:23 PM
bb removed a reviewer: Restricted Owners Package.

The only reason I can see (now) to keep the per player storage is when ordering a unit to gather somewhere, where also enemies are gathering, the unit maybe should kill the enemies before gathering. However this can be considered player responsibility too, sine he should be able too see the enemies in this case. If he can't see them (very large resourcesupply ent or so), it is fine this way. So probably behavior we don't need want.

binaries/data/mods/public/simulation/components/ResourceSupply.js
161–162 ↗(On Diff #13387)

No need to claim lying since that implies the code being buggy. Rather redefine the return value to include this case (hence change the comment in L154)

Angen added inline comments.Tue, Sep 8, 4:16 PM
binaries/data/mods/public/simulation/components/ResourceSupply.js
91 ↗(On Diff #13387)

maybe CanAddAdditionalGatherer and we do not need comment

100 ↗(On Diff #13387)

maybe we could have entityID and we do not need comment :)

168 ↗(On Diff #13387)

do we need this comment ?

Freagarach marked 3 inline comments as done.

Comments.

@Angen, I'm keeping JSDOC anyway ;)

wraitii resigned from this revision.Thu, Sep 10, 10:19 AM
This revision is now accepted and ready to land.Thu, Sep 10, 10:19 AM

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

builderr-debug-macos.txt
In file included from ../../../source/simulation2/tests/test_SerializeTemplates.cpp:17:
/Users/wfg/Jenkins/workspace/macos-differential/source/simulation2/tests/test_SerializeTemplates.h:39:4: warning: suggest braces around initialization of subobject [-Wmissing-braces]
                        3, 0, 1, 4, 1, 5
                        ^~~~~~~~~~~~~~~~
                        {               }
1 warning generated.
builderr-release-macos.txt
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libsimulation2.a(precompiled.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libgraphics.a(precompiled.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libatlas.a(precompiled.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libgui.a(precompiled.o) has no symbols
In file included from ../../../source/simulation2/tests/test_SerializeTemplates.cpp:17:
/Users/wfg/Jenkins/workspace/macos-differential/source/simulation2/tests/test_SerializeTemplates.h:39:4: warning: suggest braces around initialization of subobject [-Wmissing-braces]
                        3, 0, 1, 4, 1, 5
                        ^~~~~~~~~~~~~~~~
                        {               }
1 warning generated.

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

This revision was automatically updated to reflect the committed changes.

Thanks for the review @bb!