init.lua 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. -- Baked Clay by TenPlus1
  2. local clay = {
  3. {"natural", "Natural"},
  4. {"white", "White"},
  5. {"grey", "Grey"},
  6. {"black", "Black"},
  7. {"red", "Red"},
  8. {"yellow", "Yellow"},
  9. {"green", "Green"},
  10. {"cyan", "Cyan"},
  11. {"blue", "Blue"},
  12. {"magenta", "Magenta"},
  13. {"orange", "Orange"},
  14. {"violet", "Violet"},
  15. {"brown", "Brown"},
  16. {"pink", "Pink"},
  17. {"dark_grey", "Dark Grey"},
  18. {"dark_green", "Dark Green"},
  19. }
  20. local techcnc_mod = minetest.get_modpath("technic_cnc")
  21. local stairs_mod = minetest.get_modpath("stairs")
  22. local stairsplus_mod = minetest.get_modpath("moreblocks")
  23. and minetest.global_exists("stairsplus")
  24. for _, clay in pairs(clay) do
  25. -- node definition
  26. minetest.register_node("bakedclay:" .. clay[1], {
  27. description = clay[2] .. " Baked Clay",
  28. tiles = {"baked_clay_" .. clay[1] ..".png"},
  29. groups = {cracky = 3, bakedclay = 1},
  30. sounds = default.node_sound_stone_defaults(),
  31. })
  32. -- craft from dye and any baked clay
  33. if clay[1] ~= "natural" then
  34. minetest.register_craft({
  35. output = "bakedclay:" .. clay[1] .. " 8",
  36. recipe = {
  37. {"group:bakedclay", "group:bakedclay", "group:bakedclay"},
  38. {"group:bakedclay", "dye:" .. clay[1], "group:bakedclay"},
  39. {"group:bakedclay", "group:bakedclay", "group:bakedclay"}
  40. },
  41. })
  42. end
  43. -- register stairsplus stairs if found
  44. if stairsplus_mod then
  45. stairsplus:register_all("bakedclay", "baked_clay_" .. clay[1], "bakedclay:" .. clay[1], {
  46. description = clay[2] .. " Baked Clay",
  47. tiles = {"baked_clay_" .. clay[1] .. ".png"},
  48. groups = {cracky = 3},
  49. sounds = default.node_sound_stone_defaults(),
  50. })
  51. stairsplus:register_alias_all("bakedclay", clay[1], "bakedclay", "baked_clay_" .. clay[1])
  52. minetest.register_alias("stairs:slab_bakedclay_".. clay[1], "bakedclay:slab_baked_clay_" .. clay[1])
  53. minetest.register_alias("stairs:stair_bakedclay_".. clay[1], "bakedclay:stair_baked_clay_" .. clay[1])
  54. -- register all stair types for stairs redo
  55. elseif stairs_mod and stairs.mod then
  56. stairs.register_all("bakedclay_" .. clay[1], "bakedclay:" .. clay[1],
  57. {cracky = 3},
  58. {"baked_clay_" .. clay[1] .. ".png"},
  59. clay[2] .. " Baked Clay",
  60. default.node_sound_stone_defaults())
  61. -- register stair and slab using default stairs
  62. elseif stairs_mod then
  63. stairs.register_stair_and_slab("bakedclay_".. clay[1], "bakedclay:".. clay[1],
  64. {cracky = 3},
  65. {"baked_clay_" .. clay[1] .. ".png"},
  66. clay[2] .. " Baked Clay Stair",
  67. clay[2] .. " Baked Clay Slab",
  68. default.node_sound_stone_defaults())
  69. end
  70. -- register bakedclay for use in technic_cnc mod
  71. if techcnc_mod then
  72. technic_cnc.register_all("bakedclay:" .. clay[1],
  73. {cracky = 3, not_in_creative_inventory = 1},
  74. {"baked_clay_" .. clay[1] .. ".png"},
  75. clay[2] .. " Baked Clay")
  76. end
  77. end
  78. -- cook clay block into white baked clay
  79. minetest.register_craft({
  80. type = "cooking",
  81. output = "bakedclay:natural",
  82. recipe = "default:clay",
  83. })
  84. -- register a few extra dye colour options
  85. minetest.register_craft( {
  86. type = "shapeless",
  87. output = "dye:dark_grey 3",
  88. recipe = {"dye:black", "dye:black", "dye:white"}
  89. })
  90. minetest.register_craft( {
  91. type = "shapeless",
  92. output = "dye:grey 3",
  93. recipe = {"dye:black", "dye:white", "dye:white"}
  94. })
  95. minetest.register_craft( {
  96. type = "shapeless",
  97. output = "dye:green 4",
  98. recipe = {"default:cactus"}
  99. })
  100. minetest.register_craft( {
  101. type = "shapeless",
  102. output = "dye:black 4",
  103. recipe = {"default:coal_lump"}
  104. })
  105. minetest.register_craft( {
  106. type = "shapeless",
  107. output = "dye:brown 4",
  108. recipe = {"default:dry_shrub"}
  109. })
  110. -- 2x2 red bakedclay makes 16x clay brick
  111. minetest.register_craft( {
  112. output = "default:clay_brick 16",
  113. recipe = {
  114. {"bakedclay:red", "bakedclay:red"},
  115. {"bakedclay:red", "bakedclay:red"},
  116. }
  117. })
  118. -- register some new flowers to fill in missing dye colours
  119. -- flower registration (borrowed from default game)
  120. local function add_simple_flower(name, desc, box, f_groups)
  121. f_groups.snappy = 3
  122. f_groups.flower = 1
  123. f_groups.flora = 1
  124. f_groups.attached_node = 1
  125. minetest.register_node("bakedclay:" .. name, {
  126. description = desc,
  127. drawtype = "plantlike",
  128. waving = 1,
  129. tiles = {"baked_clay_" .. name .. ".png"},
  130. inventory_image = "baked_clay_" .. name .. ".png",
  131. wield_image = "baked_clay_" .. name .. ".png",
  132. sunlight_propagates = true,
  133. paramtype = "light",
  134. walkable = false,
  135. buildable_to = true,
  136. stack_max = 99,
  137. groups = f_groups,
  138. sounds = default.node_sound_leaves_defaults(),
  139. selection_box = {
  140. type = "fixed",
  141. fixed = box
  142. }
  143. })
  144. end
  145. local flowers = {
  146. {"delphinium", "Blue Delphinium", {-0.15, -0.5, -0.15, 0.15, 0.3, 0.15}, {color_cyan = 1}},
  147. {"thistle", "Thistle", {-0.15, -0.5, -0.15, 0.15, 0.2, 0.15}, {color_magenta = 1}},
  148. {"lazarus", "Lazarus Bell", {-0.15, -0.5, -0.15, 0.15, 0.2, 0.15}, {color_pink = 1}},
  149. {"mannagrass", "Reed Mannagrass", {-0.15, -0.5, -0.15, 0.15, 0.2, 0.15}, {color_dark_green = 1}},
  150. }
  151. for _,item in pairs(flowers) do
  152. add_simple_flower(unpack(item))
  153. end
  154. -- mapgen for new flowers
  155. minetest.register_decoration({
  156. deco_type = "simple",
  157. place_on = {"default:dirt_with_grass"},
  158. sidelen = 16,
  159. noise_params = {
  160. offset = 0,
  161. scale = 0.004,
  162. spread = {x = 100, y = 100, z = 100},
  163. seed = 7133,
  164. octaves = 3,
  165. persist = 0.6
  166. },
  167. y_min = 10,
  168. y_max = 90,
  169. decoration = "bakedclay:delphinium",
  170. })
  171. minetest.register_decoration({
  172. deco_type = "simple",
  173. place_on = {"default:dirt_with_grass", "default:dirt_with_dry_grass"},
  174. sidelen = 16,
  175. noise_params = {
  176. offset = 0,
  177. scale = 0.004,
  178. spread = {x = 100, y = 100, z = 100},
  179. seed = 7134,
  180. octaves = 3,
  181. persist = 0.6
  182. },
  183. y_min = 15,
  184. y_max = 90,
  185. decoration = "bakedclay:thistle",
  186. })
  187. minetest.register_decoration({
  188. deco_type = "simple",
  189. place_on = {"default:dirt_with_grass", "default:dirt_with_rainforest_litter"},
  190. sidelen = 16,
  191. noise_params = {
  192. offset = 0,
  193. scale = 0.01,
  194. spread = {x = 100, y = 100, z = 100},
  195. seed = 7135,
  196. octaves = 3,
  197. persist = 0.6
  198. },
  199. y_min = 1,
  200. y_max = 90,
  201. decoration = "bakedclay:lazarus",
  202. spawn_by = "default:jungletree",
  203. num_spawn_by = 1,
  204. })
  205. minetest.register_decoration({
  206. deco_type = "simple",
  207. place_on = {"default:dirt_with_grass", "default:sand"},
  208. sidelen = 16,
  209. noise_params = {
  210. offset = 0,
  211. scale = 0.009,
  212. spread = {x = 100, y = 100, z = 100},
  213. seed = 7136,
  214. octaves = 3,
  215. persist = 0.6
  216. },
  217. y_min = 1,
  218. y_max = 15,
  219. decoration = "bakedclay:mannagrass",
  220. spawn_by = "group:water",
  221. num_spawn_by = 1,
  222. })
  223. -- add lucky blocks
  224. if minetest.get_modpath("lucky_block") then
  225. local p = "bakedclay:"
  226. lucky_block:add_blocks({
  227. {"dro", {"bakedclay:"}, 10, true},
  228. {"fal", {p.."black", p.."blue", p.."brown", p.."cyan", p.."dark_green",
  229. p.."dark_grey", p.."green", p.."grey", p.."magenta", p.."orange",
  230. p.."pink", p.."red", p.."violet", p.."white", p.."yellow", p.."natural"}, 0},
  231. {"fal", {p.."black", p.."blue", p.."brown", p.."cyan", p.."dark_green",
  232. p.."dark_grey", p.."green", p.."grey", p.."magenta", p.."orange",
  233. p.."pink", p.."red", p.."violet", p.."white", p.."yellow", p.."natural"}, 0, true},
  234. {"dro", {p.."delphinium"}, 5},
  235. {"dro", {p.."lazarus"}, 5},
  236. {"dro", {p.."mannagrass"}, 5},
  237. {"dro", {p.."thistle"}, 6},
  238. {"flo", 5, {p.."natural", p.."black", p.."blue", p.."brown", p.."cyan",
  239. p.."dark_green", p.."dark_grey", p.."green", p.."grey", p.."magenta",
  240. p.."orange", p.."pink", p.."red", p.."violet", p.."white", p.."yellow"}, 2},
  241. {"nod", "default:chest", 0, {
  242. {name = p.."natural", max = 30},
  243. {name = p.."black", max = 30},
  244. {name = p.."blue", max = 30},
  245. {name = p.."brown", max = 30},
  246. {name = p.."cyan", max = 30},
  247. {name = p.."dark_green", max = 30},
  248. {name = p.."dark_grey", max = 30},
  249. {name = p.."green", max = 30},
  250. {name = p.."grey", max = 30},
  251. {name = p.."magenta", max = 30},
  252. {name = p.."orange", max = 30},
  253. {name = p.."pink", max = 30},
  254. {name = p.."red", max = 30},
  255. {name = p.."violet", max = 30},
  256. {name = p.."white", max = 30},
  257. {name = p.."yellow", max = 30},
  258. }},
  259. })
  260. end
  261. print ("[MOD] Baked Clay loaded")