init.lua 26 KB

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