walls_deco.lua 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. _doc_items_create_entry = false,
  45. description = desc2.." "..coldesc,
  46. drawtype = 'mesh',
  47. mesh = 'mylandscaping_deco_'..obj..'.obj',
  48. tiles = {{name='mylandscaping_block_split.png'..alpha}, {name='mylandscaping_block_smooth.png'..alpha}},
  49. groups = grup,
  50. paramtype = 'light',
  51. paramtype2 = 'facedir',
  52. selection_box = colbox,
  53. collision_box = colbox,
  54. sounds = default.node_sound_stone_defaults(),
  55. })
  56. minetest.register_node('mylandscaping:deco_column_light_'..col, {
  57. _doc_items_create_entry = false,
  58. description = coldesc..'lighted column',
  59. drawtype = 'mesh',
  60. mesh = 'mylandscaping_deco_column_l.obj',
  61. tiles = {
  62. {name='mylandscaping_block_split.png'..alpha},
  63. {name='mylandscaping_block_smooth.png'..alpha},
  64. {name='mylandscaping_block_smooth.png^[colorize:yellow:255'},
  65. {name='mylandscaping_block_smooth.png^[colorize:#190B07:200'}},
  66. groups = grup,
  67. paramtype = 'light',
  68. paramtype2 = 'facedir',
  69. light_source = LIGHT_MAX,
  70. selection_box = colbox_type1,
  71. collision_box = colbox_type1,
  72. sounds = default.node_sound_stone_defaults(),
  73. })
  74. minetest.register_craft({
  75. type = 'shapeless',
  76. output = 'mylandscaping:deco_column_light_'..col,
  77. recipe = {'default:torch', 'mylandscaping:deco_column_'..col}
  78. })
  79. end
  80. end