Advertisement
Guest User

Untitled

a guest
Dec 13th, 2018
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. cabinets.put_data_into_cabinet = function (pos, cabinet_name, cabinet_num, data, formspec)
  2. local meta = minetest.get_meta(pos)
  3.  
  4. if type(data) == "table" and #data ~= 0 then
  5. meta:set_string(cabinet_name .. "_" .. cabinet_num, minetest.serialize(data))
  6. else
  7. return
  8. end
  9.  
  10. meta:set_string(formspec[name], minetest.serialize(formspec[data]))
  11. return true
  12. end
  13.  
  14. for cab, cab_boxes in pairs(kit_wood_cabs) do
  15. cabinet_num = cabinet_num + 1
  16. minetest.register_node("luxury_decor:"..cab, {
  17. description = "Kitchen Wooden Cabinet",
  18. visual_scale = 0.5,
  19. mesh = cab..".obj",
  20. tiles = {"wood_material.png"},
  21. paramtype = "light",
  22. paramtype2 = "facedir",
  23. groups = {choppy=3, not_in_creative_inventory = cab_boxes[not_in_creative_inventory]},
  24. drawtype = "mesh",
  25. collision_box = {
  26. type = "fixed",
  27. fixed = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}
  28. },
  29. selection_box = {
  30. type = "fixed",
  31. fixed = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}
  32. },
  33. sounds = default.node_sound_wood_defaults(),
  34. on_construct = function (pos)
  35. local img_button1 = "image_button[0.5, 0;1, 2;" .. cab_boxes[1].img_button ..";" .. cab_boxes[1].button .. "]"
  36. local img_button2 = "image_button[0.5, 0.3;1, 2;" .. cab_boxes[2].img_button .. ";" .. cab_boxes[2].button .. "]"
  37. local list1 = "list[nodemeta:".. pos.x .. "," .. pos.y .. "," .. pos.z .. ";".. cab_boxes[1].listname .. ";1.5, 0;4, 2]"
  38. local list2 = "list[nodemeta:".. pos.x .. "," .. pos.y .. "," .. pos.z .. ";".. cab_boxes[2].listname .. ";1.5, 0.3;4, 2]"
  39. form = "size[6,5]" .. img_button1 .. img_button2 .. list1 .. list2 .. "]"
  40. --minetest.debug(dump(cabinets))
  41. 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