concrete.lua 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. local S = minetest.get_translator("decoblocks")
  2. local function register_concrete(name, desc)
  3. name = "concrete_" .. name
  4. desc = S(desc)
  5. minetest.register_node("decoblocks:" .. name, {
  6. description = desc,
  7. tiles = {
  8. "decoblocks_" .. name .. ".png",
  9. },
  10. groups = {cracky = 3},
  11. sounds = default.node_sound_stone_defaults()
  12. })
  13. minetest.register_node("decoblocks:" .. name .. "_slab", {
  14. description = desc .. " " .. S("(slab)"),
  15. drawtype = "nodebox",
  16. paramtype = "light",
  17. paramtype2 = "facedir",
  18. tiles = {
  19. "decoblocks_" .. name .. ".png",
  20. },
  21. node_box = {
  22. type = "fixed",
  23. fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5}
  24. },
  25. groups = {cracky = 3},
  26. sounds = default.node_sound_stone_defaults(),
  27. on_place = function(itemstack, placer, pointed_thing)
  28. decoblocks.place_and_rotate(itemstack, placer, pointed_thing)
  29. end,
  30. })
  31. minetest.register_node("decoblocks:" .. name .. "_stair", {
  32. description = desc .. " " .. S("(stair)"),
  33. drawtype = "nodebox",
  34. paramtype = "light",
  35. paramtype2 = "facedir",
  36. tiles = {
  37. "decoblocks_" .. name .. ".png",
  38. },
  39. node_box = {
  40. type = "fixed",
  41. fixed = {
  42. {-0.5, -0.5, -0.5, 0.5, 0.0, 0.5},
  43. {-0.5, 0.0, 0.0, 0.5, 0.5, 0.5},
  44. },
  45. },
  46. groups = {cracky = 3},
  47. sounds = default.node_sound_stone_defaults(),
  48. on_place = function(itemstack, placer, pointed_thing)
  49. if pointed_thing.type ~= "node" then
  50. return itemstack
  51. end
  52. return decoblocks.place_and_rotate(itemstack, placer, pointed_thing)
  53. end,
  54. })
  55. minetest.register_alias(name, "decoblocks:" .. name)
  56. minetest.register_alias(name .. "_slab", "decoblocks:" .. name .. "_slab")
  57. minetest.register_alias(name .. "_stair", "decoblocks:" .. name .. "_stair")
  58. end
  59. register_concrete("blue", "Blue concrete")
  60. register_concrete("red", "Red concrete")
  61. register_concrete("grey", "Grey concrete")
  62. register_concrete("light_grey", "Light grey concrete")
  63. register_concrete("dark_grey", "Dark grey concrete")
  64. register_concrete("black", "Black concrete")