Skip to content

Commit

Permalink
Initialize section edit texts from section
Browse files Browse the repository at this point in the history
  • Loading branch information
Sharparam committed Nov 13, 2024
1 parent 5740183 commit 51e0da6
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/scripts/gui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1674,6 +1674,15 @@ local function create_logistic_group_edit(player_index, state, section_id, secti
local player = game.players[player_index]
local screen = player.gui.screen
create_dimmer(player_index)

local section

if section_id then
section = state.combinator:get_or_create_section(section_id)
elseif section_index then
section = state.combinator.entity.get_control_behavior().get_section(section_index)
end

local named, dialog

do
Expand Down Expand Up @@ -1752,6 +1761,7 @@ local function create_logistic_group_edit(player_index, state, section_id, secti
maximal_width = 0,
horizontally_stretchable = true
},
text = section and section.group or "",
icon_selector = true,
handler = {
[defines.events.on_gui_confirmed] = handle_logistic_group_confirmed
Expand All @@ -1769,7 +1779,7 @@ local function create_logistic_group_edit(player_index, state, section_id, secti
width = 40,
natural_width = 40
},
text = "1",
text = section and section.multiplier or 1,
numeric = true,
allow_decimal = true,
allow_negative = false,
Expand Down Expand Up @@ -1864,14 +1874,6 @@ local function create_logistic_group_edit(player_index, state, section_id, secti
flib_gui.add(group_list, make_logistic_group_item(group.name, group.count, group.count == nil))
end

local section

if section_id then
section = state.combinator:get_or_create_section(section_id)
elseif section_index then
section = state.combinator.entity.get_control_behavior().get_section(section_index)
end

state.logistic_group_edit = {
dialog = dialog,
section = section --[[@as LuaLogisticSection]],
Expand Down

0 comments on commit 51e0da6

Please sign in to comment.