Page MenuHomeWildfire Games

Do not attempt to gather when full on that resource
Needs ReviewPublic

Authored by Stan on Jun 6 2020, 1:48 PM.

Details

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

When unit goes back from war, or from being idle and has filled its capacity it currently tries to gather instead of depositing it's resource to the nearest dropsite. The unit then goes to the resource plays an animation and creates a timer for nothing, then tries to find the nearest dropsite while it could return to that dropsite directly. This patch also makes it not move if there is no dropsite, not sure if that's wanted, another solution would be to keep that original behavior in that case instead of finishing the order

Test Plan

Without the patch, task a unit to gather a tree until it's full then task it again to gather from that tree, notice it goes back to the tree. Apply the patch and see it goes to the dropsite anymore and stay where it's at if there is no dropsite. Test removing the tree and removing the dropsite, test the back to work button.

Diff Detail

Repository
rP 0 A.D. Public Repository
Branch
/ps/trunk
Lint
Lint OK
SeverityLocationCodeMessage
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:351ESLintBear (consistent-return)ESLintBear (consistent-return)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:826ESLintBear (no-else-return)ESLintBear (no-else-return)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:1089ESLintBear (key-spacing)ESLintBear (key-spacing)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:2107ESLintBear (operator-linebreak)ESLintBear (operator-linebreak)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:2275ESLintBear (no-trailing-spaces)ESLintBear (no-trailing-spaces)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:2577ESLintBear (indent)ESLintBear (indent)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:3414ESLintBear (indent)ESLintBear (indent)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:3491ESLintBear (no-unneeded-ternary)ESLintBear (no-unneeded-ternary)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:3631ESLintBear (comma-spacing)ESLintBear (comma-spacing)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:3688ESLintBear (object-curly-spacing)ESLintBear (object-curly-spacing)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:3688ESLintBear (object-curly-spacing)ESLintBear (object-curly-spacing)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:3817ESLintBear (spaced-comment)ESLintBear (spaced-comment)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:3984ESLintBear (object-curly-spacing)ESLintBear (object-curly-spacing)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:3984ESLintBear (object-curly-spacing)ESLintBear (object-curly-spacing)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:4119ESLintBear (no-shadow)ESLintBear (no-shadow)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:4211ESLintBear (object-curly-spacing)ESLintBear (object-curly-spacing)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:4211ESLintBear (object-curly-spacing)ESLintBear (object-curly-spacing)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:4297ESLintBear (object-curly-spacing)ESLintBear (object-curly-spacing)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:4297ESLintBear (object-curly-spacing)ESLintBear (object-curly-spacing)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:4302ESLintBear (object-curly-spacing)ESLintBear (object-curly-spacing)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:4302ESLintBear (object-curly-spacing)ESLintBear (object-curly-spacing)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:4307ESLintBear (object-curly-spacing)ESLintBear (object-curly-spacing)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:4307ESLintBear (object-curly-spacing)ESLintBear (object-curly-spacing)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:4322ESLintBear (object-curly-spacing)ESLintBear (object-curly-spacing)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:4322ESLintBear (object-curly-spacing)ESLintBear (object-curly-spacing)
Unit
No Unit Test Coverage
Build Status
Buildable 13165
Build 26195: Vulcan BuildJenkins
Build 26194: Vulcan Build (macOS)Jenkins
Build 26193: Vulcan Build (Windows)Jenkins
Build 26192: arc lint + arc unit

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
Freagarach added inline comments.Jul 13 2020, 8:29 PM
binaries/data/mods/public/simulation/components/UnitAI.js
2288

Early return?

2294

Check for cmpResourceGatherer?

2295

You can revert this ;)

Stan updated this revision to Diff 12676.Jul 14 2020, 5:06 PM

Style changes

