Page MenuHomeWildfire Games

Gather using ResourceGatherer instead of UnitAI.
Needs ReviewPublic

Authored by Freagarach on Mon, Mar 23, 2:19 PM.

Details

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

This diff moves the logic for gathering from UnitAI to ResourceGatherer. It would make it easier to allow modders to let e.g. structures gather resources.

Downsides:

  • There are two timers per entity now, perhaps the one in UnitAI can be removed by checking the range in ResourceGatherer?
  • There is an extra message sent now, although not often.

(See also #4293.)

Test Plan

Verify that:

  • Normal gathering behaviour remains the same.
  • Gathering from moving targets is also still possible.
  • Back-to-work still works.

Event Timeline

Freagarach created this revision.Mon, Mar 23, 2:19 PM
Freagarach added inline comments.Mon, Mar 23, 2:47 PM
binaries/data/mods/public/simulation/components/UnitAI.js
2234–2235

Probably not needed anymore.

2285–2302

Can be removed.

2300

We could get it from the order data.

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

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

Freagarach updated this revision to Diff 11530.Tue, Mar 24, 8:22 AM

Remove redundant variables in UnitAI.

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

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

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (no-extra-semi):
|    | Unnecessary semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceGatherer.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceGatherer.js
|  47|  47| 	cmpResourceGatherer = ConstructComponent(gathererID, "ResourceGatherer", template);
|  48|  48| 	cmpResourceGatherer.RecalculateGatherRatesAndCapacities(); // Force updating values.
|  49|  49| 	cmpTimer = ConstructComponent(SYSTEM_ENTITY, "Timer", {});
|  50|    |-};
|    |  50|+}
|  51|  51| 
|  52|  52| // General getters.
|  53|  53| TS_ASSERT_UNEVAL_EQUALS(cmpResourceGatherer.GetCarryingStatus(), []);
|    | [NORMAL] ESLintBear (no-extra-semi):
|    | Unnecessary semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceGatherer.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceGatherer.js
|  90|  90| 	});
|  91|  91| 
|  92|  92| 	TS_ASSERT(cmpResourceGatherer.TryInstantGather(supplyID));
|  93|    |-};
|    |  93|+}
|  94|  94| testTreasure();
|  95|  95| 
|  96|  96| function testNormalGathering()
|    | [NORMAL] ESLintBear (no-extra-semi):
|    | Unnecessary semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceGatherer.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceGatherer.js
| 154| 154| 		[{ "type": "food", "amount": 2, "max": 10 }]);
| 155| 155| 	TS_ASSERT(cmpResourceGatherer.IsCarrying("food"));
| 156| 156| 	TS_ASSERT(cmpResourceGatherer.CanCarryMore("food"));
| 157|    |-};
|    | 157|+}
| 158| 158| testNormalGathering();
| 159| 159| 
| 160| 160| function testSecondTypeDitchesFirst()
|    | [NORMAL] ESLintBear (no-extra-semi):
|    | Unnecessary semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceGatherer.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceGatherer.js
| 199| 199| 	TS_ASSERT(cmpResourceGatherer.CanCarryMore("food"));
| 200| 200| 	TS_ASSERT(cmpResourceGatherer.IsCarrying("wood"));
| 201| 201| 	TS_ASSERT(cmpResourceGatherer.CanCarryMore("wood"));
| 202|    |-};
|    | 202|+}
| 203| 203| testSecondTypeDitchesFirst();
| 204| 204| 
| 205| 205| function testStopIfExhausted()
|    | [NORMAL] ESLintBear (no-extra-semi):
|    | Unnecessary semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceGatherer.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceGatherer.js
| 224| 224| 	cmpTimer.OnUpdate({ "turnLength": 1 });
| 225| 225| 	TS_ASSERT_UNEVAL_EQUALS(cmpResourceGatherer.GetCarryingStatus(),
| 226| 226| 		[{ "type": "food", "amount": 1, "max": 10 }]);
| 227|    |-};
|    | 227|+}
| 228| 228| testStopIfExhausted();
| 229| 229| 
| 230| 230| function testStopIfFilled()
|    | [NORMAL] ESLintBear (no-extra-semi):
|    | Unnecessary semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceGatherer.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceGatherer.js
| 249| 249| 	cmpTimer.OnUpdate({ "turnLength": 1 });
| 250| 250| 	TS_ASSERT_UNEVAL_EQUALS(cmpResourceGatherer.GetCarryingStatus(),
| 251| 251| 		[{ "type": "food", "amount": 10, "max": 10 }]);
| 252|    |-};
|    | 252|+}
| 253| 253| testStopIfFilled();
| 254| 254| 
| 255| 255| function testAddingTwiceDoesntMatter()
|    | [NORMAL] ESLintBear (no-extra-semi):
|    | Unnecessary semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceGatherer.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_ResourceGatherer.js
| 281| 281| 	cmpTimer.OnUpdate({ "turnLength": 1 });
| 282| 282| 	TS_ASSERT_UNEVAL_EQUALS(cmpResourceGatherer.GetCarryingStatus(),
| 283| 283| 		[{ "type": "food", "amount": 4, "max": 10 }]);
| 284|    |-};
|    | 284|+}
| 285| 285| testAddingTwiceDoesntMatter();

