Skip to content

Commit

Permalink
Fix consumption bug of consecutive enhancements (FAForever#3599)
Browse files Browse the repository at this point in the history
  • Loading branch information
Garanas authored Dec 10, 2021
1 parent 1ed0853 commit 25c0bfb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lua/defaultunits.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2450,6 +2450,18 @@ CommandUnit = Class(WalkingLandUnit) {
self.UnitBeingTeleported = nil
self.TeleportThread = nil
end,

OnWorkBegin = function(self, work)
if WalkingLandUnit.OnWorkBegin(self, work) then

-- Prevent consumption bug where two enhancements in a row prevents assisting units from
-- updating their consumption costs based on the new build rate values.
self:UpdateAssistersConsumption()

-- Inform EnhanceTask that enhancement is not restricted
return true
end
end,
}

ACUUnit = Class(CommandUnit) {
Expand Down
1 change: 1 addition & 0 deletions lua/sim/Unit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3008,6 +3008,7 @@ Unit = Class(moho.unit_methods) {
return false
end


self.WorkItem = tempEnhanceBp
self.WorkItemBuildCostEnergy = tempEnhanceBp.BuildCostEnergy
self.WorkItemBuildCostMass = tempEnhanceBp.BuildCostEnergy
Expand Down

0 comments on commit 25c0bfb

Please sign in to comment.