Skip to content

Fix "proper" expressions not being parsed in default target priorities#7138

Open
lL1l1 wants to merge 7 commits into
FAForever:developfrom
lL1l1:fix/default-proper-prios-parsing
Open

Fix "proper" expressions not being parsed in default target priorities#7138
lL1l1 wants to merge 7 commits into
FAForever:developfrom
lL1l1:fix/default-proper-prios-parsing

Conversation

@lL1l1

@lL1l1 lL1l1 commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Description of the proposed changes

When I was working on #7135, Mercy was not targeting any mobile units on attack move even after I set TargetCheckInterval to a functional value.

The bug was caused by the string.find third argument "plain" being set to true, which disables pattern matching functionality, but the pattern string was written as if pattern matching was enabled. So instead of matching ( it was matching %(, since % is a literal character when pattern matching functionality is disabled.

By logging the priorities passing through the "proper" parsing path, I identified that the following default priorities have become functional:

(ALLUNITS - SPECIALLOWPRI)
(STRUCTURE * DEFENSE - ANTIMISSILE)
(NAVAL * TECH2 * SHIELD)
(STRUCTURE * DEFENSE * ANTIAIR)
(TECH3 * NAVAL * CARRIER)
(AIR * MOBILE - INTELLIGENCE)
(STRUCTURE * DEFENSE - ANTIMISSILE - ANTIAIR)
(AIR * MOBILE * EXPERIMENTAL - BOMBER)
(STRUCTURE * TECH2 * DEFENSE - ANTIMISSILE)
(ARTILLERY - TECH1)
(MOBILE * TECH1 + COMMAND)
(STRUCTURE * DEFENSE - ANTIAIR)
(TECH2 * MOBILE * NAVAL - CRUISER)
(STRUCTURE * DEFENSE - ANTIAIR - ANTIMISSILE)
(TECH3 * STRUCTURE * DEFENSE * ANTIAIR)
(SUBMERSIBLE - TECH1)
(NAVAL * TECH2)
(NAVAL * TECH3)
(EXPERIMENTAL * ARTILLERY - FACTORY)

Some of these only use unions, so they do not need to use the proper parsing, and I turned them into normal prios. I used "\(((\w+)\s*\*\s*)+\w+\)"" to search files for these prios.

Testing done on the proposed changes

The debug logging shows that Mercy's target priority is being "properly" parsed instead of normally.
Mercy auto attacks units when the target check interval is fixed and it is on attack move.

I also regex searched all files with find\(.*, true\) and didn't find any other instances of this mistake.

This is the list of all weapons using proper priorities, excluding the fixed torp bombers:
{ -- table: 2301AA50 (360 bytes)
        ["(AIR * MOBILE * EXPERIMENTAL - BOMBER)"] = { -- table: 18312618 (168 bytes)
          "AEON     TECH2        Anti-Air Flak Artillery Marr                 uab2204-1-AAFizz                   ",
          "AEON     TECH2        Anti-Air Flak Artillery Marr                 uab2204-1-AAFizz                   ",
          "AEON     TECH2        Mobile AA Flak Artillery Ascendant           ual0205-2-AAGun                    ",
          "UEF      TECH2        Anti-Air Flak Artillery Air Cleaner          ueb2204-1-AAGun                    ",
          "UEF      TECH2        Mobile AA Flak Artillery Sky Boxer           uel0205-2-AAGun                    ",
          "CYBRAN   TECH2        Anti-Air Flak Artillery Burst Master         urb2204-1-AAGun                    ",
          "CYBRAN   TECH2        Mobile AA Flak Artillery Banger              url0205-2-AAGun                    ",
          "SERAPHIM TECH2        Anti-Air Flak Artillery Sinnatha             xsb2204-1-AAFizz                   ",
          "SERAPHIM TECH2        Mobile Anti-Air Cannon Iashavoh              xsl0205-2-AAGun                    ",
          "SERAPHIM EXPERIMENTAL Experimental Assault Bot Ythotha             xsl0401-4-LeftAA                   ",
          "SERAPHIM EXPERIMENTAL Experimental Assault Bot Ythotha             xsl0401-5-RightAA                  " },
        ["(AIR * MOBILE - INTELLIGENCE)"] = { -- table: 18312460 (168 bytes)
          "AEON     EXPERIMENTAL Experimental Aircraft Carrier CZAR           uaa0310-2-SonicPulseBattery1       ",
          "AEON     EXPERIMENTAL Experimental Aircraft Carrier CZAR           uaa0310-2-SonicPulseBattery1       ",
          "AEON     EXPERIMENTAL Experimental Aircraft Carrier CZAR           uaa0310-3-SonicPulseBattery2       ",
          "AEON     EXPERIMENTAL Experimental Aircraft Carrier CZAR           uaa0310-4-SonicPulseBattery3       ",
          "AEON     EXPERIMENTAL Experimental Aircraft Carrier CZAR           uaa0310-5-SonicPulseBattery4       ",
          "AEON     EXPERIMENTAL Experimental Aircraft Carrier CZAR           uaa0310-8-AAFizz01                 ",
          "AEON     EXPERIMENTAL Experimental Aircraft Carrier CZAR           uaa0310-9-AAFizz02                 ",
          "UEF      TECH3        Heavy Gunship Broadsword                     uea0305-2-AAGun                    ",
          "CYBRAN   EXPERIMENTAL Experimental Gunship Soul Ripper             ura0401-3-AAMissile01              ",
          "CYBRAN   EXPERIMENTAL Experimental Gunship Soul Ripper             ura0401-4-AAMissile02              ",
          "AEON     TECH3        AA Gunship Restorer                          xaa0305-2-AAGun01                  ",
          "AEON     TECH3        AA Gunship Restorer                          xaa0305-3-AAGun02                  ",
          "CYBRAN   TECH3        Heavy Gunship Wailer                         xra0305-2-Missiles1                " },
        ["(ALLUNITS - SPECIALLOWPRI)"] = { -- table: 18312DE8 (56 bytes)
          "AEON     TECH2        Guided Missile Mercy                         daa0206-1-Suicide                  ",
          "AEON     TECH2        Guided Missile Mercy                         daa0206-1-Suicide                  " },
        ["(ARTILLERY - TECH1)"] = { -- table: 18312370 (168 bytes)
          "AEON     TECH2        Artillery Installation Miasma                uab2303-1-MainGun                  ",
          "AEON     TECH2        Artillery Installation Miasma                uab2303-1-MainGun                  ",
          "AEON     TECH3        Mobile Heavy Artillery Serenity              ual0304-1-MainGun                  ",
          "UEF      TECH2        Artillery Installation Klink Hammer          ueb2303-1-MainGun                  ",
          "UEF      TECH3        Mobile Heavy Artillery Demolisher            uel0304-1-MainGun                  ",
          "CYBRAN   TECH2        Artillery Installation Gunther               urb2303-1-MainGun                  ",
          "CYBRAN   TECH3        Mobile Heavy Artillery Trebuchet             url0304-1-MainGun                  ",
          "AEON     TECH3        Sniper Bot Sprite Striker                    xal0305-1-MainGun                  ",
          "SERAPHIM TECH2        Artillery Installation Zthuthaam             xsb2303-1-MainGun                  ",
          "SERAPHIM TECH3        Mobile Heavy Artillery Suthanus              xsl0304-1-MainGun                  ",
          "SERAPHIM TECH3        Sniper Bot Usha-Ah                           xsl0305-2-MainGun                  ",
          "SERAPHIM TECH3        Sniper Bot Usha-Ah                           xsl0305-3-SniperGun                " },
        ["(EXPERIMENTAL * ARTILLERY - FACTORY)"] = { -- table: 22D67A50 (56 bytes)
          "UEF      EXPERIMENTAL Defense Satellite                            xea0002-1-OrbitalDeathLaserWeapon  ",
          "UEF      EXPERIMENTAL Defense Satellite                            xea0002-1-OrbitalDeathLaserWeapon  " },
        ["(MOBILE * TECH1 + COMMAND)"] = { -- table: 183128E8 (104 bytes)
          "AEON     TECH1        Mobile Light Artillery Fervor                ual0103-1-MainGun                  ",
          "AEON     TECH1        Mobile Light Artillery Fervor                ual0103-1-MainGun                  ",
          "UEF      TECH1        Mobile Light Artillery Lobo                  uel0103-1-MainGun                  ",
          "CYBRAN   TECH1        Mobile Light Artillery Medusa                url0103-1-MainGun                  ",
          "SERAPHIM TECH1        Mobile Light Artillery Zthuee                xsl0103-1-MainGun                  " },
        ["(STRUCTURE * DEFENSE - ANTIAIR - ANTIMISSILE)"] = { -- table: 1F22D0F0 (56 bytes)
          "CYBRAN   COMMAND      Armored Command Unit                         url0001-7-Torpedo                  ",
          "CYBRAN   COMMAND      Armored Command Unit                         url0001-7-Torpedo                  " },
        ["(STRUCTURE * DEFENSE - ANTIAIR)"] = { -- table: 1D0162D0 (168 bytes)
          "AEON     TECH1        Attack Submarine Sylph                       uas0203-1-Torpedo01                ",
          "AEON     TECH1        Attack Submarine Sylph                       uas0203-1-Torpedo01                ",
          "AEON     EXPERIMENTAL Experimental Battleship Tempest              uas0401-2-Torpedo01                ",
          "UEF      EXPERIMENTAL Experimental Mobile Factory Fatboy           uel0401-9-Torpedo                  ",
          "UEF      TECH1        Attack Submarine Tigershark                  ues0203-1-Torpedo01                ",
          "UEF      EXPERIMENTAL Experimental Aircraft Carrier Atlantis       ues0401-1-Torpedo01                ",
          "CYBRAN   EXPERIMENTAL Experimental Spiderbot Monkeylord            url0402-6-Torpedo                  ",
          "CYBRAN   TECH1        Attack Submarine Sliver                      urs0203-1-Torpedo01                ",
          "CYBRAN   TECH3        Strategic Missile Submarine Plan B           urs0304-2-Torpedo01                ",
          "AEON     TECH2        Submarine Hunter Vesper                      xas0204-1-Torpedo01                ",
          "CYBRAN   TECH2        Submarine Killer Barracuda                   xrs0204-1-Torpedo01                ",
          "SERAPHIM TECH2        Destroyer Uashavoh                           xss0201-3-Torpedo1                 ",
          "SERAPHIM TECH1        Attack Submarine Sou-istle                   xss0203-1-Torpedo01                ",
          "SERAPHIM TECH3        Submarine Hunter Yathsou                     xss0304-1-TorpedoFront             " },
        ["(STRUCTURE * DEFENSE - ANTIMISSILE - ANTIAIR)"] = { -- table: 183126E0 (168 bytes)
          "AEON     TECH1        Torpedo Launcher Tide                        uab2109-1-Turret01                 ",
          "AEON     TECH1        Torpedo Launcher Tide                        uab2109-1-Turret01                 ",
          "AEON     TECH2        Torpedo Launcher Wave Break                  uab2205-1-Turret01                 ",
          "UEF      TECH1        Torpedo Launcher DN1                         ueb2109-1-Turret01                 ",
          "UEF      TECH2        Torpedo Launcher Tsunami                     ueb2205-1-Torpedo                  ",
          "CYBRAN   TECH1        Torpedo Launcher Scuttle                     urb2109-1-Turret01                 ",
          "CYBRAN   TECH2        Torpedo Launcher Nanite Torpedo Array        urb2205-1-Turret01                 ",
          "SERAPHIM TECH1        Torpedo Launcher Sou-atha                    xsb2109-1-Turret01                 ",
          "SERAPHIM TECH2        Torpedo Launcher Uosthu                      xsb2205-1-TorpedoTurrets           " },
        ["(STRUCTURE * DEFENSE - ANTIMISSILE)"] = { -- table: 183122F8 (2088 bytes)
          "AEON     TECH3        Shield Disruptor Absolver                    dal0310-1-MainGun                  ",
          "AEON     TECH3        Shield Disruptor Absolver                    dal0310-1-MainGun                  ",
          "UEF      TECH2        Gatling Bot Mongoose                         del0204-1-GatlingCannon            ",
          "UEF      TECH2        Gatling Bot Mongoose                         del0204-2-Grenade                  ",
          "CYBRAN   TECH2        Rocket Bot Hoplite                           drl0204-1-RocketBackpack           ",
          "CYBRAN   TECH3        Mobile Missile Anti-Air Bouncer              drlk001-2-GroundGun                ",
          "SERAPHIM TECH3        Lightning Tank Uyanah                        dslk004-1-PhasonBeamGround         ",
          "AEON     TECH2        Torpedo Bomber Skimmer                       uaa0204-1-Bomb                     ",
          "AEON     TECH1        Point Defense Erupter                        uab2101-1-MainGun                  ",
          "AEON     TECH2        Tactical Missile Launcher Serpentine         uab2108-1-CruiseMissile            ",
          "AEON     TECH2        Artillery Installation Miasma                uab2303-1-MainGun                  ",
          "AEON     COMMAND      Armored Command Unit                         ual0001-1-RightDisruptor           ",
          "AEON     COMMAND      Armored Command Unit                         ual0001-2-OverCharge               ",
          "AEON     COMMAND      Armored Command Unit                         ual0001-3-AutoOverCharge           ",
          "AEON     TECH1        Mobile Light Artillery Fervor                ual0103-1-MainGun                  ",
          "AEON     TECH1        Light Assault Bot Flare                      ual0106-1-ArmLaserTurret           ",
          "AEON     TECH1        Light Tank Aurora                            ual0201-1-MainGun                  ",
          "AEON     TECH2        Heavy Tank Obsidian                          ual0202-1-MainGun                  ",
          "AEON     SUBCOMMANDER Support Armored Command Unit                 ual0301-1-RightReactonCannon       ",
          "AEON     SUBCOMMANDER SACU (Engineer Preset)                       ual0301-1-RightReactonCannon       ",
          "AEON     SUBCOMMANDER SACU (Nano Combatant Preset)                 ual0301-1-RightReactonCannon       ",
          "AEON     SUBCOMMANDER SACU (Rambo Preset)                          ual0301-1-RightReactonCannon       ",
          "AEON     SUBCOMMANDER SACU (RAS Preset)                            ual0301-1-RightReactonCannon       ",
          "AEON     SUBCOMMANDER SACU (Shield Combatant Preset)               ual0301-1-RightReactonCannon       ",
          "AEON     SUBCOMMANDER SACU (Combatant Preset)                      ual0301-1-RightReactonCannon       ",
          "AEON     TECH3        Heavy Assault Bot Harbinger Mark IV          ual0303-1-FrontTurret01            ",
          "AEON     TECH3        Mobile Heavy Artillery Serenity              ual0304-1-MainGun                  ",
          "AEON     EXPERIMENTAL Experimental Assault Bot Galactic Colossus   ual0401-1-EyeWeapon                ",
          "AEON     TECH2        Destroyer Exodus Class                       uas0201-2-DepthCharge              ",
          "UEF      TECH2        Torpedo Bomber Stork                         uea0204-1-Torpedo                  ",
          "UEF      TECH1        Point Defense DM1 Plasma Cannon              ueb2101-1-MainGun                  ",
          "UEF      TECH2        Artillery Installation Klink Hammer          ueb2303-1-MainGun                  ",
          "UEF      COMMAND      Armored Command Unit                         uel0001-1-RightZephyr              ",
          "UEF      COMMAND      Armored Command Unit                         uel0001-2-OverCharge               ",
          "UEF      COMMAND      Armored Command Unit                         uel0001-3-AutoOverCharge           ",
          "UEF      COMMAND      Armored Command Unit                         uel0001-4-TacMissile               ",
          "UEF      TECH1        Mobile Light Artillery Lobo                  uel0103-1-MainGun                  ",
          "UEF      TECH1        Light Assault Bot Mech Marine                uel0106-1-ArmCannonTurret          ",
          "UEF      TECH1        Medium Tank MA12 Striker                     uel0201-1-MainGun                  ",
          "UEF      TECH2        Heavy Tank Pillar                            uel0202-1-FrontTurret01            ",
          "UEF      TECH2        Amphibious Tank Riptide                      uel0203-1-Riotgun01                ",
          "UEF      SUBCOMMANDER Support Armored Command Unit                 uel0301-1-RightHeavyPlasmaCannon   ",
          "UEF      SUBCOMMANDER SACU (Shield Preset)                         uel0301-1-RightHeavyPlasmaCannon   ",
          "UEF      SUBCOMMANDER SACU (Combatant Preset)                      uel0301-1-RightHeavyPlasmaCannon   ",
          "UEF      SUBCOMMANDER SACU (Engineer Preset)                       uel0301-1-RightHeavyPlasmaCannon   ",
          "UEF      SUBCOMMANDER SACU (Intel Jammer Preset)                   uel0301-1-RightHeavyPlasmaCannon   ",
          "UEF      SUBCOMMANDER SACU (Rambo Preset)                          uel0301-1-RightHeavyPlasmaCannon   ",
          "UEF      SUBCOMMANDER SACU (RAS Preset)                            uel0301-1-RightHeavyPlasmaCannon   ",
          "UEF      TECH3        Heavy Assault Bot Titan                      uel0303-1-HeavyPlasma01            ",
          "UEF      TECH3        Mobile Heavy Artillery Demolisher            uel0304-1-MainGun                  ",
          "UEF      EXPERIMENTAL Experimental Mobile Factory Fatboy           uel0401-1-RightTurret01            ",
          "UEF      EXPERIMENTAL Experimental Mobile Factory Fatboy           uel0401-2-RightTurret02            ",
          "UEF      EXPERIMENTAL Experimental Mobile Factory Fatboy           uel0401-3-LeftTurret01             ",
          "UEF      EXPERIMENTAL Experimental Mobile Factory Fatboy           uel0401-4-LeftTurret02             ",
          "UEF      EXPERIMENTAL Experimental Mobile Factory Fatboy           uel0401-5-RightRiotgun             ",
          "UEF      EXPERIMENTAL Experimental Mobile Factory Fatboy           uel0401-6-LeftRiotgun              ",
          "UEF      TECH1        Frigate Thunderhead Class                    ues0103-1-MainGun                  ",
          "UEF      TECH2        Destroyer Valiant Class                      ues0201-4-Torpedo01                ",
          "UEF      TECH1        Attack Submarine Tigershark                  ues0203-2-PlasmaGun                ",
          "UEF      TECH3        Sonar Platform SP3 - 3000                    ues0305-1-Torpedo01                ",
          "CYBRAN   TECH2        Torpedo Bomber Cormorant                     ura0204-1-Bomb                     ",
          "CYBRAN   EXPERIMENTAL Experimental Gunship Soul Ripper             ura0401-1-Missile01                ",
          "CYBRAN   EXPERIMENTAL Experimental Gunship Soul Ripper             ura0401-2-Missile02                ",
          "CYBRAN   EXPERIMENTAL Experimental Gunship Soul Ripper             ura0401-5-HeavyBolter              ",
          "CYBRAN   EXPERIMENTAL Experimental Gunship Soul Ripper             ura0401-6-HeavyBolterBack          ",
          "CYBRAN   TECH1        Point Defense Auto Gun                       urb2101-1-MainGun                  ",
          "CYBRAN   TECH2        Artillery Installation Gunther               urb2303-1-MainGun                  ",
          "CYBRAN   COMMAND      Armored Command Unit                         url0001-1-DummyWeapon              ",
          "CYBRAN   COMMAND      Armored Command Unit                         url0001-2-RightRipper              ",
          "CYBRAN   COMMAND      Armored Command Unit                         url0001-3-OverCharge               ",
          "CYBRAN   COMMAND      Armored Command Unit                         url0001-4-AutoOverCharge           ",
          "CYBRAN   COMMAND      Armored Command Unit                         url0001-6-MLG                      ",
          "CYBRAN   TECH1        Mobile Light Artillery Medusa                url0103-1-MainGun                  ",
          "CYBRAN   TECH1        Mobile Anti-Air Gun Sky Slammer              url0104-1-GroundGun                ",
          "CYBRAN   TECH1        Light Assault Bot Hunter                     url0106-1-MainGun                  ",
          "CYBRAN   TECH1        Assault Bot Mantis                           url0107-1-LaserArms                ",
          "CYBRAN   TECH2        Heavy Tank Rhino                             url0202-1-MainGun                  ",
          "CYBRAN   TECH2        Amphibious Tank Wagner                       url0203-1-Rocket                   ",
          "CYBRAN   TECH2        Amphibious Tank Wagner                       url0203-2-Bolter                   ",
          "CYBRAN   TECH2        Amphibious Tank Wagner                       url0203-3-Torpedo                  ",
          "CYBRAN   SUBCOMMANDER Support Armored Command Unit                 url0301-1-RightDisintegrator       ",
          "CYBRAN   SUBCOMMANDER SACU (Anti-Air Preset)                       url0301-1-RightDisintegrator       ",
          "CYBRAN   SUBCOMMANDER SACU (Cloak Preset)                          url0301-1-RightDisintegrator       ",
          "CYBRAN   SUBCOMMANDER SACU (Combatant Preset)                      url0301-1-RightDisintegrator       ",
          "CYBRAN   SUBCOMMANDER SACU (Engineer Preset)                       url0301-1-RightDisintegrator       ",
          "CYBRAN   SUBCOMMANDER SACU (Rambo Preset)                          url0301-1-RightDisintegrator       ",
          "CYBRAN   SUBCOMMANDER SACU (RAS Preset)                            url0301-1-RightDisintegrator       ",
          "CYBRAN   SUBCOMMANDER SACU (Stealth Preset)                        url0301-1-RightDisintegrator       ",
          "CYBRAN   TECH3        Siege Assault Bot Loyalist                   url0303-1-Disintigrator            ",
          "CYBRAN   TECH3        Siege Assault Bot Loyalist                   url0303-2-HeavyBolter              ",
          "CYBRAN   TECH3        Mobile Heavy Artillery Trebuchet             url0304-1-MainGun                  ",
          "CYBRAN   EXPERIMENTAL Experimental Spiderbot Monkeylord            url0402-1-MainGun                  ",
          "CYBRAN   EXPERIMENTAL Experimental Spiderbot Monkeylord            url0402-2-RightLaserTurret         ",
          "CYBRAN   EXPERIMENTAL Experimental Spiderbot Monkeylord            url0402-3-LeftLaserTurret          ",
          "CYBRAN   TECH2        Destroyer Salem Class                        urs0201-3-TorpedoL                 ",
          "CYBRAN   TECH1        Attack Submarine Sliver                      urs0203-2-MainGun                  ",
          "CYBRAN   TECH3        Battleship Galaxy Class                      urs0302-5-Torpedo01                ",
          "UEF      TECH1        Test Unit Arc Projectile uxl0021 name        uxl0021-1-MainGun                  ",
          "AEON     TECH3        Torpedo Bomber Solace                        xaa0306-1-Bomb                     ",
          "AEON     TECH2        Assault Tank Blaze                           xal0203-1-MainGun                  ",
          "AEON     TECH3        Sniper Bot Sprite Striker                    xal0305-1-MainGun                  ",
          "UEF      TECH3        Heavy Point Defense Ravager                  xeb2306-1-MainGun                  ",
          "UEF      TECH2        Field Engineer Sparky                        xel0209-1-Riotgun01                ",
          "UEF      TECH3        Armored Assault Bot Percival                 xel0305-1-PlasmaCannon01           ",
          "UEF      TECH2        Torpedo Boat Cooper                          xes0102-1-Torpedo01                ",
          "UEF      TECH3        Battlecruiser Neptune Class                  xes0307-3-TorpedoLeft01            ",
          "CYBRAN   TECH3        Heavy Gunship Wailer                         xra0305-1-Disintegrator01          ",
          "CYBRAN   TECH3        Torpedo Ambushing System HARMS               xrb2308-1-Turret01                 ",
          "CYBRAN   TECH3        Torpedo Ambushing System HARMS               xrb2309-1-Turret01                 ",
          "CYBRAN   TECH2        Mobile Bomb Fire Beetle                      xrl0302-1-Suicide                  ",
          "CYBRAN   TECH3        Armored Assault Bot The Brick                xrl0305-1-Disintigrator            ",
          "CYBRAN   TECH3        Armored Assault Bot The Brick                xrl0305-2-Torpedo                  ",
          "CYBRAN   EXPERIMENTAL Experimental Megabot Megalith                xrl0403-3-Torpedo01                ",
          "CYBRAN   EXPERIMENTAL Experimental Megabot Megalith                xrl0403-6-HackPegLauncher          ",
          "SERAPHIM TECH2        Torpedo Bomber Uosioz                        xsa0204-1-Bomb                     ",
          "SERAPHIM TECH1        Point Defense Uttaus                         xsb2101-1-MainGun                  ",
          "SERAPHIM TECH2        Tactical Missile Launcher Ythis              xsb2108-1-CruiseMissile            ",
          "SERAPHIM TECH2        Artillery Installation Zthuthaam             xsb2303-1-MainGun                  ",
          "SERAPHIM COMMAND      Armored Command Unit                         xsl0001-1-ChronotronCannon         ",
          "SERAPHIM COMMAND      Armored Command Unit                         xsl0001-2-OverCharge               ",
          "SERAPHIM COMMAND      Armored Command Unit                         xsl0001-3-AutoOverCharge           ",
          "SERAPHIM COMMAND      Armored Command Unit                         xsl0001-5-Missile                  ",
          "SERAPHIM TECH1        Combat Scout Selen                           xsl0101-1-LaserTurret              ",
          "SERAPHIM TECH1        Mobile Light Artillery Zthuee                xsl0103-1-MainGun                  ",
          "SERAPHIM TECH1        Medium Tank Thaam                            xsl0201-1-MainGun                  ",
          "SERAPHIM TECH2        Assault Bot Ilshavoh                         xsl0202-1-MainGun                  ",
          "SERAPHIM TECH2        Hover Tank Yenzyne                           xsl0203-1-TauCannon01              ",
          "SERAPHIM SUBCOMMANDER Support Armored Command Unit                 xsl0301-1-LightChronatronCannon    ",
          "SERAPHIM SUBCOMMANDER Support Armored Command Unit                 xsl0301-2-OverCharge               ",
          "SERAPHIM SUBCOMMANDER Support Armored Command Unit                 xsl0301-3-AutoOverCharge           ",
          "SERAPHIM SUBCOMMANDER Support Armored Command Unit                 xsl0301-5-Missile                  ",
          "SERAPHIM SUBCOMMANDER SACU (Advanced Combatant Preset)             xsl0301-1-LightChronatronCannon    ",
          "SERAPHIM SUBCOMMANDER SACU (Advanced Combatant Preset)             xsl0301-2-OverCharge               ",
          "SERAPHIM SUBCOMMANDER SACU (Advanced Combatant Preset)             xsl0301-3-AutoOverCharge           ",
          "SERAPHIM SUBCOMMANDER SACU (Advanced Combatant Preset)             xsl0301-5-Missile                  ",
          "SERAPHIM SUBCOMMANDER SACU (Combatant Preset)                      xsl0301-1-LightChronatronCannon    ",
          "SERAPHIM SUBCOMMANDER SACU (Combatant Preset)                      xsl0301-2-OverCharge               ",
          "SERAPHIM SUBCOMMANDER SACU (Combatant Preset)                      xsl0301-3-AutoOverCharge           ",
          "SERAPHIM SUBCOMMANDER SACU (Combatant Preset)                      xsl0301-5-Missile                  ",
          "SERAPHIM SUBCOMMANDER SACU (Engineer Preset)                       xsl0301-1-LightChronatronCannon    ",
          "SERAPHIM SUBCOMMANDER SACU (Engineer Preset)                       xsl0301-2-OverCharge               ",
          "SERAPHIM SUBCOMMANDER SACU (Engineer Preset)                       xsl0301-3-AutoOverCharge           ",
          "SERAPHIM SUBCOMMANDER SACU (Engineer Preset)                       xsl0301-5-Missile                  ",
          "SERAPHIM SUBCOMMANDER SACU (Missile Preset)                        xsl0301-1-LightChronatronCannon    ",
          "SERAPHIM SUBCOMMANDER SACU (Missile Preset)                        xsl0301-2-OverCharge               ",
          "SERAPHIM SUBCOMMANDER SACU (Missile Preset)                        xsl0301-3-AutoOverCharge           ",
          "SERAPHIM SUBCOMMANDER SACU (Missile Preset)                        xsl0301-5-Missile                  ",
          "SERAPHIM SUBCOMMANDER SACU (Nano Combatant Preset)                 xsl0301-1-LightChronatronCannon    ",
          "SERAPHIM SUBCOMMANDER SACU (Nano Combatant Preset)                 xsl0301-2-OverCharge               ",
          "SERAPHIM SUBCOMMANDER SACU (Nano Combatant Preset)                 xsl0301-3-AutoOverCharge           ",
          "SERAPHIM SUBCOMMANDER SACU (Nano Combatant Preset)                 xsl0301-5-Missile                  ",
          "SERAPHIM SUBCOMMANDER SACU (Rambo Preset)                          xsl0301-1-LightChronatronCannon    ",
          "SERAPHIM SUBCOMMANDER SACU (Rambo Preset)                          xsl0301-2-OverCharge               ",
          "SERAPHIM SUBCOMMANDER SACU (Rambo Preset)                          xsl0301-3-AutoOverCharge           ",
          "SERAPHIM SUBCOMMANDER SACU (Rambo Preset)                          xsl0301-5-Missile                  ",
          "SERAPHIM TECH3        Siege Tank Othuum                            xsl0303-1-RightTurret              ",
          "SERAPHIM TECH3        Siege Tank Othuum                            xsl0303-2-LeftTurret               ",
          "SERAPHIM TECH3        Siege Tank Othuum                            xsl0303-3-MainTurret               ",
          "SERAPHIM TECH3        Siege Tank Othuum                            xsl0303-4-Torpedo01                ",
          "SERAPHIM TECH3        Mobile Heavy Artillery Suthanus              xsl0304-1-MainGun                  ",
          "SERAPHIM TECH3        Sniper Bot Usha-Ah                           xsl0305-2-MainGun                  ",
          "SERAPHIM TECH3        Sniper Bot Usha-Ah                           xsl0305-3-SniperGun                ",
          "SERAPHIM EXPERIMENTAL Experimental Assault Bot Ythotha             xsl0401-1-EyeWeapon                ",
          "SERAPHIM EXPERIMENTAL Experimental Assault Bot Ythotha             xsl0401-2-LeftArm                  ",
          "SERAPHIM EXPERIMENTAL Experimental Assault Bot Ythotha             xsl0401-3-RightArm                 ",
          "SERAPHIM TECH1        Attack Submarine Sou-istle                   xss0203-3-Cannon                   " },
        ["(STRUCTURE * TECH2 * DEFENSE - ANTIMISSILE)"] = { -- table: 18312C08 (104 bytes)
          "AEON     TECH2        Point Defense Oblivion                       uab2301-1-MainGun                  ",
          "AEON     TECH2        Point Defense Oblivion                       uab2301-1-MainGun                  ",
          "UEF      TECH2        Point Defense Triad                          ueb2301-1-Gauss01                  ",
          "CYBRAN   TECH2        Point Defense Cerberus                       urb2301-1-MainGun                  ",
          "SERAPHIM TECH2        Point Defense Uttaushala                     xsb2301-1-MainGun                  " },
        ["(SUBMERSIBLE - TECH1)"] = { -- table: 22D67C80 (56 bytes)
          "AEON     TECH3        Torpedo Bomber Solace                        xaa0306-1-Bomb                     ",
          "AEON     TECH3        Torpedo Bomber Solace                        xaa0306-1-Bomb                     " },
        ["(TECH2 * MOBILE * NAVAL - CRUISER)"] = { -- table: 1D016050 (168 bytes)
          "AEON     TECH1        Attack Submarine Sylph                       uas0203-1-Torpedo01                ",
          "AEON     TECH1        Attack Submarine Sylph                       uas0203-1-Torpedo01                ",
          "AEON     EXPERIMENTAL Experimental Battleship Tempest              uas0401-2-Torpedo01                ",
          "UEF      EXPERIMENTAL Experimental Mobile Factory Fatboy           uel0401-9-Torpedo                  ",
          "UEF      TECH1        Attack Submarine Tigershark                  ues0203-1-Torpedo01                ",
          "UEF      EXPERIMENTAL Experimental Aircraft Carrier Atlantis       ues0401-1-Torpedo01                ",
          "CYBRAN   COMMAND      Armored Command Unit                         url0001-7-Torpedo                  ",
          "CYBRAN   EXPERIMENTAL Experimental Spiderbot Monkeylord            url0402-6-Torpedo                  ",
          "CYBRAN   TECH1        Attack Submarine Sliver                      urs0203-1-Torpedo01                ",
          "CYBRAN   TECH3        Strategic Missile Submarine Plan B           urs0304-2-Torpedo01                ",
          "AEON     TECH2        Submarine Hunter Vesper                      xas0204-1-Torpedo01                ",
          "CYBRAN   TECH2        Submarine Killer Barracuda                   xrs0204-1-Torpedo01                ",
          "SERAPHIM TECH2        Destroyer Uashavoh                           xss0201-3-Torpedo1                 ",
          "SERAPHIM TECH1        Attack Submarine Sou-istle                   xss0203-1-Torpedo01                ",
          "SERAPHIM TECH3        Submarine Hunter Yathsou                     xss0304-1-TorpedoFront             " }
      }

It is quite a long list so it needs some going over to see if it makes sense. I didn't do so but I trust that it they are reasonable changes.

Additional Context

It is easy to be unaware of this bug because proper prios are used successfully when custom priorities are given, the default prios fix themselves when reset, and the proper prios are generally niche.

Checklist

Summary by CodeRabbit

  • Bug Fixes
    • Fixed an issue with how default weapon target priorities were being parsed, which was preventing proper categorization of targets according to their predefined priority categories.
    • Updated weapon target priorities for multiple units to use the corrected parsing format, ensuring more consistent and accurate weapon targeting behavior during all gameplay scenarios.

lL1l1 added 5 commits June 12, 2026 15:15
You can reload the weapon.lua file to reload the initial prio parsing
The bug is that the third argument `plain` being `true` disables the pattern matching facilities so the escape character `%` becomes an actual matched character, which causes the string from target priorities to not match.

I also regex searched all files with `find\(.*, true\)` and didn't find any other instances of this mistake.
@lL1l1 lL1l1 requested review from Garanas and speed2CZ June 12, 2026 23:38
@lL1l1 lL1l1 added type: bug area: balance related to units balance, but not as a suggestion labels Jun 12, 2026
@lL1l1 lL1l1 added area: sim Area that is affected by the Simulation of the Game feature: target priorities related to the target priorities of weapons labels Jun 12, 2026
@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This pull request fixes target priority parsing by normalizing syntax from parenthesized wildcard expressions to space-separated category strings. The parser change enables richer category matching, and unit blueprints are updated to use the new format.

Changes

Target Priority Parsing Fix

Layer / File(s) Summary
Parser logic and changelog
changelog/snippets/fix.7138.md, lua/sim/weapon.lua
Changelog documents the fix to target priority parsing. Parser detection logic changes from escaped pattern '%(' to literal character '(', which routes priorities differently between strict and rich category parsing functions.
Unit blueprint priority migrations
units/UAA0204/UAA0204_unit.bp, units/UEA0204/UEA0204_unit.bp, units/URA0204/URA0204_unit.bp, units/XAA0306/XAA0306_unit.bp, units/XSA0204/XSA0204_unit.bp
Five unit weapon TargetPriorities lists are updated to use explicit space-separated category format (NAVAL TECH2 SHIELD, STRUCTURE DEFENSE ANTIAIR, TECH3 NAVAL CARRIER, etc.) instead of wildcard expressions with parentheses, aligning with the new parser behavior.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested labels

area: unit-blueprint

Suggested reviewers

  • Rhaelya

Poem

🐰 Priorities parsed with clarity now,
Spaces replace wildcards' bow,
From (NAVAL * TECH2) old and worn,
To NAVAL TECH2 SHIELD reborn—
Five units dance in syntaxes new! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main fix: correcting the parsing of 'proper' expressions in default target priorities by changing the string pattern matching behavior.
Description check ✅ Passed The description comprehensively covers the root cause, affected priorities, testing performed, and includes a changelog snippet. All required template sections are present and well-documented.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@lL1l1 lL1l1 marked this pull request as ready for review June 12, 2026 23:40
@lL1l1

lL1l1 commented Jun 12, 2026

Copy link
Copy Markdown
Contributor Author

Normal parsing will still take in the words that it detects as categories and apply unions to them. So some priorities maybe worked in an unexpected way.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
lua/sim/weapon.lua (1)

629-636: 📐 Maintainability & Code Quality | 💤 Low value

Consider updating for consistency (optional).

Line 629 uses pattern-matching search string.find(v, '%(') while line 58 now uses plain search StringFind(priority, '(', 1, true). Both correctly detect parentheses, but for consistency and clarity, line 629 could adopt the same plain-search style:

if string.find(v, '(', 1, true) then
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lua/sim/weapon.lua` around lines 629 - 636, Replace the pattern-based
string.find call with a plain search for consistency: in the block that sets
cachedPriorities and priorityTable (references: cachedPriorities, priorityTable,
ParseEntityCategoryProperly, ParseEntityCategory) change the condition that
currently uses string.find(v, '%(') to use a plain search string.find(v, '(', 1,
true) so it behaves like the earlier usage and avoids pattern interpretation.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@lua/sim/weapon.lua`:
- Around line 629-636: Replace the pattern-based string.find call with a plain
search for consistency: in the block that sets cachedPriorities and
priorityTable (references: cachedPriorities, priorityTable,
ParseEntityCategoryProperly, ParseEntityCategory) change the condition that
currently uses string.find(v, '%(') to use a plain search string.find(v, '(', 1,
true) so it behaves like the earlier usage and avoids pattern interpretation.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a8229cfa-25a2-4c69-8354-e2284e69f446

📥 Commits

Reviewing files that changed from the base of the PR and between b6a16d6 and e9f217a.

📒 Files selected for processing (7)
  • changelog/snippets/fix.7138.md
  • lua/sim/weapon.lua
  • units/UAA0204/UAA0204_unit.bp
  • units/UEA0204/UEA0204_unit.bp
  • units/URA0204/URA0204_unit.bp
  • units/XAA0306/XAA0306_unit.bp
  • units/XSA0204/XSA0204_unit.bp

@Garanas

Garanas commented Jun 13, 2026

Copy link
Copy Markdown
Member

It would be good to have a regression check in blueprints-weapons so that this doesn't happen again, do you think that would be possible?

@lL1l1

lL1l1 commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

What do you mean by regression check? I'm not sure how a check in blueprint loading will help with verifying that the code that parses priorities is working (the 'what happened' part of "so that this doesn't happen again").

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: balance related to units balance, but not as a suggestion area: sim Area that is affected by the Simulation of the Game feature: target priorities related to the target priorities of weapons type: bug

Projects

Status: To Discuss

Development

Successfully merging this pull request may close these issues.

2 participants