Stan marked 3 inline comments as done.Jul 14 2020, 5:07 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
| 794| 794| 					this.FinishOrder();
| 795| 795| 					return;
| 796| 796| 				}
| 797|    |-				else
| 798|    |-				{
|    | 797|+				
| 799| 798| 					this.SetNextState("GARRISON.APPROACHING");
| 800| 799| 					return;
| 801|    |-				}
|    | 800|+				
| 802| 801| 			}
| 803| 802| 
| 804| 803| 			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
|1058|1058| 			},
|1059|1059| 		},
|1060|1060| 
|1061|    |-		"GARRISON":{
|    |1061|+		"GARRISON": {
|1062|1062| 			"APPROACHING": {
|1063|1063| 				"enter": function() {
|1064|1064| 					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
|2055|2055| 
|2056|2056| 				"Attacked": function(msg) {
|2057|2057| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2058|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2059|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2058|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2059|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2060|2060| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2061|2061| 				},
|2062|2062| 			},
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 7 tabs but found 6.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2546|2546| 
|2547|2547| 								return type.specific == resourceType.specific &&
|2548|2548| 								    (type.specific != "meat" || resourceTemplate == template);
|2549|    |-						});
|    |2549|+							});
|2550|2550| 
|2551|2551| 						if (nearbyResource)
|2552|2552| 						{
|    | [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
|2878|2878| 					{
|2879|2879| 						// The building was already finished/fully repaired before we arrived;
|2880|2880| 						// let the ConstructionFinished handler handle this.
|2881|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2881|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2882|2882| 						return true;
|2883|2883| 					}
|2884|2884| 
|    | [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
|2878|2878| 					{
|2879|2879| 						// The building was already finished/fully repaired before we arrived;
|2880|2880| 						// let the ConstructionFinished handler handle this.
|2881|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2881|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2882|2882| 						return true;
|2883|2883| 					}
|2884|2884| 
|    | [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
|3168|3168| 				this.StopTimer();
|3169|3169| 				this.ResetAnimation();
|3170|3170| 				if (this.formationAnimationVariant)
|3171|    |-					this.SetAnimationVariant(this.formationAnimationVariant)
|    |3171|+					this.SetAnimationVariant(this.formationAnimationVariant);
|3172|3172| 				else
|3173|3173| 					this.SetDefaultAnimationVariant();
|3174|3174| 				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
|3394|3394| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3395|3395| 
|3396|3396| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3397|    |-							// only used for domestic animals
|    |3397|+		// only used for domestic animals
|3398|3398| 
|3399|3399| 		// Reuse the same garrison behaviour for animals.
|3400|3400| 		"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
|3446|3446| 
|3447|3447| UnitAI.prototype.IsAnimal = function()
|3448|3448| {
|3449|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3449|+	return (!!this.template.NaturalBehaviour);
|3450|3450| };
|3451|3451| 
|3452|3452| 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
|3586|3586| 		{
|3587|3587| 			let index = this.GetCurrentState().indexOf(".");
|3588|3588| 			if (index != -1)
|3589|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3589|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3590|3590| 			this.Stop(false);
|3591|3591| 		}
|3592|3592| 
|    | [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
|3642|3642| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3643|3643| 			continue;
|3644|3644| 		if (i == 0)
|3645|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3645|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3646|3646| 		else
|3647|3647| 			this.orderQueue.splice(i, 1);
|3648|3648| 		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
|3642|3642| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3643|3643| 			continue;
|3644|3644| 		if (i == 0)
|3645|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3645|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3646|3646| 		else
|3647|3647| 			this.orderQueue.splice(i, 1);
|3648|3648| 		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
|3729|3729| };
|3730|3730| 
|3731|3731| 
|3732|    |-//// FSM linkage functions ////
|    |3732|+// // FSM linkage functions ////
|3733|3733| 
|3734|3734| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3735|3735| 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
|3902|3902| 				continue;
|3903|3903| 			if (this.orderQueue[i].type == type)
|3904|3904| 				continue;
|3905|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3905|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3906|3906| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3907|3907| 			return;
|3908|3908| 		}
|    | [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
|3902|3902| 				continue;
|3903|3903| 			if (this.orderQueue[i].type == type)
|3904|3904| 				continue;
|3905|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3905|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3906|3906| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3907|3907| 			return;
|3908|3908| 		}
|    | [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
|4143|4143| 	if (data.timerRepeat === undefined)
|4144|4144| 		this.timer = undefined;
|4145|4145| 
|4146|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4146|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4147|4147| };
|4148|4148| 
|4149|4149| /**
|    | [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
|4143|4143| 	if (data.timerRepeat === undefined)
|4144|4144| 		this.timer = undefined;
|4145|4145| 
|4146|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4146|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4147|4147| };
|4148|4148| 
|4149|4149| /**
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4188|4188| 	// TODO: This is a bit inefficient since every unit listens to every
|4189|4189| 	// construction message - ideally we could scope it to only the one we're building
|4190|4190| 
|4191|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4191|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4192|4192| };
|4193|4193| 
|4194|4194| 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
|4188|4188| 	// TODO: This is a bit inefficient since every unit listens to every
|4189|4189| 	// construction message - ideally we could scope it to only the one we're building
|4190|4190| 
|4191|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4191|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4192|4192| };
|4193|4193| 
|4194|4194| 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
|4227|4227| 	if (msg.fromStatusEffect)
|4228|4228| 		return;
|4229|4229| 
|4230|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4230|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4231|4231| };
|4232|4232| 
|4233|4233| 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
|4227|4227| 	if (msg.fromStatusEffect)
|4228|4228| 		return;
|4229|4229| 
|4230|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4230|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4231|4231| };
|4232|4232| 
|4233|4233| 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
|4232|4232| 
|4233|4233| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4234|4234| {
|4235|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4235|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4236|4236| };
|4237|4237| 
|4238|4238| 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
|4232|4232| 
|4233|4233| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4234|4234| {
|4235|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4235|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4236|4236| };
|4237|4237| 
|4238|4238| 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
|4237|4237| 
|4238|4238| UnitAI.prototype.OnHealthChanged = function(msg)
|4239|4239| {
|4240|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4240|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4241|4241| };
|4242|4242| 
|4243|4243| 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
|4237|4237| 
|4238|4238| UnitAI.prototype.OnHealthChanged = function(msg)
|4239|4239| {
|4240|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4240|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4241|4241| };
|4242|4242| 
|4243|4243| 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
|4243|4243| UnitAI.prototype.OnRangeUpdate = function(msg)
|4244|4244| {
|4245|4245| 	if (msg.tag == this.losRangeQuery)
|4246|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4246|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4247|4247| 	else if (msg.tag == this.losHealRangeQuery)
|4248|4248| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4249|4249| };
|    | [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
|4243|4243| UnitAI.prototype.OnRangeUpdate = function(msg)
|4244|4244| {
|4245|4245| 	if (msg.tag == this.losRangeQuery)
|4246|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4246|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4247|4247| 	else if (msg.tag == this.losHealRangeQuery)
|4248|4248| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4249|4249| };
|    | [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
|4245|4245| 	if (msg.tag == this.losRangeQuery)
|4246|4246| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4247|4247| 	else if (msg.tag == this.losHealRangeQuery)
|4248|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4248|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4249|4249| };
|4250|4250| 
|4251|4251| 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
|4245|4245| 	if (msg.tag == this.losRangeQuery)
|4246|4246| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4247|4247| 	else if (msg.tag == this.losHealRangeQuery)
|4248|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4248|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4249|4249| };
|4250|4250| 
|4251|4251| 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
|4250|4250| 
|4251|4251| UnitAI.prototype.OnPackFinished = function(msg)
|4252|4252| {
|4253|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4253|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4254|4254| };
|4255|4255| 
|4256|4256| //// 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
|4250|4250| 
|4251|4251| UnitAI.prototype.OnPackFinished = function(msg)
|4252|4252| {
|4253|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4253|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4254|4254| };
|4255|4255| 
|4256|4256| //// 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
|4253|4253| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4254|4254| };
|4255|4255| 
|4256|    |-//// Helper functions to be called by the FSM ////
|    |4256|+// // Helper functions to be called by the FSM ////
|4257|4257| 
|4258|4258| UnitAI.prototype.GetWalkSpeed = function()
|4259|4259| {
|    | [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
|4983|4983| UnitAI.prototype.AttackEntityInZone = function(ents)
|4984|4984| {
|4985|4985| 	var target = ents.find(target =>
|4986|    |-		this.CanAttack(target)
|4987|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4986|+		this.CanAttack(target) &&
|    |4987|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4988|4988| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4989|4989| 	);
|4990|4990| 	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
|4984|4984| {
|4985|4985| 	var target = ents.find(target =>
|4986|4986| 		this.CanAttack(target)
|4987|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4988|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4987|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4988|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4989|4989| 	);
|4990|4990| 	if (!target)
|4991|4991| 		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
|5050|5050| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|5051|5051| 	if (this.isGuardOf)
|5052|5052| 	{
|5053|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |5053|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|5054|5054| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|5055|5055| 		if (cmpUnitAI && cmpAttack &&
|5056|5056| 		    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
|5054|5054| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|5055|5055| 		if (cmpUnitAI && cmpAttack &&
|5056|5056| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|5057|    |-				return false;
|    |5057|+			return false;
|5058|5058| 	}
|5059|5059| 
|5060|5060| 	// 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
|5092|5092| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|5093|5093| 	if (this.isGuardOf)
|5094|5094| 	{
|5095|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |5095|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|5096|5096| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|5097|5097| 		if (cmpUnitAI && cmpAttack &&
|5098|5098| 		    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
|5105|5105| 	return false;
|5106|5106| };
|5107|5107| 
|5108|    |-//// External interface functions ////
|    |5108|+// // External interface functions ////
|5109|5109| 
|5110|5110| UnitAI.prototype.SetFormationController = function(ent)
|5111|5111| {
|    | [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
|5261|5261| 	{
|5262|5262| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5263|5263| 			return;
|5264|    |-		else
|5265|    |-			this.RemoveGuard();
|    |5264|+		this.RemoveGuard();
|5266|5265| 	}
|5267|5266| 
|5268|5267| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5595|5595| 
|5596|5596| 	if (this.IsFormationController())
|5597|5597| 		this.CallMemberFunction("CancelSetupTradeRoute", [target]);
|5598|    |-}
|    |5598|+};
|5599|5599| /**
|5600|5600|  * Adds trade order to the queue. Either walk to the first market, or
|5601|5601|  * start a new route. Not forced, so it can be interrupted by attacks.
|    | [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
|5897|5897| 				{
|5898|5898| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5899|5899| 					var targetClasses = this.order.data.targetClasses;
|5900|    |-					if (targetClasses.attack && cmpIdentity
|5901|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5900|+					if (targetClasses.attack && cmpIdentity &&
|    |5901|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5902|5902| 						continue;
|5903|5903| 					if (targetClasses.avoid && cmpIdentity
|5904|5904| 						&& 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
|5900|5900| 					if (targetClasses.attack && cmpIdentity
|5901|5901| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5902|5902| 						continue;
|5903|    |-					if (targetClasses.avoid && cmpIdentity
|5904|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5903|+					if (targetClasses.avoid && cmpIdentity &&
|    |5904|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5905|5905| 						continue;
|5906|5906| 					// Only used by the AIs to prevent some choices of targets
|5907|5907| 					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
|5923|5923| 		{
|5924|5924| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5925|5925| 			var targetClasses = this.order.data.targetClasses;
|5926|    |-			if (cmpIdentity && targetClasses.attack
|5927|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5926|+			if (cmpIdentity && targetClasses.attack &&
|    |5927|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5928|5928| 				continue;
|5929|5929| 			if (cmpIdentity && targetClasses.avoid
|5930|5930| 				&& 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
|5926|5926| 			if (cmpIdentity && targetClasses.attack
|5927|5927| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5928|5928| 				continue;
|5929|    |-			if (cmpIdentity && targetClasses.avoid
|5930|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5929|+			if (cmpIdentity && targetClasses.avoid &&
|    |5930|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5931|5931| 				continue;
|5932|5932| 			// Only used by the AIs to prevent some choices of targets
|5933|5933| 			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
|6086|6086| 
|6087|6087| UnitAI.prototype.SetHeldPosition = function(x, z)
|6088|6088| {
|6089|    |-	this.heldPosition = {"x": x, "z": z};
|    |6089|+	this.heldPosition = { "x": x, "z": z};
|6090|6090| };
|6091|6091| 
|6092|6092| 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
|6086|6086| 
|6087|6087| UnitAI.prototype.SetHeldPosition = function(x, z)
|6088|6088| {
|6089|    |-	this.heldPosition = {"x": x, "z": z};
|    |6089|+	this.heldPosition = {"x": x, "z": z };
|6090|6090| };
|6091|6091| 
|6092|6092| 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
|6113|6113| 	return false;
|6114|6114| };
|6115|6115| 
|6116|    |-//// Helper functions ////
|    |6116|+// // Helper functions ////
|6117|6117| 
|6118|6118| /**
|6119|6119|  * 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
|6132|6132| 		return undefined;
|6133|6133| 
|6134|6134| 	return component.GetRange(type);
|6135|    |-}
|    |6135|+};
|6136|6136| 
|6137|6137| UnitAI.prototype.CanAttack = function(target)
|6138|6138| {
|    | [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
|6308|6308| 	return cmpPack && cmpPack.IsPacking();
|6309|6309| };
|6310|6310| 
|6311|    |-//// Formation specific functions ////
|    |6311|+// // Formation specific functions ////
|6312|6312| 
|6313|6313| UnitAI.prototype.IsAttackingAsFormation = function()
|6314|6314| {
|    | [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
|6313|6313| UnitAI.prototype.IsAttackingAsFormation = function()
|6314|6314| {
|6315|6315| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6316|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6317|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6316|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6317|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6318|6318| };
|6319|6319| 
|6320|6320| //// 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
|6317|6317| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6318|6318| };
|6319|6319| 
|6320|    |-//// Animal specific functions ////
|    |6320|+// // Animal specific functions ////
|6321|6321| 
|6322|6322| UnitAI.prototype.MoveRandomly = function(distance)
|6323|6323| {

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4048| »   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
|4970| »   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
|4985| »   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
|5033| »   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
|5056| »   »   ····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
|2059| »   »   »   »   »   »   &&·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
|3171| »   »   »   »   »   this.SetAnimationVariant(this.formationAnimationVariant)
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

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

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

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

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

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

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

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

Freagarach added inline comments.Jul 16 2020, 11:23 AM
binaries/data/mods/public/simulation/components/UnitAI.js
2287

Probably need the order here ^^

2296

false

2303

true

5686

(Please revert this change when committing.)

Freagarach added inline comments.Jul 16 2020, 11:43 AM
binaries/data/mods/public/simulation/components/UnitAI.js
2286

Oh, and this on the previous line.

2313

+\n

Stan updated this revision to Diff 12709.Jul 16 2020, 12:07 PM
Stan marked 5 inline comments as done.

Fix notes

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
| 794| 794| 					this.FinishOrder();
| 795| 795| 					return;
| 796| 796| 				}
| 797|    |-				else
| 798|    |-				{
|    | 797|+				
| 799| 798| 					this.SetNextState("GARRISON.APPROACHING");
| 800| 799| 					return;
| 801|    |-				}
|    | 800|+				
| 802| 801| 			}
| 803| 802| 
| 804| 803| 			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
|1058|1058| 			},
|1059|1059| 		},
|1060|1060| 
|1061|    |-		"GARRISON":{
|    |1061|+		"GARRISON": {
|1062|1062| 			"APPROACHING": {
|1063|1063| 				"enter": function() {
|1064|1064| 					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
|2055|2055| 
|2056|2056| 				"Attacked": function(msg) {
|2057|2057| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2058|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2059|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2058|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2059|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2060|2060| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2061|2061| 				},
|2062|2062| 			},
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 7 tabs but found 6.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2546|2546| 
|2547|2547| 								return type.specific == resourceType.specific &&
|2548|2548| 								    (type.specific != "meat" || resourceTemplate == template);
|2549|    |-						});
|    |2549|+							});
|2550|2550| 
|2551|2551| 						if (nearbyResource)
|2552|2552| 						{
|    | [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
|2878|2878| 					{
|2879|2879| 						// The building was already finished/fully repaired before we arrived;
|2880|2880| 						// let the ConstructionFinished handler handle this.
|2881|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2881|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2882|2882| 						return true;
|2883|2883| 					}
|2884|2884| 
|    | [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
|2878|2878| 					{
|2879|2879| 						// The building was already finished/fully repaired before we arrived;
|2880|2880| 						// let the ConstructionFinished handler handle this.
|2881|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2881|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2882|2882| 						return true;
|2883|2883| 					}
|2884|2884| 
|    | [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
|3168|3168| 				this.StopTimer();
|3169|3169| 				this.ResetAnimation();
|3170|3170| 				if (this.formationAnimationVariant)
|3171|    |-					this.SetAnimationVariant(this.formationAnimationVariant)
|    |3171|+					this.SetAnimationVariant(this.formationAnimationVariant);
|3172|3172| 				else
|3173|3173| 					this.SetDefaultAnimationVariant();
|3174|3174| 				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
|3394|3394| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3395|3395| 
|3396|3396| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3397|    |-							// only used for domestic animals
|    |3397|+		// only used for domestic animals
|3398|3398| 
|3399|3399| 		// Reuse the same garrison behaviour for animals.
|3400|3400| 		"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
|3446|3446| 
|3447|3447| UnitAI.prototype.IsAnimal = function()
|3448|3448| {
|3449|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3449|+	return (!!this.template.NaturalBehaviour);
|3450|3450| };
|3451|3451| 
|3452|3452| 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
|3586|3586| 		{
|3587|3587| 			let index = this.GetCurrentState().indexOf(".");
|3588|3588| 			if (index != -1)
|3589|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3589|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3590|3590| 			this.Stop(false);
|3591|3591| 		}
|3592|3592| 
|    | [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
|3642|3642| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3643|3643| 			continue;
|3644|3644| 		if (i == 0)
|3645|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3645|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3646|3646| 		else
|3647|3647| 			this.orderQueue.splice(i, 1);
|3648|3648| 		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
|3642|3642| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3643|3643| 			continue;
|3644|3644| 		if (i == 0)
|3645|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3645|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3646|3646| 		else
|3647|3647| 			this.orderQueue.splice(i, 1);
|3648|3648| 		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
|3729|3729| };
|3730|3730| 
|3731|3731| 
|3732|    |-//// FSM linkage functions ////
|    |3732|+// // FSM linkage functions ////
|3733|3733| 
|3734|3734| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3735|3735| 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
|3902|3902| 				continue;
|3903|3903| 			if (this.orderQueue[i].type == type)
|3904|3904| 				continue;
|3905|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3905|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3906|3906| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3907|3907| 			return;
|3908|3908| 		}
|    | [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
|3902|3902| 				continue;
|3903|3903| 			if (this.orderQueue[i].type == type)
|3904|3904| 				continue;
|3905|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3905|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3906|3906| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3907|3907| 			return;
|3908|3908| 		}
|    | [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
|4143|4143| 	if (data.timerRepeat === undefined)
|4144|4144| 		this.timer = undefined;
|4145|4145| 
|4146|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4146|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4147|4147| };
|4148|4148| 
|4149|4149| /**
|    | [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
|4143|4143| 	if (data.timerRepeat === undefined)
|4144|4144| 		this.timer = undefined;
|4145|4145| 
|4146|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4146|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4147|4147| };
|4148|4148| 
|4149|4149| /**
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4188|4188| 	// TODO: This is a bit inefficient since every unit listens to every
|4189|4189| 	// construction message - ideally we could scope it to only the one we're building
|4190|4190| 
|4191|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4191|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4192|4192| };
|4193|4193| 
|4194|4194| 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
|4188|4188| 	// TODO: This is a bit inefficient since every unit listens to every
|4189|4189| 	// construction message - ideally we could scope it to only the one we're building
|4190|4190| 
|4191|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4191|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4192|4192| };
|4193|4193| 
|4194|4194| 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
|4227|4227| 	if (msg.fromStatusEffect)
|4228|4228| 		return;
|4229|4229| 
|4230|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4230|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4231|4231| };
|4232|4232| 
|4233|4233| 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
|4227|4227| 	if (msg.fromStatusEffect)
|4228|4228| 		return;
|4229|4229| 
|4230|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4230|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4231|4231| };
|4232|4232| 
|4233|4233| 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
|4232|4232| 
|4233|4233| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4234|4234| {
|4235|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4235|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4236|4236| };
|4237|4237| 
|4238|4238| 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
|4232|4232| 
|4233|4233| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4234|4234| {
|4235|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4235|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4236|4236| };
|4237|4237| 
|4238|4238| 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
|4237|4237| 
|4238|4238| UnitAI.prototype.OnHealthChanged = function(msg)
|4239|4239| {
|4240|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4240|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4241|4241| };
|4242|4242| 
|4243|4243| 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
|4237|4237| 
|4238|4238| UnitAI.prototype.OnHealthChanged = function(msg)
|4239|4239| {
|4240|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4240|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4241|4241| };
|4242|4242| 
|4243|4243| 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
|4243|4243| UnitAI.prototype.OnRangeUpdate = function(msg)
|4244|4244| {
|4245|4245| 	if (msg.tag == this.losRangeQuery)
|4246|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4246|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4247|4247| 	else if (msg.tag == this.losHealRangeQuery)
|4248|4248| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4249|4249| };
|    | [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
|4243|4243| UnitAI.prototype.OnRangeUpdate = function(msg)
|4244|4244| {
|4245|4245| 	if (msg.tag == this.losRangeQuery)
|4246|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4246|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4247|4247| 	else if (msg.tag == this.losHealRangeQuery)
|4248|4248| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4249|4249| };
|    | [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
|4245|4245| 	if (msg.tag == this.losRangeQuery)
|4246|4246| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4247|4247| 	else if (msg.tag == this.losHealRangeQuery)
|4248|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4248|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4249|4249| };
|4250|4250| 
|4251|4251| 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
|4245|4245| 	if (msg.tag == this.losRangeQuery)
|4246|4246| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4247|4247| 	else if (msg.tag == this.losHealRangeQuery)
|4248|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4248|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4249|4249| };
|4250|4250| 
|4251|4251| 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
|4250|4250| 
|4251|4251| UnitAI.prototype.OnPackFinished = function(msg)
|4252|4252| {
|4253|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4253|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4254|4254| };
|4255|4255| 
|4256|4256| //// 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
|4250|4250| 
|4251|4251| UnitAI.prototype.OnPackFinished = function(msg)
|4252|4252| {
|4253|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4253|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4254|4254| };
|4255|4255| 
|4256|4256| //// 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
|4253|4253| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4254|4254| };
|4255|4255| 
|4256|    |-//// Helper functions to be called by the FSM ////
|    |4256|+// // Helper functions to be called by the FSM ////
|4257|4257| 
|4258|4258| UnitAI.prototype.GetWalkSpeed = function()
|4259|4259| {
|    | [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
|4983|4983| UnitAI.prototype.AttackEntityInZone = function(ents)
|4984|4984| {
|4985|4985| 	var target = ents.find(target =>
|4986|    |-		this.CanAttack(target)
|4987|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4986|+		this.CanAttack(target) &&
|    |4987|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4988|4988| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4989|4989| 	);
|4990|4990| 	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
|4984|4984| {
|4985|4985| 	var target = ents.find(target =>
|4986|4986| 		this.CanAttack(target)
|4987|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4988|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4987|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4988|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4989|4989| 	);
|4990|4990| 	if (!target)
|4991|4991| 		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
|5050|5050| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|5051|5051| 	if (this.isGuardOf)
|5052|5052| 	{
|5053|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |5053|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|5054|5054| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|5055|5055| 		if (cmpUnitAI && cmpAttack &&
|5056|5056| 		    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
|5054|5054| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|5055|5055| 		if (cmpUnitAI && cmpAttack &&
|5056|5056| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|5057|    |-				return false;
|    |5057|+			return false;
|5058|5058| 	}
|5059|5059| 
|5060|5060| 	// 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
|5092|5092| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|5093|5093| 	if (this.isGuardOf)
|5094|5094| 	{
|5095|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |5095|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|5096|5096| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|5097|5097| 		if (cmpUnitAI && cmpAttack &&
|5098|5098| 		    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
|5105|5105| 	return false;
|5106|5106| };
|5107|5107| 
|5108|    |-//// External interface functions ////
|    |5108|+// // External interface functions ////
|5109|5109| 
|5110|5110| UnitAI.prototype.SetFormationController = function(ent)
|5111|5111| {
|    | [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
|5261|5261| 	{
|5262|5262| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5263|5263| 			return;
|5264|    |-		else
|5265|    |-			this.RemoveGuard();
|    |5264|+		this.RemoveGuard();
|5266|5265| 	}
|5267|5266| 
|5268|5267| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5595|5595| 
|5596|5596| 	if (this.IsFormationController())
|5597|5597| 		this.CallMemberFunction("CancelSetupTradeRoute", [target]);
|5598|    |-}
|    |5598|+};
|5599|5599| /**
|5600|5600|  * Adds trade order to the queue. Either walk to the first market, or
|5601|5601|  * start a new route. Not forced, so it can be interrupted by attacks.
|    | [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
|5897|5897| 				{
|5898|5898| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5899|5899| 					var targetClasses = this.order.data.targetClasses;
|5900|    |-					if (targetClasses.attack && cmpIdentity
|5901|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5900|+					if (targetClasses.attack && cmpIdentity &&
|    |5901|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5902|5902| 						continue;
|5903|5903| 					if (targetClasses.avoid && cmpIdentity
|5904|5904| 						&& 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
|5900|5900| 					if (targetClasses.attack && cmpIdentity
|5901|5901| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5902|5902| 						continue;
|5903|    |-					if (targetClasses.avoid && cmpIdentity
|5904|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5903|+					if (targetClasses.avoid && cmpIdentity &&
|    |5904|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5905|5905| 						continue;
|5906|5906| 					// Only used by the AIs to prevent some choices of targets
|5907|5907| 					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
|5923|5923| 		{
|5924|5924| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5925|5925| 			var targetClasses = this.order.data.targetClasses;
|5926|    |-			if (cmpIdentity && targetClasses.attack
|5927|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5926|+			if (cmpIdentity && targetClasses.attack &&
|    |5927|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5928|5928| 				continue;
|5929|5929| 			if (cmpIdentity && targetClasses.avoid
|5930|5930| 				&& 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
|5926|5926| 			if (cmpIdentity && targetClasses.attack
|5927|5927| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5928|5928| 				continue;
|5929|    |-			if (cmpIdentity && targetClasses.avoid
|5930|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5929|+			if (cmpIdentity && targetClasses.avoid &&
|    |5930|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5931|5931| 				continue;
|5932|5932| 			// Only used by the AIs to prevent some choices of targets
|5933|5933| 			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
|6086|6086| 
|6087|6087| UnitAI.prototype.SetHeldPosition = function(x, z)
|6088|6088| {
|6089|    |-	this.heldPosition = {"x": x, "z": z};
|    |6089|+	this.heldPosition = { "x": x, "z": z};
|6090|6090| };
|6091|6091| 
|6092|6092| 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
|6086|6086| 
|6087|6087| UnitAI.prototype.SetHeldPosition = function(x, z)
|6088|6088| {
|6089|    |-	this.heldPosition = {"x": x, "z": z};
|    |6089|+	this.heldPosition = {"x": x, "z": z };
|6090|6090| };
|6091|6091| 
|6092|6092| 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
|6113|6113| 	return false;
|6114|6114| };
|6115|6115| 
|6116|    |-//// Helper functions ////
|    |6116|+// // Helper functions ////
|6117|6117| 
|6118|6118| /**
|6119|6119|  * 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
|6132|6132| 		return undefined;
|6133|6133| 
|6134|6134| 	return component.GetRange(type);
|6135|    |-}
|    |6135|+};
|6136|6136| 
|6137|6137| UnitAI.prototype.CanAttack = function(target)
|6138|6138| {
|    | [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
|6308|6308| 	return cmpPack && cmpPack.IsPacking();
|6309|6309| };
|6310|6310| 
|6311|    |-//// Formation specific functions ////
|    |6311|+// // Formation specific functions ////
|6312|6312| 
|6313|6313| UnitAI.prototype.IsAttackingAsFormation = function()
|6314|6314| {
|    | [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
|6313|6313| UnitAI.prototype.IsAttackingAsFormation = function()
|6314|6314| {
|6315|6315| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6316|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6317|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6316|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6317|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6318|6318| };
|6319|6319| 
|6320|6320| //// 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
|6317|6317| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6318|6318| };
|6319|6319| 
|6320|    |-//// Animal specific functions ////
|    |6320|+// // Animal specific functions ////
|6321|6321| 
|6322|6322| UnitAI.prototype.MoveRandomly = function(distance)
|6323|6323| {

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4048| »   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
|4970| »   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
|4985| »   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
|5033| »   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
|5056| »   »   ····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
|2059| »   »   »   »   »   »   &&·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
|3171| »   »   »   »   »   this.SetAnimationVariant(this.formationAnimationVariant)
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

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

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

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

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

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

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

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

This is a very nice addition :)

  • Code is good.
  • Test plan performed and passed (one may write a UnitAI test for this behaviour).
  • It may be unclear to a user why the entity won't move when full and no dropsite is available, but then again it would probably be also unclear as to why they would go to the resource and clutter there.

Will accept once the treasure thing is done.

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

\t ->

2293

Comment should go below.

2294

Also return false when the resourceType == "treasure" since we cannot carry that. (Ugly hardcoding, but I plan to revisit treasures.)

Freagarach requested changes to this revision.Jul 24 2020, 5:41 PM
This revision now requires changes to proceed.Jul 24 2020, 5:41 PM
Stan updated this revision to Diff 12888.Jul 24 2020, 5:49 PM
Stan marked an inline comment as done.

Rebase, fix inlines

Stan marked 2 inline comments as done.Jul 24 2020, 5:50 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
| 798| 798| 					this.FinishOrder();
| 799| 799| 					return;
| 800| 800| 				}
| 801|    |-				else
| 802|    |-				{
|    | 801|+				
| 803| 802| 					this.SetNextState("GARRISON.APPROACHING");
| 804| 803| 					return;
| 805|    |-				}
|    | 804|+				
| 806| 805| 			}
| 807| 806| 
| 808| 807| 			this.SetNextState("GARRISON.GARRISONING");
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'GARRISON'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1062|1062| 			},
|1063|1063| 		},
|1064|1064| 
|1065|    |-		"GARRISON":{
|    |1065|+		"GARRISON": {
|1066|1066| 			"APPROACHING": {
|1067|1067| 				"enter": function() {
|1068|1068| 					if (!this.MoveToGarrisonRange(this.order.data.target))
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2066|2066| 
|2067|2067| 				"Attacked": function(msg) {
|2068|2068| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2069|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2070|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2069|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2070|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2071|2071| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2072|2072| 				},
|2073|2073| 			},
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 7 tabs but found 6.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2557|2557| 
|2558|2558| 								return type.specific == resourceType.specific &&
|2559|2559| 								    (type.specific != "meat" || resourceTemplate == template);
|2560|    |-						});
|    |2560|+							});
|2561|2561| 
|2562|2562| 						if (nearbyResource)
|2563|2563| 						{
|    | [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
|2889|2889| 					{
|2890|2890| 						// The building was already finished/fully repaired before we arrived;
|2891|2891| 						// let the ConstructionFinished handler handle this.
|2892|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2892|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2893|2893| 						return true;
|2894|2894| 					}
|2895|2895| 
|    | [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
|2889|2889| 					{
|2890|2890| 						// The building was already finished/fully repaired before we arrived;
|2891|2891| 						// let the ConstructionFinished handler handle this.
|2892|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2892|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2893|2893| 						return true;
|2894|2894| 					}
|2895|2895| 
|    | [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
|3179|3179| 				this.StopTimer();
|3180|3180| 				this.ResetAnimation();
|3181|3181| 				if (this.formationAnimationVariant)
|3182|    |-					this.SetAnimationVariant(this.formationAnimationVariant)
|    |3182|+					this.SetAnimationVariant(this.formationAnimationVariant);
|3183|3183| 				else
|3184|3184| 					this.SetDefaultAnimationVariant();
|3185|3185| 				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
|3393|3393| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3394|3394| 
|3395|3395| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3396|    |-							// only used for domestic animals
|    |3396|+		// only used for domestic animals
|3397|3397| 
|3398|3398| 		// Reuse the same garrison behaviour for animals.
|3399|3399| 		"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
|3443|3443| 
|3444|3444| UnitAI.prototype.IsAnimal = function()
|3445|3445| {
|3446|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3446|+	return (!!this.template.NaturalBehaviour);
|3447|3447| };
|3448|3448| 
|3449|3449| 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
|3583|3583| 		{
|3584|3584| 			let index = this.GetCurrentState().indexOf(".");
|3585|3585| 			if (index != -1)
|3586|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3586|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3587|3587| 			this.Stop(false);
|3588|3588| 		}
|3589|3589| 
|    | [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
|3640|3640| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3641|3641| 			continue;
|3642|3642| 		if (i == 0)
|3643|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3643|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3644|3644| 		else
|3645|3645| 			this.orderQueue.splice(i, 1);
|3646|3646| 		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
|3640|3640| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3641|3641| 			continue;
|3642|3642| 		if (i == 0)
|3643|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3643|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3644|3644| 		else
|3645|3645| 			this.orderQueue.splice(i, 1);
|3646|3646| 		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
|3769|3769| };
|3770|3770| 
|3771|3771| 
|3772|    |-//// FSM linkage functions ////
|    |3772|+// // FSM linkage functions ////
|3773|3773| 
|3774|3774| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3775|3775| 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
|3942|3942| 				continue;
|3943|3943| 			if (this.orderQueue[i].type == type)
|3944|3944| 				continue;
|3945|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3945|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3946|3946| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3947|3947| 			return;
|3948|3948| 		}
|    | [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
|3942|3942| 				continue;
|3943|3943| 			if (this.orderQueue[i].type == type)
|3944|3944| 				continue;
|3945|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3945|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3946|3946| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3947|3947| 			return;
|3948|3948| 		}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4183|4183| 	if (data.timerRepeat === undefined)
|4184|4184| 		this.timer = undefined;
|4185|4185| 
|4186|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4186|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4187|4187| };
|4188|4188| 
|4189|4189| /**
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4183|4183| 	if (data.timerRepeat === undefined)
|4184|4184| 		this.timer = undefined;
|4185|4185| 
|4186|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4186|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4187|4187| };
|4188|4188| 
|4189|4189| /**
|    | [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
|4228|4228| 	// TODO: This is a bit inefficient since every unit listens to every
|4229|4229| 	// construction message - ideally we could scope it to only the one we're building
|4230|4230| 
|4231|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4231|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4232|4232| };
|4233|4233| 
|4234|4234| 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
|4228|4228| 	// TODO: This is a bit inefficient since every unit listens to every
|4229|4229| 	// construction message - ideally we could scope it to only the one we're building
|4230|4230| 
|4231|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4231|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4232|4232| };
|4233|4233| 
|4234|4234| 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
|4267|4267| 	if (msg.fromStatusEffect)
|4268|4268| 		return;
|4269|4269| 
|4270|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4270|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4271|4271| };
|4272|4272| 
|4273|4273| 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
|4267|4267| 	if (msg.fromStatusEffect)
|4268|4268| 		return;
|4269|4269| 
|4270|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4270|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4271|4271| };
|4272|4272| 
|4273|4273| 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
|4272|4272| 
|4273|4273| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4274|4274| {
|4275|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4275|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4276|4276| };
|4277|4277| 
|4278|4278| 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
|4272|4272| 
|4273|4273| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4274|4274| {
|4275|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4275|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4276|4276| };
|4277|4277| 
|4278|4278| 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
|4277|4277| 
|4278|4278| UnitAI.prototype.OnHealthChanged = function(msg)
|4279|4279| {
|4280|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4280|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4281|4281| };
|4282|4282| 
|4283|4283| 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
|4277|4277| 
|4278|4278| UnitAI.prototype.OnHealthChanged = function(msg)
|4279|4279| {
|4280|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4280|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4281|4281| };
|4282|4282| 
|4283|4283| 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
|4292|4292| 
|4293|4293| UnitAI.prototype.OnPackFinished = function(msg)
|4294|4294| {
|4295|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4295|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4296|4296| };
|4297|4297| 
|4298|4298| //// 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
|4292|4292| 
|4293|4293| UnitAI.prototype.OnPackFinished = function(msg)
|4294|4294| {
|4295|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4295|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4296|4296| };
|4297|4297| 
|4298|4298| //// 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
|4295|4295| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4296|4296| };
|4297|4297| 
|4298|    |-//// Helper functions to be called by the FSM ////
|    |4298|+// // Helper functions to be called by the FSM ////
|4299|4299| 
|4300|4300| UnitAI.prototype.GetWalkSpeed = function()
|4301|4301| {
|    | [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
|5025|5025| UnitAI.prototype.AttackEntityInZone = function(ents)
|5026|5026| {
|5027|5027| 	var target = ents.find(target =>
|5028|    |-		this.CanAttack(target)
|5029|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |5028|+		this.CanAttack(target) &&
|    |5029|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|5030|5030| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|5031|5031| 	);
|5032|5032| 	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
|5026|5026| {
|5027|5027| 	var target = ents.find(target =>
|5028|5028| 		this.CanAttack(target)
|5029|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|5030|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |5029|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |5030|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|5031|5031| 	);
|5032|5032| 	if (!target)
|5033|5033| 		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
|5110|5110| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|5111|5111| 	if (this.isGuardOf)
|5112|5112| 	{
|5113|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |5113|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|5114|5114| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|5115|5115| 		if (cmpUnitAI && cmpAttack &&
|5116|5116| 		    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
|5114|5114| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|5115|5115| 		if (cmpUnitAI && cmpAttack &&
|5116|5116| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|5117|    |-				return false;
|    |5117|+			return false;
|5118|5118| 	}
|5119|5119| 
|5120|5120| 	// 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
|5152|5152| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|5153|5153| 	if (this.isGuardOf)
|5154|5154| 	{
|5155|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |5155|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|5156|5156| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|5157|5157| 		if (cmpUnitAI && cmpAttack &&
|5158|5158| 		    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
|5165|5165| 	return false;
|5166|5166| };
|5167|5167| 
|5168|    |-//// External interface functions ////
|    |5168|+// // External interface functions ////
|5169|5169| 
|5170|5170| UnitAI.prototype.SetFormationController = function(ent)
|5171|5171| {
|    | [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
|5321|5321| 	{
|5322|5322| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5323|5323| 			return;
|5324|    |-		else
|5325|    |-			this.RemoveGuard();
|    |5324|+		this.RemoveGuard();
|5326|5325| 	}
|5327|5326| 
|5328|5327| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5655|5655| 
|5656|5656| 	if (this.IsFormationController())
|5657|5657| 		this.CallMemberFunction("CancelSetupTradeRoute", [target]);
|5658|    |-}
|    |5658|+};
|5659|5659| /**
|5660|5660|  * Adds trade order to the queue. Either walk to the first market, or
|5661|5661|  * start a new route. Not forced, so it can be interrupted by attacks.
|    | [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
|5983|5983| 				{
|5984|5984| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5985|5985| 					var targetClasses = this.order.data.targetClasses;
|5986|    |-					if (targetClasses.attack && cmpIdentity
|5987|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5986|+					if (targetClasses.attack && cmpIdentity &&
|    |5987|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5988|5988| 						continue;
|5989|5989| 					if (targetClasses.avoid && cmpIdentity
|5990|5990| 						&& 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
|5986|5986| 					if (targetClasses.attack && cmpIdentity
|5987|5987| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5988|5988| 						continue;
|5989|    |-					if (targetClasses.avoid && cmpIdentity
|5990|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5989|+					if (targetClasses.avoid && cmpIdentity &&
|    |5990|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5991|5991| 						continue;
|5992|5992| 					// Only used by the AIs to prevent some choices of targets
|5993|5993| 					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
|6009|6009| 		{
|6010|6010| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|6011|6011| 			var targetClasses = this.order.data.targetClasses;
|6012|    |-			if (cmpIdentity && targetClasses.attack
|6013|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |6012|+			if (cmpIdentity && targetClasses.attack &&
|    |6013|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|6014|6014| 				continue;
|6015|6015| 			if (cmpIdentity && targetClasses.avoid
|6016|6016| 				&& 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
|6012|6012| 			if (cmpIdentity && targetClasses.attack
|6013|6013| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|6014|6014| 				continue;
|6015|    |-			if (cmpIdentity && targetClasses.avoid
|6016|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |6015|+			if (cmpIdentity && targetClasses.avoid &&
|    |6016|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|6017|6017| 				continue;
|6018|6018| 			// Only used by the AIs to prevent some choices of targets
|6019|6019| 			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
|6165|6165| 
|6166|6166| UnitAI.prototype.SetHeldPosition = function(x, z)
|6167|6167| {
|6168|    |-	this.heldPosition = {"x": x, "z": z};
|    |6168|+	this.heldPosition = { "x": x, "z": z};
|6169|6169| };
|6170|6170| 
|6171|6171| 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
|6165|6165| 
|6166|6166| UnitAI.prototype.SetHeldPosition = function(x, z)
|6167|6167| {
|6168|    |-	this.heldPosition = {"x": x, "z": z};
|    |6168|+	this.heldPosition = {"x": x, "z": z };
|6169|6169| };
|6170|6170| 
|6171|6171| 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
|6192|6192| 	return false;
|6193|6193| };
|6194|6194| 
|6195|    |-//// Helper functions ////
|    |6195|+// // Helper functions ////
|6196|6196| 
|6197|6197| /**
|6198|6198|  * 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
|6211|6211| 		return undefined;
|6212|6212| 
|6213|6213| 	return component.GetRange(type);
|6214|    |-}
|    |6214|+};
|6215|6215| 
|6216|6216| UnitAI.prototype.CanAttack = function(target)
|6217|6217| {
|    | [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
|6387|6387| 	return cmpPack && cmpPack.IsPacking();
|6388|6388| };
|6389|6389| 
|6390|    |-//// Formation specific functions ////
|    |6390|+// // Formation specific functions ////
|6391|6391| 
|6392|6392| UnitAI.prototype.IsAttackingAsFormation = function()
|6393|6393| {
|    | [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
|6392|6392| UnitAI.prototype.IsAttackingAsFormation = function()
|6393|6393| {
|6394|6394| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6395|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6396|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6395|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6396|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6397|6397| };
|6398|6398| 
|6399|6399| //// 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
|6396|6396| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6397|6397| };
|6398|6398| 
|6399|    |-//// Animal specific functions ////
|    |6399|+// // Animal specific functions ////
|6400|6400| 
|6401|6401| UnitAI.prototype.MoveRandomly = function(distance)
|6402|6402| {
|    | [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
|6447|6447| {
|6448|6448| 	let cmpUnitMotion = Engine.QueryInterface(this.entity, IID_UnitMotion);
|6449|6449| 	return cmpUnitMotion && cmpUnitMotion.GetFacePointAfterMove();
|6450|    |-}
|    |6450|+};
|6451|6451| 
|6452|6452| UnitAI.prototype.AttackEntitiesByPreference = function(ents)
|6453|6453| {

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4088| »   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
|5012| »   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
|5027| »   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
|5093| »   let·ent·=·ents.find(ent·=>·this.CanHeal(ent));
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'ent' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|5116| »   »   ····cmpAttack.GetAttackTypes().some(type·=>·cmpUnitAI.CheckTargetAttackRange(this.isGuardOf,·type)))
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'type' is already declared in the upper scope.

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

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

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

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

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

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

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

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

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

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

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

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

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

Notice that when going from GATHER.APPROACHING to GATHER.APPROACHING the entity won't go through enter (i.e. gather until full, send to gather a different resource, sent to gather first resource whilst still approaching the second). IMHO That does not need fixing here since it is a rather minor issue and is not breaking.

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

(Empty line not needed.)

Stan added a subscriber: wraitii.
‎[18:51:01] ‎Freagarach‎: Stan: ^ Not sure whether I can accept now ^^' I think it is just a minor issue, what about you?
‎[18:52:06] ‎Stan‎: Freagarach, is it because you asked me to do it on enter rather than approaching?
‎[18:54:57] ‎Freagarach‎: Problem if you do it on approaching is that it won't go through it when standing next to the resource.
‎[18:55:58] ‎Stan‎: Are you sure?
‎[18:56:08] ‎Stan‎: it should try to show the tool 
‎[18:56:21] ‎Stan‎: hence enter approaching?
‎[18:57:23] ‎Freagarach‎: if (this.CheckTargetRange(this.order.data.target, IID_ResourceGatherer)) this.SetNextState("INDIVIDUAL.GATHER.GATHERING");
‎[18:58:18] ‎Stan‎: Mmmh then question lies in which is the most common case
‎[18:58:35] ‎Freagarach‎: Or what costs the most time ^^
‎[18:59:38] ‎Freagarach‎: (Proper fix could include moving the range check to GATHER.enter and SetNextState("INDIVIDUAL.GATHER").)
‎[19:00:12] ‎Freagarach‎: But wraitii had some opinion regarding stuff in the order vs stuff in "enter".
‎[19:03:12] ‎Stan‎: So we should ask wraitii ?
‎[19:04:37] ‎Freagarach‎: That is the safest ^^
‎[19:04:40] ‎Stan‎: bb, do you have thoughts ?

@wraitii thoughts ?

Hm. This is quite debatable :P

The first thing is the "enter" not being triggered -> when leaving-entering a state in the same FSM-state, only the substate handler is triggered. That's working as designed, but it's tricky here.
I think it's a bad idea to put too much code in there because of that. So my advice would be to break things into functions (similar code is reused elsewhere) and call those in the APPROCAHING/GATHERING "enter" handlers.

Secondly, I think this is fine in the FSM state. It could also be in the order, since it's more of a QoL issue than a real "AI" thing. I don't mind it in the state though, I suppose it can be useful.

Stan updated this revision to Diff 12918.Jul 25 2020, 1:39 PM

Do it in the order instead

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
| 819| 819| 					this.FinishOrder();
| 820| 820| 					return;
| 821| 821| 				}
| 822|    |-				else
| 823|    |-				{
|    | 822|+				
| 824| 823| 					this.SetNextState("GARRISON.APPROACHING");
| 825| 824| 					return;
| 826|    |-				}
|    | 825|+				
| 827| 826| 			}
| 828| 827| 
| 829| 828| 			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
|1083|1083| 			},
|1084|1084| 		},
|1085|1085| 
|1086|    |-		"GARRISON":{
|    |1086|+		"GARRISON": {
|1087|1087| 			"APPROACHING": {
|1088|1088| 				"enter": function() {
|1089|1089| 					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
|2087|2087| 
|2088|2088| 				"Attacked": function(msg) {
|2089|2089| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2090|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2091|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2090|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2091|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2092|2092| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2093|2093| 				},
|2094|2094| 			},
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 7 tabs but found 6.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2549|2549| 
|2550|2550| 								return type.specific == resourceType.specific &&
|2551|2551| 								    (type.specific != "meat" || resourceTemplate == template);
|2552|    |-						});
|    |2552|+							});
|2553|2553| 
|2554|2554| 						if (nearbyResource)
|2555|2555| 						{
|    | [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
|2881|2881| 					{
|2882|2882| 						// The building was already finished/fully repaired before we arrived;
|2883|2883| 						// let the ConstructionFinished handler handle this.
|2884|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2884|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2885|2885| 						return true;
|2886|2886| 					}
|2887|2887| 
|    | [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
|2881|2881| 					{
|2882|2882| 						// The building was already finished/fully repaired before we arrived;
|2883|2883| 						// let the ConstructionFinished handler handle this.
|2884|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2884|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2885|2885| 						return true;
|2886|2886| 					}
|2887|2887| 
|    | [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
|3171|3171| 				this.StopTimer();
|3172|3172| 				this.ResetAnimation();
|3173|3173| 				if (this.formationAnimationVariant)
|3174|    |-					this.SetAnimationVariant(this.formationAnimationVariant)
|    |3174|+					this.SetAnimationVariant(this.formationAnimationVariant);
|3175|3175| 				else
|3176|3176| 					this.SetDefaultAnimationVariant();
|3177|3177| 				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
|3385|3385| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3386|3386| 
|3387|3387| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3388|    |-							// only used for domestic animals
|    |3388|+		// only used for domestic animals
|3389|3389| 
|3390|3390| 		// Reuse the same garrison behaviour for animals.
|3391|3391| 		"GARRISON": "INDIVIDUAL.GARRISON",
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3435|3435| 
|3436|3436| UnitAI.prototype.IsAnimal = function()
|3437|3437| {
|3438|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3438|+	return (!!this.template.NaturalBehaviour);
|3439|3439| };
|3440|3440| 
|3441|3441| 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
|3575|3575| 		{
|3576|3576| 			let index = this.GetCurrentState().indexOf(".");
|3577|3577| 			if (index != -1)
|3578|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3578|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3579|3579| 			this.Stop(false);
|3580|3580| 		}
|3581|3581| 
|    | [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
|3632|3632| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3633|3633| 			continue;
|3634|3634| 		if (i == 0)
|3635|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3635|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3636|3636| 		else
|3637|3637| 			this.orderQueue.splice(i, 1);
|3638|3638| 		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
|3632|3632| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3633|3633| 			continue;
|3634|3634| 		if (i == 0)
|3635|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3635|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3636|3636| 		else
|3637|3637| 			this.orderQueue.splice(i, 1);
|3638|3638| 		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
|3761|3761| };
|3762|3762| 
|3763|3763| 
|3764|    |-//// FSM linkage functions ////
|    |3764|+// // FSM linkage functions ////
|3765|3765| 
|3766|3766| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3767|3767| 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
|3934|3934| 				continue;
|3935|3935| 			if (this.orderQueue[i].type == type)
|3936|3936| 				continue;
|3937|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3937|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3938|3938| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3939|3939| 			return;
|3940|3940| 		}
|    | [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
|3934|3934| 				continue;
|3935|3935| 			if (this.orderQueue[i].type == type)
|3936|3936| 				continue;
|3937|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3937|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3938|3938| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3939|3939| 			return;
|3940|3940| 		}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4175|4175| 	if (data.timerRepeat === undefined)
|4176|4176| 		this.timer = undefined;
|4177|4177| 
|4178|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4178|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4179|4179| };
|4180|4180| 
|4181|4181| /**
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4175|4175| 	if (data.timerRepeat === undefined)
|4176|4176| 		this.timer = undefined;
|4177|4177| 
|4178|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4178|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4179|4179| };
|4180|4180| 
|4181|4181| /**
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4220|4220| 	// TODO: This is a bit inefficient since every unit listens to every
|4221|4221| 	// construction message - ideally we could scope it to only the one we're building
|4222|4222| 
|4223|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4223|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4224|4224| };
|4225|4225| 
|4226|4226| 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
|4220|4220| 	// TODO: This is a bit inefficient since every unit listens to every
|4221|4221| 	// construction message - ideally we could scope it to only the one we're building
|4222|4222| 
|4223|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4223|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4224|4224| };
|4225|4225| 
|4226|4226| 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
|4259|4259| 	if (msg.fromStatusEffect)
|4260|4260| 		return;
|4261|4261| 
|4262|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4262|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4263|4263| };
|4264|4264| 
|4265|4265| 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
|4259|4259| 	if (msg.fromStatusEffect)
|4260|4260| 		return;
|4261|4261| 
|4262|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4262|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4263|4263| };
|4264|4264| 
|4265|4265| 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
|4264|4264| 
|4265|4265| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4266|4266| {
|4267|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4267|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4268|4268| };
|4269|4269| 
|4270|4270| 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
|4264|4264| 
|4265|4265| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4266|4266| {
|4267|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4267|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4268|4268| };
|4269|4269| 
|4270|4270| 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
|4269|4269| 
|4270|4270| UnitAI.prototype.OnHealthChanged = function(msg)
|4271|4271| {
|4272|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4272|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4273|4273| };
|4274|4274| 
|4275|4275| 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
|4269|4269| 
|4270|4270| UnitAI.prototype.OnHealthChanged = function(msg)
|4271|4271| {
|4272|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4272|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4273|4273| };
|4274|4274| 
|4275|4275| 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
|4284|4284| 
|4285|4285| UnitAI.prototype.OnPackFinished = function(msg)
|4286|4286| {
|4287|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4287|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4288|4288| };
|4289|4289| 
|4290|4290| //// 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
|4284|4284| 
|4285|4285| UnitAI.prototype.OnPackFinished = function(msg)
|4286|4286| {
|4287|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4287|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4288|4288| };
|4289|4289| 
|4290|4290| //// 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
|4287|4287| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4288|4288| };
|4289|4289| 
|4290|    |-//// Helper functions to be called by the FSM ////
|    |4290|+// // Helper functions to be called by the FSM ////
|4291|4291| 
|4292|4292| UnitAI.prototype.GetWalkSpeed = function()
|4293|4293| {
|    | [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
|5017|5017| UnitAI.prototype.AttackEntityInZone = function(ents)
|5018|5018| {
|5019|5019| 	var target = ents.find(target =>
|5020|    |-		this.CanAttack(target)
|5021|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |5020|+		this.CanAttack(target) &&
|    |5021|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|5022|5022| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|5023|5023| 	);
|5024|5024| 	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
|5018|5018| {
|5019|5019| 	var target = ents.find(target =>
|5020|5020| 		this.CanAttack(target)
|5021|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|5022|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |5021|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |5022|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|5023|5023| 	);
|5024|5024| 	if (!target)
|5025|5025| 		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
|5102|5102| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|5103|5103| 	if (this.isGuardOf)
|5104|5104| 	{
|5105|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |5105|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|5106|5106| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|5107|5107| 		if (cmpUnitAI && cmpAttack &&
|5108|5108| 		    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
|5106|5106| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|5107|5107| 		if (cmpUnitAI && cmpAttack &&
|5108|5108| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|5109|    |-				return false;
|    |5109|+			return false;
|5110|5110| 	}
|5111|5111| 
|5112|5112| 	// 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
|5144|5144| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|5145|5145| 	if (this.isGuardOf)
|5146|5146| 	{
|5147|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |5147|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|5148|5148| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|5149|5149| 		if (cmpUnitAI && cmpAttack &&
|5150|5150| 		    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
|5157|5157| 	return false;
|5158|5158| };
|5159|5159| 
|5160|    |-//// External interface functions ////
|    |5160|+// // External interface functions ////
|5161|5161| 
|5162|5162| UnitAI.prototype.SetFormationController = function(ent)
|5163|5163| {
|    | [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
|5313|5313| 	{
|5314|5314| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5315|5315| 			return;
|5316|    |-		else
|5317|    |-			this.RemoveGuard();
|    |5316|+		this.RemoveGuard();
|5318|5317| 	}
|5319|5318| 
|5320|5319| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5647|5647| 
|5648|5648| 	if (this.IsFormationController())
|5649|5649| 		this.CallMemberFunction("CancelSetupTradeRoute", [target]);
|5650|    |-}
|    |5650|+};
|5651|5651| /**
|5652|5652|  * Adds trade order to the queue. Either walk to the first market, or
|5653|5653|  * start a new route. Not forced, so it can be interrupted by attacks.
|    | [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
|5975|5975| 				{
|5976|5976| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5977|5977| 					var targetClasses = this.order.data.targetClasses;
|5978|    |-					if (targetClasses.attack && cmpIdentity
|5979|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5978|+					if (targetClasses.attack && cmpIdentity &&
|    |5979|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5980|5980| 						continue;
|5981|5981| 					if (targetClasses.avoid && cmpIdentity
|5982|5982| 						&& 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
|5978|5978| 					if (targetClasses.attack && cmpIdentity
|5979|5979| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5980|5980| 						continue;
|5981|    |-					if (targetClasses.avoid && cmpIdentity
|5982|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5981|+					if (targetClasses.avoid && cmpIdentity &&
|    |5982|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5983|5983| 						continue;
|5984|5984| 					// Only used by the AIs to prevent some choices of targets
|5985|5985| 					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
|6001|6001| 		{
|6002|6002| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|6003|6003| 			var targetClasses = this.order.data.targetClasses;
|6004|    |-			if (cmpIdentity && targetClasses.attack
|6005|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |6004|+			if (cmpIdentity && targetClasses.attack &&
|    |6005|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|6006|6006| 				continue;
|6007|6007| 			if (cmpIdentity && targetClasses.avoid
|6008|6008| 				&& 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
|6004|6004| 			if (cmpIdentity && targetClasses.attack
|6005|6005| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|6006|6006| 				continue;
|6007|    |-			if (cmpIdentity && targetClasses.avoid
|6008|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |6007|+			if (cmpIdentity && targetClasses.avoid &&
|    |6008|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|6009|6009| 				continue;
|6010|6010| 			// Only used by the AIs to prevent some choices of targets
|6011|6011| 			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
|6157|6157| 
|6158|6158| UnitAI.prototype.SetHeldPosition = function(x, z)
|6159|6159| {
|6160|    |-	this.heldPosition = {"x": x, "z": z};
|    |6160|+	this.heldPosition = { "x": x, "z": z};
|6161|6161| };
|6162|6162| 
|6163|6163| 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
|6157|6157| 
|6158|6158| UnitAI.prototype.SetHeldPosition = function(x, z)
|6159|6159| {
|6160|    |-	this.heldPosition = {"x": x, "z": z};
|    |6160|+	this.heldPosition = {"x": x, "z": z };
|6161|6161| };
|6162|6162| 
|6163|6163| 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
|6184|6184| 	return false;
|6185|6185| };
|6186|6186| 
|6187|    |-//// Helper functions ////
|    |6187|+// // Helper functions ////
|6188|6188| 
|6189|6189| /**
|6190|6190|  * 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
|6203|6203| 		return undefined;
|6204|6204| 
|6205|6205| 	return component.GetRange(type);
|6206|    |-}
|    |6206|+};
|6207|6207| 
|6208|6208| UnitAI.prototype.CanAttack = function(target)
|6209|6209| {
|    | [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
|6379|6379| 	return cmpPack && cmpPack.IsPacking();
|6380|6380| };
|6381|6381| 
|6382|    |-//// Formation specific functions ////
|    |6382|+// // Formation specific functions ////
|6383|6383| 
|6384|6384| UnitAI.prototype.IsAttackingAsFormation = function()
|6385|6385| {
|    | [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
|6384|6384| UnitAI.prototype.IsAttackingAsFormation = function()
|6385|6385| {
|6386|6386| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6387|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6388|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6387|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6388|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6389|6389| };
|6390|6390| 
|6391|6391| //// 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
|6388|6388| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6389|6389| };
|6390|6390| 
|6391|    |-//// Animal specific functions ////
|    |6391|+// // Animal specific functions ////
|6392|6392| 
|6393|6393| UnitAI.prototype.MoveRandomly = function(distance)
|6394|6394| {
|    | [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
|6439|6439| {
|6440|6440| 	let cmpUnitMotion = Engine.QueryInterface(this.entity, IID_UnitMotion);
|6441|6441| 	return cmpUnitMotion && cmpUnitMotion.GetFacePointAfterMove();
|6442|    |-}
|    |6442|+};
|6443|6443| 
|6444|6444| UnitAI.prototype.AttackEntitiesByPreference = function(ents)
|6445|6445| {

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4080| »   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
|5004| »   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
|5019| »   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
|5085| »   let·ent·=·ents.find(ent·=>·this.CanHeal(ent));
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'ent' is already declared in the upper scope.

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

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

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

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

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

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

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

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

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

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

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

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

Giving this a longer look, I'm doubtful if it's not better in gathering.Enter or in a function somewhere called in APPROACHING/GATHERING. I guess it'll hardly ever happen without also passing through Order.Gather, which seems OK.
I pondered using a "FINDINGDROPSITE" state to regroup the different paths in which we find a dropside, but that doesn't really seem worth doing.

I think this fails if you order a unit to gather on a resource it can't gather.

I think this fails if you order a unit to gather on a resource it can't gather.

How come? Moreover, one is not supposed to end here when we can't gather the resource.

How come? Moreover, one is not supposed to end here when we can't gather the resource.

CanCarryMore will return false and we'll enter the condition - despite it obviously making no sense.
I do agree that the unit shouldn't end up here, but you never know.

Stan added a comment.Aug 5 2020, 1:10 PM

So what should I do?

Stan updated this revision to Diff 13075.Aug 5 2020, 3:40 PM

Check if allowed to gather

Vulcan added a comment.Aug 5 2020, 4:36 PM

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

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

Stan updated this revision to Diff 13078.Aug 5 2020, 4:38 PM

Abort mission if we are disguised as gatherer

Vulcan added a comment.Aug 5 2020, 4:39 PM

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

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

Vulcan added a comment.Aug 5 2020, 5:09 PM

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

Linter detected issues:
Executing section Source...
Executing section JS...
**** ESLintBear (no-else-return) [Section <empty> | Severity NORMAL] ****
!    ! Unnecessary 'else' after 'return'.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[ 832] 				else
[ 833] 				{
[ 832] 				
[ 836] 				}
[ 835] 				
**** ESLintBear (key-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[1096] 		"GARRISON":{
[1096] 		"GARRISON": {
**** ESLintBear (operator-linebreak) [Section <empty> | Severity NORMAL] ****
!    ! '&&' 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
[2100] 					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
[2101] 						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
[2100] 					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
[2101] 						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
**** ESLintBear (indent) [Section <empty> | Severity NORMAL] ****
!    ! Expected indentation of 6 tabs but found 5.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[2561] 					});
[2561] 						});
**** ESLintBear (semi) [Section <empty> | Severity NORMAL] ****
!    ! Missing semicolon.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[3178] 					this.SetAnimationVariant(this.formationAnimationVariant)
[3178] 					this.SetAnimationVariant(this.formationAnimationVariant);
**** ESLintBear (indent) [Section <empty> | Severity NORMAL] ****
!    ! 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
[3392] 							// only used for domestic animals
[3392] 		// only used for domestic animals
**** ESLintBear (no-unneeded-ternary) [Section <empty> | Severity NORMAL] ****
!    ! 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
[3442] 	return (this.template.NaturalBehaviour ? true : false);
[3442] 	return (!!this.template.NaturalBehaviour);
**** ESLintBear (comma-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[3582] 				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
[3582] 				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[3639] 			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
[3639] 			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[3639] 			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
[3639] 			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
**** ESLintBear (spaced-comment) [Section <empty> | Severity NORMAL] ****
!    ! 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
[3768] //// FSM linkage functions ////
[3768] // // FSM linkage functions ////
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! A space is required after '{'.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[3941] 			this.orderQueue.splice(i, 0, {"type": type, "data": data});
[3941] 			this.orderQueue.splice(i, 0, { "type": type, "data": data});
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! A space is required before '}'.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[3941] 			this.orderQueue.splice(i, 0, {"type": type, "data": data});
[3941] 			this.orderQueue.splice(i, 0, {"type": type, "data": data });
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! A space is required after '{'.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[4182] 	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
[4182] 	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! A space is required before '}'.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[4182] 	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
[4182] 	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4268] 	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
[4268] 	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4268] 	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
[4268] 	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4273] 	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
[4273] 	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4273] 	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
[4273] 	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4278] 	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
[4278] 	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4278] 	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
[4278] 	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4293] 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
[4293] 	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4293] 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
[4293] 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
**** ESLintBear (spaced-comment) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4296] //// Helper functions to be called by the FSM ////
[4296] // // Helper functions to be called by the FSM ////
**** ESLintBear (operator-linebreak) [Section <empty> | Severity NORMAL] ****
!    ! '&&' 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
[5021] 		this.CanAttack(target)
[5022] 		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
[5021] 		this.CanAttack(target) &&
[5022] 		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
**** ESLintBear (operator-linebreak) [Section <empty> | Severity NORMAL] ****
!    ! '&&' 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
[5022] 		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
[5023] 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
[5022] 		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
[5023] 		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
**** ESLintBear (no-multi-spaces) [Section <empty> | Severity NORMAL] ****
!    ! 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
[5106] 		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
[5106] 		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
**** ESLintBear (indent) [Section <empty> | Severity NORMAL] ****
!    ! 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
[5110] 				return false;
[5110] 			return false;
**** ESLintBear (no-multi-spaces) [Section <empty> | Severity NORMAL] ****
!    ! 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
[5148] 		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
[5148] 		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
**** ESLintBear (spaced-comment) [Section <empty> | Severity NORMAL] ****
!    ! 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
[5161] //// External interface functions ////
[5161] // // External interface functions ////
**** ESLintBear (no-else-return) [Section <empty> | Severity NORMAL] ****
!    ! Unnecessary 'else' after 'return'.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[5317] 		else
[5318] 			this.RemoveGuard();
[5317] 		this.RemoveGuard();
**** ESLintBear (semi) [Section <empty> | Severity NORMAL] ****
!    ! Missing semicolon.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[5651] }
[5651] };
**** ESLintBear (operator-linebreak) [Section <empty> | Severity NORMAL] ****
!    ! '&&' should be placed at the end of the line.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[5979] 					if (targetClasses.attack && cmpIdentity
[5980] 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
[5979] 					if (targetClasses.attack && cmpIdentity &&
[5980] 						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
**** ESLintBear (operator-linebreak) [Section <empty> | Severity NORMAL] ****
!    ! '&&' should be placed at the end of the line.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[5982] 					if (targetClasses.avoid && cmpIdentity
[5983] 						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
[5982] 					if (targetClasses.avoid && cmpIdentity &&
[5983] 						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
**** ESLintBear (operator-linebreak) [Section <empty> | Severity NORMAL] ****
!    ! '&&' 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
[6005] 			if (cmpIdentity && targetClasses.attack
[6006] 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
[6005] 			if (cmpIdentity && targetClasses.attack &&
[6006] 				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
**** ESLintBear (operator-linebreak) [Section <empty> | Severity NORMAL] ****
!    ! '&&' 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
[6008] 			if (cmpIdentity && targetClasses.avoid
[6009] 				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
[6008] 			if (cmpIdentity && targetClasses.avoid &&
[6009] 				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[6161] 	this.heldPosition = {"x": x, "z": z};
[6161] 	this.heldPosition = { "x": x, "z": z};
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[6161] 	this.heldPosition = {"x": x, "z": z};
[6161] 	this.heldPosition = {"x": x, "z": z };
**** ESLintBear (spaced-comment) [Section <empty> | Severity NORMAL] ****
!    ! 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
[6188] //// Helper functions ////
[6188] // // Helper functions ////
**** ESLintBear (semi) [Section <empty> | Severity NORMAL] ****
!    ! Missing semicolon.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[6207] }
[6207] };
**** ESLintBear (spaced-comment) [Section <empty> | Severity NORMAL] ****
!    ! 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
[6383] //// Formation specific functions ////
[6383] // // Formation specific functions ////
**** ESLintBear (operator-linebreak) [Section <empty> | Severity NORMAL] ****
!    ! '&&' 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
[6388] 	return cmpAttack && cmpAttack.CanAttackAsFormation()
[6389] 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
[6388] 	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
[6389] 		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
**** ESLintBear (spaced-comment) [Section <empty> | Severity NORMAL] ****
!    ! 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
[6392] //// Animal specific functions ////
[6392] // // Animal specific functions ////
**** ESLintBear (semi) [Section <empty> | Severity NORMAL] ****
!    ! Missing semicolon.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[6443] }
[6443] };

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

binaries/data/mods/public/simulation/components/UnitAI.js
[4084] »   var·isWorkType·=·type·=>·type·==·"Gather"·||·type·==·"Trade"·||·type·==·"Repair"·||·type·==·"ReturnResource";
**** ESLintBear (no-shadow) [Section: JS | Severity: NORMAL] ****
!    ! 'type' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
[5005] »   var·target·=·ents.find(target·=>·this.CanAttack(target));
**** ESLintBear (no-shadow) [Section: JS | Severity: NORMAL] ****
!    ! 'target' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
[5020] »   var·target·=·ents.find(target·=>
**** ESLintBear (no-shadow) [Section: JS | Severity: NORMAL] ****
!    ! 'target' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
[5086] »   let·ent·=·ents.find(ent·=>·this.CanHeal(ent));
**** ESLintBear (no-shadow) [Section: JS | Severity: NORMAL] ****
!    ! 'ent' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
[5109] »   »   ····cmpAttack.GetAttackTypes().some(type·=>·cmpUnitAI.CheckTargetAttackRange(this.isGuardOf,·type)))
**** ESLintBear (no-shadow) [Section: JS | Severity: NORMAL] ****
!    ! 'type' is already declared in the upper scope.

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

binaries/data/mods/public/simulation/components/UnitAI.js
[3178] »   »   »   »   »   this.SetAnimationVariant(this.formationAnimationVariant)
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Missing semicolon.

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
[5022] »   »   &&·this.CheckTargetDistanceFromHeldPosition(target,·IID_Attack,·this.GetBestAttackAgainst(target,·true))
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
[5023] »   »   &&·(this.GetStance().respondChaseBeyondVision·||·this.CheckTargetIsInVisionRange(target))
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
[5651] }
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Missing semicolon.

binaries/data/mods/public/simulation/components/UnitAI.js
[5980] »   »   »   »   »   »   &&·!MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.attack))
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
[5983] »   »   »   »   »   »   &&·MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.avoid))
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
[5996] »   var·targets·=·this.GetTargetsFromUnit();
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! 'targets' is already defined.

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
[6006] »   »   »   »   &&·!MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.attack))
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
[6009] »   »   »   »   &&·MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.avoid))
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
[6207] }
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Missing semicolon.

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

binaries/data/mods/public/simulation/components/UnitAI.js
[6443] }
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Missing semicolon.
Executing section cli...

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

Freagarach added inline comments.Aug 5 2020, 5:55 PM
binaries/data/mods/public/simulation/components/UnitAI.js
536

^

538

Space, also add here this.CanGather(target) and you can ditch the one below?

554

dropsites seems to be one word?

Stan updated this revision to Diff 13082.Aug 5 2020, 5:59 PM
Stan marked 3 inline comments as done.

Inlines

Vulcan added a comment.Aug 5 2020, 6:05 PM

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

Linter detected issues:
Executing section Source...
Executing section JS...
**** ESLintBear (no-else-return) [Section <empty> | Severity NORMAL] ****
!    ! Unnecessary 'else' after 'return'.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[ 825] 				else
[ 826] 				{
[ 825] 				
[ 829] 				}
[ 828] 				
**** ESLintBear (key-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[1089] 		"GARRISON":{
[1089] 		"GARRISON": {
**** ESLintBear (operator-linebreak) [Section <empty> | Severity NORMAL] ****
!    ! '&&' 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
[2093] 					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
[2094] 						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
[2093] 					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
[2094] 						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
**** ESLintBear (indent) [Section <empty> | Severity NORMAL] ****
!    ! Expected indentation of 6 tabs but found 5.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[2554] 					});
[2554] 						});
**** ESLintBear (semi) [Section <empty> | Severity NORMAL] ****
!    ! Missing semicolon.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[3171] 					this.SetAnimationVariant(this.formationAnimationVariant)
[3171] 					this.SetAnimationVariant(this.formationAnimationVariant);
**** ESLintBear (indent) [Section <empty> | Severity NORMAL] ****
!    ! Expected indentation of 2 tabs but found 7.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[3385] 							// only used for domestic animals
[3385] 		// only used for domestic animals
**** ESLintBear (no-unneeded-ternary) [Section <empty> | Severity NORMAL] ****
!    ! 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
[3435] 	return (this.template.NaturalBehaviour ? true : false);
[3435] 	return (!!this.template.NaturalBehaviour);
**** ESLintBear (comma-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[3575] 				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
[3575] 				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[3632] 			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
[3632] 			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[3632] 			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
[3632] 			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
**** ESLintBear (spaced-comment) [Section <empty> | Severity NORMAL] ****
!    ! 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
[3761] //// FSM linkage functions ////
[3761] // // FSM linkage functions ////
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[3934] 			this.orderQueue.splice(i, 0, {"type": type, "data": data});
[3934] 			this.orderQueue.splice(i, 0, { "type": type, "data": data});
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[3934] 			this.orderQueue.splice(i, 0, {"type": type, "data": data});
[3934] 			this.orderQueue.splice(i, 0, {"type": type, "data": data });
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! A space is required after '{'.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[4175] 	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
[4175] 	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! A space is required before '}'.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[4175] 	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
[4175] 	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4261] 	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
[4261] 	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4261] 	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
[4261] 	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4266] 	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
[4266] 	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4266] 	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
[4266] 	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4271] 	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
[4271] 	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4271] 	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
[4271] 	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4286] 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
[4286] 	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4286] 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
[4286] 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
**** ESLintBear (spaced-comment) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4289] //// Helper functions to be called by the FSM ////
[4289] // // Helper functions to be called by the FSM ////
**** ESLintBear (operator-linebreak) [Section <empty> | Severity NORMAL] ****
!    ! '&&' 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
[5014] 		this.CanAttack(target)
[5015] 		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
[5014] 		this.CanAttack(target) &&
[5015] 		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
**** ESLintBear (operator-linebreak) [Section <empty> | Severity NORMAL] ****
!    ! '&&' 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
[5015] 		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
[5016] 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
[5015] 		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
[5016] 		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
**** ESLintBear (no-multi-spaces) [Section <empty> | Severity NORMAL] ****
!    ! 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
[5099] 		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
[5099] 		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
**** ESLintBear (indent) [Section <empty> | Severity NORMAL] ****
!    ! 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
[5103] 				return false;
[5103] 			return false;
**** ESLintBear (no-multi-spaces) [Section <empty> | Severity NORMAL] ****
!    ! 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
[5141] 		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
[5141] 		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
**** ESLintBear (spaced-comment) [Section <empty> | Severity NORMAL] ****
!    ! 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
[5154] //// External interface functions ////
[5154] // // External interface functions ////
**** ESLintBear (no-else-return) [Section <empty> | Severity NORMAL] ****
!    ! Unnecessary 'else' after 'return'.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[5310] 		else
[5311] 			this.RemoveGuard();
[5310] 		this.RemoveGuard();
**** ESLintBear (semi) [Section <empty> | Severity NORMAL] ****
!    ! Missing semicolon.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[5644] }
[5644] };
**** ESLintBear (operator-linebreak) [Section <empty> | Severity NORMAL] ****
!    ! '&&' 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
[5972] 					if (targetClasses.attack && cmpIdentity
[5973] 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
[5972] 					if (targetClasses.attack && cmpIdentity &&
[5973] 						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
**** ESLintBear (operator-linebreak) [Section <empty> | Severity NORMAL] ****
!    ! '&&' 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
[5975] 					if (targetClasses.avoid && cmpIdentity
[5976] 						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
[5975] 					if (targetClasses.avoid && cmpIdentity &&
[5976] 						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
**** ESLintBear (operator-linebreak) [Section <empty> | Severity NORMAL] ****
!    ! '&&' 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
[5998] 			if (cmpIdentity && targetClasses.attack
[5999] 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
[5998] 			if (cmpIdentity && targetClasses.attack &&
[5999] 				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
**** ESLintBear (operator-linebreak) [Section <empty> | Severity NORMAL] ****
!    ! '&&' 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
[6001] 			if (cmpIdentity && targetClasses.avoid
[6002] 				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
[6001] 			if (cmpIdentity && targetClasses.avoid &&
[6002] 				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[6154] 	this.heldPosition = {"x": x, "z": z};
[6154] 	this.heldPosition = { "x": x, "z": z};
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[6154] 	this.heldPosition = {"x": x, "z": z};
[6154] 	this.heldPosition = {"x": x, "z": z };
**** ESLintBear (spaced-comment) [Section <empty> | Severity NORMAL] ****
!    ! 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
[6181] //// Helper functions ////
[6181] // // Helper functions ////
**** ESLintBear (semi) [Section <empty> | Severity NORMAL] ****
!    ! Missing semicolon.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[6200] }
[6200] };
**** ESLintBear (spaced-comment) [Section <empty> | Severity NORMAL] ****
!    ! 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
[6376] //// Formation specific functions ////
[6376] // // Formation specific functions ////
**** ESLintBear (operator-linebreak) [Section <empty> | Severity NORMAL] ****
!    ! '&&' 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
[6381] 	return cmpAttack && cmpAttack.CanAttackAsFormation()
[6382] 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
[6381] 	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
[6382] 		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
**** ESLintBear (spaced-comment) [Section <empty> | Severity NORMAL] ****
!    ! 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
[6385] //// Animal specific functions ////
[6385] // // Animal specific functions ////
**** ESLintBear (semi) [Section <empty> | Severity NORMAL] ****
!    ! Missing semicolon.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[6436] }
[6436] };

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

binaries/data/mods/public/simulation/components/UnitAI.js
[4077] »   var·isWorkType·=·type·=>·type·==·"Gather"·||·type·==·"Trade"·||·type·==·"Repair"·||·type·==·"ReturnResource";
**** ESLintBear (no-shadow) [Section: JS | Severity: NORMAL] ****
!    ! 'type' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
[4998] »   var·target·=·ents.find(target·=>·this.CanAttack(target));
**** ESLintBear (no-shadow) [Section: JS | Severity: NORMAL] ****
!    ! 'target' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
[5013] »   var·target·=·ents.find(target·=>
**** ESLintBear (no-shadow) [Section: JS | Severity: NORMAL] ****
!    ! 'target' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
[5079] »   let·ent·=·ents.find(ent·=>·this.CanHeal(ent));
**** ESLintBear (no-shadow) [Section: JS | Severity: NORMAL] ****
!    ! 'ent' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
[5102] »   »   ····cmpAttack.GetAttackTypes().some(type·=>·cmpUnitAI.CheckTargetAttackRange(this.isGuardOf,·type)))
**** ESLintBear (no-shadow) [Section: JS | Severity: NORMAL] ****
!    ! 'type' is already declared in the upper scope.

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

binaries/data/mods/public/simulation/components/UnitAI.js
[3171] »   »   »   »   »   this.SetAnimationVariant(this.formationAnimationVariant)
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Missing semicolon.

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
[5015] »   »   &&·this.CheckTargetDistanceFromHeldPosition(target,·IID_Attack,·this.GetBestAttackAgainst(target,·true))
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
[5016] »   »   &&·(this.GetStance().respondChaseBeyondVision·||·this.CheckTargetIsInVisionRange(target))
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
[5644] }
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Missing semicolon.

binaries/data/mods/public/simulation/components/UnitAI.js
[5973] »   »   »   »   »   »   &&·!MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.attack))
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
[5976] »   »   »   »   »   »   &&·MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.avoid))
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
[5989] »   var·targets·=·this.GetTargetsFromUnit();
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! 'targets' is already defined.

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
[5999] »   »   »   »   &&·!MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.attack))
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
[6002] »   »   »   »   &&·MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.avoid))
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
[6200] }
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Missing semicolon.

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

binaries/data/mods/public/simulation/components/UnitAI.js
[6436] }
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Missing semicolon.
Executing section cli...

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

Freagarach requested changes to this revision.EditedAug 6 2020, 7:39 PM

Then you can notice other faulty thing: L2490 ;(

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

I did mean by "target" "this.order.data.target".

This revision now requires changes to proceed.Aug 6 2020, 7:39 PM
Stan updated this revision to Diff 13118.Aug 6 2020, 8:13 PM

Revert cangather

Vulcan added a comment.Aug 6 2020, 8:18 PM

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

Linter detected issues:
Executing section Source...
Executing section JS...
**** ESLintBear (no-else-return) [Section <empty> | Severity NORMAL] ****
!    ! Unnecessary 'else' after 'return'.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[ 827] 				else
[ 828] 				{
[ 827] 				
[ 831] 				}
[ 830] 				
**** ESLintBear (key-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[1091] 		"GARRISON":{
[1091] 		"GARRISON": {
**** ESLintBear (operator-linebreak) [Section <empty> | Severity NORMAL] ****
!    ! '&&' 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
[2098] 					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
[2099] 						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
[2098] 					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
[2099] 						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
**** ESLintBear (indent) [Section <empty> | Severity NORMAL] ****
!    ! Expected indentation of 6 tabs but found 5.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[2559] 					});
[2559] 						});
**** ESLintBear (semi) [Section <empty> | Severity NORMAL] ****
!    ! Missing semicolon.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[3176] 					this.SetAnimationVariant(this.formationAnimationVariant)
[3176] 					this.SetAnimationVariant(this.formationAnimationVariant);
**** ESLintBear (indent) [Section <empty> | Severity NORMAL] ****
!    ! 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
[3390] 							// only used for domestic animals
[3390] 		// only used for domestic animals
**** ESLintBear (no-unneeded-ternary) [Section <empty> | Severity NORMAL] ****
!    ! 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
[3440] 	return (this.template.NaturalBehaviour ? true : false);
[3440] 	return (!!this.template.NaturalBehaviour);
**** ESLintBear (comma-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[3580] 				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
[3580] 				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! A space is required after '{'.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[3637] 			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
[3637] 			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! A space is required before '}'.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[3637] 			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
[3637] 			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
**** ESLintBear (spaced-comment) [Section <empty> | Severity NORMAL] ****
!    ! 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
[3766] //// FSM linkage functions ////
[3766] // // FSM linkage functions ////
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[3939] 			this.orderQueue.splice(i, 0, {"type": type, "data": data});
[3939] 			this.orderQueue.splice(i, 0, { "type": type, "data": data});
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[3939] 			this.orderQueue.splice(i, 0, {"type": type, "data": data});
[3939] 			this.orderQueue.splice(i, 0, {"type": type, "data": data });
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! A space is required after '{'.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[4180] 	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
[4180] 	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! A space is required before '}'.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[4180] 	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
[4180] 	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4266] 	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
[4266] 	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4266] 	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
[4266] 	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4271] 	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
[4271] 	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4271] 	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
[4271] 	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4276] 	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
[4276] 	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4276] 	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
[4276] 	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4291] 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
[4291] 	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4291] 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
[4291] 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
**** ESLintBear (spaced-comment) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4294] //// Helper functions to be called by the FSM ////
[4294] // // Helper functions to be called by the FSM ////
**** ESLintBear (operator-linebreak) [Section <empty> | Severity NORMAL] ****
!    ! '&&' 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
[5019] 		this.CanAttack(target)
[5020] 		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
[5019] 		this.CanAttack(target) &&
[5020] 		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
**** ESLintBear (operator-linebreak) [Section <empty> | Severity NORMAL] ****
!    ! '&&' 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
[5020] 		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
[5021] 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
[5020] 		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
[5021] 		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
**** ESLintBear (no-multi-spaces) [Section <empty> | Severity NORMAL] ****
!    ! 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
[5104] 		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
[5104] 		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
**** ESLintBear (indent) [Section <empty> | Severity NORMAL] ****
!    ! 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
[5108] 				return false;
[5108] 			return false;
**** ESLintBear (no-multi-spaces) [Section <empty> | Severity NORMAL] ****
!    ! 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
[5146] 		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
[5146] 		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
**** ESLintBear (spaced-comment) [Section <empty> | Severity NORMAL] ****
!    ! 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
[5159] //// External interface functions ////
[5159] // // External interface functions ////
**** ESLintBear (no-else-return) [Section <empty> | Severity NORMAL] ****
!    ! Unnecessary 'else' after 'return'.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[5315] 		else
[5316] 			this.RemoveGuard();
[5315] 		this.RemoveGuard();
**** ESLintBear (semi) [Section <empty> | Severity NORMAL] ****
!    ! Missing semicolon.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[5649] }
[5649] };
**** ESLintBear (operator-linebreak) [Section <empty> | Severity NORMAL] ****
!    ! '&&' 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
[5977] 					if (targetClasses.attack && cmpIdentity
[5978] 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
[5977] 					if (targetClasses.attack && cmpIdentity &&
[5978] 						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
**** ESLintBear (operator-linebreak) [Section <empty> | Severity NORMAL] ****
!    ! '&&' 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
[5980] 					if (targetClasses.avoid && cmpIdentity
[5981] 						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
[5980] 					if (targetClasses.avoid && cmpIdentity &&
[5981] 						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
**** ESLintBear (operator-linebreak) [Section <empty> | Severity NORMAL] ****
!    ! '&&' 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
[6003] 			if (cmpIdentity && targetClasses.attack
[6004] 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
[6003] 			if (cmpIdentity && targetClasses.attack &&
[6004] 				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
**** ESLintBear (operator-linebreak) [Section <empty> | Severity NORMAL] ****
!    ! '&&' 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
[6006] 			if (cmpIdentity && targetClasses.avoid
[6007] 				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
[6006] 			if (cmpIdentity && targetClasses.avoid &&
[6007] 				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[6159] 	this.heldPosition = {"x": x, "z": z};
[6159] 	this.heldPosition = { "x": x, "z": z};
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[6159] 	this.heldPosition = {"x": x, "z": z};
[6159] 	this.heldPosition = {"x": x, "z": z };
**** ESLintBear (spaced-comment) [Section <empty> | Severity NORMAL] ****
!    ! 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
[6186] //// Helper functions ////
[6186] // // Helper functions ////
**** ESLintBear (semi) [Section <empty> | Severity NORMAL] ****
!    ! Missing semicolon.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[6205] }
[6205] };
**** ESLintBear (spaced-comment) [Section <empty> | Severity NORMAL] ****
!    ! 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
[6381] //// Formation specific functions ////
[6381] // // Formation specific functions ////
**** ESLintBear (operator-linebreak) [Section <empty> | Severity NORMAL] ****
!    ! '&&' 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
[6386] 	return cmpAttack && cmpAttack.CanAttackAsFormation()
[6387] 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
[6386] 	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
[6387] 		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
**** ESLintBear (spaced-comment) [Section <empty> | Severity NORMAL] ****
!    ! 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
[6390] //// Animal specific functions ////
[6390] // // Animal specific functions ////
**** ESLintBear (semi) [Section <empty> | Severity NORMAL] ****
!    ! Missing semicolon.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[6441] }
[6441] };

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

binaries/data/mods/public/simulation/components/UnitAI.js
[4082] »   var·isWorkType·=·type·=>·type·==·"Gather"·||·type·==·"Trade"·||·type·==·"Repair"·||·type·==·"ReturnResource";
**** ESLintBear (no-shadow) [Section: JS | Severity: NORMAL] ****
!    ! 'type' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
[5003] »   var·target·=·ents.find(target·=>·this.CanAttack(target));
**** ESLintBear (no-shadow) [Section: JS | Severity: NORMAL] ****
!    ! 'target' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
[5018] »   var·target·=·ents.find(target·=>
**** ESLintBear (no-shadow) [Section: JS | Severity: NORMAL] ****
!    ! 'target' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
[5084] »   let·ent·=·ents.find(ent·=>·this.CanHeal(ent));
**** ESLintBear (no-shadow) [Section: JS | Severity: NORMAL] ****
!    ! 'ent' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
[5107] »   »   ····cmpAttack.GetAttackTypes().some(type·=>·cmpUnitAI.CheckTargetAttackRange(this.isGuardOf,·type)))
**** ESLintBear (no-shadow) [Section: JS | Severity: NORMAL] ****
!    ! 'type' is already declared in the upper scope.

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

binaries/data/mods/public/simulation/components/UnitAI.js
[3176] »   »   »   »   »   this.SetAnimationVariant(this.formationAnimationVariant)
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Missing semicolon.

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
[5020] »   »   &&·this.CheckTargetDistanceFromHeldPosition(target,·IID_Attack,·this.GetBestAttackAgainst(target,·true))
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
[5021] »   »   &&·(this.GetStance().respondChaseBeyondVision·||·this.CheckTargetIsInVisionRange(target))
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
[5649] }
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Missing semicolon.

binaries/data/mods/public/simulation/components/UnitAI.js
[5978] »   »   »   »   »   »   &&·!MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.attack))
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
[5981] »   »   »   »   »   »   &&·MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.avoid))
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
[5994] »   var·targets·=·this.GetTargetsFromUnit();
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! 'targets' is already defined.

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
[6004] »   »   »   »   &&·!MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.attack))
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
[6007] »   »   »   »   &&·MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.avoid))
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
[6205] }
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Missing semicolon.

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

binaries/data/mods/public/simulation/components/UnitAI.js
[6441] }
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Missing semicolon.
Executing section cli...

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

Freagarach requested changes to this revision.Aug 6 2020, 8:55 PM
Freagarach added inline comments.
binaries/data/mods/public/simulation/components/UnitAI.js
538

GetGatherRate needs also a specific type, which you don't always have.

This revision now requires changes to proceed.Aug 6 2020, 8:55 PM
Stan updated this revision to Diff 13127.Aug 7 2020, 10:31 AM

Fix gathering

Stan marked 3 inline comments as done.Aug 7 2020, 10:32 AM

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

Linter detected issues:
Executing section Source...
Executing section JS...
**** ESLintBear (no-else-return) [Section <empty> | Severity NORMAL] ****
!    ! Unnecessary 'else' after 'return'.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[ 827] 				else
[ 828] 				{
[ 827] 				
[ 831] 				}
[ 830] 				
**** ESLintBear (key-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[1091] 		"GARRISON":{
[1091] 		"GARRISON": {
**** ESLintBear (operator-linebreak) [Section <empty> | Severity NORMAL] ****
!    ! '&&' 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
[2098] 					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
[2099] 						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
[2098] 					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
[2099] 						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
**** ESLintBear (indent) [Section <empty> | Severity NORMAL] ****
!    ! Expected indentation of 6 tabs but found 5.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[2559] 					});
[2559] 						});
**** ESLintBear (semi) [Section <empty> | Severity NORMAL] ****
!    ! Missing semicolon.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[3176] 					this.SetAnimationVariant(this.formationAnimationVariant)
[3176] 					this.SetAnimationVariant(this.formationAnimationVariant);
**** ESLintBear (indent) [Section <empty> | Severity NORMAL] ****
!    ! 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
[3390] 							// only used for domestic animals
[3390] 		// only used for domestic animals
**** ESLintBear (no-unneeded-ternary) [Section <empty> | Severity NORMAL] ****
!    ! 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
[3440] 	return (this.template.NaturalBehaviour ? true : false);
[3440] 	return (!!this.template.NaturalBehaviour);
**** ESLintBear (comma-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[3580] 				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
[3580] 				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! A space is required after '{'.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[3637] 			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
[3637] 			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! A space is required before '}'.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[3637] 			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
[3637] 			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
**** ESLintBear (spaced-comment) [Section <empty> | Severity NORMAL] ****
!    ! 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
[3766] //// FSM linkage functions ////
[3766] // // FSM linkage functions ////
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[3939] 			this.orderQueue.splice(i, 0, {"type": type, "data": data});
[3939] 			this.orderQueue.splice(i, 0, { "type": type, "data": data});
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[3939] 			this.orderQueue.splice(i, 0, {"type": type, "data": data});
[3939] 			this.orderQueue.splice(i, 0, {"type": type, "data": data });
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! A space is required after '{'.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[4180] 	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
[4180] 	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! A space is required before '}'.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[4180] 	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
[4180] 	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4266] 	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
[4266] 	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4266] 	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
[4266] 	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4271] 	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
[4271] 	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4271] 	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
[4271] 	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4276] 	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
[4276] 	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4276] 	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
[4276] 	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4291] 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
[4291] 	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4291] 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
[4291] 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
**** ESLintBear (spaced-comment) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4294] //// Helper functions to be called by the FSM ////
[4294] // // Helper functions to be called by the FSM ////
**** ESLintBear (operator-linebreak) [Section <empty> | Severity NORMAL] ****
!    ! '&&' 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
[5019] 		this.CanAttack(target)
[5020] 		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
[5019] 		this.CanAttack(target) &&
[5020] 		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
**** ESLintBear (operator-linebreak) [Section <empty> | Severity NORMAL] ****
!    ! '&&' 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
[5020] 		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
[5021] 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
[5020] 		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
[5021] 		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
**** ESLintBear (no-multi-spaces) [Section <empty> | Severity NORMAL] ****
!    ! 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
[5104] 		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
[5104] 		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
**** ESLintBear (indent) [Section <empty> | Severity NORMAL] ****
!    ! 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
[5108] 				return false;
[5108] 			return false;
**** ESLintBear (no-multi-spaces) [Section <empty> | Severity NORMAL] ****
!    ! 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
[5146] 		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
[5146] 		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
**** ESLintBear (spaced-comment) [Section <empty> | Severity NORMAL] ****
!    ! 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
[5159] //// External interface functions ////
[5159] // // External interface functions ////
**** ESLintBear (no-else-return) [Section <empty> | Severity NORMAL] ****
!    ! Unnecessary 'else' after 'return'.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[5315] 		else
[5316] 			this.RemoveGuard();
[5315] 		this.RemoveGuard();
**** ESLintBear (semi) [Section <empty> | Severity NORMAL] ****
!    ! Missing semicolon.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[5649] }
[5649] };
**** ESLintBear (operator-linebreak) [Section <empty> | Severity NORMAL] ****
!    ! '&&' 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
[5977] 					if (targetClasses.attack && cmpIdentity
[5978] 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
[5977] 					if (targetClasses.attack && cmpIdentity &&
[5978] 						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
**** ESLintBear (operator-linebreak) [Section <empty> | Severity NORMAL] ****
!    ! '&&' 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
[5980] 					if (targetClasses.avoid && cmpIdentity
[5981] 						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
[5980] 					if (targetClasses.avoid && cmpIdentity &&
[5981] 						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
**** ESLintBear (operator-linebreak) [Section <empty> | Severity NORMAL] ****
!    ! '&&' 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
[6003] 			if (cmpIdentity && targetClasses.attack
[6004] 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
[6003] 			if (cmpIdentity && targetClasses.attack &&
[6004] 				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
**** ESLintBear (operator-linebreak) [Section <empty> | Severity NORMAL] ****
!    ! '&&' 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
[6006] 			if (cmpIdentity && targetClasses.avoid
[6007] 				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
[6006] 			if (cmpIdentity && targetClasses.avoid &&
[6007] 				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[6159] 	this.heldPosition = {"x": x, "z": z};
[6159] 	this.heldPosition = { "x": x, "z": z};
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[6159] 	this.heldPosition = {"x": x, "z": z};
[6159] 	this.heldPosition = {"x": x, "z": z };
**** ESLintBear (spaced-comment) [Section <empty> | Severity NORMAL] ****
!    ! 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
[6186] //// Helper functions ////
[6186] // // Helper functions ////
**** ESLintBear (semi) [Section <empty> | Severity NORMAL] ****
!    ! Missing semicolon.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[6205] }
[6205] };
**** ESLintBear (spaced-comment) [Section <empty> | Severity NORMAL] ****
!    ! 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
[6381] //// Formation specific functions ////
[6381] // // Formation specific functions ////
**** ESLintBear (operator-linebreak) [Section <empty> | Severity NORMAL] ****
!    ! '&&' 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
[6386] 	return cmpAttack && cmpAttack.CanAttackAsFormation()
[6387] 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
[6386] 	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
[6387] 		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
**** ESLintBear (spaced-comment) [Section <empty> | Severity NORMAL] ****
!    ! 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
[6390] //// Animal specific functions ////
[6390] // // Animal specific functions ////
**** ESLintBear (semi) [Section <empty> | Severity NORMAL] ****
!    ! Missing semicolon.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[6441] }
[6441] };

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

binaries/data/mods/public/simulation/components/UnitAI.js
[4082] »   var·isWorkType·=·type·=>·type·==·"Gather"·||·type·==·"Trade"·||·type·==·"Repair"·||·type·==·"ReturnResource";
**** ESLintBear (no-shadow) [Section: JS | Severity: NORMAL] ****
!    ! 'type' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
[5003] »   var·target·=·ents.find(target·=>·this.CanAttack(target));
**** ESLintBear (no-shadow) [Section: JS | Severity: NORMAL] ****
!    ! 'target' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
[5018] »   var·target·=·ents.find(target·=>
**** ESLintBear (no-shadow) [Section: JS | Severity: NORMAL] ****
!    ! 'target' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
[5084] »   let·ent·=·ents.find(ent·=>·this.CanHeal(ent));
**** ESLintBear (no-shadow) [Section: JS | Severity: NORMAL] ****
!    ! 'ent' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
[5107] »   »   ····cmpAttack.GetAttackTypes().some(type·=>·cmpUnitAI.CheckTargetAttackRange(this.isGuardOf,·type)))
**** ESLintBear (no-shadow) [Section: JS | Severity: NORMAL] ****
!    ! 'type' is already declared in the upper scope.

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

binaries/data/mods/public/simulation/components/UnitAI.js
[3176] »   »   »   »   »   this.SetAnimationVariant(this.formationAnimationVariant)
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Missing semicolon.

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
[5020] »   »   &&·this.CheckTargetDistanceFromHeldPosition(target,·IID_Attack,·this.GetBestAttackAgainst(target,·true))
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
[5021] »   »   &&·(this.GetStance().respondChaseBeyondVision·||·this.CheckTargetIsInVisionRange(target))
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
[5649] }
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Missing semicolon.

binaries/data/mods/public/simulation/components/UnitAI.js
[5978] »   »   »   »   »   »   &&·!MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.attack))
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
[5981] »   »   »   »   »   »   &&·MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.avoid))
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
[5994] »   var·targets·=·this.GetTargetsFromUnit();
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! 'targets' is already defined.

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
[6004] »   »   »   »   &&·!MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.attack))
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
[6007] »   »   »   »   &&·MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.avoid))
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
[6205] }
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Missing semicolon.

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

binaries/data/mods/public/simulation/components/UnitAI.js
[6441] }
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Missing semicolon.
Executing section cli...

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

Freagarach updated this revision to Diff 13133.Aug 7 2020, 1:59 PM

Directly go to finding new target when we exhaust a resource since that also checks for fullness.
This avoids the ugly INVALID_ENTITY as a target.

Freagarach updated this revision to Diff 13134.Aug 7 2020, 2:10 PM

Find new target when we cannot gather. That will also ensure we stop when we can't gather at all.

Freagarach added inline comments.Aug 7 2020, 2:17 PM
binaries/data/mods/public/simulation/components/UnitAI.js
2498–2503

This move is not even necessary ^^'

Vulcan added a comment.Aug 7 2020, 2:36 PM

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

Linter detected issues:
Executing section Source...
Executing section JS...
**** ESLintBear (no-else-return) [Section <empty> | Severity NORMAL] ****
!    ! Unnecessary 'else' after 'return'.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[ 826] 				else
[ 827] 				{
[ 826] 				
[ 830] 				}
[ 829] 				
**** ESLintBear (key-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[1090] 		"GARRISON":{
[1090] 		"GARRISON": {
**** ESLintBear (operator-linebreak) [Section <empty> | Severity NORMAL] ****
!    ! '&&' 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
[2097] 					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
[2098] 						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
[2097] 					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
[2098] 						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
**** ESLintBear (no-trailing-spaces) [Section <empty> | Severity NORMAL] ****
!    ! Trailing spaces not allowed.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[2256] 						if (msg.likelyFailure || 
[2256] 						if (msg.likelyFailure ||
**** ESLintBear (indent) [Section <empty> | Severity NORMAL] ****
!    ! Expected indentation of 6 tabs but found 5.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[2557] 					});
[2557] 						});
**** ESLintBear (semi) [Section <empty> | Severity NORMAL] ****
!    ! Missing semicolon.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[3174] 					this.SetAnimationVariant(this.formationAnimationVariant)
[3174] 					this.SetAnimationVariant(this.formationAnimationVariant);
**** ESLintBear (indent) [Section <empty> | Severity NORMAL] ****
!    ! 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
[3388] 							// only used for domestic animals
[3388] 		// only used for domestic animals
**** ESLintBear (no-unneeded-ternary) [Section <empty> | Severity NORMAL] ****
!    ! 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
[3438] 	return (this.template.NaturalBehaviour ? true : false);
[3438] 	return (!!this.template.NaturalBehaviour);
**** ESLintBear (comma-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[3578] 				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
[3578] 				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[3635] 			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
[3635] 			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[3635] 			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
[3635] 			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
**** ESLintBear (spaced-comment) [Section <empty> | Severity NORMAL] ****
!    ! 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
[3764] //// FSM linkage functions ////
[3764] // // FSM linkage functions ////
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[3937] 			this.orderQueue.splice(i, 0, {"type": type, "data": data});
[3937] 			this.orderQueue.splice(i, 0, { "type": type, "data": data});
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[3937] 			this.orderQueue.splice(i, 0, {"type": type, "data": data});
[3937] 			this.orderQueue.splice(i, 0, {"type": type, "data": data });
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4178] 	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
[4178] 	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4178] 	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
[4178] 	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4264] 	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
[4264] 	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4264] 	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
[4264] 	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4269] 	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
[4269] 	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4269] 	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
[4269] 	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4274] 	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
[4274] 	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4274] 	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
[4274] 	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4289] 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
[4289] 	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4289] 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
[4289] 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
**** ESLintBear (spaced-comment) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4292] //// Helper functions to be called by the FSM ////
[4292] // // Helper functions to be called by the FSM ////
**** ESLintBear (operator-linebreak) [Section <empty> | Severity NORMAL] ****
!    ! '&&' 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
[5017] 		this.CanAttack(target)
[5018] 		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
[5017] 		this.CanAttack(target) &&
[5018] 		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
**** ESLintBear (operator-linebreak) [Section <empty> | Severity NORMAL] ****
!    ! '&&' 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
[5018] 		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
[5019] 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
[5018] 		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
[5019] 		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
**** ESLintBear (no-multi-spaces) [Section <empty> | Severity NORMAL] ****
!    ! 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
[5102] 		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
[5102] 		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
**** ESLintBear (indent) [Section <empty> | Severity NORMAL] ****
!    ! 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
[5106] 				return false;
[5106] 			return false;
**** ESLintBear (no-multi-spaces) [Section <empty> | Severity NORMAL] ****
!    ! 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
[5144] 		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
[5144] 		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
**** ESLintBear (spaced-comment) [Section <empty> | Severity NORMAL] ****
!    ! 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
[5157] //// External interface functions ////
[5157] // // External interface functions ////
**** ESLintBear (no-else-return) [Section <empty> | Severity NORMAL] ****
!    ! Unnecessary 'else' after 'return'.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[5313] 		else
[5314] 			this.RemoveGuard();
[5313] 		this.RemoveGuard();
**** ESLintBear (semi) [Section <empty> | Severity NORMAL] ****
!    ! Missing semicolon.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[5647] }
[5647] };
**** ESLintBear (no-trailing-spaces) [Section <empty> | Severity NORMAL] ****
!    ! Trailing spaces not allowed.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[5668] 		if (cmpTrader.HasBothMarkets() && 
[5668] 		if (cmpTrader.HasBothMarkets() &&
**** ESLintBear (operator-linebreak) [Section <empty> | Severity NORMAL] ****
!    ! '&&' 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
[5975] 					if (targetClasses.attack && cmpIdentity
[5976] 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
[5975] 					if (targetClasses.attack && cmpIdentity &&
[5976] 						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
**** ESLintBear (operator-linebreak) [Section <empty> | Severity NORMAL] ****
!    ! '&&' 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
[5978] 					if (targetClasses.avoid && cmpIdentity
[5979] 						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
[5978] 					if (targetClasses.avoid && cmpIdentity &&
[5979] 						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
**** ESLintBear (operator-linebreak) [Section <empty> | Severity NORMAL] ****
!    ! '&&' 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
[6001] 			if (cmpIdentity && targetClasses.attack
[6002] 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
[6001] 			if (cmpIdentity && targetClasses.attack &&
[6002] 				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
**** ESLintBear (operator-linebreak) [Section <empty> | Severity NORMAL] ****
!    ! '&&' 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
[6004] 			if (cmpIdentity && targetClasses.avoid
[6005] 				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
[6004] 			if (cmpIdentity && targetClasses.avoid &&
[6005] 				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[6157] 	this.heldPosition = {"x": x, "z": z};
[6157] 	this.heldPosition = { "x": x, "z": z};
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[6157] 	this.heldPosition = {"x": x, "z": z};
[6157] 	this.heldPosition = {"x": x, "z": z };
**** ESLintBear (spaced-comment) [Section <empty> | Severity NORMAL] ****
!    ! 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
[6184] //// Helper functions ////
[6184] // // Helper functions ////
**** ESLintBear (semi) [Section <empty> | Severity NORMAL] ****
!    ! Missing semicolon.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[6203] }
[6203] };
**** ESLintBear (spaced-comment) [Section <empty> | Severity NORMAL] ****
!    ! 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
[6379] //// Formation specific functions ////
[6379] // // Formation specific functions ////
**** ESLintBear (operator-linebreak) [Section <empty> | Severity NORMAL] ****
!    ! '&&' 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
[6384] 	return cmpAttack && cmpAttack.CanAttackAsFormation()
[6385] 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
[6384] 	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
[6385] 		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
**** ESLintBear (spaced-comment) [Section <empty> | Severity NORMAL] ****
!    ! 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
[6388] //// Animal specific functions ////
[6388] // // Animal specific functions ////
**** ESLintBear (semi) [Section <empty> | Severity NORMAL] ****
!    ! Missing semicolon.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[6439] }
[6439] };

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

binaries/data/mods/public/simulation/components/UnitAI.js
[4080] »   var·isWorkType·=·type·=>·type·==·"Gather"·||·type·==·"Trade"·||·type·==·"Repair"·||·type·==·"ReturnResource";
**** ESLintBear (no-shadow) [Section: JS | Severity: NORMAL] ****
!    ! 'type' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
[5001] »   var·target·=·ents.find(target·=>·this.CanAttack(target));
**** ESLintBear (no-shadow) [Section: JS | Severity: NORMAL] ****
!    ! 'target' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
[5016] »   var·target·=·ents.find(target·=>
**** ESLintBear (no-shadow) [Section: JS | Severity: NORMAL] ****
!    ! 'target' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
[5082] »   let·ent·=·ents.find(ent·=>·this.CanHeal(ent));
**** ESLintBear (no-shadow) [Section: JS | Severity: NORMAL] ****
!    ! 'ent' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
[5105] »   »   ····cmpAttack.GetAttackTypes().some(type·=>·cmpUnitAI.CheckTargetAttackRange(this.isGuardOf,·type)))
**** ESLintBear (no-shadow) [Section: JS | Severity: NORMAL] ****
!    ! 'type' is already declared in the upper scope.

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

binaries/data/mods/public/simulation/components/UnitAI.js
[3174] »   »   »   »   »   this.SetAnimationVariant(this.formationAnimationVariant)
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Missing semicolon.

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
[5018] »   »   &&·this.CheckTargetDistanceFromHeldPosition(target,·IID_Attack,·this.GetBestAttackAgainst(target,·true))
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
[5019] »   »   &&·(this.GetStance().respondChaseBeyondVision·||·this.CheckTargetIsInVisionRange(target))
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
[5647] }
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Missing semicolon.

binaries/data/mods/public/simulation/components/UnitAI.js
[5976] »   »   »   »   »   »   &&·!MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.attack))
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
[5979] »   »   »   »   »   »   &&·MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.avoid))
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
[5992] »   var·targets·=·this.GetTargetsFromUnit();
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! 'targets' is already defined.

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
[6002] »   »   »   »   &&·!MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.attack))
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
[6005] »   »   »   »   &&·MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.avoid))
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
[6203] }
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Missing semicolon.

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

binaries/data/mods/public/simulation/components/UnitAI.js
[6439] }
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Missing semicolon.
Executing section cli...

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

Vulcan added a comment.Aug 7 2020, 2:42 PM

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

Linter detected issues:
Executing section Source...
Executing section JS...
**** ESLintBear (no-else-return) [Section <empty> | Severity NORMAL] ****
!    ! Unnecessary 'else' after 'return'.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[ 826] 				else
[ 827] 				{
[ 826] 				
[ 830] 				}
[ 829] 				
**** ESLintBear (key-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[1090] 		"GARRISON":{
[1090] 		"GARRISON": {
**** ESLintBear (operator-linebreak) [Section <empty> | Severity NORMAL] ****
!    ! '&&' 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
[2097] 					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
[2098] 						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
[2097] 					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
[2098] 						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
**** ESLintBear (no-trailing-spaces) [Section <empty> | Severity NORMAL] ****
!    ! Trailing spaces not allowed.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[2256] 						if (msg.likelyFailure || 
[2256] 						if (msg.likelyFailure ||
**** ESLintBear (indent) [Section <empty> | Severity NORMAL] ****
!    ! Expected indentation of 6 tabs but found 5.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[2557] 					});
[2557] 						});
**** ESLintBear (semi) [Section <empty> | Severity NORMAL] ****
!    ! Missing semicolon.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[3174] 					this.SetAnimationVariant(this.formationAnimationVariant)
[3174] 					this.SetAnimationVariant(this.formationAnimationVariant);
**** ESLintBear (indent) [Section <empty> | Severity NORMAL] ****
!    ! 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
[3388] 							// only used for domestic animals
[3388] 		// only used for domestic animals
**** ESLintBear (no-unneeded-ternary) [Section <empty> | Severity NORMAL] ****
!    ! 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
[3438] 	return (this.template.NaturalBehaviour ? true : false);
[3438] 	return (!!this.template.NaturalBehaviour);
**** ESLintBear (comma-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[3578] 				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
[3578] 				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[3635] 			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
[3635] 			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[3635] 			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
[3635] 			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
**** ESLintBear (spaced-comment) [Section <empty> | Severity NORMAL] ****
!    ! 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
[3764] //// FSM linkage functions ////
[3764] // // FSM linkage functions ////
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[3937] 			this.orderQueue.splice(i, 0, {"type": type, "data": data});
[3937] 			this.orderQueue.splice(i, 0, { "type": type, "data": data});
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[3937] 			this.orderQueue.splice(i, 0, {"type": type, "data": data});
[3937] 			this.orderQueue.splice(i, 0, {"type": type, "data": data });
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4178] 	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
[4178] 	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4178] 	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
[4178] 	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4264] 	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
[4264] 	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4264] 	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
[4264] 	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4269] 	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
[4269] 	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4269] 	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
[4269] 	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4274] 	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
[4274] 	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4274] 	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
[4274] 	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4289] 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
[4289] 	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4289] 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
[4289] 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
**** ESLintBear (spaced-comment) [Section <empty> | Severity NORMAL] ****
!    ! 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
[4292] //// Helper functions to be called by the FSM ////
[4292] // // Helper functions to be called by the FSM ////
**** ESLintBear (operator-linebreak) [Section <empty> | Severity NORMAL] ****
!    ! '&&' 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
[5017] 		this.CanAttack(target)
[5018] 		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
[5017] 		this.CanAttack(target) &&
[5018] 		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
**** ESLintBear (operator-linebreak) [Section <empty> | Severity NORMAL] ****
!    ! '&&' 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
[5018] 		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
[5019] 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
[5018] 		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
[5019] 		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
**** ESLintBear (no-multi-spaces) [Section <empty> | Severity NORMAL] ****
!    ! 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
[5102] 		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
[5102] 		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
**** ESLintBear (indent) [Section <empty> | Severity NORMAL] ****
!    ! 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
[5106] 				return false;
[5106] 			return false;
**** ESLintBear (no-multi-spaces) [Section <empty> | Severity NORMAL] ****
!    ! 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
[5144] 		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
[5144] 		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
**** ESLintBear (spaced-comment) [Section <empty> | Severity NORMAL] ****
!    ! 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
[5157] //// External interface functions ////
[5157] // // External interface functions ////
**** ESLintBear (no-else-return) [Section <empty> | Severity NORMAL] ****
!    ! Unnecessary 'else' after 'return'.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[5313] 		else
[5314] 			this.RemoveGuard();
[5313] 		this.RemoveGuard();
**** ESLintBear (semi) [Section <empty> | Severity NORMAL] ****
!    ! Missing semicolon.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[5647] }
[5647] };
**** ESLintBear (no-trailing-spaces) [Section <empty> | Severity NORMAL] ****
!    ! Trailing spaces not allowed.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[5668] 		if (cmpTrader.HasBothMarkets() && 
[5668] 		if (cmpTrader.HasBothMarkets() &&
**** ESLintBear (operator-linebreak) [Section <empty> | Severity NORMAL] ****
!    ! '&&' 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
[5975] 					if (targetClasses.attack && cmpIdentity
[5976] 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
[5975] 					if (targetClasses.attack && cmpIdentity &&
[5976] 						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
**** ESLintBear (operator-linebreak) [Section <empty> | Severity NORMAL] ****
!    ! '&&' 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
[5978] 					if (targetClasses.avoid && cmpIdentity
[5979] 						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
[5978] 					if (targetClasses.avoid && cmpIdentity &&
[5979] 						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
**** ESLintBear (operator-linebreak) [Section <empty> | Severity NORMAL] ****
!    ! '&&' 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
[6001] 			if (cmpIdentity && targetClasses.attack
[6002] 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
[6001] 			if (cmpIdentity && targetClasses.attack &&
[6002] 				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
**** ESLintBear (operator-linebreak) [Section <empty> | Severity NORMAL] ****
!    ! '&&' 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
[6004] 			if (cmpIdentity && targetClasses.avoid
[6005] 				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
[6004] 			if (cmpIdentity && targetClasses.avoid &&
[6005] 				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[6157] 	this.heldPosition = {"x": x, "z": z};
[6157] 	this.heldPosition = { "x": x, "z": z};
**** ESLintBear (object-curly-spacing) [Section <empty> | Severity NORMAL] ****
!    ! 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
[6157] 	this.heldPosition = {"x": x, "z": z};
[6157] 	this.heldPosition = {"x": x, "z": z };
**** ESLintBear (spaced-comment) [Section <empty> | Severity NORMAL] ****
!    ! 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
[6184] //// Helper functions ////
[6184] // // Helper functions ////
**** ESLintBear (semi) [Section <empty> | Severity NORMAL] ****
!    ! Missing semicolon.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[6203] }
[6203] };
**** ESLintBear (spaced-comment) [Section <empty> | Severity NORMAL] ****
!    ! 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
[6379] //// Formation specific functions ////
[6379] // // Formation specific functions ////
**** ESLintBear (operator-linebreak) [Section <empty> | Severity NORMAL] ****
!    ! '&&' 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
[6384] 	return cmpAttack && cmpAttack.CanAttackAsFormation()
[6385] 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
[6384] 	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
[6385] 		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
**** ESLintBear (spaced-comment) [Section <empty> | Severity NORMAL] ****
!    ! 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
[6388] //// Animal specific functions ////
[6388] // // Animal specific functions ////
**** ESLintBear (semi) [Section <empty> | Severity NORMAL] ****
!    ! Missing semicolon.
[----] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[++++] /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
[6439] }
[6439] };

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

binaries/data/mods/public/simulation/components/UnitAI.js
[4080] »   var·isWorkType·=·type·=>·type·==·"Gather"·||·type·==·"Trade"·||·type·==·"Repair"·||·type·==·"ReturnResource";
**** ESLintBear (no-shadow) [Section: JS | Severity: NORMAL] ****
!    ! 'type' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
[5001] »   var·target·=·ents.find(target·=>·this.CanAttack(target));
**** ESLintBear (no-shadow) [Section: JS | Severity: NORMAL] ****
!    ! 'target' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
[5016] »   var·target·=·ents.find(target·=>
**** ESLintBear (no-shadow) [Section: JS | Severity: NORMAL] ****
!    ! 'target' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
[5082] »   let·ent·=·ents.find(ent·=>·this.CanHeal(ent));
**** ESLintBear (no-shadow) [Section: JS | Severity: NORMAL] ****
!    ! 'ent' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/UnitAI.js
[5105] »   »   ····cmpAttack.GetAttackTypes().some(type·=>·cmpUnitAI.CheckTargetAttackRange(this.isGuardOf,·type)))
**** ESLintBear (no-shadow) [Section: JS | Severity: NORMAL] ****
!    ! 'type' is already declared in the upper scope.

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

binaries/data/mods/public/simulation/components/UnitAI.js
[3174] »   »   »   »   »   this.SetAnimationVariant(this.formationAnimationVariant)
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Missing semicolon.

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
[5018] »   »   &&·this.CheckTargetDistanceFromHeldPosition(target,·IID_Attack,·this.GetBestAttackAgainst(target,·true))
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
[5019] »   »   &&·(this.GetStance().respondChaseBeyondVision·||·this.CheckTargetIsInVisionRange(target))
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
[5647] }
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Missing semicolon.

binaries/data/mods/public/simulation/components/UnitAI.js
[5976] »   »   »   »   »   »   &&·!MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.attack))
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
[5979] »   »   »   »   »   »   &&·MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.avoid))
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
[5992] »   var·targets·=·this.GetTargetsFromUnit();
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! 'targets' is already defined.

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
[6002] »   »   »   »   &&·!MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.attack))
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
[6005] »   »   »   »   &&·MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.avoid))
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Misleading line break before '&&'; readers may interpret this as an expression boundary.

binaries/data/mods/public/simulation/components/UnitAI.js
[6203] }
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Missing semicolon.

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

binaries/data/mods/public/simulation/components/UnitAI.js
[6439] }
**** JSHintBear [Section: JS | Severity: NORMAL] ****
!    ! Missing semicolon.
Executing section cli...

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

Revert the move in gather.

Freagarach resigned from this revision.Fri, Sep 11, 11:30 AM
Freagarach removed a reviewer: Freagarach.

I can't review since I wrote part of the code myself.

Angen added a comment.Fri, Sep 11, 9:04 PM

1.) At first look it is good
2.) In my opinion unit should try to store current resource if they differ as well, but that may be another diff
3.) If there is no dropsite, it would fail after moving to resource anyway, but it would be near point where player expects it to go when gives that order, I think it could be confusing why it is not moving, maybe we could inform player that unit failed to find dropsite for given resource (just idea)