Skip to content

Commit

Permalink
Fixed constant combinators from 0.12 blueprints
Browse files Browse the repository at this point in the history
  • Loading branch information
DaveMcW committed Aug 7, 2016
1 parent c3afdfd commit 323c997
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 15 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions blueprintstring/blueprintstring.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 16 additions & 14 deletions control.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion info.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
1 change: 1 addition & 0 deletions locale/en/blueprint-string.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
main-button=Blueprint
save=Save
save-as=Save as:
cancel=Cancel
Expand Down

0 comments on commit 323c997

Please sign in to comment.