Page MenuHomeWildfire Games

Cheer after no enemy entities left in range
Needs RevisionPublic

Authored by Angen on Jun 15 2019, 7:31 PM.

Details

Summary

Cheering as is done now is highly unfair and illogical. Cheering units are immune to all damage for 2.8 seconds.
That means unit A attacking cheering unit B is wasting its attack and doing 0 damage while taking damage from anyone attacking it (unit A).
That can save cheering unit with 1 HP from being killed what is not fair to the attacker.

In this diff I am:

  1. removing immunity to damage while cheering
  2. do not forcing cheering order so unit can respond to attacks
  3. removing cheering from promotion
  4. cheering after unit cannot find more targets while in combat and has nothing else to do
  5. tell units around to cheer as well
Test Plan

Check cheering unit can respond to attacks and orders while in combat and is cheering.

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
Freagarach added inline comments.Nov 24 2019, 10:35 PM
binaries/data/mods/public/simulation/components/UnitAI.js
664–666

-

1492

+

1989

+/n

1992

Idem.

2114–2115

Do we want to cheer before this or after this?

2117

+/n

3574–3575

+.

3849–3850

+.

This revision now requires changes to proceed.Nov 24 2019, 10:35 PM
Angen planned changes to this revision.Dec 9 2019, 2:18 PM

I would prefer to get D1520 in first then i finish this.

Freagarach added inline comments.Apr 7 2020, 4:54 PM
binaries/data/mods/public/simulation/components/UnitAI.js
5751–5752

This could be made more generic perhaps? (To also allow group behavious such as a pack of wild animals attacking instead of being slaughtered one by one.)

Freagarach added inline comments.Apr 10 2020, 8:03 PM
binaries/data/mods/public/simulation/components/UnitAI.js
1493

Perhaps also check if we're really idle?

3574–3575

-or

5761

+;

