forked from mtcontrib/homedecor_modpack
only set main list size if size field is given, to allow using the locked/lockable features with different listnames
This commit is contained in:
parent
088269a85e
commit
9773d63e8e
@ -5,7 +5,6 @@ local default_can_dig = function(pos,player)
|
||||
return meta:get_inventory():is_empty("main")
|
||||
end
|
||||
|
||||
local default_inventory_size = 32
|
||||
local background = default.gui_bg .. default.gui_bg_img .. default.gui_slots
|
||||
local default_inventory_formspecs = {
|
||||
["4"]="size[8,6]".. background ..
|
||||
@ -63,14 +62,16 @@ function homedecor.handle_inventory(name, def, original_def)
|
||||
if not inventory then return end
|
||||
def.inventory = nil
|
||||
|
||||
if inventory.size then
|
||||
local on_construct = def.on_construct
|
||||
def.on_construct = function(pos)
|
||||
local size = inventory.size or default_inventory_size
|
||||
local size = inventory.size
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:get_inventory():set_size("main", size)
|
||||
meta:set_string("formspec", inventory.formspec or get_formspec_by_size(size))
|
||||
if on_construct then on_construct(pos) end
|
||||
end
|
||||
end
|
||||
|
||||
def.can_dig = def.can_dig or default_can_dig
|
||||
def.on_metadata_inventory_move = def.on_metadata_inventory_move or function(pos, from_list, from_index, to_list, to_index, count, player)
|
||||
|
Loading…
Reference in New Issue
Block a user