Details
Details
- Reviewers
- None
- Group Reviewers
Restricted Owners Package (Owns No Changed Paths) - Commits
- rP22353: Fix repairing/garrisoning range checks following rP22351
Build a dock, make a ship, garrison units inside.
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 | 352| 352| var cmpPosition = Engine.QueryInterface(this.entity, IID_Position); | 353| 353| if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x) | 354| 354| && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z)) | 355| |- { | | 355|+ | 356| 356| // we were already on the shoreline, and have not moved since | 357| 357| if (DistanceBetweenEntities(this.entity, this.order.data.target) < 50) | 358| 358| needToMove = false; | 359| |- } | | 359|+ | 360| 360| | 361| 361| if (needToMove) | 362| 362| 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 | 350| 350| // Check if we need to move TODO implement a better way to know if we are on the shoreline | 351| 351| var needToMove = true; | 352| 352| var cmpPosition = Engine.QueryInterface(this.entity, IID_Position); | 353| |- if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x) | 354| |- && (this.lastShorelinePosition.z == cmpPosition.GetPosition().z)) | | 353|+ if (this.lastShorelinePosition && cmpPosition && (this.lastShorelinePosition.x == cmpPosition.GetPosition().x) && | | 354|+ (this.lastShorelinePosition.z == cmpPosition.GetPosition().z)) | 355| 355| { | 356| 356| // we were already on the shoreline, and have not moved since | 357| 357| 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 | 515| 515| this.PushOrderFront("Walk", this.order.data.lastPos); | 516| 516| } | 517| 517| else | 518| |- { | | 518|+ | 519| 519| // We couldn't move there, or the target moved away | 520| 520| this.FinishOrder(); | 521| |- } | | 521|+ | 522| 522| return; | 523| 523| } | 524| 524| | | [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 | 730| 730| } | 731| 731| // Check if we are already in range, otherwise walk there | 732| 732| if (!this.CheckGarrisonRange(msg.data.target)) | 733| |- { | | 733|+ | 734| 734| if (!this.CheckTargetVisible(msg.data.target)) | 735| 735| { | 736| 736| this.FinishOrder(); | 741| 741| this.SetNextState("GARRISON.APPROACHING"); | 742| 742| return; | 743| 743| } | 744| |- } | | 744|+ | 745| 745| | 746| 746| this.SetNextState("GARRISON.GARRISONING"); | 747| 747| }, | | [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 | 736| 736| this.FinishOrder(); | 737| 737| return; | 738| 738| } | 739| |- else | 740| |- { | | 739|+ | 741| 740| this.SetNextState("GARRISON.APPROACHING"); | 742| 741| return; | 743| |- } | | 742|+ | 744| 743| } | 745| 744| | 746| 745| 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 | 759| 759| this.PushOrderFront("Walk", msg.data.lastPos); | 760| 760| } | 761| 761| else | 762| |- { | | 762|+ | 763| 763| // We couldn't move there, or the target moved away | 764| 764| this.FinishOrder(); | 765| |- } | | 765|+ | 766| 766| return; | 767| 767| } | 768| 768| | | [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 | 992| 992| }, | 993| 993| }, | 994| 994| | 995| |- "GARRISON":{ | | 995|+ "GARRISON": { | 996| 996| "enter": function() { | 997| 997| // If the garrisonholder should pickup, warn it so it can take needed action | 998| 998| 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 |1205|1205| // If the controller handled an order but some members rejected it, |1206|1206| // they will have no orders and be in the FORMATIONMEMBER.IDLE state. |1207|1207| if (this.orderQueue.length) |1208| |- { | |1208|+ |1209|1209| // We're leaving the formation, so stop our FormationWalk order |1210|1210| if (this.FinishOrder()) |1211|1211| return; |1212| |- } | |1212|+ |1213|1213| |1214|1214| // No orders left, we're an individual now |1215|1215| 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 |1233|1233| // Move a tile outside the building |1234|1234| let range = 4; |1235|1235| if (this.CheckTargetRangeExplicit(msg.data.target, range, range)) |1236| |- { | |1236|+ |1237|1237| // We are already at the target, or can't move at all |1238|1238| this.FinishOrder(); |1239| |- } | |1239|+ |1240|1240| else |1241|1241| { |1242|1242| 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 |1454|1454| |1455|1455| "LosRangeUpdate": function(msg) { |1456|1456| if (this.GetStance().targetVisibleEnemies) |1457| |- { | |1457|+ |1458|1458| // Start attacking one of the newly-seen enemy (if any) |1459|1459| this.AttackEntitiesByPreference(msg.data.added); |1460| |- } | |1460|+ |1461|1461| }, |1462|1462| |1463|1463| "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 |1487|1487| this.SelectAnimation("move"); |1488|1488| }, |1489|1489| |1490| |- "leave": function () { | |1490|+ "leave": function() { |1491|1491| this.SelectAnimation("idle"); |1492|1492| this.StopMoving(); |1493|1493| }, | | [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 |1667|1667| // if nothing better to do, check if the guarded needs to be healed or repaired |1668|1668| var cmpHealth = Engine.QueryInterface(this.isGuardOf, IID_Health); |1669|1669| if (cmpHealth && cmpHealth.IsInjured()) |1670| |- { | |1670|+ |1671|1671| if (this.CanHeal(this.isGuardOf)) |1672|1672| this.PushOrderFront("Heal", { "target": this.isGuardOf, "force": false }); |1673|1673| else if (this.CanRepair(this.isGuardOf)) |1674|1674| this.PushOrderFront("Repair", { "target": this.isGuardOf, "autocontinue": false, "force": false }); |1675| |- } | |1675|+ |1676|1676| } |1677|1677| }, |1678|1678| | | [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 |1794|1794| } |1795|1795| // Check the target is still alive and attackable |1796|1796| if (this.CanAttack(target) && !this.CheckTargetAttackRange(target, this.order.data.attackType)) |1797| |- { | |1797|+ |1798|1798| // Can't reach it - try to chase after it |1799|1799| if (this.ShouldChaseTargetedEntity(target, this.order.data.force)) |1800|1800| { |1809|1809| return true; |1810|1810| } |1811|1811| } |1812| |- } | |1812|+ |1813|1813| |1814|1814| this.StopMoving(); |1815|1815| | | [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 |1842|1842| // TODO: we should probably only bother syncing projectile attacks, not melee |1843|1843| |1844|1844| // If using a non-default prepare time, re-sync the animation when the timer runs. |1845| |- this.resyncAnimation = (prepare != this.attackTimers.prepare) ? true : false; | |1845|+ this.resyncAnimation = (prepare != this.attackTimers.prepare); |1846|1846| |1847|1847| this.FaceTowardsTarget(this.order.data.target); |1848|1848| | | [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 |1971|1971| |1972|1972| "Attacked": function(msg) { |1973|1973| // If we are capturing and are attacked by something that we would not capture, attack that entity instead |1974| |- if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) |1975| |- && this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture") | |1974|+ if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) && | |1975|+ this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture") |1976|1976| this.RespondToTargetedEntities([msg.data.attacker]); |1977|1977| }, |1978|1978| }, | | [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 |1991|1991| this.SelectAnimation("move"); |1992|1992| var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI); |1993|1993| if (cmpUnitAI && cmpUnitAI.IsFleeing()) |1994| |- { | |1994|+ |1995|1995| // Run after a fleeing target |1996|1996| this.SetSpeedMultiplier(this.GetRunMultiplier()); |1997| |- } | |1997|+ |1998|1998| this.StartTimer(1000, 1000); |1999|1999| }, |2000|2000| | | [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 |2173|2173| |2174|2174| var cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply); |2175|2175| if (cmpSupply && cmpSupply.IsAvailable(cmpOwnership.GetOwner(), this.entity)) |2176| |- { | |2176|+ |2177|2177| // Check we can still reach and gather from the target |2178|2178| if (this.CheckTargetRange(this.gatheringTarget, IID_ResourceGatherer) && this.CanGather(this.gatheringTarget)) |2179|2179| { |2238|2238| return; |2239|2239| } |2240|2240| } |2241| |- } | |2241|+ |2242|2242| |2243|2243| // We're already in range, can't get anywhere near it or the target is exhausted. |2244|2244| | | [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 |2264|2264| // Also don't switch to a different type of huntable animal |2265|2265| var nearby = this.FindNearbyResource(function(ent, type, template) { |2266|2266| return ( |2267| |- (type.generic == "treasure" && resourceType.generic == "treasure") |2268| |- || (type.specific == resourceType.specific | |2267|+ (type.generic == "treasure" && resourceType.generic == "treasure") || | |2268|+ (type.specific == resourceType.specific |2269|2269| && (type.specific != "meat" || resourceTemplate == template)) |2270|2270| ); |2271|2271| }); | | [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 |2265|2265| var nearby = this.FindNearbyResource(function(ent, type, template) { |2266|2266| return ( |2267|2267| (type.generic == "treasure" && resourceType.generic == "treasure") |2268| |- || (type.specific == resourceType.specific |2269| |- && (type.specific != "meat" || resourceTemplate == template)) | |2268|+ || (type.specific == resourceType.specific && | |2269|+ (type.specific != "meat" || resourceTemplate == template)) |2270|2270| ); |2271|2271| }); |2272|2272| 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 |2330|2330| |2331|2331| "Timer": function(msg) { |2332|2332| if (this.ShouldAbandonChase(this.order.data.target, this.order.data.force, IID_Heal, null)) |2333| |- { | |2333|+ |2334|2334| // Return to our original position unless we have a better order. |2335|2335| if (!this.FinishOrder() && this.GetStance().respondHoldGround) |2336|2336| this.WalkToHeldPosition(); |2337| |- } | |2337|+ |2338|2338| }, |2339|2339| |2340|2340| "MovementUpdate": 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 |2364|2364| this.StartTimer(prepare, this.healTimers.repeat); |2365|2365| |2366|2366| // If using a non-default prepare time, re-sync the animation when the timer runs. |2367| |- this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false; | |2367|+ this.resyncAnimation = (prepare != this.healTimers.prepare); |2368|2368| |2369|2369| this.FaceTowardsTarget(this.order.data.target); |2370|2370| }, | | [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 |2580|2580| { |2581|2581| // The building was already finished/fully repaired before we arrived; |2582|2582| // let the ConstructionFinished handler handle this. |2583| |- this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget}); | |2583|+ this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget}); |2584|2584| return true; |2585|2585| } |2586|2586| | | [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 |2580|2580| { |2581|2581| // The building was already finished/fully repaired before we arrived; |2582|2582| // let the ConstructionFinished handler handle this. |2583| |- this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget}); | |2583|+ this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget }); |2584|2584| return true; |2585|2585| } |2586|2586| | | [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 |2623|2623| if (!inRange && this.MoveToTargetRange(this.repairTarget, IID_Builder)) |2624|2624| this.SetNextState("APPROACHING"); |2625|2625| else if (!inRange) |2626| |- this.FinishOrder(); //can't approach and isn't in reach | |2626|+ this.FinishOrder(); // can't approach and isn't in reach |2627|2627| }, |2628|2628| }, |2629|2629| | | [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 |2710|2710| |2711|2711| // Unit was approaching and there's nothing to do now, so switch to walking |2712|2712| if (oldState === "INDIVIDUAL.REPAIR.APPROACHING") |2713| |- { | |2713|+ |2714|2714| // We're already walking to the given point, so add this as a order. |2715|2715| this.WalkToTarget(msg.data.newentity, true); |2716| |- } | |2716|+ |2717|2717| }, |2718|2718| }, |2719|2719| | | [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 |2773|2773| |2774|2774| // Check that we can garrison here |2775|2775| if (this.CanGarrison(target)) |2776| |- { | |2776|+ |2777|2777| // Check that we're in range of the garrison target |2778|2778| if (this.CheckGarrisonRange(target)) |2779|2779| { |2849|2849| return false; |2850|2850| } |2851|2851| } |2852| |- } | |2852|+ |2853|2853| // Garrisoning failed for some reason, so finish the order |2854|2854| this.FinishOrder(); |2855|2855| 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 |2971|2971| "Attacked": function(msg) { |2972|2972| if (this.template.NaturalBehaviour == "skittish" || |2973|2973| this.template.NaturalBehaviour == "passive") |2974| |- { | |2974|+ |2975|2975| this.Flee(msg.data.attacker, false); |2976| |- } | |2976|+ |2977|2977| else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive") |2978|2978| { |2979|2979| 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 |2980|2980| this.Attack(msg.data.attacker, false); |2981|2981| } |2982|2982| else if (this.template.NaturalBehaviour == "domestic") |2983| |- { | |2983|+ |2984|2984| // Never flee, stop what we were doing |2985|2985| this.SetNextState("IDLE"); |2986| |- } | |2986|+ |2987|2987| }, |2988|2988| |2989|2989| "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 |2994|2994| this.FinishOrder(); |2995|2995| return; |2996|2996| } |2997| |- else |2998| |- { | |2997|+ |2999|2998| this.order.data.min = range; |3000|2999| this.SetNextState("WALKING"); |3001| |- } | |3000|+ |3002|3001| }, |3003|3002| |3004|3003| "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 |3038|3038| } |3039|3039| // Start attacking one of the newly-seen enemy (if any) |3040|3040| else if (this.IsDangerousAnimal()) |3041| |- { | |3041|+ |3042|3042| this.AttackVisibleEntity(msg.data.added); |3043| |- } | |3043|+ |3044|3044| |3045|3045| // TODO: if two units enter our range together, we'll attack the |3046|3046| // 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 |3081|3081| } |3082|3082| // Start attacking one of the newly-seen enemy (if any) |3083|3083| else if (this.template.NaturalBehaviour == "violent") |3084| |- { | |3084|+ |3085|3085| this.AttackVisibleEntity(msg.data.added); |3086| |- } | |3086|+ |3087|3087| }, |3088|3088| |3089|3089| "Timer": function(msg) { | | [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 |3096|3096| "COMBAT": "INDIVIDUAL.COMBAT", // reuse the same combat behaviour for animals |3097|3097| |3098|3098| "WALKING": "INDIVIDUAL.WALKING", // reuse the same walking behaviour for animals |3099| |- // only used for domestic animals | |3099|+ // only used for domestic animals |3100|3100| }, |3101|3101| }; |3102|3102| | | [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 |3153|3153| |3154|3154| UnitAI.prototype.IsAnimal = function() |3155|3155| { |3156| |- return (this.template.NaturalBehaviour ? true : false); | |3156|+ return (!!this.template.NaturalBehaviour); |3157|3157| }; |3158|3158| |3159|3159| 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 |3191|3191| UnitAI.prototype.GetGarrisonHolder = function() |3192|3192| { |3193|3193| if (this.IsGarrisoned()) |3194| |- { | |3194|+ |3195|3195| for (let order of this.orderQueue) |3196|3196| if (order.type == "Garrison") |3197|3197| return order.data.target; |3198| |- } | |3198|+ |3199|3199| return INVALID_ENTITY; |3200|3200| }; |3201|3201| | | [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 |3269|3269| { |3270|3270| let index = this.GetCurrentState().indexOf("."); |3271|3271| if (index != -1) |3272| |- this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index)); | |3272|+ this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0, index)); |3273|3273| this.Stop(false); |3274|3274| } |3275|3275| | | [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 |3325|3325| if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity) |3326|3326| continue; |3327|3327| if (i == 0) |3328| |- this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg}); | |3328|+ this.UnitFsm.ProcessMessage(this, { "type": "PickupCanceled", "data": msg}); |3329|3329| else |3330|3330| this.orderQueue.splice(i, 1); |3331|3331| 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 |3325|3325| if (this.orderQueue[i].type != "PickupUnit" || this.orderQueue[i].data.target != msg.entity) |3326|3326| continue; |3327|3327| if (i == 0) |3328| |- this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg}); | |3328|+ this.UnitFsm.ProcessMessage(this, {"type": "PickupCanceled", "data": msg }); |3329|3329| else |3330|3330| this.orderQueue.splice(i, 1); |3331|3331| 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 |3409|3409| }; |3410|3410| |3411|3411| |3412| |-//// FSM linkage functions //// | |3412|+// // FSM linkage functions //// |3413|3413| |3414|3414| // Setting the next state to the current state will leave/re-enter the top-most substate. |3415|3415| 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 |3581|3581| continue; |3582|3582| if (this.orderQueue[i].type == type) |3583|3583| continue; |3584| |- this.orderQueue.splice(i, 0, {"type": type, "data": data}); | |3584|+ this.orderQueue.splice(i, 0, { "type": type, "data": data}); |3585|3585| Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() }); |3586|3586| return; |3587|3587| } | | [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 |3581|3581| continue; |3582|3582| if (this.orderQueue[i].type == type) |3583|3583| continue; |3584| |- this.orderQueue.splice(i, 0, {"type": type, "data": data}); | |3584|+ this.orderQueue.splice(i, 0, {"type": type, "data": data }); |3585|3585| Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() }); |3586|3586| return; |3587|3587| } | | [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 |3595|3595| { |3596|3596| // Remember the previous work orders to be able to go back to them later if required |3597|3597| if (data && data.force) |3598| |- { | |3598|+ |3599|3599| if (this.IsFormationController()) |3600|3600| this.CallMemberFunction("UpdateWorkOrders", [type]); |3601|3601| else |3602|3602| this.UpdateWorkOrders(type); |3603| |- } | |3603|+ |3604|3604| |3605|3605| let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null; |3606|3606| | | [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 |3672|3672| { |3673|3673| var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI); |3674|3674| if (cmpUnitAI) |3675| |- { | |3675|+ |3676|3676| for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i) |3677|3677| { |3678|3678| if (isWorkType(cmpUnitAI.orderQueue[i].type)) |3681|3681| return; |3682|3682| } |3683|3683| } |3684| |- } | |3684|+ |3685|3685| } |3686|3686| |3687|3687| // 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 |3674|3674| if (cmpUnitAI) |3675|3675| { |3676|3676| for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i) |3677| |- { | |3677|+ |3678|3678| if (isWorkType(cmpUnitAI.orderQueue[i].type)) |3679|3679| { |3680|3680| this.workOrders = cmpUnitAI.orderQueue.slice(i); |3681|3681| return; |3682|3682| } |3683| |- } | |3683|+ |3684|3684| } |3685|3685| } |3686|3686| | | [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 |3686|3686| |3687|3687| // If nothing found, take the unit orders |3688|3688| for (var i = 0; i < this.orderQueue.length; ++i) |3689| |- { | |3689|+ |3690|3690| if (isWorkType(this.orderQueue[i].type)) |3691|3691| { |3692|3692| this.workOrders = this.orderQueue.slice(i); |3693|3693| return; |3694|3694| } |3695| |- } | |3695|+ |3696|3696| }; |3697|3697| |3698|3698| 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 |3752|3752| if (data.timerRepeat === undefined) |3753|3753| this.timer = undefined; |3754|3754| |3755| |- this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness}); | |3755|+ this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness}); |3756|3756| }; |3757|3757| |3758|3758| /** | | [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 |3752|3752| if (data.timerRepeat === undefined) |3753|3753| this.timer = undefined; |3754|3754| |3755| |- this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness}); | |3755|+ this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness }); |3756|3756| }; |3757|3757| |3758|3758| /** | | [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 |3787|3787| this.timer = undefined; |3788|3788| }; |3789|3789| |3790| |-//// Message handlers ///// | |3790|+// // Message handlers ///// |3791|3791| |3792|3792| UnitAI.prototype.OnMotionChanged = function(msg) |3793|3793| { | | [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 |3799|3799| // TODO: This is a bit inefficient since every unit listens to every |3800|3800| // construction message - ideally we could scope it to only the one we're building |3801|3801| |3802| |- this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg}); | |3802|+ this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg}); |3803|3803| }; |3804|3804| |3805|3805| 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 |3799|3799| // TODO: This is a bit inefficient since every unit listens to every |3800|3800| // construction message - ideally we could scope it to only the one we're building |3801|3801| |3802| |- this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg}); | |3802|+ this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg }); |3803|3803| }; |3804|3804| |3805|3805| 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 |3824|3824| |3825|3825| UnitAI.prototype.OnAttacked = function(msg) |3826|3826| { |3827| |- this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg}); | |3827|+ this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg}); |3828|3828| }; |3829|3829| |3830|3830| 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 |3824|3824| |3825|3825| UnitAI.prototype.OnAttacked = function(msg) |3826|3826| { |3827| |- this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg}); | |3827|+ this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg }); |3828|3828| }; |3829|3829| |3830|3830| 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 |3829|3829| |3830|3830| UnitAI.prototype.OnGuardedAttacked = function(msg) |3831|3831| { |3832| |- this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data}); | |3832|+ this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data}); |3833|3833| }; |3834|3834| |3835|3835| 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 |3829|3829| |3830|3830| UnitAI.prototype.OnGuardedAttacked = function(msg) |3831|3831| { |3832| |- this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data}); | |3832|+ this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data }); |3833|3833| }; |3834|3834| |3835|3835| 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 |3834|3834| |3835|3835| UnitAI.prototype.OnHealthChanged = function(msg) |3836|3836| { |3837| |- this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to}); | |3837|+ this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to}); |3838|3838| }; |3839|3839| |3840|3840| 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 |3834|3834| |3835|3835| UnitAI.prototype.OnHealthChanged = function(msg) |3836|3836| { |3837| |- this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to}); | |3837|+ this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to }); |3838|3838| }; |3839|3839| |3840|3840| 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 |3840|3840| UnitAI.prototype.OnRangeUpdate = function(msg) |3841|3841| { |3842|3842| if (msg.tag == this.losRangeQuery) |3843| |- this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg}); | |3843|+ this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg}); |3844|3844| else if (msg.tag == this.losHealRangeQuery) |3845|3845| this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg}); |3846|3846| }; | | [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 |3840|3840| UnitAI.prototype.OnRangeUpdate = function(msg) |3841|3841| { |3842|3842| if (msg.tag == this.losRangeQuery) |3843| |- this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg}); | |3843|+ this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg }); |3844|3844| else if (msg.tag == this.losHealRangeQuery) |3845|3845| this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg}); |3846|3846| }; | | [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 |3842|3842| if (msg.tag == this.losRangeQuery) |3843|3843| this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg}); |3844|3844| else if (msg.tag == this.losHealRangeQuery) |3845| |- this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg}); | |3845|+ this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg}); |3846|3846| }; |3847|3847| |3848|3848| 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 |3842|3842| if (msg.tag == this.losRangeQuery) |3843|3843| this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg}); |3844|3844| else if (msg.tag == this.losHealRangeQuery) |3845| |- this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg}); | |3845|+ this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg }); |3846|3846| }; |3847|3847| |3848|3848| 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 |3847|3847| |3848|3848| UnitAI.prototype.OnPackFinished = function(msg) |3849|3849| { |3850| |- this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed}); | |3850|+ this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed}); |3851|3851| }; |3852|3852| |3853|3853| //// 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 |3847|3847| |3848|3848| UnitAI.prototype.OnPackFinished = function(msg) |3849|3849| { |3850| |- this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed}); | |3850|+ this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed }); |3851|3851| }; |3852|3852| |3853|3853| //// 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 |3850|3850| this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed}); |3851|3851| }; |3852|3852| |3853| |-//// Helper functions to be called by the FSM //// | |3853|+// // Helper functions to be called by the FSM //// |3854|3854| |3855|3855| UnitAI.prototype.GetWalkSpeed = function() |3856|3856| { | | [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 |3952|3952| if (!cmpOwnership || cmpOwnership.GetOwner() == INVALID_PLAYER) |3953|3953| return undefined; |3954|3954| |3955| |- let cmpPosition = Engine.QueryInterface(this.entity, IID_Position) | |3955|+ let cmpPosition = Engine.QueryInterface(this.entity, IID_Position); |3956|3956| if (!cmpPosition || !cmpPosition.IsInWorld()) |3957|3957| return undefined; |3958|3958| | | [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 |4037|4037| PlaySound(name, member); |4038|4038| } |4039|4039| else |4040| |- { | |4040|+ |4041|4041| // Otherwise use our own sounds |4042|4042| PlaySound(name, this.entity); |4043| |- } | |4043|+ |4044|4044| }; |4045|4045| |4046|4046| /* | | [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 |4229|4229| else |4230|4230| // return false? Or hope you come close enough? |4231|4231| var parabolicMaxRange = 0; |4232| |- //return false; | |4232|+ // return false; |4233|4233| |4234|4234| // the parabole changes while walking, take something in the middle |4235|4235| 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 |4316|4316| if (this.IsFormationMember()) |4317|4317| { |4318|4318| var cmpFormationUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI); |4319| |- if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation() |4320| |- && cmpFormationUnitAI.order.data.target == target) | |4319|+ if (cmpFormationUnitAI && cmpFormationUnitAI.IsAttackingAsFormation() && | |4320|+ cmpFormationUnitAI.order.data.target == target) |4321|4321| return true; |4322|4322| } |4323|4323| | | [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 |4484|4484| UnitAI.prototype.AttackEntityInZone = function(ents) |4485|4485| { |4486|4486| var target = ents.find(target => |4487| |- this.CanAttack(target) |4488| |- && this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) | |4487|+ this.CanAttack(target) && | |4488|+ this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) |4489|4489| && (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target)) |4490|4490| ); |4491|4491| 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 |4485|4485| { |4486|4486| var target = ents.find(target => |4487|4487| this.CanAttack(target) |4488| |- && this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) |4489| |- && (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target)) | |4488|+ && this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) && | |4489|+ (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target)) |4490|4490| ); |4491|4491| if (!target) |4492|4492| 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 |4549|4549| // If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker |4550|4550| if (this.isGuardOf) |4551|4551| { |4552| |- var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI); | |4552|+ var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI); |4553|4553| var cmpAttack = Engine.QueryInterface(target, IID_Attack); |4554|4554| if (cmpUnitAI && cmpAttack && |4555|4555| 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 |4553|4553| var cmpAttack = Engine.QueryInterface(target, IID_Attack); |4554|4554| if (cmpUnitAI && cmpAttack && |4555|4555| cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type))) |4556| |- return false; | |4556|+ return false; |4557|4557| } |4558|4558| |4559|4559| // 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 |4558|4558| |4559|4559| // Stop if we're in hold-ground mode and it's too far from the holding point |4560|4560| if (this.GetStance().respondHoldGround) |4561| |- { | |4561|+ |4562|4562| if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type)) |4563|4563| return true; |4564| |- } | |4564|+ |4565|4565| |4566|4566| // Stop if it's left our vision range, unless we're especially persistent |4567|4567| 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 |4565|4565| |4566|4566| // Stop if it's left our vision range, unless we're especially persistent |4567|4567| if (!this.GetStance().respondChaseBeyondVision) |4568| |- { | |4568|+ |4569|4569| if (!this.CheckTargetIsInVisionRange(target)) |4570|4570| return true; |4571| |- } | |4571|+ |4572|4572| |4573|4573| // (Note that CCmpUnitMotion will detect if the target is lost in FoW, |4574|4574| // 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 |4591|4591| // If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker |4592|4592| if (this.isGuardOf) |4593|4593| { |4594| |- let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI); | |4594|+ let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI); |4595|4595| let cmpAttack = Engine.QueryInterface(target, IID_Attack); |4596|4596| if (cmpUnitAI && cmpAttack && |4597|4597| 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 |4604|4604| return false; |4605|4605| }; |4606|4606| |4607| |-//// External interface functions //// | |4607|+// // External interface functions //// |4608|4608| |4609|4609| UnitAI.prototype.SetFormationController = function(ent) |4610|4610| { | | [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 |4614|4614| // of our own formation (or ourself if not in formation) |4615|4615| var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction); |4616|4616| if (cmpObstruction) |4617| |- { | |4617|+ |4618|4618| if (ent == INVALID_ENTITY) |4619|4619| cmpObstruction.SetControlGroup(this.entity); |4620|4620| else |4621|4621| cmpObstruction.SetControlGroup(ent); |4622| |- } | |4622|+ |4623|4623| |4624|4624| // If we were removed from a formation, let the FSM switch back to INDIVIDUAL |4625|4625| 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 |4757|4757| // if we already had an old guard order, do nothing if the target is the same |4758|4758| // and the order is running, otherwise remove the previous order |4759|4759| if (this.isGuardOf) |4760| |- { | |4760|+ |4761|4761| if (this.isGuardOf == target && this.order && this.order.type == "Guard") |4762|4762| return; |4763|4763| else |4764|4764| this.RemoveGuard(); |4765| |- } | |4765|+ |4766|4766| |4767|4767| this.AddOrder("Guard", { "target": target, "force": false }, queued); |4768|4768| }; | | [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 |4760|4760| { |4761|4761| if (this.isGuardOf == target && this.order && this.order.type == "Guard") |4762|4762| return; |4763| |- else |4764| |- this.RemoveGuard(); | |4763|+ this.RemoveGuard(); |4765|4764| } |4766|4765| |4767|4766| 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 |4931|4931| this.WalkToTarget(target, queued); |4932|4932| return; |4933|4933| } |4934| |- this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture}, queued); | |4934|+ this.AddOrder("Attack", { "target": target, "force": true, "allowCapture": allowCapture }, queued); |4935|4935| }; |4936|4936| |4937|4937| /** | | [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 |5080|5080| this.workOrders.length && this.workOrders[0].type == "Trade") |5081|5081| { |5082|5082| let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader); |5083| |- if (cmpTrader.HasBothMarkets() && | |5083|+ if (cmpTrader.HasBothMarkets() && |5084|5084| (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source || |5085|5085| cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target)) |5086|5086| { | | [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 |5361|5361| { |5362|5362| var cmpIdentity = Engine.QueryInterface(targ, IID_Identity); |5363|5363| var targetClasses = this.order.data.targetClasses; |5364| |- if (targetClasses.attack && cmpIdentity |5365| |- && !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack)) | |5364|+ if (targetClasses.attack && cmpIdentity && | |5365|+ !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack)) |5366|5366| continue; |5367|5367| if (targetClasses.avoid && cmpIdentity |5368|5368| && 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 |5364|5364| if (targetClasses.attack && cmpIdentity |5365|5365| && !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack)) |5366|5366| continue; |5367| |- if (targetClasses.avoid && cmpIdentity |5368| |- && MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid)) | |5367|+ if (targetClasses.avoid && cmpIdentity && | |5368|+ MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid)) |5369|5369| continue; |5370|5370| // Only used by the AIs to prevent some choices of targets |5371|5371| 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 |5387|5387| { |5388|5388| var cmpIdentity = Engine.QueryInterface(targ, IID_Identity); |5389|5389| var targetClasses = this.order.data.targetClasses; |5390| |- if (cmpIdentity && targetClasses.attack |5391| |- && !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack)) | |5390|+ if (cmpIdentity && targetClasses.attack && | |5391|+ !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack)) |5392|5392| continue; |5393|5393| if (cmpIdentity && targetClasses.avoid |5394|5394| && 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 |5390|5390| if (cmpIdentity && targetClasses.attack |5391|5391| && !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack)) |5392|5392| continue; |5393| |- if (cmpIdentity && targetClasses.avoid |5394| |- && MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid)) | |5393|+ if (cmpIdentity && targetClasses.avoid && | |5394|+ MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid)) |5395|5395| continue; |5396|5396| // Only used by the AIs to prevent some choices of targets |5397|5397| 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 |5533|5533| |5534|5534| UnitAI.prototype.SetHeldPosition = function(x, z) |5535|5535| { |5536| |- this.heldPosition = {"x": x, "z": z}; | |5536|+ this.heldPosition = { "x": x, "z": z}; |5537|5537| }; |5538|5538| |5539|5539| 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 |5533|5533| |5534|5534| UnitAI.prototype.SetHeldPosition = function(x, z) |5535|5535| { |5536| |- this.heldPosition = {"x": x, "z": z}; | |5536|+ this.heldPosition = {"x": x, "z": z }; |5537|5537| }; |5538|5538| |5539|5539| 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 |5560|5560| return false; |5561|5561| }; |5562|5562| |5563| |-//// Helper functions //// | |5563|+// // Helper functions //// |5564|5564| |5565|5565| UnitAI.prototype.CanAttack = function(target) |5566|5566| { | | [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 |5764|5764| return cmpPack && cmpPack.IsPacking(); |5765|5765| }; |5766|5766| |5767| |-//// Formation specific functions //// | |5767|+// // Formation specific functions //// |5768|5768| |5769|5769| UnitAI.prototype.IsAttackingAsFormation = function() |5770|5770| { | | [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 |5769|5769| UnitAI.prototype.IsAttackingAsFormation = function() |5770|5770| { |5771|5771| var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack); |5772| |- return cmpAttack && cmpAttack.CanAttackAsFormation() |5773| |- && this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING"; | |5772|+ return cmpAttack && cmpAttack.CanAttackAsFormation() && | |5773|+ this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING"; |5774|5774| }; |5775|5775| |5776|5776| //// 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 |5773|5773| && this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING"; |5774|5774| }; |5775|5775| |5776| |-//// Animal specific functions //// | |5776|+// // Animal specific functions //// |5777|5777| |5778|5778| UnitAI.prototype.MoveRandomly = function(distance) |5779|5779| { binaries/data/mods/public/simulation/components/UnitAI.js | 327| » » » return·true; | | [NORMAL] ESLintBear (consistent-return): | | Method 'Order.WalkToTarget' expected no return value. binaries/data/mods/public/simulation/components/UnitAI.js | 885| » » » "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 | 907| » » » "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 | 954| » » » » » return·true; | | [NORMAL] ESLintBear (consistent-return): | | Method 'enter' expected no return value. binaries/data/mods/public/simulation/components/UnitAI.js |1017| » » » » "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 |1052| » » » "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 |1084| » » » » "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 |1298| » » » "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 |1481| » » » "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 |1502| » » » "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 |1532| » » » "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 |1687| » » » "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 |1738| » » » » "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 |1809| » » » » » » » » return·true; | | [NORMAL] ESLintBear (consistent-return): | | Method 'enter' expected no return value. binaries/data/mods/public/simulation/components/UnitAI.js |1981| » » » » "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 |2071| » » » » "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 |2254| » » » » » » 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 |2309| » » » » "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 |2427| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |2492| » » » » "enter":·function()·{ | | [NORMAL] ESLintBear (consistent-return): | | Expected to return a value at the end of method 'enter'. binaries/data/mods/public/simulation/components/UnitAI.js |2532| » » » » "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 |2742| » » » » "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 |2926| » » » » "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 |3657| » 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 |4471| » 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 |4486| » 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 |4532| » 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 |4555| » » ····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 |5011| » 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 | 354| » » ····&&·(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 |1834| » » » » » » var·cmpFormation·=·Engine.QueryInterface(this.formationController,·IID_Formation); | | [NORMAL] JSHintBear: | | 'cmpFormation' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |1975| » » » » » » &&·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 |2249| » » » » » var·cmpResourceGatherer·=·Engine.QueryInterface(this.entity,·IID_ResourceGatherer); | | [NORMAL] JSHintBear: | | 'cmpResourceGatherer' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |2265| » » » » » var·nearby·=·this.FindNearbyResource(function(ent,·type,·template)·{ | | [NORMAL] JSHintBear: | | 'nearby' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |2268| » » » » » » » ||·(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 |2269| » » » » » » » &&·(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 |2289| » » » » » var·nearby·=·this.FindNearestDropsite(resourceType.generic); | | [NORMAL] JSHintBear: | | 'nearby' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |2469| » » » » » var·cmpResourceGatherer·=·Engine.QueryInterface(this.entity,·IID_ResourceGatherer); | | [NORMAL] JSHintBear: | | 'cmpResourceGatherer' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |2689| » » » » » var·cmpResourceDropsite·=·Engine.QueryInterface(msg.data.newentity,·IID_ResourceDropsite); | | [NORMAL] JSHintBear: | | 'cmpResourceDropsite' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |2775| » » » » » if·(this.CanGarrison(target)) | | [NORMAL] JSHintBear: | | 'target' used out of scope. binaries/data/mods/public/simulation/components/UnitAI.js |2778| » » » » » » if·(this.CheckGarrisonRange(target)) | | [NORMAL] JSHintBear: | | 'target' used out of scope. binaries/data/mods/public/simulation/components/UnitAI.js |2780| » » » » » » » var·cmpGarrisonHolder·=·Engine.QueryInterface(target,·IID_GarrisonHolder); | | [NORMAL] JSHintBear: | | 'target' used out of scope. binaries/data/mods/public/simulation/components/UnitAI.js |2802| » » » » » » » » var·cmpResourceDropsite·=·Engine.QueryInterface(target,·IID_ResourceDropsite); | | [NORMAL] JSHintBear: | | 'target' used out of scope. binaries/data/mods/public/simulation/components/UnitAI.js |2803| » » » » » » » » if·(cmpResourceDropsite·&&·this.CanReturnResource(target,·true)) | | [NORMAL] JSHintBear: | | 'target' used out of scope. binaries/data/mods/public/simulation/components/UnitAI.js |2818| » » » » » » » » » var·cmpHolderPosition·=·Engine.QueryInterface(target,·IID_Position); | | [NORMAL] JSHintBear: | | 'target' used out of scope. binaries/data/mods/public/simulation/components/UnitAI.js |2819| » » » » » » » » » var·cmpHolderUnitAI·=·Engine.QueryInterface(target,·IID_UnitAI); | | [NORMAL] JSHintBear: | | 'target' used out of scope. binaries/data/mods/public/simulation/components/UnitAI.js |2846| » » » » » » » if·(!this.CheckTargetRangeExplicit(target,·0,·0)·&&·this.MoveToTarget(target)) | | [NORMAL] JSHintBear: | | 'target' used out of scope. binaries/data/mods/public/simulation/components/UnitAI.js |2846| » » » » » » » if·(!this.CheckTargetRangeExplicit(target,·0,·0)·&&·this.MoveToTarget(target)) | | [NORMAL] JSHintBear: | | 'target' used out of scope. binaries/data/mods/public/simulation/components/UnitAI.js |3619| » » var·order·=·{·"type":·type,·"data":·data·}; | | [NORMAL] JSHintBear: | | 'order' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |3688| » for·(var·i·=·0;·i·<·this.orderQueue.length;·++i) | | [NORMAL] JSHintBear: | | 'i' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |3955| » let·cmpPosition·=·Engine.QueryInterface(this.entity,·IID_Position) | | [NORMAL] JSHintBear: | | Missing semicolon. binaries/data/mods/public/simulation/components/UnitAI.js |4231| » » var·parabolicMaxRange·=·0; | | [NORMAL] JSHintBear: | | 'parabolicMaxRange' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |4235| » var·guessedMaxRange·=·(range.max·+·parabolicMaxRange)/2; | | [NORMAL] JSHintBear: | | 'parabolicMaxRange' used out of scope. binaries/data/mods/public/simulation/components/UnitAI.js |4242| » 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 |4320| » » » &&·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 |4488| » » &&·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 |4489| » » &&·(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 |5011| » var·lastPos·=·undefined; | | [NORMAL] JSHintBear: | | It's not necessary to initialize 'lastPos' to 'undefined'. binaries/data/mods/public/simulation/components/UnitAI.js |5365| » » » » » » &&·!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 |5368| » » » » » » &&·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 |5381| » var·targets·=·this.GetTargetsFromUnit(); | | [NORMAL] JSHintBear: | | 'targets' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5382| » for·(var·targ·of·targets) | | [NORMAL] JSHintBear: | | 'targ' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5388| » » » var·cmpIdentity·=·Engine.QueryInterface(targ,·IID_Identity); | | [NORMAL] JSHintBear: | | 'cmpIdentity' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5389| » » » var·targetClasses·=·this.order.data.targetClasses; | | [NORMAL] JSHintBear: | | 'targetClasses' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5391| » » » » &&·!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 |5394| » » » » &&·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 |5469| » » var·cmpVision·=·Engine.QueryInterface(this.entity,·IID_Vision); | | [NORMAL] JSHintBear: | | 'cmpVision' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5472| » » var·range·=·cmpVision.GetRange(); | | [NORMAL] JSHintBear: | | 'range' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5477| » » var·cmpRanged·=·Engine.QueryInterface(this.entity,·iid); | | [NORMAL] JSHintBear: | | 'cmpRanged' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5480| » » var·range·=·iid·!==·IID_Attack·?·cmpRanged.GetRange()·:·cmpRanged.GetFullAttackRange(); | | [NORMAL] JSHintBear: | | 'range' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5481| » » var·cmpVision·=·Engine.QueryInterface(this.entity,·IID_Vision); | | [NORMAL] JSHintBear: | | 'cmpVision' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5491| » » var·cmpVision·=·Engine.QueryInterface(this.entity,·IID_Vision); | | [NORMAL] JSHintBear: | | 'cmpVision' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5494| » » var·range·=·cmpVision.GetRange(); | | [NORMAL] JSHintBear: | | 'range' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5773| » » &&·this.GetCurrentState()·==·"FORMATIONCONTROLLER.COMBAT.ATTACKING"; | | [NORMAL] JSHintBear: | | Misleading line break before '&&'; readers may interpret this as an expression boundary. Executing section cli...
Link to build: https://jenkins.wildfiregames.com/job/differential/1669/display/redirect