Page MenuHomeWildfire Games

Allow to guard a guard.
ClosedPublic

Authored by Freagarach on May 13 2020, 9:13 PM.

Details

Reviewers
Silier
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Commits
rP24033: Allow guards to guard a guarding guard.
Trac Tickets
#2034
Summary

Use case: Someone wants to guard a relic with a hero and wants to guard the hero with some healers.

Note that it was explicitly disallowed to guard a guarding entity. I could neither find nor think of a reason why it should not be allowed.

Test Plan

Verify that:

  • guarding still functions.
  • doing A <-> B does not cause code errors or infinite loop.
  • doing A -> B -> C -> A neither.

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Freagarach created this revision.May 13 2020, 9:13 PM
Owners added a subscriber: Restricted Owners Package.May 13 2020, 9:13 PM

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'execute'.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/session/unit_actions.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/session/unit_actions.js
| 530| 530| 
| 531| 531| 	"cancel-setup-trade-route":
| 532| 532| 	{
| 533|    |-		"execute":function(target, action, selection, queued)
|    | 533|+		"execute": function(target, action, selection, queued)
| 534| 534| 		{
| 535| 535| 			Engine.PostNetworkCommand({
| 536| 536| 				"type": "cancel-setup-trade-route",
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/session/unit_actions.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/session/unit_actions.js
| 575| 575| 				"cursor": "action-cancel-setup-trade-route",
| 576| 576| 				"tooltip": actionInfo.tooltip,
| 577| 577| 				"target": target
| 578|    |-			}
|    | 578|+			};
| 579| 579| 		},
| 580| 580| 		"specificness": 2,
| 581| 581| 	},

binaries/data/mods/public/gui/session/unit_actions.js
| 620| »   »   »   switch·(tradingDetails.type)
|    | [NORMAL] ESLintBear (default-case):
|    | Expected a default case.

