Page MenuHomeWildfire Games

Do not let every entity with UnitAI listen to "OnGlobalConstructionFinished".
ClosedPublic

Authored by Freagarach on Apr 11 2020, 8:13 AM.

Details

Reviewers
wraitii
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Commits
rP23924: Do not let every entity with UnitAI listen to "OnGlobalConstructionFinished".
Summary

In rP7775, UnitAI was rewritten, among the changes made was that a foundation being finished sent a message.
Since at that time there was no way of telling which units took part in the construction, a global message was handled in UnitAI, along with a ToDo that that is expensive and unnecessary.

rP23449 Introduced a function to get the builders for both a foundation and a repairable target, which means that the messages can now be sent targeted. Since it was discussed on IRC and regarding D2704 that messages ought to be sent to themselves only, this patch queries the UnitAI's of the builders to directly call the ConstructionFinished function.

Test Plan

Verify that:

  • When a building has finished construction, the builders get the message (pun intended).
  • Also approaching builders/repairers don't error out when their target is finished before they arrive.
  • When entities repair a target they stop when their target is fully repaired.

Diff Detail

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

Event Timeline

Freagarach created this revision.Apr 11 2020, 8:13 AM

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

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

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Repairable.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Repairable.js
|  57|  57| {
|  58|  58| 	for (let builder of builders)
|  59|  59| 		this.AddBuilder(builder);
|  60|    |-}
|    |  60|+};
|  61|  61| 
|  62|  62| Repairable.prototype.AddBuilder = function(builderEnt)
|  63|  63| {

binaries/data/mods/public/simulation/components/Repairable.js
|  60| }
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Foundation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Foundation.js
| 162| 162| 	this.totalBuilderRate += buildRate;
| 163| 163| 
| 164| 164| 	return true;
| 165|    |-}
|    | 165|+};
| 166| 166| 
| 167| 167| /**
| 168| 168|  * Adds a builder to the counter.
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Foundation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Foundation.js
| 197| 197| 		cmpVisual.SetVariable("numbuilders", this.builders.size);
| 198| 198| 
| 199| 199| 	Engine.PostMessage(this.entity, MT_FoundationBuildersChanged, { "to": this.GetBuilders() });
| 200|    |-}
|    | 200|+};
| 201| 201| 
| 202| 202| /**
| 203| 203|  * The build multiplier is a penalty that is applied to each builder.

binaries/data/mods/public/simulation/components/Foundation.js
| 456| »   »   for·(let·ent·of·this.GetBuilders())
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'ent' is already declared in the upper scope.

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

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

binaries/data/mods/public/simulation/components/Foundation.js
| 370| »   »   var·pos·=·cmpPosition.GetPosition2D();
|    | [NORMAL] JSHintBear:
|    | 'pos' is already defined.

binaries/data/mods/public/simulation/components/Foundation.js
| 372| »   »   var·rot·=·cmpPosition.GetRotation();
|    | [NORMAL] JSHintBear:
|    | 'rot' is already defined.
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 788| 788| 					this.FinishOrder();
| 789| 789| 					return;
| 790| 790| 				}
| 791|    |-				else
| 792|    |-				{
|    | 791|+				
| 793| 792| 					this.SetNextState("GARRISON.APPROACHING");
| 794| 793| 					return;
| 795|    |-				}
|    | 794|+				
| 796| 795| 			}
| 797| 796| 
| 798| 797| 			this.SetNextState("GARRISON.GARRISONING");
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'GARRISON'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1060|1060| 			},
|1061|1061| 		},
|1062|1062| 
|1063|    |-		"GARRISON":{
|    |1063|+		"GARRISON": {
|1064|1064| 			"APPROACHING": {
|1065|1065| 				"enter": function() {
|1066|1066| 					if (!this.MoveToGarrisonRange(this.order.data.target))
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2038|2038| 
|2039|2039| 				"Attacked": function(msg) {
|2040|2040| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2041|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2042|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2041|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2042|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2043|2043| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2044|2044| 				},
|2045|2045| 			},
|    | [NORMAL] ESLintBear (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
|2197|2197| 					"MovementUpdate": function(msg) {
|2198|2198| 						// If it looks like the path is failing, and we are close enough (3 tiles) from wanted range
|2199|2199| 						// stop anyways. This avoids pathing for an unreachable goal and reduces lag considerably.
|2200|    |-						if (msg.likelyFailure || 
|    |2200|+						if (msg.likelyFailure ||
|2201|2201| 							msg.obstructed && this.RelaxedMaxRangeCheck(this.order.data, this.order.data.max + this.DefaultRelaxedMaxRange) ||
|2202|2202| 							!msg.obstructed && this.CheckRange(this.order.data))
|2203|2203| 							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
|2839|2839| 					{
|2840|2840| 						// The building was already finished/fully repaired before we arrived;
|2841|2841| 						// let the ConstructionFinished handler handle this.
|2842|    |-						this.OnConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2842|+						this.OnConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2843|2843| 						return true;
|2844|2844| 					}
|2845|2845| 
|    | [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
|2839|2839| 					{
|2840|2840| 						// The building was already finished/fully repaired before we arrived;
|2841|2841| 						// let the ConstructionFinished handler handle this.
|2842|    |-						this.OnConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2842|+						this.OnConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2843|2843| 						return true;
|2844|2844| 					}
|2845|2845| 
|    | [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
|3137|3137| 				this.StopTimer();
|3138|3138| 				this.ResetAnimation();
|3139|3139| 				if (this.formationAnimationVariant)
|3140|    |-					this.SetAnimationVariant(this.formationAnimationVariant)
|    |3140|+					this.SetAnimationVariant(this.formationAnimationVariant);
|3141|3141| 				else
|3142|3142| 					this.SetDefaultAnimationVariant();
|3143|3143| 				var cmpResistance = Engine.QueryInterface(this.entity, IID_Resistance);
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 7.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3363|3363| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3364|3364| 
|3365|3365| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3366|    |-							// only used for domestic animals
|    |3366|+		// only used for domestic animals
|3367|3367| 
|3368|3368| 		// Reuse the same garrison behaviour for animals.
|3369|3369| 		"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
|3425|3425| 
|3426|3426| UnitAI.prototype.IsAnimal = function()
|3427|3427| {
|3428|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3428|+	return (!!this.template.NaturalBehaviour);
|3429|3429| };
|3430|3430| 
|3431|3431| 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
|3541|3541| 		{
|3542|3542| 			let index = this.GetCurrentState().indexOf(".");
|3543|3543| 			if (index != -1)
|3544|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3544|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3545|3545| 			this.Stop(false);
|3546|3546| 		}
|3547|3547| 
|    | [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
|3597|3597| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3598|3598| 			continue;
|3599|3599| 		if (i == 0)
|3600|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3600|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3601|3601| 		else
|3602|3602| 			this.orderQueue.splice(i, 1);
|3603|3603| 		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
|3597|3597| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3598|3598| 			continue;
|3599|3599| 		if (i == 0)
|3600|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3600|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3601|3601| 		else
|3602|3602| 			this.orderQueue.splice(i, 1);
|3603|3603| 		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
|3684|3684| };
|3685|3685| 
|3686|3686| 
|3687|    |-//// FSM linkage functions ////
|    |3687|+// // FSM linkage functions ////
|3688|3688| 
|3689|3689| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3690|3690| 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
|3855|3855| 				continue;
|3856|3856| 			if (this.orderQueue[i].type == type)
|3857|3857| 				continue;
|3858|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3858|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3859|3859| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3860|3860| 			return;
|3861|3861| 		}
|    | [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
|3855|3855| 				continue;
|3856|3856| 			if (this.orderQueue[i].type == type)
|3857|3857| 				continue;
|3858|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3858|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3859|3859| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3860|3860| 			return;
|3861|3861| 		}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4097|4097| 	if (data.timerRepeat === undefined)
|4098|4098| 		this.timer = undefined;
|4099|4099| 
|4100|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4100|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4101|4101| };
|4102|4102| 
|4103|4103| /**
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4097|4097| 	if (data.timerRepeat === undefined)
|4098|4098| 		this.timer = undefined;
|4099|4099| 
|4100|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4100|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4101|4101| };
|4102|4102| 
|4103|4103| /**
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4139|4139| 
|4140|4140| UnitAI.prototype.OnConstructionFinished = function(msg)
|4141|4141| {
|4142|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4142|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4143|4143| };
|4144|4144| 
|4145|4145| UnitAI.prototype.OnGlobalEntityRenamed = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4139|4139| 
|4140|4140| UnitAI.prototype.OnConstructionFinished = function(msg)
|4141|4141| {
|4142|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4142|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4143|4143| };
|4144|4144| 
|4145|4145| UnitAI.prototype.OnGlobalEntityRenamed = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4170|4170| 	if (msg.fromStatusEffect)
|4171|4171| 		return;
|4172|4172| 
|4173|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4173|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4174|4174| };
|4175|4175| 
|4176|4176| UnitAI.prototype.OnGuardedAttacked = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4170|4170| 	if (msg.fromStatusEffect)
|4171|4171| 		return;
|4172|4172| 
|4173|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4173|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4174|4174| };
|4175|4175| 
|4176|4176| UnitAI.prototype.OnGuardedAttacked = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4175|4175| 
|4176|4176| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4177|4177| {
|4178|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4178|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4179|4179| };
|4180|4180| 
|4181|4181| UnitAI.prototype.OnHealthChanged = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4175|4175| 
|4176|4176| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4177|4177| {
|4178|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4178|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4179|4179| };
|4180|4180| 
|4181|4181| UnitAI.prototype.OnHealthChanged = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4180|4180| 
|4181|4181| UnitAI.prototype.OnHealthChanged = function(msg)
|4182|4182| {
|4183|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4183|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4184|4184| };
|4185|4185| 
|4186|4186| UnitAI.prototype.OnRangeUpdate = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4180|4180| 
|4181|4181| UnitAI.prototype.OnHealthChanged = function(msg)
|4182|4182| {
|4183|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4183|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4184|4184| };
|4185|4185| 
|4186|4186| UnitAI.prototype.OnRangeUpdate = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4186|4186| UnitAI.prototype.OnRangeUpdate = function(msg)
|4187|4187| {
|4188|4188| 	if (msg.tag == this.losRangeQuery)
|4189|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4189|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4190|4190| 	else if (msg.tag == this.losHealRangeQuery)
|4191|4191| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4192|4192| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4186|4186| UnitAI.prototype.OnRangeUpdate = function(msg)
|4187|4187| {
|4188|4188| 	if (msg.tag == this.losRangeQuery)
|4189|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4189|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4190|4190| 	else if (msg.tag == this.losHealRangeQuery)
|4191|4191| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4192|4192| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4188|4188| 	if (msg.tag == this.losRangeQuery)
|4189|4189| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4190|4190| 	else if (msg.tag == this.losHealRangeQuery)
|4191|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4191|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4192|4192| };
|4193|4193| 
|4194|4194| UnitAI.prototype.OnPackFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4188|4188| 	if (msg.tag == this.losRangeQuery)
|4189|4189| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4190|4190| 	else if (msg.tag == this.losHealRangeQuery)
|4191|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4191|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4192|4192| };
|4193|4193| 
|4194|4194| UnitAI.prototype.OnPackFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4193|4193| 
|4194|4194| UnitAI.prototype.OnPackFinished = function(msg)
|4195|4195| {
|4196|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4196|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4197|4197| };
|4198|4198| 
|4199|4199| //// Helper functions to be called by the FSM ////
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4193|4193| 
|4194|4194| UnitAI.prototype.OnPackFinished = function(msg)
|4195|4195| {
|4196|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4196|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4197|4197| };
|4198|4198| 
|4199|4199| //// Helper functions to be called by the FSM ////
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4196|4196| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4197|4197| };
|4198|4198| 
|4199|    |-//// Helper functions to be called by the FSM ////
|    |4199|+// // Helper functions to be called by the FSM ////
|4200|4200| 
|4201|4201| UnitAI.prototype.GetWalkSpeed = function()
|4202|4202| {
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4908|4908| UnitAI.prototype.AttackEntityInZone = function(ents)
|4909|4909| {
|4910|4910| 	var target = ents.find(target =>
|4911|    |-		this.CanAttack(target)
|4912|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4911|+		this.CanAttack(target) &&
|    |4912|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4913|4913| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4914|4914| 	);
|4915|4915| 	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
|4909|4909| {
|4910|4910| 	var target = ents.find(target =>
|4911|4911| 		this.CanAttack(target)
|4912|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4913|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4912|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4913|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4914|4914| 	);
|4915|4915| 	if (!target)
|4916|4916| 		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
|4973|4973| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4974|4974| 	if (this.isGuardOf)
|4975|4975| 	{
|4976|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4976|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4977|4977| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4978|4978| 		if (cmpUnitAI && cmpAttack &&
|4979|4979| 		    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
|4977|4977| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4978|4978| 		if (cmpUnitAI && cmpAttack &&
|4979|4979| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4980|    |-				return false;
|    |4980|+			return false;
|4981|4981| 	}
|4982|4982| 
|4983|4983| 	// 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
|5015|5015| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|5016|5016| 	if (this.isGuardOf)
|5017|5017| 	{
|5018|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |5018|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|5019|5019| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|5020|5020| 		if (cmpUnitAI && cmpAttack &&
|5021|5021| 		    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
|5028|5028| 	return false;
|5029|5029| };
|5030|5030| 
|5031|    |-//// External interface functions ////
|    |5031|+// // External interface functions ////
|5032|5032| 
|5033|5033| UnitAI.prototype.SetFormationController = function(ent)
|5034|5034| {
|    | [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
|5184|5184| 	{
|5185|5185| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5186|5186| 			return;
|5187|    |-		else
|5188|    |-			this.RemoveGuard();
|    |5187|+		this.RemoveGuard();
|5189|5188| 	}
|5190|5189| 
|5191|5190| 	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
|5515|5515| 
|5516|5516| 	if (this.IsFormationController())
|5517|5517| 		this.CallMemberFunction("CancelSetupTradeRoute", [target]);
|5518|    |-}
|    |5518|+};
|5519|5519| /**
|5520|5520|  * Adds trade order to the queue. Either walk to the first market, or
|5521|5521|  * 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
|5536|5536| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5537|5537| 	{
|5538|5538| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5539|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5539|+		if (cmpTrader.HasBothMarkets() &&
|5540|5540| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5541|5541| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5542|5542| 		{
|    | [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
|5817|5817| 				{
|5818|5818| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5819|5819| 					var targetClasses = this.order.data.targetClasses;
|5820|    |-					if (targetClasses.attack && cmpIdentity
|5821|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5820|+					if (targetClasses.attack && cmpIdentity &&
|    |5821|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5822|5822| 						continue;
|5823|5823| 					if (targetClasses.avoid && cmpIdentity
|5824|5824| 						&& 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
|5820|5820| 					if (targetClasses.attack && cmpIdentity
|5821|5821| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5822|5822| 						continue;
|5823|    |-					if (targetClasses.avoid && cmpIdentity
|5824|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5823|+					if (targetClasses.avoid && cmpIdentity &&
|    |5824|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5825|5825| 						continue;
|5826|5826| 					// Only used by the AIs to prevent some choices of targets
|5827|5827| 					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
|5843|5843| 		{
|5844|5844| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5845|5845| 			var targetClasses = this.order.data.targetClasses;
|5846|    |-			if (cmpIdentity && targetClasses.attack
|5847|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5846|+			if (cmpIdentity && targetClasses.attack &&
|    |5847|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5848|5848| 				continue;
|5849|5849| 			if (cmpIdentity && targetClasses.avoid
|5850|5850| 				&& 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
|5846|5846| 			if (cmpIdentity && targetClasses.attack
|5847|5847| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5848|5848| 				continue;
|5849|    |-			if (cmpIdentity && targetClasses.avoid
|5850|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5849|+			if (cmpIdentity && targetClasses.avoid &&
|    |5850|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5851|5851| 				continue;
|5852|5852| 			// Only used by the AIs to prevent some choices of targets
|5853|5853| 			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
|5989|5989| 
|5990|5990| UnitAI.prototype.SetHeldPosition = function(x, z)
|5991|5991| {
|5992|    |-	this.heldPosition = {"x": x, "z": z};
|    |5992|+	this.heldPosition = { "x": x, "z": z};
|5993|5993| };
|5994|5994| 
|5995|5995| 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
|5989|5989| 
|5990|5990| UnitAI.prototype.SetHeldPosition = function(x, z)
|5991|5991| {
|5992|    |-	this.heldPosition = {"x": x, "z": z};
|    |5992|+	this.heldPosition = {"x": x, "z": z };
|5993|5993| };
|5994|5994| 
|5995|5995| 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
|6016|6016| 	return false;
|6017|6017| };
|6018|6018| 
|6019|    |-//// Helper functions ////
|    |6019|+// // Helper functions ////
|6020|6020| 
|6021|6021| /**
|6022|6022|  * 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
|6035|6035| 		return undefined;
|6036|6036| 
|6037|6037| 	return component.GetRange(type);
|6038|    |-}
|    |6038|+};
|6039|6039| 
|6040|6040| UnitAI.prototype.CanAttack = function(target)
|6041|6041| {
|    | [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
|6233|6233| 	return cmpPack && cmpPack.IsPacking();
|6234|6234| };
|6235|6235| 
|6236|    |-//// Formation specific functions ////
|    |6236|+// // Formation specific functions ////
|6237|6237| 
|6238|6238| UnitAI.prototype.IsAttackingAsFormation = function()
|6239|6239| {
|    | [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
|6238|6238| UnitAI.prototype.IsAttackingAsFormation = function()
|6239|6239| {
|6240|6240| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6241|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6242|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6241|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6242|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6243|6243| };
|6244|6244| 
|6245|6245| //// 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
|6242|6242| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6243|6243| };
|6244|6244| 
|6245|    |-//// Animal specific functions ////
|    |6245|+// // Animal specific functions ////
|6246|6246| 
|6247|6247| UnitAI.prototype.MoveRandomly = function(distance)
|6248|6248| {

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Freagarach retitled this revision from Do not let every entity with UnitAI listen to "OnGlobalConstructionFinished", while it is not needed anymore. to Do not let every entity with UnitAI listen to "OnGlobalConstructionFinished", while it is perhaps not needed anymore..Apr 11 2020, 8:29 AM
Freagarach edited the summary of this revision. (Show Details)
Silier added a subscriber: Silier.Apr 11 2020, 9:30 AM

I think it meant unitfsm.processmessage, but not sure.
Now there are more messages send when entitiny finished construction, but also less received so possibly that is better.

profiling would help but would need to be done in c++ when sending messages I guess

need to chcek how global actually works

binaries/data/mods/public/simulation/components/Repairable.js
133 ↗(On Diff #11658)

this.entity - > ent

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

if this here, do we really need to listen to engine messages?

Freagarach added inline comments.Apr 11 2020, 10:13 AM
binaries/data/mods/public/simulation/components/UnitAI.js
2842 ↗(On Diff #11658)

Yes, this is only on enter, but you are right, perhaps we can even refactor the whole construction finished message listening out.

Freagarach planned changes to this revision.Apr 11 2020, 11:37 AM

Build using Builder.js?
Then builders would know if it was finished by themselves.

wraitii requested changes to this revision.May 30 2020, 3:01 PM
wraitii added a subscriber: wraitii.

I think you can just hook into OnGlobalEntityRenamed. Will need a little care to not break things.

Freagarach updated this revision to Diff 12394.Jun 20 2020, 8:44 AM
Freagarach marked an inline comment as done.

Query UnitAI directly.

I think you can just hook into OnGlobalEntityRenamed. Will need a little care to not break things.

No we can't, imagine an entity that is repairable and gets promoted.

Freagarach retitled this revision from Do not let every entity with UnitAI listen to "OnGlobalConstructionFinished", while it is perhaps not needed anymore. to Do not let every entity with UnitAI listen to "OnGlobalConstructionFinished"..Jun 20 2020, 8:48 AM
Freagarach edited the summary of this revision. (Show Details)

With ~400 entities timings go from ~1600 μs for the postMessage to ~500 μs for the postMessage including builders query.

Seems fine like this given the limited usage.

I am questioning the usefulness -> is this an actual bottleneck in real-life games?

No we can't, imagine an entity that is repairable and gets promoted.

I don't really get what the trouble is with that?

binaries/data/mods/public/simulation/components/Foundation.js
460 ↗(On Diff #12394)

likewise

binaries/data/mods/public/simulation/components/Repairable.js
135 ↗(On Diff #12394)

I'd add a little comment here that this is done for performance purposes

wraitii accepted this revision.Jul 30 2020, 3:48 PM
wraitii added a subscriber: bb.

@bb pointed out that you mean "400 units on the map", not actually building, so this easily seems worth doing to me.

This revision is now accepted and ready to land.Jul 30 2020, 3:48 PM
bb added inline comments.Jul 30 2020, 3:49 PM
binaries/data/mods/public/simulation/components/Repairable.js
133 ↗(On Diff #12394)

Message still required for AI, so good

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

Can't find a really good position too place this function in the unitAI. Probably here is fine...

Freagarach updated this revision to Diff 13020.Aug 3 2020, 11:58 AM
Freagarach marked 3 inline comments as done.
  • Rebased.
  • Updated comment.

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Repairable.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Repairable.js
|  57|  57| {
|  58|  58| 	for (let builder of builders)
|  59|  59| 		this.AddBuilder(builder);
|  60|    |-}
|    |  60|+};
|  61|  61| 
|  62|  62| Repairable.prototype.AddBuilder = function(builderEnt)
|  63|  63| {

binaries/data/mods/public/simulation/components/Repairable.js
|  60| }
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Foundation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Foundation.js
| 162| 162| 	this.totalBuilderRate += buildRate;
| 163| 163| 
| 164| 164| 	return true;
| 165|    |-}
|    | 165|+};
| 166| 166| 
| 167| 167| /**
| 168| 168|  * Adds a builder to the counter.
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Foundation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Foundation.js
| 197| 197| 		cmpVisual.SetVariable("numbuilders", this.builders.size);
| 198| 198| 
| 199| 199| 	Engine.PostMessage(this.entity, MT_FoundationBuildersChanged, { "to": this.GetBuilders() });
| 200|    |-}
|    | 200|+};
| 201| 201| 
| 202| 202| /**
| 203| 203|  * The build multiplier is a penalty that is applied to each builder.

binaries/data/mods/public/simulation/components/Foundation.js
| 462| »   »   for·(let·ent·of·this.GetBuilders())
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'ent' is already declared in the upper scope.

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

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

binaries/data/mods/public/simulation/components/Foundation.js
| 370| »   »   var·pos·=·cmpPosition.GetPosition2D();
|    | [NORMAL] JSHintBear:
|    | 'pos' is already defined.

binaries/data/mods/public/simulation/components/Foundation.js
| 372| »   »   var·rot·=·cmpPosition.GetRotation();
|    | [NORMAL] JSHintBear:
|    | 'rot' is already defined.
|    | [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
| 798| 798| 					this.FinishOrder();
| 799| 799| 					return;
| 800| 800| 				}
| 801|    |-				else
| 802|    |-				{
|    | 801|+				
| 803| 802| 					this.SetNextState("GARRISON.APPROACHING");
| 804| 803| 					return;
| 805|    |-				}
|    | 804|+				
| 806| 805| 			}
| 807| 806| 
| 808| 807| 			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
|1062|1062| 			},
|1063|1063| 		},
|1064|1064| 
|1065|    |-		"GARRISON":{
|    |1065|+		"GARRISON": {
|1066|1066| 			"APPROACHING": {
|1067|1067| 				"enter": function() {
|1068|1068| 					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
|2066|2066| 
|2067|2067| 				"Attacked": function(msg) {
|2068|2068| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2069|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2070|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2069|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2070|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2071|2071| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2072|2072| 				},
|2073|2073| 			},
|    | [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
|2225|2225| 					"MovementUpdate": function(msg) {
|2226|2226| 						// If it looks like the path is failing, and we are close enough (3 tiles) from wanted range
|2227|2227| 						// stop anyways. This avoids pathing for an unreachable goal and reduces lag considerably.
|2228|    |-						if (msg.likelyFailure || 
|    |2228|+						if (msg.likelyFailure ||
|2229|2229| 							msg.obstructed && this.RelaxedMaxRangeCheck(this.order.data, this.order.data.max + this.DefaultRelaxedMaxRange) ||
|2230|2230| 							!msg.obstructed && this.CheckRange(this.order.data))
|2231|2231| 							this.FinishOrder();
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 6 tabs but found 5.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2527|2527| 
|2528|2528| 							return type.specific == resourceType.specific &&
|2529|2529| 							    (type.specific != "meat" || resourceTemplate == template);
|2530|    |-					});
|    |2530|+						});
|2531|2531| 
|2532|2532| 					if (nearbyResource)
|2533|2533| 					{
|    | [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
|3147|3147| 				this.StopTimer();
|3148|3148| 				this.ResetAnimation();
|3149|3149| 				if (this.formationAnimationVariant)
|3150|    |-					this.SetAnimationVariant(this.formationAnimationVariant)
|    |3150|+					this.SetAnimationVariant(this.formationAnimationVariant);
|3151|3151| 				else
|3152|3152| 					this.SetDefaultAnimationVariant();
|3153|3153| 				var cmpResistance = Engine.QueryInterface(this.entity, IID_Resistance);
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 7.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3361|3361| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3362|3362| 
|3363|3363| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3364|    |-							// only used for domestic animals
|    |3364|+		// only used for domestic animals
|3365|3365| 
|3366|3366| 		// Reuse the same garrison behaviour for animals.
|3367|3367| 		"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
|3411|3411| 
|3412|3412| UnitAI.prototype.IsAnimal = function()
|3413|3413| {
|3414|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3414|+	return (!!this.template.NaturalBehaviour);
|3415|3415| };
|3416|3416| 
|3417|3417| 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
|3551|3551| 		{
|3552|3552| 			let index = this.GetCurrentState().indexOf(".");
|3553|3553| 			if (index != -1)
|3554|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3554|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3555|3555| 			this.Stop(false);
|3556|3556| 		}
|3557|3557| 
|    | [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
|3608|3608| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3609|3609| 			continue;
|3610|3610| 		if (i == 0)
|3611|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3611|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3612|3612| 		else
|3613|3613| 			this.orderQueue.splice(i, 1);
|3614|3614| 		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
|3608|3608| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3609|3609| 			continue;
|3610|3610| 		if (i == 0)
|3611|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3611|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3612|3612| 		else
|3613|3613| 			this.orderQueue.splice(i, 1);
|3614|3614| 		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
|3737|3737| };
|3738|3738| 
|3739|3739| 
|3740|    |-//// FSM linkage functions ////
|    |3740|+// // FSM linkage functions ////
|3741|3741| 
|3742|3742| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3743|3743| 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
|3910|3910| 				continue;
|3911|3911| 			if (this.orderQueue[i].type == type)
|3912|3912| 				continue;
|3913|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3913|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3914|3914| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3915|3915| 			return;
|3916|3916| 		}
|    | [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
|3910|3910| 				continue;
|3911|3911| 			if (this.orderQueue[i].type == type)
|3912|3912| 				continue;
|3913|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3913|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3914|3914| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3915|3915| 			return;
|3916|3916| 		}
|    | [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
|4151|4151| 	if (data.timerRepeat === undefined)
|4152|4152| 		this.timer = undefined;
|4153|4153| 
|4154|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4154|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4155|4155| };
|4156|4156| 
|4157|4157| /**
|    | [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
|4151|4151| 	if (data.timerRepeat === undefined)
|4152|4152| 		this.timer = undefined;
|4153|4153| 
|4154|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4154|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4155|4155| };
|4156|4156| 
|4157|4157| /**
|    | [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
|4237|4237| 	if (msg.fromStatusEffect)
|4238|4238| 		return;
|4239|4239| 
|4240|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4240|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4241|4241| };
|4242|4242| 
|4243|4243| 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
|4237|4237| 	if (msg.fromStatusEffect)
|4238|4238| 		return;
|4239|4239| 
|4240|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4240|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4241|4241| };
|4242|4242| 
|4243|4243| 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
|4242|4242| 
|4243|4243| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4244|4244| {
|4245|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4245|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4246|4246| };
|4247|4247| 
|4248|4248| 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
|4242|4242| 
|4243|4243| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4244|4244| {
|4245|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4245|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4246|4246| };
|4247|4247| 
|4248|4248| 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
|4247|4247| 
|4248|4248| UnitAI.prototype.OnHealthChanged = function(msg)
|4249|4249| {
|4250|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4250|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4251|4251| };
|4252|4252| 
|4253|4253| 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
|4247|4247| 
|4248|4248| UnitAI.prototype.OnHealthChanged = function(msg)
|4249|4249| {
|4250|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4250|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4251|4251| };
|4252|4252| 
|4253|4253| 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
|4262|4262| 
|4263|4263| UnitAI.prototype.OnPackFinished = function(msg)
|4264|4264| {
|4265|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4265|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4266|4266| };
|4267|4267| 
|4268|4268| //// 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
|4262|4262| 
|4263|4263| UnitAI.prototype.OnPackFinished = function(msg)
|4264|4264| {
|4265|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4265|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4266|4266| };
|4267|4267| 
|4268|4268| //// 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
|4265|4265| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4266|4266| };
|4267|4267| 
|4268|    |-//// Helper functions to be called by the FSM ////
|    |4268|+// // Helper functions to be called by the FSM ////
|4269|4269| 
|4270|4270| UnitAI.prototype.GetWalkSpeed = function()
|4271|4271| {
|    | [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
|4995|4995| UnitAI.prototype.AttackEntityInZone = function(ents)
|4996|4996| {
|4997|4997| 	var target = ents.find(target =>
|4998|    |-		this.CanAttack(target)
|4999|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4998|+		this.CanAttack(target) &&
|    |4999|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|5000|5000| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|5001|5001| 	);
|5002|5002| 	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
|4996|4996| {
|4997|4997| 	var target = ents.find(target =>
|4998|4998| 		this.CanAttack(target)
|4999|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|5000|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4999|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |5000|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|5001|5001| 	);
|5002|5002| 	if (!target)
|5003|5003| 		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
|5080|5080| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|5081|5081| 	if (this.isGuardOf)
|5082|5082| 	{
|5083|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |5083|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|5084|5084| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|5085|5085| 		if (cmpUnitAI && cmpAttack &&
|5086|5086| 		    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
|5084|5084| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|5085|5085| 		if (cmpUnitAI && cmpAttack &&
|5086|5086| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|5087|    |-				return false;
|    |5087|+			return false;
|5088|5088| 	}
|5089|5089| 
|5090|5090| 	// 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
|5122|5122| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|5123|5123| 	if (this.isGuardOf)
|5124|5124| 	{
|5125|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |5125|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|5126|5126| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|5127|5127| 		if (cmpUnitAI && cmpAttack &&
|5128|5128| 		    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
|5135|5135| 	return false;
|5136|5136| };
|5137|5137| 
|5138|    |-//// External interface functions ////
|    |5138|+// // External interface functions ////
|5139|5139| 
|5140|5140| UnitAI.prototype.SetFormationController = function(ent)
|5141|5141| {
|    | [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
|5291|5291| 	{
|5292|5292| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5293|5293| 			return;
|5294|    |-		else
|5295|    |-			this.RemoveGuard();
|    |5294|+		this.RemoveGuard();
|5296|5295| 	}
|5297|5296| 
|5298|5297| 	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
|5625|5625| 
|5626|5626| 	if (this.IsFormationController())
|5627|5627| 		this.CallMemberFunction("CancelSetupTradeRoute", [target]);
|5628|    |-}
|    |5628|+};
|5629|5629| /**
|5630|5630|  * Adds trade order to the queue. Either walk to the first market, or
|5631|5631|  * 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
|5646|5646| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5647|5647| 	{
|5648|5648| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5649|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5649|+		if (cmpTrader.HasBothMarkets() &&
|5650|5650| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5651|5651| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5652|5652| 		{
|    | [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
|5953|5953| 				{
|5954|5954| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5955|5955| 					var targetClasses = this.order.data.targetClasses;
|5956|    |-					if (targetClasses.attack && cmpIdentity
|5957|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5956|+					if (targetClasses.attack && cmpIdentity &&
|    |5957|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5958|5958| 						continue;
|5959|5959| 					if (targetClasses.avoid && cmpIdentity
|5960|5960| 						&& 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
|5956|5956| 					if (targetClasses.attack && cmpIdentity
|5957|5957| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5958|5958| 						continue;
|5959|    |-					if (targetClasses.avoid && cmpIdentity
|5960|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5959|+					if (targetClasses.avoid && cmpIdentity &&
|    |5960|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5961|5961| 						continue;
|5962|5962| 					// Only used by the AIs to prevent some choices of targets
|5963|5963| 					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
|5979|5979| 		{
|5980|5980| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5981|5981| 			var targetClasses = this.order.data.targetClasses;
|5982|    |-			if (cmpIdentity && targetClasses.attack
|5983|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5982|+			if (cmpIdentity && targetClasses.attack &&
|    |5983|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5984|5984| 				continue;
|5985|5985| 			if (cmpIdentity && targetClasses.avoid
|5986|5986| 				&& 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
|5982|5982| 			if (cmpIdentity && targetClasses.attack
|5983|5983| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5984|5984| 				continue;
|5985|    |-			if (cmpIdentity && targetClasses.avoid
|5986|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5985|+			if (cmpIdentity && targetClasses.avoid &&
|    |5986|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5987|5987| 				continue;
|5988|5988| 			// Only used by the AIs to prevent some choices of targets
|5989|5989| 			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
|6135|6135| 
|6136|6136| UnitAI.prototype.SetHeldPosition = function(x, z)
|6137|6137| {
|6138|    |-	this.heldPosition = {"x": x, "z": z};
|    |6138|+	this.heldPosition = { "x": x, "z": z};
|6139|6139| };
|6140|6140| 
|6141|6141| 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
|6135|6135| 
|6136|6136| UnitAI.prototype.SetHeldPosition = function(x, z)
|6137|6137| {
|6138|    |-	this.heldPosition = {"x": x, "z": z};
|    |6138|+	this.heldPosition = {"x": x, "z": z };
|6139|6139| };
|6140|6140| 
|6141|6141| 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
|6162|6162| 	return false;
|6163|6163| };
|6164|6164| 
|6165|    |-//// Helper functions ////
|    |6165|+// // Helper functions ////
|6166|6166| 
|6167|6167| /**
|6168|6168|  * 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
|6181|6181| 		return undefined;
|6182|6182| 
|6183|6183| 	return component.GetRange(type);
|6184|    |-}
|    |6184|+};
|6185|6185| 
|6186|6186| UnitAI.prototype.CanAttack = function(target)
|6187|6187| {
|    | [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
|6357|6357| 	return cmpPack && cmpPack.IsPacking();
|6358|6358| };
|6359|6359| 
|6360|    |-//// Formation specific functions ////
|    |6360|+// // Formation specific functions ////
|6361|6361| 
|6362|6362| UnitAI.prototype.IsAttackingAsFormation = function()
|6363|6363| {
|    | [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
|6362|6362| UnitAI.prototype.IsAttackingAsFormation = function()
|6363|6363| {
|6364|6364| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6365|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6366|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6365|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6366|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6367|6367| };
|6368|6368| 
|6369|6369| //// 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
|6366|6366| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6367|6367| };
|6368|6368| 
|6369|    |-//// Animal specific functions ////
|    |6369|+// // Animal specific functions ////
|6370|6370| 
|6371|6371| UnitAI.prototype.MoveRandomly = function(distance)
|6372|6372| {
|    | [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
|6417|6417| {
|6418|6418| 	let cmpUnitMotion = Engine.QueryInterface(this.entity, IID_UnitMotion);
|6419|6419| 	return cmpUnitMotion && cmpUnitMotion.GetFacePointAfterMove();
|6420|    |-}
|    |6420|+};
|6421|6421| 
|6422|6422| UnitAI.prototype.AttackEntitiesByPreference = function(ents)
|6423|6423| {

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4056| »   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
|4982| »   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
|4997| »   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
|5063| »   let·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
|5086| »   »   ····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
|2070| »   »   »   »   »   »   &&·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
|3150| »   »   »   »   »   this.SetAnimationVariant(this.formationAnimationVariant)
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|6366| »   »   &&·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
|6420| }
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.
Executing section cli...

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

This revision was landed with ongoing or failed builds.Aug 3 2020, 12:14 PM
This revision was automatically updated to reflect the committed changes.