Page MenuHomeWildfire Games

Do not chase units in FOW/SOD.
Needs RevisionPublic

Authored by Freagarach on Apr 12 2020, 8:15 AM.

Details

Reviewers
wraitii
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Trac Tickets
#1832
#3394
Summary

I found it kinda annoying that entities could just chase entities that disappeared in the FOW/SOD.
This patch introduces a check for the visibility of the target in the approaching and chasing states and lets an entity move to the last known position.

Test Plan

Verify that:

  • Normal approaching/chasing behaviour is maintained.
  • When an entity outruns a chasing entity the latter keeps moving to the last known position.
  • GAIA fauna entities still chase attackers, despite their low LOS, due to GAIA having omnivisibility.

Event Timeline

Freagarach created this revision.Apr 12 2020, 8:15 AM

Open question: should we try to pick up our previous target when it comes into sight again?

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
| 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
|2084|2084| 
|2085|2085| 				"Attacked": function(msg) {
|2086|2086| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2087|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2088|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2087|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2088|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2089|2089| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2090|2090| 				},
|2091|2091| 			},
|    | [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
|2255|2255| 					"MovementUpdate": function(msg) {
|2256|2256| 						// If it looks like the path is failing, and we are close enough (3 tiles) from wanted range
|2257|2257| 						// stop anyways. This avoids pathing for an unreachable goal and reduces lag considerably.
|2258|    |-						if (msg.likelyFailure || 
|    |2258|+						if (msg.likelyFailure ||
|2259|2259| 							msg.obstructed && this.RelaxedMaxRangeCheck(this.order.data, this.order.data.max + this.DefaultRelaxedMaxRange) ||
|2260|2260| 							!msg.obstructed && this.CheckRange(this.order.data))
|2261|2261| 							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
|2897|2897| 					{
|2898|2898| 						// The building was already finished/fully repaired before we arrived;
|2899|2899| 						// let the ConstructionFinished handler handle this.
|2900|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2900|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2901|2901| 						return true;
|2902|2902| 					}
|2903|2903| 
|    | [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
|2897|2897| 					{
|2898|2898| 						// The building was already finished/fully repaired before we arrived;
|2899|2899| 						// let the ConstructionFinished handler handle this.
|2900|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2900|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2901|2901| 						return true;
|2902|2902| 					}
|2903|2903| 
|    | [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
|3195|3195| 				this.StopTimer();
|3196|3196| 				this.ResetAnimation();
|3197|3197| 				if (this.formationAnimationVariant)
|3198|    |-					this.SetAnimationVariant(this.formationAnimationVariant)
|    |3198|+					this.SetAnimationVariant(this.formationAnimationVariant);
|3199|3199| 				else
|3200|3200| 					this.SetDefaultAnimationVariant();
|3201|3201| 				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
|3421|3421| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3422|3422| 
|3423|3423| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3424|    |-							// only used for domestic animals
|    |3424|+		// only used for domestic animals
|3425|3425| 
|3426|3426| 		// Reuse the same garrison behaviour for animals.
|3427|3427| 		"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
|3483|3483| 
|3484|3484| UnitAI.prototype.IsAnimal = function()
|3485|3485| {
|3486|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3486|+	return (!!this.template.NaturalBehaviour);
|3487|3487| };
|3488|3488| 
|3489|3489| 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
|3599|3599| 		{
|3600|3600| 			let index = this.GetCurrentState().indexOf(".");
|3601|3601| 			if (index != -1)
|3602|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3602|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3603|3603| 			this.Stop(false);
|3604|3604| 		}
|3605|3605| 
|    | [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
|3655|3655| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3656|3656| 			continue;
|3657|3657| 		if (i == 0)
|3658|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3658|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3659|3659| 		else
|3660|3660| 			this.orderQueue.splice(i, 1);
|3661|3661| 		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
|3655|3655| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3656|3656| 			continue;
|3657|3657| 		if (i == 0)
|3658|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3658|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3659|3659| 		else
|3660|3660| 			this.orderQueue.splice(i, 1);
|3661|3661| 		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
|3742|3742| };
|3743|3743| 
|3744|3744| 
|3745|    |-//// FSM linkage functions ////
|    |3745|+// // FSM linkage functions ////
|3746|3746| 
|3747|3747| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3748|3748| 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
|3913|3913| 				continue;
|3914|3914| 			if (this.orderQueue[i].type == type)
|3915|3915| 				continue;
|3916|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3916|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3917|3917| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3918|3918| 			return;
|3919|3919| 		}
|    | [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
|3913|3913| 				continue;
|3914|3914| 			if (this.orderQueue[i].type == type)
|3915|3915| 				continue;
|3916|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3916|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3917|3917| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3918|3918| 			return;
|3919|3919| 		}
|    | [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
|4155|4155| 	if (data.timerRepeat === undefined)
|4156|4156| 		this.timer = undefined;
|4157|4157| 
|4158|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4158|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4159|4159| };
|4160|4160| 
|4161|4161| /**
|    | [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
|4155|4155| 	if (data.timerRepeat === undefined)
|4156|4156| 		this.timer = undefined;
|4157|4157| 
|4158|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4158|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4159|4159| };
|4160|4160| 
|4161|4161| /**
|    | [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| 	// TODO: This is a bit inefficient since every unit listens to every
|4201|4201| 	// construction message - ideally we could scope it to only the one we're building
|4202|4202| 
|4203|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4203|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4204|4204| };
|4205|4205| 
|4206|4206| 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
|4200|4200| 	// TODO: This is a bit inefficient since every unit listens to every
|4201|4201| 	// construction message - ideally we could scope it to only the one we're building
|4202|4202| 
|4203|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4203|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4204|4204| };
|4205|4205| 
|4206|4206| 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
|4231|4231| 	if (msg.fromStatusEffect)
|4232|4232| 		return;
|4233|4233| 
|4234|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4234|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4235|4235| };
|4236|4236| 
|4237|4237| 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
|4231|4231| 	if (msg.fromStatusEffect)
|4232|4232| 		return;
|4233|4233| 
|4234|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4234|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4235|4235| };
|4236|4236| 
|4237|4237| 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
|4236|4236| 
|4237|4237| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4238|4238| {
|4239|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4239|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4240|4240| };
|4241|4241| 
|4242|4242| 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
|4236|4236| 
|4237|4237| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4238|4238| {
|4239|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4239|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4240|4240| };
|4241|4241| 
|4242|4242| 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
|4241|4241| 
|4242|4242| UnitAI.prototype.OnHealthChanged = function(msg)
|4243|4243| {
|4244|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4244|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4245|4245| };
|4246|4246| 
|4247|4247| 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
|4241|4241| 
|4242|4242| UnitAI.prototype.OnHealthChanged = function(msg)
|4243|4243| {
|4244|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4244|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4245|4245| };
|4246|4246| 
|4247|4247| 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
|4247|4247| UnitAI.prototype.OnRangeUpdate = function(msg)
|4248|4248| {
|4249|4249| 	if (msg.tag == this.losRangeQuery)
|4250|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4250|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4251|4251| 	else if (msg.tag == this.losHealRangeQuery)
|4252|4252| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4253|4253| };
|    | [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
|4247|4247| UnitAI.prototype.OnRangeUpdate = function(msg)
|4248|4248| {
|4249|4249| 	if (msg.tag == this.losRangeQuery)
|4250|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4250|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4251|4251| 	else if (msg.tag == this.losHealRangeQuery)
|4252|4252| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4253|4253| };
|    | [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
|4249|4249| 	if (msg.tag == this.losRangeQuery)
|4250|4250| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4251|4251| 	else if (msg.tag == this.losHealRangeQuery)
|4252|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4252|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4253|4253| };
|4254|4254| 
|4255|4255| 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
|4249|4249| 	if (msg.tag == this.losRangeQuery)
|4250|4250| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4251|4251| 	else if (msg.tag == this.losHealRangeQuery)
|4252|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4252|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4253|4253| };
|4254|4254| 
|4255|4255| 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
|4254|4254| 
|4255|4255| UnitAI.prototype.OnPackFinished = function(msg)
|4256|4256| {
|4257|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4257|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4258|4258| };
|4259|4259| 
|4260|4260| //// 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
|4254|4254| 
|4255|4255| UnitAI.prototype.OnPackFinished = function(msg)
|4256|4256| {
|4257|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4257|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4258|4258| };
|4259|4259| 
|4260|4260| //// 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
|4257|4257| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4258|4258| };
|4259|4259| 
|4260|    |-//// Helper functions to be called by the FSM ////
|    |4260|+// // Helper functions to be called by the FSM ////
|4261|4261| 
|4262|4262| UnitAI.prototype.GetWalkSpeed = function()
|4263|4263| {
|    | [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
|4969|4969| UnitAI.prototype.AttackEntityInZone = function(ents)
|4970|4970| {
|4971|4971| 	var target = ents.find(target =>
|4972|    |-		this.CanAttack(target)
|4973|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4972|+		this.CanAttack(target) &&
|    |4973|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4974|4974| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4975|4975| 	);
|4976|4976| 	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
|4970|4970| {
|4971|4971| 	var target = ents.find(target =>
|4972|4972| 		this.CanAttack(target)
|4973|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4974|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4973|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4974|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4975|4975| 	);
|4976|4976| 	if (!target)
|4977|4977| 		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
|5034|5034| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|5035|5035| 	if (this.isGuardOf)
|5036|5036| 	{
|5037|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |5037|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|5038|5038| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|5039|5039| 		if (cmpUnitAI && cmpAttack &&
|5040|5040| 		    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
|5038|5038| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|5039|5039| 		if (cmpUnitAI && cmpAttack &&
|5040|5040| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|5041|    |-				return false;
|    |5041|+			return false;
|5042|5042| 	}
|5043|5043| 
|5044|5044| 	// 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
|5076|5076| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|5077|5077| 	if (this.isGuardOf)
|5078|5078| 	{
|5079|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |5079|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|5080|5080| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|5081|5081| 		if (cmpUnitAI && cmpAttack &&
|5082|5082| 		    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
|5089|5089| 	return false;
|5090|5090| };
|5091|5091| 
|5092|    |-//// External interface functions ////
|    |5092|+// // External interface functions ////
|5093|5093| 
|5094|5094| UnitAI.prototype.SetFormationController = function(ent)
|5095|5095| {
|    | [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
|5245|5245| 	{
|5246|5246| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5247|5247| 			return;
|5248|    |-		else
|5249|    |-			this.RemoveGuard();
|    |5248|+		this.RemoveGuard();
|5250|5249| 	}
|5251|5250| 
|5252|5251| 	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
|5576|5576| 
|5577|5577| 	if (this.IsFormationController())
|5578|5578| 		this.CallMemberFunction("CancelSetupTradeRoute", [target]);
|5579|    |-}
|    |5579|+};
|5580|5580| /**
|5581|5581|  * Adds trade order to the queue. Either walk to the first market, or
|5582|5582|  * 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
|5597|5597| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5598|5598| 	{
|5599|5599| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5600|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5600|+		if (cmpTrader.HasBothMarkets() &&
|5601|5601| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5602|5602| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5603|5603| 		{
|    | [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
|5878|5878| 				{
|5879|5879| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5880|5880| 					var targetClasses = this.order.data.targetClasses;
|5881|    |-					if (targetClasses.attack && cmpIdentity
|5882|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5881|+					if (targetClasses.attack && cmpIdentity &&
|    |5882|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5883|5883| 						continue;
|5884|5884| 					if (targetClasses.avoid && cmpIdentity
|5885|5885| 						&& 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
|5881|5881| 					if (targetClasses.attack && cmpIdentity
|5882|5882| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5883|5883| 						continue;
|5884|    |-					if (targetClasses.avoid && cmpIdentity
|5885|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5884|+					if (targetClasses.avoid && cmpIdentity &&
|    |5885|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5886|5886| 						continue;
|5887|5887| 					// Only used by the AIs to prevent some choices of targets
|5888|5888| 					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
|5904|5904| 		{
|5905|5905| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5906|5906| 			var targetClasses = this.order.data.targetClasses;
|5907|    |-			if (cmpIdentity && targetClasses.attack
|5908|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5907|+			if (cmpIdentity && targetClasses.attack &&
|    |5908|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5909|5909| 				continue;
|5910|5910| 			if (cmpIdentity && targetClasses.avoid
|5911|5911| 				&& 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
|5907|5907| 			if (cmpIdentity && targetClasses.attack
|5908|5908| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5909|5909| 				continue;
|5910|    |-			if (cmpIdentity && targetClasses.avoid
|5911|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5910|+			if (cmpIdentity && targetClasses.avoid &&
|    |5911|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5912|5912| 				continue;
|5913|5913| 			// Only used by the AIs to prevent some choices of targets
|5914|5914| 			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
|6050|6050| 
|6051|6051| UnitAI.prototype.SetHeldPosition = function(x, z)
|6052|6052| {
|6053|    |-	this.heldPosition = {"x": x, "z": z};
|    |6053|+	this.heldPosition = { "x": x, "z": z};
|6054|6054| };
|6055|6055| 
|6056|6056| 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
|6050|6050| 
|6051|6051| UnitAI.prototype.SetHeldPosition = function(x, z)
|6052|6052| {
|6053|    |-	this.heldPosition = {"x": x, "z": z};
|    |6053|+	this.heldPosition = {"x": x, "z": z };
|6054|6054| };
|6055|6055| 
|6056|6056| 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
|6077|6077| 	return false;
|6078|6078| };
|6079|6079| 
|6080|    |-//// Helper functions ////
|    |6080|+// // Helper functions ////
|6081|6081| 
|6082|6082| /**
|6083|6083|  * 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
|6096|6096| 		return undefined;
|6097|6097| 
|6098|6098| 	return component.GetRange(type);
|6099|    |-}
|    |6099|+};
|6100|6100| 
|6101|6101| UnitAI.prototype.CanAttack = function(target)
|6102|6102| {
|    | [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
|6294|6294| 	return cmpPack && cmpPack.IsPacking();
|6295|6295| };
|6296|6296| 
|6297|    |-//// Formation specific functions ////
|    |6297|+// // Formation specific functions ////
|6298|6298| 
|6299|6299| UnitAI.prototype.IsAttackingAsFormation = function()
|6300|6300| {
|    | [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
|6299|6299| UnitAI.prototype.IsAttackingAsFormation = function()
|6300|6300| {
|6301|6301| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6302|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6303|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6302|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6303|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6304|6304| };
|6305|6305| 
|6306|6306| //// 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
|6303|6303| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6304|6304| };
|6305|6305| 
|6306|    |-//// Animal specific functions ////
|    |6306|+// // Animal specific functions ////
|6307|6307| 
|6308|6308| UnitAI.prototype.MoveRandomly = function(distance)
|6309|6309| {

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|4060| »   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
|4956| »   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
|4971| »   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
|5017| »   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
|5040| »   »   ····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
|2088| »   »   »   »   »   »   &&·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
|3198| »   »   »   »   »   this.SetAnimationVariant(this.formationAnimationVariant)
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

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

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

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

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

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

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

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

Freagarach updated the Trac tickets for this revision.Apr 12 2020, 1:57 PM

Open question: should we try to pick up our previous target when it comes into sight again?

I'm unsure how exactly that would work. Obviously, if the unit has received a new order it shouldn't care about the previous target anymore, but if it loses the target and then becomes idle the unit will attack the first enemy it sees anyways, in which case I don't think it would be best to switch targets after already starting to fight with a different unit.

What I had in mind was that while it is walking to the last known position and seeing its former target, it could pick that up as a target. So that is before it turns idle.

Freagarach updated the Trac tickets for this revision.Apr 16 2020, 6:33 PM
wraitii requested changes to this revision.May 30 2020, 3:15 PM
wraitii added a subscriber: wraitii.

I believe ShouldAbandonChase already has code to do that, but maybe compare with your implementation.

I don't think you should default to trying to approach the target in FOW. It seems more like a last resort to me, even if the player explicitly ordered the move. Perhaps check what others RTS do? in any case, for unforced orders, the entity should definitely FinishOrder and let the Idle logic pickup.

MoveToApproachingPoint is also weird and seems to duplicate code we have elsewhere.

This revision now requires changes to proceed.May 30 2020, 3:15 PM