Details
Details
- Reviewers
bb - Group Reviewers
Restricted Owners Package (Owns No Changed Paths) - Commits
- rP22339: Resolve issues with rP22313 - unitAI order cleanup and unitMotion MoveTo change
Review bb's and Angen's comments.
Diff Detail
Diff Detail
- Repository
- rP 0 A.D. Public Repository
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Event Timeline
Comment Actions
Successful build - Chance fights ever on the side of the prudent.
Linter detected issues: Executing section Source... Executing section JS... | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | 356| 356| var cmpPosition = Engine.QueryInterface(this.entity, IID_Position); | 357| 357| if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x) | 358| 358| && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z)) | 359| |- { | | 359|+ | 360| 360| // we were already on the shoreline, and have not moved since | 361| 361| if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50) | 362| 362| needToMove = false; | 363| |- } | | 363|+ | 364| 364| | 365| 365| if (needToMove) | 366| 366| this.SetNextState("INDIVIDUAL.PICKUP.APPROACHING"); | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | 354| 354| // Check if we need to move TODO implement a better way to know if we are on the shoreline | 355| 355| var needToMove = true; | 356| 356| var cmpPosition = Engine.QueryInterface(this.entity, IID_Position); | 357| |- if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x) | 358| |- && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z)) | | 357|+ if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x) && | | 358|+ (this.lastShorelinePosition.z == cmpPosition.GetPosition().z)) | 359| 359| { | 360| 360| // we were already on the shoreline, and have not moved since | 361| 361| if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50) | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'else'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | 519| 519| this.PushOrderFront("Walk", this.order.data.lastPos); | 520| 520| } | 521| 521| else | 522| |- { | | 522|+ | 523| 523| // We couldn't move there, or the target moved away | 524| 524| this.FinishOrder(); | 525| |- } | | 525|+ | 526| 526| return; | 527| 527| } | 528| 528| | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | 734| 734| } | 735| 735| // Check if we are already in range, otherwise walk there | 736| 736| if (!this.CheckGarrisonRange(msg.data.target)) | 737| |- { | | 737|+ | 738| 738| if (!this.CheckTargetVisible(msg.data.target)) | 739| 739| { | 740| 740| this.FinishOrder(); | 745| 745| this.SetNextState("GARRISON.APPROACHING"); | 746| 746| return; | 747| 747| } | 748| |- } | | 748|+ | 749| 749| | 750| 750| this.SetNextState("GARRISON.GARRISONING"); | 751| 751| }, | | [NORMAL] ESLintBear (no-else-return): | | Unnecessary 'else' after 'return'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | 740| 740| this.FinishOrder(); | 741| 741| return; | 742| 742| } | 743| |- else | 744| |- { | | 743|+ | 745| 744| this.SetNextState("GARRISON.APPROACHING"); | 746| 745| return; | 747| |- } | | 746|+ | 748| 747| } | 749| 748| | 750| 749| this.SetNextState("GARRISON.GARRISONING"); | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'else'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | 763| 763| this.PushOrderFront("Walk", msg.data.lastPos); | 764| 764| } | 765| 765| else | 766| |- { | | 766|+ | 767| 767| // We couldn't move there, or the target moved away | 768| 768| this.FinishOrder(); | 769| |- } | | 769|+ | 770| 770| return; | 771| 771| } | 772| 772| | | [NORMAL] ESLintBear (key-spacing): | | Missing space before value for key 'GARRISON'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |1011|1011| }, |1012|1012| }, |1013|1013| |1014| |- "GARRISON":{ | |1014|+ "GARRISON": { |1015|1015| "enter": function() { |1016|1016| // If the garrisonholder should pickup, warn it so it can take needed action |1017|1017| var cmpGarrisonHolder = Engine.QueryInterface(this.order.data.target, IID_GarrisonHolder); | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |1231|1231| // If the controller handled an order but some members rejected it, |1232|1232| // they will have no orders and be in the FORMATIONMEMBER.IDLE state. |1233|1233| if (this.orderQueue.length) |1234| |- { | |1234|+ |1235|1235| // We're leaving the formation, so stop our FormationWalk order |1236|1236| if (this.FinishOrder()) |1237|1237| return; |1238| |- } | |1238|+ |1239|1239| |1240|1240| // No orders left, we're an individual now |1241|1241| if (this.IsAnimal()) | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |1259|1259| // Move a tile outside the building |1260|1260| let range = 4; |1261|1261| if (this.CheckTargetRangeExplicit(msg.data.target, range, range)) |1262| |- { | |1262|+ |1263|1263| // We are already at the target, or can't move at all |1264|1264| this.FinishOrder(); |1265| |- } | |1265|+ |1266|1266| else |1267|1267| { |1268|1268| this.order.data.min = range; | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |1474|1474| |1475|1475| "LosRangeUpdate": function(msg) { |1476|1476| if (this.GetStance().targetVisibleEnemies) |1477| |- { | |1477|+ |1478|1478| // Start attacking one of the newly-seen enemy (if any) |1479|1479| this.AttackEntitiesByPreference(msg.data.added); |1480| |- } | |1480|+ |1481|1481| }, |1482|1482| |1483|1483| "LosHealRangeUpdate": function(msg) { | | [NORMAL] ESLintBear (space-before-function-paren): | | Unexpected space before function parentheses. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |1511|1511| this.SelectAnimation("move"); |1512|1512| }, |1513|1513| |1514| |- "leave": function () { | |1514|+ "leave": function() { |1515|1515| this.SelectAnimation("idle"); |1516|1516| this.StopMoving(); |1517|1517| }, | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |1688|1688| // if nothing better to do, check if the guarded needs to be healed or repaired |1689|1689| var cmpHealth = Engine.QueryInterface(this.isGuardOf, IID_Health); |1690|1690| if (cmpHealth && cmpHealth.IsInjured()) |1691| |- { | |1691|+ |1692|1692| if (this.CanHeal(this.isGuardOf)) |1693|1693| this.PushOrderFront("Heal", { "target": this.isGuardOf, "force": false }); |1694|1694| else if (this.CanRepair(this.isGuardOf)) |1695|1695| this.PushOrderFront("Repair", { "target": this.isGuardOf, "autocontinue": false, "force": false }); |1696| |- } | |1696|+ |1697|1697| } |1698|1698| }, |1699|1699| | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |1791|1791| "MoveCompleted": function() { |1792|1792| |1793|1793| if (this.CheckTargetAttackRange(this.order.data.target, this.order.data.attackType)) |1794| |- { | |1794|+ |1795|1795| // If the unit needs to unpack, do so |1796|1796| if (this.CanUnpack()) |1797|1797| { |1800|1800| } |1801|1801| else |1802|1802| this.SetNextState("ATTACKING"); |1803| |- } | |1803|+ |1804|1804| else |1805|1805| { |1806|1806| if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType)) | | [NORMAL] ESLintBear (no-else-return): | | Unnecessary 'else' after 'return'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |1798|1798| this.PushOrderFront("Unpack", { "force": true }); |1799|1799| return; |1800|1800| } |1801| |- else |1802| |- this.SetNextState("ATTACKING"); | |1801|+ this.SetNextState("ATTACKING"); |1803|1802| } |1804|1803| else |1805|1804| { | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'else'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |1802|1802| this.SetNextState("ATTACKING"); |1803|1803| } |1804|1804| else |1805| |- { | |1805|+ |1806|1806| if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType)) |1807|1807| { |1808|1808| this.SetNextState("APPROACHING"); |1812|1812| // Give up |1813|1813| this.FinishOrder(); |1814|1814| } |1815| |- } | |1815|+ |1816|1816| }, |1817|1817| }, |1818|1818| | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |1804|1804| else |1805|1805| { |1806|1806| if (this.MoveToTargetAttackRange(this.order.data.target, this.order.data.attackType)) |1807| |- { | |1807|+ |1808|1808| this.SetNextState("APPROACHING"); |1809| |- } | |1809|+ |1810|1810| else |1811|1811| { |1812|1812| // Give up | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'else'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |1808|1808| this.SetNextState("APPROACHING"); |1809|1809| } |1810|1810| else |1811| |- { | |1811|+ |1812|1812| // Give up |1813|1813| this.FinishOrder(); |1814| |- } | |1814|+ |1815|1815| } |1816|1816| }, |1817|1817| }, | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |1829|1829| } |1830|1830| // Check the target is still alive and attackable |1831|1831| if (this.CanAttack(target) && !this.CheckTargetAttackRange(target, this.order.data.attackType)) |1832| |- { | |1832|+ |1833|1833| // Can't reach it - try to chase after it |1834|1834| if (this.ShouldChaseTargetedEntity(target, this.order.data.force)) |1835|1835| { |1844|1844| return true; |1845|1845| } |1846|1846| } |1847| |- } | |1847|+ |1848|1848| |1849|1849| this.StopMoving(); |1850|1850| | | [NORMAL] ESLintBear (no-unneeded-ternary): | | Unnecessary use of boolean literals in conditional expression. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |1877|1877| // TODO: we should probably only bother syncing projectile attacks, not melee |1878|1878| |1879|1879| // If using a non-default prepare time, re-sync the animation when the timer runs. |1880| |- this.resyncAnimation = (prepare != this.attackTimers.prepare) ? true : false; | |1880|+ this.resyncAnimation = (prepare != this.attackTimers.prepare); |1881|1881| |1882|1882| this.FaceTowardsTarget(this.order.data.target); |1883|1883| | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |2006|2006| |2007|2007| "Attacked": function(msg) { |2008|2008| // If we are capturing and are attacked by something that we would not capture, attack that entity instead |2009| |- if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) |2010| |- && this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture") | |2009|+ if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) && | |2010|+ this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture") |2011|2011| this.RespondToTargetedEntities([msg.data.attacker]); |2012|2012| }, |2013|2013| }, | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |2026|2026| this.SelectAnimation("move"); |2027|2027| var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI); |2028|2028| if (cmpUnitAI && cmpUnitAI.IsFleeing()) |2029| |- { | |2029|+ |2030|2030| // Run after a fleeing target |2031|2031| this.SetSpeedMultiplier(this.GetRunMultiplier()); |2032| |- } | |2032|+ |2033|2033| this.StartTimer(1000, 1000); |2034|2034| }, |2035|2035| | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |2085|2085| // Also don't switch to a different type of huntable animal |2086|2086| var nearby = this.FindNearbyResource(function(ent, type, template) { |2087|2087| return ( |2088| |- ent != oldTarget |2089| |- && ((type.generic == "treasure" && oldType.generic == "treasure") | |2088|+ ent != oldTarget && | |2089|+ ((type.generic == "treasure" && oldType.generic == "treasure") |2090|2090| || (type.specific == oldType.specific |2091|2091| && (type.specific != "meat" || oldTemplate == template))) |2092|2092| ); | | [NORMAL] ESLintBear (operator-linebreak): | | '||' should be placed at the end of the line. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |2086|2086| var nearby = this.FindNearbyResource(function(ent, type, template) { |2087|2087| return ( |2088|2088| ent != oldTarget |2089| |- && ((type.generic == "treasure" && oldType.generic == "treasure") |2090| |- || (type.specific == oldType.specific | |2089|+ && ((type.generic == "treasure" && oldType.generic == "treasure") || | |2090|+ (type.specific == oldType.specific |2091|2091| && (type.specific != "meat" || oldTemplate == template))) |2092|2092| ); |2093|2093| }, oldTarget); | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |2087|2087| return ( |2088|2088| ent != oldTarget |2089|2089| && ((type.generic == "treasure" && oldType.generic == "treasure") |2090| |- || (type.specific == oldType.specific |2091| |- && (type.specific != "meat" || oldTemplate == template))) | |2090|+ || (type.specific == oldType.specific && | |2091|+ (type.specific != "meat" || oldTemplate == template))) |2092|2092| ); |2093|2093| }, oldTarget); |2094|2094| if (nearby) | | [NORMAL] ESLintBear (no-else-return): | | Unnecessary 'else' after 'return'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |2096|2096| this.PerformGather(nearby, false, false); |2097|2097| return true; |2098|2098| } |2099| |- else |2100| |- { | |2099|+ |2101|2100| // It's probably better in this case, to avoid units getting stuck around a dropsite |2102|2101| // in a "Target is far away, full, nearby are no good resources, return to dropsite" loop |2103|2102| // to order it to GatherNear the resource position. |2118|2117| return true; |2119|2118| } |2120|2119| } |2121| |- } | |2120|+ |2122|2121| return true; |2123|2122| } |2124|2123| | | [NORMAL] ESLintBear (no-else-return): | | Unnecessary 'else' after 'return'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |2108|2108| this.GatherNearPosition(pos.x, pos.z, oldType, oldTemplate); |2109|2109| return true; |2110|2110| } |2111| |- else |2112| |- { | |2111|+ |2113|2112| // we're kind of stuck here. Return resource. |2114|2113| var nearby = this.FindNearestDropsite(oldType.generic); |2115|2114| if (nearby) |2117|2116| this.PushOrderFront("ReturnResource", { "target": nearby, "force": false }); |2118|2117| return true; |2119|2118| } |2120| |- } | |2119|+ |2121|2120| } |2122|2121| return true; |2123|2122| } | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |2160|2160| // Also don't switch to a different type of huntable animal |2161|2161| var nearby = this.FindNearbyResource(function(ent, type, template) { |2162|2162| return ( |2163| |- ent != oldTarget |2164| |- && ((type.generic == "treasure" && oldType.generic == "treasure") | |2163|+ ent != oldTarget && | |2164|+ ((type.generic == "treasure" && oldType.generic == "treasure") |2165|2165| || (type.specific == oldType.specific |2166|2166| && (type.specific != "meat" || oldTemplate == template))) |2167|2167| ); | | [NORMAL] ESLintBear (operator-linebreak): | | '||' should be placed at the end of the line. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |2161|2161| var nearby = this.FindNearbyResource(function(ent, type, template) { |2162|2162| return ( |2163|2163| ent != oldTarget |2164| |- && ((type.generic == "treasure" && oldType.generic == "treasure") |2165| |- || (type.specific == oldType.specific | |2164|+ && ((type.generic == "treasure" && oldType.generic == "treasure") || | |2165|+ (type.specific == oldType.specific |2166|2166| && (type.specific != "meat" || oldTemplate == template))) |2167|2167| ); |2168|2168| }); | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |2162|2162| return ( |2163|2163| ent != oldTarget |2164|2164| && ((type.generic == "treasure" && oldType.generic == "treasure") |2165| |- || (type.specific == oldType.specific |2166| |- && (type.specific != "meat" || oldTemplate == template))) | |2165|+ || (type.specific == oldType.specific && | |2166|+ (type.specific != "meat" || oldTemplate == template))) |2167|2167| ); |2168|2168| }); |2169|2169| if (nearby) | | [NORMAL] ESLintBear (operator-linebreak): | | '||' should be placed at the end of the line. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |2220|2220| // Also don't switch to a different type of huntable animal |2221|2221| var nearby = this.FindNearbyResource(function(ent, type, template) { |2222|2222| return ( |2223| |- (type.generic == "treasure" && resourceType.generic == "treasure") |2224| |- || (type.specific == resourceType.specific | |2223|+ (type.generic == "treasure" && resourceType.generic == "treasure") || | |2224|+ (type.specific == resourceType.specific |2225|2225| && (type.specific != "meat" || resourceTemplate == template)) |2226|2226| ); |2227|2227| }); | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |2221|2221| var nearby = this.FindNearbyResource(function(ent, type, template) { |2222|2222| return ( |2223|2223| (type.generic == "treasure" && resourceType.generic == "treasure") |2224| |- || (type.specific == resourceType.specific |2225| |- && (type.specific != "meat" || resourceTemplate == template)) | |2224|+ || (type.specific == resourceType.specific && | |2225|+ (type.specific != "meat" || resourceTemplate == template)) |2226|2226| ); |2227|2227| }); |2228|2228| | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |2338|2338| |2339|2339| var cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply); |2340|2340| if (cmpSupply && cmpSupply.IsAvailable(cmpOwnership.GetOwner(), this.entity)) |2341| |- { | |2341|+ |2342|2342| // Check we can still reach and gather from the target |2343|2343| if (this.CheckTargetRange(this.gatheringTarget, IID_ResourceGatherer) && this.CanGather(this.gatheringTarget)) |2344|2344| { |2403|2403| return; |2404|2404| } |2405|2405| } |2406| |- } | |2406|+ |2407|2407| |2408|2408| // We're already in range, can't get anywhere near it or the target is exhausted. |2409|2409| | | [NORMAL] ESLintBear (operator-linebreak): | | '||' should be placed at the end of the line. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |2429|2429| // Also don't switch to a different type of huntable animal |2430|2430| var nearby = this.FindNearbyResource(function(ent, type, template) { |2431|2431| return ( |2432| |- (type.generic == "treasure" && resourceType.generic == "treasure") |2433| |- || (type.specific == resourceType.specific | |2432|+ (type.generic == "treasure" && resourceType.generic == "treasure") || | |2433|+ (type.specific == resourceType.specific |2434|2434| && (type.specific != "meat" || resourceTemplate == template)) |2435|2435| ); |2436|2436| }); | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |2430|2430| var nearby = this.FindNearbyResource(function(ent, type, template) { |2431|2431| return ( |2432|2432| (type.generic == "treasure" && resourceType.generic == "treasure") |2433| |- || (type.specific == resourceType.specific |2434| |- && (type.specific != "meat" || resourceTemplate == template)) | |2433|+ || (type.specific == resourceType.specific && | |2434|+ (type.specific != "meat" || resourceTemplate == template)) |2435|2435| ); |2436|2436| }); |2437|2437| if (nearby) | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |2495|2495| |2496|2496| "Timer": function(msg) { |2497|2497| if (this.ShouldAbandonChase(this.order.data.target, this.order.data.force, IID_Heal, null)) |2498| |- { | |2498|+ |2499|2499| // Return to our original position unless we have a better order. |2500|2500| if (!this.FinishOrder() && this.GetStance().respondHoldGround) |2501|2501| this.WalkToHeldPosition(); |2502| |- } | |2502|+ |2503|2503| }, |2504|2504| |2505|2505| "MoveCompleted": function() { | | [NORMAL] ESLintBear (no-unneeded-ternary): | | Unnecessary use of boolean literals in conditional expression. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |2529|2529| this.StartTimer(prepare, this.healTimers.repeat); |2530|2530| |2531|2531| // If using a non-default prepare time, re-sync the animation when the timer runs. |2532| |- this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false; | |2532|+ this.resyncAnimation = (prepare != this.healTimers.prepare); |2533|2533| |2534|2534| this.FaceTowardsTarget(this.order.data.target); |2535|2535| }, | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |2741|2741| { |2742|2742| // The building was already finished/fully repaired before we arrived; |2743|2743| // let the ConstructionFinished handler handle this. |2744| |- this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget}); | |2744|+ this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget}); |2745|2745| return true; |2746|2746| } |2747|2747| | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |2741|2741| { |2742|2742| // The building was already finished/fully repaired before we arrived; |2743|2743| // let the ConstructionFinished handler handle this. |2744| |- this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget}); | |2744|+ this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget }); |2745|2745| return true; |2746|2746| } |2747|2747| | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |2784|2784| if (!inRange && this.MoveToTargetRange(this.repairTarget, IID_Builder)) |2785|2785| this.SetNextState("APPROACHING"); |2786|2786| else if (!inRange) |2787| |- this.FinishOrder(); //can't approach and isn't in reach | |2787|+ this.FinishOrder(); // can't approach and isn't in reach |2788|2788| }, |2789|2789| }, |2790|2790| | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |2871|2871| |2872|2872| // Unit was approaching and there's nothing to do now, so switch to walking |2873|2873| if (oldState === "INDIVIDUAL.REPAIR.APPROACHING") |2874| |- { | |2874|+ |2875|2875| // We're already walking to the given point, so add this as a order. |2876|2876| this.WalkToTarget(msg.data.newentity, true); |2877| |- } | |2877|+ |2878|2878| }, |2879|2879| }, |2880|2880| | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |2933|2933| |2934|2934| // Check that we can garrison here |2935|2935| if (this.CanGarrison(target)) |2936| |- { | |2936|+ |2937|2937| // Check that we're in range of the garrison target |2938|2938| if (this.CheckGarrisonRange(target)) |2939|2939| { |3009|3009| return false; |3010|3010| } |3011|3011| } |3012| |- } | |3012|+ |3013|3013| // Garrisoning failed for some reason, so finish the order |3014|3014| this.FinishOrder(); |3015|3015| return true; | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |3130|3130| "Attacked": function(msg) { |3131|3131| if (this.template.NaturalBehaviour == "skittish" || |3132|3132| this.template.NaturalBehaviour == "passive") |3133| |- { | |3133|+ |3134|3134| this.Flee(msg.data.attacker, false); |3135| |- } | |3135|+ |3136|3136| else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive") |3137|3137| { |3138|3138| if (this.CanAttack(msg.data.attacker)) | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |3139|3139| this.Attack(msg.data.attacker, false); |3140|3140| } |3141|3141| else if (this.template.NaturalBehaviour == "domestic") |3142| |- { | |3142|+ |3143|3143| // Never flee, stop what we were doing |3144|3144| this.SetNextState("IDLE"); |3145| |- } | |3145|+ |3146|3146| }, |3147|3147| |3148|3148| "Order.LeaveFoundation": function(msg) { | | [NORMAL] ESLintBear (no-else-return): | | Unnecessary 'else' after 'return'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |3153|3153| this.FinishOrder(); |3154|3154| return; |3155|3155| } |3156| |- else |3157| |- { | |3156|+ |3158|3157| this.order.data.min = range; |3159|3158| this.SetNextState("WALKING"); |3160| |- } | |3159|+ |3161|3160| }, |3162|3161| |3163|3162| "IDLE": { | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |3197|3197| } |3198|3198| // Start attacking one of the newly-seen enemy (if any) |3199|3199| else if (this.IsDangerousAnimal()) |3200| |- { | |3200|+ |3201|3201| this.AttackVisibleEntity(msg.data.added); |3202| |- } | |3202|+ |3203|3203| |3204|3204| // TODO: if two units enter our range together, we'll attack the |3205|3205| // first and then the second won't trigger another LosRangeUpdate | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |3240|3240| } |3241|3241| // Start attacking one of the newly-seen enemy (if any) |3242|3242| else if (this.template.NaturalBehaviour == "violent") |3243| |- { | |3243|+ |3244|3244| this.AttackVisibleEntity(msg.data.added); |3245| |- } | |3245|+ |3246|3246| }, |3247|3247| |3248|3248| "MoveCompleted": function() { }, | | [NORMAL] ESLintBear (indent): | | Expected indentation of 2 tabs but found 7. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |3257|3257| "COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals |3258|3258| |3259|3259| "WALKING": "INDIVIDUAL.WALKING", // reuse the same walking behaviour for animals |3260| |- // only used for domestic animals | |3260|+ // only used for domestic animals |3261|3261| }, |3262|3262| }; |3263|3263| | | [NORMAL] ESLintBear (no-unneeded-ternary): | | Unnecessary use of boolean literals in conditional expression. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |3314|3314| |3315|3315| UnitAI.prototype.IsAnimal = function() |3316|3316| { |3317| |- return (this.template.NaturalBehaviour ? true : false); | |3317|+ return (!!this.template.NaturalBehaviour); |3318|3318| }; |3319|3319| |3320|3320| UnitAI.prototype.IsDangerousAnimal = function() | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |3352|3352| UnitAI.prototype.GetGarrisonHolder = function() |3353|3353| { |3354|3354| if (this.IsGarrisoned()) |3355| |- { | |3355|+ |3356|3356| for (let order of this.orderQueue) |3357|3357| if (order.type == "Garrison") |3358|3358| return order.data.target; |3359| |- } | |3359|+ |3360|3360| return INVALID_ENTITY; |3361|3361| }; |3362|3362| | | [NORMAL] ESLintBear (comma-spacing): | | A space is required after ','. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |3430|3430| { |3431|3431| let index = this.GetCurrentState().indexOf("."); |3432|3432| if (index != -1) |3433| |- this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index)); | |3433|+ this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index)); |3434|3434| this.Stop(false); |3435|3435| } |3436|3436| | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |3486|3486| if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity) |3487|3487| continue; |3488|3488| if (i == 0) |3489| |- this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg}); | |3489|+ this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg}); |3490|3490| else |3491|3491| this.orderQueue.splice(i, 1); |3492|3492| Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() }); | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |3486|3486| if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity) |3487|3487| continue; |3488|3488| if (i == 0) |3489| |- this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg}); | |3489|+ this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg }); |3490|3490| else |3491|3491| this.orderQueue.splice(i, 1); |3492|3492| Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() }); | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |3570|3570| }; |3571|3571| |3572|3572| |3573| |-//// FSM linkage functions //// | |3573|+// // FSM linkage functions //// |3574|3574| |3575|3575| // Setting the next state to the current state will leave/re-enter the top-most substate. |3576|3576| UnitAI.prototype.SetNextState = function(state) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |3742|3742| continue; |3743|3743| if (this.orderQueue[i].type == type) |3744|3744| continue; |3745| |- this.orderQueue.splice(i, 0, {"type": type, "data": data}); | |3745|+ this.orderQueue.splice(i, 0, { "type": type, "data": data}); |3746|3746| Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() }); |3747|3747| return; |3748|3748| } | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |3742|3742| continue; |3743|3743| if (this.orderQueue[i].type == type) |3744|3744| continue; |3745| |- this.orderQueue.splice(i, 0, {"type": type, "data": data}); | |3745|+ this.orderQueue.splice(i, 0, {"type": type, "data": data }); |3746|3746| Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() }); |3747|3747| return; |3748|3748| } | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |3756|3756| { |3757|3757| // Remember the previous work orders to be able to go back to them later if required |3758|3758| if (data && data.force) |3759| |- { | |3759|+ |3760|3760| if (this.IsFormationController()) |3761|3761| this.CallMemberFunction("UpdateWorkOrders", [type]); |3762|3762| else |3763|3763| this.UpdateWorkOrders(type); |3764| |- } | |3764|+ |3765|3765| |3766|3766| let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null; |3767|3767| | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |3833|3833| { |3834|3834| var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI); |3835|3835| if (cmpUnitAI) |3836| |- { | |3836|+ |3837|3837| for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i) |3838|3838| { |3839|3839| if (isWorkType(cmpUnitAI.orderQueue[i].type)) |3842|3842| return; |3843|3843| } |3844|3844| } |3845| |- } | |3845|+ |3846|3846| } |3847|3847| |3848|3848| // If nothing found, take the unit orders | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'for' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |3835|3835| if (cmpUnitAI) |3836|3836| { |3837|3837| for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i) |3838| |- { | |3838|+ |3839|3839| if (isWorkType(cmpUnitAI.orderQueue[i].type)) |3840|3840| { |3841|3841| this.workOrders = cmpUnitAI.orderQueue.slice(i); |3842|3842| return; |3843|3843| } |3844| |- } | |3844|+ |3845|3845| } |3846|3846| } |3847|3847| | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'for' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |3847|3847| |3848|3848| // If nothing found, take the unit orders |3849|3849| for (var i = 0; i < this.orderQueue.length; ++i) |3850| |- { | |3850|+ |3851|3851| if (isWorkType(this.orderQueue[i].type)) |3852|3852| { |3853|3853| this.workOrders = this.orderQueue.slice(i); |3854|3854| return; |3855|3855| } |3856| |- } | |3856|+ |3857|3857| }; |3858|3858| |3859|3859| UnitAI.prototype.BackToWork = function() | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |3913|3913| if (data.timerRepeat === undefined) |3914|3914| this.timer = undefined; |3915|3915| |3916| |- this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness}); | |3916|+ this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness}); |3917|3917| }; |3918|3918| |3919|3919| /** | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |3913|3913| if (data.timerRepeat === undefined) |3914|3914| this.timer = undefined; |3915|3915| |3916| |- this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness}); | |3916|+ this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness }); |3917|3917| }; |3918|3918| |3919|3919| /** | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |3948|3948| this.timer = undefined; |3949|3949| }; |3950|3950| |3951| |-//// Message handlers ///// | |3951|+// // Message handlers ///// |3952|3952| |3953|3953| UnitAI.prototype.OnMotionChanged = function(msg) |3954|3954| { | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |3953|3953| UnitAI.prototype.OnMotionChanged = function(msg) |3954|3954| { |3955|3955| if (msg.starting && !msg.error) |3956| |- this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg}); | |3956|+ this.UnitFsm.ProcessMessage(this, { "type": "MoveStarted", "data": msg}); |3957|3957| else if (!msg.starting || msg.error) |3958|3958| this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg}); |3959|3959| }; | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |3953|3953| UnitAI.prototype.OnMotionChanged = function(msg) |3954|3954| { |3955|3955| if (msg.starting && !msg.error) |3956| |- this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg}); | |3956|+ this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg }); |3957|3957| else if (!msg.starting || msg.error) |3958|3958| this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg}); |3959|3959| }; | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |3955|3955| if (msg.starting && !msg.error) |3956|3956| this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg}); |3957|3957| else if (!msg.starting || msg.error) |3958| |- this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg}); | |3958|+ this.UnitFsm.ProcessMessage(this, { "type": "MoveCompleted", "data": msg}); |3959|3959| }; |3960|3960| |3961|3961| UnitAI.prototype.OnGlobalConstructionFinished = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |3955|3955| if (msg.starting && !msg.error) |3956|3956| this.UnitFsm.ProcessMessage(this, {"type": "MoveStarted", "data": msg}); |3957|3957| else if (!msg.starting || msg.error) |3958| |- this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg}); | |3958|+ this.UnitFsm.ProcessMessage(this, {"type": "MoveCompleted", "data": msg }); |3959|3959| }; |3960|3960| |3961|3961| UnitAI.prototype.OnGlobalConstructionFinished = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |3963|3963| // TODO: This is a bit inefficient since every unit listens to every |3964|3964| // construction message - ideally we could scope it to only the one we're building |3965|3965| |3966| |- this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg}); | |3966|+ this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg}); |3967|3967| }; |3968|3968| |3969|3969| UnitAI.prototype.OnGlobalEntityRenamed = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |3963|3963| // TODO: This is a bit inefficient since every unit listens to every |3964|3964| // construction message - ideally we could scope it to only the one we're building |3965|3965| |3966| |- this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg}); | |3966|+ this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg }); |3967|3967| }; |3968|3968| |3969|3969| UnitAI.prototype.OnGlobalEntityRenamed = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |3988|3988| |3989|3989| UnitAI.prototype.OnAttacked = function(msg) |3990|3990| { |3991| |- this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg}); | |3991|+ this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg}); |3992|3992| }; |3993|3993| |3994|3994| UnitAI.prototype.OnGuardedAttacked = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |3988|3988| |3989|3989| UnitAI.prototype.OnAttacked = function(msg) |3990|3990| { |3991| |- this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg}); | |3991|+ this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg }); |3992|3992| }; |3993|3993| |3994|3994| UnitAI.prototype.OnGuardedAttacked = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |3993|3993| |3994|3994| UnitAI.prototype.OnGuardedAttacked = function(msg) |3995|3995| { |3996| |- this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data}); | |3996|+ this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data}); |3997|3997| }; |3998|3998| |3999|3999| UnitAI.prototype.OnHealthChanged = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |3993|3993| |3994|3994| UnitAI.prototype.OnGuardedAttacked = function(msg) |3995|3995| { |3996| |- this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data}); | |3996|+ this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data }); |3997|3997| }; |3998|3998| |3999|3999| UnitAI.prototype.OnHealthChanged = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |3998|3998| |3999|3999| UnitAI.prototype.OnHealthChanged = function(msg) |4000|4000| { |4001| |- this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to}); | |4001|+ this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to}); |4002|4002| }; |4003|4003| |4004|4004| UnitAI.prototype.OnRangeUpdate = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |3998|3998| |3999|3999| UnitAI.prototype.OnHealthChanged = function(msg) |4000|4000| { |4001| |- this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to}); | |4001|+ this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to }); |4002|4002| }; |4003|4003| |4004|4004| UnitAI.prototype.OnRangeUpdate = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |4004|4004| UnitAI.prototype.OnRangeUpdate = function(msg) |4005|4005| { |4006|4006| if (msg.tag == this.losRangeQuery) |4007| |- this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg}); | |4007|+ this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg}); |4008|4008| else if (msg.tag == this.losHealRangeQuery) |4009|4009| this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg}); |4010|4010| }; | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |4004|4004| UnitAI.prototype.OnRangeUpdate = function(msg) |4005|4005| { |4006|4006| if (msg.tag == this.losRangeQuery) |4007| |- this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg}); | |4007|+ this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg }); |4008|4008| else if (msg.tag == this.losHealRangeQuery) |4009|4009| this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg}); |4010|4010| }; | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |4006|4006| if (msg.tag == this.losRangeQuery) |4007|4007| this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg}); |4008|4008| else if (msg.tag == this.losHealRangeQuery) |4009| |- this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg}); | |4009|+ this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg}); |4010|4010| }; |4011|4011| |4012|4012| UnitAI.prototype.OnPackFinished = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |4006|4006| if (msg.tag == this.losRangeQuery) |4007|4007| this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg}); |4008|4008| else if (msg.tag == this.losHealRangeQuery) |4009| |- this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg}); | |4009|+ this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg }); |4010|4010| }; |4011|4011| |4012|4012| UnitAI.prototype.OnPackFinished = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |4011|4011| |4012|4012| UnitAI.prototype.OnPackFinished = function(msg) |4013|4013| { |4014| |- this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed}); | |4014|+ this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed}); |4015|4015| }; |4016|4016| |4017|4017| //// Helper functions to be called by the FSM //// | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |4011|4011| |4012|4012| UnitAI.prototype.OnPackFinished = function(msg) |4013|4013| { |4014| |- this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed}); | |4014|+ this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed }); |4015|4015| }; |4016|4016| |4017|4017| //// Helper functions to be called by the FSM //// | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |4014|4014| this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed}); |4015|4015| }; |4016|4016| |4017| |-//// Helper functions to be called by the FSM //// | |4017|+// // Helper functions to be called by the FSM //// |4018|4018| |4019|4019| UnitAI.prototype.GetWalkSpeed = function() |4020|4020| { | | [NORMAL] ESLintBear (semi): | | Missing semicolon. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |4116|4116| if (!cmpOwnership || cmpOwnership.GetOwner() == INVALID_PLAYER) |4117|4117| return undefined; |4118|4118| |4119| |- let cmpPosition = Engine.QueryInterface(this.entity, IID_Position) | |4119|+ let cmpPosition = Engine.QueryInterface(this.entity, IID_Position); |4120|4120| if (!cmpPosition || !cmpPosition.IsInWorld()) |4121|4121| return undefined; |4122|4122| | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'else'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |4201|4201| PlaySound(name, member); |4202|4202| } |4203|4203| else |4204| |- { | |4204|+ |4205|4205| // Otherwise use our own sounds |4206|4206| PlaySound(name, this.entity); |4207| |- } | |4207|+ |4208|4208| }; |4209|4209| |4210|4210| /* | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |4297|4297| UnitAI.prototype.MoveTo = function(data, iid, type) |4298|4298| { |4299|4299| if (data["target"]) |4300| |- { | |4300|+ |4301|4301| if (data["min"] || data["max"]) |4302|4302| return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1); |4303|4303| else |4307|4307| else |4308|4308| return this.MoveToTargetRange(data.target, iid, type); |4309|4309| } |4310| |- } | |4310|+ |4311|4311| else |4312|4312| { |4313|4313| if (data["min"] || data["max"]) | | [NORMAL] ESLintBear (dot-notation): | | ["target"] is better written in dot notation. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |4296|4296| */ |4297|4297| UnitAI.prototype.MoveTo = function(data, iid, type) |4298|4298| { |4299| |- if (data["target"]) | |4299|+ if (data.target) |4300|4300| { |4301|4301| if (data["min"] || data["max"]) |4302|4302| return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1); | | [NORMAL] ESLintBear (dot-notation): | | ["min"] is better written in dot notation. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |4298|4298| { |4299|4299| if (data["target"]) |4300|4300| { |4301| |- if (data["min"] || data["max"]) | |4301|+ if (data.min || data["max"]) |4302|4302| return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1); |4303|4303| else |4304|4304| { | | [NORMAL] ESLintBear (dot-notation): | | ["max"] is better written in dot notation. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |4298|4298| { |4299|4299| if (data["target"]) |4300|4300| { |4301| |- if (data["min"] || data["max"]) | |4301|+ if (data["min"] || data.max) |4302|4302| return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1); |4303|4303| else |4304|4304| { | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'else'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |4301|4301| if (data["min"] || data["max"]) |4302|4302| return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1); |4303|4303| else |4304| |- { | |4304|+ |4305|4305| if (!iid) |4306|4306| return this.MoveToTarget(data.target); |4307|4307| else |4308|4308| return this.MoveToTargetRange(data.target, iid, type); |4309| |- } | |4309|+ |4310|4310| } |4311|4311| else |4312|4312| { | | [NORMAL] ESLintBear (no-else-return): | | Unnecessary 'else' after 'return'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |4300|4300| { |4301|4301| if (data["min"] || data["max"]) |4302|4302| return this.MoveToTargetRangeExplicit(data.target, data.min || -1, data.max || -1); |4303| |- else |4304| |- { | |4303|+ |4305|4304| if (!iid) |4306|4305| return this.MoveToTarget(data.target); |4307|4306| else |4308|4307| return this.MoveToTargetRange(data.target, iid, type); |4309| |- } | |4308|+ |4310|4309| } |4311|4310| else |4312|4311| { | | [NORMAL] ESLintBear (no-else-return): | | Unnecessary 'else' after 'return'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |4304|4304| { |4305|4305| if (!iid) |4306|4306| return this.MoveToTarget(data.target); |4307| |- else |4308| |- return this.MoveToTargetRange(data.target, iid, type); | |4307|+ return this.MoveToTargetRange(data.target, iid, type); |4309|4308| } |4310|4309| } |4311|4310| else | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'else'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |4309|4309| } |4310|4310| } |4311|4311| else |4312| |- { | |4312|+ |4313|4313| if (data["min"] || data["max"]) |4314|4314| return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1); |4315|4315| else |4316|4316| return this.MoveToPoint(data.x, data.z); |4317| |- } | |4317|+ |4318|4318| } |4319|4319| |4320|4320| UnitAI.prototype.MoveToPoint = function(x, z) | | [NORMAL] ESLintBear (dot-notation): | | ["min"] is better written in dot notation. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |4310|4310| } |4311|4311| else |4312|4312| { |4313| |- if (data["min"] || data["max"]) | |4313|+ if (data.min || data["max"]) |4314|4314| return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1); |4315|4315| else |4316|4316| return this.MoveToPoint(data.x, data.z); | | [NORMAL] ESLintBear (dot-notation): | | ["max"] is better written in dot notation. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |4310|4310| } |4311|4311| else |4312|4312| { |4313| |- if (data["min"] || data["max"]) | |4313|+ if (data["min"] || data.max) |4314|4314| return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1); |4315|4315| else |4316|4316| return this.MoveToPoint(data.x, data.z); | | [NORMAL] ESLintBear (no-else-return): | | Unnecessary 'else' after 'return'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |4312|4312| { |4313|4313| if (data["min"] || data["max"]) |4314|4314| return this.MoveToPointRange(data.x, data.z, data.min || -1, data.max || -1); |4315| |- else |4316| |- return this.MoveToPoint(data.x, data.z); | |4315|+ return this.MoveToPoint(data.x, data.z); |4317|4316| } |4318|4317| } |4319|4318| | | [NORMAL] ESLintBear (semi): | | Missing semicolon. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |4315|4315| else |4316|4316| return this.MoveToPoint(data.x, data.z); |4317|4317| } |4318| |-} | |4318|+}; |4319|4319| |4320|4320| UnitAI.prototype.MoveToPoint = function(x, z) |4321|4321| { | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |4399|4399| else |4400|4400| // return false? Or hope you come close enough? |4401|4401| var parabolicMaxRange = 0; |4402| |- //return false; | |4402|+ // return false; |4403|4403| |4404|4404| // the parabole changes while walking, take something in the middle |4405|4405| var guessedMaxRange = (range.max + parabolicMaxRange)/2; | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |4464|4464| if (this.IsFormationMember()) |4465|4465| { |4466|4466| var cmpFormationUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI); |4467| |- if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation() |4468| |- && cmpFormationUnitAI.order.data.target == target) | |4467|+ if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation() && | |4468|+ cmpFormationUnitAI.order.data.target == target) |4469|4469| return true; |4470|4470| } |4471|4471| | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |4632|4632| UnitAI.prototype.AttackEntityInZone = function(ents) |4633|4633| { |4634|4634| var target = ents.find(target => |4635| |- this.CanAttack(target) |4636| |- && this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) | |4635|+ this.CanAttack(target) && | |4636|+ this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) |4637|4637| && (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target)) |4638|4638| ); |4639|4639| if (!target) | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |4633|4633| { |4634|4634| var target = ents.find(target => |4635|4635| this.CanAttack(target) |4636| |- && this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) |4637| |- && (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target)) | |4636|+ && this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) && | |4637|+ (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target)) |4638|4638| ); |4639|4639| if (!target) |4640|4640| return false; | | [NORMAL] ESLintBear (no-multi-spaces): | | Multiple spaces found before 'Engine'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |4697|4697| // If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker |4698|4698| if (this.isGuardOf) |4699|4699| { |4700| |- var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI); | |4700|+ var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI); |4701|4701| var cmpAttack = Engine.QueryInterface(target, IID_Attack); |4702|4702| if (cmpUnitAI && cmpAttack && |4703|4703| cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type))) | | [NORMAL] ESLintBear (indent): | | Expected indentation of 3 tabs but found 4. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |4701|4701| var cmpAttack = Engine.QueryInterface(target, IID_Attack); |4702|4702| if (cmpUnitAI && cmpAttack && |4703|4703| cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type))) |4704| |- return false; | |4704|+ return false; |4705|4705| } |4706|4706| |4707|4707| // Stop if we're in hold-ground mode and it's too far from the holding point | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |4706|4706| |4707|4707| // Stop if we're in hold-ground mode and it's too far from the holding point |4708|4708| if (this.GetStance().respondHoldGround) |4709| |- { | |4709|+ |4710|4710| if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type)) |4711|4711| return true; |4712| |- } | |4712|+ |4713|4713| |4714|4714| // Stop if it's left our vision range, unless we're especially persistent |4715|4715| if (!this.GetStance().respondChaseBeyondVision) | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |4713|4713| |4714|4714| // Stop if it's left our vision range, unless we're especially persistent |4715|4715| if (!this.GetStance().respondChaseBeyondVision) |4716| |- { | |4716|+ |4717|4717| if (!this.CheckTargetIsInVisionRange(target)) |4718|4718| return true; |4719| |- } | |4719|+ |4720|4720| |4721|4721| // (Note that CCmpUnitMotion will detect if the target is lost in FoW, |4722|4722| // and will continue moving to its last seen position and then stop) | | [NORMAL] ESLintBear (no-multi-spaces): | | Multiple spaces found before 'Engine'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |4739|4739| // If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker |4740|4740| if (this.isGuardOf) |4741|4741| { |4742| |- let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI); | |4742|+ let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI); |4743|4743| let cmpAttack = Engine.QueryInterface(target, IID_Attack); |4744|4744| if (cmpUnitAI && cmpAttack && |4745|4745| cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type))) | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |4752|4752| return false; |4753|4753| }; |4754|4754| |4755| |-//// External interface functions //// | |4755|+// // External interface functions //// |4756|4756| |4757|4757| UnitAI.prototype.SetFormationController = function(ent) |4758|4758| { | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |4762|4762| // of our own formation (or ourself if not in formation) |4763|4763| var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction); |4764|4764| if (cmpObstruction) |4765| |- { | |4765|+ |4766|4766| if (ent == INVALID_ENTITY) |4767|4767| cmpObstruction.SetControlGroup(this.entity); |4768|4768| else |4769|4769| cmpObstruction.SetControlGroup(ent); |4770| |- } | |4770|+ |4771|4771| |4772|4772| // If we were removed from a formation, let the FSM switch back to INDIVIDUAL |4773|4773| if (ent == INVALID_ENTITY) | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |4905|4905| // if we already had an old guard order, do nothing if the target is the same |4906|4906| // and the order is running, otherwise remove the previous order |4907|4907| if (this.isGuardOf) |4908| |- { | |4908|+ |4909|4909| if (this.isGuardOf == target && this.order && this.order.type == "Guard") |4910|4910| return; |4911|4911| else |4912|4912| this.RemoveGuard(); |4913| |- } | |4913|+ |4914|4914| |4915|4915| this.AddOrder("Guard", { "target": target, "force": false }, queued); |4916|4916| }; | | [NORMAL] ESLintBear (no-else-return): | | Unnecessary 'else' after 'return'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |4908|4908| { |4909|4909| if (this.isGuardOf == target && this.order && this.order.type == "Guard") |4910|4910| return; |4911| |- else |4912| |- this.RemoveGuard(); | |4911|+ this.RemoveGuard(); |4913|4912| } |4914|4913| |4915|4914| this.AddOrder("Guard", { "target": target, "force": false }, queued); | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |5079|5079| this.WalkToTarget(target, queued); |5080|5080| return; |5081|5081| } |5082| |- this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture}, queued); | |5082|+ this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture }, queued); |5083|5083| }; |5084|5084| |5085|5085| /** | | [NORMAL] ESLintBear (no-trailing-spaces): | | Trailing spaces not allowed. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |5228|5228| this.workOrders.length && this.workOrders[0].type == "Trade") |5229|5229| { |5230|5230| let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader); |5231| |- if (cmpTrader.HasBothMarkets() && | |5231|+ if (cmpTrader.HasBothMarkets() && |5232|5232| (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source || |5233|5233| cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target)) |5234|5234| { | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |5509|5509| { |5510|5510| var cmpIdentity = Engine.QueryInterface(targ, IID_Identity); |5511|5511| var targetClasses = this.order.data.targetClasses; |5512| |- if (targetClasses.attack && cmpIdentity |5513| |- && !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack)) | |5512|+ if (targetClasses.attack && cmpIdentity && | |5513|+ !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack)) |5514|5514| continue; |5515|5515| if (targetClasses.avoid && cmpIdentity |5516|5516| && MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid)) | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |5512|5512| if (targetClasses.attack && cmpIdentity |5513|5513| && !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack)) |5514|5514| continue; |5515| |- if (targetClasses.avoid && cmpIdentity |5516| |- && MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid)) | |5515|+ if (targetClasses.avoid && cmpIdentity && | |5516|+ MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid)) |5517|5517| continue; |5518|5518| // Only used by the AIs to prevent some choices of targets |5519|5519| if (targetClasses.vetoEntities && targetClasses.vetoEntities[targ]) | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |5535|5535| { |5536|5536| var cmpIdentity = Engine.QueryInterface(targ, IID_Identity); |5537|5537| var targetClasses = this.order.data.targetClasses; |5538| |- if (cmpIdentity && targetClasses.attack |5539| |- && !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack)) | |5538|+ if (cmpIdentity && targetClasses.attack && | |5539|+ !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack)) |5540|5540| continue; |5541|5541| if (cmpIdentity && targetClasses.avoid |5542|5542| && MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid)) | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |5538|5538| if (cmpIdentity && targetClasses.attack |5539|5539| && !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack)) |5540|5540| continue; |5541| |- if (cmpIdentity && targetClasses.avoid |5542| |- && MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid)) | |5541|+ if (cmpIdentity && targetClasses.avoid && | |5542|+ MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid)) |5543|5543| continue; |5544|5544| // Only used by the AIs to prevent some choices of targets |5545|5545| if (targetClasses.vetoEntities && targetClasses.vetoEntities[targ]) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |5681|5681| |5682|5682| UnitAI.prototype.SetHeldPosition = function(x, z) |5683|5683| { |5684| |- this.heldPosition = {"x": x, "z": z}; | |5684|+ this.heldPosition = { "x": x, "z": z}; |5685|5685| }; |5686|5686| |5687|5687| UnitAI.prototype.SetHeldPositionOnEntity = function(entity) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |5681|5681| |5682|5682| UnitAI.prototype.SetHeldPosition = function(x, z) |5683|5683| { |5684| |- this.heldPosition = {"x": x, "z": z}; | |5684|+ this.heldPosition = {"x": x, "z": z }; |5685|5685| }; |5686|5686| |5687|5687| UnitAI.prototype.SetHeldPositionOnEntity = function(entity) | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |5708|5708| return false; |5709|5709| }; |5710|5710| |5711| |-//// Helper functions //// | |5711|+// // Helper functions //// |5712|5712| |5713|5713| UnitAI.prototype.CanAttack = function(target) |5714|5714| { | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |5912|5912| return cmpPack && cmpPack.IsPacking(); |5913|5913| }; |5914|5914| |5915| |-//// Formation specific functions //// | |5915|+// // Formation specific functions //// |5916|5916| |5917|5917| UnitAI.prototype.IsAttackingAsFormation = function() |5918|5918| { | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |5917|5917| UnitAI.prototype.IsAttackingAsFormation = function() |5918|5918| { |5919|5919| var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack); |5920| |- return cmpAttack && cmpAttack.CanAttackAsFormation() |5921| |- && this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING"; | |5920|+ return cmpAttack && cmpAttack.CanAttackAsFormation() && | |5921|+ this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING"; |5922|5922| }; |5923|5923| |5924|5924| //// Animal specific functions //// | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/simulation/components/UnitAI.js |5921|5921| && this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING"; |5922|5922| }; |5923|5923| |5924| |-//// Animal specific functions //// | |5924|+// // Animal specific functions //// |5925|5925| |5926|5926| UnitAI.prototype.MoveRandomly = function(distance) |5927|5927| { 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 | 895| » » » "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 | 920| » » » "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 | 938| » » » "leave":·function(msg)·{ | | [NORMAL] ESLintBear (no-dupe-keys): | | Duplicate key 'leave'. binaries/data/mods/public/simulation/components/UnitAI.js | 973| » » » » » return·true; | | [NORMAL] ESLintBear (consistent-return): | | Method 'enter' expected no return value. binaries/data/mods/public/simulation/components/UnitAI.js |1036| » » » » "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 |1074| » » » "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 |1107| » » » » "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 |1320| » » » "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 |1505| » » » "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 |1525| » » » "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 |1554| » » » "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 |1708| » » » "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 |1758| » » » » "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 |1844| » » » » » » » » return·true; | | [NORMAL] ESLintBear (consistent-return): | | Method 'enter' expected no return value. binaries/data/mods/public/simulation/components/UnitAI.js |2016| » » » » "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 |2202| » » » » "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| » » » » » » let·nearby·=·this.FindNearestDropsite(resourceType.generic); | | [NORMAL] ESLintBear (no-shadow): | | 'nearby' is already declared in the upper scope. binaries/data/mods/public/simulation/components/UnitAI.js |2474| » » » » "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 |2592| » » » » "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 |2657| » » » » "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 |2694| » » » » "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 |2903| » » » » "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 |3086| » » » » "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 |3818| » 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 |4619| » 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 |4634| » 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 |4680| » 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 |4703| » » ····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 |5159| » var·lastPos·=·undefined; | | [NORMAL] ESLintBear (no-undef-init): | | It's not necessary to initialize 'lastPos' to undefined. binaries/data/mods/public/simulation/components/UnitAI.js | 358| » » ····&&·(this.lastShorelinePosition.z·==·cmpPosition.GetPosition().z)) | | [NORMAL] JSHintBear: | | Misleading line break before '&&'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/components/UnitAI.js | 938| » » » "leave":·function(msg)·{ | | [NORMAL] JSHintBear: | | Duplicate key 'leave'. binaries/data/mods/public/simulation/components/UnitAI.js |1869| » » » » » » var·cmpFormation·=·Engine.QueryInterface(this.formationController,·IID_Formation); | | [NORMAL] JSHintBear: | | 'cmpFormation' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |2010| » » » » » » &&·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 |2089| » » » » » » » » ·&&·((type.generic·==·"treasure"·&&·oldType.generic·==·"treasure") | | [NORMAL] JSHintBear: | | Misleading line break before '&&'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/components/UnitAI.js |2090| » » » » » » » » ·||·(type.specific·==·oldType.specific | | [NORMAL] JSHintBear: | | Misleading line break before '||'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/components/UnitAI.js |2091| » » » » » » » » ·&&·(type.specific·!=·"meat"·||·oldTemplate·==·template))) | | [NORMAL] JSHintBear: | | Misleading line break before '&&'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/components/UnitAI.js |2114| » » » » » » » » var·nearby·=·this.FindNearestDropsite(oldType.generic); | | [NORMAL] JSHintBear: | | 'nearby' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |2164| » » » » » » » » &&·((type.generic·==·"treasure"·&&·oldType.generic·==·"treasure") | | [NORMAL] JSHintBear: | | Misleading line break before '&&'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/components/UnitAI.js |2165| » » » » » » » » ||·(type.specific·==·oldType.specific | | [NORMAL] JSHintBear: | | Misleading line break before '||'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/components/UnitAI.js |2166| » » » » » » » » &&·(type.specific·!=·"meat"·||·oldTemplate·==·template))) | | [NORMAL] JSHintBear: | | Misleading line break before '&&'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/components/UnitAI.js |2224| » » » » » » » ||·(type.specific·==·resourceType.specific | | [NORMAL] JSHintBear: | | Misleading line break before '||'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/components/UnitAI.js |2225| » » » » » » » &&·(type.specific·!=·"meat"·||·resourceTemplate·==·template)) | | [NORMAL] JSHintBear: | | Misleading line break before '&&'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/components/UnitAI.js |2241| » » » » » var·nearby·=·this.FindNearestDropsite(resourceType.generic); | | [NORMAL] JSHintBear: | | 'nearby' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |2414| » » » » » var·cmpResourceGatherer·=·Engine.QueryInterface(this.entity,·IID_ResourceGatherer); | | [NORMAL] JSHintBear: | | 'cmpResourceGatherer' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |2430| » » » » » var·nearby·=·this.FindNearbyResource(function(ent,·type,·template)·{ | | [NORMAL] JSHintBear: | | 'nearby' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |2433| » » » » » » » ||·(type.specific·==·resourceType.specific | | [NORMAL] JSHintBear: | | Misleading line break before '||'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/components/UnitAI.js |2434| » » » » » » » &&·(type.specific·!=·"meat"·||·resourceTemplate·==·template)) | | [NORMAL] JSHintBear: | | Misleading line break before '&&'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/components/UnitAI.js |2454| » » » » » var·nearby·=·this.FindNearestDropsite(resourceType.generic); | | [NORMAL] JSHintBear: | | 'nearby' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |2634| » » » » » var·cmpResourceGatherer·=·Engine.QueryInterface(this.entity,·IID_ResourceGatherer); | | [NORMAL] JSHintBear: | | 'cmpResourceGatherer' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |2850| » » » » » var·cmpResourceDropsite·=·Engine.QueryInterface(msg.data.newentity,·IID_ResourceDropsite); | | [NORMAL] JSHintBear: | | 'cmpResourceDropsite' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |2935| » » » » » if·(this.CanGarrison(target)) | | [NORMAL] JSHintBear: | | 'target' used out of scope. binaries/data/mods/public/simulation/components/UnitAI.js |2938| » » » » » » if·(this.CheckGarrisonRange(target)) | | [NORMAL] JSHintBear: | | 'target' used out of scope. binaries/data/mods/public/simulation/components/UnitAI.js |2940| » » » » » » » var·cmpGarrisonHolder·=·Engine.QueryInterface(target,·IID_GarrisonHolder); | | [NORMAL] JSHintBear: | | 'target' used out of scope. binaries/data/mods/public/simulation/components/UnitAI.js |2962| » » » » » » » » var·cmpResourceDropsite·=·Engine.QueryInterface(target,·IID_ResourceDropsite); | | [NORMAL] JSHintBear: | | 'target' used out of scope. binaries/data/mods/public/simulation/components/UnitAI.js |2963| » » » » » » » » if·(cmpResourceDropsite·&&·this.CanReturnResource(target,·true)) | | [NORMAL] JSHintBear: | | 'target' used out of scope. binaries/data/mods/public/simulation/components/UnitAI.js |2978| » » » » » » » » » var·cmpHolderPosition·=·Engine.QueryInterface(target,·IID_Position); | | [NORMAL] JSHintBear: | | 'target' used out of scope. binaries/data/mods/public/simulation/components/UnitAI.js |2979| » » » » » » » » » var·cmpHolderUnitAI·=·Engine.QueryInterface(target,·IID_UnitAI); | | [NORMAL] JSHintBear: | | 'target' used out of scope. binaries/data/mods/public/simulation/components/UnitAI.js |3006| » » » » » » » if·(!this.CheckTargetRangeExplicit(target,·0,·0)·&&·this.MoveToTarget(target)) | | [NORMAL] JSHintBear: | | 'target' used out of scope. binaries/data/mods/public/simulation/components/UnitAI.js |3006| » » » » » » » if·(!this.CheckTargetRangeExplicit(target,·0,·0)·&&·this.MoveToTarget(target)) | | [NORMAL] JSHintBear: | | 'target' used out of scope. binaries/data/mods/public/simulation/components/UnitAI.js |3780| » » var·order·=·{·"type":·type,·"data":·data·}; | | [NORMAL] JSHintBear: | | 'order' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |3849| » for·(var·i·=·0;·i·<·this.orderQueue.length;·++i) | | [NORMAL] JSHintBear: | | 'i' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |4119| » let·cmpPosition·=·Engine.QueryInterface(this.entity,·IID_Position) | | [NORMAL] JSHintBear: | | Missing semicolon. binaries/data/mods/public/simulation/components/UnitAI.js |4299| » if·(data["target"]) | | [NORMAL] JSHintBear: | | ['target'] is better written in dot notation. binaries/data/mods/public/simulation/components/UnitAI.js |4301| » » if·(data["min"]·||·data["max"]) | | [NORMAL] JSHintBear: | | ['min'] is better written in dot notation. binaries/data/mods/public/simulation/components/UnitAI.js |4301| » » if·(data["min"]·||·data["max"]) | | [NORMAL] JSHintBear: | | ['max'] is better written in dot notation. binaries/data/mods/public/simulation/components/UnitAI.js |4313| » » if·(data["min"]·||·data["max"]) | | [NORMAL] JSHintBear: | | ['min'] is better written in dot notation. binaries/data/mods/public/simulation/components/UnitAI.js |4313| » » if·(data["min"]·||·data["max"]) | | [NORMAL] JSHintBear: | | ['max'] is better written in dot notation. binaries/data/mods/public/simulation/components/UnitAI.js |4318| } | | [NORMAL] JSHintBear: | | Missing semicolon. binaries/data/mods/public/simulation/components/UnitAI.js |4401| » » var·parabolicMaxRange·=·0; | | [NORMAL] JSHintBear: | | 'parabolicMaxRange' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |4405| » var·guessedMaxRange·=·(range.max·+·parabolicMaxRange)/2; | | [NORMAL] JSHintBear: | | 'parabolicMaxRange' used out of scope. binaries/data/mods/public/simulation/components/UnitAI.js |4412| » return·cmpUnitMotion.MoveToTargetRange(target,·range.min,·Math.min(range.max,·parabolicMaxRange)); | | [NORMAL] JSHintBear: | | 'parabolicMaxRange' used out of scope. binaries/data/mods/public/simulation/components/UnitAI.js |4468| » » » &&·cmpFormationUnitAI.order.data.target·==·target) | | [NORMAL] JSHintBear: | | Misleading line break before '&&'; readers may interpret this as an expression boundary. binaries/data/mods/public/simulation/components/UnitAI.js |4636| » » &&·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 |4637| » » &&·(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 |5159| » var·lastPos·=·undefined; | | [NORMAL] JSHintBear: | | It's not necessary to initialize 'lastPos' to 'undefined'. binaries/data/mods/public/simulation/components/UnitAI.js |5513| » » » » » » &&·!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 |5516| » » » » » » &&·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 |5529| » var·targets·=·this.GetTargetsFromUnit(); | | [NORMAL] JSHintBear: | | 'targets' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5530| » for·(var·targ·of·targets) | | [NORMAL] JSHintBear: | | 'targ' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5530| » for·(var·targ·of·targets) | | [MAJOR] JSHintBear: | | Too many errors. (91% scanned). Executing section cli...
Link to build: https://jenkins.wildfiregames.com/job/differential/1592/display/redirect