Skip to content

Commit

Permalink
Update constructions on COMPLETED event
Browse files Browse the repository at this point in the history
  • Loading branch information
scfmod committed Dec 18, 2023
1 parent c435488 commit 5b90c2a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions scripts/gui/InGameMenuConstructionsFrame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ function InGameMenuConstructionsFrame:onFrameOpen()
g_messageCenter:subscribe(MessageType.CONSTRUCTION_PLACEABLE_ADDED, self.onPlaceableAdded, self)
g_messageCenter:subscribe(MessageType.CONSTRUCTION_PLACEABLE_REMOVED, self.onPlaceableRemoved, self)
g_messageCenter:subscribe(MessageType.CONSTRUCTION_SETTINGS_CHANGED, self.onSettingsChanged, self)
g_messageCenter:subscribe(MessageType.CONSTRUCTION_COMPLETED, self.onConstructionCompleted, self)
end

function InGameMenuConstructionsFrame:onFrameClose()
Expand Down Expand Up @@ -465,6 +466,14 @@ function InGameMenuConstructionsFrame:onPlaceableRemoved(placeable)
self:updateMenuButtons()
end

---@param placeable PlaceableConstruction
function InGameMenuConstructionsFrame:onConstructionCompleted(placeable)
if ConstructionUtils.getPlayerHasAccess(placeable) then
self:updatePlaceables()
self:updateMenuButtons()
end
end

---@param previous ConstructionSettings
function InGameMenuConstructionsFrame:onSettingsChanged(previous)
if previous.requireFarmAccess ~= g_construction:getRequireFarmAccess() then
Expand Down

0 comments on commit 5b90c2a

Please sign in to comment.