Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cabinets.put_data_into_cabinet = function (pos, cabinet_name, cabinet_num, data, formspec)
- local meta = minetest.get_meta(pos)
- if type(data) == "table" and #data ~= 0 then
- meta:set_string(cabinet_name .. "_" .. cabinet_num, minetest.serialize(data))
- else
- return
- end
- meta:set_string(formspec[name], minetest.serialize(formspec[data]))
- return true
- end
- for cab, cab_boxes in pairs(kit_wood_cabs) do
- cabinet_num = cabinet_num + 1
- minetest.register_node("luxury_decor:"..cab, {
- description = "Kitchen Wooden Cabinet",
- visual_scale = 0.5,
- mesh = cab..".obj",
- tiles = {"wood_material.png"},
- paramtype = "light",
- paramtype2 = "facedir",
- groups = {choppy=3, not_in_creative_inventory = cab_boxes[not_in_creative_inventory]},
- drawtype = "mesh",
- collision_box = {
- type = "fixed",
- fixed = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}
- },
- selection_box = {
- type = "fixed",
- fixed = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}
- },
- sounds = default.node_sound_wood_defaults(),
- on_construct = function (pos)
- local img_button1 = "image_button[0.5, 0;1, 2;" .. cab_boxes[1].img_button ..";" .. cab_boxes[1].button .. "]"
- local img_button2 = "image_button[0.5, 0.3;1, 2;" .. cab_boxes[2].img_button .. ";" .. cab_boxes[2].button .. "]"
- local list1 = "list[nodemeta:".. pos.x .. "," .. pos.y .. "," .. pos.z .. ";".. cab_boxes[1].listname .. ";1.5, 0;4, 2]"
- local list2 = "list[nodemeta:".. pos.x .. "," .. pos.y .. "," .. pos.z .. ";".. cab_boxes[2].listname .. ";1.5, 0.3;4, 2]"
- form = "size[6,5]" .. img_button1 .. img_button2 .. list1 .. list2 .. "]"
- --minetest.debug(dump(cabinets))
- cabinets.put_data_into_cabinet(pos, "kitchen_wooden_cabinet", tostring(cabinet_num), cab_boxes, form)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement