diff --git a/README.md b/README.md index 4462274..62ce152 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,9 @@ This mod has strict error checking, so bad strings will not crash your game or m ####Changelog +Version 3.1.2 +- Fixed constant combinators from 0.12 blueprints + Version 3.1.1 - Toned down the 0.12.32 upgrade button diff --git a/blueprintstring/blueprintstring.lua b/blueprintstring/blueprintstring.lua index e520f63..4bc90be 100644 --- a/blueprintstring/blueprintstring.lua +++ b/blueprintstring/blueprintstring.lua @@ -87,6 +87,9 @@ function fix_entities(array) entity.control_behavior = {decider_conditions = entity.conditions.decider} end end + if (entity.name == "constant-combinator" and entity.filters) then + entity.control_behavior = {filters = entity.filters} + end -- Add entity number entity.entity_number = count diff --git a/control.lua b/control.lua index e2355f0..d74eb90 100644 --- a/control.lua +++ b/control.lua @@ -242,6 +242,8 @@ function load_blueprint(player) local blueprint = nil local book = nil + local active = nil + local main = nil if (not blueprint_format.book) then -- Blueprint if (holding_book(player)) then @@ -284,8 +286,8 @@ function load_blueprint(player) return end - local active = book.get_inventory(defines.inventory.item_active) - local main = book.get_inventory(defines.inventory.item_main) + active = book.get_inventory(defines.inventory.item_active) + main = book.get_inventory(defines.inventory.item_main) local advanced_circuits = slots - active.get_item_count("blueprint") - main.get_item_count("blueprint") if (advanced_circuits > player.get_item_count("advanced-circuit")) then @@ -327,6 +329,7 @@ function load_blueprint(player) textbox.text = "" + -- Blueprint if (not book) then local error = load_blueprint_data(blueprint, blueprint_format) if (error) then @@ -335,22 +338,21 @@ function load_blueprint(player) return end - for i, page in pairs(blueprint_format.book) do - local active = book.get_inventory(defines.inventory.item_active) - local main = book.get_inventory(defines.inventory.item_main) - local error - if (i == 1) then - error = load_blueprint_data(active[1], page) - else - if (i - 1 > #main) then - break - end - error = load_blueprint_data(main[i-1], page) - end + -- Blueprint Book + if (blueprint_format.book[1]) then + local error = load_blueprint_data(active[1], blueprint_format.book[1]) if (error and error[1] ~= "unknown-format") then player.print(error) end end + for i = 1, #main do + if (blueprint_format.book[i+1]) then + local error = load_blueprint_data(main[i], blueprint_format.book[i+1]) + if (error and error[1] ~= "unknown-format") then + player.print(error) + end + end + end book.label = blueprint_format.name or "" end diff --git a/info.json b/info.json index 868ccb2..22fb2a4 100644 --- a/info.json +++ b/info.json @@ -1,6 +1,6 @@ { "name": "blueprint-string", - "version": "3.1.1", + "version": "3.1.2", "title": "Blueprint String", "author": "DaveMcW", "description": "Converts text strings into blueprints", diff --git a/locale/en/blueprint-string.cfg b/locale/en/blueprint-string.cfg index ab8fdce..f589805 100644 --- a/locale/en/blueprint-string.cfg +++ b/locale/en/blueprint-string.cfg @@ -1,3 +1,4 @@ +main-button=Blueprint save=Save save-as=Save as: cancel=Cancel