Details
Details
- Reviewers
- None
- Group Reviewers
Restricted Owners Package (Owns No Changed Paths) - Commits
- rP22506: Restore previous formation behaviour of targeting nearby enemies when idle /…
- Trac Tickets
- #5519
Notice units in aggressive stance attack nearby enemies when a formation move finishes.
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 'else'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | 516| 516| this.PushOrderFront("Walk", this.order.data.lastPos); | 517| 517| } | 518| 518| else | 519| |- { | | 519|+ | 520| 520| // We couldn't move there, or the target moved away | 521| 521| this.FinishOrder(); | 522| |- } | | 522|+ | 523| 523| return; | 524| 524| } | 525| 525| | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | 736| 736| } | 737| 737| // Check if we are already in range, otherwise walk there | 738| 738| if (!this.CheckGarrisonRange(msg.data.target)) | 739| |- { | | 739|+ | 740| 740| if (!this.CheckTargetVisible(msg.data.target)) | 741| 741| { | 742| 742| this.FinishOrder(); | 747| 747| this.SetNextState("GARRISON.APPROACHING"); | 748| 748| return; | 749| 749| } | 750| |- } | | 750|+ | 751| 751| | 752| 752| this.SetNextState("GARRISON.GARRISONING"); | 753| 753| }, | | [NORMAL] ESLintBear (no-else-return): | | Unnecessary 'else' after 'return'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | 742| 742| this.FinishOrder(); | 743| 743| return; | 744| 744| } | 745| |- else | 746| |- { | | 745|+ | 747| 746| this.SetNextState("GARRISON.APPROACHING"); | 748| 747| return; | 749| |- } | | 748|+ | 750| 749| } | 751| 750| | 752| 751| this.SetNextState("GARRISON.GARRISONING"); | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'else'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | 765| 765| this.PushOrderFront("Walk", msg.data.lastPos); | 766| 766| } | 767| 767| else | 768| |- { | | 768|+ | 769| 769| // We couldn't move there, or the target moved away | 770| 770| this.FinishOrder(); | 771| |- } | | 771|+ | 772| 772| return; | 773| 773| } | 774| 774| | | [NORMAL] ESLintBear (key-spacing): | | Missing space before value for key 'GARRISON'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | 998| 998| }, | 999| 999| }, |1000|1000| |1001| |- "GARRISON":{ | |1001|+ "GARRISON": { |1002|1002| "enter": function() { |1003|1003| // If the garrisonholder should pickup, warn it so it can take needed action |1004|1004| var cmpGarrisonHolder = Engine.QueryInterface(this.order.data.target, IID_GarrisonHolder); | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |1211|1211| // If the controller handled an order but some members rejected it, |1212|1212| // they will have no orders and be in the FORMATIONMEMBER.IDLE state. |1213|1213| if (this.orderQueue.length) |1214| |- { | |1214|+ |1215|1215| // We're leaving the formation, so stop our FormationWalk order |1216|1216| if (this.FinishOrder()) |1217|1217| return; |1218| |- } | |1218|+ |1219|1219| |1220|1220| // No orders left, we're an individual now |1221|1221| this.SetNextState("INDIVIDUAL.IDLE"); | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |1236|1236| // Move a tile outside the building |1237|1237| let range = 4; |1238|1238| if (this.CheckTargetRangeExplicit(msg.data.target, range, -1)) |1239| |- { | |1239|+ |1240|1240| // We are already at the target, or can't move at all |1241|1241| this.FinishOrder(); |1242| |- } | |1242|+ |1243|1243| else |1244|1244| { |1245|1245| this.order.data.min = range; | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |1429|1429| |1430|1430| "LosRangeUpdate": function(msg) { |1431|1431| if (this.GetStance().targetVisibleEnemies) |1432| |- { | |1432|+ |1433|1433| // Start attacking one of the newly-seen enemy (if any) |1434|1434| this.AttackEntitiesByPreference(msg.data.added); |1435| |- } | |1435|+ |1436|1436| }, |1437|1437| |1438|1438| "LosHealRangeUpdate": function(msg) { | | [NORMAL] ESLintBear (space-before-function-paren): | | Unexpected space before function parentheses. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |1487|1487| } |1488|1488| }, |1489|1489| |1490| |- "leave": function () { | |1490|+ "leave": function() { |1491|1491| this.StopMoving(); |1492|1492| }, |1493|1493| | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |1662|1662| // if nothing better to do, check if the guarded needs to be healed or repaired |1663|1663| var cmpHealth = Engine.QueryInterface(this.isGuardOf, IID_Health); |1664|1664| if (cmpHealth && cmpHealth.IsInjured()) |1665| |- { | |1665|+ |1666|1666| if (this.CanHeal(this.isGuardOf)) |1667|1667| this.PushOrderFront("Heal", { "target": this.isGuardOf, "force": false }); |1668|1668| else if (this.CanRepair(this.isGuardOf)) |1669|1669| this.PushOrderFront("Repair", { "target": this.isGuardOf, "autocontinue": false, "force": false }); |1670| |- } | |1670|+ |1671|1671| } |1672|1672| }, |1673|1673| | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |1944|1944| |1945|1945| "Attacked": function(msg) { |1946|1946| // If we are capturing and are attacked by something that we would not capture, attack that entity instead |1947| |- if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) |1948| |- && this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture") | |1947|+ if (this.order.data.attackType == "Capture" && (this.GetStance().targetAttackersAlways || !this.order.data.force) && | |1948|+ this.order.data.target != msg.data.attacker && this.GetBestAttackAgainst(msg.data.attacker, true) != "Capture") |1949|1949| this.RespondToTargetedEntities([msg.data.attacker]); |1950|1950| }, |1951|1951| }, | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |1996|1996| |1997|1997| var cmpUnitAI = Engine.QueryInterface(this.order.data.target, IID_UnitAI); |1998|1998| if (cmpUnitAI && cmpUnitAI.IsFleeing()) |1999| |- { | |1999|+ |2000|2000| // Run after a fleeing target |2001|2001| this.SetSpeedMultiplier(this.GetRunMultiplier()); |2002| |- } | |2002|+ |2003|2003| this.StartTimer(1000, 1000); |2004|2004| }, |2005|2005| | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |2347|2347| |2348|2348| "Timer": function(msg) { |2349|2349| if (this.ShouldAbandonChase(this.order.data.target, this.order.data.force, IID_Heal, null)) |2350| |- { | |2350|+ |2351|2351| // Return to our original position unless we have a better order. |2352|2352| if (!this.FinishOrder() && this.GetStance().respondHoldGround) |2353|2353| this.WalkToHeldPosition(); |2354| |- } | |2354|+ |2355|2355| }, |2356|2356| |2357|2357| "MovementUpdate": function() { | | [NORMAL] ESLintBear (no-unneeded-ternary): | | Unnecessary use of boolean literals in conditional expression. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |2381|2381| this.StartTimer(prepare, this.healTimers.repeat); |2382|2382| |2383|2383| // If using a non-default prepare time, re-sync the animation when the timer runs. |2384| |- this.resyncAnimation = (prepare != this.healTimers.prepare) ? true : false; | |2384|+ this.resyncAnimation = (prepare != this.healTimers.prepare); |2385|2385| |2386|2386| this.FaceTowardsTarget(this.order.data.target); |2387|2387| }, | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |2589|2589| { |2590|2590| // The building was already finished/fully repaired before we arrived; |2591|2591| // let the ConstructionFinished handler handle this. |2592| |- this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget}); | |2592|+ this.OnGlobalConstructionFinished({ "entity": this.repairTarget, "newentity": this.repairTarget}); |2593|2593| return true; |2594|2594| } |2595|2595| | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |2589|2589| { |2590|2590| // The building was already finished/fully repaired before we arrived; |2591|2591| // let the ConstructionFinished handler handle this. |2592| |- this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget}); | |2592|+ this.OnGlobalConstructionFinished({"entity": this.repairTarget, "newentity": this.repairTarget }); |2593|2593| return true; |2594|2594| } |2595|2595| | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |2974|2974| "Attacked": function(msg) { |2975|2975| if (this.template.NaturalBehaviour == "skittish" || |2976|2976| this.template.NaturalBehaviour == "passive") |2977| |- { | |2977|+ |2978|2978| this.Flee(msg.data.attacker, false); |2979| |- } | |2979|+ |2980|2980| else if (this.IsDangerousAnimal() || this.template.NaturalBehaviour == "defensive") |2981|2981| { |2982|2982| if (this.CanAttack(msg.data.attacker)) | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |2983|2983| this.Attack(msg.data.attacker, false); |2984|2984| } |2985|2985| else if (this.template.NaturalBehaviour == "domestic") |2986| |- { | |2986|+ |2987|2987| // Never flee, stop what we were doing |2988|2988| this.SetNextState("IDLE"); |2989| |- } | |2989|+ |2990|2990| }, |2991|2991| |2992|2992| "Order.LeaveFoundation": function(msg) { | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3037|3037| } |3038|3038| // Start attacking one of the newly-seen enemy (if any) |3039|3039| else if (this.IsDangerousAnimal()) |3040| |- { | |3040|+ |3041|3041| this.AttackVisibleEntity(msg.data.added); |3042| |- } | |3042|+ |3043|3043| |3044|3044| // TODO: if two units enter our range together, we'll attack the |3045|3045| // first and then the second won't trigger another LosRangeUpdate | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/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. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/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. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/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. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/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 ','. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/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 '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/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 '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/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. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/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 '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3579|3579| continue; |3580|3580| if (this.orderQueue[i].type == type) |3581|3581| continue; |3582| |- this.orderQueue.splice(i, 0, {"type": type, "data": data}); | |3582|+ this.orderQueue.splice(i, 0, { "type": type, "data": data}); |3583|3583| Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() }); |3584|3584| return; |3585|3585| } | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3579|3579| continue; |3580|3580| if (this.orderQueue[i].type == type) |3581|3581| continue; |3582| |- this.orderQueue.splice(i, 0, {"type": type, "data": data}); | |3582|+ this.orderQueue.splice(i, 0, {"type": type, "data": data }); |3583|3583| Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() }); |3584|3584| return; |3585|3585| } | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3593|3593| { |3594|3594| // Remember the previous work orders to be able to go back to them later if required |3595|3595| if (data && data.force) |3596| |- { | |3596|+ |3597|3597| if (this.IsFormationController()) |3598|3598| this.CallMemberFunction("UpdateWorkOrders", [type]); |3599|3599| else |3600|3600| this.UpdateWorkOrders(type); |3601| |- } | |3601|+ |3602|3602| |3603|3603| let garrisonHolder = this.IsGarrisoned() && type != "Ungarrison" ? this.GetGarrisonHolder() : null; |3604|3604| | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3670|3670| { |3671|3671| var cmpUnitAI = Engine.QueryInterface(this.formationController, IID_UnitAI); |3672|3672| if (cmpUnitAI) |3673| |- { | |3673|+ |3674|3674| for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i) |3675|3675| { |3676|3676| if (isWorkType(cmpUnitAI.orderQueue[i].type)) |3679|3679| return; |3680|3680| } |3681|3681| } |3682| |- } | |3682|+ |3683|3683| } |3684|3684| |3685|3685| // If nothing found, take the unit orders | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'for' condition. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3672|3672| if (cmpUnitAI) |3673|3673| { |3674|3674| for (var i = 0; i < cmpUnitAI.orderQueue.length; ++i) |3675| |- { | |3675|+ |3676|3676| if (isWorkType(cmpUnitAI.orderQueue[i].type)) |3677|3677| { |3678|3678| this.workOrders = cmpUnitAI.orderQueue.slice(i); |3679|3679| return; |3680|3680| } |3681| |- } | |3681|+ |3682|3682| } |3683|3683| } |3684|3684| | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'for' condition. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3684|3684| |3685|3685| // If nothing found, take the unit orders |3686|3686| for (var i = 0; i < this.orderQueue.length; ++i) |3687| |- { | |3687|+ |3688|3688| if (isWorkType(this.orderQueue[i].type)) |3689|3689| { |3690|3690| this.workOrders = this.orderQueue.slice(i); |3691|3691| return; |3692|3692| } |3693| |- } | |3693|+ |3694|3694| }; |3695|3695| |3696|3696| UnitAI.prototype.BackToWork = function() | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3750|3750| if (data.timerRepeat === undefined) |3751|3751| this.timer = undefined; |3752|3752| |3753| |- this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness}); | |3753|+ this.UnitFsm.ProcessMessage(this, { "type": "Timer", "data": data, "lateness": lateness}); |3754|3754| }; |3755|3755| |3756|3756| /** | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3750|3750| if (data.timerRepeat === undefined) |3751|3751| this.timer = undefined; |3752|3752| |3753| |- this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness}); | |3753|+ this.UnitFsm.ProcessMessage(this, {"type": "Timer", "data": data, "lateness": lateness }); |3754|3754| }; |3755|3755| |3756|3756| /** | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3785|3785| this.timer = undefined; |3786|3786| }; |3787|3787| |3788| |-//// Message handlers ///// | |3788|+// // Message handlers ///// |3789|3789| |3790|3790| UnitAI.prototype.OnMotionChanged = function(msg) |3791|3791| { | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3797|3797| // TODO: This is a bit inefficient since every unit listens to every |3798|3798| // construction message - ideally we could scope it to only the one we're building |3799|3799| |3800| |- this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg}); | |3800|+ this.UnitFsm.ProcessMessage(this, { "type": "ConstructionFinished", "data": msg}); |3801|3801| }; |3802|3802| |3803|3803| UnitAI.prototype.OnGlobalEntityRenamed = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3797|3797| // TODO: This is a bit inefficient since every unit listens to every |3798|3798| // construction message - ideally we could scope it to only the one we're building |3799|3799| |3800| |- this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg}); | |3800|+ this.UnitFsm.ProcessMessage(this, {"type": "ConstructionFinished", "data": msg }); |3801|3801| }; |3802|3802| |3803|3803| UnitAI.prototype.OnGlobalEntityRenamed = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3822|3822| |3823|3823| UnitAI.prototype.OnAttacked = function(msg) |3824|3824| { |3825| |- this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg}); | |3825|+ this.UnitFsm.ProcessMessage(this, { "type": "Attacked", "data": msg}); |3826|3826| }; |3827|3827| |3828|3828| UnitAI.prototype.OnGuardedAttacked = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3822|3822| |3823|3823| UnitAI.prototype.OnAttacked = function(msg) |3824|3824| { |3825| |- this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg}); | |3825|+ this.UnitFsm.ProcessMessage(this, {"type": "Attacked", "data": msg }); |3826|3826| }; |3827|3827| |3828|3828| UnitAI.prototype.OnGuardedAttacked = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3827|3827| |3828|3828| UnitAI.prototype.OnGuardedAttacked = function(msg) |3829|3829| { |3830| |- this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data}); | |3830|+ this.UnitFsm.ProcessMessage(this, { "type": "GuardedAttacked", "data": msg.data}); |3831|3831| }; |3832|3832| |3833|3833| UnitAI.prototype.OnHealthChanged = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3827|3827| |3828|3828| UnitAI.prototype.OnGuardedAttacked = function(msg) |3829|3829| { |3830| |- this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data}); | |3830|+ this.UnitFsm.ProcessMessage(this, {"type": "GuardedAttacked", "data": msg.data }); |3831|3831| }; |3832|3832| |3833|3833| UnitAI.prototype.OnHealthChanged = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3832|3832| |3833|3833| UnitAI.prototype.OnHealthChanged = function(msg) |3834|3834| { |3835| |- this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to}); | |3835|+ this.UnitFsm.ProcessMessage(this, { "type": "HealthChanged", "from": msg.from, "to": msg.to}); |3836|3836| }; |3837|3837| |3838|3838| UnitAI.prototype.OnRangeUpdate = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3832|3832| |3833|3833| UnitAI.prototype.OnHealthChanged = function(msg) |3834|3834| { |3835| |- this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to}); | |3835|+ this.UnitFsm.ProcessMessage(this, {"type": "HealthChanged", "from": msg.from, "to": msg.to }); |3836|3836| }; |3837|3837| |3838|3838| UnitAI.prototype.OnRangeUpdate = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3838|3838| UnitAI.prototype.OnRangeUpdate = function(msg) |3839|3839| { |3840|3840| if (msg.tag == this.losRangeQuery) |3841| |- this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg}); | |3841|+ this.UnitFsm.ProcessMessage(this, { "type": "LosRangeUpdate", "data": msg}); |3842|3842| else if (msg.tag == this.losHealRangeQuery) |3843|3843| this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg}); |3844|3844| }; | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3838|3838| UnitAI.prototype.OnRangeUpdate = function(msg) |3839|3839| { |3840|3840| if (msg.tag == this.losRangeQuery) |3841| |- this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg}); | |3841|+ this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg }); |3842|3842| else if (msg.tag == this.losHealRangeQuery) |3843|3843| this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg}); |3844|3844| }; | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3840|3840| if (msg.tag == this.losRangeQuery) |3841|3841| this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg}); |3842|3842| else if (msg.tag == this.losHealRangeQuery) |3843| |- this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg}); | |3843|+ this.UnitFsm.ProcessMessage(this, { "type": "LosHealRangeUpdate", "data": msg}); |3844|3844| }; |3845|3845| |3846|3846| UnitAI.prototype.OnPackFinished = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3840|3840| if (msg.tag == this.losRangeQuery) |3841|3841| this.UnitFsm.ProcessMessage(this, {"type": "LosRangeUpdate", "data": msg}); |3842|3842| else if (msg.tag == this.losHealRangeQuery) |3843| |- this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg}); | |3843|+ this.UnitFsm.ProcessMessage(this, {"type": "LosHealRangeUpdate", "data": msg }); |3844|3844| }; |3845|3845| |3846|3846| UnitAI.prototype.OnPackFinished = function(msg) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3845|3845| |3846|3846| UnitAI.prototype.OnPackFinished = function(msg) |3847|3847| { |3848| |- this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed}); | |3848|+ this.UnitFsm.ProcessMessage(this, { "type": "PackFinished", "packed": msg.packed}); |3849|3849| }; |3850|3850| |3851|3851| //// Helper functions to be called by the FSM //// | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3845|3845| |3846|3846| UnitAI.prototype.OnPackFinished = function(msg) |3847|3847| { |3848| |- this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed}); | |3848|+ this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed }); |3849|3849| }; |3850|3850| |3851|3851| //// Helper functions to be called by the FSM //// | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |3848|3848| this.UnitFsm.ProcessMessage(this, {"type": "PackFinished", "packed": msg.packed}); |3849|3849| }; |3850|3850| |3851| |-//// Helper functions to be called by the FSM //// | |3851|+// // Helper functions to be called by the FSM //// |3852|3852| |3853|3853| UnitAI.prototype.GetWalkSpeed = function() |3854|3854| { | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'else'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |4035|4035| PlaySound(name, member); |4036|4036| } |4037|4037| else |4038| |- { | |4038|+ |4039|4039| // Otherwise use our own sounds |4040|4040| PlaySound(name, this.entity); |4041| |- } | |4041|+ |4042|4042| }; |4043|4043| |4044|4044| /* | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |4481|4481| UnitAI.prototype.AttackEntityInZone = function(ents) |4482|4482| { |4483|4483| var target = ents.find(target => |4484| |- this.CanAttack(target) |4485| |- && this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) | |4484|+ this.CanAttack(target) && | |4485|+ this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) |4486|4486| && (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target)) |4487|4487| ); |4488|4488| if (!target) | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |4482|4482| { |4483|4483| var target = ents.find(target => |4484|4484| this.CanAttack(target) |4485| |- && this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) |4486| |- && (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target)) | |4485|+ && this.CheckTargetDistanceFromHeldPosition(target, IID_Attack, this.GetBestAttackAgainst(target, true)) && | |4486|+ (this.GetStance().respondChaseBeyondVision || this.CheckTargetIsInVisionRange(target)) |4487|4487| ); |4488|4488| if (!target) |4489|4489| return false; | | [NORMAL] ESLintBear (no-multi-spaces): | | Multiple spaces found before 'Engine'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |4546|4546| // If we are guarding/escorting, don't abandon as long as the guarded unit is in target range of the attacker |4547|4547| if (this.isGuardOf) |4548|4548| { |4549| |- var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI); | |4549|+ var cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI); |4550|4550| var cmpAttack = Engine.QueryInterface(target, IID_Attack); |4551|4551| if (cmpUnitAI && cmpAttack && |4552|4552| cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type))) | | [NORMAL] ESLintBear (indent): | | Expected indentation of 3 tabs but found 4. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |4550|4550| var cmpAttack = Engine.QueryInterface(target, IID_Attack); |4551|4551| if (cmpUnitAI && cmpAttack && |4552|4552| cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type))) |4553| |- return false; | |4553|+ return false; |4554|4554| } |4555|4555| |4556|4556| // Stop if we're in hold-ground mode and it's too far from the holding point | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |4555|4555| |4556|4556| // Stop if we're in hold-ground mode and it's too far from the holding point |4557|4557| if (this.GetStance().respondHoldGround) |4558| |- { | |4558|+ |4559|4559| if (!this.CheckTargetDistanceFromHeldPosition(target, iid, type)) |4560|4560| return true; |4561| |- } | |4561|+ |4562|4562| |4563|4563| // Stop if it's left our vision range, unless we're especially persistent |4564|4564| if (!this.GetStance().respondChaseBeyondVision) | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |4562|4562| |4563|4563| // Stop if it's left our vision range, unless we're especially persistent |4564|4564| if (!this.GetStance().respondChaseBeyondVision) |4565| |- { | |4565|+ |4566|4566| if (!this.CheckTargetIsInVisionRange(target)) |4567|4567| return true; |4568| |- } | |4568|+ |4569|4569| |4570|4570| // (Note that CCmpUnitMotion will detect if the target is lost in FoW, |4571|4571| // and will continue moving to its last seen position and then stop) | | [NORMAL] ESLintBear (no-multi-spaces): | | Multiple spaces found before 'Engine'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |4588|4588| // If we are guarding/escorting, chase at least as long as the guarded unit is in target range of the attacker |4589|4589| if (this.isGuardOf) |4590|4590| { |4591| |- let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI); | |4591|+ let cmpUnitAI = Engine.QueryInterface(target, IID_UnitAI); |4592|4592| let cmpAttack = Engine.QueryInterface(target, IID_Attack); |4593|4593| if (cmpUnitAI && cmpAttack && |4594|4594| cmpAttack.GetAttackTypes().some(type => cmpUnitAI.CheckTargetAttackRange(this.isGuardOf, type))) | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |4601|4601| return false; |4602|4602| }; |4603|4603| |4604| |-//// External interface functions //// | |4604|+// // External interface functions //// |4605|4605| |4606|4606| UnitAI.prototype.SetFormationController = function(ent) |4607|4607| { | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |4611|4611| // of our own formation (or ourself if not in formation) |4612|4612| var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction); |4613|4613| if (cmpObstruction) |4614| |- { | |4614|+ |4615|4615| if (ent == INVALID_ENTITY) |4616|4616| cmpObstruction.SetControlGroup(this.entity); |4617|4617| else |4618|4618| cmpObstruction.SetControlGroup(ent); |4619| |- } | |4619|+ |4620|4620| |4621|4621| // If we were removed from a formation, let the FSM switch back to INDIVIDUAL |4622|4622| if (ent == INVALID_ENTITY) | | [NORMAL] ESLintBear (curly): | | Unnecessary { after 'if' condition. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |4754|4754| // if we already had an old guard order, do nothing if the target is the same |4755|4755| // and the order is running, otherwise remove the previous order |4756|4756| if (this.isGuardOf) |4757| |- { | |4757|+ |4758|4758| if (this.isGuardOf == target && this.order && this.order.type == "Guard") |4759|4759| return; |4760|4760| else |4761|4761| this.RemoveGuard(); |4762| |- } | |4762|+ |4763|4763| |4764|4764| this.AddOrder("Guard", { "target": target, "force": false }, queued); |4765|4765| }; | | [NORMAL] ESLintBear (no-else-return): | | Unnecessary 'else' after 'return'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |4757|4757| { |4758|4758| if (this.isGuardOf == target && this.order && this.order.type == "Guard") |4759|4759| return; |4760| |- else |4761| |- this.RemoveGuard(); | |4760|+ this.RemoveGuard(); |4762|4761| } |4763|4762| |4764|4763| this.AddOrder("Guard", { "target": target, "force": false }, queued); | | [NORMAL] ESLintBear (no-trailing-spaces): | | Trailing spaces not allowed. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5089|5089| this.workOrders.length && this.workOrders[0].type == "Trade") |5090|5090| { |5091|5091| let cmpTrader = Engine.QueryInterface(this.entity, IID_Trader); |5092| |- if (cmpTrader.HasBothMarkets() && | |5092|+ if (cmpTrader.HasBothMarkets() && |5093|5093| (cmpTrader.GetFirstMarket() == target && cmpTrader.GetSecondMarket() == source || |5094|5094| cmpTrader.GetFirstMarket() == source && cmpTrader.GetSecondMarket() == target)) |5095|5095| { | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5370|5370| { |5371|5371| var cmpIdentity = Engine.QueryInterface(targ, IID_Identity); |5372|5372| var targetClasses = this.order.data.targetClasses; |5373| |- if (targetClasses.attack && cmpIdentity |5374| |- && !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack)) | |5373|+ if (targetClasses.attack && cmpIdentity && | |5374|+ !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack)) |5375|5375| continue; |5376|5376| if (targetClasses.avoid && cmpIdentity |5377|5377| && MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid)) | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5373|5373| if (targetClasses.attack && cmpIdentity |5374|5374| && !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack)) |5375|5375| continue; |5376| |- if (targetClasses.avoid && cmpIdentity |5377| |- && MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid)) | |5376|+ if (targetClasses.avoid && cmpIdentity && | |5377|+ MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid)) |5378|5378| continue; |5379|5379| // Only used by the AIs to prevent some choices of targets |5380|5380| if (targetClasses.vetoEntities && targetClasses.vetoEntities[targ]) | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5396|5396| { |5397|5397| var cmpIdentity = Engine.QueryInterface(targ, IID_Identity); |5398|5398| var targetClasses = this.order.data.targetClasses; |5399| |- if (cmpIdentity && targetClasses.attack |5400| |- && !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack)) | |5399|+ if (cmpIdentity && targetClasses.attack && | |5400|+ !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack)) |5401|5401| continue; |5402|5402| if (cmpIdentity && targetClasses.avoid |5403|5403| && MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid)) | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5399|5399| if (cmpIdentity && targetClasses.attack |5400|5400| && !MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.attack)) |5401|5401| continue; |5402| |- if (cmpIdentity && targetClasses.avoid |5403| |- && MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid)) | |5402|+ if (cmpIdentity && targetClasses.avoid && | |5403|+ MatchesClassList(cmpIdentity.GetClassesList(), targetClasses.avoid)) |5404|5404| continue; |5405|5405| // Only used by the AIs to prevent some choices of targets |5406|5406| if (targetClasses.vetoEntities && targetClasses.vetoEntities[targ]) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required after '{'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5556|5556| |5557|5557| UnitAI.prototype.SetHeldPosition = function(x, z) |5558|5558| { |5559| |- this.heldPosition = {"x": x, "z": z}; | |5559|+ this.heldPosition = { "x": x, "z": z}; |5560|5560| }; |5561|5561| |5562|5562| UnitAI.prototype.SetHeldPositionOnEntity = function(entity) | | [NORMAL] ESLintBear (object-curly-spacing): | | A space is required before '}'. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5556|5556| |5557|5557| UnitAI.prototype.SetHeldPosition = function(x, z) |5558|5558| { |5559| |- this.heldPosition = {"x": x, "z": z}; | |5559|+ this.heldPosition = {"x": x, "z": z }; |5560|5560| }; |5561|5561| |5562|5562| UnitAI.prototype.SetHeldPositionOnEntity = function(entity) | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5583|5583| return false; |5584|5584| }; |5585|5585| |5586| |-//// Helper functions //// | |5586|+// // Helper functions //// |5587|5587| |5588|5588| UnitAI.prototype.CanAttack = function(target) |5589|5589| { | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5787|5787| return cmpPack && cmpPack.IsPacking(); |5788|5788| }; |5789|5789| |5790| |-//// Formation specific functions //// | |5790|+// // Formation specific functions //// |5791|5791| |5792|5792| UnitAI.prototype.IsAttackingAsFormation = function() |5793|5793| { | | [NORMAL] ESLintBear (operator-linebreak): | | '&&' should be placed at the end of the line. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5792|5792| UnitAI.prototype.IsAttackingAsFormation = function() |5793|5793| { |5794|5794| var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack); |5795| |- return cmpAttack && cmpAttack.CanAttackAsFormation() |5796| |- && this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING"; | |5795|+ return cmpAttack && cmpAttack.CanAttackAsFormation() && | |5796|+ this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING"; |5797|5797| }; |5798|5798| |5799|5799| //// Animal specific functions //// | | [NORMAL] ESLintBear (spaced-comment): | | Expected space or tab after '//' in comment. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/UnitAI.js |5796|5796| && this.GetCurrentState() == "FORMATIONCONTROLLER.COMBAT.ATTACKING"; |5797|5797| }; |5798|5798| |5799| |-//// Animal specific functions //// | |5799|+// // Animal specific functions //// |5800|5800| |5801|5801| UnitAI.prototype.MoveRandomly = function(distance) |5802|5802| { 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 | 891| » » » "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 | 913| » » » "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 | 960| » » » » » return·true; | | [NORMAL] ESLintBear (consistent-return): | | Method 'enter' expected no return value. binaries/data/mods/public/simulation/components/UnitAI.js |1023| » » » » "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 |1058| » » » "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 |1090| » » » » "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 |1250| » » "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 |1307| » » » "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 |1482| » » » "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 |1501| » » » "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 |1530| » » » "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 |1682| » » » "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 |1732| » » » » "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 |1807| » » » » "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 |1971| » » » » » » return·true; | | [NORMAL] ESLintBear (consistent-return): | | Method 'enter' expected no return value. binaries/data/mods/public/simulation/components/UnitAI.js |1976| » » » » » » return·true; | | [NORMAL] ESLintBear (consistent-return): | | Method 'enter' expected no return value. binaries/data/mods/public/simulation/components/UnitAI.js |1982| » » » » » return·true; | | [NORMAL] ESLintBear (consistent-return): | | Method 'enter' expected no return value. binaries/data/mods/public/simulation/components/UnitAI.js |1987| » » » » "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 |2075| » » » » "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 |2327| » » » » "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 |2445| » » » » "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 |2507| » » » » "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 |2546| » » » » "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 |2752| » » » » "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 |2932| » » » » "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 |3655| » 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 |4468| » 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 |4483| » 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 |4529| » 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 |4552| » » ····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 |1948| » » » » » » &&·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 |2484| » » » » » var·cmpResourceGatherer·=·Engine.QueryInterface(this.entity,·IID_ResourceGatherer); | | [NORMAL] JSHintBear: | | 'cmpResourceGatherer' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |3617| » » var·order·=·{·"type":·type,·"data":·data·}; | | [NORMAL] JSHintBear: | | 'order' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |3686| » for·(var·i·=·0;·i·<·this.orderQueue.length;·++i) | | [NORMAL] JSHintBear: | | 'i' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |4485| » » &&·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 |4486| » » &&·(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 |5374| » » » » » » &&·!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 |5377| » » » » » » &&·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 |5390| » var·targets·=·this.GetTargetsFromUnit(); | | [NORMAL] JSHintBear: | | 'targets' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5391| » for·(var·targ·of·targets) | | [NORMAL] JSHintBear: | | 'targ' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5397| » » » var·cmpIdentity·=·Engine.QueryInterface(targ,·IID_Identity); | | [NORMAL] JSHintBear: | | 'cmpIdentity' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5398| » » » var·targetClasses·=·this.order.data.targetClasses; | | [NORMAL] JSHintBear: | | 'targetClasses' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5400| » » » » &&·!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 |5403| » » » » &&·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 |5478| » » var·cmpVision·=·Engine.QueryInterface(this.entity,·IID_Vision); | | [NORMAL] JSHintBear: | | 'cmpVision' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5481| » » var·range·=·cmpVision.GetRange(); | | [NORMAL] JSHintBear: | | 'range' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5486| » » var·cmpRanged·=·Engine.QueryInterface(this.entity,·iid); | | [NORMAL] JSHintBear: | | 'cmpRanged' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5489| » » var·range·=·iid·!==·IID_Attack·?·cmpRanged.GetRange()·:·cmpRanged.GetFullAttackRange(); | | [NORMAL] JSHintBear: | | 'range' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5490| » » var·cmpVision·=·Engine.QueryInterface(this.entity,·IID_Vision); | | [NORMAL] JSHintBear: | | 'cmpVision' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5500| » » var·cmpVision·=·Engine.QueryInterface(this.entity,·IID_Vision); | | [NORMAL] JSHintBear: | | 'cmpVision' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5503| » » var·range·=·cmpVision.GetRange(); | | [NORMAL] JSHintBear: | | 'range' is already defined. binaries/data/mods/public/simulation/components/UnitAI.js |5796| » » &&·this.GetCurrentState()·==·"FORMATIONCONTROLLER.COMBAT.ATTACKING"; | | [NORMAL] JSHintBear: | | Misleading line break before '&&'; readers may interpret this as an expression boundary. Executing section cli...
Link to build: https://jenkins.wildfiregames.com/job/docker-differential/126/display/redirect