diff --git a/mods_2.0/052_show-missing-bottles-for-current-research/changelog.txt b/mods_2.0/052_show-missing-bottles-for-current-research/changelog.txt index 834525fe..762847dd 100644 --- a/mods_2.0/052_show-missing-bottles-for-current-research/changelog.txt +++ b/mods_2.0/052_show-missing-bottles-for-current-research/changelog.txt @@ -1,8 +1,9 @@ --------------------------------------------------------------------------------------------------- Version: 2.0.1 -Date: ???? +Date: 2025. 01. 21 Info: - ' => " + - Bodge to move it when toggling remote view --------------------------------------------------------------------------------------------------- Version: 2.0.0 Date: 2025. 01. 10 diff --git a/mods_2.0/052_show-missing-bottles-for-current-research/control.lua b/mods_2.0/052_show-missing-bottles-for-current-research/control.lua index 7f319d0b..21ab52c2 100644 --- a/mods_2.0/052_show-missing-bottles-for-current-research/control.lua +++ b/mods_2.0/052_show-missing-bottles-for-current-research/control.lua @@ -1,10 +1,22 @@ local util = require("util") +local Flasks = {} + +Flasks.frame_name = "show_missing_bottles_for_current_research_frame" +Flasks.window_name = "show_missing_bottles_for_current_research_window" +Flasks.label_name = "show_missing_bottles_for_current_research_label" + local function on_configuration_changed(event) storage.lab_inputs = {} for _, entity_prototype in pairs(prototypes.get_entity_filtered({{filter = "type", type = "lab"}})) do storage.lab_inputs[entity_prototype.name] = util.list_to_map(entity_prototype.lab_inputs) end + + for _, player in pairs(game.players) do + if player.gui.screen[Flasks.frame_name] then + player.gui.screen[Flasks.frame_name].destroy() + end + end end script.on_configuration_changed(on_configuration_changed) @@ -42,12 +54,6 @@ for _, event in ipairs({ }) end -local Flasks = {} - -Flasks.frame_name = "show_missing_bottles_for_current_research_frame" -Flasks.window_name = "show_missing_bottles_for_current_research_window" -Flasks.label_name = "show_missing_bottles_for_current_research_label" - function Flasks.update_player(player, caption) if script.level.is_simulation then return end @@ -60,10 +66,6 @@ function Flasks.update_player(player, caption) direction = "horizontal", ignored_by_interaction = true, }) - else - -- canceling a research causes the "press T to start a new research" to come ontop layer-wise, - -- so to bodge that we'll just bring the frame to front when there's ever no pending research. - frame.bring_to_front() end local window = frame[Flasks.window_name] @@ -80,6 +82,14 @@ function Flasks.update_player(player, caption) window.style.top_padding = 46 end + if player.controller_type == defines.controllers.remote then + window.style.top_padding = 46 + 40 + window.style.right_margin = 12 + else + window.style.top_padding = 46 + window.style.right_margin = 0 + end + local label = window[Flasks.label_name] if not label or not label.valid then label = window.add({ @@ -187,6 +197,7 @@ end script.on_event(defines.events.on_player_display_resolution_changed, Flasks.resize_player) script.on_event(defines.events.on_player_display_scale_changed, Flasks.resize_player) +script.on_event(defines.events.on_player_controller_changed, on_active_research_changed) for _, event in ipairs({ defines.events.on_research_cancelled, diff --git a/mods_2.0/052_show-missing-bottles-for-current-research/info.json b/mods_2.0/052_show-missing-bottles-for-current-research/info.json index 53bf5fbb..73a9e2ee 100644 --- a/mods_2.0/052_show-missing-bottles-for-current-research/info.json +++ b/mods_2.0/052_show-missing-bottles-for-current-research/info.json @@ -2,7 +2,7 @@ "name": "show-missing-bottles-for-current-research", "title": "Show missing bottles for current research", "description": "Research-kun why are you stuck?", - "version": "2.0.0", + "version": "2.0.1", "author": "Quezler", "factorio_version": "2.0", "dependencies": [