init.lua 28 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034
  1. if not minetest.global_exists("cavestuff") then cavestuff = {} end
  2. cavestuff.modpath = minetest.get_modpath("cavestuff")
  3. -- Localize for performance.
  4. local math_random = math.random
  5. -- Functions.
  6. dofile(cavestuff.modpath .. "/functions.lua")
  7. minetest.register_node("cavestuff:cobble_with_moss", {
  8. description = "Cave Stone With Moss",
  9. tiles = {
  10. "default_cobble.png^caverealms_moss.png",
  11. "default_cobble.png",
  12. "default_cobble.png^caverealms_moss_side.png",
  13. },
  14. groups = utility.dig_groups("softcobble", {
  15. falling_node = 1,
  16. melts = 1,
  17. cavern_soil = 1, cobble_type = 1,
  18. }),
  19. _melts_to = "cavestuff:cobble_with_rockmelt",
  20. sounds = default.node_sound_gravel_defaults({
  21. footstep = {name="default_grass_footstep", gain=0.25},
  22. }),
  23. light_source = 1,
  24. movement_speed_multiplier = default.SLOW_SPEED_GRASS,
  25. drop = "default:cobble",
  26. silverpick_drop = true,
  27. _is_bulk_mapgen_stone = true,
  28. -- Common stone does not count toward tool's dig count.
  29. _toolranks = {
  30. ignore = true,
  31. },
  32. })
  33. minetest.register_node("cavestuff:cobble_with_lichen", {
  34. description = "Cave Stone With Lichen",
  35. tiles = {
  36. "default_cobble.png^caverealms_lichen.png",
  37. "default_cobble.png",
  38. "default_cobble.png^caverealms_lichen_side.png",
  39. },
  40. groups = utility.dig_groups("softcobble", {
  41. falling_node = 1,
  42. melts = 1,
  43. cavern_soil = 1, cobble_type = 1,
  44. }),
  45. _melts_to = "cavestuff:cobble_with_rockmelt",
  46. sounds = default.node_sound_gravel_defaults({
  47. footstep = {name="default_grass_footstep", gain=0.25},
  48. }),
  49. light_source = 1,
  50. movement_speed_multiplier = default.SLOW_SPEED_GRASS,
  51. drop = "default:cobble",
  52. silverpick_drop = true,
  53. _is_bulk_mapgen_stone = true,
  54. -- Common stone does not count toward tool's dig count.
  55. _toolranks = {
  56. ignore = true,
  57. },
  58. })
  59. minetest.register_node("cavestuff:cobble_with_algae", {
  60. description = "Cave Stone With Algae",
  61. tiles = {
  62. "default_cobble.png^caverealms_algae.png",
  63. "default_cobble.png",
  64. "default_cobble.png^caverealms_algae_side.png",
  65. },
  66. groups = utility.dig_groups("softcobble", {
  67. falling_node = 1,
  68. melts = 1,
  69. cavern_soil = 1, cobble_type = 1,
  70. }),
  71. _melts_to = "cavestuff:cobble_with_rockmelt",
  72. sounds = default.node_sound_gravel_defaults({
  73. footstep = {name="default_grass_footstep", gain=0.25},
  74. }),
  75. light_source = 1,
  76. movement_speed_multiplier = default.SLOW_SPEED_GRASS,
  77. drop = "default:cobble",
  78. silverpick_drop = true,
  79. _is_bulk_mapgen_stone = true,
  80. -- Common stone does not count toward tool's dig count.
  81. _toolranks = {
  82. ignore = true,
  83. },
  84. })
  85. minetest.register_node("cavestuff:cobble_with_salt", {
  86. description = "Cave Stone With Salt",
  87. tiles = {
  88. "default_cobble.png^caverealms_salty.png",
  89. "default_cobble.png",
  90. "default_cobble.png^caverealms_salty_side.png",
  91. },
  92. groups = utility.dig_groups("softcobble", {
  93. falling_node = 1,
  94. melts = 1, cobble_type = 1,
  95. }),
  96. _melts_to = "cavestuff:cobble_with_rockmelt",
  97. sounds = default.node_sound_gravel_defaults(),
  98. light_source = 1,
  99. movement_speed_multiplier = default.SLOW_SPEED_GRASS,
  100. drop = "default:cobble",
  101. silverpick_drop = true,
  102. _is_bulk_mapgen_stone = true,
  103. -- Common stone does not count toward tool's dig count.
  104. _toolranks = {
  105. ignore = true,
  106. },
  107. })
  108. minetest.register_node("cavestuff:cobble_with_rockmelt", {
  109. description = "Rockmelt Cobble",
  110. tiles = {"caverealms_hot_cobble.png"},
  111. groups = utility.dig_groups("softcobble", {hot=1, falling_node=1, melt_around=3, cobble_type=1, rockmelt=1}),
  112. damage_per_second = 1*500,
  113. _damage_per_second_type = "heat",
  114. _death_message = "<player> succumbed to melted rock.",
  115. light_source = 5,
  116. sounds = default.node_sound_stone_defaults(),
  117. drop = "default:cobble",
  118. _is_bulk_mapgen_stone = true,
  119. movement_speed_multiplier = default.SLOW_SPEED,
  120. on_construct = function(pos)
  121. torchmelt.start_melting(pos)
  122. end,
  123. after_place_node = function(...)
  124. return cavestuff.hotcobble.after_place_node(...)
  125. end,
  126. after_dig_node = function(...)
  127. return cavestuff.hotcobble.after_dig_node(...)
  128. end,
  129. on_player_walk_over = function(...)
  130. return cavestuff.hotcobble.on_player_walk_over(...)
  131. end,
  132. on_finish_collapse = function(...)
  133. return cavestuff.hotcobble.on_finish_collapse(...)
  134. end,
  135. -- Common stone does not count toward tool's dig count.
  136. _toolranks = {
  137. ignore = true,
  138. },
  139. })
  140. minetest.register_node("cavestuff:glow_sapphire", {
  141. description = "Glowing Sapphire",
  142. tiles = {"caverealms_glow_crystal.png"},
  143. groups = utility.dig_groups("crystal"),
  144. sounds = default.node_sound_glass_defaults(),
  145. light_source = 13,
  146. paramtype = "light",
  147. use_texture_alpha = "blend",
  148. drawtype = "glasslike",
  149. sunlight_propagates = true,
  150. })
  151. stairs.register_stair_and_slab(
  152. "glow_sapphire",
  153. "cavestuff:glow_sapphire",
  154. utility.dig_groups("crystal"),
  155. {"caverealms_glow_crystal.png"},
  156. "Glowing Sapphire",
  157. default.node_sound_glass_defaults()
  158. )
  159. minetest.override_item("stairs:slab_glow_sapphire", {
  160. sunlight_propagates = true,
  161. light_source = 13,
  162. })
  163. minetest.override_item("stairs:stair_glow_sapphire", {
  164. sunlight_propagates = true,
  165. light_source = 13,
  166. })
  167. minetest.register_node("cavestuff:glow_emerald", {
  168. description = "Glowing Emerald",
  169. tiles = {"caverealms_glow_emerald.png"},
  170. groups = utility.dig_groups("crystal"),
  171. sounds = default.node_sound_glass_defaults(),
  172. light_source = 10,
  173. paramtype = "light",
  174. use_texture_alpha = "blend",
  175. drawtype = "glasslike",
  176. sunlight_propagates = true,
  177. })
  178. stairs.register_stair_and_slab(
  179. "glow_emerald",
  180. "cavestuff:glow_emerald",
  181. utility.dig_groups("crystal"),
  182. {"caverealms_glow_emerald.png"},
  183. "Glowing Emerald",
  184. default.node_sound_glass_defaults()
  185. )
  186. minetest.override_item("stairs:slab_glow_emerald", {
  187. sunlight_propagates = true,
  188. light_source = 10,
  189. })
  190. minetest.override_item("stairs:stair_glow_emerald", {
  191. sunlight_propagates = true,
  192. light_source = 10,
  193. })
  194. minetest.register_node("cavestuff:glow_mese", {
  195. description = "Glowing Mese",
  196. tiles = {"caverealms_glow_mese.png"},
  197. groups = utility.dig_groups("crystal"),
  198. sounds = default.node_sound_glass_defaults(),
  199. light_source = 14,
  200. paramtype = "light",
  201. use_texture_alpha = "blend",
  202. drawtype = "glasslike",
  203. sunlight_propagates = true,
  204. })
  205. stairs.register_stair_and_slab(
  206. "glow_mese",
  207. "cavestuff:glow_mese",
  208. utility.dig_groups("crystal"),
  209. {"caverealms_glow_mese.png"},
  210. "Glowing Mese",
  211. default.node_sound_glass_defaults()
  212. )
  213. minetest.override_item("stairs:slab_glow_mese", {
  214. sunlight_propagates = true,
  215. light_source = 14,
  216. })
  217. minetest.override_item("stairs:stair_glow_mese", {
  218. sunlight_propagates = true,
  219. light_source = 14,
  220. })
  221. minetest.register_node("cavestuff:glow_ruby", {
  222. description = "Glowing Ruby",
  223. tiles = {"caverealms_glow_ruby.png"},
  224. groups = utility.dig_groups("crystal"),
  225. sounds = default.node_sound_glass_defaults(),
  226. light_source = 8,
  227. paramtype = "light",
  228. use_texture_alpha = "blend",
  229. drawtype = "glasslike",
  230. sunlight_propagates = true,
  231. })
  232. stairs.register_stair_and_slab(
  233. "glow_ruby",
  234. "cavestuff:glow_ruby",
  235. utility.dig_groups("crystal"),
  236. {"caverealms_glow_ruby.png"},
  237. "Glowing Ruby",
  238. default.node_sound_glass_defaults()
  239. )
  240. minetest.override_item("stairs:slab_glow_ruby", {
  241. sunlight_propagates = true,
  242. light_source = 8,
  243. })
  244. minetest.override_item("stairs:stair_glow_ruby", {
  245. sunlight_propagates = true,
  246. light_source = 8,
  247. })
  248. minetest.register_node("cavestuff:glow_amethyst", {
  249. description = "Glowing Amethyst",
  250. tiles = {"caverealms_glow_amethyst.png"},
  251. groups = utility.dig_groups("crystal"),
  252. sounds = default.node_sound_glass_defaults(),
  253. light_source = 7,
  254. paramtype = "light",
  255. use_texture_alpha = "blend",
  256. drawtype = "glasslike",
  257. sunlight_propagates = true,
  258. })
  259. stairs.register_stair_and_slab(
  260. "glow_amethyst",
  261. "cavestuff:glow_amethyst",
  262. utility.dig_groups("crystal"),
  263. {"caverealms_glow_amethyst.png"},
  264. "Glowing Amethyst",
  265. default.node_sound_glass_defaults()
  266. )
  267. minetest.override_item("stairs:slab_glow_amethyst", {
  268. sunlight_propagates = true,
  269. light_source = 7,
  270. })
  271. minetest.override_item("stairs:stair_glow_amethyst", {
  272. sunlight_propagates = true,
  273. light_source = 7,
  274. })
  275. minetest.register_node("cavestuff:glow_sapphire_ore", {
  276. description = "Embedded Glowing Sapphire",
  277. tiles = {"caverealms_glow_ore.png"},
  278. groups = utility.dig_groups("hardore"),
  279. sounds = default.node_sound_stone_defaults(),
  280. light_source = 8,
  281. paramtype = "light",
  282. })
  283. stairs.register_stair_and_slab(
  284. "glow_sapphire_ore",
  285. "cavestuff:glow_sapphire_ore",
  286. utility.dig_groups("hardore"),
  287. {"caverealms_glow_ore.png"},
  288. "Embedded Glowing Sapphire",
  289. default.node_sound_stone_defaults()
  290. )
  291. minetest.override_item("stairs:slab_glow_sapphire_ore", {
  292. light_source = 8,
  293. })
  294. minetest.override_item("stairs:stair_glow_sapphire_ore", {
  295. light_source = 8,
  296. })
  297. minetest.register_node("cavestuff:glow_emerald_ore", {
  298. description = "Embedded Glowing Emerald",
  299. tiles = {"caverealms_glow_emerald_ore.png"},
  300. groups = utility.dig_groups("hardore"),
  301. sounds = default.node_sound_stone_defaults(),
  302. light_source = 8,
  303. paramtype = "light",
  304. })
  305. stairs.register_stair_and_slab(
  306. "glow_emerald_ore",
  307. "cavestuff:glow_emerald_ore",
  308. utility.dig_groups("hardore"),
  309. {"caverealms_glow_emerald_ore.png"},
  310. "Embedded Glowing Emerald",
  311. default.node_sound_stone_defaults()
  312. )
  313. minetest.override_item("stairs:slab_glow_emerald_ore", {
  314. light_source = 8,
  315. })
  316. minetest.override_item("stairs:stair_glow_emerald_ore", {
  317. light_source = 8,
  318. })
  319. minetest.register_node("cavestuff:glow_ruby_ore", {
  320. description = "Embedded Glowing Ruby",
  321. tiles = {"caverealms_glow_ruby_ore.png"},
  322. groups = utility.dig_groups("hardore"),
  323. sounds = default.node_sound_stone_defaults(),
  324. light_source = 8,
  325. paramtype = "light",
  326. })
  327. stairs.register_stair_and_slab(
  328. "glow_ruby_ore",
  329. "cavestuff:glow_ruby_ore",
  330. utility.dig_groups("hardore"),
  331. {"caverealms_glow_ruby_ore.png"},
  332. "Embedded Glowing Ruby",
  333. default.node_sound_stone_defaults()
  334. )
  335. minetest.override_item("stairs:slab_glow_ruby_ore", {
  336. light_source = 8,
  337. })
  338. minetest.override_item("stairs:stair_glow_ruby_ore", {
  339. light_source = 8,
  340. })
  341. minetest.register_node("cavestuff:glow_amethyst_ore", {
  342. description = "Embedded Glowing Amethyst",
  343. tiles = {"caverealms_glow_amethyst_ore.png"},
  344. groups = utility.dig_groups("hardore"),
  345. sounds = default.node_sound_stone_defaults(),
  346. light_source = 8,
  347. paramtype = "light",
  348. })
  349. stairs.register_stair_and_slab(
  350. "glow_amethyst_ore",
  351. "cavestuff:glow_amethyst_ore",
  352. utility.dig_groups("hardore"),
  353. {"caverealms_glow_amethyst_ore.png"},
  354. "Embedded Glowing Amethyst",
  355. default.node_sound_stone_defaults()
  356. )
  357. minetest.override_item("stairs:slab_glow_amethyst_ore", {
  358. light_source = 8,
  359. })
  360. minetest.override_item("stairs:stair_glow_amethyst_ore", {
  361. light_source = 8,
  362. })
  363. minetest.register_node("cavestuff:glow_worm", {
  364. description = "Glow Worms",
  365. tiles = {"caverealms_glow_worm.png"},
  366. inventory_image = "caverealms_glow_worm.png",
  367. wield_image = "caverealms_glow_worm.png",
  368. groups = utility.dig_groups("plant", {
  369. hanging_node = 1, flammable = 3,
  370. }),
  371. light_source = 5,
  372. paramtype = "light",
  373. drawtype = "plantlike",
  374. movement_speed_multiplier = default.SLOW_SPEED_PLANTS,
  375. walkable = false,
  376. climbable = true,
  377. drop = "",
  378. shears_drop = true,
  379. -- Selection box interferes with hanging node group?
  380. -- Making the selection box smaller seems to prevent the
  381. -- hanging node group from working properly.
  382. selection_box = {
  383. type = "fixed",
  384. fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3},
  385. },
  386. })
  387. minetest.register_node("cavestuff:glow_fungus", {
  388. description = "Glow Fungus",
  389. tiles = {"caverealms_glow_fungus.png"},
  390. inventory_image = "caverealms_glow_fungus.png",
  391. wield_image = "caverealms_glow_fungus.png",
  392. groups = utility.dig_groups("plant", {
  393. attached_node = 1, flammable = 3,
  394. }),
  395. light_source = 5,
  396. paramtype = "light",
  397. drawtype = "firelike",
  398. movement_speed_multiplier = default.SLOW_SPEED_PLANTS,
  399. walkable = false,
  400. buildable_to = true,
  401. drop = "",
  402. shears_drop = true,
  403. -- Selection box interferes with hanging node group?
  404. -- Making the selection box smaller seems to prevent the
  405. -- hanging node group from working properly.
  406. selection_box = {
  407. type = "fixed",
  408. fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
  409. },
  410. })
  411. minetest.register_node("cavestuff:glow_obsidian", {
  412. description = "Luminescent Obsidian",
  413. tiles = {"caverealms_glow_obsidian.png"},
  414. groups = utility.dig_groups("obsidian", {
  415. immovable = 1,
  416. }),
  417. light_source = 7,
  418. sounds = default.node_sound_stone_defaults(),
  419. on_blast = function(...) end, -- Blast resistant.
  420. node_dig_prediction = "",
  421. after_destruct = function(pos)
  422. minetest.after(0, ambiance.recheck_nearby_sound_beacons, {x=pos.x, y=pos.y, z=pos.z}, 16)
  423. end,
  424. on_destruct = function(pos)
  425. obsidian_gateway.on_damage_gate(pos)
  426. end,
  427. })
  428. minetest.register_craft({
  429. output = "cavestuff:glow_obsidian",
  430. type = "shapeless",
  431. recipe = {"default:obsidian", "glowstone:glowing_dust"},
  432. })
  433. stairs.register_stair_and_slab("glow_obsidian", "cavestuff:glow_obsidian",
  434. utility.dig_groups("obsidian"),
  435. {"caverealms_glow_obsidian.png"},
  436. "Luminescent Obsidian",
  437. default.node_sound_stone_defaults())
  438. minetest.register_node("cavestuff:glow_obsidian_brick", {
  439. description = "Luminescent Obsidian Brick",
  440. tiles = {"caverealms_glow_obsidian_brick.png"},
  441. groups = utility.dig_groups("brick", {
  442. immovable = 1,
  443. }),
  444. light_source = 7,
  445. sounds = default.node_sound_stone_defaults(),
  446. node_dig_prediction = "",
  447. })
  448. minetest.register_craft({
  449. output = "cavestuff:glow_obsidian_brick 4",
  450. recipe = {
  451. {"cavestuff:glow_obsidian", "cavestuff:glow_obsidian"},
  452. {"cavestuff:glow_obsidian", "cavestuff:glow_obsidian"},
  453. },
  454. })
  455. stairs.register_stair_and_slab(
  456. "glow_obsidian_brick",
  457. "cavestuff:glow_obsidian_brick",
  458. utility.dig_groups("brick"),
  459. {"caverealms_glow_obsidian_brick.png"},
  460. "Luminescent Obsidian Brick",
  461. default.node_sound_stone_defaults())
  462. minetest.register_node("cavestuff:glow_obsidian_block", {
  463. description = "Luminescent Obsidian Block",
  464. tiles = {"caverealms_glow_obsidian_block.png"},
  465. groups = utility.dig_groups("block", {
  466. immovable = 1,
  467. }),
  468. light_source = 7,
  469. sounds = default.node_sound_stone_defaults(),
  470. node_dig_prediction = "",
  471. })
  472. minetest.register_craft({
  473. output = "cavestuff:glow_obsidian_block 9",
  474. recipe = {
  475. {"cavestuff:glow_obsidian", "cavestuff:glow_obsidian", "cavestuff:glow_obsidian"},
  476. {"cavestuff:glow_obsidian", "cavestuff:glow_obsidian", "cavestuff:glow_obsidian"},
  477. {"cavestuff:glow_obsidian", "cavestuff:glow_obsidian", "cavestuff:glow_obsidian"},
  478. },
  479. })
  480. stairs.register_stair_and_slab(
  481. "glow_obsidian_block",
  482. "cavestuff:glow_obsidian_block",
  483. utility.dig_groups("block"),
  484. {"caverealms_glow_obsidian_block.png"},
  485. "Luminescent Obsidian Block",
  486. default.node_sound_stone_defaults())
  487. minetest.register_node("cavestuff:dark_obsidian", {
  488. description = "Dead Obsidian",
  489. tiles = {"technic_obsidian.png"},
  490. groups = utility.dig_groups("obsidian", {
  491. immovable = 1,
  492. }),
  493. sounds = default.node_sound_stone_defaults(),
  494. movement_speed_multiplier = default.ROAD_SPEED_CAVERN,
  495. node_dig_prediction = "",
  496. -- Note: adamant TNT mining depends on this.
  497. on_blast = function(...) end, -- Blast resistant.
  498. after_destruct = function(pos)
  499. minetest.after(0, ambiance.recheck_nearby_sound_beacons, {x=pos.x, y=pos.y, z=pos.z}, 16)
  500. end,
  501. on_destruct = function(pos)
  502. obsidian_gateway.on_damage_gate(pos)
  503. end,
  504. crushing_damage = 5000,
  505. })
  506. stairs.register_stair_and_slab(
  507. "dark_obsidian",
  508. "cavestuff:dark_obsidian",
  509. utility.dig_groups("obsidian"),
  510. {"technic_obsidian.png"},
  511. "Dead Obsidian",
  512. default.node_sound_stone_defaults())
  513. minetest.register_node("cavestuff:dark_obsidian_brick", {
  514. description = "Dead Obsidian Brick",
  515. tiles = {"technic_obsidian_brick.png"},
  516. groups = utility.dig_groups("obsidian"),
  517. sounds = default.node_sound_stone_defaults(),
  518. on_blast = function(...) end, -- Blast resistant.
  519. crushing_damage = 5000,
  520. node_dig_prediction = "",
  521. })
  522. stairs.register_stair_and_slab(
  523. "dark_obsidian_brick",
  524. "cavestuff:dark_obsidian_brick",
  525. utility.dig_groups("obsidian"),
  526. {"technic_obsidian_brick.png"},
  527. "Dead Obsidian Brick",
  528. default.node_sound_stone_defaults())
  529. minetest.register_node("cavestuff:dark_obsidian_block", {
  530. description = "Dead Obsidian Block",
  531. tiles = {"technic_obsidian_block.png"},
  532. groups = utility.dig_groups("obsidian"),
  533. sounds = default.node_sound_stone_defaults(),
  534. on_blast = function(...) end, -- Blast resistant.
  535. crushing_damage = 5000,
  536. node_dig_prediction = "",
  537. })
  538. stairs.register_stair_and_slab(
  539. "dark_obsidian_block",
  540. "cavestuff:dark_obsidian_block",
  541. utility.dig_groups("obsidian"),
  542. {"technic_obsidian_block.png"},
  543. "Dead Obsidian Block",
  544. default.node_sound_stone_defaults())
  545. minetest.register_craft({
  546. output = "cavestuff:dark_obsidian_brick 4",
  547. recipe = {
  548. {"cavestuff:dark_obsidian", "cavestuff:dark_obsidian"},
  549. {"cavestuff:dark_obsidian", "cavestuff:dark_obsidian"},
  550. }
  551. })
  552. minetest.register_craft({
  553. output = "cavestuff:dark_obsidian_block 9",
  554. recipe = {
  555. {"cavestuff:dark_obsidian", "cavestuff:dark_obsidian", "cavestuff:dark_obsidian"},
  556. {"cavestuff:dark_obsidian", "cavestuff:dark_obsidian", "cavestuff:dark_obsidian"},
  557. {"cavestuff:dark_obsidian", "cavestuff:dark_obsidian", "cavestuff:dark_obsidian"},
  558. }
  559. })
  560. minetest.register_node("cavestuff:coal_dust", {
  561. description = "Coal Dust Block",
  562. tiles = {"caverealms_coal_dust.png"},
  563. groups = utility.dig_groups("sand", {falling_node = 1}),
  564. sounds = default.node_sound_gravel_defaults(),
  565. --drop = "dusts:coal 9",
  566. movement_speed_multiplier = default.SLOW_SPEED,
  567. })
  568. minetest.register_craft({
  569. output = "cavestuff:coal_dust",
  570. recipe = {
  571. {"dusts:coal", "dusts:coal", "dusts:coal"},
  572. {"dusts:coal", "default:sand", "dusts:coal"},
  573. {"dusts:coal", "dusts:coal", "dusts:coal"},
  574. },
  575. })
  576. minetest.register_node("cavestuff:salt_crystal", {
  577. description = "Salt Crystal",
  578. tiles = {"caverealms_salt_crystal.png"},
  579. groups = utility.dig_groups("crystal"),
  580. sounds = default.node_sound_gravel_defaults(),
  581. light_source = 1,
  582. paramtype = "light",
  583. use_texture_alpha = "blend",
  584. drawtype = "glasslike",
  585. sunlight_propagates = true,
  586. })
  587. local eat_mushroom = minetest.item_eat(1)
  588. local function mushroom_poison(pname, step)
  589. local msg = "# Server: <" .. rename.gpn(pname) .. "> ate a mushroom. Desperate!"
  590. hb4.delayed_harm({name=pname, step=step, min=1*500, max=3*500, msg=msg, poison=true})
  591. end
  592. minetest.register_node("cavestuff:mycena", {
  593. description = "Mycena Mushroom",
  594. tiles = {"caverealms_mycena.png"},
  595. inventory_image = "caverealms_mycena.png",
  596. wield_image = "caverealms_mycena.png",
  597. groups = utility.dig_groups("plant", {attached_node = 1, flammable = 3}),
  598. light_source = 3,
  599. paramtype = "light",
  600. drawtype = "plantlike",
  601. movement_speed_multiplier = default.SLOW_SPEED_PLANTS,
  602. walkable = false,
  603. buildable_to = true,
  604. visual_scale = 0.6,
  605. selection_box = {
  606. type = "fixed",
  607. fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
  608. },
  609. sounds = default.node_sound_leaves_defaults(),
  610. drop = "",
  611. shears_drop = true,
  612. flowerpot_drop = "cavestuff:mycena",
  613. on_use = function(itemstack, user, pointed_thing)
  614. if not user or not user:is_player() then return end
  615. minetest.after(1, mushroom_poison, user:get_player_name(), 3)
  616. return eat_mushroom(itemstack, user, pointed_thing)
  617. end,
  618. on_construct = function(...)
  619. return flowers.on_mushroom_construct(...)
  620. end,
  621. on_destruct = function(...)
  622. return flowers.on_mushroom_destruct(...)
  623. end,
  624. on_timer = function(...)
  625. return flowers.on_mushroom_timer(...)
  626. end,
  627. on_punch = function(...)
  628. return flowers.on_mushroom_punch(...)
  629. end,
  630. })
  631. minetest.register_node("cavestuff:fungus", {
  632. description = "Glowing Fungus",
  633. tiles = {"caverealms_fungi.png"},
  634. inventory_image = "caverealms_fungi.png",
  635. wield_image = "caverealms_fungi.png",
  636. groups = utility.dig_groups("plant", {attached_node = 1, flammable = 3}),
  637. light_source = 3,
  638. paramtype = "light",
  639. drawtype = "firelike",
  640. movement_speed_multiplier = default.SLOW_SPEED_PLANTS,
  641. walkable = false,
  642. buildable_to = true,
  643. selection_box = {
  644. type = "fixed",
  645. fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
  646. },
  647. sounds = default.node_sound_leaves_defaults(),
  648. drop = "",
  649. shears_drop = true,
  650. flowerpot_drop = "cavestuff:fungus",
  651. on_use = function(itemstack, user, pointed_thing)
  652. if not user or not user:is_player() then return end
  653. -- Fewer steps than the mycena, to simulate being less poisonous.
  654. minetest.after(1, mushroom_poison, user:get_player_name(), 2)
  655. return eat_mushroom(itemstack, user, pointed_thing)
  656. end,
  657. on_construct = function(...)
  658. return flowers.on_mushroom_construct(...)
  659. end,
  660. on_destruct = function(...)
  661. return flowers.on_mushroom_destruct(...)
  662. end,
  663. on_timer = function(...)
  664. return flowers.on_mushroom_timer(...)
  665. end,
  666. on_punch = function(...)
  667. return flowers.on_mushroom_punch(...)
  668. end,
  669. })
  670. minetest.register_node("cavestuff:icicle_up", {
  671. description = "Icicle",
  672. tiles = {"caverealms_icicle_up.png"},
  673. inventory_image = "caverealms_icicle_up.png",
  674. wield_image = "caverealms_icicle_up.png",
  675. groups = utility.dig_groups("bigitem", {
  676. attached_node = 1,
  677. melts = 1,
  678. }),
  679. sounds = default.node_sound_glass_defaults(),
  680. paramtype = "light",
  681. drawtype = "plantlike",
  682. movement_speed_multiplier = default.SLOW_SPEED_PLANTS,
  683. walkable = false,
  684. selection_box = {
  685. type = "fixed",
  686. fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
  687. },
  688. collision_box = {
  689. type = "fixed",
  690. fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
  691. },
  692. })
  693. minetest.register_node("cavestuff:icicle_up_glowing", {
  694. description = "Icicle With Glowing Minerals",
  695. tiles = {"caverealms_icicle_up.png"},
  696. inventory_image = "caverealms_icicle_up.png",
  697. wield_image = "caverealms_icicle_up.png",
  698. groups = utility.dig_groups("bigitem", {
  699. attached_node = 1,
  700. melts = 1,
  701. }),
  702. sounds = default.node_sound_glass_defaults(),
  703. paramtype = "light",
  704. drawtype = "plantlike",
  705. movement_speed_multiplier = default.SLOW_SPEED_PLANTS,
  706. walkable = false,
  707. light_source = 7,
  708. selection_box = {
  709. type = "fixed",
  710. fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
  711. },
  712. collision_box = {
  713. type = "fixed",
  714. fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
  715. },
  716. })
  717. minetest.register_node("cavestuff:icicle_down", {
  718. description = "Icicle",
  719. tiles = {"caverealms_icicle_down.png"},
  720. inventory_image = "caverealms_icicle_down.png",
  721. wield_image = "caverealms_icicle_down.png",
  722. groups = utility.dig_groups("bigitem", {
  723. hanging_node = 1,
  724. melts = 1,
  725. }),
  726. sounds = default.node_sound_glass_defaults(),
  727. paramtype = "light",
  728. drawtype = "plantlike",
  729. movement_speed_multiplier = default.SLOW_SPEED_PLANTS,
  730. walkable = false,
  731. selection_box = {
  732. type = "fixed",
  733. fixed = {-0.5, 5/16, -0.5, 0.5, 0.5, 0.5},
  734. },
  735. collision_box = {
  736. type = "fixed",
  737. fixed = {-0.5, 5/16, -0.5, 0.5, 0.5, 0.5},
  738. },
  739. })
  740. minetest.register_node("cavestuff:icicle_down_glowing", {
  741. description = "Icicle With Glowing Minerals",
  742. tiles = {"caverealms_icicle_down.png"},
  743. inventory_image = "caverealms_icicle_down.png",
  744. wield_image = "caverealms_icicle_down.png",
  745. groups = utility.dig_groups("bigitem", {
  746. hanging_node = 1,
  747. melts = 1,
  748. }),
  749. sounds = default.node_sound_glass_defaults(),
  750. paramtype = "light",
  751. drawtype = "plantlike",
  752. movement_speed_multiplier = default.SLOW_SPEED_PLANTS,
  753. walkable = false,
  754. light_source = 7,
  755. selection_box = {
  756. type = "fixed",
  757. fixed = {-0.5, 5/16, -0.5, 0.5, 0.5, 0.5},
  758. },
  759. collision_box = {
  760. type = "fixed",
  761. fixed = {-0.5, 5/16, -0.5, 0.5, 0.5, 0.5},
  762. },
  763. })
  764. for i=1, 4, 1 do
  765. minetest.register_node("cavestuff:bluecrystal" .. i, {
  766. description = "Moon Gem",
  767. mesh = "mese_crystal_ore" .. i .. ".obj",
  768. tiles = {"caverealms_glow_crystal.png"},
  769. paramtype = "light",
  770. paramtype2 = "facedir",
  771. drawtype = "mesh",
  772. groups = utility.dig_groups("crystal", {
  773. attached_node = 1, fall_damage_add_percent = 100,
  774. }),
  775. use_texture_alpha = "blend",
  776. sounds = default.node_sound_glass_defaults(),
  777. light_source = 5,
  778. selection_box = {
  779. type = "fixed",
  780. fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
  781. },
  782. visual_scale = 1.3,
  783. on_rotate = function(...)
  784. return screwdriver.rotate_simple(...)
  785. end,
  786. on_construct = function(pos)
  787. local node = minetest.get_node(pos)
  788. node.param2 = math_random(0, 3)
  789. minetest.swap_node(pos, node)
  790. end,
  791. on_player_walk_over = function(pos, player)
  792. utility.damage_player(player, "fleshy", (1*500), "ground")
  793. if player:get_hp() == 0 then
  794. minetest.chat_send_all("# Server: <" .. rename.gpn(player:get_player_name()) .. "> stepped on a moon spike.")
  795. end
  796. end,
  797. })
  798. end
  799. for i=1, 4, 1 do
  800. minetest.register_node("cavestuff:saltcrystal" .. i, {
  801. description = "Salt Crystal",
  802. mesh = "mese_crystal_ore" .. i .. ".obj",
  803. tiles = {"caverealms_salty.png"},
  804. paramtype = "light",
  805. paramtype2 = "facedir",
  806. drawtype = "mesh",
  807. groups = utility.dig_groups("crystal", {
  808. attached_node = 1,
  809. fall_damage_add_percent = 100,
  810. }),
  811. use_texture_alpha = "blend",
  812. sounds = default.node_sound_glass_defaults(),
  813. light_source = 5,
  814. selection_box = {
  815. type = "fixed",
  816. fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
  817. },
  818. on_rotate = function(...)
  819. return screwdriver.rotate_simple(...)
  820. end,
  821. on_construct = function(pos)
  822. local node = minetest.get_node(pos)
  823. node.param2 = math_random(0, 3)
  824. minetest.swap_node(pos, node)
  825. end,
  826. on_player_walk_over = function(pos, player)
  827. utility.damage_player(player, "fleshy", 1*500, "ground")
  828. if player:get_hp() == 0 then
  829. minetest.chat_send_all("# Server: <" .. rename.gpn(player:get_player_name()) .. "> stepped on a salt spike.")
  830. end
  831. end,
  832. })
  833. end
  834. for i=1, 4, 1 do
  835. minetest.register_node("cavestuff:spike" .. i, {
  836. description = "Rock Spike",
  837. mesh = "mese_crystal_ore" .. i .. ".obj",
  838. tiles = {"default_stone.png"},
  839. drawtype = "mesh",
  840. paramtype = "light",
  841. paramtype2 = "facedir",
  842. groups = utility.dig_groups("crystal", {
  843. attached_node = 1, fall_damage_add_percent = 100,
  844. }),
  845. sounds = default.node_sound_stone_defaults(),
  846. selection_box = {
  847. type = "fixed",
  848. fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
  849. },
  850. on_rotate = function(...)
  851. return screwdriver.rotate_simple(...)
  852. end,
  853. on_construct = function(pos)
  854. local node = minetest.get_node(pos)
  855. node.param2 = math_random(0, 3)
  856. minetest.swap_node(pos, node)
  857. end,
  858. on_player_walk_over = function(pos, player)
  859. utility.damage_player(player, "fleshy", 1*500, "ground")
  860. if player:get_hp() == 0 then
  861. minetest.chat_send_all("# Server: <" .. rename.gpn(player:get_player_name()) .. "> stepped on a rock spike.")
  862. end
  863. end,
  864. })
  865. end
  866. for i=1, 4, 1 do
  867. minetest.register_node("cavestuff:redspike" .. i, {
  868. description = "Redstone Spike",
  869. mesh = "mese_crystal_ore" .. i .. ".obj",
  870. tiles = {"default_desert_stone.png"},
  871. drawtype = "mesh",
  872. paramtype = "light",
  873. paramtype2 = "facedir",
  874. groups = utility.dig_groups("crystal", {
  875. attached_node = 1, fall_damage_add_percent = 100,
  876. }),
  877. sounds = default.node_sound_stone_defaults(),
  878. selection_box = {
  879. type = "fixed",
  880. fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
  881. },
  882. on_rotate = function(...)
  883. return screwdriver.rotate_simple(...)
  884. end,
  885. on_construct = function(pos)
  886. local node = minetest.get_node(pos)
  887. node.param2 = math_random(0, 3)
  888. minetest.swap_node(pos, node)
  889. end,
  890. on_player_walk_over = function(pos, player)
  891. utility.damage_player(player, "fleshy", 1*500, "ground")
  892. if player:get_hp() == 0 then
  893. minetest.chat_send_all("# Server: <" .. rename.gpn(player:get_player_name()) .. "> stepped on a rock spike.")
  894. end
  895. end,
  896. })
  897. end
  898. -- Special cobble type which mimics default cobble. Needed for cavegen.
  899. -- The player should not be able to obtain this nodetype directly.
  900. minetest.register_node("cavestuff:cobble", {
  901. description = "Cobblestone",
  902. tiles = {"default_cobble.png"},
  903. is_ground_content = true, -- Important!
  904. groups = utility.dig_groups("cobble", {
  905. melts = 1, cobble_type = 1,
  906. }),
  907. _melts_to = "cavestuff:cobble_with_rockmelt",
  908. drop = "default:cobble", -- Mimic default cobble.
  909. _is_bulk_mapgen_stone = true,
  910. sounds = default.node_sound_stone_defaults(),
  911. -- Common stone does not count toward tool's dig count.
  912. _toolranks = {
  913. ignore = true,
  914. },
  915. on_finish_collapse = function(pos)
  916. minetest.swap_node(pos, {name="default:cobble"})
  917. end,
  918. on_collapse_to_entity = function(pos)
  919. return {ItemStack("default:cobble")}
  920. end,
  921. })