Skip to content

[Bug]: ACUs that are building do not fire TML when ordered to #6994

@lL1l1

Description

@lL1l1

Describe the Bug

This code disables the weapons and doesn't react on time to engine signals that the weapon should be enabled, so when the engine stops the unit from building and then checks if it has any TML to fire, it doesn't because they're disabled.

---@param self ACUUnit
---@param unitBeingBuilt Unit
---@param order string
OnStartBuild = function(self, unitBeingBuilt, order)
CommandUnit.OnStartBuild(self, unitBeingBuilt, order)
-- Disable any active upgrade weapons
local fork = false
for label, enabled in self.WeaponEnabled do
if enabled then
self:SetWeaponEnabledByLabel(label, false, true)
fork = true
end
end
if fork then
self:ForkThread(self.BuildDisable)
end
end,

---@param self ACUUnit
BuildDisable = function(self)
while self:IsUnitState('Building') or self:IsUnitState('Enhancing') or self:IsUnitState('Upgrading') or
self:IsUnitState('Repairing') or self:IsUnitState('Reclaiming') do
WaitSeconds(0.5)
end
for label, enabled in self.WeaponEnabled do
if enabled then
self:SetWeaponEnabledByLabel(label, true, true)
end
end
end,

Reproduce the bug

Upgrade an ACU with TML, load it, and start building a structure. Then give a TML fire command without shift while the unit is building and it won't fire.

As a counterexample, TML SACU works correctly and does fire after issuing a fire command without shift.

   CreateUnitAtMouse('uel0001', 0,   -0.85,    1.97, -2.18294)
   CreateUnitAtMouse('xab1401', 0,   -0.46,   -5.11, -0.00000)
   CreateUnitAtMouse('xsl0301_missile', 0,    1.31,    3.14,  0.60447)

Screenshots

No response

Additional context

The code originates from a fix related to auto OC firing while the ACU is reclaiming/building/etc: d8d35c7
So those things have to tested in the new fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: simArea that is affected by the Simulation of the Gametype: bug

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions