Page MenuHomeWildfire Games

UnitMotion - Send messages to UnitAI when the path was obstructed, to allow stopping early when walking and avoiding pathfinding lag
ClosedPublic

Authored by wraitii on Sun, Jul 21, 1:30 PM.

Details

Reviewers
None
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Commits
rP22526: UnitMotion - Send messages to UnitAI when obstructed, to allow stopping early…
Trac Tickets
#5521
Summary

As reported by #5521, Ordering units to walk to a point in a forest can lag terribly, as units will end up computing terribly large short paths in the forest, which can result in ComputeShortPath calls that individually take upwards of 80ms.

This can be alleviated by allowing units to stop a bit earlier. A23 handled this in UnitMotion directly, but it's better to handle this in UnitAI to avoid surprises.

This also refactors UM sending messages to UnitAI so that we may in the future push more information (in particular, the entity_id that a unit was obstructed by could be interesting for COMBAT).

This doesn't fix the possibility of lag, but it reduces its occurrence to levels that should be similar to A23 and thus acceptable enough.

Unit Pushing and pathfinder threading should help with the other cases.

Test Plan

Check that changed orders are still working correctly.
Test moving units in clumpy forests and notice that it no longer lags (see minimal reproduction at #5521).

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.Sun, Jul 21, 1:30 PM

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

Linter detected issues:
Executing section Source...

source/simulation2/MessageTypes.h
|  44| class·CMessageTurnStart·:·public·CMessage
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'classCMessageTurnStart:' is invalid C code. Use --std or --language to configure the language.

source/simulation2/TypeList.h
|   1| /*·Copyright·(C)·2018·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2019" year instead of "2018"
Executing section JS...
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 526| 526| 					this.PushOrderFront("Walk", this.order.data.lastPos);
| 527| 527| 				}
| 528| 528| 				else
| 529|    |-				{
|    | 529|+				
| 530| 530| 					// We couldn't move there, or the target moved away
| 531| 531| 					this.FinishOrder();
| 532|    |-				}
|    | 532|+				
| 533| 533| 				return;
| 534| 534| 			}
| 535| 535| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 746| 746| 			}
| 747| 747| 			// Check if we are already in range, otherwise walk there
| 748| 748| 			if (!this.CheckGarrisonRange(msg.data.target))
| 749|    |-			{
|    | 749|+			
| 750| 750| 				if (!this.CheckTargetVisible(msg.data.target))
| 751| 751| 				{
| 752| 752| 					this.FinishOrder();
| 757| 757| 					this.SetNextState("GARRISON.APPROACHING");
| 758| 758| 					return;
| 759| 759| 				}
| 760|    |-			}
|    | 760|+			
| 761| 761| 
| 762| 762| 			this.SetNextState("GARRISON.GARRISONING");
| 763| 763| 		},
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 752| 752| 					this.FinishOrder();
| 753| 753| 					return;
| 754| 754| 				}
| 755|    |-				else
| 756|    |-				{
|    | 755|+				
| 757| 756| 					this.SetNextState("GARRISON.APPROACHING");
| 758| 757| 					return;
| 759|    |-				}
|    | 758|+				
| 760| 759| 			}
| 761| 760| 
| 762| 761| 			this.SetNextState("GARRISON.GARRISONING");
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 775| 775| 						this.PushOrderFront("Walk", msg.data.lastPos);
| 776| 776| 					}
| 777| 777| 					else
| 778|    |-					{
|    | 778|+					
| 779| 779| 						// We couldn't move there, or the target moved away
| 780| 780| 						this.FinishOrder();
| 781|    |-					}
|    | 781|+					
| 782| 782| 					return;
| 783| 783| 				}
| 784| 784| 
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'GARRISON'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1014|1014| 			},
|1015|1015| 		},
|1016|1016| 
|1017|    |-		"GARRISON":{
|    |1017|+		"GARRISON": {
|1018|1018| 			"enter": function() {
|1019|1019| 				// If the garrisonholder should pickup, warn it so it can take needed action
|1020|1020| 				var cmpGarrisonHolder = Engine.QueryInterface(this.order.data.target, IID_GarrisonHolder);
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1228|1228| 			// If the controller handled an order but some members rejected it,
|1229|1229| 			// they will have no orders and be in the FORMATIONMEMBER.IDLE state.
|1230|1230| 			if (this.orderQueue.length)
|1231|    |-			{
|    |1231|+			
|1232|1232| 				// We're leaving the formation, so stop our FormationWalk order
|1233|1233| 				if (this.FinishOrder())
|1234|1234| 					return;
|1235|    |-			}
|    |1235|+			
|1236|1236| 
|1237|1237| 			// No orders left, we're an individual now
|1238|1238| 			this.SetNextState("INDIVIDUAL.IDLE");
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1253|1253| 			// Move a tile outside the building
|1254|1254| 			let range = 4;
|1255|1255| 			if (this.CheckTargetRangeExplicit(msg.data.target, range, -1))
|1256|    |-			{
|    |1256|+			
|1257|1257| 				// We are already at the target, or can't move at all
|1258|1258| 				this.FinishOrder();
|1259|    |-			}
|    |1259|+			
|1260|1260| 			else
|1261|1261| 			{
|1262|1262| 				this.order.data.min = range;
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1446|1446| 
|1447|1447| 			"LosRangeUpdate": function(msg) {
|1448|1448| 				if (this.GetStance().targetVisibleEnemies)
|1449|    |-				{
|    |1449|+				
|1450|1450| 					// Start attacking one of the newly-seen enemy (if any)
|1451|1451| 					this.AttackEntitiesByPreference(msg.data.added);
|1452|    |-				}
|    |1452|+				
|1453|1453| 			},
|1454|1454| 
|1455|1455| 			"LosHealRangeUpdate": function(msg) {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1688|1688| 						// if nothing better to do, check if the guarded needs to be healed or repaired
|1689|1689| 						var cmpHealth = Engine.QueryInterface(this.isGuardOf, IID_Health);
|1690|1690| 						if (cmpHealth && cmpHealth.IsInjured())
|1691|    |-						{
|    |1691|+						
|1692|1692| 							if (this.CanHeal(this.isGuardOf))
|1693|1693| 								this.PushOrderFront("Heal", { "target": this.isGuardOf, "force": false });
|1694|1694| 							else if (this.CanRepair(this.isGuardOf))
|1695|1695| 								this.PushOrderFront("Repair", { "target": this.isGuardOf, "autocontinue": false, "force": false });
|1696|    |-						}
|    |1696|+						
|1697|1697| 					}
|1698|1698| 				},
|1699|1699| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1969|1969| 
|1970|1970| 				"Attacked": function(msg) {
|1971|1971| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|1972|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|1973|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |1972|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |1973|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|1974|1974| 						this.RespondToTargetedEntities([msg.data.attacker]);
|1975|1975| 				},
|1976|1976| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2021|2021| 
|2022|2022| 					var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|2023|2023| 					if (cmpUnitAI && cmpUnitAI.IsFleeing())
|2024|    |-					{
|    |2024|+					
|2025|2025| 						// Run after a fleeing target
|2026|2026| 						this.SetSpeedMultiplier(this.GetRunMultiplier());
|2027|    |-					}
|    |2027|+					
|2028|2028| 					this.StartTimer(1000, 1000);
|2029|2029| 				},
|2030|2030| 
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2432|2432| 					this.StartTimer(prepare, this.healTimers.repeat);
|2433|2433| 
|2434|2434| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2435|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2435|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2436|2436| 
|2437|2437| 					this.FaceTowardsTarget(this.order.data.target);
|2438|2438| 				},
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2655|2655| 					{
|2656|2656| 						// The building was already finished/fully repaired before we arrived;
|2657|2657| 						// let the ConstructionFinished handler handle this.
|2658|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2658|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2659|2659| 						return true;
|2660|2660| 					}
|2661|2661| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2655|2655| 					{
|2656|2656| 						// The building was already finished/fully repaired before we arrived;
|2657|2657| 						// let the ConstructionFinished handler handle this.
|2658|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2658|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2659|2659| 						return true;
|2660|2660| 					}
|2661|2661| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3046|3046| 		"Attacked": function(msg) {
|3047|3047| 			if (this.template.NaturalBehaviour == "skittish" ||
|3048|3048| 			    this.template.NaturalBehaviour == "passive")
|3049|    |-			{
|    |3049|+			
|3050|3050| 				this.Flee(msg.data.attacker, false);
|3051|    |-			}
|    |3051|+			
|3052|3052| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|3053|3053| 			{
|3054|3054| 				if (this.CanAttack(msg.data.attacker))
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3055|3055| 					this.Attack(msg.data.attacker, false);
|3056|3056| 			}
|3057|3057| 			else if (this.template.NaturalBehaviour == "domestic")
|3058|    |-			{
|    |3058|+			
|3059|3059| 				// Never flee, stop what we were doing
|3060|3060| 				this.SetNextState("IDLE");
|3061|    |-			}
|    |3061|+			
|3062|3062| 		},
|3063|3063| 
|3064|3064| 		"Order.LeaveFoundation": function(msg) {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/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.IsDangerousAnimal())
|3112|    |-				{
|    |3112|+				
|3113|3113| 					this.AttackVisibleEntity(msg.data.added);
|3114|    |-				}
|    |3114|+				
|3115|3115| 
|3116|3116| 				// TODO: if two units enter our range together, we'll attack the
|3117|3117| 				// first and then the second won't trigger another LosRangeUpdate
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3153|3153| 				}
|3154|3154| 				// Start attacking one of the newly-seen enemy (if any)
|3155|3155| 				else if (this.template.NaturalBehaviour == "violent")
|3156|    |-				{
|    |3156|+				
|3157|3157| 					this.AttackVisibleEntity(msg.data.added);
|3158|    |-				}
|    |3158|+				
|3159|3159| 			},
|3160|3160| 
|3161|3161| 			"Timer": function(msg) {
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 7.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3168|3168| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3169|3169| 
|3170|3170| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3171|    |-							// only used for domestic animals
|    |3171|+		// only used for domestic animals
|3172|3172| 	},
|3173|3173| };
|3174|3174| 
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3225|3225| 
|3226|3226| UnitAI.prototype.IsAnimal = function()
|3227|3227| {
|3228|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3228|+	return (!!this.template.NaturalBehaviour);
|3229|3229| };
|3230|3230| 
|3231|3231| UnitAI.prototype.IsDangerousAnimal = function()
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3263|3263| UnitAI.prototype.GetGarrisonHolder = function()
|3264|3264| {
|3265|3265| 	if (this.IsGarrisoned())
|3266|    |-	{
|    |3266|+	
|3267|3267| 		for (let order of this.orderQueue)
|3268|3268| 			if (order.type == "Garrison")
|3269|3269| 				return order.data.target;
|3270|    |-	}
|    |3270|+	
|3271|3271| 	return INVALID_ENTITY;
|3272|3272| };
|3273|3273| 
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3341|3341| 		{
|3342|3342| 			let index = this.GetCurrentState().indexOf(".");
|3343|3343| 			if (index != -1)
|3344|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3344|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3345|3345| 			this.Stop(false);
|3346|3346| 		}
|3347|3347| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3397|3397| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3398|3398| 			continue;
|3399|3399| 		if (i == 0)
|3400|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3400|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3401|3401| 		else
|3402|3402| 			this.orderQueue.splice(i, 1);
|3403|3403| 		Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3397|3397| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3398|3398| 			continue;
|3399|3399| 		if (i == 0)
|3400|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3400|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3401|3401| 		else
|3402|3402| 			this.orderQueue.splice(i, 1);
|3403|3403| 		Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3481|3481| };
|3482|3482| 
|3483|3483| 
|3484|    |-//// FSM linkage functions ////
|    |3484|+// // FSM linkage functions ////
|3485|3485| 
|3486|3486| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3487|3487| UnitAI.prototype.SetNextState = function(state)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3651|3651| 				continue;
|3652|3652| 			if (this.orderQueue[i].type == type)
|3653|3653| 				continue;
|3654|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3654|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3655|3655| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3656|3656| 			return;
|3657|3657| 		}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3651|3651| 				continue;
|3652|3652| 			if (this.orderQueue[i].type == type)
|3653|3653| 				continue;
|3654|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3654|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3655|3655| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3656|3656| 			return;
|3657|3657| 		}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3665|3665| {
|3666|3666| 	// Remember the previous work orders to be able to go back to them later if required
|3667|3667| 	if (data && data.force)
|3668|    |-	{
|    |3668|+	
|3669|3669| 		if (this.IsFormationController())
|3670|3670| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3671|3671| 		else
|3672|3672| 			this.UpdateWorkOrders(type);
|3673|    |-	}
|    |3673|+	
|3674|3674| 
|3675|3675| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3676|3676| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3742|3742| 	{
|3743|3743| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3744|3744| 		if (cmpUnitAI)
|3745|    |-		{
|    |3745|+		
|3746|3746| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3747|3747| 			{
|3748|3748| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3751|3751| 					return;
|3752|3752| 				}
|3753|3753| 			}
|3754|    |-		}
|    |3754|+		
|3755|3755| 	}
|3756|3756| 
|3757|3757| 	// If nothing found, take the unit orders
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3744|3744| 		if (cmpUnitAI)
|3745|3745| 		{
|3746|3746| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3747|    |-			{
|    |3747|+			
|3748|3748| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3749|3749| 				{
|3750|3750| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3751|3751| 					return;
|3752|3752| 				}
|3753|    |-			}
|    |3753|+			
|3754|3754| 		}
|3755|3755| 	}
|3756|3756| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3756|3756| 
|3757|3757| 	// If nothing found, take the unit orders
|3758|3758| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3759|    |-	{
|    |3759|+	
|3760|3760| 		if (isWorkType(this.orderQueue[i].type))
|3761|3761| 		{
|3762|3762| 			this.workOrders = this.orderQueue.slice(i);
|3763|3763| 			return;
|3764|3764| 		}
|3765|    |-	}
|    |3765|+	
|3766|3766| };
|3767|3767| 
|3768|3768| UnitAI.prototype.BackToWork = function()
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3822|3822| 	if (data.timerRepeat === undefined)
|3823|3823| 		this.timer = undefined;
|3824|3824| 
|3825|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3825|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3826|3826| };
|3827|3827| 
|3828|3828| /**
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3822|3822| 	if (data.timerRepeat === undefined)
|3823|3823| 		this.timer = undefined;
|3824|3824| 
|3825|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3825|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3826|3826| };
|3827|3827| 
|3828|3828| /**
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3857|3857| 	this.timer = undefined;
|3858|3858| };
|3859|3859| 
|3860|    |-//// Message handlers /////
|    |3860|+// // Message handlers /////
|3861|3861| 
|3862|3862| UnitAI.prototype.OnMotionUpdate = function(msg)
|3863|3863| {
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3874|3874| 	// TODO: This is a bit inefficient since every unit listens to every
|3875|3875| 	// construction message - ideally we could scope it to only the one we're building
|3876|3876| 
|3877|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3877|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3878|3878| };
|3879|3879| 
|3880|3880| UnitAI.prototype.OnGlobalEntityRenamed = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3874|3874| 	// TODO: This is a bit inefficient since every unit listens to every
|3875|3875| 	// construction message - ideally we could scope it to only the one we're building
|3876|3876| 
|3877|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3877|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3878|3878| };
|3879|3879| 
|3880|3880| UnitAI.prototype.OnGlobalEntityRenamed = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3899|3899| 
|3900|3900| UnitAI.prototype.OnAttacked = function(msg)
|3901|3901| {
|3902|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3902|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3903|3903| };
|3904|3904| 
|3905|3905| UnitAI.prototype.OnGuardedAttacked = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3899|3899| 
|3900|3900| UnitAI.prototype.OnAttacked = function(msg)
|3901|3901| {
|3902|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3902|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3903|3903| };
|3904|3904| 
|3905|3905| UnitAI.prototype.OnGuardedAttacked = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3904|3904| 
|3905|3905| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3906|3906| {
|3907|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3907|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|3908|3908| };
|3909|3909| 
|3910|3910| UnitAI.prototype.OnHealthChanged = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3904|3904| 
|3905|3905| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3906|3906| {
|3907|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3907|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|3908|3908| };
|3909|3909| 
|3910|3910| UnitAI.prototype.OnHealthChanged = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3909|3909| 
|3910|3910| UnitAI.prototype.OnHealthChanged = function(msg)
|3911|3911| {
|3912|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3912|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|3913|3913| };
|3914|3914| 
|3915|3915| UnitAI.prototype.OnRangeUpdate = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3909|3909| 
|3910|3910| UnitAI.prototype.OnHealthChanged = function(msg)
|3911|3911| {
|3912|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3912|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|3913|3913| };
|3914|3914| 
|3915|3915| UnitAI.prototype.OnRangeUpdate = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3915|3915| UnitAI.prototype.OnRangeUpdate = function(msg)
|3916|3916| {
|3917|3917| 	if (msg.tag == this.losRangeQuery)
|3918|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3918|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|3919|3919| 	else if (msg.tag == this.losHealRangeQuery)
|3920|3920| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3921|3921| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3915|3915| UnitAI.prototype.OnRangeUpdate = function(msg)
|3916|3916| {
|3917|3917| 	if (msg.tag == this.losRangeQuery)
|3918|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3918|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|3919|3919| 	else if (msg.tag == this.losHealRangeQuery)
|3920|3920| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3921|3921| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3917|3917| 	if (msg.tag == this.losRangeQuery)
|3918|3918| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3919|3919| 	else if (msg.tag == this.losHealRangeQuery)
|3920|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3920|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|3921|3921| };
|3922|3922| 
|3923|3923| UnitAI.prototype.OnPackFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3917|3917| 	if (msg.tag == this.losRangeQuery)
|3918|3918| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3919|3919| 	else if (msg.tag == this.losHealRangeQuery)
|3920|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3920|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|3921|3921| };
|3922|3922| 
|3923|3923| UnitAI.prototype.OnPackFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3922|3922| 
|3923|3923| UnitAI.prototype.OnPackFinished = function(msg)
|3924|3924| {
|3925|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3925|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|3926|3926| };
|3927|3927| 
|3928|3928| //// Helper functions to be called by the FSM ////
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3922|3922| 
|3923|3923| UnitAI.prototype.OnPackFinished = function(msg)
|3924|3924| {
|3925|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3925|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|3926|3926| };
|3927|3927| 
|3928|3928| //// Helper functions to be called by the FSM ////
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3925|3925| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|3926|3926| };
|3927|3927| 
|3928|    |-//// Helper functions to be called by the FSM ////
|    |3928|+// // Helper functions to be called by the FSM ////
|3929|3929| 
|3930|3930| UnitAI.prototype.GetWalkSpeed = function()
|3931|3931| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4112|4112| 			PlaySound(name, member);
|4113|4113| 	}
|4114|4114| 	else
|4115|    |-	{
|    |4115|+	
|4116|4116| 		// Otherwise use our own sounds
|4117|4117| 		PlaySound(name, this.entity);
|4118|    |-	}
|    |4118|+	
|4119|4119| };
|4120|4120| 
|4121|4121| /*
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4572|4572| UnitAI.prototype.AttackEntityInZone = function(ents)
|4573|4573| {
|4574|4574| 	var target = ents.find(target =>
|4575|    |-		this.CanAttack(target)
|4576|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4575|+		this.CanAttack(target) &&
|    |4576|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4577|4577| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4578|4578| 	);
|4579|4579| 	if (!target)
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4573|4573| {
|4574|4574| 	var target = ents.find(target =>
|4575|4575| 		this.CanAttack(target)
|4576|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4577|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4576|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4577|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4578|4578| 	);
|4579|4579| 	if (!target)
|4580|4580| 		return false;
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before 'Engine'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4637|4637| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4638|4638| 	if (this.isGuardOf)
|4639|4639| 	{
|4640|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4640|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4641|4641| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4642|4642| 		if (cmpUnitAI && cmpAttack &&
|4643|4643| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 4.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4641|4641| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4642|4642| 		if (cmpUnitAI && cmpAttack &&
|4643|4643| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4644|    |-				return false;
|    |4644|+			return false;
|4645|4645| 	}
|4646|4646| 
|4647|4647| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4646|4646| 
|4647|4647| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4648|4648| 	if (this.GetStance().respondHoldGround)
|4649|    |-	{
|    |4649|+	
|4650|4650| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4651|4651| 			return true;
|4652|    |-	}
|    |4652|+	
|4653|4653| 
|4654|4654| 	// Stop if it's left our vision range, unless we're especially persistent
|4655|4655| 	if (!this.GetStance().respondChaseBeyondVision)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4653|4653| 
|4654|4654| 	// Stop if it's left our vision range, unless we're especially persistent
|4655|4655| 	if (!this.GetStance().respondChaseBeyondVision)
|4656|    |-	{
|    |4656|+	
|4657|4657| 		if (!this.CheckTargetIsInVisionRange(target))
|4658|4658| 			return true;
|4659|    |-	}
|    |4659|+	
|4660|4660| 
|4661|4661| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4662|4662| 	// and will continue moving to its last seen position and then stop)
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before 'Engine'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4679|4679| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4680|4680| 	if (this.isGuardOf)
|4681|4681| 	{
|4682|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4682|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4683|4683| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4684|4684| 		if (cmpUnitAI && cmpAttack &&
|4685|4685| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4692|4692| 	return false;
|4693|4693| };
|4694|4694| 
|4695|    |-//// External interface functions ////
|    |4695|+// // External interface functions ////
|4696|4696| 
|4697|4697| UnitAI.prototype.SetFormationController = function(ent)
|4698|4698| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4702|4702| 	// of our own formation (or ourself if not in formation)
|4703|4703| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4704|4704| 	if (cmpObstruction)
|4705|    |-	{
|    |4705|+	
|4706|4706| 		if (ent == INVALID_ENTITY)
|4707|4707| 			cmpObstruction.SetControlGroup(this.entity);
|4708|4708| 		else
|4709|4709| 			cmpObstruction.SetControlGroup(ent);
|4710|    |-	}
|    |4710|+	
|4711|4711| 
|4712|4712| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4713|4713| 	if (ent == INVALID_ENTITY)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4845|4845| 	// if we already had an old guard order, do nothing if the target is the same
|4846|4846| 	// and the order is running, otherwise remove the previous order
|4847|4847| 	if (this.isGuardOf)
|4848|    |-	{
|    |4848|+	
|4849|4849| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4850|4850| 			return;
|4851|4851| 		else
|4852|4852| 			this.RemoveGuard();
|4853|    |-	}
|    |4853|+	
|4854|4854| 
|4855|4855| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4856|4856| };
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4848|4848| 	{
|4849|4849| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4850|4850| 			return;
|4851|    |-		else
|4852|    |-			this.RemoveGuard();
|    |4851|+		this.RemoveGuard();
|4853|4852| 	}
|4854|4853| 
|4855|4854| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|    | [NORMAL] ESLintBear (no-trailing-spaces):
|    | Trailing spaces not allowed.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5180|5180| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5181|5181| 	{
|5182|5182| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5183|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5183|+		if (cmpTrader.HasBothMarkets() &&
|5184|5184| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5185|5185| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5186|5186| 		{
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5461|5461| 				{
|5462|5462| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5463|5463| 					var targetClasses = this.order.data.targetClasses;
|5464|    |-					if (targetClasses.attack && cmpIdentity
|5465|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5464|+					if (targetClasses.attack && cmpIdentity &&
|    |5465|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5466|5466| 						continue;
|5467|5467| 					if (targetClasses.avoid && cmpIdentity
|5468|5468| 						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5464|5464| 					if (targetClasses.attack && cmpIdentity
|5465|5465| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5466|5466| 						continue;
|5467|    |-					if (targetClasses.avoid && cmpIdentity
|5468|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5467|+					if (targetClasses.avoid && cmpIdentity &&
|    |5468|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5469|5469| 						continue;
|5470|5470| 					// Only used by the AIs to prevent some choices of targets
|5471|5471| 					if (targetClasses.vetoEntities && targetClasses.vetoEntities[targ])
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5487|5487| 		{
|5488|5488| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5489|5489| 			var targetClasses = this.order.data.targetClasses;
|5490|    |-			if (cmpIdentity && targetClasses.attack
|5491|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5490|+			if (cmpIdentity && targetClasses.attack &&
|    |5491|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5492|5492| 				continue;
|5493|5493| 			if (cmpIdentity && targetClasses.avoid
|5494|5494| 				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5490|5490| 			if (cmpIdentity && targetClasses.attack
|5491|5491| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5492|5492| 				continue;
|5493|    |-			if (cmpIdentity && targetClasses.avoid
|5494|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5493|+			if (cmpIdentity && targetClasses.avoid &&
|    |5494|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5495|5495| 				continue;
|5496|5496| 			// Only used by the AIs to prevent some choices of targets
|5497|5497| 			if (targetClasses.vetoEntities && targetClasses.vetoEntities[targ])
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5647|5647| 
|5648|5648| UnitAI.prototype.SetHeldPosition = function(x, z)
|5649|5649| {
|5650|    |-	this.heldPosition = {"x": x, "z": z};
|    |5650|+	this.heldPosition = { "x": x, "z": z};
|5651|5651| };
|5652|5652| 
|5653|5653| UnitAI.prototype.SetHeldPositionOnEntity = function(entity)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5647|5647| 
|5648|5648| UnitAI.prototype.SetHeldPosition = function(x, z)
|5649|5649| {
|5650|    |-	this.heldPosition = {"x": x, "z": z};
|    |5650|+	this.heldPosition = {"x": x, "z": z };
|5651|5651| };
|5652|5652| 
|5653|5653| UnitAI.prototype.SetHeldPositionOnEntity = function(entity)
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5674|5674| 	return false;
|5675|5675| };
|5676|5676| 
|5677|    |-//// Helper functions ////
|    |5677|+// // Helper functions ////
|5678|5678| 
|5679|5679| UnitAI.prototype.CanAttack = function(target)
|5680|5680| {
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5878|5878| 	return cmpPack && cmpPack.IsPacking();
|5879|5879| };
|5880|5880| 
|5881|    |-//// Formation specific functions ////
|    |5881|+// // Formation specific functions ////
|5882|5882| 
|5883|5883| UnitAI.prototype.IsAttackingAsFormation = function()
|5884|5884| {
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5883|5883| UnitAI.prototype.IsAttackingAsFormation = function()
|5884|5884| {
|5885|5885| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5886|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5887|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5886|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5887|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5888|5888| };
|5889|5889| 
|5890|5890| //// Animal specific functions ////
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5887|5887| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5888|5888| };
|5889|5889| 
|5890|    |-//// Animal specific functions ////
|    |5890|+// // Animal specific functions ////
|5891|5891| 
|5892|5892| UnitAI.prototype.MoveRandomly = function(distance)
|5893|5893| {

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

binaries/data/mods/public/simulation/components/UnitAI.js
| 901| »   »   »   "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
| 926| »   »   »   "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
| 976| »   »   »   »   »   return·true;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'enter' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
|1039| »   »   »   »   "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
|1075| »   »   »   "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
|1107| »   »   »   »   "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
|1267| »   »   "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
|1324| »   »   »   "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
|1499| »   »   »   "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
|1521| »   »   »   "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
|1553| »   »   »   "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
|1708| »   »   »   "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
|1758| »   »   »   »   "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
|1832| »   »   »   »   "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
|1996| »   »   »   »   »   »   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
|2007| »   »   »   »   »   return·true;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'enter' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
|2012| »   »   »   »   "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
|2115| »   »   »   »   "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
|2370| »   »   »   »   "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
|2403| »   »   »   »   "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
|2445| »   »   »   »   "Timer":·function(msg)·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'Timer'.

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|2506| »   »   »   »   "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
|2611| »   »   »   »   "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
|2822| »   »   »   »   "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
|3003| »   »   »   »   "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
|3727| »   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
|4559| »   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
|4574| »   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
|4620| »   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
|4643| »   »   ····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
|1973| »   »   »   »   »   »   &&·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
|3689| »   »   var·order·=·{·"type":·type,·"data":·data·};
|    | [NORMAL] JSHintBear:
|    | 'order' is already defined.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

wraitii updated this revision to Diff 9035.EditedSun, Jul 21, 4:54 PM

Other optimising changes: start at 1.5 terrain tiles instead of 2 as a minimum, increase by 1, also send "obstructed" in path result when a short path fails, and only warn after the first computation (which should be fast with range 1.5) to avoid too much spuriousness.

Reduce max range from 10 terrain tiles to 6 since that's already bigger than most obstructions.

Move the short-path search-range forward a bit when it seems useful (aka goal is outside the range) as that make slower search domains slightly less problematic.

Still needs to be tested somewhat extensively.

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

Linter detected issues:
Executing section Source...

source/simulation2/TypeList.h
|   1| /*·Copyright·(C)·2018·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2019" year instead of "2018"

source/simulation2/MessageTypes.h
|  44| class·CMessageTurnStart·:·public·CMessage
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'classCMessageTurnStart:' is invalid C code. Use --std or --language to configure the language.
Executing section JS...
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 526| 526| 					this.PushOrderFront("Walk", this.order.data.lastPos);
| 527| 527| 				}
| 528| 528| 				else
| 529|    |-				{
|    | 529|+				
| 530| 530| 					// We couldn't move there, or the target moved away
| 531| 531| 					this.FinishOrder();
| 532|    |-				}
|    | 532|+				
| 533| 533| 				return;
| 534| 534| 			}
| 535| 535| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 746| 746| 			}
| 747| 747| 			// Check if we are already in range, otherwise walk there
| 748| 748| 			if (!this.CheckGarrisonRange(msg.data.target))
| 749|    |-			{
|    | 749|+			
| 750| 750| 				if (!this.CheckTargetVisible(msg.data.target))
| 751| 751| 				{
| 752| 752| 					this.FinishOrder();
| 757| 757| 					this.SetNextState("GARRISON.APPROACHING");
| 758| 758| 					return;
| 759| 759| 				}
| 760|    |-			}
|    | 760|+			
| 761| 761| 
| 762| 762| 			this.SetNextState("GARRISON.GARRISONING");
| 763| 763| 		},
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 752| 752| 					this.FinishOrder();
| 753| 753| 					return;
| 754| 754| 				}
| 755|    |-				else
| 756|    |-				{
|    | 755|+				
| 757| 756| 					this.SetNextState("GARRISON.APPROACHING");
| 758| 757| 					return;
| 759|    |-				}
|    | 758|+				
| 760| 759| 			}
| 761| 760| 
| 762| 761| 			this.SetNextState("GARRISON.GARRISONING");
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 775| 775| 						this.PushOrderFront("Walk", msg.data.lastPos);
| 776| 776| 					}
| 777| 777| 					else
| 778|    |-					{
|    | 778|+					
| 779| 779| 						// We couldn't move there, or the target moved away
| 780| 780| 						this.FinishOrder();
| 781|    |-					}
|    | 781|+					
| 782| 782| 					return;
| 783| 783| 				}
| 784| 784| 
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'GARRISON'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1014|1014| 			},
|1015|1015| 		},
|1016|1016| 
|1017|    |-		"GARRISON":{
|    |1017|+		"GARRISON": {
|1018|1018| 			"enter": function() {
|1019|1019| 				// If the garrisonholder should pickup, warn it so it can take needed action
|1020|1020| 				var cmpGarrisonHolder = Engine.QueryInterface(this.order.data.target, IID_GarrisonHolder);
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1228|1228| 			// If the controller handled an order but some members rejected it,
|1229|1229| 			// they will have no orders and be in the FORMATIONMEMBER.IDLE state.
|1230|1230| 			if (this.orderQueue.length)
|1231|    |-			{
|    |1231|+			
|1232|1232| 				// We're leaving the formation, so stop our FormationWalk order
|1233|1233| 				if (this.FinishOrder())
|1234|1234| 					return;
|1235|    |-			}
|    |1235|+			
|1236|1236| 
|1237|1237| 			// No orders left, we're an individual now
|1238|1238| 			this.SetNextState("INDIVIDUAL.IDLE");
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1253|1253| 			// Move a tile outside the building
|1254|1254| 			let range = 4;
|1255|1255| 			if (this.CheckTargetRangeExplicit(msg.data.target, range, -1))
|1256|    |-			{
|    |1256|+			
|1257|1257| 				// We are already at the target, or can't move at all
|1258|1258| 				this.FinishOrder();
|1259|    |-			}
|    |1259|+			
|1260|1260| 			else
|1261|1261| 			{
|1262|1262| 				this.order.data.min = range;
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1446|1446| 
|1447|1447| 			"LosRangeUpdate": function(msg) {
|1448|1448| 				if (this.GetStance().targetVisibleEnemies)
|1449|    |-				{
|    |1449|+				
|1450|1450| 					// Start attacking one of the newly-seen enemy (if any)
|1451|1451| 					this.AttackEntitiesByPreference(msg.data.added);
|1452|    |-				}
|    |1452|+				
|1453|1453| 			},
|1454|1454| 
|1455|1455| 			"LosHealRangeUpdate": function(msg) {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1688|1688| 						// if nothing better to do, check if the guarded needs to be healed or repaired
|1689|1689| 						var cmpHealth = Engine.QueryInterface(this.isGuardOf, IID_Health);
|1690|1690| 						if (cmpHealth && cmpHealth.IsInjured())
|1691|    |-						{
|    |1691|+						
|1692|1692| 							if (this.CanHeal(this.isGuardOf))
|1693|1693| 								this.PushOrderFront("Heal", { "target": this.isGuardOf, "force": false });
|1694|1694| 							else if (this.CanRepair(this.isGuardOf))
|1695|1695| 								this.PushOrderFront("Repair", { "target": this.isGuardOf, "autocontinue": false, "force": false });
|1696|    |-						}
|    |1696|+						
|1697|1697| 					}
|1698|1698| 				},
|1699|1699| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1969|1969| 
|1970|1970| 				"Attacked": function(msg) {
|1971|1971| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|1972|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|1973|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |1972|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |1973|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|1974|1974| 						this.RespondToTargetedEntities([msg.data.attacker]);
|1975|1975| 				},
|1976|1976| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2021|2021| 
|2022|2022| 					var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|2023|2023| 					if (cmpUnitAI && cmpUnitAI.IsFleeing())
|2024|    |-					{
|    |2024|+					
|2025|2025| 						// Run after a fleeing target
|2026|2026| 						this.SetSpeedMultiplier(this.GetRunMultiplier());
|2027|    |-					}
|    |2027|+					
|2028|2028| 					this.StartTimer(1000, 1000);
|2029|2029| 				},
|2030|2030| 
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2432|2432| 					this.StartTimer(prepare, this.healTimers.repeat);
|2433|2433| 
|2434|2434| 					// If using a non-default prepare time, re-sync the animation when the timer runs.
|2435|    |-					this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false;
|    |2435|+					this.resyncAnimation = (prepare != this.healTimers.prepare);
|2436|2436| 
|2437|2437| 					this.FaceTowardsTarget(this.order.data.target);
|2438|2438| 				},
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2655|2655| 					{
|2656|2656| 						// The building was already finished/fully repaired before we arrived;
|2657|2657| 						// let the ConstructionFinished handler handle this.
|2658|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2658|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2659|2659| 						return true;
|2660|2660| 					}
|2661|2661| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2655|2655| 					{
|2656|2656| 						// The building was already finished/fully repaired before we arrived;
|2657|2657| 						// let the ConstructionFinished handler handle this.
|2658|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2658|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2659|2659| 						return true;
|2660|2660| 					}
|2661|2661| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3046|3046| 		"Attacked": function(msg) {
|3047|3047| 			if (this.template.NaturalBehaviour == "skittish" ||
|3048|3048| 			    this.template.NaturalBehaviour == "passive")
|3049|    |-			{
|    |3049|+			
|3050|3050| 				this.Flee(msg.data.attacker, false);
|3051|    |-			}
|    |3051|+			
|3052|3052| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|3053|3053| 			{
|3054|3054| 				if (this.CanAttack(msg.data.attacker))
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3055|3055| 					this.Attack(msg.data.attacker, false);
|3056|3056| 			}
|3057|3057| 			else if (this.template.NaturalBehaviour == "domestic")
|3058|    |-			{
|    |3058|+			
|3059|3059| 				// Never flee, stop what we were doing
|3060|3060| 				this.SetNextState("IDLE");
|3061|    |-			}
|    |3061|+			
|3062|3062| 		},
|3063|3063| 
|3064|3064| 		"Order.LeaveFoundation": function(msg) {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/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.IsDangerousAnimal())
|3112|    |-				{
|    |3112|+				
|3113|3113| 					this.AttackVisibleEntity(msg.data.added);
|3114|    |-				}
|    |3114|+				
|3115|3115| 
|3116|3116| 				// TODO: if two units enter our range together, we'll attack the
|3117|3117| 				// first and then the second won't trigger another LosRangeUpdate
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3153|3153| 				}
|3154|3154| 				// Start attacking one of the newly-seen enemy (if any)
|3155|3155| 				else if (this.template.NaturalBehaviour == "violent")
|3156|    |-				{
|    |3156|+				
|3157|3157| 					this.AttackVisibleEntity(msg.data.added);
|3158|    |-				}
|    |3158|+				
|3159|3159| 			},
|3160|3160| 
|3161|3161| 			"Timer": function(msg) {
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 7.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3168|3168| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3169|3169| 
|3170|3170| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3171|    |-							// only used for domestic animals
|    |3171|+		// only used for domestic animals
|3172|3172| 	},
|3173|3173| };
|3174|3174| 
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3225|3225| 
|3226|3226| UnitAI.prototype.IsAnimal = function()
|3227|3227| {
|3228|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3228|+	return (!!this.template.NaturalBehaviour);
|3229|3229| };
|3230|3230| 
|3231|3231| UnitAI.prototype.IsDangerousAnimal = function()
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3263|3263| UnitAI.prototype.GetGarrisonHolder = function()
|3264|3264| {
|3265|3265| 	if (this.IsGarrisoned())
|3266|    |-	{
|    |3266|+	
|3267|3267| 		for (let order of this.orderQueue)
|3268|3268| 			if (order.type == "Garrison")
|3269|3269| 				return order.data.target;
|3270|    |-	}
|    |3270|+	
|3271|3271| 	return INVALID_ENTITY;
|3272|3272| };
|3273|3273| 
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3341|3341| 		{
|3342|3342| 			let index = this.GetCurrentState().indexOf(".");
|3343|3343| 			if (index != -1)
|3344|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3344|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3345|3345| 			this.Stop(false);
|3346|3346| 		}
|3347|3347| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3397|3397| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3398|3398| 			continue;
|3399|3399| 		if (i == 0)
|3400|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3400|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3401|3401| 		else
|3402|3402| 			this.orderQueue.splice(i, 1);
|3403|3403| 		Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3397|3397| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3398|3398| 			continue;
|3399|3399| 		if (i == 0)
|3400|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3400|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3401|3401| 		else
|3402|3402| 			this.orderQueue.splice(i, 1);
|3403|3403| 		Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3481|3481| };
|3482|3482| 
|3483|3483| 
|3484|    |-//// FSM linkage functions ////
|    |3484|+// // FSM linkage functions ////
|3485|3485| 
|3486|3486| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3487|3487| UnitAI.prototype.SetNextState = function(state)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3651|3651| 				continue;
|3652|3652| 			if (this.orderQueue[i].type == type)
|3653|3653| 				continue;
|3654|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3654|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3655|3655| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3656|3656| 			return;
|3657|3657| 		}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3651|3651| 				continue;
|3652|3652| 			if (this.orderQueue[i].type == type)
|3653|3653| 				continue;
|3654|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3654|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3655|3655| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3656|3656| 			return;
|3657|3657| 		}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3665|3665| {
|3666|3666| 	// Remember the previous work orders to be able to go back to them later if required
|3667|3667| 	if (data && data.force)
|3668|    |-	{
|    |3668|+	
|3669|3669| 		if (this.IsFormationController())
|3670|3670| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3671|3671| 		else
|3672|3672| 			this.UpdateWorkOrders(type);
|3673|    |-	}
|    |3673|+	
|3674|3674| 
|3675|3675| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3676|3676| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3742|3742| 	{
|3743|3743| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3744|3744| 		if (cmpUnitAI)
|3745|    |-		{
|    |3745|+		
|3746|3746| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3747|3747| 			{
|3748|3748| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3751|3751| 					return;
|3752|3752| 				}
|3753|3753| 			}
|3754|    |-		}
|    |3754|+		
|3755|3755| 	}
|3756|3756| 
|3757|3757| 	// If nothing found, take the unit orders
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3744|3744| 		if (cmpUnitAI)
|3745|3745| 		{
|3746|3746| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3747|    |-			{
|    |3747|+			
|3748|3748| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3749|3749| 				{
|3750|3750| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3751|3751| 					return;
|3752|3752| 				}
|3753|    |-			}
|    |3753|+			
|3754|3754| 		}
|3755|3755| 	}
|3756|3756| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3756|3756| 
|3757|3757| 	// If nothing found, take the unit orders
|3758|3758| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3759|    |-	{
|    |3759|+	
|3760|3760| 		if (isWorkType(this.orderQueue[i].type))
|3761|3761| 		{
|3762|3762| 			this.workOrders = this.orderQueue.slice(i);
|3763|3763| 			return;
|3764|3764| 		}
|3765|    |-	}
|    |3765|+	
|3766|3766| };
|3767|3767| 
|3768|3768| UnitAI.prototype.BackToWork = function()
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3822|3822| 	if (data.timerRepeat === undefined)
|3823|3823| 		this.timer = undefined;
|3824|3824| 
|3825|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3825|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3826|3826| };
|3827|3827| 
|3828|3828| /**
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3822|3822| 	if (data.timerRepeat === undefined)
|3823|3823| 		this.timer = undefined;
|3824|3824| 
|3825|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3825|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3826|3826| };
|3827|3827| 
|3828|3828| /**
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3857|3857| 	this.timer = undefined;
|3858|3858| };
|3859|3859| 
|3860|    |-//// Message handlers /////
|    |3860|+// // Message handlers /////
|3861|3861| 
|3862|3862| UnitAI.prototype.OnMotionUpdate = function(msg)
|3863|3863| {
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3874|3874| 	// TODO: This is a bit inefficient since every unit listens to every
|3875|3875| 	// construction message - ideally we could scope it to only the one we're building
|3876|3876| 
|3877|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3877|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3878|3878| };
|3879|3879| 
|3880|3880| UnitAI.prototype.OnGlobalEntityRenamed = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3874|3874| 	// TODO: This is a bit inefficient since every unit listens to every
|3875|3875| 	// construction message - ideally we could scope it to only the one we're building
|3876|3876| 
|3877|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3877|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3878|3878| };
|3879|3879| 
|3880|3880| UnitAI.prototype.OnGlobalEntityRenamed = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3899|3899| 
|3900|3900| UnitAI.prototype.OnAttacked = function(msg)
|3901|3901| {
|3902|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3902|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3903|3903| };
|3904|3904| 
|3905|3905| UnitAI.prototype.OnGuardedAttacked = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3899|3899| 
|3900|3900| UnitAI.prototype.OnAttacked = function(msg)
|3901|3901| {
|3902|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3902|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3903|3903| };
|3904|3904| 
|3905|3905| UnitAI.prototype.OnGuardedAttacked = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3904|3904| 
|3905|3905| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3906|3906| {
|3907|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3907|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|3908|3908| };
|3909|3909| 
|3910|3910| UnitAI.prototype.OnHealthChanged = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3904|3904| 
|3905|3905| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3906|3906| {
|3907|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3907|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|3908|3908| };
|3909|3909| 
|3910|3910| UnitAI.prototype.OnHealthChanged = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3909|3909| 
|3910|3910| UnitAI.prototype.OnHealthChanged = function(msg)
|3911|3911| {
|3912|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3912|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|3913|3913| };
|3914|3914| 
|3915|3915| UnitAI.prototype.OnRangeUpdate = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3909|3909| 
|3910|3910| UnitAI.prototype.OnHealthChanged = function(msg)
|3911|3911| {
|3912|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3912|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|3913|3913| };
|3914|3914| 
|3915|3915| UnitAI.prototype.OnRangeUpdate = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3915|3915| UnitAI.prototype.OnRangeUpdate = function(msg)
|3916|3916| {
|3917|3917| 	if (msg.tag == this.losRangeQuery)
|3918|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3918|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|3919|3919| 	else if (msg.tag == this.losHealRangeQuery)
|3920|3920| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3921|3921| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3915|3915| UnitAI.prototype.OnRangeUpdate = function(msg)
|3916|3916| {
|3917|3917| 	if (msg.tag == this.losRangeQuery)
|3918|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3918|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|3919|3919| 	else if (msg.tag == this.losHealRangeQuery)
|3920|3920| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3921|3921| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3917|3917| 	if (msg.tag == this.losRangeQuery)
|3918|3918| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3919|3919| 	else if (msg.tag == this.losHealRangeQuery)
|3920|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3920|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|3921|3921| };
|3922|3922| 
|3923|3923| UnitAI.prototype.OnPackFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3917|3917| 	if (msg.tag == this.losRangeQuery)
|3918|3918| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3919|3919| 	else if (msg.tag == this.losHealRangeQuery)
|3920|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3920|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|3921|3921| };
|3922|3922| 
|3923|3923| UnitAI.prototype.OnPackFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3922|3922| 
|3923|3923| UnitAI.prototype.OnPackFinished = function(msg)
|3924|3924| {
|3925|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3925|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|3926|3926| };
|3927|3927| 
|3928|3928| //// Helper functions to be called by the FSM ////
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3922|3922| 
|3923|3923| UnitAI.prototype.OnPackFinished = function(msg)
|3924|3924| {
|3925|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3925|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|3926|3926| };
|3927|3927| 
|3928|3928| //// Helper functions to be called by the FSM ////
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3925|3925| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|3926|3926| };
|3927|3927| 
|3928|    |-//// Helper functions to be called by the FSM ////
|    |3928|+// // Helper functions to be called by the FSM ////
|3929|3929| 
|3930|3930| UnitAI.prototype.GetWalkSpeed = function()
|3931|3931| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4112|4112| 			PlaySound(name, member);
|4113|4113| 	}
|4114|4114| 	else
|4115|    |-	{
|    |4115|+	
|4116|4116| 		// Otherwise use our own sounds
|4117|4117| 		PlaySound(name, this.entity);
|4118|    |-	}
|    |4118|+	
|4119|4119| };
|4120|4120| 
|4121|4121| /*
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4572|4572| UnitAI.prototype.AttackEntityInZone = function(ents)
|4573|4573| {
|4574|4574| 	var target = ents.find(target =>
|4575|    |-		this.CanAttack(target)
|4576|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4575|+		this.CanAttack(target) &&
|    |4576|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4577|4577| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4578|4578| 	);
|4579|4579| 	if (!target)
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4573|4573| {
|4574|4574| 	var target = ents.find(target =>
|4575|4575| 		this.CanAttack(target)
|4576|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4577|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4576|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4577|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4578|4578| 	);
|4579|4579| 	if (!target)
|4580|4580| 		return false;
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before 'Engine'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4637|4637| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4638|4638| 	if (this.isGuardOf)
|4639|4639| 	{
|4640|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4640|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4641|4641| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4642|4642| 		if (cmpUnitAI && cmpAttack &&
|4643|4643| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 4.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4641|4641| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4642|4642| 		if (cmpUnitAI && cmpAttack &&
|4643|4643| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4644|    |-				return false;
|    |4644|+			return false;
|4645|4645| 	}
|4646|4646| 
|4647|4647| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4646|4646| 
|4647|4647| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4648|4648| 	if (this.GetStance().respondHoldGround)
|4649|    |-	{
|    |4649|+	
|4650|4650| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4651|4651| 			return true;
|4652|    |-	}
|    |4652|+	
|4653|4653| 
|4654|4654| 	// Stop if it's left our vision range, unless we're especially persistent
|4655|4655| 	if (!this.GetStance().respondChaseBeyondVision)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4653|4653| 
|4654|4654| 	// Stop if it's left our vision range, unless we're especially persistent
|4655|4655| 	if (!this.GetStance().respondChaseBeyondVision)
|4656|    |-	{
|    |4656|+	
|4657|4657| 		if (!this.CheckTargetIsInVisionRange(target))
|4658|4658| 			return true;
|4659|    |-	}
|    |4659|+	
|4660|4660| 
|4661|4661| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4662|4662| 	// and will continue moving to its last seen position and then stop)
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before 'Engine'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4679|4679| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4680|4680| 	if (this.isGuardOf)
|4681|4681| 	{
|4682|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4682|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4683|4683| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4684|4684| 		if (cmpUnitAI && cmpAttack &&
|4685|4685| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4692|4692| 	return false;
|4693|4693| };
|4694|4694| 
|4695|    |-//// External interface functions ////
|    |4695|+// // External interface functions ////
|4696|4696| 
|4697|4697| UnitAI.prototype.SetFormationController = function(ent)
|4698|4698| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4702|4702| 	// of our own formation (or ourself if not in formation)
|4703|4703| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4704|4704| 	if (cmpObstruction)
|4705|    |-	{
|    |4705|+	
|4706|4706| 		if (ent == INVALID_ENTITY)
|4707|4707| 			cmpObstruction.SetControlGroup(this.entity);
|4708|4708| 		else
|4709|4709| 			cmpObstruction.SetControlGroup(ent);
|4710|    |-	}
|    |4710|+	
|4711|4711| 
|4712|4712| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4713|4713| 	if (ent == INVALID_ENTITY)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4845|4845| 	// if we already had an old guard order, do nothing if the target is the same
|4846|4846| 	// and the order is running, otherwise remove the previous order
|4847|4847| 	if (this.isGuardOf)
|4848|    |-	{
|    |4848|+	
|4849|4849| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4850|4850| 			return;
|4851|4851| 		else
|4852|4852| 			this.RemoveGuard();
|4853|    |-	}
|    |4853|+	
|4854|4854| 
|4855|4855| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4856|4856| };
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4848|4848| 	{
|4849|4849| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4850|4850| 			return;
|4851|    |-		else
|4852|    |-			this.RemoveGuard();
|    |4851|+		this.RemoveGuard();
|4853|4852| 	}
|4854|4853| 
|4855|4854| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|    | [NORMAL] ESLintBear (no-trailing-spaces):
|    | Trailing spaces not allowed.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5180|5180| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5181|5181| 	{
|5182|5182| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5183|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5183|+		if (cmpTrader.HasBothMarkets() &&
|5184|5184| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5185|5185| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5186|5186| 		{
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5461|5461| 				{
|5462|5462| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5463|5463| 					var targetClasses = this.order.data.targetClasses;
|5464|    |-					if (targetClasses.attack && cmpIdentity
|5465|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5464|+					if (targetClasses.attack && cmpIdentity &&
|    |5465|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5466|5466| 						continue;
|5467|5467| 					if (targetClasses.avoid && cmpIdentity
|5468|5468| 						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5464|5464| 					if (targetClasses.attack && cmpIdentity
|5465|5465| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5466|5466| 						continue;
|5467|    |-					if (targetClasses.avoid && cmpIdentity
|5468|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5467|+					if (targetClasses.avoid && cmpIdentity &&
|    |5468|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5469|5469| 						continue;
|5470|5470| 					// Only used by the AIs to prevent some choices of targets
|5471|5471| 					if (targetClasses.vetoEntities && targetClasses.vetoEntities[targ])
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5487|5487| 		{
|5488|5488| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5489|5489| 			var targetClasses = this.order.data.targetClasses;
|5490|    |-			if (cmpIdentity && targetClasses.attack
|5491|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5490|+			if (cmpIdentity && targetClasses.attack &&
|    |5491|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5492|5492| 				continue;
|5493|5493| 			if (cmpIdentity && targetClasses.avoid
|5494|5494| 				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5490|5490| 			if (cmpIdentity && targetClasses.attack
|5491|5491| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5492|5492| 				continue;
|5493|    |-			if (cmpIdentity && targetClasses.avoid
|5494|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5493|+			if (cmpIdentity && targetClasses.avoid &&
|    |5494|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5495|5495| 				continue;
|5496|5496| 			// Only used by the AIs to prevent some choices of targets
|5497|5497| 			if (targetClasses.vetoEntities && targetClasses.vetoEntities[targ])
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5647|5647| 
|5648|5648| UnitAI.prototype.SetHeldPosition = function(x, z)
|5649|5649| {
|5650|    |-	this.heldPosition = {"x": x, "z": z};
|    |5650|+	this.heldPosition = { "x": x, "z": z};
|5651|5651| };
|5652|5652| 
|5653|5653| UnitAI.prototype.SetHeldPositionOnEntity = function(entity)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5647|5647| 
|5648|5648| UnitAI.prototype.SetHeldPosition = function(x, z)
|5649|5649| {
|5650|    |-	this.heldPosition = {"x": x, "z": z};
|    |5650|+	this.heldPosition = {"x": x, "z": z };
|5651|5651| };
|5652|5652| 
|5653|5653| UnitAI.prototype.SetHeldPositionOnEntity = function(entity)
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5674|5674| 	return false;
|5675|5675| };
|5676|5676| 
|5677|    |-//// Helper functions ////
|    |5677|+// // Helper functions ////
|5678|5678| 
|5679|5679| UnitAI.prototype.CanAttack = function(target)
|5680|5680| {
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5878|5878| 	return cmpPack && cmpPack.IsPacking();
|5879|5879| };
|5880|5880| 
|5881|    |-//// Formation specific functions ////
|    |5881|+// // Formation specific functions ////
|5882|5882| 
|5883|5883| UnitAI.prototype.IsAttackingAsFormation = function()
|5884|5884| {
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5883|5883| UnitAI.prototype.IsAttackingAsFormation = function()
|5884|5884| {
|5885|5885| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5886|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5887|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5886|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5887|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5888|5888| };
|5889|5889| 
|5890|5890| //// Animal specific functions ////
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5887|5887| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5888|5888| };
|5889|5889| 
|5890|    |-//// Animal specific functions ////
|    |5890|+// // Animal specific functions ////
|5891|5891| 
|5892|5892| UnitAI.prototype.MoveRandomly = function(distance)
|5893|5893| {

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

binaries/data/mods/public/simulation/components/UnitAI.js
| 901| »   »   »   "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
| 926| »   »   »   "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
| 976| »   »   »   »   »   return·true;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'enter' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
|1039| »   »   »   »   "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
|1075| »   »   »   "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
|1107| »   »   »   »   "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
|1267| »   »   "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
|1324| »   »   »   "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
|1499| »   »   »   "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
|1521| »   »   »   "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
|1553| »   »   »   "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
|1708| »   »   »   "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
|1758| »   »   »   »   "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
|1832| »   »   »   »   "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
|1996| »   »   »   »   »   »   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
|2007| »   »   »   »   »   return·true;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'enter' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
|2012| »   »   »   »   "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
|2115| »   »   »   »   "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
|2370| »   »   »   »   "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
|2403| »   »   »   »   "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
|2445| »   »   »   »   "Timer":·function(msg)·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'Timer'.

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|2506| »   »   »   »   "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
|2611| »   »   »   »   "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
|2822| »   »   »   »   "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
|3003| »   »   »   »   "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
|3727| »   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
|4559| »   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
|4574| »   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
|4620| »   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
|4643| »   »   ····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
|1973| »   »   »   »   »   »   &&·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
|3689| »   »   var·order·=·{·"type":·type,·"data":·data·};
|    | [NORMAL] JSHintBear:
|    | 'order' is already defined.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

wraitii added inline comments.Mon, Jul 22, 11:50 AM
binaries/data/mods/public/simulation/components/UnitAI.js
542 ↗(On Diff #9035)

Need to mark this as 'relaxed' too.

1055 ↗(On Diff #9035)

swap for likelySuccess as I need to call this.CheckGarrisonRange instead

2404 ↗(On Diff #9035)

CheckRange

2454 ↗(On Diff #9035)

CheckRange

3897 ↗(On Diff #9035)

change to object assign (possibly change msg directly)

Angen added a subscriber: Angen.Mon, Jul 22, 12:28 PM
Angen added inline comments.
binaries/data/mods/public/simulation/components/UnitAI.js
2490 ↗(On Diff #9035)

return true, also note that FinisOrder will return false when changing to IDLE so be careful, because that needs return true so if any branch fails, you have to return true at leaving enter state anyway

2495 ↗(On Diff #9035)

possible change of state so return true

2498 ↗(On Diff #9035)

changing state to walking so return true

wraitii planned changes to this revision.Mon, Jul 22, 1:32 PM
wraitii added inline comments.
binaries/data/mods/public/simulation/components/UnitAI.js
2498 ↗(On Diff #9035)

Indeed, thanks for the look

wraitii updated this revision to Diff 9063.Mon, Jul 22, 6:44 PM

Fix issues noted. Tested 'heal' state, tested other things, ran AI games, Freagarach tested also. Will commit once build passes.

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

Linter detected issues:
Executing section Source...

source/simulation2/TypeList.h
|   1| /*·Copyright·(C)·2018·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2019" year instead of "2018"

source/simulation2/MessageTypes.h
|  44| class·CMessageTurnStart·:·public·CMessage
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'classCMessageTurnStart:' is invalid C code. Use --std or --language to configure the language.
Executing section JS...
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 526| 526| 					this.PushOrderFront("Walk", this.order.data.lastPos);
| 527| 527| 				}
| 528| 528| 				else
| 529|    |-				{
|    | 529|+				
| 530| 530| 					// We couldn't move there, or the target moved away
| 531| 531| 					this.FinishOrder();
| 532|    |-				}
|    | 532|+				
| 533| 533| 				return;
| 534| 534| 			}
| 535| 535| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 747| 747| 			}
| 748| 748| 			// Check if we are already in range, otherwise walk there
| 749| 749| 			if (!this.CheckGarrisonRange(msg.data.target))
| 750|    |-			{
|    | 750|+			
| 751| 751| 				if (!this.CheckTargetVisible(msg.data.target))
| 752| 752| 				{
| 753| 753| 					this.FinishOrder();
| 758| 758| 					this.SetNextState("GARRISON.APPROACHING");
| 759| 759| 					return;
| 760| 760| 				}
| 761|    |-			}
|    | 761|+			
| 762| 762| 
| 763| 763| 			this.SetNextState("GARRISON.GARRISONING");
| 764| 764| 		},
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 753| 753| 					this.FinishOrder();
| 754| 754| 					return;
| 755| 755| 				}
| 756|    |-				else
| 757|    |-				{
|    | 756|+				
| 758| 757| 					this.SetNextState("GARRISON.APPROACHING");
| 759| 758| 					return;
| 760|    |-				}
|    | 759|+				
| 761| 760| 			}
| 762| 761| 
| 763| 762| 			this.SetNextState("GARRISON.GARRISONING");
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 776| 776| 						this.PushOrderFront("Walk", msg.data.lastPos);
| 777| 777| 					}
| 778| 778| 					else
| 779|    |-					{
|    | 779|+					
| 780| 780| 						// We couldn't move there, or the target moved away
| 781| 781| 						this.FinishOrder();
| 782|    |-					}
|    | 782|+					
| 783| 783| 					return;
| 784| 784| 				}
| 785| 785| 
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'GARRISON'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1015|1015| 			},
|1016|1016| 		},
|1017|1017| 
|1018|    |-		"GARRISON":{
|    |1018|+		"GARRISON": {
|1019|1019| 			"enter": function() {
|1020|1020| 				// If the garrisonholder should pickup, warn it so it can take needed action
|1021|1021| 				var cmpGarrisonHolder = Engine.QueryInterface(this.order.data.target, IID_GarrisonHolder);
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1229|1229| 			// If the controller handled an order but some members rejected it,
|1230|1230| 			// they will have no orders and be in the FORMATIONMEMBER.IDLE state.
|1231|1231| 			if (this.orderQueue.length)
|1232|    |-			{
|    |1232|+			
|1233|1233| 				// We're leaving the formation, so stop our FormationWalk order
|1234|1234| 				if (this.FinishOrder())
|1235|1235| 					return;
|1236|    |-			}
|    |1236|+			
|1237|1237| 
|1238|1238| 			// No orders left, we're an individual now
|1239|1239| 			this.SetNextState("INDIVIDUAL.IDLE");
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1254|1254| 			// Move a tile outside the building
|1255|1255| 			let range = 4;
|1256|1256| 			if (this.CheckTargetRangeExplicit(msg.data.target, range, -1))
|1257|    |-			{
|    |1257|+			
|1258|1258| 				// We are already at the target, or can't move at all
|1259|1259| 				this.FinishOrder();
|1260|    |-			}
|    |1260|+			
|1261|1261| 			else
|1262|1262| 			{
|1263|1263| 				this.order.data.min = range;
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1447|1447| 
|1448|1448| 			"LosRangeUpdate": function(msg) {
|1449|1449| 				if (this.GetStance().targetVisibleEnemies)
|1450|    |-				{
|    |1450|+				
|1451|1451| 					// Start attacking one of the newly-seen enemy (if any)
|1452|1452| 					this.AttackEntitiesByPreference(msg.data.added);
|1453|    |-				}
|    |1453|+				
|1454|1454| 			},
|1455|1455| 
|1456|1456| 			"LosHealRangeUpdate": function(msg) {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1689|1689| 						// if nothing better to do, check if the guarded needs to be healed or repaired
|1690|1690| 						var cmpHealth = Engine.QueryInterface(this.isGuardOf, IID_Health);
|1691|1691| 						if (cmpHealth && cmpHealth.IsInjured())
|1692|    |-						{
|    |1692|+						
|1693|1693| 							if (this.CanHeal(this.isGuardOf))
|1694|1694| 								this.PushOrderFront("Heal", { "target": this.isGuardOf, "force": false });
|1695|1695| 							else if (this.CanRepair(this.isGuardOf))
|1696|1696| 								this.PushOrderFront("Repair", { "target": this.isGuardOf, "autocontinue": false, "force": false });
|1697|    |-						}
|    |1697|+						
|1698|1698| 					}
|1699|1699| 				},
|1700|1700| 
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1970|1970| 
|1971|1971| 				"Attacked": function(msg) {
|1972|1972| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|1973|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|1974|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |1973|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |1974|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|1975|1975| 						this.RespondToTargetedEntities([msg.data.attacker]);
|1976|1976| 				},
|1977|1977| 			},
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2022|2022| 
|2023|2023| 					var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI);
|2024|2024| 					if (cmpUnitAI && cmpUnitAI.IsFleeing())
|2025|    |-					{
|    |2025|+					
|2026|2026| 						// Run after a fleeing target
|2027|2027| 						this.SetSpeedMultiplier(this.GetRunMultiplier());
|2028|    |-					}
|    |2028|+					
|2029|2029| 					this.StartTimer(1000, 1000);
|2030|2030| 				},
|2031|2031| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2659|2659| 					{
|2660|2660| 						// The building was already finished/fully repaired before we arrived;
|2661|2661| 						// let the ConstructionFinished handler handle this.
|2662|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2662|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2663|2663| 						return true;
|2664|2664| 					}
|2665|2665| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2659|2659| 					{
|2660|2660| 						// The building was already finished/fully repaired before we arrived;
|2661|2661| 						// let the ConstructionFinished handler handle this.
|2662|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2662|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2663|2663| 						return true;
|2664|2664| 					}
|2665|2665| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3050|3050| 		"Attacked": function(msg) {
|3051|3051| 			if (this.template.NaturalBehaviour == "skittish" ||
|3052|3052| 			    this.template.NaturalBehaviour == "passive")
|3053|    |-			{
|    |3053|+			
|3054|3054| 				this.Flee(msg.data.attacker, false);
|3055|    |-			}
|    |3055|+			
|3056|3056| 			else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive")
|3057|3057| 			{
|3058|3058| 				if (this.CanAttack(msg.data.attacker))
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3059|3059| 					this.Attack(msg.data.attacker, false);
|3060|3060| 			}
|3061|3061| 			else if (this.template.NaturalBehaviour == "domestic")
|3062|    |-			{
|    |3062|+			
|3063|3063| 				// Never flee, stop what we were doing
|3064|3064| 				this.SetNextState("IDLE");
|3065|    |-			}
|    |3065|+			
|3066|3066| 		},
|3067|3067| 
|3068|3068| 		"Order.LeaveFoundation": function(msg) {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3113|3113| 				}
|3114|3114| 				// Start attacking one of the newly-seen enemy (if any)
|3115|3115| 				else if (this.IsDangerousAnimal())
|3116|    |-				{
|    |3116|+				
|3117|3117| 					this.AttackVisibleEntity(msg.data.added);
|3118|    |-				}
|    |3118|+				
|3119|3119| 
|3120|3120| 				// TODO: if two units enter our range together, we'll attack the
|3121|3121| 				// first and then the second won't trigger another LosRangeUpdate
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3157|3157| 				}
|3158|3158| 				// Start attacking one of the newly-seen enemy (if any)
|3159|3159| 				else if (this.template.NaturalBehaviour == "violent")
|3160|    |-				{
|    |3160|+				
|3161|3161| 					this.AttackVisibleEntity(msg.data.added);
|3162|    |-				}
|    |3162|+				
|3163|3163| 			},
|3164|3164| 
|3165|3165| 			"Timer": function(msg) {
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 7.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3172|3172| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3173|3173| 
|3174|3174| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3175|    |-							// only used for domestic animals
|    |3175|+		// only used for domestic animals
|3176|3176| 	},
|3177|3177| };
|3178|3178| 
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3229|3229| 
|3230|3230| UnitAI.prototype.IsAnimal = function()
|3231|3231| {
|3232|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3232|+	return (!!this.template.NaturalBehaviour);
|3233|3233| };
|3234|3234| 
|3235|3235| UnitAI.prototype.IsDangerousAnimal = function()
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3267|3267| UnitAI.prototype.GetGarrisonHolder = function()
|3268|3268| {
|3269|3269| 	if (this.IsGarrisoned())
|3270|    |-	{
|    |3270|+	
|3271|3271| 		for (let order of this.orderQueue)
|3272|3272| 			if (order.type == "Garrison")
|3273|3273| 				return order.data.target;
|3274|    |-	}
|    |3274|+	
|3275|3275| 	return INVALID_ENTITY;
|3276|3276| };
|3277|3277| 
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3345|3345| 		{
|3346|3346| 			let index = this.GetCurrentState().indexOf(".");
|3347|3347| 			if (index != -1)
|3348|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3348|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3349|3349| 			this.Stop(false);
|3350|3350| 		}
|3351|3351| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3401|3401| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3402|3402| 			continue;
|3403|3403| 		if (i == 0)
|3404|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3404|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3405|3405| 		else
|3406|3406| 			this.orderQueue.splice(i, 1);
|3407|3407| 		Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3401|3401| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3402|3402| 			continue;
|3403|3403| 		if (i == 0)
|3404|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3404|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3405|3405| 		else
|3406|3406| 			this.orderQueue.splice(i, 1);
|3407|3407| 		Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3485|3485| };
|3486|3486| 
|3487|3487| 
|3488|    |-//// FSM linkage functions ////
|    |3488|+// // FSM linkage functions ////
|3489|3489| 
|3490|3490| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3491|3491| UnitAI.prototype.SetNextState = function(state)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3655|3655| 				continue;
|3656|3656| 			if (this.orderQueue[i].type == type)
|3657|3657| 				continue;
|3658|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3658|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3659|3659| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3660|3660| 			return;
|3661|3661| 		}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3655|3655| 				continue;
|3656|3656| 			if (this.orderQueue[i].type == type)
|3657|3657| 				continue;
|3658|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3658|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3659|3659| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3660|3660| 			return;
|3661|3661| 		}
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3669|3669| {
|3670|3670| 	// Remember the previous work orders to be able to go back to them later if required
|3671|3671| 	if (data && data.force)
|3672|    |-	{
|    |3672|+	
|3673|3673| 		if (this.IsFormationController())
|3674|3674| 			this.CallMemberFunction("UpdateWorkOrders", [type]);
|3675|3675| 		else
|3676|3676| 			this.UpdateWorkOrders(type);
|3677|    |-	}
|    |3677|+	
|3678|3678| 
|3679|3679| 	let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null;
|3680|3680| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3746|3746| 	{
|3747|3747| 		var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI);
|3748|3748| 		if (cmpUnitAI)
|3749|    |-		{
|    |3749|+		
|3750|3750| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3751|3751| 			{
|3752|3752| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3755|3755| 					return;
|3756|3756| 				}
|3757|3757| 			}
|3758|    |-		}
|    |3758|+		
|3759|3759| 	}
|3760|3760| 
|3761|3761| 	// If nothing found, take the unit orders
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3748|3748| 		if (cmpUnitAI)
|3749|3749| 		{
|3750|3750| 			for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i)
|3751|    |-			{
|    |3751|+			
|3752|3752| 				if (isWorkType(cmpUnitAI.orderQueue[i].type))
|3753|3753| 				{
|3754|3754| 					this.workOrders = cmpUnitAI.orderQueue.slice(i);
|3755|3755| 					return;
|3756|3756| 				}
|3757|    |-			}
|    |3757|+			
|3758|3758| 		}
|3759|3759| 	}
|3760|3760| 
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'for' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3760|3760| 
|3761|3761| 	// If nothing found, take the unit orders
|3762|3762| 	for (var i = 0; i < this.orderQueue.length; ++i)
|3763|    |-	{
|    |3763|+	
|3764|3764| 		if (isWorkType(this.orderQueue[i].type))
|3765|3765| 		{
|3766|3766| 			this.workOrders = this.orderQueue.slice(i);
|3767|3767| 			return;
|3768|3768| 		}
|3769|    |-	}
|    |3769|+	
|3770|3770| };
|3771|3771| 
|3772|3772| UnitAI.prototype.BackToWork = function()
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3826|3826| 	if (data.timerRepeat === undefined)
|3827|3827| 		this.timer = undefined;
|3828|3828| 
|3829|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3829|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3830|3830| };
|3831|3831| 
|3832|3832| /**
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3826|3826| 	if (data.timerRepeat === undefined)
|3827|3827| 		this.timer = undefined;
|3828|3828| 
|3829|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3829|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3830|3830| };
|3831|3831| 
|3832|3832| /**
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3871|3871| 	// TODO: This is a bit inefficient since every unit listens to every
|3872|3872| 	// construction message - ideally we could scope it to only the one we're building
|3873|3873| 
|3874|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3874|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3875|3875| };
|3876|3876| 
|3877|3877| UnitAI.prototype.OnGlobalEntityRenamed = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3871|3871| 	// TODO: This is a bit inefficient since every unit listens to every
|3872|3872| 	// construction message - ideally we could scope it to only the one we're building
|3873|3873| 
|3874|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3874|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3875|3875| };
|3876|3876| 
|3877|3877| UnitAI.prototype.OnGlobalEntityRenamed = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3896|3896| 
|3897|3897| UnitAI.prototype.OnAttacked = function(msg)
|3898|3898| {
|3899|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3899|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3900|3900| };
|3901|3901| 
|3902|3902| UnitAI.prototype.OnGuardedAttacked = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3896|3896| 
|3897|3897| UnitAI.prototype.OnAttacked = function(msg)
|3898|3898| {
|3899|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3899|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3900|3900| };
|3901|3901| 
|3902|3902| UnitAI.prototype.OnGuardedAttacked = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3901|3901| 
|3902|3902| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3903|3903| {
|3904|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3904|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|3905|3905| };
|3906|3906| 
|3907|3907| UnitAI.prototype.OnHealthChanged = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3901|3901| 
|3902|3902| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3903|3903| {
|3904|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3904|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|3905|3905| };
|3906|3906| 
|3907|3907| UnitAI.prototype.OnHealthChanged = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3906|3906| 
|3907|3907| UnitAI.prototype.OnHealthChanged = function(msg)
|3908|3908| {
|3909|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3909|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|3910|3910| };
|3911|3911| 
|3912|3912| UnitAI.prototype.OnRangeUpdate = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3906|3906| 
|3907|3907| UnitAI.prototype.OnHealthChanged = function(msg)
|3908|3908| {
|3909|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3909|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|3910|3910| };
|3911|3911| 
|3912|3912| UnitAI.prototype.OnRangeUpdate = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3912|3912| UnitAI.prototype.OnRangeUpdate = function(msg)
|3913|3913| {
|3914|3914| 	if (msg.tag == this.losRangeQuery)
|3915|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3915|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|3916|3916| 	else if (msg.tag == this.losHealRangeQuery)
|3917|3917| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3918|3918| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3912|3912| UnitAI.prototype.OnRangeUpdate = function(msg)
|3913|3913| {
|3914|3914| 	if (msg.tag == this.losRangeQuery)
|3915|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3915|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|3916|3916| 	else if (msg.tag == this.losHealRangeQuery)
|3917|3917| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3918|3918| };
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3914|3914| 	if (msg.tag == this.losRangeQuery)
|3915|3915| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3916|3916| 	else if (msg.tag == this.losHealRangeQuery)
|3917|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3917|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|3918|3918| };
|3919|3919| 
|3920|3920| UnitAI.prototype.OnPackFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3914|3914| 	if (msg.tag == this.losRangeQuery)
|3915|3915| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3916|3916| 	else if (msg.tag == this.losHealRangeQuery)
|3917|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3917|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|3918|3918| };
|3919|3919| 
|3920|3920| UnitAI.prototype.OnPackFinished = function(msg)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3919|3919| 
|3920|3920| UnitAI.prototype.OnPackFinished = function(msg)
|3921|3921| {
|3922|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3922|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|3923|3923| };
|3924|3924| 
|3925|3925| //// Helper functions to be called by the FSM ////
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3919|3919| 
|3920|3920| UnitAI.prototype.OnPackFinished = function(msg)
|3921|3921| {
|3922|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3922|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|3923|3923| };
|3924|3924| 
|3925|3925| //// Helper functions to be called by the FSM ////
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3922|3922| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|3923|3923| };
|3924|3924| 
|3925|    |-//// Helper functions to be called by the FSM ////
|    |3925|+// // Helper functions to be called by the FSM ////
|3926|3926| 
|3927|3927| UnitAI.prototype.GetWalkSpeed = function()
|3928|3928| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'else'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4109|4109| 			PlaySound(name, member);
|4110|4110| 	}
|4111|4111| 	else
|4112|    |-	{
|    |4112|+	
|4113|4113| 		// Otherwise use our own sounds
|4114|4114| 		PlaySound(name, this.entity);
|4115|    |-	}
|    |4115|+	
|4116|4116| };
|4117|4117| 
|4118|4118| /*
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4569|4569| UnitAI.prototype.AttackEntityInZone = function(ents)
|4570|4570| {
|4571|4571| 	var target = ents.find(target =>
|4572|    |-		this.CanAttack(target)
|4573|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4572|+		this.CanAttack(target) &&
|    |4573|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4574|4574| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4575|4575| 	);
|4576|4576| 	if (!target)
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4570|4570| {
|4571|4571| 	var target = ents.find(target =>
|4572|4572| 		this.CanAttack(target)
|4573|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4574|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4573|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4574|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4575|4575| 	);
|4576|4576| 	if (!target)
|4577|4577| 		return false;
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before 'Engine'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4634|4634| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4635|4635| 	if (this.isGuardOf)
|4636|4636| 	{
|4637|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4637|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4638|4638| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4639|4639| 		if (cmpUnitAI && cmpAttack &&
|4640|4640| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 4.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4638|4638| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4639|4639| 		if (cmpUnitAI && cmpAttack &&
|4640|4640| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4641|    |-				return false;
|    |4641|+			return false;
|4642|4642| 	}
|4643|4643| 
|4644|4644| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4643|4643| 
|4644|4644| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|4645|4645| 	if (this.GetStance().respondHoldGround)
|4646|    |-	{
|    |4646|+	
|4647|4647| 		if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type))
|4648|4648| 			return true;
|4649|    |-	}
|    |4649|+	
|4650|4650| 
|4651|4651| 	// Stop if it's left our vision range, unless we're especially persistent
|4652|4652| 	if (!this.GetStance().respondChaseBeyondVision)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4650|4650| 
|4651|4651| 	// Stop if it's left our vision range, unless we're especially persistent
|4652|4652| 	if (!this.GetStance().respondChaseBeyondVision)
|4653|    |-	{
|    |4653|+	
|4654|4654| 		if (!this.CheckTargetIsInVisionRange(target))
|4655|4655| 			return true;
|4656|    |-	}
|    |4656|+	
|4657|4657| 
|4658|4658| 	// (Note that CCmpUnitMotion will detect if the target is lost in FoW,
|4659|4659| 	// and will continue moving to its last seen position and then stop)
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before 'Engine'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4676|4676| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4677|4677| 	if (this.isGuardOf)
|4678|4678| 	{
|4679|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4679|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4680|4680| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4681|4681| 		if (cmpUnitAI && cmpAttack &&
|4682|4682| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4689|4689| 	return false;
|4690|4690| };
|4691|4691| 
|4692|    |-//// External interface functions ////
|    |4692|+// // External interface functions ////
|4693|4693| 
|4694|4694| UnitAI.prototype.SetFormationController = function(ent)
|4695|4695| {
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4699|4699| 	// of our own formation (or ourself if not in formation)
|4700|4700| 	var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction);
|4701|4701| 	if (cmpObstruction)
|4702|    |-	{
|    |4702|+	
|4703|4703| 		if (ent == INVALID_ENTITY)
|4704|4704| 			cmpObstruction.SetControlGroup(this.entity);
|4705|4705| 		else
|4706|4706| 			cmpObstruction.SetControlGroup(ent);
|4707|    |-	}
|    |4707|+	
|4708|4708| 
|4709|4709| 	// If we were removed from a formation, let the FSM switch back to INDIVIDUAL
|4710|4710| 	if (ent == INVALID_ENTITY)
|    | [NORMAL] ESLintBear (curly):
|    | Unnecessary { after 'if' condition.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4842|4842| 	// if we already had an old guard order, do nothing if the target is the same
|4843|4843| 	// and the order is running, otherwise remove the previous order
|4844|4844| 	if (this.isGuardOf)
|4845|    |-	{
|    |4845|+	
|4846|4846| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4847|4847| 			return;
|4848|4848| 		else
|4849|4849| 			this.RemoveGuard();
|4850|    |-	}
|    |4850|+	
|4851|4851| 
|4852|4852| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|4853|4853| };
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4845|4845| 	{
|4846|4846| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4847|4847| 			return;
|4848|    |-		else
|4849|    |-			this.RemoveGuard();
|    |4848|+		this.RemoveGuard();
|4850|4849| 	}
|4851|4850| 
|4852|4851| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|    | [NORMAL] ESLintBear (no-trailing-spaces):
|    | Trailing spaces not allowed.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5177|5177| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5178|5178| 	{
|5179|5179| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5180|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5180|+		if (cmpTrader.HasBothMarkets() &&
|5181|5181| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5182|5182| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5183|5183| 		{
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5458|5458| 				{
|5459|5459| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5460|5460| 					var targetClasses = this.order.data.targetClasses;
|5461|    |-					if (targetClasses.attack && cmpIdentity
|5462|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5461|+					if (targetClasses.attack && cmpIdentity &&
|    |5462|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5463|5463| 						continue;
|5464|5464| 					if (targetClasses.avoid && cmpIdentity
|5465|5465| 						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5461|5461| 					if (targetClasses.attack && cmpIdentity
|5462|5462| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5463|5463| 						continue;
|5464|    |-					if (targetClasses.avoid && cmpIdentity
|5465|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5464|+					if (targetClasses.avoid && cmpIdentity &&
|    |5465|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5466|5466| 						continue;
|5467|5467| 					// Only used by the AIs to prevent some choices of targets
|5468|5468| 					if (targetClasses.vetoEntities && targetClasses.vetoEntities[targ])
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5484|5484| 		{
|5485|5485| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5486|5486| 			var targetClasses = this.order.data.targetClasses;
|5487|    |-			if (cmpIdentity && targetClasses.attack
|5488|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5487|+			if (cmpIdentity && targetClasses.attack &&
|    |5488|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5489|5489| 				continue;
|5490|5490| 			if (cmpIdentity && targetClasses.avoid
|5491|5491| 				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5487|5487| 			if (cmpIdentity && targetClasses.attack
|5488|5488| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5489|5489| 				continue;
|5490|    |-			if (cmpIdentity && targetClasses.avoid
|5491|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5490|+			if (cmpIdentity && targetClasses.avoid &&
|    |5491|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5492|5492| 				continue;
|5493|5493| 			// Only used by the AIs to prevent some choices of targets
|5494|5494| 			if (targetClasses.vetoEntities && targetClasses.vetoEntities[targ])
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5644|5644| 
|5645|5645| UnitAI.prototype.SetHeldPosition = function(x, z)
|5646|5646| {
|5647|    |-	this.heldPosition = {"x": x, "z": z};
|    |5647|+	this.heldPosition = { "x": x, "z": z};
|5648|5648| };
|5649|5649| 
|5650|5650| UnitAI.prototype.SetHeldPositionOnEntity = function(entity)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5644|5644| 
|5645|5645| UnitAI.prototype.SetHeldPosition = function(x, z)
|5646|5646| {
|5647|    |-	this.heldPosition = {"x": x, "z": z};
|    |5647|+	this.heldPosition = {"x": x, "z": z };
|5648|5648| };
|5649|5649| 
|5650|5650| UnitAI.prototype.SetHeldPositionOnEntity = function(entity)
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5671|5671| 	return false;
|5672|5672| };
|5673|5673| 
|5674|    |-//// Helper functions ////
|    |5674|+// // Helper functions ////
|5675|5675| 
|5676|5676| UnitAI.prototype.CanAttack = function(target)
|5677|5677| {
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5875|5875| 	return cmpPack && cmpPack.IsPacking();
|5876|5876| };
|5877|5877| 
|5878|    |-//// Formation specific functions ////
|    |5878|+// // Formation specific functions ////
|5879|5879| 
|5880|5880| UnitAI.prototype.IsAttackingAsFormation = function()
|5881|5881| {
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5880|5880| UnitAI.prototype.IsAttackingAsFormation = function()
|5881|5881| {
|5882|5882| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5883|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5884|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5883|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5884|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5885|5885| };
|5886|5886| 
|5887|5887| //// Animal specific functions ////
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5884|5884| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5885|5885| };
|5886|5886| 
|5887|    |-//// Animal specific functions ////
|    |5887|+// // Animal specific functions ////
|5888|5888| 
|5889|5889| UnitAI.prototype.MoveRandomly = function(distance)
|5890|5890| {

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

binaries/data/mods/public/simulation/components/UnitAI.js
| 902| »   »   »   "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
| 927| »   »   »   "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
| 977| »   »   »   »   »   return·true;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'enter' expected no return value.

binaries/data/mods/public/simulation/components/UnitAI.js
|1040| »   »   »   »   "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
|1076| »   »   »   "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
|1108| »   »   »   »   "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
|1268| »   »   "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
|1325| »   »   »   "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
|1500| »   »   »   "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
|1522| »   »   »   "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
|1554| »   »   »   "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
|1709| »   »   »   "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
|1759| »   »   »   »   "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
|1833| »   »   »   »   "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
|1997| »   »   »   »   »   »   return·true;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'enter' expected no return value.

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|2013| »   »   »   »   "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
|2116| »   »   »   »   "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
|2371| »   »   »   »   "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
|2404| »   »   »   »   "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
|2510| »   »   »   »   "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
|2576| »   »   »   »   "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
|2615| »   »   »   »   "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
|2826| »   »   »   »   "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
|3007| »   »   »   »   "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
|3731| »   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
|4556| »   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
|4571| »   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
|4617| »   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
|4640| »   »   ····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
|1974| »   »   »   »   »   »   &&·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
|3693| »   »   var·order·=·{·"type":·type,·"data":·data·};
|    | [NORMAL] JSHintBear:
|    | 'order' is already defined.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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