This places the damage types in a "Damage" container, just like the "Resources" are.
Discussed in D1936.
Disclaimer: I am sorry to all modders!
Differential D1950
Create "Damage"-container for damage types in templates. wraitii on Jun 3 2019, 9:30 PM. Authored by
Details
This places the damage types in a "Damage" container, just like the "Resources" are. Disclaimer: I am sorry to all modders! Play some games, pray that nothing is overlooked in this gigantic patch.
Diff Detail
Event TimelineThere are a very large number of changes, so older changes are hidden. Show Older Changes Comment Actions Lowercase damage types, currently not visible. True, is there some kind of rule for that? Comment Actions Good to know! Yeah, I didn't change all those files by hand, but I'll make sure they get indented correctly. No, certainly not. D1936 lets mods add new damage types by adding files (like currently done with resources) and this just changes the way the damage types are structured in the templates (again like currently done with resources). Consistency all over the place :D Comment Actions 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 2. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/DamageTypes.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/DamageTypes.js | 2| 2| { | 3| 3| return "<interleave>" + this.GetTypes().reduce((schema, type) => | 4| 4| schema + "<element name='"+type+"' a:help='"+type+" "+helptext+"'><ref name='nonNegativeDecimal'/></element>", | 5| |- "") + "</interleave>"; | | 5|+ "") + "</interleave>"; | 6| 6| }; | 7| 7| | 8| 8| DamageTypes = new DamageTypes(); | | [NORMAL] ESLintBear (operator-linebreak): | | '||' should be placed at the end of the line. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/globalscripts/Templates.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/globalscripts/Templates.js | 87| 87| // If the elements are still strings, split them by space or by '+' | 88| 88| if (typeof sublist == "string") | 89| 89| sublist = sublist.split(/[+\s]+/); | 90| |- if (sublist.every(c => (c[0] == "!" && classes.indexOf(c.substr(1)) == -1) | 91| |- || (c[0] != "!" && classes.indexOf(c) != -1))) | | 90|+ if (sublist.every(c => (c[0] == "!" && classes.indexOf(c.substr(1)) == -1) || | | 91|+ (c[0] != "!" && classes.indexOf(c) != -1))) | 92| 92| return true; | 93| 93| } | 94| 94| | | [NORMAL] ESLintBear (indent): | | Expected indentation of 4 tabs but found 5. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/globalscripts/Templates.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/globalscripts/Templates.js | 226| 226| { | 227| 227| let aura = auraTemplates[auraID]; | 228| 228| ret.auras[auraID] = { | 229| |- "name": aura.auraName, | | 229|+ "name": aura.auraName, | 230| 230| "description": aura.auraDescription || null, | 231| 231| "radius": aura.radius || null | 232| 232| }; | | [NORMAL] ESLintBear (indent): | | Expected indentation of 4 tabs but found 5. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/globalscripts/Templates.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/globalscripts/Templates.js | 227| 227| let aura = auraTemplates[auraID]; | 228| 228| ret.auras[auraID] = { | 229| 229| "name": aura.auraName, | 230| |- "description": aura.auraDescription || null, | | 230|+ "description": aura.auraDescription || null, | 231| 231| "radius": aura.radius || null | 232| 232| }; | 233| 233| } | | [NORMAL] ESLintBear (indent): | | Expected indentation of 4 tabs but found 5. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/globalscripts/Templates.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/globalscripts/Templates.js | 228| 228| ret.auras[auraID] = { | 229| 229| "name": aura.auraName, | 230| 230| "description": aura.auraDescription || null, | 231| |- "radius": aura.radius || null | | 231|+ "radius": aura.radius || null | 232| 232| }; | 233| 233| } | 234| 234| } | | [NORMAL] ESLintBear (indent): | | Expected indentation of 3 tabs but found 4. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/globalscripts/Templates.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/globalscripts/Templates.js | 229| 229| "name": aura.auraName, | 230| 230| "description": aura.auraDescription || null, | 231| 231| "radius": aura.radius || null | 232| |- }; | | 232|+ }; | 233| 233| } | 234| 234| } | 235| 235| binaries/data/mods/public/globalscripts/Templates.js | 91| » » ····················||·(c[0]·!=·"!"·&&·classes.indexOf(c)·!=·-1))) | | [NORMAL] JSHintBear: | | Misleading line break before '||'; readers may interpret this as an expression boundary. | | [NORMAL] ESLintBear (dot-notation): | | ["Value"] is better written in dot notation. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js | 459| 459| ApplyValueModificationsToEntity("Attack/" + type + splash + "/Damage/" + damageType, +(template.Damage[damageType] || 0), this.entity); | 460| 460| | 461| 461| if (type == "Capture") | 462| |- return { "value": ApplyValueModificationsToEntity("Attack/Capture/Value", +(template["Value"] || 0), this.entity) }; | | 462|+ return { "value": ApplyValueModificationsToEntity("Attack/Capture/Value", +(template.Value || 0), this.entity) }; | 463| 463| | 464| 464| let ret = {}; | 465| 465| for (let damageType of DamageTypes.GetTypes()) | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js | 523| 523| | 524| 524| let horizSpeed = +this.template[type].Projectile.Speed; | 525| 525| let gravity = +this.template[type].Projectile.Gravity; | 526| |- //horizSpeed /= 2; gravity /= 2; // slow it down for testing | | 526|+ // horizSpeed /= 2; gravity /= 2; // slow it down for testing | 527| 527| | 528| 528| let cmpPosition = Engine.QueryInterface(this.entity, IID_Position); | 529| 529| if (!cmpPosition || !cmpPosition.IsInWorld()) | | [NORMAL] ESLintBear (no-trailing-spaces): | | Trailing spaces not allowed. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js | 570| 570| // TODO: Use unit rotation to implement x/z offsets. | 571| 571| let deltaLaunchPoint = new Vector3D(0, this.template[type].Projectile.LaunchPoint["@y"], 0.0); | 572| 572| let launchPoint = Vector3D.add(selfPosition, deltaLaunchPoint); | 573| |- | | 573|+ | 574| 574| let cmpVisual = Engine.QueryInterface(this.entity, IID_Visual); | 575| 575| if (cmpVisual) | 576| 576| { | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'else'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js | 642| 642| }); | 643| 643| } | 644| 644| else | 645| |- { | | 645|+ | 646| 646| // Melee attack - hurt the target immediately | 647| 647| cmpDamage.CauseDamage({ | 648| 648| "strengths": this.GetAttackStrengths(type), | 652| 652| "type": type, | 653| 653| "attackerOwner": attackerOwner | 654| 654| }); | 655| |- } | | 655|+ | 656| 656| }; | 657| 657| | 658| 658| /** binaries/data/mods/public/simulation/components/Attack.js | 513| ·» let·cmpDamage·=·Engine.QueryInterface(SYSTEM_ENTITY,·IID_Damage); | | [NORMAL] ESLintBear (no-mixed-spaces-and-tabs): | | Mixed spaces and tabs. binaries/data/mods/public/simulation/components/Attack.js | 462| » » return·{·"value":·ApplyValueModificationsToEntity("Attack/Capture/Value",·+(template["Value"]·||·0),·this.entity)·}; | | [NORMAL] JSHintBear: | | ['Value'] is better written in dot notation. binaries/data/mods/public/simulation/components/Attack.js | 617| » » cmpTimer.SetTimeout(SYSTEM_ENTITY,·IID_Damage,·"MissileHit",·timeToTarget·*·1000·+·+this.template[type].Delay,·data); | | [NORMAL] JSHintBear: | | Confusing plusses. | | [NORMAL] ESLintBear (key-spacing): | | Extra space after key 'Melee'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js | 43| 43| }); | 44| 44| | 45| 45| let cmpAttack = ConstructComponent(attacker, "Attack", { | 46| |- "Melee" : { | | 46|+ "Melee": { | 47| 47| "Damage": { | 48| 48| "Hack": 11, | 49| 49| "Pierce": 5, | | [NORMAL] ESLintBear (key-spacing): | | Extra space after key 'Ranged'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js | 65| 65| } | 66| 66| } | 67| 67| }, | 68| |- "Ranged" : { | | 68|+ "Ranged": { | 69| 69| "Damage": { | 70| 70| "Hack": 0, | 71| 71| "Pierce": 10, | | [NORMAL] ESLintBear (key-spacing): | | Extra space after key 'Splash'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js | 86| 86| "RestrictedClasses": { | 87| 87| "_string": "Elephant" | 88| 88| }, | 89| |- "Splash" : { | | 89|+ "Splash": { | 90| 90| "Shape": "Circular", | 91| 91| "Range": 10, | 92| 92| "FriendlyFire": "false", | | [NORMAL] ESLintBear (key-spacing): | | Extra space after key 'Capture'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js | 103| 103| } | 104| 104| } | 105| 105| }, | 106| |- "Capture" : { | | 106|+ "Capture": { | 107| 107| "Value": 8, | 108| 108| "MaxRange": 10, | 109| 109| }, | | [NORMAL] ESLintBear (comma-spacing): | | There should be no space before ','. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js | 134| 134| } | 135| 135| | 136| 136| // Validate template getter functions | 137| |-attackComponentTest(undefined, true ,(attacker, cmpAttack, defender) => { | | 137|+attackComponentTest(undefined, true,(attacker, cmpAttack, defender) => { | 138| 138| | 139| 139| TS_ASSERT_UNEVAL_EQUALS(cmpAttack.GetAttackTypes(), ["Melee", "Ranged", "Capture"]); | 140| 140| TS_ASSERT_UNEVAL_EQUALS(cmpAttack.GetAttackTypes([]), ["Melee", "Ranged", "Capture"]); | | [NORMAL] ESLintBear (comma-spacing): | | A space is required after ','. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js | 134| 134| } | 135| 135| | 136| 136| // Validate template getter functions | 137| |-attackComponentTest(undefined, true ,(attacker, cmpAttack, defender) => { | | 137|+attackComponentTest(undefined, true , (attacker, cmpAttack, defender) => { | 138| 138| | 139| 139| TS_ASSERT_UNEVAL_EQUALS(cmpAttack.GetAttackTypes(), ["Melee", "Ranged", "Capture"]); | 140| 140| TS_ASSERT_UNEVAL_EQUALS(cmpAttack.GetAttackTypes([]), ["Melee", "Ranged", "Capture"]); | | [NORMAL] ESLintBear (no-trailing-spaces): | | Trailing spaces not allowed. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js | 157| 157| "Pierce": 10, | 158| 158| "Crush": 0 | 159| 159| }); | 160| |- | | 160|+ | 161| 161| TS_ASSERT_UNEVAL_EQUALS(cmpAttack.GetAttackStrengths("Ranged.Splash"), { | 162| 162| "Hack": 0.0, | 163| 163| "Pierce": 15.0, | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'for-in'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | 10| 10| | 11| 11| var ret = {}; | 12| 12| for (var i in this) | 13| |- { | | 13|+ | 14| 14| if (this.hasOwnProperty(i)) | 15| 15| ret[i] = this[i]; | 16| |- } | | 16|+ | 17| 17| ret.modificationCache = {}; | 18| 18| return ret; | 19| 19| }; | | [NORMAL] ESLintBear (operator-linebreak): | | '||' should be placed at the end of the line. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | 64| 64| for (let key of this.unresearchedAutoResearchTechs) | 65| 65| { | 66| 66| let tech = TechnologyTemplates.Get(key); | 67| |- if ((tech.autoResearch && this.CanResearch(key)) | 68| |- || (tech.top && (this.IsTechnologyResearched(tech.top) || this.IsTechnologyResearched(tech.bottom)))) | | 67|+ if ((tech.autoResearch && this.CanResearch(key)) || | | 68|+ (tech.top && (this.IsTechnologyResearched(tech.top) || this.IsTechnologyResearched(tech.bottom)))) | 69| 69| { | 70| 70| this.unresearchedAutoResearchTechs.delete(key); | 71| 71| this.ResearchTechnology(key); | | [NORMAL] ESLintBear (space-before-function-paren): | | Unexpected space before function parentheses. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | 75| 75| }; | 76| 76| | 77| 77| // Checks an entity template to see if its technology requirements have been met | 78| |-TechnologyManager.prototype.CanProduce = function (templateName) | | 78|+TechnologyManager.prototype.CanProduce = function(templateName) | 79| 79| { | 80| 80| var cmpTempManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_TemplateManager); | 81| 81| var template = cmpTempManager.GetTemplate(templateName); | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | 193| 193| var classes = cmpIdentity.GetClassesList(); | 194| 194| // don't use foundations for the class counts but check if techs apply (e.g. health increase) | 195| 195| if (!Engine.QueryInterface(msg.entity, IID_Foundation)) | 196| |- { | | 196|+ | 197| 197| for (let cls of classes) | 198| 198| { | 199| 199| this.classCounts[cls] = this.classCounts[cls] || 0; | 203| 203| this.typeCountsByClass[cls][template] = this.typeCountsByClass[cls][template] || 0; | 204| 204| this.typeCountsByClass[cls][template] += 1; | 205| 205| } | 206| |- } | | 206|+ | 207| 207| | 208| 208| // Newly created entity, check if any researched techs might apply | 209| 209| // (only do this for new entities because even if an entity is converted or captured, | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | 286| 286| } | 287| 287| | 288| 288| if (template.replaces && template.replaces.length > 0) | 289| |- { | | 289|+ | 290| 290| for (var i of template.replaces) | 291| 291| { | 292| 292| if (!i || this.IsTechnologyResearched(i)) | 304| 304| cmpPlayerEntityLimits.UpdateLimitsFromTech(i); | 305| 305| } | 306| 306| } | 307| |- } | | 307|+ | 308| 308| | 309| 309| this.UpdateAutoResearch(); | 310| 310| | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | 322| 322| cmpPlayerEntityLimits.UpdateLimitsFromTech(tech); | 323| 323| | 324| 324| // always send research finished message | 325| |- Engine.PostMessage(this.entity, MT_ResearchFinished, {"player": playerID, "tech": tech}); | | 325|+ Engine.PostMessage(this.entity, MT_ResearchFinished, { "player": playerID, "tech": tech}); | 326| 326| | 327| 327| for (var component in modifiedComponents) | 328| 328| { | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | 322| 322| cmpPlayerEntityLimits.UpdateLimitsFromTech(tech); | 323| 323| | 324| 324| // always send research finished message | 325| |- Engine.PostMessage(this.entity, MT_ResearchFinished, {"player": playerID, "tech": tech}); | | 325|+ Engine.PostMessage(this.entity, MT_ResearchFinished, {"player": playerID, "tech": tech }); | 326| 326| | 327| 327| for (var component in modifiedComponents) | 328| 328| { | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | 326| 326| | 327| 327| for (var component in modifiedComponents) | 328| 328| { | 329| |- Engine.PostMessage(SYSTEM_ENTITY, MT_TemplateModification, { "player": playerID, "component": component, "valueNames": modifiedComponents[component]}); | | 329|+ Engine.PostMessage(SYSTEM_ENTITY, MT_TemplateModification, { "player": playerID, "component": component, "valueNames": modifiedComponents[component] }); | 330| 330| Engine.BroadcastMessage(MT_ValueModification, { "entities": ents, "component": component, "valueNames": modifiedComponents[component]}); | 331| 331| } | 332| 332| | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | 327| 327| for (var component in modifiedComponents) | 328| 328| { | 329| 329| Engine.PostMessage(SYSTEM_ENTITY, MT_TemplateModification, { "player": playerID, "component": component, "valueNames": modifiedComponents[component]}); | 330| |- Engine.BroadcastMessage(MT_ValueModification, { "entities": ents, "component": component, "valueNames": modifiedComponents[component]}); | | 330|+ Engine.BroadcastMessage(MT_ValueModification, { "entities": ents, "component": component, "valueNames": modifiedComponents[component] }); | 331| 331| } | 332| 332| | 333| 333| if (tech.startsWith("phase") && !template.autoResearch) | | [NORMAL] ESLintBear (semi): | | Missing semicolon. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | 449| 449| */ | 450| 450| TechnologyManager.prototype.GetResearcher = function(tech) | 451| 451| { | 452| |- return this.researchQueued.get(tech) | | 452|+ return this.researchQueued.get(tech); | 453| 453| }; | 454| 454| | 455| 455| /** binaries/data/mods/public/simulation/components/TechnologyManager.js | 150| » » » switch·(type) | | [NORMAL] ESLintBear (default-case): | | Expected a default case. binaries/data/mods/public/simulation/components/TechnologyManager.js | 165| » switch·(entity.check) | | [NORMAL] ESLintBear (default-case): | | Expected a default case. binaries/data/mods/public/simulation/components/TechnologyManager.js | 220| ·» » » » » if·(DoesModificationApply(modif,·classes)) | | [NORMAL] ESLintBear (no-mixed-spaces-and-tabs): | | Mixed spaces and tabs. binaries/data/mods/public/simulation/components/TechnologyManager.js | 68| » » » ||·(tech.top·&&·(this.IsTechnologyResearched(tech.top)·||·this.IsTechnologyResearched(tech.bottom)))) | | [NORMAL] JSHintBear: | | Misleading line break before '||'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/components/TechnologyManager.js | 229| » » » for·(var·component·in·modifiedComponents) | | [NORMAL] JSHintBear: | | 'component' is already defined. binaries/data/mods/public/simulation/components/TechnologyManager.js | 235| » » var·cmpTemplateManager·=·Engine.QueryInterface(SYSTEM_ENTITY,·IID_TemplateManager); | | [NORMAL] JSHintBear: | | 'cmpTemplateManager' is already defined. binaries/data/mods/public/simulation/components/TechnologyManager.js | 236| » » var·template·=·cmpTemplateManager.GetCurrentTemplateName(msg.entity); | | [NORMAL] JSHintBear: | | 'template' is already defined. binaries/data/mods/public/simulation/components/TechnologyManager.js | 241| » » » var·cmpIdentity·=·Engine.QueryInterface(msg.entity,·IID_Identity); | | [NORMAL] JSHintBear: | | 'cmpIdentity' is already defined. binaries/data/mods/public/simulation/components/TechnologyManager.js | 244| » » » » var·classes·=·cmpIdentity.GetClassesList(); | | [NORMAL] JSHintBear: | | 'classes' is already defined. binaries/data/mods/public/simulation/components/TechnologyManager.js | 452| » return·this.researchQueued.get(tech) | | [NORMAL] JSHintBear: | | Missing semicolon. | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'for-of'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js | 33| 33| { | 34| 34| let args = string.split("/"); | 35| 35| for (let arg of args) | 36| |- { | | 36|+ | 37| 37| if (value[arg]) | 38| 38| value = value[arg]; | 39| 39| else | 41| 41| value = undefined; | 42| 42| break; | 43| 43| } | 44| |- } | | 44|+ | 45| 45| this._tpCache.set(string, value); | 46| 46| } | 47| 47| return this._tpCache.get(string); | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js | 308| 308| return undefined; | 309| 309| | 310| 310| if (this.get("Attack/" + type + "/Bonuses")) | 311| |- { | | 311|+ | 312| 312| for (let b in this.get("Attack/" + type + "/Bonuses")) | 313| 313| { | 314| 314| let bonusClasses = this.get("Attack/" + type + "/Bonuses/" + b + "/Classes"); | 318| 318| if (bcl == againstClass) | 319| 319| return +this.get("Attack/" + type + "/Bonuses/" + b + "/Multiplier"); | 320| 320| } | 321| |- } | | 321|+ | 322| 322| return 1; | 323| 323| }, | 324| 324| binaries/data/mods/public/simulation/ai/common-api/entity.js | 798| » » if·(this.position()·!==·undefined)·{ | | [NORMAL] ESLintBear (brace-rules/brace-on-same-line): | | Opening curly brace appears on the same line as controlling statement. binaries/data/mods/public/simulation/ai/common-api/entity.js | 815| » » if·(this.position()·!==·undefined·&&·unitToFleeFrom.position()·!==·undefined)·{ | | [NORMAL] ESLintBear (brace-rules/brace-on-same-line): | | Opening curly brace appears on the same line as controlling statement. Executing section cli... Link to build: https://jenkins.wildfiregames.com/job/differential/1601/display/redirect Comment Actions 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 2. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/DamageTypes.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/DamageTypes.js | 2| 2| { | 3| 3| return "<interleave>" + this.GetTypes().reduce((schema, type) => | 4| 4| schema + "<element name='"+type+"' a:help='"+type+" "+helptext+"'><ref name='nonNegativeDecimal'/></element>", | 5| |- "") + "</interleave>"; | | 5|+ "") + "</interleave>"; | 6| 6| }; | 7| 7| | 8| 8| DamageTypes = new DamageTypes(); | | [NORMAL] ESLintBear (key-spacing): | | Extra space after key 'Melee'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js | 43| 43| }); | 44| 44| | 45| 45| let cmpAttack = ConstructComponent(attacker, "Attack", { | 46| |- "Melee" : { | | 46|+ "Melee": { | 47| 47| "Damage": { | 48| 48| "Hack": 11, | 49| 49| "Pierce": 5, | | [NORMAL] ESLintBear (key-spacing): | | Extra space after key 'Ranged'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js | 65| 65| } | 66| 66| } | 67| 67| }, | 68| |- "Ranged" : { | | 68|+ "Ranged": { | 69| 69| "Damage": { | 70| 70| "Hack": 0, | 71| 71| "Pierce": 10, | | [NORMAL] ESLintBear (key-spacing): | | Extra space after key 'Splash'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js | 86| 86| "RestrictedClasses": { | 87| 87| "_string": "Elephant" | 88| 88| }, | 89| |- "Splash" : { | | 89|+ "Splash": { | 90| 90| "Shape": "Circular", | 91| 91| "Range": 10, | 92| 92| "FriendlyFire": "false", | | [NORMAL] ESLintBear (key-spacing): | | Extra space after key 'Capture'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js | 103| 103| } | 104| 104| } | 105| 105| }, | 106| |- "Capture" : { | | 106|+ "Capture": { | 107| 107| "Value": 8, | 108| 108| "MaxRange": 10, | 109| 109| }, | | [NORMAL] ESLintBear (comma-spacing): | | There should be no space before ','. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js | 134| 134| } | 135| 135| | 136| 136| // Validate template getter functions | 137| |-attackComponentTest(undefined, true ,(attacker, cmpAttack, defender) => { | | 137|+attackComponentTest(undefined, true,(attacker, cmpAttack, defender) => { | 138| 138| | 139| 139| TS_ASSERT_UNEVAL_EQUALS(cmpAttack.GetAttackTypes(), ["Melee", "Ranged", "Capture"]); | 140| 140| TS_ASSERT_UNEVAL_EQUALS(cmpAttack.GetAttackTypes([]), ["Melee", "Ranged", "Capture"]); | | [NORMAL] ESLintBear (comma-spacing): | | A space is required after ','. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js | 134| 134| } | 135| 135| | 136| 136| // Validate template getter functions | 137| |-attackComponentTest(undefined, true ,(attacker, cmpAttack, defender) => { | | 137|+attackComponentTest(undefined, true , (attacker, cmpAttack, defender) => { | 138| 138| | 139| 139| TS_ASSERT_UNEVAL_EQUALS(cmpAttack.GetAttackTypes(), ["Melee", "Ranged", "Capture"]); | 140| 140| TS_ASSERT_UNEVAL_EQUALS(cmpAttack.GetAttackTypes([]), ["Melee", "Ranged", "Capture"]); | | [NORMAL] ESLintBear (no-trailing-spaces): | | Trailing spaces not allowed. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js | 157| 157| "Pierce": 10, | 158| 158| "Crush": 0 | 159| 159| }); | 160| |- | | 160|+ | 161| 161| TS_ASSERT_UNEVAL_EQUALS(cmpAttack.GetAttackStrengths("Ranged.Splash"), { | 162| 162| "Hack": 0.0, | 163| 163| "Pierce": 15.0, | | [NORMAL] ESLintBear (operator-linebreak): | | '||' should be placed at the end of the line. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/globalscripts/Templates.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/globalscripts/Templates.js | 87| 87| // If the elements are still strings, split them by space or by '+' | 88| 88| if (typeof sublist == "string") | 89| 89| sublist = sublist.split(/[+\s]+/); | 90| |- if (sublist.every(c => (c[0] == "!" && classes.indexOf(c.substr(1)) == -1) | 91| |- || (c[0] != "!" && classes.indexOf(c) != -1))) | | 90|+ if (sublist.every(c => (c[0] == "!" && classes.indexOf(c.substr(1)) == -1) || | | 91|+ (c[0] != "!" && classes.indexOf(c) != -1))) | 92| 92| return true; | 93| 93| } | 94| 94| | | [NORMAL] ESLintBear (indent): | | Expected indentation of 4 tabs but found 5. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/globalscripts/Templates.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/globalscripts/Templates.js | 226| 226| { | 227| 227| let aura = auraTemplates[auraID]; | 228| 228| ret.auras[auraID] = { | 229| |- "name": aura.auraName, | | 229|+ "name": aura.auraName, | 230| 230| "description": aura.auraDescription || null, | 231| 231| "radius": aura.radius || null | 232| 232| }; | | [NORMAL] ESLintBear (indent): | | Expected indentation of 4 tabs but found 5. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/globalscripts/Templates.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/globalscripts/Templates.js | 227| 227| let aura = auraTemplates[auraID]; | 228| 228| ret.auras[auraID] = { | 229| 229| "name": aura.auraName, | 230| |- "description": aura.auraDescription || null, | | 230|+ "description": aura.auraDescription || null, | 231| 231| "radius": aura.radius || null | 232| 232| }; | 233| 233| } | | [NORMAL] ESLintBear (indent): | | Expected indentation of 4 tabs but found 5. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/globalscripts/Templates.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/globalscripts/Templates.js | 228| 228| ret.auras[auraID] = { | 229| 229| "name": aura.auraName, | 230| 230| "description": aura.auraDescription || null, | 231| |- "radius": aura.radius || null | | 231|+ "radius": aura.radius || null | 232| 232| }; | 233| 233| } | 234| 234| } | | [NORMAL] ESLintBear (indent): | | Expected indentation of 3 tabs but found 4. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/globalscripts/Templates.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/globalscripts/Templates.js | 229| 229| "name": aura.auraName, | 230| 230| "description": aura.auraDescription || null, | 231| 231| "radius": aura.radius || null | 232| |- }; | | 232|+ }; | 233| 233| } | 234| 234| } | 235| 235| binaries/data/mods/public/globalscripts/Templates.js | 91| » » ····················||·(c[0]·!=·"!"·&&·classes.indexOf(c)·!=·-1))) | | [NORMAL] JSHintBear: | | Misleading line break before '||'; readers may interpret this as an expression boundary. | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'for-in'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | 10| 10| | 11| 11| var ret = {}; | 12| 12| for (var i in this) | 13| |- { | | 13|+ | 14| 14| if (this.hasOwnProperty(i)) | 15| 15| ret[i] = this[i]; | 16| |- } | | 16|+ | 17| 17| ret.modificationCache = {}; | 18| 18| return ret; | 19| 19| }; | | [NORMAL] ESLintBear (operator-linebreak): | | '||' should be placed at the end of the line. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | 64| 64| for (let key of this.unresearchedAutoResearchTechs) | 65| 65| { | 66| 66| let tech = TechnologyTemplates.Get(key); | 67| |- if ((tech.autoResearch && this.CanResearch(key)) | 68| |- || (tech.top && (this.IsTechnologyResearched(tech.top) || this.IsTechnologyResearched(tech.bottom)))) | | 67|+ if ((tech.autoResearch && this.CanResearch(key)) || | | 68|+ (tech.top && (this.IsTechnologyResearched(tech.top) || this.IsTechnologyResearched(tech.bottom)))) | 69| 69| { | 70| 70| this.unresearchedAutoResearchTechs.delete(key); | 71| 71| this.ResearchTechnology(key); | | [NORMAL] ESLintBear (space-before-function-paren): | | Unexpected space before function parentheses. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | 75| 75| }; | 76| 76| | 77| 77| // Checks an entity template to see if its technology requirements have been met | 78| |-TechnologyManager.prototype.CanProduce = function (templateName) | | 78|+TechnologyManager.prototype.CanProduce = function(templateName) | 79| 79| { | 80| 80| var cmpTempManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_TemplateManager); | 81| 81| var template = cmpTempManager.GetTemplate(templateName); | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | 193| 193| var classes = cmpIdentity.GetClassesList(); | 194| 194| // don't use foundations for the class counts but check if techs apply (e.g. health increase) | 195| 195| if (!Engine.QueryInterface(msg.entity, IID_Foundation)) | 196| |- { | | 196|+ | 197| 197| for (let cls of classes) | 198| 198| { | 199| 199| this.classCounts[cls] = this.classCounts[cls] || 0; | 203| 203| this.typeCountsByClass[cls][template] = this.typeCountsByClass[cls][template] || 0; | 204| 204| this.typeCountsByClass[cls][template] += 1; | 205| 205| } | 206| |- } | | 206|+ | 207| 207| | 208| 208| // Newly created entity, check if any researched techs might apply | 209| 209| // (only do this for new entities because even if an entity is converted or captured, | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | 286| 286| } | 287| 287| | 288| 288| if (template.replaces && template.replaces.length > 0) | 289| |- { | | 289|+ | 290| 290| for (var i of template.replaces) | 291| 291| { | 292| 292| if (!i || this.IsTechnologyResearched(i)) | 304| 304| cmpPlayerEntityLimits.UpdateLimitsFromTech(i); | 305| 305| } | 306| 306| } | 307| |- } | | 307|+ | 308| 308| | 309| 309| this.UpdateAutoResearch(); | 310| 310| | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | 322| 322| cmpPlayerEntityLimits.UpdateLimitsFromTech(tech); | 323| 323| | 324| 324| // always send research finished message | 325| |- Engine.PostMessage(this.entity, MT_ResearchFinished, {"player": playerID, "tech": tech}); | | 325|+ Engine.PostMessage(this.entity, MT_ResearchFinished, { "player": playerID, "tech": tech}); | 326| 326| | 327| 327| for (var component in modifiedComponents) | 328| 328| { | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | 322| 322| cmpPlayerEntityLimits.UpdateLimitsFromTech(tech); | 323| 323| | 324| 324| // always send research finished message | 325| |- Engine.PostMessage(this.entity, MT_ResearchFinished, {"player": playerID, "tech": tech}); | | 325|+ Engine.PostMessage(this.entity, MT_ResearchFinished, {"player": playerID, "tech": tech }); | 326| 326| | 327| 327| for (var component in modifiedComponents) | 328| 328| { | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | 326| 326| | 327| 327| for (var component in modifiedComponents) | 328| 328| { | 329| |- Engine.PostMessage(SYSTEM_ENTITY, MT_TemplateModification, { "player": playerID, "component": component, "valueNames": modifiedComponents[component]}); | | 329|+ Engine.PostMessage(SYSTEM_ENTITY, MT_TemplateModification, { "player": playerID, "component": component, "valueNames": modifiedComponents[component] }); | 330| 330| Engine.BroadcastMessage(MT_ValueModification, { "entities": ents, "component": component, "valueNames": modifiedComponents[component]}); | 331| 331| } | 332| 332| | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | 327| 327| for (var component in modifiedComponents) | 328| 328| { | 329| 329| Engine.PostMessage(SYSTEM_ENTITY, MT_TemplateModification, { "player": playerID, "component": component, "valueNames": modifiedComponents[component]}); | 330| |- Engine.BroadcastMessage(MT_ValueModification, { "entities": ents, "component": component, "valueNames": modifiedComponents[component]}); | | 330|+ Engine.BroadcastMessage(MT_ValueModification, { "entities": ents, "component": component, "valueNames": modifiedComponents[component] }); | 331| 331| } | 332| 332| | 333| 333| if (tech.startsWith("phase") && !template.autoResearch) | | [NORMAL] ESLintBear (semi): | | Missing semicolon. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | 449| 449| */ | 450| 450| TechnologyManager.prototype.GetResearcher = function(tech) | 451| 451| { | 452| |- return this.researchQueued.get(tech) | | 452|+ return this.researchQueued.get(tech); | 453| 453| }; | 454| 454| | 455| 455| /** binaries/data/mods/public/simulation/components/TechnologyManager.js | 150| » » » switch·(type) | | [NORMAL] ESLintBear (default-case): | | Expected a default case. binaries/data/mods/public/simulation/components/TechnologyManager.js | 165| » switch·(entity.check) | | [NORMAL] ESLintBear (default-case): | | Expected a default case. binaries/data/mods/public/simulation/components/TechnologyManager.js | 220| ·» » » » » if·(DoesModificationApply(modif,·classes)) | | [NORMAL] ESLintBear (no-mixed-spaces-and-tabs): | | Mixed spaces and tabs. binaries/data/mods/public/simulation/components/TechnologyManager.js | 68| » » » ||·(tech.top·&&·(this.IsTechnologyResearched(tech.top)·||·this.IsTechnologyResearched(tech.bottom)))) | | [NORMAL] JSHintBear: | | Misleading line break before '||'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/components/TechnologyManager.js | 229| » » » for·(var·component·in·modifiedComponents) | | [NORMAL] JSHintBear: | | 'component' is already defined. binaries/data/mods/public/simulation/components/TechnologyManager.js | 235| » » var·cmpTemplateManager·=·Engine.QueryInterface(SYSTEM_ENTITY,·IID_TemplateManager); | | [NORMAL] JSHintBear: | | 'cmpTemplateManager' is already defined. binaries/data/mods/public/simulation/components/TechnologyManager.js | 236| » » var·template·=·cmpTemplateManager.GetCurrentTemplateName(msg.entity); | | [NORMAL] JSHintBear: | | 'template' is already defined. binaries/data/mods/public/simulation/components/TechnologyManager.js | 241| » » » var·cmpIdentity·=·Engine.QueryInterface(msg.entity,·IID_Identity); | | [NORMAL] JSHintBear: | | 'cmpIdentity' is already defined. binaries/data/mods/public/simulation/components/TechnologyManager.js | 244| » » » » var·classes·=·cmpIdentity.GetClassesList(); | | [NORMAL] JSHintBear: | | 'classes' is already defined. binaries/data/mods/public/simulation/components/TechnologyManager.js | 452| » return·this.researchQueued.get(tech) | | [NORMAL] JSHintBear: | | Missing semicolon. | | [NORMAL] ESLintBear (dot-notation): | | ["Value"] is better written in dot notation. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js | 459| 459| ApplyValueModificationsToEntity("Attack/" + type + splash + "/Damage/" + damageType, +(template.Damage[damageType] || 0), this.entity); | 460| 460| | 461| 461| if (type == "Capture") | 462| |- return { "value": ApplyValueModificationsToEntity("Attack/Capture/Value", +(template["Value"] || 0), this.entity) }; | | 462|+ return { "value": ApplyValueModificationsToEntity("Attack/Capture/Value", +(template.Value || 0), this.entity) }; | 463| 463| | 464| 464| let ret = {}; | 465| 465| for (let damageType of DamageTypes.GetTypes()) | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js | 523| 523| | 524| 524| let horizSpeed = +this.template[type].Projectile.Speed; | 525| 525| let gravity = +this.template[type].Projectile.Gravity; | 526| |- //horizSpeed /= 2; gravity /= 2; // slow it down for testing | | 526|+ // horizSpeed /= 2; gravity /= 2; // slow it down for testing | 527| 527| | 528| 528| let cmpPosition = Engine.QueryInterface(this.entity, IID_Position); | 529| 529| if (!cmpPosition || !cmpPosition.IsInWorld()) | | [NORMAL] ESLintBear (no-trailing-spaces): | | Trailing spaces not allowed. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js | 570| 570| // TODO: Use unit rotation to implement x/z offsets. | 571| 571| let deltaLaunchPoint = new Vector3D(0, this.template[type].Projectile.LaunchPoint["@y"], 0.0); | 572| 572| let launchPoint = Vector3D.add(selfPosition, deltaLaunchPoint); | 573| |- | | 573|+ | 574| 574| let cmpVisual = Engine.QueryInterface(this.entity, IID_Visual); | 575| 575| if (cmpVisual) | 576| 576| { | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'else'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js | 642| 642| }); | 643| 643| } | 644| 644| else | 645| |- { | | 645|+ | 646| 646| // Melee attack - hurt the target immediately | 647| 647| cmpDamage.CauseDamage({ | 648| 648| "strengths": this.GetAttackStrengths(type), | 652| 652| "type": type, | 653| 653| "attackerOwner": attackerOwner | 654| 654| }); | 655| |- } | | 655|+ | 656| 656| }; | 657| 657| | 658| 658| /** binaries/data/mods/public/simulation/components/Attack.js | 513| ·» let·cmpDamage·=·Engine.QueryInterface(SYSTEM_ENTITY,·IID_Damage); | | [NORMAL] ESLintBear (no-mixed-spaces-and-tabs): | | Mixed spaces and tabs. binaries/data/mods/public/simulation/components/Attack.js | 462| » » return·{·"value":·ApplyValueModificationsToEntity("Attack/Capture/Value",·+(template["Value"]·||·0),·this.entity)·}; | | [NORMAL] JSHintBear: | | ['Value'] is better written in dot notation. binaries/data/mods/public/simulation/components/Attack.js | 617| » » cmpTimer.SetTimeout(SYSTEM_ENTITY,·IID_Damage,·"MissileHit",·timeToTarget·*·1000·+·+this.template[type].Delay,·data); | | [NORMAL] JSHintBear: | | Confusing plusses. | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'for-of'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js | 33| 33| { | 34| 34| let args = string.split("/"); | 35| 35| for (let arg of args) | 36| |- { | | 36|+ | 37| 37| if (value[arg]) | 38| 38| value = value[arg]; | 39| 39| else | 41| 41| value = undefined; | 42| 42| break; | 43| 43| } | 44| |- } | | 44|+ | 45| 45| this._tpCache.set(string, value); | 46| 46| } | 47| 47| return this._tpCache.get(string); | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js | 308| 308| return undefined; | 309| 309| | 310| 310| if (this.get("Attack/" + type + "/Bonuses")) | 311| |- { | | 311|+ | 312| 312| for (let b in this.get("Attack/" + type + "/Bonuses")) | 313| 313| { | 314| 314| let bonusClasses = this.get("Attack/" + type + "/Bonuses/" + b + "/Classes"); | 318| 318| if (bcl == againstClass) | 319| 319| return +this.get("Attack/" + type + "/Bonuses/" + b + "/Multiplier"); | 320| 320| } | 321| |- } | | 321|+ | 322| 322| return 1; | 323| 323| }, | 324| 324| binaries/data/mods/public/simulation/ai/common-api/entity.js | 798| » » if·(this.position()·!==·undefined)·{ | | [NORMAL] ESLintBear (brace-rules/brace-on-same-line): | | Opening curly brace appears on the same line as controlling statement. binaries/data/mods/public/simulation/ai/common-api/entity.js | 815| » » if·(this.position()·!==·undefined·&&·unitToFleeFrom.position()·!==·undefined)·{ | | [NORMAL] ESLintBear (brace-rules/brace-on-same-line): | | Opening curly brace appears on the same line as controlling statement. Executing section cli... Link to build: https://jenkins.wildfiregames.com/job/differential/1605/display/redirect Comment Actions Did you use tabs or spaces ?
Comment Actions Yes.
Comment Actions Well, I've told them about it and some were enthousiastic, so perhaps some will join ;) By the way, should the Armour damage types also be in some (the same) kind of container? I guess not because Armour can only have the damage types as options? (But then there is "Foundation".)
Comment Actions
No, I don't think it's necessary; for comparison, <Cost> has a <Resources> node, but <Loot>, <Looter>, and <ProductionQueue/TechCostMultiplier> don't. Comment Actions The reason for that being that Cost only lists resources, same for the others, whereas attack could probably conflict. I think it's fine as is. Comment Actions Probably a good idea, yes. Will accept once that's fixed. As discussed in D1938, this seems like a good idea for unexpected reasons too. Comment Actions True... Though we're talking about different kinds of damage. Perhaps "DamageTypes" ? Bit long perhaps. I guess we can keep Damage maybe. Comment Actions Sorry, no native English speaker ;) 'Damages' is English, but it doesn't mean the thing I thought it would mean :) Comment Actions
As @elexis would say, we don't pray - we check and we test that nothing does ;) Here what I can think of:
@Freagarach Can you update GetTemplateDataHelper to also return template data in a Damage object and then update the GUI? Then I will commit this (possibly commandeer/upload to run the tests/commit as I like to do nowadays if I make some final changes) Comment Actions "ora et labora" I would say ;)
Comment Actions 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 2. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/DamageTypes.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/helpers/DamageTypes.js | 2| 2| { | 3| 3| return "<interleave>" + this.GetTypes().reduce((schema, type) => | 4| 4| schema + "<element name='"+type+"' a:help='"+type+" "+helptext+"'><ref name='nonNegativeDecimal'/></element>", | 5| |- "") + "</interleave>"; | | 5|+ "") + "</interleave>"; | 6| 6| }; | 7| 7| | 8| 8| DamageTypes = new DamageTypes(); | | [NORMAL] ESLintBear (dot-notation): | | ["Value"] is better written in dot notation. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js | 459| 459| ApplyValueModificationsToEntity("Attack/" + type + splash + "/Damage/" + damageType, +(template.Damage[damageType] || 0), this.entity); | 460| 460| | 461| 461| if (type == "Capture") | 462| |- return { "value": ApplyValueModificationsToEntity("Attack/Capture/Value", +(template["Value"] || 0), this.entity) }; | | 462|+ return { "value": ApplyValueModificationsToEntity("Attack/Capture/Value", +(template.Value || 0), this.entity) }; | 463| 463| | 464| 464| let ret = {}; | 465| 465| for (let damageType of DamageTypes.GetTypes()) | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js | 524| 524| | 525| 525| let horizSpeed = +this.template[type].Projectile.Speed; | 526| 526| let gravity = +this.template[type].Projectile.Gravity; | 527| |- //horizSpeed /= 2; gravity /= 2; // slow it down for testing | | 527|+ // horizSpeed /= 2; gravity /= 2; // slow it down for testing | 528| 528| | 529| 529| let cmpPosition = Engine.QueryInterface(this.entity, IID_Position); | 530| 530| if (!cmpPosition || !cmpPosition.IsInWorld()) | | [NORMAL] ESLintBear (no-trailing-spaces): | | Trailing spaces not allowed. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js | 571| 571| // TODO: Use unit rotation to implement x/z offsets. | 572| 572| let deltaLaunchPoint = new Vector3D(0, this.template[type].Projectile.LaunchPoint["@y"], 0.0); | 573| 573| let launchPoint = Vector3D.add(selfPosition, deltaLaunchPoint); | 574| |- | | 574|+ | 575| 575| let cmpVisual = Engine.QueryInterface(this.entity, IID_Visual); | 576| 576| if (cmpVisual) | 577| 577| { | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'else'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js | 643| 643| }); | 644| 644| } | 645| 645| else | 646| |- { | | 646|+ | 647| 647| // Melee attack - hurt the target immediately | 648| 648| cmpDamage.CauseDamage({ | 649| 649| "strengths": this.GetAttackStrengths(type), | 653| 653| "type": type, | 654| 654| "attackerOwner": attackerOwner | 655| 655| }); | 656| |- } | | 656|+ | 657| 657| }; | 658| 658| | 659| 659| /** binaries/data/mods/public/simulation/components/Attack.js | 514| ·» let·cmpDamage·=·Engine.QueryInterface(SYSTEM_ENTITY,·IID_Damage); | | [NORMAL] ESLintBear (no-mixed-spaces-and-tabs): | | Mixed spaces and tabs. binaries/data/mods/public/simulation/components/Attack.js | 462| » » return·{·"value":·ApplyValueModificationsToEntity("Attack/Capture/Value",·+(template["Value"]·||·0),·this.entity)·}; | | [NORMAL] JSHintBear: | | ['Value'] is better written in dot notation. binaries/data/mods/public/simulation/components/Attack.js | 618| » » cmpTimer.SetTimeout(SYSTEM_ENTITY,·IID_Damage,·"MissileHit",·timeToTarget·*·1000·+·+this.template[type].Delay,·data); | | [NORMAL] JSHintBear: | | Confusing plusses. | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | 66| 66| let phase = ""; | 67| 67| let cmpTechnologyManager = QueryPlayerIDInterface(i, IID_TechnologyManager); | 68| 68| if (cmpTechnologyManager) | 69| |- { | | 69|+ | 70| 70| if (cmpTechnologyManager.IsTechnologyResearched("phase_city")) | 71| 71| phase = "city"; | 72| 72| else if (cmpTechnologyManager.IsTechnologyResearched("phase_town")) | 73| 73| phase = "town"; | 74| 74| else if (cmpTechnologyManager.IsTechnologyResearched("phase_village")) | 75| 75| phase = "village"; | 76| |- } | | 76|+ | 77| 77| | 78| 78| // store player ally/neutral/enemy data as arrays | 79| 79| let allies = []; | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | 415| 415| ret.attack[type].elevationBonus = range.elevationBonus; | 416| 416| | 417| 417| if (cmpUnitAI && cmpPosition && cmpPosition.IsInWorld()) | 418| |- { | | 418|+ | 419| 419| // For units, take the range in front of it, no spread. So angle = 0 | 420| 420| ret.attack[type].elevationAdaptedRange = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, 0); | 421| |- } | | 421|+ | 422| 422| else if(cmpPosition && cmpPosition.IsInWorld()) | 423| 423| { | 424| 424| // For buildings, take the average elevation around it. So angle = 2*pi | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | 420| 420| ret.attack[type].elevationAdaptedRange = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, 0); | 421| 421| } | 422| 422| else if(cmpPosition && cmpPosition.IsInWorld()) | 423| |- { | | 423|+ | 424| 424| // For buildings, take the average elevation around it. So angle = 2*pi | 425| 425| ret.attack[type].elevationAdaptedRange = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, 2*Math.PI); | 426| |- } | | 426|+ | 427| 427| else | 428| 428| { | 429| 429| // not in world, set a default? | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'else'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | 425| 425| ret.attack[type].elevationAdaptedRange = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, 2*Math.PI); | 426| 426| } | 427| 427| else | 428| |- { | | 428|+ | 429| 429| // not in world, set a default? | 430| 430| ret.attack[type].elevationAdaptedRange = ret.attack.maxRange; | 431| |- } | | 431|+ | 432| 432| } | 433| 433| } | 434| 434| | | [NORMAL] ESLintBear (indent): | | Expected indentation of 2 tabs but found 3. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | 796| 796| updateEntityColor(data.showAllStatusBars && (i == player || player == -1) ? | 797| 797| [IID_Minimap, IID_RangeOverlayRenderer, IID_RallyPointRenderer, IID_StatusBars] : | 798| 798| [IID_Minimap, IID_RangeOverlayRenderer, IID_RallyPointRenderer], | 799| |- cmpRangeManager.GetEntitiesByPlayer(i)); | | 799|+ cmpRangeManager.GetEntitiesByPlayer(i)); | 800| 800| } | 801| 801| updateEntityColor([IID_Selectable, IID_StatusBars], data.selected); | 802| 802| Engine.QueryInterface(SYSTEM_ENTITY, IID_TerritoryManager).UpdateColors(); | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'else'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js |1315|1315| } |1316|1316| } |1317|1317| else |1318| |- { | |1318|+ |1319|1319| // Didn't snap to an existing entity, add the starting tower manually. To prevent odd-looking rotation jumps |1320|1320| // when shift-clicking to build a wall, reuse the placement angle that was last seen on a validly positioned |1321|1321| // wall piece. |1336|1336| "pos": start.pos, |1337|1337| "angle": previewEntities.length > 0 ? previewEntities[0].angle : this.placementWallLastAngle |1338|1338| }); |1339| |- } | |1339|+ |1340|1340| |1341|1341| if (end.pos) |1342|1342| { | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js |1339|1339| } |1340|1340| |1341|1341| if (end.pos) |1342| |- { | |1342|+ |1343|1343| // Analogous to the starting side case above |1344|1344| if (end.snappedEnt && end.snappedEnt != INVALID_ENTITY) |1345|1345| { |1377|1377| "pos": end.pos, |1378|1378| "angle": previewEntities.length > 0 ? previewEntities[previewEntities.length-1].angle : this.placementWallLastAngle |1379|1379| }); |1380| |- } | |1380|+ |1381|1381| |1382|1382| let cmpTerrain = Engine.QueryInterface(SYSTEM_ENTITY, IID_Terrain); |1383|1383| if (!cmpTerrain) | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js |1555|1555| |1556|1556| let cmpVisual = Engine.QueryInterface(ent, IID_Visual); |1557|1557| if (cmpVisual) |1558| |- { | |1558|+ |1559|1559| if (!allPiecesValid || !canAfford) |1560|1560| cmpVisual.SetShadingColor(1.4, 0.4, 0.4, 1); |1561|1561| else |1562|1562| cmpVisual.SetShadingColor(1, 1, 1, 1); |1563| |- } | |1563|+ |1564|1564| |1565|1565| ++entPool.numUsed; |1566|1566| } | | [NORMAL] ESLintBear (indent): | | Expected indentation of 5 tabs but found 6. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js |1629|1629| { |1630|1630| minDist2 = dist2; |1631|1631| minDistEntitySnapData = { |1632| |- "x": pos.x, | |1632|+ "x": pos.x, |1633|1633| "z": pos.z, |1634|1634| "angle": cmpPosition.GetRotation().y, |1635|1635| "ent": ent | | [NORMAL] ESLintBear (indent): | | Expected indentation of 5 tabs but found 6. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js |1630|1630| minDist2 = dist2; |1631|1631| minDistEntitySnapData = { |1632|1632| "x": pos.x, |1633| |- "z": pos.z, | |1633|+ "z": pos.z, |1634|1634| "angle": cmpPosition.GetRotation().y, |1635|1635| "ent": ent |1636|1636| }; | | [NORMAL] ESLintBear (indent): | | Expected indentation of 5 tabs but found 6. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js |1631|1631| minDistEntitySnapData = { |1632|1632| "x": pos.x, |1633|1633| "z": pos.z, |1634| |- "angle": cmpPosition.GetRotation().y, | |1634|+ "angle": cmpPosition.GetRotation().y, |1635|1635| "ent": ent |1636|1636| }; |1637|1637| } | | [NORMAL] ESLintBear (indent): | | Expected indentation of 5 tabs but found 6. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js |1632|1632| "x": pos.x, |1633|1633| "z": pos.z, |1634|1634| "angle": cmpPosition.GetRotation().y, |1635| |- "ent": ent | |1635|+ "ent": ent |1636|1636| }; |1637|1637| } |1638|1638| } | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js |1777|1777| result.gain = cmpEntityTrader.GetGoods().amount; |1778|1778| } |1779|1779| else if (data.target === secondMarket) |1780| |- { | |1780|+ |1781|1781| result = { |1782|1782| "type": "is second", |1783|1783| "gain": cmpEntityTrader.GetGoods().amount, |1784|1784| }; |1785| |- } | |1785|+ |1786|1786| else if (!firstMarket) |1787|1787| { |1788|1788| result = { "type": "set first" }; | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js |1784|1784| }; |1785|1785| } |1786|1786| else if (!firstMarket) |1787| |- { | |1787|+ |1788|1788| result = { "type": "set first" }; |1789| |- } | |1789|+ |1790|1790| else if (!secondMarket) |1791|1791| { |1792|1792| result = { | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js |1788|1788| result = { "type": "set first" }; |1789|1789| } |1790|1790| else if (!secondMarket) |1791| |- { | |1791|+ |1792|1792| result = { |1793|1793| "type": "set second", |1794|1794| "gain": cmpEntityTrader.CalculateGain(firstMarket, data.target), |1795|1795| }; |1796| |- } | |1796|+ |1797|1797| else |1798|1798| { |1799|1799| // Else both markets are not null and target is different from them | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'else'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js |1795|1795| }; |1796|1796| } |1797|1797| else |1798| |- { | |1798|+ |1799|1799| // Else both markets are not null and target is different from them |1800|1800| result = { "type": "set first" }; |1801| |- } | |1801|+ |1802|1802| return result; |1803|1803| }; |1804|1804| | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'for-in'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | 10| 10| | 11| 11| var ret = {}; | 12| 12| for (var i in this) | 13| |- { | | 13|+ | 14| 14| if (this.hasOwnProperty(i)) | 15| 15| ret[i] = this[i]; | 16| |- } | | 16|+ | 17| 17| ret.modificationCache = {}; | 18| 18| return ret; | 19| 19| }; | | [NORMAL] ESLintBear (operator-linebreak): | | '||' should be placed at the end of the line. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | 64| 64| for (let key of this.unresearchedAutoResearchTechs) | 65| 65| { | 66| 66| let tech = TechnologyTemplates.Get(key); | 67| |- if ((tech.autoResearch && this.CanResearch(key)) | 68| |- || (tech.top && (this.IsTechnologyResearched(tech.top) || this.IsTechnologyResearched(tech.bottom)))) | | 67|+ if ((tech.autoResearch && this.CanResearch(key)) || | | 68|+ (tech.top && (this.IsTechnologyResearched(tech.top) || this.IsTechnologyResearched(tech.bottom)))) | 69| 69| { | 70| 70| this.unresearchedAutoResearchTechs.delete(key); | 71| 71| this.ResearchTechnology(key); | | [NORMAL] ESLintBear (space-before-function-paren): | | Unexpected space before function parentheses. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | 75| 75| }; | 76| 76| | 77| 77| // Checks an entity template to see if its technology requirements have been met | 78| |-TechnologyManager.prototype.CanProduce = function (templateName) | | 78|+TechnologyManager.prototype.CanProduce = function(templateName) | 79| 79| { | 80| 80| var cmpTempManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_TemplateManager); | 81| 81| var template = cmpTempManager.GetTemplate(templateName); | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | 193| 193| var classes = cmpIdentity.GetClassesList(); | 194| 194| // don't use foundations for the class counts but check if techs apply (e.g. health increase) | 195| 195| if (!Engine.QueryInterface(msg.entity, IID_Foundation)) | 196| |- { | | 196|+ | 197| 197| for (let cls of classes) | 198| 198| { | 199| 199| this.classCounts[cls] = this.classCounts[cls] || 0; | 203| 203| this.typeCountsByClass[cls][template] = this.typeCountsByClass[cls][template] || 0; | 204| 204| this.typeCountsByClass[cls][template] += 1; | 205| 205| } | 206| |- } | | 206|+ | 207| 207| | 208| 208| // Newly created entity, check if any researched techs might apply | 209| 209| // (only do this for new entities because even if an entity is converted or captured, | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | 286| 286| } | 287| 287| | 288| 288| if (template.replaces && template.replaces.length > 0) | 289| |- { | | 289|+ | 290| 290| for (var i of template.replaces) | 291| 291| { | 292| 292| if (!i || this.IsTechnologyResearched(i)) | 304| 304| cmpPlayerEntityLimits.UpdateLimitsFromTech(i); | 305| 305| } | 306| 306| } | 307| |- } | | 307|+ | 308| 308| | 309| 309| this.UpdateAutoResearch(); | 310| 310| | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | 322| 322| cmpPlayerEntityLimits.UpdateLimitsFromTech(tech); | 323| 323| | 324| 324| // always send research finished message | 325| |- Engine.PostMessage(this.entity, MT_ResearchFinished, {"player": playerID, "tech": tech}); | | 325|+ Engine.PostMessage(this.entity, MT_ResearchFinished, { "player": playerID, "tech": tech}); | 326| 326| | 327| 327| for (var component in modifiedComponents) | 328| 328| { | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | 322| 322| cmpPlayerEntityLimits.UpdateLimitsFromTech(tech); | 323| 323| | 324| 324| // always send research finished message | 325| |- Engine.PostMessage(this.entity, MT_ResearchFinished, {"player": playerID, "tech": tech}); | | 325|+ Engine.PostMessage(this.entity, MT_ResearchFinished, {"player": playerID, "tech": tech }); | 326| 326| | 327| 327| for (var component in modifiedComponents) | 328| 328| { | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | 326| 326| | 327| 327| for (var component in modifiedComponents) | 328| 328| { | 329| |- Engine.PostMessage(SYSTEM_ENTITY, MT_TemplateModification, { "player": playerID, "component": component, "valueNames": modifiedComponents[component]}); | | 329|+ Engine.PostMessage(SYSTEM_ENTITY, MT_TemplateModification, { "player": playerID, "component": component, "valueNames": modifiedComponents[component] }); | 330| 330| Engine.BroadcastMessage(MT_ValueModification, { "entities": ents, "component": component, "valueNames": modifiedComponents[component]}); | 331| 331| } | 332| 332| | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | 327| 327| for (var component in modifiedComponents) | 328| 328| { | 329| 329| Engine.PostMessage(SYSTEM_ENTITY, MT_TemplateModification, { "player": playerID, "component": component, "valueNames": modifiedComponents[component]}); | 330| |- Engine.BroadcastMessage(MT_ValueModification, { "entities": ents, "component": component, "valueNames": modifiedComponents[component]}); | | 330|+ Engine.BroadcastMessage(MT_ValueModification, { "entities": ents, "component": component, "valueNames": modifiedComponents[component] }); | 331| 331| } | 332| 332| | 333| 333| if (tech.startsWith("phase") && !template.autoResearch) | | [NORMAL] ESLintBear (semi): | | Missing semicolon. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | 449| 449| */ | 450| 450| TechnologyManager.prototype.GetResearcher = function(tech) | 451| 451| { | 452| |- return this.researchQueued.get(tech) | | 452|+ return this.researchQueued.get(tech); | 453| 453| }; | 454| 454| | 455| 455| /** binaries/data/mods/public/simulation/components/TechnologyManager.js | 150| » » » switch·(type) | | [NORMAL] ESLintBear (default-case): | | Expected a default case. binaries/data/mods/public/simulation/components/TechnologyManager.js | 165| » switch·(entity.check) | | [NORMAL] ESLintBear (default-case): | | Expected a default case. binaries/data/mods/public/simulation/components/TechnologyManager.js | 220| ·» » » » » if·(DoesModificationApply(modif,·classes)) | | [NORMAL] ESLintBear (no-mixed-spaces-and-tabs): | | Mixed spaces and tabs. binaries/data/mods/public/simulation/components/TechnologyManager.js | 68| » » » ||·(tech.top·&&·(this.IsTechnologyResearched(tech.top)·||·this.IsTechnologyResearched(tech.bottom)))) | | [NORMAL] JSHintBear: | | Misleading line break before '||'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/components/TechnologyManager.js | 229| » » » for·(var·component·in·modifiedComponents) | | [NORMAL] JSHintBear: | | 'component' is already defined. binaries/data/mods/public/simulation/components/TechnologyManager.js | 235| » » var·cmpTemplateManager·=·Engine.QueryInterface(SYSTEM_ENTITY,·IID_TemplateManager); | | [NORMAL] JSHintBear: | | 'cmpTemplateManager' is already defined. binaries/data/mods/public/simulation/components/TechnologyManager.js | 236| » » var·template·=·cmpTemplateManager.GetCurrentTemplateName(msg.entity); | | [NORMAL] JSHintBear: | | 'template' is already defined. binaries/data/mods/public/simulation/components/TechnologyManager.js | 241| » » » var·cmpIdentity·=·Engine.QueryInterface(msg.entity,·IID_Identity); | | [NORMAL] JSHintBear: | | 'cmpIdentity' is already defined. binaries/data/mods/public/simulation/components/TechnologyManager.js | 244| » » » » var·classes·=·cmpIdentity.GetClassesList(); | | [NORMAL] JSHintBear: | | 'classes' is already defined. binaries/data/mods/public/simulation/components/TechnologyManager.js | 452| » return·this.researchQueued.get(tech) | | [NORMAL] JSHintBear: | | Missing semicolon. | | [NORMAL] ESLintBear (operator-linebreak): | | '||' should be placed at the end of the line. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/globalscripts/Templates.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/globalscripts/Templates.js | 87| 87| // If the elements are still strings, split them by space or by '+' | 88| 88| if (typeof sublist == "string") | 89| 89| sublist = sublist.split(/[+\s]+/); | 90| |- if (sublist.every(c => (c[0] == "!" && classes.indexOf(c.substr(1)) == -1) | 91| |- || (c[0] != "!" && classes.indexOf(c) != -1))) | | 90|+ if (sublist.every(c => (c[0] == "!" && classes.indexOf(c.substr(1)) == -1) || | | 91|+ (c[0] != "!" && classes.indexOf(c) != -1))) | 92| 92| return true; | 93| 93| } | 94| 94| | | [NORMAL] ESLintBear (indent): | | Expected indentation of 4 tabs but found 5. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/globalscripts/Templates.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/globalscripts/Templates.js | 229| 229| { | 230| 230| let aura = auraTemplates[auraID]; | 231| 231| ret.auras[auraID] = { | 232| |- "name": aura.auraName, | | 232|+ "name": aura.auraName, | 233| 233| "description": aura.auraDescription || null, | 234| 234| "radius": aura.radius || null | 235| 235| }; | | [NORMAL] ESLintBear (indent): | | Expected indentation of 4 tabs but found 5. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/globalscripts/Templates.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/globalscripts/Templates.js | 230| 230| let aura = auraTemplates[auraID]; | 231| 231| ret.auras[auraID] = { | 232| 232| "name": aura.auraName, | 233| |- "description": aura.auraDescription || null, | | 233|+ "description": aura.auraDescription || null, | 234| 234| "radius": aura.radius || null | 235| 235| }; | 236| 236| } | | [NORMAL] ESLintBear (indent): | | Expected indentation of 4 tabs but found 5. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/globalscripts/Templates.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/globalscripts/Templates.js | 231| 231| ret.auras[auraID] = { | 232| 232| "name": aura.auraName, | 233| 233| "description": aura.auraDescription || null, | 234| |- "radius": aura.radius || null | | 234|+ "radius": aura.radius || null | 235| 235| }; | 236| 236| } | 237| 237| } | | [NORMAL] ESLintBear (indent): | | Expected indentation of 3 tabs but found 4. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/globalscripts/Templates.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/globalscripts/Templates.js | 232| 232| "name": aura.auraName, | 233| 233| "description": aura.auraDescription || null, | 234| 234| "radius": aura.radius || null | 235| |- }; | | 235|+ }; | 236| 236| } | 237| 237| } | 238| 238| binaries/data/mods/public/globalscripts/Templates.js | 91| » » ····················||·(c[0]·!=·"!"·&&·classes.indexOf(c)·!=·-1))) | | [NORMAL] JSHintBear: | | Misleading line break before '||'; readers may interpret this as an expression boundary. | | [NORMAL] ESLintBear (key-spacing): | | Extra space after key 'Melee'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js | 43| 43| }); | 44| 44| | 45| 45| let cmpAttack = ConstructComponent(attacker, "Attack", { | 46| |- "Melee" : { | | 46|+ "Melee": { | 47| 47| "Damage": { | 48| 48| "Hack": 11, | 49| 49| "Pierce": 5, | | [NORMAL] ESLintBear (key-spacing): | | Extra space after key 'Ranged'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js | 65| 65| } | 66| 66| } | 67| 67| }, | 68| |- "Ranged" : { | | 68|+ "Ranged": { | 69| 69| "Damage": { | 70| 70| "Hack": 0, | 71| 71| "Pierce": 10, | | [NORMAL] ESLintBear (key-spacing): | | Extra space after key 'Splash'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js | 86| 86| "RestrictedClasses": { | 87| 87| "_string": "Elephant" | 88| 88| }, | 89| |- "Splash" : { | | 89|+ "Splash": { | 90| 90| "Shape": "Circular", | 91| 91| "Range": 10, | 92| 92| "FriendlyFire": "false", | | [NORMAL] ESLintBear (key-spacing): | | Extra space after key 'Capture'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js | 103| 103| } | 104| 104| } | 105| 105| }, | 106| |- "Capture" : { | | 106|+ "Capture": { | 107| 107| "Value": 8, | 108| 108| "MaxRange": 10, | 109| 109| }, | | [NORMAL] ESLintBear (comma-spacing): | | There should be no space before ','. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js | 134| 134| } | 135| 135| | 136| 136| // Validate template getter functions | 137| |-attackComponentTest(undefined, true ,(attacker, cmpAttack, defender) => { | | 137|+attackComponentTest(undefined, true,(attacker, cmpAttack, defender) => { | 138| 138| | 139| 139| TS_ASSERT_UNEVAL_EQUALS(cmpAttack.GetAttackTypes(), ["Melee", "Ranged", "Capture"]); | 140| 140| TS_ASSERT_UNEVAL_EQUALS(cmpAttack.GetAttackTypes([]), ["Melee", "Ranged", "Capture"]); | | [NORMAL] ESLintBear (comma-spacing): | | A space is required after ','. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js | 134| 134| } | 135| 135| | 136| 136| // Validate template getter functions | 137| |-attackComponentTest(undefined, true ,(attacker, cmpAttack, defender) => { | | 137|+attackComponentTest(undefined, true , (attacker, cmpAttack, defender) => { | 138| 138| | 139| 139| TS_ASSERT_UNEVAL_EQUALS(cmpAttack.GetAttackTypes(), ["Melee", "Ranged", "Capture"]); | 140| 140| TS_ASSERT_UNEVAL_EQUALS(cmpAttack.GetAttackTypes([]), ["Melee", "Ranged", "Capture"]); | | [NORMAL] ESLintBear (no-trailing-spaces): | | Trailing spaces not allowed. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/tests/test_Attack.js | 157| 157| "Pierce": 10, | 158| 158| "Crush": 0 | 159| 159| }); | 160| |- | | 160|+ | 161| 161| TS_ASSERT_UNEVAL_EQUALS(cmpAttack.GetAttackStrengths("Ranged.Splash"), { | 162| 162| "Hack": 0.0, | 163| 163| "Pierce": 15.0, | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'for-of'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js | 33| 33| { | 34| 34| let args = string.split("/"); | 35| 35| for (let arg of args) | 36| |- { | | 36|+ | 37| 37| if (value[arg]) | 38| 38| value = value[arg]; | 39| 39| else | 41| 41| value = undefined; | 42| 42| break; | 43| 43| } | 44| |- } | | 44|+ | 45| 45| this._tpCache.set(string, value); | 46| 46| } | 47| 47| return this._tpCache.get(string); | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js | 308| 308| return undefined; | 309| 309| | 310| 310| if (this.get("Attack/" + type + "/Bonuses")) | 311| |- { | | 311|+ | 312| 312| for (let b in this.get("Attack/" + type + "/Bonuses")) | 313| 313| { | 314| 314| let bonusClasses = this.get("Attack/" + type + "/Bonuses/" + b + "/Classes"); | 318| 318| if (bcl == againstClass) | 319| 319| return +this.get("Attack/" + type + "/Bonuses/" + b + "/Multiplier"); | 320| 320| } | 321| |- } | | 321|+ | 322| 322| return 1; | 323| 323| }, | 324| 324| binaries/data/mods/public/simulation/ai/common-api/entity.js | 798| » » if·(this.position()·!==·undefined)·{ | | [NORMAL] ESLintBear (brace-rules/brace-on-same-line): | | Opening curly brace appears on the same line as controlling statement. binaries/data/mods/public/simulation/ai/common-api/entity.js | 815| » » if·(this.position()·!==·undefined·&&·unitToFleeFrom.position()·!==·undefined)·{ | | [NORMAL] ESLintBear (brace-rules/brace-on-same-line): | | Opening curly brace appears on the same line as controlling statement. | | [NORMAL] ESLintBear (indent): | | Expected indentation of 2 tabs but found 3. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js | 392| 392| function getRepairTimeTooltip(entState) | 393| 393| { | 394| 394| return sprintf(translate("%(label)s %(details)s"), { | 395| |- "label": headerFont(translate("Number of repairers:")), | | 395|+ "label": headerFont(translate("Number of repairers:")), | 396| 396| "details": entState.repairable.numBuilders | 397| 397| }) + "\n" + (entState.repairable.numBuilders ? | 398| 398| sprintf(translatePlural( | | [NORMAL] ESLintBear (indent): | | Expected indentation of 2 tabs but found 3. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js | 393| 393| { | 394| 394| return sprintf(translate("%(label)s %(details)s"), { | 395| 395| "label": headerFont(translate("Number of repairers:")), | 396| |- "details": entState.repairable.numBuilders | | 396|+ "details": entState.repairable.numBuilders | 397| 397| }) + "\n" + (entState.repairable.numBuilders ? | 398| 398| sprintf(translatePlural( | 399| 399| "Add another worker to speed up the repairs by %(second)s second.", | | [NORMAL] ESLintBear (indent): | | Expected indentation of 1 tab but found 2. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js | 394| 394| return sprintf(translate("%(label)s %(details)s"), { | 395| 395| "label": headerFont(translate("Number of repairers:")), | 396| 396| "details": entState.repairable.numBuilders | 397| |- }) + "\n" + (entState.repairable.numBuilders ? | | 397|+ }) + "\n" + (entState.repairable.numBuilders ? | 398| 398| sprintf(translatePlural( | 399| 399| "Add another worker to speed up the repairs by %(second)s second.", | 400| 400| "Add another worker to speed up the repairs by %(second)s seconds.", | | [NORMAL] ESLintBear (indent): | | Expected indentation of 2 tabs but found 3. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js | 414| 414| function getBuildTimeTooltip(entState) | 415| 415| { | 416| 416| return sprintf(translate("%(label)s %(details)s"), { | 417| |- "label": headerFont(translate("Number of builders:")), | | 417|+ "label": headerFont(translate("Number of builders:")), | 418| 418| "details": entState.foundation.numBuilders | 419| 419| }) + "\n" + (entState.foundation.numBuilders ? | 420| 420| sprintf(translatePlural( | | [NORMAL] ESLintBear (indent): | | Expected indentation of 2 tabs but found 3. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js | 415| 415| { | 416| 416| return sprintf(translate("%(label)s %(details)s"), { | 417| 417| "label": headerFont(translate("Number of builders:")), | 418| |- "details": entState.foundation.numBuilders | | 418|+ "details": entState.foundation.numBuilders | 419| 419| }) + "\n" + (entState.foundation.numBuilders ? | 420| 420| sprintf(translatePlural( | 421| 421| "Add another worker to speed up the construction by %(second)s second.", | | [NORMAL] ESLintBear (indent): | | Expected indentation of 1 tab but found 2. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js | 416| 416| return sprintf(translate("%(label)s %(details)s"), { | 417| 417| "label": headerFont(translate("Number of builders:")), | 418| 418| "details": entState.foundation.numBuilders | 419| |- }) + "\n" + (entState.foundation.numBuilders ? | | 419|+ }) + "\n" + (entState.foundation.numBuilders ? | 420| 420| sprintf(translatePlural( | 421| 421| "Add another worker to speed up the construction by %(second)s second.", | 422| 422| "Add another worker to speed up the construction by %(second)s seconds.", Executing section cli... Link to build: https://jenkins.wildfiregames.com/job/differential/1744/display/redirect Comment Actions Build failure - The Moirai have given mortals hearts that can endure. Linter detected issues: Executing section Source... Executing section JS... | | [NORMAL] ESLintBear (indent): | | Expected indentation of 2 tabs but found 3. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js | 392| 392| function getRepairTimeTooltip(entState) | 393| 393| { | 394| 394| return sprintf(translate("%(label)s %(details)s"), { | 395| |- "label": headerFont(translate("Number of repairers:")), | | 395|+ "label": headerFont(translate("Number of repairers:")), | 396| 396| "details": entState.repairable.numBuilders | 397| 397| }) + "\n" + (entState.repairable.numBuilders ? | 398| 398| sprintf(translatePlural( | | [NORMAL] ESLintBear (indent): | | Expected indentation of 2 tabs but found 3. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js | 393| 393| { | 394| 394| return sprintf(translate("%(label)s %(details)s"), { | 395| 395| "label": headerFont(translate("Number of repairers:")), | 396| |- "details": entState.repairable.numBuilders | | 396|+ "details": entState.repairable.numBuilders | 397| 397| }) + "\n" + (entState.repairable.numBuilders ? | 398| 398| sprintf(translatePlural( | 399| 399| "Add another worker to speed up the repairs by %(second)s second.", | | [NORMAL] ESLintBear (indent): | | Expected indentation of 1 tab but found 2. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js | 394| 394| return sprintf(translate("%(label)s %(details)s"), { | 395| 395| "label": headerFont(translate("Number of repairers:")), | 396| 396| "details": entState.repairable.numBuilders | 397| |- }) + "\n" + (entState.repairable.numBuilders ? | | 397|+ }) + "\n" + (entState.repairable.numBuilders ? | 398| 398| sprintf(translatePlural( | 399| 399| "Add another worker to speed up the repairs by %(second)s second.", | 400| 400| "Add another worker to speed up the repairs by %(second)s seconds.", | | [NORMAL] ESLintBear (indent): | | Expected indentation of 2 tabs but found 3. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js | 414| 414| function getBuildTimeTooltip(entState) | 415| 415| { | 416| 416| return sprintf(translate("%(label)s %(details)s"), { | 417| |- "label": headerFont(translate("Number of builders:")), | | 417|+ "label": headerFont(translate("Number of builders:")), | 418| 418| "details": entState.foundation.numBuilders | 419| 419| }) + "\n" + (entState.foundation.numBuilders ? | 420| 420| sprintf(translatePlural( | | [NORMAL] ESLintBear (indent): | | Expected indentation of 2 tabs but found 3. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js | 415| 415| { | 416| 416| return sprintf(translate("%(label)s %(details)s"), { | 417| 417| "label": headerFont(translate("Number of builders:")), | 418| |- "details": entState.foundation.numBuilders | | 418|+ "details": entState.foundation.numBuilders | 419| 419| }) + "\n" + (entState.foundation.numBuilders ? | 420| 420| sprintf(translatePlural( | 421| 421| "Add another worker to speed up the construction by %(second)s second.", | | [NORMAL] ESLintBear (indent): | | Expected indentation of 1 tab but found 2. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js | 416| 416| return sprintf(translate("%(label)s %(details)s"), { | 417| 417| "label": headerFont(translate("Number of builders:")), | 418| 418| "details": entState.foundation.numBuilders | 419| |- }) + "\n" + (entState.foundation.numBuilders ? | | 419|+ }) + "\n" + (entState.foundation.numBuilders ? | 420| 420| sprintf(translatePlural( | 421| 421| "Add another worker to speed up the construction by %(second)s second.", | 422| 422| "Add another worker to speed up the construction by %(second)s seconds.", | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'for-of'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js | 33| 33| { | 34| 34| let args = string.split("/"); | 35| 35| for (let arg of args) | 36| |- { | | 36|+ | 37| 37| if (value[arg]) | 38| 38| value = value[arg]; | 39| 39| else | 41| 41| value = undefined; | 42| 42| break; | 43| 43| } | 44| |- } | | 44|+ | 45| 45| this._tpCache.set(string, value); | 46| 46| } | 47| 47| return this._tpCache.get(string); | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js | 308| 308| return undefined; | 309| 309| | 310| 310| if (this.get("Attack/" + type + "/Bonuses")) | 311| |- { | | 311|+ | 312| 312| for (let b in this.get("Attack/" + type + "/Bonuses")) | 313| 313| { | 314| 314| let bonusClasses = this.get("Attack/" + type + "/Bonuses/" + b + "/Classes"); | 318| 318| if (bcl == againstClass) | 319| 319| return +this.get("Attack/" + type + "/Bonuses/" + b + "/Multiplier"); | 320| 320| } | 321| |- } | | 321|+ | 322| 322| return 1; | 323| 323| }, | 324| 324| binaries/data/mods/public/simulation/ai/common-api/entity.js | 798| » » if·(this.position()·!==·undefined)·{ | | [NORMAL] ESLintBear (brace-rules/brace-on-same-line): | | Opening curly brace appears on the same line as controlling statement. binaries/data/mods/public/simulation/ai/common-api/entity.js | 815| » » if·(this.position()·!==·undefined·&&·unitToFleeFrom.position()·!==·undefined)·{ | | [NORMAL] ESLintBear (brace-rules/brace-on-same-line): | | Opening curly brace appears on the same line as controlling statement. | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | 66| 66| let phase = ""; | 67| 67| let cmpTechnologyManager = QueryPlayerIDInterface(i, IID_TechnologyManager); | 68| 68| if (cmpTechnologyManager) | 69| |- { | | 69|+ | 70| 70| if (cmpTechnologyManager.IsTechnologyResearched("phase_city")) | 71| 71| phase = "city"; | 72| 72| else if (cmpTechnologyManager.IsTechnologyResearched("phase_town")) | 73| 73| phase = "town"; | 74| 74| else if (cmpTechnologyManager.IsTechnologyResearched("phase_village")) | 75| 75| phase = "village"; | 76| |- } | | 76|+ | 77| 77| | 78| 78| // store player ally/neutral/enemy data as arrays | 79| 79| let allies = []; | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | 415| 415| ret.attack[type].elevationBonus = range.elevationBonus; | 416| 416| | 417| 417| if (cmpUnitAI && cmpPosition && cmpPosition.IsInWorld()) | 418| |- { | | 418|+ | 419| 419| // For units, take the range in front of it, no spread. So angle = 0 | 420| 420| ret.attack[type].elevationAdaptedRange = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, 0); | 421| |- } | | 421|+ | 422| 422| else if(cmpPosition && cmpPosition.IsInWorld()) | 423| 423| { | 424| 424| // For buildings, take the average elevation around it. So angle = 2*pi | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | 420| 420| ret.attack[type].elevationAdaptedRange = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, 0); | 421| 421| } | 422| 422| else if(cmpPosition && cmpPosition.IsInWorld()) | 423| |- { | | 423|+ | 424| 424| // For buildings, take the average elevation around it. So angle = 2*pi | 425| 425| ret.attack[type].elevationAdaptedRange = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, 2*Math.PI); | 426| |- } | | 426|+ | 427| 427| else | 428| 428| { | 429| 429| // not in world, set a default? | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'else'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | 425| 425| ret.attack[type].elevationAdaptedRange = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, 2*Math.PI); | 426| 426| } | 427| 427| else | 428| |- { | | 428|+ | 429| 429| // not in world, set a default? | 430| 430| ret.attack[type].elevationAdaptedRange = ret.attack.maxRange; | 431| |- } | | 431|+ | 432| 432| } | 433| 433| } | 434| 434| | | [NORMAL] ESLintBear (indent): | | Expected indentation of 2 tabs but found 3. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | 796| 796| updateEntityColor(data.showAllStatusBars && (i == player || player == -1) ? | 797| 797| [IID_Minimap, IID_RangeOverlayRenderer, IID_RallyPointRenderer, IID_StatusBars] : | 798| 798| [IID_Minimap, IID_RangeOverlayRenderer, IID_RallyPointRenderer], | 799| |- cmpRangeManager.GetEntitiesByPlayer(i)); | | 799|+ cmpRangeManager.GetEntitiesByPlayer(i)); | 800| 800| } | 801| 801| updateEntityColor([IID_Selectable, IID_StatusBars], data.selected); | 802| 802| Engine.QueryInterface(SYSTEM_ENTITY, IID_TerritoryManager).UpdateColors(); | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'else'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js |1315|1315| } |1316|1316| } |1317|1317| else |1318| |- { | |1318|+ |1319|1319| // Didn't snap to an existing entity, add the starting tower manually. To prevent odd-looking rotation jumps |1320|1320| // when shift-clicking to build a wall, reuse the placement angle that was last seen on a validly positioned |1321|1321| // wall piece. |1336|1336| "pos": start.pos, |1337|1337| "angle": previewEntities.length > 0 ? previewEntities[0].angle : this.placementWallLastAngle |1338|1338| }); |1339| |- } | |1339|+ |1340|1340| |1341|1341| if (end.pos) |1342|1342| { | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js |1339|1339| } |1340|1340| |1341|1341| if (end.pos) |1342| |- { | |1342|+ |1343|1343| // Analogous to the starting side case above |1344|1344| if (end.snappedEnt && end.snappedEnt != INVALID_ENTITY) |1345|1345| { |1377|1377| "pos": end.pos, |1378|1378| "angle": previewEntities.length > 0 ? previewEntities[previewEntities.length-1].angle : this.placementWallLastAngle |1379|1379| }); |1380| |- } | |1380|+ |1381|1381| |1382|1382| let cmpTerrain = Engine.QueryInterface(SYSTEM_ENTITY, IID_Terrain); |1383|1383| if (!cmpTerrain) | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js |1555|1555| |1556|1556| let cmpVisual = Engine.QueryInterface(ent, IID_Visual); |1557|1557| if (cmpVisual) |1558| |- { | |1558|+ |1559|1559| if (!allPiecesValid || !canAfford) |1560|1560| cmpVisual.SetShadingColor(1.4, 0.4, 0.4, 1); |1561|1561| else |1562|1562| cmpVisual.SetShadingColor(1, 1, 1, 1); |1563| |- } | |1563|+ |1564|1564| |1565|1565| ++entPool.numUsed; |1566|1566| } | | [NORMAL] ESLintBear (indent): | | Expected indentation of 5 tabs but found 6. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js |1629|1629| { |1630|1630| minDist2 = dist2; |1631|1631| minDistEntitySnapData = { |1632| |- "x": pos.x, | |1632|+ "x": pos.x, |1633|1633| "z": pos.z, |1634|1634| "angle": cmpPosition.GetRotation().y, |1635|1635| "ent": ent | | [NORMAL] ESLintBear (indent): | | Expected indentation of 5 tabs but found 6. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js |1630|1630| minDist2 = dist2; |1631|1631| minDistEntitySnapData = { |1632|1632| "x": pos.x, |1633| |- "z": pos.z, | |1633|+ "z": pos.z, |1634|1634| "angle": cmpPosition.GetRotation().y, |1635|1635| "ent": ent |1636|1636| }; | | [NORMAL] ESLintBear (indent): | | Expected indentation of 5 tabs but found 6. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js |1631|1631| minDistEntitySnapData = { |1632|1632| "x": pos.x, |1633|1633| "z": pos.z, |1634| |- "angle": cmpPosition.GetRotation().y, | |1634|+ "angle": cmpPosition.GetRotation().y, |1635|1635| "ent": ent |1636|1636| }; |1637|1637| } | | [NORMAL] ESLintBear (indent): | | Expected indentation of 5 tabs but found 6. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js |1632|1632| "x": pos.x, |1633|1633| "z": pos.z, |1634|1634| "angle": cmpPosition.GetRotation().y, |1635| |- "ent": ent | |1635|+ "ent": ent |1636|1636| }; |1637|1637| } |1638|1638| } | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js |1777|1777| result.gain = cmpEntityTrader.GetGoods().amount; |1778|1778| } |1779|1779| else if (data.target === secondMarket) |1780| |- { | |1780|+ |1781|1781| result = { |1782|1782| "type": "is second", |1783|1783| "gain": cmpEntityTrader.GetGoods().amount, |1784|1784| }; |1785| |- } | |1785|+ |1786|1786| else if (!firstMarket) |1787|1787| { |1788|1788| result = { "type": "set first" }; | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js |1784|1784| }; |1785|1785| } |1786|1786| else if (!firstMarket) |1787| |- { | |1787|+ |1788|1788| result = { "type": "set first" }; |1789| |- } | |1789|+ |1790|1790| else if (!secondMarket) |1791|1791| { |1792|1792| result = { | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js |1788|1788| result = { "type": "set first" }; |1789|1789| } |1790|1790| else if (!secondMarket) |1791| |- { | |1791|+ |1792|1792| result = { |1793|1793| "type": "set second", |1794|1794| "gain": cmpEntityTrader.CalculateGain(firstMarket, data.target), |1795|1795| }; |1796| |- } | |1796|+ |1797|1797| else |1798|1798| { |1799|1799| // Else both markets are not null and target is different from them | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'else'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js |1795|1795| }; |1796|1796| } |1797|1797| else |1798| |- { | |1798|+ |1799|1799| // Else both markets are not null and target is different from them |1800|1800| result = { "type": "set first" }; |1801| |- } | |1801|+ |1802|1802| return result; |1803|1803| }; |1804|1804| | | [NORMAL] ESLintBear (operator-linebreak): | | '||' should be placed at the end of the line. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/globalscripts/Templates.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/globalscripts/Templates.js | 87| 87| // If the elements are still strings, split them by space or by '+' | 88| 88| if (typeof sublist == "string") | 89| 89| sublist = sublist.split(/[+\s]+/); | 90| |- if (sublist.every(c => (c[0] == "!" && classes.indexOf(c.substr(1)) == -1) | 91| |- || (c[0] != "!" && classes.indexOf(c) != -1))) | | 90|+ if (sublist.every(c => (c[0] == "!" && classes.indexOf(c.substr(1)) == -1) || | | 91|+ (c[0] != "!" && classes.indexOf(c) != -1))) | 92| 92| return true; | 93| 93| } | 94| 94| binaries/data/mods/public/globalscripts/Templates.js | 91| » » ····················||·(c[0]·!=·"!"·&&·classes.indexOf(c)·!=·-1))) | | [NORMAL] JSHintBear: | | Misleading line break before '||'; readers may interpret this as an expression boundary. | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js | 524| 524| | 525| 525| let horizSpeed = +this.template[type].Projectile.Speed; | 526| 526| let gravity = +this.template[type].Projectile.Gravity; | 527| |- //horizSpeed /= 2; gravity /= 2; // slow it down for testing | | 527|+ // horizSpeed /= 2; gravity /= 2; // slow it down for testing | 528| 528| | 529| 529| let cmpPosition = Engine.QueryInterface(this.entity, IID_Position); | 530| 530| if (!cmpPosition || !cmpPosition.IsInWorld()) | | [NORMAL] ESLintBear (no-trailing-spaces): | | Trailing spaces not allowed. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js | 571| 571| // TODO: Use unit rotation to implement x/z offsets. | 572| 572| let deltaLaunchPoint = new Vector3D(0, this.template[type].Projectile.LaunchPoint["@y"], 0.0); | 573| 573| let launchPoint = Vector3D.add(selfPosition, deltaLaunchPoint); | 574| |- | | 574|+ | 575| 575| let cmpVisual = Engine.QueryInterface(this.entity, IID_Visual); | 576| 576| if (cmpVisual) | 577| 577| { | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'else'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js | 643| 643| }); | 644| 644| } | 645| 645| else | 646| |- { | | 646|+ | 647| 647| // Melee attack - hurt the target immediately | 648| 648| cmpDamage.CauseDamage({ | 649| 649| "strengths": this.GetAttackStrengths(type), | 653| 653| "type": type, | 654| 654| "attackerOwner": attackerOwner | 655| 655| }); | 656| |- } | | 656|+ | 657| 657| }; | 658| 658| | 659| 659| /** binaries/data/mods/public/simulation/components/Attack.js | 514| ·» let·cmpDamage·=·Engine.QueryInterface(SYSTEM_ENTITY,·IID_Damage); | | [NORMAL] ESLintBear (no-mixed-spaces-and-tabs): | | Mixed spaces and tabs. binaries/data/mods/public/simulation/components/Attack.js | 618| » » cmpTimer.SetTimeout(SYSTEM_ENTITY,·IID_Damage,·"MissileHit",·timeToTarget·*·1000·+·+this.template[type].Delay,·data); | | [NORMAL] JSHintBear: | | Confusing plusses. | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'for-in'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | 10| 10| | 11| 11| var ret = {}; | 12| 12| for (var i in this) | 13| |- { | | 13|+ | 14| 14| if (this.hasOwnProperty(i)) | 15| 15| ret[i] = this[i]; | 16| |- } | | 16|+ | 17| 17| ret.modificationCache = {}; | 18| 18| return ret; | 19| 19| }; | | [NORMAL] ESLintBear (operator-linebreak): | | '||' should be placed at the end of the line. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | 64| 64| for (let key of this.unresearchedAutoResearchTechs) | 65| 65| { | 66| 66| let tech = TechnologyTemplates.Get(key); | 67| |- if ((tech.autoResearch && this.CanResearch(key)) | 68| |- || (tech.top && (this.IsTechnologyResearched(tech.top) || this.IsTechnologyResearched(tech.bottom)))) | | 67|+ if ((tech.autoResearch && this.CanResearch(key)) || | | 68|+ (tech.top && (this.IsTechnologyResearched(tech.top) || this.IsTechnologyResearched(tech.bottom)))) | 69| 69| { | 70| 70| this.unresearchedAutoResearchTechs.delete(key); | 71| 71| this.ResearchTechnology(key); | | [NORMAL] ESLintBear (space-before-function-paren): | | Unexpected space before function parentheses. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | 75| 75| }; | 76| 76| | 77| 77| // Checks an entity template to see if its technology requirements have been met | 78| |-TechnologyManager.prototype.CanProduce = function (templateName) | | 78|+TechnologyManager.prototype.CanProduce = function(templateName) | 79| 79| { | 80| 80| var cmpTempManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_TemplateManager); | 81| 81| var template = cmpTempManager.GetTemplate(templateName); | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | 193| 193| var classes = cmpIdentity.GetClassesList(); | 194| 194| // don't use foundations for the class counts but check if techs apply (e.g. health increase) | 195| 195| if (!Engine.QueryInterface(msg.entity, IID_Foundation)) | 196| |- { | | 196|+ | 197| 197| for (let cls of classes) | 198| 198| { | 199| 199| this.classCounts[cls] = this.classCounts[cls] || 0; | 203| 203| this.typeCountsByClass[cls][template] = this.typeCountsByClass[cls][template] || 0; | 204| 204| this.typeCountsByClass[cls][template] += 1; | 205| 205| } | 206| |- } | | 206|+ | 207| 207| | 208| 208| // Newly created entity, check if any researched techs might apply | 209| 209| // (only do this for new entities because even if an entity is converted or captured, | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | 286| 286| } | 287| 287| | 288| 288| if (template.replaces && template.replaces.length > 0) | 289| |- { | | 289|+ | 290| 290| for (var i of template.replaces) | 291| 291| { | 292| 292| if (!i || this.IsTechnologyResearched(i)) | 304| 304| cmpPlayerEntityLimits.UpdateLimitsFromTech(i); | 305| 305| } | 306| 306| } | 307| |- } | | 307|+ | 308| 308| | 309| 309| this.UpdateAutoResearch(); | 310| 310| | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | 322| 322| cmpPlayerEntityLimits.UpdateLimitsFromTech(tech); | 323| 323| | 324| 324| // always send research finished message | 325| |- Engine.PostMessage(this.entity, MT_ResearchFinished, {"player": playerID, "tech": tech}); | | 325|+ Engine.PostMessage(this.entity, MT_ResearchFinished, { "player": playerID, "tech": tech}); | 326| 326| | 327| 327| for (var component in modifiedComponents) | 328| 328| { | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | 322| 322| cmpPlayerEntityLimits.UpdateLimitsFromTech(tech); | 323| 323| | 324| 324| // always send research finished message | 325| |- Engine.PostMessage(this.entity, MT_ResearchFinished, {"player": playerID, "tech": tech}); | | 325|+ Engine.PostMessage(this.entity, MT_ResearchFinished, {"player": playerID, "tech": tech }); | 326| 326| | 327| 327| for (var component in modifiedComponents) | 328| 328| { | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | 326| 326| | 327| 327| for (var component in modifiedComponents) | 328| 328| { | 329| |- Engine.PostMessage(SYSTEM_ENTITY, MT_TemplateModification, { "player": playerID, "component": component, "valueNames": modifiedComponents[component]}); | | 329|+ Engine.PostMessage(SYSTEM_ENTITY, MT_TemplateModification, { "player": playerID, "component": component, "valueNames": modifiedComponents[component] }); | 330| 330| Engine.BroadcastMessage(MT_ValueModification, { "entities": ents, "component": component, "valueNames": modifiedComponents[component]}); | 331| 331| } | 332| 332| | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | 327| 327| for (var component in modifiedComponents) | 328| 328| { | 329| 329| Engine.PostMessage(SYSTEM_ENTITY, MT_TemplateModification, { "player": playerID, "component": component, "valueNames": modifiedComponents[component]}); | 330| |- Engine.BroadcastMessage(MT_ValueModification, { "entities": ents, "component": component, "valueNames": modifiedComponents[component]}); | | 330|+ Engine.BroadcastMessage(MT_ValueModification, { "entities": ents, "component": component, "valueNames": modifiedComponents[component] }); | 331| 331| } | 332| 332| | 333| 333| if (tech.startsWith("phase") && !template.autoResearch) | | [NORMAL] ESLintBear (semi): | | Missing semicolon. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | 449| 449| */ | 450| 450| TechnologyManager.prototype.GetResearcher = function(tech) | 451| 451| { | 452| |- return this.researchQueued.get(tech) | | 452|+ return this.researchQueued.get(tech); | 453| 453| }; | 454| 454| | 455| 455| /** binaries/data/mods/public/simulation/components/TechnologyManager.js | 150| » » » switch·(type) | | [NORMAL] ESLintBear (default-case): | | Expected a default case. binaries/data/mods/public/simulation/components/TechnologyManager.js | 165| » switch·(entity.check) | | [NORMAL] ESLintBear (default-case): | | Expected a default case. binaries/data/mods/public/simulation/components/TechnologyManager.js | 220| ·» » » » » if·(DoesModificationApply(modif,·classes)) | | [NORMAL] ESLintBear (no-mixed-spaces-and-tabs): | | Mixed spaces and tabs. binaries/data/mods/public/simulation/components/TechnologyManager.js | 68| » » » ||·(tech.top·&&·(this.IsTechnologyResearched(tech.top)·||·this.IsTechnologyResearched(tech.bottom)))) | | [NORMAL] JSHintBear: | | Misleading line break before '||'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/components/TechnologyManager.js | 229| » » » for·(var·component·in·modifiedComponents) | | [NORMAL] JSHintBear: | | 'component' is already defined. binaries/data/mods/public/simulation/components/TechnologyManager.js | 235| » » var·cmpTemplateManager·=·Engine.QueryInterface(SYSTEM_ENTITY,·IID_TemplateManager); | | [NORMAL] JSHintBear: | | 'cmpTemplateManager' is already defined. binaries/data/mods/public/simulation/components/TechnologyManager.js | 236| » » var·template·=·cmpTemplateManager.GetCurrentTemplateName(msg.entity); | | [NORMAL] JSHintBear: | | 'template' is already defined. binaries/data/mods/public/simulation/components/TechnologyManager.js | 241| » » » var·cmpIdentity·=·Engine.QueryInterface(msg.entity,·IID_Identity); | | [NORMAL] JSHintBear: | | 'cmpIdentity' is already defined. binaries/data/mods/public/simulation/components/TechnologyManager.js | 244| » » » » var·classes·=·cmpIdentity.GetClassesList(); | | [NORMAL] JSHintBear: | | 'classes' is already defined. binaries/data/mods/public/simulation/components/TechnologyManager.js | 452| » return·this.researchQueued.get(tech) | | [NORMAL] JSHintBear: | | Missing semicolon. Executing section cli... Link to build: https://jenkins.wildfiregames.com/job/differential/1745/display/redirect Comment Actions Looks better. Comment Actions The remaining issue being the broken build? (Perhaps the problem lies in the "Attack.js"?) But I can't really try because the tests don't fail with me,,, Comment Actions I think it's just a freak test failure since it worked fine on my computer too. Re-uploading to check. @Freagarach I should add you to the 0 A.D. credits file. I have your Nickname, do you want your name to be shown too? Comment Actions 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 2 tabs but found 3. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js | 392| 392| function getRepairTimeTooltip(entState) | 393| 393| { | 394| 394| return sprintf(translate("%(label)s %(details)s"), { | 395| |- "label": headerFont(translate("Number of repairers:")), | | 395|+ "label": headerFont(translate("Number of repairers:")), | 396| 396| "details": entState.repairable.numBuilders | 397| 397| }) + "\n" + (entState.repairable.numBuilders ? | 398| 398| sprintf(translatePlural( | | [NORMAL] ESLintBear (indent): | | Expected indentation of 2 tabs but found 3. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js | 393| 393| { | 394| 394| return sprintf(translate("%(label)s %(details)s"), { | 395| 395| "label": headerFont(translate("Number of repairers:")), | 396| |- "details": entState.repairable.numBuilders | | 396|+ "details": entState.repairable.numBuilders | 397| 397| }) + "\n" + (entState.repairable.numBuilders ? | 398| 398| sprintf(translatePlural( | 399| 399| "Add another worker to speed up the repairs by %(second)s second.", | | [NORMAL] ESLintBear (indent): | | Expected indentation of 1 tab but found 2. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js | 394| 394| return sprintf(translate("%(label)s %(details)s"), { | 395| 395| "label": headerFont(translate("Number of repairers:")), | 396| 396| "details": entState.repairable.numBuilders | 397| |- }) + "\n" + (entState.repairable.numBuilders ? | | 397|+ }) + "\n" + (entState.repairable.numBuilders ? | 398| 398| sprintf(translatePlural( | 399| 399| "Add another worker to speed up the repairs by %(second)s second.", | 400| 400| "Add another worker to speed up the repairs by %(second)s seconds.", | | [NORMAL] ESLintBear (indent): | | Expected indentation of 2 tabs but found 3. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js | 414| 414| function getBuildTimeTooltip(entState) | 415| 415| { | 416| 416| return sprintf(translate("%(label)s %(details)s"), { | 417| |- "label": headerFont(translate("Number of builders:")), | | 417|+ "label": headerFont(translate("Number of builders:")), | 418| 418| "details": entState.foundation.numBuilders | 419| 419| }) + "\n" + (entState.foundation.numBuilders ? | 420| 420| sprintf(translatePlural( | | [NORMAL] ESLintBear (indent): | | Expected indentation of 2 tabs but found 3. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js | 415| 415| { | 416| 416| return sprintf(translate("%(label)s %(details)s"), { | 417| 417| "label": headerFont(translate("Number of builders:")), | 418| |- "details": entState.foundation.numBuilders | | 418|+ "details": entState.foundation.numBuilders | 419| 419| }) + "\n" + (entState.foundation.numBuilders ? | 420| 420| sprintf(translatePlural( | 421| 421| "Add another worker to speed up the construction by %(second)s second.", | | [NORMAL] ESLintBear (indent): | | Expected indentation of 1 tab but found 2. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/common/tooltips.js | 416| 416| return sprintf(translate("%(label)s %(details)s"), { | 417| 417| "label": headerFont(translate("Number of builders:")), | 418| 418| "details": entState.foundation.numBuilders | 419| |- }) + "\n" + (entState.foundation.numBuilders ? | | 419|+ }) + "\n" + (entState.foundation.numBuilders ? | 420| 420| sprintf(translatePlural( | 421| 421| "Add another worker to speed up the construction by %(second)s second.", | 422| 422| "Add another worker to speed up the construction by %(second)s seconds.", | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'for-of'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js | 33| 33| { | 34| 34| let args = string.split("/"); | 35| 35| for (let arg of args) | 36| |- { | | 36|+ | 37| 37| if (value[arg]) | 38| 38| value = value[arg]; | 39| 39| else | 41| 41| value = undefined; | 42| 42| break; | 43| 43| } | 44| |- } | | 44|+ | 45| 45| this._tpCache.set(string, value); | 46| 46| } | 47| 47| return this._tpCache.get(string); | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/ai/common-api/entity.js | 308| 308| return undefined; | 309| 309| | 310| 310| if (this.get("Attack/" + type + "/Bonuses")) | 311| |- { | | 311|+ | 312| 312| for (let b in this.get("Attack/" + type + "/Bonuses")) | 313| 313| { | 314| 314| let bonusClasses = this.get("Attack/" + type + "/Bonuses/" + b + "/Classes"); | 318| 318| if (bcl == againstClass) | 319| 319| return +this.get("Attack/" + type + "/Bonuses/" + b + "/Multiplier"); | 320| 320| } | 321| |- } | | 321|+ | 322| 322| return 1; | 323| 323| }, | 324| 324| binaries/data/mods/public/simulation/ai/common-api/entity.js | 798| » » if·(this.position()·!==·undefined)·{ | | [NORMAL] ESLintBear (brace-rules/brace-on-same-line): | | Opening curly brace appears on the same line as controlling statement. binaries/data/mods/public/simulation/ai/common-api/entity.js | 815| » » if·(this.position()·!==·undefined·&&·unitToFleeFrom.position()·!==·undefined)·{ | | [NORMAL] ESLintBear (brace-rules/brace-on-same-line): | | Opening curly brace appears on the same line as controlling statement. | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | 66| 66| let phase = ""; | 67| 67| let cmpTechnologyManager = QueryPlayerIDInterface(i, IID_TechnologyManager); | 68| 68| if (cmpTechnologyManager) | 69| |- { | | 69|+ | 70| 70| if (cmpTechnologyManager.IsTechnologyResearched("phase_city")) | 71| 71| phase = "city"; | 72| 72| else if (cmpTechnologyManager.IsTechnologyResearched("phase_town")) | 73| 73| phase = "town"; | 74| 74| else if (cmpTechnologyManager.IsTechnologyResearched("phase_village")) | 75| 75| phase = "village"; | 76| |- } | | 76|+ | 77| 77| | 78| 78| // store player ally/neutral/enemy data as arrays | 79| 79| let allies = []; | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | 415| 415| ret.attack[type].elevationBonus = range.elevationBonus; | 416| 416| | 417| 417| if (cmpUnitAI && cmpPosition && cmpPosition.IsInWorld()) | 418| |- { | | 418|+ | 419| 419| // For units, take the range in front of it, no spread. So angle = 0 | 420| 420| ret.attack[type].elevationAdaptedRange = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, 0); | 421| |- } | | 421|+ | 422| 422| else if(cmpPosition && cmpPosition.IsInWorld()) | 423| 423| { | 424| 424| // For buildings, take the average elevation around it. So angle = 2*pi | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | 420| 420| ret.attack[type].elevationAdaptedRange = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, 0); | 421| 421| } | 422| 422| else if(cmpPosition && cmpPosition.IsInWorld()) | 423| |- { | | 423|+ | 424| 424| // For buildings, take the average elevation around it. So angle = 2*pi | 425| 425| ret.attack[type].elevationAdaptedRange = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, 2*Math.PI); | 426| |- } | | 426|+ | 427| 427| else | 428| 428| { | 429| 429| // not in world, set a default? | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'else'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | 425| 425| ret.attack[type].elevationAdaptedRange = cmpRangeManager.GetElevationAdaptedRange(cmpPosition.GetPosition(), cmpPosition.GetRotation(), range.max, range.elevationBonus, 2*Math.PI); | 426| 426| } | 427| 427| else | 428| |- { | | 428|+ | 429| 429| // not in world, set a default? | 430| 430| ret.attack[type].elevationAdaptedRange = ret.attack.maxRange; | 431| |- } | | 431|+ | 432| 432| } | 433| 433| } | 434| 434| | | [NORMAL] ESLintBear (indent): | | Expected indentation of 2 tabs but found 3. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | 796| 796| updateEntityColor(data.showAllStatusBars && (i == player || player == -1) ? | 797| 797| [IID_Minimap, IID_RangeOverlayRenderer, IID_RallyPointRenderer, IID_StatusBars] : | 798| 798| [IID_Minimap, IID_RangeOverlayRenderer, IID_RallyPointRenderer], | 799| |- cmpRangeManager.GetEntitiesByPlayer(i)); | | 799|+ cmpRangeManager.GetEntitiesByPlayer(i)); | 800| 800| } | 801| 801| updateEntityColor([IID_Selectable, IID_StatusBars], data.selected); | 802| 802| Engine.QueryInterface(SYSTEM_ENTITY, IID_TerritoryManager).UpdateColors(); | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'else'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js |1315|1315| } |1316|1316| } |1317|1317| else |1318| |- { | |1318|+ |1319|1319| // Didn't snap to an existing entity, add the starting tower manually. To prevent odd-looking rotation jumps |1320|1320| // when shift-clicking to build a wall, reuse the placement angle that was last seen on a validly positioned |1321|1321| // wall piece. |1336|1336| "pos": start.pos, |1337|1337| "angle": previewEntities.length > 0 ? previewEntities[0].angle : this.placementWallLastAngle |1338|1338| }); |1339| |- } | |1339|+ |1340|1340| |1341|1341| if (end.pos) |1342|1342| { | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js |1339|1339| } |1340|1340| |1341|1341| if (end.pos) |1342| |- { | |1342|+ |1343|1343| // Analogous to the starting side case above |1344|1344| if (end.snappedEnt && end.snappedEnt != INVALID_ENTITY) |1345|1345| { |1377|1377| "pos": end.pos, |1378|1378| "angle": previewEntities.length > 0 ? previewEntities[previewEntities.length-1].angle : this.placementWallLastAngle |1379|1379| }); |1380| |- } | |1380|+ |1381|1381| |1382|1382| let cmpTerrain = Engine.QueryInterface(SYSTEM_ENTITY, IID_Terrain); |1383|1383| if (!cmpTerrain) | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js |1555|1555| |1556|1556| let cmpVisual = Engine.QueryInterface(ent, IID_Visual); |1557|1557| if (cmpVisual) |1558| |- { | |1558|+ |1559|1559| if (!allPiecesValid || !canAfford) |1560|1560| cmpVisual.SetShadingColor(1.4, 0.4, 0.4, 1); |1561|1561| else |1562|1562| cmpVisual.SetShadingColor(1, 1, 1, 1); |1563| |- } | |1563|+ |1564|1564| |1565|1565| ++entPool.numUsed; |1566|1566| } | | [NORMAL] ESLintBear (indent): | | Expected indentation of 5 tabs but found 6. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js |1629|1629| { |1630|1630| minDist2 = dist2; |1631|1631| minDistEntitySnapData = { |1632| |- "x": pos.x, | |1632|+ "x": pos.x, |1633|1633| "z": pos.z, |1634|1634| "angle": cmpPosition.GetRotation().y, |1635|1635| "ent": ent | | [NORMAL] ESLintBear (indent): | | Expected indentation of 5 tabs but found 6. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js |1630|1630| minDist2 = dist2; |1631|1631| minDistEntitySnapData = { |1632|1632| "x": pos.x, |1633| |- "z": pos.z, | |1633|+ "z": pos.z, |1634|1634| "angle": cmpPosition.GetRotation().y, |1635|1635| "ent": ent |1636|1636| }; | | [NORMAL] ESLintBear (indent): | | Expected indentation of 5 tabs but found 6. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js |1631|1631| minDistEntitySnapData = { |1632|1632| "x": pos.x, |1633|1633| "z": pos.z, |1634| |- "angle": cmpPosition.GetRotation().y, | |1634|+ "angle": cmpPosition.GetRotation().y, |1635|1635| "ent": ent |1636|1636| }; |1637|1637| } | | [NORMAL] ESLintBear (indent): | | Expected indentation of 5 tabs but found 6. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js |1632|1632| "x": pos.x, |1633|1633| "z": pos.z, |1634|1634| "angle": cmpPosition.GetRotation().y, |1635| |- "ent": ent | |1635|+ "ent": ent |1636|1636| }; |1637|1637| } |1638|1638| } | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js |1777|1777| result.gain = cmpEntityTrader.GetGoods().amount; |1778|1778| } |1779|1779| else if (data.target === secondMarket) |1780| |- { | |1780|+ |1781|1781| result = { |1782|1782| "type": "is second", |1783|1783| "gain": cmpEntityTrader.GetGoods().amount, |1784|1784| }; |1785| |- } | |1785|+ |1786|1786| else if (!firstMarket) |1787|1787| { |1788|1788| result = { "type": "set first" }; | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js |1784|1784| }; |1785|1785| } |1786|1786| else if (!firstMarket) |1787| |- { | |1787|+ |1788|1788| result = { "type": "set first" }; |1789| |- } | |1789|+ |1790|1790| else if (!secondMarket) |1791|1791| { |1792|1792| result = { | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js |1788|1788| result = { "type": "set first" }; |1789|1789| } |1790|1790| else if (!secondMarket) |1791| |- { | |1791|+ |1792|1792| result = { |1793|1793| "type": "set second", |1794|1794| "gain": cmpEntityTrader.CalculateGain(firstMarket, data.target), |1795|1795| }; |1796| |- } | |1796|+ |1797|1797| else |1798|1798| { |1799|1799| // Else both markets are not null and target is different from them | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'else'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/GuiInterface.js |1795|1795| }; |1796|1796| } |1797|1797| else |1798| |- { | |1798|+ |1799|1799| // Else both markets are not null and target is different from them |1800|1800| result = { "type": "set first" }; |1801| |- } | |1801|+ |1802|1802| return result; |1803|1803| }; |1804|1804| | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'for-in'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | 10| 10| | 11| 11| var ret = {}; | 12| 12| for (var i in this) | 13| |- { | | 13|+ | 14| 14| if (this.hasOwnProperty(i)) | 15| 15| ret[i] = this[i]; | 16| |- } | | 16|+ | 17| 17| ret.modificationCache = {}; | 18| 18| return ret; | 19| 19| }; | | [NORMAL] ESLintBear (operator-linebreak): | | '||' should be placed at the end of the line. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | 64| 64| for (let key of this.unresearchedAutoResearchTechs) | 65| 65| { | 66| 66| let tech = TechnologyTemplates.Get(key); | 67| |- if ((tech.autoResearch && this.CanResearch(key)) | 68| |- || (tech.top && (this.IsTechnologyResearched(tech.top) || this.IsTechnologyResearched(tech.bottom)))) | | 67|+ if ((tech.autoResearch && this.CanResearch(key)) || | | 68|+ (tech.top && (this.IsTechnologyResearched(tech.top) || this.IsTechnologyResearched(tech.bottom)))) | 69| 69| { | 70| 70| this.unresearchedAutoResearchTechs.delete(key); | 71| 71| this.ResearchTechnology(key); | | [NORMAL] ESLintBear (space-before-function-paren): | | Unexpected space before function parentheses. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | 75| 75| }; | 76| 76| | 77| 77| // Checks an entity template to see if its technology requirements have been met | 78| |-TechnologyManager.prototype.CanProduce = function (templateName) | | 78|+TechnologyManager.prototype.CanProduce = function(templateName) | 79| 79| { | 80| 80| var cmpTempManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_TemplateManager); | 81| 81| var template = cmpTempManager.GetTemplate(templateName); | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | 193| 193| var classes = cmpIdentity.GetClassesList(); | 194| 194| // don't use foundations for the class counts but check if techs apply (e.g. health increase) | 195| 195| if (!Engine.QueryInterface(msg.entity, IID_Foundation)) | 196| |- { | | 196|+ | 197| 197| for (let cls of classes) | 198| 198| { | 199| 199| this.classCounts[cls] = this.classCounts[cls] || 0; | 203| 203| this.typeCountsByClass[cls][template] = this.typeCountsByClass[cls][template] || 0; | 204| 204| this.typeCountsByClass[cls][template] += 1; | 205| 205| } | 206| |- } | | 206|+ | 207| 207| | 208| 208| // Newly created entity, check if any researched techs might apply | 209| 209| // (only do this for new entities because even if an entity is converted or captured, | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | 286| 286| } | 287| 287| | 288| 288| if (template.replaces && template.replaces.length > 0) | 289| |- { | | 289|+ | 290| 290| for (var i of template.replaces) | 291| 291| { | 292| 292| if (!i || this.IsTechnologyResearched(i)) | 304| 304| cmpPlayerEntityLimits.UpdateLimitsFromTech(i); | 305| 305| } | 306| 306| } | 307| |- } | | 307|+ | 308| 308| | 309| 309| this.UpdateAutoResearch(); | 310| 310| | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | 322| 322| cmpPlayerEntityLimits.UpdateLimitsFromTech(tech); | 323| 323| | 324| 324| // always send research finished message | 325| |- Engine.PostMessage(this.entity, MT_ResearchFinished, {"player": playerID, "tech": tech}); | | 325|+ Engine.PostMessage(this.entity, MT_ResearchFinished, { "player": playerID, "tech": tech}); | 326| 326| | 327| 327| for (var component in modifiedComponents) | 328| 328| { | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | 322| 322| cmpPlayerEntityLimits.UpdateLimitsFromTech(tech); | 323| 323| | 324| 324| // always send research finished message | 325| |- Engine.PostMessage(this.entity, MT_ResearchFinished, {"player": playerID, "tech": tech}); | | 325|+ Engine.PostMessage(this.entity, MT_ResearchFinished, {"player": playerID, "tech": tech }); | 326| 326| | 327| 327| for (var component in modifiedComponents) | 328| 328| { | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | 326| 326| | 327| 327| for (var component in modifiedComponents) | 328| 328| { | 329| |- Engine.PostMessage(SYSTEM_ENTITY, MT_TemplateModification, { "player": playerID, "component": component, "valueNames": modifiedComponents[component]}); | | 329|+ Engine.PostMessage(SYSTEM_ENTITY, MT_TemplateModification, { "player": playerID, "component": component, "valueNames": modifiedComponents[component] }); | 330| 330| Engine.BroadcastMessage(MT_ValueModification, { "entities": ents, "component": component, "valueNames": modifiedComponents[component]}); | 331| 331| } | 332| 332| | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | 327| 327| for (var component in modifiedComponents) | 328| 328| { | 329| 329| Engine.PostMessage(SYSTEM_ENTITY, MT_TemplateModification, { "player": playerID, "component": component, "valueNames": modifiedComponents[component]}); | 330| |- Engine.BroadcastMessage(MT_ValueModification, { "entities": ents, "component": component, "valueNames": modifiedComponents[component]}); | | 330|+ Engine.BroadcastMessage(MT_ValueModification, { "entities": ents, "component": component, "valueNames": modifiedComponents[component] }); | 331| 331| } | 332| 332| | 333| 333| if (tech.startsWith("phase") && !template.autoResearch) | | [NORMAL] ESLintBear (semi): | | Missing semicolon. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/TechnologyManager.js | 449| 449| */ | 450| 450| TechnologyManager.prototype.GetResearcher = function(tech) | 451| 451| { | 452| |- return this.researchQueued.get(tech) | | 452|+ return this.researchQueued.get(tech); | 453| 453| }; | 454| 454| | 455| 455| /** binaries/data/mods/public/simulation/components/TechnologyManager.js | 150| » » » switch·(type) | | [NORMAL] ESLintBear (default-case): | | Expected a default case. binaries/data/mods/public/simulation/components/TechnologyManager.js | 165| » switch·(entity.check) | | [NORMAL] ESLintBear (default-case): | | Expected a default case. binaries/data/mods/public/simulation/components/TechnologyManager.js | 220| ·» » » » » if·(DoesModificationApply(modif,·classes)) | | [NORMAL] ESLintBear (no-mixed-spaces-and-tabs): | | Mixed spaces and tabs. binaries/data/mods/public/simulation/components/TechnologyManager.js | 68| » » » ||·(tech.top·&&·(this.IsTechnologyResearched(tech.top)·||·this.IsTechnologyResearched(tech.bottom)))) | | [NORMAL] JSHintBear: | | Misleading line break before '||'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/components/TechnologyManager.js | 229| » » » for·(var·component·in·modifiedComponents) | | [NORMAL] JSHintBear: | | 'component' is already defined. binaries/data/mods/public/simulation/components/TechnologyManager.js | 235| » » var·cmpTemplateManager·=·Engine.QueryInterface(SYSTEM_ENTITY,·IID_TemplateManager); | | [NORMAL] JSHintBear: | | 'cmpTemplateManager' is already defined. binaries/data/mods/public/simulation/components/TechnologyManager.js | 236| » » var·template·=·cmpTemplateManager.GetCurrentTemplateName(msg.entity); | | [NORMAL] JSHintBear: | | 'template' is already defined. binaries/data/mods/public/simulation/components/TechnologyManager.js | 241| » » » var·cmpIdentity·=·Engine.QueryInterface(msg.entity,·IID_Identity); | | [NORMAL] JSHintBear: | | 'cmpIdentity' is already defined. binaries/data/mods/public/simulation/components/TechnologyManager.js | 244| » » » » var·classes·=·cmpIdentity.GetClassesList(); | | [NORMAL] JSHintBear: | | 'classes' is already defined. binaries/data/mods/public/simulation/components/TechnologyManager.js | 452| » return·this.researchQueued.get(tech) | | [NORMAL] JSHintBear: | | Missing semicolon. | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js | 524| 524| | 525| 525| let horizSpeed = +this.template[type].Projectile.Speed; | 526| 526| let gravity = +this.template[type].Projectile.Gravity; | 527| |- //horizSpeed /= 2; gravity /= 2; // slow it down for testing | | 527|+ // horizSpeed /= 2; gravity /= 2; // slow it down for testing | 528| 528| | 529| 529| let cmpPosition = Engine.QueryInterface(this.entity, IID_Position); | 530| 530| if (!cmpPosition || !cmpPosition.IsInWorld()) | | [NORMAL] ESLintBear (no-trailing-spaces): | | Trailing spaces not allowed. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js | 571| 571| // TODO: Use unit rotation to implement x/z offsets. | 572| 572| let deltaLaunchPoint = new Vector3D(0, this.template[type].Projectile.LaunchPoint["@y"], 0.0); | 573| 573| let launchPoint = Vector3D.add(selfPosition, deltaLaunchPoint); | 574| |- | | 574|+ | 575| 575| let cmpVisual = Engine.QueryInterface(this.entity, IID_Visual); | 576| 576| if (cmpVisual) | 577| 577| { | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'else'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/Attack.js | 643| 643| }); | 644| 644| } | 645| 645| else | 646| |- { | | 646|+ | 647| 647| // Melee attack - hurt the target immediately | 648| 648| cmpDamage.CauseDamage({ | 649| 649| "strengths": this.GetAttackStrengths(type), | 653| 653| "type": type, | 654| 654| "attackerOwner": attackerOwner | 655| 655| }); | 656| |- } | | 656|+ | 657| 657| }; | 658| 658| | 659| 659| /** binaries/data/mods/public/simulation/components/Attack.js | 514| ·» let·cmpDamage·=·Engine.QueryInterface(SYSTEM_ENTITY,·IID_Damage); | | [NORMAL] ESLintBear (no-mixed-spaces-and-tabs): | | Mixed spaces and tabs. binaries/data/mods/public/simulation/components/Attack.js | 618| » » cmpTimer.SetTimeout(SYSTEM_ENTITY,·IID_Damage,·"MissileHit",·timeToTarget·*·1000·+·+this.template[type].Delay,·data); | | [NORMAL] JSHintBear: | | Confusing plusses. | | [NORMAL] ESLintBear (operator-linebreak): | | '||' should be placed at the end of the line. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/globalscripts/Templates.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/globalscripts/Templates.js | 87| 87| // If the elements are still strings, split them by space or by '+' | 88| 88| if (typeof sublist == "string") | 89| 89| sublist = sublist.split(/[+\s]+/); | 90| |- if (sublist.every(c => (c[0] == "!" && classes.indexOf(c.substr(1)) == -1) | 91| |- || (c[0] != "!" && classes.indexOf(c) != -1))) | | 90|+ if (sublist.every(c => (c[0] == "!" && classes.indexOf(c.substr(1)) == -1) || | | 91|+ (c[0] != "!" && classes.indexOf(c) != -1))) | 92| 92| return true; | 93| 93| } | 94| 94| binaries/data/mods/public/globalscripts/Templates.js | 91| » » ····················||·(c[0]·!=·"!"·&&·classes.indexOf(c)·!=·-1))) | | [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/differential/1747/display/redirect Comment Actions Thank you for this patch. Next question, should we also have a <Range> node? E.g.: <Attack> <Ranged> <Damage> <Hack>0.0</Hack> <Pierce>9.0</Pierce> <Crush>0.0</Crush> </Damage> ... <Range> <ElevationBonus>9</ElevationBonus> <Max>70</Max> <Min>10</Min> <Overlay> <LineTexture>outline_border.png</LineTexture> <LineTextureMask>outline_border_mask.png</LineTextureMask> <LineThickness>0.175</LineThickness> </Overlay> </Range> </Ranged> </Attack> instead of: <Attack> <Ranged> <Damage> <Hack>0.0</Hack> <Pierce>9.0</Pierce> <Crush>0.0</Crush> </Damage> <MaxRange>70</MaxRange> <MinRange>10</MinRange> <ElevationBonus>9</ElevationBonus> ... <RangeOverlay> <LineTexture>outline_border.png</LineTexture> <LineTextureMask>outline_border_mask.png</LineTextureMask> <LineThickness>0.175</LineThickness> </RangeOverlay> </Ranged> </Attack> Comment Actions That is up to the dev's I guess. I think it is pretty, but is it useful? Useful enough to agitate the modders again? Comment Actions One question is what to do with range - range implies projectile, should range be moved to the projectile? Possibly if we want one attack to send multiple projectiles with different behaviour. So maybe then do it. If it's just to group with no gameplay impact, I don't think it's worth breaking mod compatibility. Comment Actions I think range does *not* imply projectile (#2949). Especially if we want to support arbitrary attack types. (E.g. a pikeman has to switch to a sword when in close combat.) Comment Actions Melee attack also has range, but no projectiles. You're right, it has no immediate gameplay effects, it would just be a more logical grouping in the xml files. Currently there are already separate nodes for <Bonuses>, <Damage>, <Projectile>, <RangeOverlay>, and <Splash>. I believe <RangeOverlay> is based on <MaxRange> and <MinRange>, so it would make sense to put those (and <ElevationBonus>) inside the same node, and rename it to simply <Range>. Comment Actions Partly agreed, but (, I think,) modders are already converting their mods based on SVN. Comment Actions Forgot about melee attacks... But my above point still stands that we might want attacks that generate more than one projectile, and then these projectiles could have different range behaviour. We might need range at two different levels again.
Very good point. Might be worth it indeed. Comment Actions Ideally different projectiles would also be able to have different damage, therefore what is eventually desirable is support for multiple ranged attacks, e.g. a fortress able to fire both arrows (long range, low damage) and javelins (shorter range, higher damage). Comment Actions So we need a "Range" node in the "Attack" *and* a "Range" in the "Projectile"? Comment Actions We would
Yes it's a paradigm change, introduced mostly by D1171 a said above. Launching multiple projectiles is unsupported, but it could/should be added. But I think it'd be better first to make Projectile handle more things. The correct way forward is probably to define the common schema of melee attacks and projectile stuff somewhere, then re-use that, instead of duplicating the schema so much. Comment Actions Please correct me if I'm mistaken, but currently ranged attack has everything melee attack has, plus <Delay>, <ElevationBonus>, <Projectile>, and <Splash>. By the way, the example schemata in simulation/components/Attack.js lines 61-121 don't have a <Damage> node yet. Comment Actions Should probably be a pre-requisite - will have to see what @bb's patch is like.
Ranged has Splash MinRange, ElevationBonus, RangeOverlay, and Delay.
Comment Actions That would need a "Projectile" as well right? Nevertheless I do agree that "Delay" could be useful. Comment Actions Indeed I would use a projectile for that. Delay for pure melee attacks sounds better implemented using status effects (which are already in-game, just need a GUI) Comment Actions By the way, <FriendlyFire> is wrapped inside the <Splash> node, but shouldn't it be applicable to non-splash attacks as well? E.g. an archer shoots an arrow at an enemy, but the projectile spread causes it to land on another unit of yours right next to the target, then it would be nice to have if that one was wounded, for realism. Comment Actions I think with that patch this (the common scheme) becomes obselete since one would only need to define it once. Comment Actions Have updated the relevant wiki page on trac: https://trac.wildfiregames.com/wiki/TechModifications |