init.lua 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. -- Baked Clay by TenPlus1
  2. -- Modified for "Must Test" server by MustTest
  3. -- Note: must match the colors defined by the 'dye' mod.
  4. local clay = {
  5. {"white", "White"},
  6. {"grey", "Grey"},
  7. {"black", "Black"},
  8. {"red", "Red"},
  9. {"yellow", "Yellow"},
  10. {"green", "Green"},
  11. {"cyan", "Cyan"},
  12. {"blue", "Blue"},
  13. {"magenta", "Magenta"},
  14. {"orange", "Orange"},
  15. {"violet", "Violet"},
  16. {"brown", "Brown"},
  17. {"pink", "Pink"},
  18. {"dark_grey", "Dark Grey"},
  19. {"dark_green", "Dark Green"},
  20. }
  21. -- Register "natural" baked clay.
  22. do
  23. local v = {"natural", "Natural"}
  24. minetest.register_node("bakedclay:" .. v[1], {
  25. description = v[2] .. " Baked Clay",
  26. tiles = {"baked_clay_" .. v[1] ..".png"},
  27. groups = utility.dig_groups("hardclay", {bakedclay = 1}),
  28. sounds = default.node_sound_stone_defaults(),
  29. })
  30. stairs.register_stair_and_slab(
  31. "bakedclay_".. v[1],
  32. "bakedclay:".. v[1],
  33. utility.dig_groups("hardclay"),
  34. {"baked_clay_" .. v[1] .. ".png"},
  35. v[2] .. " Baked Clay",
  36. default.node_sound_stone_defaults()
  37. )
  38. end
  39. for _, clay in ipairs(clay) do
  40. -- node definition
  41. minetest.register_node("bakedclay:" .. clay[1], {
  42. description = clay[2] .. " Baked Clay",
  43. tiles = {"baked_clay_" .. clay[1] ..".png"},
  44. groups = utility.dig_groups("hardclay", {bakedclay = 1}),
  45. sounds = default.node_sound_stone_defaults(),
  46. })
  47. -- craft from dye and natural baked clay
  48. minetest.register_craft({
  49. type = "shapeless",
  50. output = "bakedclay:" .. clay[1],
  51. recipe = {"bakedclay:natural", "dye:" .. clay[1]},
  52. })
  53. -- register stair and slab
  54. stairs.register_stair_and_slab(
  55. "bakedclay_".. clay[1],
  56. "bakedclay:".. clay[1],
  57. utility.dig_groups("hardclay"),
  58. {"baked_clay_" .. clay[1] .. ".png"},
  59. clay[2] .. " Baked Clay",
  60. default.node_sound_stone_defaults()
  61. )
  62. end
  63. -- Terracotta blocks (textures by D3monPixel, thanks for use :)
  64. for k, v in ipairs(clay) do
  65. local texture = "baked_clay_terracotta_" .. v[1] ..".png"
  66. minetest.register_node("bakedclay:terracotta_" .. v[1], {
  67. description = v[2] .. " Glazed Terracotta",
  68. tiles = {
  69. texture .. "",
  70. texture .. "",
  71. texture .. "^[transformR180",
  72. texture .. "",
  73. texture .. "^[transformR270",
  74. texture .. "^[transformR90",
  75. },
  76. paramtype2 = "facedir",
  77. groups = utility.dig_groups("hardclay", {terracotta = 1}),
  78. sounds = default.node_sound_stone_defaults(),
  79. on_place = minetest.rotate_node,
  80. })
  81. minetest.register_craft({
  82. type = "cooking",
  83. output = "bakedclay:terracotta_" .. v[1],
  84. recipe = "bakedclay:" .. v[1],
  85. cooktime = 10,
  86. })
  87. stairs.register_stair_and_slab(
  88. "bakedclay_terracotta_".. v[1],
  89. "bakedclay:terracotta_".. v[1],
  90. utility.dig_groups("hardclay"),
  91. {"baked_clay_terracotta_" .. v[1] .. ".png"},
  92. v[2] .. " Baked Clay",
  93. default.node_sound_stone_defaults()
  94. )
  95. end
  96. -- Need to handle "light_blue" specifically because not present in clay list.
  97. do
  98. local v = {"light_blue", "Light Blue"}
  99. local texture = "baked_clay_terracotta_" .. v[1] ..".png"
  100. minetest.register_node("bakedclay:terracotta_" .. v[1], {
  101. description = v[2] .. " Glazed Terracotta",
  102. tiles = {
  103. texture .. "",
  104. texture .. "",
  105. texture .. "^[transformR180",
  106. texture .. "",
  107. texture .. "^[transformR270",
  108. texture .. "^[transformR90",
  109. },
  110. paramtype2 = "facedir",
  111. groups = utility.dig_groups("hardclay", {terracotta = 1}),
  112. sounds = default.node_sound_stone_defaults(),
  113. on_place = minetest.rotate_node,
  114. })
  115. minetest.register_craft({
  116. type = "cooking",
  117. output = "bakedclay:terracotta_" .. v[1],
  118. recipe = "bakedclay:terracotta_cyan",
  119. cooktime = 10,
  120. })
  121. stairs.register_stair_and_slab(
  122. "bakedclay_terracotta_".. v[1],
  123. "bakedclay:terracotta_".. v[1],
  124. utility.dig_groups("hardclay"),
  125. {"baked_clay_terracotta_" .. v[1] .. ".png"},
  126. v[2] .. " Baked Clay",
  127. default.node_sound_stone_defaults()
  128. )
  129. end
  130. -- cook clay block into natural baked clay
  131. minetest.register_craft({
  132. type = "cooking",
  133. output = "bakedclay:natural",
  134. recipe = "default:clay",
  135. cooktime = 10,
  136. })
  137. -- register a few extra dye colour options
  138. minetest.register_craft( {
  139. type = "shapeless",
  140. output = "dye:dark_grey 3",
  141. recipe = {"dye:black", "dye:black", "dye:white"}
  142. })
  143. minetest.register_craft( {
  144. type = "shapeless",
  145. output = "dye:grey 3",
  146. recipe = {"dye:black", "dye:white", "dye:white"}
  147. })
  148. minetest.register_craft( {
  149. type = "extracting",
  150. output = "dye:brown 4",
  151. recipe = "default:dry_shrub"
  152. })
  153. minetest.register_craft( {
  154. type = "extracting",
  155. output = "dye:brown 4",
  156. recipe = "default:dry_shrub2"
  157. })
  158. -- 2x2 red bakedclay makes 16x clay brick
  159. minetest.register_craft( {
  160. output = "default:clay_brick 16",
  161. recipe = {
  162. {"bakedclay:red", "bakedclay:red"},
  163. {"bakedclay:red", "bakedclay:red"},
  164. }
  165. })
  166. -- register some new flowers to fill in missing dye colours
  167. -- flower registration (borrowed from default game)
  168. local function add_simple_flower(name, desc, box, f_groups)
  169. f_groups.flower = 1
  170. f_groups.flora = 1
  171. f_groups.attached_node = 1
  172. f_groups.flammable = 3,
  173. minetest.register_node(":flowers:" .. name, {
  174. description = desc,
  175. drawtype = "plantlike",
  176. waving = 1,
  177. tiles = {"baked_clay_" .. name .. ".png"},
  178. inventory_image = "baked_clay_" .. name .. ".png",
  179. wield_image = "baked_clay_" .. name .. ".png",
  180. sunlight_propagates = true,
  181. paramtype = "light",
  182. walkable = false,
  183. buildable_to = true,
  184. groups = utility.dig_groups("plant", f_groups),
  185. sounds = default.node_sound_leaves_defaults(),
  186. selection_box = {
  187. type = "fixed",
  188. fixed = box
  189. },
  190. movement_speed_multiplier = default.SLOW_SPEED_PLANTS,
  191. on_construct = function(...)
  192. return flowers.on_flora_construct(...)
  193. end,
  194. on_destruct = function(...)
  195. return flowers.on_flora_destruct(...)
  196. end,
  197. on_timer = function(...)
  198. return flowers.on_flora_timer(...)
  199. end,
  200. on_punch = function(...)
  201. return flowers.on_flora_punch(...)
  202. end,
  203. })
  204. end
  205. local flowers = {
  206. {"delphinium", "Blue Delphinium",
  207. {-5 / 16, -0.5, -5 / 16, 5 / 16, 5 / 16, 5 / 16},
  208. {color_cyan = 1}},
  209. {"thistle", "Thistle",
  210. {-0.15, -0.5, -0.15, 0.15, 0.2, 0.15},
  211. {color_magenta = 1}},
  212. {"lazarus", "Lazarus Bell",
  213. {-0.15, -0.5, -0.15, 0.15, 0.2, 0.15},
  214. {color_pink = 1}},
  215. {"mannagrass", "Reed Mannagrass",
  216. {-5 / 16, -0.5, -5 / 16, 5 / 16, 5 / 16, 5 / 16},
  217. {color_dark_green = 1}},
  218. {"lockspur", "Lockspur",
  219. {-0.15, -0.5, -0.15, 0.15, 0.3, 0.15},
  220. {color_cyan = 1}},
  221. }
  222. for _,item in pairs(flowers) do
  223. add_simple_flower(unpack(item))
  224. end
  225. minetest.register_craft({
  226. type = "extracting",
  227. output = 'dye:cyan 5',
  228. recipe = 'flowers:delphinium',
  229. time = 3,
  230. })
  231. minetest.register_craft({
  232. type = "extracting",
  233. output = 'dye:cyan 5',
  234. recipe = 'flowers:lockspur',
  235. time = 3,
  236. })
  237. minetest.register_craft({
  238. type = "extracting",
  239. output = 'dye:magenta 5',
  240. recipe = 'flowers:thistle',
  241. time = 3,
  242. })
  243. minetest.register_craft({
  244. type = "extracting",
  245. output = 'dye:pink 5',
  246. recipe = 'flowers:lazarus',
  247. time = 3,
  248. })
  249. minetest.register_craft({
  250. type = "extracting",
  251. output = 'dye:dark_green 5',
  252. recipe = 'flowers:mannagrass',
  253. time = 3,
  254. })
  255. minetest.register_craft({
  256. type = "shapeless",
  257. output = "default:clay_lump",
  258. recipe = {"darkage:silt_lump", "darkage:mud_lump"},
  259. })