Skip to content

Commit

Permalink
now uses ItemPrototype.inventory_size
Browse files Browse the repository at this point in the history
  • Loading branch information
DaveMcW committed Sep 9, 2016
1 parent 6320d57 commit 9944b4a
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions control.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ local BlueprintString = require "blueprintstring.blueprintstring"
BlueprintString.COMPRESS_STRINGS = true
BlueprintString.LINE_LENGTH = 120

-- Total inventory slots for a blueprint book. How can I detect this at runtime?
local BOOK_MAX_SLOTS = 31

function init_gui(player)
if (not player.force.technologies["automated-construction"].researched) then
return
Expand Down Expand Up @@ -279,7 +276,7 @@ function load_blueprint(player)
return
end

local slots = math.min(page_count, BOOK_MAX_SLOTS)
local slots = math.min(page_count, game.item_prototypes["blueprint-book"].inventory_size + 1)
book = find_empty_book(player, slots)
if (not book) then
player.print({"no-empty-blueprint"})
Expand Down

0 comments on commit 9944b4a

Please sign in to comment.