nodes.lua 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. minetest.register_node("lottmapgen:fog", {
  2. description = "Fog",
  3. drawtype = "glasslike",
  4. tiles = {"lottmapgen_fog.png"},
  5. paramtype = "light",
  6. is_ground_content = false,
  7. sunlight_propagates = true,
  8. walkable = false,
  9. pointable = false,
  10. diggable = false,
  11. buildable_to = true,
  12. is_ground_content = false,
  13. post_effect_color = {a=128, r=241, g=248, b=255},
  14. groups = {not_in_creative_inventory=1},
  15. })
  16. minetest.register_node("lottmapgen:angsnowblock", {
  17. description = "Snow Block",
  18. tiles = {"default_snow.png"},
  19. is_ground_content = true,
  20. drop = 'default:snowblock',
  21. freezemelt = "default:water_source",
  22. groups = {crumbly=3, melts=1},
  23. sounds = default.node_sound_dirt_defaults({
  24. footstep = {name="default_snow_footstep", gain=0.25},
  25. dug = {name="default_snow_footstep", gain=0.75},
  26. }),
  27. })
  28. minetest.register_node("lottmapgen:frozen_stone", {
  29. description = "Frozen Stone",
  30. tiles = {"default_stone.png^lottmapgen_frozen.png"},
  31. is_ground_content = true,
  32. groups = {cracky=3, stone=1},
  33. drop = 'default:cobble','default:snow',
  34. sounds = default.node_sound_stone_defaults(),
  35. })
  36. minetest.register_node("lottmapgen:mordor_stone", {
  37. description = "Mordor Stone",
  38. tiles = {"lottmapgen_mordor_stone.png"},
  39. is_ground_content = true,
  40. groups = {cracky=3, stone=1},
  41. sounds = default.node_sound_stone_defaults(),
  42. })
  43. minetest.register_node(":default:ice", {
  44. description = "Ice",
  45. drawtype = "glasslike",
  46. tiles = {"lottmapgen_ice.png"},
  47. is_ground_content = true,
  48. alpha = 200,
  49. paramtype = "light",
  50. freezemelt = "default:water_source",
  51. groups = {cracky=3, melts=1},
  52. sounds = default.node_sound_glass_defaults(),
  53. })
  54. minetest.register_node("lottmapgen:blacksource", {
  55. description = "Black Water Source",
  56. drawtype = "liquid",
  57. tiles = {"lottmapgen_black_water.png"},
  58. alpha = 240,
  59. paramtype = "light",
  60. walkable = false,
  61. pointable = false,
  62. diggable = false,
  63. buildable_to = true,
  64. drowning = 1,
  65. liquidtype = "source",
  66. liquid_alternative_flowing = "lottmapgen:blackflowing",
  67. liquid_alternative_source = "lottmapgen:blacksource",
  68. liquid_viscosity = 1,
  69. damage_per_second = 2,
  70. post_effect_color = {a=192, r=140, g=140, b=140},
  71. groups = {water=3, liquid=3, puts_out_fire=1},
  72. })
  73. minetest.register_node("lottmapgen:blackflowing", {
  74. drawtype = "flowingliquid",
  75. tiles = {"lottmapgen_black_water.png"},
  76. special_tiles = {
  77. {
  78. image="lottmapgen_black_water_flow.png",
  79. backface_culling=false,
  80. animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=1}
  81. },
  82. {
  83. image="lottmapgen_black_water_flow.png",
  84. backface_culling=true,
  85. animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=1}
  86. },
  87. },
  88. alpha = 245,
  89. paramtype = "light",
  90. walkable = false,
  91. pointable = false,
  92. diggable = false,
  93. buildable_to = true,
  94. liquidtype = "flowing",
  95. liquid_alternative_flowing = "lottmapgen:blackflowing",
  96. liquid_alternative_source = "lottmapgen:blacksource",
  97. liquid_viscosity = 1,
  98. damage_per_second = 2,
  99. post_effect_color = {a=192, r=140, g=140, b=140},-- {a=224, r=31, g=56, b=8},
  100. groups = {water=3, liquid=3, puts_out_fire=1, not_in_creative_inventory=1},
  101. })
  102. minetest.register_node("lottmapgen:black_river_source", {
  103. description = "Black River Source",
  104. drawtype = "liquid",
  105. tiles = {"lottmapgen_black_water.png"},
  106. alpha = 240,
  107. paramtype = "light",
  108. walkable = false,
  109. pointable = false,
  110. diggable = false,
  111. buildable_to = true,
  112. drowning = 1,
  113. liquidtype = "source",
  114. liquid_alternative_flowing = "lottmapgen:black_river_flowing",
  115. liquid_alternative_source = "lottmapgen:black_river_source",
  116. liquid_viscosity = 1,
  117. liquid_renewable = false,
  118. liquid_range = 2,
  119. damage_per_second = 2,
  120. post_effect_color = {a=192, r=140, g=140, b=140},
  121. groups = {water=3, liquid=3, puts_out_fire=1},
  122. })
  123. minetest.register_node("lottmapgen:black_river_flowing", {
  124. drawtype = "flowingliquid",
  125. tiles = {"lottmapgen_black_water.png"},
  126. special_tiles = {
  127. {
  128. image="lottmapgen_black_water_flow.png",
  129. backface_culling=false,
  130. animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=1}
  131. },
  132. {
  133. image="lottmapgen_black_water_flow.png",
  134. backface_culling=true,
  135. animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=1}
  136. },
  137. },
  138. alpha = 245,
  139. paramtype = "light",
  140. walkable = false,
  141. pointable = false,
  142. diggable = false,
  143. buildable_to = true,
  144. liquidtype = "flowing",
  145. liquid_alternative_flowing = "lottmapgen:black_river_flowing",
  146. liquid_alternative_source = "lottmapgen:black_river_source",
  147. liquid_viscosity = 1,
  148. liquid_renewable = false,
  149. liquid_range = 2,
  150. damage_per_second = 2,
  151. post_effect_color = {a=192, r=140, g=140, b=140},-- {a=224, r=31, g=56, b=8},
  152. groups = {water=3, liquid=3, puts_out_fire=1, not_in_creative_inventory=1},
  153. })
  154. bucket.register_liquid(
  155. "lottmapgen:blacksource",
  156. "lottmapgen:blackflowing",
  157. "lottmapgen:bucket_mordor",
  158. "lottmapgen_bucket_mordor_water.png",
  159. "Mordor Water Bucket"
  160. )
  161. -- Grasses
  162. minetest.register_node("lottmapgen:dunland_grass", {
  163. description = "Dunland Grass",
  164. tiles = {"default_grass.png^[colorize:#35ba3c:50", "default_dirt.png",
  165. {name = "default_dirt.png^(default_grass_side.png^[colorize:#35ba3c:50)", tileable_vertical = false}
  166. },
  167. is_ground_content = true,
  168. groups = {crumbly=3, soil=1, lottmapgen_grass=1, not_in_creative_inventory=1},
  169. drop = 'default:dirt',
  170. sounds = default.node_sound_dirt_defaults({
  171. footstep = {name="default_grass_footstep", gain=0.25},
  172. }),
  173. })
  174. minetest.register_node("lottmapgen:ironhill_grass", {
  175. description = "Iron Hills Grass",
  176. tiles = {"default_grass.png^[colorize:#1cbca7:60", "default_dirt.png",
  177. {name = "default_dirt.png^(default_grass_side.png^[colorize:#1cbca7:60)", tileable_vertical = false}
  178. },
  179. is_ground_content = true,
  180. groups = {crumbly=3, soil=1, lottmapgen_grass=1, not_in_creative_inventory=1},
  181. drop = 'default:dirt',
  182. sounds = default.node_sound_dirt_defaults({
  183. footstep = {name="default_grass_footstep", gain=0.25},
  184. }),
  185. })
  186. minetest.register_node("lottmapgen:gondor_grass", {
  187. description = "Gondor Grass",
  188. tiles = {"default_grass.png", "default_dirt.png", {name = "default_dirt.png^default_grass_side.png", tileable_vertical = false}},
  189. is_ground_content = true,
  190. groups = {crumbly=3, soil=1, lottmapgen_grass=1, not_in_creative_inventory=1},
  191. drop = 'default:dirt',
  192. sounds = default.node_sound_dirt_defaults({
  193. footstep = {name="default_grass_footstep", gain=0.25},
  194. }),
  195. })
  196. minetest.register_node("lottmapgen:lorien_grass", {
  197. description = "Lorien Grass",
  198. tiles = {"default_grass.png^[colorize:#5bf7ea:75", "default_dirt.png",
  199. {name = "default_dirt.png^(default_grass_side.png^[colorize:#5bf7ea:75)", tileable_vertical = false}
  200. },
  201. is_ground_content = true,
  202. groups = {crumbly=3, soil=1, lottmapgen_grass=1, not_in_creative_inventory=1},
  203. drop = 'default:dirt',
  204. sounds = default.node_sound_dirt_defaults({
  205. footstep = {name="default_grass_footstep", gain=0.25},
  206. }),
  207. })
  208. minetest.register_node("lottmapgen:fangorn_grass", {
  209. description = "? Grass",
  210. tiles = {"default_grass.png^[colorize:#720e6f:30", "default_dirt.png",
  211. {name = "default_dirt.png^(default_grass_side.png^[colorize:#720e6f:30)", tileable_vertical = false}
  212. },
  213. is_ground_content = true,
  214. groups = {crumbly=3, soil=1, lottmapgen_grass=1, not_in_creative_inventory=1},
  215. drop = 'default:dirt',
  216. sounds = default.node_sound_dirt_defaults({
  217. footstep = {name="default_grass_footstep", gain=0.25},
  218. }),
  219. })
  220. minetest.register_node("lottmapgen:mirkwood_grass", {
  221. description = "Mirkwood Grass",
  222. tiles = {"default_grass.png^[colorize:#331507:120", "default_dirt.png",
  223. {name = "default_dirt.png^(default_grass_side.png^[colorize:#331507:120)", tileable_vertical = false}
  224. },
  225. is_ground_content = true,
  226. groups = {crumbly=3, soil=1, lottmapgen_grass=1, not_in_creative_inventory=1},
  227. drop = 'default:dirt',
  228. sounds = default.node_sound_dirt_defaults({
  229. footstep = {name="default_grass_footstep", gain=0.25},
  230. }),
  231. })
  232. minetest.register_node("lottmapgen:rohan_grass", {
  233. description = "? Grass",
  234. tiles = {"default_grass.png^[colorize:#af5301:95", "default_dirt.png",
  235. {name = "default_dirt.png^(default_grass_side.png^[colorize:#af5301:95)", tileable_vertical = false}
  236. },
  237. is_ground_content = true,
  238. groups = {crumbly=3, soil=1, lottmapgen_grass=1, not_in_creative_inventory=1},
  239. drop = 'default:dirt',
  240. sounds = default.node_sound_dirt_defaults({
  241. footstep = {name="default_grass_footstep", gain=0.25},
  242. }),
  243. })
  244. minetest.register_node("lottmapgen:shire_grass", {
  245. description = "Shire Grass",
  246. tiles = {"default_grass.png^[colorize:#86ad06:105", "default_dirt.png",
  247. {name = "default_dirt.png^(default_grass_side.png^[colorize:#86ad06:105)", tileable_vertical = false}
  248. },
  249. is_ground_content = true,
  250. groups = {crumbly=3, soil=1, lottmapgen_grass=1, not_in_creative_inventory=1},
  251. drop = 'default:dirt',
  252. sounds = default.node_sound_dirt_defaults({
  253. footstep = {name="default_grass_footstep", gain=0.25},
  254. }),
  255. })
  256. minetest.register_node("lottmapgen:ithilien_grass", {
  257. description = "Ithilien Grass",
  258. tiles = {"default_grass.png^[colorize:#ba6f35:50", "default_dirt.png",
  259. {name = "default_dirt.png^(default_grass_side.png^[colorize:#ba6f35:50)", tileable_vertical = false}
  260. },
  261. is_ground_content = true,
  262. groups = {crumbly=3, soil=1, lottmapgen_grass=1, not_in_creative_inventory=1},
  263. drop = 'default:dirt',
  264. sounds = default.node_sound_dirt_defaults({
  265. footstep = {name="default_grass_footstep", gain=0.25},
  266. }),
  267. })
  268. minetest.register_node("lottmapgen:default_grass", {
  269. tiles = {"default_grass.png", "default_dirt.png", {name = "default_dirt.png^default_grass_side.png", tileable_vertical = false}},
  270. is_ground_content = true,
  271. groups = {crumbly=3, soil=1, lottmapgen_grass=1, not_in_creative_inventory=1},
  272. drop = 'default:dirt',
  273. sounds = default.node_sound_dirt_defaults()
  274. })
  275. minetest.register_abm({
  276. nodenames = {"default:dirt_with_grass"},
  277. interval = 2,
  278. chance = 1,
  279. action = function(pos, node)
  280. local count_grasses = {};
  281. local curr_max = 0;
  282. local curr_type = "lottmapgen:default_grass";
  283. local positions = minetest.find_nodes_in_area( {x=(pos.x-2), y=(pos.y-2), z=(pos.z-2)},
  284. {x=(pos.x+2), y=(pos.y+2), z=(pos.z+2)},
  285. "group:lottmapgen_grass" );
  286. for _,p in ipairs(positions) do
  287. local n = minetest.get_node( p );
  288. if( n and n.name ) then
  289. if( not( count_grasses[ n.name ] )) then
  290. count_grasses[ n.name ] = 1;
  291. else
  292. count_grasses[ n.name ] = count_grasses[ n.name ] + 1;
  293. end
  294. if( count_grasses[ n.name ] > curr_max ) then
  295. curr_max = count_grasses[ n.name ];
  296. curr_type = n.name;
  297. end
  298. end
  299. end
  300. minetest.set_node(pos, {name = curr_type })
  301. end
  302. })
  303. minetest.register_abm({
  304. nodenames = {"group:lottmapgen_grass"},
  305. interval = 2,
  306. chance = 20,
  307. action = function(pos, node)
  308. local above = {x=pos.x, y=pos.y+1, z=pos.z}
  309. local name = minetest.get_node(above).name
  310. local nodedef = minetest.registered_nodes[name]
  311. if name ~= "ignore" and nodedef
  312. and not ((nodedef.sunlight_propagates or nodedef.paramtype == "light")
  313. and nodedef.liquidtype == "none") then
  314. minetest.set_node(pos, {name = "default:dirt"})
  315. end
  316. end
  317. })