Page MenuHomeWildfire Games

Decay/regenerate option for resources.
Needs ReviewPublic

Authored by Freagarach on Dec 30 2018, 9:17 AM.
Tags
None
Subscribers
Restricted Owners Package, wraitii, Freagarach and 6 others
Tokens
"Yellow Medal" token, awarded by ffffffff."Like" token, awarded by elexis.

Details

Reviewers
Stan
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Trac Tickets
#1973
Summary

This patch gives (modders) the ability to let resources regenerate or decay, i.e. change their resource amount using a timer.
There are several states included which can be used to check whether the change should be applied: whether the entity is dead, i.e. no Health cmp., is alive, is being gathered (introduced a new list for that, activeGatherers) or not. Combinations of those can easily be made in the State.

The ticket also mentioned a "delay" after which a specified effect occurs, that is also not implemented here, for convenience. So if there are no entities gathering anymore the timer starts running immediately, if applicable.

Use case can be included later. (Or here if people want that.)

The idea was to use StatusEffects for this, but since SE cannot modify the resource amounts (V5 of SE perhaps? ;) ) I just used normal timers.
One could alter the change-value using a SE, though.


Possible extension:

  • In the ticket there is a patch which uses sigmoidal growth, which would be cool :)
Test Plan

Verify that:

  • When added to a resource, the right constraints produce the desired results (see the fat-chicken test).
  • Value modifications are applied (see corral aura).

Check that this is the right change in code, that no simplifications are possible and not too much overhead is added for entities not having the change.

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

It seems to me like your tests could be abstracted in a function to remove a lot of redundancy.

Easier to deal with auras and whatnot.

OK, so I guess your position is that you want to enable having a "faster fattening" aura/tech that changes ResourceSupply/Fattening/Value, instead of having a tech that changes ResourceSupply/Alive/Value and only affects items with Identity classes Organic, Domestic for example. That's internally coherent, and I do agree that on the surface it seems more craftier - both systems actually allow the same thing but using identity classes might force one to add arbitrary identity classes to templates, which seems undesirable.
However this doesn't seem obvious from reading the code, nor the tests. I think you should be able to add an Aura in the tests that only affects Fattening, not say Growth, to highlight that.
I'm not sure where this would be best to document, perhaps in the schema as a a:help or as a comment?

Stan added a comment.Jun 15 2019, 12:17 PM

It seems to me like your tests could be abstracted in a function to remove a lot of redundancy.

Easier to deal with auras and whatnot.

OK, so I guess your position is that you want to enable having a "faster fattening" aura/tech that changes ResourceSupply/Fattening/Value, instead of having a tech that changes ResourceSupply/Alive/Value and only affects items with Identity classes Organic, Domestic for example. That's internally coherent, and I do agree that on the surface it seems more craftier - both systems actually allow the same thing but using identity classes might force one to add arbitrary identity classes to templates, which seems undesirable.
However this doesn't seem obvious from reading the code, nor the tests. I think you should be able to add an Aura in the tests that only affects Fattening, not say Growth, to highlight that.

Didn't we have that discussion already that it was particularly tricky to add auras during the tests ?

I'm not sure where this would be best to document, perhaps in the schema as a a:help or as a comment?

I will try to add functions for the tests, might make them more consistent..

Didn't we have that discussion already that it was particularly tricky to add auras during the tests ?

We did, that's why D274 exists - but I think auras are doable, whereas techs are extremely annoying to add. That being said, it's not a hard requirement from me, this can be merged without these imo.

Stan updated this revision to Diff 8473.Jun 15 2019, 12:55 PM
  • Use function for the tests to remove duplication.

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

Linter detected issues:
Executing section Source...
Executing section JS...

binaries/data/mods/public/simulation/components/tests/test_ResourceSupply.js
|  92| function·TestChangeModifiers(template,·entity,·results)
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'template' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/tests/test_ResourceSupply.js
|  92| function·TestChangeModifiers(template,·entity,·results)
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'entity' is already declared in the upper scope.

binaries/data/mods/public/simulation/components/tests/test_ResourceSupply.js
|  94| »   let·cmpResourceSupply·=·ConstructComponent(entity,·"ResourceSupply",·template);
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'cmpResourceSupply' is already declared in the upper scope.
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/differential/1718/display/redirect

Stan updated this revision to Diff 8477.Jun 15 2019, 3:36 PM

Fix warnings

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

Link to build: https://jenkins.wildfiregames.com/job/differential/1722/display/redirect

Stan updated this revision to Diff 8478.Jun 15 2019, 3:39 PM
  • Do not break the test in the process

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

Link to build: https://jenkins.wildfiregames.com/job/differential/1723/display/redirect

Stan updated this revision to Diff 8523.Jun 16 2019, 8:45 PM
  • Add aura tests.

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

Linter detected issues:
Executing section Source...
Executing section JS...

binaries/data/mods/public/simulation/components/tests/test_ResourceSupply.js
| 126| »   »   "ApplyModifications":·(key,·val,·ent)·=>·{
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'ent' is already declared in the upper scope.
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/differential/1751/display/redirect

Stan added a comment.Jun 27 2019, 10:24 AM

@wraitii Anything else you want me to change aside from the warning in Jenkins console ?

@Stan I haven't really looked deep into your patch, so perhaps, yes. I don't consider what I've said above a review.

Stan added a comment.Jun 27 2019, 10:37 AM

@Stan I haven't really looked deep into your patch, so perhaps, yes. I don't consider what I've said above a review.

Okay thanks for the heads up :)

It's been a long time since I last looked at this. If it's not too much trouble, perhaps you could explain how it works/syntax in xml templates?

Stan added a comment.Jun 27 2019, 11:02 AM

Well it might change again before it's committed but currently you can do something like

<Change>
    <AnyName> 
        <Alive/> 
        <Dead/>
        <NotBeingGathered/> 
        <Value>2</Value> 
        <Interval>1000</Interval> 
        <ChangeLimit>5000</ChangeLimit>
    </AnyName> 
</Change>

ChangeLimit defines the lowest or the highest the specific change can go if limit is higher than the max amount, the max amount is set to that value.
Interval defines how often the change is run.
Value (positive or negative) defines what will be done to the resource
Then you have three flags that can be combined or use individually.

If dead is present then the resource only decay/regrow when dead.
if alive is present then the resource only decay/regrow when alive.
When both are there, it always decay.
If NotBeingGathered is present it controls the two others by adding or cancelling the decay when gatherers are removed or added.

Thanks, that's helpful.
Alive and Dead are clear for fauna (fatten when living, decay when killed), but not really for gaia templates (is a tree considered alive or dead?).
Does NotBeingGathered means it will or won't work? Also, shouldn't there be a OnlyWhenBeingGathered tag then too?
Furthermore, there is probably a clearer term for ChangeLimit.

Stan added a comment.Jun 27 2019, 11:17 AM
In D1718#84088, @Nescio wrote:

Thanks, that's helpful.
Alive and Dead are clear for fauna (fatten when living, decay when killed), but not really for gaia templates (is a tree considered alive or dead?).

A tree is considered dead because it does not have health.

Does NotBeingGathered means it will or won't work? Also, shouldn't there be a OnlyWhenBeingGathered tag then too?

Alive + Notbeinggathered only works when alive and not being gathered
Dead + Notbeinggathered only works when dead and not being gathered
Alive + Dead + Notbeinggathered only works when not being gathered.
Notbeinggathered only works when not being gathered.

Furthermore, there is probably a clearer term for ChangeLimit.

We tried to find a word, but it's not a treshold, nor it is a maximum, nor it is a minium. Hence limit.

Alive + Dead + Notbeinggathered only works when not being gathered.

Why? Surely something can't be alive and dead simultaneously? (No Schrödinger's cat in 0 A.D.)
Also, what if someone wants a resource change that only works when being gathered (making something)?

Hence limit.

Then why ChangeLimit and not just Limit?

Stan added a comment.Jun 27 2019, 11:33 AM
In D1718#84090, @Nescio wrote:

