Page MenuHomeWildfire Games

Various Unit AI fixes following UM / UAI changes
ClosedPublic

Authored by wraitii on Jul 5 2019, 8:11 PM.

Details

Reviewers
None
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Commits
rP22440: Various Unit AI fixes following UM / UAI changes
Summary

Three things:

  • Garrisoning cleanup (return true in some cases in ENTER when we do change the state)
  • Fix animal walking speed until D1901 lands
  • Fix trading behaviour which occasionally bugged out.
Test Plan

Run some games, test trading.

Diff Detail

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

Event Timeline

wraitii created this revision.Jul 5 2019, 8:11 PM
wraitii added inline comments.
binaries/data/mods/public/simulation/components/UnitAI.js
2807 ↗(On Diff #8735)

can stay return false

2864 ↗(On Diff #8735)

Should probably be in the IF above

Vulcan added a comment.Jul 5 2019, 8:13 PM

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 352| 352| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 353| 353| 		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 354| 354| 		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 355|    |-		{
|    | 355|+		
| 356| 356| 			// we were already on the shoreline, and have not moved since
| 357| 357| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
| 358| 358| 				needToMove = false;
| 359|    |-		}
|    | 359|+		
| 360| 360| 
| 361| 361| 		if (needToMove)
| 362| 362| 			this.SetNextState("INDIVIDUAL.PICKUP.APPROACHING");
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 350| 350| 		// Check if we need to move     TODO implement a better way to know if we are on the shoreline
| 351| 351| 		var needToMove = true;
| 352| 352| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 353|    |-		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 354|    |-		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
|    | 353|+		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x) &&
|    | 354|+		    (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 355| 355| 		{
| 356| 356| 			// we were already on the shoreline, and have not moved since
| 357| 357| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 517| 517| 					this.PushOrderFront("Walk", this.order.data.lastPos);
| 518| 518| 				}
| 519| 519| 				else
| 520|    |-				{
|    | 520|+				
| 521| 521| 					// We couldn't move there, or the target moved away
| 522| 522| 					this.FinishOrder();
| 523|    |-				}
|    | 523|+				
| 524| 524| 				return;
| 525| 525| 			}
| 526| 526| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 736| 736| 			}
| 737| 737| 			// Check if we are already in range, otherwise walk there
| 738| 738| 			if (!this.CheckGarrisonRange(msg.data.target))
| 739|    |-			{
|    | 739|+			
| 740| 740| 				if (!this.CheckTargetVisible(msg.data.target))
| 741| 741| 				{
| 742| 742| 					this.FinishOrder();
| 747| 747| 					this.SetNextState("GARRISON.APPROACHING");
| 748| 748| 					return;
| 749| 749| 				}
| 750|    |-			}
|    | 750|+			
| 751| 751| 
| 752| 752| 			this.SetNextState("GARRISON.GARRISONING");
| 753| 753| 		},
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 742| 742| 					this.FinishOrder();
| 743| 743| 					return;
| 744| 744| 				}
| 745|    |-				else
| 746|    |-				{
|    | 745|+				
| 747| 746| 					this.SetNextState("GARRISON.APPROACHING");
| 748| 747| 					return;
| 749|    |-				}
|    | 748|+				
| 750| 749| 			}
| 751| 750| 
| 752| 751| 			this.SetNextState("GARRISON.GARRISONING");
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 765| 765| 						this.PushOrderFront("Walk", msg.data.lastPos);
| 766| 766| 					}
| 767| 767| 					else
| 768|    |-					{
|    | 768|+					
| 769| 769| 						// We couldn't move there, or the target moved away
| 770| 770| 						this.FinishOrder();
| 771|    |-					}
|    | 771|+					
| 772| 772| 					return;
| 773| 773| 				}
| 774| 774| 
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'GARRISON'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 998| 998| 			},
| 999| 999| 		},
|1000|1000| 
|1001|    |-		"GARRISON":{
|    |1001|+		"GARRISON": {
|1002|1002| 			"enter": function() {
|1003|1003| 				// If the garrisonholder should pickup, warn it so it can take needed action
|1004|1004| 				var cmpGarrisonHolder = Engine.QueryInterface(this.order.data.target, IID_GarrisonHolder);
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1211|1211| 			// If the controller handled an order but some members rejected it,
|1212|1212| 			// they will have no orders and be in the FORMATIONMEMBER.IDLE state.
|1213|1213| 			if (this.orderQueue.length)
|1214|    |-			{
|    |1214|+			
|1215|1215| 				// We're leaving the formation, so stop our FormationWalk order
|1216|1216| 				if (this.FinishOrder())
|1217|1217| 					return;
|1218|    |-			}
|    |1218|+			
|1219|1219| 
|1220|1220| 			// No orders left, we're an individual now
|1221|1221| 			if (this.IsAnimal())
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1239|1239| 			// Move a tile outside the building
|1240|1240| 			let range = 4;
|1241|1241| 			if (this.CheckTargetRangeExplicit(msg.data.target, range, -1))
|1242|    |-			{
|    |1242|+			
|1243|1243| 				// We are already at the target, or can't move at all
|1244|1244| 				this.FinishOrder();
|1245|    |-			}
|    |1245|+			
|1246|1246| 			else
|1247|1247| 			{
|1248|1248| 				this.order.data.min = range;
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1460|1460| 
|1461|1461| 			"LosRangeUpdate": function(msg) {
|1462|1462| 				if (this.GetStance().targetVisibleEnemies)
|1463|    |-				{
|    |1463|+				
|1464|1464| 					// Start attacking one of the newly-seen enemy (if any)
|1465|1465| 					this.AttackEntitiesByPreference(msg.data.added);
|1466|    |-				}
|    |1466|+				
|1467|1467| 			},
|1468|1468| 
|1469|1469| 			"LosHealRangeUpdate": function(msg) {
|    | [NORMAL] ESLintBear (space-before-function-paren):
|    | Unexpected space before function parentheses.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1493|1493| 				this.SelectAnimation("move");
|1494|1494| 			},
|1495|1495| 
|1496|    |-			"leave": function () {
|    |1496|+			"leave": function() {
|1497|1497| 				this.SelectAnimation("idle");
|1498|1498| 				this.StopMoving();
|1499|1499| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1673|1673| 						// if nothing better to do, check if the guarded needs to be healed or repaired
|1674|1674| 						var cmpHealth = Engine.QueryInterface(this.isGuardOf, IID_Health);
|1675|1675| 						if (cmpHealth && cmpHealth.IsInjured())
|1676|    |-						{
|    |1676|+						
|1677|1677| 							if (this.CanHeal(this.isGuardOf))
|1678|1678| 								this.PushOrderFront("Heal", { "target": this.isGuardOf, "force": false });
|1679|1679| 							else if (this.CanRepair(this.isGuardOf))
|1680|1680| 								this.PushOrderFront("Repair", { "target": this.isGuardOf, "autocontinue": false, "force": false });
|1681|    |-						}
|    |1681|+						
|1682|1682| 					}
|1683|1683| 				},
|1684|1684| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1963|1963| 
|1964|1964| 				"Attacked": function(msg) {
|1965|1965| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|1966|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|1967|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |1966|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |1967|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|1968|1968| 						this.RespondToTargetedEntities([msg.data.attacker]);
|1969|1969| 				},
|1970|1970| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2016|2016| 					this.SelectAnimation("move");
|2017|2017| 					var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|2018|2018| 					if (cmpUnitAI && cmpUnitAI.IsFleeing())
|2019|    |-					{
|    |2019|+					
|2020|2020| 						// Run after a fleeing target
|2021|2021| 						this.SetSpeedMultiplier(this.GetRunMultiplier());
|2022|    |-					}
|    |2022|+					
|2023|2023| 					this.StartTimer(1000, 1000);
|2024|2024| 				},
|2025|2025| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2370|2370| 
|2371|2371| 				"Timer": function(msg) {
|2372|2372| 					if (this.ShouldAbandonChase(this.order.data.target, this.order.data.force, IID_Heal, null))
|2373|    |-					{
|    |2373|+					
|2374|2374| 						// Return to our original position unless we have a better order.
|2375|2375| 						if (!this.FinishOrder() && this.GetStance().respondHoldGround)
|2376|2376| 							this.WalkToHeldPosition();
|2377|    |-					}
|    |2377|+					
|2378|2378| 				},
|2379|2379| 
|2380|2380| 				"MovementUpdate": function() {
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2404|2404| 					this.StartTimer(prepare, this.healTimers.repeat);
|2405|2405| 
|2406|2406| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2407|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2407|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2408|2408| 
|2409|2409| 					this.FaceTowardsTarget(this.order.data.target);
|2410|2410| 				},
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2616|2616| 					{
|2617|2617| 						// The building was already finished/fully repaired before we arrived;
|2618|2618| 						// let the ConstructionFinished handler handle this.
|2619|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2619|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2620|2620| 						return true;
|2621|2621| 					}
|2622|2622| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2616|2616| 					{
|2617|2617| 						// The building was already finished/fully repaired before we arrived;
|2618|2618| 						// let the ConstructionFinished handler handle this.
|2619|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2619|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2620|2620| 						return true;
|2621|2621| 					}
|2622|2622| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2808|2808| 
|2809|2809| 					// Check that we can garrison here
|2810|2810| 					if (this.CanGarrison(target))
|2811|    |-					{
|    |2811|+					
|2812|2812| 						// Check that we're in range of the garrison target
|2813|2813| 						if (this.CheckGarrisonRange(target))
|2814|2814| 						{
|2881|2881| 							this.SetNextState("APPROACHING");
|2882|2882| 							return true;
|2883|2883| 						}
|2884|    |-					}
|    |2884|+					
|2885|2885| 					// Garrisoning failed for some reason, so finish the order
|2886|2886| 					this.FinishOrder();
|2887|2887| 					return true;
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3002|3002| 		"Attacked": function(msg) {
|3003|3003| 			if (this.template.NaturalBehaviour == "skittish" ||
|3004|3004| 			    this.template.NaturalBehaviour == "passive")
|3005|    |-			{
|    |3005|+			
|3006|3006| 				this.Flee(msg.data.attacker, false);
|3007|    |-			}
|    |3007|+			
|3008|3008| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|3009|3009| 			{
|3010|3010| 				if (this.CanAttack(msg.data.attacker))
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3011|3011| 					this.Attack(msg.data.attacker, false);
|3012|3012| 			}
|3013|3013| 			else if (this.template.NaturalBehaviour == "domestic")
|3014|    |-			{
|    |3014|+			
|3015|3015| 				// Never flee, stop what we were doing
|3016|3016| 				this.SetNextState("IDLE");
|3017|    |-			}
|    |3017|+			
|3018|3018| 		},
|3019|3019| 
|3020|3020| 		"Order.LeaveFoundation": function(msg) {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3066|3066| 				}
|3067|3067| 				// Start attacking one of the newly-seen enemy (if any)
|3068|3068| 				else if (this.IsDangerousAnimal())
|3069|    |-				{
|    |3069|+				
|3070|3070| 					this.AttackVisibleEntity(msg.data.added);
|3071|    |-				}
|    |3071|+				
|3072|3072| 
|3073|3073| 				// TODO: if two units enter our range together, we'll attack the
|3074|3074| 				// first and then the second won't trigger another LosRangeUpdate
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3109|3109| 				}
|3110|3110| 				// Start attacking one of the newly-seen enemy (if any)
|3111|3111| 				else if (this.template.NaturalBehaviour == "violent")
|3112|    |-				{
|    |3112|+				
|3113|3113| 					this.AttackVisibleEntity(msg.data.added);
|3114|    |-				}
|    |3114|+				
|3115|3115| 			},
|3116|3116| 
|3117|3117| 			"Timer": function(msg) {
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 7.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3124|3124| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3125|3125| 
|3126|3126| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3127|    |-							// only used for domestic animals
|    |3127|+		// only used for domestic animals
|3128|3128| 	},
|3129|3129| };
|3130|3130| 
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3181|3181| 
|3182|3182| UnitAI.prototype.IsAnimal = function()
|3183|3183| {
|3184|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3184|+	return (!!this.template.NaturalBehaviour);
|3185|3185| };
|3186|3186| 
|3187|3187| UnitAI.prototype.IsDangerousAnimal = function()
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3219|3219| UnitAI.prototype.GetGarrisonHolder = function()
|3220|3220| {
|3221|3221| 	if (this.IsGarrisoned())
|3222|    |-	{
|    |3222|+	
|3223|3223| 		for (let order of this.orderQueue)
|3224|3224| 			if (order.type == "Garrison")
|3225|3225| 				return order.data.target;
|3226|    |-	}
|    |3226|+	
|3227|3227| 	return INVALID_ENTITY;
|3228|3228| };
|3229|3229| 
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3297|3297| 		{
|3298|3298| 			let index = this.GetCurrentState().indexOf(".");
|3299|3299| 			if (index != -1)
|3300|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3300|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3301|3301| 			this.Stop(false);
|3302|3302| 		}
|3303|3303| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3353|3353| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3354|3354| 			continue;
|3355|3355| 		if (i == 0)
|3356|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3356|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3357|3357| 		else
|3358|3358| 			this.orderQueue.splice(i, 1);
|3359|3359| 		Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3353|3353| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3354|3354| 			continue;
|3355|3355| 		if (i == 0)
|3356|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3356|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3357|3357| 		else
|3358|3358| 			this.orderQueue.splice(i, 1);
|3359|3359| 		Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3437|3437| };
|3438|3438| 
|3439|3439| 
|3440|    |-//// FSM linkage functions ////
|    |3440|+// // FSM linkage functions ////
|3441|3441| 
|3442|3442| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3443|3443| UnitAI.prototype.SetNextState = function(state)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3609|3609| 				continue;
|3610|3610| 			if (this.orderQueue[i].type == type)
|3611|3611| 				continue;
|3612|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3612|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3613|3613| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3614|3614| 			return;
|3615|3615| 		}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3609|3609| 				continue;
|3610|3610| 			if (this.orderQueue[i].type == type)
|3611|3611| 				continue;
|3612|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3612|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3613|3613| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3614|3614| 			return;
|3615|3615| 		}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3623|3623| {
|3624|3624| 	// Remember the previous work orders to be able to go back to them later if required
|3625|3625| 	if (data && data.force)
|3626|    |-	{
|    |3626|+	
|3627|3627| 		if (this.IsFormationController())
|3628|3628| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3629|3629| 		else
|3630|3630| 			this.UpdateWorkOrders(type);
|3631|    |-	}
|    |3631|+	
|3632|3632| 
|3633|3633| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3634|3634| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3700|3700| 	{
|3701|3701| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3702|3702| 		if (cmpUnitAI)
|3703|    |-		{
|    |3703|+		
|3704|3704| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3705|3705| 			{
|3706|3706| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3709|3709| 					return;
|3710|3710| 				}
|3711|3711| 			}
|3712|    |-		}
|    |3712|+		
|3713|3713| 	}
|3714|3714| 
|3715|3715| 	// If nothing found, take the unit orders
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3702|3702| 		if (cmpUnitAI)
|3703|3703| 		{
|3704|3704| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3705|    |-			{
|    |3705|+			
|3706|3706| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3707|3707| 				{
|3708|3708| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3709|3709| 					return;
|3710|3710| 				}
|3711|    |-			}
|    |3711|+			
|3712|3712| 		}
|3713|3713| 	}
|3714|3714| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3714|3714| 
|3715|3715| 	// If nothing found, take the unit orders
|3716|3716| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3717|    |-	{
|    |3717|+	
|3718|3718| 		if (isWorkType(this.orderQueue[i].type))
|3719|3719| 		{
|3720|3720| 			this.workOrders = this.orderQueue.slice(i);
|3721|3721| 			return;
|3722|3722| 		}
|3723|    |-	}
|    |3723|+	
|3724|3724| };
|3725|3725| 
|3726|3726| UnitAI.prototype.BackToWork = function()
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3780|3780| 	if (data.timerRepeat === undefined)
|3781|3781| 		this.timer = undefined;
|3782|3782| 
|3783|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3783|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3784|3784| };
|3785|3785| 
|3786|3786| /**
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3780|3780| 	if (data.timerRepeat === undefined)
|3781|3781| 		this.timer = undefined;
|3782|3782| 
|3783|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3783|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3784|3784| };
|3785|3785| 
|3786|3786| /**
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3815|3815| 	this.timer = undefined;
|3816|3816| };
|3817|3817| 
|3818|    |-//// Message handlers /////
|    |3818|+// // Message handlers /////
|3819|3819| 
|3820|3820| UnitAI.prototype.OnMotionChanged = function(msg)
|3821|3821| {
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3827|3827| 	// TODO: This is a bit inefficient since every unit listens to every
|3828|3828| 	// construction message - ideally we could scope it to only the one we're building
|3829|3829| 
|3830|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3830|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3831|3831| };
|3832|3832| 
|3833|3833| UnitAI.prototype.OnGlobalEntityRenamed = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3827|3827| 	// TODO: This is a bit inefficient since every unit listens to every
|3828|3828| 	// construction message - ideally we could scope it to only the one we're building
|3829|3829| 
|3830|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3830|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3831|3831| };
|3832|3832| 
|3833|3833| UnitAI.prototype.OnGlobalEntityRenamed = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3852|3852| 
|3853|3853| UnitAI.prototype.OnAttacked = function(msg)
|3854|3854| {
|3855|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3855|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3856|3856| };
|3857|3857| 
|3858|3858| UnitAI.prototype.OnGuardedAttacked = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3852|3852| 
|3853|3853| UnitAI.prototype.OnAttacked = function(msg)
|3854|3854| {
|3855|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3855|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3856|3856| };
|3857|3857| 
|3858|3858| UnitAI.prototype.OnGuardedAttacked = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3857|3857| 
|3858|3858| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3859|3859| {
|3860|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3860|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|3861|3861| };
|3862|3862| 
|3863|3863| UnitAI.prototype.OnHealthChanged = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3857|3857| 
|3858|3858| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3859|3859| {
|3860|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3860|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|3861|3861| };
|3862|3862| 
|3863|3863| UnitAI.prototype.OnHealthChanged = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3862|3862| 
|3863|3863| UnitAI.prototype.OnHealthChanged = function(msg)
|3864|3864| {
|3865|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3865|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|3866|3866| };
|3867|3867| 
|3868|3868| UnitAI.prototype.OnRangeUpdate = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3862|3862| 
|3863|3863| UnitAI.prototype.OnHealthChanged = function(msg)
|3864|3864| {
|3865|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3865|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|3866|3866| };
|3867|3867| 
|3868|3868| UnitAI.prototype.OnRangeUpdate = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3868|3868| UnitAI.prototype.OnRangeUpdate = function(msg)
|3869|3869| {
|3870|3870| 	if (msg.tag == this.losRangeQuery)
|3871|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3871|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|3872|3872| 	else if (msg.tag == this.losHealRangeQuery)
|3873|3873| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3874|3874| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3868|3868| UnitAI.prototype.OnRangeUpdate = function(msg)
|3869|3869| {
|3870|3870| 	if (msg.tag == this.losRangeQuery)
|3871|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3871|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|3872|3872| 	else if (msg.tag == this.losHealRangeQuery)
|3873|3873| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3874|3874| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3870|3870| 	if (msg.tag == this.losRangeQuery)
|3871|3871| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3872|3872| 	else if (msg.tag == this.losHealRangeQuery)
|3873|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3873|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|3874|3874| };
|3875|3875| 
|3876|3876| UnitAI.prototype.OnPackFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3870|3870| 	if (msg.tag == this.losRangeQuery)
|3871|3871| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3872|3872| 	else if (msg.tag == this.losHealRangeQuery)
|3873|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3873|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|3874|3874| };
|3875|3875| 
|3876|3876| UnitAI.prototype.OnPackFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3875|3875| 
|3876|3876| UnitAI.prototype.OnPackFinished = function(msg)
|3877|3877| {
|3878|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3878|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|3879|3879| };
|3880|3880| 
|3881|3881| //// Helper functions to be called by the FSM ////
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3875|3875| 
|3876|3876| UnitAI.prototype.OnPackFinished = function(msg)
|3877|3877| {
|3878|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3878|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|3879|3879| };
|3880|3880| 
|3881|3881| //// Helper functions to be called by the FSM ////
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3878|3878| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|3879|3879| };
|3880|3880| 
|3881|    |-//// Helper functions to be called by the FSM ////
|    |3881|+// // Helper functions to be called by the FSM ////
|3882|3882| 
|3883|3883| UnitAI.prototype.GetWalkSpeed = function()
|3884|3884| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4065|4065| 			PlaySound(name, member);
|4066|4066| 	}
|4067|4067| 	else
|4068|    |-	{
|    |4068|+	
|4069|4069| 		// Otherwise use our own sounds
|4070|4070| 		PlaySound(name, this.entity);
|4071|    |-	}
|    |4071|+	
|4072|4072| };
|4073|4073| 
|4074|4074| /*
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4511|4511| UnitAI.prototype.AttackEntityInZone = function(ents)
|4512|4512| {
|4513|4513| 	var target = ents.find(target =>
|4514|    |-		this.CanAttack(target)
|4515|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4514|+		this.CanAttack(target) &&
|    |4515|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4516|4516| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4517|4517| 	);
|4518|4518| 	if (!target)
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4512|4512| {
|4513|4513| 	var target = ents.find(target =>
|4514|4514| 		this.CanAttack(target)
|4515|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4516|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4515|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4516|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4517|4517| 	);
|4518|4518| 	if (!target)
|4519|4519| 		return false;
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before 'Engine'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4576|4576| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4577|4577| 	if (this.isGuardOf)
|4578|4578| 	{
|4579|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4579|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4580|4580| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4581|4581| 		if (cmpUnitAI && cmpAttack &&
|4582|4582| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 4.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4580|4580| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4581|4581| 		if (cmpUnitAI && cmpAttack &&
|4582|4582| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4583|    |-				return false;
|    |4583|+			return false;
|4584|4584| 	}
|4585|4585| 
|4586|4586| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4585|4585| 
|4586|4586| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4587|4587| 	if (this.GetStance().respondHoldGround)
|4588|    |-	{
|    |4588|+	
|4589|4589| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4590|4590| 			return true;
|4591|    |-	}
|    |4591|+	
|4592|4592| 
|4593|4593| 	// Stop if it's left our vision range, unless we're especially persistent
|4594|4594| 	if (!this.GetStance().respondChaseBeyondVision)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4592|4592| 
|4593|4593| 	// Stop if it's left our vision range, unless we're especially persistent
|4594|4594| 	if (!this.GetStance().respondChaseBeyondVision)
|4595|    |-	{
|    |4595|+	
|4596|4596| 		if (!this.CheckTargetIsInVisionRange(target))
|4597|4597| 			return true;
|4598|    |-	}
|    |4598|+	
|4599|4599| 
|4600|4600| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4601|4601| 	// and will continue moving to its last seen position and then stop)
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before 'Engine'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4618|4618| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4619|4619| 	if (this.isGuardOf)
|4620|4620| 	{
|4621|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4621|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4622|4622| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4623|4623| 		if (cmpUnitAI && cmpAttack &&
|4624|4624| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4631|4631| 	return false;
|4632|4632| };
|4633|4633| 
|4634|    |-//// External interface functions ////
|    |4634|+// // External interface functions ////
|4635|4635| 
|4636|4636| UnitAI.prototype.SetFormationController = function(ent)
|4637|4637| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4641|4641| 	// of our own formation (or ourself if not in formation)
|4642|4642| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4643|4643| 	if (cmpObstruction)
|4644|    |-	{
|    |4644|+	
|4645|4645| 		if (ent == INVALID_ENTITY)
|4646|4646| 			cmpObstruction.SetControlGroup(this.entity);
|4647|4647| 		else
|4648|4648| 			cmpObstruction.SetControlGroup(ent);
|4649|    |-	}
|    |4649|+	
|4650|4650| 
|4651|4651| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4652|4652| 	if (ent == INVALID_ENTITY)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4784|4784| 	// if we already had an old guard order, do nothing if the target is the same
|4785|4785| 	// and the order is running, otherwise remove the previous order
|4786|4786| 	if (this.isGuardOf)
|4787|    |-	{
|    |4787|+	
|4788|4788| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4789|4789| 			return;
|4790|4790| 		else
|4791|4791| 			this.RemoveGuard();
|4792|    |-	}
|    |4792|+	
|4793|4793| 
|4794|4794| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4795|4795| };
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4787|4787| 	{
|4788|4788| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4789|4789| 			return;
|4790|    |-		else
|4791|    |-			this.RemoveGuard();
|    |4790|+		this.RemoveGuard();
|4792|4791| 	}
|4793|4792| 
|4794|4793| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|    | [NORMAL] ESLintBear (no-trailing-spaces):
|    | Trailing spaces not allowed.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5119|5119| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5120|5120| 	{
|5121|5121| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5122|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5122|+		if (cmpTrader.HasBothMarkets() &&
|5123|5123| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5124|5124| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5125|5125| 		{
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5400|5400| 				{
|5401|5401| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5402|5402| 					var targetClasses = this.order.data.targetClasses;
|5403|    |-					if (targetClasses.attack && cmpIdentity
|5404|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5403|+					if (targetClasses.attack && cmpIdentity &&
|    |5404|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5405|5405| 						continue;
|5406|5406| 					if (targetClasses.avoid && cmpIdentity
|5407|5407| 						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5403|5403| 					if (targetClasses.attack && cmpIdentity
|5404|5404| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5405|5405| 						continue;
|5406|    |-					if (targetClasses.avoid && cmpIdentity
|5407|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5406|+					if (targetClasses.avoid && cmpIdentity &&
|    |5407|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5408|5408| 						continue;
|5409|5409| 					// Only used by the AIs to prevent some choices of targets
|5410|5410| 					if (targetClasses.vetoEntities && targetClasses.vetoEntities[targ])
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5426|5426| 		{
|5427|5427| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5428|5428| 			var targetClasses = this.order.data.targetClasses;
|5429|    |-			if (cmpIdentity && targetClasses.attack
|5430|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5429|+			if (cmpIdentity && targetClasses.attack &&
|    |5430|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5431|5431| 				continue;
|5432|5432| 			if (cmpIdentity && targetClasses.avoid
|5433|5433| 				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5429|5429| 			if (cmpIdentity && targetClasses.attack
|5430|5430| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5431|5431| 				continue;
|5432|    |-			if (cmpIdentity && targetClasses.avoid
|5433|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5432|+			if (cmpIdentity && targetClasses.avoid &&
|    |5433|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5434|5434| 				continue;
|5435|5435| 			// Only used by the AIs to prevent some choices of targets
|5436|5436| 			if (targetClasses.vetoEntities && targetClasses.vetoEntities[targ])
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5586|5586| 
|5587|5587| UnitAI.prototype.SetHeldPosition = function(x, z)
|5588|5588| {
|5589|    |-	this.heldPosition = {"x": x, "z": z};
|    |5589|+	this.heldPosition = { "x": x, "z": z};
|5590|5590| };
|5591|5591| 
|5592|5592| UnitAI.prototype.SetHeldPositionOnEntity = function(entity)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5586|5586| 
|5587|5587| UnitAI.prototype.SetHeldPosition = function(x, z)
|5588|5588| {
|5589|    |-	this.heldPosition = {"x": x, "z": z};
|    |5589|+	this.heldPosition = {"x": x, "z": z };
|5590|5590| };
|5591|5591| 
|5592|5592| UnitAI.prototype.SetHeldPositionOnEntity = function(entity)
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5613|5613| 	return false;
|5614|5614| };
|5615|5615| 
|5616|    |-//// Helper functions ////
|    |5616|+// // Helper functions ////
|5617|5617| 
|5618|5618| UnitAI.prototype.CanAttack = function(target)
|5619|5619| {
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5817|5817| 	return cmpPack && cmpPack.IsPacking();
|5818|5818| };
|5819|5819| 
|5820|    |-//// Formation specific functions ////
|    |5820|+// // Formation specific functions ////
|5821|5821| 
|5822|5822| UnitAI.prototype.IsAttackingAsFormation = function()
|5823|5823| {
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5822|5822| UnitAI.prototype.IsAttackingAsFormation = function()
|5823|5823| {
|5824|5824| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5825|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5826|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5825|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5826|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5827|5827| };
|5828|5828| 
|5829|5829| //// Animal specific functions ////
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5826|5826| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5827|5827| };
|5828|5828| 
|5829|    |-//// Animal specific functions ////
|    |5829|+// // Animal specific functions ////
|5830|5830| 
|5831|5831| UnitAI.prototype.MoveRandomly = function(distance)
|5832|5832| {

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|3685| »   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
|4498| »   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
|4513| »   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
|4559| »   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
|4582| »   »   ····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
| 354| »   »   ····&&·(this.lastShorelinePosition.z·==·cmpPosition.GetPosition().z))
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

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

binaries/data/mods/public/simulation/components/UnitAI.js
|2810| »   »   »   »   »   if·(this.CanGarrison(target))
|    | [NORMAL] JSHintBear:
|    | 'target' used out of scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|2813| »   »   »   »   »   »   if·(this.CheckGarrisonRange(target))
|    | [NORMAL] JSHintBear:
|    | 'target' used out of scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|2815| »   »   »   »   »   »   »   var·cmpGarrisonHolder·=·Engine.QueryInterface(target,·IID_GarrisonHolder);
|    | [NORMAL] JSHintBear:
|    | 'target' used out of scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|2837| »   »   »   »   »   »   »   »   var·cmpResourceDropsite·=·Engine.QueryInterface(target,·IID_ResourceDropsite);
|    | [NORMAL] JSHintBear:
|    | 'target' used out of scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|2838| »   »   »   »   »   »   »   »   if·(cmpResourceDropsite·&&·this.CanReturnResource(target,·true))
|    | [NORMAL] JSHintBear:
|    | 'target' used out of scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|2853| »   »   »   »   »   »   »   »   »   var·cmpHolderPosition·=·Engine.QueryInterface(target,·IID_Position);
|    | [NORMAL] JSHintBear:
|    | 'target' used out of scope.

binaries/data/mods/public/simulation/components/UnitAI.js
|2854| »   »   »   »   »   »   »   »   »   var·cmpHolderUnitAI·=·Engine.QueryInterface(target,·IID_UnitAI);
|    | [NORMAL] JSHintBear:
|    | 'target' used out of scope.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

wraitii updated this revision to Diff 8775.Jul 8 2019, 7:14 PM

Cleanup the garrison code slightly

Vulcan added a comment.Jul 8 2019, 7:38 PM

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 352| 352| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 353| 353| 		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 354| 354| 		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 355|    |-		{
|    | 355|+		
| 356| 356| 			// we were already on the shoreline, and have not moved since
| 357| 357| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
| 358| 358| 				needToMove = false;
| 359|    |-		}
|    | 359|+		
| 360| 360| 
| 361| 361| 		if (needToMove)
| 362| 362| 			this.SetNextState("INDIVIDUAL.PICKUP.APPROACHING");
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 350| 350| 		// Check if we need to move     TODO implement a better way to know if we are on the shoreline
| 351| 351| 		var needToMove = true;
| 352| 352| 		var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
| 353|    |-		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x)
| 354|    |-		    && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
|    | 353|+		if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x) &&
|    | 354|+		    (this.lastShorelinePosition.z == cmpPosition.GetPosition().z))
| 355| 355| 		{
| 356| 356| 			// we were already on the shoreline, and have not moved since
| 357| 357| 			if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 517| 517| 					this.PushOrderFront("Walk", this.order.data.lastPos);
| 518| 518| 				}
| 519| 519| 				else
| 520|    |-				{
|    | 520|+				
| 521| 521| 					// We couldn't move there, or the target moved away
| 522| 522| 					this.FinishOrder();
| 523|    |-				}
|    | 523|+				
| 524| 524| 				return;
| 525| 525| 			}
| 526| 526| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 736| 736| 			}
| 737| 737| 			// Check if we are already in range, otherwise walk there
| 738| 738| 			if (!this.CheckGarrisonRange(msg.data.target))
| 739|    |-			{
|    | 739|+			
| 740| 740| 				if (!this.CheckTargetVisible(msg.data.target))
| 741| 741| 				{
| 742| 742| 					this.FinishOrder();
| 747| 747| 					this.SetNextState("GARRISON.APPROACHING");
| 748| 748| 					return;
| 749| 749| 				}
| 750|    |-			}
|    | 750|+			
| 751| 751| 
| 752| 752| 			this.SetNextState("GARRISON.GARRISONING");
| 753| 753| 		},
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 742| 742| 					this.FinishOrder();
| 743| 743| 					return;
| 744| 744| 				}
| 745|    |-				else
| 746|    |-				{
|    | 745|+				
| 747| 746| 					this.SetNextState("GARRISON.APPROACHING");
| 748| 747| 					return;
| 749|    |-				}
|    | 748|+				
| 750| 749| 			}
| 751| 750| 
| 752| 751| 			this.SetNextState("GARRISON.GARRISONING");
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 765| 765| 						this.PushOrderFront("Walk", msg.data.lastPos);
| 766| 766| 					}
| 767| 767| 					else
| 768|    |-					{
|    | 768|+					
| 769| 769| 						// We couldn't move there, or the target moved away
| 770| 770| 						this.FinishOrder();
| 771|    |-					}
|    | 771|+					
| 772| 772| 					return;
| 773| 773| 				}
| 774| 774| 
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'GARRISON'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
| 998| 998| 			},
| 999| 999| 		},
|1000|1000| 
|1001|    |-		"GARRISON":{
|    |1001|+		"GARRISON": {
|1002|1002| 			"enter": function() {
|1003|1003| 				// If the garrisonholder should pickup, warn it so it can take needed action
|1004|1004| 				var cmpGarrisonHolder = Engine.QueryInterface(this.order.data.target, IID_GarrisonHolder);
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1211|1211| 			// If the controller handled an order but some members rejected it,
|1212|1212| 			// they will have no orders and be in the FORMATIONMEMBER.IDLE state.
|1213|1213| 			if (this.orderQueue.length)
|1214|    |-			{
|    |1214|+			
|1215|1215| 				// We're leaving the formation, so stop our FormationWalk order
|1216|1216| 				if (this.FinishOrder())
|1217|1217| 					return;
|1218|    |-			}
|    |1218|+			
|1219|1219| 
|1220|1220| 			// No orders left, we're an individual now
|1221|1221| 			if (this.IsAnimal())
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1239|1239| 			// Move a tile outside the building
|1240|1240| 			let range = 4;
|1241|1241| 			if (this.CheckTargetRangeExplicit(msg.data.target, range, -1))
|1242|    |-			{
|    |1242|+			
|1243|1243| 				// We are already at the target, or can't move at all
|1244|1244| 				this.FinishOrder();
|1245|    |-			}
|    |1245|+			
|1246|1246| 			else
|1247|1247| 			{
|1248|1248| 				this.order.data.min = range;
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1460|1460| 
|1461|1461| 			"LosRangeUpdate": function(msg) {
|1462|1462| 				if (this.GetStance().targetVisibleEnemies)
|1463|    |-				{
|    |1463|+				
|1464|1464| 					// Start attacking one of the newly-seen enemy (if any)
|1465|1465| 					this.AttackEntitiesByPreference(msg.data.added);
|1466|    |-				}
|    |1466|+				
|1467|1467| 			},
|1468|1468| 
|1469|1469| 			"LosHealRangeUpdate": function(msg) {
|    | [NORMAL] ESLintBear (space-before-function-paren):
|    | Unexpected space before function parentheses.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1493|1493| 				this.SelectAnimation("move");
|1494|1494| 			},
|1495|1495| 
|1496|    |-			"leave": function () {
|    |1496|+			"leave": function() {
|1497|1497| 				this.SelectAnimation("idle");
|1498|1498| 				this.StopMoving();
|1499|1499| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1673|1673| 						// if nothing better to do, check if the guarded needs to be healed or repaired
|1674|1674| 						var cmpHealth = Engine.QueryInterface(this.isGuardOf, IID_Health);
|1675|1675| 						if (cmpHealth && cmpHealth.IsInjured())
|1676|    |-						{
|    |1676|+						
|1677|1677| 							if (this.CanHeal(this.isGuardOf))
|1678|1678| 								this.PushOrderFront("Heal", { "target": this.isGuardOf, "force": false });
|1679|1679| 							else if (this.CanRepair(this.isGuardOf))
|1680|1680| 								this.PushOrderFront("Repair", { "target": this.isGuardOf, "autocontinue": false, "force": false });
|1681|    |-						}
|    |1681|+						
|1682|1682| 					}
|1683|1683| 				},
|1684|1684| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|1963|1963| 
|1964|1964| 				"Attacked": function(msg) {
|1965|1965| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|1966|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|1967|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |1966|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |1967|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|1968|1968| 						this.RespondToTargetedEntities([msg.data.attacker]);
|1969|1969| 				},
|1970|1970| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2016|2016| 					this.SelectAnimation("move");
|2017|2017| 					var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|2018|2018| 					if (cmpUnitAI && cmpUnitAI.IsFleeing())
|2019|    |-					{
|    |2019|+					
|2020|2020| 						// Run after a fleeing target
|2021|2021| 						this.SetSpeedMultiplier(this.GetRunMultiplier());
|2022|    |-					}
|    |2022|+					
|2023|2023| 					this.StartTimer(1000, 1000);
|2024|2024| 				},
|2025|2025| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2370|2370| 
|2371|2371| 				"Timer": function(msg) {
|2372|2372| 					if (this.ShouldAbandonChase(this.order.data.target, this.order.data.force, IID_Heal, null))
|2373|    |-					{
|    |2373|+					
|2374|2374| 						// Return to our original position unless we have a better order.
|2375|2375| 						if (!this.FinishOrder() && this.GetStance().respondHoldGround)
|2376|2376| 							this.WalkToHeldPosition();
|2377|    |-					}
|    |2377|+					
|2378|2378| 				},
|2379|2379| 
|2380|2380| 				"MovementUpdate": function() {
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2404|2404| 					this.StartTimer(prepare, this.healTimers.repeat);
|2405|2405| 
|2406|2406| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2407|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2407|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2408|2408| 
|2409|2409| 					this.FaceTowardsTarget(this.order.data.target);
|2410|2410| 				},
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2616|2616| 					{
|2617|2617| 						// The building was already finished/fully repaired before we arrived;
|2618|2618| 						// let the ConstructionFinished handler handle this.
|2619|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2619|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2620|2620| 						return true;
|2621|2621| 					}
|2622|2622| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|2616|2616| 					{
|2617|2617| 						// The building was already finished/fully repaired before we arrived;
|2618|2618| 						// let the ConstructionFinished handler handle this.
|2619|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2619|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2620|2620| 						return true;
|2621|2621| 					}
|2622|2622| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3002|3002| 		"Attacked": function(msg) {
|3003|3003| 			if (this.template.NaturalBehaviour == "skittish" ||
|3004|3004| 			    this.template.NaturalBehaviour == "passive")
|3005|    |-			{
|    |3005|+			
|3006|3006| 				this.Flee(msg.data.attacker, false);
|3007|    |-			}
|    |3007|+			
|3008|3008| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|3009|3009| 			{
|3010|3010| 				if (this.CanAttack(msg.data.attacker))
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3011|3011| 					this.Attack(msg.data.attacker, false);
|3012|3012| 			}
|3013|3013| 			else if (this.template.NaturalBehaviour == "domestic")
|3014|    |-			{
|    |3014|+			
|3015|3015| 				// Never flee, stop what we were doing
|3016|3016| 				this.SetNextState("IDLE");
|3017|    |-			}
|    |3017|+			
|3018|3018| 		},
|3019|3019| 
|3020|3020| 		"Order.LeaveFoundation": function(msg) {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3066|3066| 				}
|3067|3067| 				// Start attacking one of the newly-seen enemy (if any)
|3068|3068| 				else if (this.IsDangerousAnimal())
|3069|    |-				{
|    |3069|+				
|3070|3070| 					this.AttackVisibleEntity(msg.data.added);
|3071|    |-				}
|    |3071|+				
|3072|3072| 
|3073|3073| 				// TODO: if two units enter our range together, we'll attack the
|3074|3074| 				// first and then the second won't trigger another LosRangeUpdate
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3109|3109| 				}
|3110|3110| 				// Start attacking one of the newly-seen enemy (if any)
|3111|3111| 				else if (this.template.NaturalBehaviour == "violent")
|3112|    |-				{
|    |3112|+				
|3113|3113| 					this.AttackVisibleEntity(msg.data.added);
|3114|    |-				}
|    |3114|+				
|3115|3115| 			},
|3116|3116| 
|3117|3117| 			"Timer": function(msg) {
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 7.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3124|3124| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3125|3125| 
|3126|3126| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3127|    |-							// only used for domestic animals
|    |3127|+		// only used for domestic animals
|3128|3128| 	},
|3129|3129| };
|3130|3130| 
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3181|3181| 
|3182|3182| UnitAI.prototype.IsAnimal = function()
|3183|3183| {
|3184|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3184|+	return (!!this.template.NaturalBehaviour);
|3185|3185| };
|3186|3186| 
|3187|3187| UnitAI.prototype.IsDangerousAnimal = function()
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3219|3219| UnitAI.prototype.GetGarrisonHolder = function()
|3220|3220| {
|3221|3221| 	if (this.IsGarrisoned())
|3222|    |-	{
|    |3222|+	
|3223|3223| 		for (let order of this.orderQueue)
|3224|3224| 			if (order.type == "Garrison")
|3225|3225| 				return order.data.target;
|3226|    |-	}
|    |3226|+	
|3227|3227| 	return INVALID_ENTITY;
|3228|3228| };
|3229|3229| 
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3297|3297| 		{
|3298|3298| 			let index = this.GetCurrentState().indexOf(".");
|3299|3299| 			if (index != -1)
|3300|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3300|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3301|3301| 			this.Stop(false);
|3302|3302| 		}
|3303|3303| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3353|3353| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3354|3354| 			continue;
|3355|3355| 		if (i == 0)
|3356|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3356|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3357|3357| 		else
|3358|3358| 			this.orderQueue.splice(i, 1);
|3359|3359| 		Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3353|3353| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3354|3354| 			continue;
|3355|3355| 		if (i == 0)
|3356|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3356|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3357|3357| 		else
|3358|3358| 			this.orderQueue.splice(i, 1);
|3359|3359| 		Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3437|3437| };
|3438|3438| 
|3439|3439| 
|3440|    |-//// FSM linkage functions ////
|    |3440|+// // FSM linkage functions ////
|3441|3441| 
|3442|3442| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3443|3443| UnitAI.prototype.SetNextState = function(state)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3609|3609| 				continue;
|3610|3610| 			if (this.orderQueue[i].type == type)
|3611|3611| 				continue;
|3612|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3612|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3613|3613| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3614|3614| 			return;
|3615|3615| 		}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3609|3609| 				continue;
|3610|3610| 			if (this.orderQueue[i].type == type)
|3611|3611| 				continue;
|3612|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3612|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3613|3613| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3614|3614| 			return;
|3615|3615| 		}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3623|3623| {
|3624|3624| 	// Remember the previous work orders to be able to go back to them later if required
|3625|3625| 	if (data && data.force)
|3626|    |-	{
|    |3626|+	
|3627|3627| 		if (this.IsFormationController())
|3628|3628| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3629|3629| 		else
|3630|3630| 			this.UpdateWorkOrders(type);
|3631|    |-	}
|    |3631|+	
|3632|3632| 
|3633|3633| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3634|3634| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3700|3700| 	{
|3701|3701| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3702|3702| 		if (cmpUnitAI)
|3703|    |-		{
|    |3703|+		
|3704|3704| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3705|3705| 			{
|3706|3706| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3709|3709| 					return;
|3710|3710| 				}
|3711|3711| 			}
|3712|    |-		}
|    |3712|+		
|3713|3713| 	}
|3714|3714| 
|3715|3715| 	// If nothing found, take the unit orders
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3702|3702| 		if (cmpUnitAI)
|3703|3703| 		{
|3704|3704| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3705|    |-			{
|    |3705|+			
|3706|3706| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3707|3707| 				{
|3708|3708| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3709|3709| 					return;
|3710|3710| 				}
|3711|    |-			}
|    |3711|+			
|3712|3712| 		}
|3713|3713| 	}
|3714|3714| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3714|3714| 
|3715|3715| 	// If nothing found, take the unit orders
|3716|3716| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3717|    |-	{
|    |3717|+	
|3718|3718| 		if (isWorkType(this.orderQueue[i].type))
|3719|3719| 		{
|3720|3720| 			this.workOrders = this.orderQueue.slice(i);
|3721|3721| 			return;
|3722|3722| 		}
|3723|    |-	}
|    |3723|+	
|3724|3724| };
|3725|3725| 
|3726|3726| UnitAI.prototype.BackToWork = function()
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3780|3780| 	if (data.timerRepeat === undefined)
|3781|3781| 		this.timer = undefined;
|3782|3782| 
|3783|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3783|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3784|3784| };
|3785|3785| 
|3786|3786| /**
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3780|3780| 	if (data.timerRepeat === undefined)
|3781|3781| 		this.timer = undefined;
|3782|3782| 
|3783|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3783|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3784|3784| };
|3785|3785| 
|3786|3786| /**
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3815|3815| 	this.timer = undefined;
|3816|3816| };
|3817|3817| 
|3818|    |-//// Message handlers /////
|    |3818|+// // Message handlers /////
|3819|3819| 
|3820|3820| UnitAI.prototype.OnMotionChanged = function(msg)
|3821|3821| {
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3827|3827| 	// TODO: This is a bit inefficient since every unit listens to every
|3828|3828| 	// construction message - ideally we could scope it to only the one we're building
|3829|3829| 
|3830|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3830|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3831|3831| };
|3832|3832| 
|3833|3833| UnitAI.prototype.OnGlobalEntityRenamed = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3827|3827| 	// TODO: This is a bit inefficient since every unit listens to every
|3828|3828| 	// construction message - ideally we could scope it to only the one we're building
|3829|3829| 
|3830|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3830|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3831|3831| };
|3832|3832| 
|3833|3833| UnitAI.prototype.OnGlobalEntityRenamed = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3852|3852| 
|3853|3853| UnitAI.prototype.OnAttacked = function(msg)
|3854|3854| {
|3855|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3855|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3856|3856| };
|3857|3857| 
|3858|3858| UnitAI.prototype.OnGuardedAttacked = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3852|3852| 
|3853|3853| UnitAI.prototype.OnAttacked = function(msg)
|3854|3854| {
|3855|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3855|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3856|3856| };
|3857|3857| 
|3858|3858| UnitAI.prototype.OnGuardedAttacked = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3857|3857| 
|3858|3858| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3859|3859| {
|3860|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3860|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|3861|3861| };
|3862|3862| 
|3863|3863| UnitAI.prototype.OnHealthChanged = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3857|3857| 
|3858|3858| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3859|3859| {
|3860|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3860|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|3861|3861| };
|3862|3862| 
|3863|3863| UnitAI.prototype.OnHealthChanged = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3862|3862| 
|3863|3863| UnitAI.prototype.OnHealthChanged = function(msg)
|3864|3864| {
|3865|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3865|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|3866|3866| };
|3867|3867| 
|3868|3868| UnitAI.prototype.OnRangeUpdate = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3862|3862| 
|3863|3863| UnitAI.prototype.OnHealthChanged = function(msg)
|3864|3864| {
|3865|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3865|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|3866|3866| };
|3867|3867| 
|3868|3868| UnitAI.prototype.OnRangeUpdate = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3868|3868| UnitAI.prototype.OnRangeUpdate = function(msg)
|3869|3869| {
|3870|3870| 	if (msg.tag == this.losRangeQuery)
|3871|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3871|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|3872|3872| 	else if (msg.tag == this.losHealRangeQuery)
|3873|3873| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3874|3874| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3868|3868| UnitAI.prototype.OnRangeUpdate = function(msg)
|3869|3869| {
|3870|3870| 	if (msg.tag == this.losRangeQuery)
|3871|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3871|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|3872|3872| 	else if (msg.tag == this.losHealRangeQuery)
|3873|3873| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3874|3874| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3870|3870| 	if (msg.tag == this.losRangeQuery)
|3871|3871| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3872|3872| 	else if (msg.tag == this.losHealRangeQuery)
|3873|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3873|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|3874|3874| };
|3875|3875| 
|3876|3876| UnitAI.prototype.OnPackFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3870|3870| 	if (msg.tag == this.losRangeQuery)
|3871|3871| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3872|3872| 	else if (msg.tag == this.losHealRangeQuery)
|3873|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3873|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|3874|3874| };
|3875|3875| 
|3876|3876| UnitAI.prototype.OnPackFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3875|3875| 
|3876|3876| UnitAI.prototype.OnPackFinished = function(msg)
|3877|3877| {
|3878|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3878|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|3879|3879| };
|3880|3880| 
|3881|3881| //// Helper functions to be called by the FSM ////
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3875|3875| 
|3876|3876| UnitAI.prototype.OnPackFinished = function(msg)
|3877|3877| {
|3878|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3878|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|3879|3879| };
|3880|3880| 
|3881|3881| //// Helper functions to be called by the FSM ////
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|3878|3878| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|3879|3879| };
|3880|3880| 
|3881|    |-//// Helper functions to be called by the FSM ////
|    |3881|+// // Helper functions to be called by the FSM ////
|3882|3882| 
|3883|3883| UnitAI.prototype.GetWalkSpeed = function()
|3884|3884| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4065|4065| 			PlaySound(name, member);
|4066|4066| 	}
|4067|4067| 	else
|4068|    |-	{
|    |4068|+	
|4069|4069| 		// Otherwise use our own sounds
|4070|4070| 		PlaySound(name, this.entity);
|4071|    |-	}
|    |4071|+	
|4072|4072| };
|4073|4073| 
|4074|4074| /*
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4511|4511| UnitAI.prototype.AttackEntityInZone = function(ents)
|4512|4512| {
|4513|4513| 	var target = ents.find(target =>
|4514|    |-		this.CanAttack(target)
|4515|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4514|+		this.CanAttack(target) &&
|    |4515|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4516|4516| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4517|4517| 	);
|4518|4518| 	if (!target)
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4512|4512| {
|4513|4513| 	var target = ents.find(target =>
|4514|4514| 		this.CanAttack(target)
|4515|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4516|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4515|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4516|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4517|4517| 	);
|4518|4518| 	if (!target)
|4519|4519| 		return false;
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before 'Engine'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4576|4576| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4577|4577| 	if (this.isGuardOf)
|4578|4578| 	{
|4579|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4579|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4580|4580| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4581|4581| 		if (cmpUnitAI && cmpAttack &&
|4582|4582| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 4.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4580|4580| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4581|4581| 		if (cmpUnitAI && cmpAttack &&
|4582|4582| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4583|    |-				return false;
|    |4583|+			return false;
|4584|4584| 	}
|4585|4585| 
|4586|4586| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4585|4585| 
|4586|4586| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4587|4587| 	if (this.GetStance().respondHoldGround)
|4588|    |-	{
|    |4588|+	
|4589|4589| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4590|4590| 			return true;
|4591|    |-	}
|    |4591|+	
|4592|4592| 
|4593|4593| 	// Stop if it's left our vision range, unless we're especially persistent
|4594|4594| 	if (!this.GetStance().respondChaseBeyondVision)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4592|4592| 
|4593|4593| 	// Stop if it's left our vision range, unless we're especially persistent
|4594|4594| 	if (!this.GetStance().respondChaseBeyondVision)
|4595|    |-	{
|    |4595|+	
|4596|4596| 		if (!this.CheckTargetIsInVisionRange(target))
|4597|4597| 			return true;
|4598|    |-	}
|    |4598|+	
|4599|4599| 
|4600|4600| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4601|4601| 	// and will continue moving to its last seen position and then stop)
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before 'Engine'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4618|4618| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4619|4619| 	if (this.isGuardOf)
|4620|4620| 	{
|4621|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4621|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4622|4622| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4623|4623| 		if (cmpUnitAI && cmpAttack &&
|4624|4624| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4631|4631| 	return false;
|4632|4632| };
|4633|4633| 
|4634|    |-//// External interface functions ////
|    |4634|+// // External interface functions ////
|4635|4635| 
|4636|4636| UnitAI.prototype.SetFormationController = function(ent)
|4637|4637| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4641|4641| 	// of our own formation (or ourself if not in formation)
|4642|4642| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4643|4643| 	if (cmpObstruction)
|4644|    |-	{
|    |4644|+	
|4645|4645| 		if (ent == INVALID_ENTITY)
|4646|4646| 			cmpObstruction.SetControlGroup(this.entity);
|4647|4647| 		else
|4648|4648| 			cmpObstruction.SetControlGroup(ent);
|4649|    |-	}
|    |4649|+	
|4650|4650| 
|4651|4651| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4652|4652| 	if (ent == INVALID_ENTITY)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4784|4784| 	// if we already had an old guard order, do nothing if the target is the same
|4785|4785| 	// and the order is running, otherwise remove the previous order
|4786|4786| 	if (this.isGuardOf)
|4787|    |-	{
|    |4787|+	
|4788|4788| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4789|4789| 			return;
|4790|4790| 		else
|4791|4791| 			this.RemoveGuard();
|4792|    |-	}
|    |4792|+	
|4793|4793| 
|4794|4794| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4795|4795| };
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|4787|4787| 	{
|4788|4788| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4789|4789| 			return;
|4790|    |-		else
|4791|    |-			this.RemoveGuard();
|    |4790|+		this.RemoveGuard();
|4792|4791| 	}
|4793|4792| 
|4794|4793| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|    | [NORMAL] ESLintBear (no-trailing-spaces):
|    | Trailing spaces not allowed.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5119|5119| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5120|5120| 	{
|5121|5121| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5122|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5122|+		if (cmpTrader.HasBothMarkets() &&
|5123|5123| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5124|5124| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5125|5125| 		{
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5400|5400| 				{
|5401|5401| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5402|5402| 					var targetClasses = this.order.data.targetClasses;
|5403|    |-					if (targetClasses.attack && cmpIdentity
|5404|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5403|+					if (targetClasses.attack && cmpIdentity &&
|    |5404|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5405|5405| 						continue;
|5406|5406| 					if (targetClasses.avoid && cmpIdentity
|5407|5407| 						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5403|5403| 					if (targetClasses.attack && cmpIdentity
|5404|5404| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5405|5405| 						continue;
|5406|    |-					if (targetClasses.avoid && cmpIdentity
|5407|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5406|+					if (targetClasses.avoid && cmpIdentity &&
|    |5407|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5408|5408| 						continue;
|5409|5409| 					// Only used by the AIs to prevent some choices of targets
|5410|5410| 					if (targetClasses.vetoEntities && targetClasses.vetoEntities[targ])
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5426|5426| 		{
|5427|5427| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5428|5428| 			var targetClasses = this.order.data.targetClasses;
|5429|    |-			if (cmpIdentity && targetClasses.attack
|5430|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5429|+			if (cmpIdentity && targetClasses.attack &&
|    |5430|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5431|5431| 				continue;
|5432|5432| 			if (cmpIdentity && targetClasses.avoid
|5433|5433| 				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5429|5429| 			if (cmpIdentity && targetClasses.attack
|5430|5430| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5431|5431| 				continue;
|5432|    |-			if (cmpIdentity && targetClasses.avoid
|5433|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5432|+			if (cmpIdentity && targetClasses.avoid &&
|    |5433|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5434|5434| 				continue;
|5435|5435| 			// Only used by the AIs to prevent some choices of targets
|5436|5436| 			if (targetClasses.vetoEntities && targetClasses.vetoEntities[targ])
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5586|5586| 
|5587|5587| UnitAI.prototype.SetHeldPosition = function(x, z)
|5588|5588| {
|5589|    |-	this.heldPosition = {"x": x, "z": z};
|    |5589|+	this.heldPosition = { "x": x, "z": z};
|5590|5590| };
|5591|5591| 
|5592|5592| UnitAI.prototype.SetHeldPositionOnEntity = function(entity)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5586|5586| 
|5587|5587| UnitAI.prototype.SetHeldPosition = function(x, z)
|5588|5588| {
|5589|    |-	this.heldPosition = {"x": x, "z": z};
|    |5589|+	this.heldPosition = {"x": x, "z": z };
|5590|5590| };
|5591|5591| 
|5592|5592| UnitAI.prototype.SetHeldPositionOnEntity = function(entity)
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5613|5613| 	return false;
|5614|5614| };
|5615|5615| 
|5616|    |-//// Helper functions ////
|    |5616|+// // Helper functions ////
|5617|5617| 
|5618|5618| UnitAI.prototype.CanAttack = function(target)
|5619|5619| {
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5817|5817| 	return cmpPack && cmpPack.IsPacking();
|5818|5818| };
|5819|5819| 
|5820|    |-//// Formation specific functions ////
|    |5820|+// // Formation specific functions ////
|5821|5821| 
|5822|5822| UnitAI.prototype.IsAttackingAsFormation = function()
|5823|5823| {
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5822|5822| UnitAI.prototype.IsAttackingAsFormation = function()
|5823|5823| {
|5824|5824| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5825|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5826|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5825|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5826|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5827|5827| };
|5828|5828| 
|5829|5829| //// Animal specific functions ////
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js
|5826|5826| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5827|5827| };
|5828|5828| 
|5829|    |-//// Animal specific functions ////
|    |5829|+// // Animal specific functions ////
|5830|5830| 
|5831|5831| UnitAI.prototype.MoveRandomly = function(distance)
|5832|5832| {

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|3685| »   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
|4498| »   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
|4513| »   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
|4559| »   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
|4582| »   »   ····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
| 354| »   »   ····&&·(this.lastShorelinePosition.z·==·cmpPosition.GetPosition().z))
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

This revision was not accepted when it landed; it landed in state Needs Review.Jul 8 2019, 8:07 PM
This revision was automatically updated to reflect the committed changes.