init.lua 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. local cbox = {
  2. type = "fixed",
  3. fixed = {
  4. {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
  5. }
  6. }
  7. local piri = {
  8. {"Side 1","1","1"},
  9. {"Side 2","2","1"},
  10. {"Side 3","3","1"},
  11. {"Side 4","4","1"},
  12. {"Side 5","5","1"},
  13. {"Side 6","6","1"},
  14. }
  15. for i in ipairs(piri) do
  16. local des = piri[i][1]
  17. local num = piri[i][2]
  18. local nic = piri[i][3]
  19. minetest.register_node("mypirinola:piri_"..num, {
  20. description = "Pirinola "..des,
  21. drawtype = "mesh",
  22. mesh = "mypirinola_oct.obj",
  23. tiles = {"mypirinola_img_"..num..".png"},
  24. paramtype = "light",
  25. paramtype2 = "facedir",
  26. drop = "mypirinola:piri_spin",
  27. groups = {choppy=2, dig_immediate=3, not_in_creative_inventory=nic},
  28. --sounds = default.node_sound_wood_defaults(),
  29. --on_place = minetest.rotate_node,
  30. collision_box = cbox,
  31. selection_box = cbox,
  32. })
  33. end
  34. minetest.register_node("mypirinola:piri_spin", {
  35. description = "Pirinola",
  36. inventory_image = "mypirinola_inv.png",
  37. wield_image = "mypirinola_inv.png",
  38. drawtype = "mesh",
  39. mesh = "mypirinola_oct.obj",
  40. tiles = {
  41. {name="mypirinola_img_ani.png", animation={type="vertical_frames",aspect_w=16, aspect_h=16, length=0.2}}
  42. },
  43. paramtype = "light",
  44. paramtype2 = "facedir",
  45. groups = {choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=0},
  46. --sounds = default.node_sound_wood_defaults(),
  47. collision_box = cbox,
  48. selection_box = cbox,
  49. after_place_node = function(pos, placer, itemstack, pointed_thing)
  50. local ran = math.random(1,6)
  51. local parn = {5,7,9,11,12,14,16,18}
  52. local par2 = parn[ math.random( #parn ) ]
  53. minetest.after(3, function()
  54. minetest.set_node(pos,{name="mypirinola:piri_"..ran, param2=par2})
  55. end)
  56. end,
  57. })