Page MenuHomeWildfire Games

Commit resources at a target rather than per type.
Needs ReviewPublic

Authored by Freagarach on Tue, Mar 24, 10:55 AM.

Details

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

This moves some resource committing logic from UnitAI to ResourceGatherer.
This would allow easier modification by modders, e.g. share resources with allies when dropping at an allied storehouse, since that change only has to be done in one place instead of scattered in the UnitAI-beast.

This also enables a check to only send a resource carrying changed message when it actually changes.

Test Plan

Verify that:

  • Entities can ordinarily return resources.
  • Entities carrying resources and finish constructing a dropsite with the correct type drop off resources.
  • Entities carrying resources and finish constructing a dropsite with the wrong type do not drop off resources.
  • Entities garrisoning in a dropsite drop the right types of resources.

Event Timeline

Freagarach created this revision.Tue, Mar 24, 10:55 AM

A test can be added (after D2662).

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

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1889/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
| 786| 786| 					this.FinishOrder();
| 787| 787| 					return;
| 788| 788| 				}
| 789|    |-				else
| 790|    |-				{
|    | 789|+				
| 791| 790| 					this.SetNextState("GARRISON.APPROACHING");
| 792| 791| 					return;
| 793|    |-				}
|    | 792|+				
| 794| 793| 			}
| 795| 794| 
| 796| 795| 			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
|1058|1058| 			},
|1059|1059| 		},
|1060|1060| 
|1061|    |-		"GARRISON":{
|    |1061|+		"GARRISON": {
|1062|1062| 			"APPROACHING": {
|1063|1063| 				"enter": function() {
|1064|1064| 					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
|2036|2036| 
|2037|2037| 				"Attacked": function(msg) {
|2038|2038| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2039|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2040|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2039|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2040|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2041|2041| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2042|2042| 				},
|2043|2043| 			},
|    | [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
|2771|2771| 					{
|2772|2772| 						// The building was already finished/fully repaired before we arrived;
|2773|2773| 						// let the ConstructionFinished handler handle this.
|2774|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2774|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2775|2775| 						return true;
|2776|2776| 					}
|2777|2777| 
|    | [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
|2771|2771| 					{
|2772|2772| 						// The building was already finished/fully repaired before we arrived;
|2773|2773| 						// let the ConstructionFinished handler handle this.
|2774|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2774|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2775|2775| 						return true;
|2776|2776| 					}
|2777|2777| 
|    | [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
|3062|3062| 				this.StopTimer();
|3063|3063| 				this.ResetAnimation();
|3064|3064| 				if (this.formationAnimationVariant)
|3065|    |-					this.SetAnimationVariant(this.formationAnimationVariant)
|    |3065|+					this.SetAnimationVariant(this.formationAnimationVariant);
|3066|3066| 				else
|3067|3067| 					this.SetDefaultAnimationVariant();
|3068|3068| 				var cmpResistance = Engine.QueryInterface(this.entity, IID_Resistance);
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 7.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3288|3288| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3289|3289| 
|3290|3290| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3291|    |-							// only used for domestic animals
|    |3291|+		// only used for domestic animals
|3292|3292| 
|3293|3293| 		// Reuse the same garrison behaviour for animals.
|3294|3294| 		"GARRISON": "INDIVIDUAL.GARRISON",
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3350|3350| 
|3351|3351| UnitAI.prototype.IsAnimal = function()
|3352|3352| {
|3353|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3353|+	return (!!this.template.NaturalBehaviour);
|3354|3354| };
|3355|3355| 
|3356|3356| UnitAI.prototype.IsDangerousAnimal = function()
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3466|3466| 		{
|3467|3467| 			let index = this.GetCurrentState().indexOf(".");
|3468|3468| 			if (index != -1)
|3469|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3469|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3470|3470| 			this.Stop(false);
|3471|3471| 		}
|3472|3472| 
|    | [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
|3522|3522| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3523|3523| 			continue;
|3524|3524| 		if (i == 0)
|3525|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3525|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3526|3526| 		else
|3527|3527| 			this.orderQueue.splice(i, 1);
|3528|3528| 		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
|3522|3522| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3523|3523| 			continue;
|3524|3524| 		if (i == 0)
|3525|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3525|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3526|3526| 		else
|3527|3527| 			this.orderQueue.splice(i, 1);
|3528|3528| 		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
|3609|3609| };
|3610|3610| 
|3611|3611| 
|3612|    |-//// FSM linkage functions ////
|    |3612|+// // FSM linkage functions ////
|3613|3613| 
|3614|3614| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3615|3615| 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
|3780|3780| 				continue;
|3781|3781| 			if (this.orderQueue[i].type == type)
|3782|3782| 				continue;
|3783|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3783|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3784|3784| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3785|3785| 			return;
|3786|3786| 		}
|    | [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
|3780|3780| 				continue;
|3781|3781| 			if (this.orderQueue[i].type == type)
|3782|3782| 				continue;
|3783|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3783|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3784|3784| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3785|3785| 			return;
|3786|3786| 		}
|    | [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
|4022|4022| 	if (data.timerRepeat === undefined)
|4023|4023| 		this.timer = undefined;
|4024|4024| 
|4025|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4025|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4026|4026| };
|4027|4027| 
|4028|4028| /**
|    | [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
|4022|4022| 	if (data.timerRepeat === undefined)
|4023|4023| 		this.timer = undefined;
|4024|4024| 
|4025|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4025|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4026|4026| };
|4027|4027| 
|4028|4028| /**
|    | [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| 	// TODO: This is a bit inefficient since every unit listens to every
|4068|4068| 	// construction message - ideally we could scope it to only the one we're building
|4069|4069| 
|4070|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4070|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4071|4071| };
|4072|4072| 
|4073|4073| 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
|4067|4067| 	// TODO: This is a bit inefficient since every unit listens to every
|4068|4068| 	// construction message - ideally we could scope it to only the one we're building
|4069|4069| 
|4070|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4070|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4071|4071| };
|4072|4072| 
|4073|4073| 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
|4098|4098| 	if (msg.fromStatusEffect)
|4099|4099| 		return;
|4100|4100| 
|4101|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4101|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4102|4102| };
|4103|4103| 
|4104|4104| 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
|4098|4098| 	if (msg.fromStatusEffect)
|4099|4099| 		return;
|4100|4100| 
|4101|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4101|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4102|4102| };
|4103|4103| 
|4104|4104| 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
|4103|4103| 
|4104|4104| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4105|4105| {
|4106|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4106|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4107|4107| };
|4108|4108| 
|4109|4109| 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
|4103|4103| 
|4104|4104| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4105|4105| {
|4106|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4106|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4107|4107| };
|4108|4108| 
|4109|4109| 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
|4108|4108| 
|4109|4109| UnitAI.prototype.OnHealthChanged = function(msg)
|4110|4110| {
|4111|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4111|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4112|4112| };
|4113|4113| 
|4114|4114| 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
|4108|4108| 
|4109|4109| UnitAI.prototype.OnHealthChanged = function(msg)
|4110|4110| {
|4111|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4111|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4112|4112| };
|4113|4113| 
|4114|4114| 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
|4114|4114| UnitAI.prototype.OnRangeUpdate = function(msg)
|4115|4115| {
|4116|4116| 	if (msg.tag == this.losRangeQuery)
|4117|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4117|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4118|4118| 	else if (msg.tag == this.losHealRangeQuery)
|4119|4119| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4120|4120| };
|    | [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
|4114|4114| UnitAI.prototype.OnRangeUpdate = function(msg)
|4115|4115| {
|4116|4116| 	if (msg.tag == this.losRangeQuery)
|4117|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4117|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4118|4118| 	else if (msg.tag == this.losHealRangeQuery)
|4119|4119| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4120|4120| };
|    | [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
|4116|4116| 	if (msg.tag == this.losRangeQuery)
|4117|4117| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4118|4118| 	else if (msg.tag == this.losHealRangeQuery)
|4119|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4119|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4120|4120| };
|4121|4121| 
|4122|4122| 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
|4116|4116| 	if (msg.tag == this.losRangeQuery)
|4117|4117| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4118|4118| 	else if (msg.tag == this.losHealRangeQuery)
|4119|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4119|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4120|4120| };
|4121|4121| 
|4122|4122| 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
|4121|4121| 
|4122|4122| UnitAI.prototype.OnPackFinished = function(msg)
|4123|4123| {
|4124|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4124|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4125|4125| };
|4126|4126| 
|4127|4127| //// 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
|4121|4121| 
|4122|4122| UnitAI.prototype.OnPackFinished = function(msg)
|4123|4123| {
|4124|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4124|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4125|4125| };
|4126|4126| 
|4127|4127| //// 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
|4124|4124| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4125|4125| };
|4126|4126| 
|4127|    |-//// Helper functions to be called by the FSM ////
|    |4127|+// // Helper functions to be called by the FSM ////
|4128|4128| 
|4129|4129| UnitAI.prototype.GetWalkSpeed = function()
|4130|4130| {
|    | [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
|4791|4791| UnitAI.prototype.AttackEntityInZone = function(ents)
|4792|4792| {
|4793|4793| 	var target = ents.find(target =>
|4794|    |-		this.CanAttack(target)
|4795|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4794|+		this.CanAttack(target) &&
|    |4795|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4796|4796| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4797|4797| 	);
|4798|4798| 	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
|4792|4792| {
|4793|4793| 	var target = ents.find(target =>
|4794|4794| 		this.CanAttack(target)
|4795|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4796|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4795|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4796|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4797|4797| 	);
|4798|4798| 	if (!target)
|4799|4799| 		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
|4856|4856| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4857|4857| 	if (this.isGuardOf)
|4858|4858| 	{
|4859|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4859|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4860|4860| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4861|4861| 		if (cmpUnitAI && cmpAttack &&
|4862|4862| 		    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
|4860|4860| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4861|4861| 		if (cmpUnitAI && cmpAttack &&
|4862|4862| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4863|    |-				return false;
|    |4863|+			return false;
|4864|4864| 	}
|4865|4865| 
|4866|4866| 	// 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
|4898|4898| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4899|4899| 	if (this.isGuardOf)
|4900|4900| 	{
|4901|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4901|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4902|4902| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4903|4903| 		if (cmpUnitAI && cmpAttack &&
|4904|4904| 		    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
|4911|4911| 	return false;
|4912|4912| };
|4913|4913| 
|4914|    |-//// External interface functions ////
|    |4914|+// // External interface functions ////
|4915|4915| 
|4916|4916| UnitAI.prototype.SetFormationController = function(ent)
|4917|4917| {
|    | [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
|5067|5067| 	{
|5068|5068| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5069|5069| 			return;
|5070|    |-		else
|5071|    |-			this.RemoveGuard();
|    |5070|+		this.RemoveGuard();
|5072|5071| 	}
|5073|5072| 
|5074|5073| 	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
|5398|5398| 
|5399|5399| 	if (this.IsFormationController())
|5400|5400| 		this.CallMemberFunction("CancelSetupTradeRoute", [target]);
|5401|    |-}
|    |5401|+};
|5402|5402| /**
|5403|5403|  * Adds trade order to the queue. Either walk to the first market, or
|5404|5404|  * 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
|5419|5419| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5420|5420| 	{
|5421|5421| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5422|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5422|+		if (cmpTrader.HasBothMarkets() &&
|5423|5423| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5424|5424| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5425|5425| 		{
|    | [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
|5700|5700| 				{
|5701|5701| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5702|5702| 					var targetClasses = this.order.data.targetClasses;
|5703|    |-					if (targetClasses.attack && cmpIdentity
|5704|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5703|+					if (targetClasses.attack && cmpIdentity &&
|    |5704|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5705|5705| 						continue;
|5706|5706| 					if (targetClasses.avoid && cmpIdentity
|5707|5707| 						&& 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
|5703|5703| 					if (targetClasses.attack && cmpIdentity
|5704|5704| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5705|5705| 						continue;
|5706|    |-					if (targetClasses.avoid && cmpIdentity
|5707|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5706|+					if (targetClasses.avoid && cmpIdentity &&
|    |5707|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5708|5708| 						continue;
|5709|5709| 					// Only used by the AIs to prevent some choices of targets
|5710|5710| 					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
|5726|5726| 		{
|5727|5727| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5728|5728| 			var targetClasses = this.order.data.targetClasses;
|5729|    |-			if (cmpIdentity && targetClasses.attack
|5730|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5729|+			if (cmpIdentity && targetClasses.attack &&
|    |5730|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5731|5731| 				continue;
|5732|5732| 			if (cmpIdentity && targetClasses.avoid
|5733|5733| 				&& 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
|5729|5729| 			if (cmpIdentity && targetClasses.attack
|5730|5730| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5731|5731| 				continue;
|5732|    |-			if (cmpIdentity && targetClasses.avoid
|5733|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5732|+			if (cmpIdentity && targetClasses.avoid &&
|    |5733|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5734|5734| 				continue;
|5735|5735| 			// Only used by the AIs to prevent some choices of targets
|5736|5736| 			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
|5872|5872| 
|5873|5873| UnitAI.prototype.SetHeldPosition = function(x, z)
|5874|5874| {
|5875|    |-	this.heldPosition = {"x": x, "z": z};
|    |5875|+	this.heldPosition = { "x": x, "z": z};
|5876|5876| };
|5877|5877| 
|5878|5878| 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
|5872|5872| 
|5873|5873| UnitAI.prototype.SetHeldPosition = function(x, z)
|5874|5874| {
|5875|    |-	this.heldPosition = {"x": x, "z": z};
|    |5875|+	this.heldPosition = {"x": x, "z": z };
|5876|5876| };
|5877|5877| 
|5878|5878| 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
|5899|5899| 	return false;
|5900|5900| };
|5901|5901| 
|5902|    |-//// Helper functions ////
|    |5902|+// // Helper functions ////
|5903|5903| 
|5904|5904| /**
|5905|5905|  * 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
|5918|5918| 		return undefined;
|5919|5919| 
|5920|5920| 	return component.GetRange(type);
|5921|    |-}
|    |5921|+};
|5922|5922| 
|5923|5923| UnitAI.prototype.CanAttack = function(target)
|5924|5924| {
|    | [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
|6116|6116| 	return cmpPack && cmpPack.IsPacking();
|6117|6117| };
|6118|6118| 
|6119|    |-//// Formation specific functions ////
|    |6119|+// // Formation specific functions ////
|6120|6120| 
|6121|6121| UnitAI.prototype.IsAttackingAsFormation = function()
|6122|6122| {
|    | [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
|6121|6121| UnitAI.prototype.IsAttackingAsFormation = function()
|6122|6122| {
|6123|6123| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6124|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6125|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6124|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6125|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6126|6126| };
|6127|6127| 
|6128|6128| //// 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
|6125|6125| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6126|6126| };
|6127|6127| 
|6128|    |-//// Animal specific functions ////
|    |6128|+// // Animal specific functions ////
|6129|6129| 
|6130|6130| UnitAI.prototype.MoveRandomly = function(distance)
|6131|6131| {

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|3927| »   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
|4778| »   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
|4793| »   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
|4839| »   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
|4862| »   »   ····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
|2040| »   »   »   »   »   »   &&·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
|3065| »   »   »   »   »   this.SetAnimationVariant(this.formationAnimationVariant)
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

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

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

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

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

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

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

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