Skip to content

Comments

Fix render fire clock progress turning into silo build progress after unit ownership transfer#7051

Open
lL1l1 wants to merge 13 commits intoFAForever:developfrom
lL1l1:Fix/silo-work-progress-transfer
Open

Fix render fire clock progress turning into silo build progress after unit ownership transfer#7051
lL1l1 wants to merge 13 commits intoFAForever:developfrom
lL1l1:Fix/silo-work-progress-transfer

Conversation

@lL1l1
Copy link
Contributor

@lL1l1 lL1l1 commented Feb 22, 2026

Description of the proposed changes

Fixes #7049.

Testing done on the proposed changes

Command to transfer a unit to yourself
ConExecute([[SimLua 
ForkThread(function ()
    local focus = GetFocusArmy()
    local f = import('/lua/SimUtils.lua').TransferUnitsOwnership
    local units = DebugGetSelection()
    units = f(units, focus + 1, false)
    WaitTicks(3)
    f(units, focus, false)
end)
]])

Spawn a seraphim battleship:

   CreateUnitAtMouse('xss0302', 0,    0.00,    0.00,  0.12705)
Command to view unit states:

ConExecute([[SimLua 
local unit = SelectedUnit()
local unitStates = { 'Immobile', 'Moving', 'Attacking', 'Guarding', 'Building', 'Upgrading',
    'WaitingForTransport', 'TransportLoading', 'TransportUnloading', 'MovingDown', 'MovingUp',
    'Patrolling', 'Busy', 'Attached', 'BeingReclaimed', 'Repairing', 'Diving', 'Surfacing',
    'Teleporting', 'Ferrying', 'WaitForFerry', 'AssistMoving', 'PathFinding', 'ProblemGettingToGoal',
    'NeedToTerminateTask', 'Capturing', 'BeingCaptured', 'Reclaiming', 'AssistingCommander',
    'Refueling', 'GuardBusy', 'ForceSpeedThrough', 'UnSelectable', 'DoNotTarget', 'LandingOnPlatform',
    'CannotFindPlaceToLand', 'BeingUpgraded', 'Enhancing', 'BeingBuilt', 'NoReclaim', 'NoCost',
    'BlockCommandQueue', 'MakingAttackRun', 'HoldingPattern', 'SiloBuildingAmmo',
}
local activeStates = {}
for _, state in unitStates do
    if unit:IsUnitState(state) then
        table.insert(activeStates, state)
    end
end
unit:DebugLog('Active states: ' .. table.concat(activeStates, ', '))
]])

Testing:
Fire battleship and wait for its reload bar to fill. You shouldn't be able to transfer it and with it having a full bar and being in the silo build state. The debug logging tells you if the transferred unit transfers silo progress.
What I've tried:

  • Fire and transfer
  • Fire and then transfer with a modification of ordering silo build at the same time (Add IssueCommand("BuildSiloNuke") before ConExecute call).
  • Fire, pause the unit, order a silo build, and transfer.
    Fire, pause the unit, order a silo build, unpause and re-pause in the same tick (puts it into silo build state), and then transfer.

Checklist

@lL1l1 lL1l1 requested a review from Garanas February 22, 2026 21:04
@lL1l1 lL1l1 added type: bug area: sim Area that is affected by the Simulation of the Game labels Feb 22, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 22, 2026

📝 Walkthrough

Walkthrough

Fixes a unit-transfer exploit that granted silo progress to instantly unlock or boost nuke submarines and Seraphim battleship for free by preventing work progress from transferring inappropriately during silo ammo building and unit ownership changes.

Changes

Cohort / File(s) Summary
Changelog
changelog/snippets/fix.7051.md
Added changelog entry documenting the fix for issue #7051 regarding the unit-transfer silo progress exploit.
Documentation
engine/Core/Blueprints/WeaponBlueprint.lua
Updated RenderFireClock field comments to clarify that reload progress display should not be used for units with silo weapons due to potential silo progress misalignment after unit transfer.
Exploit Prevention Logic
lua/SimUtils.lua, lua/sim/Unit.lua, lua/sim/weapons/DefaultProjectileWeapon.lua
Modified work progress handling during silo ammo building: SimUtils now conditionally passes silo work progress only during "SiloBuildingAmmo" state; Unit resets work progress on silo build start; DefaultProjectileWeapon skips work progress updates during silo ammo replenishment to prevent progress exploitation.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • BlackYps
  • 4z0t

Poem

🐰 A silo stood proud, but the scheme ran deep,
Progress would transfer while guards were asleep!
We patched up the holes where the exploits would hide,
Now nukes build their way, on the rightful side. 🚀

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change—fixing a render fire clock progress issue that was granting unintended silo progress during unit ownership transfer.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Description check ✅ Passed The PR description includes a clear issue reference, detailed testing instructions with code snippets, comprehensive testing scenarios, and all checklist items marked as complete.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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 February 22, 2026 21:07
@lL1l1 lL1l1 changed the title Remove RenderFireClock from nuke-capable units Fix render fire clock progress turning into silo build progress after unit ownership transfer Feb 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: sim Area that is affected by the Simulation of the Game type: bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Unit generic work progress transfers as silo ammo build progress in unit ownership transfer

1 participant