z_mirror/BlueprintTools

git clone https://git.raiguard.me/z_mirror/BlueprintTools

raiguardButtons show/hide logicdb88a13

clipboards
513 B15 linesraw
1local util = {}
2
3-- get blueprint from cursor stack (if there is one)
4function util.get_blueprint(item_stack)
5  if not (item_stack and item_stack.valid_for_read) then return end
6  if item_stack.is_blueprint then
7    return item_stack
8  elseif item_stack.is_blueprint_book and item_stack.active_index then
9    local inventory = item_stack.get_inventory(defines.inventory.item_main)
10    if inventory.is_empty() then return end
11    return util.get_blueprint(inventory[item_stack.active_index])
12  end
13end
14
15return util