init.lua 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. minetest.register_node("myconnect4:front",{
  2. description = "front",
  3. tiles = {"default_sand.png"},
  4. drawtype = "nodebox",
  5. paramtype = "light",
  6. paramtype2 = "facedir",
  7. groups = {cracky=1,not_in_creative_inventory=1},
  8. node_box = {
  9. type = "fixed",
  10. fixed = {
  11. {-0.5, -0.5, 0.375, 0.5, -0.375, 0.5},
  12. {-0.5, 0.375, 0.375, 0.5, 0.5, 0.5},
  13. {0.375, -0.5, 0.375, 0.5, 0.5, 0.5},
  14. {-0.5, -0.5, 0.375, -0.375, 0.5, 0.5},
  15. {-0.5, 0.25, 0.375, -0.25, 0.5, 0.5},
  16. {-0.5, -0.5, 0.375, -0.25, -0.25, 0.5},
  17. {0.25, 0.25, 0.375, 0.5, 0.5, 0.5},
  18. {0.25, -0.5, 0.375, 0.5, -0.25, 0.5},
  19. }
  20. },
  21. selection_box = {
  22. type = "fixed",
  23. fixed = {
  24. {0.5, 0.5, 0.5, 0.5, 0.5, 0.5},
  25. }
  26. },
  27. })
  28. minetest.register_node("myconnect4:red",{
  29. description = "Red",
  30. tiles = {"myconnect4_red.png"},
  31. drawtype = "nodebox",
  32. paramtype = "light",
  33. paramtype2 = "facedir",
  34. groups = {cracky=3,dig_immediate=3,falling_node=1,not_in_creative_inventory=1},
  35. node_box = {
  36. type = "fixed",
  37. fixed = {
  38. {-0.375, -0.5, -0.3125, 0.375, 0.5, -0.5},
  39. {-0.5, -0.375, -0.3125, 0.5, 0.375, -0.5},
  40. }
  41. }
  42. })
  43. minetest.register_node("myconnect4:black",{
  44. description = "Black",
  45. tiles = {"myconnect4_black.png"},
  46. drawtype = "nodebox",
  47. paramtype = "light",
  48. paramtype2 = "facedir",
  49. groups = {cracky=3,dig_immediate=3,falling_node=1,not_in_creative_inventory=1},
  50. node_box = {
  51. type = "fixed",
  52. fixed = {
  53. {-0.375, -0.5, -0.3125, 0.375, 0.5, -0.5},
  54. {-0.5, -0.375, -0.3125, 0.5, 0.375, -0.5},
  55. }
  56. }
  57. })
  58. minetest.register_node("myconnect4:redrf",{
  59. description = "redrf",
  60. tiles = {"myconnect4_red.png"},
  61. drawtype = "nodebox",
  62. paramtype = "light",
  63. paramtype2 = "facedir",
  64. drop = "myconnect4:red",
  65. groups = {cracky=3,dig_immediate=3,falling_node=1,not_in_creative_inventory=1},
  66. node_box = {
  67. type = "fixed",
  68. fixed = {
  69. {-0.375, -0.5, -0.3125, 0.375, 0.5, -0.5},
  70. {-0.5, -0.375, -0.3125, 0.5, 0.375, -0.5},
  71. }
  72. },
  73. after_destruct = function(pos, oldnode)
  74. minetest.set_node(pos,{name="myconnect4:redrf",param2=oldnode.param2})
  75. end
  76. })
  77. minetest.register_node("myconnect4:blackrf",{
  78. description = "blackrf",
  79. tiles = {"myconnect4_black.png"},
  80. drawtype = "nodebox",
  81. paramtype = "light",
  82. paramtype2 = "facedir",
  83. drop = "myconnect4:black",
  84. groups = {cracky=3,dig_immediate=3,falling_node=1,not_in_creative_inventory=1},
  85. node_box = {
  86. type = "fixed",
  87. fixed = {
  88. {-0.375, -0.5, -0.3125, 0.375, 0.5, -0.5},
  89. {-0.5, -0.375, -0.3125, 0.5, 0.375, -0.5},
  90. }
  91. },
  92. after_destruct = function(pos, oldnode)
  93. minetest.set_node(pos,{name="myconnect4:blackrf",param2=oldnode.param2})
  94. end
  95. })
  96. minetest.register_node("myconnect4:back",{
  97. description = "back",
  98. tiles = {"wool_grey.png"},
  99. drawtype = "nodebox",
  100. paramtype = "light",
  101. paramtype2 = "facedir",
  102. groups = {cracky=1,falling_node=1,not_in_creative_inventory=1},
  103. node_box = {
  104. type = "fixed",
  105. fixed = {
  106. {-1.125, -0.5, -0.5, 0.5, 0.5, 0.5},
  107. }
  108. },
  109. collision_box = {
  110. type = "fixed",
  111. fixed = {
  112. {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
  113. }
  114. },
  115. })
  116. minetest.register_node("myconnect4:reset",{
  117. description = "Connect 4",
  118. inventory_image = "myconnect4_inv.png",
  119. wield_image = "myconnect4_inv.png",
  120. tiles = {"default_sandstone.png^myconnect4_reset.png"},
  121. drawtype = "normal",
  122. paramtype = "light",
  123. paramtype2 = "facedir",
  124. groups = {cracky=1},
  125. on_rightclick = function(pos, node, player, itemstack, pointed_thing)
  126. local schem = minetest.get_modpath("myconnect4").."/schems/myconnect4.mts"
  127. minetest.place_schematic({x=pos.x,y=pos.y,z=pos.z},schem,0, "air", true)
  128. end,
  129. after_place_node = function(pos, placer, itemstack, pointed_thing)
  130. if placer and minetest.check_player_privs(placer:get_player_name(), {myboardgames = true}) then
  131. else
  132. minetest.remove_node(pos)
  133. return true
  134. end
  135. end,
  136. })