Page MenuHomeWildfire Games

Heal using Heal.js instead of UnitAI.
Changes PlannedPublic

Authored by Freagarach on Mar 26 2020, 10:28 PM.

Details

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

This diff moves the logic for healing from UnitAI to Heal. It would make it easier to allow modders to let e.g. structures heal not using auras.

Downsides:

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

Verify that:

  • Normal healing behaviour remains the same.
  • Healing moving targets is also still possible.
  • Healing renamed that rename works.

Diff Detail

Repository
rP 0 A.D. Public Repository
Branch
/ps/trunk
Lint
Lint OK
SeverityLocationCodeMessage
Warningbinaries/data/mods/public/simulation/components/Heal.js:164ESLintBear (semi)ESLintBear (semi)
Warningbinaries/data/mods/public/simulation/components/Heal.js:164JSHintBearJSHintBear
Warningbinaries/data/mods/public/simulation/components/Heal.js:193ESLintBear (semi)ESLintBear (semi)
Warningbinaries/data/mods/public/simulation/components/Heal.js:193JSHintBearJSHintBear
Warningbinaries/data/mods/public/simulation/components/Heal.js:245ESLintBear (semi)ESLintBear (semi)
Warningbinaries/data/mods/public/simulation/components/Heal.js:245JSHintBearJSHintBear
Warningbinaries/data/mods/public/simulation/components/Heal.js:256ESLintBear (semi)ESLintBear (semi)
Warningbinaries/data/mods/public/simulation/components/Heal.js:256JSHintBearJSHintBear
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:333ESLintBear (consistent-return)ESLintBear (consistent-return)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:757ESLintBear (no-else-return)ESLintBear (no-else-return)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:1009ESLintBear (key-spacing)ESLintBear (key-spacing)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:1995ESLintBear (operator-linebreak)ESLintBear (operator-linebreak)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:2451ESLintBear (indent)ESLintBear (indent)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:3235ESLintBear (indent)ESLintBear (indent)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:3310ESLintBear (no-unneeded-ternary)ESLintBear (no-unneeded-ternary)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:3450ESLintBear (comma-spacing)ESLintBear (comma-spacing)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:3504ESLintBear (object-curly-spacing)ESLintBear (object-curly-spacing)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:3504ESLintBear (object-curly-spacing)ESLintBear (object-curly-spacing)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:3633ESLintBear (spaced-comment)ESLintBear (spaced-comment)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:3799ESLintBear (object-curly-spacing)ESLintBear (object-curly-spacing)
Warningbinaries/data/mods/public/simulation/components/UnitAI.js:3799ESLintBear (object-curly-spacing)ESLintBear (object-curly-spacing)
Warningbinaries/data/mods/public/simulation/components/tests/test_Heal.js:15ESLintBear (semi)ESLintBear (semi)
Warningbinaries/data/mods/public/simulation/components/tests/test_Heal.js:15JSHintBearJSHintBear
Warningbinaries/data/mods/public/simulation/components/tests/test_Heal.js:125ESLintBear (semi)ESLintBear (semi)
Warningbinaries/data/mods/public/simulation/components/tests/test_Heal.js:125JSHintBearJSHintBear
Unit
No Unit Test Coverage
Build Status
Buildable 13490
Build 27292: Vulcan BuildJenkins
Build 27291: Vulcan Build (macOS)Jenkins
Build 27290: Vulcan Build (Windows)Jenkins
Build 27289: arc lint + arc unit

Event Timeline

