init.lua 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963
  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. })
  390. minetest.register_craft({
  391. output = "cavestuff:glow_obsidian",
  392. type = "shapeless",
  393. recipe = {"default:obsidian", "glowstone:glowing_dust"},
  394. })
  395. stairs.register_stair_and_slab("glow_obsidian", "cavestuff:glow_obsidian",
  396. utility.dig_groups("obsidian"),
  397. {"caverealms_glow_obsidian.png"},
  398. "Luminescent Obsidian",
  399. default.node_sound_stone_defaults())
  400. minetest.register_node("cavestuff:glow_obsidian_brick", {
  401. description = "Luminescent Obsidian Brick",
  402. tiles = {"caverealms_glow_obsidian_brick.png"},
  403. groups = utility.dig_groups("brick", {
  404. immovable = 1,
  405. }),
  406. light_source = 7,
  407. sounds = default.node_sound_stone_defaults(),
  408. })
  409. minetest.register_craft({
  410. output = "cavestuff:glow_obsidian_brick",
  411. recipe = {
  412. {"cavestuff:glow_obsidian", "cavestuff:glow_obsidian"},
  413. {"cavestuff:glow_obsidian", "cavestuff:glow_obsidian"},
  414. },
  415. })
  416. stairs.register_stair_and_slab(
  417. "glow_obsidian_brick",
  418. "cavestuff:glow_obsidian_brick",
  419. utility.dig_groups("brick"),
  420. {"caverealms_glow_obsidian_brick.png"},
  421. "Luminescent Obsidian Brick",
  422. default.node_sound_stone_defaults())
  423. minetest.register_node("cavestuff:glow_obsidian_block", {
  424. description = "Luminescent Obsidian Block",
  425. tiles = {"caverealms_glow_obsidian_block.png"},
  426. groups = utility.dig_groups("block", {
  427. immovable = 1,
  428. }),
  429. light_source = 7,
  430. sounds = default.node_sound_stone_defaults(),
  431. })
  432. minetest.register_craft({
  433. output = "cavestuff:glow_obsidian_block 9",
  434. recipe = {
  435. {"cavestuff:glow_obsidian", "cavestuff:glow_obsidian", "cavestuff:glow_obsidian"},
  436. {"cavestuff:glow_obsidian", "cavestuff:glow_obsidian", "cavestuff:glow_obsidian"},
  437. {"cavestuff:glow_obsidian", "cavestuff:glow_obsidian", "cavestuff:glow_obsidian"},
  438. },
  439. })
  440. stairs.register_stair_and_slab(
  441. "glow_obsidian_block",
  442. "cavestuff:glow_obsidian_block",
  443. utility.dig_groups("block"),
  444. {"caverealms_glow_obsidian_block.png"},
  445. "Luminescent Obsidian Block",
  446. default.node_sound_stone_defaults())
  447. minetest.register_node("cavestuff:dark_obsidian", {
  448. description = "Dead Obsidian",
  449. tiles = {"technic_obsidian.png"},
  450. groups = utility.dig_groups("obsidian", {
  451. immovable = 1,
  452. }),
  453. sounds = default.node_sound_stone_defaults(),
  454. movement_speed_multiplier = default.ROAD_SPEED_CAVERN,
  455. on_blast = function(...) end, -- Blast resistant.
  456. after_destruct = function(pos)
  457. minetest.after(0, ambiance.recheck_nearby_sound_beacons, {x=pos.x, y=pos.y, z=pos.z}, 16)
  458. end,
  459. })
  460. stairs.register_stair_and_slab(
  461. "dark_obsidian",
  462. "cavestuff:dark_obsidian",
  463. utility.dig_groups("obsidian"),
  464. {"technic_obsidian.png"},
  465. "Dead Obsidian",
  466. default.node_sound_stone_defaults())
  467. minetest.register_node("cavestuff:dark_obsidian_brick", {
  468. description = "Dead Obsidian Brick",
  469. tiles = {"technic_obsidian_brick.png"},
  470. groups = utility.dig_groups("obsidian"),
  471. sounds = default.node_sound_stone_defaults(),
  472. on_blast = function(...) end, -- Blast resistant.
  473. })
  474. stairs.register_stair_and_slab(
  475. "dark_obsidian_brick",
  476. "cavestuff:dark_obsidian_brick",
  477. utility.dig_groups("obsidian"),
  478. {"technic_obsidian_brick.png"},
  479. "Dead Obsidian Brick",
  480. default.node_sound_stone_defaults())
  481. minetest.register_node("cavestuff:dark_obsidian_block", {
  482. description = "Dead Obsidian Block",
  483. tiles = {"technic_obsidian_block.png"},
  484. groups = utility.dig_groups("obsidian"),
  485. sounds = default.node_sound_stone_defaults(),
  486. on_blast = function(...) end, -- Blast resistant.
  487. })
  488. stairs.register_stair_and_slab(
  489. "dark_obsidian_block",
  490. "cavestuff:dark_obsidian_block",
  491. utility.dig_groups("obsidian"),
  492. {"technic_obsidian_block.png"},
  493. "Dead Obsidian Block",
  494. default.node_sound_stone_defaults())
  495. minetest.register_craft({
  496. output = "cavestuff:dark_obsidian_brick 4",
  497. recipe = {
  498. {"cavestuff:dark_obsidian", "cavestuff:dark_obsidian"},
  499. {"cavestuff:dark_obsidian", "cavestuff:dark_obsidian"},
  500. }
  501. })
  502. minetest.register_craft({
  503. output = "cavestuff:dark_obsidian_block 9",
  504. recipe = {
  505. {"cavestuff:dark_obsidian", "cavestuff:dark_obsidian", "cavestuff:dark_obsidian"},
  506. {"cavestuff:dark_obsidian", "cavestuff:dark_obsidian", "cavestuff:dark_obsidian"},
  507. {"cavestuff:dark_obsidian", "cavestuff:dark_obsidian", "cavestuff:dark_obsidian"},
  508. }
  509. })
  510. minetest.register_node("cavestuff:coal_dust", {
  511. description = "Coal Dust Block",
  512. tiles = {"caverealms_coal_dust.png"},
  513. groups = utility.dig_groups("sand", {falling_node = 1}),
  514. sounds = default.node_sound_gravel_defaults(),
  515. --drop = "dusts:coal 9",
  516. movement_speed_multiplier = default.SLOW_SPEED,
  517. })
  518. minetest.register_craft({
  519. output = "cavestuff:coal_dust",
  520. recipe = {
  521. {"dusts:coal", "dusts:coal", "dusts:coal"},
  522. {"dusts:coal", "default:sand", "dusts:coal"},
  523. {"dusts:coal", "dusts:coal", "dusts:coal"},
  524. },
  525. })
  526. minetest.register_node("cavestuff:salt_crystal", {
  527. description = "Salt Crystal",
  528. tiles = {"caverealms_salt_crystal.png"},
  529. groups = utility.dig_groups("crystal"),
  530. sounds = default.node_sound_gravel_defaults(),
  531. light_source = 1,
  532. paramtype = "light",
  533. use_texture_alpha = true,
  534. drawtype = "glasslike",
  535. sunlight_propagates = true,
  536. })
  537. local eat_mushroom = minetest.item_eat(1)
  538. local function mushroom_poison(pname, step)
  539. local msg = "# Server: <" .. rename.gpn(pname) .. "> ate a mushroom. Desperate!"
  540. hb4.delayed_harm({name=pname, step=step, min=1, max=3, msg=msg, poison=true})
  541. end
  542. minetest.register_node("cavestuff:mycena", {
  543. description = "Mycena Mushroom",
  544. tiles = {"caverealms_mycena.png"},
  545. inventory_image = "caverealms_mycena.png",
  546. wield_image = "caverealms_mycena.png",
  547. groups = utility.dig_groups("plant", {attached_node = 1, flammable = 3}),
  548. light_source = 3,
  549. paramtype = "light",
  550. drawtype = "plantlike",
  551. movement_speed_multiplier = default.SLOW_SPEED_PLANTS,
  552. walkable = false,
  553. buildable_to = true,
  554. visual_scale = 0.6,
  555. selection_box = {
  556. type = "fixed",
  557. fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
  558. },
  559. sounds = default.node_sound_leaves_defaults(),
  560. drop = "",
  561. shears_drop = true,
  562. flowerpot_drop = "cavestuff:mycena",
  563. on_use = function(itemstack, user, pointed_thing)
  564. if not user or not user:is_player() then return end
  565. minetest.after(1, mushroom_poison, user:get_player_name(), 3)
  566. return eat_mushroom(itemstack, user, pointed_thing)
  567. end,
  568. on_construct = function(...)
  569. return flowers.on_mushroom_construct(...)
  570. end,
  571. on_destruct = function(...)
  572. return flowers.on_mushroom_destruct(...)
  573. end,
  574. on_timer = function(...)
  575. return flowers.on_mushroom_timer(...)
  576. end,
  577. on_punch = function(...)
  578. return flowers.on_mushroom_punch(...)
  579. end,
  580. })
  581. minetest.register_node("cavestuff:fungus", {
  582. description = "Glowing Fungus",
  583. tiles = {"caverealms_fungi.png"},
  584. inventory_image = "caverealms_fungi.png",
  585. wield_image = "caverealms_fungi.png",
  586. groups = utility.dig_groups("plant", {attached_node = 1, flammable = 3}),
  587. light_source = 3,
  588. paramtype = "light",
  589. drawtype = "firelike",
  590. movement_speed_multiplier = default.SLOW_SPEED_PLANTS,
  591. walkable = false,
  592. buildable_to = true,
  593. --visual_scale = 1.0,
  594. selection_box = {
  595. type = "fixed",
  596. fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
  597. },
  598. sounds = default.node_sound_leaves_defaults(),
  599. drop = "",
  600. shears_drop = true,
  601. flowerpot_drop = "cavestuff:fungus",
  602. on_use = function(itemstack, user, pointed_thing)
  603. if not user or not user:is_player() then return end
  604. -- Fewer steps than the mycena, to simulate being less poisonous.
  605. minetest.after(1, mushroom_poison, user:get_player_name(), 2)
  606. return eat_mushroom(itemstack, user, pointed_thing)
  607. end,
  608. on_construct = function(...)
  609. return flowers.on_mushroom_construct(...)
  610. end,
  611. on_destruct = function(...)
  612. return flowers.on_mushroom_destruct(...)
  613. end,
  614. on_timer = function(...)
  615. return flowers.on_mushroom_timer(...)
  616. end,
  617. on_punch = function(...)
  618. return flowers.on_mushroom_punch(...)
  619. end,
  620. })
  621. minetest.register_node("cavestuff:icicle_up", {
  622. description = "Icicle",
  623. tiles = {"caverealms_icicle_up.png"},
  624. inventory_image = "caverealms_icicle_up.png",
  625. wield_image = "caverealms_icicle_up.png",
  626. groups = utility.dig_groups("bigitem", {
  627. attached_node = 1,
  628. melts = 1,
  629. }),
  630. sounds = default.node_sound_glass_defaults(),
  631. paramtype = "light",
  632. drawtype = "plantlike",
  633. movement_speed_multiplier = default.SLOW_SPEED_PLANTS,
  634. walkable = false,
  635. --visual_scale = 1.0,
  636. selection_box = {
  637. type = "fixed",
  638. fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
  639. },
  640. collision_box = {
  641. type = "fixed",
  642. fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
  643. },
  644. })
  645. minetest.register_node("cavestuff:icicle_up_glowing", {
  646. description = "Icicle With Glowing Minerals",
  647. tiles = {"caverealms_icicle_up.png"},
  648. inventory_image = "caverealms_icicle_up.png",
  649. wield_image = "caverealms_icicle_up.png",
  650. groups = utility.dig_groups("bigitem", {
  651. attached_node = 1,
  652. melts = 1,
  653. }),
  654. sounds = default.node_sound_glass_defaults(),
  655. paramtype = "light",
  656. drawtype = "plantlike",
  657. movement_speed_multiplier = default.SLOW_SPEED_PLANTS,
  658. walkable = false,
  659. light_source = 7,
  660. --visual_scale = 1.0,
  661. selection_box = {
  662. type = "fixed",
  663. fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
  664. },
  665. collision_box = {
  666. type = "fixed",
  667. fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
  668. },
  669. })
  670. minetest.register_node("cavestuff:icicle_down", {
  671. description = "Icicle",
  672. tiles = {"caverealms_icicle_down.png"},
  673. inventory_image = "caverealms_icicle_down.png",
  674. wield_image = "caverealms_icicle_down.png",
  675. groups = utility.dig_groups("bigitem", {
  676. hanging_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. --visual_scale = 1.0,
  685. selection_box = {
  686. type = "fixed",
  687. fixed = {-0.5, 5/16, -0.5, 0.5, 0.5, 0.5},
  688. },
  689. collision_box = {
  690. type = "fixed",
  691. fixed = {-0.5, 5/16, -0.5, 0.5, 0.5, 0.5},
  692. },
  693. })
  694. minetest.register_node("cavestuff:icicle_down_glowing", {
  695. description = "Icicle With Glowing Minerals",
  696. tiles = {"caverealms_icicle_down.png"},
  697. inventory_image = "caverealms_icicle_down.png",
  698. wield_image = "caverealms_icicle_down.png",
  699. groups = utility.dig_groups("bigitem", {
  700. hanging_node = 1,
  701. melts = 1,
  702. }),
  703. sounds = default.node_sound_glass_defaults(),
  704. paramtype = "light",
  705. drawtype = "plantlike",
  706. movement_speed_multiplier = default.SLOW_SPEED_PLANTS,
  707. walkable = false,
  708. light_source = 7,
  709. --visual_scale = 1.0,
  710. selection_box = {
  711. type = "fixed",
  712. fixed = {-0.5, 5/16, -0.5, 0.5, 0.5, 0.5},
  713. },
  714. collision_box = {
  715. type = "fixed",
  716. fixed = {-0.5, 5/16, -0.5, 0.5, 0.5, 0.5},
  717. },
  718. })
  719. for i=1, 4, 1 do
  720. minetest.register_node("cavestuff:bluecrystal" .. i, {
  721. description = "Moon Gem",
  722. mesh = "mese_crystal_ore" .. i .. ".obj",
  723. tiles = {"caverealms_glow_crystal.png"},
  724. paramtype = "light",
  725. paramtype2 = "facedir",
  726. drawtype = "mesh",
  727. groups = utility.dig_groups("crystal", {
  728. attached_node = 1, fall_damage_add_percent = 100,
  729. }),
  730. use_texture_alpha = true,
  731. sounds = default.node_sound_glass_defaults(),
  732. light_source = 5,
  733. selection_box = {
  734. type = "fixed",
  735. fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
  736. },
  737. visual_scale = 1.3,
  738. on_rotate = function(...)
  739. return screwdriver.rotate_simple(...)
  740. end,
  741. on_construct = function(pos)
  742. local node = minetest.get_node(pos)
  743. node.param2 = math_random(0, 3)
  744. minetest.swap_node(pos, node)
  745. end,
  746. on_player_walk_over = function(pos, player)
  747. player:set_hp(player:get_hp() - 1)
  748. if player:get_hp() == 0 then
  749. minetest.chat_send_all("# Server: <" .. rename.gpn(player:get_player_name()) .. "> stepped on a moon spike.")
  750. end
  751. end,
  752. })
  753. end
  754. for i=1, 4, 1 do
  755. minetest.register_node("cavestuff:saltcrystal" .. i, {
  756. description = "Salt Crystal",
  757. mesh = "mese_crystal_ore" .. i .. ".obj",
  758. tiles = {"caverealms_salty.png"},
  759. paramtype = "light",
  760. paramtype2 = "facedir",
  761. drawtype = "mesh",
  762. groups = utility.dig_groups("crystal", {
  763. attached_node = 1,
  764. fall_damage_add_percent = 100,
  765. }),
  766. use_texture_alpha = true,
  767. sounds = default.node_sound_glass_defaults(),
  768. light_source = 5,
  769. selection_box = {
  770. type = "fixed",
  771. fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
  772. },
  773. on_rotate = function(...)
  774. return screwdriver.rotate_simple(...)
  775. end,
  776. on_construct = function(pos)
  777. local node = minetest.get_node(pos)
  778. node.param2 = math_random(0, 3)
  779. minetest.swap_node(pos, node)
  780. end,
  781. on_player_walk_over = function(pos, player)
  782. player:set_hp(player:get_hp() - 1)
  783. if player:get_hp() == 0 then
  784. minetest.chat_send_all("# Server: <" .. rename.gpn(player:get_player_name()) .. "> stepped on a salt spike.")
  785. end
  786. end,
  787. })
  788. end
  789. for i=1, 4, 1 do
  790. minetest.register_node("cavestuff:spike" .. i, {
  791. description = "Rock Spike",
  792. mesh = "mese_crystal_ore" .. i .. ".obj",
  793. tiles = {"default_stone.png"},
  794. drawtype = "mesh",
  795. paramtype = "light",
  796. paramtype2 = "facedir",
  797. groups = utility.dig_groups("crystal", {
  798. attached_node = 1, fall_damage_add_percent = 100,
  799. }),
  800. sounds = default.node_sound_stone_defaults(),
  801. selection_box = {
  802. type = "fixed",
  803. fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
  804. },
  805. on_rotate = function(...)
  806. return screwdriver.rotate_simple(...)
  807. end,
  808. on_construct = function(pos)
  809. local node = minetest.get_node(pos)
  810. node.param2 = math_random(0, 3)
  811. minetest.swap_node(pos, node)
  812. end,
  813. on_player_walk_over = function(pos, player)
  814. player:set_hp(player:get_hp() - 1)
  815. if player:get_hp() == 0 then
  816. minetest.chat_send_all("# Server: <" .. rename.gpn(player:get_player_name()) .. "> stepped on a rock spike.")
  817. end
  818. end,
  819. })
  820. end
  821. for i=1, 4, 1 do
  822. minetest.register_node("cavestuff:redspike" .. i, {
  823. description = "Redstone Spike",
  824. mesh = "mese_crystal_ore" .. i .. ".obj",
  825. tiles = {"default_desert_stone.png"},
  826. drawtype = "mesh",
  827. paramtype = "light",
  828. paramtype2 = "facedir",
  829. groups = utility.dig_groups("crystal", {
  830. attached_node = 1, fall_damage_add_percent = 100,
  831. }),
  832. sounds = default.node_sound_stone_defaults(),
  833. selection_box = {
  834. type = "fixed",
  835. fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
  836. },
  837. on_rotate = function(...)
  838. return screwdriver.rotate_simple(...)
  839. end,
  840. on_construct = function(pos)
  841. local node = minetest.get_node(pos)
  842. node.param2 = math_random(0, 3)
  843. minetest.swap_node(pos, node)
  844. end,
  845. on_player_walk_over = function(pos, player)
  846. player:set_hp(player:get_hp() - 1)
  847. if player:get_hp() == 0 then
  848. minetest.chat_send_all("# Server: <" .. rename.gpn(player:get_player_name()) .. "> stepped on a rock spike.")
  849. end
  850. end,
  851. })
  852. end
  853. -- Special cobble type which mimics default cobble. Needed for cavegen.
  854. -- The player should not be able to obtain this nodetype directly.
  855. minetest.register_node("cavestuff:cobble", {
  856. description = "Cobblestone",
  857. tiles = {"default_cobble.png"},
  858. is_ground_content = true, -- Important!
  859. groups = utility.dig_groups("cobble", {
  860. melts = 1, cobble_type = 1,
  861. }),
  862. _melts_to = "cavestuff:cobble_with_rockmelt",
  863. drop = "default:cobble", -- Mimic default cobble.
  864. sounds = default.node_sound_stone_defaults(),
  865. -- Common stone does not count toward tool's dig count.
  866. _toolranks = {
  867. ignore = true,
  868. },
  869. })