Page MenuHomeWildfire Games

Allow for building-specific build/repair animations and use seeding animation for fields
Needs RevisionPublic

Authored by Imarok on Oct 7 2019, 3:55 PM.

Details

Reviewers
wraitii
Summary

Uses the build_farm seeding animation. Variant files and basket files by @Stan. The worker elephant for now builds a field with its usual build animation but without a timber in their trunk.

Test Plan

Try it out. Agree with the way the animation is switched between build and build_farm

Event Timeline

Imarok created this revision.Oct 7 2019, 3:55 PM
Owners added a subscriber: Restricted Owners Package.Oct 7 2019, 3:55 PM
elexis added a subscriber: elexis.Oct 7 2019, 4:08 PM
elexis added inline comments.
binaries/data/mods/public/simulation/components/UnitAI.js
2792

that requires all building units to have build_farm animation? (fallback to default)

building-specific build animations sound like a feature that could be implemented in the templates for arbitrary classes.

Perhaps the Repairable template could store the actor animation to be chosen? Sounds weird, and it also wouldnt allow chosing a different animation per unit.
Otherwise the Builder template might store a pairs of classes and animations to remove the hardcoding.

Vulcan added a comment.Oct 7 2019, 4:08 PM

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

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

Vulcan added a comment.Oct 7 2019, 4:22 PM

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 762| 762| 					this.FinishOrder();
| 763| 763| 					return;
| 764| 764| 				}
| 765|    |-				else
| 766|    |-				{
|    | 765|+				
| 767| 766| 					this.SetNextState("GARRISON.APPROACHING");
| 768| 767| 					return;
| 769|    |-				}
|    | 768|+				
| 770| 769| 			}
| 771| 770| 
| 772| 771| 			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
|1030|1030| 			},
|1031|1031| 		},
|1032|1032| 
|1033|    |-		"GARRISON":{
|    |1033|+		"GARRISON": {
|1034|1034| 			"enter": function() {
|1035|1035| 				// If the garrisonholder should pickup, warn it so it can take needed action
|1036|1036| 				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
|1979|1979| 
|1980|1980| 				"Attacked": function(msg) {
|1981|1981| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|1982|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|1983|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |1982|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |1983|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|1984|1984| 						this.RespondToTargetedEntities([msg.data.attacker]);
|1985|1985| 				},
|1986|1986| 			},
|    | [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
|2707|2707| 					{
|2708|2708| 						// The building was already finished/fully repaired before we arrived;
|2709|2709| 						// let the ConstructionFinished handler handle this.
|2710|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2710|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2711|2711| 						return true;
|2712|2712| 					}
|2713|2713| 
|    | [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
|2707|2707| 					{
|2708|2708| 						// The building was already finished/fully repaired before we arrived;
|2709|2709| 						// let the ConstructionFinished handler handle this.
|2710|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2710|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2711|2711| 						return true;
|2712|2712| 					}
|2713|2713| 
|    | [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
|3221|3221| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3222|3222| 
|3223|3223| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3224|    |-							// only used for domestic animals
|    |3224|+		// only used for domestic animals
|3225|3225| 	},
|3226|3226| };
|3227|3227| 
|    | [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
|3278|3278| 
|3279|3279| UnitAI.prototype.IsAnimal = function()
|3280|3280| {
|3281|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3281|+	return (!!this.template.NaturalBehaviour);
|3282|3282| };
|3283|3283| 
|3284|3284| 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
|3394|3394| 		{
|3395|3395| 			let index = this.GetCurrentState().indexOf(".");
|3396|3396| 			if (index != -1)
|3397|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3397|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3398|3398| 			this.Stop(false);
|3399|3399| 		}
|3400|3400| 
|    | [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
|3450|3450| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3451|3451| 			continue;
|3452|3452| 		if (i == 0)
|3453|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3453|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3454|3454| 		else
|3455|3455| 			this.orderQueue.splice(i, 1);
|3456|3456| 		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
|3450|3450| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3451|3451| 			continue;
|3452|3452| 		if (i == 0)
|3453|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3453|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3454|3454| 		else
|3455|3455| 			this.orderQueue.splice(i, 1);
|3456|3456| 		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
|3534|3534| };
|3535|3535| 
|3536|3536| 
|3537|    |-//// FSM linkage functions ////
|    |3537|+// // FSM linkage functions ////
|3538|3538| 
|3539|3539| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3540|3540| 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
|3704|3704| 				continue;
|3705|3705| 			if (this.orderQueue[i].type == type)
|3706|3706| 				continue;
|3707|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3707|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3708|3708| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3709|3709| 			return;
|3710|3710| 		}
|    | [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
|3704|3704| 				continue;
|3705|3705| 			if (this.orderQueue[i].type == type)
|3706|3706| 				continue;
|3707|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3707|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3708|3708| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3709|3709| 			return;
|3710|3710| 		}
|    | [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
|3875|3875| 	if (data.timerRepeat === undefined)
|3876|3876| 		this.timer = undefined;
|3877|3877| 
|3878|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3878|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3879|3879| };
|3880|3880| 
|3881|3881| /**
|    | [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
|3875|3875| 	if (data.timerRepeat === undefined)
|3876|3876| 		this.timer = undefined;
|3877|3877| 
|3878|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3878|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3879|3879| };
|3880|3880| 
|3881|3881| /**
|    | [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
|3920|3920| 	// TODO: This is a bit inefficient since every unit listens to every
|3921|3921| 	// construction message - ideally we could scope it to only the one we're building
|3922|3922| 
|3923|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3923|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3924|3924| };
|3925|3925| 
|3926|3926| 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
|3920|3920| 	// TODO: This is a bit inefficient since every unit listens to every
|3921|3921| 	// construction message - ideally we could scope it to only the one we're building
|3922|3922| 
|3923|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3923|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3924|3924| };
|3925|3925| 
|3926|3926| 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
|3945|3945| 
|3946|3946| UnitAI.prototype.OnAttacked = function(msg)
|3947|3947| {
|3948|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3948|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3949|3949| };
|3950|3950| 
|3951|3951| 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
|3945|3945| 
|3946|3946| UnitAI.prototype.OnAttacked = function(msg)
|3947|3947| {
|3948|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3948|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3949|3949| };
|3950|3950| 
|3951|3951| 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
|3950|3950| 
|3951|3951| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3952|3952| {
|3953|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3953|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|3954|3954| };
|3955|3955| 
|3956|3956| 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
|3950|3950| 
|3951|3951| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3952|3952| {
|3953|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3953|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|3954|3954| };
|3955|3955| 
|3956|3956| 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
|3955|3955| 
|3956|3956| UnitAI.prototype.OnHealthChanged = function(msg)
|3957|3957| {
|3958|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3958|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|3959|3959| };
|3960|3960| 
|3961|3961| 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
|3955|3955| 
|3956|3956| UnitAI.prototype.OnHealthChanged = function(msg)
|3957|3957| {
|3958|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3958|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|3959|3959| };
|3960|3960| 
|3961|3961| 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
|3961|3961| UnitAI.prototype.OnRangeUpdate = function(msg)
|3962|3962| {
|3963|3963| 	if (msg.tag == this.losRangeQuery)
|3964|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3964|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|3965|3965| 	else if (msg.tag == this.losHealRangeQuery)
|3966|3966| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3967|3967| };
|    | [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
|3961|3961| UnitAI.prototype.OnRangeUpdate = function(msg)
|3962|3962| {
|3963|3963| 	if (msg.tag == this.losRangeQuery)
|3964|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3964|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|3965|3965| 	else if (msg.tag == this.losHealRangeQuery)
|3966|3966| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3967|3967| };
|    | [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
|3963|3963| 	if (msg.tag == this.losRangeQuery)
|3964|3964| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3965|3965| 	else if (msg.tag == this.losHealRangeQuery)
|3966|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3966|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|3967|3967| };
|3968|3968| 
|3969|3969| 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
|3963|3963| 	if (msg.tag == this.losRangeQuery)
|3964|3964| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3965|3965| 	else if (msg.tag == this.losHealRangeQuery)
|3966|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3966|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|3967|3967| };
|3968|3968| 
|3969|3969| 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
|3968|3968| 
|3969|3969| UnitAI.prototype.OnPackFinished = function(msg)
|3970|3970| {
|3971|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3971|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|3972|3972| };
|3973|3973| 
|3974|3974| //// 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
|3968|3968| 
|3969|3969| UnitAI.prototype.OnPackFinished = function(msg)
|3970|3970| {
|3971|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3971|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|3972|3972| };
|3973|3973| 
|3974|3974| //// 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
|3971|3971| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|3972|3972| };
|3973|3973| 
|3974|    |-//// Helper functions to be called by the FSM ////
|    |3974|+// // Helper functions to be called by the FSM ////
|3975|3975| 
|3976|3976| UnitAI.prototype.GetWalkSpeed = function()
|3977|3977| {
|    | [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
|4640|4640| UnitAI.prototype.AttackEntityInZone = function(ents)
|4641|4641| {
|4642|4642| 	var target = ents.find(target =>
|4643|    |-		this.CanAttack(target)
|4644|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4643|+		this.CanAttack(target) &&
|    |4644|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4645|4645| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4646|4646| 	);
|4647|4647| 	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
|4641|4641| {
|4642|4642| 	var target = ents.find(target =>
|4643|4643| 		this.CanAttack(target)
|4644|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4645|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4644|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4645|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4646|4646| 	);
|4647|4647| 	if (!target)
|4648|4648| 		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
|4705|4705| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4706|4706| 	if (this.isGuardOf)
|4707|4707| 	{
|4708|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4708|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4709|4709| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4710|4710| 		if (cmpUnitAI && cmpAttack &&
|4711|4711| 		    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
|4709|4709| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4710|4710| 		if (cmpUnitAI && cmpAttack &&
|4711|4711| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4712|    |-				return false;
|    |4712|+			return false;
|4713|4713| 	}
|4714|4714| 
|4715|4715| 	// 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
|4747|4747| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4748|4748| 	if (this.isGuardOf)
|4749|4749| 	{
|4750|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4750|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4751|4751| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4752|4752| 		if (cmpUnitAI && cmpAttack &&
|4753|4753| 		    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
|4760|4760| 	return false;
|4761|4761| };
|4762|4762| 
|4763|    |-//// External interface functions ////
|    |4763|+// // External interface functions ////
|4764|4764| 
|4765|4765| UnitAI.prototype.SetFormationController = function(ent)
|4766|4766| {
|    | [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
|4916|4916| 	{
|4917|4917| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4918|4918| 			return;
|4919|    |-		else
|4920|    |-			this.RemoveGuard();
|    |4919|+		this.RemoveGuard();
|4921|4920| 	}
|4922|4921| 
|4923|4922| 	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
|5248|5248| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5249|5249| 	{
|5250|5250| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5251|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5251|+		if (cmpTrader.HasBothMarkets() &&
|5252|5252| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5253|5253| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5254|5254| 		{
|    | [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
|5529|5529| 				{
|5530|5530| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5531|5531| 					var targetClasses = this.order.data.targetClasses;
|5532|    |-					if (targetClasses.attack && cmpIdentity
|5533|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5532|+					if (targetClasses.attack && cmpIdentity &&
|    |5533|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5534|5534| 						continue;
|5535|5535| 					if (targetClasses.avoid && cmpIdentity
|5536|5536| 						&& 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
|5532|5532| 					if (targetClasses.attack && cmpIdentity
|5533|5533| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5534|5534| 						continue;
|5535|    |-					if (targetClasses.avoid && cmpIdentity
|5536|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5535|+					if (targetClasses.avoid && cmpIdentity &&
|    |5536|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5537|5537| 						continue;
|5538|5538| 					// Only used by the AIs to prevent some choices of targets
|5539|5539| 					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
|5555|5555| 		{
|5556|5556| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5557|5557| 			var targetClasses = this.order.data.targetClasses;
|5558|    |-			if (cmpIdentity && targetClasses.attack
|5559|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5558|+			if (cmpIdentity && targetClasses.attack &&
|    |5559|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5560|5560| 				continue;
|5561|5561| 			if (cmpIdentity && targetClasses.avoid
|5562|5562| 				&& 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
|5558|5558| 			if (cmpIdentity && targetClasses.attack
|5559|5559| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5560|5560| 				continue;
|5561|    |-			if (cmpIdentity && targetClasses.avoid
|5562|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5561|+			if (cmpIdentity && targetClasses.avoid &&
|    |5562|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5563|5563| 				continue;
|5564|5564| 			// Only used by the AIs to prevent some choices of targets
|5565|5565| 			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
|5715|5715| 
|5716|5716| UnitAI.prototype.SetHeldPosition = function(x, z)
|5717|5717| {
|5718|    |-	this.heldPosition = {"x": x, "z": z};
|    |5718|+	this.heldPosition = { "x": x, "z": z};
|5719|5719| };
|5720|5720| 
|5721|5721| 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
|5715|5715| 
|5716|5716| UnitAI.prototype.SetHeldPosition = function(x, z)
|5717|5717| {
|5718|    |-	this.heldPosition = {"x": x, "z": z};
|    |5718|+	this.heldPosition = {"x": x, "z": z };
|5719|5719| };
|5720|5720| 
|5721|5721| 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
|5742|5742| 	return false;
|5743|5743| };
|5744|5744| 
|5745|    |-//// Helper functions ////
|    |5745|+// // Helper functions ////
|5746|5746| 
|5747|5747| UnitAI.prototype.CanAttack = function(target)
|5748|5748| {
|    | [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
|5946|5946| 	return cmpPack && cmpPack.IsPacking();
|5947|5947| };
|5948|5948| 
|5949|    |-//// Formation specific functions ////
|    |5949|+// // Formation specific functions ////
|5950|5950| 
|5951|5951| UnitAI.prototype.IsAttackingAsFormation = function()
|5952|5952| {
|    | [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
|5951|5951| UnitAI.prototype.IsAttackingAsFormation = function()
|5952|5952| {
|5953|5953| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5954|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5955|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5954|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5955|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5956|5956| };
|5957|5957| 
|5958|5958| //// 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
|5955|5955| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5956|5956| };
|5957|5957| 
|5958|    |-//// Animal specific functions ////
|    |5958|+// // Animal specific functions ////
|5959|5959| 
|5960|5960| UnitAI.prototype.MoveRandomly = function(distance)
|5961|5961| {

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
| 917| »   »   »   "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
| 942| »   »   »   "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
| 992| »   »   »   »   »   return·true;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'enter' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
|1055| »   »   »   »   "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
|1091| »   »   »   "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
|1123| »   »   »   »   "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
|1283| »   »   "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
|1340| »   »   »   "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
|1515| »   »   »   "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
|1537| »   »   »   "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
|1569| »   »   »   "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
|1723| »   »   »   "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
|1773| »   »   »   »   "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
|1851| »   »   »   »   "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
|2028| »   »   »   »   "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
|2144| »   »   »   »   "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
|2419| »   »   »   »   "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
|2452| »   »   »   »   "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
|2558| »   »   »   »   "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
|2624| »   »   »   »   "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
|2663| »   »   »   »   "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
|2875| »   »   »   »   "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
|3056| »   »   »   »   "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
|3780| »   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
|4627| »   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
|4642| »   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
|4688| »   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
|4711| »   »   ····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
|1983| »   »   »   »   »   »   &&·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
|3742| »   »   var·order·=·{·"type":·type,·"data":·data·};
|    | [NORMAL] JSHintBear:
|    | 'order' is already defined.

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

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

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

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

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

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

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

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

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

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

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

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

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

Stan added inline comments.Oct 7 2019, 4:39 PM
binaries/data/mods/public/simulation/components/UnitAI.js
2792

Yes it does, else it would default to idle, which is not ideal.

Imarok added inline comments.Oct 15 2019, 2:51 PM
binaries/data/mods/public/simulation/components/UnitAI.js
2792

yes, which will be the case after this revision.
But let's don't overcomplicate it.

elexis added inline comments.Oct 15 2019, 3:05 PM
binaries/data/mods/public/simulation/components/UnitAI.js
2792

Complicating what exactly? The feature design or the code? Also
there is a difference between complicating it and overcomplicating it, the latter preconcludes.

Hardcoding template classes and template names is against the purpose of having template values in template files, not in the code.

If the feature you want is having a specific build animation for a specific building chosen by the game designer, then implementing it only for the Field = build_farm pair is undercomplicating it.

Just moving these two constants to template_unit.xml (or template_structure_resource_field.xml) should be achievable?

Stan added a comment.Oct 15 2019, 3:06 PM

That inline got me wondering, wouldn't a saner implementation be to specify the build animation and fallback in the cmpIdentity ?

In D2362#99185, @Stan wrote:

That inline got me wondering, wouldn't a saner implementation be to specify the build animation and fallback in the cmpIdentity ?

Yeah, I agree we should not hardcode it in the code. Any suggeestions on a format?

Stan added a comment.Feb 16 2020, 2:45 PM

Usually it's <variant>variantname</variant>

Imarok retitled this revision from Use seeding animation to Allow for building-specific build/repair animations and use seeding animation for fields.Feb 16 2020, 4:25 PM
Imarok updated this revision to Diff 11372.Feb 16 2020, 4:27 PM

Define the building-specific animation in the buildings template.

Imarok updated this revision to Diff 11374.Feb 16 2020, 4:33 PM

Indent with spaces in templates

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Identity.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Identity.js
| 187| 187| Identity.prototype.GetBuildVariant = function()
| 188| 188| {
| 189| 189| 	return this.template.BuildVariant || "";
| 190|    |-}
|    | 190|+};
| 191| 191| 
| 192| 192| Identity.prototype.IsUndeletable = function()
| 193| 193| {

binaries/data/mods/public/simulation/components/Identity.js
| 190| }
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 788| 788| 					this.FinishOrder();
| 789| 789| 					return;
| 790| 790| 				}
| 791|    |-				else
| 792|    |-				{
|    | 791|+				
| 793| 792| 					this.SetNextState("GARRISON.APPROACHING");
| 794| 793| 					return;
| 795|    |-				}
|    | 794|+				
| 796| 795| 			}
| 797| 796| 
| 798| 797| 			this.SetNextState("GARRISON.GARRISONING");
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'GARRISON'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1060|1060| 			},
|1061|1061| 		},
|1062|1062| 
|1063|    |-		"GARRISON":{
|    |1063|+		"GARRISON": {
|1064|1064| 			"APPROACHING": {
|1065|1065| 				"enter": function() {
|1066|1066| 					if (!this.MoveToGarrisonRange(this.order.data.target))
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2038|2038| 
|2039|2039| 				"Attacked": function(msg) {
|2040|2040| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2041|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2042|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2041|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2042|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2043|2043| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2044|2044| 				},
|2045|2045| 			},
|    | [NORMAL] ESLintBear (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
|2776|2776| 					{
|2777|2777| 						// The building was already finished/fully repaired before we arrived;
|2778|2778| 						// let the ConstructionFinished handler handle this.
|2779|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2779|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2780|2780| 						return true;
|2781|2781| 					}
|2782|2782| 
|    | [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
|2776|2776| 					{
|2777|2777| 						// The building was already finished/fully repaired before we arrived;
|2778|2778| 						// let the ConstructionFinished handler handle this.
|2779|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2779|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2780|2780| 						return true;
|2781|2781| 					}
|2782|2782| 
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3075|3075| 				this.StopTimer();
|3076|3076| 				this.ResetAnimation();
|3077|3077| 				if (this.formationAnimationVariant)
|3078|    |-					this.SetAnimationVariant(this.formationAnimationVariant)
|    |3078|+					this.SetAnimationVariant(this.formationAnimationVariant);
|3079|3079| 				else
|3080|3080| 					this.SetDefaultAnimationVariant();
|3081|3081| 				var cmpResistance = Engine.QueryInterface(this.entity, IID_Resistance);
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 7.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3301|3301| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3302|3302| 
|3303|3303| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3304|    |-							// only used for domestic animals
|    |3304|+		// only used for domestic animals
|3305|3305| 
|3306|3306| 		// Reuse the same garrison behaviour for animals.
|3307|3307| 		"GARRISON": "INDIVIDUAL.GARRISON",
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3363|3363| 
|3364|3364| UnitAI.prototype.IsAnimal = function()
|3365|3365| {
|3366|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3366|+	return (!!this.template.NaturalBehaviour);
|3367|3367| };
|3368|3368| 
|3369|3369| 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
|3479|3479| 		{
|3480|3480| 			let index = this.GetCurrentState().indexOf(".");
|3481|3481| 			if (index != -1)
|3482|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3482|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3483|3483| 			this.Stop(false);
|3484|3484| 		}
|3485|3485| 
|    | [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
|3535|3535| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3536|3536| 			continue;
|3537|3537| 		if (i == 0)
|3538|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3538|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3539|3539| 		else
|3540|3540| 			this.orderQueue.splice(i, 1);
|3541|3541| 		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
|3535|3535| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3536|3536| 			continue;
|3537|3537| 		if (i == 0)
|3538|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3538|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3539|3539| 		else
|3540|3540| 			this.orderQueue.splice(i, 1);
|3541|3541| 		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
|3622|3622| };
|3623|3623| 
|3624|3624| 
|3625|    |-//// FSM linkage functions ////
|    |3625|+// // FSM linkage functions ////
|3626|3626| 
|3627|3627| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3628|3628| 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
|3793|3793| 				continue;
|3794|3794| 			if (this.orderQueue[i].type == type)
|3795|3795| 				continue;
|3796|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3796|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3797|3797| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3798|3798| 			return;
|3799|3799| 		}
|    | [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
|3793|3793| 				continue;
|3794|3794| 			if (this.orderQueue[i].type == type)
|3795|3795| 				continue;
|3796|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3796|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3797|3797| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3798|3798| 			return;
|3799|3799| 		}
|    | [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
|4035|4035| 	if (data.timerRepeat === undefined)
|4036|4036| 		this.timer = undefined;
|4037|4037| 
|4038|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4038|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4039|4039| };
|4040|4040| 
|4041|4041| /**
|    | [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
|4035|4035| 	if (data.timerRepeat === undefined)
|4036|4036| 		this.timer = undefined;
|4037|4037| 
|4038|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4038|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4039|4039| };
|4040|4040| 
|4041|4041| /**
|    | [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
|4080|4080| 	// TODO: This is a bit inefficient since every unit listens to every
|4081|4081| 	// construction message - ideally we could scope it to only the one we're building
|4082|4082| 
|4083|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4083|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4084|4084| };
|4085|4085| 
|4086|4086| 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
|4080|4080| 	// TODO: This is a bit inefficient since every unit listens to every
|4081|4081| 	// construction message - ideally we could scope it to only the one we're building
|4082|4082| 
|4083|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4083|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4084|4084| };
|4085|4085| 
|4086|4086| 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
|4111|4111| 	if (msg.fromStatusEffect)
|4112|4112| 		return;
|4113|4113| 
|4114|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4114|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4115|4115| };
|4116|4116| 
|4117|4117| 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
|4111|4111| 	if (msg.fromStatusEffect)
|4112|4112| 		return;
|4113|4113| 
|4114|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4114|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4115|4115| };
|4116|4116| 
|4117|4117| 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
|4116|4116| 
|4117|4117| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4118|4118| {
|4119|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4119|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4120|4120| };
|4121|4121| 
|4122|4122| 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
|4116|4116| 
|4117|4117| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4118|4118| {
|4119|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4119|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4120|4120| };
|4121|4121| 
|4122|4122| 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
|4121|4121| 
|4122|4122| UnitAI.prototype.OnHealthChanged = function(msg)
|4123|4123| {
|4124|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4124|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4125|4125| };
|4126|4126| 
|4127|4127| 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
|4121|4121| 
|4122|4122| UnitAI.prototype.OnHealthChanged = function(msg)
|4123|4123| {
|4124|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4124|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4125|4125| };
|4126|4126| 
|4127|4127| 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
|4127|4127| UnitAI.prototype.OnRangeUpdate = function(msg)
|4128|4128| {
|4129|4129| 	if (msg.tag == this.losRangeQuery)
|4130|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4130|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4131|4131| 	else if (msg.tag == this.losHealRangeQuery)
|4132|4132| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4133|4133| };
|    | [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
|4127|4127| UnitAI.prototype.OnRangeUpdate = function(msg)
|4128|4128| {
|4129|4129| 	if (msg.tag == this.losRangeQuery)
|4130|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4130|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4131|4131| 	else if (msg.tag == this.losHealRangeQuery)
|4132|4132| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4133|4133| };
|    | [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
|4129|4129| 	if (msg.tag == this.losRangeQuery)
|4130|4130| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4131|4131| 	else if (msg.tag == this.losHealRangeQuery)
|4132|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4132|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4133|4133| };
|4134|4134| 
|4135|4135| 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
|4129|4129| 	if (msg.tag == this.losRangeQuery)
|4130|4130| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4131|4131| 	else if (msg.tag == this.losHealRangeQuery)
|4132|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4132|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4133|4133| };
|4134|4134| 
|4135|4135| 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
|4134|4134| 
|4135|4135| UnitAI.prototype.OnPackFinished = function(msg)
|4136|4136| {
|4137|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4137|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4138|4138| };
|4139|4139| 
|4140|4140| //// 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
|4134|4134| 
|4135|4135| UnitAI.prototype.OnPackFinished = function(msg)
|4136|4136| {
|4137|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4137|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4138|4138| };
|4139|4139| 
|4140|4140| //// 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
|4137|4137| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4138|4138| };
|4139|4139| 
|4140|    |-//// Helper functions to be called by the FSM ////
|    |4140|+// // Helper functions to be called by the FSM ////
|4141|4141| 
|4142|4142| UnitAI.prototype.GetWalkSpeed = function()
|4143|4143| {
|    | [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
|4803|4803| UnitAI.prototype.AttackEntityInZone = function(ents)
|4804|4804| {
|4805|4805| 	var target = ents.find(target =>
|4806|    |-		this.CanAttack(target)
|4807|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4806|+		this.CanAttack(target) &&
|    |4807|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4808|4808| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4809|4809| 	);
|4810|4810| 	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
|4804|4804| {
|4805|4805| 	var target = ents.find(target =>
|4806|4806| 		this.CanAttack(target)
|4807|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4808|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4807|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4808|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4809|4809| 	);
|4810|4810| 	if (!target)
|4811|4811| 		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
|4868|4868| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4869|4869| 	if (this.isGuardOf)
|4870|4870| 	{
|4871|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4871|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4872|4872| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4873|4873| 		if (cmpUnitAI && cmpAttack &&
|4874|4874| 		    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
|4872|4872| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4873|4873| 		if (cmpUnitAI && cmpAttack &&
|4874|4874| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4875|    |-				return false;
|    |4875|+			return false;
|4876|4876| 	}
|4877|4877| 
|4878|4878| 	// 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
|4910|4910| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4911|4911| 	if (this.isGuardOf)
|4912|4912| 	{
|4913|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4913|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4914|4914| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4915|4915| 		if (cmpUnitAI && cmpAttack &&
|4916|4916| 		    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
|4923|4923| 	return false;
|4924|4924| };
|4925|4925| 
|4926|    |-//// External interface functions ////
|    |4926|+// // External interface functions ////
|4927|4927| 
|4928|4928| UnitAI.prototype.SetFormationController = function(ent)
|4929|4929| {
|    | [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
|5079|5079| 	{
|5080|5080| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5081|5081| 			return;
|5082|    |-		else
|5083|    |-			this.RemoveGuard();
|    |5082|+		this.RemoveGuard();
|5084|5083| 	}
|5085|5084| 
|5086|5085| 	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
|5421|5421| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5422|5422| 	{
|5423|5423| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5424|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5424|+		if (cmpTrader.HasBothMarkets() &&
|5425|5425| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5426|5426| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5427|5427| 		{
|    | [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
|5702|5702| 				{
|5703|5703| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5704|5704| 					var targetClasses = this.order.data.targetClasses;
|5705|    |-					if (targetClasses.attack && cmpIdentity
|5706|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5705|+					if (targetClasses.attack && cmpIdentity &&
|    |5706|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5707|5707| 						continue;
|5708|5708| 					if (targetClasses.avoid && cmpIdentity
|5709|5709| 						&& 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
|5705|5705| 					if (targetClasses.attack && cmpIdentity
|5706|5706| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5707|5707| 						continue;
|5708|    |-					if (targetClasses.avoid && cmpIdentity
|5709|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5708|+					if (targetClasses.avoid && cmpIdentity &&
|    |5709|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5710|5710| 						continue;
|5711|5711| 					// Only used by the AIs to prevent some choices of targets
|5712|5712| 					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
|5728|5728| 		{
|5729|5729| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5730|5730| 			var targetClasses = this.order.data.targetClasses;
|5731|    |-			if (cmpIdentity && targetClasses.attack
|5732|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5731|+			if (cmpIdentity && targetClasses.attack &&
|    |5732|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5733|5733| 				continue;
|5734|5734| 			if (cmpIdentity && targetClasses.avoid
|5735|5735| 				&& 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
|5731|5731| 			if (cmpIdentity && targetClasses.attack
|5732|5732| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5733|5733| 				continue;
|5734|    |-			if (cmpIdentity && targetClasses.avoid
|5735|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5734|+			if (cmpIdentity && targetClasses.avoid &&
|    |5735|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5736|5736| 				continue;
|5737|5737| 			// Only used by the AIs to prevent some choices of targets
|5738|5738| 			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
|5874|5874| 
|5875|5875| UnitAI.prototype.SetHeldPosition = function(x, z)
|5876|5876| {
|5877|    |-	this.heldPosition = {"x": x, "z": z};
|    |5877|+	this.heldPosition = { "x": x, "z": z};
|5878|5878| };
|5879|5879| 
|5880|5880| 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
|5874|5874| 
|5875|5875| UnitAI.prototype.SetHeldPosition = function(x, z)
|5876|5876| {
|5877|    |-	this.heldPosition = {"x": x, "z": z};
|    |5877|+	this.heldPosition = {"x": x, "z": z };
|5878|5878| };
|5879|5879| 
|5880|5880| 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
|5901|5901| 	return false;
|5902|5902| };
|5903|5903| 
|5904|    |-//// Helper functions ////
|    |5904|+// // Helper functions ////
|5905|5905| 
|5906|5906| /**
|5907|5907|  * General getter for ranges.
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5920|5920| 		return undefined;
|5921|5921| 
|5922|5922| 	return component.GetRange(type);
|5923|    |-}
|    |5923|+};
|5924|5924| 
|5925|5925| UnitAI.prototype.CanAttack = function(target)
|5926|5926| {
|    | [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
|6118|6118| 	return cmpPack && cmpPack.IsPacking();
|6119|6119| };
|6120|6120| 
|6121|    |-//// Formation specific functions ////
|    |6121|+// // Formation specific functions ////
|6122|6122| 
|6123|6123| UnitAI.prototype.IsAttackingAsFormation = function()
|6124|6124| {
|    | [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
|6123|6123| UnitAI.prototype.IsAttackingAsFormation = function()
|6124|6124| {
|6125|6125| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6126|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6127|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6126|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6127|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6128|6128| };
|6129|6129| 
|6130|6130| //// 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
|6127|6127| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6128|6128| };
|6129|6129| 
|6130|    |-//// Animal specific functions ////
|    |6130|+// // Animal specific functions ////
|6131|6131| 
|6132|6132| UnitAI.prototype.MoveRandomly = function(distance)
|6133|6133| {

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Identity.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Identity.js
| 187| 187| Identity.prototype.GetBuildVariant = function()
| 188| 188| {
| 189| 189| 	return this.template.BuildVariant || "";
| 190|    |-}
|    | 190|+};
| 191| 191| 
| 192| 192| Identity.prototype.IsUndeletable = function()
| 193| 193| {

binaries/data/mods/public/simulation/components/Identity.js
| 190| }
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 788| 788| 					this.FinishOrder();
| 789| 789| 					return;
| 790| 790| 				}
| 791|    |-				else
| 792|    |-				{
|    | 791|+				
| 793| 792| 					this.SetNextState("GARRISON.APPROACHING");
| 794| 793| 					return;
| 795|    |-				}
|    | 794|+				
| 796| 795| 			}
| 797| 796| 
| 798| 797| 			this.SetNextState("GARRISON.GARRISONING");
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'GARRISON'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1060|1060| 			},
|1061|1061| 		},
|1062|1062| 
|1063|    |-		"GARRISON":{
|    |1063|+		"GARRISON": {
|1064|1064| 			"APPROACHING": {
|1065|1065| 				"enter": function() {
|1066|1066| 					if (!this.MoveToGarrisonRange(this.order.data.target))
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2038|2038| 
|2039|2039| 				"Attacked": function(msg) {
|2040|2040| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2041|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2042|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2041|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2042|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2043|2043| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2044|2044| 				},
|2045|2045| 			},
|    | [NORMAL] ESLintBear (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
|2776|2776| 					{
|2777|2777| 						// The building was already finished/fully repaired before we arrived;
|2778|2778| 						// let the ConstructionFinished handler handle this.
|2779|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2779|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2780|2780| 						return true;
|2781|2781| 					}
|2782|2782| 
|    | [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
|2776|2776| 					{
|2777|2777| 						// The building was already finished/fully repaired before we arrived;
|2778|2778| 						// let the ConstructionFinished handler handle this.
|2779|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2779|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2780|2780| 						return true;
|2781|2781| 					}
|2782|2782| 
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3075|3075| 				this.StopTimer();
|3076|3076| 				this.ResetAnimation();
|3077|3077| 				if (this.formationAnimationVariant)
|3078|    |-					this.SetAnimationVariant(this.formationAnimationVariant)
|    |3078|+					this.SetAnimationVariant(this.formationAnimationVariant);
|3079|3079| 				else
|3080|3080| 					this.SetDefaultAnimationVariant();
|3081|3081| 				var cmpResistance = Engine.QueryInterface(this.entity, IID_Resistance);
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 7.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3301|3301| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3302|3302| 
|3303|3303| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3304|    |-							// only used for domestic animals
|    |3304|+		// only used for domestic animals
|3305|3305| 
|3306|3306| 		// Reuse the same garrison behaviour for animals.
|3307|3307| 		"GARRISON": "INDIVIDUAL.GARRISON",
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3363|3363| 
|3364|3364| UnitAI.prototype.IsAnimal = function()
|3365|3365| {
|3366|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3366|+	return (!!this.template.NaturalBehaviour);
|3367|3367| };
|3368|3368| 
|3369|3369| 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
|3479|3479| 		{
|3480|3480| 			let index = this.GetCurrentState().indexOf(".");
|3481|3481| 			if (index != -1)
|3482|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3482|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3483|3483| 			this.Stop(false);
|3484|3484| 		}
|3485|3485| 
|    | [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
|3535|3535| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3536|3536| 			continue;
|3537|3537| 		if (i == 0)
|3538|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3538|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3539|3539| 		else
|3540|3540| 			this.orderQueue.splice(i, 1);
|3541|3541| 		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
|3535|3535| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3536|3536| 			continue;
|3537|3537| 		if (i == 0)
|3538|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3538|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3539|3539| 		else
|3540|3540| 			this.orderQueue.splice(i, 1);
|3541|3541| 		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
|3622|3622| };
|3623|3623| 
|3624|3624| 
|3625|    |-//// FSM linkage functions ////
|    |3625|+// // FSM linkage functions ////
|3626|3626| 
|3627|3627| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3628|3628| 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
|3793|3793| 				continue;
|3794|3794| 			if (this.orderQueue[i].type == type)
|3795|3795| 				continue;
|3796|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3796|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3797|3797| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3798|3798| 			return;
|3799|3799| 		}
|    | [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
|3793|3793| 				continue;
|3794|3794| 			if (this.orderQueue[i].type == type)
|3795|3795| 				continue;
|3796|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3796|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3797|3797| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3798|3798| 			return;
|3799|3799| 		}
|    | [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
|4035|4035| 	if (data.timerRepeat === undefined)
|4036|4036| 		this.timer = undefined;
|4037|4037| 
|4038|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4038|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4039|4039| };
|4040|4040| 
|4041|4041| /**
|    | [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
|4035|4035| 	if (data.timerRepeat === undefined)
|4036|4036| 		this.timer = undefined;
|4037|4037| 
|4038|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4038|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4039|4039| };
|4040|4040| 
|4041|4041| /**
|    | [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
|4080|4080| 	// TODO: This is a bit inefficient since every unit listens to every
|4081|4081| 	// construction message - ideally we could scope it to only the one we're building
|4082|4082| 
|4083|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4083|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4084|4084| };
|4085|4085| 
|4086|4086| 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
|4080|4080| 	// TODO: This is a bit inefficient since every unit listens to every
|4081|4081| 	// construction message - ideally we could scope it to only the one we're building
|4082|4082| 
|4083|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4083|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4084|4084| };
|4085|4085| 
|4086|4086| 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
|4111|4111| 	if (msg.fromStatusEffect)
|4112|4112| 		return;
|4113|4113| 
|4114|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4114|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4115|4115| };
|4116|4116| 
|4117|4117| 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
|4111|4111| 	if (msg.fromStatusEffect)
|4112|4112| 		return;
|4113|4113| 
|4114|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4114|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4115|4115| };
|4116|4116| 
|4117|4117| 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
|4116|4116| 
|4117|4117| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4118|4118| {
|4119|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4119|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4120|4120| };
|4121|4121| 
|4122|4122| 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
|4116|4116| 
|4117|4117| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4118|4118| {
|4119|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4119|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4120|4120| };
|4121|4121| 
|4122|4122| 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
|4121|4121| 
|4122|4122| UnitAI.prototype.OnHealthChanged = function(msg)
|4123|4123| {
|4124|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4124|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4125|4125| };
|4126|4126| 
|4127|4127| 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
|4121|4121| 
|4122|4122| UnitAI.prototype.OnHealthChanged = function(msg)
|4123|4123| {
|4124|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4124|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4125|4125| };
|4126|4126| 
|4127|4127| 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
|4127|4127| UnitAI.prototype.OnRangeUpdate = function(msg)
|4128|4128| {
|4129|4129| 	if (msg.tag == this.losRangeQuery)
|4130|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4130|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4131|4131| 	else if (msg.tag == this.losHealRangeQuery)
|4132|4132| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4133|4133| };
|    | [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
|4127|4127| UnitAI.prototype.OnRangeUpdate = function(msg)
|4128|4128| {
|4129|4129| 	if (msg.tag == this.losRangeQuery)
|4130|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4130|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4131|4131| 	else if (msg.tag == this.losHealRangeQuery)
|4132|4132| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4133|4133| };
|    | [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
|4129|4129| 	if (msg.tag == this.losRangeQuery)
|4130|4130| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4131|4131| 	else if (msg.tag == this.losHealRangeQuery)
|4132|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4132|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4133|4133| };
|4134|4134| 
|4135|4135| 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
|4129|4129| 	if (msg.tag == this.losRangeQuery)
|4130|4130| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4131|4131| 	else if (msg.tag == this.losHealRangeQuery)
|4132|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4132|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4133|4133| };
|4134|4134| 
|4135|4135| 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
|4134|4134| 
|4135|4135| UnitAI.prototype.OnPackFinished = function(msg)
|4136|4136| {
|4137|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4137|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4138|4138| };
|4139|4139| 
|4140|4140| //// 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
|4134|4134| 
|4135|4135| UnitAI.prototype.OnPackFinished = function(msg)
|4136|4136| {
|4137|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4137|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4138|4138| };
|4139|4139| 
|4140|4140| //// 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
|4137|4137| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4138|4138| };
|4139|4139| 
|4140|    |-//// Helper functions to be called by the FSM ////
|    |4140|+// // Helper functions to be called by the FSM ////
|4141|4141| 
|4142|4142| UnitAI.prototype.GetWalkSpeed = function()
|4143|4143| {
|    | [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
|4803|4803| UnitAI.prototype.AttackEntityInZone = function(ents)
|4804|4804| {
|4805|4805| 	var target = ents.find(target =>
|4806|    |-		this.CanAttack(target)
|4807|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4806|+		this.CanAttack(target) &&
|    |4807|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4808|4808| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4809|4809| 	);
|4810|4810| 	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
|4804|4804| {
|4805|4805| 	var target = ents.find(target =>
|4806|4806| 		this.CanAttack(target)
|4807|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4808|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4807|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4808|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4809|4809| 	);
|4810|4810| 	if (!target)
|4811|4811| 		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
|4868|4868| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4869|4869| 	if (this.isGuardOf)
|4870|4870| 	{
|4871|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4871|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4872|4872| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4873|4873| 		if (cmpUnitAI && cmpAttack &&
|4874|4874| 		    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
|4872|4872| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4873|4873| 		if (cmpUnitAI && cmpAttack &&
|4874|4874| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4875|    |-				return false;
|    |4875|+			return false;
|4876|4876| 	}
|4877|4877| 
|4878|4878| 	// 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
|4910|4910| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4911|4911| 	if (this.isGuardOf)
|4912|4912| 	{
|4913|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4913|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4914|4914| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4915|4915| 		if (cmpUnitAI && cmpAttack &&
|4916|4916| 		    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
|4923|4923| 	return false;
|4924|4924| };
|4925|4925| 
|4926|    |-//// External interface functions ////
|    |4926|+// // External interface functions ////
|4927|4927| 
|4928|4928| UnitAI.prototype.SetFormationController = function(ent)
|4929|4929| {
|    | [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
|5079|5079| 	{
|5080|5080| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5081|5081| 			return;
|5082|    |-		else
|5083|    |-			this.RemoveGuard();
|    |5082|+		this.RemoveGuard();
|5084|5083| 	}
|5085|5084| 
|5086|5085| 	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
|5421|5421| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5422|5422| 	{
|5423|5423| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5424|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5424|+		if (cmpTrader.HasBothMarkets() &&
|5425|5425| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5426|5426| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5427|5427| 		{
|    | [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
|5702|5702| 				{
|5703|5703| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5704|5704| 					var targetClasses = this.order.data.targetClasses;
|5705|    |-					if (targetClasses.attack && cmpIdentity
|5706|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5705|+					if (targetClasses.attack && cmpIdentity &&
|    |5706|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5707|5707| 						continue;
|5708|5708| 					if (targetClasses.avoid && cmpIdentity
|5709|5709| 						&& 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
|5705|5705| 					if (targetClasses.attack && cmpIdentity
|5706|5706| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5707|5707| 						continue;
|5708|    |-					if (targetClasses.avoid && cmpIdentity
|5709|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5708|+					if (targetClasses.avoid && cmpIdentity &&
|    |5709|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5710|5710| 						continue;
|5711|5711| 					// Only used by the AIs to prevent some choices of targets
|5712|5712| 					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
|5728|5728| 		{
|5729|5729| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5730|5730| 			var targetClasses = this.order.data.targetClasses;
|5731|    |-			if (cmpIdentity && targetClasses.attack
|5732|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5731|+			if (cmpIdentity && targetClasses.attack &&
|    |5732|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5733|5733| 				continue;
|5734|5734| 			if (cmpIdentity && targetClasses.avoid
|5735|5735| 				&& 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
|5731|5731| 			if (cmpIdentity && targetClasses.attack
|5732|5732| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5733|5733| 				continue;
|5734|    |-			if (cmpIdentity && targetClasses.avoid
|5735|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5734|+			if (cmpIdentity && targetClasses.avoid &&
|    |5735|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5736|5736| 				continue;
|5737|5737| 			// Only used by the AIs to prevent some choices of targets
|5738|5738| 			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
|5874|5874| 
|5875|5875| UnitAI.prototype.SetHeldPosition = function(x, z)
|5876|5876| {
|5877|    |-	this.heldPosition = {"x": x, "z": z};
|    |5877|+	this.heldPosition = { "x": x, "z": z};
|5878|5878| };
|5879|5879| 
|5880|5880| 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
|5874|5874| 
|5875|5875| UnitAI.prototype.SetHeldPosition = function(x, z)
|5876|5876| {
|5877|    |-	this.heldPosition = {"x": x, "z": z};
|    |5877|+	this.heldPosition = {"x": x, "z": z };
|5878|5878| };
|5879|5879| 
|5880|5880| 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
|5901|5901| 	return false;
|5902|5902| };
|5903|5903| 
|5904|    |-//// Helper functions ////
|    |5904|+// // Helper functions ////
|5905|5905| 
|5906|5906| /**
|5907|5907|  * General getter for ranges.
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5920|5920| 		return undefined;
|5921|5921| 
|5922|5922| 	return component.GetRange(type);
|5923|    |-}
|    |5923|+};
|5924|5924| 
|5925|5925| UnitAI.prototype.CanAttack = function(target)
|5926|5926| {
|    | [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
|6118|6118| 	return cmpPack && cmpPack.IsPacking();
|6119|6119| };
|6120|6120| 
|6121|    |-//// Formation specific functions ////
|    |6121|+// // Formation specific functions ////
|6122|6122| 
|6123|6123| UnitAI.prototype.IsAttackingAsFormation = function()
|6124|6124| {
|    | [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
|6123|6123| UnitAI.prototype.IsAttackingAsFormation = function()
|6124|6124| {
|6125|6125| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6126|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6127|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6126|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6127|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6128|6128| };
|6129|6129| 
|6130|6130| //// 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
|6127|6127| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6128|6128| };
|6129|6129| 
|6130|    |-//// Animal specific functions ////
|    |6130|+// // Animal specific functions ////
|6131|6131| 
|6132|6132| UnitAI.prototype.MoveRandomly = function(distance)
|6133|6133| {

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

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

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

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

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

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

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

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

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

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

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

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

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

Stan added inline comments.Feb 16 2020, 6:40 PM
binaries/data/mods/public/simulation/components/Identity.js
94 ↗(On Diff #11374)

I guess we could create a ticket to add the possibility to set the repairing variant. In this case it works because you "seed" to "build" a farm, and "reseed" to "repair" it.

189 ↗(On Diff #11374)

Why not set "build" here?

Silier added a subscriber: Silier.Feb 17 2020, 8:28 AM
Silier added inline comments.
binaries/data/mods/public/art/variants/biped/female_build_farm.xml
9

do not hide helmet in case women would have some hats

Imarok updated this revision to Diff 11383.Feb 17 2020, 6:26 PM
Imarok marked 3 inline comments as done.

Show helmets for women. Default to build

binaries/data/mods/public/art/variants/biped/female_build_farm.xml
9

Good catch.

binaries/data/mods/public/simulation/components/Identity.js
94 ↗(On Diff #11374)

Nope. The simulation knows no build command. Everything is repair. If you order a unit to build a House you first place the foundation and then the unit repairs the foundation.

189 ↗(On Diff #11374)

hmm, yeah makes sense. But I still can't remove the "build" in unitAI then. (There might be a entity without cmpIdentity)

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Identity.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Identity.js
| 187| 187| Identity.prototype.GetBuildVariant = function()
| 188| 188| {
| 189| 189| 	return this.template.BuildVariant || "build";
| 190|    |-}
|    | 190|+};
| 191| 191| 
| 192| 192| Identity.prototype.IsUndeletable = function()
| 193| 193| {

binaries/data/mods/public/simulation/components/Identity.js
| 190| }
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 788| 788| 					this.FinishOrder();
| 789| 789| 					return;
| 790| 790| 				}
| 791|    |-				else
| 792|    |-				{
|    | 791|+				
| 793| 792| 					this.SetNextState("GARRISON.APPROACHING");
| 794| 793| 					return;
| 795|    |-				}
|    | 794|+				
| 796| 795| 			}
| 797| 796| 
| 798| 797| 			this.SetNextState("GARRISON.GARRISONING");
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'GARRISON'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1060|1060| 			},
|1061|1061| 		},
|1062|1062| 
|1063|    |-		"GARRISON":{
|    |1063|+		"GARRISON": {
|1064|1064| 			"APPROACHING": {
|1065|1065| 				"enter": function() {
|1066|1066| 					if (!this.MoveToGarrisonRange(this.order.data.target))
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2038|2038| 
|2039|2039| 				"Attacked": function(msg) {
|2040|2040| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2041|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2042|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2041|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2042|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2043|2043| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2044|2044| 				},
|2045|2045| 			},
|    | [NORMAL] ESLintBear (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
|2776|2776| 					{
|2777|2777| 						// The building was already finished/fully repaired before we arrived;
|2778|2778| 						// let the ConstructionFinished handler handle this.
|2779|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2779|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2780|2780| 						return true;
|2781|2781| 					}
|2782|2782| 
|    | [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
|2776|2776| 					{
|2777|2777| 						// The building was already finished/fully repaired before we arrived;
|2778|2778| 						// let the ConstructionFinished handler handle this.
|2779|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2779|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2780|2780| 						return true;
|2781|2781| 					}
|2782|2782| 
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3075|3075| 				this.StopTimer();
|3076|3076| 				this.ResetAnimation();
|3077|3077| 				if (this.formationAnimationVariant)
|3078|    |-					this.SetAnimationVariant(this.formationAnimationVariant)
|    |3078|+					this.SetAnimationVariant(this.formationAnimationVariant);
|3079|3079| 				else
|3080|3080| 					this.SetDefaultAnimationVariant();
|3081|3081| 				var cmpResistance = Engine.QueryInterface(this.entity, IID_Resistance);
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 7.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3301|3301| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3302|3302| 
|3303|3303| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3304|    |-							// only used for domestic animals
|    |3304|+		// only used for domestic animals
|3305|3305| 
|3306|3306| 		// Reuse the same garrison behaviour for animals.
|3307|3307| 		"GARRISON": "INDIVIDUAL.GARRISON",
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3363|3363| 
|3364|3364| UnitAI.prototype.IsAnimal = function()
|3365|3365| {
|3366|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3366|+	return (!!this.template.NaturalBehaviour);
|3367|3367| };
|3368|3368| 
|3369|3369| 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
|3479|3479| 		{
|3480|3480| 			let index = this.GetCurrentState().indexOf(".");
|3481|3481| 			if (index != -1)
|3482|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3482|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3483|3483| 			this.Stop(false);
|3484|3484| 		}
|3485|3485| 
|    | [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
|3535|3535| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3536|3536| 			continue;
|3537|3537| 		if (i == 0)
|3538|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3538|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3539|3539| 		else
|3540|3540| 			this.orderQueue.splice(i, 1);
|3541|3541| 		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
|3535|3535| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3536|3536| 			continue;
|3537|3537| 		if (i == 0)
|3538|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3538|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3539|3539| 		else
|3540|3540| 			this.orderQueue.splice(i, 1);
|3541|3541| 		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
|3622|3622| };
|3623|3623| 
|3624|3624| 
|3625|    |-//// FSM linkage functions ////
|    |3625|+// // FSM linkage functions ////
|3626|3626| 
|3627|3627| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3628|3628| 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
|3793|3793| 				continue;
|3794|3794| 			if (this.orderQueue[i].type == type)
|3795|3795| 				continue;
|3796|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3796|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3797|3797| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3798|3798| 			return;
|3799|3799| 		}
|    | [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
|3793|3793| 				continue;
|3794|3794| 			if (this.orderQueue[i].type == type)
|3795|3795| 				continue;
|3796|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3796|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3797|3797| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3798|3798| 			return;
|3799|3799| 		}
|    | [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
|4035|4035| 	if (data.timerRepeat === undefined)
|4036|4036| 		this.timer = undefined;
|4037|4037| 
|4038|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4038|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4039|4039| };
|4040|4040| 
|4041|4041| /**
|    | [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
|4035|4035| 	if (data.timerRepeat === undefined)
|4036|4036| 		this.timer = undefined;
|4037|4037| 
|4038|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4038|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4039|4039| };
|4040|4040| 
|4041|4041| /**
|    | [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
|4080|4080| 	// TODO: This is a bit inefficient since every unit listens to every
|4081|4081| 	// construction message - ideally we could scope it to only the one we're building
|4082|4082| 
|4083|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4083|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4084|4084| };
|4085|4085| 
|4086|4086| 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
|4080|4080| 	// TODO: This is a bit inefficient since every unit listens to every
|4081|4081| 	// construction message - ideally we could scope it to only the one we're building
|4082|4082| 
|4083|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4083|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4084|4084| };
|4085|4085| 
|4086|4086| 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
|4111|4111| 	if (msg.fromStatusEffect)
|4112|4112| 		return;
|4113|4113| 
|4114|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4114|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4115|4115| };
|4116|4116| 
|4117|4117| 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
|4111|4111| 	if (msg.fromStatusEffect)
|4112|4112| 		return;
|4113|4113| 
|4114|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4114|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4115|4115| };
|4116|4116| 
|4117|4117| 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
|4116|4116| 
|4117|4117| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4118|4118| {
|4119|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4119|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4120|4120| };
|4121|4121| 
|4122|4122| 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
|4116|4116| 
|4117|4117| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4118|4118| {
|4119|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4119|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4120|4120| };
|4121|4121| 
|4122|4122| 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
|4121|4121| 
|4122|4122| UnitAI.prototype.OnHealthChanged = function(msg)
|4123|4123| {
|4124|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4124|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4125|4125| };
|4126|4126| 
|4127|4127| 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
|4121|4121| 
|4122|4122| UnitAI.prototype.OnHealthChanged = function(msg)
|4123|4123| {
|4124|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4124|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4125|4125| };
|4126|4126| 
|4127|4127| 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
|4127|4127| UnitAI.prototype.OnRangeUpdate = function(msg)
|4128|4128| {
|4129|4129| 	if (msg.tag == this.losRangeQuery)
|4130|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4130|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4131|4131| 	else if (msg.tag == this.losHealRangeQuery)
|4132|4132| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4133|4133| };
|    | [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
|4127|4127| UnitAI.prototype.OnRangeUpdate = function(msg)
|4128|4128| {
|4129|4129| 	if (msg.tag == this.losRangeQuery)
|4130|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4130|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4131|4131| 	else if (msg.tag == this.losHealRangeQuery)
|4132|4132| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4133|4133| };
|    | [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
|4129|4129| 	if (msg.tag == this.losRangeQuery)
|4130|4130| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4131|4131| 	else if (msg.tag == this.losHealRangeQuery)
|4132|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4132|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4133|4133| };
|4134|4134| 
|4135|4135| 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
|4129|4129| 	if (msg.tag == this.losRangeQuery)
|4130|4130| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4131|4131| 	else if (msg.tag == this.losHealRangeQuery)
|4132|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4132|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4133|4133| };
|4134|4134| 
|4135|4135| 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
|4134|4134| 
|4135|4135| UnitAI.prototype.OnPackFinished = function(msg)
|4136|4136| {
|4137|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4137|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4138|4138| };
|4139|4139| 
|4140|4140| //// 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
|4134|4134| 
|4135|4135| UnitAI.prototype.OnPackFinished = function(msg)
|4136|4136| {
|4137|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4137|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4138|4138| };
|4139|4139| 
|4140|4140| //// 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
|4137|4137| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4138|4138| };
|4139|4139| 
|4140|    |-//// Helper functions to be called by the FSM ////
|    |4140|+// // Helper functions to be called by the FSM ////
|4141|4141| 
|4142|4142| UnitAI.prototype.GetWalkSpeed = function()
|4143|4143| {
|    | [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
|4803|4803| UnitAI.prototype.AttackEntityInZone = function(ents)
|4804|4804| {
|4805|4805| 	var target = ents.find(target =>
|4806|    |-		this.CanAttack(target)
|4807|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4806|+		this.CanAttack(target) &&
|    |4807|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4808|4808| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4809|4809| 	);
|4810|4810| 	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
|4804|4804| {
|4805|4805| 	var target = ents.find(target =>
|4806|4806| 		this.CanAttack(target)
|4807|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4808|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4807|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4808|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4809|4809| 	);
|4810|4810| 	if (!target)
|4811|4811| 		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
|4868|4868| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4869|4869| 	if (this.isGuardOf)
|4870|4870| 	{
|4871|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4871|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4872|4872| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4873|4873| 		if (cmpUnitAI && cmpAttack &&
|4874|4874| 		    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
|4872|4872| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4873|4873| 		if (cmpUnitAI && cmpAttack &&
|4874|4874| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4875|    |-				return false;
|    |4875|+			return false;
|4876|4876| 	}
|4877|4877| 
|4878|4878| 	// 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
|4910|4910| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4911|4911| 	if (this.isGuardOf)
|4912|4912| 	{
|4913|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4913|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4914|4914| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4915|4915| 		if (cmpUnitAI && cmpAttack &&
|4916|4916| 		    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
|4923|4923| 	return false;
|4924|4924| };
|4925|4925| 
|4926|    |-//// External interface functions ////
|    |4926|+// // External interface functions ////
|4927|4927| 
|4928|4928| UnitAI.prototype.SetFormationController = function(ent)
|4929|4929| {
|    | [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
|5079|5079| 	{
|5080|5080| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5081|5081| 			return;
|5082|    |-		else
|5083|    |-			this.RemoveGuard();
|    |5082|+		this.RemoveGuard();
|5084|5083| 	}
|5085|5084| 
|5086|5085| 	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
|5421|5421| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5422|5422| 	{
|5423|5423| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5424|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5424|+		if (cmpTrader.HasBothMarkets() &&
|5425|5425| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5426|5426| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5427|5427| 		{
|    | [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
|5702|5702| 				{
|5703|5703| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5704|5704| 					var targetClasses = this.order.data.targetClasses;
|5705|    |-					if (targetClasses.attack && cmpIdentity
|5706|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5705|+					if (targetClasses.attack && cmpIdentity &&
|    |5706|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5707|5707| 						continue;
|5708|5708| 					if (targetClasses.avoid && cmpIdentity
|5709|5709| 						&& 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
|5705|5705| 					if (targetClasses.attack && cmpIdentity
|5706|5706| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5707|5707| 						continue;
|5708|    |-					if (targetClasses.avoid && cmpIdentity
|5709|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5708|+					if (targetClasses.avoid && cmpIdentity &&
|    |5709|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5710|5710| 						continue;
|5711|5711| 					// Only used by the AIs to prevent some choices of targets
|5712|5712| 					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
|5728|5728| 		{
|5729|5729| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5730|5730| 			var targetClasses = this.order.data.targetClasses;
|5731|    |-			if (cmpIdentity && targetClasses.attack
|5732|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5731|+			if (cmpIdentity && targetClasses.attack &&
|    |5732|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5733|5733| 				continue;
|5734|5734| 			if (cmpIdentity && targetClasses.avoid
|5735|5735| 				&& 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
|5731|5731| 			if (cmpIdentity && targetClasses.attack
|5732|5732| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5733|5733| 				continue;
|5734|    |-			if (cmpIdentity && targetClasses.avoid
|5735|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5734|+			if (cmpIdentity && targetClasses.avoid &&
|    |5735|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5736|5736| 				continue;
|5737|5737| 			// Only used by the AIs to prevent some choices of targets
|5738|5738| 			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
|5874|5874| 
|5875|5875| UnitAI.prototype.SetHeldPosition = function(x, z)
|5876|5876| {
|5877|    |-	this.heldPosition = {"x": x, "z": z};
|    |5877|+	this.heldPosition = { "x": x, "z": z};
|5878|5878| };
|5879|5879| 
|5880|5880| 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
|5874|5874| 
|5875|5875| UnitAI.prototype.SetHeldPosition = function(x, z)
|5876|5876| {
|5877|    |-	this.heldPosition = {"x": x, "z": z};
|    |5877|+	this.heldPosition = {"x": x, "z": z };
|5878|5878| };
|5879|5879| 
|5880|5880| 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
|5901|5901| 	return false;
|5902|5902| };
|5903|5903| 
|5904|    |-//// Helper functions ////
|    |5904|+// // Helper functions ////
|5905|5905| 
|5906|5906| /**
|5907|5907|  * General getter for ranges.
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5920|5920| 		return undefined;
|5921|5921| 
|5922|5922| 	return component.GetRange(type);
|5923|    |-}
|    |5923|+};
|5924|5924| 
|5925|5925| UnitAI.prototype.CanAttack = function(target)
|5926|5926| {
|    | [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
|6118|6118| 	return cmpPack && cmpPack.IsPacking();
|6119|6119| };
|6120|6120| 
|6121|    |-//// Formation specific functions ////
|    |6121|+// // Formation specific functions ////
|6122|6122| 
|6123|6123| UnitAI.prototype.IsAttackingAsFormation = function()
|6124|6124| {
|    | [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
|6123|6123| UnitAI.prototype.IsAttackingAsFormation = function()
|6124|6124| {
|6125|6125| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6126|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6127|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6126|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6127|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6128|6128| };
|6129|6129| 
|6130|6130| //// 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
|6127|6127| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6128|6128| };
|6129|6129| 
|6130|    |-//// Animal specific functions ////
|    |6130|+// // Animal specific functions ////
|6131|6131| 
|6132|6132| UnitAI.prototype.MoveRandomly = function(distance)
|6133|6133| {

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

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

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

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

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

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

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

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

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

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

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

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

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

Stan added a comment.Feb 17 2020, 8:36 PM

Looking good to me apart from the indentation.

binaries/data/mods/public/simulation/components/Identity.js
94 ↗(On Diff #11374)

Ah that sucks.

binaries/data/mods/public/simulation/templates/template_structure_resource_field.xml
30

I guess tabs?

Imarok added inline comments.Feb 18 2020, 9:40 PM
binaries/data/mods/public/simulation/components/Identity.js
190 ↗(On Diff #11383)

semi

Freagarach added inline comments.
binaries/data/mods/public/art/meshes/props/tool_seeding_basket.dae
6

Nice name ;) For my information, do these names ought to be correct?

Stan added inline comments.Feb 18 2020, 10:19 PM
binaries/data/mods/public/art/meshes/props/tool_seeding_basket.dae
6

They could but they do not. There used to be an option in blender to set them properly (Search for my name you'll see) but there is no longer one in 2.8+

Imarok added inline comments.Feb 19 2020, 6:48 AM
binaries/data/mods/public/art/meshes/props/tool_seeding_basket.dae
6

That's Stans undercover name. Don't tell anyone. ;)

Imarok updated this revision to Diff 11415.Feb 23 2020, 5:36 PM
Imarok marked 3 inline comments as done.

Fix small style issues

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 788| 788| 					this.FinishOrder();
| 789| 789| 					return;
| 790| 790| 				}
| 791|    |-				else
| 792|    |-				{
|    | 791|+				
| 793| 792| 					this.SetNextState("GARRISON.APPROACHING");
| 794| 793| 					return;
| 795|    |-				}
|    | 794|+				
| 796| 795| 			}
| 797| 796| 
| 798| 797| 			this.SetNextState("GARRISON.GARRISONING");
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'GARRISON'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1060|1060| 			},
|1061|1061| 		},
|1062|1062| 
|1063|    |-		"GARRISON":{
|    |1063|+		"GARRISON": {
|1064|1064| 			"APPROACHING": {
|1065|1065| 				"enter": function() {
|1066|1066| 					if (!this.MoveToGarrisonRange(this.order.data.target))
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2038|2038| 
|2039|2039| 				"Attacked": function(msg) {
|2040|2040| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2041|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2042|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2041|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2042|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2043|2043| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2044|2044| 				},
|2045|2045| 			},
|    | [NORMAL] ESLintBear (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
|2776|2776| 					{
|2777|2777| 						// The building was already finished/fully repaired before we arrived;
|2778|2778| 						// let the ConstructionFinished handler handle this.
|2779|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2779|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2780|2780| 						return true;
|2781|2781| 					}
|2782|2782| 
|    | [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
|2776|2776| 					{
|2777|2777| 						// The building was already finished/fully repaired before we arrived;
|2778|2778| 						// let the ConstructionFinished handler handle this.
|2779|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2779|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2780|2780| 						return true;
|2781|2781| 					}
|2782|2782| 
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3075|3075| 				this.StopTimer();
|3076|3076| 				this.ResetAnimation();
|3077|3077| 				if (this.formationAnimationVariant)
|3078|    |-					this.SetAnimationVariant(this.formationAnimationVariant)
|    |3078|+					this.SetAnimationVariant(this.formationAnimationVariant);
|3079|3079| 				else
|3080|3080| 					this.SetDefaultAnimationVariant();
|3081|3081| 				var cmpResistance = Engine.QueryInterface(this.entity, IID_Resistance);
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 7.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3301|3301| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3302|3302| 
|3303|3303| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3304|    |-							// only used for domestic animals
|    |3304|+		// only used for domestic animals
|3305|3305| 
|3306|3306| 		// Reuse the same garrison behaviour for animals.
|3307|3307| 		"GARRISON": "INDIVIDUAL.GARRISON",
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3363|3363| 
|3364|3364| UnitAI.prototype.IsAnimal = function()
|3365|3365| {
|3366|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3366|+	return (!!this.template.NaturalBehaviour);
|3367|3367| };
|3368|3368| 
|3369|3369| 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
|3479|3479| 		{
|3480|3480| 			let index = this.GetCurrentState().indexOf(".");
|3481|3481| 			if (index != -1)
|3482|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3482|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3483|3483| 			this.Stop(false);
|3484|3484| 		}
|3485|3485| 
|    | [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
|3535|3535| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3536|3536| 			continue;
|3537|3537| 		if (i == 0)
|3538|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3538|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3539|3539| 		else
|3540|3540| 			this.orderQueue.splice(i, 1);
|3541|3541| 		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
|3535|3535| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3536|3536| 			continue;
|3537|3537| 		if (i == 0)
|3538|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3538|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3539|3539| 		else
|3540|3540| 			this.orderQueue.splice(i, 1);
|3541|3541| 		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
|3622|3622| };
|3623|3623| 
|3624|3624| 
|3625|    |-//// FSM linkage functions ////
|    |3625|+// // FSM linkage functions ////
|3626|3626| 
|3627|3627| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3628|3628| 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
|3793|3793| 				continue;
|3794|3794| 			if (this.orderQueue[i].type == type)
|3795|3795| 				continue;
|3796|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3796|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3797|3797| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3798|3798| 			return;
|3799|3799| 		}
|    | [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
|3793|3793| 				continue;
|3794|3794| 			if (this.orderQueue[i].type == type)
|3795|3795| 				continue;
|3796|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3796|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3797|3797| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3798|3798| 			return;
|3799|3799| 		}
|    | [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
|4035|4035| 	if (data.timerRepeat === undefined)
|4036|4036| 		this.timer = undefined;
|4037|4037| 
|4038|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4038|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4039|4039| };
|4040|4040| 
|4041|4041| /**
|    | [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
|4035|4035| 	if (data.timerRepeat === undefined)
|4036|4036| 		this.timer = undefined;
|4037|4037| 
|4038|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4038|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4039|4039| };
|4040|4040| 
|4041|4041| /**
|    | [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
|4080|4080| 	// TODO: This is a bit inefficient since every unit listens to every
|4081|4081| 	// construction message - ideally we could scope it to only the one we're building
|4082|4082| 
|4083|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4083|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4084|4084| };
|4085|4085| 
|4086|4086| 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
|4080|4080| 	// TODO: This is a bit inefficient since every unit listens to every
|4081|4081| 	// construction message - ideally we could scope it to only the one we're building
|4082|4082| 
|4083|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4083|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4084|4084| };
|4085|4085| 
|4086|4086| 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
|4111|4111| 	if (msg.fromStatusEffect)
|4112|4112| 		return;
|4113|4113| 
|4114|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4114|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4115|4115| };
|4116|4116| 
|4117|4117| 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
|4111|4111| 	if (msg.fromStatusEffect)
|4112|4112| 		return;
|4113|4113| 
|4114|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4114|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4115|4115| };
|4116|4116| 
|4117|4117| 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
|4116|4116| 
|4117|4117| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4118|4118| {
|4119|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4119|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4120|4120| };
|4121|4121| 
|4122|4122| 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
|4116|4116| 
|4117|4117| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4118|4118| {
|4119|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4119|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4120|4120| };
|4121|4121| 
|4122|4122| 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
|4121|4121| 
|4122|4122| UnitAI.prototype.OnHealthChanged = function(msg)
|4123|4123| {
|4124|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4124|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4125|4125| };
|4126|4126| 
|4127|4127| 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
|4121|4121| 
|4122|4122| UnitAI.prototype.OnHealthChanged = function(msg)
|4123|4123| {
|4124|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4124|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4125|4125| };
|4126|4126| 
|4127|4127| 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
|4127|4127| UnitAI.prototype.OnRangeUpdate = function(msg)
|4128|4128| {
|4129|4129| 	if (msg.tag == this.losRangeQuery)
|4130|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4130|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4131|4131| 	else if (msg.tag == this.losHealRangeQuery)
|4132|4132| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4133|4133| };
|    | [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
|4127|4127| UnitAI.prototype.OnRangeUpdate = function(msg)
|4128|4128| {
|4129|4129| 	if (msg.tag == this.losRangeQuery)
|4130|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4130|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4131|4131| 	else if (msg.tag == this.losHealRangeQuery)
|4132|4132| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4133|4133| };
|    | [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
|4129|4129| 	if (msg.tag == this.losRangeQuery)
|4130|4130| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4131|4131| 	else if (msg.tag == this.losHealRangeQuery)
|4132|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4132|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4133|4133| };
|4134|4134| 
|4135|4135| 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
|4129|4129| 	if (msg.tag == this.losRangeQuery)
|4130|4130| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4131|4131| 	else if (msg.tag == this.losHealRangeQuery)
|4132|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4132|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4133|4133| };
|4134|4134| 
|4135|4135| 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
|4134|4134| 
|4135|4135| UnitAI.prototype.OnPackFinished = function(msg)
|4136|4136| {
|4137|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4137|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4138|4138| };
|4139|4139| 
|4140|4140| //// 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
|4134|4134| 
|4135|4135| UnitAI.prototype.OnPackFinished = function(msg)
|4136|4136| {
|4137|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4137|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4138|4138| };
|4139|4139| 
|4140|4140| //// 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
|4137|4137| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4138|4138| };
|4139|4139| 
|4140|    |-//// Helper functions to be called by the FSM ////
|    |4140|+// // Helper functions to be called by the FSM ////
|4141|4141| 
|4142|4142| UnitAI.prototype.GetWalkSpeed = function()
|4143|4143| {
|    | [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
|4803|4803| UnitAI.prototype.AttackEntityInZone = function(ents)
|4804|4804| {
|4805|4805| 	var target = ents.find(target =>
|4806|    |-		this.CanAttack(target)
|4807|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4806|+		this.CanAttack(target) &&
|    |4807|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4808|4808| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4809|4809| 	);
|4810|4810| 	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
|4804|4804| {
|4805|4805| 	var target = ents.find(target =>
|4806|4806| 		this.CanAttack(target)
|4807|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4808|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4807|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4808|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4809|4809| 	);
|4810|4810| 	if (!target)
|4811|4811| 		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
|4868|4868| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4869|4869| 	if (this.isGuardOf)
|4870|4870| 	{
|4871|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4871|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4872|4872| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4873|4873| 		if (cmpUnitAI && cmpAttack &&
|4874|4874| 		    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
|4872|4872| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4873|4873| 		if (cmpUnitAI && cmpAttack &&
|4874|4874| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4875|    |-				return false;
|    |4875|+			return false;
|4876|4876| 	}
|4877|4877| 
|4878|4878| 	// 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
|4910|4910| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4911|4911| 	if (this.isGuardOf)
|4912|4912| 	{
|4913|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4913|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4914|4914| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4915|4915| 		if (cmpUnitAI && cmpAttack &&
|4916|4916| 		    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
|4923|4923| 	return false;
|4924|4924| };
|4925|4925| 
|4926|    |-//// External interface functions ////
|    |4926|+// // External interface functions ////
|4927|4927| 
|4928|4928| UnitAI.prototype.SetFormationController = function(ent)
|4929|4929| {
|    | [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
|5079|5079| 	{
|5080|5080| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5081|5081| 			return;
|5082|    |-		else
|5083|    |-			this.RemoveGuard();
|    |5082|+		this.RemoveGuard();
|5084|5083| 	}
|5085|5084| 
|5086|5085| 	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
|5421|5421| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5422|5422| 	{
|5423|5423| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5424|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5424|+		if (cmpTrader.HasBothMarkets() &&
|5425|5425| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5426|5426| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5427|5427| 		{
|    | [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
|5702|5702| 				{
|5703|5703| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5704|5704| 					var targetClasses = this.order.data.targetClasses;
|5705|    |-					if (targetClasses.attack && cmpIdentity
|5706|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5705|+					if (targetClasses.attack && cmpIdentity &&
|    |5706|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5707|5707| 						continue;
|5708|5708| 					if (targetClasses.avoid && cmpIdentity
|5709|5709| 						&& 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
|5705|5705| 					if (targetClasses.attack && cmpIdentity
|5706|5706| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5707|5707| 						continue;
|5708|    |-					if (targetClasses.avoid && cmpIdentity
|5709|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5708|+					if (targetClasses.avoid && cmpIdentity &&
|    |5709|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5710|5710| 						continue;
|5711|5711| 					// Only used by the AIs to prevent some choices of targets
|5712|5712| 					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
|5728|5728| 		{
|5729|5729| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5730|5730| 			var targetClasses = this.order.data.targetClasses;
|5731|    |-			if (cmpIdentity && targetClasses.attack
|5732|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5731|+			if (cmpIdentity && targetClasses.attack &&
|    |5732|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5733|5733| 				continue;
|5734|5734| 			if (cmpIdentity && targetClasses.avoid
|5735|5735| 				&& 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
|5731|5731| 			if (cmpIdentity && targetClasses.attack
|5732|5732| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5733|5733| 				continue;
|5734|    |-			if (cmpIdentity && targetClasses.avoid
|5735|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5734|+			if (cmpIdentity && targetClasses.avoid &&
|    |5735|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5736|5736| 				continue;
|5737|5737| 			// Only used by the AIs to prevent some choices of targets
|5738|5738| 			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
|5874|5874| 
|5875|5875| UnitAI.prototype.SetHeldPosition = function(x, z)
|5876|5876| {
|5877|    |-	this.heldPosition = {"x": x, "z": z};
|    |5877|+	this.heldPosition = { "x": x, "z": z};
|5878|5878| };
|5879|5879| 
|5880|5880| 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
|5874|5874| 
|5875|5875| UnitAI.prototype.SetHeldPosition = function(x, z)
|5876|5876| {
|5877|    |-	this.heldPosition = {"x": x, "z": z};
|    |5877|+	this.heldPosition = {"x": x, "z": z };
|5878|5878| };
|5879|5879| 
|5880|5880| 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
|5901|5901| 	return false;
|5902|5902| };
|5903|5903| 
|5904|    |-//// Helper functions ////
|    |5904|+// // Helper functions ////
|5905|5905| 
|5906|5906| /**
|5907|5907|  * General getter for ranges.
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5920|5920| 		return undefined;
|5921|5921| 
|5922|5922| 	return component.GetRange(type);
|5923|    |-}
|    |5923|+};
|5924|5924| 
|5925|5925| UnitAI.prototype.CanAttack = function(target)
|5926|5926| {
|    | [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
|6118|6118| 	return cmpPack && cmpPack.IsPacking();
|6119|6119| };
|6120|6120| 
|6121|    |-//// Formation specific functions ////
|    |6121|+// // Formation specific functions ////
|6122|6122| 
|6123|6123| UnitAI.prototype.IsAttackingAsFormation = function()
|6124|6124| {
|    | [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
|6123|6123| UnitAI.prototype.IsAttackingAsFormation = function()
|6124|6124| {
|6125|6125| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6126|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6127|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6126|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6127|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6128|6128| };
|6129|6129| 
|6130|6130| //// 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
|6127|6127| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6128|6128| };
|6129|6129| 
|6130|    |-//// Animal specific functions ////
|    |6130|+// // Animal specific functions ////
|6131|6131| 
|6132|6132| UnitAI.prototype.MoveRandomly = function(distance)
|6133|6133| {

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

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

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

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

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

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

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

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

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

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

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

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

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

It might be better to store the data in UnitAI as datapairs of class and variation.

Imarok updated this revision to Diff 11438.Feb 26 2020, 9:00 PM

Use an extra component for SpecialVariants

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

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

Stan added a comment.Feb 26 2020, 9:54 PM

Missing the new component?

What about this for the name component

<VariantOverrides>
  <Build>build_farm</Build>
</VariantOverrides>
elexis removed a subscriber: elexis.Feb 27 2020, 1:56 PM

http://irclogs.wildfiregames.com/2020-02/2020-02-26-QuakeNet-%230ad-dev.log
Re

20:03 < elexis> "SpecialVariant" what does special mean
20:03 < Imarok> different from the usual ones
20:04 < Imarok> fields are special, so they get a special animation variant
20:05 < Imarok> "special": just different from normal
20:06 < elexis> then define what is normal
20:06 < Stan`> Philosophy 101
20:06 < Imarok> normal is what you get when you don't add this component ^^
20:07 < Imarok> I thought about naming it BuildingDependendVariant, but it could also be used for other entities
20:07 < Imarok> So I stuck with special
20:10 < Imarok> I'm also not 100% fond with the naming, but please use constructive criticism and no philosophical questions...

I object to that notion that this wasn't constructive criticism and that finding a clear definition and name would be a philosophical and not development question, because the reader and template user must not guess what normal and special means.
We can see 60 variants defined in lists.xml, why are those 59 ones normal and the field one special?
Why are gather_treasure and syntagma_front_walk normal and not special?
Perhaps with normal variant you mean "default variant"? But there is no actual default variant I see.
Regardless of the distinction that one might find, is the distinction necessary or might it look better if theyre stored in one place?
It looks like the name of that new component would just be <VariantNames> storing the names of variants that can be used by an entity performing an order with the target entity of that template.

One can look at the current variant code to see what would be the most consistent implementation.

UnitAI.prototype.SetDefaultAnimationVariant for example is related.
			let typename = "carry_" + type.generic;
this.SelectAnimation("gather_" + this.order.data.type.specific);

That hardcoding seems to be a bad precedent.

It might be better to store the data in UnitAI as datapairs of class and variation.

That seemed to cover all use cases?

<Builder>
<VisualActorVariants>
<VisualActorVariant>
   <Classes>Field</Classes>
  <Variant>build_farm</Variant>

But that had the disadvantage that the schema would have to be replicated for every use outside of builder.

So another option might be:

 <Builder>...</Builder/>
<VisualActor>
  <BuildVariant>
   <Classes>Field</Classes>
  <Variant>build_farm</Variant>
   <...>
   <FooVariant>
    ...

But that had the disadvantage that one cant add a new component using a variant stored in the VisualActor template without modifying the VisualActor component schema again;
unless that schema would allow passing any *Variant and Classes + VariantName would be sufficient for every component.

To see if the implemented approach would be a solution covering all known use cases, one could check if that implementation would cover those use cases.
The list of known use cases: Can one implement that for gather / carry variants too?
I suppose the last pattern does work with that,
But we also observe the disadvantage that there one would have to add new Identity classes for all the resource types.
Then there would be duplicated data of identity classes and resource types (perhaps that's the part that you refered to when you said you didn't like the identity classes approach).

A component <VariantNames> or <SpecialVariants> is only intended for orders that have a target entity and that template is stored in the target entity?
Or does it work with formation variants too?

20:23 < elexis> constructive means I have to find the solution?

Just because I point out that the code lacks something doesn't mean I should have to spend the hours to find the solution, I already spent one for this post that I regret and there is no reward for me doing so other than maybe ban or nothing.

binaries/data/mods/public/simulation/templates/template_structure_resource_field.xml
71

(<FoundationBuilderVariant>, but it seems awkward / wrong to store the builder variant in the actor of the entity to be built.)

Stan added a comment.Apr 24 2020, 6:19 PM

I believe that since a D2511 elephants no longer need to build.

wraitii requested changes to this revision.May 23 2020, 6:26 PM
wraitii added a subscriber: wraitii.

That hardcoding seems to be a bad precedent.

UnitAI.SetDefaultAnimationVariant is actually not hardcoding, since it uses animation variants, and units can fallback to a default animation. gather_ predates it but should be updated. The code specific to resource-gatherer should probably be in resource-gatherer, but meh.


Anyways, don't bother with XML, just do like carrying animations: define a variant build_{generic building name} (instead of an animation) and set it when building. Then make sure to create a group with the build animations only, and let the default one(s) have some >0 frequency, and name one "build_farm" with frequency 0. Then your units will do what you want automagically.
(you'll need to use "Idle" for your animation name when Idle, but that's OK).

This revision now requires changes to proceed.May 23 2020, 6:26 PM

Anyways, don't bother with XML, just do like carrying animations: define a variant build_{generic building name} (instead of an animation) and set it when building. Then make sure to create a group with the build animations only, and let the default one(s) have some >0 frequency, and name one "build_farm" with frequency 0. Then your units will do what you want automagically.
(you'll need to use "Idle" for your animation name when Idle, but that's OK).

I kind of get how you want to do this. It sounds sane.
But I've never done something with our animations/variants etc. so I'll need to look into it first. I'll do that when I find the time.
If you think it's a quick no-brainer for you, feel free to commandeer. ;)

I kind of get how you want to do this. It sounds sane.
But I've never done something with our animations/variants etc. so I'll need to look into it first. I'll do that when I find the time.
If you think it's a quick no-brainer for you, feel free to commandeer. ;)

It's quite easy: you set the animation variant, and in the groups you have something like:

<group>
  <variant name="default0" frequency="0.5">
    <animation name='Idle' ... />
  </variant>
  <variant name="default1" frequency="0.5">
    <animation name='Idle' ... />
  </variant>
  <variant name="build_field" frequency="0">  <- this never gets picked, unless the animation variant is "build_field", in which case it always gets picked
    <animation name='Idle' ... />
  </variant>
</group>

I'll let you give it a go I think, because it'd be good for knowledge sharing ;) . Indeed, you should be able to look at "Carry_food" and such.

The trick is that all animations for building must be in the same group.

I kind of get how you want to do this. It sounds sane.
But I've never done something with our animations/variants etc. so I'll need to look into it first. I'll do that when I find the time.
If you think it's a quick no-brainer for you, feel free to commandeer. ;)

It's quite easy: you set the animation variant, and in the groups you have something like:

<group>
  <variant name="default0" frequency="0.5">
    <animation name='Idle' ... />
  </variant>
  <variant name="default1" frequency="0.5">
    <animation name='Idle' ... />
  </variant>
  <variant name="build_field" frequency="0">  <- this never gets picked, unless the animation variant is "build_field", in which case it always gets picked
    <animation name='Idle' ... />
  </variant>
</group>

Ah, that's how I imagined it :)

I'll let you give it a go I think, because it'd be good for knowledge sharing ;) . Indeed, you should be able to look at "Carry_food" and such.

Sure that's always good ;)
I'll look at it when I find the time.

UnitAI.SetDefaultAnimationVariant is actually not hardcoding, since it uses animation variants

It is not hardcoding which resource carry variants are chosen but is hardcoding which components can set a different 'default' animation variant as opposed to the other functions calling SetAnimationVariant and hardcoding the string concatenation format, which is acceptable for resource type animation variants but doesn't look applicable for building animation variants.

don't bother with XML, just do like carrying animations: define a variant build_{generic building name} (instead of an animation) and set it when building

I don't understand the "don't bother with XML" comment.
Carry animations relate to resource codes, we don't have codes for buildings, only template names and Identity class names.

The use cases should be clarified:

  • Should UnitAI be able to use the same building variant build_foo for multiple building types (for example one variant for small buildings and another variant for large buildings).
  • Is it possible, unproblematic and clean to use the templatename template_field.xml or the Identity class Field be lowercased and cutoff to obtain the animation variant name? (If you chose the Identity class of the building, how does UnitAI decide which of the template classes to look up, since template_field also has Structure for instance.)

The XML based approach that was worked out so far:

<SpecialVariant>
  <BuildVariant>build_farm</BuildVariant>
</SpecialVariant>

would be more feasible than using Identity class or template name to identify which animation variant is to be chosen, because it allows chosing the same animation variant for multiple templates which the templatename based approach can't, and because it allows picking the exact animation variant to be looked up from the target template which the Identity class based approach doesn't allow.

binaries/data/mods/public/simulation/templates/template_structure_resource_field.xml
71

(It's a C++ component too, so it would not be comfortable to extend or modify, especially for modders)

@wraitii @Freagarach can you have another look at this ?

My comment above remains valid, my status is "waiting on @Imarok to update the diff" ;)