Alive + Dead + Notbeinggathered only works when not being gathered.

Why? Surely something can't be alive and dead simultaneously? (No Schrödinger's cat in 0 A.D.)

Alive and dead means the change works always, not that the thing has to be both alive and dead. Alive and dead is equal to not having them at all.

Also, what if someone wants a resource change that only works when being gathered (making something)?

Well he is out of luck with the current implementation...

Hence limit.

Then why ChangeLimit and not just Limit?

Cause wraitii asked me to change it :P

Alive and dead is equal to not having them at all.

Isn't that confusing?

Stan added a comment.Jun 27 2019, 11:59 AM
In D1718#84092, @Nescio wrote:

Alive and dead is equal to not having them at all.

Isn't that confusing?

Well that's only because you have NotBeinGathered with the other two.

It's like saying the resource change when being alive, and when being dead, but only when not being gathered.
or saying the the resource change when not being gathered.
I would usually recommend people do multiple changes instead of combining them of the sort
One for the dead part, one for the alive part, which would gave them more control.

I guess "LimitToTheChange" or something longer would be clearer... This mechanic is very flexible, perhaps too much for its own good.
One question I will ask myself on this is whether status effects should be used for this - it seems like they might, with some changes - as @elexis noted. Which might end up reducing complexity, or at least genericing it usefully.

Stan added a comment.Jun 27 2019, 12:24 PM

Means rewriting the whole patch, but okay I guess...

This comment was removed by wraitii.
wraitii added a comment.EditedJun 27 2019, 2:10 PM

Bit of a more complete review:

There's a bunch of things going on here:

  • You're implementing ResourceSupply/Change/[Key]/Value modifier, which triggers a timer for changing the supply of a resource.
  • You're defining a few different Change possibilities.
  • You're triggering these Change possibilities based on constraints (alive, dead, notbeingGathered).
  • You are "untriggering" these based on the Change.

The third item is specific to resources. The "Alive/Dead" check seems like it is a workaround for us having no ability to transform components when applying a filter (since dead entities become corpse| or resource| variants). So we should fix that. We ran in the same problem with armour and its "foundation" sub-item.

The other three definitely look like status effects to me, and would benefit from being merged with that code. In particular, this would let us:

  • have GUI support (when we implement that for status effects)
  • have generic modifiers StatusEffect/[Key]/ResourceSupplyChange/Value
  • Implement limits in a cleaner fashion, using "MinValue", "MaxValue", "AmountBeforeExpiration" or something like that. This logic could be mad generic for status effects, since damage effects might want to have these too.

Currently StatusEffects implements damaging only. We could extend it to implement resource supply changes. The timer logic is already implemented there (perhaps must be improved) so that limits repetitions.

So my suggestion is to keep the triggering code, but to make it trigger a status effect, and move the rest of the logic to status effects. We might need to define a schema for status effects there.

At the moment, I would keep the definition of the status effects in the ResourceSupply template.

Edit: possibly resource trickles should also be implemented as status effects - it's a bit of a blurry line there to me -

Stan planned changes to this revision.EditedJun 27 2019, 2:48 PM

Well given the current state of things around here and the impact it has on me, I guess this won't happen soonish. Maybe I'll get to do it for A24 but I'm not sure anymore. 47th revision (192 comments)

I'm marking this as planned changes, but, feel free to commandeer.

http://irclogs.wildfiregames.com/2020-01/2020-01-28-QuakeNet-%230ad-dev.log:

