From bf22a80ca9ca5f98bffbe9d6bb7b6ce115c1919f Mon Sep 17 00:00:00 2001 From: Wyrrrd Date: Mon, 6 Sep 2021 10:35:15 +0200 Subject: [PATCH] Workaround for blueprint update bug thanks to Honktown for the help --- changelog.txt | 5 +++++ control.lua | 7 +++++++ info.json | 2 +- locale/de/strings.cfg | 3 +++ locale/en/strings.cfg | 3 +++ locale/fr/strings.cfg | 3 +++ 6 files changed, 22 insertions(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index 782dd1a..7da5338 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,9 @@ --------------------------------------------------------------------------------------------------- +Version: 1.1.3 +Date: 2021-09-06 + Bugfixes: + - Implemented controlled error message for blueprint update bug in factorio to avoid crash +--------------------------------------------------------------------------------------------------- Version: 1.1.2 Date: 2021-08-21 Changes: diff --git a/control.lua b/control.lua index 0818d71..0f29933 100644 --- a/control.lua +++ b/control.lua @@ -552,6 +552,13 @@ script.on_event(defines.events.on_player_setup_blueprint, function (event) local blueprint = nil if player and player.blueprint_to_setup and player.blueprint_to_setup.valid_for_read then blueprint = player.blueprint_to_setup elseif player and player.cursor_stack.valid_for_read and player.cursor_stack.name == "blueprint" then blueprint = player.cursor_stack end + + -- Workaround for blueprint update bug + if blueprint.get_blueprint_entity_count() == 0 then + player.print({"display-plates.blueprint-wont-have-icons"}) + return + end + if blueprint then for index,entity in pairs(event.mapping.get()) do local stype,sname = get_render_sprite_info(entity) diff --git a/info.json b/info.json index b3a0815..41177b6 100644 --- a/info.json +++ b/info.json @@ -1,6 +1,6 @@ { "name": "IndustrialDisplayPlates", - "version": "1.1.2", + "version": "1.1.3", "title": "Industrial Display Plates", "author": "Wyrrrd", "homepage": "https://github.com/Wyrrrd/IndustrialDisplayPlates", diff --git a/locale/de/strings.cfg b/locale/de/strings.cfg index 697cb4b..b2fab0c 100644 --- a/locale/de/strings.cfg +++ b/locale/de/strings.cfg @@ -1,3 +1,6 @@ +[display-plates] +blueprint-wont-have-icons=Dieser aktualisierte Blaupause wird keine Symbole oder Kartenmarkierungen der Anzeigeplatten enthalten. Um diese hinzuzufügen, erstelle eine neue Blaupause. + [entity-name] copper-display=Kupferanzeigeplatte (groß) iron-display=Eisenanzeigeplatte (groß) diff --git a/locale/en/strings.cfg b/locale/en/strings.cfg index e524c0a..cfec795 100644 --- a/locale/en/strings.cfg +++ b/locale/en/strings.cfg @@ -1,3 +1,6 @@ +[display-plates] +blueprint-wont-have-icons=This updated blueprint will not contain any icons or map markers of the display plates. To include them, create a new blueprint. + [entity-name] copper-display=Copper display plate (large) iron-display=Iron display plate (large) diff --git a/locale/fr/strings.cfg b/locale/fr/strings.cfg index e2b2965..f724994 100644 --- a/locale/fr/strings.cfg +++ b/locale/fr/strings.cfg @@ -1,3 +1,6 @@ +[display-plates] +blueprint-wont-have-icons=UNLOCALIZED ERROR + [entity-name] copper-display=Panneau d'affichage en Cuivre (Grand) iron-display=Panneau d'affichage en Fer (Grand)