diff --git a/VERSION b/VERSION index 3e33edb..4c156e5 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.4.207 +0.4.301 diff --git a/control.lua b/control.lua index fc224a0..1df7f91 100644 --- a/control.lua +++ b/control.lua @@ -57,7 +57,10 @@ script.on_event(defines.events.on_tick, function(event) if err then evogui.log({"err_generic", "on_tick:update_gui", err}) end end) -script.on_event(defines.events.on_gui_click, function(event) +local last_clicked = nil +local last_checked = nil + +local function raise_on_click(event) local status, err = pcall(evogui.on_gui_click, event) if err then @@ -67,4 +70,24 @@ script.on_event(defines.events.on_gui_click, function(event) evogui.log({"err_generic", "on_gui_click", err}) end end +end + +script.on_event(defines.events.on_gui_checked_state_changed, function(event) + -- prevent raising on_click twice for the same element + if last_clicked ~= nil and last_clicked == event.element.name then + return + end + last_checked = event.element.name + + raise_on_click(event) +end) + +script.on_event(defines.events.on_gui_click, function(event) + -- prevent raising on_click twice for the same element + if last_checked ~= nil and last_checked == event.element.name then + return + end + last_clicked = event.element.name + + raise_on_click(event) end) diff --git a/evoGUI.lua b/evoGUI.lua index c4dde8d..99192da 100644 --- a/evoGUI.lua +++ b/evoGUI.lua @@ -202,12 +202,12 @@ function evogui.create_sensor_display(player) local root = player.gui.top.add{type="frame", name="evogui_root", direction="horizontal", - style="outer_frame_style"} + style="outer_frame"} local action_buttons = root.add{type="flow", name="action_buttons", direction="vertical", - style="description_flow_style"} + style="EvoGUI_cramped_flow_v"} action_buttons.add{type="button", name="evoGUI_toggle_popup", style="EvoGUI_expando_closed"} @@ -221,15 +221,15 @@ function evogui.create_sensor_display(player) local sensor_flow = root.add{type="flow", name="sensor_flow", direction="vertical", - style="description_flow_style"} + style="EvoGUI_cramped_flow_v"} sensor_flow.add{type="flow", name="always_visible", direction="vertical", - style="description_flow_style"} + style="EvoGUI_cramped_flow_v"} sensor_flow.add{type="flow", name="in_popup", direction="vertical", - style="description_flow_style"} + style="EvoGUI_cramped_flow_v"} end end diff --git a/info.json b/info.json index 8ccb0d6..821ceab 100644 --- a/info.json +++ b/info.json @@ -1,11 +1,11 @@ { "name": "{{MOD_NAME}}", "version": "{{VERSION}}", - "factorio_version": "0.15", + "factorio_version": "0.16", "title": "EvoGUI - Evolution Factor Indicator and more", "author": "Octav \"narc\" Sandulescu", "contact": "factorio-mods@narc.ro", "homepage": "https://github.com/narc0tiq/evoGUI/", "description": "Places some indicators on your UI for various little statistics that are nice to have.", - "dependencies": ["base >= 0.15.0", "? moweather"] + "dependencies": ["base >= 0.16.1", "? moweather"] } diff --git a/prototypes/styles.lua b/prototypes/styles.lua index ddc1ede..c6445bc 100644 --- a/prototypes/styles.lua +++ b/prototypes/styles.lua @@ -23,7 +23,7 @@ end default_gui.EvoGUI_button_with_icon = { type = "button_style", - parent = "slot_button_style", + parent = "slot_button", scalable = true, @@ -69,3 +69,15 @@ default_gui.EvoGUI_settings = { hovered_graphical_set = button_graphics(16, 48), clicked_graphical_set = button_graphics(32, 48), } + +default_gui.EvoGUI_cramped_flow_v = { + type = "vertical_flow_style", + vertical_spacing = 1, + horizontal_spacing = 1, +} + +default_gui.EvoGUI_cramped_flow_h = { + type = "horizontal_flow_style", + vertical_spacing = 1, + horizontal_spacing = 1, +} diff --git a/settingsGUI.lua b/settingsGUI.lua index ddb493d..feb7631 100644 --- a/settingsGUI.lua +++ b/settingsGUI.lua @@ -110,11 +110,11 @@ function evogui.evoGUI_settings(event) name="core_settings", caption={"settings.core_settings.title"}, direction="vertical", - style="naked_frame_style"} + style="naked_frame"} local update_freq_flow = core_settings.add{type="flow", name="update_freq_flow", direction="horizontal"} update_freq_flow.add{type="label", caption={"settings.core_settings.update_freq_left"}} - local textfield = update_freq_flow.add{type="textfield", name="textfield", style="number_textfield_style"} + local textfield = update_freq_flow.add{type="textfield", name="textfield", style="number_textfield"} textfield.text=tostring(global.settings.update_delay) update_freq_flow.add{type="label", caption={"settings.core_settings.update_freq_right"}} @@ -122,9 +122,9 @@ function evogui.evoGUI_settings(event) name="sensors_frame", caption={"settings.sensors_frame.title"}, direction="vertical", - style="naked_frame_style"} + style="naked_frame"} - local table = sensors_frame.add{type="table", name="table", colspan=4} + local table = sensors_frame.add{type="table", name="table", column_count=4} for _, sensor in ipairs(evogui.value_sensors) do add_sensor_table_row(table, sensor, player_data.always_visible, player_data.in_popup) diff --git a/value_sensors/player_locations.lua b/value_sensors/player_locations.lua index 0cdab7f..fce306c 100644 --- a/value_sensors/player_locations.lua +++ b/value_sensors/player_locations.lua @@ -14,10 +14,10 @@ function sensor:create_ui(owner) local root = owner.add{type="flow", name=self.name, direction="horizontal", - style="description_flow_style"} + style="EvoGUI_cramped_flow_h"} root.add{type="label", caption={self.format_key}} - root.add{type="table", name="player_list", colspan=1} + root.add{type="table", name="player_list", column_count=1} end end