18:52 < Stan`> doing the same thing
18:52 < Stan`> So btw I only have to remove timers
18:52 < Stan`> and use status effects instead?

As far as I can currently see, yes. And I guess the notbeinggathered can be an add/remove status effect?

Freagarach updated this revision to Diff 11505.Fri, Mar 20, 9:09 AM
Freagarach retitled this revision from Decay/regenerate option for resources when not being gathered from to Decay/regenerate option for resources..
Freagarach edited the summary of this revision. (Show Details)
Freagarach edited the test plan for this revision. (Show Details)
Freagarach removed a subscriber: Vulcan.

Some different approach.
Test fails for now for some unknown reason. Perhaps @elexis can shed their light on that? (Hence the warnings still in place.)

I've read all the comments and inlines but there were quite a few, so I hope I didn't miss information, otherwise, please attend me on that.

Owners added a subscriber: Restricted Owners Package.Fri, Mar 20, 9:09 AM
Freagarach commandeered this revision.Fri, Mar 20, 9:10 AM
Freagarach added a reviewer: Stan.

Thanks for the hard work already done @Stan :D

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

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

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

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

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

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

Freagarach updated this revision to Diff 11506.Fri, Mar 20, 9:39 AM
Freagarach edited the test plan for this revision. (Show Details)

Added corral aura.

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

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

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

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

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

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

Freagarach added inline comments.Fri, Mar 20, 11:55 AM
binaries/data/mods/public/simulation/components/tests/test_ResourceSupply.js
611

-cmp

642

-cmp

672

-cmp

704

-cmp

739

-cmp

Freagarach updated this revision to Diff 11507.Fri, Mar 20, 1:37 PM

Fix test, thanks @Stan!

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 0.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/ResourceSupply.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/ResourceSupply.js
| 294| 294| 
| 295| 295| 	if (this.activeGatherers[player].indexOf(entity) == -1)
| 296| 296| 		this.activeGatherers[player].push(entity);
| 297|    |-/*
|    | 297|+	/*
| 298| 298| warn("Add Active Gatherer:");
| 299| 299| warn(uneval(this.activeGatherers));
| 300| 300| warn(uneval(this.gatherers));
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 0.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/ResourceSupply.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/ResourceSupply.js
| 347| 347| {
| 348| 348| 	if (!this.timers || this.IsInfinite())
| 349| 349| 		return;
| 350|    |-/*
|    | 350|+	/*
| 351| 351| warn(uneval("Check Timers:"));
| 352| 352| warn(uneval(this.activeGatherers));
| 353| 353| warn(uneval(this.gatherers));
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/ResourceSupply.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/ResourceSupply.js
| 369| 369| 
| 370| 370| 		if (this.cachedChanges[changeKey] == 0)
| 371| 371| 		{
| 372|    |-			this.StopTimer(changeKey)
|    | 372|+			this.StopTimer(changeKey);
| 373| 373| 			continue;
| 374| 374| 		}
| 375| 375| 

binaries/data/mods/public/simulation/components/ResourceSupply.js
| 372| »   »   »   this.StopTimer(changeKey)
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

binaries/data/mods/public/simulation/components/tests/test_ResourceSupply.js
|  95| function·reset(template)
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'template' is already declared in the upper scope.
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 788| 788| 					this.FinishOrder();
| 789| 789| 					return;
| 790| 790| 				}
| 791|    |-				else
| 792|    |-				{
|    | 791|+				
| 793| 792| 					this.SetNextState("GARRISON.APPROACHING");
| 794| 793| 					return;
| 795|    |-				}
|    | 794|+				
| 796| 795| 			}
| 797| 796| 
| 798| 797| 			this.SetNextState("GARRISON.GARRISONING");
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'GARRISON'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1060|1060| 			},
|1061|1061| 		},
|1062|1062| 
|1063|    |-		"GARRISON":{
|    |1063|+		"GARRISON": {
|1064|1064| 			"APPROACHING": {
|1065|1065| 				"enter": function() {
|1066|1066| 					if (!this.MoveToGarrisonRange(this.order.data.target))
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2038|2038| 
|2039|2039| 				"Attacked": function(msg) {
|2040|2040| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2041|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2042|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2041|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2042|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2043|2043| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2044|2044| 				},
|2045|2045| 			},
|    | [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
|2776|2776| 					{
|2777|2777| 						// The building was already finished/fully repaired before we arrived;
|2778|2778| 						// let the ConstructionFinished handler handle this.
|2779|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2779|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2780|2780| 						return true;
|2781|2781| 					}
|2782|2782| 
|    | [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
|2776|2776| 					{
|2777|2777| 						// The building was already finished/fully repaired before we arrived;
|2778|2778| 						// let the ConstructionFinished handler handle this.
|2779|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2779|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2780|2780| 						return true;
|2781|2781| 					}
|2782|2782| 
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3074|3074| 				this.StopTimer();
|3075|3075| 				this.ResetAnimation();
|3076|3076| 				if (this.formationAnimationVariant)
|3077|    |-					this.SetAnimationVariant(this.formationAnimationVariant)
|    |3077|+					this.SetAnimationVariant(this.formationAnimationVariant);
|3078|3078| 				else
|3079|3079| 					this.SetDefaultAnimationVariant();
|3080|3080| 				var cmpResistance = Engine.QueryInterface(this.entity, IID_Resistance);
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 7.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3300|3300| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3301|3301| 
|3302|3302| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3303|    |-							// only used for domestic animals
|    |3303|+		// only used for domestic animals
|3304|3304| 
|3305|3305| 		// Reuse the same garrison behaviour for animals.
|3306|3306| 		"GARRISON": "INDIVIDUAL.GARRISON",
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3362|3362| 
|3363|3363| UnitAI.prototype.IsAnimal = function()
|3364|3364| {
|3365|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3365|+	return (!!this.template.NaturalBehaviour);
|3366|3366| };
|3367|3367| 
|3368|3368| 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
|3478|3478| 		{
|3479|3479| 			let index = this.GetCurrentState().indexOf(".");
|3480|3480| 			if (index != -1)
|3481|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3481|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3482|3482| 			this.Stop(false);
|3483|3483| 		}
|3484|3484| 
|    | [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
|3534|3534| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3535|3535| 			continue;
|3536|3536| 		if (i == 0)
|3537|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3537|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3538|3538| 		else
|3539|3539| 			this.orderQueue.splice(i, 1);
|3540|3540| 		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
|3534|3534| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3535|3535| 			continue;
|3536|3536| 		if (i == 0)
|3537|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3537|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3538|3538| 		else
|3539|3539| 			this.orderQueue.splice(i, 1);
|3540|3540| 		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
|3621|3621| };
|3622|3622| 
|3623|3623| 
|3624|    |-//// FSM linkage functions ////
|    |3624|+// // FSM linkage functions ////
|3625|3625| 
|3626|3626| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3627|3627| 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
|3792|3792| 				continue;
|3793|3793| 			if (this.orderQueue[i].type == type)
|3794|3794| 				continue;
|3795|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3795|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3796|3796| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3797|3797| 			return;
|3798|3798| 		}
|    | [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
|3792|3792| 				continue;
|3793|3793| 			if (this.orderQueue[i].type == type)
|3794|3794| 				continue;
|3795|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3795|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3796|3796| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3797|3797| 			return;
|3798|3798| 		}
|    | [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
|4034|4034| 	if (data.timerRepeat === undefined)
|4035|4035| 		this.timer = undefined;
|4036|4036| 
|4037|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4037|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4038|4038| };
|4039|4039| 
|4040|4040| /**
|    | [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
|4034|4034| 	if (data.timerRepeat === undefined)
|4035|4035| 		this.timer = undefined;
|4036|4036| 
|4037|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4037|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4038|4038| };
|4039|4039| 
|4040|4040| /**
|    | [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
|4079|4079| 	// TODO: This is a bit inefficient since every unit listens to every
|4080|4080| 	// construction message - ideally we could scope it to only the one we're building
|4081|4081| 
|4082|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4082|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4083|4083| };
|4084|4084| 
|4085|4085| 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
|4079|4079| 	// TODO: This is a bit inefficient since every unit listens to every
|4080|4080| 	// construction message - ideally we could scope it to only the one we're building
|4081|4081| 
|4082|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4082|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4083|4083| };
|4084|4084| 
|4085|4085| 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
|4110|4110| 	if (msg.fromStatusEffect)
|4111|4111| 		return;
|4112|4112| 
|4113|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4113|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4114|4114| };
|4115|4115| 
|4116|4116| 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
|4110|4110| 	if (msg.fromStatusEffect)
|4111|4111| 		return;
|4112|4112| 
|4113|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4113|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4114|4114| };
|4115|4115| 
|4116|4116| 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
|4115|4115| 
|4116|4116| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4117|4117| {
|4118|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4118|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4119|4119| };
|4120|4120| 
|4121|4121| 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
|4115|4115| 
|4116|4116| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4117|4117| {
|4118|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4118|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4119|4119| };
|4120|4120| 
|4121|4121| 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
|4120|4120| 
|4121|4121| UnitAI.prototype.OnHealthChanged = function(msg)
|4122|4122| {
|4123|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4123|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4124|4124| };
|4125|4125| 
|4126|4126| 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
|4120|4120| 
|4121|4121| UnitAI.prototype.OnHealthChanged = function(msg)
|4122|4122| {
|4123|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4123|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4124|4124| };
|4125|4125| 
|4126|4126| 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
|4126|4126| UnitAI.prototype.OnRangeUpdate = function(msg)
|4127|4127| {
|4128|4128| 	if (msg.tag == this.losRangeQuery)
|4129|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4129|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4130|4130| 	else if (msg.tag == this.losHealRangeQuery)
|4131|4131| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4132|4132| };
|    | [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
|4126|4126| UnitAI.prototype.OnRangeUpdate = function(msg)
|4127|4127| {
|4128|4128| 	if (msg.tag == this.losRangeQuery)
|4129|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4129|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4130|4130| 	else if (msg.tag == this.losHealRangeQuery)
|4131|4131| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4132|4132| };
|    | [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
|4128|4128| 	if (msg.tag == this.losRangeQuery)
|4129|4129| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4130|4130| 	else if (msg.tag == this.losHealRangeQuery)
|4131|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4131|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4132|4132| };
|4133|4133| 
|4134|4134| 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
|4128|4128| 	if (msg.tag == this.losRangeQuery)
|4129|4129| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4130|4130| 	else if (msg.tag == this.losHealRangeQuery)
|4131|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4131|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4132|4132| };
|4133|4133| 
|4134|4134| 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
|4133|4133| 
|4134|4134| UnitAI.prototype.OnPackFinished = function(msg)
|4135|4135| {
|4136|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4136|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4137|4137| };
|4138|4138| 
|4139|4139| //// 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
|4133|4133| 
|4134|4134| UnitAI.prototype.OnPackFinished = function(msg)
|4135|4135| {
|4136|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4136|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4137|4137| };
|4138|4138| 
|4139|4139| //// 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
|4136|4136| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4137|4137| };
|4138|4138| 
|4139|    |-//// Helper functions to be called by the FSM ////
|    |4139|+// // Helper functions to be called by the FSM ////
|4140|4140| 
|4141|4141| UnitAI.prototype.GetWalkSpeed = function()
|4142|4142| {
|    | [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
|4802|4802| UnitAI.prototype.AttackEntityInZone = function(ents)
|4803|4803| {
|4804|4804| 	var target = ents.find(target =>
|4805|    |-		this.CanAttack(target)
|4806|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4805|+		this.CanAttack(target) &&
|    |4806|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4807|4807| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4808|4808| 	);
|4809|4809| 	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
|4803|4803| {
|4804|4804| 	var target = ents.find(target =>
|4805|4805| 		this.CanAttack(target)
|4806|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4807|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4806|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4807|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4808|4808| 	);
|4809|4809| 	if (!target)
|4810|4810| 		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
|4867|4867| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4868|4868| 	if (this.isGuardOf)
|4869|4869| 	{
|4870|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4870|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4871|4871| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4872|4872| 		if (cmpUnitAI && cmpAttack &&
|4873|4873| 		    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
|4871|4871| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4872|4872| 		if (cmpUnitAI && cmpAttack &&
|4873|4873| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4874|    |-				return false;
|    |4874|+			return false;
|4875|4875| 	}
|4876|4876| 
|4877|4877| 	// 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
|4909|4909| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4910|4910| 	if (this.isGuardOf)
|4911|4911| 	{
|4912|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4912|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4913|4913| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4914|4914| 		if (cmpUnitAI && cmpAttack &&
|4915|4915| 		    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
|4922|4922| 	return false;
|4923|4923| };
|4924|4924| 
|4925|    |-//// External interface functions ////
|    |4925|+// // External interface functions ////
|4926|4926| 
|4927|4927| UnitAI.prototype.SetFormationController = function(ent)
|4928|4928| {
|    | [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
|5078|5078| 	{
|5079|5079| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5080|5080| 			return;
|5081|    |-		else
|5082|    |-			this.RemoveGuard();
|    |5081|+		this.RemoveGuard();
|5083|5082| 	}
|5084|5083| 
|5085|5084| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5409|5409| 
|5410|5410| 	if (this.IsFormationController())
|5411|5411| 		this.CallMemberFunction("CancelSetupTradeRoute", [target]);
|5412|    |-}
|    |5412|+};
|5413|5413| /**
|5414|5414|  * Adds trade order to the queue. Either walk to the first market, or
|5415|5415|  * start a new route. Not forced, so it can be interrupted by attacks.
|    | [NORMAL] ESLintBear (no-trailing-spaces):
|    | Trailing spaces not allowed.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5430|5430| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5431|5431| 	{
|5432|5432| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5433|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5433|+		if (cmpTrader.HasBothMarkets() &&
|5434|5434| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5435|5435| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5436|5436| 		{
|    | [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
|5711|5711| 				{
|5712|5712| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5713|5713| 					var targetClasses = this.order.data.targetClasses;
|5714|    |-					if (targetClasses.attack && cmpIdentity
|5715|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5714|+					if (targetClasses.attack && cmpIdentity &&
|    |5715|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5716|5716| 						continue;
|5717|5717| 					if (targetClasses.avoid && cmpIdentity
|5718|5718| 						&& 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
|5714|5714| 					if (targetClasses.attack && cmpIdentity
|5715|5715| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5716|5716| 						continue;
|5717|    |-					if (targetClasses.avoid && cmpIdentity
|5718|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5717|+					if (targetClasses.avoid && cmpIdentity &&
|    |5718|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5719|5719| 						continue;
|5720|5720| 					// Only used by the AIs to prevent some choices of targets
|5721|5721| 					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
|5737|5737| 		{
|5738|5738| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5739|5739| 			var targetClasses = this.order.data.targetClasses;
|5740|    |-			if (cmpIdentity && targetClasses.attack
|5741|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5740|+			if (cmpIdentity && targetClasses.attack &&
|    |5741|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5742|5742| 				continue;
|5743|5743| 			if (cmpIdentity && targetClasses.avoid
|5744|5744| 				&& 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
|5740|5740| 			if (cmpIdentity && targetClasses.attack
|5741|5741| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5742|5742| 				continue;
|5743|    |-			if (cmpIdentity && targetClasses.avoid
|5744|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5743|+			if (cmpIdentity && targetClasses.avoid &&
|    |5744|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5745|5745| 				continue;
|5746|5746| 			// Only used by the AIs to prevent some choices of targets
|5747|5747| 			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
|5883|5883| 
|5884|5884| UnitAI.prototype.SetHeldPosition = function(x, z)
|5885|5885| {
|5886|    |-	this.heldPosition = {"x": x, "z": z};
|    |5886|+	this.heldPosition = { "x": x, "z": z};
|5887|5887| };
|5888|5888| 
|5889|5889| 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
|5883|5883| 
|5884|5884| UnitAI.prototype.SetHeldPosition = function(x, z)
|5885|5885| {
|5886|    |-	this.heldPosition = {"x": x, "z": z};
|    |5886|+	this.heldPosition = {"x": x, "z": z };
|5887|5887| };
|5888|5888| 
|5889|5889| 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
|5910|5910| 	return false;
|5911|5911| };
|5912|5912| 
|5913|    |-//// Helper functions ////
|    |5913|+// // Helper functions ////
|5914|5914| 
|5915|5915| /**
|5916|5916|  * General getter for ranges.
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5929|5929| 		return undefined;
|5930|5930| 
|5931|5931| 	return component.GetRange(type);
|5932|    |-}
|    |5932|+};
|5933|5933| 
|5934|5934| UnitAI.prototype.CanAttack = function(target)
|5935|5935| {
|    | [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
|6127|6127| 	return cmpPack && cmpPack.IsPacking();
|6128|6128| };
|6129|6129| 
|6130|    |-//// Formation specific functions ////
|    |6130|+// // Formation specific functions ////
|6131|6131| 
|6132|6132| UnitAI.prototype.IsAttackingAsFormation = function()
|6133|6133| {
|    | [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
|6132|6132| UnitAI.prototype.IsAttackingAsFormation = function()
|6133|6133| {
|6134|6134| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6135|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6136|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6135|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6136|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6137|6137| };
|6138|6138| 
|6139|6139| //// 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
|6136|6136| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6137|6137| };
|6138|6138| 
|6139|    |-//// Animal specific functions ////
|    |6139|+// // Animal specific functions ////
|6140|6140| 
|6141|6141| UnitAI.prototype.MoveRandomly = function(distance)
|6142|6142| {

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|3939| »   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
|4789| »   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
|4804| »   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
|4850| »   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
|4873| »   »   ····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
|2042| »   »   »   »   »   »   &&·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
|3077| »   »   »   »   »   this.SetAnimationVariant(this.formationAnimationVariant)
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

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

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

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

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

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

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

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

Freagarach updated this revision to Diff 11508.EditedFri, Mar 20, 2:15 PM
  • Remove warns.
  • Fix linter issue.

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 788| 788| 					this.FinishOrder();
| 789| 789| 					return;
| 790| 790| 				}
| 791|    |-				else
| 792|    |-				{
|    | 791|+				
| 793| 792| 					this.SetNextState("GARRISON.APPROACHING");
| 794| 793| 					return;
| 795|    |-				}
|    | 794|+				
| 796| 795| 			}
| 797| 796| 
| 798| 797| 			this.SetNextState("GARRISON.GARRISONING");
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'GARRISON'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1060|1060| 			},
|1061|1061| 		},
|1062|1062| 
|1063|    |-		"GARRISON":{
|    |1063|+		"GARRISON": {
|1064|1064| 			"APPROACHING": {
|1065|1065| 				"enter": function() {
|1066|1066| 					if (!this.MoveToGarrisonRange(this.order.data.target))
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2038|2038| 
|2039|2039| 				"Attacked": function(msg) {
|2040|2040| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2041|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2042|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2041|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2042|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2043|2043| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2044|2044| 				},
|2045|2045| 			},
|    | [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
|2776|2776| 					{
|2777|2777| 						// The building was already finished/fully repaired before we arrived;
|2778|2778| 						// let the ConstructionFinished handler handle this.
|2779|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2779|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2780|2780| 						return true;
|2781|2781| 					}
|2782|2782| 
|    | [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
|2776|2776| 					{
|2777|2777| 						// The building was already finished/fully repaired before we arrived;
|2778|2778| 						// let the ConstructionFinished handler handle this.
|2779|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2779|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2780|2780| 						return true;
|2781|2781| 					}
|2782|2782| 
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3074|3074| 				this.StopTimer();
|3075|3075| 				this.ResetAnimation();
|3076|3076| 				if (this.formationAnimationVariant)
|3077|    |-					this.SetAnimationVariant(this.formationAnimationVariant)
|    |3077|+					this.SetAnimationVariant(this.formationAnimationVariant);
|3078|3078| 				else
|3079|3079| 					this.SetDefaultAnimationVariant();
|3080|3080| 				var cmpResistance = Engine.QueryInterface(this.entity, IID_Resistance);
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 7.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3300|3300| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3301|3301| 
|3302|3302| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3303|    |-							// only used for domestic animals
|    |3303|+		// only used for domestic animals
|3304|3304| 
|3305|3305| 		// Reuse the same garrison behaviour for animals.
|3306|3306| 		"GARRISON": "INDIVIDUAL.GARRISON",
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3362|3362| 
|3363|3363| UnitAI.prototype.IsAnimal = function()
|3364|3364| {
|3365|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3365|+	return (!!this.template.NaturalBehaviour);
|3366|3366| };
|3367|3367| 
|3368|3368| 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
|3478|3478| 		{
|3479|3479| 			let index = this.GetCurrentState().indexOf(".");
|3480|3480| 			if (index != -1)
|3481|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3481|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3482|3482| 			this.Stop(false);
|3483|3483| 		}
|3484|3484| 
|    | [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
|3534|3534| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3535|3535| 			continue;
|3536|3536| 		if (i == 0)
|3537|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3537|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3538|3538| 		else
|3539|3539| 			this.orderQueue.splice(i, 1);
|3540|3540| 		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
|3534|3534| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3535|3535| 			continue;
|3536|3536| 		if (i == 0)
|3537|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3537|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3538|3538| 		else
|3539|3539| 			this.orderQueue.splice(i, 1);
|3540|3540| 		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
|3621|3621| };
|3622|3622| 
|3623|3623| 
|3624|    |-//// FSM linkage functions ////
|    |3624|+// // FSM linkage functions ////
|3625|3625| 
|3626|3626| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3627|3627| 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
|3792|3792| 				continue;
|3793|3793| 			if (this.orderQueue[i].type == type)
|3794|3794| 				continue;
|3795|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3795|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3796|3796| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3797|3797| 			return;
|3798|3798| 		}
|    | [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
|3792|3792| 				continue;
|3793|3793| 			if (this.orderQueue[i].type == type)
|3794|3794| 				continue;
|3795|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3795|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3796|3796| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3797|3797| 			return;
|3798|3798| 		}
|    | [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
|4034|4034| 	if (data.timerRepeat === undefined)
|4035|4035| 		this.timer = undefined;
|4036|4036| 
|4037|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4037|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4038|4038| };
|4039|4039| 
|4040|4040| /**
|    | [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
|4034|4034| 	if (data.timerRepeat === undefined)
|4035|4035| 		this.timer = undefined;
|4036|4036| 
|4037|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4037|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4038|4038| };
|4039|4039| 
|4040|4040| /**
|    | [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
|4079|4079| 	// TODO: This is a bit inefficient since every unit listens to every
|4080|4080| 	// construction message - ideally we could scope it to only the one we're building
|4081|4081| 
|4082|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4082|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4083|4083| };
|4084|4084| 
|4085|4085| 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
|4079|4079| 	// TODO: This is a bit inefficient since every unit listens to every
|4080|4080| 	// construction message - ideally we could scope it to only the one we're building
|4081|4081| 
|4082|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4082|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4083|4083| };
|4084|4084| 
|4085|4085| 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
|4110|4110| 	if (msg.fromStatusEffect)
|4111|4111| 		return;
|4112|4112| 
|4113|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4113|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4114|4114| };
|4115|4115| 
|4116|4116| 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
|4110|4110| 	if (msg.fromStatusEffect)
|4111|4111| 		return;
|4112|4112| 
|4113|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4113|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4114|4114| };
|4115|4115| 
|4116|4116| 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
|4115|4115| 
|4116|4116| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4117|4117| {
|4118|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4118|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4119|4119| };
|4120|4120| 
|4121|4121| 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
|4115|4115| 
|4116|4116| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4117|4117| {
|4118|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4118|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4119|4119| };
|4120|4120| 
|4121|4121| 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
|4120|4120| 
|4121|4121| UnitAI.prototype.OnHealthChanged = function(msg)
|4122|4122| {
|4123|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4123|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4124|4124| };
|4125|4125| 
|4126|4126| 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
|4120|4120| 
|4121|4121| UnitAI.prototype.OnHealthChanged = function(msg)
|4122|4122| {
|4123|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4123|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4124|4124| };
|4125|4125| 
|4126|4126| 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
|4126|4126| UnitAI.prototype.OnRangeUpdate = function(msg)
|4127|4127| {
|4128|4128| 	if (msg.tag == this.losRangeQuery)
|4129|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4129|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4130|4130| 	else if (msg.tag == this.losHealRangeQuery)
|4131|4131| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4132|4132| };
|    | [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
|4126|4126| UnitAI.prototype.OnRangeUpdate = function(msg)
|4127|4127| {
|4128|4128| 	if (msg.tag == this.losRangeQuery)
|4129|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4129|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4130|4130| 	else if (msg.tag == this.losHealRangeQuery)
|4131|4131| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4132|4132| };
|    | [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
|4128|4128| 	if (msg.tag == this.losRangeQuery)
|4129|4129| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4130|4130| 	else if (msg.tag == this.losHealRangeQuery)
|4131|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4131|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4132|4132| };
|4133|4133| 
|4134|4134| 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
|4128|4128| 	if (msg.tag == this.losRangeQuery)
|4129|4129| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4130|4130| 	else if (msg.tag == this.losHealRangeQuery)
|4131|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4131|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4132|4132| };
|4133|4133| 
|4134|4134| 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
|4133|4133| 
|4134|4134| UnitAI.prototype.OnPackFinished = function(msg)
|4135|4135| {
|4136|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4136|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4137|4137| };
|4138|4138| 
|4139|4139| //// 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
|4133|4133| 
|4134|4134| UnitAI.prototype.OnPackFinished = function(msg)
|4135|4135| {
|4136|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4136|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4137|4137| };
|4138|4138| 
|4139|4139| //// 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
|4136|4136| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4137|4137| };
|4138|4138| 
|4139|    |-//// Helper functions to be called by the FSM ////
|    |4139|+// // Helper functions to be called by the FSM ////
|4140|4140| 
|4141|4141| UnitAI.prototype.GetWalkSpeed = function()
|4142|4142| {
|    | [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
|4802|4802| UnitAI.prototype.AttackEntityInZone = function(ents)
|4803|4803| {
|4804|4804| 	var target = ents.find(target =>
|4805|    |-		this.CanAttack(target)
|4806|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4805|+		this.CanAttack(target) &&
|    |4806|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4807|4807| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4808|4808| 	);
|4809|4809| 	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
|4803|4803| {
|4804|4804| 	var target = ents.find(target =>
|4805|4805| 		this.CanAttack(target)
|4806|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4807|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4806|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4807|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4808|4808| 	);
|4809|4809| 	if (!target)
|4810|4810| 		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
|4867|4867| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4868|4868| 	if (this.isGuardOf)
|4869|4869| 	{
|4870|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4870|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4871|4871| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4872|4872| 		if (cmpUnitAI && cmpAttack &&
|4873|4873| 		    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
|4871|4871| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4872|4872| 		if (cmpUnitAI && cmpAttack &&
|4873|4873| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4874|    |-				return false;
|    |4874|+			return false;
|4875|4875| 	}
|4876|4876| 
|4877|4877| 	// 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
|4909|4909| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4910|4910| 	if (this.isGuardOf)
|4911|4911| 	{
|4912|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4912|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4913|4913| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4914|4914| 		if (cmpUnitAI && cmpAttack &&
|4915|4915| 		    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
|4922|4922| 	return false;
|4923|4923| };
|4924|4924| 
|4925|    |-//// External interface functions ////
|    |4925|+// // External interface functions ////
|4926|4926| 
|4927|4927| UnitAI.prototype.SetFormationController = function(ent)
|4928|4928| {
|    | [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
|5078|5078| 	{
|5079|5079| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5080|5080| 			return;
|5081|    |-		else
|5082|    |-			this.RemoveGuard();
|    |5081|+		this.RemoveGuard();
|5083|5082| 	}
|5084|5083| 
|5085|5084| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5409|5409| 
|5410|5410| 	if (this.IsFormationController())
|5411|5411| 		this.CallMemberFunction("CancelSetupTradeRoute", [target]);
|5412|    |-}
|    |5412|+};
|5413|5413| /**
|5414|5414|  * Adds trade order to the queue. Either walk to the first market, or
|5415|5415|  * start a new route. Not forced, so it can be interrupted by attacks.
|    | [NORMAL] ESLintBear (no-trailing-spaces):
|    | Trailing spaces not allowed.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5430|5430| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5431|5431| 	{
|5432|5432| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5433|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5433|+		if (cmpTrader.HasBothMarkets() &&
|5434|5434| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5435|5435| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5436|5436| 		{
|    | [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
|5711|5711| 				{
|5712|5712| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5713|5713| 					var targetClasses = this.order.data.targetClasses;
|5714|    |-					if (targetClasses.attack && cmpIdentity
|5715|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5714|+					if (targetClasses.attack && cmpIdentity &&
|    |5715|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5716|5716| 						continue;
|5717|5717| 					if (targetClasses.avoid && cmpIdentity
|5718|5718| 						&& 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
|5714|5714| 					if (targetClasses.attack && cmpIdentity
|5715|5715| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5716|5716| 						continue;
|5717|    |-					if (targetClasses.avoid && cmpIdentity
|5718|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5717|+					if (targetClasses.avoid && cmpIdentity &&
|    |5718|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5719|5719| 						continue;
|5720|5720| 					// Only used by the AIs to prevent some choices of targets
|5721|5721| 					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
|5737|5737| 		{
|5738|5738| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5739|5739| 			var targetClasses = this.order.data.targetClasses;
|5740|    |-			if (cmpIdentity && targetClasses.attack
|5741|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5740|+			if (cmpIdentity && targetClasses.attack &&
|    |5741|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5742|5742| 				continue;
|5743|5743| 			if (cmpIdentity && targetClasses.avoid
|5744|5744| 				&& 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
|5740|5740| 			if (cmpIdentity && targetClasses.attack
|5741|5741| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5742|5742| 				continue;
|5743|    |-			if (cmpIdentity && targetClasses.avoid
|5744|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5743|+			if (cmpIdentity && targetClasses.avoid &&
|    |5744|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5745|5745| 				continue;
|5746|5746| 			// Only used by the AIs to prevent some choices of targets
|5747|5747| 			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
|5883|5883| 
|5884|5884| UnitAI.prototype.SetHeldPosition = function(x, z)
|5885|5885| {
|5886|    |-	this.heldPosition = {"x": x, "z": z};
|    |5886|+	this.heldPosition = { "x": x, "z": z};
|5887|5887| };
|5888|5888| 
|5889|5889| 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
|5883|5883| 
|5884|5884| UnitAI.prototype.SetHeldPosition = function(x, z)
|5885|5885| {
|5886|    |-	this.heldPosition = {"x": x, "z": z};
|    |5886|+	this.heldPosition = {"x": x, "z": z };
|5887|5887| };
|5888|5888| 
|5889|5889| 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
|5910|5910| 	return false;
|5911|5911| };
|5912|5912| 
|5913|    |-//// Helper functions ////
|    |5913|+// // Helper functions ////
|5914|5914| 
|5915|5915| /**
|5916|5916|  * General getter for ranges.
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5929|5929| 		return undefined;
|5930|5930| 
|5931|5931| 	return component.GetRange(type);
|5932|    |-}
|    |5932|+};
|5933|5933| 
|5934|5934| UnitAI.prototype.CanAttack = function(target)
|5935|5935| {
|    | [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
|6127|6127| 	return cmpPack && cmpPack.IsPacking();
|6128|6128| };
|6129|6129| 
|6130|    |-//// Formation specific functions ////
|    |6130|+// // Formation specific functions ////
|6131|6131| 
|6132|6132| UnitAI.prototype.IsAttackingAsFormation = function()
|6133|6133| {
|    | [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
|6132|6132| UnitAI.prototype.IsAttackingAsFormation = function()
|6133|6133| {
|6134|6134| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6135|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6136|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6135|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6136|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6137|6137| };
|6138|6138| 
|6139|6139| //// 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
|6136|6136| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6137|6137| };
|6138|6138| 
|6139|    |-//// Animal specific functions ////
|    |6139|+// // Animal specific functions ////
|6140|6140| 
|6141|6141| UnitAI.prototype.MoveRandomly = function(distance)
|6142|6142| {

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|3939| »   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
|4789| »   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
|4804| »   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
|4850| »   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
|4873| »   »   ····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
|2042| »   »   »   »   »   »   &&·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
|3077| »   »   »   »   »   this.SetAnimationVariant(this.formationAnimationVariant)
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

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

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

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

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

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

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

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

Stan added inline comments.Fri, Mar 20, 3:02 PM
binaries/data/mods/public/simulation/components/ResourceSupply.js
158

int → number

339

check for length?

384

Should we use the regexp \s+ here ?

449

check for length?

466

check for length?

473

int → number

484

check for length?

491

int → number

binaries/data/mods/public/simulation/components/tests/test_ResourceSupply.js
33–34

Use strings.

102

Use strings.

122

Use strings.

146

Use strings.

165

Use strings.

188

Use strings.

Freagarach marked 4 inline comments as done.Fri, Mar 20, 3:10 PM
Freagarach added inline comments.
binaries/data/mods/public/simulation/components/ResourceSupply.js
339

No, because it could be possible that all timers were stopped and deleted.

384

I don't know?
It just uses indexOf in BuildRestrictions.js, so perhaps that can also be used here?

binaries/data/mods/public/simulation/components/tests/test_ResourceSupply.js
188

You *could* have stopped after the first one ;)

Nescio removed a subscriber: Nescio.Sat, Mar 21, 10:59 AM
Freagarach updated this revision to Diff 11536.Tue, Mar 24, 3:15 PM
Freagarach marked 11 inline comments as done.
  • Strings in test.
  • int -> number.
  • Use indexOf directly instead of splitting first.

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (no-else-return):
|    | Unnecessary 'else' after 'return'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
| 788| 788| 					this.FinishOrder();
| 789| 789| 					return;
| 790| 790| 				}
| 791|    |-				else
| 792|    |-				{
|    | 791|+				
| 793| 792| 					this.SetNextState("GARRISON.APPROACHING");
| 794| 793| 					return;
| 795|    |-				}
|    | 794|+				
| 796| 795| 			}
| 797| 796| 
| 798| 797| 			this.SetNextState("GARRISON.GARRISONING");
|    | [NORMAL] ESLintBear (key-spacing):
|    | Missing space before value for key 'GARRISON'.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|1060|1060| 			},
|1061|1061| 		},
|1062|1062| 
|1063|    |-		"GARRISON":{
|    |1063|+		"GARRISON": {
|1064|1064| 			"APPROACHING": {
|1065|1065| 				"enter": function() {
|1066|1066| 					if (!this.MoveToGarrisonRange(this.order.data.target))
|    | [NORMAL] ESLintBear (operator-linebreak):
|    | '&&' should be placed at the end of the line.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|2038|2038| 
|2039|2039| 				"Attacked": function(msg) {
|2040|2040| 					// If we are capturing and are attacked by something that we would not capture, attack that entity instead
|2041|    |-					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force)
|2042|    |-						&& this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|    |2041|+					if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) &&
|    |2042|+						this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture")
|2043|2043| 						this.RespondToTargetedEntities([msg.data.attacker]);
|2044|2044| 				},
|2045|2045| 			},
|    | [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
|2776|2776| 					{
|2777|2777| 						// The building was already finished/fully repaired before we arrived;
|2778|2778| 						// let the ConstructionFinished handler handle this.
|2779|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2779|+						this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget});
|2780|2780| 						return true;
|2781|2781| 					}
|2782|2782| 
|    | [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
|2776|2776| 					{
|2777|2777| 						// The building was already finished/fully repaired before we arrived;
|2778|2778| 						// let the ConstructionFinished handler handle this.
|2779|    |-						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget});
|    |2779|+						this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget });
|2780|2780| 						return true;
|2781|2781| 					}
|2782|2782| 
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3074|3074| 				this.StopTimer();
|3075|3075| 				this.ResetAnimation();
|3076|3076| 				if (this.formationAnimationVariant)
|3077|    |-					this.SetAnimationVariant(this.formationAnimationVariant)
|    |3077|+					this.SetAnimationVariant(this.formationAnimationVariant);
|3078|3078| 				else
|3079|3079| 					this.SetDefaultAnimationVariant();
|3080|3080| 				var cmpResistance = Engine.QueryInterface(this.entity, IID_Resistance);
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 7.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3300|3300| 		"COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals
|3301|3301| 
|3302|3302| 		"WALKING": "INDIVIDUAL.WALKING",	// reuse the same walking behaviour for animals
|3303|    |-							// only used for domestic animals
|    |3303|+		// only used for domestic animals
|3304|3304| 
|3305|3305| 		// Reuse the same garrison behaviour for animals.
|3306|3306| 		"GARRISON": "INDIVIDUAL.GARRISON",
|    | [NORMAL] ESLintBear (no-unneeded-ternary):
|    | Unnecessary use of boolean literals in conditional expression.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|3362|3362| 
|3363|3363| UnitAI.prototype.IsAnimal = function()
|3364|3364| {
|3365|    |-	return (this.template.NaturalBehaviour ? true : false);
|    |3365|+	return (!!this.template.NaturalBehaviour);
|3366|3366| };
|3367|3367| 
|3368|3368| 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
|3478|3478| 		{
|3479|3479| 			let index = this.GetCurrentState().indexOf(".");
|3480|3480| 			if (index != -1)
|3481|    |-				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index));
|    |3481|+				this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index));
|3482|3482| 			this.Stop(false);
|3483|3483| 		}
|3484|3484| 
|    | [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
|3534|3534| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3535|3535| 			continue;
|3536|3536| 		if (i == 0)
|3537|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3537|+			this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg});
|3538|3538| 		else
|3539|3539| 			this.orderQueue.splice(i, 1);
|3540|3540| 		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
|3534|3534| 		if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity)
|3535|3535| 			continue;
|3536|3536| 		if (i == 0)
|3537|    |-			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg});
|    |3537|+			this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg });
|3538|3538| 		else
|3539|3539| 			this.orderQueue.splice(i, 1);
|3540|3540| 		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
|3621|3621| };
|3622|3622| 
|3623|3623| 
|3624|    |-//// FSM linkage functions ////
|    |3624|+// // FSM linkage functions ////
|3625|3625| 
|3626|3626| // Setting the next state to the current state will leave/re-enter the top-most substate.
|3627|3627| 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
|3792|3792| 				continue;
|3793|3793| 			if (this.orderQueue[i].type == type)
|3794|3794| 				continue;
|3795|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3795|+			this.orderQueue.splice(i, 0, { "type": type, "data": data});
|3796|3796| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3797|3797| 			return;
|3798|3798| 		}
|    | [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
|3792|3792| 				continue;
|3793|3793| 			if (this.orderQueue[i].type == type)
|3794|3794| 				continue;
|3795|    |-			this.orderQueue.splice(i, 0, {"type": type, "data": data});
|    |3795|+			this.orderQueue.splice(i, 0, {"type": type, "data": data });
|3796|3796| 			Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
|3797|3797| 			return;
|3798|3798| 		}
|    | [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
|4034|4034| 	if (data.timerRepeat === undefined)
|4035|4035| 		this.timer = undefined;
|4036|4036| 
|4037|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4037|+	this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness});
|4038|4038| };
|4039|4039| 
|4040|4040| /**
|    | [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
|4034|4034| 	if (data.timerRepeat === undefined)
|4035|4035| 		this.timer = undefined;
|4036|4036| 
|4037|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness});
|    |4037|+	this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness });
|4038|4038| };
|4039|4039| 
|4040|4040| /**
|    | [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
|4079|4079| 	// TODO: This is a bit inefficient since every unit listens to every
|4080|4080| 	// construction message - ideally we could scope it to only the one we're building
|4081|4081| 
|4082|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4082|+	this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg});
|4083|4083| };
|4084|4084| 
|4085|4085| 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
|4079|4079| 	// TODO: This is a bit inefficient since every unit listens to every
|4080|4080| 	// construction message - ideally we could scope it to only the one we're building
|4081|4081| 
|4082|    |-	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg});
|    |4082|+	this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg });
|4083|4083| };
|4084|4084| 
|4085|4085| 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
|4110|4110| 	if (msg.fromStatusEffect)
|4111|4111| 		return;
|4112|4112| 
|4113|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4113|+	this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg});
|4114|4114| };
|4115|4115| 
|4116|4116| 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
|4110|4110| 	if (msg.fromStatusEffect)
|4111|4111| 		return;
|4112|4112| 
|4113|    |-	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg});
|    |4113|+	this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg });
|4114|4114| };
|4115|4115| 
|4116|4116| 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
|4115|4115| 
|4116|4116| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4117|4117| {
|4118|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4118|+	this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data});
|4119|4119| };
|4120|4120| 
|4121|4121| 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
|4115|4115| 
|4116|4116| UnitAI.prototype.OnGuardedAttacked = function(msg)
|4117|4117| {
|4118|    |-	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data});
|    |4118|+	this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data });
|4119|4119| };
|4120|4120| 
|4121|4121| 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
|4120|4120| 
|4121|4121| UnitAI.prototype.OnHealthChanged = function(msg)
|4122|4122| {
|4123|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4123|+	this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to});
|4124|4124| };
|4125|4125| 
|4126|4126| 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
|4120|4120| 
|4121|4121| UnitAI.prototype.OnHealthChanged = function(msg)
|4122|4122| {
|4123|    |-	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to});
|    |4123|+	this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to });
|4124|4124| };
|4125|4125| 
|4126|4126| 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
|4126|4126| UnitAI.prototype.OnRangeUpdate = function(msg)
|4127|4127| {
|4128|4128| 	if (msg.tag == this.losRangeQuery)
|4129|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4129|+		this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg});
|4130|4130| 	else if (msg.tag == this.losHealRangeQuery)
|4131|4131| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4132|4132| };
|    | [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
|4126|4126| UnitAI.prototype.OnRangeUpdate = function(msg)
|4127|4127| {
|4128|4128| 	if (msg.tag == this.losRangeQuery)
|4129|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|    |4129|+		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg });
|4130|4130| 	else if (msg.tag == this.losHealRangeQuery)
|4131|4131| 		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|4132|4132| };
|    | [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
|4128|4128| 	if (msg.tag == this.losRangeQuery)
|4129|4129| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4130|4130| 	else if (msg.tag == this.losHealRangeQuery)
|4131|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4131|+		this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg});
|4132|4132| };
|4133|4133| 
|4134|4134| 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
|4128|4128| 	if (msg.tag == this.losRangeQuery)
|4129|4129| 		this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg});
|4130|4130| 	else if (msg.tag == this.losHealRangeQuery)
|4131|    |-		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg});
|    |4131|+		this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg });
|4132|4132| };
|4133|4133| 
|4134|4134| 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
|4133|4133| 
|4134|4134| UnitAI.prototype.OnPackFinished = function(msg)
|4135|4135| {
|4136|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4136|+	this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed});
|4137|4137| };
|4138|4138| 
|4139|4139| //// 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
|4133|4133| 
|4134|4134| UnitAI.prototype.OnPackFinished = function(msg)
|4135|4135| {
|4136|    |-	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|    |4136|+	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed });
|4137|4137| };
|4138|4138| 
|4139|4139| //// 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
|4136|4136| 	this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed});
|4137|4137| };
|4138|4138| 
|4139|    |-//// Helper functions to be called by the FSM ////
|    |4139|+// // Helper functions to be called by the FSM ////
|4140|4140| 
|4141|4141| UnitAI.prototype.GetWalkSpeed = function()
|4142|4142| {
|    | [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
|4803|4803| UnitAI.prototype.AttackEntityInZone = function(ents)
|4804|4804| {
|4805|4805| 	var target = ents.find(target =>
|4806|    |-		this.CanAttack(target)
|4807|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|    |4806|+		this.CanAttack(target) &&
|    |4807|+		this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4808|4808| 		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4809|4809| 	);
|4810|4810| 	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
|4804|4804| {
|4805|4805| 	var target = ents.find(target =>
|4806|4806| 		this.CanAttack(target)
|4807|    |-		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true))
|4808|    |-		&& (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|    |4807|+		&& this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) &&
|    |4808|+		(this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target))
|4809|4809| 	);
|4810|4810| 	if (!target)
|4811|4811| 		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
|4868|4868| 	// If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker
|4869|4869| 	if (this.isGuardOf)
|4870|4870| 	{
|4871|    |-		var cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4871|+		var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4872|4872| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4873|4873| 		if (cmpUnitAI && cmpAttack &&
|4874|4874| 		    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
|4872|4872| 		var cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4873|4873| 		if (cmpUnitAI && cmpAttack &&
|4874|4874| 		    cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type)))
|4875|    |-				return false;
|    |4875|+			return false;
|4876|4876| 	}
|4877|4877| 
|4878|4878| 	// 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
|4910|4910| 	// If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker
|4911|4911| 	if (this.isGuardOf)
|4912|4912| 	{
|4913|    |-		let cmpUnitAI =  Engine.QueryInterface(target, IID_UnitAI);
|    |4913|+		let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI);
|4914|4914| 		let cmpAttack = Engine.QueryInterface(target, IID_Attack);
|4915|4915| 		if (cmpUnitAI && cmpAttack &&
|4916|4916| 		    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
|4923|4923| 	return false;
|4924|4924| };
|4925|4925| 
|4926|    |-//// External interface functions ////
|    |4926|+// // External interface functions ////
|4927|4927| 
|4928|4928| UnitAI.prototype.SetFormationController = function(ent)
|4929|4929| {
|    | [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
|5079|5079| 	{
|5080|5080| 		if (this.isGuardOf == target && this.order && this.order.type == "Guard")
|5081|5081| 			return;
|5082|    |-		else
|5083|    |-			this.RemoveGuard();
|    |5082|+		this.RemoveGuard();
|5084|5083| 	}
|5085|5084| 
|5086|5085| 	this.AddOrder("Guard", { "target": target, "force": false }, queued);
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5410|5410| 
|5411|5411| 	if (this.IsFormationController())
|5412|5412| 		this.CallMemberFunction("CancelSetupTradeRoute", [target]);
|5413|    |-}
|    |5413|+};
|5414|5414| /**
|5415|5415|  * Adds trade order to the queue. Either walk to the first market, or
|5416|5416|  * start a new route. Not forced, so it can be interrupted by attacks.
|    | [NORMAL] ESLintBear (no-trailing-spaces):
|    | Trailing spaces not allowed.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5431|5431| 	    this.workOrders.length && this.workOrders[0].type == "Trade")
|5432|5432| 	{
|5433|5433| 		let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader);
|5434|    |-		if (cmpTrader.HasBothMarkets() && 
|    |5434|+		if (cmpTrader.HasBothMarkets() &&
|5435|5435| 		   (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source ||
|5436|5436| 		    cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target))
|5437|5437| 		{
|    | [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
|5712|5712| 				{
|5713|5713| 					var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5714|5714| 					var targetClasses = this.order.data.targetClasses;
|5715|    |-					if (targetClasses.attack && cmpIdentity
|5716|    |-						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5715|+					if (targetClasses.attack && cmpIdentity &&
|    |5716|+						!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5717|5717| 						continue;
|5718|5718| 					if (targetClasses.avoid && cmpIdentity
|5719|5719| 						&& 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
|5715|5715| 					if (targetClasses.attack && cmpIdentity
|5716|5716| 						&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5717|5717| 						continue;
|5718|    |-					if (targetClasses.avoid && cmpIdentity
|5719|    |-						&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5718|+					if (targetClasses.avoid && cmpIdentity &&
|    |5719|+						MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5720|5720| 						continue;
|5721|5721| 					// Only used by the AIs to prevent some choices of targets
|5722|5722| 					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
|5738|5738| 		{
|5739|5739| 			var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
|5740|5740| 			var targetClasses = this.order.data.targetClasses;
|5741|    |-			if (cmpIdentity && targetClasses.attack
|5742|    |-				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|    |5741|+			if (cmpIdentity && targetClasses.attack &&
|    |5742|+				!MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5743|5743| 				continue;
|5744|5744| 			if (cmpIdentity && targetClasses.avoid
|5745|5745| 				&& 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
|5741|5741| 			if (cmpIdentity && targetClasses.attack
|5742|5742| 				&& !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack))
|5743|5743| 				continue;
|5744|    |-			if (cmpIdentity && targetClasses.avoid
|5745|    |-				&& MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|    |5744|+			if (cmpIdentity && targetClasses.avoid &&
|    |5745|+				MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid))
|5746|5746| 				continue;
|5747|5747| 			// Only used by the AIs to prevent some choices of targets
|5748|5748| 			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
|5884|5884| 
|5885|5885| UnitAI.prototype.SetHeldPosition = function(x, z)
|5886|5886| {
|5887|    |-	this.heldPosition = {"x": x, "z": z};
|    |5887|+	this.heldPosition = { "x": x, "z": z};
|5888|5888| };
|5889|5889| 
|5890|5890| 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
|5884|5884| 
|5885|5885| UnitAI.prototype.SetHeldPosition = function(x, z)
|5886|5886| {
|5887|    |-	this.heldPosition = {"x": x, "z": z};
|    |5887|+	this.heldPosition = {"x": x, "z": z };
|5888|5888| };
|5889|5889| 
|5890|5890| 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
|5911|5911| 	return false;
|5912|5912| };
|5913|5913| 
|5914|    |-//// Helper functions ////
|    |5914|+// // Helper functions ////
|5915|5915| 
|5916|5916| /**
|5917|5917|  * General getter for ranges.
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
|5930|5930| 		return undefined;
|5931|5931| 
|5932|5932| 	return component.GetRange(type);
|5933|    |-}
|    |5933|+};
|5934|5934| 
|5935|5935| UnitAI.prototype.CanAttack = function(target)
|5936|5936| {
|    | [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
|6128|6128| 	return cmpPack && cmpPack.IsPacking();
|6129|6129| };
|6130|6130| 
|6131|    |-//// Formation specific functions ////
|    |6131|+// // Formation specific functions ////
|6132|6132| 
|6133|6133| UnitAI.prototype.IsAttackingAsFormation = function()
|6134|6134| {
|    | [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
|6133|6133| UnitAI.prototype.IsAttackingAsFormation = function()
|6134|6134| {
|6135|6135| 	var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
|6136|    |-	return cmpAttack && cmpAttack.CanAttackAsFormation()
|6137|    |-		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|    |6136|+	return cmpAttack && cmpAttack.CanAttackAsFormation() &&
|    |6137|+		this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6138|6138| };
|6139|6139| 
|6140|6140| //// 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
|6137|6137| 		&& this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING";
|6138|6138| };
|6139|6139| 
|6140|    |-//// Animal specific functions ////
|    |6140|+// // Animal specific functions ////
|6141|6141| 
|6142|6142| UnitAI.prototype.MoveRandomly = function(distance)
|6143|6143| {

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

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

binaries/data/mods/public/simulation/components/UnitAI.js
|3939| »   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
|4790| »   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
|4805| »   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
|4851| »   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
|4874| »   »   ····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
|2042| »   »   »   »   »   »   &&·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
|3077| »   »   »   »   »   this.SetAnimationVariant(this.formationAnimationVariant)
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.

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

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

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

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

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

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

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

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

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