forked from HeroOfTheWinds/minetest-caverealms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nodes.lua
592 lines (542 loc) · 16.4 KB
/
nodes.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
-- internationalization boilerplate
local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua")
--NODES--
local FALLING_ICICLES = caverealms.config.falling_icicles --true --toggle to turn on or off falling icicles in glaciated biome
local FALLCHA = caverealms.config.fallcha --0.33 --chance of causing the structure to fall
local DM_TOP = caverealms.config.dm_top -- -4000 --level at which Dungeon Master Realms start to appear
--glowing crystal
minetest.register_node("caverealms:glow_crystal", {
description = S("Glow Crystal"),
tiles = {"caverealms_glow_crystal.png"},
is_ground_content = true,
groups = {cracky=3},
sounds = default.node_sound_glass_defaults(),
light_source = 13,
paramtype = "light",
use_texture_alpha = true,
drawtype = "glasslike",
sunlight_propagates = true,
})
--glowing emerald
minetest.register_node("caverealms:glow_emerald", {
description = S("Glow Emerald"),
tiles = {"caverealms_glow_emerald.png"},
is_ground_content = true,
groups = {cracky=3},
sounds = default.node_sound_glass_defaults(),
light_source = 13,
paramtype = "light",
use_texture_alpha = true,
drawtype = "glasslike",
sunlight_propagates = true,
})
--glowing mese crystal blocks
minetest.register_node("caverealms:glow_mese", {
description = S("Mese Crystal Block"),
tiles = {"caverealms_glow_mese.png"},
is_ground_content = true,
groups = {cracky=3},
sounds = default.node_sound_glass_defaults(),
light_source = 13,
paramtype = "light",
use_texture_alpha = true,
drawtype = "glasslike",
sunlight_propagates = true,
})
--glowing ruby
minetest.register_node("caverealms:glow_ruby", {
description = S("Glow Ruby"),
tiles = {"caverealms_glow_ruby.png"},
is_ground_content = true,
groups = {cracky=3},
sounds = default.node_sound_glass_defaults(),
light_source = 13,
paramtype = "light",
use_texture_alpha = true,
drawtype = "glasslike",
sunlight_propagates = true,
})
--glowing amethyst
minetest.register_node("caverealms:glow_amethyst", {
description = S("Glow Amethyst"),
tiles = {"caverealms_glow_amethyst.png"},
is_ground_content = true,
groups = {cracky=3},
sounds = default.node_sound_glass_defaults(),
light_source = 13,
paramtype = "light",
use_texture_alpha = true,
drawtype = "glasslike",
sunlight_propagates = true,
})
--embedded crystal
minetest.register_node("caverealms:glow_ore", {
description = S("Glow Crystal Ore"),
tiles = {"caverealms_glow_ore.png"},
is_ground_content = true,
groups = {cracky=2},
sounds = default.node_sound_glass_defaults(),
light_source = 10,
paramtype = "light",
})
--embedded emerald
minetest.register_node("caverealms:glow_emerald_ore", {
description = S("Glow Emerald Ore"),
tiles = {"caverealms_glow_emerald_ore.png"},
is_ground_content = true,
groups = {cracky=2},
sounds = default.node_sound_glass_defaults(),
light_source = 10,
paramtype = "light",
})
--embedded ruby
minetest.register_node("caverealms:glow_ruby_ore", {
description = S("Glow Ruby Ore"),
tiles = {"caverealms_glow_ruby_ore.png"},
is_ground_content = true,
groups = {cracky=2},
sounds = default.node_sound_glass_defaults(),
light_source = 10,
paramtype = "light",
})
--embedded amethyst
minetest.register_node("caverealms:glow_amethyst_ore", {
description = S("Glow Amethyst Ore"),
tiles = {"caverealms_glow_amethyst_ore.png"},
is_ground_content = true,
groups = {cracky=2},
sounds = default.node_sound_glass_defaults(),
light_source = 10,
paramtype = "light",
})
--thin (transparent) ice
minetest.register_node("caverealms:thin_ice", {
description = S("Thin Ice"),
tiles = {"caverealms_thin_ice.png"},
is_ground_content = true,
groups = {cracky=3, puts_out_fire = 1, cools_lava = 1, slippery = 3},
sounds = default.node_sound_glass_defaults(),
use_texture_alpha = true,
drawtype = "glasslike",
sunlight_propagates = true,
freezemelt = "default:water_source",
paramtype = "light",
})
--salt crystal
minetest.register_node("caverealms:salt_crystal", {
description = S("Salt Crystal"),
tiles = {"caverealms_salt_crystal.png"},
is_ground_content = true,
groups = {cracky=3},
sounds = default.node_sound_glass_defaults(),
light_source = 11,
paramtype = "light",
use_texture_alpha = true,
drawtype = "glasslike",
sunlight_propagates = true,
})
--alternate version for stalactites
minetest.register_node("caverealms:hanging_thin_ice", {
description = S("Thin Ice"),
tiles = {"caverealms_thin_ice.png"},
is_ground_content = true,
groups = {cracky=3, puts_out_fire = 1, cools_lava = 1, slippery = 3},
sounds = default.node_sound_glass_defaults(),
use_texture_alpha = true,
drawtype = "glasslike",
sunlight_propagates = true,
drop = "caverealms:thin_ice",
freezemelt = "default:water_flowing",
paramtype = "light",
after_dig_node = function(pos, oldnode, oldmetadata, digger)
if FALLING_ICICLES then
if math.random() <= FALLCHA then
obj = minetest.add_entity(pos, "caverealms:falling_ice")
obj:get_luaentity():set_node(oldnode)
for y = -13, 13 do
for x = -3, 3 do
for z = -3, 3 do
local npos = {x=pos.x+x, y=pos.y+y, z=pos.z+z}
if minetest.get_node(npos).name == "caverealms:hanging_thin_ice" then
nobj = minetest.add_entity(npos, "caverealms:falling_ice")
nobj:get_luaentity():set_node(oldnode)
minetest.remove_node(npos)
end
end
end
end
minetest.remove_node(pos)
else
return 1
end
else
return 1
end
end,
})
--glowing crystal gem
local glow_gem_size = { 1.0, 1.2, 1.4, 1.6, 1.7 }
for i in ipairs(glow_gem_size) do
if i == 1 then
nodename = "caverealms:glow_gem"
else
nodename = "caverealms:glow_gem_"..i
end
vs = glow_gem_size[i]
minetest.register_node(nodename, {
description = S("Glow Gem"),
tiles = {"caverealms_glow_gem.png"},
inventory_image = "caverealms_glow_gem.png",
wield_image = "caverealms_glow_gem.png",
is_ground_content = true,
groups = {cracky=3, oddly_breakable_by_hand=1},
sounds = default.node_sound_glass_defaults(),
light_source = 11,
paramtype = "light",
drawtype = "plantlike",
walkable = false,
buildable_to = true,
visual_scale = vs,
selection_box = {
type = "fixed",
fixed = {-0.5*vs, -0.5*vs, -0.5*vs, 0.5*vs, -5/16*vs, 0.5*vs},
}
})
end
--glowing salt gem
local salt_gem_size = { 1.0, 1.2, 1.4, 1.6, 1.7 }
for i in ipairs(salt_gem_size) do
if i == 1 then
nodename = "caverealms:salt_gem"
else
nodename = "caverealms:salt_gem_"..i
end
vs = salt_gem_size[i]
minetest.register_node(nodename, {
description = S("Salt Gem"),
tiles = {"caverealms_salt_gem.png"},
inventory_image = "caverealms_salt_gem.png",
wield_image = "caverealms_salt_gem.png",
is_ground_content = true,
groups = {cracky=3, oddly_breakable_by_hand=1},
sounds = default.node_sound_glass_defaults(),
light_source = 11,
paramtype = "light",
drawtype = "plantlike",
walkable = false,
buildable_to = true,
visual_scale = vs,
selection_box = {
type = "fixed",
fixed = {-0.5*vs, -0.5*vs, -0.5*vs, 0.5*vs, -5/16*vs, 0.5*vs},
}
})
end
--stone spike
local spike_size = { 1.0, 1.2, 1.4, 1.6, 1.7 }
for i in ipairs(spike_size) do
if i == 1 then
nodename = "caverealms:spike"
else
nodename = "caverealms:spike_"..i
end
vs = spike_size[i]
minetest.register_node(nodename, {
description = S("Stone Spike"),
tiles = {"caverealms_spike.png"},
inventory_image = "caverealms_spike.png",
wield_image = "caverealms_spike.png",
is_ground_content = true,
groups = {cracky=3, oddly_breakable_by_hand=1},
sounds = default.node_sound_stone_defaults(),
light_source = 3,
paramtype = "light",
drawtype = "plantlike",
walkable = false,
buildable_to = true,
visual_scale = vs,
selection_box = {
type = "fixed",
fixed = {-0.5*vs, -0.5*vs, -0.5*vs, 0.5*vs, -5/16*vs, 0.5*vs},
}
})
end
--upward pointing icicle
minetest.register_node("caverealms:icicle_up", {
description = S("Icicle"),
tiles = {"caverealms_icicle_up.png"},
inventory_image = "caverealms_icicle_up.png",
wield_image = "caverealms_icicle_up.png",
is_ground_content = true,
groups = {cracky=3, oddly_breakable_by_hand=1},
sounds = default.node_sound_glass_defaults(),
light_source = 8,
paramtype = "light",
drawtype = "plantlike",
walkable = false,
buildable_to = true,
visual_scale = 1.0,
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
},
})
--downward pointing icicle
minetest.register_node("caverealms:icicle_down", {
description = S("Icicle"),
tiles = {"caverealms_icicle_down.png"},
inventory_image = "caverealms_icicle_down.png",
wield_image = "caverealms_icicle_down.png",
is_ground_content = true,
groups = {cracky=3, oddly_breakable_by_hand=1},
sounds = default.node_sound_glass_defaults(),
light_source = 8,
paramtype = "light",
drawtype = "plantlike",
walkable = false,
buildable_to = true,
visual_scale = 1.0,
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
},
})
--cave mossy cobble - bluish?
minetest.register_node("caverealms:stone_with_moss", {
description = S("Cave Stone with Moss"),
tiles = {"default_cobble.png^caverealms_moss.png", "default_cobble.png", "default_cobble.png^caverealms_moss_side.png"},
is_ground_content = true,
groups = {crumbly=3},
drop = 'default:cobble',
sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.25},
}),
})
--cave lichen-covered cobble - purple-ish
minetest.register_node("caverealms:stone_with_lichen", {
description = S("Cave Stone with Lichen"),
tiles = {"default_cobble.png^caverealms_lichen.png", "default_cobble.png", "default_cobble.png^caverealms_lichen_side.png"},
is_ground_content = true,
groups = {crumbly=3},
drop = 'default:cobble',
sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.25},
}),
})
--cave algae-covered cobble - yellow-ish
minetest.register_node("caverealms:stone_with_algae", {
description = S("Cave Stone with Algae"),
tiles = {"default_cobble.png^caverealms_algae.png", "default_cobble.png", "default_cobble.png^caverealms_algae_side.png"},
is_ground_content = true,
groups = {crumbly=3},
drop = 'default:cobble',
sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.25},
}),
})
--tiny-salt-crystal-covered cobble - pink-ish
minetest.register_node("caverealms:stone_with_salt", {
description = S("Cave Stone with Salt"),
tiles = {"caverealms_salty2.png"},--{"caverealms_salty2.png^caverealms_salty.png", "caverealms_salty2.png", "caverealms_salty2.png^caverealms_salty_side.png"},
light_source = 9,
paramtype = "light",
use_texture_alpha = true,
drawtype = "glasslike",
sunlight_propagates = true,
is_ground_content = true,
groups = {crumbly=3},
sounds = default.node_sound_glass_defaults(),
})
--Hot Cobble - cobble with lava instead of mortar XD
minetest.register_node("caverealms:hot_cobble", {
description = S("Hot Cobble"),
tiles = {"caverealms_hot_cobble.png"},
is_ground_content = true,
groups = {crumbly=2, hot=1},
damage_per_second = 1,
light_source = 3,
sounds = default.node_sound_stone_defaults({
footstep = {name="default_stone_footstep", gain=0.25},
}),
})
--Glow Obsidian
minetest.register_node("caverealms:glow_obsidian", {
description = S("Glowing Obsidian"),
tiles = {"caverealms_glow_obsidian.png"},
is_ground_content = true,
groups = {crumbly=1},
light_source = 7,
sounds = default.node_sound_stone_defaults({
footstep = {name="default_stone_footstep", gain=0.25},
}),
})
--Glow Obsidian 2 - has traces of lava
minetest.register_node("caverealms:glow_obsidian_2", {
description = S("Hot Glow Obsidian"),
tiles = {"caverealms_glow_obsidian2.png"},
is_ground_content = true,
groups = {crumbly=1, hot=1},
damage_per_second = 1,
light_source = 9,
sounds = default.node_sound_stone_defaults({
footstep = {name="default_stone_footstep", gain=0.25},
}),
})
--Coal Dust
minetest.register_node("caverealms:coal_dust", {
description = S("Coal Dust"),
tiles = {"caverealms_coal_dust.png"},
is_ground_content = true,
groups = {crumbly=3, falling_node=1, sand=1},
sounds = default.node_sound_sand_defaults(),
})
--glow worms
minetest.register_node("caverealms:glow_worm", {
description = S("Glow Worms"),
tiles = {"caverealms_glow_worm.png"},
inventory_image = "caverealms_glow_worm.png",
wield_image = "caverealms_glow_worm.png",
is_ground_content = true,
groups = {oddly_breakable_by_hand=3},
light_source = 9,
paramtype = "light",
drawtype = "plantlike",
walkable = false,
buildable_to = true,
visual_scale = 1.0,
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -0.5, 0.5},
},
})
--cave plants go here
--glowing fungi
minetest.register_node("caverealms:fungus", {
description = S("Glowing Fungus"),
tiles = {"caverealms_fungi.png"},
inventory_image = "caverealms_fungi.png",
wield_image = "caverealms_fungi.png",
is_ground_content = true,
groups = {oddly_breakable_by_hand=3, flammable = 1},
light_source = 5,
paramtype = "light",
drawtype = "plantlike",
walkable = false,
buildable_to = true,
visual_scale = 1.0,
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
},
})
--mycena mushroom
minetest.register_node("caverealms:mycena", {
description = S("Mycena Mushroom"),
tiles = {"caverealms_mycena.png"},
inventory_image = "caverealms_mycena.png",
wield_image = "caverealms_mycena.png",
is_ground_content = true,
groups = {oddly_breakable_by_hand=3, flammable = 1},
light_source = 6,
paramtype = "light",
drawtype = "plantlike",
walkable = false,
buildable_to = true,
visual_scale = 1.0,
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
},
})
--giant mushroom
--stem
minetest.register_node("caverealms:mushroom_stem", {
description = S("Giant Mushroom Stem"),
tiles = {"caverealms_mushroom_stem.png"},
is_ground_content = true,
groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
sounds = default.node_sound_wood_defaults(),
})
--cap
minetest.register_node("caverealms:mushroom_cap", {
description = S("Giant Mushroom Cap"),
tiles = {"caverealms_mushroom_cap.png"},
is_ground_content = true,
groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2},
sounds = default.node_sound_wood_defaults(),
})
--gills
minetest.register_node("caverealms:mushroom_gills", {
description = S("Giant Mushroom Gills"),
tiles = {"caverealms_mushroom_gills.png"},
is_ground_content = true,
groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1},
sounds = default.node_sound_leaves_defaults(),
drawtype = "plantlike",
paramtype = "light",
})
--define special flame so that it does not expire
minetest.register_alias("caverealms:constant_flame", "fire:permanent_flame")
--node to create a treasure chest in DM Forts.
minetest.register_node("caverealms:s_chest", {
description = "Treasure chest placement block",
tiles = {"default_chest_front.png"},
paramtype2 = "facedir",
groups = {choppy=3,oddly_breakable_by_hand=2,cavechest=1, not_in_creative_inventory=1},
after_dig_node = function(pos, oldnode, oldmetadata, digger)
if pos.y > DM_TOP then
minetest.remove_node(pos)
end
end,
})
--hacky schematic placers
minetest.register_node("caverealms:s_fountain", {
description = "Fountain placement block",
tiles = {"caverealms_stone_eyes.png"},
groups = {crumbly=3, schema=1, not_in_creative_inventory=1},
after_dig_node = function(pos, oldnode, oldmetadata, digger)
if pos.y > DM_TOP then
minetest.remove_node(pos)
end
end,
})
minetest.register_node("caverealms:s_fortress", {
description = "Fortress placement block",
tiles = {"caverealms_stone_eyes.png"},
groups = {crumbly=3, schema=1, not_in_creative_inventory=1},
after_dig_node = function(pos, oldnode, oldmetadata, digger)
if pos.y > DM_TOP then
minetest.remove_node(pos)
end
end,
})
--dungeon master statue (nodebox)
minetest.register_node("caverealms:dm_statue", {
tiles = {
"caverealms_dm_stone.png",
"caverealms_dm_stone.png",
"caverealms_dm_stone.png",
"caverealms_dm_stone.png",
"caverealms_dm_stone.png",
"caverealms_stone_eyes.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky=2},
node_box = {
type = "fixed",
fixed = {
{-0.4375, -0.5, -0.4375, 0.4375, -0.3125, 0.4375}, -- NodeBox1
{-0.25, -0.125, -0.1875, 0.25, 0.5, 0.1875}, -- NodeBox2
{-0.375, 0, -0.125, -0.25, 0.4375, 0.125}, -- NodeBox3
{0.25, 0.125, -0.4375, 0.375, 0.375, 0.1875}, -- NodeBox4
{-0.25, -0.5, -0.125, -0.125, -0.125, 0.125}, -- NodeBox5
{0.125, -0.3125, -0.125, 0.25, 0, 0.125}, -- NodeBox6
}
},
selection_box = {
type = "regular"
}
})