binaries/data/mods/public/simulation/components/tests/test_ResourceGatherer.js
|  86| »   »   "TakeResources":·(value)·=>·{·return·{
|    | [NORMAL] ESLintBear (brace-rules/brace-on-same-line):
|    | Statement inside of curly braces should be on next line.

binaries/data/mods/public/simulation/components/tests/test_ResourceGatherer.js
| 135| »   »   "TakeResources":·(amount)·=>·{·return·{
|    | [NORMAL] ESLintBear (brace-rules/brace-on-same-line):
|    | Statement inside of curly braces should be on next line.

binaries/data/mods/public/simulation/components/tests/test_ResourceGatherer.js
| 168| »   »   "TakeResources":·(amount)·=>·{·return·{
|    | [NORMAL] ESLintBear (brace-rules/brace-on-same-line):
|    | Statement inside of curly braces should be on next line.

binaries/data/mods/public/simulation/components/tests/test_ResourceGatherer.js
| 186| »   »   "TakeResources":·(amount)·=>·{·return·{
|    | [NORMAL] ESLintBear (brace-rules/brace-on-same-line):
|    | Statement inside of curly braces should be on next line.

binaries/data/mods/public/simulation/components/tests/test_ResourceGatherer.js
| 213| »   »   "TakeResources":·(amount)·=>·{·return·{
|    | [NORMAL] ESLintBear (brace-rules/brace-on-same-line):
|    | Statement inside of curly braces should be on next line.

binaries/data/mods/public/simulation/components/tests/test_ResourceGatherer.js
| 238| »   »   "TakeResources":·(amount)·=>·{·return·{
|    | [NORMAL] ESLintBear (brace-rules/brace-on-same-line):
|    | Statement inside of curly braces should be on next line.

binaries/data/mods/public/simulation/components/tests/test_ResourceGatherer.js
| 263| »   »   "TakeResources":·(amount)·=>·{·return·{
|    | [NORMAL] ESLintBear (brace-rules/brace-on-same-line):
|    | Statement inside of curly braces should be on next line.

binaries/data/mods/public/simulation/components/tests/test_ResourceGatherer.js
|  50| };
|    | [NORMAL] JSHintBear:
|    | Unnecessary semicolon.

binaries/data/mods/public/simulation/components/tests/test_ResourceGatherer.js
|  93| };
|    | [NORMAL] JSHintBear:
|    | Unnecessary semicolon.

binaries/data/mods/public/simulation/components/tests/test_ResourceGatherer.js
| 157| };
|    | [NORMAL] JSHintBear:
|    | Unnecessary semicolon.

binaries/data/mods/public/simulation/components/tests/test_ResourceGatherer.js
| 202| };
|    | [NORMAL] JSHintBear:
|    | Unnecessary semicolon.

binaries/data/mods/public/simulation/components/tests/test_ResourceGatherer.js
| 227| };
|    | [NORMAL] JSHintBear:
|    | Unnecessary semicolon.

binaries/data/mods/public/simulation/components/tests/test_ResourceGatherer.js
| 252| };
|    | [NORMAL] JSHintBear:
|    | Unnecessary semicolon.

binaries/data/mods/public/simulation/components/tests/test_ResourceGatherer.js
| 284| };
|    | [NORMAL] JSHintBear:
|    | Unnecessary semicolon.
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 788| 788| 					this.FinishOrder();
| 789| 789| 					return;
| 790| 790| 				}
| 791|    |-				else
| 792|    |-				{
|    | 791|+				
| 793| 792| 					this.SetNextState("GARRISON.APPROACHING");
| 794| 793| 					return;
| 795|    |-				}
|    | 794|+				
| 796| 795| 			}
| 797| 796| 
| 798| 797| 			this.SetNextState("GARRISON.GARRISONING");
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'GARRISON'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1060|1060| 			},
|1061|1061| 		},
|1062|1062| 
|1063|    |-		"GARRISON":{
|    |1063|+		"GARRISON": {
|1064|1064| 			"APPROACHING": {
|1065|1065| 				"enter": function() {
|1066|1066| 					if (!this.MoveToGarrisonRange(this.order.data.target))
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2038|2038| 
|2039|2039| 				"Attacked": function(msg) {
|2040|2040| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2041|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2042|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2041|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2042|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2043|2043| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2044|2044| 				},
|2045|2045| 			},
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2748|2748| 					{
|2749|2749| 						// The building was already finished/fully repaired before we arrived;
|2750|2750| 						// let the ConstructionFinished handler handle this.
|2751|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2751|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2752|2752| 						return true;
|2753|2753| 					}
|2754|2754| 
|    | [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
|2748|2748| 					{
|2749|2749| 						// The building was already finished/fully repaired before we arrived;
|2750|2750| 						// let the ConstructionFinished handler handle this.
|2751|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2751|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2752|2752| 						return true;
|2753|2753| 					}
|2754|2754| 
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3046|3046| 				this.StopTimer();
|3047|3047| 				this.ResetAnimation();
|3048|3048| 				if (this.formationAnimationVariant)
|3049|    |-					this.SetAnimationVariant(this.formationAnimationVariant)
|    |3049|+					this.SetAnimationVariant(this.formationAnimationVariant);
|3050|3050| 				else
|3051|3051| 					this.SetDefaultAnimationVariant();
|3052|3052| 				var cmpResistance = Engine.QueryInterface(this.entity, IID_Resistance);
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 7.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3272|3272| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3273|3273| 
|3274|3274| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3275|    |-							// only used for domestic animals
|    |3275|+		// only used for domestic animals
|3276|3276| 
|3277|3277| 		// Reuse the same garrison behaviour for animals.
|3278|3278| 		"GARRISON": "INDIVIDUAL.GARRISON",
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3334|3334| 
|3335|3335| UnitAI.prototype.IsAnimal = function()
|3336|3336| {
|3337|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3337|+	return (!!this.template.NaturalBehaviour);
|3338|3338| };
|3339|3339| 
|3340|3340| UnitAI.prototype.IsDangerousAnimal = function()
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3450|3450| 		{
|3451|3451| 			let index = this.GetCurrentState().indexOf(".");
|3452|3452| 			if (index != -1)
|3453|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3453|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3454|3454| 			this.Stop(false);
|3455|3455| 		}
|3456|3456| 
|    | [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
|3506|3506| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3507|3507| 			continue;
|3508|3508| 		if (i == 0)
|3509|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3509|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3510|3510| 		else
|3511|3511| 			this.orderQueue.splice(i, 1);
|3512|3512| 		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
|3506|3506| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3507|3507| 			continue;
|3508|3508| 		if (i == 0)
|3509|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3509|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3510|3510| 		else
|3511|3511| 			this.orderQueue.splice(i, 1);
|3512|3512| 		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
|3593|3593| };
|3594|3594| 
|3595|3595| 
|3596|    |-//// FSM linkage functions ////
|    |3596|+// // FSM linkage functions ////
|3597|3597| 
|3598|3598| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3599|3599| 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
|3764|3764| 				continue;
|3765|3765| 			if (this.orderQueue[i].type == type)
|3766|3766| 				continue;
|3767|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3767|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3768|3768| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3769|3769| 			return;
|3770|3770| 		}
|    | [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
|3764|3764| 				continue;
|3765|3765| 			if (this.orderQueue[i].type == type)
|3766|3766| 				continue;
|3767|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3767|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3768|3768| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3769|3769| 			return;
|3770|3770| 		}
|    | [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
|4006|4006| 	if (data.timerRepeat === undefined)
|4007|4007| 		this.timer = undefined;
|4008|4008| 
|4009|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4009|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4010|4010| };
|4011|4011| 
|4012|4012| /**
|    | [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
|4006|4006| 	if (data.timerRepeat === undefined)
|4007|4007| 		this.timer = undefined;
|4008|4008| 
|4009|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4009|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4010|4010| };
|4011|4011| 
|4012|4012| /**
|    | [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
|4051|4051| 	// TODO: This is a bit inefficient since every unit listens to every
|4052|4052| 	// construction message - ideally we could scope it to only the one we're building
|4053|4053| 
|4054|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4054|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4055|4055| };
|4056|4056| 
|4057|4057| 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
|4051|4051| 	// TODO: This is a bit inefficient since every unit listens to every
|4052|4052| 	// construction message - ideally we could scope it to only the one we're building
|4053|4053| 
|4054|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4054|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4055|4055| };
|4056|4056| 
|4057|4057| 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
|4082|4082| 	if (msg.fromStatusEffect)
|4083|4083| 		return;
|4084|4084| 
|4085|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4085|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4086|4086| };
|4087|4087| 
|4088|4088| 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
|4082|4082| 	if (msg.fromStatusEffect)
|4083|4083| 		return;
|4084|4084| 
|4085|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4085|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4086|4086| };
|4087|4087| 
|4088|4088| 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
|4087|4087| 
|4088|4088| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4089|4089| {
|4090|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4090|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4091|4091| };
|4092|4092| 
|4093|4093| 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
|4087|4087| 
|4088|4088| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4089|4089| {
|4090|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4090|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4091|4091| };
|4092|4092| 
|4093|4093| 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
|4092|4092| 
|4093|4093| UnitAI.prototype.OnHealthChanged = function(msg)
|4094|4094| {
|4095|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4095|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4096|4096| };
|4097|4097| 
|4098|4098| 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
|4092|4092| 
|4093|4093| UnitAI.prototype.OnHealthChanged = function(msg)
|4094|4094| {
|4095|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4095|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4096|4096| };
|4097|4097| 
|4098|4098| 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
|4098|4098| UnitAI.prototype.OnRangeUpdate = function(msg)
|4099|4099| {
|4100|4100| 	if (msg.tag == this.losRangeQuery)
|4101|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4101|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4102|4102| 	else if (msg.tag == this.losHealRangeQuery)
|4103|4103| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4104|4104| };
|    | [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
|4098|4098| UnitAI.prototype.OnRangeUpdate = function(msg)
|4099|4099| {
|4100|4100| 	if (msg.tag == this.losRangeQuery)
|4101|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4101|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4102|4102| 	else if (msg.tag == this.losHealRangeQuery)
|4103|4103| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4104|4104| };
|    | [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
|4100|4100| 	if (msg.tag == this.losRangeQuery)
|4101|4101| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4102|4102| 	else if (msg.tag == this.losHealRangeQuery)
|4103|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4103|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4104|4104| };
|4105|4105| 
|4106|4106| 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
|4100|4100| 	if (msg.tag == this.losRangeQuery)
|4101|4101| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4102|4102| 	else if (msg.tag == this.losHealRangeQuery)
|4103|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4103|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4104|4104| };
|4105|4105| 
|4106|4106| 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
|4105|4105| 
|4106|4106| UnitAI.prototype.OnPackFinished = function(msg)
|4107|4107| {
|4108|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4108|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4109|4109| };
|4110|4110| 
|4111|4111| UnitAI.prototype.OnGatheringStateChanged = 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
|4105|4105| 
|4106|4106| UnitAI.prototype.OnPackFinished = function(msg)
|4107|4107| {
|4108|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4108|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4109|4109| };
|4110|4110| 
|4111|4111| UnitAI.prototype.OnGatheringStateChanged = function(msg)
|    | [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
|4113|4113| 	this.UnitFsm.ProcessMessage(this, { "type": "GatheringStateChanged", "data": msg });
|4114|4114| };
|4115|4115| 
|4116|    |-//// Helper functions to be called by the FSM ////
|    |4116|+// // Helper functions to be called by the FSM ////
|4117|4117| 
|4118|4118| UnitAI.prototype.GetWalkSpeed = function()
|4119|4119| {
|    | [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
|4780|4780| UnitAI.prototype.AttackEntityInZone = function(ents)
|4781|4781| {
|4782|4782| 	var target = ents.find(target =>
|4783|    |-		this.CanAttack(target)
|4784|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4783|+		this.CanAttack(target) &&
|    |4784|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4785|4785| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4786|4786| 	);
|4787|4787| 	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
|4781|4781| {
|4782|4782| 	var target = ents.find(target =>
|4783|4783| 		this.CanAttack(target)
|4784|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4785|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4784|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4785|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4786|4786| 	);
|4787|4787| 	if (!target)
|4788|4788| 		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
|4845|4845| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4846|4846| 	if (this.isGuardOf)
|4847|4847| 	{
|4848|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4848|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4849|4849| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4850|4850| 		if (cmpUnitAI && cmpAttack &&
|4851|4851| 		    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
|4849|4849| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4850|4850| 		if (cmpUnitAI && cmpAttack &&
|4851|4851| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4852|    |-				return false;
|    |4852|+			return false;
|4853|4853| 	}
|4854|4854| 
|4855|4855| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before 'Engine'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4887|4887| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4888|4888| 	if (this.isGuardOf)
|4889|4889| 	{
|4890|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4890|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4891|4891| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4892|4892| 		if (cmpUnitAI && cmpAttack &&
|4893|4893| 		    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
|4900|4900| 	return false;
|4901|4901| };
|4902|4902| 
|4903|    |-//// External interface functions ////
|    |4903|+// // External interface functions ////
|4904|4904| 
|4905|4905| UnitAI.prototype.SetFormationController = function(ent)
|4906|4906| {
|    | [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
|5056|5056| 	{
|5057|5057| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5058|5058| 			return;
|5059|    |-		else
|5060|    |-			this.RemoveGuard();
|    |5059|+		this.RemoveGuard();
|5061|5060| 	}
|5062|5061| 
|5063|5062| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5387|5387| 
|5388|5388| 	if (this.IsFormationController())
|5389|5389| 		this.CallMemberFunction("CancelSetupTradeRoute", [target]);
|5390|    |-}
|    |5390|+};
|5391|5391| /**
|5392|5392|  * Adds trade order to the queue. Either walk to the first market, or
|5393|5393|  * start a new route. Not forced, so it can be interrupted by attacks.
|    | [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
|5408|5408| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5409|5409| 	{
|5410|5410| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5411|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5411|+		if (cmpTrader.HasBothMarkets() &&
|5412|5412| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5413|5413| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5414|5414| 		{
|    | [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
|5689|5689| 				{
|5690|5690| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5691|5691| 					var targetClasses = this.order.data.targetClasses;
|5692|    |-					if (targetClasses.attack && cmpIdentity
|5693|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5692|+					if (targetClasses.attack && cmpIdentity &&
|    |5693|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5694|5694| 						continue;
|5695|5695| 					if (targetClasses.avoid && cmpIdentity
|5696|5696| 						&& 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
|5692|5692| 					if (targetClasses.attack && cmpIdentity
|5693|5693| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5694|5694| 						continue;
|5695|    |-					if (targetClasses.avoid && cmpIdentity
|5696|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5695|+					if (targetClasses.avoid && cmpIdentity &&
|    |5696|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5697|5697| 						continue;
|5698|5698| 					// Only used by the AIs to prevent some choices of targets
|5699|5699| 					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
|5715|5715| 		{
|5716|5716| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5717|5717| 			var targetClasses = this.order.data.targetClasses;
|5718|    |-			if (cmpIdentity && targetClasses.attack
|5719|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5718|+			if (cmpIdentity && targetClasses.attack &&
|    |5719|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5720|5720| 				continue;
|5721|5721| 			if (cmpIdentity && targetClasses.avoid
|5722|5722| 				&& 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
|5718|5718| 			if (cmpIdentity && targetClasses.attack
|5719|5719| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5720|5720| 				continue;
|5721|    |-			if (cmpIdentity && targetClasses.avoid
|5722|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5721|+			if (cmpIdentity && targetClasses.avoid &&
|    |5722|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5723|5723| 				continue;
|5724|5724| 			// Only used by the AIs to prevent some choices of targets
|5725|5725| 			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
|5861|5861| 
|5862|5862| UnitAI.prototype.SetHeldPosition = function(x, z)
|5863|5863| {
|5864|    |-	this.heldPosition = {"x": x, "z": z};
|    |5864|+	this.heldPosition = { "x": x, "z": z};
|5865|5865| };
|5866|5866| 
|5867|5867| 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
|5861|5861| 
|5862|5862| UnitAI.prototype.SetHeldPosition = function(x, z)
|5863|5863| {
|5864|    |-	this.heldPosition = {"x": x, "z": z};
|    |5864|+	this.heldPosition = {"x": x, "z": z };
|5865|5865| };
|5866|5866| 
|5867|5867| 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
|5888|5888| 	return false;
|5889|5889| };
|5890|5890| 
|5891|    |-//// Helper functions ////
|    |5891|+// // Helper functions ////
|5892|5892| 
|5893|5893| /**
|5894|5894|  * General getter for ranges.
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5907|5907| 		return undefined;
|5908|5908| 
|5909|5909| 	return component.GetRange(type);
|5910|    |-}
|    |5910|+};
|5911|5911| 
|5912|5912| UnitAI.prototype.CanAttack = function(target)
|5913|5913| {
|    | [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
|6105|6105| 	return cmpPack && cmpPack.IsPacking();
|6106|6106| };
|6107|6107| 
|6108|    |-//// Formation specific functions ////
|    |6108|+// // Formation specific functions ////
|6109|6109| 
|6110|6110| UnitAI.prototype.IsAttackingAsFormation = function()
|6111|6111| {
|    | [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
|6110|6110| UnitAI.prototype.IsAttackingAsFormation = function()
|6111|6111| {
|6112|6112| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6113|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6114|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6113|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6114|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6115|6115| };
|6116|6116| 
|6117|6117| //// 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
|6114|6114| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6115|6115| };
|6116|6116| 
|6117|    |-//// Animal specific functions ////
|    |6117|+// // Animal specific functions ////
|6118|6118| 
|6119|6119| UnitAI.prototype.MoveRandomly = function(distance)
|6120|6120| {

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Freagarach edited the summary of this revision. (Show Details)Tue, Mar 24, 8:23 PM
  • Linter issues.
  • Handle message in default.
  • Store target as INVALID_ENTITY when unused.

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 792| 792| 					this.FinishOrder();
| 793| 793| 					return;
| 794| 794| 				}
| 795|    |-				else
| 796|    |-				{
|    | 795|+				
| 797| 796| 					this.SetNextState("GARRISON.APPROACHING");
| 798| 797| 					return;
| 799|    |-				}
|    | 798|+				
| 800| 799| 			}
| 801| 800| 
| 802| 801| 			this.SetNextState("GARRISON.GARRISONING");
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'GARRISON'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1064|1064| 			},
|1065|1065| 		},
|1066|1066| 
|1067|    |-		"GARRISON":{
|    |1067|+		"GARRISON": {
|1068|1068| 			"APPROACHING": {
|1069|1069| 				"enter": function() {
|1070|1070| 					if (!this.MoveToGarrisonRange(this.order.data.target))
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2042|2042| 
|2043|2043| 				"Attacked": function(msg) {
|2044|2044| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2045|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2046|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2045|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2046|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2047|2047| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2048|2048| 				},
|2049|2049| 			},
|    | [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
|2738|2738| 					{
|2739|2739| 						// The building was already finished/fully repaired before we arrived;
|2740|2740| 						// let the ConstructionFinished handler handle this.
|2741|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2741|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2742|2742| 						return true;
|2743|2743| 					}
|2744|2744| 
|    | [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
|2738|2738| 					{
|2739|2739| 						// The building was already finished/fully repaired before we arrived;
|2740|2740| 						// let the ConstructionFinished handler handle this.
|2741|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2741|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2742|2742| 						return true;
|2743|2743| 					}
|2744|2744| 
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3036|3036| 				this.StopTimer();
|3037|3037| 				this.ResetAnimation();
|3038|3038| 				if (this.formationAnimationVariant)
|3039|    |-					this.SetAnimationVariant(this.formationAnimationVariant)
|    |3039|+					this.SetAnimationVariant(this.formationAnimationVariant);
|3040|3040| 				else
|3041|3041| 					this.SetDefaultAnimationVariant();
|3042|3042| 				var cmpResistance = Engine.QueryInterface(this.entity, IID_Resistance);
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 7.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3262|3262| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3263|3263| 
|3264|3264| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3265|    |-							// only used for domestic animals
|    |3265|+		// only used for domestic animals
|3266|3266| 
|3267|3267| 		// Reuse the same garrison behaviour for animals.
|3268|3268| 		"GARRISON": "INDIVIDUAL.GARRISON",
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3324|3324| 
|3325|3325| UnitAI.prototype.IsAnimal = function()
|3326|3326| {
|3327|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3327|+	return (!!this.template.NaturalBehaviour);
|3328|3328| };
|3329|3329| 
|3330|3330| UnitAI.prototype.IsDangerousAnimal = function()
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3440|3440| 		{
|3441|3441| 			let index = this.GetCurrentState().indexOf(".");
|3442|3442| 			if (index != -1)
|3443|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3443|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3444|3444| 			this.Stop(false);
|3445|3445| 		}
|3446|3446| 
|    | [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
|3496|3496| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3497|3497| 			continue;
|3498|3498| 		if (i == 0)
|3499|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3499|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3500|3500| 		else
|3501|3501| 			this.orderQueue.splice(i, 1);
|3502|3502| 		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
|3496|3496| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3497|3497| 			continue;
|3498|3498| 		if (i == 0)
|3499|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3499|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3500|3500| 		else
|3501|3501| 			this.orderQueue.splice(i, 1);
|3502|3502| 		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
|3583|3583| };
|3584|3584| 
|3585|3585| 
|3586|    |-//// FSM linkage functions ////
|    |3586|+// // FSM linkage functions ////
|3587|3587| 
|3588|3588| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3589|3589| 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
|3754|3754| 				continue;
|3755|3755| 			if (this.orderQueue[i].type == type)
|3756|3756| 				continue;
|3757|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3757|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3758|3758| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3759|3759| 			return;
|3760|3760| 		}
|    | [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
|3754|3754| 				continue;
|3755|3755| 			if (this.orderQueue[i].type == type)
|3756|3756| 				continue;
|3757|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3757|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3758|3758| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3759|3759| 			return;
|3760|3760| 		}
|    | [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
|3996|3996| 	if (data.timerRepeat === undefined)
|3997|3997| 		this.timer = undefined;
|3998|3998| 
|3999|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3999|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4000|4000| };
|4001|4001| 
|4002|4002| /**
|    | [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
|3996|3996| 	if (data.timerRepeat === undefined)
|3997|3997| 		this.timer = undefined;
|3998|3998| 
|3999|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3999|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4000|4000| };
|4001|4001| 
|4002|4002| /**
|    | [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
|4041|4041| 	// TODO: This is a bit inefficient since every unit listens to every
|4042|4042| 	// construction message - ideally we could scope it to only the one we're building
|4043|4043| 
|4044|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4044|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4045|4045| };
|4046|4046| 
|4047|4047| 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
|4041|4041| 	// TODO: This is a bit inefficient since every unit listens to every
|4042|4042| 	// construction message - ideally we could scope it to only the one we're building
|4043|4043| 
|4044|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4044|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4045|4045| };
|4046|4046| 
|4047|4047| 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
|4072|4072| 	if (msg.fromStatusEffect)
|4073|4073| 		return;
|4074|4074| 
|4075|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4075|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4076|4076| };
|4077|4077| 
|4078|4078| 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
|4072|4072| 	if (msg.fromStatusEffect)
|4073|4073| 		return;
|4074|4074| 
|4075|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4075|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4076|4076| };
|4077|4077| 
|4078|4078| 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
|4077|4077| 
|4078|4078| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4079|4079| {
|4080|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4080|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4081|4081| };
|4082|4082| 
|4083|4083| 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
|4077|4077| 
|4078|4078| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4079|4079| {
|4080|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4080|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4081|4081| };
|4082|4082| 
|4083|4083| 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
|4082|4082| 
|4083|4083| UnitAI.prototype.OnHealthChanged = function(msg)
|4084|4084| {
|4085|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4085|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4086|4086| };
|4087|4087| 
|4088|4088| 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
|4082|4082| 
|4083|4083| UnitAI.prototype.OnHealthChanged = function(msg)
|4084|4084| {
|4085|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4085|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4086|4086| };
|4087|4087| 
|4088|4088| 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
|4088|4088| UnitAI.prototype.OnRangeUpdate = function(msg)
|4089|4089| {
|4090|4090| 	if (msg.tag == this.losRangeQuery)
|4091|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4091|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4092|4092| 	else if (msg.tag == this.losHealRangeQuery)
|4093|4093| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4094|4094| };
|    | [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
|4088|4088| UnitAI.prototype.OnRangeUpdate = function(msg)
|4089|4089| {
|4090|4090| 	if (msg.tag == this.losRangeQuery)
|4091|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4091|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4092|4092| 	else if (msg.tag == this.losHealRangeQuery)
|4093|4093| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4094|4094| };
|    | [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
|4090|4090| 	if (msg.tag == this.losRangeQuery)
|4091|4091| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4092|4092| 	else if (msg.tag == this.losHealRangeQuery)
|4093|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4093|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4094|4094| };
|4095|4095| 
|4096|4096| 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
|4090|4090| 	if (msg.tag == this.losRangeQuery)
|4091|4091| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4092|4092| 	else if (msg.tag == this.losHealRangeQuery)
|4093|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4093|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4094|4094| };
|4095|4095| 
|4096|4096| 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
|4095|4095| 
|4096|4096| UnitAI.prototype.OnPackFinished = function(msg)
|4097|4097| {
|4098|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4098|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4099|4099| };
|4100|4100| 
|4101|4101| UnitAI.prototype.OnGatheringStateChanged = 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
|4095|4095| 
|4096|4096| UnitAI.prototype.OnPackFinished = function(msg)
|4097|4097| {
|4098|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4098|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4099|4099| };
|4100|4100| 
|4101|4101| UnitAI.prototype.OnGatheringStateChanged = function(msg)
|    | [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
|4103|4103| 	this.UnitFsm.ProcessMessage(this, { "type": "GatheringStateChanged", "data": msg });
|4104|4104| };
|4105|4105| 
|4106|    |-//// Helper functions to be called by the FSM ////
|    |4106|+// // Helper functions to be called by the FSM ////
|4107|4107| 
|4108|4108| UnitAI.prototype.GetWalkSpeed = function()
|4109|4109| {
|    | [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
|4770|4770| UnitAI.prototype.AttackEntityInZone = function(ents)
|4771|4771| {
|4772|4772| 	var target = ents.find(target =>
|4773|    |-		this.CanAttack(target)
|4774|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4773|+		this.CanAttack(target) &&
|    |4774|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4775|4775| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4776|4776| 	);
|4777|4777| 	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
|4771|4771| {
|4772|4772| 	var target = ents.find(target =>
|4773|4773| 		this.CanAttack(target)
|4774|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4775|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4774|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4775|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4776|4776| 	);
|4777|4777| 	if (!target)
|4778|4778| 		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
|4835|4835| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4836|4836| 	if (this.isGuardOf)
|4837|4837| 	{
|4838|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4838|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4839|4839| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4840|4840| 		if (cmpUnitAI && cmpAttack &&
|4841|4841| 		    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
|4839|4839| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4840|4840| 		if (cmpUnitAI && cmpAttack &&
|4841|4841| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4842|    |-				return false;
|    |4842|+			return false;
|4843|4843| 	}
|4844|4844| 
|4845|4845| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before 'Engine'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4877|4877| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4878|4878| 	if (this.isGuardOf)
|4879|4879| 	{
|4880|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4880|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4881|4881| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4882|4882| 		if (cmpUnitAI && cmpAttack &&
|4883|4883| 		    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
|4890|4890| 	return false;
|4891|4891| };
|4892|4892| 
|4893|    |-//// External interface functions ////
|    |4893|+// // External interface functions ////
|4894|4894| 
|4895|4895| UnitAI.prototype.SetFormationController = function(ent)
|4896|4896| {
|    | [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
|5046|5046| 	{
|5047|5047| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5048|5048| 			return;
|5049|    |-		else
|5050|    |-			this.RemoveGuard();
|    |5049|+		this.RemoveGuard();
|5051|5050| 	}
|5052|5051| 
|5053|5052| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5377|5377| 
|5378|5378| 	if (this.IsFormationController())
|5379|5379| 		this.CallMemberFunction("CancelSetupTradeRoute", [target]);
|5380|    |-}
|    |5380|+};
|5381|5381| /**
|5382|5382|  * Adds trade order to the queue. Either walk to the first market, or
|5383|5383|  * start a new route. Not forced, so it can be interrupted by attacks.
|    | [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
|5398|5398| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5399|5399| 	{
|5400|5400| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5401|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5401|+		if (cmpTrader.HasBothMarkets() &&
|5402|5402| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5403|5403| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5404|5404| 		{
|    | [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
|5679|5679| 				{
|5680|5680| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5681|5681| 					var targetClasses = this.order.data.targetClasses;
|5682|    |-					if (targetClasses.attack && cmpIdentity
|5683|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5682|+					if (targetClasses.attack && cmpIdentity &&
|    |5683|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5684|5684| 						continue;
|5685|5685| 					if (targetClasses.avoid && cmpIdentity
|5686|5686| 						&& 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
|5682|5682| 					if (targetClasses.attack && cmpIdentity
|5683|5683| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5684|5684| 						continue;
|5685|    |-					if (targetClasses.avoid && cmpIdentity
|5686|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5685|+					if (targetClasses.avoid && cmpIdentity &&
|    |5686|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5687|5687| 						continue;
|5688|5688| 					// Only used by the AIs to prevent some choices of targets
|5689|5689| 					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
|5705|5705| 		{
|5706|5706| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5707|5707| 			var targetClasses = this.order.data.targetClasses;
|5708|    |-			if (cmpIdentity && targetClasses.attack
|5709|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5708|+			if (cmpIdentity && targetClasses.attack &&
|    |5709|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5710|5710| 				continue;
|5711|5711| 			if (cmpIdentity && targetClasses.avoid
|5712|5712| 				&& 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
|5708|5708| 			if (cmpIdentity && targetClasses.attack
|5709|5709| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5710|5710| 				continue;
|5711|    |-			if (cmpIdentity && targetClasses.avoid
|5712|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5711|+			if (cmpIdentity && targetClasses.avoid &&
|    |5712|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5713|5713| 				continue;
|5714|5714| 			// Only used by the AIs to prevent some choices of targets
|5715|5715| 			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
|5851|5851| 
|5852|5852| UnitAI.prototype.SetHeldPosition = function(x, z)
|5853|5853| {
|5854|    |-	this.heldPosition = {"x": x, "z": z};
|    |5854|+	this.heldPosition = { "x": x, "z": z};
|5855|5855| };
|5856|5856| 
|5857|5857| 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
|5851|5851| 
|5852|5852| UnitAI.prototype.SetHeldPosition = function(x, z)
|5853|5853| {
|5854|    |-	this.heldPosition = {"x": x, "z": z};
|    |5854|+	this.heldPosition = {"x": x, "z": z };
|5855|5855| };
|5856|5856| 
|5857|5857| 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
|5878|5878| 	return false;
|5879|5879| };
|5880|5880| 
|5881|    |-//// Helper functions ////
|    |5881|+// // Helper functions ////
|5882|5882| 
|5883|5883| /**
|5884|5884|  * General getter for ranges.
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5897|5897| 		return undefined;
|5898|5898| 
|5899|5899| 	return component.GetRange(type);
|5900|    |-}
|    |5900|+};
|5901|5901| 
|5902|5902| UnitAI.prototype.CanAttack = function(target)
|5903|5903| {
|    | [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
|6095|6095| 	return cmpPack && cmpPack.IsPacking();
|6096|6096| };
|6097|6097| 
|6098|    |-//// Formation specific functions ////
|    |6098|+// // Formation specific functions ////
|6099|6099| 
|6100|6100| UnitAI.prototype.IsAttackingAsFormation = function()
|6101|6101| {
|    | [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
|6100|6100| UnitAI.prototype.IsAttackingAsFormation = function()
|6101|6101| {
|6102|6102| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6103|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6104|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6103|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6104|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6105|6105| };
|6106|6106| 
|6107|6107| //// 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
|6104|6104| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6105|6105| };
|6106|6106| 
|6107|    |-//// Animal specific functions ////
|    |6107|+// // Animal specific functions ////
|6108|6108| 
|6109|6109| UnitAI.prototype.MoveRandomly = function(distance)
|6110|6110| {

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|3901| »   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
|4757| »   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
|4772| »   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
|4818| »   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
|4841| »   »   ····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
|2046| »   »   »   »   »   »   &&·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
|3039| »   »   »   »   »   this.SetAnimationVariant(this.formationAnimationVariant)
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

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

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

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

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

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

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

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

Freagarach updated this revision to Diff 11577.Fri, Mar 27, 9:32 AM

Send the stopped message only after invalidating the target.

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 792| 792| 					this.FinishOrder();
| 793| 793| 					return;
| 794| 794| 				}
| 795|    |-				else
| 796|    |-				{
|    | 795|+				
| 797| 796| 					this.SetNextState("GARRISON.APPROACHING");
| 798| 797| 					return;
| 799|    |-				}
|    | 798|+				
| 800| 799| 			}
| 801| 800| 
| 802| 801| 			this.SetNextState("GARRISON.GARRISONING");
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'GARRISON'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1064|1064| 			},
|1065|1065| 		},
|1066|1066| 
|1067|    |-		"GARRISON":{
|    |1067|+		"GARRISON": {
|1068|1068| 			"APPROACHING": {
|1069|1069| 				"enter": function() {
|1070|1070| 					if (!this.MoveToGarrisonRange(this.order.data.target))
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2042|2042| 
|2043|2043| 				"Attacked": function(msg) {
|2044|2044| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2045|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2046|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2045|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2046|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2047|2047| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2048|2048| 				},
|2049|2049| 			},
|    | [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
|2738|2738| 					{
|2739|2739| 						// The building was already finished/fully repaired before we arrived;
|2740|2740| 						// let the ConstructionFinished handler handle this.
|2741|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2741|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2742|2742| 						return true;
|2743|2743| 					}
|2744|2744| 
|    | [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
|2738|2738| 					{
|2739|2739| 						// The building was already finished/fully repaired before we arrived;
|2740|2740| 						// let the ConstructionFinished handler handle this.
|2741|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2741|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2742|2742| 						return true;
|2743|2743| 					}
|2744|2744| 
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3036|3036| 				this.StopTimer();
|3037|3037| 				this.ResetAnimation();
|3038|3038| 				if (this.formationAnimationVariant)
|3039|    |-					this.SetAnimationVariant(this.formationAnimationVariant)
|    |3039|+					this.SetAnimationVariant(this.formationAnimationVariant);
|3040|3040| 				else
|3041|3041| 					this.SetDefaultAnimationVariant();
|3042|3042| 				var cmpResistance = Engine.QueryInterface(this.entity, IID_Resistance);
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 7.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3262|3262| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3263|3263| 
|3264|3264| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3265|    |-							// only used for domestic animals
|    |3265|+		// only used for domestic animals
|3266|3266| 
|3267|3267| 		// Reuse the same garrison behaviour for animals.
|3268|3268| 		"GARRISON": "INDIVIDUAL.GARRISON",
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3324|3324| 
|3325|3325| UnitAI.prototype.IsAnimal = function()
|3326|3326| {
|3327|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3327|+	return (!!this.template.NaturalBehaviour);
|3328|3328| };
|3329|3329| 
|3330|3330| UnitAI.prototype.IsDangerousAnimal = function()
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3440|3440| 		{
|3441|3441| 			let index = this.GetCurrentState().indexOf(".");
|3442|3442| 			if (index != -1)
|3443|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3443|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3444|3444| 			this.Stop(false);
|3445|3445| 		}
|3446|3446| 
|    | [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
|3496|3496| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3497|3497| 			continue;
|3498|3498| 		if (i == 0)
|3499|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3499|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3500|3500| 		else
|3501|3501| 			this.orderQueue.splice(i, 1);
|3502|3502| 		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
|3496|3496| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3497|3497| 			continue;
|3498|3498| 		if (i == 0)
|3499|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3499|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3500|3500| 		else
|3501|3501| 			this.orderQueue.splice(i, 1);
|3502|3502| 		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
|3583|3583| };
|3584|3584| 
|3585|3585| 
|3586|    |-//// FSM linkage functions ////
|    |3586|+// // FSM linkage functions ////
|3587|3587| 
|3588|3588| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3589|3589| 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
|3754|3754| 				continue;
|3755|3755| 			if (this.orderQueue[i].type == type)
|3756|3756| 				continue;
|3757|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3757|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3758|3758| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3759|3759| 			return;
|3760|3760| 		}
|    | [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
|3754|3754| 				continue;
|3755|3755| 			if (this.orderQueue[i].type == type)
|3756|3756| 				continue;
|3757|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3757|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3758|3758| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3759|3759| 			return;
|3760|3760| 		}
|    | [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
|3996|3996| 	if (data.timerRepeat === undefined)
|3997|3997| 		this.timer = undefined;
|3998|3998| 
|3999|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3999|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4000|4000| };
|4001|4001| 
|4002|4002| /**
|    | [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
|3996|3996| 	if (data.timerRepeat === undefined)
|3997|3997| 		this.timer = undefined;
|3998|3998| 
|3999|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3999|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4000|4000| };
|4001|4001| 
|4002|4002| /**
|    | [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
|4041|4041| 	// TODO: This is a bit inefficient since every unit listens to every
|4042|4042| 	// construction message - ideally we could scope it to only the one we're building
|4043|4043| 
|4044|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4044|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4045|4045| };
|4046|4046| 
|4047|4047| 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
|4041|4041| 	// TODO: This is a bit inefficient since every unit listens to every
|4042|4042| 	// construction message - ideally we could scope it to only the one we're building
|4043|4043| 
|4044|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4044|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4045|4045| };
|4046|4046| 
|4047|4047| 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
|4072|4072| 	if (msg.fromStatusEffect)
|4073|4073| 		return;
|4074|4074| 
|4075|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4075|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4076|4076| };
|4077|4077| 
|4078|4078| 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
|4072|4072| 	if (msg.fromStatusEffect)
|4073|4073| 		return;
|4074|4074| 
|4075|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4075|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4076|4076| };
|4077|4077| 
|4078|4078| 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
|4077|4077| 
|4078|4078| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4079|4079| {
|4080|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4080|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4081|4081| };
|4082|4082| 
|4083|4083| 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
|4077|4077| 
|4078|4078| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4079|4079| {
|4080|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4080|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4081|4081| };
|4082|4082| 
|4083|4083| 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
|4082|4082| 
|4083|4083| UnitAI.prototype.OnHealthChanged = function(msg)
|4084|4084| {
|4085|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4085|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4086|4086| };
|4087|4087| 
|4088|4088| 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
|4082|4082| 
|4083|4083| UnitAI.prototype.OnHealthChanged = function(msg)
|4084|4084| {
|4085|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4085|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4086|4086| };
|4087|4087| 
|4088|4088| 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
|4088|4088| UnitAI.prototype.OnRangeUpdate = function(msg)
|4089|4089| {
|4090|4090| 	if (msg.tag == this.losRangeQuery)
|4091|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4091|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4092|4092| 	else if (msg.tag == this.losHealRangeQuery)
|4093|4093| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4094|4094| };
|    | [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
|4088|4088| UnitAI.prototype.OnRangeUpdate = function(msg)
|4089|4089| {
|4090|4090| 	if (msg.tag == this.losRangeQuery)
|4091|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4091|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4092|4092| 	else if (msg.tag == this.losHealRangeQuery)
|4093|4093| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4094|4094| };
|    | [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
|4090|4090| 	if (msg.tag == this.losRangeQuery)
|4091|4091| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4092|4092| 	else if (msg.tag == this.losHealRangeQuery)
|4093|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4093|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4094|4094| };
|4095|4095| 
|4096|4096| 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
|4090|4090| 	if (msg.tag == this.losRangeQuery)
|4091|4091| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4092|4092| 	else if (msg.tag == this.losHealRangeQuery)
|4093|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4093|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4094|4094| };
|4095|4095| 
|4096|4096| 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
|4095|4095| 
|4096|4096| UnitAI.prototype.OnPackFinished = function(msg)
|4097|4097| {
|4098|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4098|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4099|4099| };
|4100|4100| 
|4101|4101| UnitAI.prototype.OnGatheringStateChanged = 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
|4095|4095| 
|4096|4096| UnitAI.prototype.OnPackFinished = function(msg)
|4097|4097| {
|4098|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4098|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4099|4099| };
|4100|4100| 
|4101|4101| UnitAI.prototype.OnGatheringStateChanged = function(msg)
|    | [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
|4103|4103| 	this.UnitFsm.ProcessMessage(this, { "type": "GatheringStateChanged", "data": msg });
|4104|4104| };
|4105|4105| 
|4106|    |-//// Helper functions to be called by the FSM ////
|    |4106|+// // Helper functions to be called by the FSM ////
|4107|4107| 
|4108|4108| UnitAI.prototype.GetWalkSpeed = function()
|4109|4109| {
|    | [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
|4770|4770| UnitAI.prototype.AttackEntityInZone = function(ents)
|4771|4771| {
|4772|4772| 	var target = ents.find(target =>
|4773|    |-		this.CanAttack(target)
|4774|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4773|+		this.CanAttack(target) &&
|    |4774|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4775|4775| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4776|4776| 	);
|4777|4777| 	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
|4771|4771| {
|4772|4772| 	var target = ents.find(target =>
|4773|4773| 		this.CanAttack(target)
|4774|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4775|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4774|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4775|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4776|4776| 	);
|4777|4777| 	if (!target)
|4778|4778| 		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
|4835|4835| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4836|4836| 	if (this.isGuardOf)
|4837|4837| 	{
|4838|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4838|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4839|4839| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4840|4840| 		if (cmpUnitAI && cmpAttack &&
|4841|4841| 		    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
|4839|4839| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4840|4840| 		if (cmpUnitAI && cmpAttack &&
|4841|4841| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4842|    |-				return false;
|    |4842|+			return false;
|4843|4843| 	}
|4844|4844| 
|4845|4845| 	// Stop if we're in hold-ground mode and it's too far from the holding point
|    | [NORMAL] ESLintBear (no-multi-spaces):
|    | Multiple spaces found before 'Engine'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4877|4877| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4878|4878| 	if (this.isGuardOf)
|4879|4879| 	{
|4880|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4880|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4881|4881| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4882|4882| 		if (cmpUnitAI && cmpAttack &&
|4883|4883| 		    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
|4890|4890| 	return false;
|4891|4891| };
|4892|4892| 
|4893|    |-//// External interface functions ////
|    |4893|+// // External interface functions ////
|4894|4894| 
|4895|4895| UnitAI.prototype.SetFormationController = function(ent)
|4896|4896| {
|    | [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
|5046|5046| 	{
|5047|5047| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5048|5048| 			return;
|5049|    |-		else
|5050|    |-			this.RemoveGuard();
|    |5049|+		this.RemoveGuard();
|5051|5050| 	}
|5052|5051| 
|5053|5052| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5377|5377| 
|5378|5378| 	if (this.IsFormationController())
|5379|5379| 		this.CallMemberFunction("CancelSetupTradeRoute", [target]);
|5380|    |-}
|    |5380|+};
|5381|5381| /**
|5382|5382|  * Adds trade order to the queue. Either walk to the first market, or
|5383|5383|  * start a new route. Not forced, so it can be interrupted by attacks.
|    | [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
|5398|5398| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5399|5399| 	{
|5400|5400| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5401|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5401|+		if (cmpTrader.HasBothMarkets() &&
|5402|5402| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5403|5403| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5404|5404| 		{
|    | [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
|5679|5679| 				{
|5680|5680| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5681|5681| 					var targetClasses = this.order.data.targetClasses;
|5682|    |-					if (targetClasses.attack && cmpIdentity
|5683|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5682|+					if (targetClasses.attack && cmpIdentity &&
|    |5683|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5684|5684| 						continue;
|5685|5685| 					if (targetClasses.avoid && cmpIdentity
|5686|5686| 						&& 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
|5682|5682| 					if (targetClasses.attack && cmpIdentity
|5683|5683| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5684|5684| 						continue;
|5685|    |-					if (targetClasses.avoid && cmpIdentity
|5686|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5685|+					if (targetClasses.avoid && cmpIdentity &&
|    |5686|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5687|5687| 						continue;
|5688|5688| 					// Only used by the AIs to prevent some choices of targets
|5689|5689| 					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
|5705|5705| 		{
|5706|5706| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5707|5707| 			var targetClasses = this.order.data.targetClasses;
|5708|    |-			if (cmpIdentity && targetClasses.attack
|5709|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5708|+			if (cmpIdentity && targetClasses.attack &&
|    |5709|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5710|5710| 				continue;
|5711|5711| 			if (cmpIdentity && targetClasses.avoid
|5712|5712| 				&& 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
|5708|5708| 			if (cmpIdentity && targetClasses.attack
|5709|5709| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5710|5710| 				continue;
|5711|    |-			if (cmpIdentity && targetClasses.avoid
|5712|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5711|+			if (cmpIdentity && targetClasses.avoid &&
|    |5712|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5713|5713| 				continue;
|5714|5714| 			// Only used by the AIs to prevent some choices of targets
|5715|5715| 			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
|5851|5851| 
|5852|5852| UnitAI.prototype.SetHeldPosition = function(x, z)
|5853|5853| {
|5854|    |-	this.heldPosition = {"x": x, "z": z};
|    |5854|+	this.heldPosition = { "x": x, "z": z};
|5855|5855| };
|5856|5856| 
|5857|5857| 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
|5851|5851| 
|5852|5852| UnitAI.prototype.SetHeldPosition = function(x, z)
|5853|5853| {
|5854|    |-	this.heldPosition = {"x": x, "z": z};
|    |5854|+	this.heldPosition = {"x": x, "z": z };
|5855|5855| };
|5856|5856| 
|5857|5857| 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
|5878|5878| 	return false;
|5879|5879| };
|5880|5880| 
|5881|    |-//// Helper functions ////
|    |5881|+// // Helper functions ////
|5882|5882| 
|5883|5883| /**
|5884|5884|  * General getter for ranges.
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5897|5897| 		return undefined;
|5898|5898| 
|5899|5899| 	return component.GetRange(type);
|5900|    |-}
|    |5900|+};
|5901|5901| 
|5902|5902| UnitAI.prototype.CanAttack = function(target)
|5903|5903| {
|    | [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
|6095|6095| 	return cmpPack && cmpPack.IsPacking();
|6096|6096| };
|6097|6097| 
|6098|    |-//// Formation specific functions ////
|    |6098|+// // Formation specific functions ////
|6099|6099| 
|6100|6100| UnitAI.prototype.IsAttackingAsFormation = function()
|6101|6101| {
|    | [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
|6100|6100| UnitAI.prototype.IsAttackingAsFormation = function()
|6101|6101| {
|6102|6102| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6103|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6104|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6103|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6104|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6105|6105| };
|6106|6106| 
|6107|6107| //// 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
|6104|6104| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6105|6105| };
|6106|6106| 
|6107|    |-//// Animal specific functions ////
|    |6107|+// // Animal specific functions ////
|6108|6108| 
|6109|6109| UnitAI.prototype.MoveRandomly = function(distance)
|6110|6110| {

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|3901| »   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
|4757| »   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
|4772| »   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
|4818| »   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
|4841| »   »   ····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
|2046| »   »   »   »   »   »   &&·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
|3039| »   »   »   »   »   this.SetAnimationVariant(this.formationAnimationVariant)
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

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

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

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

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

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

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

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

Freagarach edited the test plan for this revision. (Show Details)Fri, Mar 27, 9:42 AM