Skip to content

Conversation

@lL1l1
Copy link
Contributor

@lL1l1 lL1l1 commented Mar 22, 2025

Issue

First reported by @4z0t.
Units currently building in an external factory are attached indirectly, so the engine's usual army transfer behavior for standard factories doesn't destroy those units, and instead the unbuilt units are spawned as damaged units. In other words you can have an unit building in an external factory, transfer it to another player, and the unbuilt unit would respawn as a built but damaged unit for the other army.

spawn.units.exploit.mp4

Description of the proposed changes

In the SimUtils transfer function, before using the engine ChangeUnitArmy function, destroy the building unit in the external factory if it exists. All user transfers go through here, as well as all the share on death type of transfers. Some scenario or AI utils don't, but they don't seem to be an issue with this specific exploit.

Testing done on the proposed changes

You can no longer spawn built units from transferring external factories with unbuilt units.

CreateUnitAtMouse('uas0303', 1,    0.00,    0.00, -0.00000)
import('/lua/SimUtils.lua').TransferUnitsOwnership(DebugGetSelection(), 1, false)
spawn.units.exploit.fixed.mp4

Checklist

  • Changes are annotated, including comments where useful
  • Changes are documented in the changelog for the next game version

@lL1l1 lL1l1 added type: bug area: sim Area that is affected by the Simulation of the Game feature: mobile factories related to mobile factory functionality labels Mar 22, 2025
@lL1l1 lL1l1 marked this pull request as ready for review March 22, 2025 09:17
@lL1l1 lL1l1 merged commit 0247dcc into FAForever:develop Mar 24, 2025
5 checks passed
@lL1l1 lL1l1 deleted the Fix/carrier-unbuilt-unit-transfer branch March 24, 2025 17:25
BlackYps pushed a commit that referenced this pull request Mar 31, 2025
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 feature: mobile factories related to mobile factory functionality type: bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants