This gives players an option to choose a preferred attack type since it was requested often in the forums (specifically regarding capture not always desired).
This patch enlarges (vertically) the left selection panel slightly for this to enable a second row of buttons (similar to stances).
There are no icons for this yet. I hoped to find them in #1785, but to no avail, since those were damage icons.
Details
- Reviewers
- None
- Group Reviewers
Restricted Owners Package (Owns No Changed Paths)
Verify this works as advertised and is wanted.
Diff Detail
- Repository
- rP 0 A.D. Public Repository
- Branch
- /ps/trunk
- Lint
Lint OK - Unit
No Unit Test Coverage - Build Status
Buildable 8777 Build 14392: Vulcan Build Jenkins Build 14390: arc lint + arc unit
Event Timeline
Build failure - The Moirai have given mortals hearts that can endure.
Link to build: https://jenkins.wildfiregames.com/job/docker-differential/288/display/redirect
Successful build - Chance fights ever on the side of the prudent.
Linter detected issues: Executing section Source... Executing section JS... | | [NORMAL] ESLintBear (space-before-function-paren): | | Unexpected space before function parentheses. |----| | /zpool0/trunk/binaries/data/mods/public/gui/session/selection_panels.js | |++++| /zpool0/trunk/binaries/data/mods/public/gui/session/selection_panels.js | 763| 763| addResearchToQueue(data.item.researchFacilityId, t); | 764| 764| })(tech); | 765| 765| | 766| |- button.onPressRight = (t => function () { | | 766|+ button.onPressRight = (t => function() { | 767| 767| showTemplateDetails( | 768| 768| t, | 769| 769| GetTemplateData(data.unitEntStates.find(state => state.id == data.item.researchFacilityId).template).nativeCiv); binaries/data/mods/public/gui/session/selection_panels.js | 48| » » » switch·(data.item) | | [NORMAL] ESLintBear (default-case): | | Expected a default case. binaries/data/mods/public/gui/session/selection_panels.js | 59| » » switch·(data.item) | | [NORMAL] ESLintBear (default-case): | | Expected a default case. binaries/data/mods/public/gui/session/selection_panels.js | 731| » » » » » » switch·(entity.check) | | [NORMAL] ESLintBear (default-case): | | Expected a default case. | | [NORMAL] ESLintBear (indent): | | Expected indentation of 2 tabs but found 3. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js | 807| 807| updateEntityColor(data.showAllStatusBars && (i == player || player == -1) ? | 808| 808| [IID_Minimap, IID_RangeOverlayRenderer, IID_RallyPointRenderer, IID_StatusBars] : | 809| 809| [IID_Minimap, IID_RangeOverlayRenderer, IID_RallyPointRenderer], | 810| |- cmpRangeManager.GetEntitiesByPlayer(i)); | | 810|+ cmpRangeManager.GetEntitiesByPlayer(i)); | 811| 811| } | 812| 812| updateEntityColor([IID_Selectable, IID_StatusBars], data.selected); | 813| 813| Engine.QueryInterface(SYSTEM_ENTITY, IID_TerritoryManager).UpdateColors(); | | [NORMAL] ESLintBear (indent): | | Expected indentation of 5 tabs but found 6. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js |1640|1640| { |1641|1641| minDist2 = dist2; |1642|1642| minDistEntitySnapData = { |1643| |- "x": pos.x, | |1643|+ "x": pos.x, |1644|1644| "z": pos.z, |1645|1645| "angle": cmpPosition.GetRotation().y, |1646|1646| "ent": ent | | [NORMAL] ESLintBear (indent): | | Expected indentation of 5 tabs but found 6. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js |1641|1641| minDist2 = dist2; |1642|1642| minDistEntitySnapData = { |1643|1643| "x": pos.x, |1644| |- "z": pos.z, | |1644|+ "z": pos.z, |1645|1645| "angle": cmpPosition.GetRotation().y, |1646|1646| "ent": ent |1647|1647| }; | | [NORMAL] ESLintBear (indent): | | Expected indentation of 5 tabs but found 6. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js |1642|1642| minDistEntitySnapData = { |1643|1643| "x": pos.x, |1644|1644| "z": pos.z, |1645| |- "angle": cmpPosition.GetRotation().y, | |1645|+ "angle": cmpPosition.GetRotation().y, |1646|1646| "ent": ent |1647|1647| }; |1648|1648| } | | [NORMAL] ESLintBear (indent): | | Expected indentation of 5 tabs but found 6. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js |1643|1643| "x": pos.x, |1644|1644| "z": pos.z, |1645|1645| "angle": cmpPosition.GetRotation().y, |1646| |- "ent": ent | |1646|+ "ent": ent |1647|1647| }; |1648|1648| } |1649|1649| } | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | 537| 537| if (cmpGarrisonHolder) | 538| 538| { | 539| 539| // Only the owner of the garrisonHolder may unload entities from any owners | 540| |- if (!IsOwnedByPlayer(player, garrisonHolder) && !data.controlAllUnits | 541| |- && player != +cmd.owner) | | 540|+ if (!IsOwnedByPlayer(player, garrisonHolder) && !data.controlAllUnits && | | 541|+ player != +cmd.owner) | 542| 542| continue; | 543| 543| | 544| 544| if (!cmpGarrisonHolder.UnloadTemplate(cmd.template, cmd.owner, cmd.all)) | | [NORMAL] ESLintBear (indent): | | Expected indentation of 5 tabs but found 6. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | 539| 539| // Only the owner of the garrisonHolder may unload entities from any owners | 540| 540| if (!IsOwnedByPlayer(player, garrisonHolder) && !data.controlAllUnits | 541| 541| && player != +cmd.owner) | 542| |- continue; | | 542|+ continue; | 543| 543| | 544| 544| if (!cmpGarrisonHolder.UnloadTemplate(cmd.template, cmd.owner, cmd.all)) | 545| 545| notifyUnloadFailure(player, garrisonHolder); | | [NORMAL] ESLintBear (key-spacing): | | Extra space after key 'metadata'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js |1153|1153| |1154|1154| // send Metadata info if any |1155|1155| if (cmd.metadata) |1156| |- Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player } ); | |1156|+ Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata": cmd.metadata, "owner" : player } ); |1157|1157| |1158|1158| // Tell the units to start building this new entity |1159|1159| if (cmd.autorepair) | | [NORMAL] ESLintBear (key-spacing): | | Extra space after key 'owner'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js |1153|1153| |1154|1154| // send Metadata info if any |1155|1155| if (cmd.metadata) |1156| |- Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player } ); | |1156|+ Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner": player } ); |1157|1157| |1158|1158| // Tell the units to start building this new entity |1159|1159| if (cmd.autorepair) | | [NORMAL] ESLintBear (space-in-parens): | | There should be no spaces inside this paren. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js |1153|1153| |1154|1154| // send Metadata info if any |1155|1155| if (cmd.metadata) |1156| |- Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player } ); | |1156|+ Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player }); |1157|1157| |1158|1158| // Tell the units to start building this new entity |1159|1159| if (cmd.autorepair) | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js |1261|1261| } |1262|1262| |1263|1263| lastTowerControlGroup = cmpSnappedStartObstruction.GetControlGroup(); |1264| |- //warn("setting lastTowerControlGroup to control group of start snapped entity " + cmd.startSnappedEntity + ": " + lastTowerControlGroup); | |1264|+ // warn("setting lastTowerControlGroup to control group of start snapped entity " + cmd.startSnappedEntity + ": " + lastTowerControlGroup); |1265|1265| } |1266|1266| |1267|1267| var i = 0; | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js |1325|1325| |1326|1326| if (i > 0) |1327|1327| { |1328| |- //warn(" updating previous wall piece's secondary control group to " + newTowerControlGroup); | |1328|+ // warn(" updating previous wall piece's secondary control group to " + newTowerControlGroup); |1329|1329| var cmpPreviousObstruction = Engine.QueryInterface(pieces[i-1].ent, IID_Obstruction); |1330|1330| // TODO: ensure that cmpPreviousObstruction exists |1331|1331| // TODO: ensure that the previous obstruction does not yet have a secondary control group set | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js |1488|1488| // Check that all its members are selected |1489|1489| var fid = formationIds[0]; |1490|1490| var cmpFormation = Engine.QueryInterface(+fid, IID_Formation); |1491| |- if (cmpFormation && cmpFormation.GetMemberCount() == formation.members[fid].length |1492| |- && cmpFormation.GetMemberCount() == formation.entities.length) | |1491|+ if (cmpFormation && cmpFormation.GetMemberCount() == formation.members[fid].length && | |1492|+ cmpFormation.GetMemberCount() == formation.entities.length) |1493|1493| { |1494|1494| cmpFormation.DeleteTwinFormations(); |1495|1495| // The whole formation was selected, so reuse its controller for this command | | [NORMAL] ESLintBear (comma-spacing): | | A space is required after ','. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js |1596|1596| for (var i = matrix.length - 1; i >= 0 && !closeClusters; --i) |1597|1597| for (var j = i - 1; j >= 0 && !closeClusters; --j) |1598|1598| if (matrix[i][j] < distSq) |1599| |- closeClusters = [i,j]; | |1599|+ closeClusters = [i, j]; |1600|1600| |1601|1601| // if no more close clusters found, just return all found clusters so far |1602|1602| if (!closeClusters) | | [NORMAL] ESLintBear (comma-spacing): | | A space is required after ','. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js |1618|1618| } |1619|1619| // remove the rows and columns in the matrix for the merged clusters, |1620|1620| // and the clusters themselves from the cluster list |1621| |- clusters.splice(closeClusters[0],1); | |1621|+ clusters.splice(closeClusters[0], 1); |1622|1622| clusters.splice(closeClusters[1],1); |1623|1623| matrix.splice(closeClusters[0],1); |1624|1624| matrix.splice(closeClusters[1],1); | | [NORMAL] ESLintBear (comma-spacing): | | A space is required after ','. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js |1619|1619| // remove the rows and columns in the matrix for the merged clusters, |1620|1620| // and the clusters themselves from the cluster list |1621|1621| clusters.splice(closeClusters[0],1); |1622| |- clusters.splice(closeClusters[1],1); | |1622|+ clusters.splice(closeClusters[1], 1); |1623|1623| matrix.splice(closeClusters[0],1); |1624|1624| matrix.splice(closeClusters[1],1); |1625|1625| for (let i = 0; i < matrix.length; ++i) | | [NORMAL] ESLintBear (comma-spacing): | | A space is required after ','. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js |1620|1620| // and the clusters themselves from the cluster list |1621|1621| clusters.splice(closeClusters[0],1); |1622|1622| clusters.splice(closeClusters[1],1); |1623| |- matrix.splice(closeClusters[0],1); | |1623|+ matrix.splice(closeClusters[0], 1); |1624|1624| matrix.splice(closeClusters[1],1); |1625|1625| for (let i = 0; i < matrix.length; ++i) |1626|1626| { | | [NORMAL] ESLintBear (comma-spacing): | | A space is required after ','. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js |1621|1621| clusters.splice(closeClusters[0],1); |1622|1622| clusters.splice(closeClusters[1],1); |1623|1623| matrix.splice(closeClusters[0],1); |1624| |- matrix.splice(closeClusters[1],1); | |1624|+ matrix.splice(closeClusters[1], 1); |1625|1625| for (let i = 0; i < matrix.length; ++i) |1626|1626| { |1627|1627| if (matrix[i].length > closeClusters[0]) | | [NORMAL] ESLintBear (comma-spacing): | | A space is required after ','. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js |1625|1625| for (let i = 0; i < matrix.length; ++i) |1626|1626| { |1627|1627| if (matrix[i].length > closeClusters[0]) |1628| |- matrix[i].splice(closeClusters[0],1); | |1628|+ matrix[i].splice(closeClusters[0], 1); |1629|1629| if (matrix[i].length > closeClusters[1]) |1630|1630| matrix[i].splice(closeClusters[1],1); |1631|1631| } | | [NORMAL] ESLintBear (comma-spacing): | | A space is required after ','. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js |1627|1627| if (matrix[i].length > closeClusters[0]) |1628|1628| matrix[i].splice(closeClusters[0],1); |1629|1629| if (matrix[i].length > closeClusters[1]) |1630| |- matrix[i].splice(closeClusters[1],1); | |1630|+ matrix[i].splice(closeClusters[1], 1); |1631|1631| } |1632|1632| // add a new row of distances to the matrix and the new cluster |1633|1633| clusters.push(newCluster); binaries/data/mods/public/simulation/helpers/Commands.js | 43| » if·(g_Commands[cmd.type]) | | [MAJOR] ESLintBear (no-use-before-define): | | 'g_Commands' was used before it was defined. binaries/data/mods/public/simulation/helpers/Commands.js | 47| » » g_Commands[cmd.type](player,·cmd,·data); | | [MAJOR] ESLintBear (no-use-before-define): | | 'g_Commands' was used before it was defined. binaries/data/mods/public/simulation/helpers/Commands.js | 799| » » let·ent·=·pickRandom(cmpRangeManager.GetEntitiesByPlayer(cmd.player).filter(ent·=>·{ | | [NORMAL] ESLintBear (no-shadow): | | 'ent' is already declared in the upper scope. binaries/data/mods/public/simulation/helpers/Commands.js |1284| ····» » » error("[TryConstructWall]·Expected·last·tower·control·group·to·be·available,·none·found·(1st·pass,·iteration·"·+·i·+·")"); | | [NORMAL] ESLintBear (no-mixed-spaces-and-tabs): | | Mixed spaces and tabs. binaries/data/mods/public/simulation/helpers/Commands.js |1285| ····» » » break; | | [NORMAL] ESLintBear (no-mixed-spaces-and-tabs): | | Mixed spaces and tabs. binaries/data/mods/public/simulation/helpers/Commands.js |1515| » » » » var·lastFormationTemplate·=·undefined; | | [NORMAL] ESLintBear (no-undef-init): | | It's not necessary to initialize 'lastFormationTemplate' to undefined. binaries/data/mods/public/simulation/helpers/Commands.js |1594| » » var·closeClusters·=·undefined; | | [NORMAL] ESLintBear (no-undef-init): | | It's not necessary to initialize 'closeClusters' to undefined. binaries/data/mods/public/simulation/helpers/Commands.js |1611| » » for·(let·i·=·0;·i·<·clusters.length;·++i) | | [NORMAL] ESLintBear (no-shadow): | | 'i' is already declared in the upper scope. binaries/data/mods/public/simulation/helpers/Commands.js |1625| » » for·(let·i·=·0;·i·<·matrix.length;·++i) | | [NORMAL] ESLintBear (no-shadow): | | 'i' is already declared in the upper scope. binaries/data/mods/public/simulation/helpers/Commands.js | 53| var·g_Commands·=·{ | | [NORMAL] JSHintBear: | | 'g_Commands' was used before it was defined. binaries/data/mods/public/simulation/helpers/Commands.js | 541| » » » » ····&&·player·!=·+cmd.owner) | | [NORMAL] JSHintBear: | | Misleading line break before '&&'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/helpers/Commands.js | 739| » » » » var·cmpGUIInterface·=·Engine.QueryInterface(SYSTEM_ENTITY,·IID_GuiInterface); | | [NORMAL] JSHintBear: | | 'cmpGUIInterface' is already defined. binaries/data/mods/public/simulation/helpers/Commands.js | 958| » » for·(var·i·=·0;·i·<·length;·++i) | | [NORMAL] JSHintBear: | | 'i' is already defined. binaries/data/mods/public/simulation/helpers/Commands.js | 971| » » var·count·=·0; | | [NORMAL] JSHintBear: | | 'count' is already defined. binaries/data/mods/public/simulation/helpers/Commands.js |1118| » » var·cmpGuiInterface·=·Engine.QueryInterface(SYSTEM_ENTITY,·IID_GuiInterface); | | [NORMAL] JSHintBear: | | 'cmpGuiInterface' is already defined. binaries/data/mods/public/simulation/helpers/Commands.js |1370| » » var·piece·=·pieces[j]; | | [NORMAL] JSHintBear: | | 'piece' is already defined. binaries/data/mods/public/simulation/helpers/Commands.js |1453| » » var·cmpUnitAI·=·Engine.QueryInterface(ent,·IID_UnitAI); | | [NORMAL] JSHintBear: | | 'cmpUnitAI' is already defined. binaries/data/mods/public/simulation/helpers/Commands.js |1492| » » » &&·cmpFormation.GetMemberCount()·==·formation.entities.length) | | [NORMAL] JSHintBear: | | Misleading line break before '&&'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/helpers/Commands.js |1518| » » » » » var·cmpUnitAI·=·Engine.QueryInterface(ent,·IID_UnitAI); | | [NORMAL] JSHintBear: | | 'cmpUnitAI' is already defined. binaries/data/mods/public/simulation/helpers/Commands.js |1551| » » » var·cmpFormation·=·Engine.QueryInterface(formationEnt,·IID_Formation); | | [NORMAL] JSHintBear: | | 'cmpFormation' is already defined. | | [NORMAL] ESLintBear (no-else-return): | | Unnecessary 'else' after 'return'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | 762| 762| this.FinishOrder(); | 763| 763| return; | 764| 764| } | 765| |- else | 766| |- { | | 765|+ | 767| 766| this.SetNextState("GARRISON.APPROACHING"); | 768| 767| return; | 769| |- } | | 768|+ | 770| 769| } | 771| 770| | 772| 771| this.SetNextState("GARRISON.GARRISONING"); | | [NORMAL] ESLintBear (key-spacing): | | Missing space before value for key 'GARRISON'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |1030|1030| }, |1031|1031| }, |1032|1032| |1033| |- "GARRISON":{ | |1033|+ "GARRISON": { |1034|1034| "enter": function() { |1035|1035| // If the garrisonholder should pickup, warn it so it can take needed action |1036|1036| var cmpGarrisonHolder = Engine.QueryInterface(this.order.data.target, IID_GarrisonHolder); | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |1979|1979| |1980|1980| "Attacked": function(msg) { |1981|1981| // If we are capturing and are attacked by something that we would not capture, attack that entity instead |1982| |- if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) |1983| |- && this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture") | |1982|+ if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) && | |1983|+ this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture") |1984|1984| this.RespondToTargetedEntities([msg.data.attacker]); |1985|1985| }, |1986|1986| }, | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |2674|2674| { |2675|2675| // The building was already finished/fully repaired before we arrived; |2676|2676| // let the ConstructionFinished handler handle this. |2677| |- this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget}); | |2677|+ this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget}); |2678|2678| return true; |2679|2679| } |2680|2680| | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |2674|2674| { |2675|2675| // The building was already finished/fully repaired before we arrived; |2676|2676| // let the ConstructionFinished handler handle this. |2677| |- this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget}); | |2677|+ this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget }); |2678|2678| return true; |2679|2679| } |2680|2680| | | [NORMAL] ESLintBear (indent): | | Expected indentation of 2 tabs but found 7. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3187|3187| "COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals |3188|3188| |3189|3189| "WALKING": "INDIVIDUAL.WALKING", // reuse the same walking behaviour for animals |3190| |- // only used for domestic animals | |3190|+ // only used for domestic animals |3191|3191| }, |3192|3192| }; |3193|3193| | | [NORMAL] ESLintBear (no-unneeded-ternary): | | Unnecessary use of boolean literals in conditional expression. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3247|3247| |3248|3248| UnitAI.prototype.IsAnimal = function() |3249|3249| { |3250| |- return (this.template.NaturalBehaviour ? true : false); | |3250|+ return (!!this.template.NaturalBehaviour); |3251|3251| }; |3252|3252| |3253|3253| UnitAI.prototype.IsDangerousAnimal = function() | | [NORMAL] ESLintBear (comma-spacing): | | A space is required after ','. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3363|3363| { |3364|3364| let index = this.GetCurrentState().indexOf("."); |3365|3365| if (index != -1) |3366| |- this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index)); | |3366|+ this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index)); |3367|3367| this.Stop(false); |3368|3368| } |3369|3369| | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3419|3419| if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity) |3420|3420| continue; |3421|3421| if (i == 0) |3422| |- this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg}); | |3422|+ this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg}); |3423|3423| else |3424|3424| this.orderQueue.splice(i, 1); |3425|3425| Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() }); | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3419|3419| if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity) |3420|3420| continue; |3421|3421| if (i == 0) |3422| |- this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg}); | |3422|+ this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg }); |3423|3423| else |3424|3424| this.orderQueue.splice(i, 1); |3425|3425| Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() }); | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3503|3503| }; |3504|3504| |3505|3505| |3506| |-//// FSM linkage functions //// | |3506|+// // FSM linkage functions //// |3507|3507| |3508|3508| // Setting the next state to the current state will leave/re-enter the top-most substate. |3509|3509| UnitAI.prototype.SetNextState = function(state) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3673|3673| continue; |3674|3674| if (this.orderQueue[i].type == type) |3675|3675| continue; |3676| |- this.orderQueue.splice(i, 0, {"type": type, "data": data}); | |3676|+ this.orderQueue.splice(i, 0, { "type": type, "data": data}); |3677|3677| Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() }); |3678|3678| return; |3679|3679| } | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3673|3673| continue; |3674|3674| if (this.orderQueue[i].type == type) |3675|3675| continue; |3676| |- this.orderQueue.splice(i, 0, {"type": type, "data": data}); | |3676|+ this.orderQueue.splice(i, 0, {"type": type, "data": data }); |3677|3677| Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() }); |3678|3678| return; |3679|3679| } | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3844|3844| if (data.timerRepeat === undefined) |3845|3845| this.timer = undefined; |3846|3846| |3847| |- this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness}); | |3847|+ this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness}); |3848|3848| }; |3849|3849| |3850|3850| /** | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3844|3844| if (data.timerRepeat === undefined) |3845|3845| this.timer = undefined; |3846|3846| |3847| |- this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness}); | |3847|+ this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness }); |3848|3848| }; |3849|3849| |3850|3850| /** | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3889|3889| // TODO: This is a bit inefficient since every unit listens to every |3890|3890| // construction message - ideally we could scope it to only the one we're building |3891|3891| |3892| |- this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg}); | |3892|+ this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg}); |3893|3893| }; |3894|3894| |3895|3895| UnitAI.prototype.OnGlobalEntityRenamed = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3889|3889| // TODO: This is a bit inefficient since every unit listens to every |3890|3890| // construction message - ideally we could scope it to only the one we're building |3891|3891| |3892| |- this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg}); | |3892|+ this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg }); |3893|3893| }; |3894|3894| |3895|3895| UnitAI.prototype.OnGlobalEntityRenamed = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3914|3914| |3915|3915| UnitAI.prototype.OnAttacked = function(msg) |3916|3916| { |3917| |- this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg}); | |3917|+ this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg}); |3918|3918| }; |3919|3919| |3920|3920| UnitAI.prototype.OnGuardedAttacked = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3914|3914| |3915|3915| UnitAI.prototype.OnAttacked = function(msg) |3916|3916| { |3917| |- this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg}); | |3917|+ this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg }); |3918|3918| }; |3919|3919| |3920|3920| UnitAI.prototype.OnGuardedAttacked = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3919|3919| |3920|3920| UnitAI.prototype.OnGuardedAttacked = function(msg) |3921|3921| { |3922| |- this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data}); | |3922|+ this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data}); |3923|3923| }; |3924|3924| |3925|3925| UnitAI.prototype.OnHealthChanged = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3919|3919| |3920|3920| UnitAI.prototype.OnGuardedAttacked = function(msg) |3921|3921| { |3922| |- this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data}); | |3922|+ this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data }); |3923|3923| }; |3924|3924| |3925|3925| UnitAI.prototype.OnHealthChanged = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3924|3924| |3925|3925| UnitAI.prototype.OnHealthChanged = function(msg) |3926|3926| { |3927| |- this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to}); | |3927|+ this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to}); |3928|3928| }; |3929|3929| |3930|3930| UnitAI.prototype.OnRangeUpdate = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3924|3924| |3925|3925| UnitAI.prototype.OnHealthChanged = function(msg) |3926|3926| { |3927| |- this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to}); | |3927|+ this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to }); |3928|3928| }; |3929|3929| |3930|3930| UnitAI.prototype.OnRangeUpdate = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3930|3930| UnitAI.prototype.OnRangeUpdate = function(msg) |3931|3931| { |3932|3932| if (msg.tag == this.losRangeQuery) |3933| |- this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg}); | |3933|+ this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg}); |3934|3934| else if (msg.tag == this.losHealRangeQuery) |3935|3935| this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg}); |3936|3936| }; | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3930|3930| UnitAI.prototype.OnRangeUpdate = function(msg) |3931|3931| { |3932|3932| if (msg.tag == this.losRangeQuery) |3933| |- this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg}); | |3933|+ this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg }); |3934|3934| else if (msg.tag == this.losHealRangeQuery) |3935|3935| this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg}); |3936|3936| }; | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3932|3932| if (msg.tag == this.losRangeQuery) |3933|3933| this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg}); |3934|3934| else if (msg.tag == this.losHealRangeQuery) |3935| |- this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg}); | |3935|+ this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg}); |3936|3936| }; |3937|3937| |3938|3938| UnitAI.prototype.OnPackFinished = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3932|3932| if (msg.tag == this.losRangeQuery) |3933|3933| this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg}); |3934|3934| else if (msg.tag == this.losHealRangeQuery) |3935| |- this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg}); | |3935|+ this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg }); |3936|3936| }; |3937|3937| |3938|3938| UnitAI.prototype.OnPackFinished = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3937|3937| |3938|3938| UnitAI.prototype.OnPackFinished = function(msg) |3939|3939| { |3940| |- this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed}); | |3940|+ this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed}); |3941|3941| }; |3942|3942| |3943|3943| //// Helper functions to be called by the FSM //// | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3937|3937| |3938|3938| UnitAI.prototype.OnPackFinished = function(msg) |3939|3939| { |3940| |- this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed}); | |3940|+ this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed }); |3941|3941| }; |3942|3942| |3943|3943| //// Helper functions to be called by the FSM //// | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3940|3940| this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed}); |3941|3941| }; |3942|3942| |3943| |-//// Helper functions to be called by the FSM //// | |3943|+// // Helper functions to be called by the FSM //// |3944|3944| |3945|3945| UnitAI.prototype.GetWalkSpeed = function() |3946|3946| { | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |4599|4599| UnitAI.prototype.AttackEntityInZone = function(ents) |4600|4600| { |4601|4601| var target = ents.find(target => |4602| |- this.CanAttack(target) |4603| |- && this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) | |4602|+ this.CanAttack(target) && | |4603|+ this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) |4604|4604| && (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target)) |4605|4605| ); |4606|4606| if (!target) | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |4600|4600| { |4601|4601| var target = ents.find(target => |4602|4602| this.CanAttack(target) |4603| |- && this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) |4604| |- && (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target)) | |4603|+ && this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) && | |4604|+ (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target)) |4605|4605| ); |4606|4606| if (!target) |4607|4607| return false; | | [NORMAL] ESLintBear (no-multi-spaces): | | Multiple spaces found before 'Engine'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |4664|4664| // If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker |4665|4665| if (this.isGuardOf) |4666|4666| { |4667| |- var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI); | |4667|+ var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI); |4668|4668| var cmpAttack = Engine.QueryInterface(target, IID_Attack); |4669|4669| if (cmpUnitAI && cmpAttack && |4670|4670| cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type))) | | [NORMAL] ESLintBear (indent): | | Expected indentation of 3 tabs but found 4. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |4668|4668| var cmpAttack = Engine.QueryInterface(target, IID_Attack); |4669|4669| if (cmpUnitAI && cmpAttack && |4670|4670| cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type))) |4671| |- return false; | |4671|+ return false; |4672|4672| } |4673|4673| |4674|4674| // Stop if we're in hold-ground mode and it's too far from the holding point | | [NORMAL] ESLintBear (no-multi-spaces): | | Multiple spaces found before 'Engine'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |4706|4706| // If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker |4707|4707| if (this.isGuardOf) |4708|4708| { |4709| |- let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI); | |4709|+ let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI); |4710|4710| let cmpAttack = Engine.QueryInterface(target, IID_Attack); |4711|4711| if (cmpUnitAI && cmpAttack && |4712|4712| cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type))) | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |4719|4719| return false; |4720|4720| }; |4721|4721| |4722| |-//// External interface functions //// | |4722|+// // External interface functions //// |4723|4723| |4724|4724| UnitAI.prototype.SetFormationController = function(ent) |4725|4725| { | | [NORMAL] ESLintBear (no-else-return): | | Unnecessary 'else' after 'return'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |4875|4875| { |4876|4876| if (this.isGuardOf == target && this.order && this.order.type == "Guard") |4877|4877| return; |4878| |- else |4879| |- this.RemoveGuard(); | |4878|+ this.RemoveGuard(); |4880|4879| } |4881|4880| |4882|4881| this.AddOrder("Guard", { "target": target, "force": false }, queued); | | [NORMAL] ESLintBear (no-trailing-spaces): | | Trailing spaces not allowed. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5207|5207| this.workOrders.length && this.workOrders[0].type == "Trade") |5208|5208| { |5209|5209| let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader); |5210| |- if (cmpTrader.HasBothMarkets() && | |5210|+ if (cmpTrader.HasBothMarkets() && |5211|5211| (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source || |5212|5212| cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target)) |5213|5213| { | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5488|5488| { |5489|5489| var cmpIdentity = Engine.QueryInterface(targ, IID_Identity); |5490|5490| var targetClasses = this.order.data.targetClasses; |5491| |- if (targetClasses.attack && cmpIdentity |5492| |- && !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack)) | |5491|+ if (targetClasses.attack && cmpIdentity && | |5492|+ !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack)) |5493|5493| continue; |5494|5494| if (targetClasses.avoid && cmpIdentity |5495|5495| && MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid)) | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5491|5491| if (targetClasses.attack && cmpIdentity |5492|5492| && !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack)) |5493|5493| continue; |5494| |- if (targetClasses.avoid && cmpIdentity |5495| |- && MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid)) | |5494|+ if (targetClasses.avoid && cmpIdentity && | |5495|+ MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid)) |5496|5496| continue; |5497|5497| // Only used by the AIs to prevent some choices of targets |5498|5498| if (targetClasses.vetoEntities && targetClasses.vetoEntities[targ]) | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5514|5514| { |5515|5515| var cmpIdentity = Engine.QueryInterface(targ, IID_Identity); |5516|5516| var targetClasses = this.order.data.targetClasses; |5517| |- if (cmpIdentity && targetClasses.attack |5518| |- && !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack)) | |5517|+ if (cmpIdentity && targetClasses.attack && | |5518|+ !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack)) |5519|5519| continue; |5520|5520| if (cmpIdentity && targetClasses.avoid |5521|5521| && MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid)) | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5517|5517| if (cmpIdentity && targetClasses.attack |5518|5518| && !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack)) |5519|5519| continue; |5520| |- if (cmpIdentity && targetClasses.avoid |5521| |- && MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid)) | |5520|+ if (cmpIdentity && targetClasses.avoid && | |5521|+ MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid)) |5522|5522| continue; |5523|5523| // Only used by the AIs to prevent some choices of targets |5524|5524| if (targetClasses.vetoEntities && targetClasses.vetoEntities[targ]) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5698|5698| |5699|5699| UnitAI.prototype.SetHeldPosition = function(x, z) |5700|5700| { |5701| |- this.heldPosition = {"x": x, "z": z}; | |5701|+ this.heldPosition = { "x": x, "z": z}; |5702|5702| }; |5703|5703| |5704|5704| UnitAI.prototype.SetHeldPositionOnEntity = function(entity) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5698|5698| |5699|5699| UnitAI.prototype.SetHeldPosition = function(x, z) |5700|5700| { |5701| |- this.heldPosition = {"x": x, "z": z}; | |5701|+ this.heldPosition = {"x": x, "z": z }; |5702|5702| }; |5703|5703| |5704|5704| UnitAI.prototype.SetHeldPositionOnEntity = function(entity) | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5725|5725| return false; |5726|5726| }; |5727|5727| |5728| |-//// Helper functions //// | |5728|+// // Helper functions //// |5729|5729| |5730|5730| UnitAI.prototype.CanAttack = function(target) |5731|5731| { | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5929|5929| return cmpPack && cmpPack.IsPacking(); |5930|5930| }; |5931|5931| |5932| |-//// Formation specific functions //// | |5932|+// // Formation specific functions //// |5933|5933| |5934|5934| UnitAI.prototype.IsAttackingAsFormation = function() |5935|5935| { | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5934|5934| UnitAI.prototype.IsAttackingAsFormation = function() |5935|5935| { |5936|5936| var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack); |5937| |- return cmpAttack && cmpAttack.CanAttackAsFormation() |5938| |- && this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING"; | |5937|+ return cmpAttack && cmpAttack.CanAttackAsFormation() && | |5938|+ this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING"; |5939|5939| }; |5940|5940| |5941|5941| //// Animal specific functions //// | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5938|5938| && this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING"; |5939|5939| }; |5940|5940| |5941| |-//// Animal specific functions //// | |5941|+// // Animal specific functions //// |5942|5942| |5943|5943| UnitAI.prototype.MoveRandomly = function(distance) |5944|5944| { binaries/data/mods/public/simulation/components/UnitAI.js | 331| » » » return·true; | | [NORMAL] ESLintBear (consistent-return): | | Method 'Order.WalkToTarget' expected no return value. binaries/data/mods/public/simulation/components/UnitAI.js | 917| » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js | 942| » » » "enter":·function(msg)·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js | 992| » » » » » return·true; | | [NORMAL] ESLintBear (consistent-return): | | Method 'enter' expected no return value. binaries/data/mods/public/simulation/components/UnitAI.js |1055| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |1091| » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |1123| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |1283| » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |1340| » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |1515| » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |1537| » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |1569| » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |1723| » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |1773| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |1851| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |2028| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |2131| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |2386| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |2419| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |2525| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |2591| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |2630| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |2841| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |3022| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |3749| » var·isWorkType·=·type·=>·type·==·"Gather"·||·type·==·"Trade"·||·type·==·"Repair"·||·type·==·"ReturnResource"; | | [NORMAL] ESLintBear (no-shadow): | | 'type' is already declared in the upper scope. binaries/data/mods/public/simulation/components/UnitAI.js |4586| » var·target·=·ents.find(target·=>·this.CanAttack(target)); | | [NORMAL] ESLintBear (no-shadow): | | 'target' is already declared in the upper scope. binaries/data/mods/public/simulation/components/UnitAI.js |4601| » var·target·=·ents.find(target·=> | | [NORMAL] ESLintBear (no-shadow): | | 'target' is already declared in the upper scope. binaries/data/mods/public/simulation/components/UnitAI.js |4647| » var·ent·=·ents.find(ent·=>·this.CanHeal(ent)); | | [NORMAL] ESLintBear (no-shadow): | | 'ent' is already declared in the upper scope. binaries/data/mods/public/simulation/components/UnitAI.js |4670| » » ····cmpAttack.GetAttackTypes().some(type·=>·cmpUnitAI.CheckTargetAttackRange(this.isGuardOf,·type))) | | [NORMAL] ESLintBear (no-shadow): | | 'type' is already declared in the upper scope. binaries/data/mods/public/simulation/components/UnitAI.js |5656| UnitAI.prototype.GetSelectableAttacks·=·function() | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of function. binaries/data/mods/public/simulation/components/UnitAI.js |1983| » » » » » » &&·this.order.data.target·!=·msg.data.attacker·&&·this.GetBestAttackAgainst(msg.data.attacker,·true)·!=·"Capture") | | [NORMAL] JSHintBear: | | Misleading line break before '&&'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/components/UnitAI.js |3711| » » var·order·=·{·"type":·type,·"data":·data·}; | | [NORMAL] JSHintBear: | | 'order' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |3780| » for·(var·i·=·0;·i·<·this.orderQueue.length;·++i) | | [NORMAL] JSHintBear: | | 'i' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |4603| » » &&·this.CheckTargetDistanceFromHeldPosition(target,·IID_Attack,·this.GetBestAttackAgainst(target,·true)) | | [NORMAL] JSHintBear: | | Misleading line break before '&&'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/components/UnitAI.js |4604| » » &&·(this.GetStance().respondChaseBeyondVision·||·this.CheckTargetIsInVisionRange(target)) | | [NORMAL] JSHintBear: | | Misleading line break before '&&'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/components/UnitAI.js |5492| » » » » » » &&·!MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.attack)) | | [NORMAL] JSHintBear: | | Misleading line break before '&&'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/components/UnitAI.js |5495| » » » » » » &&·MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.avoid)) | | [NORMAL] JSHintBear: | | Misleading line break before '&&'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/components/UnitAI.js |5508| » var·targets·=·this.GetTargetsFromUnit(); | | [NORMAL] JSHintBear: | | 'targets' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5509| » for·(var·targ·of·targets) | | [NORMAL] JSHintBear: | | 'targ' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5515| » » » var·cmpIdentity·=·Engine.QueryInterface(targ,·IID_Identity); | | [NORMAL] JSHintBear: | | 'cmpIdentity' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5516| » » » var·targetClasses·=·this.order.data.targetClasses; | | [NORMAL] JSHintBear: | | 'targetClasses' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5518| » » » » &&·!MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.attack)) | | [NORMAL] JSHintBear: | | Misleading line break before '&&'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/components/UnitAI.js |5521| » » » » &&·MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.avoid)) | | [NORMAL] JSHintBear: | | Misleading line break before '&&'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/components/UnitAI.js |5596| » » var·cmpVision·=·Engine.QueryInterface(this.entity,·IID_Vision); | | [NORMAL] JSHintBear: | | 'cmpVision' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5599| » » var·range·=·cmpVision.GetRange(); | | [NORMAL] JSHintBear: | | 'range' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5604| » » var·cmpRanged·=·Engine.QueryInterface(this.entity,·iid); | | [NORMAL] JSHintBear: | | 'cmpRanged' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5607| » » var·range·=·iid·!==·IID_Attack·?·cmpRanged.GetRange()·:·cmpRanged.GetFullAttackRange(); | | [NORMAL] JSHintBear: | | 'range' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5608| » » var·cmpVision·=·Engine.QueryInterface(this.entity,·IID_Vision); | | [NORMAL] JSHintBear: | | 'cmpVision' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5618| » » var·cmpVision·=·Engine.QueryInterface(this.entity,·IID_Vision); | | [NORMAL] JSHintBear: | | 'cmpVision' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5621| » » var·range·=·cmpVision.GetRange(); | | [NORMAL] JSHintBear: | | 'range' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5938| » » &&·this.GetCurrentState()·==·"FORMATIONCONTROLLER.COMBAT.ATTACKING"; | | [NORMAL] JSHintBear: | | Misleading line break before '&&'; readers may interpret this as an expression boundary. Executing section cli...
Link to build: https://jenkins.wildfiregames.com/job/docker-differential/289/display/redirect
- Allow preferred types buildings.
- Do not show when only one attack type is available.
Successful build - Chance fights ever on the side of the prudent.
Linter detected issues: Executing section Source... Executing section JS... | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/Attack.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Attack.js | 535| 535| | 536| 536| let horizSpeed = +this.template[type].Projectile.Speed; | 537| 537| let gravity = +this.template[type].Projectile.Gravity; | 538| |- //horizSpeed /= 2; gravity /= 2; // slow it down for testing | | 538|+ // horizSpeed /= 2; gravity /= 2; // slow it down for testing | 539| 539| | 540| 540| let cmpPosition = Engine.QueryInterface(this.entity, IID_Position); | 541| 541| if (!cmpPosition || !cmpPosition.IsInWorld()) | | [NORMAL] ESLintBear (no-trailing-spaces): | | Trailing spaces not allowed. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/Attack.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Attack.js | 582| 582| // TODO: Use unit rotation to implement x/z offsets. | 583| 583| let deltaLaunchPoint = new Vector3D(0, this.template[type].Projectile.LaunchPoint["@y"], 0.0); | 584| 584| let launchPoint = Vector3D.add(selfPosition, deltaLaunchPoint); | 585| |- | | 585|+ | 586| 586| let cmpVisual = Engine.QueryInterface(this.entity, IID_Visual); | 587| 587| if (cmpVisual) | 588| 588| { binaries/data/mods/public/simulation/components/Attack.js | 525| ·» 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 | 629| » » cmpTimer.SetTimeout(SYSTEM_ENTITY,·IID_Damage,·"MissileHit",·timeToTarget·*·1000·+·+this.template[type].Delay,·data); | | [NORMAL] JSHintBear: | | Confusing plusses. | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/BuildingAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/BuildingAI.js | 1| |-//Number of rounds of firing per 2 seconds | | 1|+// Number of rounds of firing per 2 seconds | 2| 2| const roundCount = 10; | 3| 3| | 4| 4| function BuildingAI() {} | | [NORMAL] ESLintBear (indent): | | Expected indentation of 2 tabs but found 3. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/BuildingAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/BuildingAI.js | 130| 130| | 131| 131| let range = cmpAttack.GetFullAttackRange(); | 132| 132| this.enemyUnitsQuery = cmpRangeManager.CreateActiveParabolicQuery( | 133| |- this.entity, range.min, range.max, range.elevationBonus, | | 133|+ this.entity, range.min, range.max, range.elevationBonus, | 134| 134| enemies, IID_DamageReceiver, cmpRangeManager.GetEntityFlagMask("normal")); | 135| 135| | 136| 136| cmpRangeManager.EnableActiveQuery(this.enemyUnitsQuery); | | [NORMAL] ESLintBear (indent): | | Expected indentation of 2 tabs but found 3. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/BuildingAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/BuildingAI.js | 131| 131| let range = cmpAttack.GetFullAttackRange(); | 132| 132| this.enemyUnitsQuery = cmpRangeManager.CreateActiveParabolicQuery( | 133| 133| this.entity, range.min, range.max, range.elevationBonus, | 134| |- enemies, IID_DamageReceiver, cmpRangeManager.GetEntityFlagMask("normal")); | | 134|+ enemies, IID_DamageReceiver, cmpRangeManager.GetEntityFlagMask("normal")); | 135| 135| | 136| 136| cmpRangeManager.EnableActiveQuery(this.enemyUnitsQuery); | 137| 137| }; | | [NORMAL] ESLintBear (indent): | | Expected indentation of 2 tabs but found 3. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/BuildingAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/BuildingAI.js | 159| 159| | 160| 160| // This query is only interested in Gaia entities that can attack. | 161| 161| this.gaiaUnitsQuery = cmpRangeManager.CreateActiveParabolicQuery( | 162| |- this.entity, range.min, range.max, range.elevationBonus, | | 162|+ this.entity, range.min, range.max, range.elevationBonus, | 163| 163| [0], IID_Attack, cmpRangeManager.GetEntityFlagMask("normal")); | 164| 164| | 165| 165| cmpRangeManager.EnableActiveQuery(this.gaiaUnitsQuery); | | [NORMAL] ESLintBear (indent): | | Expected indentation of 2 tabs but found 3. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/BuildingAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/BuildingAI.js | 160| 160| // This query is only interested in Gaia entities that can attack. | 161| 161| this.gaiaUnitsQuery = cmpRangeManager.CreateActiveParabolicQuery( | 162| 162| this.entity, range.min, range.max, range.elevationBonus, | 163| |- [0], IID_Attack, cmpRangeManager.GetEntityFlagMask("normal")); | | 163|+ [0], IID_Attack, cmpRangeManager.GetEntityFlagMask("normal")); | 164| 164| | 165| 165| cmpRangeManager.EnableActiveQuery(this.gaiaUnitsQuery); | 166| 166| }; binaries/data/mods/public/simulation/components/BuildingAI.js | 392| BuildingAI.prototype.GetSelectableAttacks·=·function() | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of function. | | [NORMAL] ESLintBear (space-before-function-paren): | | Unexpected space before function parentheses. |----| | /zpool0/trunk/binaries/data/mods/public/gui/session/selection_panels.js | |++++| /zpool0/trunk/binaries/data/mods/public/gui/session/selection_panels.js | 763| 763| addResearchToQueue(data.item.researchFacilityId, t); | 764| 764| })(tech); | 765| 765| | 766| |- button.onPressRight = (t => function () { | | 766|+ button.onPressRight = (t => function() { | 767| 767| showTemplateDetails( | 768| 768| t, | 769| 769| GetTemplateData(data.unitEntStates.find(state => state.id == data.item.researchFacilityId).template).nativeCiv); binaries/data/mods/public/gui/session/selection_panels.js | 48| » » » switch·(data.item) | | [NORMAL] ESLintBear (default-case): | | Expected a default case. binaries/data/mods/public/gui/session/selection_panels.js | 59| » » switch·(data.item) | | [NORMAL] ESLintBear (default-case): | | Expected a default case. binaries/data/mods/public/gui/session/selection_panels.js | 731| » » » » » » switch·(entity.check) | | [NORMAL] ESLintBear (default-case): | | Expected a default case. | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | 537| 537| if (cmpGarrisonHolder) | 538| 538| { | 539| 539| // Only the owner of the garrisonHolder may unload entities from any owners | 540| |- if (!IsOwnedByPlayer(player, garrisonHolder) && !data.controlAllUnits | 541| |- && player != +cmd.owner) | | 540|+ if (!IsOwnedByPlayer(player, garrisonHolder) && !data.controlAllUnits && | | 541|+ player != +cmd.owner) | 542| 542| continue; | 543| 543| | 544| 544| if (!cmpGarrisonHolder.UnloadTemplate(cmd.template, cmd.owner, cmd.all)) | | [NORMAL] ESLintBear (indent): | | Expected indentation of 5 tabs but found 6. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | 539| 539| // Only the owner of the garrisonHolder may unload entities from any owners | 540| 540| if (!IsOwnedByPlayer(player, garrisonHolder) && !data.controlAllUnits | 541| 541| && player != +cmd.owner) | 542| |- continue; | | 542|+ continue; | 543| 543| | 544| 544| if (!cmpGarrisonHolder.UnloadTemplate(cmd.template, cmd.owner, cmd.all)) | 545| 545| notifyUnloadFailure(player, garrisonHolder); | | [NORMAL] ESLintBear (key-spacing): | | Extra space after key 'metadata'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js |1156|1156| |1157|1157| // send Metadata info if any |1158|1158| if (cmd.metadata) |1159| |- Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player } ); | |1159|+ Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata": cmd.metadata, "owner" : player } ); |1160|1160| |1161|1161| // Tell the units to start building this new entity |1162|1162| if (cmd.autorepair) | | [NORMAL] ESLintBear (key-spacing): | | Extra space after key 'owner'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js |1156|1156| |1157|1157| // send Metadata info if any |1158|1158| if (cmd.metadata) |1159| |- Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player } ); | |1159|+ Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner": player } ); |1160|1160| |1161|1161| // Tell the units to start building this new entity |1162|1162| if (cmd.autorepair) | | [NORMAL] ESLintBear (space-in-parens): | | There should be no spaces inside this paren. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js |1156|1156| |1157|1157| // send Metadata info if any |1158|1158| if (cmd.metadata) |1159| |- Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player } ); | |1159|+ Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player }); |1160|1160| |1161|1161| // Tell the units to start building this new entity |1162|1162| if (cmd.autorepair) | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js |1264|1264| } |1265|1265| |1266|1266| lastTowerControlGroup = cmpSnappedStartObstruction.GetControlGroup(); |1267| |- //warn("setting lastTowerControlGroup to control group of start snapped entity " + cmd.startSnappedEntity + ": " + lastTowerControlGroup); | |1267|+ // warn("setting lastTowerControlGroup to control group of start snapped entity " + cmd.startSnappedEntity + ": " + lastTowerControlGroup); |1268|1268| } |1269|1269| |1270|1270| var i = 0; | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js |1328|1328| |1329|1329| if (i > 0) |1330|1330| { |1331| |- //warn(" updating previous wall piece's secondary control group to " + newTowerControlGroup); | |1331|+ // warn(" updating previous wall piece's secondary control group to " + newTowerControlGroup); |1332|1332| var cmpPreviousObstruction = Engine.QueryInterface(pieces[i-1].ent, IID_Obstruction); |1333|1333| // TODO: ensure that cmpPreviousObstruction exists |1334|1334| // TODO: ensure that the previous obstruction does not yet have a secondary control group set | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js |1491|1491| // Check that all its members are selected |1492|1492| var fid = formationIds[0]; |1493|1493| var cmpFormation = Engine.QueryInterface(+fid, IID_Formation); |1494| |- if (cmpFormation && cmpFormation.GetMemberCount() == formation.members[fid].length |1495| |- && cmpFormation.GetMemberCount() == formation.entities.length) | |1494|+ if (cmpFormation && cmpFormation.GetMemberCount() == formation.members[fid].length && | |1495|+ cmpFormation.GetMemberCount() == formation.entities.length) |1496|1496| { |1497|1497| cmpFormation.DeleteTwinFormations(); |1498|1498| // The whole formation was selected, so reuse its controller for this command | | [NORMAL] ESLintBear (comma-spacing): | | A space is required after ','. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js |1599|1599| for (var i = matrix.length - 1; i >= 0 && !closeClusters; --i) |1600|1600| for (var j = i - 1; j >= 0 && !closeClusters; --j) |1601|1601| if (matrix[i][j] < distSq) |1602| |- closeClusters = [i,j]; | |1602|+ closeClusters = [i, j]; |1603|1603| |1604|1604| // if no more close clusters found, just return all found clusters so far |1605|1605| if (!closeClusters) | | [NORMAL] ESLintBear (comma-spacing): | | A space is required after ','. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js |1621|1621| } |1622|1622| // remove the rows and columns in the matrix for the merged clusters, |1623|1623| // and the clusters themselves from the cluster list |1624| |- clusters.splice(closeClusters[0],1); | |1624|+ clusters.splice(closeClusters[0], 1); |1625|1625| clusters.splice(closeClusters[1],1); |1626|1626| matrix.splice(closeClusters[0],1); |1627|1627| matrix.splice(closeClusters[1],1); | | [NORMAL] ESLintBear (comma-spacing): | | A space is required after ','. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js |1622|1622| // remove the rows and columns in the matrix for the merged clusters, |1623|1623| // and the clusters themselves from the cluster list |1624|1624| clusters.splice(closeClusters[0],1); |1625| |- clusters.splice(closeClusters[1],1); | |1625|+ clusters.splice(closeClusters[1], 1); |1626|1626| matrix.splice(closeClusters[0],1); |1627|1627| matrix.splice(closeClusters[1],1); |1628|1628| for (let i = 0; i < matrix.length; ++i) | | [NORMAL] ESLintBear (comma-spacing): | | A space is required after ','. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js |1623|1623| // and the clusters themselves from the cluster list |1624|1624| clusters.splice(closeClusters[0],1); |1625|1625| clusters.splice(closeClusters[1],1); |1626| |- matrix.splice(closeClusters[0],1); | |1626|+ matrix.splice(closeClusters[0], 1); |1627|1627| matrix.splice(closeClusters[1],1); |1628|1628| for (let i = 0; i < matrix.length; ++i) |1629|1629| { | | [NORMAL] ESLintBear (comma-spacing): | | A space is required after ','. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js |1624|1624| clusters.splice(closeClusters[0],1); |1625|1625| clusters.splice(closeClusters[1],1); |1626|1626| matrix.splice(closeClusters[0],1); |1627| |- matrix.splice(closeClusters[1],1); | |1627|+ matrix.splice(closeClusters[1], 1); |1628|1628| for (let i = 0; i < matrix.length; ++i) |1629|1629| { |1630|1630| if (matrix[i].length > closeClusters[0]) | | [NORMAL] ESLintBear (comma-spacing): | | A space is required after ','. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js |1628|1628| for (let i = 0; i < matrix.length; ++i) |1629|1629| { |1630|1630| if (matrix[i].length > closeClusters[0]) |1631| |- matrix[i].splice(closeClusters[0],1); | |1631|+ matrix[i].splice(closeClusters[0], 1); |1632|1632| if (matrix[i].length > closeClusters[1]) |1633|1633| matrix[i].splice(closeClusters[1],1); |1634|1634| } | | [NORMAL] ESLintBear (comma-spacing): | | A space is required after ','. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js |1630|1630| if (matrix[i].length > closeClusters[0]) |1631|1631| matrix[i].splice(closeClusters[0],1); |1632|1632| if (matrix[i].length > closeClusters[1]) |1633| |- matrix[i].splice(closeClusters[1],1); | |1633|+ matrix[i].splice(closeClusters[1], 1); |1634|1634| } |1635|1635| // add a new row of distances to the matrix and the new cluster |1636|1636| clusters.push(newCluster); binaries/data/mods/public/simulation/helpers/Commands.js | 43| » if·(g_Commands[cmd.type]) | | [MAJOR] ESLintBear (no-use-before-define): | | 'g_Commands' was used before it was defined. binaries/data/mods/public/simulation/helpers/Commands.js | 47| » » g_Commands[cmd.type](player,·cmd,·data); | | [MAJOR] ESLintBear (no-use-before-define): | | 'g_Commands' was used before it was defined. binaries/data/mods/public/simulation/helpers/Commands.js | 802| » » let·ent·=·pickRandom(cmpRangeManager.GetEntitiesByPlayer(cmd.player).filter(ent·=>·{ | | [NORMAL] ESLintBear (no-shadow): | | 'ent' is already declared in the upper scope. binaries/data/mods/public/simulation/helpers/Commands.js |1287| ····» » » error("[TryConstructWall]·Expected·last·tower·control·group·to·be·available,·none·found·(1st·pass,·iteration·"·+·i·+·")"); | | [NORMAL] ESLintBear (no-mixed-spaces-and-tabs): | | Mixed spaces and tabs. binaries/data/mods/public/simulation/helpers/Commands.js |1288| ····» » » break; | | [NORMAL] ESLintBear (no-mixed-spaces-and-tabs): | | Mixed spaces and tabs. binaries/data/mods/public/simulation/helpers/Commands.js |1518| » » » » var·lastFormationTemplate·=·undefined; | | [NORMAL] ESLintBear (no-undef-init): | | It's not necessary to initialize 'lastFormationTemplate' to undefined. binaries/data/mods/public/simulation/helpers/Commands.js |1597| » » var·closeClusters·=·undefined; | | [NORMAL] ESLintBear (no-undef-init): | | It's not necessary to initialize 'closeClusters' to undefined. binaries/data/mods/public/simulation/helpers/Commands.js |1614| » » for·(let·i·=·0;·i·<·clusters.length;·++i) | | [NORMAL] ESLintBear (no-shadow): | | 'i' is already declared in the upper scope. binaries/data/mods/public/simulation/helpers/Commands.js |1628| » » for·(let·i·=·0;·i·<·matrix.length;·++i) | | [NORMAL] ESLintBear (no-shadow): | | 'i' is already declared in the upper scope. binaries/data/mods/public/simulation/helpers/Commands.js | 53| var·g_Commands·=·{ | | [NORMAL] JSHintBear: | | 'g_Commands' was used before it was defined. binaries/data/mods/public/simulation/helpers/Commands.js | 541| » » » » ····&&·player·!=·+cmd.owner) | | [NORMAL] JSHintBear: | | Misleading line break before '&&'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/helpers/Commands.js | 742| » » » » var·cmpGUIInterface·=·Engine.QueryInterface(SYSTEM_ENTITY,·IID_GuiInterface); | | [NORMAL] JSHintBear: | | 'cmpGUIInterface' is already defined. binaries/data/mods/public/simulation/helpers/Commands.js | 961| » » for·(var·i·=·0;·i·<·length;·++i) | | [NORMAL] JSHintBear: | | 'i' is already defined. binaries/data/mods/public/simulation/helpers/Commands.js | 974| » » var·count·=·0; | | [NORMAL] JSHintBear: | | 'count' is already defined. binaries/data/mods/public/simulation/helpers/Commands.js |1121| » » var·cmpGuiInterface·=·Engine.QueryInterface(SYSTEM_ENTITY,·IID_GuiInterface); | | [NORMAL] JSHintBear: | | 'cmpGuiInterface' is already defined. binaries/data/mods/public/simulation/helpers/Commands.js |1373| » » var·piece·=·pieces[j]; | | [NORMAL] JSHintBear: | | 'piece' is already defined. binaries/data/mods/public/simulation/helpers/Commands.js |1456| » » var·cmpUnitAI·=·Engine.QueryInterface(ent,·IID_UnitAI); | | [NORMAL] JSHintBear: | | 'cmpUnitAI' is already defined. binaries/data/mods/public/simulation/helpers/Commands.js |1495| » » » &&·cmpFormation.GetMemberCount()·==·formation.entities.length) | | [NORMAL] JSHintBear: | | Misleading line break before '&&'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/helpers/Commands.js |1521| » » » » » var·cmpUnitAI·=·Engine.QueryInterface(ent,·IID_UnitAI); | | [NORMAL] JSHintBear: | | 'cmpUnitAI' is already defined. binaries/data/mods/public/simulation/helpers/Commands.js |1554| » » » var·cmpFormation·=·Engine.QueryInterface(formationEnt,·IID_Formation); | | [NORMAL] JSHintBear: | | 'cmpFormation' is already defined. | | [NORMAL] ESLintBear (no-else-return): | | Unnecessary 'else' after 'return'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | 762| 762| this.FinishOrder(); | 763| 763| return; | 764| 764| } | 765| |- else | 766| |- { | | 765|+ | 767| 766| this.SetNextState("GARRISON.APPROACHING"); | 768| 767| return; | 769| |- } | | 768|+ | 770| 769| } | 771| 770| | 772| 771| this.SetNextState("GARRISON.GARRISONING"); | | [NORMAL] ESLintBear (key-spacing): | | Missing space before value for key 'GARRISON'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |1030|1030| }, |1031|1031| }, |1032|1032| |1033| |- "GARRISON":{ | |1033|+ "GARRISON": { |1034|1034| "enter": function() { |1035|1035| // If the garrisonholder should pickup, warn it so it can take needed action |1036|1036| var cmpGarrisonHolder = Engine.QueryInterface(this.order.data.target, IID_GarrisonHolder); | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |1979|1979| |1980|1980| "Attacked": function(msg) { |1981|1981| // If we are capturing and are attacked by something that we would not capture, attack that entity instead |1982| |- if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) |1983| |- && this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture") | |1982|+ if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) && | |1983|+ this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture") |1984|1984| this.RespondToTargetedEntities([msg.data.attacker]); |1985|1985| }, |1986|1986| }, | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |2674|2674| { |2675|2675| // The building was already finished/fully repaired before we arrived; |2676|2676| // let the ConstructionFinished handler handle this. |2677| |- this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget}); | |2677|+ this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget}); |2678|2678| return true; |2679|2679| } |2680|2680| | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |2674|2674| { |2675|2675| // The building was already finished/fully repaired before we arrived; |2676|2676| // let the ConstructionFinished handler handle this. |2677| |- this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget}); | |2677|+ this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget }); |2678|2678| return true; |2679|2679| } |2680|2680| | | [NORMAL] ESLintBear (indent): | | Expected indentation of 2 tabs but found 7. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3187|3187| "COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals |3188|3188| |3189|3189| "WALKING": "INDIVIDUAL.WALKING", // reuse the same walking behaviour for animals |3190| |- // only used for domestic animals | |3190|+ // only used for domestic animals |3191|3191| }, |3192|3192| }; |3193|3193| | | [NORMAL] ESLintBear (no-unneeded-ternary): | | Unnecessary use of boolean literals in conditional expression. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3246|3246| |3247|3247| UnitAI.prototype.IsAnimal = function() |3248|3248| { |3249| |- return (this.template.NaturalBehaviour ? true : false); | |3249|+ return (!!this.template.NaturalBehaviour); |3250|3250| }; |3251|3251| |3252|3252| UnitAI.prototype.IsDangerousAnimal = function() | | [NORMAL] ESLintBear (comma-spacing): | | A space is required after ','. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3362|3362| { |3363|3363| let index = this.GetCurrentState().indexOf("."); |3364|3364| if (index != -1) |3365| |- this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index)); | |3365|+ this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index)); |3366|3366| this.Stop(false); |3367|3367| } |3368|3368| | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3418|3418| if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity) |3419|3419| continue; |3420|3420| if (i == 0) |3421| |- this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg}); | |3421|+ this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg}); |3422|3422| else |3423|3423| this.orderQueue.splice(i, 1); |3424|3424| Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() }); | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3418|3418| if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity) |3419|3419| continue; |3420|3420| if (i == 0) |3421| |- this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg}); | |3421|+ this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg }); |3422|3422| else |3423|3423| this.orderQueue.splice(i, 1); |3424|3424| Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() }); | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3502|3502| }; |3503|3503| |3504|3504| |3505| |-//// FSM linkage functions //// | |3505|+// // FSM linkage functions //// |3506|3506| |3507|3507| // Setting the next state to the current state will leave/re-enter the top-most substate. |3508|3508| UnitAI.prototype.SetNextState = function(state) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3672|3672| continue; |3673|3673| if (this.orderQueue[i].type == type) |3674|3674| continue; |3675| |- this.orderQueue.splice(i, 0, {"type": type, "data": data}); | |3675|+ this.orderQueue.splice(i, 0, { "type": type, "data": data}); |3676|3676| Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() }); |3677|3677| return; |3678|3678| } | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3672|3672| continue; |3673|3673| if (this.orderQueue[i].type == type) |3674|3674| continue; |3675| |- this.orderQueue.splice(i, 0, {"type": type, "data": data}); | |3675|+ this.orderQueue.splice(i, 0, {"type": type, "data": data }); |3676|3676| Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() }); |3677|3677| return; |3678|3678| } | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3843|3843| if (data.timerRepeat === undefined) |3844|3844| this.timer = undefined; |3845|3845| |3846| |- this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness}); | |3846|+ this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness}); |3847|3847| }; |3848|3848| |3849|3849| /** | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3843|3843| if (data.timerRepeat === undefined) |3844|3844| this.timer = undefined; |3845|3845| |3846| |- this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness}); | |3846|+ this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness }); |3847|3847| }; |3848|3848| |3849|3849| /** | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3888|3888| // TODO: This is a bit inefficient since every unit listens to every |3889|3889| // construction message - ideally we could scope it to only the one we're building |3890|3890| |3891| |- this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg}); | |3891|+ this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg}); |3892|3892| }; |3893|3893| |3894|3894| UnitAI.prototype.OnGlobalEntityRenamed = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3888|3888| // TODO: This is a bit inefficient since every unit listens to every |3889|3889| // construction message - ideally we could scope it to only the one we're building |3890|3890| |3891| |- this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg}); | |3891|+ this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg }); |3892|3892| }; |3893|3893| |3894|3894| UnitAI.prototype.OnGlobalEntityRenamed = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3913|3913| |3914|3914| UnitAI.prototype.OnAttacked = function(msg) |3915|3915| { |3916| |- this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg}); | |3916|+ this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg}); |3917|3917| }; |3918|3918| |3919|3919| UnitAI.prototype.OnGuardedAttacked = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3913|3913| |3914|3914| UnitAI.prototype.OnAttacked = function(msg) |3915|3915| { |3916| |- this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg}); | |3916|+ this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg }); |3917|3917| }; |3918|3918| |3919|3919| UnitAI.prototype.OnGuardedAttacked = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3918|3918| |3919|3919| UnitAI.prototype.OnGuardedAttacked = function(msg) |3920|3920| { |3921| |- this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data}); | |3921|+ this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data}); |3922|3922| }; |3923|3923| |3924|3924| UnitAI.prototype.OnHealthChanged = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3918|3918| |3919|3919| UnitAI.prototype.OnGuardedAttacked = function(msg) |3920|3920| { |3921| |- this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data}); | |3921|+ this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data }); |3922|3922| }; |3923|3923| |3924|3924| UnitAI.prototype.OnHealthChanged = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3923|3923| |3924|3924| UnitAI.prototype.OnHealthChanged = function(msg) |3925|3925| { |3926| |- this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to}); | |3926|+ this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to}); |3927|3927| }; |3928|3928| |3929|3929| UnitAI.prototype.OnRangeUpdate = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3923|3923| |3924|3924| UnitAI.prototype.OnHealthChanged = function(msg) |3925|3925| { |3926| |- this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to}); | |3926|+ this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to }); |3927|3927| }; |3928|3928| |3929|3929| UnitAI.prototype.OnRangeUpdate = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3929|3929| UnitAI.prototype.OnRangeUpdate = function(msg) |3930|3930| { |3931|3931| if (msg.tag == this.losRangeQuery) |3932| |- this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg}); | |3932|+ this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg}); |3933|3933| else if (msg.tag == this.losHealRangeQuery) |3934|3934| this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg}); |3935|3935| }; | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3929|3929| UnitAI.prototype.OnRangeUpdate = function(msg) |3930|3930| { |3931|3931| if (msg.tag == this.losRangeQuery) |3932| |- this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg}); | |3932|+ this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg }); |3933|3933| else if (msg.tag == this.losHealRangeQuery) |3934|3934| this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg}); |3935|3935| }; | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3931|3931| if (msg.tag == this.losRangeQuery) |3932|3932| this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg}); |3933|3933| else if (msg.tag == this.losHealRangeQuery) |3934| |- this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg}); | |3934|+ this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg}); |3935|3935| }; |3936|3936| |3937|3937| UnitAI.prototype.OnPackFinished = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3931|3931| if (msg.tag == this.losRangeQuery) |3932|3932| this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg}); |3933|3933| else if (msg.tag == this.losHealRangeQuery) |3934| |- this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg}); | |3934|+ this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg }); |3935|3935| }; |3936|3936| |3937|3937| UnitAI.prototype.OnPackFinished = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3936|3936| |3937|3937| UnitAI.prototype.OnPackFinished = function(msg) |3938|3938| { |3939| |- this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed}); | |3939|+ this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed}); |3940|3940| }; |3941|3941| |3942|3942| //// Helper functions to be called by the FSM //// | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3936|3936| |3937|3937| UnitAI.prototype.OnPackFinished = function(msg) |3938|3938| { |3939| |- this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed}); | |3939|+ this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed }); |3940|3940| }; |3941|3941| |3942|3942| //// Helper functions to be called by the FSM //// | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3939|3939| this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed}); |3940|3940| }; |3941|3941| |3942| |-//// Helper functions to be called by the FSM //// | |3942|+// // Helper functions to be called by the FSM //// |3943|3943| |3944|3944| UnitAI.prototype.GetWalkSpeed = function() |3945|3945| { | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |4598|4598| UnitAI.prototype.AttackEntityInZone = function(ents) |4599|4599| { |4600|4600| var target = ents.find(target => |4601| |- this.CanAttack(target) |4602| |- && this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) | |4601|+ this.CanAttack(target) && | |4602|+ this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) |4603|4603| && (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target)) |4604|4604| ); |4605|4605| if (!target) | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |4599|4599| { |4600|4600| var target = ents.find(target => |4601|4601| this.CanAttack(target) |4602| |- && this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) |4603| |- && (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target)) | |4602|+ && this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) && | |4603|+ (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target)) |4604|4604| ); |4605|4605| if (!target) |4606|4606| return false; | | [NORMAL] ESLintBear (no-multi-spaces): | | Multiple spaces found before 'Engine'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |4663|4663| // If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker |4664|4664| if (this.isGuardOf) |4665|4665| { |4666| |- var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI); | |4666|+ var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI); |4667|4667| var cmpAttack = Engine.QueryInterface(target, IID_Attack); |4668|4668| if (cmpUnitAI && cmpAttack && |4669|4669| cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type))) | | [NORMAL] ESLintBear (indent): | | Expected indentation of 3 tabs but found 4. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |4667|4667| var cmpAttack = Engine.QueryInterface(target, IID_Attack); |4668|4668| if (cmpUnitAI && cmpAttack && |4669|4669| cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type))) |4670| |- return false; | |4670|+ return false; |4671|4671| } |4672|4672| |4673|4673| // Stop if we're in hold-ground mode and it's too far from the holding point | | [NORMAL] ESLintBear (no-multi-spaces): | | Multiple spaces found before 'Engine'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |4705|4705| // If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker |4706|4706| if (this.isGuardOf) |4707|4707| { |4708| |- let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI); | |4708|+ let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI); |4709|4709| let cmpAttack = Engine.QueryInterface(target, IID_Attack); |4710|4710| if (cmpUnitAI && cmpAttack && |4711|4711| cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type))) | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |4718|4718| return false; |4719|4719| }; |4720|4720| |4721| |-//// External interface functions //// | |4721|+// // External interface functions //// |4722|4722| |4723|4723| UnitAI.prototype.SetFormationController = function(ent) |4724|4724| { | | [NORMAL] ESLintBear (no-else-return): | | Unnecessary 'else' after 'return'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |4874|4874| { |4875|4875| if (this.isGuardOf == target && this.order && this.order.type == "Guard") |4876|4876| return; |4877| |- else |4878| |- this.RemoveGuard(); | |4877|+ this.RemoveGuard(); |4879|4878| } |4880|4879| |4881|4880| this.AddOrder("Guard", { "target": target, "force": false }, queued); | | [NORMAL] ESLintBear (no-trailing-spaces): | | Trailing spaces not allowed. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5206|5206| this.workOrders.length && this.workOrders[0].type == "Trade") |5207|5207| { |5208|5208| let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader); |5209| |- if (cmpTrader.HasBothMarkets() && | |5209|+ if (cmpTrader.HasBothMarkets() && |5210|5210| (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source || |5211|5211| cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target)) |5212|5212| { | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5487|5487| { |5488|5488| var cmpIdentity = Engine.QueryInterface(targ, IID_Identity); |5489|5489| var targetClasses = this.order.data.targetClasses; |5490| |- if (targetClasses.attack && cmpIdentity |5491| |- && !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack)) | |5490|+ if (targetClasses.attack && cmpIdentity && | |5491|+ !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack)) |5492|5492| continue; |5493|5493| if (targetClasses.avoid && cmpIdentity |5494|5494| && MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid)) | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5490|5490| if (targetClasses.attack && cmpIdentity |5491|5491| && !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack)) |5492|5492| continue; |5493| |- if (targetClasses.avoid && cmpIdentity |5494| |- && MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid)) | |5493|+ if (targetClasses.avoid && cmpIdentity && | |5494|+ MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid)) |5495|5495| continue; |5496|5496| // Only used by the AIs to prevent some choices of targets |5497|5497| if (targetClasses.vetoEntities && targetClasses.vetoEntities[targ]) | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5513|5513| { |5514|5514| var cmpIdentity = Engine.QueryInterface(targ, IID_Identity); |5515|5515| var targetClasses = this.order.data.targetClasses; |5516| |- if (cmpIdentity && targetClasses.attack |5517| |- && !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack)) | |5516|+ if (cmpIdentity && targetClasses.attack && | |5517|+ !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack)) |5518|5518| continue; |5519|5519| if (cmpIdentity && targetClasses.avoid |5520|5520| && MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid)) | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5516|5516| if (cmpIdentity && targetClasses.attack |5517|5517| && !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack)) |5518|5518| continue; |5519| |- if (cmpIdentity && targetClasses.avoid |5520| |- && MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid)) | |5519|+ if (cmpIdentity && targetClasses.avoid && | |5520|+ MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid)) |5521|5521| continue; |5522|5522| // Only used by the AIs to prevent some choices of targets |5523|5523| if (targetClasses.vetoEntities && targetClasses.vetoEntities[targ]) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5697|5697| |5698|5698| UnitAI.prototype.SetHeldPosition = function(x, z) |5699|5699| { |5700| |- this.heldPosition = {"x": x, "z": z}; | |5700|+ this.heldPosition = { "x": x, "z": z}; |5701|5701| }; |5702|5702| |5703|5703| UnitAI.prototype.SetHeldPositionOnEntity = function(entity) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5697|5697| |5698|5698| UnitAI.prototype.SetHeldPosition = function(x, z) |5699|5699| { |5700| |- this.heldPosition = {"x": x, "z": z}; | |5700|+ this.heldPosition = {"x": x, "z": z }; |5701|5701| }; |5702|5702| |5703|5703| UnitAI.prototype.SetHeldPositionOnEntity = function(entity) | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5724|5724| return false; |5725|5725| }; |5726|5726| |5727| |-//// Helper functions //// | |5727|+// // Helper functions //// |5728|5728| |5729|5729| UnitAI.prototype.CanAttack = function(target) |5730|5730| { | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5928|5928| return cmpPack && cmpPack.IsPacking(); |5929|5929| }; |5930|5930| |5931| |-//// Formation specific functions //// | |5931|+// // Formation specific functions //// |5932|5932| |5933|5933| UnitAI.prototype.IsAttackingAsFormation = function() |5934|5934| { | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5933|5933| UnitAI.prototype.IsAttackingAsFormation = function() |5934|5934| { |5935|5935| var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack); |5936| |- return cmpAttack && cmpAttack.CanAttackAsFormation() |5937| |- && this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING"; | |5936|+ return cmpAttack && cmpAttack.CanAttackAsFormation() && | |5937|+ this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING"; |5938|5938| }; |5939|5939| |5940|5940| //// Animal specific functions //// | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5937|5937| && this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING"; |5938|5938| }; |5939|5939| |5940| |-//// Animal specific functions //// | |5940|+// // Animal specific functions //// |5941|5941| |5942|5942| UnitAI.prototype.MoveRandomly = function(distance) |5943|5943| { binaries/data/mods/public/simulation/components/UnitAI.js | 331| » » » return·true; | | [NORMAL] ESLintBear (consistent-return): | | Method 'Order.WalkToTarget' expected no return value. binaries/data/mods/public/simulation/components/UnitAI.js | 917| » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js | 942| » » » "enter":·function(msg)·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js | 992| » » » » » return·true; | | [NORMAL] ESLintBear (consistent-return): | | Method 'enter' expected no return value. binaries/data/mods/public/simulation/components/UnitAI.js |1055| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |1091| » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |1123| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |1283| » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |1340| » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |1515| » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |1537| » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |1569| » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |1723| » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |1773| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |1851| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |2028| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |2131| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |2386| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |2419| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |2525| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |2591| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |2630| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |2841| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |3022| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |3748| » var·isWorkType·=·type·=>·type·==·"Gather"·||·type·==·"Trade"·||·type·==·"Repair"·||·type·==·"ReturnResource"; | | [NORMAL] ESLintBear (no-shadow): | | 'type' is already declared in the upper scope. binaries/data/mods/public/simulation/components/UnitAI.js |4585| » var·target·=·ents.find(target·=>·this.CanAttack(target)); | | [NORMAL] ESLintBear (no-shadow): | | 'target' is already declared in the upper scope. binaries/data/mods/public/simulation/components/UnitAI.js |4600| » var·target·=·ents.find(target·=> | | [NORMAL] ESLintBear (no-shadow): | | 'target' is already declared in the upper scope. binaries/data/mods/public/simulation/components/UnitAI.js |4646| » var·ent·=·ents.find(ent·=>·this.CanHeal(ent)); | | [NORMAL] ESLintBear (no-shadow): | | 'ent' is already declared in the upper scope. binaries/data/mods/public/simulation/components/UnitAI.js |4669| » » ····cmpAttack.GetAttackTypes().some(type·=>·cmpUnitAI.CheckTargetAttackRange(this.isGuardOf,·type))) | | [NORMAL] ESLintBear (no-shadow): | | 'type' is already declared in the upper scope. binaries/data/mods/public/simulation/components/UnitAI.js |5655| UnitAI.prototype.GetSelectableAttacks·=·function() | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of function. binaries/data/mods/public/simulation/components/UnitAI.js |1983| » » » » » » &&·this.order.data.target·!=·msg.data.attacker·&&·this.GetBestAttackAgainst(msg.data.attacker,·true)·!=·"Capture") | | [NORMAL] JSHintBear: | | Misleading line break before '&&'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/components/UnitAI.js |3710| » » var·order·=·{·"type":·type,·"data":·data·}; | | [NORMAL] JSHintBear: | | 'order' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |3779| » for·(var·i·=·0;·i·<·this.orderQueue.length;·++i) | | [NORMAL] JSHintBear: | | 'i' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |4602| » » &&·this.CheckTargetDistanceFromHeldPosition(target,·IID_Attack,·this.GetBestAttackAgainst(target,·true)) | | [NORMAL] JSHintBear: | | Misleading line break before '&&'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/components/UnitAI.js |4603| » » &&·(this.GetStance().respondChaseBeyondVision·||·this.CheckTargetIsInVisionRange(target)) | | [NORMAL] JSHintBear: | | Misleading line break before '&&'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/components/UnitAI.js |5491| » » » » » » &&·!MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.attack)) | | [NORMAL] JSHintBear: | | Misleading line break before '&&'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/components/UnitAI.js |5494| » » » » » » &&·MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.avoid)) | | [NORMAL] JSHintBear: | | Misleading line break before '&&'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/components/UnitAI.js |5507| » var·targets·=·this.GetTargetsFromUnit(); | | [NORMAL] JSHintBear: | | 'targets' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5508| » for·(var·targ·of·targets) | | [NORMAL] JSHintBear: | | 'targ' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5514| » » » var·cmpIdentity·=·Engine.QueryInterface(targ,·IID_Identity); | | [NORMAL] JSHintBear: | | 'cmpIdentity' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5515| » » » var·targetClasses·=·this.order.data.targetClasses; | | [NORMAL] JSHintBear: | | 'targetClasses' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5517| » » » » &&·!MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.attack)) | | [NORMAL] JSHintBear: | | Misleading line break before '&&'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/components/UnitAI.js |5520| » » » » &&·MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.avoid)) | | [NORMAL] JSHintBear: | | Misleading line break before '&&'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/components/UnitAI.js |5595| » » var·cmpVision·=·Engine.QueryInterface(this.entity,·IID_Vision); | | [NORMAL] JSHintBear: | | 'cmpVision' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5598| » » var·range·=·cmpVision.GetRange(); | | [NORMAL] JSHintBear: | | 'range' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5603| » » var·cmpRanged·=·Engine.QueryInterface(this.entity,·iid); | | [NORMAL] JSHintBear: | | 'cmpRanged' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5606| » » var·range·=·iid·!==·IID_Attack·?·cmpRanged.GetRange()·:·cmpRanged.GetFullAttackRange(); | | [NORMAL] JSHintBear: | | 'range' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5607| » » var·cmpVision·=·Engine.QueryInterface(this.entity,·IID_Vision); | | [NORMAL] JSHintBear: | | 'cmpVision' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5617| » » var·cmpVision·=·Engine.QueryInterface(this.entity,·IID_Vision); | | [NORMAL] JSHintBear: | | 'cmpVision' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5620| » » var·range·=·cmpVision.GetRange(); | | [NORMAL] JSHintBear: | | 'range' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5937| » » &&·this.GetCurrentState()·==·"FORMATIONCONTROLLER.COMBAT.ATTACKING"; | | [NORMAL] JSHintBear: | | Misleading line break before '&&'; readers may interpret this as an expression boundary. | | [NORMAL] ESLintBear (indent): | | Expected indentation of 2 tabs but found 3. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js | 810| 810| updateEntityColor(data.showAllStatusBars && (i == player || player == -1) ? | 811| 811| [IID_Minimap, IID_RangeOverlayRenderer, IID_RallyPointRenderer, IID_StatusBars] : | 812| 812| [IID_Minimap, IID_RangeOverlayRenderer, IID_RallyPointRenderer], | 813| |- cmpRangeManager.GetEntitiesByPlayer(i)); | | 813|+ cmpRangeManager.GetEntitiesByPlayer(i)); | 814| 814| } | 815| 815| updateEntityColor([IID_Selectable, IID_StatusBars], data.selected); | 816| 816| Engine.QueryInterface(SYSTEM_ENTITY, IID_TerritoryManager).UpdateColors(); | | [NORMAL] ESLintBear (indent): | | Expected indentation of 5 tabs but found 6. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js |1643|1643| { |1644|1644| minDist2 = dist2; |1645|1645| minDistEntitySnapData = { |1646| |- "x": pos.x, | |1646|+ "x": pos.x, |1647|1647| "z": pos.z, |1648|1648| "angle": cmpPosition.GetRotation().y, |1649|1649| "ent": ent | | [NORMAL] ESLintBear (indent): | | Expected indentation of 5 tabs but found 6. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js |1644|1644| minDist2 = dist2; |1645|1645| minDistEntitySnapData = { |1646|1646| "x": pos.x, |1647| |- "z": pos.z, | |1647|+ "z": pos.z, |1648|1648| "angle": cmpPosition.GetRotation().y, |1649|1649| "ent": ent |1650|1650| }; | | [NORMAL] ESLintBear (indent): | | Expected indentation of 5 tabs but found 6. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js |1645|1645| minDistEntitySnapData = { |1646|1646| "x": pos.x, |1647|1647| "z": pos.z, |1648| |- "angle": cmpPosition.GetRotation().y, | |1648|+ "angle": cmpPosition.GetRotation().y, |1649|1649| "ent": ent |1650|1650| }; |1651|1651| } | | [NORMAL] ESLintBear (indent): | | Expected indentation of 5 tabs but found 6. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js |1646|1646| "x": pos.x, |1647|1647| "z": pos.z, |1648|1648| "angle": cmpPosition.GetRotation().y, |1649| |- "ent": ent | |1649|+ "ent": ent |1650|1650| }; |1651|1651| } |1652|1652| } Executing section cli...
Link to build: https://jenkins.wildfiregames.com/job/docker-differential/292/display/redirect
binaries/data/mods/public/gui/session/selection_panels.js | ||
---|---|---|
927 | 5 | |
936–938 | Slow. | |
949 | font tag. | |
binaries/data/mods/public/gui/session/selection_panels_helpers.js | ||
90–123 | Can be generalised. | |
binaries/data/mods/public/gui/session/selection_panels_left/attack_panel.xml | ||
10 | 5 | |
binaries/data/mods/public/simulation/components/GuiInterface.js | ||
758 | some | |
binaries/data/mods/public/simulation/components/UnitAI.js | ||
5647 | I'm not entirely sure the message is needed? |
- Max number of items: 5.
- Removed support for BuildingAI, since that needs a lot more changes to be valid.
- Switched switch to non-switch in selection_panels_helpers.js.
- .some(...) in IsPrefAttackSelected.
binaries/data/mods/public/gui/session/selection_panels.js | ||
---|---|---|
936–938 |
But attack types should be hardcoded then? | |
949 | Ought to be done in the entire file, out of scope I would say? | |
955 |
Suggestions? | |
binaries/data/mods/public/simulation/components/UnitAI.js | ||
5647 | It is, for if we are attacking using ranged and the owner wants us to run after a fleeing target instead of missing 9/10 due to the range (s)he can set our preferred attack type to melee and we need to comply immediately. |
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 3 tabs but found 2. |----| | /zpool0/trunk/binaries/data/mods/public/gui/session/selection_panels_helpers.js | |++++| /zpool0/trunk/binaries/data/mods/public/gui/session/selection_panels_helpers.js | 95| 95| }); | 96| 96| text.tooltip = name == "Default" ? translate("Let the unit decide.") : | 97| 97| sprintf(translate("Prefer %(name)s attack."), { | 98| |- "name": translateWithContext("attack type", name) | | 98|+ "name": translateWithContext("attack type", name) | 99| 99| }); | 100| 100| return text; | 101| 101| } | | [NORMAL] ESLintBear (indent): | | Expected indentation of 2 tabs but found 1. |----| | /zpool0/trunk/binaries/data/mods/public/gui/session/selection_panels_helpers.js | |++++| /zpool0/trunk/binaries/data/mods/public/gui/session/selection_panels_helpers.js | 96| 96| text.tooltip = name == "Default" ? translate("Let the unit decide.") : | 97| 97| sprintf(translate("Prefer %(name)s attack."), { | 98| 98| "name": translateWithContext("attack type", name) | 99| |- }); | | 99|+ }); | 100| 100| return text; | 101| 101| } | 102| 102| | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | 537| 537| if (cmpGarrisonHolder) | 538| 538| { | 539| 539| // Only the owner of the garrisonHolder may unload entities from any owners | 540| |- if (!IsOwnedByPlayer(player, garrisonHolder) && !data.controlAllUnits | 541| |- && player != +cmd.owner) | | 540|+ if (!IsOwnedByPlayer(player, garrisonHolder) && !data.controlAllUnits && | | 541|+ player != +cmd.owner) | 542| 542| continue; | 543| 543| | 544| 544| if (!cmpGarrisonHolder.UnloadTemplate(cmd.template, cmd.owner, cmd.all)) | | [NORMAL] ESLintBear (indent): | | Expected indentation of 5 tabs but found 6. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | 539| 539| // Only the owner of the garrisonHolder may unload entities from any owners | 540| 540| if (!IsOwnedByPlayer(player, garrisonHolder) && !data.controlAllUnits | 541| 541| && player != +cmd.owner) | 542| |- continue; | | 542|+ continue; | 543| 543| | 544| 544| if (!cmpGarrisonHolder.UnloadTemplate(cmd.template, cmd.owner, cmd.all)) | 545| 545| notifyUnloadFailure(player, garrisonHolder); | | [NORMAL] ESLintBear (key-spacing): | | Extra space after key 'metadata'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js |1153|1153| |1154|1154| // send Metadata info if any |1155|1155| if (cmd.metadata) |1156| |- Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player } ); | |1156|+ Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata": cmd.metadata, "owner" : player } ); |1157|1157| |1158|1158| // Tell the units to start building this new entity |1159|1159| if (cmd.autorepair) | | [NORMAL] ESLintBear (key-spacing): | | Extra space after key 'owner'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js |1153|1153| |1154|1154| // send Metadata info if any |1155|1155| if (cmd.metadata) |1156| |- Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player } ); | |1156|+ Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner": player } ); |1157|1157| |1158|1158| // Tell the units to start building this new entity |1159|1159| if (cmd.autorepair) | | [NORMAL] ESLintBear (space-in-parens): | | There should be no spaces inside this paren. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js |1153|1153| |1154|1154| // send Metadata info if any |1155|1155| if (cmd.metadata) |1156| |- Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player } ); | |1156|+ Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player }); |1157|1157| |1158|1158| // Tell the units to start building this new entity |1159|1159| if (cmd.autorepair) | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js |1261|1261| } |1262|1262| |1263|1263| lastTowerControlGroup = cmpSnappedStartObstruction.GetControlGroup(); |1264| |- //warn("setting lastTowerControlGroup to control group of start snapped entity " + cmd.startSnappedEntity + ": " + lastTowerControlGroup); | |1264|+ // warn("setting lastTowerControlGroup to control group of start snapped entity " + cmd.startSnappedEntity + ": " + lastTowerControlGroup); |1265|1265| } |1266|1266| |1267|1267| var i = 0; | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js |1325|1325| |1326|1326| if (i > 0) |1327|1327| { |1328| |- //warn(" updating previous wall piece's secondary control group to " + newTowerControlGroup); | |1328|+ // warn(" updating previous wall piece's secondary control group to " + newTowerControlGroup); |1329|1329| var cmpPreviousObstruction = Engine.QueryInterface(pieces[i-1].ent, IID_Obstruction); |1330|1330| // TODO: ensure that cmpPreviousObstruction exists |1331|1331| // TODO: ensure that the previous obstruction does not yet have a secondary control group set | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js |1488|1488| // Check that all its members are selected |1489|1489| var fid = formationIds[0]; |1490|1490| var cmpFormation = Engine.QueryInterface(+fid, IID_Formation); |1491| |- if (cmpFormation && cmpFormation.GetMemberCount() == formation.members[fid].length |1492| |- && cmpFormation.GetMemberCount() == formation.entities.length) | |1491|+ if (cmpFormation && cmpFormation.GetMemberCount() == formation.members[fid].length && | |1492|+ cmpFormation.GetMemberCount() == formation.entities.length) |1493|1493| { |1494|1494| cmpFormation.DeleteTwinFormations(); |1495|1495| // The whole formation was selected, so reuse its controller for this command | | [NORMAL] ESLintBear (comma-spacing): | | A space is required after ','. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js |1596|1596| for (var i = matrix.length - 1; i >= 0 && !closeClusters; --i) |1597|1597| for (var j = i - 1; j >= 0 && !closeClusters; --j) |1598|1598| if (matrix[i][j] < distSq) |1599| |- closeClusters = [i,j]; | |1599|+ closeClusters = [i, j]; |1600|1600| |1601|1601| // if no more close clusters found, just return all found clusters so far |1602|1602| if (!closeClusters) | | [NORMAL] ESLintBear (comma-spacing): | | A space is required after ','. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js |1618|1618| } |1619|1619| // remove the rows and columns in the matrix for the merged clusters, |1620|1620| // and the clusters themselves from the cluster list |1621| |- clusters.splice(closeClusters[0],1); | |1621|+ clusters.splice(closeClusters[0], 1); |1622|1622| clusters.splice(closeClusters[1],1); |1623|1623| matrix.splice(closeClusters[0],1); |1624|1624| matrix.splice(closeClusters[1],1); | | [NORMAL] ESLintBear (comma-spacing): | | A space is required after ','. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js |1619|1619| // remove the rows and columns in the matrix for the merged clusters, |1620|1620| // and the clusters themselves from the cluster list |1621|1621| clusters.splice(closeClusters[0],1); |1622| |- clusters.splice(closeClusters[1],1); | |1622|+ clusters.splice(closeClusters[1], 1); |1623|1623| matrix.splice(closeClusters[0],1); |1624|1624| matrix.splice(closeClusters[1],1); |1625|1625| for (let i = 0; i < matrix.length; ++i) | | [NORMAL] ESLintBear (comma-spacing): | | A space is required after ','. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js |1620|1620| // and the clusters themselves from the cluster list |1621|1621| clusters.splice(closeClusters[0],1); |1622|1622| clusters.splice(closeClusters[1],1); |1623| |- matrix.splice(closeClusters[0],1); | |1623|+ matrix.splice(closeClusters[0], 1); |1624|1624| matrix.splice(closeClusters[1],1); |1625|1625| for (let i = 0; i < matrix.length; ++i) |1626|1626| { | | [NORMAL] ESLintBear (comma-spacing): | | A space is required after ','. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js |1621|1621| clusters.splice(closeClusters[0],1); |1622|1622| clusters.splice(closeClusters[1],1); |1623|1623| matrix.splice(closeClusters[0],1); |1624| |- matrix.splice(closeClusters[1],1); | |1624|+ matrix.splice(closeClusters[1], 1); |1625|1625| for (let i = 0; i < matrix.length; ++i) |1626|1626| { |1627|1627| if (matrix[i].length > closeClusters[0]) | | [NORMAL] ESLintBear (comma-spacing): | | A space is required after ','. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js |1625|1625| for (let i = 0; i < matrix.length; ++i) |1626|1626| { |1627|1627| if (matrix[i].length > closeClusters[0]) |1628| |- matrix[i].splice(closeClusters[0],1); | |1628|+ matrix[i].splice(closeClusters[0], 1); |1629|1629| if (matrix[i].length > closeClusters[1]) |1630|1630| matrix[i].splice(closeClusters[1],1); |1631|1631| } | | [NORMAL] ESLintBear (comma-spacing): | | A space is required after ','. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js |1627|1627| if (matrix[i].length > closeClusters[0]) |1628|1628| matrix[i].splice(closeClusters[0],1); |1629|1629| if (matrix[i].length > closeClusters[1]) |1630| |- matrix[i].splice(closeClusters[1],1); | |1630|+ matrix[i].splice(closeClusters[1], 1); |1631|1631| } |1632|1632| // add a new row of distances to the matrix and the new cluster |1633|1633| clusters.push(newCluster); binaries/data/mods/public/simulation/helpers/Commands.js | 43| » if·(g_Commands[cmd.type]) | | [MAJOR] ESLintBear (no-use-before-define): | | 'g_Commands' was used before it was defined. binaries/data/mods/public/simulation/helpers/Commands.js | 47| » » g_Commands[cmd.type](player,·cmd,·data); | | [MAJOR] ESLintBear (no-use-before-define): | | 'g_Commands' was used before it was defined. binaries/data/mods/public/simulation/helpers/Commands.js | 799| » » let·ent·=·pickRandom(cmpRangeManager.GetEntitiesByPlayer(cmd.player).filter(ent·=>·{ | | [NORMAL] ESLintBear (no-shadow): | | 'ent' is already declared in the upper scope. binaries/data/mods/public/simulation/helpers/Commands.js |1284| ····» » » error("[TryConstructWall]·Expected·last·tower·control·group·to·be·available,·none·found·(1st·pass,·iteration·"·+·i·+·")"); | | [NORMAL] ESLintBear (no-mixed-spaces-and-tabs): | | Mixed spaces and tabs. binaries/data/mods/public/simulation/helpers/Commands.js |1285| ····» » » break; | | [NORMAL] ESLintBear (no-mixed-spaces-and-tabs): | | Mixed spaces and tabs. binaries/data/mods/public/simulation/helpers/Commands.js |1515| » » » » var·lastFormationTemplate·=·undefined; | | [NORMAL] ESLintBear (no-undef-init): | | It's not necessary to initialize 'lastFormationTemplate' to undefined. binaries/data/mods/public/simulation/helpers/Commands.js |1594| » » var·closeClusters·=·undefined; | | [NORMAL] ESLintBear (no-undef-init): | | It's not necessary to initialize 'closeClusters' to undefined. binaries/data/mods/public/simulation/helpers/Commands.js |1611| » » for·(let·i·=·0;·i·<·clusters.length;·++i) | | [NORMAL] ESLintBear (no-shadow): | | 'i' is already declared in the upper scope. binaries/data/mods/public/simulation/helpers/Commands.js |1625| » » for·(let·i·=·0;·i·<·matrix.length;·++i) | | [NORMAL] ESLintBear (no-shadow): | | 'i' is already declared in the upper scope. binaries/data/mods/public/simulation/helpers/Commands.js | 53| var·g_Commands·=·{ | | [NORMAL] JSHintBear: | | 'g_Commands' was used before it was defined. binaries/data/mods/public/simulation/helpers/Commands.js | 541| » » » » ····&&·player·!=·+cmd.owner) | | [NORMAL] JSHintBear: | | Misleading line break before '&&'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/helpers/Commands.js | 739| » » » » var·cmpGUIInterface·=·Engine.QueryInterface(SYSTEM_ENTITY,·IID_GuiInterface); | | [NORMAL] JSHintBear: | | 'cmpGUIInterface' is already defined. binaries/data/mods/public/simulation/helpers/Commands.js | 958| » » for·(var·i·=·0;·i·<·length;·++i) | | [NORMAL] JSHintBear: | | 'i' is already defined. binaries/data/mods/public/simulation/helpers/Commands.js | 971| » » var·count·=·0; | | [NORMAL] JSHintBear: | | 'count' is already defined. binaries/data/mods/public/simulation/helpers/Commands.js |1118| » » var·cmpGuiInterface·=·Engine.QueryInterface(SYSTEM_ENTITY,·IID_GuiInterface); | | [NORMAL] JSHintBear: | | 'cmpGuiInterface' is already defined. binaries/data/mods/public/simulation/helpers/Commands.js |1370| » » var·piece·=·pieces[j]; | | [NORMAL] JSHintBear: | | 'piece' is already defined. binaries/data/mods/public/simulation/helpers/Commands.js |1453| » » var·cmpUnitAI·=·Engine.QueryInterface(ent,·IID_UnitAI); | | [NORMAL] JSHintBear: | | 'cmpUnitAI' is already defined. binaries/data/mods/public/simulation/helpers/Commands.js |1492| » » » &&·cmpFormation.GetMemberCount()·==·formation.entities.length) | | [NORMAL] JSHintBear: | | Misleading line break before '&&'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/helpers/Commands.js |1518| » » » » » var·cmpUnitAI·=·Engine.QueryInterface(ent,·IID_UnitAI); | | [NORMAL] JSHintBear: | | 'cmpUnitAI' is already defined. binaries/data/mods/public/simulation/helpers/Commands.js |1551| » » » var·cmpFormation·=·Engine.QueryInterface(formationEnt,·IID_Formation); | | [NORMAL] JSHintBear: | | 'cmpFormation' is already defined. | | [NORMAL] ESLintBear (space-before-function-paren): | | Unexpected space before function parentheses. |----| | /zpool0/trunk/binaries/data/mods/public/gui/session/selection_panels.js | |++++| /zpool0/trunk/binaries/data/mods/public/gui/session/selection_panels.js | 763| 763| addResearchToQueue(data.item.researchFacilityId, t); | 764| 764| })(tech); | 765| 765| | 766| |- button.onPressRight = (t => function () { | | 766|+ button.onPressRight = (t => function() { | 767| 767| showTemplateDetails( | 768| 768| t, | 769| 769| GetTemplateData(data.unitEntStates.find(state => state.id == data.item.researchFacilityId).template).nativeCiv); binaries/data/mods/public/gui/session/selection_panels.js | 48| » » » switch·(data.item) | | [NORMAL] ESLintBear (default-case): | | Expected a default case. binaries/data/mods/public/gui/session/selection_panels.js | 59| » » switch·(data.item) | | [NORMAL] ESLintBear (default-case): | | Expected a default case. binaries/data/mods/public/gui/session/selection_panels.js | 731| » » » » » » switch·(entity.check) | | [NORMAL] ESLintBear (default-case): | | Expected a default case. | | [NORMAL] ESLintBear (indent): | | Expected indentation of 2 tabs but found 3. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js | 804| 804| updateEntityColor(data.showAllStatusBars && (i == player || player == -1) ? | 805| 805| [IID_Minimap, IID_RangeOverlayRenderer, IID_RallyPointRenderer, IID_StatusBars] : | 806| 806| [IID_Minimap, IID_RangeOverlayRenderer, IID_RallyPointRenderer], | 807| |- cmpRangeManager.GetEntitiesByPlayer(i)); | | 807|+ cmpRangeManager.GetEntitiesByPlayer(i)); | 808| 808| } | 809| 809| updateEntityColor([IID_Selectable, IID_StatusBars], data.selected); | 810| 810| Engine.QueryInterface(SYSTEM_ENTITY, IID_TerritoryManager).UpdateColors(); | | [NORMAL] ESLintBear (indent): | | Expected indentation of 5 tabs but found 6. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js |1637|1637| { |1638|1638| minDist2 = dist2; |1639|1639| minDistEntitySnapData = { |1640| |- "x": pos.x, | |1640|+ "x": pos.x, |1641|1641| "z": pos.z, |1642|1642| "angle": cmpPosition.GetRotation().y, |1643|1643| "ent": ent | | [NORMAL] ESLintBear (indent): | | Expected indentation of 5 tabs but found 6. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js |1638|1638| minDist2 = dist2; |1639|1639| minDistEntitySnapData = { |1640|1640| "x": pos.x, |1641| |- "z": pos.z, | |1641|+ "z": pos.z, |1642|1642| "angle": cmpPosition.GetRotation().y, |1643|1643| "ent": ent |1644|1644| }; | | [NORMAL] ESLintBear (indent): | | Expected indentation of 5 tabs but found 6. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js |1639|1639| minDistEntitySnapData = { |1640|1640| "x": pos.x, |1641|1641| "z": pos.z, |1642| |- "angle": cmpPosition.GetRotation().y, | |1642|+ "angle": cmpPosition.GetRotation().y, |1643|1643| "ent": ent |1644|1644| }; |1645|1645| } | | [NORMAL] ESLintBear (indent): | | Expected indentation of 5 tabs but found 6. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js |1640|1640| "x": pos.x, |1641|1641| "z": pos.z, |1642|1642| "angle": cmpPosition.GetRotation().y, |1643| |- "ent": ent | |1643|+ "ent": ent |1644|1644| }; |1645|1645| } |1646|1646| } | | [NORMAL] ESLintBear (no-else-return): | | Unnecessary 'else' after 'return'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | 762| 762| this.FinishOrder(); | 763| 763| return; | 764| 764| } | 765| |- else | 766| |- { | | 765|+ | 767| 766| this.SetNextState("GARRISON.APPROACHING"); | 768| 767| return; | 769| |- } | | 768|+ | 770| 769| } | 771| 770| | 772| 771| this.SetNextState("GARRISON.GARRISONING"); | | [NORMAL] ESLintBear (key-spacing): | | Missing space before value for key 'GARRISON'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |1030|1030| }, |1031|1031| }, |1032|1032| |1033| |- "GARRISON":{ | |1033|+ "GARRISON": { |1034|1034| "enter": function() { |1035|1035| // If the garrisonholder should pickup, warn it so it can take needed action |1036|1036| var cmpGarrisonHolder = Engine.QueryInterface(this.order.data.target, IID_GarrisonHolder); | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |1979|1979| |1980|1980| "Attacked": function(msg) { |1981|1981| // If we are capturing and are attacked by something that we would not capture, attack that entity instead |1982| |- if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) |1983| |- && this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture") | |1982|+ if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) && | |1983|+ this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture") |1984|1984| this.RespondToTargetedEntities([msg.data.attacker]); |1985|1985| }, |1986|1986| }, | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |2674|2674| { |2675|2675| // The building was already finished/fully repaired before we arrived; |2676|2676| // let the ConstructionFinished handler handle this. |2677| |- this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget}); | |2677|+ this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget}); |2678|2678| return true; |2679|2679| } |2680|2680| | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |2674|2674| { |2675|2675| // The building was already finished/fully repaired before we arrived; |2676|2676| // let the ConstructionFinished handler handle this. |2677| |- this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget}); | |2677|+ this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget }); |2678|2678| return true; |2679|2679| } |2680|2680| | | [NORMAL] ESLintBear (indent): | | Expected indentation of 2 tabs but found 7. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3187|3187| "COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals |3188|3188| |3189|3189| "WALKING": "INDIVIDUAL.WALKING", // reuse the same walking behaviour for animals |3190| |- // only used for domestic animals | |3190|+ // only used for domestic animals |3191|3191| }, |3192|3192| }; |3193|3193| | | [NORMAL] ESLintBear (no-unneeded-ternary): | | Unnecessary use of boolean literals in conditional expression. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3245|3245| |3246|3246| UnitAI.prototype.IsAnimal = function() |3247|3247| { |3248| |- return (this.template.NaturalBehaviour ? true : false); | |3248|+ return (!!this.template.NaturalBehaviour); |3249|3249| }; |3250|3250| |3251|3251| UnitAI.prototype.IsDangerousAnimal = function() | | [NORMAL] ESLintBear (comma-spacing): | | A space is required after ','. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3361|3361| { |3362|3362| let index = this.GetCurrentState().indexOf("."); |3363|3363| if (index != -1) |3364| |- this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index)); | |3364|+ this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index)); |3365|3365| this.Stop(false); |3366|3366| } |3367|3367| | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3417|3417| if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity) |3418|3418| continue; |3419|3419| if (i == 0) |3420| |- this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg}); | |3420|+ this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg}); |3421|3421| else |3422|3422| this.orderQueue.splice(i, 1); |3423|3423| Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() }); | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3417|3417| if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity) |3418|3418| continue; |3419|3419| if (i == 0) |3420| |- this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg}); | |3420|+ this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg }); |3421|3421| else |3422|3422| this.orderQueue.splice(i, 1); |3423|3423| Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() }); | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3501|3501| }; |3502|3502| |3503|3503| |3504| |-//// FSM linkage functions //// | |3504|+// // FSM linkage functions //// |3505|3505| |3506|3506| // Setting the next state to the current state will leave/re-enter the top-most substate. |3507|3507| UnitAI.prototype.SetNextState = function(state) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3671|3671| continue; |3672|3672| if (this.orderQueue[i].type == type) |3673|3673| continue; |3674| |- this.orderQueue.splice(i, 0, {"type": type, "data": data}); | |3674|+ this.orderQueue.splice(i, 0, { "type": type, "data": data}); |3675|3675| Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() }); |3676|3676| return; |3677|3677| } | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3671|3671| continue; |3672|3672| if (this.orderQueue[i].type == type) |3673|3673| continue; |3674| |- this.orderQueue.splice(i, 0, {"type": type, "data": data}); | |3674|+ this.orderQueue.splice(i, 0, {"type": type, "data": data }); |3675|3675| Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() }); |3676|3676| return; |3677|3677| } | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3842|3842| if (data.timerRepeat === undefined) |3843|3843| this.timer = undefined; |3844|3844| |3845| |- this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness}); | |3845|+ this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness}); |3846|3846| }; |3847|3847| |3848|3848| /** | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3842|3842| if (data.timerRepeat === undefined) |3843|3843| this.timer = undefined; |3844|3844| |3845| |- this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness}); | |3845|+ this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness }); |3846|3846| }; |3847|3847| |3848|3848| /** | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3887|3887| // TODO: This is a bit inefficient since every unit listens to every |3888|3888| // construction message - ideally we could scope it to only the one we're building |3889|3889| |3890| |- this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg}); | |3890|+ this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg}); |3891|3891| }; |3892|3892| |3893|3893| UnitAI.prototype.OnGlobalEntityRenamed = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3887|3887| // TODO: This is a bit inefficient since every unit listens to every |3888|3888| // construction message - ideally we could scope it to only the one we're building |3889|3889| |3890| |- this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg}); | |3890|+ this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg }); |3891|3891| }; |3892|3892| |3893|3893| UnitAI.prototype.OnGlobalEntityRenamed = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3912|3912| |3913|3913| UnitAI.prototype.OnAttacked = function(msg) |3914|3914| { |3915| |- this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg}); | |3915|+ this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg}); |3916|3916| }; |3917|3917| |3918|3918| UnitAI.prototype.OnGuardedAttacked = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3912|3912| |3913|3913| UnitAI.prototype.OnAttacked = function(msg) |3914|3914| { |3915| |- this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg}); | |3915|+ this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg }); |3916|3916| }; |3917|3917| |3918|3918| UnitAI.prototype.OnGuardedAttacked = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3917|3917| |3918|3918| UnitAI.prototype.OnGuardedAttacked = function(msg) |3919|3919| { |3920| |- this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data}); | |3920|+ this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data}); |3921|3921| }; |3922|3922| |3923|3923| UnitAI.prototype.OnHealthChanged = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3917|3917| |3918|3918| UnitAI.prototype.OnGuardedAttacked = function(msg) |3919|3919| { |3920| |- this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data}); | |3920|+ this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data }); |3921|3921| }; |3922|3922| |3923|3923| UnitAI.prototype.OnHealthChanged = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3922|3922| |3923|3923| UnitAI.prototype.OnHealthChanged = function(msg) |3924|3924| { |3925| |- this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to}); | |3925|+ this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to}); |3926|3926| }; |3927|3927| |3928|3928| UnitAI.prototype.OnRangeUpdate = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3922|3922| |3923|3923| UnitAI.prototype.OnHealthChanged = function(msg) |3924|3924| { |3925| |- this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to}); | |3925|+ this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to }); |3926|3926| }; |3927|3927| |3928|3928| UnitAI.prototype.OnRangeUpdate = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3928|3928| UnitAI.prototype.OnRangeUpdate = function(msg) |3929|3929| { |3930|3930| if (msg.tag == this.losRangeQuery) |3931| |- this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg}); | |3931|+ this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg}); |3932|3932| else if (msg.tag == this.losHealRangeQuery) |3933|3933| this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg}); |3934|3934| }; | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3928|3928| UnitAI.prototype.OnRangeUpdate = function(msg) |3929|3929| { |3930|3930| if (msg.tag == this.losRangeQuery) |3931| |- this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg}); | |3931|+ this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg }); |3932|3932| else if (msg.tag == this.losHealRangeQuery) |3933|3933| this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg}); |3934|3934| }; | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3930|3930| if (msg.tag == this.losRangeQuery) |3931|3931| this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg}); |3932|3932| else if (msg.tag == this.losHealRangeQuery) |3933| |- this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg}); | |3933|+ this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg}); |3934|3934| }; |3935|3935| |3936|3936| UnitAI.prototype.OnPackFinished = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3930|3930| if (msg.tag == this.losRangeQuery) |3931|3931| this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg}); |3932|3932| else if (msg.tag == this.losHealRangeQuery) |3933| |- this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg}); | |3933|+ this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg }); |3934|3934| }; |3935|3935| |3936|3936| UnitAI.prototype.OnPackFinished = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3935|3935| |3936|3936| UnitAI.prototype.OnPackFinished = function(msg) |3937|3937| { |3938| |- this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed}); | |3938|+ this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed}); |3939|3939| }; |3940|3940| |3941|3941| //// Helper functions to be called by the FSM //// | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3935|3935| |3936|3936| UnitAI.prototype.OnPackFinished = function(msg) |3937|3937| { |3938| |- this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed}); | |3938|+ this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed }); |3939|3939| }; |3940|3940| |3941|3941| //// Helper functions to be called by the FSM //// | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3938|3938| this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed}); |3939|3939| }; |3940|3940| |3941| |-//// Helper functions to be called by the FSM //// | |3941|+// // Helper functions to be called by the FSM //// |3942|3942| |3943|3943| UnitAI.prototype.GetWalkSpeed = function() |3944|3944| { | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |4597|4597| UnitAI.prototype.AttackEntityInZone = function(ents) |4598|4598| { |4599|4599| var target = ents.find(target => |4600| |- this.CanAttack(target) |4601| |- && this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) | |4600|+ this.CanAttack(target) && | |4601|+ this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) |4602|4602| && (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target)) |4603|4603| ); |4604|4604| if (!target) | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |4598|4598| { |4599|4599| var target = ents.find(target => |4600|4600| this.CanAttack(target) |4601| |- && this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) |4602| |- && (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target)) | |4601|+ && this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) && | |4602|+ (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target)) |4603|4603| ); |4604|4604| if (!target) |4605|4605| return false; | | [NORMAL] ESLintBear (no-multi-spaces): | | Multiple spaces found before 'Engine'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |4662|4662| // If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker |4663|4663| if (this.isGuardOf) |4664|4664| { |4665| |- var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI); | |4665|+ var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI); |4666|4666| var cmpAttack = Engine.QueryInterface(target, IID_Attack); |4667|4667| if (cmpUnitAI && cmpAttack && |4668|4668| cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type))) | | [NORMAL] ESLintBear (indent): | | Expected indentation of 3 tabs but found 4. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |4666|4666| var cmpAttack = Engine.QueryInterface(target, IID_Attack); |4667|4667| if (cmpUnitAI && cmpAttack && |4668|4668| cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type))) |4669| |- return false; | |4669|+ return false; |4670|4670| } |4671|4671| |4672|4672| // Stop if we're in hold-ground mode and it's too far from the holding point | | [NORMAL] ESLintBear (no-multi-spaces): | | Multiple spaces found before 'Engine'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |4704|4704| // If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker |4705|4705| if (this.isGuardOf) |4706|4706| { |4707| |- let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI); | |4707|+ let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI); |4708|4708| let cmpAttack = Engine.QueryInterface(target, IID_Attack); |4709|4709| if (cmpUnitAI && cmpAttack && |4710|4710| cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type))) | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |4717|4717| return false; |4718|4718| }; |4719|4719| |4720| |-//// External interface functions //// | |4720|+// // External interface functions //// |4721|4721| |4722|4722| UnitAI.prototype.SetFormationController = function(ent) |4723|4723| { | | [NORMAL] ESLintBear (no-else-return): | | Unnecessary 'else' after 'return'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |4873|4873| { |4874|4874| if (this.isGuardOf == target && this.order && this.order.type == "Guard") |4875|4875| return; |4876| |- else |4877| |- this.RemoveGuard(); | |4876|+ this.RemoveGuard(); |4878|4877| } |4879|4878| |4880|4879| this.AddOrder("Guard", { "target": target, "force": false }, queued); | | [NORMAL] ESLintBear (no-trailing-spaces): | | Trailing spaces not allowed. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5205|5205| this.workOrders.length && this.workOrders[0].type == "Trade") |5206|5206| { |5207|5207| let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader); |5208| |- if (cmpTrader.HasBothMarkets() && | |5208|+ if (cmpTrader.HasBothMarkets() && |5209|5209| (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source || |5210|5210| cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target)) |5211|5211| { | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5486|5486| { |5487|5487| var cmpIdentity = Engine.QueryInterface(targ, IID_Identity); |5488|5488| var targetClasses = this.order.data.targetClasses; |5489| |- if (targetClasses.attack && cmpIdentity |5490| |- && !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack)) | |5489|+ if (targetClasses.attack && cmpIdentity && | |5490|+ !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack)) |5491|5491| continue; |5492|5492| if (targetClasses.avoid && cmpIdentity |5493|5493| && MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid)) | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5489|5489| if (targetClasses.attack && cmpIdentity |5490|5490| && !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack)) |5491|5491| continue; |5492| |- if (targetClasses.avoid && cmpIdentity |5493| |- && MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid)) | |5492|+ if (targetClasses.avoid && cmpIdentity && | |5493|+ MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid)) |5494|5494| continue; |5495|5495| // Only used by the AIs to prevent some choices of targets |5496|5496| if (targetClasses.vetoEntities && targetClasses.vetoEntities[targ]) | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5512|5512| { |5513|5513| var cmpIdentity = Engine.QueryInterface(targ, IID_Identity); |5514|5514| var targetClasses = this.order.data.targetClasses; |5515| |- if (cmpIdentity && targetClasses.attack |5516| |- && !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack)) | |5515|+ if (cmpIdentity && targetClasses.attack && | |5516|+ !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack)) |5517|5517| continue; |5518|5518| if (cmpIdentity && targetClasses.avoid |5519|5519| && MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid)) | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5515|5515| if (cmpIdentity && targetClasses.attack |5516|5516| && !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack)) |5517|5517| continue; |5518| |- if (cmpIdentity && targetClasses.avoid |5519| |- && MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid)) | |5518|+ if (cmpIdentity && targetClasses.avoid && | |5519|+ MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid)) |5520|5520| continue; |5521|5521| // Only used by the AIs to prevent some choices of targets |5522|5522| if (targetClasses.vetoEntities && targetClasses.vetoEntities[targ]) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5696|5696| |5697|5697| UnitAI.prototype.SetHeldPosition = function(x, z) |5698|5698| { |5699| |- this.heldPosition = {"x": x, "z": z}; | |5699|+ this.heldPosition = { "x": x, "z": z}; |5700|5700| }; |5701|5701| |5702|5702| UnitAI.prototype.SetHeldPositionOnEntity = function(entity) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5696|5696| |5697|5697| UnitAI.prototype.SetHeldPosition = function(x, z) |5698|5698| { |5699| |- this.heldPosition = {"x": x, "z": z}; | |5699|+ this.heldPosition = {"x": x, "z": z }; |5700|5700| }; |5701|5701| |5702|5702| UnitAI.prototype.SetHeldPositionOnEntity = function(entity) | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5723|5723| return false; |5724|5724| }; |5725|5725| |5726| |-//// Helper functions //// | |5726|+// // Helper functions //// |5727|5727| |5728|5728| UnitAI.prototype.CanAttack = function(target) |5729|5729| { | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5927|5927| return cmpPack && cmpPack.IsPacking(); |5928|5928| }; |5929|5929| |5930| |-//// Formation specific functions //// | |5930|+// // Formation specific functions //// |5931|5931| |5932|5932| UnitAI.prototype.IsAttackingAsFormation = function() |5933|5933| { | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5932|5932| UnitAI.prototype.IsAttackingAsFormation = function() |5933|5933| { |5934|5934| var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack); |5935| |- return cmpAttack && cmpAttack.CanAttackAsFormation() |5936| |- && this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING"; | |5935|+ return cmpAttack && cmpAttack.CanAttackAsFormation() && | |5936|+ this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING"; |5937|5937| }; |5938|5938| |5939|5939| //// Animal specific functions //// | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5936|5936| && this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING"; |5937|5937| }; |5938|5938| |5939| |-//// Animal specific functions //// | |5939|+// // Animal specific functions //// |5940|5940| |5941|5941| UnitAI.prototype.MoveRandomly = function(distance) |5942|5942| { binaries/data/mods/public/simulation/components/UnitAI.js | 331| » » » return·true; | | [NORMAL] ESLintBear (consistent-return): | | Method 'Order.WalkToTarget' expected no return value. binaries/data/mods/public/simulation/components/UnitAI.js | 917| » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js | 942| » » » "enter":·function(msg)·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js | 992| » » » » » return·true; | | [NORMAL] ESLintBear (consistent-return): | | Method 'enter' expected no return value. binaries/data/mods/public/simulation/components/UnitAI.js |1055| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |1091| » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |1123| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |1283| » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |1340| » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |1515| » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |1537| » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |1569| » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |1723| » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |1773| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |1851| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |2028| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |2131| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |2386| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |2419| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |2525| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |2591| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |2630| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |2841| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |3022| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |3747| » var·isWorkType·=·type·=>·type·==·"Gather"·||·type·==·"Trade"·||·type·==·"Repair"·||·type·==·"ReturnResource"; | | [NORMAL] ESLintBear (no-shadow): | | 'type' is already declared in the upper scope. binaries/data/mods/public/simulation/components/UnitAI.js |4584| » var·target·=·ents.find(target·=>·this.CanAttack(target)); | | [NORMAL] ESLintBear (no-shadow): | | 'target' is already declared in the upper scope. binaries/data/mods/public/simulation/components/UnitAI.js |4599| » var·target·=·ents.find(target·=> | | [NORMAL] ESLintBear (no-shadow): | | 'target' is already declared in the upper scope. binaries/data/mods/public/simulation/components/UnitAI.js |4645| » var·ent·=·ents.find(ent·=>·this.CanHeal(ent)); | | [NORMAL] ESLintBear (no-shadow): | | 'ent' is already declared in the upper scope. binaries/data/mods/public/simulation/components/UnitAI.js |4668| » » ····cmpAttack.GetAttackTypes().some(type·=>·cmpUnitAI.CheckTargetAttackRange(this.isGuardOf,·type))) | | [NORMAL] ESLintBear (no-shadow): | | 'type' is already declared in the upper scope. binaries/data/mods/public/simulation/components/UnitAI.js |5654| UnitAI.prototype.GetSelectableAttacks·=·function() | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of function. binaries/data/mods/public/simulation/components/UnitAI.js |1983| » » » » » » &&·this.order.data.target·!=·msg.data.attacker·&&·this.GetBestAttackAgainst(msg.data.attacker,·true)·!=·"Capture") | | [NORMAL] JSHintBear: | | Misleading line break before '&&'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/components/UnitAI.js |3709| » » var·order·=·{·"type":·type,·"data":·data·}; | | [NORMAL] JSHintBear: | | 'order' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |3778| » for·(var·i·=·0;·i·<·this.orderQueue.length;·++i) | | [NORMAL] JSHintBear: | | 'i' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |4601| » » &&·this.CheckTargetDistanceFromHeldPosition(target,·IID_Attack,·this.GetBestAttackAgainst(target,·true)) | | [NORMAL] JSHintBear: | | Misleading line break before '&&'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/components/UnitAI.js |4602| » » &&·(this.GetStance().respondChaseBeyondVision·||·this.CheckTargetIsInVisionRange(target)) | | [NORMAL] JSHintBear: | | Misleading line break before '&&'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/components/UnitAI.js |5490| » » » » » » &&·!MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.attack)) | | [NORMAL] JSHintBear: | | Misleading line break before '&&'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/components/UnitAI.js |5493| » » » » » » &&·MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.avoid)) | | [NORMAL] JSHintBear: | | Misleading line break before '&&'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/components/UnitAI.js |5506| » var·targets·=·this.GetTargetsFromUnit(); | | [NORMAL] JSHintBear: | | 'targets' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5507| » for·(var·targ·of·targets) | | [NORMAL] JSHintBear: | | 'targ' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5513| » » » var·cmpIdentity·=·Engine.QueryInterface(targ,·IID_Identity); | | [NORMAL] JSHintBear: | | 'cmpIdentity' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5514| » » » var·targetClasses·=·this.order.data.targetClasses; | | [NORMAL] JSHintBear: | | 'targetClasses' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5516| » » » » &&·!MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.attack)) | | [NORMAL] JSHintBear: | | Misleading line break before '&&'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/components/UnitAI.js |5519| » » » » &&·MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.avoid)) | | [NORMAL] JSHintBear: | | Misleading line break before '&&'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/components/UnitAI.js |5594| » » var·cmpVision·=·Engine.QueryInterface(this.entity,·IID_Vision); | | [NORMAL] JSHintBear: | | 'cmpVision' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5597| » » var·range·=·cmpVision.GetRange(); | | [NORMAL] JSHintBear: | | 'range' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5602| » » var·cmpRanged·=·Engine.QueryInterface(this.entity,·iid); | | [NORMAL] JSHintBear: | | 'cmpRanged' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5605| » » var·range·=·iid·!==·IID_Attack·?·cmpRanged.GetRange()·:·cmpRanged.GetFullAttackRange(); | | [NORMAL] JSHintBear: | | 'range' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5606| » » var·cmpVision·=·Engine.QueryInterface(this.entity,·IID_Vision); | | [NORMAL] JSHintBear: | | 'cmpVision' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5616| » » var·cmpVision·=·Engine.QueryInterface(this.entity,·IID_Vision); | | [NORMAL] JSHintBear: | | 'cmpVision' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5619| » » var·range·=·cmpVision.GetRange(); | | [NORMAL] JSHintBear: | | 'range' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5936| » » &&·this.GetCurrentState()·==·"FORMATIONCONTROLLER.COMBAT.ATTACKING"; | | [NORMAL] JSHintBear: | | Misleading line break before '&&'; readers may interpret this as an expression boundary. Executing section cli...
Link to build: https://jenkins.wildfiregames.com/job/docker-differential/320/display/redirect
binaries/data/mods/public/gui/session/selection_panels.js | ||
---|---|---|
936–938 | The items = items.concat-part takes ~10 μs per entity (using Engine.GetMicroseconds()) down to 6 or 7 when multiple entities are selected. |
Created a variable for unique templates in a selection, thus reducing the call time of g_SelectionPanels.PrefAttack.GetItems. This function can probably used for more functions, but that's out of scope.
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 3 tabs but found 2. |----| | /zpool0/trunk/binaries/data/mods/public/gui/session/selection_panels_helpers.js | |++++| /zpool0/trunk/binaries/data/mods/public/gui/session/selection_panels_helpers.js | 95| 95| }); | 96| 96| text.tooltip = name == "Default" ? translate("Let the unit decide.") : | 97| 97| sprintf(translate("Prefer %(name)s attack."), { | 98| |- "name": translateWithContext("attack type", name) | | 98|+ "name": translateWithContext("attack type", name) | 99| 99| }); | 100| 100| return text; | 101| 101| } | | [NORMAL] ESLintBear (indent): | | Expected indentation of 2 tabs but found 1. |----| | /zpool0/trunk/binaries/data/mods/public/gui/session/selection_panels_helpers.js | |++++| /zpool0/trunk/binaries/data/mods/public/gui/session/selection_panels_helpers.js | 96| 96| text.tooltip = name == "Default" ? translate("Let the unit decide.") : | 97| 97| sprintf(translate("Prefer %(name)s attack."), { | 98| 98| "name": translateWithContext("attack type", name) | 99| |- }); | | 99|+ }); | 100| 100| return text; | 101| 101| } | 102| 102| | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | 537| 537| if (cmpGarrisonHolder) | 538| 538| { | 539| 539| // Only the owner of the garrisonHolder may unload entities from any owners | 540| |- if (!IsOwnedByPlayer(player, garrisonHolder) && !data.controlAllUnits | 541| |- && player != +cmd.owner) | | 540|+ if (!IsOwnedByPlayer(player, garrisonHolder) && !data.controlAllUnits && | | 541|+ player != +cmd.owner) | 542| 542| continue; | 543| 543| | 544| 544| if (!cmpGarrisonHolder.UnloadTemplate(cmd.template, cmd.owner, cmd.all)) | | [NORMAL] ESLintBear (indent): | | Expected indentation of 5 tabs but found 6. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | 539| 539| // Only the owner of the garrisonHolder may unload entities from any owners | 540| 540| if (!IsOwnedByPlayer(player, garrisonHolder) && !data.controlAllUnits | 541| 541| && player != +cmd.owner) | 542| |- continue; | | 542|+ continue; | 543| 543| | 544| 544| if (!cmpGarrisonHolder.UnloadTemplate(cmd.template, cmd.owner, cmd.all)) | 545| 545| notifyUnloadFailure(player, garrisonHolder); | | [NORMAL] ESLintBear (key-spacing): | | Extra space after key 'metadata'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js |1153|1153| |1154|1154| // send Metadata info if any |1155|1155| if (cmd.metadata) |1156| |- Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player } ); | |1156|+ Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata": cmd.metadata, "owner" : player } ); |1157|1157| |1158|1158| // Tell the units to start building this new entity |1159|1159| if (cmd.autorepair) | | [NORMAL] ESLintBear (key-spacing): | | Extra space after key 'owner'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js |1153|1153| |1154|1154| // send Metadata info if any |1155|1155| if (cmd.metadata) |1156| |- Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player } ); | |1156|+ Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner": player } ); |1157|1157| |1158|1158| // Tell the units to start building this new entity |1159|1159| if (cmd.autorepair) | | [NORMAL] ESLintBear (space-in-parens): | | There should be no spaces inside this paren. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js |1153|1153| |1154|1154| // send Metadata info if any |1155|1155| if (cmd.metadata) |1156| |- Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player } ); | |1156|+ Engine.PostMessage(ent, MT_AIMetadata, { "id": ent, "metadata" : cmd.metadata, "owner" : player }); |1157|1157| |1158|1158| // Tell the units to start building this new entity |1159|1159| if (cmd.autorepair) | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js |1261|1261| } |1262|1262| |1263|1263| lastTowerControlGroup = cmpSnappedStartObstruction.GetControlGroup(); |1264| |- //warn("setting lastTowerControlGroup to control group of start snapped entity " + cmd.startSnappedEntity + ": " + lastTowerControlGroup); | |1264|+ // warn("setting lastTowerControlGroup to control group of start snapped entity " + cmd.startSnappedEntity + ": " + lastTowerControlGroup); |1265|1265| } |1266|1266| |1267|1267| var i = 0; | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js |1325|1325| |1326|1326| if (i > 0) |1327|1327| { |1328| |- //warn(" updating previous wall piece's secondary control group to " + newTowerControlGroup); | |1328|+ // warn(" updating previous wall piece's secondary control group to " + newTowerControlGroup); |1329|1329| var cmpPreviousObstruction = Engine.QueryInterface(pieces[i-1].ent, IID_Obstruction); |1330|1330| // TODO: ensure that cmpPreviousObstruction exists |1331|1331| // TODO: ensure that the previous obstruction does not yet have a secondary control group set | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js |1488|1488| // Check that all its members are selected |1489|1489| var fid = formationIds[0]; |1490|1490| var cmpFormation = Engine.QueryInterface(+fid, IID_Formation); |1491| |- if (cmpFormation && cmpFormation.GetMemberCount() == formation.members[fid].length |1492| |- && cmpFormation.GetMemberCount() == formation.entities.length) | |1491|+ if (cmpFormation && cmpFormation.GetMemberCount() == formation.members[fid].length && | |1492|+ cmpFormation.GetMemberCount() == formation.entities.length) |1493|1493| { |1494|1494| cmpFormation.DeleteTwinFormations(); |1495|1495| // The whole formation was selected, so reuse its controller for this command | | [NORMAL] ESLintBear (comma-spacing): | | A space is required after ','. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js |1596|1596| for (var i = matrix.length - 1; i >= 0 && !closeClusters; --i) |1597|1597| for (var j = i - 1; j >= 0 && !closeClusters; --j) |1598|1598| if (matrix[i][j] < distSq) |1599| |- closeClusters = [i,j]; | |1599|+ closeClusters = [i, j]; |1600|1600| |1601|1601| // if no more close clusters found, just return all found clusters so far |1602|1602| if (!closeClusters) | | [NORMAL] ESLintBear (comma-spacing): | | A space is required after ','. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js |1618|1618| } |1619|1619| // remove the rows and columns in the matrix for the merged clusters, |1620|1620| // and the clusters themselves from the cluster list |1621| |- clusters.splice(closeClusters[0],1); | |1621|+ clusters.splice(closeClusters[0], 1); |1622|1622| clusters.splice(closeClusters[1],1); |1623|1623| matrix.splice(closeClusters[0],1); |1624|1624| matrix.splice(closeClusters[1],1); | | [NORMAL] ESLintBear (comma-spacing): | | A space is required after ','. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js |1619|1619| // remove the rows and columns in the matrix for the merged clusters, |1620|1620| // and the clusters themselves from the cluster list |1621|1621| clusters.splice(closeClusters[0],1); |1622| |- clusters.splice(closeClusters[1],1); | |1622|+ clusters.splice(closeClusters[1], 1); |1623|1623| matrix.splice(closeClusters[0],1); |1624|1624| matrix.splice(closeClusters[1],1); |1625|1625| for (let i = 0; i < matrix.length; ++i) | | [NORMAL] ESLintBear (comma-spacing): | | A space is required after ','. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js |1620|1620| // and the clusters themselves from the cluster list |1621|1621| clusters.splice(closeClusters[0],1); |1622|1622| clusters.splice(closeClusters[1],1); |1623| |- matrix.splice(closeClusters[0],1); | |1623|+ matrix.splice(closeClusters[0], 1); |1624|1624| matrix.splice(closeClusters[1],1); |1625|1625| for (let i = 0; i < matrix.length; ++i) |1626|1626| { | | [NORMAL] ESLintBear (comma-spacing): | | A space is required after ','. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js |1621|1621| clusters.splice(closeClusters[0],1); |1622|1622| clusters.splice(closeClusters[1],1); |1623|1623| matrix.splice(closeClusters[0],1); |1624| |- matrix.splice(closeClusters[1],1); | |1624|+ matrix.splice(closeClusters[1], 1); |1625|1625| for (let i = 0; i < matrix.length; ++i) |1626|1626| { |1627|1627| if (matrix[i].length > closeClusters[0]) | | [NORMAL] ESLintBear (comma-spacing): | | A space is required after ','. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js |1625|1625| for (let i = 0; i < matrix.length; ++i) |1626|1626| { |1627|1627| if (matrix[i].length > closeClusters[0]) |1628| |- matrix[i].splice(closeClusters[0],1); | |1628|+ matrix[i].splice(closeClusters[0], 1); |1629|1629| if (matrix[i].length > closeClusters[1]) |1630|1630| matrix[i].splice(closeClusters[1],1); |1631|1631| } | | [NORMAL] ESLintBear (comma-spacing): | | A space is required after ','. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/helpers/Commands.js |1627|1627| if (matrix[i].length > closeClusters[0]) |1628|1628| matrix[i].splice(closeClusters[0],1); |1629|1629| if (matrix[i].length > closeClusters[1]) |1630| |- matrix[i].splice(closeClusters[1],1); | |1630|+ matrix[i].splice(closeClusters[1], 1); |1631|1631| } |1632|1632| // add a new row of distances to the matrix and the new cluster |1633|1633| clusters.push(newCluster); binaries/data/mods/public/simulation/helpers/Commands.js | 43| » if·(g_Commands[cmd.type]) | | [MAJOR] ESLintBear (no-use-before-define): | | 'g_Commands' was used before it was defined. binaries/data/mods/public/simulation/helpers/Commands.js | 47| » » g_Commands[cmd.type](player,·cmd,·data); | | [MAJOR] ESLintBear (no-use-before-define): | | 'g_Commands' was used before it was defined. binaries/data/mods/public/simulation/helpers/Commands.js | 799| » » let·ent·=·pickRandom(cmpRangeManager.GetEntitiesByPlayer(cmd.player).filter(ent·=>·{ | | [NORMAL] ESLintBear (no-shadow): | | 'ent' is already declared in the upper scope. binaries/data/mods/public/simulation/helpers/Commands.js |1284| ····» » » error("[TryConstructWall]·Expected·last·tower·control·group·to·be·available,·none·found·(1st·pass,·iteration·"·+·i·+·")"); | | [NORMAL] ESLintBear (no-mixed-spaces-and-tabs): | | Mixed spaces and tabs. binaries/data/mods/public/simulation/helpers/Commands.js |1285| ····» » » break; | | [NORMAL] ESLintBear (no-mixed-spaces-and-tabs): | | Mixed spaces and tabs. binaries/data/mods/public/simulation/helpers/Commands.js |1515| » » » » var·lastFormationTemplate·=·undefined; | | [NORMAL] ESLintBear (no-undef-init): | | It's not necessary to initialize 'lastFormationTemplate' to undefined. binaries/data/mods/public/simulation/helpers/Commands.js |1594| » » var·closeClusters·=·undefined; | | [NORMAL] ESLintBear (no-undef-init): | | It's not necessary to initialize 'closeClusters' to undefined. binaries/data/mods/public/simulation/helpers/Commands.js |1611| » » for·(let·i·=·0;·i·<·clusters.length;·++i) | | [NORMAL] ESLintBear (no-shadow): | | 'i' is already declared in the upper scope. binaries/data/mods/public/simulation/helpers/Commands.js |1625| » » for·(let·i·=·0;·i·<·matrix.length;·++i) | | [NORMAL] ESLintBear (no-shadow): | | 'i' is already declared in the upper scope. binaries/data/mods/public/simulation/helpers/Commands.js | 53| var·g_Commands·=·{ | | [NORMAL] JSHintBear: | | 'g_Commands' was used before it was defined. binaries/data/mods/public/simulation/helpers/Commands.js | 541| » » » » ····&&·player·!=·+cmd.owner) | | [NORMAL] JSHintBear: | | Misleading line break before '&&'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/helpers/Commands.js | 739| » » » » var·cmpGUIInterface·=·Engine.QueryInterface(SYSTEM_ENTITY,·IID_GuiInterface); | | [NORMAL] JSHintBear: | | 'cmpGUIInterface' is already defined. binaries/data/mods/public/simulation/helpers/Commands.js | 958| » » for·(var·i·=·0;·i·<·length;·++i) | | [NORMAL] JSHintBear: | | 'i' is already defined. binaries/data/mods/public/simulation/helpers/Commands.js | 971| » » var·count·=·0; | | [NORMAL] JSHintBear: | | 'count' is already defined. binaries/data/mods/public/simulation/helpers/Commands.js |1118| » » var·cmpGuiInterface·=·Engine.QueryInterface(SYSTEM_ENTITY,·IID_GuiInterface); | | [NORMAL] JSHintBear: | | 'cmpGuiInterface' is already defined. binaries/data/mods/public/simulation/helpers/Commands.js |1370| » » var·piece·=·pieces[j]; | | [NORMAL] JSHintBear: | | 'piece' is already defined. binaries/data/mods/public/simulation/helpers/Commands.js |1453| » » var·cmpUnitAI·=·Engine.QueryInterface(ent,·IID_UnitAI); | | [NORMAL] JSHintBear: | | 'cmpUnitAI' is already defined. binaries/data/mods/public/simulation/helpers/Commands.js |1492| » » » &&·cmpFormation.GetMemberCount()·==·formation.entities.length) | | [NORMAL] JSHintBear: | | Misleading line break before '&&'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/helpers/Commands.js |1518| » » » » » var·cmpUnitAI·=·Engine.QueryInterface(ent,·IID_UnitAI); | | [NORMAL] JSHintBear: | | 'cmpUnitAI' is already defined. binaries/data/mods/public/simulation/helpers/Commands.js |1551| » » » var·cmpFormation·=·Engine.QueryInterface(formationEnt,·IID_Formation); | | [NORMAL] JSHintBear: | | 'cmpFormation' is already defined. | | [NORMAL] ESLintBear (indent): | | Expected indentation of 2 tabs but found 3. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js | 804| 804| updateEntityColor(data.showAllStatusBars && (i == player || player == -1) ? | 805| 805| [IID_Minimap, IID_RangeOverlayRenderer, IID_RallyPointRenderer, IID_StatusBars] : | 806| 806| [IID_Minimap, IID_RangeOverlayRenderer, IID_RallyPointRenderer], | 807| |- cmpRangeManager.GetEntitiesByPlayer(i)); | | 807|+ cmpRangeManager.GetEntitiesByPlayer(i)); | 808| 808| } | 809| 809| updateEntityColor([IID_Selectable, IID_StatusBars], data.selected); | 810| 810| Engine.QueryInterface(SYSTEM_ENTITY, IID_TerritoryManager).UpdateColors(); | | [NORMAL] ESLintBear (indent): | | Expected indentation of 5 tabs but found 6. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js |1637|1637| { |1638|1638| minDist2 = dist2; |1639|1639| minDistEntitySnapData = { |1640| |- "x": pos.x, | |1640|+ "x": pos.x, |1641|1641| "z": pos.z, |1642|1642| "angle": cmpPosition.GetRotation().y, |1643|1643| "ent": ent | | [NORMAL] ESLintBear (indent): | | Expected indentation of 5 tabs but found 6. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js |1638|1638| minDist2 = dist2; |1639|1639| minDistEntitySnapData = { |1640|1640| "x": pos.x, |1641| |- "z": pos.z, | |1641|+ "z": pos.z, |1642|1642| "angle": cmpPosition.GetRotation().y, |1643|1643| "ent": ent |1644|1644| }; | | [NORMAL] ESLintBear (indent): | | Expected indentation of 5 tabs but found 6. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js |1639|1639| minDistEntitySnapData = { |1640|1640| "x": pos.x, |1641|1641| "z": pos.z, |1642| |- "angle": cmpPosition.GetRotation().y, | |1642|+ "angle": cmpPosition.GetRotation().y, |1643|1643| "ent": ent |1644|1644| }; |1645|1645| } | | [NORMAL] ESLintBear (indent): | | Expected indentation of 5 tabs but found 6. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js |1640|1640| "x": pos.x, |1641|1641| "z": pos.z, |1642|1642| "angle": cmpPosition.GetRotation().y, |1643| |- "ent": ent | |1643|+ "ent": ent |1644|1644| }; |1645|1645| } |1646|1646| } | | [NORMAL] ESLintBear (space-before-function-paren): | | Unexpected space before function parentheses. |----| | /zpool0/trunk/binaries/data/mods/public/gui/session/selection_panels.js | |++++| /zpool0/trunk/binaries/data/mods/public/gui/session/selection_panels.js | 763| 763| addResearchToQueue(data.item.researchFacilityId, t); | 764| 764| })(tech); | 765| 765| | 766| |- button.onPressRight = (t => function () { | | 766|+ button.onPressRight = (t => function() { | 767| 767| showTemplateDetails( | 768| 768| t, | 769| 769| GetTemplateData(data.unitEntStates.find(state => state.id == data.item.researchFacilityId).template).nativeCiv); binaries/data/mods/public/gui/session/selection_panels.js | 48| » » » switch·(data.item) | | [NORMAL] ESLintBear (default-case): | | Expected a default case. binaries/data/mods/public/gui/session/selection_panels.js | 59| » » switch·(data.item) | | [NORMAL] ESLintBear (default-case): | | Expected a default case. binaries/data/mods/public/gui/session/selection_panels.js | 731| » » » » » » switch·(entity.check) | | [NORMAL] ESLintBear (default-case): | | Expected a default case. | | [NORMAL] ESLintBear (no-else-return): | | Unnecessary 'else' after 'return'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | 762| 762| this.FinishOrder(); | 763| 763| return; | 764| 764| } | 765| |- else | 766| |- { | | 765|+ | 767| 766| this.SetNextState("GARRISON.APPROACHING"); | 768| 767| return; | 769| |- } | | 768|+ | 770| 769| } | 771| 770| | 772| 771| this.SetNextState("GARRISON.GARRISONING"); | | [NORMAL] ESLintBear (key-spacing): | | Missing space before value for key 'GARRISON'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |1030|1030| }, |1031|1031| }, |1032|1032| |1033| |- "GARRISON":{ | |1033|+ "GARRISON": { |1034|1034| "enter": function() { |1035|1035| // If the garrisonholder should pickup, warn it so it can take needed action |1036|1036| var cmpGarrisonHolder = Engine.QueryInterface(this.order.data.target, IID_GarrisonHolder); | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |1979|1979| |1980|1980| "Attacked": function(msg) { |1981|1981| // If we are capturing and are attacked by something that we would not capture, attack that entity instead |1982| |- if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) |1983| |- && this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture") | |1982|+ if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) && | |1983|+ this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture") |1984|1984| this.RespondToTargetedEntities([msg.data.attacker]); |1985|1985| }, |1986|1986| }, | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |2674|2674| { |2675|2675| // The building was already finished/fully repaired before we arrived; |2676|2676| // let the ConstructionFinished handler handle this. |2677| |- this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget}); | |2677|+ this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget}); |2678|2678| return true; |2679|2679| } |2680|2680| | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |2674|2674| { |2675|2675| // The building was already finished/fully repaired before we arrived; |2676|2676| // let the ConstructionFinished handler handle this. |2677| |- this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget}); | |2677|+ this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget }); |2678|2678| return true; |2679|2679| } |2680|2680| | | [NORMAL] ESLintBear (indent): | | Expected indentation of 2 tabs but found 7. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3187|3187| "COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals |3188|3188| |3189|3189| "WALKING": "INDIVIDUAL.WALKING", // reuse the same walking behaviour for animals |3190| |- // only used for domestic animals | |3190|+ // only used for domestic animals |3191|3191| }, |3192|3192| }; |3193|3193| | | [NORMAL] ESLintBear (no-unneeded-ternary): | | Unnecessary use of boolean literals in conditional expression. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3245|3245| |3246|3246| UnitAI.prototype.IsAnimal = function() |3247|3247| { |3248| |- return (this.template.NaturalBehaviour ? true : false); | |3248|+ return (!!this.template.NaturalBehaviour); |3249|3249| }; |3250|3250| |3251|3251| UnitAI.prototype.IsDangerousAnimal = function() | | [NORMAL] ESLintBear (comma-spacing): | | A space is required after ','. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3361|3361| { |3362|3362| let index = this.GetCurrentState().indexOf("."); |3363|3363| if (index != -1) |3364| |- this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index)); | |3364|+ this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index)); |3365|3365| this.Stop(false); |3366|3366| } |3367|3367| | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3417|3417| if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity) |3418|3418| continue; |3419|3419| if (i == 0) |3420| |- this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg}); | |3420|+ this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg}); |3421|3421| else |3422|3422| this.orderQueue.splice(i, 1); |3423|3423| Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() }); | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3417|3417| if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity) |3418|3418| continue; |3419|3419| if (i == 0) |3420| |- this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg}); | |3420|+ this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg }); |3421|3421| else |3422|3422| this.orderQueue.splice(i, 1); |3423|3423| Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() }); | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3501|3501| }; |3502|3502| |3503|3503| |3504| |-//// FSM linkage functions //// | |3504|+// // FSM linkage functions //// |3505|3505| |3506|3506| // Setting the next state to the current state will leave/re-enter the top-most substate. |3507|3507| UnitAI.prototype.SetNextState = function(state) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3671|3671| continue; |3672|3672| if (this.orderQueue[i].type == type) |3673|3673| continue; |3674| |- this.orderQueue.splice(i, 0, {"type": type, "data": data}); | |3674|+ this.orderQueue.splice(i, 0, { "type": type, "data": data}); |3675|3675| Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() }); |3676|3676| return; |3677|3677| } | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3671|3671| continue; |3672|3672| if (this.orderQueue[i].type == type) |3673|3673| continue; |3674| |- this.orderQueue.splice(i, 0, {"type": type, "data": data}); | |3674|+ this.orderQueue.splice(i, 0, {"type": type, "data": data }); |3675|3675| Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() }); |3676|3676| return; |3677|3677| } | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3842|3842| if (data.timerRepeat === undefined) |3843|3843| this.timer = undefined; |3844|3844| |3845| |- this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness}); | |3845|+ this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness}); |3846|3846| }; |3847|3847| |3848|3848| /** | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3842|3842| if (data.timerRepeat === undefined) |3843|3843| this.timer = undefined; |3844|3844| |3845| |- this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness}); | |3845|+ this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness }); |3846|3846| }; |3847|3847| |3848|3848| /** | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3887|3887| // TODO: This is a bit inefficient since every unit listens to every |3888|3888| // construction message - ideally we could scope it to only the one we're building |3889|3889| |3890| |- this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg}); | |3890|+ this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg}); |3891|3891| }; |3892|3892| |3893|3893| UnitAI.prototype.OnGlobalEntityRenamed = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3887|3887| // TODO: This is a bit inefficient since every unit listens to every |3888|3888| // construction message - ideally we could scope it to only the one we're building |3889|3889| |3890| |- this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg}); | |3890|+ this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg }); |3891|3891| }; |3892|3892| |3893|3893| UnitAI.prototype.OnGlobalEntityRenamed = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3912|3912| |3913|3913| UnitAI.prototype.OnAttacked = function(msg) |3914|3914| { |3915| |- this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg}); | |3915|+ this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg}); |3916|3916| }; |3917|3917| |3918|3918| UnitAI.prototype.OnGuardedAttacked = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3912|3912| |3913|3913| UnitAI.prototype.OnAttacked = function(msg) |3914|3914| { |3915| |- this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg}); | |3915|+ this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg }); |3916|3916| }; |3917|3917| |3918|3918| UnitAI.prototype.OnGuardedAttacked = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3917|3917| |3918|3918| UnitAI.prototype.OnGuardedAttacked = function(msg) |3919|3919| { |3920| |- this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data}); | |3920|+ this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data}); |3921|3921| }; |3922|3922| |3923|3923| UnitAI.prototype.OnHealthChanged = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3917|3917| |3918|3918| UnitAI.prototype.OnGuardedAttacked = function(msg) |3919|3919| { |3920| |- this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data}); | |3920|+ this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data }); |3921|3921| }; |3922|3922| |3923|3923| UnitAI.prototype.OnHealthChanged = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3922|3922| |3923|3923| UnitAI.prototype.OnHealthChanged = function(msg) |3924|3924| { |3925| |- this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to}); | |3925|+ this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to}); |3926|3926| }; |3927|3927| |3928|3928| UnitAI.prototype.OnRangeUpdate = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3922|3922| |3923|3923| UnitAI.prototype.OnHealthChanged = function(msg) |3924|3924| { |3925| |- this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to}); | |3925|+ this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to }); |3926|3926| }; |3927|3927| |3928|3928| UnitAI.prototype.OnRangeUpdate = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3928|3928| UnitAI.prototype.OnRangeUpdate = function(msg) |3929|3929| { |3930|3930| if (msg.tag == this.losRangeQuery) |3931| |- this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg}); | |3931|+ this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg}); |3932|3932| else if (msg.tag == this.losHealRangeQuery) |3933|3933| this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg}); |3934|3934| }; | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3928|3928| UnitAI.prototype.OnRangeUpdate = function(msg) |3929|3929| { |3930|3930| if (msg.tag == this.losRangeQuery) |3931| |- this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg}); | |3931|+ this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg }); |3932|3932| else if (msg.tag == this.losHealRangeQuery) |3933|3933| this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg}); |3934|3934| }; | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3930|3930| if (msg.tag == this.losRangeQuery) |3931|3931| this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg}); |3932|3932| else if (msg.tag == this.losHealRangeQuery) |3933| |- this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg}); | |3933|+ this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg}); |3934|3934| }; |3935|3935| |3936|3936| UnitAI.prototype.OnPackFinished = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3930|3930| if (msg.tag == this.losRangeQuery) |3931|3931| this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg}); |3932|3932| else if (msg.tag == this.losHealRangeQuery) |3933| |- this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg}); | |3933|+ this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg }); |3934|3934| }; |3935|3935| |3936|3936| UnitAI.prototype.OnPackFinished = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3935|3935| |3936|3936| UnitAI.prototype.OnPackFinished = function(msg) |3937|3937| { |3938| |- this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed}); | |3938|+ this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed}); |3939|3939| }; |3940|3940| |3941|3941| //// Helper functions to be called by the FSM //// | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3935|3935| |3936|3936| UnitAI.prototype.OnPackFinished = function(msg) |3937|3937| { |3938| |- this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed}); | |3938|+ this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed }); |3939|3939| }; |3940|3940| |3941|3941| //// Helper functions to be called by the FSM //// | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3938|3938| this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed}); |3939|3939| }; |3940|3940| |3941| |-//// Helper functions to be called by the FSM //// | |3941|+// // Helper functions to be called by the FSM //// |3942|3942| |3943|3943| UnitAI.prototype.GetWalkSpeed = function() |3944|3944| { | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |4597|4597| UnitAI.prototype.AttackEntityInZone = function(ents) |4598|4598| { |4599|4599| var target = ents.find(target => |4600| |- this.CanAttack(target) |4601| |- && this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) | |4600|+ this.CanAttack(target) && | |4601|+ this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) |4602|4602| && (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target)) |4603|4603| ); |4604|4604| if (!target) | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |4598|4598| { |4599|4599| var target = ents.find(target => |4600|4600| this.CanAttack(target) |4601| |- && this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) |4602| |- && (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target)) | |4601|+ && this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) && | |4602|+ (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target)) |4603|4603| ); |4604|4604| if (!target) |4605|4605| return false; | | [NORMAL] ESLintBear (no-multi-spaces): | | Multiple spaces found before 'Engine'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |4662|4662| // If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker |4663|4663| if (this.isGuardOf) |4664|4664| { |4665| |- var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI); | |4665|+ var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI); |4666|4666| var cmpAttack = Engine.QueryInterface(target, IID_Attack); |4667|4667| if (cmpUnitAI && cmpAttack && |4668|4668| cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type))) | | [NORMAL] ESLintBear (indent): | | Expected indentation of 3 tabs but found 4. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |4666|4666| var cmpAttack = Engine.QueryInterface(target, IID_Attack); |4667|4667| if (cmpUnitAI && cmpAttack && |4668|4668| cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type))) |4669| |- return false; | |4669|+ return false; |4670|4670| } |4671|4671| |4672|4672| // Stop if we're in hold-ground mode and it's too far from the holding point | | [NORMAL] ESLintBear (no-multi-spaces): | | Multiple spaces found before 'Engine'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |4704|4704| // If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker |4705|4705| if (this.isGuardOf) |4706|4706| { |4707| |- let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI); | |4707|+ let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI); |4708|4708| let cmpAttack = Engine.QueryInterface(target, IID_Attack); |4709|4709| if (cmpUnitAI && cmpAttack && |4710|4710| cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type))) | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |4717|4717| return false; |4718|4718| }; |4719|4719| |4720| |-//// External interface functions //// | |4720|+// // External interface functions //// |4721|4721| |4722|4722| UnitAI.prototype.SetFormationController = function(ent) |4723|4723| { | | [NORMAL] ESLintBear (no-else-return): | | Unnecessary 'else' after 'return'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |4873|4873| { |4874|4874| if (this.isGuardOf == target && this.order && this.order.type == "Guard") |4875|4875| return; |4876| |- else |4877| |- this.RemoveGuard(); | |4876|+ this.RemoveGuard(); |4878|4877| } |4879|4878| |4880|4879| this.AddOrder("Guard", { "target": target, "force": false }, queued); | | [NORMAL] ESLintBear (no-trailing-spaces): | | Trailing spaces not allowed. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5205|5205| this.workOrders.length && this.workOrders[0].type == "Trade") |5206|5206| { |5207|5207| let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader); |5208| |- if (cmpTrader.HasBothMarkets() && | |5208|+ if (cmpTrader.HasBothMarkets() && |5209|5209| (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source || |5210|5210| cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target)) |5211|5211| { | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5486|5486| { |5487|5487| var cmpIdentity = Engine.QueryInterface(targ, IID_Identity); |5488|5488| var targetClasses = this.order.data.targetClasses; |5489| |- if (targetClasses.attack && cmpIdentity |5490| |- && !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack)) | |5489|+ if (targetClasses.attack && cmpIdentity && | |5490|+ !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack)) |5491|5491| continue; |5492|5492| if (targetClasses.avoid && cmpIdentity |5493|5493| && MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid)) | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5489|5489| if (targetClasses.attack && cmpIdentity |5490|5490| && !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack)) |5491|5491| continue; |5492| |- if (targetClasses.avoid && cmpIdentity |5493| |- && MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid)) | |5492|+ if (targetClasses.avoid && cmpIdentity && | |5493|+ MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid)) |5494|5494| continue; |5495|5495| // Only used by the AIs to prevent some choices of targets |5496|5496| if (targetClasses.vetoEntities && targetClasses.vetoEntities[targ]) | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5512|5512| { |5513|5513| var cmpIdentity = Engine.QueryInterface(targ, IID_Identity); |5514|5514| var targetClasses = this.order.data.targetClasses; |5515| |- if (cmpIdentity && targetClasses.attack |5516| |- && !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack)) | |5515|+ if (cmpIdentity && targetClasses.attack && | |5516|+ !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack)) |5517|5517| continue; |5518|5518| if (cmpIdentity && targetClasses.avoid |5519|5519| && MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid)) | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5515|5515| if (cmpIdentity && targetClasses.attack |5516|5516| && !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack)) |5517|5517| continue; |5518| |- if (cmpIdentity && targetClasses.avoid |5519| |- && MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid)) | |5518|+ if (cmpIdentity && targetClasses.avoid && | |5519|+ MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid)) |5520|5520| continue; |5521|5521| // Only used by the AIs to prevent some choices of targets |5522|5522| if (targetClasses.vetoEntities && targetClasses.vetoEntities[targ]) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5696|5696| |5697|5697| UnitAI.prototype.SetHeldPosition = function(x, z) |5698|5698| { |5699| |- this.heldPosition = {"x": x, "z": z}; | |5699|+ this.heldPosition = { "x": x, "z": z}; |5700|5700| }; |5701|5701| |5702|5702| UnitAI.prototype.SetHeldPositionOnEntity = function(entity) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5696|5696| |5697|5697| UnitAI.prototype.SetHeldPosition = function(x, z) |5698|5698| { |5699| |- this.heldPosition = {"x": x, "z": z}; | |5699|+ this.heldPosition = {"x": x, "z": z }; |5700|5700| }; |5701|5701| |5702|5702| UnitAI.prototype.SetHeldPositionOnEntity = function(entity) | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5723|5723| return false; |5724|5724| }; |5725|5725| |5726| |-//// Helper functions //// | |5726|+// // Helper functions //// |5727|5727| |5728|5728| UnitAI.prototype.CanAttack = function(target) |5729|5729| { | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5927|5927| return cmpPack && cmpPack.IsPacking(); |5928|5928| }; |5929|5929| |5930| |-//// Formation specific functions //// | |5930|+// // Formation specific functions //// |5931|5931| |5932|5932| UnitAI.prototype.IsAttackingAsFormation = function() |5933|5933| { | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5932|5932| UnitAI.prototype.IsAttackingAsFormation = function() |5933|5933| { |5934|5934| var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack); |5935| |- return cmpAttack && cmpAttack.CanAttackAsFormation() |5936| |- && this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING"; | |5935|+ return cmpAttack && cmpAttack.CanAttackAsFormation() && | |5936|+ this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING"; |5937|5937| }; |5938|5938| |5939|5939| //// Animal specific functions //// | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5936|5936| && this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING"; |5937|5937| }; |5938|5938| |5939| |-//// Animal specific functions //// | |5939|+// // Animal specific functions //// |5940|5940| |5941|5941| UnitAI.prototype.MoveRandomly = function(distance) |5942|5942| { binaries/data/mods/public/simulation/components/UnitAI.js | 331| » » » return·true; | | [NORMAL] ESLintBear (consistent-return): | | Method 'Order.WalkToTarget' expected no return value. binaries/data/mods/public/simulation/components/UnitAI.js | 917| » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js | 942| » » » "enter":·function(msg)·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js | 992| » » » » » return·true; | | [NORMAL] ESLintBear (consistent-return): | | Method 'enter' expected no return value. binaries/data/mods/public/simulation/components/UnitAI.js |1055| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |1091| » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |1123| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |1283| » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |1340| » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |1515| » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |1537| » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |1569| » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |1723| » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |1773| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |1851| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |2028| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |2131| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |2386| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |2419| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |2525| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |2591| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |2630| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |2841| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |3022| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |3747| » var·isWorkType·=·type·=>·type·==·"Gather"·||·type·==·"Trade"·||·type·==·"Repair"·||·type·==·"ReturnResource"; | | [NORMAL] ESLintBear (no-shadow): | | 'type' is already declared in the upper scope. binaries/data/mods/public/simulation/components/UnitAI.js |4584| » var·target·=·ents.find(target·=>·this.CanAttack(target)); | | [NORMAL] ESLintBear (no-shadow): | | 'target' is already declared in the upper scope. binaries/data/mods/public/simulation/components/UnitAI.js |4599| » var·target·=·ents.find(target·=> | | [NORMAL] ESLintBear (no-shadow): | | 'target' is already declared in the upper scope. binaries/data/mods/public/simulation/components/UnitAI.js |4645| » var·ent·=·ents.find(ent·=>·this.CanHeal(ent)); | | [NORMAL] ESLintBear (no-shadow): | | 'ent' is already declared in the upper scope. binaries/data/mods/public/simulation/components/UnitAI.js |4668| » » ····cmpAttack.GetAttackTypes().some(type·=>·cmpUnitAI.CheckTargetAttackRange(this.isGuardOf,·type))) | | [NORMAL] ESLintBear (no-shadow): | | 'type' is already declared in the upper scope. binaries/data/mods/public/simulation/components/UnitAI.js |5654| UnitAI.prototype.GetSelectableAttacks·=·function() | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of function. binaries/data/mods/public/simulation/components/UnitAI.js |1983| » » » » » » &&·this.order.data.target·!=·msg.data.attacker·&&·this.GetBestAttackAgainst(msg.data.attacker,·true)·!=·"Capture") | | [NORMAL] JSHintBear: | | Misleading line break before '&&'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/components/UnitAI.js |3709| » » var·order·=·{·"type":·type,·"data":·data·}; | | [NORMAL] JSHintBear: | | 'order' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |3778| » for·(var·i·=·0;·i·<·this.orderQueue.length;·++i) | | [NORMAL] JSHintBear: | | 'i' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |4601| » » &&·this.CheckTargetDistanceFromHeldPosition(target,·IID_Attack,·this.GetBestAttackAgainst(target,·true)) | | [NORMAL] JSHintBear: | | Misleading line break before '&&'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/components/UnitAI.js |4602| » » &&·(this.GetStance().respondChaseBeyondVision·||·this.CheckTargetIsInVisionRange(target)) | | [NORMAL] JSHintBear: | | Misleading line break before '&&'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/components/UnitAI.js |5490| » » » » » » &&·!MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.attack)) | | [NORMAL] JSHintBear: | | Misleading line break before '&&'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/components/UnitAI.js |5493| » » » » » » &&·MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.avoid)) | | [NORMAL] JSHintBear: | | Misleading line break before '&&'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/components/UnitAI.js |5506| » var·targets·=·this.GetTargetsFromUnit(); | | [NORMAL] JSHintBear: | | 'targets' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5507| » for·(var·targ·of·targets) | | [NORMAL] JSHintBear: | | 'targ' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5513| » » » var·cmpIdentity·=·Engine.QueryInterface(targ,·IID_Identity); | | [NORMAL] JSHintBear: | | 'cmpIdentity' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5514| » » » var·targetClasses·=·this.order.data.targetClasses; | | [NORMAL] JSHintBear: | | 'targetClasses' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5516| » » » » &&·!MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.attack)) | | [NORMAL] JSHintBear: | | Misleading line break before '&&'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/components/UnitAI.js |5519| » » » » &&·MatchesClassList(cmpIdentity.GetClassesList(),·targetClasses.avoid)) | | [NORMAL] JSHintBear: | | Misleading line break before '&&'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/components/UnitAI.js |5594| » » var·cmpVision·=·Engine.QueryInterface(this.entity,·IID_Vision); | | [NORMAL] JSHintBear: | | 'cmpVision' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5597| » » var·range·=·cmpVision.GetRange(); | | [NORMAL] JSHintBear: | | 'range' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5602| » » var·cmpRanged·=·Engine.QueryInterface(this.entity,·iid); | | [NORMAL] JSHintBear: | | 'cmpRanged' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5605| » » var·range·=·iid·!==·IID_Attack·?·cmpRanged.GetRange()·:·cmpRanged.GetFullAttackRange(); | | [NORMAL] JSHintBear: | | 'range' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5606| » » var·cmpVision·=·Engine.QueryInterface(this.entity,·IID_Vision); | | [NORMAL] JSHintBear: | | 'cmpVision' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5616| » » var·cmpVision·=·Engine.QueryInterface(this.entity,·IID_Vision); | | [NORMAL] JSHintBear: | | 'cmpVision' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5619| » » var·range·=·cmpVision.GetRange(); | | [NORMAL] JSHintBear: | | 'range' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5936| » » &&·this.GetCurrentState()·==·"FORMATIONCONTROLLER.COMBAT.ATTACKING"; | | [NORMAL] JSHintBear: | | Misleading line break before '&&'; readers may interpret this as an expression boundary. Executing section cli...
Link to build: https://jenkins.wildfiregames.com/job/docker-differential/337/display/redirect
didnt test but why not putting this option to have it global and dont get confused maybe additional to know wut general auto attack behaviour is like in options -> ingame -> unit auto attack -> capture/attack. Maybe thats good to add. is it good?
Yeah, I thought about that, but that means hardcoding "capture". Not sure whether that is wanted though.
Honestly, I think an immediately accessible UI isn't needed. I don't think this is a setting players will change very often, particularly since(if?) there is a hotkey to toggle the other one.
IMO it can be an option in the gameplay options.
Ideally, we would allow some flexibility (e.g. capture/destroy siege; capture/destroy structures...)