binaries/data/mods/public/gui/session/unit_actions.js
| 578| »   »   »   }
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 788| 788| 					this.FinishOrder();
| 789| 789| 					return;
| 790| 790| 				}
| 791|    |-				else
| 792|    |-				{
|    | 791|+				
| 793| 792| 					this.SetNextState("GARRISON.APPROACHING");
| 794| 793| 					return;
| 795|    |-				}
|    | 794|+				
| 796| 795| 			}
| 797| 796| 
| 798| 797| 			this.SetNextState("GARRISON.GARRISONING");
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'GARRISON'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1060|1060| 			},
|1061|1061| 		},
|1062|1062| 
|1063|    |-		"GARRISON":{
|    |1063|+		"GARRISON": {
|1064|1064| 			"APPROACHING": {
|1065|1065| 				"enter": function() {
|1066|1066| 					if (!this.MoveToGarrisonRange(this.order.data.target))
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2042|2042| 
|2043|2043| 				"Attacked": function(msg) {
|2044|2044| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2045|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2046|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2045|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2046|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2047|2047| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2048|2048| 				},
|2049|2049| 			},
|    | [NORMAL] ESLintBear (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
|2201|2201| 					"MovementUpdate": function(msg) {
|2202|2202| 						// If it looks like the path is failing, and we are close enough (3 tiles) from wanted range
|2203|2203| 						// stop anyways. This avoids pathing for an unreachable goal and reduces lag considerably.
|2204|    |-						if (msg.likelyFailure || 
|    |2204|+						if (msg.likelyFailure ||
|2205|2205| 							msg.obstructed && this.RelaxedMaxRangeCheck(this.order.data, this.order.data.max + this.DefaultRelaxedMaxRange) ||
|2206|2206| 							!msg.obstructed && this.CheckRange(this.order.data))
|2207|2207| 							this.FinishOrder();
|    | [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
|2843|2843| 					{
|2844|2844| 						// The building was already finished/fully repaired before we arrived;
|2845|2845| 						// let the ConstructionFinished handler handle this.
|2846|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2846|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2847|2847| 						return true;
|2848|2848| 					}
|2849|2849| 
|    | [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
|2843|2843| 					{
|2844|2844| 						// The building was already finished/fully repaired before we arrived;
|2845|2845| 						// let the ConstructionFinished handler handle this.
|2846|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2846|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2847|2847| 						return true;
|2848|2848| 					}
|2849|2849| 
|    | [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
|3141|3141| 				this.StopTimer();
|3142|3142| 				this.ResetAnimation();
|3143|3143| 				if (this.formationAnimationVariant)
|3144|    |-					this.SetAnimationVariant(this.formationAnimationVariant)
|    |3144|+					this.SetAnimationVariant(this.formationAnimationVariant);
|3145|3145| 				else
|3146|3146| 					this.SetDefaultAnimationVariant();
|3147|3147| 				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
|3367|3367| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3368|3368| 
|3369|3369| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3370|    |-							// only used for domestic animals
|    |3370|+		// only used for domestic animals
|3371|3371| 
|3372|3372| 		// Reuse the same garrison behaviour for animals.
|3373|3373| 		"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
|3429|3429| 
|3430|3430| UnitAI.prototype.IsAnimal = function()
|3431|3431| {
|3432|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3432|+	return (!!this.template.NaturalBehaviour);
|3433|3433| };
|3434|3434| 
|3435|3435| 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
|3545|3545| 		{
|3546|3546| 			let index = this.GetCurrentState().indexOf(".");
|3547|3547| 			if (index != -1)
|3548|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3548|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3549|3549| 			this.Stop(false);
|3550|3550| 		}
|3551|3551| 
|    | [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
|3601|3601| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3602|3602| 			continue;
|3603|3603| 		if (i == 0)
|3604|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3604|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3605|3605| 		else
|3606|3606| 			this.orderQueue.splice(i, 1);
|3607|3607| 		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
|3601|3601| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3602|3602| 			continue;
|3603|3603| 		if (i == 0)
|3604|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3604|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3605|3605| 		else
|3606|3606| 			this.orderQueue.splice(i, 1);
|3607|3607| 		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
|3688|3688| };
|3689|3689| 
|3690|3690| 
|3691|    |-//// FSM linkage functions ////
|    |3691|+// // FSM linkage functions ////
|3692|3692| 
|3693|3693| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3694|3694| 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
|3859|3859| 				continue;
|3860|3860| 			if (this.orderQueue[i].type == type)
|3861|3861| 				continue;
|3862|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3862|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3863|3863| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3864|3864| 			return;
|3865|3865| 		}
|    | [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
|3859|3859| 				continue;
|3860|3860| 			if (this.orderQueue[i].type == type)
|3861|3861| 				continue;
|3862|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3862|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3863|3863| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3864|3864| 			return;
|3865|3865| 		}
|    | [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| 	if (data.timerRepeat === undefined)
|4102|4102| 		this.timer = undefined;
|4103|4103| 
|4104|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4104|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4105|4105| };
|4106|4106| 
|4107|4107| /**
|    | [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| 	if (data.timerRepeat === undefined)
|4102|4102| 		this.timer = undefined;
|4103|4103| 
|4104|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4104|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4105|4105| };
|4106|4106| 
|4107|4107| /**
|    | [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
|4146|4146| 	// TODO: This is a bit inefficient since every unit listens to every
|4147|4147| 	// construction message - ideally we could scope it to only the one we're building
|4148|4148| 
|4149|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4149|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4150|4150| };
|4151|4151| 
|4152|4152| 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
|4146|4146| 	// TODO: This is a bit inefficient since every unit listens to every
|4147|4147| 	// construction message - ideally we could scope it to only the one we're building
|4148|4148| 
|4149|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4149|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4150|4150| };
|4151|4151| 
|4152|4152| 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
|4177|4177| 	if (msg.fromStatusEffect)
|4178|4178| 		return;
|4179|4179| 
|4180|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4180|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4181|4181| };
|4182|4182| 
|4183|4183| 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
|4177|4177| 	if (msg.fromStatusEffect)
|4178|4178| 		return;
|4179|4179| 
|4180|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4180|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4181|4181| };
|4182|4182| 
|4183|4183| 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
|4182|4182| 
|4183|4183| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4184|4184| {
|4185|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4185|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4186|4186| };
|4187|4187| 
|4188|4188| 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
|4182|4182| 
|4183|4183| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4184|4184| {
|4185|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4185|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4186|4186| };
|4187|4187| 
|4188|4188| 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
|4187|4187| 
|4188|4188| UnitAI.prototype.OnHealthChanged = function(msg)
|4189|4189| {
|4190|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4190|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4191|4191| };
|4192|4192| 
|4193|4193| 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
|4187|4187| 
|4188|4188| UnitAI.prototype.OnHealthChanged = function(msg)
|4189|4189| {
|4190|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4190|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4191|4191| };
|4192|4192| 
|4193|4193| 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
|4193|4193| UnitAI.prototype.OnRangeUpdate = function(msg)
|4194|4194| {
|4195|4195| 	if (msg.tag == this.losRangeQuery)
|4196|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4196|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4197|4197| 	else if (msg.tag == this.losHealRangeQuery)
|4198|4198| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4199|4199| };
|    | [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
|4193|4193| UnitAI.prototype.OnRangeUpdate = function(msg)
|4194|4194| {
|4195|4195| 	if (msg.tag == this.losRangeQuery)
|4196|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4196|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4197|4197| 	else if (msg.tag == this.losHealRangeQuery)
|4198|4198| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4199|4199| };
|    | [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
|4195|4195| 	if (msg.tag == this.losRangeQuery)
|4196|4196| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4197|4197| 	else if (msg.tag == this.losHealRangeQuery)
|4198|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4198|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4199|4199| };
|4200|4200| 
|4201|4201| 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
|4195|4195| 	if (msg.tag == this.losRangeQuery)
|4196|4196| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4197|4197| 	else if (msg.tag == this.losHealRangeQuery)
|4198|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4198|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4199|4199| };
|4200|4200| 
|4201|4201| 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
|4200|4200| 
|4201|4201| UnitAI.prototype.OnPackFinished = function(msg)
|4202|4202| {
|4203|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4203|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4204|4204| };
|4205|4205| 
|4206|4206| //// 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
|4200|4200| 
|4201|4201| UnitAI.prototype.OnPackFinished = function(msg)
|4202|4202| {
|4203|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4203|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4204|4204| };
|4205|4205| 
|4206|4206| //// 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
|4203|4203| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4204|4204| };
|4205|4205| 
|4206|    |-//// Helper functions to be called by the FSM ////
|    |4206|+// // Helper functions to be called by the FSM ////
|4207|4207| 
|4208|4208| UnitAI.prototype.GetWalkSpeed = function()
|4209|4209| {
|    | [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
|4915|4915| UnitAI.prototype.AttackEntityInZone = function(ents)
|4916|4916| {
|4917|4917| 	var target = ents.find(target =>
|4918|    |-		this.CanAttack(target)
|4919|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4918|+		this.CanAttack(target) &&
|    |4919|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4920|4920| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4921|4921| 	);
|4922|4922| 	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
|4916|4916| {
|4917|4917| 	var target = ents.find(target =>
|4918|4918| 		this.CanAttack(target)
|4919|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4920|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4919|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4920|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4921|4921| 	);
|4922|4922| 	if (!target)
|4923|4923| 		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
|4982|4982| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4983|4983| 	if (this.isGuardOf)
|4984|4984| 	{
|4985|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4985|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4986|4986| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4987|4987| 		if (cmpUnitAI && cmpAttack &&
|4988|4988| 		    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
|4986|4986| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4987|4987| 		if (cmpUnitAI && cmpAttack &&
|4988|4988| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4989|    |-				return false;
|    |4989|+			return false;
|4990|4990| 	}
|4991|4991| 
|4992|4992| 	// 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
|5024|5024| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|5025|5025| 	if (this.isGuardOf)
|5026|5026| 	{
|5027|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |5027|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|5028|5028| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|5029|5029| 		if (cmpUnitAI && cmpAttack &&
|5030|5030| 		    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
|5037|5037| 	return false;
|5038|5038| };
|5039|5039| 
|5040|    |-//// External interface functions ////
|    |5040|+// // External interface functions ////
|5041|5041| 
|5042|5042| UnitAI.prototype.SetFormationController = function(ent)
|5043|5043| {
|    | [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
|5193|5193| 	{
|5194|5194| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5195|5195| 			return;
|5196|    |-		else
|5197|    |-			this.RemoveGuard();
|    |5196|+		this.RemoveGuard();
|5198|5197| 	}
|5199|5198| 
|5200|5199| 	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
|5513|5513| 
|5514|5514| 	if (this.IsFormationController())
|5515|5515| 		this.CallMemberFunction("CancelSetupTradeRoute", [target]);
|5516|    |-}
|    |5516|+};
|5517|5517| /**
|5518|5518|  * Adds trade order to the queue. Either walk to the first market, or
|5519|5519|  * 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
|5534|5534| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5535|5535| 	{
|5536|5536| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5537|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5537|+		if (cmpTrader.HasBothMarkets() &&
|5538|5538| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5539|5539| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5540|5540| 		{
|    | [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
|5815|5815| 				{
|5816|5816| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5817|5817| 					var targetClasses = this.order.data.targetClasses;
|5818|    |-					if (targetClasses.attack && cmpIdentity
|5819|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5818|+					if (targetClasses.attack && cmpIdentity &&
|    |5819|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5820|5820| 						continue;
|5821|5821| 					if (targetClasses.avoid && cmpIdentity
|5822|5822| 						&& 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
|5818|5818| 					if (targetClasses.attack && cmpIdentity
|5819|5819| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5820|5820| 						continue;
|5821|    |-					if (targetClasses.avoid && cmpIdentity
|5822|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5821|+					if (targetClasses.avoid && cmpIdentity &&
|    |5822|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5823|5823| 						continue;
|5824|5824| 					// Only used by the AIs to prevent some choices of targets
|5825|5825| 					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
|5841|5841| 		{
|5842|5842| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5843|5843| 			var targetClasses = this.order.data.targetClasses;
|5844|    |-			if (cmpIdentity && targetClasses.attack
|5845|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5844|+			if (cmpIdentity && targetClasses.attack &&
|    |5845|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5846|5846| 				continue;
|5847|5847| 			if (cmpIdentity && targetClasses.avoid
|5848|5848| 				&& 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
|5844|5844| 			if (cmpIdentity && targetClasses.attack
|5845|5845| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5846|5846| 				continue;
|5847|    |-			if (cmpIdentity && targetClasses.avoid
|5848|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5847|+			if (cmpIdentity && targetClasses.avoid &&
|    |5848|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5849|5849| 				continue;
|5850|5850| 			// Only used by the AIs to prevent some choices of targets
|5851|5851| 			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
|5987|5987| 
|5988|5988| UnitAI.prototype.SetHeldPosition = function(x, z)
|5989|5989| {
|5990|    |-	this.heldPosition = {"x": x, "z": z};
|    |5990|+	this.heldPosition = { "x": x, "z": z};
|5991|5991| };
|5992|5992| 
|5993|5993| 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
|5987|5987| 
|5988|5988| UnitAI.prototype.SetHeldPosition = function(x, z)
|5989|5989| {
|5990|    |-	this.heldPosition = {"x": x, "z": z};
|    |5990|+	this.heldPosition = {"x": x, "z": z };
|5991|5991| };
|5992|5992| 
|5993|5993| 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
|6014|6014| 	return false;
|6015|6015| };
|6016|6016| 
|6017|    |-//// Helper functions ////
|    |6017|+// // Helper functions ////
|6018|6018| 
|6019|6019| /**
|6020|6020|  * 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
|6033|6033| 		return undefined;
|6034|6034| 
|6035|6035| 	return component.GetRange(type);
|6036|    |-}
|    |6036|+};
|6037|6037| 
|6038|6038| UnitAI.prototype.CanAttack = function(target)
|6039|6039| {
|    | [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
|6201|6201| 	return cmpPack && cmpPack.IsPacking();
|6202|6202| };
|6203|6203| 
|6204|    |-//// Formation specific functions ////
|    |6204|+// // Formation specific functions ////
|6205|6205| 
|6206|6206| UnitAI.prototype.IsAttackingAsFormation = function()
|6207|6207| {
|    | [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
|6206|6206| UnitAI.prototype.IsAttackingAsFormation = function()
|6207|6207| {
|6208|6208| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6209|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6210|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6209|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6210|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6211|6211| };
|6212|6212| 
|6213|6213| //// 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
|6210|6210| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6211|6211| };
|6212|6212| 
|6213|    |-//// Animal specific functions ////
|    |6213|+// // Animal specific functions ////
|6214|6214| 
|6215|6215| UnitAI.prototype.MoveRandomly = function(distance)
|6216|6216| {

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
|1252| »   »   »   »   return·false;
|    | [NORMAL] ESLintBear (consistent-return):
|    | Method 'Timer' expected no return value.

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

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

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

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

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

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

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

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

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

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

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

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

bb added a subscriber: bb.Aug 31 2020, 10:50 PM

Code looks complete and works as advertised.

I did agree guard chains should be allowed (disallowing for the sake of disallowing doesn't really serve any purpose), maybe others have opinions?

Silier added a subscriber: Silier.Sep 1 2020, 8:25 AM

If it does not create infinite loops or another weird behaviour, why no.

Silier requested changes to this revision.Sep 1 2020, 11:37 AM

You can guard yourself.
A guarding B and B guarding A:
move B -> after B finishes movement, B moves back to A, what means A is not exactly in guarding range of B.
B should not move back if A followed successfully. It is also question if B should move back to A at all since it had input from player to be at point x, y.

This revision now requires changes to proceed.Sep 1 2020, 11:37 AM
Freagarach updated this revision to Diff 13373.EditedSep 3 2020, 12:40 PM

Do not allow guarding oneself.

In D2732#130313, @Angen wrote:

A guarding B and B guarding A:
move B -> after B finishes movement, B moves back to A, what means A is not exactly in guarding range of B.
B should not move back if A followed successfully. It is also question if B should move back to A at all since it had input from player to be at point x, y.

Minor issue, IMHO. You indeed force an entity to _move_ to a point, but when that order is finished there is the player's order to guard A, which means moving a tad (ideally they should be in range already indeed).

Silier accepted this revision.Sep 6 2020, 11:06 AM

Looks and works good.
IMO one should create diff to get guarding units closer if possible so they mostly ends up in guarding range then mostly not.

This revision is now accepted and ready to land.Sep 6 2020, 11:06 AM
This revision was automatically updated to reflect the committed changes.

Thanks for the review @Angen (and @bb) :)