Page MenuHomeWildfire Games

[WIP] - Fake physics.
AbandonedPublic

Authored by Freagarach on Nov 28 2019, 7:56 PM.

Details

Reviewers
wraitii
Trac Tickets
#2319
Summary

It'd be cool to have the ability to let units fly away by great force or slide down a hill when dead.
Proper physics simulation is difficult and demanding, therefore some simple system can be put in place (first).

Test Plan

One can test how the physics feels for now by altering the numbers in the test code in UnitAI.js.

Event Timeline

Freagarach created this revision.Nov 28 2019, 7:56 PM
Owners added a subscriber: Restricted Owners Package.Nov 28 2019, 7:56 PM
Freagarach added a subscriber: wraitii.EditedNov 28 2019, 7:56 PM

Straight from @wraitii's patch from the ticket.
[EDIT]: I've missed the template_unit_ship in changing the decays.

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

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

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

Linter detected issues:
Executing section Source...

source/simulation2/components/ICmpDecay.cpp
|   1| /*·Copyright·(C)·2010·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2019" year instead of "2010"

source/simulation2/components/ICmpDecay.h
|   1| /*·Copyright·(C)·2010·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2019" year instead of "2010"

source/simulation2/components/ICmpDecay.h
|  26| class·ICmpDecay·:·public·IComponent
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'classICmpDecay:' is invalid C code. Use --std or --language to configure the language.

source/simulation2/components/CCmpDecay.cpp
|   1| /*·Copyright·(C)·2015·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2019" year instead of "2015"
Executing section JS...
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Health.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Health.js
| 428| 428| 
| 429| 429| 	if (this.regenRate != oldRegenRate || this.idleRegenRate != oldIdleRegenRate)
| 430| 430| 		this.CheckRegenTimer();
| 431|    |-}
|    | 431|+};
| 432| 432| 
| 433| 433| Health.prototype.OnValueModification = function(msg)
| 434| 434| {
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Health.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Health.js
| 440| 440| {
| 441| 441| 	if (msg.to != INVALID_PLAYER)
| 442| 442| 		this.RecalculateValues();
| 443|    |-}
|    | 443|+};
| 444| 444| 
| 445| 445| Health.prototype.RegisterHealthChanged = function(from)
| 446| 446| {

binaries/data/mods/public/simulation/components/Health.js
| 431| }
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

Silier added a subscriber: Silier.Nov 29 2019, 8:35 AM
Silier added inline comments.
binaries/data/mods/public/simulation/helpers/Attacking.js
267 ↗(On Diff #10433)

mind to call GetPosition just once?

268 ↗(On Diff #10433)

any reasons why 4 and 10 ?

source/simulation2/components/CCmpDecay.cpp
258 ↗(On Diff #10433)

msgFata.deltaSimTime is called quite often and it is just read from it
it should be cached so it does not need to jump into that structure all the time
also space around * operator pls

269 ↗(On Diff #10433)

just sink ? anyway looks like not needed comment for me

288 ↗(On Diff #10433)

is that not obvious from reading the code?

292 ↗(On Diff #10433)

// R

294 ↗(On Diff #10433)

spaces around -

297 ↗(On Diff #10433)

any specific reason why -2 ?

301 ↗(On Diff #10433)

// Check if

313 ↗(On Diff #10433)

space after ,

source/simulation2/components/ICmpDecay.h
29 ↗(On Diff #10433)

// Adds

Freagarach planned changes to this revision.Dec 1 2019, 9:38 PM

I'll move the simple physics outside of CmpDecay.

(Should have submitted this immediately.)

Freagarach updated this revision to Diff 10458.Dec 2 2019, 8:38 AM
Freagarach edited the test plan for this revision. (Show Details)

Moved out of CCmpDecay.
(Means discarding the decay part for now, but should be added back in the future.)

Freagarach added a comment.EditedDec 2 2019, 8:42 AM

MaxForce and MomentOfInertia won't be used.

Just a side-note, I am not a Physicist, so please correct me where applicable.

source/simulation2/components/CCmpPhysics.cpp
217

Still no clue where @wraitii used the -2 for :s

Vulcan added a comment.Dec 2 2019, 8:49 AM

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

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

Vulcan added a comment.Dec 2 2019, 9:22 AM

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

Linter detected issues:
Executing section Source...

source/simulation2/components/ICmpPhysics.h
|  27| class·ICmpPhysics·:·public·IComponent
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'classICmpPhysics:' is invalid C code. Use --std or --language to configure the language.
Executing section JS...
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 0.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 240| 240| 			this.FinishOrder();
| 241| 241| 			return;
| 242| 242| 		}
| 243|    |-let cmpPhysics = Engine.QueryInterface(this.entity, IID_Physics);
|    | 243|+		let cmpPhysics = Engine.QueryInterface(this.entity, IID_Physics);
| 244| 244| if (cmpPhysics)
| 245| 245| {
| 246| 246| 	cmpPhysics.SetActive(true);
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 0.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 241| 241| 			return;
| 242| 242| 		}
| 243| 243| let cmpPhysics = Engine.QueryInterface(this.entity, IID_Physics);
| 244|    |-if (cmpPhysics)
|    | 244|+		if (cmpPhysics)
| 245| 245| {
| 246| 246| 	cmpPhysics.SetActive(true);
| 247| 247| 	cmpPhysics.ApplyForce(0, 100, 0);
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 0.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 242| 242| 		}
| 243| 243| let cmpPhysics = Engine.QueryInterface(this.entity, IID_Physics);
| 244| 244| if (cmpPhysics)
| 245|    |-{
|    | 245|+		{
| 246| 246| 	cmpPhysics.SetActive(true);
| 247| 247| 	cmpPhysics.ApplyForce(0, 100, 0);
| 248| 248| }
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 1.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 243| 243| let cmpPhysics = Engine.QueryInterface(this.entity, IID_Physics);
| 244| 244| if (cmpPhysics)
| 245| 245| {
| 246|    |-	cmpPhysics.SetActive(true);
|    | 246|+			cmpPhysics.SetActive(true);
| 247| 247| 	cmpPhysics.ApplyForce(0, 100, 0);
| 248| 248| }
| 249| 249| 		// Stop moving immediately.
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 1.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 244| 244| if (cmpPhysics)
| 245| 245| {
| 246| 246| 	cmpPhysics.SetActive(true);
| 247|    |-	cmpPhysics.ApplyForce(0, 100, 0);
|    | 247|+			cmpPhysics.ApplyForce(0, 100, 0);
| 248| 248| }
| 249| 249| 		// Stop moving immediately.
| 250| 250| 		this.StopMoving();
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 0.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 245| 245| {
| 246| 246| 	cmpPhysics.SetActive(true);
| 247| 247| 	cmpPhysics.ApplyForce(0, 100, 0);
| 248|    |-}
|    | 248|+		}
| 249| 249| 		// Stop moving immediately.
| 250| 250| 		this.StopMoving();
| 251| 251| 		this.FinishOrder();
|    | [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
| 767| 767| 					this.FinishOrder();
| 768| 768| 					return;
| 769| 769| 				}
| 770|    |-				else
| 771|    |-				{
|    | 770|+				
| 772| 771| 					this.SetNextState("GARRISON.APPROACHING");
| 773| 772| 					return;
| 774|    |-				}
|    | 773|+				
| 775| 774| 			}
| 776| 775| 
| 777| 776| 			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
|1035|1035| 			},
|1036|1036| 		},
|1037|1037| 
|1038|    |-		"GARRISON":{
|    |1038|+		"GARRISON": {
|1039|1039| 			"enter": function() {
|1040|1040| 				// If the garrisonholder should pickup, warn it so it can take needed action
|1041|1041| 				var cmpGarrisonHolder = Engine.QueryInterface(this.order.data.target, IID_GarrisonHolder);
|    | [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
|1984|1984| 
|1985|1985| 				"Attacked": function(msg) {
|1986|1986| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|1987|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|1988|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |1987|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |1988|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|1989|1989| 						this.RespondToTargetedEntities([msg.data.attacker]);
|1990|1990| 				},
|1991|1991| 			},
|    | [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
|2712|2712| 					{
|2713|2713| 						// The building was already finished/fully repaired before we arrived;
|2714|2714| 						// let the ConstructionFinished handler handle this.
|2715|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2715|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2716|2716| 						return true;
|2717|2717| 					}
|2718|2718| 
|    | [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
|2712|2712| 					{
|2713|2713| 						// The building was already finished/fully repaired before we arrived;
|2714|2714| 						// let the ConstructionFinished handler handle this.
|2715|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2715|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2716|2716| 						return true;
|2717|2717| 					}
|2718|2718| 
|    | [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
|3225|3225| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3226|3226| 
|3227|3227| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3228|    |-							// only used for domestic animals
|    |3228|+		// only used for domestic animals
|3229|3229| 	},
|3230|3230| };
|3231|3231| 
|    | [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
|3282|3282| 
|3283|3283| UnitAI.prototype.IsAnimal = function()
|3284|3284| {
|3285|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3285|+	return (!!this.template.NaturalBehaviour);
|3286|3286| };
|3287|3287| 
|3288|3288| 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
|3398|3398| 		{
|3399|3399| 			let index = this.GetCurrentState().indexOf(".");
|3400|3400| 			if (index != -1)
|3401|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3401|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3402|3402| 			this.Stop(false);
|3403|3403| 		}
|3404|3404| 
|    | [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
|3454|3454| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3455|3455| 			continue;
|3456|3456| 		if (i == 0)
|3457|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3457|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3458|3458| 		else
|3459|3459| 			this.orderQueue.splice(i, 1);
|3460|3460| 		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
|3454|3454| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3455|3455| 			continue;
|3456|3456| 		if (i == 0)
|3457|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3457|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3458|3458| 		else
|3459|3459| 			this.orderQueue.splice(i, 1);
|3460|3460| 		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
|3538|3538| };
|3539|3539| 
|3540|3540| 
|3541|    |-//// FSM linkage functions ////
|    |3541|+// // FSM linkage functions ////
|3542|3542| 
|3543|3543| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3544|3544| 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
|3708|3708| 				continue;
|3709|3709| 			if (this.orderQueue[i].type == type)
|3710|3710| 				continue;
|3711|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3711|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3712|3712| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3713|3713| 			return;
|3714|3714| 		}
|    | [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
|3708|3708| 				continue;
|3709|3709| 			if (this.orderQueue[i].type == type)
|3710|3710| 				continue;
|3711|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3711|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3712|3712| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3713|3713| 			return;
|3714|3714| 		}
|    | [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
|3879|3879| 	if (data.timerRepeat === undefined)
|3880|3880| 		this.timer = undefined;
|3881|3881| 
|3882|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3882|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3883|3883| };
|3884|3884| 
|3885|3885| /**
|    | [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
|3879|3879| 	if (data.timerRepeat === undefined)
|3880|3880| 		this.timer = undefined;
|3881|3881| 
|3882|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3882|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3883|3883| };
|3884|3884| 
|3885|3885| /**
|    | [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
|3924|3924| 	// TODO: This is a bit inefficient since every unit listens to every
|3925|3925| 	// construction message - ideally we could scope it to only the one we're building
|3926|3926| 
|3927|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3927|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3928|3928| };
|3929|3929| 
|3930|3930| 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
|3924|3924| 	// TODO: This is a bit inefficient since every unit listens to every
|3925|3925| 	// construction message - ideally we could scope it to only the one we're building
|3926|3926| 
|3927|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3927|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3928|3928| };
|3929|3929| 
|3930|3930| 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
|3949|3949| 
|3950|3950| UnitAI.prototype.OnAttacked = function(msg)
|3951|3951| {
|3952|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3952|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3953|3953| };
|3954|3954| 
|3955|3955| 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
|3949|3949| 
|3950|3950| UnitAI.prototype.OnAttacked = function(msg)
|3951|3951| {
|3952|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3952|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3953|3953| };
|3954|3954| 
|3955|3955| 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
|3954|3954| 
|3955|3955| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3956|3956| {
|3957|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3957|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|3958|3958| };
|3959|3959| 
|3960|3960| 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
|3954|3954| 
|3955|3955| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3956|3956| {
|3957|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3957|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|3958|3958| };
|3959|3959| 
|3960|3960| 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
|3959|3959| 
|3960|3960| UnitAI.prototype.OnHealthChanged = function(msg)
|3961|3961| {
|3962|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3962|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|3963|3963| };
|3964|3964| 
|3965|3965| 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
|3959|3959| 
|3960|3960| UnitAI.prototype.OnHealthChanged = function(msg)
|3961|3961| {
|3962|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3962|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|3963|3963| };
|3964|3964| 
|3965|3965| 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
|3965|3965| UnitAI.prototype.OnRangeUpdate = function(msg)
|3966|3966| {
|3967|3967| 	if (msg.tag == this.losRangeQuery)
|3968|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3968|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|3969|3969| 	else if (msg.tag == this.losHealRangeQuery)
|3970|3970| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3971|3971| };
|    | [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
|3965|3965| UnitAI.prototype.OnRangeUpdate = function(msg)
|3966|3966| {
|3967|3967| 	if (msg.tag == this.losRangeQuery)
|3968|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |3968|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|3969|3969| 	else if (msg.tag == this.losHealRangeQuery)
|3970|3970| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|3971|3971| };
|    | [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
|3967|3967| 	if (msg.tag == this.losRangeQuery)
|3968|3968| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3969|3969| 	else if (msg.tag == this.losHealRangeQuery)
|3970|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3970|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|3971|3971| };
|3972|3972| 
|3973|3973| 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
|3967|3967| 	if (msg.tag == this.losRangeQuery)
|3968|3968| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|3969|3969| 	else if (msg.tag == this.losHealRangeQuery)
|3970|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |3970|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|3971|3971| };
|3972|3972| 
|3973|3973| 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
|3972|3972| 
|3973|3973| UnitAI.prototype.OnPackFinished = function(msg)
|3974|3974| {
|3975|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3975|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|3976|3976| };
|3977|3977| 
|3978|3978| //// 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
|3972|3972| 
|3973|3973| UnitAI.prototype.OnPackFinished = function(msg)
|3974|3974| {
|3975|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |3975|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|3976|3976| };
|3977|3977| 
|3978|3978| //// 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
|3975|3975| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|3976|3976| };
|3977|3977| 
|3978|    |-//// Helper functions to be called by the FSM ////
|    |3978|+// // Helper functions to be called by the FSM ////
|3979|3979| 
|3980|3980| UnitAI.prototype.GetWalkSpeed = function()
|3981|3981| {
|    | [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
|4644|4644| UnitAI.prototype.AttackEntityInZone = function(ents)
|4645|4645| {
|4646|4646| 	var target = ents.find(target =>
|4647|    |-		this.CanAttack(target)
|4648|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4647|+		this.CanAttack(target) &&
|    |4648|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4649|4649| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4650|4650| 	);
|4651|4651| 	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
|4645|4645| {
|4646|4646| 	var target = ents.find(target =>
|4647|4647| 		this.CanAttack(target)
|4648|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4649|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4648|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4649|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4650|4650| 	);
|4651|4651| 	if (!target)
|4652|4652| 		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
|4709|4709| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4710|4710| 	if (this.isGuardOf)
|4711|4711| 	{
|4712|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4712|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4713|4713| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4714|4714| 		if (cmpUnitAI && cmpAttack &&
|4715|4715| 		    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
|4713|4713| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4714|4714| 		if (cmpUnitAI && cmpAttack &&
|4715|4715| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4716|    |-				return false;
|    |4716|+			return false;
|4717|4717| 	}
|4718|4718| 
|4719|4719| 	// 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
|4751|4751| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4752|4752| 	if (this.isGuardOf)
|4753|4753| 	{
|4754|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4754|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4755|4755| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4756|4756| 		if (cmpUnitAI && cmpAttack &&
|4757|4757| 		    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
|4764|4764| 	return false;
|4765|4765| };
|4766|4766| 
|4767|    |-//// External interface functions ////
|    |4767|+// // External interface functions ////
|4768|4768| 
|4769|4769| UnitAI.prototype.SetFormationController = function(ent)
|4770|4770| {
|    | [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
|4920|4920| 	{
|4921|4921| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4922|4922| 			return;
|4923|    |-		else
|4924|    |-			this.RemoveGuard();
|    |4923|+		this.RemoveGuard();
|4925|4924| 	}
|4926|4925| 
|4927|4926| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|    | [NORMAL] ESLintBear (no-trailing-spaces):
|    | Trailing spaces not allowed.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5252|5252| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5253|5253| 	{
|5254|5254| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5255|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5255|+		if (cmpTrader.HasBothMarkets() &&
|5256|5256| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5257|5257| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5258|5258| 		{
|    | [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
|5533|5533| 				{
|5534|5534| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5535|5535| 					var targetClasses = this.order.data.targetClasses;
|5536|    |-					if (targetClasses.attack && cmpIdentity
|5537|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5536|+					if (targetClasses.attack && cmpIdentity &&
|    |5537|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5538|5538| 						continue;
|5539|5539| 					if (targetClasses.avoid && cmpIdentity
|5540|5540| 						&& 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
|5536|5536| 					if (targetClasses.attack && cmpIdentity
|5537|5537| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5538|5538| 						continue;
|5539|    |-					if (targetClasses.avoid && cmpIdentity
|5540|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5539|+					if (targetClasses.avoid && cmpIdentity &&
|    |5540|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5541|5541| 						continue;
|5542|5542| 					// Only used by the AIs to prevent some choices of targets
|5543|5543| 					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
|5559|5559| 		{
|5560|5560| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5561|5561| 			var targetClasses = this.order.data.targetClasses;
|5562|    |-			if (cmpIdentity && targetClasses.attack
|5563|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5562|+			if (cmpIdentity && targetClasses.attack &&
|    |5563|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5564|5564| 				continue;
|5565|5565| 			if (cmpIdentity && targetClasses.avoid
|5566|5566| 				&& 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
|5562|5562| 			if (cmpIdentity && targetClasses.attack
|5563|5563| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5564|5564| 				continue;
|5565|    |-			if (cmpIdentity && targetClasses.avoid
|5566|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5565|+			if (cmpIdentity && targetClasses.avoid &&
|    |5566|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5567|5567| 				continue;
|5568|5568| 			// Only used by the AIs to prevent some choices of targets
|5569|5569| 			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
|5719|5719| 
|5720|5720| UnitAI.prototype.SetHeldPosition = function(x, z)
|5721|5721| {
|5722|    |-	this.heldPosition = {"x": x, "z": z};
|    |5722|+	this.heldPosition = { "x": x, "z": z};
|5723|5723| };
|5724|5724| 
|5725|5725| 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
|5719|5719| 
|5720|5720| UnitAI.prototype.SetHeldPosition = function(x, z)
|5721|5721| {
|5722|    |-	this.heldPosition = {"x": x, "z": z};
|    |5722|+	this.heldPosition = {"x": x, "z": z };
|5723|5723| };
|5724|5724| 
|5725|5725| 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
|5746|5746| 	return false;
|5747|5747| };
|5748|5748| 
|5749|    |-//// Helper functions ////
|    |5749|+// // Helper functions ////
|5750|5750| 
|5751|5751| UnitAI.prototype.CanAttack = function(target)
|5752|5752| {
|    | [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
|5950|5950| 	return cmpPack && cmpPack.IsPacking();
|5951|5951| };
|5952|5952| 
|5953|    |-//// Formation specific functions ////
|    |5953|+// // Formation specific functions ////
|5954|5954| 
|5955|5955| UnitAI.prototype.IsAttackingAsFormation = function()
|5956|5956| {
|    | [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
|5955|5955| UnitAI.prototype.IsAttackingAsFormation = function()
|5956|5956| {
|5957|5957| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5958|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5959|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5958|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5959|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5960|5960| };
|5961|5961| 
|5962|5962| //// 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
|5959|5959| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5960|5960| };
|5961|5961| 
|5962|    |-//// Animal specific functions ////
|    |5962|+// // Animal specific functions ////
|5963|5963| 
|5964|5964| UnitAI.prototype.MoveRandomly = function(distance)
|5965|5965| {

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

binaries/data/mods/public/simulation/components/UnitAI.js
| 922| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
| 947| »   »   »   "enter":·function(msg)·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

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

binaries/data/mods/public/simulation/components/UnitAI.js
|1060| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1096| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1128| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1288| »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1345| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1520| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1542| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1574| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1728| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1778| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1856| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2033| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2149| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2424| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2457| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2563| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2629| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2668| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2879| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|3060| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|3784| »   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
|4631| »   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
|4646| »   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
|4692| »   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
|4715| »   »   ····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
|1988| »   »   »   »   »   »   &&·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
|3746| »   »   var·order·=·{·"type":·type,·"data":·data·};
|    | [NORMAL] JSHintBear:
|    | 'order' is already defined.

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|5563| »   »   »   »   &&·!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
|5566| »   »   »   »   &&·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
|5641| »   »   var·cmpVision·=·Engine.QueryInterface(this.entity,·IID_Vision);
|    | [NORMAL] JSHintBear:
|    | 'cmpVision' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|5644| »   »   var·range·=·cmpVision.GetRange();
|    | [NORMAL] JSHintBear:
|    | 'range' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|5649| »   »   var·cmpRanged·=·Engine.QueryInterface(this.entity,·iid);
|    | [NORMAL] JSHintBear:
|    | 'cmpRanged' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|5652| »   »   var·range·=·iid·!==·IID_Attack·?·cmpRanged.GetRange()·:·cmpRanged.GetFullAttackRange();
|    | [NORMAL] JSHintBear:
|    | 'range' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|5653| »   »   var·cmpVision·=·Engine.QueryInterface(this.entity,·IID_Vision);
|    | [NORMAL] JSHintBear:
|    | 'cmpVision' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|5663| »   »   var·cmpVision·=·Engine.QueryInterface(this.entity,·IID_Vision);
|    | [NORMAL] JSHintBear:
|    | 'cmpVision' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|5666| »   »   var·range·=·cmpVision.GetRange();
|    | [NORMAL] JSHintBear:
|    | 'range' is already defined.

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

Freagarach planned changes to this revision.Dec 7 2019, 10:55 AM

It should probably be written like cmpUnitMotion, i.e.:

  • Calculate how far we move in dt.
  • Move that and subtract the energy.
Freagarach updated this revision to Diff 10650.Dec 19 2019, 8:07 PM

Save some more WIP, formation change should be gone.

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

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

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

Linter detected issues:
Executing section Source...

source/simulation2/components/ICmpPhysics.h
|  27| class·ICmpPhysics·:·public·IComponent
|    | [MAJOR] CPPCheckBear (syntaxError):
|    | Code 'classICmpPhysics:' is invalid C code. Use --std or --language to configure the language.
Executing section JS...
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 119| 119| 	this.formationMembersWithAura = []; // Members with a formation aura
| 120| 120| 	this.width = 0;
| 121| 121| 	this.depth = 0;
| 122|    |-	this.oldOrientation = {"sin": 0, "cos": 0};
|    | 122|+	this.oldOrientation = { "sin": 0, "cos": 0};
| 123| 123| 	this.twinFormations = [];
| 124| 124| 	// distance from which two twin formations will merge into one.
| 125| 125| 	this.formationSeparation = 0;
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 119| 119| 	this.formationMembersWithAura = []; // Members with a formation aura
| 120| 120| 	this.width = 0;
| 121| 121| 	this.depth = 0;
| 122|    |-	this.oldOrientation = {"sin": 0, "cos": 0};
|    | 122|+	this.oldOrientation = {"sin": 0, "cos": 0 };
| 123| 123| 	this.twinFormations = [];
| 124| 124| 	// distance from which two twin formations will merge into one.
| 125| 125| 	this.formationSeparation = 0;
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 137| 137| 
| 138| 138| Formation.prototype.GetSize = function()
| 139| 139| {
| 140|    |-	return {"width": this.width, "depth": this.depth};
|    | 140|+	return { "width": this.width, "depth": this.depth};
| 141| 141| };
| 142| 142| 
| 143| 143| Formation.prototype.GetSpeedMultiplier = function()
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 137| 137| 
| 138| 138| Formation.prototype.GetSize = function()
| 139| 139| {
| 140|    |-	return {"width": this.width, "depth": this.depth};
|    | 140|+	return {"width": this.width, "depth": this.depth };
| 141| 141| };
| 142| 142| 
| 143| 143| Formation.prototype.GetSpeedMultiplier = function()
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 564| 564| 			footprints.push(cmpFootprint.GetShape());
| 565| 565| 	}
| 566| 566| 	if (!footprints.length)
| 567|    |-		return {"width":1, "depth": 1};
|    | 567|+		return { "width":1, "depth": 1};
| 568| 568| 
| 569| 569| 	var r = {"width": 0, "depth": 0};
| 570| 570| 	for (var shape of footprints)
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'width'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 564| 564| 			footprints.push(cmpFootprint.GetShape());
| 565| 565| 	}
| 566| 566| 	if (!footprints.length)
| 567|    |-		return {"width":1, "depth": 1};
|    | 567|+		return {"width": 1, "depth": 1};
| 568| 568| 
| 569| 569| 	var r = {"width": 0, "depth": 0};
| 570| 570| 	for (var shape of footprints)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 564| 564| 			footprints.push(cmpFootprint.GetShape());
| 565| 565| 	}
| 566| 566| 	if (!footprints.length)
| 567|    |-		return {"width":1, "depth": 1};
|    | 567|+		return {"width":1, "depth": 1 };
| 568| 568| 
| 569| 569| 	var r = {"width": 0, "depth": 0};
| 570| 570| 	for (var shape of footprints)
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 566| 566| 	if (!footprints.length)
| 567| 567| 		return {"width":1, "depth": 1};
| 568| 568| 
| 569|    |-	var r = {"width": 0, "depth": 0};
|    | 569|+	var r = { "width": 0, "depth": 0};
| 570| 570| 	for (var shape of footprints)
| 571| 571| 	{
| 572| 572| 		if (shape.type == "circle")
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 566| 566| 	if (!footprints.length)
| 567| 567| 		return {"width":1, "depth": 1};
| 568| 568| 
| 569|    |-	var r = {"width": 0, "depth": 0};
|    | 569|+	var r = {"width": 0, "depth": 0 };
| 570| 570| 	for (var shape of footprints)
| 571| 571| 	{
| 572| 572| 		if (shape.type == "circle")
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 592| 592| 	separation.depth *= this.separationMultiplier.depth;
| 593| 593| 
| 594| 594| 	if (this.columnar)
| 595|    |-		var sortingClasses = ["Cavalry","Infantry"];
|    | 595|+		var sortingClasses = ["Cavalry", "Infantry"];
| 596| 596| 	else
| 597| 597| 		var sortingClasses = this.sortingClasses.slice();
| 598| 598| 	sortingClasses.push("Unknown");
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 612| 612| 		{
| 613| 613| 			if (classes.indexOf(sortingClasses[c]) > -1)
| 614| 614| 			{
| 615|    |-				types[sortingClasses[c]].push({"ent": active[i], "pos": positions[i]});
|    | 615|+				types[sortingClasses[c]].push({ "ent": active[i], "pos": positions[i]});
| 616| 616| 				done = true;
| 617| 617| 				break;
| 618| 618| 			}
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 612| 612| 		{
| 613| 613| 			if (classes.indexOf(sortingClasses[c]) > -1)
| 614| 614| 			{
| 615|    |-				types[sortingClasses[c]].push({"ent": active[i], "pos": positions[i]});
|    | 615|+				types[sortingClasses[c]].push({"ent": active[i], "pos": positions[i] });
| 616| 616| 				done = true;
| 617| 617| 				break;
| 618| 618| 			}
|    | [NORMAL] ESLintBear (dot-notation):
|    | ["Unknown"] is better written in dot notation.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 618| 618| 			}
| 619| 619| 		}
| 620| 620| 		if (!done)
| 621|    |-			types["Unknown"].push({"ent": active[i], "pos": positions[i]});
|    | 621|+			types.Unknown.push({"ent": active[i], "pos": positions[i]});
| 622| 622| 	}
| 623| 623| 
| 624| 624| 	var count = active.length;
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 618| 618| 			}
| 619| 619| 		}
| 620| 620| 		if (!done)
| 621|    |-			types["Unknown"].push({"ent": active[i], "pos": positions[i]});
|    | 621|+			types["Unknown"].push({ "ent": active[i], "pos": positions[i]});
| 622| 622| 	}
| 623| 623| 
| 624| 624| 	var count = active.length;
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 618| 618| 			}
| 619| 619| 		}
| 620| 620| 		if (!done)
| 621|    |-			types["Unknown"].push({"ent": active[i], "pos": positions[i]});
|    | 621|+			types["Unknown"].push({"ent": active[i], "pos": positions[i] });
| 622| 622| 	}
| 623| 623| 
| 624| 624| 	var count = active.length;
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 636| 636| 	if (this.columnar)
| 637| 637| 	{
| 638| 638| 		shape = "square";
| 639|    |-		cols = Math.min(count,3);
|    | 639|+		cols = Math.min(count, 3);
| 640| 640| 		shiftRows = false;
| 641| 641| 		centerGap = 0;
| 642| 642| 		sortingOrder = null;
|    | [NORMAL] ESLintBear (space-before-function-paren):
|    | Unexpected space before function parentheses.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 731| 731| 	// calculating offset distances without a zero average makes no sense, as the formation
| 732| 732| 	// will jump to a different position any time
| 733| 733| 	var avgoffset = Vector2D.average(offsets);
| 734|    |-	offsets.forEach(function (o) {o.sub(avgoffset);});
|    | 734|+	offsets.forEach(function(o) {o.sub(avgoffset);});
| 735| 735| 
| 736| 736| 	// sort the available places in certain ways
| 737| 737| 	// the places first in the list will contain the heaviest units as defined by the order
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 790| 790| 			closestOffsetId = i;
| 791| 791| 		}
| 792| 792| 	}
| 793|    |-	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
|    | 793|+	this.memberPositions[entPos.ent] = { "row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
| 794| 794| 	return closestOffsetId;
| 795| 795| };
| 796| 796| 
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'column'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 790| 790| 			closestOffsetId = i;
| 791| 791| 		}
| 792| 792| 	}
| 793|    |-	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
|    | 793|+	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column": offsets[closestOffsetId].column};
| 794| 794| 	return closestOffsetId;
| 795| 795| };
| 796| 796| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 790| 790| 			closestOffsetId = i;
| 791| 791| 		}
| 792| 792| 	}
| 793|    |-	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column};
|    | 793|+	this.memberPositions[entPos.ent] = {"row": offsets[closestOffsetId].row, "column":offsets[closestOffsetId].column };
| 794| 794| 	return closestOffsetId;
| 795| 795| };
| 796| 796| 
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 800| 800| Formation.prototype.GetRealOffsetPositions = function(offsets, pos)
| 801| 801| {
| 802| 802| 	var offsetPositions = [];
| 803|    |-	var {sin, cos} = this.GetEstimatedOrientation(pos);
|    | 803|+	var { sin, cos} = this.GetEstimatedOrientation(pos);
| 804| 804| 	// calculate the world positions
| 805| 805| 	for (var o of offsets)
| 806| 806| 		offsetPositions.push(new Vector2D(pos.x + o.y * sin + o.x * cos, pos.y + o.y * cos - o.x * sin));
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 800| 800| Formation.prototype.GetRealOffsetPositions = function(offsets, pos)
| 801| 801| {
| 802| 802| 	var offsetPositions = [];
| 803|    |-	var {sin, cos} = this.GetEstimatedOrientation(pos);
|    | 803|+	var {sin, cos } = this.GetEstimatedOrientation(pos);
| 804| 804| 	// calculate the world positions
| 805| 805| 	for (var o of offsets)
| 806| 806| 		offsetPositions.push(new Vector2D(pos.x + o.y * sin + o.x * cos, pos.y + o.y * cos - o.x * sin));
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required after '{'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 817| 817| Formation.prototype.GetEstimatedOrientation = function(pos)
| 818| 818| {
| 819| 819| 	var cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI);
| 820|    |-	var r = {"sin": 0, "cos": 1};
|    | 820|+	var r = { "sin": 0, "cos": 1};
| 821| 821| 	var unitAIState = cmpUnitAI.GetCurrentState();
| 822| 822| 	if (unitAIState == "FORMATIONCONTROLLER.WALKING" || unitAIState == "FORMATIONCONTROLLER.COMBAT.APPROACHING")
| 823| 823| 	{
|    | [NORMAL] ESLintBear (object-curly-spacing):
|    | A space is required before '}'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 817| 817| Formation.prototype.GetEstimatedOrientation = function(pos)
| 818| 818| {
| 819| 819| 	var cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI);
| 820|    |-	var r = {"sin": 0, "cos": 1};
|    | 820|+	var r = {"sin": 0, "cos": 1 };
| 821| 821| 	var unitAIState = cmpUnitAI.GetCurrentState();
| 822| 822| 	if (unitAIState == "FORMATIONCONTROLLER.WALKING" || unitAIState == "FORMATIONCONTROLLER.COMBAT.APPROACHING")
| 823| 823| 	{
|    | [NORMAL] ESLintBear (comma-spacing):
|    | A space is required after ','.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Formation.js
| 899| 899| 		cmpOtherFormation.RemoveMembers(otherMembers);
| 900| 900| 		this.AddMembers(otherMembers);
| 901| 901| 		Engine.DestroyEntity(this.twinFormations[i]);
| 902|    |-		this.twinFormations.splice(i,1);
|    | 902|+		this.twinFormations.splice(i, 1);
| 903| 903| 	}
| 904| 904| 	// Switch between column and box if necessary
| 905| 905| 	var cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI);

binaries/data/mods/public/simulation/components/Formation.js
| 326| »   for·(var·ent·of·this.formationMembersWithAura)
|    | [NORMAL] JSHintBear:
|    | 'ent' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 418| »   for·(var·ent·of·this.formationMembersWithAura)
|    | [NORMAL] JSHintBear:
|    | 'ent' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 464| »   var·cmpPosition·=·Engine.QueryInterface(this.entity,·IID_Position);
|    | [NORMAL] JSHintBear:
|    | 'cmpPosition' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 509| »   »   var·cmpUnitAI·=·Engine.QueryInterface(offset.ent,·IID_UnitAI);
|    | [NORMAL] JSHintBear:
|    | 'cmpUnitAI' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 545| »   var·cmpPosition·=·Engine.QueryInterface(this.entity,·IID_Position);
|    | [NORMAL] JSHintBear:
|    | 'cmpPosition' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 597| »   »   var·sortingClasses·=·this.sortingClasses.slice();
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 606| »   for·(var·i·in·active)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 621| »   »   »   types["Unknown"].push({"ent":·active[i],·"pos":·positions[i]});
|    | [NORMAL] JSHintBear:
|    | ['Unknown'] is better written in dot notation.

binaries/data/mods/public/simulation/components/Formation.js
| 661| »   »   for·(var·i·=·0;·i·<·count;·++i)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 695| »   »   »   »   »   var·n·=·r·+·1;
|    | [NORMAL] JSHintBear:
|    | 'n' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 697| »   »   »   »   »   var·n·=·r·*·2·+·1;
|    | [NORMAL] JSHintBear:
|    | 'n' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 701| »   »   »   for·(var·c·=·0;·c·<·n·&&·left·>·0;·++c)
|    | [NORMAL] JSHintBear:
|    | 'c' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 708| »   »   »   »   »   var·x·=·side·*·Math.ceil(c/2)·*·separation.width;
|    | [NORMAL] JSHintBear:
|    | 'x' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 711| »   »   »   »   »   if·(x·==·0)·//·don't·use·the·center·position·with·a·center·gap
|    | [NORMAL] JSHintBear:
|    | 'x' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 713| »   »   »   »   »   x·+=·side·*·centerGap·/·2;
|    | [NORMAL] JSHintBear:
|    | 'x' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 719| »   »   »   »   offsets.push(new·Vector2D(x·+·r1,·z·+·r2));
|    | [NORMAL] JSHintBear:
|    | 'x' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 699| »   »   »   if·(!shiftRows·&&·n·>·left)
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 700| »   »   »   »   n·=·left;
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 701| »   »   »   for·(var·c·=·0;·c·<·n·&&·left·>·0;·++c)
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 705| »   »   »   »   if·(n%2·==·0)
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 715| »   »   »   »   var·column·=·Math.ceil(n/2)·+·Math.ceil(c/2)·*·side;
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 725| »   »   »   this.maxColumnsUsed[r]·=·n;
|    | [NORMAL] JSHintBear:
|    | 'n' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 754| »   for·(var·i·=·sortingClasses.length;·i;·--i)
|    | [NORMAL] JSHintBear:
|    | 'i' is already defined.

binaries/data/mods/public/simulation/components/Formation.js
| 598| »   sortingClasses.push("Unknown");
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 603| »   for·(var·i·=·0;·i·<·sortingClasses.length;·++i)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 604| »   »   types[sortingClasses[i]]·=·[];
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 611| »   »   for·(var·c·=·0;·c·<·sortingClasses.length;·++c)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 613| »   »   »   if·(classes.indexOf(sortingClasses[c])·>·-1)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 615| »   »   »   »   types[sortingClasses[c]].push({"ent":·active[i],·"pos":·positions[i]});
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 754| »   for·(var·i·=·sortingClasses.length;·i;·--i)
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 756| »   »   var·t·=·types[sortingClasses[i-1]];
|    | [NORMAL] JSHintBear:
|    | 'sortingClasses' used out of scope.

binaries/data/mods/public/simulation/components/Formation.js
| 861| »   var·cmpUnitMotion·=·Engine.QueryInterface(this.entity,·IID_UnitMotion);
|    | [NORMAL] JSHintBear:
|    | 'cmpUnitMotion' is already defined.
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 0.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 240| 240| 			this.FinishOrder();
| 241| 241| 			return;
| 242| 242| 		}
| 243|    |-let cmpPhysics = Engine.QueryInterface(this.entity, IID_Physics);
|    | 243|+		let cmpPhysics = Engine.QueryInterface(this.entity, IID_Physics);
| 244| 244| if (cmpPhysics)
| 245| 245| {
| 246| 246| 	cmpPhysics.SetActive(true);
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 0.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 241| 241| 			return;
| 242| 242| 		}
| 243| 243| let cmpPhysics = Engine.QueryInterface(this.entity, IID_Physics);
| 244|    |-if (cmpPhysics)
|    | 244|+		if (cmpPhysics)
| 245| 245| {
| 246| 246| 	cmpPhysics.SetActive(true);
| 247| 247| 	cmpPhysics.ApplyForce(0, 750, 0);
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 0.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 242| 242| 		}
| 243| 243| let cmpPhysics = Engine.QueryInterface(this.entity, IID_Physics);
| 244| 244| if (cmpPhysics)
| 245|    |-{
|    | 245|+		{
| 246| 246| 	cmpPhysics.SetActive(true);
| 247| 247| 	cmpPhysics.ApplyForce(0, 750, 0);
| 248| 248| 	//let cmpPos = Engine.QueryInterface(this.entity, IID_Position);
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 1.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 243| 243| let cmpPhysics = Engine.QueryInterface(this.entity, IID_Physics);
| 244| 244| if (cmpPhysics)
| 245| 245| {
| 246|    |-	cmpPhysics.SetActive(true);
|    | 246|+			cmpPhysics.SetActive(true);
| 247| 247| 	cmpPhysics.ApplyForce(0, 750, 0);
| 248| 248| 	//let cmpPos = Engine.QueryInterface(this.entity, IID_Position);
| 249| 249| 	//if (cmpPos)
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 1.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 244| 244| if (cmpPhysics)
| 245| 245| {
| 246| 246| 	cmpPhysics.SetActive(true);
| 247|    |-	cmpPhysics.ApplyForce(0, 750, 0);
|    | 247|+			cmpPhysics.ApplyForce(0, 750, 0);
| 248| 248| 	//let cmpPos = Engine.QueryInterface(this.entity, IID_Position);
| 249| 249| 	//if (cmpPos)
| 250| 250| 	//	cmpPos.SetHeightFixed(50);
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 1.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 245| 245| {
| 246| 246| 	cmpPhysics.SetActive(true);
| 247| 247| 	cmpPhysics.ApplyForce(0, 750, 0);
| 248|    |-	//let cmpPos = Engine.QueryInterface(this.entity, IID_Position);
|    | 248|+			//let cmpPos = Engine.QueryInterface(this.entity, IID_Position);
| 249| 249| 	//if (cmpPos)
| 250| 250| 	//	cmpPos.SetHeightFixed(50);
| 251| 251| }
|    | [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
| 245| 245| {
| 246| 246| 	cmpPhysics.SetActive(true);
| 247| 247| 	cmpPhysics.ApplyForce(0, 750, 0);
| 248|    |-	//let cmpPos = Engine.QueryInterface(this.entity, IID_Position);
|    | 248|+	// let cmpPos = Engine.QueryInterface(this.entity, IID_Position);
| 249| 249| 	//if (cmpPos)
| 250| 250| 	//	cmpPos.SetHeightFixed(50);
| 251| 251| }
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 1.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 246| 246| 	cmpPhysics.SetActive(true);
| 247| 247| 	cmpPhysics.ApplyForce(0, 750, 0);
| 248| 248| 	//let cmpPos = Engine.QueryInterface(this.entity, IID_Position);
| 249|    |-	//if (cmpPos)
|    | 249|+			//if (cmpPos)
| 250| 250| 	//	cmpPos.SetHeightFixed(50);
| 251| 251| }
| 252| 252| 		// Stop moving immediately.
|    | [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
| 246| 246| 	cmpPhysics.SetActive(true);
| 247| 247| 	cmpPhysics.ApplyForce(0, 750, 0);
| 248| 248| 	//let cmpPos = Engine.QueryInterface(this.entity, IID_Position);
| 249|    |-	//if (cmpPos)
|    | 249|+	// if (cmpPos)
| 250| 250| 	//	cmpPos.SetHeightFixed(50);
| 251| 251| }
| 252| 252| 		// Stop moving immediately.
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 1.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 247| 247| 	cmpPhysics.ApplyForce(0, 750, 0);
| 248| 248| 	//let cmpPos = Engine.QueryInterface(this.entity, IID_Position);
| 249| 249| 	//if (cmpPos)
| 250|    |-	//	cmpPos.SetHeightFixed(50);
|    | 250|+			//	cmpPos.SetHeightFixed(50);
| 251| 251| }
| 252| 252| 		// Stop moving immediately.
| 253| 253| 		this.StopMoving();
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 0.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 248| 248| 	//let cmpPos = Engine.QueryInterface(this.entity, IID_Position);
| 249| 249| 	//if (cmpPos)
| 250| 250| 	//	cmpPos.SetHeightFixed(50);
| 251|    |-}
|    | 251|+		}
| 252| 252| 		// Stop moving immediately.
| 253| 253| 		this.StopMoving();
| 254| 254| 		this.FinishOrder();
|    | [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
| 775| 775| 					this.FinishOrder();
| 776| 776| 					return;
| 777| 777| 				}
| 778|    |-				else
| 779|    |-				{
|    | 778|+				
| 780| 779| 					this.SetNextState("GARRISON.APPROACHING");
| 781| 780| 					return;
| 782|    |-				}
|    | 781|+				
| 783| 782| 			}
| 784| 783| 
| 785| 784| 			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
|1043|1043| 			},
|1044|1044| 		},
|1045|1045| 
|1046|    |-		"GARRISON":{
|    |1046|+		"GARRISON": {
|1047|1047| 			"enter": function() {
|1048|1048| 				// If the garrisonholder should pickup, warn it so it can take needed action
|1049|1049| 				var cmpGarrisonHolder = Engine.QueryInterface(this.order.data.target, IID_GarrisonHolder);
|    | [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
|2019|2019| 
|2020|2020| 				"Attacked": function(msg) {
|2021|2021| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2022|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2023|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2022|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2023|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2024|2024| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2025|2025| 				},
|2026|2026| 			},
|    | [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
|2747|2747| 					{
|2748|2748| 						// The building was already finished/fully repaired before we arrived;
|2749|2749| 						// let the ConstructionFinished handler handle this.
|2750|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2750|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2751|2751| 						return true;
|2752|2752| 					}
|2753|2753| 
|    | [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
|2747|2747| 					{
|2748|2748| 						// The building was already finished/fully repaired before we arrived;
|2749|2749| 						// let the ConstructionFinished handler handle this.
|2750|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2750|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2751|2751| 						return true;
|2752|2752| 					}
|2753|2753| 
|    | [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
|3260|3260| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3261|3261| 
|3262|3262| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3263|    |-							// only used for domestic animals
|    |3263|+		// only used for domestic animals
|3264|3264| 	},
|3265|3265| };
|3266|3266| 
|    | [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
|3317|3317| 
|3318|3318| UnitAI.prototype.IsAnimal = function()
|3319|3319| {
|3320|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3320|+	return (!!this.template.NaturalBehaviour);
|3321|3321| };
|3322|3322| 
|3323|3323| 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
|3433|3433| 		{
|3434|3434| 			let index = this.GetCurrentState().indexOf(".");
|3435|3435| 			if (index != -1)
|3436|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3436|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3437|3437| 			this.Stop(false);
|3438|3438| 		}
|3439|3439| 
|    | [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
|3489|3489| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3490|3490| 			continue;
|3491|3491| 		if (i == 0)
|3492|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3492|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3493|3493| 		else
|3494|3494| 			this.orderQueue.splice(i, 1);
|3495|3495| 		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
|3489|3489| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3490|3490| 			continue;
|3491|3491| 		if (i == 0)
|3492|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3492|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3493|3493| 		else
|3494|3494| 			this.orderQueue.splice(i, 1);
|3495|3495| 		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
|3573|3573| };
|3574|3574| 
|3575|3575| 
|3576|    |-//// FSM linkage functions ////
|    |3576|+// // FSM linkage functions ////
|3577|3577| 
|3578|3578| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3579|3579| 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
|3743|3743| 				continue;
|3744|3744| 			if (this.orderQueue[i].type == type)
|3745|3745| 				continue;
|3746|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3746|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3747|3747| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3748|3748| 			return;
|3749|3749| 		}
|    | [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
|3743|3743| 				continue;
|3744|3744| 			if (this.orderQueue[i].type == type)
|3745|3745| 				continue;
|3746|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3746|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3747|3747| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3748|3748| 			return;
|3749|3749| 		}
|    | [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
|3914|3914| 	if (data.timerRepeat === undefined)
|3915|3915| 		this.timer = undefined;
|3916|3916| 
|3917|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3917|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|3918|3918| };
|3919|3919| 
|3920|3920| /**
|    | [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
|3914|3914| 	if (data.timerRepeat === undefined)
|3915|3915| 		this.timer = undefined;
|3916|3916| 
|3917|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |3917|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|3918|3918| };
|3919|3919| 
|3920|3920| /**
|    | [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
|3959|3959| 	// TODO: This is a bit inefficient since every unit listens to every
|3960|3960| 	// construction message - ideally we could scope it to only the one we're building
|3961|3961| 
|3962|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3962|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|3963|3963| };
|3964|3964| 
|3965|3965| 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
|3959|3959| 	// TODO: This is a bit inefficient since every unit listens to every
|3960|3960| 	// construction message - ideally we could scope it to only the one we're building
|3961|3961| 
|3962|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |3962|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|3963|3963| };
|3964|3964| 
|3965|3965| 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
|3984|3984| 
|3985|3985| UnitAI.prototype.OnAttacked = function(msg)
|3986|3986| {
|3987|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3987|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|3988|3988| };
|3989|3989| 
|3990|3990| 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
|3984|3984| 
|3985|3985| UnitAI.prototype.OnAttacked = function(msg)
|3986|3986| {
|3987|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |3987|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|3988|3988| };
|3989|3989| 
|3990|3990| 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
|3989|3989| 
|3990|3990| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3991|3991| {
|3992|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3992|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|3993|3993| };
|3994|3994| 
|3995|3995| 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
|3989|3989| 
|3990|3990| UnitAI.prototype.OnGuardedAttacked = function(msg)
|3991|3991| {
|3992|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |3992|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|3993|3993| };
|3994|3994| 
|3995|3995| 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
|3994|3994| 
|3995|3995| UnitAI.prototype.OnHealthChanged = function(msg)
|3996|3996| {
|3997|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3997|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|3998|3998| };
|3999|3999| 
|4000|4000| 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
|3994|3994| 
|3995|3995| UnitAI.prototype.OnHealthChanged = function(msg)
|3996|3996| {
|3997|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |3997|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|3998|3998| };
|3999|3999| 
|4000|4000| 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
|4000|4000| UnitAI.prototype.OnRangeUpdate = function(msg)
|4001|4001| {
|4002|4002| 	if (msg.tag == this.losRangeQuery)
|4003|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4003|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4004|4004| 	else if (msg.tag == this.losHealRangeQuery)
|4005|4005| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4006|4006| };
|    | [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
|4000|4000| UnitAI.prototype.OnRangeUpdate = function(msg)
|4001|4001| {
|4002|4002| 	if (msg.tag == this.losRangeQuery)
|4003|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4003|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4004|4004| 	else if (msg.tag == this.losHealRangeQuery)
|4005|4005| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4006|4006| };
|    | [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
|4002|4002| 	if (msg.tag == this.losRangeQuery)
|4003|4003| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4004|4004| 	else if (msg.tag == this.losHealRangeQuery)
|4005|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4005|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4006|4006| };
|4007|4007| 
|4008|4008| 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
|4002|4002| 	if (msg.tag == this.losRangeQuery)
|4003|4003| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4004|4004| 	else if (msg.tag == this.losHealRangeQuery)
|4005|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4005|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4006|4006| };
|4007|4007| 
|4008|4008| 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
|4007|4007| 
|4008|4008| UnitAI.prototype.OnPackFinished = function(msg)
|4009|4009| {
|4010|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4010|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4011|4011| };
|4012|4012| 
|4013|4013| //// 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
|4007|4007| 
|4008|4008| UnitAI.prototype.OnPackFinished = function(msg)
|4009|4009| {
|4010|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4010|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4011|4011| };
|4012|4012| 
|4013|4013| //// 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
|4010|4010| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4011|4011| };
|4012|4012| 
|4013|    |-//// Helper functions to be called by the FSM ////
|    |4013|+// // Helper functions to be called by the FSM ////
|4014|4014| 
|4015|4015| UnitAI.prototype.GetWalkSpeed = function()
|4016|4016| {
|    | [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
|4678|4678| UnitAI.prototype.AttackEntityInZone = function(ents)
|4679|4679| {
|4680|4680| 	var target = ents.find(target =>
|4681|    |-		this.CanAttack(target)
|4682|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4681|+		this.CanAttack(target) &&
|    |4682|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4683|4683| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4684|4684| 	);
|4685|4685| 	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
|4679|4679| {
|4680|4680| 	var target = ents.find(target =>
|4681|4681| 		this.CanAttack(target)
|4682|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4683|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4682|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4683|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4684|4684| 	);
|4685|4685| 	if (!target)
|4686|4686| 		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
|4743|4743| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4744|4744| 	if (this.isGuardOf)
|4745|4745| 	{
|4746|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4746|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4747|4747| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4748|4748| 		if (cmpUnitAI && cmpAttack &&
|4749|4749| 		    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
|4747|4747| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4748|4748| 		if (cmpUnitAI && cmpAttack &&
|4749|4749| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4750|    |-				return false;
|    |4750|+			return false;
|4751|4751| 	}
|4752|4752| 
|4753|4753| 	// 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
|4785|4785| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4786|4786| 	if (this.isGuardOf)
|4787|4787| 	{
|4788|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4788|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4789|4789| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4790|4790| 		if (cmpUnitAI && cmpAttack &&
|4791|4791| 		    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
|4798|4798| 	return false;
|4799|4799| };
|4800|4800| 
|4801|    |-//// External interface functions ////
|    |4801|+// // External interface functions ////
|4802|4802| 
|4803|4803| UnitAI.prototype.SetFormationController = function(ent)
|4804|4804| {
|    | [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
|4954|4954| 	{
|4955|4955| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|4956|4956| 			return;
|4957|    |-		else
|4958|    |-			this.RemoveGuard();
|    |4957|+		this.RemoveGuard();
|4959|4958| 	}
|4960|4959| 
|4961|4960| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|    | [NORMAL] ESLintBear (no-trailing-spaces):
|    | Trailing spaces not allowed.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5286|5286| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5287|5287| 	{
|5288|5288| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5289|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5289|+		if (cmpTrader.HasBothMarkets() &&
|5290|5290| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5291|5291| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5292|5292| 		{
|    | [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
|5567|5567| 				{
|5568|5568| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5569|5569| 					var targetClasses = this.order.data.targetClasses;
|5570|    |-					if (targetClasses.attack && cmpIdentity
|5571|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5570|+					if (targetClasses.attack && cmpIdentity &&
|    |5571|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5572|5572| 						continue;
|5573|5573| 					if (targetClasses.avoid && cmpIdentity
|5574|5574| 						&& 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
|5570|5570| 					if (targetClasses.attack && cmpIdentity
|5571|5571| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5572|5572| 						continue;
|5573|    |-					if (targetClasses.avoid && cmpIdentity
|5574|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5573|+					if (targetClasses.avoid && cmpIdentity &&
|    |5574|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5575|5575| 						continue;
|5576|5576| 					// Only used by the AIs to prevent some choices of targets
|5577|5577| 					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
|5593|5593| 		{
|5594|5594| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5595|5595| 			var targetClasses = this.order.data.targetClasses;
|5596|    |-			if (cmpIdentity && targetClasses.attack
|5597|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5596|+			if (cmpIdentity && targetClasses.attack &&
|    |5597|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5598|5598| 				continue;
|5599|5599| 			if (cmpIdentity && targetClasses.avoid
|5600|5600| 				&& 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
|5596|5596| 			if (cmpIdentity && targetClasses.attack
|5597|5597| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5598|5598| 				continue;
|5599|    |-			if (cmpIdentity && targetClasses.avoid
|5600|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5599|+			if (cmpIdentity && targetClasses.avoid &&
|    |5600|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5601|5601| 				continue;
|5602|5602| 			// Only used by the AIs to prevent some choices of targets
|5603|5603| 			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
|5753|5753| 
|5754|5754| UnitAI.prototype.SetHeldPosition = function(x, z)
|5755|5755| {
|5756|    |-	this.heldPosition = {"x": x, "z": z};
|    |5756|+	this.heldPosition = { "x": x, "z": z};
|5757|5757| };
|5758|5758| 
|5759|5759| 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
|5753|5753| 
|5754|5754| UnitAI.prototype.SetHeldPosition = function(x, z)
|5755|5755| {
|5756|    |-	this.heldPosition = {"x": x, "z": z};
|    |5756|+	this.heldPosition = {"x": x, "z": z };
|5757|5757| };
|5758|5758| 
|5759|5759| 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
|5780|5780| 	return false;
|5781|5781| };
|5782|5782| 
|5783|    |-//// Helper functions ////
|    |5783|+// // Helper functions ////
|5784|5784| 
|5785|5785| UnitAI.prototype.CanAttack = function(target)
|5786|5786| {
|    | [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
|5984|5984| 	return cmpPack && cmpPack.IsPacking();
|5985|5985| };
|5986|5986| 
|5987|    |-//// Formation specific functions ////
|    |5987|+// // Formation specific functions ////
|5988|5988| 
|5989|5989| UnitAI.prototype.IsAttackingAsFormation = function()
|5990|5990| {
|    | [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
|5989|5989| UnitAI.prototype.IsAttackingAsFormation = function()
|5990|5990| {
|5991|5991| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|5992|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|5993|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |5992|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |5993|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5994|5994| };
|5995|5995| 
|5996|5996| //// 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
|5993|5993| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|5994|5994| };
|5995|5995| 
|5996|    |-//// Animal specific functions ////
|    |5996|+// // Animal specific functions ////
|5997|5997| 
|5998|5998| UnitAI.prototype.MoveRandomly = function(distance)
|5999|5999| {

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

binaries/data/mods/public/simulation/components/UnitAI.js
| 930| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
| 955| »   »   »   "enter":·function(msg)·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

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

binaries/data/mods/public/simulation/components/UnitAI.js
|1068| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1104| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1136| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1296| »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1363| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1555| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1577| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1609| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1763| »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1813| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|1891| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2068| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2184| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2459| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2492| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2598| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2664| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2703| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|2914| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|3095| »   »   »   »   "enter":·function()·{
|    | [NORMAL] ESLintBear (consistent-return):
|    | Expected to return a value at the end of method 'enter'.

binaries/data/mods/public/simulation/components/UnitAI.js
|3819| »   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
|4665| »   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
|4680| »   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
|4726| »   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
|4749| »   »   ····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
|2023| »   »   »   »   »   »   &&·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
|3781| »   »   var·order·=·{·"type":·type,·"data":·data·};
|    | [NORMAL] JSHintBear:
|    | 'order' is already defined.

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

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

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

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|5597| »   »   »   »   &&·!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
|5600| »   »   »   »   &&·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
|5675| »   »   var·cmpVision·=·Engine.QueryInterface(this.entity,·IID_Vision);
|    | [NORMAL] JSHintBear:
|    | 'cmpVision' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|5678| »   »   var·range·=·cmpVision.GetRange();
|    | [NORMAL] JSHintBear:
|    | 'range' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|5683| »   »   var·cmpRanged·=·Engine.QueryInterface(this.entity,·iid);
|    | [NORMAL] JSHintBear:
|    | 'cmpRanged' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|5686| »   »   var·range·=·iid·!==·IID_Attack·?·cmpRanged.GetRange()·:·cmpRanged.GetFullAttackRange();
|    | [NORMAL] JSHintBear:
|    | 'range' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|5687| »   »   var·cmpVision·=·Engine.QueryInterface(this.entity,·IID_Vision);
|    | [NORMAL] JSHintBear:
|    | 'cmpVision' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|5697| »   »   var·cmpVision·=·Engine.QueryInterface(this.entity,·IID_Vision);
|    | [NORMAL] JSHintBear:
|    | 'cmpVision' is already defined.

binaries/data/mods/public/simulation/components/UnitAI.js
|5700| »   »   var·range·=·cmpVision.GetRange();
|    | [NORMAL] JSHintBear:
|    | 'range' is already defined.

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

nani awarded a token.Dec 19 2019, 9:47 PM
nani added a subscriber: nani.Dec 19 2019, 11:40 PM
nani added inline comments.
source/simulation2/components/CCmpPhysics.cpp
204–207

Why absolute velocity, should the drag just be a force that acts in the opposite sense of the velocity vector ?

Freagarach added inline comments.Dec 20 2019, 7:28 PM
source/simulation2/components/CCmpPhysics.cpp
204–207

True, but here the acceleration is here a mock for the energy, that must be dissipated by drag.
A yes, that can be negative as well, thanks.

I would love it if someone knowledgeble in physics would become enthousiastic about this and take over this diff xD

small things i noticed

source/simulation2/components/CCmpPhysics.cpp
188

should be checked if that tile is walkable else unit would stuck probably

191

get unit footprint and compare with water level

204–207

nani is right, should not be in absolute, this will speed up fall of entities instead applying slow down

251

early return would be better

wraitii requested changes to this revision.Jun 6 2020, 3:30 PM

Straight from @wraitii's patch from the ticket.

Some serious patch archeology there :D

I haven't really read the implementation but moving this to its own component certainly makes sense.

However, I think this is a good candidate for a "Manager" component, i.e. Physics manager that would update all units it registers. This will make optimisations down the line easier, and it's a better pattern for system-like components like this imo.
You can still have the <Physics> component for setting some default data and activating/deactivating.

This revision now requires changes to proceed.Jun 6 2020, 3:30 PM

Makes sense.
For the one going to work on this: there is also MotionBall.js.

Freagarach abandoned this revision.Jan 26 2023, 1:48 PM

It was a nice learning event (a.k.a. try).