walls_deco.lua 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. local colbox_type1 = { --column
  2. type = "fixed",
  3. fixed = {{.1, -.5, .1, .5, 0, .5},} -- Right, Bottom, Back, Left, Top, Front
  4. }
  5. local colbox_type2 = { --wall
  6. type = "fixed",
  7. fixed = {{-.5, -.5, .4, .5, 0, .2},}
  8. }
  9. local block_type1 = { -- desc2, obj, colbox, grup,
  10. {"Deco Wall Scalloped", "wall_s", colbox_type2, {ml=1,cracky=2,not_in_creative_inventory=ml_visible}},
  11. {"Deco Wall Flat Top", "wall_f", colbox_type2, {ml=1,cracky=2,not_in_creative_inventory=ml_visible}},
  12. {'Deco Wall Peaked Top', 'wall_p', colbox_type2, {ml=1,cracky=2,not_in_creative_inventory=ml_visible}},
  13. {'Deco Wall Random Top', 'wall_r', colbox_type2, {ml=1,cracky=2,not_in_creative_inventory=ml_visible}},
  14. {"Deco Wall Column", "column", colbox_type1, {ml=1,cracky=2,not_in_creative_inventory=ml_visible}},
  15. }
  16. for i in ipairs (block_type1) do
  17. local desc2 = block_type1[i][1]
  18. local obj = block_type1[i][2]
  19. local colbox = block_type1[i][3]
  20. local grup = block_type1[i][4]
  21. local color_tab = {
  22. {'black', 'Black', '^[multiply:#2c2c2c'},
  23. {'blue', 'Blue', '^[multiply:#0041f4'},
  24. {'brown', 'Brown', '^[multiply:#6c3800'},
  25. {'cyan', 'Cyan', '^[multiply:cyan'},
  26. {'dark_green', 'Dark Green', '^[multiply:#2b7b00'},
  27. {'dark_grey', 'Dark Grey', '^[multiply:#464646'},
  28. {'green', 'Green', '^[multiply:#67eb1c'},
  29. {'grey', 'Grey', '^[multiply:#818181'},
  30. {'magenta', 'Magenta', '^[multiply:#d80481'},
  31. {'orange', 'Orange', '^[multiply:#e0601a'},
  32. {'pink', 'Pink', '^[multiply:#ffa5a5'},
  33. {'red', 'Red', '^[multiply:#c91818'},
  34. {'violet', 'Violet', '^[multiply:#480680'},
  35. {'white', 'White', '^[multiply:white'},
  36. {'yellow', 'Yellow', '^[multiply:#fcf611'},
  37. {'cement', 'Concrete', ''},
  38. }
  39. for i in ipairs (color_tab) do
  40. local col = color_tab[i][1]
  41. local coldesc = color_tab[i][2]
  42. local alpha = color_tab[i][3]
  43. minetest.register_node('mylandscaping:deco_'..obj..'_'..col, {
  44. description = desc2.." "..coldesc,
  45. drawtype = 'mesh',
  46. mesh = 'mylandscaping_deco_'..obj..'.obj',
  47. tiles = {{name='mylandscaping_block_split.png'..alpha}, {name='mylandscaping_block_smooth.png'..alpha}},
  48. groups = grup,
  49. paramtype = 'light',
  50. paramtype2 = 'facedir',
  51. selection_box = colbox,
  52. collision_box = colbox,
  53. sounds = default.node_sound_stone_defaults(),
  54. })
  55. minetest.register_node('mylandscaping:deco_column_light_'..col, {
  56. description = coldesc..'lighted column',
  57. drawtype = 'mesh',
  58. mesh = 'mylandscaping_deco_column_l.obj',
  59. tiles = {
  60. {name='mylandscaping_block_split.png'..alpha},
  61. {name='mylandscaping_block_smooth.png'..alpha},
  62. {name='mylandscaping_block_smooth.png^[colorize:yellow:255'},
  63. {name='mylandscaping_block_smooth.png^[colorize:#190B07:200'}},
  64. groups = grup,
  65. paramtype = 'light',
  66. paramtype2 = 'facedir',
  67. light_source = LIGHT_MAX,
  68. selection_box = colbox_type1,
  69. collision_box = colbox_type1,
  70. sounds = default.node_sound_stone_defaults(),
  71. })
  72. minetest.register_craft({
  73. type = 'shapeless',
  74. output = 'mylandscaping:deco_column_light_'..col,
  75. recipe = {'default:torch', 'mylandscaping:deco_column_'..col}
  76. })
  77. end
  78. end