Angen updated this revision to Diff 11673.Apr 13 2020, 4:19 PM
Angen retitled this revision from Change Cheering to Cheer after no enemies in range left.
Angen edited the summary of this revision. (Show Details)

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
| 785| 785| 					this.FinishOrder();
| 786| 786| 					return;
| 787| 787| 				}
| 788|    |-				else
| 789|    |-				{
|    | 788|+				
| 790| 789| 					this.SetNextState("GARRISON.APPROACHING");
| 791| 790| 					return;
| 792|    |-				}
|    | 791|+				
| 793| 792| 			}
| 794| 793| 
| 795| 794| 			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
|2052|2052| 
|2053|2053| 				"Attacked": function(msg) {
|2054|2054| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2055|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2056|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2055|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2056|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2057|2057| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2058|2058| 				},
|2059|2059| 			},
|    | [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
|2217|2217| 					"MovementUpdate": function(msg) {
|2218|2218| 						// If it looks like the path is failing, and we are close enough (3 tiles) from wanted range
|2219|2219| 						// stop anyways. This avoids pathing for an unreachable goal and reduces lag considerably.
|2220|    |-						if (msg.likelyFailure || 
|    |2220|+						if (msg.likelyFailure ||
|2221|2221| 							msg.obstructed && this.RelaxedMaxRangeCheck(this.order.data, this.order.data.max + this.DefaultRelaxedMaxRange) ||
|2222|2222| 							!msg.obstructed && this.CheckRange(this.order.data))
|2223|2223| 							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
|2859|2859| 					{
|2860|2860| 						// The building was already finished/fully repaired before we arrived;
|2861|2861| 						// let the ConstructionFinished handler handle this.
|2862|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2862|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2863|2863| 						return true;
|2864|2864| 					}
|2865|2865| 
|    | [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
|2859|2859| 					{
|2860|2860| 						// The building was already finished/fully repaired before we arrived;
|2861|2861| 						// let the ConstructionFinished handler handle this.
|2862|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2862|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2863|2863| 						return true;
|2864|2864| 					}
|2865|2865| 
|    | [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
|3154|3154| 				this.StopTimer();
|3155|3155| 				this.ResetAnimation();
|3156|3156| 				if (this.formationAnimationVariant)
|3157|    |-					this.SetAnimationVariant(this.formationAnimationVariant)
|    |3157|+					this.SetAnimationVariant(this.formationAnimationVariant);
|3158|3158| 				else
|3159|3159| 					this.SetDefaultAnimationVariant();
|3160|3160| 			},
|    | [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
|3387|3387| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3388|3388| 
|3389|3389| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3390|    |-							// only used for domestic animals
|    |3390|+		// only used for domestic animals
|3391|3391| 
|3392|3392| 		// Reuse the same garrison behaviour for animals.
|3393|3393| 		"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
|3449|3449| 
|3450|3450| UnitAI.prototype.IsAnimal = function()
|3451|3451| {
|3452|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3452|+	return (!!this.template.NaturalBehaviour);
|3453|3453| };
|3454|3454| 
|3455|3455| 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
|3565|3565| 		{
|3566|3566| 			let index = this.GetCurrentState().indexOf(".");
|3567|3567| 			if (index != -1)
|3568|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3568|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3569|3569| 			this.Stop(false);
|3570|3570| 		}
|3571|3571| 
|    | [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
|3621|3621| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3622|3622| 			continue;
|3623|3623| 		if (i == 0)
|3624|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3624|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3625|3625| 		else
|3626|3626| 			this.orderQueue.splice(i, 1);
|3627|3627| 		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
|3621|3621| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3622|3622| 			continue;
|3623|3623| 		if (i == 0)
|3624|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3624|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3625|3625| 		else
|3626|3626| 			this.orderQueue.splice(i, 1);
|3627|3627| 		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
|3708|3708| };
|3709|3709| 
|3710|3710| 
|3711|    |-//// FSM linkage functions ////
|    |3711|+// // FSM linkage functions ////
|3712|3712| 
|3713|3713| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3714|3714| 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
|3873|3873| 				continue;
|3874|3874| 			if (this.orderQueue[i].type == type)
|3875|3875| 				continue;
|3876|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3876|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3877|3877| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3878|3878| 			return;
|3879|3879| 		}
|    | [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
|3873|3873| 				continue;
|3874|3874| 			if (this.orderQueue[i].type == type)
|3875|3875| 				continue;
|3876|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3876|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3877|3877| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3878|3878| 			return;
|3879|3879| 		}
|    | [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
|4101|4101| 	if (data.timerRepeat === undefined)
|4102|4102| 		this.timer = undefined;
|4103|4103| 
|4104|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4104|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4105|4105| };
|4106|4106| 
|4107|4107| /**
|    | [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
|4101|4101| 	if (data.timerRepeat === undefined)
|4102|4102| 		this.timer = undefined;
|4103|4103| 
|4104|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4104|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4105|4105| };
|4106|4106| 
|4107|4107| /**
|    | [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
|4146|4146| 	// TODO: This is a bit inefficient since every unit listens to every
|4147|4147| 	// construction message - ideally we could scope it to only the one we're building
|4148|4148| 
|4149|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4149|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4150|4150| };
|4151|4151| 
|4152|4152| 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
|4146|4146| 	// TODO: This is a bit inefficient since every unit listens to every
|4147|4147| 	// construction message - ideally we could scope it to only the one we're building
|4148|4148| 
|4149|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4149|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4150|4150| };
|4151|4151| 
|4152|4152| 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
|4177|4177| 	if (msg.fromStatusEffect)
|4178|4178| 		return;
|4179|4179| 
|4180|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4180|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4181|4181| };
|4182|4182| 
|4183|4183| 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
|4177|4177| 	if (msg.fromStatusEffect)
|4178|4178| 		return;
|4179|4179| 
|4180|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4180|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4181|4181| };
|4182|4182| 
|4183|4183| 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
|4182|4182| 
|4183|4183| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4184|4184| {
|4185|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4185|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4186|4186| };
|4187|4187| 
|4188|4188| 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
|4182|4182| 
|4183|4183| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4184|4184| {
|4185|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4185|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4186|4186| };
|4187|4187| 
|4188|4188| 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
|4187|4187| 
|4188|4188| UnitAI.prototype.OnHealthChanged = function(msg)
|4189|4189| {
|4190|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4190|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4191|4191| };
|4192|4192| 
|4193|4193| 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
|4187|4187| 
|4188|4188| UnitAI.prototype.OnHealthChanged = function(msg)
|4189|4189| {
|4190|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4190|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4191|4191| };
|4192|4192| 
|4193|4193| 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
|4193|4193| UnitAI.prototype.OnRangeUpdate = function(msg)
|4194|4194| {
|4195|4195| 	if (msg.tag == this.losRangeQuery)
|4196|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4196|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4197|4197| 	else if (msg.tag == this.losHealRangeQuery)
|4198|4198| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4199|4199| };
|    | [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| UnitAI.prototype.OnRangeUpdate = function(msg)
|4194|4194| {
|4195|4195| 	if (msg.tag == this.losRangeQuery)
|4196|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4196|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4197|4197| 	else if (msg.tag == this.losHealRangeQuery)
|4198|4198| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4199|4199| };
|    | [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| 	if (msg.tag == this.losRangeQuery)
|4196|4196| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4197|4197| 	else if (msg.tag == this.losHealRangeQuery)
|4198|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4198|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4199|4199| };
|4200|4200| 
|4201|4201| 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
|4195|4195| 	if (msg.tag == this.losRangeQuery)
|4196|4196| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4197|4197| 	else if (msg.tag == this.losHealRangeQuery)
|4198|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4198|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4199|4199| };
|4200|4200| 
|4201|4201| 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
|4200|4200| 
|4201|4201| UnitAI.prototype.OnPackFinished = function(msg)
|4202|4202| {
|4203|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4203|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4204|4204| };
|4205|4205| 
|4206|4206| //// 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
|4200|4200| 
|4201|4201| UnitAI.prototype.OnPackFinished = function(msg)
|4202|4202| {
|4203|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4203|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4204|4204| };
|4205|4205| 
|4206|4206| //// 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
|4203|4203| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4204|4204| };
|4205|4205| 
|4206|    |-//// Helper functions to be called by the FSM ////
|    |4206|+// // Helper functions to be called by the FSM ////
|4207|4207| 
|4208|4208| UnitAI.prototype.GetWalkSpeed = function()
|4209|4209| {
|    | [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
|4915|4915| UnitAI.prototype.AttackEntityInZone = function(ents)
|4916|4916| {
|4917|4917| 	var target = ents.find(target =>
|4918|    |-		this.CanAttack(target)
|4919|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4918|+		this.CanAttack(target) &&
|    |4919|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4920|4920| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4921|4921| 	);
|4922|4922| 	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
|4916|4916| {
|4917|4917| 	var target = ents.find(target =>
|4918|4918| 		this.CanAttack(target)
|4919|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4920|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4919|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4920|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4921|4921| 	);
|4922|4922| 	if (!target)
|4923|4923| 		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
|4980|4980| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4981|4981| 	if (this.isGuardOf)
|4982|4982| 	{
|4983|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4983|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4984|4984| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4985|4985| 		if (cmpUnitAI && cmpAttack &&
|4986|4986| 		    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
|4984|4984| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4985|4985| 		if (cmpUnitAI && cmpAttack &&
|4986|4986| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4987|    |-				return false;
|    |4987|+			return false;
|4988|4988| 	}
|4989|4989| 
|4990|4990| 	// 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
|5022|5022| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|5023|5023| 	if (this.isGuardOf)
|5024|5024| 	{
|5025|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |5025|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|5026|5026| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|5027|5027| 		if (cmpUnitAI && cmpAttack &&
|5028|5028| 		    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
|5035|5035| 	return false;
|5036|5036| };
|5037|5037| 
|5038|    |-//// External interface functions ////
|    |5038|+// // External interface functions ////
|5039|5039| 
|5040|5040| UnitAI.prototype.SetFormationController = function(ent)
|5041|5041| {
|    | [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
|5191|5191| 	{
|5192|5192| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5193|5193| 			return;
|5194|    |-		else
|5195|    |-			this.RemoveGuard();
|    |5194|+		this.RemoveGuard();
|5196|5195| 	}
|5197|5196| 
|5198|5197| 	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
|5522|5522| 
|5523|5523| 	if (this.IsFormationController())
|5524|5524| 		this.CallMemberFunction("CancelSetupTradeRoute", [target]);
|5525|    |-}
|    |5525|+};
|5526|5526| /**
|5527|5527|  * Adds trade order to the queue. Either walk to the first market, or
|5528|5528|  * 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
|5543|5543| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5544|5544| 	{
|5545|5545| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5546|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5546|+		if (cmpTrader.HasBothMarkets() &&
|5547|5547| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5548|5548| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5549|5549| 		{
|    | [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
|5821|5821| 				{
|5822|5822| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5823|5823| 					var targetClasses = this.order.data.targetClasses;
|5824|    |-					if (targetClasses.attack && cmpIdentity
|5825|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5824|+					if (targetClasses.attack && cmpIdentity &&
|    |5825|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5826|5826| 						continue;
|5827|5827| 					if (targetClasses.avoid && cmpIdentity
|5828|5828| 						&& 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
|5824|5824| 					if (targetClasses.attack && cmpIdentity
|5825|5825| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5826|5826| 						continue;
|5827|    |-					if (targetClasses.avoid && cmpIdentity
|5828|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5827|+					if (targetClasses.avoid && cmpIdentity &&
|    |5828|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5829|5829| 						continue;
|5830|5830| 					// Only used by the AIs to prevent some choices of targets
|5831|5831| 					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
|5847|5847| 		{
|5848|5848| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5849|5849| 			var targetClasses = this.order.data.targetClasses;
|5850|    |-			if (cmpIdentity && targetClasses.attack
|5851|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5850|+			if (cmpIdentity && targetClasses.attack &&
|    |5851|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5852|5852| 				continue;
|5853|5853| 			if (cmpIdentity && targetClasses.avoid
|5854|5854| 				&& 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
|5850|5850| 			if (cmpIdentity && targetClasses.attack
|5851|5851| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5852|5852| 				continue;
|5853|    |-			if (cmpIdentity && targetClasses.avoid
|5854|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5853|+			if (cmpIdentity && targetClasses.avoid &&
|    |5854|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5855|5855| 				continue;
|5856|5856| 			// Only used by the AIs to prevent some choices of targets
|5857|5857| 			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
|5993|5993| 
|5994|5994| UnitAI.prototype.SetHeldPosition = function(x, z)
|5995|5995| {
|5996|    |-	this.heldPosition = {"x": x, "z": z};
|    |5996|+	this.heldPosition = { "x": x, "z": z};
|5997|5997| };
|5998|5998| 
|5999|5999| 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
|5993|5993| 
|5994|5994| UnitAI.prototype.SetHeldPosition = function(x, z)
|5995|5995| {
|5996|    |-	this.heldPosition = {"x": x, "z": z};
|    |5996|+	this.heldPosition = {"x": x, "z": z };
|5997|5997| };
|5998|5998| 
|5999|5999| 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
|6020|6020| 	return false;
|6021|6021| };
|6022|6022| 
|6023|    |-//// Helper functions ////
|    |6023|+// // Helper functions ////
|6024|6024| 
|6025|6025| /**
|6026|6026|  * 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
|6039|6039| 		return undefined;
|6040|6040| 
|6041|6041| 	return component.GetRange(type);
|6042|    |-}
|    |6042|+};
|6043|6043| 
|6044|6044| UnitAI.prototype.CanAttack = function(target)
|6045|6045| {
|    | [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
|6237|6237| 	return cmpPack && cmpPack.IsPacking();
|6238|6238| };
|6239|6239| 
|6240|    |-//// Formation specific functions ////
|    |6240|+// // Formation specific functions ////
|6241|6241| 
|6242|6242| UnitAI.prototype.IsAttackingAsFormation = function()
|6243|6243| {
|    | [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
|6242|6242| UnitAI.prototype.IsAttackingAsFormation = function()
|6243|6243| {
|6244|6244| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6245|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6246|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6245|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6246|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6247|6247| };
|6248|6248| 
|6249|6249| //// 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
|6246|6246| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6247|6247| };
|6248|6248| 
|6249|    |-//// Animal specific functions ////
|    |6249|+// // Animal specific functions ////
|6250|6250| 
|6251|6251| UnitAI.prototype.MoveRandomly = function(distance)
|6252|6252| {

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4012| »   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
|4902| »   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
|4917| »   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
|4963| »   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
|4986| »   »   ····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
|6368| »   for·(let·i·=·0;·i·<·nearby.length;·++i)·{
|    | [NORMAL] ESLintBear (brace-rules/brace-on-same-line):
|    | Opening curly brace appears on the same line as controlling statement.

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

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

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

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

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

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

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

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

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

Freagarach added inline comments.Apr 15 2020, 9:22 AM
binaries/data/mods/public/simulation/components/UnitAI.js
1495

+\n

1991

Isn't it still false here?

6418

friendly

6424

Friendly != owned.
So either the function ought to be renamed or we should be able to specify which players may be asked to perform the function. (Allies cheering would be nice, IMHO.)

6425

\n

Angen planned changes to this revision.Apr 15 2020, 9:49 AM
goldie added a subscriber: goldie.Apr 16 2020, 1:09 PM

Silly question as I fully don't understand advantage of "cheering" feature in game. What would happen to remove it fully? Simply if units got ranked (promoted) no any extra "cheering" activity take just got rank, stats up and done.

That is indeed what this patch does. It removes cheering from promotion.

However, the cheering itself is cool so it is kept in another form, namely when a battle ends, units go cheer.

goldie accepted this revision.Apr 16 2020, 8:32 PM

Thanks for accepting the idea of this patch @goldie :)
However, accepting a patch goes beyond accepting the idea of a patch.
For future reference, when you want to accept a patch, please take the following in consideration:

  • Differentials with changes planned (such as this one) can, generally speaking, not be accepted.
  • Check the code for major improvements, especially whether there are any design improvements that can be done.
  • Run the test plan, try to think of any flaws in it and try to abuse the code in-game as much as you can (be creative).
  • Check the code again, can/will it break some other code?
  • Think of the implications of the patch. How will it affect the gameplay, will that be in a positive manner? (This is a tricky one and should often be well discussed with other people.) <- This is accepting the idea of a patch.

As you can see, accepting is quite an effort and you basically say: "I have reviewed this patch and take full responsibility for this code and its implications." (Obviously there are also the one who wrote the patch and the committer, who say exactly the same, but it's about the idea ;) )

Furthermore, when accepting, please state *why* you accepted the patch. Things like, but not limited to:

  • The steps you've done to test this (with a elaborate test plan one can reference to that).
  • Why you think the idea of this patch is good.
  • Have you checked the code for correctness.

If you, at some point in time, want to revoke you acceptance, you can resign as reviewer and remove yourself as a reviewer for this patch.

Instead of hardcoding that only idle units can cheer, would it be a thought to allow code-wise all units to cheer, but check in the CallFriendlyUnitsFunctionInRange whether the entity is idle?
(See #5248. Also in C&C RA2 one had a hotkey to let all units cheer (not sure whether it accounted for idleness).)

Angen added a comment.Apr 18 2020, 7:57 AM

That would be also hardcoding and it would also restrict function to be used only for idle entities.
If unit is going to ignore or execute order is up to that unit based on state it is in, so current handling of order is correct based on state.
If one decides in the future unit should cheer also in another states, one only adds cheer order override to given state instead another conditional if to the calling function.

And this is also code wise :)

You're right ^^

Angen updated this revision to Diff 11943.May 20 2020, 8:05 PM

rebase and rename function

Angen updated this revision to Diff 11944.May 20 2020, 8:09 PM

actually save file after renaming function

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
| 785| 785| 					this.FinishOrder();
| 786| 786| 					return;
| 787| 787| 				}
| 788|    |-				else
| 789|    |-				{
|    | 788|+				
| 790| 789| 					this.SetNextState("GARRISON.APPROACHING");
| 791| 790| 					return;
| 792|    |-				}
|    | 791|+				
| 793| 792| 			}
| 794| 793| 
| 795| 794| 			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
|2050|2050| 
|2051|2051| 				"Attacked": function(msg) {
|2052|2052| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2053|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2054|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2053|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2054|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2055|2055| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2056|2056| 				},
|2057|2057| 			},
|    | [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
|2215|2215| 					"MovementUpdate": function(msg) {
|2216|2216| 						// If it looks like the path is failing, and we are close enough (3 tiles) from wanted range
|2217|2217| 						// stop anyways. This avoids pathing for an unreachable goal and reduces lag considerably.
|2218|    |-						if (msg.likelyFailure || 
|    |2218|+						if (msg.likelyFailure ||
|2219|2219| 							msg.obstructed && this.RelaxedMaxRangeCheck(this.order.data, this.order.data.max + this.DefaultRelaxedMaxRange) ||
|2220|2220| 							!msg.obstructed && this.CheckRange(this.order.data))
|2221|2221| 							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
|2857|2857| 					{
|2858|2858| 						// The building was already finished/fully repaired before we arrived;
|2859|2859| 						// let the ConstructionFinished handler handle this.
|2860|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2860|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2861|2861| 						return true;
|2862|2862| 					}
|2863|2863| 
|    | [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
|2857|2857| 					{
|2858|2858| 						// The building was already finished/fully repaired before we arrived;
|2859|2859| 						// let the ConstructionFinished handler handle this.
|2860|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2860|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2861|2861| 						return true;
|2862|2862| 					}
|2863|2863| 
|    | [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
|3152|3152| 				this.StopTimer();
|3153|3153| 				this.ResetAnimation();
|3154|3154| 				if (this.formationAnimationVariant)
|3155|    |-					this.SetAnimationVariant(this.formationAnimationVariant)
|    |3155|+					this.SetAnimationVariant(this.formationAnimationVariant);
|3156|3156| 				else
|3157|3157| 					this.SetDefaultAnimationVariant();
|3158|3158| 			},
|    | [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
|3385|3385| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3386|3386| 
|3387|3387| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3388|    |-							// only used for domestic animals
|    |3388|+		// only used for domestic animals
|3389|3389| 
|3390|3390| 		// Reuse the same garrison behaviour for animals.
|3391|3391| 		"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
|3447|3447| 
|3448|3448| UnitAI.prototype.IsAnimal = function()
|3449|3449| {
|3450|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3450|+	return (!!this.template.NaturalBehaviour);
|3451|3451| };
|3452|3452| 
|3453|3453| 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
|3563|3563| 		{
|3564|3564| 			let index = this.GetCurrentState().indexOf(".");
|3565|3565| 			if (index != -1)
|3566|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3566|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3567|3567| 			this.Stop(false);
|3568|3568| 		}
|3569|3569| 
|    | [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
|3619|3619| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3620|3620| 			continue;
|3621|3621| 		if (i == 0)
|3622|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3622|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3623|3623| 		else
|3624|3624| 			this.orderQueue.splice(i, 1);
|3625|3625| 		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
|3619|3619| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3620|3620| 			continue;
|3621|3621| 		if (i == 0)
|3622|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3622|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3623|3623| 		else
|3624|3624| 			this.orderQueue.splice(i, 1);
|3625|3625| 		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
|3706|3706| };
|3707|3707| 
|3708|3708| 
|3709|    |-//// FSM linkage functions ////
|    |3709|+// // FSM linkage functions ////
|3710|3710| 
|3711|3711| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3712|3712| 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
|3871|3871| 				continue;
|3872|3872| 			if (this.orderQueue[i].type == type)
|3873|3873| 				continue;
|3874|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3874|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3875|3875| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3876|3876| 			return;
|3877|3877| 		}
|    | [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
|3871|3871| 				continue;
|3872|3872| 			if (this.orderQueue[i].type == type)
|3873|3873| 				continue;
|3874|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3874|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3875|3875| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3876|3876| 			return;
|3877|3877| 		}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4099|4099| 	if (data.timerRepeat === undefined)
|4100|4100| 		this.timer = undefined;
|4101|4101| 
|4102|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4102|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4103|4103| };
|4104|4104| 
|4105|4105| /**
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4099|4099| 	if (data.timerRepeat === undefined)
|4100|4100| 		this.timer = undefined;
|4101|4101| 
|4102|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4102|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4103|4103| };
|4104|4104| 
|4105|4105| /**
|    | [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
|4144|4144| 	// TODO: This is a bit inefficient since every unit listens to every
|4145|4145| 	// construction message - ideally we could scope it to only the one we're building
|4146|4146| 
|4147|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4147|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4148|4148| };
|4149|4149| 
|4150|4150| 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
|4144|4144| 	// TODO: This is a bit inefficient since every unit listens to every
|4145|4145| 	// construction message - ideally we could scope it to only the one we're building
|4146|4146| 
|4147|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4147|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4148|4148| };
|4149|4149| 
|4150|4150| 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
|4175|4175| 	if (msg.fromStatusEffect)
|4176|4176| 		return;
|4177|4177| 
|4178|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4178|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4179|4179| };
|4180|4180| 
|4181|4181| 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
|4175|4175| 	if (msg.fromStatusEffect)
|4176|4176| 		return;
|4177|4177| 
|4178|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4178|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4179|4179| };
|4180|4180| 
|4181|4181| 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
|4180|4180| 
|4181|4181| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4182|4182| {
|4183|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4183|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4184|4184| };
|4185|4185| 
|4186|4186| 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
|4180|4180| 
|4181|4181| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4182|4182| {
|4183|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4183|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4184|4184| };
|4185|4185| 
|4186|4186| 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
|4185|4185| 
|4186|4186| UnitAI.prototype.OnHealthChanged = function(msg)
|4187|4187| {
|4188|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4188|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4189|4189| };
|4190|4190| 
|4191|4191| 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
|4185|4185| 
|4186|4186| UnitAI.prototype.OnHealthChanged = function(msg)
|4187|4187| {
|4188|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4188|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4189|4189| };
|4190|4190| 
|4191|4191| 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
|4191|4191| UnitAI.prototype.OnRangeUpdate = function(msg)
|4192|4192| {
|4193|4193| 	if (msg.tag == this.losRangeQuery)
|4194|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4194|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4195|4195| 	else if (msg.tag == this.losHealRangeQuery)
|4196|4196| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4197|4197| };
|    | [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
|4191|4191| UnitAI.prototype.OnRangeUpdate = function(msg)
|4192|4192| {
|4193|4193| 	if (msg.tag == this.losRangeQuery)
|4194|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4194|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4195|4195| 	else if (msg.tag == this.losHealRangeQuery)
|4196|4196| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4197|4197| };
|    | [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| 	if (msg.tag == this.losRangeQuery)
|4194|4194| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4195|4195| 	else if (msg.tag == this.losHealRangeQuery)
|4196|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4196|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4197|4197| };
|4198|4198| 
|4199|4199| 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
|4193|4193| 	if (msg.tag == this.losRangeQuery)
|4194|4194| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4195|4195| 	else if (msg.tag == this.losHealRangeQuery)
|4196|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4196|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4197|4197| };
|4198|4198| 
|4199|4199| 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
|4198|4198| 
|4199|4199| UnitAI.prototype.OnPackFinished = function(msg)
|4200|4200| {
|4201|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4201|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4202|4202| };
|4203|4203| 
|4204|4204| //// 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
|4198|4198| 
|4199|4199| UnitAI.prototype.OnPackFinished = function(msg)
|4200|4200| {
|4201|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4201|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4202|4202| };
|4203|4203| 
|4204|4204| //// 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
|4201|4201| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4202|4202| };
|4203|4203| 
|4204|    |-//// Helper functions to be called by the FSM ////
|    |4204|+// // Helper functions to be called by the FSM ////
|4205|4205| 
|4206|4206| UnitAI.prototype.GetWalkSpeed = function()
|4207|4207| {
|    | [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
|4913|4913| UnitAI.prototype.AttackEntityInZone = function(ents)
|4914|4914| {
|4915|4915| 	var target = ents.find(target =>
|4916|    |-		this.CanAttack(target)
|4917|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4916|+		this.CanAttack(target) &&
|    |4917|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4918|4918| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4919|4919| 	);
|4920|4920| 	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
|4914|4914| {
|4915|4915| 	var target = ents.find(target =>
|4916|4916| 		this.CanAttack(target)
|4917|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4918|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4917|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4918|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4919|4919| 	);
|4920|4920| 	if (!target)
|4921|4921| 		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
|4980|4980| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4981|4981| 	if (this.isGuardOf)
|4982|4982| 	{
|4983|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4983|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4984|4984| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4985|4985| 		if (cmpUnitAI && cmpAttack &&
|4986|4986| 		    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
|4984|4984| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4985|4985| 		if (cmpUnitAI && cmpAttack &&
|4986|4986| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4987|    |-				return false;
|    |4987|+			return false;
|4988|4988| 	}
|4989|4989| 
|4990|4990| 	// 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
|5022|5022| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|5023|5023| 	if (this.isGuardOf)
|5024|5024| 	{
|5025|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |5025|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|5026|5026| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|5027|5027| 		if (cmpUnitAI && cmpAttack &&
|5028|5028| 		    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
|5035|5035| 	return false;
|5036|5036| };
|5037|5037| 
|5038|    |-//// External interface functions ////
|    |5038|+// // External interface functions ////
|5039|5039| 
|5040|5040| UnitAI.prototype.SetFormationController = function(ent)
|5041|5041| {
|    | [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
|5191|5191| 	{
|5192|5192| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5193|5193| 			return;
|5194|    |-		else
|5195|    |-			this.RemoveGuard();
|    |5194|+		this.RemoveGuard();
|5196|5195| 	}
|5197|5196| 
|5198|5197| 	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
|5522|5522| 
|5523|5523| 	if (this.IsFormationController())
|5524|5524| 		this.CallMemberFunction("CancelSetupTradeRoute", [target]);
|5525|    |-}
|    |5525|+};
|5526|5526| /**
|5527|5527|  * Adds trade order to the queue. Either walk to the first market, or
|5528|5528|  * 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
|5543|5543| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5544|5544| 	{
|5545|5545| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5546|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5546|+		if (cmpTrader.HasBothMarkets() &&
|5547|5547| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5548|5548| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5549|5549| 		{
|    | [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
|5821|5821| 				{
|5822|5822| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5823|5823| 					var targetClasses = this.order.data.targetClasses;
|5824|    |-					if (targetClasses.attack && cmpIdentity
|5825|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5824|+					if (targetClasses.attack && cmpIdentity &&
|    |5825|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5826|5826| 						continue;
|5827|5827| 					if (targetClasses.avoid && cmpIdentity
|5828|5828| 						&& 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
|5824|5824| 					if (targetClasses.attack && cmpIdentity
|5825|5825| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5826|5826| 						continue;
|5827|    |-					if (targetClasses.avoid && cmpIdentity
|5828|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5827|+					if (targetClasses.avoid && cmpIdentity &&
|    |5828|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5829|5829| 						continue;
|5830|5830| 					// Only used by the AIs to prevent some choices of targets
|5831|5831| 					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
|5847|5847| 		{
|5848|5848| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5849|5849| 			var targetClasses = this.order.data.targetClasses;
|5850|    |-			if (cmpIdentity && targetClasses.attack
|5851|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5850|+			if (cmpIdentity && targetClasses.attack &&
|    |5851|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5852|5852| 				continue;
|5853|5853| 			if (cmpIdentity && targetClasses.avoid
|5854|5854| 				&& 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
|5850|5850| 			if (cmpIdentity && targetClasses.attack
|5851|5851| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5852|5852| 				continue;
|5853|    |-			if (cmpIdentity && targetClasses.avoid
|5854|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5853|+			if (cmpIdentity && targetClasses.avoid &&
|    |5854|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5855|5855| 				continue;
|5856|5856| 			// Only used by the AIs to prevent some choices of targets
|5857|5857| 			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
|5993|5993| 
|5994|5994| UnitAI.prototype.SetHeldPosition = function(x, z)
|5995|5995| {
|5996|    |-	this.heldPosition = {"x": x, "z": z};
|    |5996|+	this.heldPosition = { "x": x, "z": z};
|5997|5997| };
|5998|5998| 
|5999|5999| 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
|5993|5993| 
|5994|5994| UnitAI.prototype.SetHeldPosition = function(x, z)
|5995|5995| {
|5996|    |-	this.heldPosition = {"x": x, "z": z};
|    |5996|+	this.heldPosition = {"x": x, "z": z };
|5997|5997| };
|5998|5998| 
|5999|5999| 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
|6020|6020| 	return false;
|6021|6021| };
|6022|6022| 
|6023|    |-//// Helper functions ////
|    |6023|+// // Helper functions ////
|6024|6024| 
|6025|6025| /**
|6026|6026|  * 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
|6039|6039| 		return undefined;
|6040|6040| 
|6041|6041| 	return component.GetRange(type);
|6042|    |-}
|    |6042|+};
|6043|6043| 
|6044|6044| UnitAI.prototype.CanAttack = function(target)
|6045|6045| {
|    | [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
|6207|6207| 	return cmpPack && cmpPack.IsPacking();
|6208|6208| };
|6209|6209| 
|6210|    |-//// Formation specific functions ////
|    |6210|+// // Formation specific functions ////
|6211|6211| 
|6212|6212| UnitAI.prototype.IsAttackingAsFormation = function()
|6213|6213| {
|    | [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
|6212|6212| UnitAI.prototype.IsAttackingAsFormation = function()
|6213|6213| {
|6214|6214| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6215|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6216|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6215|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6216|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6217|6217| };
|6218|6218| 
|6219|6219| //// 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
|6216|6216| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6217|6217| };
|6218|6218| 
|6219|    |-//// Animal specific functions ////
|    |6219|+// // Animal specific functions ////
|6220|6220| 
|6221|6221| UnitAI.prototype.MoveRandomly = function(distance)
|6222|6222| {

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4010| »   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
|4900| »   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
|4915| »   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
|4963| »   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
|4986| »   »   ····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
|6338| »   for·(let·i·=·0;·i·<·nearby.length;·++i)·{
|    | [NORMAL] ESLintBear (brace-rules/brace-on-same-line):
|    | Opening curly brace appears on the same line as controlling statement.

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

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|6216| »   »   &&·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/2174/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
| 785| 785| 					this.FinishOrder();
| 786| 786| 					return;
| 787| 787| 				}
| 788|    |-				else
| 789|    |-				{
|    | 788|+				
| 790| 789| 					this.SetNextState("GARRISON.APPROACHING");
| 791| 790| 					return;
| 792|    |-				}
|    | 791|+				
| 793| 792| 			}
| 794| 793| 
| 795| 794| 			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
|2050|2050| 
|2051|2051| 				"Attacked": function(msg) {
|2052|2052| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2053|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2054|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2053|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2054|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2055|2055| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2056|2056| 				},
|2057|2057| 			},
|    | [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
|2215|2215| 					"MovementUpdate": function(msg) {
|2216|2216| 						// If it looks like the path is failing, and we are close enough (3 tiles) from wanted range
|2217|2217| 						// stop anyways. This avoids pathing for an unreachable goal and reduces lag considerably.
|2218|    |-						if (msg.likelyFailure || 
|    |2218|+						if (msg.likelyFailure ||
|2219|2219| 							msg.obstructed && this.RelaxedMaxRangeCheck(this.order.data, this.order.data.max + this.DefaultRelaxedMaxRange) ||
|2220|2220| 							!msg.obstructed && this.CheckRange(this.order.data))
|2221|2221| 							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
|2857|2857| 					{
|2858|2858| 						// The building was already finished/fully repaired before we arrived;
|2859|2859| 						// let the ConstructionFinished handler handle this.
|2860|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2860|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2861|2861| 						return true;
|2862|2862| 					}
|2863|2863| 
|    | [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
|2857|2857| 					{
|2858|2858| 						// The building was already finished/fully repaired before we arrived;
|2859|2859| 						// let the ConstructionFinished handler handle this.
|2860|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2860|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2861|2861| 						return true;
|2862|2862| 					}
|2863|2863| 
|    | [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
|3152|3152| 				this.StopTimer();
|3153|3153| 				this.ResetAnimation();
|3154|3154| 				if (this.formationAnimationVariant)
|3155|    |-					this.SetAnimationVariant(this.formationAnimationVariant)
|    |3155|+					this.SetAnimationVariant(this.formationAnimationVariant);
|3156|3156| 				else
|3157|3157| 					this.SetDefaultAnimationVariant();
|3158|3158| 			},
|    | [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
|3385|3385| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3386|3386| 
|3387|3387| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3388|    |-							// only used for domestic animals
|    |3388|+		// only used for domestic animals
|3389|3389| 
|3390|3390| 		// Reuse the same garrison behaviour for animals.
|3391|3391| 		"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
|3447|3447| 
|3448|3448| UnitAI.prototype.IsAnimal = function()
|3449|3449| {
|3450|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3450|+	return (!!this.template.NaturalBehaviour);
|3451|3451| };
|3452|3452| 
|3453|3453| 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
|3563|3563| 		{
|3564|3564| 			let index = this.GetCurrentState().indexOf(".");
|3565|3565| 			if (index != -1)
|3566|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3566|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3567|3567| 			this.Stop(false);
|3568|3568| 		}
|3569|3569| 
|    | [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
|3619|3619| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3620|3620| 			continue;
|3621|3621| 		if (i == 0)
|3622|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3622|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3623|3623| 		else
|3624|3624| 			this.orderQueue.splice(i, 1);
|3625|3625| 		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
|3619|3619| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3620|3620| 			continue;
|3621|3621| 		if (i == 0)
|3622|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3622|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3623|3623| 		else
|3624|3624| 			this.orderQueue.splice(i, 1);
|3625|3625| 		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
|3706|3706| };
|3707|3707| 
|3708|3708| 
|3709|    |-//// FSM linkage functions ////
|    |3709|+// // FSM linkage functions ////
|3710|3710| 
|3711|3711| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3712|3712| 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
|3871|3871| 				continue;
|3872|3872| 			if (this.orderQueue[i].type == type)
|3873|3873| 				continue;
|3874|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3874|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3875|3875| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3876|3876| 			return;
|3877|3877| 		}
|    | [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
|3871|3871| 				continue;
|3872|3872| 			if (this.orderQueue[i].type == type)
|3873|3873| 				continue;
|3874|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3874|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3875|3875| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3876|3876| 			return;
|3877|3877| 		}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4099|4099| 	if (data.timerRepeat === undefined)
|4100|4100| 		this.timer = undefined;
|4101|4101| 
|4102|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4102|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4103|4103| };
|4104|4104| 
|4105|4105| /**
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4099|4099| 	if (data.timerRepeat === undefined)
|4100|4100| 		this.timer = undefined;
|4101|4101| 
|4102|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4102|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4103|4103| };
|4104|4104| 
|4105|4105| /**
|    | [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
|4144|4144| 	// TODO: This is a bit inefficient since every unit listens to every
|4145|4145| 	// construction message - ideally we could scope it to only the one we're building
|4146|4146| 
|4147|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4147|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4148|4148| };
|4149|4149| 
|4150|4150| 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
|4144|4144| 	// TODO: This is a bit inefficient since every unit listens to every
|4145|4145| 	// construction message - ideally we could scope it to only the one we're building
|4146|4146| 
|4147|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4147|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4148|4148| };
|4149|4149| 
|4150|4150| 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
|4175|4175| 	if (msg.fromStatusEffect)
|4176|4176| 		return;
|4177|4177| 
|4178|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4178|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4179|4179| };
|4180|4180| 
|4181|4181| 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
|4175|4175| 	if (msg.fromStatusEffect)
|4176|4176| 		return;
|4177|4177| 
|4178|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4178|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4179|4179| };
|4180|4180| 
|4181|4181| 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
|4180|4180| 
|4181|4181| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4182|4182| {
|4183|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4183|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4184|4184| };
|4185|4185| 
|4186|4186| 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
|4180|4180| 
|4181|4181| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4182|4182| {
|4183|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4183|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4184|4184| };
|4185|4185| 
|4186|4186| 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
|4185|4185| 
|4186|4186| UnitAI.prototype.OnHealthChanged = function(msg)
|4187|4187| {
|4188|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4188|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4189|4189| };
|4190|4190| 
|4191|4191| 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
|4185|4185| 
|4186|4186| UnitAI.prototype.OnHealthChanged = function(msg)
|4187|4187| {
|4188|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4188|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4189|4189| };
|4190|4190| 
|4191|4191| 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
|4191|4191| UnitAI.prototype.OnRangeUpdate = function(msg)
|4192|4192| {
|4193|4193| 	if (msg.tag == this.losRangeQuery)
|4194|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4194|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4195|4195| 	else if (msg.tag == this.losHealRangeQuery)
|4196|4196| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4197|4197| };
|    | [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
|4191|4191| UnitAI.prototype.OnRangeUpdate = function(msg)
|4192|4192| {
|4193|4193| 	if (msg.tag == this.losRangeQuery)
|4194|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4194|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4195|4195| 	else if (msg.tag == this.losHealRangeQuery)
|4196|4196| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4197|4197| };
|    | [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| 	if (msg.tag == this.losRangeQuery)
|4194|4194| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4195|4195| 	else if (msg.tag == this.losHealRangeQuery)
|4196|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4196|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4197|4197| };
|4198|4198| 
|4199|4199| 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
|4193|4193| 	if (msg.tag == this.losRangeQuery)
|4194|4194| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4195|4195| 	else if (msg.tag == this.losHealRangeQuery)
|4196|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4196|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4197|4197| };
|4198|4198| 
|4199|4199| 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
|4198|4198| 
|4199|4199| UnitAI.prototype.OnPackFinished = function(msg)
|4200|4200| {
|4201|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4201|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4202|4202| };
|4203|4203| 
|4204|4204| //// 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
|4198|4198| 
|4199|4199| UnitAI.prototype.OnPackFinished = function(msg)
|4200|4200| {
|4201|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4201|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4202|4202| };
|4203|4203| 
|4204|4204| //// 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
|4201|4201| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4202|4202| };
|4203|4203| 
|4204|    |-//// Helper functions to be called by the FSM ////
|    |4204|+// // Helper functions to be called by the FSM ////
|4205|4205| 
|4206|4206| UnitAI.prototype.GetWalkSpeed = function()
|4207|4207| {
|    | [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
|4913|4913| UnitAI.prototype.AttackEntityInZone = function(ents)
|4914|4914| {
|4915|4915| 	var target = ents.find(target =>
|4916|    |-		this.CanAttack(target)
|4917|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4916|+		this.CanAttack(target) &&
|    |4917|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4918|4918| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4919|4919| 	);
|4920|4920| 	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
|4914|4914| {
|4915|4915| 	var target = ents.find(target =>
|4916|4916| 		this.CanAttack(target)
|4917|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4918|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4917|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4918|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4919|4919| 	);
|4920|4920| 	if (!target)
|4921|4921| 		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
|4980|4980| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4981|4981| 	if (this.isGuardOf)
|4982|4982| 	{
|4983|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4983|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4984|4984| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4985|4985| 		if (cmpUnitAI && cmpAttack &&
|4986|4986| 		    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
|4984|4984| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4985|4985| 		if (cmpUnitAI && cmpAttack &&
|4986|4986| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4987|    |-				return false;
|    |4987|+			return false;
|4988|4988| 	}
|4989|4989| 
|4990|4990| 	// 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
|5022|5022| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|5023|5023| 	if (this.isGuardOf)
|5024|5024| 	{
|5025|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |5025|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|5026|5026| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|5027|5027| 		if (cmpUnitAI && cmpAttack &&
|5028|5028| 		    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
|5035|5035| 	return false;
|5036|5036| };
|5037|5037| 
|5038|    |-//// External interface functions ////
|    |5038|+// // External interface functions ////
|5039|5039| 
|5040|5040| UnitAI.prototype.SetFormationController = function(ent)
|5041|5041| {
|    | [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
|5191|5191| 	{
|5192|5192| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5193|5193| 			return;
|5194|    |-		else
|5195|    |-			this.RemoveGuard();
|    |5194|+		this.RemoveGuard();
|5196|5195| 	}
|5197|5196| 
|5198|5197| 	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
|5522|5522| 
|5523|5523| 	if (this.IsFormationController())
|5524|5524| 		this.CallMemberFunction("CancelSetupTradeRoute", [target]);
|5525|    |-}
|    |5525|+};
|5526|5526| /**
|5527|5527|  * Adds trade order to the queue. Either walk to the first market, or
|5528|5528|  * 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
|5543|5543| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5544|5544| 	{
|5545|5545| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5546|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5546|+		if (cmpTrader.HasBothMarkets() &&
|5547|5547| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5548|5548| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5549|5549| 		{
|    | [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
|5821|5821| 				{
|5822|5822| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5823|5823| 					var targetClasses = this.order.data.targetClasses;
|5824|    |-					if (targetClasses.attack && cmpIdentity
|5825|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5824|+					if (targetClasses.attack && cmpIdentity &&
|    |5825|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5826|5826| 						continue;
|5827|5827| 					if (targetClasses.avoid && cmpIdentity
|5828|5828| 						&& 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
|5824|5824| 					if (targetClasses.attack && cmpIdentity
|5825|5825| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5826|5826| 						continue;
|5827|    |-					if (targetClasses.avoid && cmpIdentity
|5828|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5827|+					if (targetClasses.avoid && cmpIdentity &&
|    |5828|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5829|5829| 						continue;
|5830|5830| 					// Only used by the AIs to prevent some choices of targets
|5831|5831| 					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
|5847|5847| 		{
|5848|5848| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5849|5849| 			var targetClasses = this.order.data.targetClasses;
|5850|    |-			if (cmpIdentity && targetClasses.attack
|5851|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5850|+			if (cmpIdentity && targetClasses.attack &&
|    |5851|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5852|5852| 				continue;
|5853|5853| 			if (cmpIdentity && targetClasses.avoid
|5854|5854| 				&& 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
|5850|5850| 			if (cmpIdentity && targetClasses.attack
|5851|5851| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5852|5852| 				continue;
|5853|    |-			if (cmpIdentity && targetClasses.avoid
|5854|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5853|+			if (cmpIdentity && targetClasses.avoid &&
|    |5854|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5855|5855| 				continue;
|5856|5856| 			// Only used by the AIs to prevent some choices of targets
|5857|5857| 			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
|5993|5993| 
|5994|5994| UnitAI.prototype.SetHeldPosition = function(x, z)
|5995|5995| {
|5996|    |-	this.heldPosition = {"x": x, "z": z};
|    |5996|+	this.heldPosition = { "x": x, "z": z};
|5997|5997| };
|5998|5998| 
|5999|5999| 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
|5993|5993| 
|5994|5994| UnitAI.prototype.SetHeldPosition = function(x, z)
|5995|5995| {
|5996|    |-	this.heldPosition = {"x": x, "z": z};
|    |5996|+	this.heldPosition = {"x": x, "z": z };
|5997|5997| };
|5998|5998| 
|5999|5999| 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
|6020|6020| 	return false;
|6021|6021| };
|6022|6022| 
|6023|    |-//// Helper functions ////
|    |6023|+// // Helper functions ////
|6024|6024| 
|6025|6025| /**
|6026|6026|  * 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
|6039|6039| 		return undefined;
|6040|6040| 
|6041|6041| 	return component.GetRange(type);
|6042|    |-}
|    |6042|+};
|6043|6043| 
|6044|6044| UnitAI.prototype.CanAttack = function(target)
|6045|6045| {
|    | [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
|6207|6207| 	return cmpPack && cmpPack.IsPacking();
|6208|6208| };
|6209|6209| 
|6210|    |-//// Formation specific functions ////
|    |6210|+// // Formation specific functions ////
|6211|6211| 
|6212|6212| UnitAI.prototype.IsAttackingAsFormation = function()
|6213|6213| {
|    | [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
|6212|6212| UnitAI.prototype.IsAttackingAsFormation = function()
|6213|6213| {
|6214|6214| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6215|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6216|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6215|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6216|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6217|6217| };
|6218|6218| 
|6219|6219| //// 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
|6216|6216| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6217|6217| };
|6218|6218| 
|6219|    |-//// Animal specific functions ////
|    |6219|+// // Animal specific functions ////
|6220|6220| 
|6221|6221| UnitAI.prototype.MoveRandomly = function(distance)
|6222|6222| {

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4010| »   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
|4900| »   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
|4915| »   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
|4963| »   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
|4986| »   »   ····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
|6338| »   for·(let·i·=·0;·i·<·nearby.length;·++i)·{
|    | [NORMAL] ESLintBear (brace-rules/brace-on-same-line):
|    | Opening curly brace appears on the same line as controlling statement.

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

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

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

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

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

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

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

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

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

Entities in a 1 vs. 1 won't cheer, because they're not in the IDLE state when the order to cheer is issued, thus discarding that order.

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

(This is probably because of hunting? But just to mention it: we won't cheer after killing a lion as well.)

3972

P -> p and the dot.

6425

^

Angen updated this revision to Diff 11999.May 23 2020, 3:56 PM

fix one unit would not cheer as it stays in FINDINGNEWTARGET when receives Cheer order.

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

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/806/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
| 785| 785| 					this.FinishOrder();
| 786| 786| 					return;
| 787| 787| 				}
| 788|    |-				else
| 789|    |-				{
|    | 788|+				
| 790| 789| 					this.SetNextState("GARRISON.APPROACHING");
| 791| 790| 					return;
| 792|    |-				}
|    | 791|+				
| 793| 792| 			}
| 794| 793| 
| 795| 794| 			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
|2041|2041| 
|2042|2042| 				"Attacked": function(msg) {
|2043|2043| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2044|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2045|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2044|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2045|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2046|2046| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2047|2047| 				},
|2048|2048| 			},
|    | [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
|2209|2209| 					"MovementUpdate": function(msg) {
|2210|2210| 						// If it looks like the path is failing, and we are close enough (3 tiles) from wanted range
|2211|2211| 						// stop anyways. This avoids pathing for an unreachable goal and reduces lag considerably.
|2212|    |-						if (msg.likelyFailure || 
|    |2212|+						if (msg.likelyFailure ||
|2213|2213| 							msg.obstructed && this.RelaxedMaxRangeCheck(this.order.data, this.order.data.max + this.DefaultRelaxedMaxRange) ||
|2214|2214| 							!msg.obstructed && this.CheckRange(this.order.data))
|2215|2215| 							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
|2851|2851| 					{
|2852|2852| 						// The building was already finished/fully repaired before we arrived;
|2853|2853| 						// let the ConstructionFinished handler handle this.
|2854|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2854|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2855|2855| 						return true;
|2856|2856| 					}
|2857|2857| 
|    | [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
|2851|2851| 					{
|2852|2852| 						// The building was already finished/fully repaired before we arrived;
|2853|2853| 						// let the ConstructionFinished handler handle this.
|2854|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2854|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2855|2855| 						return true;
|2856|2856| 					}
|2857|2857| 
|    | [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
|3375|3375| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3376|3376| 
|3377|3377| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3378|    |-							// only used for domestic animals
|    |3378|+		// only used for domestic animals
|3379|3379| 
|3380|3380| 		// Reuse the same garrison behaviour for animals.
|3381|3381| 		"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
|3437|3437| 
|3438|3438| UnitAI.prototype.IsAnimal = function()
|3439|3439| {
|3440|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3440|+	return (!!this.template.NaturalBehaviour);
|3441|3441| };
|3442|3442| 
|3443|3443| 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
|3553|3553| 		{
|3554|3554| 			let index = this.GetCurrentState().indexOf(".");
|3555|3555| 			if (index != -1)
|3556|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3556|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3557|3557| 			this.Stop(false);
|3558|3558| 		}
|3559|3559| 
|    | [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
|3609|3609| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3610|3610| 			continue;
|3611|3611| 		if (i == 0)
|3612|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3612|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3613|3613| 		else
|3614|3614| 			this.orderQueue.splice(i, 1);
|3615|3615| 		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
|3609|3609| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3610|3610| 			continue;
|3611|3611| 		if (i == 0)
|3612|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3612|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3613|3613| 		else
|3614|3614| 			this.orderQueue.splice(i, 1);
|3615|3615| 		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
|3696|3696| };
|3697|3697| 
|3698|3698| 
|3699|    |-//// FSM linkage functions ////
|    |3699|+// // FSM linkage functions ////
|3700|3700| 
|3701|3701| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3702|3702| 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
|3861|3861| 				continue;
|3862|3862| 			if (this.orderQueue[i].type == type)
|3863|3863| 				continue;
|3864|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3864|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3865|3865| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3866|3866| 			return;
|3867|3867| 		}
|    | [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
|3861|3861| 				continue;
|3862|3862| 			if (this.orderQueue[i].type == type)
|3863|3863| 				continue;
|3864|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3864|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3865|3865| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3866|3866| 			return;
|3867|3867| 		}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4089|4089| 	if (data.timerRepeat === undefined)
|4090|4090| 		this.timer = undefined;
|4091|4091| 
|4092|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4092|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4093|4093| };
|4094|4094| 
|4095|4095| /**
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4089|4089| 	if (data.timerRepeat === undefined)
|4090|4090| 		this.timer = undefined;
|4091|4091| 
|4092|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4092|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4093|4093| };
|4094|4094| 
|4095|4095| /**
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4134|4134| 	// TODO: This is a bit inefficient since every unit listens to every
|4135|4135| 	// construction message - ideally we could scope it to only the one we're building
|4136|4136| 
|4137|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4137|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4138|4138| };
|4139|4139| 
|4140|4140| 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
|4134|4134| 	// TODO: This is a bit inefficient since every unit listens to every
|4135|4135| 	// construction message - ideally we could scope it to only the one we're building
|4136|4136| 
|4137|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4137|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4138|4138| };
|4139|4139| 
|4140|4140| 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
|4165|4165| 	if (msg.fromStatusEffect)
|4166|4166| 		return;
|4167|4167| 
|4168|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4168|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4169|4169| };
|4170|4170| 
|4171|4171| 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
|4165|4165| 	if (msg.fromStatusEffect)
|4166|4166| 		return;
|4167|4167| 
|4168|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4168|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4169|4169| };
|4170|4170| 
|4171|4171| 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
|4170|4170| 
|4171|4171| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4172|4172| {
|4173|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4173|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4174|4174| };
|4175|4175| 
|4176|4176| 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
|4170|4170| 
|4171|4171| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4172|4172| {
|4173|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4173|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4174|4174| };
|4175|4175| 
|4176|4176| 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
|4175|4175| 
|4176|4176| UnitAI.prototype.OnHealthChanged = function(msg)
|4177|4177| {
|4178|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4178|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4179|4179| };
|4180|4180| 
|4181|4181| 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
|4175|4175| 
|4176|4176| UnitAI.prototype.OnHealthChanged = function(msg)
|4177|4177| {
|4178|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4178|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4179|4179| };
|4180|4180| 
|4181|4181| 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
|4181|4181| UnitAI.prototype.OnRangeUpdate = function(msg)
|4182|4182| {
|4183|4183| 	if (msg.tag == this.losRangeQuery)
|4184|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4184|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4185|4185| 	else if (msg.tag == this.losHealRangeQuery)
|4186|4186| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4187|4187| };
|    | [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
|4181|4181| UnitAI.prototype.OnRangeUpdate = function(msg)
|4182|4182| {
|4183|4183| 	if (msg.tag == this.losRangeQuery)
|4184|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4184|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4185|4185| 	else if (msg.tag == this.losHealRangeQuery)
|4186|4186| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4187|4187| };
|    | [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
|4183|4183| 	if (msg.tag == this.losRangeQuery)
|4184|4184| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4185|4185| 	else if (msg.tag == this.losHealRangeQuery)
|4186|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4186|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4187|4187| };
|4188|4188| 
|4189|4189| 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
|4183|4183| 	if (msg.tag == this.losRangeQuery)
|4184|4184| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4185|4185| 	else if (msg.tag == this.losHealRangeQuery)
|4186|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4186|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4187|4187| };
|4188|4188| 
|4189|4189| 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
|4188|4188| 
|4189|4189| UnitAI.prototype.OnPackFinished = function(msg)
|4190|4190| {
|4191|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4191|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4192|4192| };
|4193|4193| 
|4194|4194| //// 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
|4188|4188| 
|4189|4189| UnitAI.prototype.OnPackFinished = function(msg)
|4190|4190| {
|4191|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4191|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4192|4192| };
|4193|4193| 
|4194|4194| //// 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
|4191|4191| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4192|4192| };
|4193|4193| 
|4194|    |-//// Helper functions to be called by the FSM ////
|    |4194|+// // Helper functions to be called by the FSM ////
|4195|4195| 
|4196|4196| UnitAI.prototype.GetWalkSpeed = function()
|4197|4197| {
|    | [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| UnitAI.prototype.AttackEntityInZone = function(ents)
|4904|4904| {
|4905|4905| 	var target = ents.find(target =>
|4906|    |-		this.CanAttack(target)
|4907|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4906|+		this.CanAttack(target) &&
|    |4907|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4908|4908| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4909|4909| 	);
|4910|4910| 	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
|4904|4904| {
|4905|4905| 	var target = ents.find(target =>
|4906|4906| 		this.CanAttack(target)
|4907|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4908|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4907|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4908|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4909|4909| 	);
|4910|4910| 	if (!target)
|4911|4911| 		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
|4970|4970| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4971|4971| 	if (this.isGuardOf)
|4972|4972| 	{
|4973|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4973|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4974|4974| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4975|4975| 		if (cmpUnitAI && cmpAttack &&
|4976|4976| 		    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
|4974|4974| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4975|4975| 		if (cmpUnitAI && cmpAttack &&
|4976|4976| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4977|    |-				return false;
|    |4977|+			return false;
|4978|4978| 	}
|4979|4979| 
|4980|4980| 	// 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
|5012|5012| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|5013|5013| 	if (this.isGuardOf)
|5014|5014| 	{
|5015|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |5015|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|5016|5016| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|5017|5017| 		if (cmpUnitAI && cmpAttack &&
|5018|5018| 		    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
|5025|5025| 	return false;
|5026|5026| };
|5027|5027| 
|5028|    |-//// External interface functions ////
|    |5028|+// // External interface functions ////
|5029|5029| 
|5030|5030| UnitAI.prototype.SetFormationController = function(ent)
|5031|5031| {
|    | [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
|5181|5181| 	{
|5182|5182| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5183|5183| 			return;
|5184|    |-		else
|5185|    |-			this.RemoveGuard();
|    |5184|+		this.RemoveGuard();
|5186|5185| 	}
|5187|5186| 
|5188|5187| 	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
|5512|5512| 
|5513|5513| 	if (this.IsFormationController())
|5514|5514| 		this.CallMemberFunction("CancelSetupTradeRoute", [target]);
|5515|    |-}
|    |5515|+};
|5516|5516| /**
|5517|5517|  * Adds trade order to the queue. Either walk to the first market, or
|5518|5518|  * 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
|5533|5533| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5534|5534| 	{
|5535|5535| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5536|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5536|+		if (cmpTrader.HasBothMarkets() &&
|5537|5537| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5538|5538| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5539|5539| 		{
|    | [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
|5811|5811| 				{
|5812|5812| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5813|5813| 					var targetClasses = this.order.data.targetClasses;
|5814|    |-					if (targetClasses.attack && cmpIdentity
|5815|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5814|+					if (targetClasses.attack && cmpIdentity &&
|    |5815|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5816|5816| 						continue;
|5817|5817| 					if (targetClasses.avoid && cmpIdentity
|5818|5818| 						&& 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
|5814|5814| 					if (targetClasses.attack && cmpIdentity
|5815|5815| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5816|5816| 						continue;
|5817|    |-					if (targetClasses.avoid && cmpIdentity
|5818|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5817|+					if (targetClasses.avoid && cmpIdentity &&
|    |5818|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5819|5819| 						continue;
|5820|5820| 					// Only used by the AIs to prevent some choices of targets
|5821|5821| 					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
|5837|5837| 		{
|5838|5838| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5839|5839| 			var targetClasses = this.order.data.targetClasses;
|5840|    |-			if (cmpIdentity && targetClasses.attack
|5841|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5840|+			if (cmpIdentity && targetClasses.attack &&
|    |5841|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5842|5842| 				continue;
|5843|5843| 			if (cmpIdentity && targetClasses.avoid
|5844|5844| 				&& 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
|5840|5840| 			if (cmpIdentity && targetClasses.attack
|5841|5841| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5842|5842| 				continue;
|5843|    |-			if (cmpIdentity && targetClasses.avoid
|5844|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5843|+			if (cmpIdentity && targetClasses.avoid &&
|    |5844|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5845|5845| 				continue;
|5846|5846| 			// Only used by the AIs to prevent some choices of targets
|5847|5847| 			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
|6000|6000| 
|6001|6001| UnitAI.prototype.SetHeldPosition = function(x, z)
|6002|6002| {
|6003|    |-	this.heldPosition = {"x": x, "z": z};
|    |6003|+	this.heldPosition = { "x": x, "z": z};
|6004|6004| };
|6005|6005| 
|6006|6006| 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
|6000|6000| 
|6001|6001| UnitAI.prototype.SetHeldPosition = function(x, z)
|6002|6002| {
|6003|    |-	this.heldPosition = {"x": x, "z": z};
|    |6003|+	this.heldPosition = {"x": x, "z": z };
|6004|6004| };
|6005|6005| 
|6006|6006| 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
|6027|6027| 	return false;
|6028|6028| };
|6029|6029| 
|6030|    |-//// Helper functions ////
|    |6030|+// // Helper functions ////
|6031|6031| 
|6032|6032| /**
|6033|6033|  * 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
|6046|6046| 		return undefined;
|6047|6047| 
|6048|6048| 	return component.GetRange(type);
|6049|    |-}
|    |6049|+};
|6050|6050| 
|6051|6051| UnitAI.prototype.CanAttack = function(target)
|6052|6052| {
|    | [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
|6214|6214| 	return cmpPack && cmpPack.IsPacking();
|6215|6215| };
|6216|6216| 
|6217|    |-//// Formation specific functions ////
|    |6217|+// // Formation specific functions ////
|6218|6218| 
|6219|6219| UnitAI.prototype.IsAttackingAsFormation = function()
|6220|6220| {
|    | [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
|6219|6219| UnitAI.prototype.IsAttackingAsFormation = function()
|6220|6220| {
|6221|6221| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6222|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6223|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6222|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6223|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6224|6224| };
|6225|6225| 
|6226|6226| //// 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
|6223|6223| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6224|6224| };
|6225|6225| 
|6226|    |-//// Animal specific functions ////
|    |6226|+// // Animal specific functions ////
|6227|6227| 
|6228|6228| UnitAI.prototype.MoveRandomly = function(distance)
|6229|6229| {

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4000| »   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
|4890| »   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
|4905| »   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
|4953| »   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
|4976| »   »   ····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
|2045| »   »   »   »   »   »   &&·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
|4031| »   for·(var·i·=·0;·i·<·this.orderQueue.length;·++i)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

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

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

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

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

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

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

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

Angen added inline comments.May 23 2020, 4:05 PM
binaries/data/mods/public/simulation/components/UnitAI.js
1493

No order does that

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

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

Freagarach added inline comments.May 25 2020, 4:40 PM
binaries/data/mods/public/simulation/components/UnitAI.js
1994

Don't we want to cheer also whenever we've destroyed a structure?

2081

+\n.

2120

Perhaps make the magic 30 part of the prototype?

borg- accepted this revision.May 30 2020, 4:39 PM
borg- added a subscriber: borg-.

We need this for the next alpha. This is perhaps the most frustrating gameplay / balance problem. I can't help with the code, but I know that Angen does a good job. He made this patch for me on my mod (borg expansion pack) and has been running for almost a year without any bugs.

borg- added a comment.Jun 20 2020, 6:34 PM

Some new?? 💪🏻

Angen added a comment.Jun 22 2020, 3:50 PM

I actaully was thinking to make cheering as template option, if unit should cheer at all. E.g. ram, ship, animals ?
But then it should probably tell friendlies to cheer or not.

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

good question.
I do not have clear answer for that.
As structures are entities in los, they will cause units to not cheer, but cheering after capturing lonely house might not be wanted. What do you think ?

2120

Still would be magic, but maybe better

If we want anything not to cheer then we can disable/remove the animation, right? Monkeys celebrate, probably other animals do as well.

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

I think we'd want to. We can force orders anyway and queued orders also prevent cheering, so it won't disturb gameplay.

Angen added a comment.Jun 22 2020, 5:28 PM

I would not say. Being in cheering state and not playing cheering animation is bad as it appears to be idle and it is not.

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

another thought,
maybe it would be good to put that to identity component? cmpIdentity.cheerAfterDestroyed? so if one does not want units to cheer after killing basic soldier one would set that in citizensoldier template to false?

Ah, yes, such an sanity check would indeed be good. Too bad they would need to be in sync then (the presence of an animation and the check in UnitAI).

Another question: a cheering entity won't be seen as idle, is that what we want?

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

I would say just cheer always, even when killing an animal. Hunting won't be affected since there is an order afterwards. And I guess people will be generally delighted when coming out of combat state ;)
But it seems a bit strange to have in the attacked template that one may not cheer. E.g. if a support women kills some basic soldier, she would be thrilled, I guess. But for some hero women it's just daily work.

Stan added a subscriber: Stan.Jun 22 2020, 5:56 PM
Stan added inline comments.
binaries/data/mods/public/simulation/components/UnitAI.js
1994

What about having cheering classes? MatchClassList(happywhenhavingkilled, this.target.classes)

Freagarach added inline comments.Jun 22 2020, 6:32 PM
binaries/data/mods/public/simulation/components/UnitAI.js
1994

And no "happywhenhavingkilled" means not cheering (e.g. rams etc.).

Angen added inline comments.Jun 23 2020, 2:40 PM
binaries/data/mods/public/simulation/components/UnitAI.js
1994

What about having cheering classes?
MatchClassList(happywhenhavingkilled, this.target.classes)

Thought about that, but in my opinion that would add too big overhead compared to that we want to add just fancy animation.

Freagarach added inline comments.Jun 24 2020, 5:34 PM
binaries/data/mods/public/simulation/components/UnitAI.js
1493

Example: Unit calls finishOrder and enters this idle state, with enemy nearby. The rangeQuery won't be reset until the timer expires, but we can be put in cheering state when that order arrives at the same turn.

1994

So we can just cheer always and when user find it strange we can react on that?

Angen added inline comments.Sun, Jul 12, 12:24 PM
binaries/data/mods/public/simulation/components/UnitAI.js
1493

Description of idle says: If we entered the idle state we must have nothing better to do.
There is no command given by the player. If unit would be in combat before it would not end up here with attackable enemies around.
And I do not think this is an issue. Unit will react back when being attacked and it just does not initiate attack right away, but after ends up cheering. Setting that on if will have in result missed orders.

1994

not always, cheering after killing chickens/sheep/deer is weird enough already since non dangerous animals does not end up in range queries.

Freagarach added inline comments.Mon, Jul 13, 4:36 PM
binaries/data/mods/public/simulation/components/UnitAI.js
1493

Unit will react back when being attacked and it just does not initiate attack right away

Which would mean always having reveiced one blow before being able to strike back. That being said, missed cheers is also not nice indeed. We'll see how this unfolds.

1994

cmpUnitAI && (!cmpUnitAI.IsAnimal() || cmpUnitAI.IsDangerousAnimal());?

Angen updated this revision to Diff 12784.Sun, Jul 19, 2:32 PM
Angen retitled this revision from Cheer after no enemies in range left to Cheer after no enemy entities left in range.

rebase
cheer when killing dangerous animal
move 30 to prototype variable

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
| 793| 793| 					this.FinishOrder();
| 794| 794| 					return;
| 795| 795| 				}
| 796|    |-				else
| 797|    |-				{
|    | 796|+				
| 798| 797| 					this.SetNextState("GARRISON.APPROACHING");
| 799| 798| 					return;
| 800|    |-				}
|    | 799|+				
| 801| 800| 			}
| 802| 801| 
| 803| 802| 			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
|2069|2069| 
|2070|2070| 				"Attacked": function(msg) {
|2071|2071| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2072|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2073|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2072|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2073|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2074|2074| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2075|2075| 				},
|2076|2076| 			},
|    | [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
|2238|2238| 					"MovementUpdate": function(msg) {
|2239|2239| 						// If it looks like the path is failing, and we are close enough (3 tiles) from wanted range
|2240|2240| 						// stop anyways. This avoids pathing for an unreachable goal and reduces lag considerably.
|2241|    |-						if (msg.likelyFailure || 
|    |2241|+						if (msg.likelyFailure ||
|2242|2242| 							msg.obstructed && this.RelaxedMaxRangeCheck(this.order.data, this.order.data.max + this.DefaultRelaxedMaxRange) ||
|2243|2243| 							!msg.obstructed && this.CheckRange(this.order.data))
|2244|2244| 							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
|2541|2541| 
|2542|2542| 								return type.specific == resourceType.specific &&
|2543|2543| 								    (type.specific != "meat" || resourceTemplate == template);
|2544|    |-						});
|    |2544|+							});
|2545|2545| 
|2546|2546| 						if (nearbyResource)
|2547|2547| 						{
|    | [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
|2873|2873| 					{
|2874|2874| 						// The building was already finished/fully repaired before we arrived;
|2875|2875| 						// let the ConstructionFinished handler handle this.
|2876|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2876|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2877|2877| 						return true;
|2878|2878| 					}
|2879|2879| 
|    | [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
|2873|2873| 					{
|2874|2874| 						// The building was already finished/fully repaired before we arrived;
|2875|2875| 						// let the ConstructionFinished handler handle this.
|2876|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2876|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2877|2877| 						return true;
|2878|2878| 					}
|2879|2879| 
|    | [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
|3389|3389| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3390|3390| 
|3391|3391| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3392|    |-							// only used for domestic animals
|    |3392|+		// only used for domestic animals
|3393|3393| 
|3394|3394| 		// Reuse the same garrison behaviour for animals.
|3395|3395| 		"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
|3441|3441| 
|3442|3442| UnitAI.prototype.IsAnimal = function()
|3443|3443| {
|3444|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3444|+	return (!!this.template.NaturalBehaviour);
|3445|3445| };
|3446|3446| 
|3447|3447| 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
|3581|3581| 		{
|3582|3582| 			let index = this.GetCurrentState().indexOf(".");
|3583|3583| 			if (index != -1)
|3584|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3584|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3585|3585| 			this.Stop(false);
|3586|3586| 		}
|3587|3587| 
|    | [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
|3637|3637| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3638|3638| 			continue;
|3639|3639| 		if (i == 0)
|3640|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3640|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3641|3641| 		else
|3642|3642| 			this.orderQueue.splice(i, 1);
|3643|3643| 		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
|3637|3637| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3638|3638| 			continue;
|3639|3639| 		if (i == 0)
|3640|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3640|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3641|3641| 		else
|3642|3642| 			this.orderQueue.splice(i, 1);
|3643|3643| 		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
|3724|3724| };
|3725|3725| 
|3726|3726| 
|3727|    |-//// FSM linkage functions ////
|    |3727|+// // FSM linkage functions ////
|3728|3728| 
|3729|3729| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3730|3730| 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
|3891|3891| 				continue;
|3892|3892| 			if (this.orderQueue[i].type == type)
|3893|3893| 				continue;
|3894|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3894|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3895|3895| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3896|3896| 			return;
|3897|3897| 		}
|    | [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
|3891|3891| 				continue;
|3892|3892| 			if (this.orderQueue[i].type == type)
|3893|3893| 				continue;
|3894|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3894|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3895|3895| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3896|3896| 			return;
|3897|3897| 		}
|    | [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
|4118|4118| 	if (data.timerRepeat === undefined)
|4119|4119| 		this.timer = undefined;
|4120|4120| 
|4121|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4121|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4122|4122| };
|4123|4123| 
|4124|4124| /**
|    | [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
|4118|4118| 	if (data.timerRepeat === undefined)
|4119|4119| 		this.timer = undefined;
|4120|4120| 
|4121|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4121|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4122|4122| };
|4123|4123| 
|4124|4124| /**
|    | [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
|4163|4163| 	// TODO: This is a bit inefficient since every unit listens to every
|4164|4164| 	// construction message - ideally we could scope it to only the one we're building
|4165|4165| 
|4166|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4166|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4167|4167| };
|4168|4168| 
|4169|4169| 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
|4163|4163| 	// TODO: This is a bit inefficient since every unit listens to every
|4164|4164| 	// construction message - ideally we could scope it to only the one we're building
|4165|4165| 
|4166|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4166|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4167|4167| };
|4168|4168| 
|4169|4169| 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
|4202|4202| 	if (msg.fromStatusEffect)
|4203|4203| 		return;
|4204|4204| 
|4205|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4205|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4206|4206| };
|4207|4207| 
|4208|4208| 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
|4202|4202| 	if (msg.fromStatusEffect)
|4203|4203| 		return;
|4204|4204| 
|4205|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4205|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4206|4206| };
|4207|4207| 
|4208|4208| 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
|4207|4207| 
|4208|4208| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4209|4209| {
|4210|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4210|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4211|4211| };
|4212|4212| 
|4213|4213| 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
|4207|4207| 
|4208|4208| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4209|4209| {
|4210|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4210|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4211|4211| };
|4212|4212| 
|4213|4213| 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
|4212|4212| 
|4213|4213| UnitAI.prototype.OnHealthChanged = function(msg)
|4214|4214| {
|4215|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4215|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4216|4216| };
|4217|4217| 
|4218|4218| 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
|4212|4212| 
|4213|4213| UnitAI.prototype.OnHealthChanged = function(msg)
|4214|4214| {
|4215|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4215|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4216|4216| };
|4217|4217| 
|4218|4218| 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
|4218|4218| UnitAI.prototype.OnRangeUpdate = function(msg)
|4219|4219| {
|4220|4220| 	if (msg.tag == this.losRangeQuery)
|4221|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4221|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4222|4222| 	else if (msg.tag == this.losHealRangeQuery)
|4223|4223| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4224|4224| };
|    | [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
|4218|4218| UnitAI.prototype.OnRangeUpdate = function(msg)
|4219|4219| {
|4220|4220| 	if (msg.tag == this.losRangeQuery)
|4221|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4221|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4222|4222| 	else if (msg.tag == this.losHealRangeQuery)
|4223|4223| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4224|4224| };
|    | [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
|4220|4220| 	if (msg.tag == this.losRangeQuery)
|4221|4221| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4222|4222| 	else if (msg.tag == this.losHealRangeQuery)
|4223|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4223|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4224|4224| };
|4225|4225| 
|4226|4226| 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
|4220|4220| 	if (msg.tag == this.losRangeQuery)
|4221|4221| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4222|4222| 	else if (msg.tag == this.losHealRangeQuery)
|4223|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4223|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4224|4224| };
|4225|4225| 
|4226|4226| 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
|4225|4225| 
|4226|4226| UnitAI.prototype.OnPackFinished = function(msg)
|4227|4227| {
|4228|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4228|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4229|4229| };
|4230|4230| 
|4231|4231| //// 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
|4225|4225| 
|4226|4226| UnitAI.prototype.OnPackFinished = function(msg)
|4227|4227| {
|4228|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4228|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4229|4229| };
|4230|4230| 
|4231|4231| //// 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
|4228|4228| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4229|4229| };
|4230|4230| 
|4231|    |-//// Helper functions to be called by the FSM ////
|    |4231|+// // Helper functions to be called by the FSM ////
|4232|4232| 
|4233|4233| UnitAI.prototype.GetWalkSpeed = function()
|4234|4234| {
|    | [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
|4958|4958| UnitAI.prototype.AttackEntityInZone = function(ents)
|4959|4959| {
|4960|4960| 	var target = ents.find(target =>
|4961|    |-		this.CanAttack(target)
|4962|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4961|+		this.CanAttack(target) &&
|    |4962|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4963|4963| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4964|4964| 	);
|4965|4965| 	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
|4959|4959| {
|4960|4960| 	var target = ents.find(target =>
|4961|4961| 		this.CanAttack(target)
|4962|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4963|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4962|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4963|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4964|4964| 	);
|4965|4965| 	if (!target)
|4966|4966| 		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
|5025|5025| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|5026|5026| 	if (this.isGuardOf)
|5027|5027| 	{
|5028|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |5028|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|5029|5029| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|5030|5030| 		if (cmpUnitAI && cmpAttack &&
|5031|5031| 		    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
|5029|5029| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|5030|5030| 		if (cmpUnitAI && cmpAttack &&
|5031|5031| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|5032|    |-				return false;
|    |5032|+			return false;
|5033|5033| 	}
|5034|5034| 
|5035|5035| 	// 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
|5067|5067| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|5068|5068| 	if (this.isGuardOf)
|5069|5069| 	{
|5070|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |5070|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|5071|5071| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|5072|5072| 		if (cmpUnitAI && cmpAttack &&
|5073|5073| 		    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
|5080|5080| 	return false;
|5081|5081| };
|5082|5082| 
|5083|    |-//// External interface functions ////
|    |5083|+// // External interface functions ////
|5084|5084| 
|5085|5085| UnitAI.prototype.SetFormationController = function(ent)
|5086|5086| {
|    | [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
|5236|5236| 	{
|5237|5237| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5238|5238| 			return;
|5239|    |-		else
|5240|    |-			this.RemoveGuard();
|    |5239|+		this.RemoveGuard();
|5241|5240| 	}
|5242|5241| 
|5243|5242| 	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
|5570|5570| 
|5571|5571| 	if (this.IsFormationController())
|5572|5572| 		this.CallMemberFunction("CancelSetupTradeRoute", [target]);
|5573|    |-}
|    |5573|+};
|5574|5574| /**
|5575|5575|  * Adds trade order to the queue. Either walk to the first market, or
|5576|5576|  * 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
|5591|5591| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5592|5592| 	{
|5593|5593| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5594|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5594|+		if (cmpTrader.HasBothMarkets() &&
|5595|5595| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5596|5596| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5597|5597| 		{
|    | [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
|5869|5869| 				{
|5870|5870| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5871|5871| 					var targetClasses = this.order.data.targetClasses;
|5872|    |-					if (targetClasses.attack && cmpIdentity
|5873|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5872|+					if (targetClasses.attack && cmpIdentity &&
|    |5873|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5874|5874| 						continue;
|5875|5875| 					if (targetClasses.avoid && cmpIdentity
|5876|5876| 						&& 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
|5872|5872| 					if (targetClasses.attack && cmpIdentity
|5873|5873| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5874|5874| 						continue;
|5875|    |-					if (targetClasses.avoid && cmpIdentity
|5876|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5875|+					if (targetClasses.avoid && cmpIdentity &&
|    |5876|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5877|5877| 						continue;
|5878|5878| 					// Only used by the AIs to prevent some choices of targets
|5879|5879| 					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
|5895|5895| 		{
|5896|5896| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5897|5897| 			var targetClasses = this.order.data.targetClasses;
|5898|    |-			if (cmpIdentity && targetClasses.attack
|5899|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5898|+			if (cmpIdentity && targetClasses.attack &&
|    |5899|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5900|5900| 				continue;
|5901|5901| 			if (cmpIdentity && targetClasses.avoid
|5902|5902| 				&& 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
|5898|5898| 			if (cmpIdentity && targetClasses.attack
|5899|5899| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5900|5900| 				continue;
|5901|    |-			if (cmpIdentity && targetClasses.avoid
|5902|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5901|+			if (cmpIdentity && targetClasses.avoid &&
|    |5902|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5903|5903| 				continue;
|5904|5904| 			// Only used by the AIs to prevent some choices of targets
|5905|5905| 			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
|6058|6058| 
|6059|6059| UnitAI.prototype.SetHeldPosition = function(x, z)
|6060|6060| {
|6061|    |-	this.heldPosition = {"x": x, "z": z};
|    |6061|+	this.heldPosition = { "x": x, "z": z};
|6062|6062| };
|6063|6063| 
|6064|6064| 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
|6058|6058| 
|6059|6059| UnitAI.prototype.SetHeldPosition = function(x, z)
|6060|6060| {
|6061|    |-	this.heldPosition = {"x": x, "z": z};
|    |6061|+	this.heldPosition = {"x": x, "z": z };
|6062|6062| };
|6063|6063| 
|6064|6064| 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
|6085|6085| 	return false;
|6086|6086| };
|6087|6087| 
|6088|    |-//// Helper functions ////
|    |6088|+// // Helper functions ////
|6089|6089| 
|6090|6090| /**
|6091|6091|  * 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
|6104|6104| 		return undefined;
|6105|6105| 
|6106|6106| 	return component.GetRange(type);
|6107|    |-}
|    |6107|+};
|6108|6108| 
|6109|6109| UnitAI.prototype.CanAttack = function(target)
|6110|6110| {
|    | [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
|6280|6280| 	return cmpPack && cmpPack.IsPacking();
|6281|6281| };
|6282|6282| 
|6283|    |-//// Formation specific functions ////
|    |6283|+// // Formation specific functions ////
|6284|6284| 
|6285|6285| UnitAI.prototype.IsAttackingAsFormation = function()
|6286|6286| {
|    | [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
|6285|6285| UnitAI.prototype.IsAttackingAsFormation = function()
|6286|6286| {
|6287|6287| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6288|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6289|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6288|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6289|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6290|6290| };
|6291|6291| 
|6292|6292| //// 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
|6289|6289| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6290|6290| };
|6291|6291| 
|6292|    |-//// Animal specific functions ////
|    |6292|+// // Animal specific functions ////
|6293|6293| 
|6294|6294| UnitAI.prototype.MoveRandomly = function(distance)
|6295|6295| {
|    | [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
|6340|6340| {
|6341|6341| 	let cmpUnitMotion = Engine.QueryInterface(this.entity, IID_UnitMotion);
|6342|6342| 	return cmpUnitMotion && cmpUnitMotion.GetFacePointAfterMove();
|6343|    |-}
|    |6343|+};
|6344|6344| 
|6345|6345| UnitAI.prototype.AttackEntitiesByPreference = function(ents)
|6346|6346| {

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4029| »   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
|4945| »   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
|4960| »   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
|5008| »   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
|5031| »   »   ····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
|2073| »   »   »   »   »   »   &&·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
|4060| »   for·(var·i·=·0;·i·<·this.orderQueue.length;·++i)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|6343| }
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.
Executing section cli...

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

Freagarach requested changes to this revision.Mon, Jul 20, 9:35 AM

I think dangerous animals need a cheering state now also? (Refs. D2646.)

ERROR: Tried to change to non-existent state 'CHEERING'
ERROR: Error in timer on entity 492, IID97, function TimerHandler: TypeError: toState is undefined
  FSM.prototype.SwitchToNextState@simulation/helpers/FSM.js:338:28
  FSM.prototype.ProcessMessage@simulation/helpers/FSM.js:274:3
  UnitAI.prototype.PushOrderFront@simulation/components/UnitAI.js:3859:13
  UnitAI.prototype.Cheer@simulation/components/UnitAI.js:5754:2
  UnitAI.prototype.UnitFsmSpec.INDIVIDUAL.COMBAT.FINDINGNEWTARGET.enter@simulation/components/UnitAI.js:2119:7
  FSM.prototype.SwitchToNextState@simulation/helpers/FSM.js:366:8
  FSM.prototype.ProcessMessage@simulation/helpers/FSM.js:274:3
  UnitAI.prototype.TimerHandler@simulation/components/UnitAI.js:4121:2
  Timer.prototype.OnUpdate@simulation/components/Timer.js:139:4
binaries/data/mods/public/simulation/components/UnitAI.js
149

Capital n?

This revision now requires changes to proceed.Mon, Jul 20, 9:35 AM
Angen added inline comments.Mon, Jul 20, 5:41 PM
binaries/data/mods/public/simulation/components/UnitAI.js
149

rather no, it is variable and not function.