Page MenuHomeWildfire Games

Give the GarrisonHolder component the power to set garrisoned on an entity with UnitAI, instead of leaving it to UnitAI.
Needs ReviewPublic

Authored by Freagarach on Oct 17 2019, 8:41 AM.

Details

Reviewers
None
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Summary

This makes that GarrisonHolder sets the IsGarrisoned-flag on an entity with UnitAI, so that it cannot be forgotten when introducing new code or moving existing code.
It makes sense because the only way of garrisoning an entity is via the GarrisonHolder.


rP9498 Introduced the flag, but I have no clue as to why it did not use the GarrisonHolder for it did mention that in the related ticket.
See discussion in D1403. There the meaning of the UnitAI's isGarrisoned was discussed:

  • To be in a "GARRISON" FSM state.
  • To have a "GarrisonHolder" (i.e. actually be garrisoned, no matter what the state or order is).
Test Plan

Verify that garrisoned units cannot be given orders, even when garrisoned visibly or autogarrisoned.

Event Timeline

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

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/464/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
| 761| 761| 					this.FinishOrder();
| 762| 762| 					return;
| 763| 763| 				}
| 764|    |-				else
| 765|    |-				{
|    | 764|+				
| 766| 765| 					this.SetNextState("GARRISON.APPROACHING");
| 767| 766| 					return;
| 768|    |-				}
|    | 767|+				
| 769| 768| 			}
| 770| 769| 
| 771| 770| 			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
|1029|1029| 			},
|1030|1030| 		},
|1031|1031| 
|1032|    |-		"GARRISON":{
|    |1032|+		"GARRISON": {
|1033|1033| 			"enter": function() {
|1034|1034| 				// If the garrisonholder should pickup, warn it so it can take needed action
|1035|1035| 				var cmpGarrisonHolder = Engine.QueryInterface(this.order.data.target, IID_GarrisonHolder);
|    | [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
|1978|1978| 
|1979|1979| 				"Attacked": function(msg) {
|1980|1980| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|1981|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|1982|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |1981|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |1982|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|1983|1983| 						this.RespondToTargetedEntities([msg.data.attacker]);
|1984|1984| 				},
|1985|1985| 			},
|    | [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
|2706|2706| 					{
|2707|2707| 						// The building was already finished/fully repaired before we arrived;
|2708|2708| 						// let the ConstructionFinished handler handle this.
|2709|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2709|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2710|2710| 						return true;
|2711|2711| 					}
|2712|2712| 
|    | [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
|2706|2706| 					{
|2707|2707| 						// The building was already finished/fully repaired before we arrived;
|2708|2708| 						// let the ConstructionFinished handler handle this.
|2709|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2709|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2710|2710| 						return true;
|2711|2711| 					}
|2712|2712| 
|    | [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
|3217|3217| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3218|3218| 
|3219|3219| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3220|    |-							// only used for domestic animals
|    |3220|+		// only used for domestic animals
|3221|3221| 	},
|3222|3222| };
|3223|3223| 
|    | [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
|3274|3274| 
|3275|3275| UnitAI.prototype.IsAnimal = function()
|3276|3276| {
|3277|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3277|+	return (!!this.template.NaturalBehaviour);
|3278|3278| };
|3279|3279| 
|3280|3280| 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
|3390|3390| 		{
|3391|3391| 			let index = this.GetCurrentState().indexOf(".");
|3392|3392| 			if (index != -1)
|3393|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3393|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3394|3394| 			this.Stop(false);
|3395|3395| 		}
|3396|3396| 
|    | [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
|3446|3446| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3447|3447| 			continue;
|3448|3448| 		if (i == 0)
|3449|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3449|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3450|3450| 		else
|3451|3451| 			this.orderQueue.splice(i, 1);
|3452|3452| 		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
|3446|3446| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3447|3447| 			continue;
|3448|3448| 		if (i == 0)
|3449|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3449|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3450|3450| 		else
|3451|3451| 			this.orderQueue.splice(i, 1);
|3452|3452| 		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
|3530|3530| };
|3531|3531| 
|3532|3532| 
|3533|    |-//// FSM linkage functions ////
|    |3533|+// // FSM linkage functions ////
|3534|3534| 
|3535|3535| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3536|3536| 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
|3700|3700| 				continue;
|3701|3701| 			if (this.orderQueue[i].type == type)
|3702|3702| 				continue;
|3703|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3703|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3704|3704| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3705|3705| 			return;
|3706|3706| 		}
|    | [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
|3700|3700| 				continue;
|3701|3701| 			if (this.orderQueue[i].type == type)
|3702|3702| 				continue;
|3703|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3703|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3704|3704| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3705|3705| 			return;
|3706|3706| 		}
|    | [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| 	if (data.timerRepeat === undefined)
|3872|3872| 		this.timer = undefined;
|3873|3873| 
|3874|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3874|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3875|3875| };
|3876|3876| 
|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| 	if (data.timerRepeat === undefined)
|3872|3872| 		this.timer = undefined;
|3873|3873| 
|3874|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3874|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3875|3875| };
|3876|3876| 
|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
|3916|3916| 	// TODO: This is a bit inefficient since every unit listens to every
|3917|3917| 	// construction message - ideally we could scope it to only the one we're building
|3918|3918| 
|3919|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3919|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3920|3920| };
|3921|3921| 
|3922|3922| 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
|3916|3916| 	// TODO: This is a bit inefficient since every unit listens to every
|3917|3917| 	// construction message - ideally we could scope it to only the one we're building
|3918|3918| 
|3919|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3919|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3920|3920| };
|3921|3921| 
|3922|3922| 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
|3941|3941| 
|3942|3942| UnitAI.prototype.OnAttacked = function(msg)
|3943|3943| {
|3944|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3944|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3945|3945| };
|3946|3946| 
|3947|3947| 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
|3941|3941| 
|3942|3942| UnitAI.prototype.OnAttacked = function(msg)
|3943|3943| {
|3944|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3944|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3945|3945| };
|3946|3946| 
|3947|3947| 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
|3946|3946| 
|3947|3947| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3948|3948| {
|3949|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3949|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|3950|3950| };
|3951|3951| 
|3952|3952| 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
|3946|3946| 
|3947|3947| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3948|3948| {
|3949|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3949|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|3950|3950| };
|3951|3951| 
|3952|3952| 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
|3951|3951| 
|3952|3952| UnitAI.prototype.OnHealthChanged = function(msg)
|3953|3953| {
|3954|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3954|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|3955|3955| };
|3956|3956| 
|3957|3957| 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
|3951|3951| 
|3952|3952| UnitAI.prototype.OnHealthChanged = function(msg)
|3953|3953| {
|3954|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3954|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|3955|3955| };
|3956|3956| 
|3957|3957| 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
|3957|3957| UnitAI.prototype.OnRangeUpdate = function(msg)
|3958|3958| {
|3959|3959| 	if (msg.tag == this.losRangeQuery)
|3960|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3960|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|3961|3961| 	else if (msg.tag == this.losHealRangeQuery)
|3962|3962| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3963|3963| };
|    | [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
|3957|3957| UnitAI.prototype.OnRangeUpdate = function(msg)
|3958|3958| {
|3959|3959| 	if (msg.tag == this.losRangeQuery)
|3960|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3960|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|3961|3961| 	else if (msg.tag == this.losHealRangeQuery)
|3962|3962| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3963|3963| };
|    | [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
|3959|3959| 	if (msg.tag == this.losRangeQuery)
|3960|3960| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3961|3961| 	else if (msg.tag == this.losHealRangeQuery)
|3962|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3962|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|3963|3963| };
|3964|3964| 
|3965|3965| 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
|3959|3959| 	if (msg.tag == this.losRangeQuery)
|3960|3960| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3961|3961| 	else if (msg.tag == this.losHealRangeQuery)
|3962|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3962|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|3963|3963| };
|3964|3964| 
|3965|3965| 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
|3964|3964| 
|3965|3965| UnitAI.prototype.OnPackFinished = function(msg)
|3966|3966| {
|3967|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3967|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|3968|3968| };
|3969|3969| 
|3970|3970| //// 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
|3964|3964| 
|3965|3965| UnitAI.prototype.OnPackFinished = function(msg)
|3966|3966| {
|3967|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3967|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|3968|3968| };
|3969|3969| 
|3970|3970| //// 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
|3967|3967| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|3968|3968| };
|3969|3969| 
|3970|    |-//// Helper functions to be called by the FSM ////
|    |3970|+// // Helper functions to be called by the FSM ////
|3971|3971| 
|3972|3972| UnitAI.prototype.GetWalkSpeed = function()
|3973|3973| {
|    | [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
|4636|4636| UnitAI.prototype.AttackEntityInZone = function(ents)
|4637|4637| {
|4638|4638| 	var target = ents.find(target =>
|4639|    |-		this.CanAttack(target)
|4640|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4639|+		this.CanAttack(target) &&
|    |4640|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4641|4641| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4642|4642| 	);
|4643|4643| 	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
|4637|4637| {
|4638|4638| 	var target = ents.find(target =>
|4639|4639| 		this.CanAttack(target)
|4640|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4641|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4640|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4641|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4642|4642| 	);
|4643|4643| 	if (!target)
|4644|4644| 		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
|4701|4701| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4702|4702| 	if (this.isGuardOf)
|4703|4703| 	{
|4704|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4704|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4705|4705| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4706|4706| 		if (cmpUnitAI && cmpAttack &&
|4707|4707| 		    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
|4705|4705| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4706|4706| 		if (cmpUnitAI && cmpAttack &&
|4707|4707| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4708|    |-				return false;
|    |4708|+			return false;
|4709|4709| 	}
|4710|4710| 
|4711|4711| 	// 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
|4743|4743| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4744|4744| 	if (this.isGuardOf)
|4745|4745| 	{
|4746|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4746|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4747|4747| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4748|4748| 		if (cmpUnitAI && cmpAttack &&
|4749|4749| 		    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
|4756|4756| 	return false;
|4757|4757| };
|4758|4758| 
|4759|    |-//// External interface functions ////
|    |4759|+// // External interface functions ////
|4760|4760| 
|4761|4761| UnitAI.prototype.SetFormationController = function(ent)
|4762|4762| {
|    | [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
|4912|4912| 	{
|4913|4913| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4914|4914| 			return;
|4915|    |-		else
|4916|    |-			this.RemoveGuard();
|    |4915|+		this.RemoveGuard();
|4917|4916| 	}
|4918|4917| 
|4919|4918| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|    | [NORMAL] ESLintBear (no-trailing-spaces):
|    | Trailing spaces not allowed.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5243|5243| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5244|5244| 	{
|5245|5245| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5246|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5246|+		if (cmpTrader.HasBothMarkets() &&
|5247|5247| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5248|5248| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5249|5249| 		{
|    | [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
|5524|5524| 				{
|5525|5525| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5526|5526| 					var targetClasses = this.order.data.targetClasses;
|5527|    |-					if (targetClasses.attack && cmpIdentity
|5528|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5527|+					if (targetClasses.attack && cmpIdentity &&
|    |5528|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5529|5529| 						continue;
|5530|5530| 					if (targetClasses.avoid && cmpIdentity
|5531|5531| 						&& 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
|5527|5527| 					if (targetClasses.attack && cmpIdentity
|5528|5528| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5529|5529| 						continue;
|5530|    |-					if (targetClasses.avoid && cmpIdentity
|5531|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5530|+					if (targetClasses.avoid && cmpIdentity &&
|    |5531|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5532|5532| 						continue;
|5533|5533| 					// Only used by the AIs to prevent some choices of targets
|5534|5534| 					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
|5550|5550| 		{
|5551|5551| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5552|5552| 			var targetClasses = this.order.data.targetClasses;
|5553|    |-			if (cmpIdentity && targetClasses.attack
|5554|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5553|+			if (cmpIdentity && targetClasses.attack &&
|    |5554|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5555|5555| 				continue;
|5556|5556| 			if (cmpIdentity && targetClasses.avoid
|5557|5557| 				&& 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
|5553|5553| 			if (cmpIdentity && targetClasses.attack
|5554|5554| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5555|5555| 				continue;
|5556|    |-			if (cmpIdentity && targetClasses.avoid
|5557|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5556|+			if (cmpIdentity && targetClasses.avoid &&
|    |5557|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5558|5558| 				continue;
|5559|5559| 			// Only used by the AIs to prevent some choices of targets
|5560|5560| 			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
|5710|5710| 
|5711|5711| UnitAI.prototype.SetHeldPosition = function(x, z)
|5712|5712| {
|5713|    |-	this.heldPosition = {"x": x, "z": z};
|    |5713|+	this.heldPosition = { "x": x, "z": z};
|5714|5714| };
|5715|5715| 
|5716|5716| 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
|5710|5710| 
|5711|5711| UnitAI.prototype.SetHeldPosition = function(x, z)
|5712|5712| {
|5713|    |-	this.heldPosition = {"x": x, "z": z};
|    |5713|+	this.heldPosition = {"x": x, "z": z };
|5714|5714| };
|5715|5715| 
|5716|5716| 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
|5737|5737| 	return false;
|5738|5738| };
|5739|5739| 
|5740|    |-//// Helper functions ////
|    |5740|+// // Helper functions ////
|5741|5741| 
|5742|5742| UnitAI.prototype.CanAttack = function(target)
|5743|5743| {
|    | [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
|5941|5941| 	return cmpPack && cmpPack.IsPacking();
|5942|5942| };
|5943|5943| 
|5944|    |-//// Formation specific functions ////
|    |5944|+// // Formation specific functions ////
|5945|5945| 
|5946|5946| UnitAI.prototype.IsAttackingAsFormation = function()
|5947|5947| {
|    | [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
|5946|5946| UnitAI.prototype.IsAttackingAsFormation = function()
|5947|5947| {
|5948|5948| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5949|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5950|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5949|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5950|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5951|5951| };
|5952|5952| 
|5953|5953| //// 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
|5950|5950| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5951|5951| };
|5952|5952| 
|5953|    |-//// Animal specific functions ////
|    |5953|+// // Animal specific functions ////
|5954|5954| 
|5955|5955| UnitAI.prototype.MoveRandomly = function(distance)
|5956|5956| {

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

binaries/data/mods/public/simulation/components/UnitAI.js
| 916| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
| 941| »   »   »   "enter":·function(msg)·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

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

binaries/data/mods/public/simulation/components/UnitAI.js
|1054| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1090| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1122| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1282| »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1339| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1514| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1536| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1568| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1722| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1772| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1850| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2027| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2143| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2418| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2451| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2557| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2623| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2662| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2873| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|3052| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|3776| »   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
|4623| »   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
|4638| »   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
|4684| »   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
|4707| »   »   ····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
|1982| »   »   »   »   »   »   &&·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
|3738| »   »   var·order·=·{·"type":·type,·"data":·data·};
|    | [NORMAL] JSHintBear:
|    | 'order' is already defined.

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

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

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

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

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

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

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

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

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

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

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

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

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

elexis added a subscriber: elexis.Oct 17 2019, 2:14 PM

Transform.js has a cmpNewUnitAI.SetGarrisoned();, I suppose that should set it to false, not undefined.

An advantage of the patch is that the member is more uniformy set (only 1 way to set it, via the setter, not some calls that use the setter and some calls that assign the value directly).

I see 5 places in UnitAI.js that assign this.isGarrisoned, one of them init, one of them the setter, the other 3 are changed in this patch, so it's complete.

binaries/data/mods/public/simulation/components/GarrisonHolder.js
337

so that it cannot be forgotten when introducing new code or moving existing code

But moving SetGarrisoned out of Ungarrisoned allows to forget calling SetGarrisoned after calling unitAI.Ungarrison, no? (Disclaimer: I don't know what I'm talking about.)

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

Less function calls = more performance, and in this case the accessed variable is a property of the this instance, so the getter call doesnt seem necessary as long as the getter can be assumed to do nothing but return the member.

1600 units running one more function call = 1600 more function calls. (now imagine it does two nested iterations around the modified code and you get 160.000 new function calls with a one line difference if youre unlucky or didnt check/consider)

5131

The other places in which the member is set, the garrison function is performed immediately after.

Here it is a PushOrderFront, but it could also be that some code clears the order queue or does another PushOrderFront before this command is processed. In that case the unit would have the garrisoned state but not have been garrisoned, correct?
If so, then this change in this line would change the behavior to be less fragile / error prone.

Freagarach edited the summary of this revision. (Show Details)Oct 17 2019, 5:11 PM
Freagarach marked 2 inline comments as done.Oct 17 2019, 5:37 PM
Freagarach added inline comments.
binaries/data/mods/public/simulation/components/GarrisonHolder.js
337

UnitAI.Ungarrison() Does nothing but resetting orders (I plan to either remove that or make it useful, preferably the latter) if one would call ungarrison without calling the the garrisonHolder-code to perform the eject, the entity would still be garrisoned visually (or non-visibly) but won't have the garrison order anymore and, formerly, would be able to receive moving-orders.

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

Autogarrison Is called either from the ProductionQueue.js or from Transform.js. The former means no orders are present. The latter is called when the garrison holder transforms and thus the entities ought to take their orders with them when being put into the GARRISON-state.
The reason isGarrisoned is set here already is that there is a early return for garrisoned entities upon state entering.

Freagarach updated this revision to Diff 10169.Oct 17 2019, 5:38 PM
Freagarach marked an inline comment as done.
  • Some function calls to member calls in UnitAI.
  • Transform.js updated.

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

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

Freagarach edited the summary of this revision. (Show Details)Oct 17 2019, 5:41 PM

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

Linter detected issues:
Executing section Source...
Executing section JS...

binaries/data/mods/public/simulation/helpers/Transform.js
| 210| »   »   »   »   for·(let·ent·of·cmpNewObstruction.GetEntitiesDeletedUponConstruction())
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'ent' is already declared in the upper scope.
|    | [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
| 761| 761| 					this.FinishOrder();
| 762| 762| 					return;
| 763| 763| 				}
| 764|    |-				else
| 765|    |-				{
|    | 764|+				
| 766| 765| 					this.SetNextState("GARRISON.APPROACHING");
| 767| 766| 					return;
| 768|    |-				}
|    | 767|+				
| 769| 768| 			}
| 770| 769| 
| 771| 770| 			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
|1029|1029| 			},
|1030|1030| 		},
|1031|1031| 
|1032|    |-		"GARRISON":{
|    |1032|+		"GARRISON": {
|1033|1033| 			"enter": function() {
|1034|1034| 				// If the garrisonholder should pickup, warn it so it can take needed action
|1035|1035| 				var cmpGarrisonHolder = Engine.QueryInterface(this.order.data.target, IID_GarrisonHolder);
|    | [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
|1978|1978| 
|1979|1979| 				"Attacked": function(msg) {
|1980|1980| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|1981|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|1982|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |1981|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |1982|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|1983|1983| 						this.RespondToTargetedEntities([msg.data.attacker]);
|1984|1984| 				},
|1985|1985| 			},
|    | [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
|2706|2706| 					{
|2707|2707| 						// The building was already finished/fully repaired before we arrived;
|2708|2708| 						// let the ConstructionFinished handler handle this.
|2709|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2709|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2710|2710| 						return true;
|2711|2711| 					}
|2712|2712| 
|    | [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
|2706|2706| 					{
|2707|2707| 						// The building was already finished/fully repaired before we arrived;
|2708|2708| 						// let the ConstructionFinished handler handle this.
|2709|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2709|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2710|2710| 						return true;
|2711|2711| 					}
|2712|2712| 
|    | [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
|3217|3217| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3218|3218| 
|3219|3219| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3220|    |-							// only used for domestic animals
|    |3220|+		// only used for domestic animals
|3221|3221| 	},
|3222|3222| };
|3223|3223| 
|    | [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
|3274|3274| 
|3275|3275| UnitAI.prototype.IsAnimal = function()
|3276|3276| {
|3277|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3277|+	return (!!this.template.NaturalBehaviour);
|3278|3278| };
|3279|3279| 
|3280|3280| 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
|3398|3398| 		{
|3399|3399| 			let index = this.GetCurrentState().indexOf(".");
|3400|3400| 			if (index != -1)
|3401|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3401|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3402|3402| 			this.Stop(false);
|3403|3403| 		}
|3404|3404| 
|    | [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
|3454|3454| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3455|3455| 			continue;
|3456|3456| 		if (i == 0)
|3457|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3457|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3458|3458| 		else
|3459|3459| 			this.orderQueue.splice(i, 1);
|3460|3460| 		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
|3454|3454| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3455|3455| 			continue;
|3456|3456| 		if (i == 0)
|3457|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3457|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3458|3458| 		else
|3459|3459| 			this.orderQueue.splice(i, 1);
|3460|3460| 		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
|3538|3538| };
|3539|3539| 
|3540|3540| 
|3541|    |-//// FSM linkage functions ////
|    |3541|+// // FSM linkage functions ////
|3542|3542| 
|3543|3543| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3544|3544| 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
|3708|3708| 				continue;
|3709|3709| 			if (this.orderQueue[i].type == type)
|3710|3710| 				continue;
|3711|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3711|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3712|3712| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3713|3713| 			return;
|3714|3714| 		}
|    | [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
|3708|3708| 				continue;
|3709|3709| 			if (this.orderQueue[i].type == type)
|3710|3710| 				continue;
|3711|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3711|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3712|3712| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3713|3713| 			return;
|3714|3714| 		}
|    | [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
|3879|3879| 	if (data.timerRepeat === undefined)
|3880|3880| 		this.timer = undefined;
|3881|3881| 
|3882|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3882|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3883|3883| };
|3884|3884| 
|3885|3885| /**
|    | [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
|3879|3879| 	if (data.timerRepeat === undefined)
|3880|3880| 		this.timer = undefined;
|3881|3881| 
|3882|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3882|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3883|3883| };
|3884|3884| 
|3885|3885| /**
|    | [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
|3924|3924| 	// TODO: This is a bit inefficient since every unit listens to every
|3925|3925| 	// construction message - ideally we could scope it to only the one we're building
|3926|3926| 
|3927|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3927|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3928|3928| };
|3929|3929| 
|3930|3930| 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
|3924|3924| 	// TODO: This is a bit inefficient since every unit listens to every
|3925|3925| 	// construction message - ideally we could scope it to only the one we're building
|3926|3926| 
|3927|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3927|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3928|3928| };
|3929|3929| 
|3930|3930| 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
|3949|3949| 
|3950|3950| UnitAI.prototype.OnAttacked = function(msg)
|3951|3951| {
|3952|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3952|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3953|3953| };
|3954|3954| 
|3955|3955| 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
|3949|3949| 
|3950|3950| UnitAI.prototype.OnAttacked = function(msg)
|3951|3951| {
|3952|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3952|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3953|3953| };
|3954|3954| 
|3955|3955| 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
|3954|3954| 
|3955|3955| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3956|3956| {
|3957|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3957|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|3958|3958| };
|3959|3959| 
|3960|3960| 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
|3954|3954| 
|3955|3955| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3956|3956| {
|3957|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3957|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|3958|3958| };
|3959|3959| 
|3960|3960| 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
|3959|3959| 
|3960|3960| UnitAI.prototype.OnHealthChanged = function(msg)
|3961|3961| {
|3962|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3962|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|3963|3963| };
|3964|3964| 
|3965|3965| 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
|3959|3959| 
|3960|3960| UnitAI.prototype.OnHealthChanged = function(msg)
|3961|3961| {
|3962|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3962|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|3963|3963| };
|3964|3964| 
|3965|3965| 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
|3965|3965| UnitAI.prototype.OnRangeUpdate = function(msg)
|3966|3966| {
|3967|3967| 	if (msg.tag == this.losRangeQuery)
|3968|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3968|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|3969|3969| 	else if (msg.tag == this.losHealRangeQuery)
|3970|3970| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3971|3971| };
|    | [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
|3965|3965| UnitAI.prototype.OnRangeUpdate = function(msg)
|3966|3966| {
|3967|3967| 	if (msg.tag == this.losRangeQuery)
|3968|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3968|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|3969|3969| 	else if (msg.tag == this.losHealRangeQuery)
|3970|3970| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3971|3971| };
|    | [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
|3967|3967| 	if (msg.tag == this.losRangeQuery)
|3968|3968| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3969|3969| 	else if (msg.tag == this.losHealRangeQuery)
|3970|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3970|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|3971|3971| };
|3972|3972| 
|3973|3973| 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
|3967|3967| 	if (msg.tag == this.losRangeQuery)
|3968|3968| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3969|3969| 	else if (msg.tag == this.losHealRangeQuery)
|3970|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3970|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|3971|3971| };
|3972|3972| 
|3973|3973| 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
|3972|3972| 
|3973|3973| UnitAI.prototype.OnPackFinished = function(msg)
|3974|3974| {
|3975|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3975|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|3976|3976| };
|3977|3977| 
|3978|3978| //// 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
|3972|3972| 
|3973|3973| UnitAI.prototype.OnPackFinished = function(msg)
|3974|3974| {
|3975|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3975|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|3976|3976| };
|3977|3977| 
|3978|3978| //// 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
|3975|3975| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|3976|3976| };
|3977|3977| 
|3978|    |-//// Helper functions to be called by the FSM ////
|    |3978|+// // Helper functions to be called by the FSM ////
|3979|3979| 
|3980|3980| UnitAI.prototype.GetWalkSpeed = function()
|3981|3981| {
|    | [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
|4644|4644| UnitAI.prototype.AttackEntityInZone = function(ents)
|4645|4645| {
|4646|4646| 	var target = ents.find(target =>
|4647|    |-		this.CanAttack(target)
|4648|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4647|+		this.CanAttack(target) &&
|    |4648|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4649|4649| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4650|4650| 	);
|4651|4651| 	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
|4645|4645| {
|4646|4646| 	var target = ents.find(target =>
|4647|4647| 		this.CanAttack(target)
|4648|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4649|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4648|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4649|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4650|4650| 	);
|4651|4651| 	if (!target)
|4652|4652| 		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
|4709|4709| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4710|4710| 	if (this.isGuardOf)
|4711|4711| 	{
|4712|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4712|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4713|4713| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4714|4714| 		if (cmpUnitAI && cmpAttack &&
|4715|4715| 		    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
|4713|4713| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4714|4714| 		if (cmpUnitAI && cmpAttack &&
|4715|4715| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4716|    |-				return false;
|    |4716|+			return false;
|4717|4717| 	}
|4718|4718| 
|4719|4719| 	// 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
|4751|4751| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4752|4752| 	if (this.isGuardOf)
|4753|4753| 	{
|4754|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4754|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4755|4755| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4756|4756| 		if (cmpUnitAI && cmpAttack &&
|4757|4757| 		    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
|4764|4764| 	return false;
|4765|4765| };
|4766|4766| 
|4767|    |-//// External interface functions ////
|    |4767|+// // External interface functions ////
|4768|4768| 
|4769|4769| UnitAI.prototype.SetFormationController = function(ent)
|4770|4770| {
|    | [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
|4920|4920| 	{
|4921|4921| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4922|4922| 			return;
|4923|    |-		else
|4924|    |-			this.RemoveGuard();
|    |4923|+		this.RemoveGuard();
|4925|4924| 	}
|4926|4925| 
|4927|4926| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|    | [NORMAL] ESLintBear (no-trailing-spaces):
|    | Trailing spaces not allowed.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5251|5251| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5252|5252| 	{
|5253|5253| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5254|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5254|+		if (cmpTrader.HasBothMarkets() &&
|5255|5255| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5256|5256| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5257|5257| 		{
|    | [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
|5532|5532| 				{
|5533|5533| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5534|5534| 					var targetClasses = this.order.data.targetClasses;
|5535|    |-					if (targetClasses.attack && cmpIdentity
|5536|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5535|+					if (targetClasses.attack && cmpIdentity &&
|    |5536|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5537|5537| 						continue;
|5538|5538| 					if (targetClasses.avoid && cmpIdentity
|5539|5539| 						&& 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
|5535|5535| 					if (targetClasses.attack && cmpIdentity
|5536|5536| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5537|5537| 						continue;
|5538|    |-					if (targetClasses.avoid && cmpIdentity
|5539|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5538|+					if (targetClasses.avoid && cmpIdentity &&
|    |5539|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5540|5540| 						continue;
|5541|5541| 					// Only used by the AIs to prevent some choices of targets
|5542|5542| 					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
|5558|5558| 		{
|5559|5559| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5560|5560| 			var targetClasses = this.order.data.targetClasses;
|5561|    |-			if (cmpIdentity && targetClasses.attack
|5562|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5561|+			if (cmpIdentity && targetClasses.attack &&
|    |5562|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5563|5563| 				continue;
|5564|5564| 			if (cmpIdentity && targetClasses.avoid
|5565|5565| 				&& 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
|5561|5561| 			if (cmpIdentity && targetClasses.attack
|5562|5562| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5563|5563| 				continue;
|5564|    |-			if (cmpIdentity && targetClasses.avoid
|5565|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5564|+			if (cmpIdentity && targetClasses.avoid &&
|    |5565|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5566|5566| 				continue;
|5567|5567| 			// Only used by the AIs to prevent some choices of targets
|5568|5568| 			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
|5718|5718| 
|5719|5719| UnitAI.prototype.SetHeldPosition = function(x, z)
|5720|5720| {
|5721|    |-	this.heldPosition = {"x": x, "z": z};
|    |5721|+	this.heldPosition = { "x": x, "z": z};
|5722|5722| };
|5723|5723| 
|5724|5724| 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
|5718|5718| 
|5719|5719| UnitAI.prototype.SetHeldPosition = function(x, z)
|5720|5720| {
|5721|    |-	this.heldPosition = {"x": x, "z": z};
|    |5721|+	this.heldPosition = {"x": x, "z": z };
|5722|5722| };
|5723|5723| 
|5724|5724| 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
|5745|5745| 	return false;
|5746|5746| };
|5747|5747| 
|5748|    |-//// Helper functions ////
|    |5748|+// // Helper functions ////
|5749|5749| 
|5750|5750| UnitAI.prototype.CanAttack = function(target)
|5751|5751| {
|    | [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
|5949|5949| 	return cmpPack && cmpPack.IsPacking();
|5950|5950| };
|5951|5951| 
|5952|    |-//// Formation specific functions ////
|    |5952|+// // Formation specific functions ////
|5953|5953| 
|5954|5954| UnitAI.prototype.IsAttackingAsFormation = function()
|5955|5955| {
|    | [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
|5954|5954| UnitAI.prototype.IsAttackingAsFormation = function()
|5955|5955| {
|5956|5956| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5957|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5958|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5957|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5958|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5959|5959| };
|5960|5960| 
|5961|5961| //// 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
|5958|5958| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5959|5959| };
|5960|5960| 
|5961|    |-//// Animal specific functions ////
|    |5961|+// // Animal specific functions ////
|5962|5962| 
|5963|5963| UnitAI.prototype.MoveRandomly = function(distance)
|5964|5964| {

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

binaries/data/mods/public/simulation/components/UnitAI.js
| 916| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
| 941| »   »   »   "enter":·function(msg)·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

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

binaries/data/mods/public/simulation/components/UnitAI.js
|1054| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1090| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1122| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1282| »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1339| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1514| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1536| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1568| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1722| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1772| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1850| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2027| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2143| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2418| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2451| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2557| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2623| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2662| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2873| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|3052| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|3784| »   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
|4631| »   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
|4646| »   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
|4692| »   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
|4715| »   »   ····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
|1982| »   »   »   »   »   »   &&·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
|3746| »   »   var·order·=·{·"type":·type,·"data":·data·};
|    | [NORMAL] JSHintBear:
|    | 'order' is already defined.

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

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

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

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

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

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

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

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

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

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

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

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

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

Stan added a subscriber: Stan.Oct 17 2019, 5:47 PM
Stan added inline comments.
binaries/data/mods/public/simulation/components/GarrisonHolder.js
268

Not sure if that's in the scope of the patch, but there are quite a few calls to check whether one can garrison.

It seems weird to me that this.GetGarrisonedEntitiesCount() + extraCount >= this.GetCapacity() is not checked in the IsAllowedToGarrison function call.

Freagarach added inline comments.Oct 18 2019, 5:40 PM
binaries/data/mods/public/simulation/components/GarrisonHolder.js
268

The position check is moved in D2367, the extraCount should be moved in D2056.
Is that what you mean?

Stan added inline comments.Oct 18 2019, 7:45 PM
binaries/data/mods/public/simulation/components/GarrisonHolder.js
268

Yeah I actually thought this function was in another file ^^