From 5c3a69c83714c5a1fe29b41ce9d1e5184c82b6f2 Mon Sep 17 00:00:00 2001 From: lL1l1 <82986251+lL1l1@users.noreply.github.com> Date: Fri, 15 Nov 2024 08:33:00 -0800 Subject: [PATCH 1/5] Remove rounding for weapon tracking radius --- lua/system/blueprints-weapons.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/lua/system/blueprints-weapons.lua b/lua/system/blueprints-weapons.lua index d85757fa18..eb4051df5d 100644 --- a/lua/system/blueprints-weapons.lua +++ b/lua/system/blueprints-weapons.lua @@ -138,7 +138,6 @@ local function ProcessWeapon(unit, weapon, projectile) end weapon.TargetCheckInterval = 0.1 * math.floor(10 * weapon.TargetCheckInterval) - weapon.TrackingRadius = 0.1 * math.floor(10 * weapon.TrackingRadius) end ---@param allBlueprints BlueprintsTable From 37efc958758d6ade3fe5de8166a57277500041e0 Mon Sep 17 00:00:00 2001 From: lL1l1 <82986251+lL1l1@users.noreply.github.com> Date: Fri, 15 Nov 2024 08:38:14 -0800 Subject: [PATCH 2/5] Apply formatter (whitespace changes) --- lua/system/blueprints-weapons.lua | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lua/system/blueprints-weapons.lua b/lua/system/blueprints-weapons.lua index eb4051df5d..cc86306ec3 100644 --- a/lua/system/blueprints-weapons.lua +++ b/lua/system/blueprints-weapons.lua @@ -1,11 +1,10 @@ - local weaponTargetCheckUpperLimit = 6000 ---@param unit UnitBlueprint ---@param weapon WeaponBlueprint ---@param projectile? ProjectileBlueprint local function ProcessWeapon(unit, weapon, projectile) - -- pre-compute flags + -- pre-compute flags local isAir = false local isStructure = false local isBomber = false @@ -81,7 +80,7 @@ local function ProcessWeapon(unit, weapon, projectile) end end - -- process target tracking radius + -- process target tracking radius -- if it is set then we use that - allows us to make adjustments as we see fit if weapon.TrackingRadius == nil then @@ -99,7 +98,7 @@ local function ProcessWeapon(unit, weapon, projectile) end -- add significant target checking radius for bombers - if isBomber then + if isBomber then weapon.TrackingRadius = 1.25 end end @@ -112,8 +111,8 @@ local function ProcessWeapon(unit, weapon, projectile) -- by default, do not recheck targets as that is expensive when a lot of units are stacked on top of another weapon.AlwaysRecheckTarget = false - -- allow - if weapon.RangeCategory == 'UWRC_DirectFire' or + -- allow + if weapon.RangeCategory == 'UWRC_DirectFire' or weapon.RangeCategory == "UWRC_IndirectFire" or weapon.MaxRadius > 50 and (weapon.RangeCategory ~= "UWRC_AntiNavy") then weapon.AlwaysRecheckTarget = true From d7e849eb72723492a4716b3fbca768d620f54fb2 Mon Sep 17 00:00:00 2001 From: lL1l1 <82986251+lL1l1@users.noreply.github.com> Date: Fri, 15 Nov 2024 08:46:33 -0800 Subject: [PATCH 3/5] Add comment for check interval flooring --- lua/system/blueprints-weapons.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/system/blueprints-weapons.lua b/lua/system/blueprints-weapons.lua index cc86306ec3..ef9a5044c8 100644 --- a/lua/system/blueprints-weapons.lua +++ b/lua/system/blueprints-weapons.lua @@ -136,6 +136,7 @@ local function ProcessWeapon(unit, weapon, projectile) weapon.AlwaysRecheckTarget = false end + -- Floor target check interval to ticks weapon.TargetCheckInterval = 0.1 * math.floor(10 * weapon.TargetCheckInterval) end From 22a6c98e00ffc1c573de935d6e207f12f5e4ffd5 Mon Sep 17 00:00:00 2001 From: lL1l1 <82986251+lL1l1@users.noreply.github.com> Date: Fri, 15 Nov 2024 09:32:03 -0800 Subject: [PATCH 4/5] Specify `UnitBlueprintAI.NeedUnpack` behavior --- engine/Core/Blueprints/UnitBlueprint.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/engine/Core/Blueprints/UnitBlueprint.lua b/engine/Core/Blueprints/UnitBlueprint.lua index 4d3783ec71..64095e33f0 100644 --- a/engine/Core/Blueprints/UnitBlueprint.lua +++ b/engine/Core/Blueprints/UnitBlueprint.lua @@ -145,6 +145,7 @@ ---@see SetAutoMode ---@field InitialAutoMode boolean --- unit should unpack before firing weapon +--- Engine sets tracking radius to 1x, calls OnLostTarget when given a move order, and OnGotTarget only when not moving ---@field NeedUnpack boolean --- this muliplier is applied when a staging platform is refueling an air unit ---@field RefuelingMultiplier number From 6838d2d0c1903c211b29e523fc213f2f30de15c6 Mon Sep 17 00:00:00 2001 From: lL1l1 <82986251+lL1l1@users.noreply.github.com> Date: Fri, 15 Nov 2024 09:50:40 -0800 Subject: [PATCH 5/5] Create fix.6536.md --- changelog/snippets/fix.6536.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 changelog/snippets/fix.6536.md diff --git a/changelog/snippets/fix.6536.md b/changelog/snippets/fix.6536.md new file mode 100644 index 0000000000..6042c245f0 --- /dev/null +++ b/changelog/snippets/fix.6536.md @@ -0,0 +1,5 @@ +- (#6536) Fix the tracking radius for unit weapons being floored to the nearest tenth, which made units not track targets that are near the outside of their range. + - Mobile unit weapons: 1.0x of weapon range -> 1.05x + - Anti-air weapons: 1.10x -> 1.15x + - Bomber weapons: 1.2x -> 1.25x + - Structure weapons: 1x -> 1x