Page MenuHomeWildfire Games

Remove special Animal state.
Needs ReviewPublic

Authored by Freagarach on Feb 29 2020, 3:37 PM.

Details

Reviewers
Angen
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Trac Tickets
#5593
Summary

rP8995 (#563) introduced an ANIMAL-state from a separate AnimalAI-component.
However, why would we need such a separate state? Maybe we want GAIA human units that linger and roam (city-building mods) or we want animals to behave like humans.
This patch therefore removes that state and brings the ROAMING and FEEDING (renamed to LINGERING) under the INDIVIDUAL.IDLE-state.

Fixes #1832.

Test Plan

Discuss whether this change is good, test that animals behave as usual.

  • Slaughter a domestic animal and verify it won't move.
  • Hunt a passive animal and verify it flees.
  • Come near a lion and verify you won't live to tell the tale (also try in game and see it attacks your unit).
  • Attack a defensive entity and verify it attacks back.

Diff Detail

Repository
rP 0 A.D. Public Repository
Branch
/ps/trunk
Lint
Lint OK
SeverityLocationCodeMessage
Warningbinaries/data/mods/public/simulation/components/BuildingAI.js:142ESLintBear (indent)ESLintBear (indent)
Warningbinaries/data/mods/public/simulation/components/BuildingAI.js:143ESLintBear (indent)ESLintBear (indent)
Warningbinaries/data/mods/public/simulation/components/BuildingAI.js:171ESLintBear (indent)ESLintBear (indent)
Warningbinaries/data/mods/public/simulation/components/BuildingAI.js:172ESLintBear (indent)ESLintBear (indent)
Warningbinaries/data/mods/public/simulation/components/tests/test_UnitAI.js:121ESLintBear (quote-props)ESLintBear (quote-props)
Warningbinaries/data/mods/public/simulation/components/tests/test_UnitAI.js:122ESLintBear (quote-props)ESLintBear (quote-props)
Warningbinaries/data/mods/public/simulation/components/tests/test_UnitAI.js:126ESLintBear (quote-props)ESLintBear (quote-props)
Warningbinaries/data/mods/public/simulation/components/tests/test_UnitAI.js:129ESLintBear (quote-props)ESLintBear (quote-props)
Warningbinaries/data/mods/public/simulation/components/tests/test_UnitAI.js:130ESLintBear (brace-rules/brace-on-same-line)ESLintBear (brace-rules/brace-on-same-line)
Warningbinaries/data/mods/public/simulation/components/tests/test_UnitAI.js:130ESLintBear (no-else-return)ESLintBear (no-else-return)
Warningbinaries/data/mods/public/simulation/components/tests/test_UnitAI.js:130ESLintBear (quote-props)ESLintBear (quote-props)
Warningbinaries/data/mods/public/simulation/components/tests/test_UnitAI.js:131ESLintBear (quote-props)ESLintBear (quote-props)
Warningbinaries/data/mods/public/simulation/components/tests/test_UnitAI.js:132ESLintBear (quote-props)ESLintBear (quote-props)
Warningbinaries/data/mods/public/simulation/components/tests/test_UnitAI.js:136ESLintBear (quote-props)ESLintBear (quote-props)
Warningbinaries/data/mods/public/simulation/components/tests/test_UnitAI.js:140ESLintBear (quote-props)ESLintBear (quote-props)
Warningbinaries/data/mods/public/simulation/components/tests/test_UnitAI.js:141ESLintBear (quote-props)ESLintBear (quote-props)
Warningbinaries/data/mods/public/simulation/components/tests/test_UnitAI.js:145ESLintBear (quote-props)ESLintBear (quote-props)
Warningbinaries/data/mods/public/simulation/components/tests/test_UnitAI.js:146ESLintBear (quote-props)ESLintBear (quote-props)
Warningbinaries/data/mods/public/simulation/components/tests/test_UnitAI.js:147ESLintBear (quote-props)ESLintBear (quote-props)
Warningbinaries/data/mods/public/simulation/components/tests/test_UnitAI.js:158ESLintBear (quote-props)ESLintBear (quote-props)
Warningbinaries/data/mods/public/simulation/components/tests/test_UnitAI.js:162ESLintBear (quote-props)ESLintBear (quote-props)
Warningbinaries/data/mods/public/simulation/components/tests/test_UnitAI.js:166ESLintBear (quote-props)ESLintBear (quote-props)
Warningbinaries/data/mods/public/simulation/components/tests/test_UnitAI.js:167ESLintBear (quote-props)ESLintBear (quote-props)
Warningbinaries/data/mods/public/simulation/components/tests/test_UnitAI.js:168ESLintBear (quote-props)ESLintBear (quote-props)
Warningbinaries/data/mods/public/simulation/components/tests/test_UnitAI.js:169ESLintBear (quote-props)ESLintBear (quote-props)
Unit
No Unit Test Coverage
Build Status
Buildable 12952
Build 25482: Vulcan BuildJenkins
Build 25481: Vulcan Build (macOS)Jenkins
Build 25480: Vulcan Build (Windows)Jenkins
Build 25479: arc lint + arc unit

Event Timeline

Freagarach created this revision.Feb 29 2020, 3:37 PM
Freagarach updated this revision to Diff 11447.Feb 29 2020, 3:38 PM

Forgot to upload the right diff.

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
| 762| 762| 					this.FinishOrder();
| 763| 763| 					return;
| 764| 764| 				}
| 765|    |-				else
| 766|    |-				{
|    | 765|+				
| 767| 766| 					this.SetNextState("GARRISON.APPROACHING");
| 768| 767| 					return;
| 769|    |-				}
|    | 768|+				
| 770| 769| 			}
| 771| 770| 
| 772| 771| 			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
|1034|1034| 			},
|1035|1035| 		},
|1036|1036| 
|1037|    |-		"GARRISON":{
|    |1037|+		"GARRISON": {
|1038|1038| 			"APPROACHING": {
|1039|1039| 				"enter": function() {
|1040|1040| 					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
|2025|2025| 
|2026|2026| 				"Attacked": function(msg) {
|2027|2027| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2028|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2029|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2028|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2029|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2030|2030| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2031|2031| 				},
|2032|2032| 			},
|    | [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
|2763|2763| 					{
|2764|2764| 						// The building was already finished/fully repaired before we arrived;
|2765|2765| 						// let the ConstructionFinished handler handle this.
|2766|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2766|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2767|2767| 						return true;
|2768|2768| 					}
|2769|2769| 
|    | [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
|2763|2763| 					{
|2764|2764| 						// The building was already finished/fully repaired before we arrived;
|2765|2765| 						// let the ConstructionFinished handler handle this.
|2766|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2766|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2767|2767| 						return true;
|2768|2768| 					}
|2769|2769| 
|    | [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
|3061|3061| 				this.StopTimer();
|3062|3062| 				this.ResetAnimation();
|3063|3063| 				if (this.formationAnimationVariant)
|3064|    |-					this.SetAnimationVariant(this.formationAnimationVariant)
|    |3064|+					this.SetAnimationVariant(this.formationAnimationVariant);
|3065|3065| 				else
|3066|3066| 					this.SetDefaultAnimationVariant();
|3067|3067| 				var cmpResistance = Engine.QueryInterface(this.entity, IID_Resistance);
|    | [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
|3299|3299| 
|3300|3300| UnitAI.prototype.HasNaturalBehaviour = function()
|3301|3301| {
|3302|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3302|+	return (!!this.template.NaturalBehaviour);
|3303|3303| };
|3304|3304| 
|3305|3305| UnitAI.prototype.IsAnimal = 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
|3420|3420| 		{
|3421|3421| 			let index = this.GetCurrentState().indexOf(".");
|3422|3422| 			if (index != -1)
|3423|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3423|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3424|3424| 			this.Stop(false);
|3425|3425| 		}
|3426|3426| 
|    | [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
|3476|3476| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3477|3477| 			continue;
|3478|3478| 		if (i == 0)
|3479|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3479|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3480|3480| 		else
|3481|3481| 			this.orderQueue.splice(i, 1);
|3482|3482| 		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
|3476|3476| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3477|3477| 			continue;
|3478|3478| 		if (i == 0)
|3479|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3479|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3480|3480| 		else
|3481|3481| 			this.orderQueue.splice(i, 1);
|3482|3482| 		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
|3563|3563| };
|3564|3564| 
|3565|3565| 
|3566|    |-//// FSM linkage functions ////
|    |3566|+// // FSM linkage functions ////
|3567|3567| 
|3568|3568| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3569|3569| 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
|3734|3734| 				continue;
|3735|3735| 			if (this.orderQueue[i].type == type)
|3736|3736| 				continue;
|3737|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3737|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3738|3738| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3739|3739| 			return;
|3740|3740| 		}
|    | [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
|3734|3734| 				continue;
|3735|3735| 			if (this.orderQueue[i].type == type)
|3736|3736| 				continue;
|3737|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3737|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3738|3738| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3739|3739| 			return;
|3740|3740| 		}
|    | [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
|3979|3979| 	if (data.timerRepeat === undefined)
|3980|3980| 		this.timer = undefined;
|3981|3981| 
|3982|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3982|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3983|3983| };
|3984|3984| 
|3985|3985| /**
|    | [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
|3979|3979| 	if (data.timerRepeat === undefined)
|3980|3980| 		this.timer = undefined;
|3981|3981| 
|3982|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3982|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3983|3983| };
|3984|3984| 
|3985|3985| /**
|    | [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
|4024|4024| 	// TODO: This is a bit inefficient since every unit listens to every
|4025|4025| 	// construction message - ideally we could scope it to only the one we're building
|4026|4026| 
|4027|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4027|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4028|4028| };
|4029|4029| 
|4030|4030| 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
|4024|4024| 	// TODO: This is a bit inefficient since every unit listens to every
|4025|4025| 	// construction message - ideally we could scope it to only the one we're building
|4026|4026| 
|4027|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4027|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4028|4028| };
|4029|4029| 
|4030|4030| 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
|4055|4055| 	if (msg.fromStatusEffect)
|4056|4056| 		return;
|4057|4057| 
|4058|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4058|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4059|4059| };
|4060|4060| 
|4061|4061| 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
|4055|4055| 	if (msg.fromStatusEffect)
|4056|4056| 		return;
|4057|4057| 
|4058|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4058|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4059|4059| };
|4060|4060| 
|4061|4061| 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
|4060|4060| 
|4061|4061| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4062|4062| {
|4063|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4063|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4064|4064| };
|4065|4065| 
|4066|4066| 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
|4060|4060| 
|4061|4061| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4062|4062| {
|4063|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4063|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4064|4064| };
|4065|4065| 
|4066|4066| 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
|4065|4065| 
|4066|4066| UnitAI.prototype.OnHealthChanged = function(msg)
|4067|4067| {
|4068|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4068|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4069|4069| };
|4070|4070| 
|4071|4071| 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
|4065|4065| 
|4066|4066| UnitAI.prototype.OnHealthChanged = function(msg)
|4067|4067| {
|4068|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4068|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4069|4069| };
|4070|4070| 
|4071|4071| 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
|4071|4071| UnitAI.prototype.OnRangeUpdate = function(msg)
|4072|4072| {
|4073|4073| 	if (msg.tag == this.losRangeQuery)
|4074|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4074|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4075|4075| 	else if (msg.tag == this.losHealRangeQuery)
|4076|4076| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4077|4077| };
|    | [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
|4071|4071| UnitAI.prototype.OnRangeUpdate = function(msg)
|4072|4072| {
|4073|4073| 	if (msg.tag == this.losRangeQuery)
|4074|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4074|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4075|4075| 	else if (msg.tag == this.losHealRangeQuery)
|4076|4076| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4077|4077| };
|    | [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
|4073|4073| 	if (msg.tag == this.losRangeQuery)
|4074|4074| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4075|4075| 	else if (msg.tag == this.losHealRangeQuery)
|4076|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4076|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4077|4077| };
|4078|4078| 
|4079|4079| 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
|4073|4073| 	if (msg.tag == this.losRangeQuery)
|4074|4074| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4075|4075| 	else if (msg.tag == this.losHealRangeQuery)
|4076|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4076|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4077|4077| };
|4078|4078| 
|4079|4079| 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
|4078|4078| 
|4079|4079| UnitAI.prototype.OnPackFinished = function(msg)
|4080|4080| {
|4081|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4081|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4082|4082| };
|4083|4083| 
|4084|4084| //// Helper functions to be called by the FSM ////
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4078|4078| 
|4079|4079| UnitAI.prototype.OnPackFinished = function(msg)
|4080|4080| {
|4081|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4081|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4082|4082| };
|4083|4083| 
|4084|4084| //// Helper functions to be called by the FSM ////
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4081|4081| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4082|4082| };
|4083|4083| 
|4084|    |-//// Helper functions to be called by the FSM ////
|    |4084|+// // Helper functions to be called by the FSM ////
|4085|4085| 
|4086|4086| UnitAI.prototype.GetWalkSpeed = function()
|4087|4087| {
|    | [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
|4747|4747| UnitAI.prototype.AttackEntityInZone = function(ents)
|4748|4748| {
|4749|4749| 	var target = ents.find(target =>
|4750|    |-		this.CanAttack(target)
|4751|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4750|+		this.CanAttack(target) &&
|    |4751|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4752|4752| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4753|4753| 	);
|4754|4754| 	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
|4748|4748| {
|4749|4749| 	var target = ents.find(target =>
|4750|4750| 		this.CanAttack(target)
|4751|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4752|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4751|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4752|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4753|4753| 	);
|4754|4754| 	if (!target)
|4755|4755| 		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
|4812|4812| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4813|4813| 	if (this.isGuardOf)
|4814|4814| 	{
|4815|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4815|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4816|4816| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4817|4817| 		if (cmpUnitAI && cmpAttack &&
|4818|4818| 		    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
|4816|4816| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4817|4817| 		if (cmpUnitAI && cmpAttack &&
|4818|4818| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4819|    |-				return false;
|    |4819|+			return false;
|4820|4820| 	}
|4821|4821| 
|4822|4822| 	// 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
|4854|4854| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4855|4855| 	if (this.isGuardOf)
|4856|4856| 	{
|4857|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4857|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4858|4858| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4859|4859| 		if (cmpUnitAI && cmpAttack &&
|4860|4860| 		    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
|4867|4867| 	return false;
|4868|4868| };
|4869|4869| 
|4870|    |-//// External interface functions ////
|    |4870|+// // External interface functions ////
|4871|4871| 
|4872|4872| UnitAI.prototype.SetFormationController = function(ent)
|4873|4873| {
|    | [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
|5023|5023| 	{
|5024|5024| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5025|5025| 			return;
|5026|    |-		else
|5027|    |-			this.RemoveGuard();
|    |5026|+		this.RemoveGuard();
|5028|5027| 	}
|5029|5028| 
|5030|5029| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|    | [NORMAL] ESLintBear (no-trailing-spaces):
|    | Trailing spaces not allowed.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5365|5365| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5366|5366| 	{
|5367|5367| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5368|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5368|+		if (cmpTrader.HasBothMarkets() &&
|5369|5369| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5370|5370| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5371|5371| 		{
|    | [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
|5646|5646| 				{
|5647|5647| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5648|5648| 					var targetClasses = this.order.data.targetClasses;
|5649|    |-					if (targetClasses.attack && cmpIdentity
|5650|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5649|+					if (targetClasses.attack && cmpIdentity &&
|    |5650|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5651|5651| 						continue;
|5652|5652| 					if (targetClasses.avoid && cmpIdentity
|5653|5653| 						&& 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
|5649|5649| 					if (targetClasses.attack && cmpIdentity
|5650|5650| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5651|5651| 						continue;
|5652|    |-					if (targetClasses.avoid && cmpIdentity
|5653|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5652|+					if (targetClasses.avoid && cmpIdentity &&
|    |5653|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5654|5654| 						continue;
|5655|5655| 					// Only used by the AIs to prevent some choices of targets
|5656|5656| 					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
|5672|5672| 		{
|5673|5673| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5674|5674| 			var targetClasses = this.order.data.targetClasses;
|5675|    |-			if (cmpIdentity && targetClasses.attack
|5676|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5675|+			if (cmpIdentity && targetClasses.attack &&
|    |5676|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5677|5677| 				continue;
|5678|5678| 			if (cmpIdentity && targetClasses.avoid
|5679|5679| 				&& 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
|5675|5675| 			if (cmpIdentity && targetClasses.attack
|5676|5676| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5677|5677| 				continue;
|5678|    |-			if (cmpIdentity && targetClasses.avoid
|5679|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5678|+			if (cmpIdentity && targetClasses.avoid &&
|    |5679|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5680|5680| 				continue;
|5681|5681| 			// Only used by the AIs to prevent some choices of targets
|5682|5682| 			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
|5818|5818| 
|5819|5819| UnitAI.prototype.SetHeldPosition = function(x, z)
|5820|5820| {
|5821|    |-	this.heldPosition = {"x": x, "z": z};
|    |5821|+	this.heldPosition = { "x": x, "z": z};
|5822|5822| };
|5823|5823| 
|5824|5824| 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
|5818|5818| 
|5819|5819| UnitAI.prototype.SetHeldPosition = function(x, z)
|5820|5820| {
|5821|    |-	this.heldPosition = {"x": x, "z": z};
|    |5821|+	this.heldPosition = {"x": x, "z": z };
|5822|5822| };
|5823|5823| 
|5824|5824| 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
|5845|5845| 	return false;
|5846|5846| };
|5847|5847| 
|5848|    |-//// Helper functions ////
|    |5848|+// // Helper functions ////
|5849|5849| 
|5850|5850| /**
|5851|5851|  * 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
|5864|5864| 		return undefined;
|5865|5865| 
|5866|5866| 	return component.GetRange(type);
|5867|    |-}
|    |5867|+};
|5868|5868| 
|5869|5869| UnitAI.prototype.CanAttack = function(target)
|5870|5870| {
|    | [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
|6062|6062| 	return cmpPack && cmpPack.IsPacking();
|6063|6063| };
|6064|6064| 
|6065|    |-//// Formation specific functions ////
|    |6065|+// // Formation specific functions ////
|6066|6066| 
|6067|6067| UnitAI.prototype.IsAttackingAsFormation = function()
|6068|6068| {
|    | [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
|6067|6067| UnitAI.prototype.IsAttackingAsFormation = function()
|6068|6068| {
|6069|6069| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6070|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6071|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6070|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6071|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6072|6072| };
|6073|6073| 
|6074|6074| //// 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
|6071|6071| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6072|6072| };
|6073|6073| 
|6074|    |-//// Animal specific functions ////
|    |6074|+// // Animal specific functions ////
|6075|6075| 
|6076|6076| UnitAI.prototype.MoveRandomly = function(distance)
|6077|6077| {

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|3884| »   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
|4734| »   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
|4749| »   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
|4795| »   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
|4818| »   »   ····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
|2029| »   »   »   »   »   »   &&·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
|3064| »   »   »   »   »   this.SetAnimationVariant(this.formationAnimationVariant)
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4751| »   »   &&·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
|4752| »   »   &&·(this.GetStance().respondChaseBeyondVision·||·this.CheckTargetIsInVisionRange(target))
|    | [NORMAL] JSHintBear:
|    | Misleading line break before '&&'; readers may interpret this as an expression boundary.

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

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

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

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

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

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

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (no-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
| 751| 751| 					this.FinishOrder();
| 752| 752| 					return;
| 753| 753| 				}
| 754|    |-				else
| 755|    |-				{
|    | 754|+				
| 756| 755| 					this.SetNextState("GARRISON.APPROACHING");
| 757| 756| 					return;
| 758|    |-				}
|    | 757|+				
| 759| 758| 			}
| 760| 759| 
| 761| 760| 			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
|1023|1023| 			},
|1024|1024| 		},
|1025|1025| 
|1026|    |-		"GARRISON":{
|    |1026|+		"GARRISON": {
|1027|1027| 			"APPROACHING": {
|1028|1028| 				"enter": function() {
|1029|1029| 					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
|2014|2014| 
|2015|2015| 				"Attacked": function(msg) {
|2016|2016| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2017|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2018|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2017|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2018|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2019|2019| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2020|2020| 				},
|2021|2021| 			},
|    | [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
|2752|2752| 					{
|2753|2753| 						// The building was already finished/fully repaired before we arrived;
|2754|2754| 						// let the ConstructionFinished handler handle this.
|2755|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2755|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2756|2756| 						return true;
|2757|2757| 					}
|2758|2758| 
|    | [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
|2752|2752| 					{
|2753|2753| 						// The building was already finished/fully repaired before we arrived;
|2754|2754| 						// let the ConstructionFinished handler handle this.
|2755|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2755|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2756|2756| 						return true;
|2757|2757| 					}
|2758|2758| 
|    | [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
|3050|3050| 				this.StopTimer();
|3051|3051| 				this.ResetAnimation();
|3052|3052| 				if (this.formationAnimationVariant)
|3053|    |-					this.SetAnimationVariant(this.formationAnimationVariant)
|    |3053|+					this.SetAnimationVariant(this.formationAnimationVariant);
|3054|3054| 				else
|3055|3055| 					this.SetDefaultAnimationVariant();
|3056|3056| 				var cmpResistance = Engine.QueryInterface(this.entity, IID_Resistance);
|    | [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
|3288|3288| 
|3289|3289| UnitAI.prototype.HasNaturalBehaviour = function()
|3290|3290| {
|3291|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3291|+	return (!!this.template.NaturalBehaviour);
|3292|3292| };
|3293|3293| 
|3294|3294| UnitAI.prototype.IsAnimal = 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
|3409|3409| 		{
|3410|3410| 			let index = this.GetCurrentState().indexOf(".");
|3411|3411| 			if (index != -1)
|3412|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3412|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3413|3413| 			this.Stop(false);
|3414|3414| 		}
|3415|3415| 
|    | [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
|3465|3465| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3466|3466| 			continue;
|3467|3467| 		if (i == 0)
|3468|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3468|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3469|3469| 		else
|3470|3470| 			this.orderQueue.splice(i, 1);
|3471|3471| 		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
|3465|3465| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3466|3466| 			continue;
|3467|3467| 		if (i == 0)
|3468|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3468|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3469|3469| 		else
|3470|3470| 			this.orderQueue.splice(i, 1);
|3471|3471| 		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
|3552|3552| };
|3553|3553| 
|3554|3554| 
|3555|    |-//// FSM linkage functions ////
|    |3555|+// // FSM linkage functions ////
|3556|3556| 
|3557|3557| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3558|3558| 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
|3723|3723| 				continue;
|3724|3724| 			if (this.orderQueue[i].type == type)
|3725|3725| 				continue;
|3726|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3726|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3727|3727| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3728|3728| 			return;
|3729|3729| 		}
|    | [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
|3723|3723| 				continue;
|3724|3724| 			if (this.orderQueue[i].type == type)
|3725|3725| 				continue;
|3726|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3726|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3727|3727| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3728|3728| 			return;
|3729|3729| 		}
|    | [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
|3968|3968| 	if (data.timerRepeat === undefined)
|3969|3969| 		this.timer = undefined;
|3970|3970| 
|3971|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3971|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3972|3972| };
|3973|3973| 
|3974|3974| /**
|    | [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
|3968|3968| 	if (data.timerRepeat === undefined)
|3969|3969| 		this.timer = undefined;
|3970|3970| 
|3971|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3971|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3972|3972| };
|3973|3973| 
|3974|3974| /**
|    | [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
|4013|4013| 	// TODO: This is a bit inefficient since every unit listens to every
|4014|4014| 	// construction message - ideally we could scope it to only the one we're building
|4015|4015| 
|4016|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4016|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4017|4017| };
|4018|4018| 
|4019|4019| 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
|4013|4013| 	// TODO: This is a bit inefficient since every unit listens to every
|4014|4014| 	// construction message - ideally we could scope it to only the one we're building
|4015|4015| 
|4016|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4016|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4017|4017| };
|4018|4018| 
|4019|4019| 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
|4044|4044| 	if (msg.fromStatusEffect)
|4045|4045| 		return;
|4046|4046| 
|4047|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4047|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4048|4048| };
|4049|4049| 
|4050|4050| 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
|4044|4044| 	if (msg.fromStatusEffect)
|4045|4045| 		return;
|4046|4046| 
|4047|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4047|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4048|4048| };
|4049|4049| 
|4050|4050| 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
|4049|4049| 
|4050|4050| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4051|4051| {
|4052|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4052|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4053|4053| };
|4054|4054| 
|4055|4055| 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
|4049|4049| 
|4050|4050| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4051|4051| {
|4052|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4052|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4053|4053| };
|4054|4054| 
|4055|4055| 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
|4054|4054| 
|4055|4055| UnitAI.prototype.OnHealthChanged = function(msg)
|4056|4056| {
|4057|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4057|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4058|4058| };
|4059|4059| 
|4060|4060| 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
|4054|4054| 
|4055|4055| UnitAI.prototype.OnHealthChanged = function(msg)
|4056|4056| {
|4057|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4057|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4058|4058| };
|4059|4059| 
|4060|4060| 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
|4060|4060| UnitAI.prototype.OnRangeUpdate = function(msg)
|4061|4061| {
|4062|4062| 	if (msg.tag == this.losRangeQuery)
|4063|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4063|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4064|4064| 	else if (msg.tag == this.losHealRangeQuery)
|4065|4065| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4066|4066| };
|    | [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
|4060|4060| UnitAI.prototype.OnRangeUpdate = function(msg)
|4061|4061| {
|4062|4062| 	if (msg.tag == this.losRangeQuery)
|4063|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4063|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4064|4064| 	else if (msg.tag == this.losHealRangeQuery)
|4065|4065| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4066|4066| };
|    | [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
|4062|4062| 	if (msg.tag == this.losRangeQuery)
|4063|4063| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4064|4064| 	else if (msg.tag == this.losHealRangeQuery)
|4065|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4065|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4066|4066| };
|4067|4067| 
|4068|4068| 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
|4062|4062| 	if (msg.tag == this.losRangeQuery)
|4063|4063| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4064|4064| 	else if (msg.tag == this.losHealRangeQuery)
|4065|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4065|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4066|4066| };
|4067|4067| 
|4068|4068| 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
|4067|4067| 
|4068|4068| UnitAI.prototype.OnPackFinished = function(msg)
|4069|4069| {
|4070|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4070|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4071|4071| };
|4072|4072| 
|4073|4073| //// Helper functions to be called by the FSM ////
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4067|4067| 
|4068|4068| UnitAI.prototype.OnPackFinished = function(msg)
|4069|4069| {
|4070|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4070|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4071|4071| };
|4072|4072| 
|4073|4073| //// Helper functions to be called by the FSM ////
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4070|4070| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4071|4071| };
|4072|4072| 
|4073|    |-//// Helper functions to be called by the FSM ////
|    |4073|+// // Helper functions to be called by the FSM ////
|4074|4074| 
|4075|4075| UnitAI.prototype.GetWalkSpeed = function()
|4076|4076| {
|    | [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
|4736|4736| UnitAI.prototype.AttackEntityInZone = function(ents)
|4737|4737| {
|4738|4738| 	var target = ents.find(target =>
|4739|    |-		this.CanAttack(target)
|4740|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4739|+		this.CanAttack(target) &&
|    |4740|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4741|4741| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4742|4742| 	);
|4743|4743| 	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
|4737|4737| {
|4738|4738| 	var target = ents.find(target =>
|4739|4739| 		this.CanAttack(target)
|4740|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4741|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4740|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4741|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4742|4742| 	);
|4743|4743| 	if (!target)
|4744|4744| 		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
|4801|4801| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4802|4802| 	if (this.isGuardOf)
|4803|4803| 	{
|4804|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4804|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4805|4805| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4806|4806| 		if (cmpUnitAI && cmpAttack &&
|4807|4807| 		    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
|4805|4805| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4806|4806| 		if (cmpUnitAI && cmpAttack &&
|4807|4807| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4808|    |-				return false;
|    |4808|+			return false;
|4809|4809| 	}
|4810|4810| 
|4811|4811| 	// 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
|4843|4843| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4844|4844| 	if (this.isGuardOf)
|4845|4845| 	{
|4846|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4846|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4847|4847| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4848|4848| 		if (cmpUnitAI && cmpAttack &&
|4849|4849| 		    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
|4856|4856| 	return false;
|4857|4857| };
|4858|4858| 
|4859|    |-//// External interface functions ////
|    |4859|+// // External interface functions ////
|4860|4860| 
|4861|4861| UnitAI.prototype.SetFormationController = function(ent)
|4862|4862| {
|    | [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
|5012|5012| 	{
|5013|5013| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5014|5014| 			return;
|5015|    |-		else
|5016|    |-			this.RemoveGuard();
|    |5015|+		this.RemoveGuard();
|5017|5016| 	}
|5018|5017| 
|5019|5018| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|    | [NORMAL] ESLintBear (no-trailing-spaces):
|    | Trailing spaces not allowed.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5354|5354| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5355|5355| 	{
|5356|5356| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5357|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5357|+		if (cmpTrader.HasBothMarkets() &&
|5358|5358| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5359|5359| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5360|5360| 		{
|    | [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
|5635|5635| 				{
|5636|5636| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5637|5637| 					var targetClasses = this.order.data.targetClasses;
|5638|    |-					if (targetClasses.attack && cmpIdentity
|5639|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5638|+					if (targetClasses.attack && cmpIdentity &&
|    |5639|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5640|5640| 						continue;
|5641|5641| 					if (targetClasses.avoid && cmpIdentity
|5642|5642| 						&& 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
|5638|5638| 					if (targetClasses.attack && cmpIdentity
|5639|5639| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5640|5640| 						continue;
|5641|    |-					if (targetClasses.avoid && cmpIdentity
|5642|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5641|+					if (targetClasses.avoid && cmpIdentity &&
|    |5642|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5643|5643| 						continue;
|5644|5644| 					// Only used by the AIs to prevent some choices of targets
|5645|5645| 					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
|5661|5661| 		{
|5662|5662| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5663|5663| 			var targetClasses = this.order.data.targetClasses;
|5664|    |-			if (cmpIdentity && targetClasses.attack
|5665|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5664|+			if (cmpIdentity && targetClasses.attack &&
|    |5665|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5666|5666| 				continue;
|5667|5667| 			if (cmpIdentity && targetClasses.avoid
|5668|5668| 				&& 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
|5664|5664| 			if (cmpIdentity && targetClasses.attack
|5665|5665| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5666|5666| 				continue;
|5667|    |-			if (cmpIdentity && targetClasses.avoid
|5668|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5667|+			if (cmpIdentity && targetClasses.avoid &&
|    |5668|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5669|5669| 				continue;
|5670|5670| 			// Only used by the AIs to prevent some choices of targets
|5671|5671| 			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
|5807|5807| 
|5808|5808| UnitAI.prototype.SetHeldPosition = function(x, z)
|5809|5809| {
|5810|    |-	this.heldPosition = {"x": x, "z": z};
|    |5810|+	this.heldPosition = { "x": x, "z": z};
|5811|5811| };
|5812|5812| 
|5813|5813| 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
|5807|5807| 
|5808|5808| UnitAI.prototype.SetHeldPosition = function(x, z)
|5809|5809| {
|5810|    |-	this.heldPosition = {"x": x, "z": z};
|    |5810|+	this.heldPosition = {"x": x, "z": z };
|5811|5811| };
|5812|5812| 
|5813|5813| 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
|5834|5834| 	return false;
|5835|5835| };
|5836|5836| 
|5837|    |-//// Helper functions ////
|    |5837|+// // Helper functions ////
|5838|5838| 
|5839|5839| /**
|5840|5840|  * 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
|5853|5853| 		return undefined;
|5854|5854| 
|5855|5855| 	return component.GetRange(type);
|5856|    |-}
|    |5856|+};
|5857|5857| 
|5858|5858| UnitAI.prototype.CanAttack = function(target)
|5859|5859| {
|    | [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
|6051|6051| 	return cmpPack && cmpPack.IsPacking();
|6052|6052| };
|6053|6053| 
|6054|    |-//// Formation specific functions ////
|    |6054|+// // Formation specific functions ////
|6055|6055| 
|6056|6056| UnitAI.prototype.IsAttackingAsFormation = function()
|6057|6057| {
|    | [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
|6056|6056| UnitAI.prototype.IsAttackingAsFormation = function()
|6057|6057| {
|6058|6058| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6059|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6060|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6059|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6060|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6061|6061| };
|6062|6062| 
|6063|6063| //// 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
|6060|6060| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6061|6061| };
|6062|6062| 
|6063|    |-//// Animal specific functions ////
|    |6063|+// // Animal specific functions ////
|6064|6064| 
|6065|6065| UnitAI.prototype.MoveRandomly = function(distance)
|6066|6066| {

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|3873| »   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
|4723| »   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
|4738| »   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
|4784| »   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
|4807| »   »   ····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
|2018| »   »   »   »   »   »   &&·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
|3053| »   »   »   »   »   this.SetAnimationVariant(this.formationAnimationVariant)
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

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

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

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

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

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

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

Stan added a subscriber: Stan.Feb 29 2020, 3:48 PM

Keep in mind that you will need to edit all the actors with feeding variants.

Freagarach updated the Trac tickets for this revision.Apr 30 2020, 9:09 PM

Conceptually, I rather like this. I think we need to commit D1960 first though.
Needs a rebase on top of rP23710 .

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

seems a bit of a weird function tbh. I'm guessing it's part of the WIP, but don't remove animal only stuff just to add it back with an if

Freagarach planned changes to this revision.Jun 4 2020, 8:24 AM

Finalise.

Freagarach added inline comments.Jun 17 2020, 5:44 PM
binaries/data/mods/public/simulation/components/UnitAI.js
3317

Yeah, we want animals to move from foundations, but I'm not sure what a proper way of checking that would be. Perhaps just check if the entity stance is passive (if it is non-allied) and if that is true move from the foundation? Would mean lions and such would stay, which seems okay to me.
(Ideally, IMHO, Gaia would be neutral and neutral entities move.)

Freagarach updated this revision to Diff 12367.EditedJun 18 2020, 8:56 AM
Freagarach edited the summary of this revision. (Show Details)
Freagarach edited the test plan for this revision. (Show Details)

More elaborate.

  • Combined natural behaviour with genuine stances.
  • Deprecated IsAnimal() and IsDomestic().

Note a few things:

  • Lingering and roaming are under IDLE now. We are considered Idle for UnitAI if all we do is linger around.
  • The stances for animals ought to be checked, notable those who had "defensive" natural behaviour earlier, since that is not fully replicated.
  • Look for nearby targets will only attack entities which have cmpAttack.
  • I forgot to change the WillMoveFromFoundation.

Note their are a few things left to be cleaned.

Owners added a subscriber: Restricted Owners Package.Jun 18 2020, 8:56 AM
Freagarach added inline comments.Jun 18 2020, 9:07 AM
binaries/data/mods/public/simulation/components/UnitAI.js
1514

Refs. D1880.

3259

Note that in real life domestic animals would run if hurt. It is just that slaughtering is so quick they don't need to. (Hence I propose to increase slaughtering damage to kill domestic animals in one go.)

5904–5915

Notice the duplication with below. One could make this stance dependant to only attack entities with cmpAttack of neutral players. (For future reference.)

5915

Refs. rP14494.

Freagarach planned changes to this revision.Jun 18 2020, 9:40 AM
  • Fix defensive animals (perhaps an extra stance?).
  • A tad more cleanup.
Freagarach updated this revision to Diff 12377.Jun 18 2020, 4:18 PM
Freagarach marked an inline comment as done.
Freagarach edited the summary of this revision. (Show Details)
  • Some comments.
  • Also change filter in BuildingAI.

"defensive" Animals won't attack back, due to the lack of vision.
My change to the filter is wrong, since entities will now auto-attack e.g. elephants as well.

Freagarach planned changes to this revision.Jun 18 2020, 4:18 PM
Freagarach added inline comments.Jun 19 2020, 10:39 AM
binaries/data/mods/public/simulation/components/UnitAI.js
3312–3316

Is fixed by moving it.

Freagarach edited the summary of this revision. (Show Details)Jun 19 2020, 11:05 AM
Stan added inline comments.Jul 24 2020, 11:05 AM
binaries/data/mods/public/simulation/components/BuildingAI.js
191

inline ?

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

inline ? Maybe could also merge with above, although might hurt readability

5919

Why is cmpAttack not inside the attack filter function?

6333

Same ^^

Freagarach marked 4 inline comments as done.
  • Rebased.
  • Tweaked some templates.

Please note that we really need to get an idea of how we want animals to behave and the templates ought to be adjusted accordingly.

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/BuildingAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/BuildingAI.js
| 139| 139| 
| 140| 140| 	var range = cmpAttack.GetRange(attackType);
| 141| 141| 	this.enemyUnitsQuery = cmpRangeManager.CreateActiveParabolicQuery(
| 142|    |-			this.entity, range.min, range.max, range.elevationBonus,
|    | 142|+		this.entity, range.min, range.max, range.elevationBonus,
| 143| 143| 			enemies, IID_Resistance, cmpRangeManager.GetEntityFlagMask("normal"));
| 144| 144| 
| 145| 145| 	cmpRangeManager.EnableActiveQuery(this.enemyUnitsQuery);
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/BuildingAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/BuildingAI.js
| 140| 140| 	var range = cmpAttack.GetRange(attackType);
| 141| 141| 	this.enemyUnitsQuery = cmpRangeManager.CreateActiveParabolicQuery(
| 142| 142| 			this.entity, range.min, range.max, range.elevationBonus,
| 143|    |-			enemies, IID_Resistance, cmpRangeManager.GetEntityFlagMask("normal"));
|    | 143|+		enemies, IID_Resistance, cmpRangeManager.GetEntityFlagMask("normal"));
| 144| 144| 
| 145| 145| 	cmpRangeManager.EnableActiveQuery(this.enemyUnitsQuery);
| 146| 146| };
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/BuildingAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/BuildingAI.js
| 168| 168| 
| 169| 169| 	// This query is only interested in Gaia entities that can attack.
| 170| 170| 	this.gaiaUnitsQuery = cmpRangeManager.CreateActiveParabolicQuery(
| 171|    |-			this.entity, range.min, range.max, range.elevationBonus,
|    | 171|+		this.entity, range.min, range.max, range.elevationBonus,
| 172| 172| 			[0], IID_Attack, cmpRangeManager.GetEntityFlagMask("normal"));
| 173| 173| 
| 174| 174| 	cmpRangeManager.EnableActiveQuery(this.gaiaUnitsQuery);
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/BuildingAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/BuildingAI.js
| 169| 169| 	// This query is only interested in Gaia entities that can attack.
| 170| 170| 	this.gaiaUnitsQuery = cmpRangeManager.CreateActiveParabolicQuery(
| 171| 171| 			this.entity, range.min, range.max, range.elevationBonus,
| 172|    |-			[0], IID_Attack, cmpRangeManager.GetEntityFlagMask("normal"));
|    | 172|+		[0], IID_Attack, cmpRangeManager.GetEntityFlagMask("normal"));
| 173| 173| 
| 174| 174| 	cmpRangeManager.EnableActiveQuery(this.gaiaUnitsQuery);
| 175| 175| };
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'SetInterval' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 118| 118| 
| 119| 119| 
| 120| 120| 	AddMock(SYSTEM_ENTITY, IID_Timer, {
| 121|    |-		SetInterval: function() { },
|    | 121|+		"SetInterval": function() { },
| 122| 122| 		SetTimeout: function() { },
| 123| 123| 	});
| 124| 124| 
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'SetTimeout' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 119| 119| 
| 120| 120| 	AddMock(SYSTEM_ENTITY, IID_Timer, {
| 121| 121| 		SetInterval: function() { },
| 122|    |-		SetTimeout: function() { },
|    | 122|+		"SetTimeout": function() { },
| 123| 123| 	});
| 124| 124| 
| 125| 125| 	AddMock(SYSTEM_ENTITY, IID_RangeManager, {
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'CreateActiveQuery' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 123| 123| 	});
| 124| 124| 
| 125| 125| 	AddMock(SYSTEM_ENTITY, IID_RangeManager, {
| 126|    |-		CreateActiveQuery: function(ent, minRange, maxRange, players, iid, flags) {
|    | 126|+		"CreateActiveQuery": function(ent, minRange, maxRange, players, iid, flags) {
| 127| 127| 			return 1;
| 128| 128| 		},
| 129| 129| 		EnableActiveQuery: function(id) { },
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'EnableActiveQuery' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 126| 126| 		CreateActiveQuery: function(ent, minRange, maxRange, players, iid, flags) {
| 127| 127| 			return 1;
| 128| 128| 		},
| 129|    |-		EnableActiveQuery: function(id) { },
|    | 129|+		"EnableActiveQuery": function(id) { },
| 130| 130| 		ResetActiveQuery: function(id) { if (mode == 0) return []; else return [enemy]; },
| 131| 131| 		DisableActiveQuery: function(id) { },
| 132| 132| 		GetEntityFlagMask: function(identifier) { },
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'ResetActiveQuery' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 127| 127| 			return 1;
| 128| 128| 		},
| 129| 129| 		EnableActiveQuery: function(id) { },
| 130|    |-		ResetActiveQuery: function(id) { if (mode == 0) return []; else return [enemy]; },
|    | 130|+		"ResetActiveQuery": function(id) { if (mode == 0) return []; else return [enemy]; },
| 131| 131| 		DisableActiveQuery: function(id) { },
| 132| 132| 		GetEntityFlagMask: function(identifier) { },
| 133| 133| 	});
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 127| 127| 			return 1;
| 128| 128| 		},
| 129| 129| 		EnableActiveQuery: function(id) { },
| 130|    |-		ResetActiveQuery: function(id) { if (mode == 0) return []; else return [enemy]; },
|    | 130|+		ResetActiveQuery: function(id) { if (mode == 0) return []; return [enemy]; },
| 131| 131| 		DisableActiveQuery: function(id) { },
| 132| 132| 		GetEntityFlagMask: function(identifier) { },
| 133| 133| 	});
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'DisableActiveQuery' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 128| 128| 		},
| 129| 129| 		EnableActiveQuery: function(id) { },
| 130| 130| 		ResetActiveQuery: function(id) { if (mode == 0) return []; else return [enemy]; },
| 131|    |-		DisableActiveQuery: function(id) { },
|    | 131|+		"DisableActiveQuery": function(id) { },
| 132| 132| 		GetEntityFlagMask: function(identifier) { },
| 133| 133| 	});
| 134| 134| 
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'GetEntityFlagMask' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 129| 129| 		EnableActiveQuery: function(id) { },
| 130| 130| 		ResetActiveQuery: function(id) { if (mode == 0) return []; else return [enemy]; },
| 131| 131| 		DisableActiveQuery: function(id) { },
| 132|    |-		GetEntityFlagMask: function(identifier) { },
|    | 132|+		"GetEntityFlagMask": function(identifier) { },
| 133| 133| 	});
| 134| 134| 
| 135| 135| 	AddMock(SYSTEM_ENTITY, IID_TemplateManager, {
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'GetCurrentTemplateName' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 133| 133| 	});
| 134| 134| 
| 135| 135| 	AddMock(SYSTEM_ENTITY, IID_TemplateManager, {
| 136|    |-		GetCurrentTemplateName: function(ent) { return "special/formations/line_closed"; },
|    | 136|+		"GetCurrentTemplateName": function(ent) { return "special/formations/line_closed"; },
| 137| 137| 	});
| 138| 138| 
| 139| 139| 	AddMock(SYSTEM_ENTITY, IID_PlayerManager, {
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'GetPlayerByID' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 137| 137| 	});
| 138| 138| 
| 139| 139| 	AddMock(SYSTEM_ENTITY, IID_PlayerManager, {
| 140|    |-		GetPlayerByID: function(id) { return playerEntity; },
|    | 140|+		"GetPlayerByID": function(id) { return playerEntity; },
| 141| 141| 		GetNumPlayers: function() { return 2; },
| 142| 142| 	});
| 143| 143| 
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'GetNumPlayers' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 138| 138| 
| 139| 139| 	AddMock(SYSTEM_ENTITY, IID_PlayerManager, {
| 140| 140| 		GetPlayerByID: function(id) { return playerEntity; },
| 141|    |-		GetNumPlayers: function() { return 2; },
|    | 141|+		"GetNumPlayers": function() { return 2; },
| 142| 142| 	});
| 143| 143| 
| 144| 144| 	AddMock(playerEntity, IID_Player, {
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'IsAlly' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 142| 142| 	});
| 143| 143| 
| 144| 144| 	AddMock(playerEntity, IID_Player, {
| 145|    |-		IsAlly: function() { return false; },
|    | 145|+		"IsAlly": function() { return false; },
| 146| 146| 		IsEnemy: function() { return true; },
| 147| 147| 		GetEnemies: function() { return [2]; },
| 148| 148| 	});
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'IsEnemy' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 143| 143| 
| 144| 144| 	AddMock(playerEntity, IID_Player, {
| 145| 145| 		IsAlly: function() { return false; },
| 146|    |-		IsEnemy: function() { return true; },
|    | 146|+		"IsEnemy": function() { return true; },
| 147| 147| 		GetEnemies: function() { return [2]; },
| 148| 148| 	});
| 149| 149| 
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'GetEnemies' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 144| 144| 	AddMock(playerEntity, IID_Player, {
| 145| 145| 		IsAlly: function() { return false; },
| 146| 146| 		IsEnemy: function() { return true; },
| 147|    |-		GetEnemies: function() { return [2]; },
|    | 147|+		"GetEnemies": function() { return [2]; },
| 148| 148| 	});
| 149| 149| 
| 150| 150| 	AddMock(SYSTEM_ENTITY, IID_ObstructionManager, {
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'GetClassesList' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 155| 155| 	var unitAI = ConstructComponent(unit, "UnitAI", { "FormationController": "false", "DefaultStance": "aggressive" });
| 156| 156| 
| 157| 157| 	AddMock(unit, IID_Identity, {
| 158|    |-		GetClassesList: function() { return []; },
|    | 158|+		"GetClassesList": function() { return []; },
| 159| 159| 	});
| 160| 160| 
| 161| 161| 	AddMock(unit, IID_Ownership, {
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'GetOwner' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 159| 159| 	});
| 160| 160| 
| 161| 161| 	AddMock(unit, IID_Ownership, {
| 162|    |-		GetOwner: function() { return 1; },
|    | 162|+		"GetOwner": function() { return 1; },
| 163| 163| 	});
| 164| 164| 
| 165| 165| 	AddMock(unit, IID_Position, {
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'GetTurretParent' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 163| 163| 	});
| 164| 164| 
| 165| 165| 	AddMock(unit, IID_Position, {
| 166|    |-		GetTurretParent: function() { return INVALID_ENTITY; },
|    | 166|+		"GetTurretParent": function() { return INVALID_ENTITY; },
| 167| 167| 		GetPosition: function() { return new Vector3D(); },
| 168| 168| 		GetPosition2D: function() { return new Vector2D(); },
| 169| 169| 		GetRotation: function() { return { "y": 0 }; },
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'GetPosition' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 164| 164| 
| 165| 165| 	AddMock(unit, IID_Position, {
| 166| 166| 		GetTurretParent: function() { return INVALID_ENTITY; },
| 167|    |-		GetPosition: function() { return new Vector3D(); },
|    | 167|+		"GetPosition": function() { return new Vector3D(); },
| 168| 168| 		GetPosition2D: function() { return new Vector2D(); },
| 169| 169| 		GetRotation: function() { return { "y": 0 }; },
| 170| 170| 		IsInWorld: function() { return true; },
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'GetPosition2D' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 165| 165| 	AddMock(unit, IID_Position, {
| 166| 166| 		GetTurretParent: function() { return INVALID_ENTITY; },
| 167| 167| 		GetPosition: function() { return new Vector3D(); },
| 168|    |-		GetPosition2D: function() { return new Vector2D(); },
|    | 168|+		"GetPosition2D": function() { return new Vector2D(); },
| 169| 169| 		GetRotation: function() { return { "y": 0 }; },
| 170| 170| 		IsInWorld: function() { return true; },
| 171| 171| 	});
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'GetRotation' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 166| 166| 		GetTurretParent: function() { return INVALID_ENTITY; },
| 167| 167| 		GetPosition: function() { return new Vector3D(); },
| 168| 168| 		GetPosition2D: function() { return new Vector2D(); },
| 169|    |-		GetRotation: function() { return { "y": 0 }; },
|    | 169|+		"GetRotation": function() { return { "y": 0 }; },
| 170| 170| 		IsInWorld: function() { return true; },
| 171| 171| 	});
| 172| 172| 
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'IsInWorld' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 167| 167| 		GetPosition: function() { return new Vector3D(); },
| 168| 168| 		GetPosition2D: function() { return new Vector2D(); },
| 169| 169| 		GetRotation: function() { return { "y": 0 }; },
| 170|    |-		IsInWorld: function() { return true; },
|    | 170|+		"IsInWorld": function() { return true; },
| 171| 171| 	});
| 172| 172| 
| 173| 173| 	AddMock(unit, IID_UnitMotion, {
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'GetRange' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 181| 181| 	});
| 182| 182| 
| 183| 183| 	AddMock(unit, IID_Vision, {
| 184|    |-		GetRange: function() { return 10; },
|    | 184|+		"GetRange": function() { return 10; },
| 185| 185| 	});
| 186| 186| 
| 187| 187| 	AddMock(unit, IID_Attack, {
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'GetRange' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 185| 185| 	});
| 186| 186| 
| 187| 187| 	AddMock(unit, IID_Attack, {
| 188|    |-		GetRange: function() { return { "max": 10, "min": 0}; },
|    | 188|+		"GetRange": function() { return { "max": 10, "min": 0}; },
| 189| 189| 		GetFullAttackRange: function() { return { "max": 40, "min": 0}; },
| 190| 190| 		GetBestAttackAgainst: function(t) { return "melee"; },
| 191| 191| 		GetPreference: function(t) { return 0; },
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 185| 185| 	});
| 186| 186| 
| 187| 187| 	AddMock(unit, IID_Attack, {
| 188|    |-		GetRange: function() { return { "max": 10, "min": 0}; },
|    | 188|+		GetRange: function() { return { "max": 10, "min": 0 }; },
| 189| 189| 		GetFullAttackRange: function() { return { "max": 40, "min": 0}; },
| 190| 190| 		GetBestAttackAgainst: function(t) { return "melee"; },
| 191| 191| 		GetPreference: function(t) { return 0; },
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'GetFullAttackRange' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 186| 186| 
| 187| 187| 	AddMock(unit, IID_Attack, {
| 188| 188| 		GetRange: function() { return { "max": 10, "min": 0}; },
| 189|    |-		GetFullAttackRange: function() { return { "max": 40, "min": 0}; },
|    | 189|+		"GetFullAttackRange": function() { return { "max": 40, "min": 0}; },
| 190| 190| 		GetBestAttackAgainst: function(t) { return "melee"; },
| 191| 191| 		GetPreference: function(t) { return 0; },
| 192| 192| 		GetTimers: function() { return { "prepare": 500, "repeat": 1000 }; },
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 186| 186| 
| 187| 187| 	AddMock(unit, IID_Attack, {
| 188| 188| 		GetRange: function() { return { "max": 10, "min": 0}; },
| 189|    |-		GetFullAttackRange: function() { return { "max": 40, "min": 0}; },
|    | 189|+		GetFullAttackRange: function() { return { "max": 40, "min": 0 }; },
| 190| 190| 		GetBestAttackAgainst: function(t) { return "melee"; },
| 191| 191| 		GetPreference: function(t) { return 0; },
| 192| 192| 		GetTimers: function() { return { "prepare": 500, "repeat": 1000 }; },
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'GetBestAttackAgainst' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 187| 187| 	AddMock(unit, IID_Attack, {
| 188| 188| 		GetRange: function() { return { "max": 10, "min": 0}; },
| 189| 189| 		GetFullAttackRange: function() { return { "max": 40, "min": 0}; },
| 190|    |-		GetBestAttackAgainst: function(t) { return "melee"; },
|    | 190|+		"GetBestAttackAgainst": function(t) { return "melee"; },
| 191| 191| 		GetPreference: function(t) { return 0; },
| 192| 192| 		GetTimers: function() { return { "prepare": 500, "repeat": 1000 }; },
| 193| 193| 		CanAttack: function(v) { return true; },
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'GetPreference' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 188| 188| 		GetRange: function() { return { "max": 10, "min": 0}; },
| 189| 189| 		GetFullAttackRange: function() { return { "max": 40, "min": 0}; },
| 190| 190| 		GetBestAttackAgainst: function(t) { return "melee"; },
| 191|    |-		GetPreference: function(t) { return 0; },
|    | 191|+		"GetPreference": function(t) { return 0; },
| 192| 192| 		GetTimers: function() { return { "prepare": 500, "repeat": 1000 }; },
| 193| 193| 		CanAttack: function(v) { return true; },
| 194| 194| 		CompareEntitiesByPreference: function(a, b) { return 0; },
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'GetTimers' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 189| 189| 		GetFullAttackRange: function() { return { "max": 40, "min": 0}; },
| 190| 190| 		GetBestAttackAgainst: function(t) { return "melee"; },
| 191| 191| 		GetPreference: function(t) { return 0; },
| 192|    |-		GetTimers: function() { return { "prepare": 500, "repeat": 1000 }; },
|    | 192|+		"GetTimers": function() { return { "prepare": 500, "repeat": 1000 }; },
| 193| 193| 		CanAttack: function(v) { return true; },
| 194| 194| 		CompareEntitiesByPreference: function(a, b) { return 0; },
| 195| 195| 	});
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'CanAttack' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 190| 190| 		GetBestAttackAgainst: function(t) { return "melee"; },
| 191| 191| 		GetPreference: function(t) { return 0; },
| 192| 192| 		GetTimers: function() { return { "prepare": 500, "repeat": 1000 }; },
| 193|    |-		CanAttack: function(v) { return true; },
|    | 193|+		"CanAttack": function(v) { return true; },
| 194| 194| 		CompareEntitiesByPreference: function(a, b) { return 0; },
| 195| 195| 	});
| 196| 196| 
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'CompareEntitiesByPreference' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 191| 191| 		GetPreference: function(t) { return 0; },
| 192| 192| 		GetTimers: function() { return { "prepare": 500, "repeat": 1000 }; },
| 193| 193| 		CanAttack: function(v) { return true; },
| 194|    |-		CompareEntitiesByPreference: function(a, b) { return 0; },
|    | 194|+		"CompareEntitiesByPreference": function(a, b) { return 0; },
| 195| 195| 	});
| 196| 196| 
| 197| 197| 	unitAI.OnCreate();
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'GetHitpoints' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 202| 202| 	if (mode == 1)
| 203| 203| 	{
| 204| 204| 		AddMock(enemy, IID_Health, {
| 205|    |-			GetHitpoints: function() { return 10; },
|    | 205|+			"GetHitpoints": function() { return 10; },
| 206| 206| 		});
| 207| 207| 		AddMock(enemy, IID_Attack, {});
| 208| 208| 		AddMock(enemy, IID_UnitAI, {
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 206| 206| 		});
| 207| 207| 		AddMock(enemy, IID_Attack, {});
| 208| 208| 		AddMock(enemy, IID_UnitAI, {
| 209|    |-			"GetStance": function() { return { "targetVisibleEnemies": true } }
|    | 209|+			"GetStance": function() { return { "targetVisibleEnemies": true }; }
| 210| 210| 		});
| 211| 211| 	}
| 212| 212| 	else if (mode == 2)
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'GetHitpoints' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 211| 211| 	}
| 212| 212| 	else if (mode == 2)
| 213| 213| 		AddMock(enemy, IID_Health, {
| 214|    |-			GetHitpoints: function() { return 0; },
|    | 214|+			"GetHitpoints": function() { return 0; },
| 215| 215| 		});
| 216| 216| 
| 217| 217| 	var controllerFormation = ConstructComponent(controller, "Formation", {"FormationName": "Line Closed", "FormationShape": "square", "ShiftRows": "false", "SortingClasses": "", "WidthDepthRatio": 1, "UnitSeparationWidthMultiplier": 1, "UnitSeparationDepthMultiplier": 1, "SpeedMultiplier": 1, "Sloppyness": 0});
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 214| 214| 			GetHitpoints: function() { return 0; },
| 215| 215| 		});
| 216| 216| 
| 217|    |-	var controllerFormation = ConstructComponent(controller, "Formation", {"FormationName": "Line Closed", "FormationShape": "square", "ShiftRows": "false", "SortingClasses": "", "WidthDepthRatio": 1, "UnitSeparationWidthMultiplier": 1, "UnitSeparationDepthMultiplier": 1, "SpeedMultiplier": 1, "Sloppyness": 0});
|    | 217|+	var controllerFormation = ConstructComponent(controller, "Formation", { "FormationName": "Line Closed", "FormationShape": "square", "ShiftRows": "false", "SortingClasses": "", "WidthDepthRatio": 1, "UnitSeparationWidthMultiplier": 1, "UnitSeparationDepthMultiplier": 1, "SpeedMultiplier": 1, "Sloppyness": 0});
| 218| 218| 	var controllerAI = ConstructComponent(controller, "UnitAI", { "FormationController": "true", "DefaultStance": "aggressive" });
| 219| 219| 
| 220| 220| 	AddMock(controller, IID_Position, {
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 214| 214| 			GetHitpoints: function() { return 0; },
| 215| 215| 		});
| 216| 216| 
| 217|    |-	var controllerFormation = ConstructComponent(controller, "Formation", {"FormationName": "Line Closed", "FormationShape": "square", "ShiftRows": "false", "SortingClasses": "", "WidthDepthRatio": 1, "UnitSeparationWidthMultiplier": 1, "UnitSeparationDepthMultiplier": 1, "SpeedMultiplier": 1, "Sloppyness": 0});
|    | 217|+	var controllerFormation = ConstructComponent(controller, "Formation", {"FormationName": "Line Closed", "FormationShape": "square", "ShiftRows": "false", "SortingClasses": "", "WidthDepthRatio": 1, "UnitSeparationWidthMultiplier": 1, "UnitSeparationDepthMultiplier": 1, "SpeedMultiplier": 1, "Sloppyness": 0 });
| 218| 218| 	var controllerAI = ConstructComponent(controller, "UnitAI", { "FormationController": "true", "DefaultStance": "aggressive" });
| 219| 219| 
| 220| 220| 	AddMock(controller, IID_Position, {
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'JumpTo' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 218| 218| 	var controllerAI = ConstructComponent(controller, "UnitAI", { "FormationController": "true", "DefaultStance": "aggressive" });
| 219| 219| 
| 220| 220| 	AddMock(controller, IID_Position, {
| 221|    |-		JumpTo: function(x, z) { this.x = x; this.z = z; },
|    | 221|+		"JumpTo": function(x, z) { this.x = x; this.z = z; },
| 222| 222| 		GetTurretParent: function() { return INVALID_ENTITY; },
| 223| 223| 		GetPosition: function() { return new Vector3D(this.x, 0, this.z); },
| 224| 224| 		GetPosition2D: function() { return new Vector2D(this.x, this.z); },
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'GetTurretParent' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 219| 219| 
| 220| 220| 	AddMock(controller, IID_Position, {
| 221| 221| 		JumpTo: function(x, z) { this.x = x; this.z = z; },
| 222|    |-		GetTurretParent: function() { return INVALID_ENTITY; },
|    | 222|+		"GetTurretParent": function() { return INVALID_ENTITY; },
| 223| 223| 		GetPosition: function() { return new Vector3D(this.x, 0, this.z); },
| 224| 224| 		GetPosition2D: function() { return new Vector2D(this.x, this.z); },
| 225| 225| 		GetRotation: function() { return { "y": 0 }; },
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'GetPosition' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 220| 220| 	AddMock(controller, IID_Position, {
| 221| 221| 		JumpTo: function(x, z) { this.x = x; this.z = z; },
| 222| 222| 		GetTurretParent: function() { return INVALID_ENTITY; },
| 223|    |-		GetPosition: function() { return new Vector3D(this.x, 0, this.z); },
|    | 223|+		"GetPosition": function() { return new Vector3D(this.x, 0, this.z); },
| 224| 224| 		GetPosition2D: function() { return new Vector2D(this.x, this.z); },
| 225| 225| 		GetRotation: function() { return { "y": 0 }; },
| 226| 226| 		IsInWorld: function() { return true; },
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'GetPosition2D' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 221| 221| 		JumpTo: function(x, z) { this.x = x; this.z = z; },
| 222| 222| 		GetTurretParent: function() { return INVALID_ENTITY; },
| 223| 223| 		GetPosition: function() { return new Vector3D(this.x, 0, this.z); },
| 224|    |-		GetPosition2D: function() { return new Vector2D(this.x, this.z); },
|    | 224|+		"GetPosition2D": function() { return new Vector2D(this.x, this.z); },
| 225| 225| 		GetRotation: function() { return { "y": 0 }; },
| 226| 226| 		IsInWorld: function() { return true; },
| 227| 227| 		MoveOutOfWorld: () => {}
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'GetRotation' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 222| 222| 		GetTurretParent: function() { return INVALID_ENTITY; },
| 223| 223| 		GetPosition: function() { return new Vector3D(this.x, 0, this.z); },
| 224| 224| 		GetPosition2D: function() { return new Vector2D(this.x, this.z); },
| 225|    |-		GetRotation: function() { return { "y": 0 }; },
|    | 225|+		"GetRotation": function() { return { "y": 0 }; },
| 226| 226| 		IsInWorld: function() { return true; },
| 227| 227| 		MoveOutOfWorld: () => {}
| 228| 228| 	});
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'IsInWorld' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 223| 223| 		GetPosition: function() { return new Vector3D(this.x, 0, this.z); },
| 224| 224| 		GetPosition2D: function() { return new Vector2D(this.x, this.z); },
| 225| 225| 		GetRotation: function() { return { "y": 0 }; },
| 226|    |-		IsInWorld: function() { return true; },
|    | 226|+		"IsInWorld": function() { return true; },
| 227| 227| 		MoveOutOfWorld: () => {}
| 228| 228| 	});
| 229| 229| 
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'MoveOutOfWorld' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 224| 224| 		GetPosition2D: function() { return new Vector2D(this.x, this.z); },
| 225| 225| 		GetRotation: function() { return { "y": 0 }; },
| 226| 226| 		IsInWorld: function() { return true; },
| 227|    |-		MoveOutOfWorld: () => {}
|    | 227|+		"MoveOutOfWorld": () => {}
| 228| 228| 	});
| 229| 229| 
| 230| 230| 	AddMock(controller, IID_UnitMotion, {
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'SetInterval' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 276| 276| 	var unitAIs = [];
| 277| 277| 
| 278| 278| 	AddMock(SYSTEM_ENTITY, IID_Timer, {
| 279|    |-		SetInterval: function() { },
|    | 279|+		"SetInterval": function() { },
| 280| 280| 		SetTimeout: function() { },
| 281| 281| 	});
| 282| 282| 
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'SetTimeout' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 277| 277| 
| 278| 278| 	AddMock(SYSTEM_ENTITY, IID_Timer, {
| 279| 279| 		SetInterval: function() { },
| 280|    |-		SetTimeout: function() { },
|    | 280|+		"SetTimeout": function() { },
| 281| 281| 	});
| 282| 282| 
| 283| 283| 
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'CreateActiveQuery' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 282| 282| 
| 283| 283| 
| 284| 284| 	AddMock(SYSTEM_ENTITY, IID_RangeManager, {
| 285|    |-		CreateActiveQuery: function(ent, minRange, maxRange, players, iid, flags) {
|    | 285|+		"CreateActiveQuery": function(ent, minRange, maxRange, players, iid, flags) {
| 286| 286| 			return 1;
| 287| 287| 		},
| 288| 288| 		EnableActiveQuery: function(id) { },
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'EnableActiveQuery' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 285| 285| 		CreateActiveQuery: function(ent, minRange, maxRange, players, iid, flags) {
| 286| 286| 			return 1;
| 287| 287| 		},
| 288|    |-		EnableActiveQuery: function(id) { },
|    | 288|+		"EnableActiveQuery": function(id) { },
| 289| 289| 		ResetActiveQuery: function(id) { return [enemy]; },
| 290| 290| 		DisableActiveQuery: function(id) { },
| 291| 291| 		GetEntityFlagMask: function(identifier) { },
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'ResetActiveQuery' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 286| 286| 			return 1;
| 287| 287| 		},
| 288| 288| 		EnableActiveQuery: function(id) { },
| 289|    |-		ResetActiveQuery: function(id) { return [enemy]; },
|    | 289|+		"ResetActiveQuery": function(id) { return [enemy]; },
| 290| 290| 		DisableActiveQuery: function(id) { },
| 291| 291| 		GetEntityFlagMask: function(identifier) { },
| 292| 292| 	});
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'DisableActiveQuery' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 287| 287| 		},
| 288| 288| 		EnableActiveQuery: function(id) { },
| 289| 289| 		ResetActiveQuery: function(id) { return [enemy]; },
| 290|    |-		DisableActiveQuery: function(id) { },
|    | 290|+		"DisableActiveQuery": function(id) { },
| 291| 291| 		GetEntityFlagMask: function(identifier) { },
| 292| 292| 	});
| 293| 293| 
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'GetEntityFlagMask' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 288| 288| 		EnableActiveQuery: function(id) { },
| 289| 289| 		ResetActiveQuery: function(id) { return [enemy]; },
| 290| 290| 		DisableActiveQuery: function(id) { },
| 291|    |-		GetEntityFlagMask: function(identifier) { },
|    | 291|+		"GetEntityFlagMask": function(identifier) { },
| 292| 292| 	});
| 293| 293| 
| 294| 294| 	AddMock(SYSTEM_ENTITY, IID_TemplateManager, {
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'GetCurrentTemplateName' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 292| 292| 	});
| 293| 293| 
| 294| 294| 	AddMock(SYSTEM_ENTITY, IID_TemplateManager, {
| 295|    |-		GetCurrentTemplateName: function(ent) { return "special/formations/line_closed"; },
|    | 295|+		"GetCurrentTemplateName": function(ent) { return "special/formations/line_closed"; },
| 296| 296| 	});
| 297| 297| 
| 298| 298| 	AddMock(SYSTEM_ENTITY, IID_PlayerManager, {
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'GetPlayerByID' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 296| 296| 	});
| 297| 297| 
| 298| 298| 	AddMock(SYSTEM_ENTITY, IID_PlayerManager, {
| 299|    |-		GetPlayerByID: function(id) { return playerEntity; },
|    | 299|+		"GetPlayerByID": function(id) { return playerEntity; },
| 300| 300| 		GetNumPlayers: function() { return 2; },
| 301| 301| 	});
| 302| 302| 
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'GetNumPlayers' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 297| 297| 
| 298| 298| 	AddMock(SYSTEM_ENTITY, IID_PlayerManager, {
| 299| 299| 		GetPlayerByID: function(id) { return playerEntity; },
| 300|    |-		GetNumPlayers: function() { return 2; },
|    | 300|+		"GetNumPlayers": function() { return 2; },
| 301| 301| 	});
| 302| 302| 
| 303| 303| 	AddMock(SYSTEM_ENTITY, IID_ObstructionManager, {
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'IsAlly' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 305| 305| 	});
| 306| 306| 
| 307| 307| 	AddMock(playerEntity, IID_Player, {
| 308|    |-		IsAlly: function() { return false; },
|    | 308|+		"IsAlly": function() { return false; },
| 309| 309| 		IsEnemy: function() { return true; },
| 310| 310| 		GetEnemies: function() { return [2]; },
| 311| 311| 	});
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'IsEnemy' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 306| 306| 
| 307| 307| 	AddMock(playerEntity, IID_Player, {
| 308| 308| 		IsAlly: function() { return false; },
| 309|    |-		IsEnemy: function() { return true; },
|    | 309|+		"IsEnemy": function() { return true; },
| 310| 310| 		GetEnemies: function() { return [2]; },
| 311| 311| 	});
| 312| 312| 
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'GetEnemies' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 307| 307| 	AddMock(playerEntity, IID_Player, {
| 308| 308| 		IsAlly: function() { return false; },
| 309| 309| 		IsEnemy: function() { return true; },
| 310|    |-		GetEnemies: function() { return [2]; },
|    | 310|+		"GetEnemies": function() { return [2]; },
| 311| 311| 	});
| 312| 312| 
| 313| 313| 	// create units
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'GetClassesList' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 318| 318| 		var unitAI = ConstructComponent(unit + i, "UnitAI", { "FormationController": "false", "DefaultStance": "aggressive" });
| 319| 319| 
| 320| 320| 		AddMock(unit + i, IID_Identity, {
| 321|    |-			GetClassesList: function() { return []; },
|    | 321|+			"GetClassesList": function() { return []; },
| 322| 322| 		});
| 323| 323| 
| 324| 324| 		AddMock(unit + i, IID_Ownership, {
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'GetOwner' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 322| 322| 		});
| 323| 323| 
| 324| 324| 		AddMock(unit + i, IID_Ownership, {
| 325|    |-			GetOwner: function() { return 1; },
|    | 325|+			"GetOwner": function() { return 1; },
| 326| 326| 		});
| 327| 327| 
| 328| 328| 		AddMock(unit + i, IID_Position, {
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'GetTurretParent' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 326| 326| 		});
| 327| 327| 
| 328| 328| 		AddMock(unit + i, IID_Position, {
| 329|    |-			GetTurretParent: function() { return INVALID_ENTITY; },
|    | 329|+			"GetTurretParent": function() { return INVALID_ENTITY; },
| 330| 330| 			GetPosition: function() { return new Vector3D(); },
| 331| 331| 			GetPosition2D: function() { return new Vector2D(); },
| 332| 332| 			GetRotation: function() { return { "y": 0 }; },
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'GetPosition' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 327| 327| 
| 328| 328| 		AddMock(unit + i, IID_Position, {
| 329| 329| 			GetTurretParent: function() { return INVALID_ENTITY; },
| 330|    |-			GetPosition: function() { return new Vector3D(); },
|    | 330|+			"GetPosition": function() { return new Vector3D(); },
| 331| 331| 			GetPosition2D: function() { return new Vector2D(); },
| 332| 332| 			GetRotation: function() { return { "y": 0 }; },
| 333| 333| 			IsInWorld: function() { return true; },
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'GetPosition2D' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 328| 328| 		AddMock(unit + i, IID_Position, {
| 329| 329| 			GetTurretParent: function() { return INVALID_ENTITY; },
| 330| 330| 			GetPosition: function() { return new Vector3D(); },
| 331|    |-			GetPosition2D: function() { return new Vector2D(); },
|    | 331|+			"GetPosition2D": function() { return new Vector2D(); },
| 332| 332| 			GetRotation: function() { return { "y": 0 }; },
| 333| 333| 			IsInWorld: function() { return true; },
| 334| 334| 		});
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'GetRotation' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 329| 329| 			GetTurretParent: function() { return INVALID_ENTITY; },
| 330| 330| 			GetPosition: function() { return new Vector3D(); },
| 331| 331| 			GetPosition2D: function() { return new Vector2D(); },
| 332|    |-			GetRotation: function() { return { "y": 0 }; },
|    | 332|+			"GetRotation": function() { return { "y": 0 }; },
| 333| 333| 			IsInWorld: function() { return true; },
| 334| 334| 		});
| 335| 335| 
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'IsInWorld' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 330| 330| 			GetPosition: function() { return new Vector3D(); },
| 331| 331| 			GetPosition2D: function() { return new Vector2D(); },
| 332| 332| 			GetRotation: function() { return { "y": 0 }; },
| 333|    |-			IsInWorld: function() { return true; },
|    | 333|+			"IsInWorld": function() { return true; },
| 334| 334| 		});
| 335| 335| 
| 336| 336| 		AddMock(unit + i, IID_UnitMotion, {
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'GetRange' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 344| 344| 		});
| 345| 345| 
| 346| 346| 		AddMock(unit + i, IID_Vision, {
| 347|    |-			GetRange: function() { return 10; },
|    | 347|+			"GetRange": function() { return 10; },
| 348| 348| 		});
| 349| 349| 
| 350| 350| 		AddMock(unit + i, IID_Attack, {
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'GetRange' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 348| 348| 		});
| 349| 349| 
| 350| 350| 		AddMock(unit + i, IID_Attack, {
| 351|    |-			GetRange: function() { return {"max":10, "min": 0}; },
|    | 351|+			"GetRange": function() { return {"max":10, "min": 0}; },
| 352| 352| 			GetFullAttackRange: function() { return { "max": 40, "min": 0}; },
| 353| 353| 			GetBestAttackAgainst: function(t) { return "melee"; },
| 354| 354| 			GetTimers: function() { return { "prepare": 500, "repeat": 1000 }; },
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 348| 348| 		});
| 349| 349| 
| 350| 350| 		AddMock(unit + i, IID_Attack, {
| 351|    |-			GetRange: function() { return {"max":10, "min": 0}; },
|    | 351|+			GetRange: function() { return { "max":10, "min": 0}; },
| 352| 352| 			GetFullAttackRange: function() { return { "max": 40, "min": 0}; },
| 353| 353| 			GetBestAttackAgainst: function(t) { return "melee"; },
| 354| 354| 			GetTimers: function() { return { "prepare": 500, "repeat": 1000 }; },
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'max'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 348| 348| 		});
| 349| 349| 
| 350| 350| 		AddMock(unit + i, IID_Attack, {
| 351|    |-			GetRange: function() { return {"max":10, "min": 0}; },
|    | 351|+			GetRange: function() { return {"max": 10, "min": 0}; },
| 352| 352| 			GetFullAttackRange: function() { return { "max": 40, "min": 0}; },
| 353| 353| 			GetBestAttackAgainst: function(t) { return "melee"; },
| 354| 354| 			GetTimers: function() { return { "prepare": 500, "repeat": 1000 }; },
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 348| 348| 		});
| 349| 349| 
| 350| 350| 		AddMock(unit + i, IID_Attack, {
| 351|    |-			GetRange: function() { return {"max":10, "min": 0}; },
|    | 351|+			GetRange: function() { return {"max":10, "min": 0 }; },
| 352| 352| 			GetFullAttackRange: function() { return { "max": 40, "min": 0}; },
| 353| 353| 			GetBestAttackAgainst: function(t) { return "melee"; },
| 354| 354| 			GetTimers: function() { return { "prepare": 500, "repeat": 1000 }; },
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'GetFullAttackRange' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 349| 349| 
| 350| 350| 		AddMock(unit + i, IID_Attack, {
| 351| 351| 			GetRange: function() { return {"max":10, "min": 0}; },
| 352|    |-			GetFullAttackRange: function() { return { "max": 40, "min": 0}; },
|    | 352|+			"GetFullAttackRange": function() { return { "max": 40, "min": 0}; },
| 353| 353| 			GetBestAttackAgainst: function(t) { return "melee"; },
| 354| 354| 			GetTimers: function() { return { "prepare": 500, "repeat": 1000 }; },
| 355| 355| 			CanAttack: function(v) { return true; },
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 349| 349| 
| 350| 350| 		AddMock(unit + i, IID_Attack, {
| 351| 351| 			GetRange: function() { return {"max":10, "min": 0}; },
| 352|    |-			GetFullAttackRange: function() { return { "max": 40, "min": 0}; },
|    | 352|+			GetFullAttackRange: function() { return { "max": 40, "min": 0 }; },
| 353| 353| 			GetBestAttackAgainst: function(t) { return "melee"; },
| 354| 354| 			GetTimers: function() { return { "prepare": 500, "repeat": 1000 }; },
| 355| 355| 			CanAttack: function(v) { return true; },
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'GetBestAttackAgainst' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 350| 350| 		AddMock(unit + i, IID_Attack, {
| 351| 351| 			GetRange: function() { return {"max":10, "min": 0}; },
| 352| 352| 			GetFullAttackRange: function() { return { "max": 40, "min": 0}; },
| 353|    |-			GetBestAttackAgainst: function(t) { return "melee"; },
|    | 353|+			"GetBestAttackAgainst": function(t) { return "melee"; },
| 354| 354| 			GetTimers: function() { return { "prepare": 500, "repeat": 1000 }; },
| 355| 355| 			CanAttack: function(v) { return true; },
| 356| 356| 			CompareEntitiesByPreference: function(a, b) { return 0; },
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'GetTimers' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 351| 351| 			GetRange: function() { return {"max":10, "min": 0}; },
| 352| 352| 			GetFullAttackRange: function() { return { "max": 40, "min": 0}; },
| 353| 353| 			GetBestAttackAgainst: function(t) { return "melee"; },
| 354|    |-			GetTimers: function() { return { "prepare": 500, "repeat": 1000 }; },
|    | 354|+			"GetTimers": function() { return { "prepare": 500, "repeat": 1000 }; },
| 355| 355| 			CanAttack: function(v) { return true; },
| 356| 356| 			CompareEntitiesByPreference: function(a, b) { return 0; },
| 357| 357| 		});
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'CanAttack' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 352| 352| 			GetFullAttackRange: function() { return { "max": 40, "min": 0}; },
| 353| 353| 			GetBestAttackAgainst: function(t) { return "melee"; },
| 354| 354| 			GetTimers: function() { return { "prepare": 500, "repeat": 1000 }; },
| 355|    |-			CanAttack: function(v) { return true; },
|    | 355|+			"CanAttack": function(v) { return true; },
| 356| 356| 			CompareEntitiesByPreference: function(a, b) { return 0; },
| 357| 357| 		});
| 358| 358| 
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'CompareEntitiesByPreference' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 353| 353| 			GetBestAttackAgainst: function(t) { return "melee"; },
| 354| 354| 			GetTimers: function() { return { "prepare": 500, "repeat": 1000 }; },
| 355| 355| 			CanAttack: function(v) { return true; },
| 356|    |-			CompareEntitiesByPreference: function(a, b) { return 0; },
|    | 356|+			"CompareEntitiesByPreference": function(a, b) { return 0; },
| 357| 357| 		});
| 358| 358| 
| 359| 359| 		unitAI.OnCreate();
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'GetHitpoints' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 365| 365| 
| 366| 366| 	// create enemy
| 367| 367| 	AddMock(enemy, IID_Health, {
| 368|    |-		GetHitpoints: function() { return 40; },
|    | 368|+		"GetHitpoints": function() { return 40; },
| 369| 369| 	});
| 370| 370| 
| 371| 371| 	var controllerFormation = ConstructComponent(controller, "Formation", {"FormationName": "Line Closed", "FormationShape": "square", "ShiftRows": "false", "SortingClasses": "", "WidthDepthRatio": 1, "UnitSeparationWidthMultiplier": 1, "UnitSeparationDepthMultiplier": 1, "SpeedMultiplier": 1, "Sloppyness": 0});
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 368| 368| 		GetHitpoints: function() { return 40; },
| 369| 369| 	});
| 370| 370| 
| 371|    |-	var controllerFormation = ConstructComponent(controller, "Formation", {"FormationName": "Line Closed", "FormationShape": "square", "ShiftRows": "false", "SortingClasses": "", "WidthDepthRatio": 1, "UnitSeparationWidthMultiplier": 1, "UnitSeparationDepthMultiplier": 1, "SpeedMultiplier": 1, "Sloppyness": 0});
|    | 371|+	var controllerFormation = ConstructComponent(controller, "Formation", { "FormationName": "Line Closed", "FormationShape": "square", "ShiftRows": "false", "SortingClasses": "", "WidthDepthRatio": 1, "UnitSeparationWidthMultiplier": 1, "UnitSeparationDepthMultiplier": 1, "SpeedMultiplier": 1, "Sloppyness": 0});
| 372| 372| 	var controllerAI = ConstructComponent(controller, "UnitAI", { "FormationController": "true", "DefaultStance": "aggressive" });
| 373| 373| 
| 374| 374| 	AddMock(controller, IID_Position, {
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 368| 368| 		GetHitpoints: function() { return 40; },
| 369| 369| 	});
| 370| 370| 
| 371|    |-	var controllerFormation = ConstructComponent(controller, "Formation", {"FormationName": "Line Closed", "FormationShape": "square", "ShiftRows": "false", "SortingClasses": "", "WidthDepthRatio": 1, "UnitSeparationWidthMultiplier": 1, "UnitSeparationDepthMultiplier": 1, "SpeedMultiplier": 1, "Sloppyness": 0});
|    | 371|+	var controllerFormation = ConstructComponent(controller, "Formation", {"FormationName": "Line Closed", "FormationShape": "square", "ShiftRows": "false", "SortingClasses": "", "WidthDepthRatio": 1, "UnitSeparationWidthMultiplier": 1, "UnitSeparationDepthMultiplier": 1, "SpeedMultiplier": 1, "Sloppyness": 0 });
| 372| 372| 	var controllerAI = ConstructComponent(controller, "UnitAI", { "FormationController": "true", "DefaultStance": "aggressive" });
| 373| 373| 
| 374| 374| 	AddMock(controller, IID_Position, {
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'GetRange' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 392| 392| 	});
| 393| 393| 
| 394| 394| 	AddMock(controller, IID_Attack, {
| 395|    |-		GetRange: function() { return {"max":10, "min": 0}; },
|    | 395|+		"GetRange": function() { return {"max":10, "min": 0}; },
| 396| 396| 		CanAttackAsFormation: function() { return false; },
| 397| 397| 	});
| 398| 398| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 392| 392| 	});
| 393| 393| 
| 394| 394| 	AddMock(controller, IID_Attack, {
| 395|    |-		GetRange: function() { return {"max":10, "min": 0}; },
|    | 395|+		GetRange: function() { return { "max":10, "min": 0}; },
| 396| 396| 		CanAttackAsFormation: function() { return false; },
| 397| 397| 	});
| 398| 398| 
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'max'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 392| 392| 	});
| 393| 393| 
| 394| 394| 	AddMock(controller, IID_Attack, {
| 395|    |-		GetRange: function() { return {"max":10, "min": 0}; },
|    | 395|+		GetRange: function() { return {"max": 10, "min": 0}; },
| 396| 396| 		CanAttackAsFormation: function() { return false; },
| 397| 397| 	});
| 398| 398| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 392| 392| 	});
| 393| 393| 
| 394| 394| 	AddMock(controller, IID_Attack, {
| 395|    |-		GetRange: function() { return {"max":10, "min": 0}; },
|    | 395|+		GetRange: function() { return {"max":10, "min": 0 }; },
| 396| 396| 		CanAttackAsFormation: function() { return false; },
| 397| 397| 	});
| 398| 398| 
|    | [NORMAL] ESLintBear (quote-props):
|    | Unquoted property 'CanAttackAsFormation' found.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 393| 393| 
| 394| 394| 	AddMock(controller, IID_Attack, {
| 395| 395| 		GetRange: function() { return {"max":10, "min": 0}; },
| 396|    |-		CanAttackAsFormation: function() { return false; },
|    | 396|+		"CanAttackAsFormation": function() { return false; },
| 397| 397| 	});
| 398| 398| 
| 399| 399| 	controllerAI.OnCreate();
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 405| 405| 	for (let ent of unitAIs)
| 406| 406| 		TS_ASSERT_EQUALS(unitAI.fsmStateName, "INDIVIDUAL.COMBAT.ATTACKING");
| 407| 407| 
| 408|    |-	controllerAI.MoveIntoFormation({"name": "Circle"});
|    | 408|+	controllerAI.MoveIntoFormation({ "name": "Circle"});
| 409| 409| 
| 410| 410| 	// let all units be in position
| 411| 411| 	for (let ent of unitAIs)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 405| 405| 	for (let ent of unitAIs)
| 406| 406| 		TS_ASSERT_EQUALS(unitAI.fsmStateName, "INDIVIDUAL.COMBAT.ATTACKING");
| 407| 407| 
| 408|    |-	controllerAI.MoveIntoFormation({"name": "Circle"});
|    | 408|+	controllerAI.MoveIntoFormation({"name": "Circle" });
| 409| 409| 
| 410| 410| 	// let all units be in position
| 411| 411| 	for (let ent of unitAIs)

binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 130| »   »   ResetActiveQuery:·function(id)·{·if·(mode·==·0)·return·[];·else·return·[enemy];·},
|    | [NORMAL] ESLintBear (brace-rules/brace-on-same-line):
|    | Closing curly brace appears on the same line as the subsequent block.

binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 314| »   for·(var·i·=·0;·i·<·unitCount;·i++)·{
|    | [NORMAL] ESLintBear (brace-rules/brace-on-same-line):
|    | Opening curly brace appears on the same line as controlling statement.

binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 209| »   »   »   "GetStance":·function()·{·return·{·"targetVisibleEnemies":·true·}·}
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 406| »   »   TS_ASSERT_EQUALS(unitAI.fsmStateName,·"INDIVIDUAL.COMBAT.ATTACKING");
|    | [NORMAL] JSHintBear:
|    | 'unitAI' used out of scope.

binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
| 415| »   »   TS_ASSERT_EQUALS(unitAI.fsmStateName,·"INDIVIDUAL.COMBAT.ATTACKING");
|    | [NORMAL] JSHintBear:
|    | 'unitAI' used out of scope.
|    | [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
| 791| 791| 					this.FinishOrder();
| 792| 792| 					return;
| 793| 793| 				}
| 794|    |-				else
| 795|    |-				{
|    | 794|+				
| 796| 795| 					this.SetNextState("GARRISON.APPROACHING");
| 797| 796| 					return;
| 798|    |-				}
|    | 797|+				
| 799| 798| 			}
| 800| 799| 
| 801| 800| 			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
|1055|1055| 			},
|1056|1056| 		},
|1057|1057| 
|1058|    |-		"GARRISON":{
|    |1058|+		"GARRISON": {
|1059|1059| 			"APPROACHING": {
|1060|1060| 				"enter": function() {
|1061|1061| 					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
|2090|2090| 
|2091|2091| 				"Attacked": function(msg) {
|2092|2092| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2093|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2094|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2093|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2094|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2095|2095| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2096|2096| 				},
|2097|2097| 			},
|    | [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
|2249|2249| 					"MovementUpdate": function(msg) {
|2250|2250| 						// If it looks like the path is failing, and we are close enough (3 tiles) from wanted range
|2251|2251| 						// stop anyways. This avoids pathing for an unreachable goal and reduces lag considerably.
|2252|    |-						if (msg.likelyFailure || 
|    |2252|+						if (msg.likelyFailure ||
|2253|2253| 							msg.obstructed && this.RelaxedMaxRangeCheck(this.order.data, this.order.data.max + this.DefaultRelaxedMaxRange) ||
|2254|2254| 							!msg.obstructed && this.CheckRange(this.order.data))
|2255|2255| 							this.FinishOrder();
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 7 tabs but found 6.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2552|2552| 
|2553|2553| 								return type.specific == resourceType.specific &&
|2554|2554| 								    (type.specific != "meat" || resourceTemplate == template);
|2555|    |-						});
|    |2555|+							});
|2556|2556| 
|2557|2557| 						if (nearbyResource)
|2558|2558| 						{
|    | [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
|2884|2884| 					{
|2885|2885| 						// The building was already finished/fully repaired before we arrived;
|2886|2886| 						// let the ConstructionFinished handler handle this.
|2887|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2887|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2888|2888| 						return true;
|2889|2889| 					}
|2890|2890| 
|    | [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
|2884|2884| 					{
|2885|2885| 						// The building was already finished/fully repaired before we arrived;
|2886|2886| 						// let the ConstructionFinished handler handle this.
|2887|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2887|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2888|2888| 						return true;
|2889|2889| 					}
|2890|2890| 
|    | [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
|3174|3174| 				this.StopTimer();
|3175|3175| 				this.ResetAnimation();
|3176|3176| 				if (this.formationAnimationVariant)
|3177|    |-					this.SetAnimationVariant(this.formationAnimationVariant)
|    |3177|+					this.SetAnimationVariant(this.formationAnimationVariant);
|3178|3178| 				else
|3179|3179| 					this.SetDefaultAnimationVariant();
|3180|3180| 				var cmpResistance = Engine.QueryInterface(this.entity, IID_Resistance);
|    | [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
|3456|3456| 		{
|3457|3457| 			let index = this.GetCurrentState().indexOf(".");
|3458|3458| 			if (index != -1)
|3459|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3459|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3460|3460| 			this.Stop(false);
|3461|3461| 		}
|3462|3462| 
|    | [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
|3513|3513| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3514|3514| 			continue;
|3515|3515| 		if (i == 0)
|3516|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3516|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3517|3517| 		else
|3518|3518| 			this.orderQueue.splice(i, 1);
|3519|3519| 		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
|3513|3513| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3514|3514| 			continue;
|3515|3515| 		if (i == 0)
|3516|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3516|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3517|3517| 		else
|3518|3518| 			this.orderQueue.splice(i, 1);
|3519|3519| 		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
|3642|3642| };
|3643|3643| 
|3644|3644| 
|3645|    |-//// FSM linkage functions ////
|    |3645|+// // FSM linkage functions ////
|3646|3646| 
|3647|3647| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3648|3648| 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
|3815|3815| 				continue;
|3816|3816| 			if (this.orderQueue[i].type == type)
|3817|3817| 				continue;
|3818|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3818|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3819|3819| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3820|3820| 			return;
|3821|3821| 		}
|    | [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
|3815|3815| 				continue;
|3816|3816| 			if (this.orderQueue[i].type == type)
|3817|3817| 				continue;
|3818|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3818|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3819|3819| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3820|3820| 			return;
|3821|3821| 		}
|    | [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
|4056|4056| 	if (data.timerRepeat === undefined)
|4057|4057| 		this.timer = undefined;
|4058|4058| 
|4059|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4059|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4060|4060| };
|4061|4061| 
|4062|4062| /**
|    | [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
|4056|4056| 	if (data.timerRepeat === undefined)
|4057|4057| 		this.timer = undefined;
|4058|4058| 
|4059|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4059|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4060|4060| };
|4061|4061| 
|4062|4062| /**
|    | [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
|4101|4101| 	// TODO: This is a bit inefficient since every unit listens to every
|4102|4102| 	// construction message - ideally we could scope it to only the one we're building
|4103|4103| 
|4104|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4104|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4105|4105| };
|4106|4106| 
|4107|4107| 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
|4101|4101| 	// TODO: This is a bit inefficient since every unit listens to every
|4102|4102| 	// construction message - ideally we could scope it to only the one we're building
|4103|4103| 
|4104|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4104|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4105|4105| };
|4106|4106| 
|4107|4107| 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
|4140|4140| 	if (msg.fromStatusEffect)
|4141|4141| 		return;
|4142|4142| 
|4143|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4143|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4144|4144| };
|4145|4145| 
|4146|4146| 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
|4140|4140| 	if (msg.fromStatusEffect)
|4141|4141| 		return;
|4142|4142| 
|4143|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4143|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4144|4144| };
|4145|4145| 
|4146|4146| 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
|4145|4145| 
|4146|4146| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4147|4147| {
|4148|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4148|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4149|4149| };
|4150|4150| 
|4151|4151| 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
|4145|4145| 
|4146|4146| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4147|4147| {
|4148|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4148|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4149|4149| };
|4150|4150| 
|4151|4151| 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
|4150|4150| 
|4151|4151| UnitAI.prototype.OnHealthChanged = function(msg)
|4152|4152| {
|4153|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4153|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4154|4154| };
|4155|4155| 
|4156|4156| 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
|4150|4150| 
|4151|4151| UnitAI.prototype.OnHealthChanged = function(msg)
|4152|4152| {
|4153|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4153|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4154|4154| };
|4155|4155| 
|4156|4156| 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
|4165|4165| 
|4166|4166| UnitAI.prototype.OnPackFinished = function(msg)
|4167|4167| {
|4168|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4168|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4169|4169| };
|4170|4170| 
|4171|4171| //// Helper functions to be called by the FSM ////
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4165|4165| 
|4166|4166| UnitAI.prototype.OnPackFinished = function(msg)
|4167|4167| {
|4168|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4168|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4169|4169| };
|4170|4170| 
|4171|4171| //// Helper functions to be called by the FSM ////
|    | [NORMAL] ESLintBear (spaced-comment):
|    | Expected space or tab after '//' in comment.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|4168|4168| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4169|4169| };
|4170|4170| 
|4171|    |-//// Helper functions to be called by the FSM ////
|    |4171|+// // Helper functions to be called by the FSM ////
|4172|4172| 
|4173|4173| UnitAI.prototype.GetWalkSpeed = function()
|4174|4174| {
|    | [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
|4898|4898| UnitAI.prototype.AttackEntityInZone = function(ents)
|4899|4899| {
|4900|4900| 	var target = ents.find(target =>
|4901|    |-		this.CanAttack(target)
|4902|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4901|+		this.CanAttack(target) &&
|    |4902|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4903|4903| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4904|4904| 	);
|4905|4905| 	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
|4899|4899| {
|4900|4900| 	var target = ents.find(target =>
|4901|4901| 		this.CanAttack(target)
|4902|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4903|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4902|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4903|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4904|4904| 	);
|4905|4905| 	if (!target)
|4906|4906| 		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
|4983|4983| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4984|4984| 	if (this.isGuardOf)
|4985|4985| 	{
|4986|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4986|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4987|4987| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4988|4988| 		if (cmpUnitAI && cmpAttack &&
|4989|4989| 		    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
|4987|4987| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4988|4988| 		if (cmpUnitAI && cmpAttack &&
|4989|4989| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4990|    |-				return false;
|    |4990|+			return false;
|4991|4991| 	}
|4992|4992| 
|4993|4993| 	// 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
|5025|5025| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|5026|5026| 	if (this.isGuardOf)
|5027|5027| 	{
|5028|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |5028|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|5029|5029| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|5030|5030| 		if (cmpUnitAI && cmpAttack &&
|5031|5031| 		    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
|5038|5038| 	return false;
|5039|5039| };
|5040|5040| 
|5041|    |-//// External interface functions ////
|    |5041|+// // External interface functions ////
|5042|5042| 
|5043|5043| UnitAI.prototype.SetFormationController = function(ent)
|5044|5044| {
|    | [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
|5194|5194| 	{
|5195|5195| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5196|5196| 			return;
|5197|    |-		else
|5198|    |-			this.RemoveGuard();
|    |5197|+		this.RemoveGuard();
|5199|5198| 	}
|5200|5199| 
|5201|5200| 	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
|5528|5528| 
|5529|5529| 	if (this.IsFormationController())
|5530|5530| 		this.CallMemberFunction("CancelSetupTradeRoute", [target]);
|5531|    |-}
|    |5531|+};
|5532|5532| /**
|5533|5533|  * Adds trade order to the queue. Either walk to the first market, or
|5534|5534|  * 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
|5549|5549| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5550|5550| 	{
|5551|5551| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5552|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5552|+		if (cmpTrader.HasBothMarkets() &&
|5553|5553| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5554|5554| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5555|5555| 		{
|    | [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
|5856|5856| 				{
|5857|5857| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5858|5858| 					var targetClasses = this.order.data.targetClasses;
|5859|    |-					if (targetClasses.attack && cmpIdentity
|5860|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5859|+					if (targetClasses.attack && cmpIdentity &&
|    |5860|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5861|5861| 						continue;
|5862|5862| 					if (targetClasses.avoid && cmpIdentity
|5863|5863| 						&& 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
|5859|5859| 					if (targetClasses.attack && cmpIdentity
|5860|5860| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5861|5861| 						continue;
|5862|    |-					if (targetClasses.avoid && cmpIdentity
|5863|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5862|+					if (targetClasses.avoid && cmpIdentity &&
|    |5863|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5864|5864| 						continue;
|5865|5865| 					// Only used by the AIs to prevent some choices of targets
|5866|5866| 					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
|5882|5882| 		{
|5883|5883| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5884|5884| 			var targetClasses = this.order.data.targetClasses;
|5885|    |-			if (cmpIdentity && targetClasses.attack
|5886|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5885|+			if (cmpIdentity && targetClasses.attack &&
|    |5886|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5887|5887| 				continue;
|5888|5888| 			if (cmpIdentity && targetClasses.avoid
|5889|5889| 				&& 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
|5885|5885| 			if (cmpIdentity && targetClasses.attack
|5886|5886| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5887|5887| 				continue;
|5888|    |-			if (cmpIdentity && targetClasses.avoid
|5889|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5888|+			if (cmpIdentity && targetClasses.avoid &&
|    |5889|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5890|5890| 				continue;
|5891|5891| 			// Only used by the AIs to prevent some choices of targets
|5892|5892| 			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
|6043|6043| 
|6044|6044| UnitAI.prototype.SetHeldPosition = function(x, z)
|6045|6045| {
|6046|    |-	this.heldPosition = {"x": x, "z": z};
|    |6046|+	this.heldPosition = { "x": x, "z": z};
|6047|6047| };
|6048|6048| 
|6049|6049| 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
|6043|6043| 
|6044|6044| UnitAI.prototype.SetHeldPosition = function(x, z)
|6045|6045| {
|6046|    |-	this.heldPosition = {"x": x, "z": z};
|    |6046|+	this.heldPosition = {"x": x, "z": z };
|6047|6047| };
|6048|6048| 
|6049|6049| 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
|6070|6070| 	return false;
|6071|6071| };
|6072|6072| 
|6073|    |-//// Helper functions ////
|    |6073|+// // Helper functions ////
|6074|6074| 
|6075|6075| /**
|6076|6076|  * 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
|6089|6089| 		return undefined;
|6090|6090| 
|6091|6091| 	return component.GetRange(type);
|6092|    |-}
|    |6092|+};
|6093|6093| 
|6094|6094| UnitAI.prototype.CanAttack = function(target)
|6095|6095| {
|    | [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
|6265|6265| 	return cmpPack && cmpPack.IsPacking();
|6266|6266| };
|6267|6267| 
|6268|    |-//// Formation specific functions ////
|    |6268|+// // Formation specific functions ////
|6269|6269| 
|6270|6270| UnitAI.prototype.IsAttackingAsFormation = function()
|6271|6271| {
|    | [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
|6270|6270| UnitAI.prototype.IsAttackingAsFormation = function()
|6271|6271| {
|6272|6272| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6273|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6274|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6273|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6274|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6275|6275| };
|6276|6276| 
|6277|6277| UnitAI.prototype.MoveRandomly = function(distance)
|    | [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
|6323|6323| {
|6324|6324| 	let cmpUnitMotion = Engine.QueryInterface(this.entity, IID_UnitMotion);
|6325|6325| 	return cmpUnitMotion && cmpUnitMotion.GetFacePointAfterMove();
|6326|    |-}
|    |6326|+};
|6327|6327| 
|6328|6328| UnitAI.prototype.AttackEntitiesByPreference = function(ents)
|6329|6329| {

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Freagarach updated this revision to Diff 13176.Aug 11 2020, 8:55 PM
  • Educate PetraAI.
Owners added a subscriber: Restricted Owners Package.Aug 11 2020, 8:55 PM
Nescio added a subscriber: Nescio.Aug 14 2020, 2:50 PM

To me “natural behaviour” implies something that can't really be changed, whereas “default stance” implies something that's optional and can be set differently. Why the rename?

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

What does this mean? And why is it listed at the bottom?

binaries/data/mods/public/simulation/templates/gaia/fauna_peacock.xml
33–34

Isn't this already inherited from its parent?

binaries/data/mods/public/simulation/templates/template_unit_fauna.xml
48

Why?

binaries/data/mods/public/simulation/templates/template_unit_fauna_breed_passive.xml
2–3

Already inherited from parent.

binaries/data/mods/public/simulation/templates/template_unit_fauna_herd_domestic.xml
6–8

Still relevant?

binaries/data/mods/public/simulation/templates/template_unit_fauna_hunt_skittish_elephant_infant.xml
24–26

Why?

Why the rename?

For I can image there are mods that like to be able to bring elephants into musth periodically.

Template values ought to be looked at when the rest of the patch has passed review.

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

This means that the entity will retaliate but not initiate in any attack. It list listed at the bottom because I added it lastly ^^
Perhaps retaliative is a better word?

binaries/data/mods/public/simulation/components/tests/test_UnitAI.js
207

Redundant.

binaries/data/mods/public/simulation/templates/gaia/fauna_peacock.xml
33–34

I haven't checked template inheritance, thanks.

binaries/data/mods/public/simulation/templates/template_unit_fauna.xml
48

Because animals need vision now to be able to attack stuff.

binaries/data/mods/public/simulation/templates/template_unit_fauna_herd_domestic.xml
6–8

Yeah, if you have trained a sheep from a corral you don't want it to have a large LOS, for gameplay reasons.

binaries/data/mods/public/simulation/templates/template_unit_fauna_hunt_skittish_elephant_infant.xml
24–26

Else they run away far to soon ^^

I need to test this.
One remark: I think you can delete the FSM logic for duplicating a state.

I think your usage of stance behaviours is an improvement in that it's actually less hardcoding. The name "defaultStance" however is indeed kind of poor and should really just be "Behaviour", with user-controllable entities having a way to change that.
Stances in general need a serious rework sometimes, I think it's not _so_ bad as it stands here.

binaries/data/mods/public/simulation/components/BuildingAI.js
186

Inaccurate comment now

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

The idea is that if you don't bother it, it won't bother you.
I feel like English must have a word for this but I'm not finding it right now.

5906

This introduces a rather early check. I'm not saying it's bad per se, but it might be quite inconsistent, I know some other functions run rather late ones instead.

Stan added inline comments.Aug 21 2020, 9:43 AM
binaries/data/mods/public/simulation/components/UnitAI.js
5906

It's only called below, so it's not so early ? Also prevents the creation of an extra function and more indirection see l5925

5919

Can't you just do:

entities.filter(attackfilter);

One remark: I think you can delete the FSM logic for duplicating a state.

Nay, it is used for formation members as well.

Freagarach edited the summary of this revision. (Show Details)Aug 21 2020, 11:09 AM
Freagarach updated this revision to Diff 13259.EditedAug 21 2020, 12:08 PM
Freagarach marked 5 inline comments as done.
  • Updated BuildingAI comment.
  • Filter.
  • Checked template inheritance.
  • Removed WillRoam().

I think your usage of stance behaviours is an improvement in that it's actually less hardcoding. The name "defaultStance" however is indeed kind of poor and should really just be "Behaviour", with user-controllable entities having a way to change that.
Stances in general need a serious rework sometimes, I think it's not _so_ bad as it stands here.

I can rename that here if you want?

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/libsimulation2.a(precompiled.o) has no symbols

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

Nescio removed a subscriber: Nescio.Mon, Aug 24, 1:28 PM