Freagarach created this revision.Mar 26 2020, 10:28 PM

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (key-spacing):
|    | Extra space after key 'RangeOverlay'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Heal.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Heal.js
|  12|  12| 
|  13|  13| let template = {
|  14|  14| 	"Range": 20,
|  15|    |-	"RangeOverlay" : {
|    |  15|+	"RangeOverlay": {
|  16|  16| 		"LineTexture": "heal_overlay_range.png",
|  17|  17| 		"LineTextureMask": "heal_overlay_range_mask.png",
|  18|  18| 		"LineThickness": 0.35
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Heal.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Heal.js
|  49|  49| 
|  50|  50| TS_ASSERT_EQUALS(cmpHeal.GetHP(), 5 + 100);
|  51|  51| 
|  52|    |-TS_ASSERT_UNEVAL_EQUALS(cmpHeal.GetRange(), {"min":0, "max": 20 + 300 });
|    |  52|+TS_ASSERT_UNEVAL_EQUALS(cmpHeal.GetRange(), { "min":0, "max": 20 + 300 });
|  53|  53| 
|  54|  54| TS_ASSERT_EQUALS(cmpHeal.GetHealableClasses(), "Support Infantry");
|  55|  55| 
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'min'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Heal.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_Heal.js
|  49|  49| 
|  50|  50| TS_ASSERT_EQUALS(cmpHeal.GetHP(), 5 + 100);
|  51|  51| 
|  52|    |-TS_ASSERT_UNEVAL_EQUALS(cmpHeal.GetRange(), {"min":0, "max": 20 + 300 });
|    |  52|+TS_ASSERT_UNEVAL_EQUALS(cmpHeal.GetRange(), {"min": 0, "max": 20 + 300 });
|  53|  53| 
|  54|  54| TS_ASSERT_EQUALS(cmpHeal.GetHealableClasses(), "Support Infantry");
|  55|  55| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 1.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Heal.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Heal.js
| 157| 157| 			cmpPromotion.IncreaseXp((targetState.new - targetState.old) / cmpHealth.GetMaxHitpoints() * cmpLoot.GetXp());
| 158| 158| 
| 159| 159| 		// TODO we need a sound file
| 160|    |-	//	PlaySound("heal_impact", this.entity);
|    | 160|+		//	PlaySound("heal_impact", this.entity);
| 161| 161| 
| 162| 162| 		if (!cmpHealth.IsInjured())
| 163| 163| 		{
|    | [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
|2760|2760| 					{
|2761|2761| 						// The building was already finished/fully repaired before we arrived;
|2762|2762| 						// let the ConstructionFinished handler handle this.
|2763|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2763|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2764|2764| 						return true;
|2765|2765| 					}
|2766|2766| 
|    | [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
|2760|2760| 					{
|2761|2761| 						// The building was already finished/fully repaired before we arrived;
|2762|2762| 						// let the ConstructionFinished handler handle this.
|2763|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2763|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2764|2764| 						return true;
|2765|2765| 					}
|2766|2766| 
|    | [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
|3058|3058| 				this.StopTimer();
|3059|3059| 				this.ResetAnimation();
|3060|3060| 				if (this.formationAnimationVariant)
|3061|    |-					this.SetAnimationVariant(this.formationAnimationVariant)
|    |3061|+					this.SetAnimationVariant(this.formationAnimationVariant);
|3062|3062| 				else
|3063|3063| 					this.SetDefaultAnimationVariant();
|3064|3064| 				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
|3284|3284| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3285|3285| 
|3286|3286| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3287|    |-							// only used for domestic animals
|    |3287|+		// only used for domestic animals
|3288|3288| 
|3289|3289| 		// Reuse the same garrison behaviour for animals.
|3290|3290| 		"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
|3346|3346| 
|3347|3347| UnitAI.prototype.IsAnimal = function()
|3348|3348| {
|3349|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3349|+	return (!!this.template.NaturalBehaviour);
|3350|3350| };
|3351|3351| 
|3352|3352| 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
|3462|3462| 		{
|3463|3463| 			let index = this.GetCurrentState().indexOf(".");
|3464|3464| 			if (index != -1)
|3465|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3465|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3466|3466| 			this.Stop(false);
|3467|3467| 		}
|3468|3468| 
|    | [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
|3518|3518| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3519|3519| 			continue;
|3520|3520| 		if (i == 0)
|3521|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3521|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3522|3522| 		else
|3523|3523| 			this.orderQueue.splice(i, 1);
|3524|3524| 		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
|3518|3518| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3519|3519| 			continue;
|3520|3520| 		if (i == 0)
|3521|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3521|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3522|3522| 		else
|3523|3523| 			this.orderQueue.splice(i, 1);
|3524|3524| 		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
|3605|3605| };
|3606|3606| 
|3607|3607| 
|3608|    |-//// FSM linkage functions ////
|    |3608|+// // FSM linkage functions ////
|3609|3609| 
|3610|3610| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3611|3611| 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
|3776|3776| 				continue;
|3777|3777| 			if (this.orderQueue[i].type == type)
|3778|3778| 				continue;
|3779|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3779|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3780|3780| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3781|3781| 			return;
|3782|3782| 		}
|    | [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
|3776|3776| 				continue;
|3777|3777| 			if (this.orderQueue[i].type == type)
|3778|3778| 				continue;
|3779|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3779|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3780|3780| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3781|3781| 			return;
|3782|3782| 		}
|    | [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
|4018|4018| 	if (data.timerRepeat === undefined)
|4019|4019| 		this.timer = undefined;
|4020|4020| 
|4021|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4021|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4022|4022| };
|4023|4023| 
|4024|4024| /**
|    | [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
|4018|4018| 	if (data.timerRepeat === undefined)
|4019|4019| 		this.timer = undefined;
|4020|4020| 
|4021|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4021|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4022|4022| };
|4023|4023| 
|4024|4024| /**
|    | [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
|4063|4063| 	// TODO: This is a bit inefficient since every unit listens to every
|4064|4064| 	// construction message - ideally we could scope it to only the one we're building
|4065|4065| 
|4066|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4066|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4067|4067| };
|4068|4068| 
|4069|4069| 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
|4063|4063| 	// TODO: This is a bit inefficient since every unit listens to every
|4064|4064| 	// construction message - ideally we could scope it to only the one we're building
|4065|4065| 
|4066|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4066|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4067|4067| };
|4068|4068| 
|4069|4069| 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
|4094|4094| 	if (msg.fromStatusEffect)
|4095|4095| 		return;
|4096|4096| 
|4097|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4097|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4098|4098| };
|4099|4099| 
|4100|4100| 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
|4094|4094| 	if (msg.fromStatusEffect)
|4095|4095| 		return;
|4096|4096| 
|4097|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4097|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4098|4098| };
|4099|4099| 
|4100|4100| 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
|4099|4099| 
|4100|4100| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4101|4101| {
|4102|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4102|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4103|4103| };
|4104|4104| 
|4105|4105| 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
|4099|4099| 
|4100|4100| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4101|4101| {
|4102|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4102|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4103|4103| };
|4104|4104| 
|4105|4105| 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
|4104|4104| 
|4105|4105| UnitAI.prototype.OnHealthChanged = function(msg)
|4106|4106| {
|4107|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4107|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4108|4108| };
|4109|4109| 
|4110|4110| 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
|4104|4104| 
|4105|4105| UnitAI.prototype.OnHealthChanged = function(msg)
|4106|4106| {
|4107|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4107|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4108|4108| };
|4109|4109| 
|4110|4110| 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
|4110|4110| UnitAI.prototype.OnRangeUpdate = function(msg)
|4111|4111| {
|4112|4112| 	if (msg.tag == this.losRangeQuery)
|4113|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4113|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4114|4114| 	else if (msg.tag == this.losHealRangeQuery)
|4115|4115| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4116|4116| };
|    | [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
|4110|4110| UnitAI.prototype.OnRangeUpdate = function(msg)
|4111|4111| {
|4112|4112| 	if (msg.tag == this.losRangeQuery)
|4113|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4113|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4114|4114| 	else if (msg.tag == this.losHealRangeQuery)
|4115|4115| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4116|4116| };
|    | [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
|4112|4112| 	if (msg.tag == this.losRangeQuery)
|4113|4113| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4114|4114| 	else if (msg.tag == this.losHealRangeQuery)
|4115|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4115|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4116|4116| };
|4117|4117| 
|4118|4118| 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
|4112|4112| 	if (msg.tag == this.losRangeQuery)
|4113|4113| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4114|4114| 	else if (msg.tag == this.losHealRangeQuery)
|4115|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4115|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4116|4116| };
|4117|4117| 
|4118|4118| 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
|4117|4117| 
|4118|4118| UnitAI.prototype.OnPackFinished = function(msg)
|4119|4119| {
|4120|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4120|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4121|4121| };
|4122|4122| 
|4123|4123| UnitAI.prototype.OnHealingStateChanged = 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
|4117|4117| 
|4118|4118| UnitAI.prototype.OnPackFinished = function(msg)
|4119|4119| {
|4120|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4120|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4121|4121| };
|4122|4122| 
|4123|4123| UnitAI.prototype.OnHealingStateChanged = 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
|4125|4125| 	this.UnitFsm.ProcessMessage(this, { "type": "HealingStateChanged", "data": msg });
|4126|4126| };
|4127|4127| 
|4128|    |-//// Helper functions to be called by the FSM ////
|    |4128|+// // Helper functions to be called by the FSM ////
|4129|4129| 
|4130|4130| UnitAI.prototype.GetWalkSpeed = function()
|4131|4131| {
|    | [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
|4792|4792| UnitAI.prototype.AttackEntityInZone = function(ents)
|4793|4793| {
|4794|4794| 	var target = ents.find(target =>
|4795|    |-		this.CanAttack(target)
|4796|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4795|+		this.CanAttack(target) &&
|    |4796|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4797|4797| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4798|4798| 	);
|4799|4799| 	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
|4793|4793| {
|4794|4794| 	var target = ents.find(target =>
|4795|4795| 		this.CanAttack(target)
|4796|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4797|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4796|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4797|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4798|4798| 	);
|4799|4799| 	if (!target)
|4800|4800| 		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
|4857|4857| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4858|4858| 	if (this.isGuardOf)
|4859|4859| 	{
|4860|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4860|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4861|4861| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4862|4862| 		if (cmpUnitAI && cmpAttack &&
|4863|4863| 		    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
|4861|4861| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4862|4862| 		if (cmpUnitAI && cmpAttack &&
|4863|4863| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4864|    |-				return false;
|    |4864|+			return false;
|4865|4865| 	}
|4866|4866| 
|4867|4867| 	// 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
|4899|4899| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4900|4900| 	if (this.isGuardOf)
|4901|4901| 	{
|4902|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4902|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4903|4903| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4904|4904| 		if (cmpUnitAI && cmpAttack &&
|4905|4905| 		    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
|4912|4912| 	return false;
|4913|4913| };
|4914|4914| 
|4915|    |-//// External interface functions ////
|    |4915|+// // External interface functions ////
|4916|4916| 
|4917|4917| UnitAI.prototype.SetFormationController = function(ent)
|4918|4918| {
|    | [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
|5068|5068| 	{
|5069|5069| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5070|5070| 			return;
|5071|    |-		else
|5072|    |-			this.RemoveGuard();
|    |5071|+		this.RemoveGuard();
|5073|5072| 	}
|5074|5073| 
|5075|5074| 	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
|5399|5399| 
|5400|5400| 	if (this.IsFormationController())
|5401|5401| 		this.CallMemberFunction("CancelSetupTradeRoute", [target]);
|5402|    |-}
|    |5402|+};
|5403|5403| /**
|5404|5404|  * Adds trade order to the queue. Either walk to the first market, or
|5405|5405|  * 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
|5420|5420| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5421|5421| 	{
|5422|5422| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5423|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5423|+		if (cmpTrader.HasBothMarkets() &&
|5424|5424| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5425|5425| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5426|5426| 		{
|    | [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
|5701|5701| 				{
|5702|5702| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5703|5703| 					var targetClasses = this.order.data.targetClasses;
|5704|    |-					if (targetClasses.attack && cmpIdentity
|5705|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5704|+					if (targetClasses.attack && cmpIdentity &&
|    |5705|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5706|5706| 						continue;
|5707|5707| 					if (targetClasses.avoid && cmpIdentity
|5708|5708| 						&& 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
|5704|5704| 					if (targetClasses.attack && cmpIdentity
|5705|5705| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5706|5706| 						continue;
|5707|    |-					if (targetClasses.avoid && cmpIdentity
|5708|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5707|+					if (targetClasses.avoid && cmpIdentity &&
|    |5708|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5709|5709| 						continue;
|5710|5710| 					// Only used by the AIs to prevent some choices of targets
|5711|5711| 					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
|5727|5727| 		{
|5728|5728| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5729|5729| 			var targetClasses = this.order.data.targetClasses;
|5730|    |-			if (cmpIdentity && targetClasses.attack
|5731|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5730|+			if (cmpIdentity && targetClasses.attack &&
|    |5731|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5732|5732| 				continue;
|5733|5733| 			if (cmpIdentity && targetClasses.avoid
|5734|5734| 				&& 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
|5730|5730| 			if (cmpIdentity && targetClasses.attack
|5731|5731| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5732|5732| 				continue;
|5733|    |-			if (cmpIdentity && targetClasses.avoid
|5734|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5733|+			if (cmpIdentity && targetClasses.avoid &&
|    |5734|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5735|5735| 				continue;
|5736|5736| 			// Only used by the AIs to prevent some choices of targets
|5737|5737| 			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
|5873|5873| 
|5874|5874| UnitAI.prototype.SetHeldPosition = function(x, z)
|5875|5875| {
|5876|    |-	this.heldPosition = {"x": x, "z": z};
|    |5876|+	this.heldPosition = { "x": x, "z": z};
|5877|5877| };
|5878|5878| 
|5879|5879| 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
|5873|5873| 
|5874|5874| UnitAI.prototype.SetHeldPosition = function(x, z)
|5875|5875| {
|5876|    |-	this.heldPosition = {"x": x, "z": z};
|    |5876|+	this.heldPosition = {"x": x, "z": z };
|5877|5877| };
|5878|5878| 
|5879|5879| 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
|5900|5900| 	return false;
|5901|5901| };
|5902|5902| 
|5903|    |-//// Helper functions ////
|    |5903|+// // Helper functions ////
|5904|5904| 
|5905|5905| /**
|5906|5906|  * 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
|5919|5919| 		return undefined;
|5920|5920| 
|5921|5921| 	return component.GetRange(type);
|5922|    |-}
|    |5922|+};
|5923|5923| 
|5924|5924| UnitAI.prototype.CanAttack = function(target)
|5925|5925| {
|    | [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
|6117|6117| 	return cmpPack && cmpPack.IsPacking();
|6118|6118| };
|6119|6119| 
|6120|    |-//// Formation specific functions ////
|    |6120|+// // Formation specific functions ////
|6121|6121| 
|6122|6122| UnitAI.prototype.IsAttackingAsFormation = function()
|6123|6123| {
|    | [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
|6122|6122| UnitAI.prototype.IsAttackingAsFormation = function()
|6123|6123| {
|6124|6124| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6125|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6126|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6125|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6126|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6127|6127| };
|6128|6128| 
|6129|6129| //// 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
|6126|6126| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6127|6127| };
|6128|6128| 
|6129|    |-//// Animal specific functions ////
|    |6129|+// // Animal specific functions ////
|6130|6130| 
|6131|6131| UnitAI.prototype.MoveRandomly = function(distance)
|6132|6132| {

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
|3923| »   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
|4779| »   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
|4794| »   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
|4840| »   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
|4863| »   »   ····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
|3061| »   »   »   »   »   this.SetAnimationVariant(this.formationAnimationVariant)
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

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

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

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

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

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

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

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

Freagarach edited the summary of this revision. (Show Details)Mar 26 2020, 10:35 PM
Freagarach updated this revision to Diff 11575.Mar 27 2020, 7:59 AM
  • Add test for stopping.
  • Use proper prepare time when starting to heal.

(See also D2403.)

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
|2760|2760| 					{
|2761|2761| 						// The building was already finished/fully repaired before we arrived;
|2762|2762| 						// let the ConstructionFinished handler handle this.
|2763|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2763|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2764|2764| 						return true;
|2765|2765| 					}
|2766|2766| 
|    | [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
|2760|2760| 					{
|2761|2761| 						// The building was already finished/fully repaired before we arrived;
|2762|2762| 						// let the ConstructionFinished handler handle this.
|2763|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2763|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2764|2764| 						return true;
|2765|2765| 					}
|2766|2766| 
|    | [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
|3058|3058| 				this.StopTimer();
|3059|3059| 				this.ResetAnimation();
|3060|3060| 				if (this.formationAnimationVariant)
|3061|    |-					this.SetAnimationVariant(this.formationAnimationVariant)
|    |3061|+					this.SetAnimationVariant(this.formationAnimationVariant);
|3062|3062| 				else
|3063|3063| 					this.SetDefaultAnimationVariant();
|3064|3064| 				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
|3284|3284| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3285|3285| 
|3286|3286| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3287|    |-							// only used for domestic animals
|    |3287|+		// only used for domestic animals
|3288|3288| 
|3289|3289| 		// Reuse the same garrison behaviour for animals.
|3290|3290| 		"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
|3346|3346| 
|3347|3347| UnitAI.prototype.IsAnimal = function()
|3348|3348| {
|3349|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3349|+	return (!!this.template.NaturalBehaviour);
|3350|3350| };
|3351|3351| 
|3352|3352| 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
|3462|3462| 		{
|3463|3463| 			let index = this.GetCurrentState().indexOf(".");
|3464|3464| 			if (index != -1)
|3465|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3465|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3466|3466| 			this.Stop(false);
|3467|3467| 		}
|3468|3468| 
|    | [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
|3518|3518| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3519|3519| 			continue;
|3520|3520| 		if (i == 0)
|3521|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3521|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3522|3522| 		else
|3523|3523| 			this.orderQueue.splice(i, 1);
|3524|3524| 		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
|3518|3518| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3519|3519| 			continue;
|3520|3520| 		if (i == 0)
|3521|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3521|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3522|3522| 		else
|3523|3523| 			this.orderQueue.splice(i, 1);
|3524|3524| 		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
|3605|3605| };
|3606|3606| 
|3607|3607| 
|3608|    |-//// FSM linkage functions ////
|    |3608|+// // FSM linkage functions ////
|3609|3609| 
|3610|3610| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3611|3611| 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
|3776|3776| 				continue;
|3777|3777| 			if (this.orderQueue[i].type == type)
|3778|3778| 				continue;
|3779|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3779|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3780|3780| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3781|3781| 			return;
|3782|3782| 		}
|    | [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
|3776|3776| 				continue;
|3777|3777| 			if (this.orderQueue[i].type == type)
|3778|3778| 				continue;
|3779|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3779|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3780|3780| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3781|3781| 			return;
|3782|3782| 		}
|    | [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
|4018|4018| 	if (data.timerRepeat === undefined)
|4019|4019| 		this.timer = undefined;
|4020|4020| 
|4021|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4021|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4022|4022| };
|4023|4023| 
|4024|4024| /**
|    | [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
|4018|4018| 	if (data.timerRepeat === undefined)
|4019|4019| 		this.timer = undefined;
|4020|4020| 
|4021|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4021|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4022|4022| };
|4023|4023| 
|4024|4024| /**
|    | [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
|4063|4063| 	// TODO: This is a bit inefficient since every unit listens to every
|4064|4064| 	// construction message - ideally we could scope it to only the one we're building
|4065|4065| 
|4066|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4066|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4067|4067| };
|4068|4068| 
|4069|4069| 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
|4063|4063| 	// TODO: This is a bit inefficient since every unit listens to every
|4064|4064| 	// construction message - ideally we could scope it to only the one we're building
|4065|4065| 
|4066|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4066|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4067|4067| };
|4068|4068| 
|4069|4069| 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
|4094|4094| 	if (msg.fromStatusEffect)
|4095|4095| 		return;
|4096|4096| 
|4097|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4097|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4098|4098| };
|4099|4099| 
|4100|4100| 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
|4094|4094| 	if (msg.fromStatusEffect)
|4095|4095| 		return;
|4096|4096| 
|4097|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4097|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4098|4098| };
|4099|4099| 
|4100|4100| 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
|4099|4099| 
|4100|4100| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4101|4101| {
|4102|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4102|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4103|4103| };
|4104|4104| 
|4105|4105| 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
|4099|4099| 
|4100|4100| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4101|4101| {
|4102|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4102|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4103|4103| };
|4104|4104| 
|4105|4105| 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
|4104|4104| 
|4105|4105| UnitAI.prototype.OnHealthChanged = function(msg)
|4106|4106| {
|4107|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4107|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4108|4108| };
|4109|4109| 
|4110|4110| 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
|4104|4104| 
|4105|4105| UnitAI.prototype.OnHealthChanged = function(msg)
|4106|4106| {
|4107|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4107|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4108|4108| };
|4109|4109| 
|4110|4110| 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
|4110|4110| UnitAI.prototype.OnRangeUpdate = function(msg)
|4111|4111| {
|4112|4112| 	if (msg.tag == this.losRangeQuery)
|4113|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4113|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4114|4114| 	else if (msg.tag == this.losHealRangeQuery)
|4115|4115| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4116|4116| };
|    | [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
|4110|4110| UnitAI.prototype.OnRangeUpdate = function(msg)
|4111|4111| {
|4112|4112| 	if (msg.tag == this.losRangeQuery)
|4113|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4113|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4114|4114| 	else if (msg.tag == this.losHealRangeQuery)
|4115|4115| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4116|4116| };
|    | [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
|4112|4112| 	if (msg.tag == this.losRangeQuery)
|4113|4113| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4114|4114| 	else if (msg.tag == this.losHealRangeQuery)
|4115|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4115|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4116|4116| };
|4117|4117| 
|4118|4118| 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
|4112|4112| 	if (msg.tag == this.losRangeQuery)
|4113|4113| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4114|4114| 	else if (msg.tag == this.losHealRangeQuery)
|4115|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4115|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4116|4116| };
|4117|4117| 
|4118|4118| 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
|4117|4117| 
|4118|4118| UnitAI.prototype.OnPackFinished = function(msg)
|4119|4119| {
|4120|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4120|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4121|4121| };
|4122|4122| 
|4123|4123| UnitAI.prototype.OnHealingStateChanged = 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
|4117|4117| 
|4118|4118| UnitAI.prototype.OnPackFinished = function(msg)
|4119|4119| {
|4120|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4120|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4121|4121| };
|4122|4122| 
|4123|4123| UnitAI.prototype.OnHealingStateChanged = 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
|4125|4125| 	this.UnitFsm.ProcessMessage(this, { "type": "HealingStateChanged", "data": msg });
|4126|4126| };
|4127|4127| 
|4128|    |-//// Helper functions to be called by the FSM ////
|    |4128|+// // Helper functions to be called by the FSM ////
|4129|4129| 
|4130|4130| UnitAI.prototype.GetWalkSpeed = function()
|4131|4131| {
|    | [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
|4792|4792| UnitAI.prototype.AttackEntityInZone = function(ents)
|4793|4793| {
|4794|4794| 	var target = ents.find(target =>
|4795|    |-		this.CanAttack(target)
|4796|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4795|+		this.CanAttack(target) &&
|    |4796|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4797|4797| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4798|4798| 	);
|4799|4799| 	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
|4793|4793| {
|4794|4794| 	var target = ents.find(target =>
|4795|4795| 		this.CanAttack(target)
|4796|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4797|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4796|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4797|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4798|4798| 	);
|4799|4799| 	if (!target)
|4800|4800| 		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
|4857|4857| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4858|4858| 	if (this.isGuardOf)
|4859|4859| 	{
|4860|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4860|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4861|4861| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4862|4862| 		if (cmpUnitAI && cmpAttack &&
|4863|4863| 		    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
|4861|4861| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4862|4862| 		if (cmpUnitAI && cmpAttack &&
|4863|4863| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4864|    |-				return false;
|    |4864|+			return false;
|4865|4865| 	}
|4866|4866| 
|4867|4867| 	// 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
|4899|4899| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4900|4900| 	if (this.isGuardOf)
|4901|4901| 	{
|4902|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4902|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4903|4903| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4904|4904| 		if (cmpUnitAI && cmpAttack &&
|4905|4905| 		    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
|4912|4912| 	return false;
|4913|4913| };
|4914|4914| 
|4915|    |-//// External interface functions ////
|    |4915|+// // External interface functions ////
|4916|4916| 
|4917|4917| UnitAI.prototype.SetFormationController = function(ent)
|4918|4918| {
|    | [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
|5068|5068| 	{
|5069|5069| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5070|5070| 			return;
|5071|    |-		else
|5072|    |-			this.RemoveGuard();
|    |5071|+		this.RemoveGuard();
|5073|5072| 	}
|5074|5073| 
|5075|5074| 	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
|5399|5399| 
|5400|5400| 	if (this.IsFormationController())
|5401|5401| 		this.CallMemberFunction("CancelSetupTradeRoute", [target]);
|5402|    |-}
|    |5402|+};
|5403|5403| /**
|5404|5404|  * Adds trade order to the queue. Either walk to the first market, or
|5405|5405|  * 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
|5420|5420| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5421|5421| 	{
|5422|5422| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5423|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5423|+		if (cmpTrader.HasBothMarkets() &&
|5424|5424| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5425|5425| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5426|5426| 		{
|    | [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
|5701|5701| 				{
|5702|5702| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5703|5703| 					var targetClasses = this.order.data.targetClasses;
|5704|    |-					if (targetClasses.attack && cmpIdentity
|5705|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5704|+					if (targetClasses.attack && cmpIdentity &&
|    |5705|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5706|5706| 						continue;
|5707|5707| 					if (targetClasses.avoid && cmpIdentity
|5708|5708| 						&& 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
|5704|5704| 					if (targetClasses.attack && cmpIdentity
|5705|5705| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5706|5706| 						continue;
|5707|    |-					if (targetClasses.avoid && cmpIdentity
|5708|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5707|+					if (targetClasses.avoid && cmpIdentity &&
|    |5708|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5709|5709| 						continue;
|5710|5710| 					// Only used by the AIs to prevent some choices of targets
|5711|5711| 					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
|5727|5727| 		{
|5728|5728| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5729|5729| 			var targetClasses = this.order.data.targetClasses;
|5730|    |-			if (cmpIdentity && targetClasses.attack
|5731|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5730|+			if (cmpIdentity && targetClasses.attack &&
|    |5731|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5732|5732| 				continue;
|5733|5733| 			if (cmpIdentity && targetClasses.avoid
|5734|5734| 				&& 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
|5730|5730| 			if (cmpIdentity && targetClasses.attack
|5731|5731| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5732|5732| 				continue;
|5733|    |-			if (cmpIdentity && targetClasses.avoid
|5734|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5733|+			if (cmpIdentity && targetClasses.avoid &&
|    |5734|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5735|5735| 				continue;
|5736|5736| 			// Only used by the AIs to prevent some choices of targets
|5737|5737| 			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
|5873|5873| 
|5874|5874| UnitAI.prototype.SetHeldPosition = function(x, z)
|5875|5875| {
|5876|    |-	this.heldPosition = {"x": x, "z": z};
|    |5876|+	this.heldPosition = { "x": x, "z": z};
|5877|5877| };
|5878|5878| 
|5879|5879| 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
|5873|5873| 
|5874|5874| UnitAI.prototype.SetHeldPosition = function(x, z)
|5875|5875| {
|5876|    |-	this.heldPosition = {"x": x, "z": z};
|    |5876|+	this.heldPosition = {"x": x, "z": z };
|5877|5877| };
|5878|5878| 
|5879|5879| 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
|5900|5900| 	return false;
|5901|5901| };
|5902|5902| 
|5903|    |-//// Helper functions ////
|    |5903|+// // Helper functions ////
|5904|5904| 
|5905|5905| /**
|5906|5906|  * 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
|5919|5919| 		return undefined;
|5920|5920| 
|5921|5921| 	return component.GetRange(type);
|5922|    |-}
|    |5922|+};
|5923|5923| 
|5924|5924| UnitAI.prototype.CanAttack = function(target)
|5925|5925| {
|    | [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
|6117|6117| 	return cmpPack && cmpPack.IsPacking();
|6118|6118| };
|6119|6119| 
|6120|    |-//// Formation specific functions ////
|    |6120|+// // Formation specific functions ////
|6121|6121| 
|6122|6122| UnitAI.prototype.IsAttackingAsFormation = function()
|6123|6123| {
|    | [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
|6122|6122| UnitAI.prototype.IsAttackingAsFormation = function()
|6123|6123| {
|6124|6124| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6125|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6126|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6125|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6126|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6127|6127| };
|6128|6128| 
|6129|6129| //// 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
|6126|6126| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6127|6127| };
|6128|6128| 
|6129|    |-//// Animal specific functions ////
|    |6129|+// // Animal specific functions ////
|6130|6130| 
|6131|6131| UnitAI.prototype.MoveRandomly = function(distance)
|6132|6132| {

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
|3923| »   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
|4779| »   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
|4794| »   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
|4840| »   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
|4863| »   »   ····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
|3061| »   »   »   »   »   this.SetAnimationVariant(this.formationAnimationVariant)
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

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

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

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

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

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

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

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

Stan added a subscriber: Stan.Mar 27 2020, 8:30 AM

Strings in tests?

binaries/data/mods/public/simulation/components/Heal.js
158

This should be pretty easy...

Freagarach updated this revision to Diff 11586.Mar 27 2020, 5:27 PM

Also include range-check in cmpHeal.

Freagarach added inline comments.Mar 27 2020, 5:29 PM
binaries/data/mods/public/simulation/components/UnitAI.js
2531–2532
2578

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

Linter detected issues:
Executing section Source...
Executing section JS...

binaries/data/mods/public/simulation/components/Heal.js
| 103| »   »   return·timings;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'StartHealing' expected no return value.
|    | [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
|2760|2760| 					{
|2761|2761| 						// The building was already finished/fully repaired before we arrived;
|2762|2762| 						// let the ConstructionFinished handler handle this.
|2763|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2763|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2764|2764| 						return true;
|2765|2765| 					}
|2766|2766| 
|    | [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
|2760|2760| 					{
|2761|2761| 						// The building was already finished/fully repaired before we arrived;
|2762|2762| 						// let the ConstructionFinished handler handle this.
|2763|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2763|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2764|2764| 						return true;
|2765|2765| 					}
|2766|2766| 
|    | [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
|3058|3058| 				this.StopTimer();
|3059|3059| 				this.ResetAnimation();
|3060|3060| 				if (this.formationAnimationVariant)
|3061|    |-					this.SetAnimationVariant(this.formationAnimationVariant)
|    |3061|+					this.SetAnimationVariant(this.formationAnimationVariant);
|3062|3062| 				else
|3063|3063| 					this.SetDefaultAnimationVariant();
|3064|3064| 				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
|3284|3284| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3285|3285| 
|3286|3286| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3287|    |-							// only used for domestic animals
|    |3287|+		// only used for domestic animals
|3288|3288| 
|3289|3289| 		// Reuse the same garrison behaviour for animals.
|3290|3290| 		"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
|3346|3346| 
|3347|3347| UnitAI.prototype.IsAnimal = function()
|3348|3348| {
|3349|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3349|+	return (!!this.template.NaturalBehaviour);
|3350|3350| };
|3351|3351| 
|3352|3352| 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
|3462|3462| 		{
|3463|3463| 			let index = this.GetCurrentState().indexOf(".");
|3464|3464| 			if (index != -1)
|3465|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3465|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3466|3466| 			this.Stop(false);
|3467|3467| 		}
|3468|3468| 
|    | [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
|3518|3518| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3519|3519| 			continue;
|3520|3520| 		if (i == 0)
|3521|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3521|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3522|3522| 		else
|3523|3523| 			this.orderQueue.splice(i, 1);
|3524|3524| 		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
|3518|3518| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3519|3519| 			continue;
|3520|3520| 		if (i == 0)
|3521|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3521|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3522|3522| 		else
|3523|3523| 			this.orderQueue.splice(i, 1);
|3524|3524| 		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
|3605|3605| };
|3606|3606| 
|3607|3607| 
|3608|    |-//// FSM linkage functions ////
|    |3608|+// // FSM linkage functions ////
|3609|3609| 
|3610|3610| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3611|3611| 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
|3776|3776| 				continue;
|3777|3777| 			if (this.orderQueue[i].type == type)
|3778|3778| 				continue;
|3779|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3779|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3780|3780| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3781|3781| 			return;
|3782|3782| 		}
|    | [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
|3776|3776| 				continue;
|3777|3777| 			if (this.orderQueue[i].type == type)
|3778|3778| 				continue;
|3779|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3779|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3780|3780| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3781|3781| 			return;
|3782|3782| 		}
|    | [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
|4018|4018| 	if (data.timerRepeat === undefined)
|4019|4019| 		this.timer = undefined;
|4020|4020| 
|4021|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4021|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4022|4022| };
|4023|4023| 
|4024|4024| /**
|    | [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
|4018|4018| 	if (data.timerRepeat === undefined)
|4019|4019| 		this.timer = undefined;
|4020|4020| 
|4021|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4021|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4022|4022| };
|4023|4023| 
|4024|4024| /**
|    | [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
|4063|4063| 	// TODO: This is a bit inefficient since every unit listens to every
|4064|4064| 	// construction message - ideally we could scope it to only the one we're building
|4065|4065| 
|4066|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4066|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4067|4067| };
|4068|4068| 
|4069|4069| 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
|4063|4063| 	// TODO: This is a bit inefficient since every unit listens to every
|4064|4064| 	// construction message - ideally we could scope it to only the one we're building
|4065|4065| 
|4066|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4066|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4067|4067| };
|4068|4068| 
|4069|4069| 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
|4094|4094| 	if (msg.fromStatusEffect)
|4095|4095| 		return;
|4096|4096| 
|4097|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4097|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4098|4098| };
|4099|4099| 
|4100|4100| 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
|4094|4094| 	if (msg.fromStatusEffect)
|4095|4095| 		return;
|4096|4096| 
|4097|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4097|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4098|4098| };
|4099|4099| 
|4100|4100| 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
|4099|4099| 
|4100|4100| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4101|4101| {
|4102|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4102|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4103|4103| };
|4104|4104| 
|4105|4105| 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
|4099|4099| 
|4100|4100| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4101|4101| {
|4102|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4102|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4103|4103| };
|4104|4104| 
|4105|4105| 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
|4104|4104| 
|4105|4105| UnitAI.prototype.OnHealthChanged = function(msg)
|4106|4106| {
|4107|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4107|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4108|4108| };
|4109|4109| 
|4110|4110| 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
|4104|4104| 
|4105|4105| UnitAI.prototype.OnHealthChanged = function(msg)
|4106|4106| {
|4107|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4107|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4108|4108| };
|4109|4109| 
|4110|4110| 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
|4110|4110| UnitAI.prototype.OnRangeUpdate = function(msg)
|4111|4111| {
|4112|4112| 	if (msg.tag == this.losRangeQuery)
|4113|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4113|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4114|4114| 	else if (msg.tag == this.losHealRangeQuery)
|4115|4115| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4116|4116| };
|    | [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
|4110|4110| UnitAI.prototype.OnRangeUpdate = function(msg)
|4111|4111| {
|4112|4112| 	if (msg.tag == this.losRangeQuery)
|4113|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4113|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4114|4114| 	else if (msg.tag == this.losHealRangeQuery)
|4115|4115| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4116|4116| };
|    | [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
|4112|4112| 	if (msg.tag == this.losRangeQuery)
|4113|4113| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4114|4114| 	else if (msg.tag == this.losHealRangeQuery)
|4115|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4115|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4116|4116| };
|4117|4117| 
|4118|4118| 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
|4112|4112| 	if (msg.tag == this.losRangeQuery)
|4113|4113| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4114|4114| 	else if (msg.tag == this.losHealRangeQuery)
|4115|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4115|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4116|4116| };
|4117|4117| 
|4118|4118| 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
|4117|4117| 
|4118|4118| UnitAI.prototype.OnPackFinished = function(msg)
|4119|4119| {
|4120|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4120|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4121|4121| };
|4122|4122| 
|4123|4123| UnitAI.prototype.OnHealingStopped = 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
|4117|4117| 
|4118|4118| UnitAI.prototype.OnPackFinished = function(msg)
|4119|4119| {
|4120|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4120|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4121|4121| };
|4122|4122| 
|4123|4123| UnitAI.prototype.OnHealingStopped = 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
|4125|4125| 	this.UnitFsm.ProcessMessage(this, { "type": "HealingStopped", "data": msg });
|4126|4126| };
|4127|4127| 
|4128|    |-//// Helper functions to be called by the FSM ////
|    |4128|+// // Helper functions to be called by the FSM ////
|4129|4129| 
|4130|4130| UnitAI.prototype.GetWalkSpeed = function()
|4131|4131| {
|    | [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
|4792|4792| UnitAI.prototype.AttackEntityInZone = function(ents)
|4793|4793| {
|4794|4794| 	var target = ents.find(target =>
|4795|    |-		this.CanAttack(target)
|4796|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4795|+		this.CanAttack(target) &&
|    |4796|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4797|4797| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4798|4798| 	);
|4799|4799| 	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
|4793|4793| {
|4794|4794| 	var target = ents.find(target =>
|4795|4795| 		this.CanAttack(target)
|4796|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4797|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4796|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4797|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4798|4798| 	);
|4799|4799| 	if (!target)
|4800|4800| 		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
|4857|4857| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4858|4858| 	if (this.isGuardOf)
|4859|4859| 	{
|4860|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4860|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4861|4861| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4862|4862| 		if (cmpUnitAI && cmpAttack &&
|4863|4863| 		    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
|4861|4861| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4862|4862| 		if (cmpUnitAI && cmpAttack &&
|4863|4863| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4864|    |-				return false;
|    |4864|+			return false;
|4865|4865| 	}
|4866|4866| 
|4867|4867| 	// 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
|4899|4899| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4900|4900| 	if (this.isGuardOf)
|4901|4901| 	{
|4902|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4902|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4903|4903| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4904|4904| 		if (cmpUnitAI && cmpAttack &&
|4905|4905| 		    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
|4912|4912| 	return false;
|4913|4913| };
|4914|4914| 
|4915|    |-//// External interface functions ////
|    |4915|+// // External interface functions ////
|4916|4916| 
|4917|4917| UnitAI.prototype.SetFormationController = function(ent)
|4918|4918| {
|    | [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
|5068|5068| 	{
|5069|5069| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5070|5070| 			return;
|5071|    |-		else
|5072|    |-			this.RemoveGuard();
|    |5071|+		this.RemoveGuard();
|5073|5072| 	}
|5074|5073| 
|5075|5074| 	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
|5399|5399| 
|5400|5400| 	if (this.IsFormationController())
|5401|5401| 		this.CallMemberFunction("CancelSetupTradeRoute", [target]);
|5402|    |-}
|    |5402|+};
|5403|5403| /**
|5404|5404|  * Adds trade order to the queue. Either walk to the first market, or
|5405|5405|  * 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
|5420|5420| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5421|5421| 	{
|5422|5422| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5423|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5423|+		if (cmpTrader.HasBothMarkets() &&
|5424|5424| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5425|5425| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5426|5426| 		{
|    | [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
|5701|5701| 				{
|5702|5702| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5703|5703| 					var targetClasses = this.order.data.targetClasses;
|5704|    |-					if (targetClasses.attack && cmpIdentity
|5705|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5704|+					if (targetClasses.attack && cmpIdentity &&
|    |5705|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5706|5706| 						continue;
|5707|5707| 					if (targetClasses.avoid && cmpIdentity
|5708|5708| 						&& 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
|5704|5704| 					if (targetClasses.attack && cmpIdentity
|5705|5705| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5706|5706| 						continue;
|5707|    |-					if (targetClasses.avoid && cmpIdentity
|5708|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5707|+					if (targetClasses.avoid && cmpIdentity &&
|    |5708|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5709|5709| 						continue;
|5710|5710| 					// Only used by the AIs to prevent some choices of targets
|5711|5711| 					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
|5727|5727| 		{
|5728|5728| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5729|5729| 			var targetClasses = this.order.data.targetClasses;
|5730|    |-			if (cmpIdentity && targetClasses.attack
|5731|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5730|+			if (cmpIdentity && targetClasses.attack &&
|    |5731|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5732|5732| 				continue;
|5733|5733| 			if (cmpIdentity && targetClasses.avoid
|5734|5734| 				&& 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
|5730|5730| 			if (cmpIdentity && targetClasses.attack
|5731|5731| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5732|5732| 				continue;
|5733|    |-			if (cmpIdentity && targetClasses.avoid
|5734|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5733|+			if (cmpIdentity && targetClasses.avoid &&
|    |5734|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5735|5735| 				continue;
|5736|5736| 			// Only used by the AIs to prevent some choices of targets
|5737|5737| 			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
|5873|5873| 
|5874|5874| UnitAI.prototype.SetHeldPosition = function(x, z)
|5875|5875| {
|5876|    |-	this.heldPosition = {"x": x, "z": z};
|    |5876|+	this.heldPosition = { "x": x, "z": z};
|5877|5877| };
|5878|5878| 
|5879|5879| 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
|5873|5873| 
|5874|5874| UnitAI.prototype.SetHeldPosition = function(x, z)
|5875|5875| {
|5876|    |-	this.heldPosition = {"x": x, "z": z};
|    |5876|+	this.heldPosition = {"x": x, "z": z };
|5877|5877| };
|5878|5878| 
|5879|5879| 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
|5900|5900| 	return false;
|5901|5901| };
|5902|5902| 
|5903|    |-//// Helper functions ////
|    |5903|+// // Helper functions ////
|5904|5904| 
|5905|5905| /**
|5906|5906|  * 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
|5919|5919| 		return undefined;
|5920|5920| 
|5921|5921| 	return component.GetRange(type);
|5922|    |-}
|    |5922|+};
|5923|5923| 
|5924|5924| UnitAI.prototype.CanAttack = function(target)
|5925|5925| {
|    | [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
|6117|6117| 	return cmpPack && cmpPack.IsPacking();
|6118|6118| };
|6119|6119| 
|6120|    |-//// Formation specific functions ////
|    |6120|+// // Formation specific functions ////
|6121|6121| 
|6122|6122| UnitAI.prototype.IsAttackingAsFormation = function()
|6123|6123| {
|    | [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
|6122|6122| UnitAI.prototype.IsAttackingAsFormation = function()
|6123|6123| {
|6124|6124| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6125|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6126|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6125|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6126|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6127|6127| };
|6128|6128| 
|6129|6129| //// 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
|6126|6126| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6127|6127| };
|6128|6128| 
|6129|    |-//// Animal specific functions ////
|    |6129|+// // Animal specific functions ////
|6130|6130| 
|6131|6131| UnitAI.prototype.MoveRandomly = function(distance)
|6132|6132| {

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
|3923| »   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
|4779| »   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
|4794| »   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
|4840| »   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
|4863| »   »   ····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
|3061| »   »   »   »   »   this.SetAnimationVariant(this.formationAnimationVariant)
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

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

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

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

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

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

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

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

Freagarach planned changes to this revision.May 20 2020, 6:40 PM

Wait for learnings from D2662. (Oh and probably declassify, ought to be done separately if still desired.)

Freagarach updated this revision to Diff 13770.Nov 6 2020, 10:19 PM

Rebased.

ToDo: Fix tests.

Freagarach planned changes to this revision.Nov 6 2020, 10:19 PM

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

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/1767/display/redirect

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

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

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

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

Stan added inline comments.Nov 7 2020, 12:43 AM
binaries/data/mods/public/simulation/components/Heal.js
50

It would be nice to have all the members initialized here. this way we would know what is serialized. We also have to keep in mind that this makes network packages bigger.

So far I have seen

this.target
this.lastHealed
this.resyncAnimation
this.target
this.callback
this.healTimer
Freagarach added inline comments.Nov 7 2020, 7:07 AM
binaries/data/mods/public/simulation/components/Heal.js
50

Right about the lastHealed, but the rest is removed at some point. (Also notice that lastHealed is removed from UnitAI.)

243
270

Would be nice to have dynamic subscriptions ^^

binaries/data/mods/public/simulation/components/UnitAI.js
3285–3286

Del.

binaries/data/mods/public/simulation/components/tests/test_Heal.js
68

Move to where needed.

83

Adapt instead of remove.

108

How are we ever allowed to perform heal when we are not allowed? (No matching classes.)

224–253

Comment and elaborate.

Freagarach updated this revision to Diff 13773.Nov 7 2020, 8:45 AM

Fix test, clean further.

Vulcan added a comment.Nov 7 2020, 8:50 AM

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

builderr-release-macos.txt
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/liblowlevel.a(dbghelp.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/liblowlevel.a(file_stats.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/liblowlevel.a(vfs_path.o) has no symbols

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/1769/display/redirect

Freagarach added inline comments.Nov 8 2020, 8:07 AM
binaries/data/mods/public/simulation/components/Heal.js
50

That means instead of _all_ (800 + gaia) UnitAI entities having a useless this.lastHealed, only the few healers (~10 xD) have them now.

98

Should be done nonetheless.

Freagarach planned changes to this revision.Nov 13 2020, 8:36 AM

Wait for D2662 again (and fix linter obviously).