From 9d8443c9b2f0699fb4b58fe04a742f83724c99c9 Mon Sep 17 00:00:00 2001 From: Wyrrrd Date: Tue, 7 Sep 2021 11:02:31 +0200 Subject: [PATCH] moved workaround in code moved to only trigger if blueprint contains displays with sprites, fixes "attempt to index local" crash as well --- changelog.txt | 5 +++++ control.lua | 13 +++++++------ info.json | 2 +- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/changelog.txt b/changelog.txt index 7da5338..b519731 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,9 @@ --------------------------------------------------------------------------------------------------- +Version: 1.1.4 +Date: 2021-09-07 + Bugfixes: + - fixed crash and unwanted behaviour introduced with last release +--------------------------------------------------------------------------------------------------- Version: 1.1.3 Date: 2021-09-06 Bugfixes: diff --git a/control.lua b/control.lua index 0f29933..e985ed5 100644 --- a/control.lua +++ b/control.lua @@ -553,16 +553,17 @@ script.on_event(defines.events.on_player_setup_blueprint, function (event) 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) if stype and sname then + + -- Workaround for blueprint update bug + if blueprint.get_blueprint_entity_count() == 0 then + player.print({"display-plates.blueprint-wont-have-icons"}) + return + end + blueprint.set_blueprint_entity_tag(index, "display-plate-sprite-type", stype) blueprint.set_blueprint_entity_tag(index, "display-plate-sprite-name", sname) blueprint.set_blueprint_entity_tag(index, "display-plate-sprite-map-marker", get_has_map_marker(entity)) diff --git a/info.json b/info.json index 41177b6..c8795f2 100644 --- a/info.json +++ b/info.json @@ -1,6 +1,6 @@ { "name": "IndustrialDisplayPlates", - "version": "1.1.3", + "version": "1.1.4", "title": "Industrial Display Plates", "author": "Wyrrrd", "homepage": "https://github.com/Wyrrrd/IndustrialDisplayPlates",