forked from oilboi/Crafter-Minetest
/
nodes.lua
774 lines (726 loc) · 23.6 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
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
local pairs = pairs
local register_node = minetest.register_node
local register_on_placenode = minetest.register_on_placenode
local register_chatcommand = minetest.register_chatcommand
local set_node = minetest.set_node
local get_node = minetest.get_node
local get_node_timer = minetest.get_node_timer
local after = minetest.after
local sound_play = minetest.sound_play
local find_node_near = minetest.find_node_near
local get_meta = minetest.get_meta
local get_objects_inside_radius = minetest.get_objects_inside_radius
local find_nodes_in_area_under_air = minetest.find_nodes_in_area_under_air
local registered_nodes = minetest.registered_nodes
local get_player_by_name = minetest.get_player_by_name
local bulk_set_node = minetest.bulk_set_node
local item_place_node = minetest.item_place_node
local item_place = minetest.item_place
local get_dig_params = minetest.get_dig_params
local node_dig = minetest.node_dig
local add_particlespawner = minetest.add_particlespawner
local remove_node = minetest.remove_node
local dir_to_wallmounted = minetest.dir_to_wallmounted
local math_floor = math.floor
local math_random = math.random
local vec_add = vector.add
local vec_new = vector.new
local vec_subtract = vector.subtract
local vec_direction = vector.direction
--ore def with required tool
local tool = {"main:woodpick","main:coalpick","main:stonepick","main:ironpick","main:lapispick","main:goldpick","main:diamondpick","main:emeraldpick","main:sapphirepick","main:rubypick"}
local ores = {
["coal"]={"main:woodpick","main:coalpick","main:stonepick","main:ironpick","main:lapispick","main:goldpick","main:diamondpick","main:emeraldpick","main:sapphirepick","main:rubypick"},
["iron"]={"main:coalpick","main:stonepick","main:ironpick","main:lapispick","main:goldpick","main:diamondpick","main:emeraldpick","main:sapphirepick","main:rubypick"},
["lapis"]={"main:ironpick","main:lapispick","main:goldpick","main:diamondpick","main:emeraldpick","main:sapphirepick","main:rubypick"},
["gold"]={"main:ironpick","main:lapispick","main:goldpick","main:diamondpick","main:emeraldpick","main:sapphirepick","main:rubypick"},
["diamond"]={"main:ironpick","main:lapispick","main:diamondpick","main:emeraldpick","main:sapphirepick","main:rubypick"},
["emerald"]={"main:diamondpick","main:emeraldpick","main:sapphirepick","main:rubypick"},
["sapphire"]={"main:diamondpick","main:emeraldpick","main:sapphirepick","main:rubypick"},
["ruby"]={"main:diamondpick","main:emeraldpick","main:sapphirepick","main:rubypick"},
}
local drops ={
["coal"]={"main:coal"},
["iron"]={"main:ironore"},
["lapis"]={"main:lapis"},
["gold"]={"main:goldore"},
["diamond"]={"main:diamond"},
["emerald"]={"main:emerald"},
["sapphire"]={"main:sapphire"},
["ruby"]={"main:ruby"},
}
local levels = {
["coal"]=1,
["iron"]=2,
["lapis"]=3,
["gold"]=3,
["diamond"]=4,
["emerald"]=5,
["sapphire"]=6,
["ruby"]=7,
}
local level = 0
local experience
for ore,tool_required in pairs(ores) do
level = levels[ore]
if ore == "iron" or ore == "gold" then
experience = 0
else
experience = level
end
register_node("main:"..ore.."block", {
description = ore:gsub("^%l", string.upper).." Block",
tiles = {ore.."block.png"},
groups = {stone = level, pathable = 1},
sounds = main.stoneSound(),
--light_source = 14,--debugging ore spawn
drop = {
max_items = 1,
items= {
{
rarity = 0,
tools = tool_required,
items = {"main:"..ore.."block"},
},
},
},
})
register_node("main:"..ore.."ore", {
description = ore:gsub("^%l", string.upper).." Ore",
tiles = {"stone.png^"..ore.."ore.png"},
groups = {stone = level, pathable = 1,experience=experience},
sounds = main.stoneSound(),
--light_source = 14,--debugging ore spawn
drop = {
max_items = 1,
items= {
{
rarity = 0,
tools = tool_required,
items = drops[ore],
},
},
},
})
register_node(":nether:"..ore.."ore", {
description = "Nether "..ore:gsub("^%l", string.upper).." Ore",
tiles = {"netherrack.png^"..ore.."ore.png"},
groups = {netherrack = level, pathable = 1, experience = experience},
sounds = main.stoneSound(),
light_source = 7,
drop = {
max_items = 1,
items= {
{
rarity = 0,
tools = tool_required,
items = drops[ore],
},
},
},
after_destruct = function(pos, oldnode)
if math_random() > 0.95 then
sound_play("tnt_ignite",{pos=pos,max_hear_distance=64})
after(1.5, function(pos)
tnt(pos,5)
end,pos)
end
end,
})
end
register_node("main:stone", {
description = "Stone",
tiles = {"stone.png"},
groups = {stone = 1, hand = 1,pathable = 1},
sounds = main.stoneSound(),
drop = {
max_items = 1,
items= {
{
rarity = 0,
tools = tool,
items = {"main:cobble"},
},
},
},
})
local function is_number_whole(input)
return math_floor(input) == input
end
local function is_vec_whole(input)
return is_number_whole(input.x) and is_number_whole(input.y) and is_number_whole(input.z)
end
register_node("main:cobble", {
description = "Cobblestone",
tiles = {"cobble.png"},
groups = {stone = 1, pathable = 1},
sounds = main.stoneSound(),
drop = {
max_items = 1,
items= {
{
rarity = 0,
tools = tool,
items = {"main:cobble"},
},
},
},
-- Makes cobblestone generators able to be continuously mined
on_destruct = function(pos)
local meta = get_meta(pos)
if meta:get_int("lava_cooled") == 1 then
local lava = find_node_near(pos, 1, {"main:lavaflow", "main:lava"})
local water = find_node_near(pos, 1, {"main:waterflow", "main:water"})
if lava and water then
local dir1 = is_vec_whole(vec_direction(pos, lava))
local dir2 = is_vec_whole(vec_direction(pos, water))
-- Brute force override the abm
if dir1 and dir2 then
after(0.15, function()
set_node(pos, {name="main:cobble"})
get_meta(pos):set_int("lava_cooled", 1)
end)
-- Moves the item out of the way of the lava to avoid annoying item destruction
for _,object in ipairs(get_objects_inside_radius(pos, 0.25)) do
if not object:is_player() then
local lua_entity = object:get_luaentity()
if lua_entity and lua_entity.itemstring and lua_entity.itemstring == "main:cobble" then
local new_pos = vec_new(pos)
new_pos.y = new_pos.y + 0.55
object:set_pos(new_pos)
end
end
end
end
end
end
end
})
register_node("main:mossy_cobble", {
description = "Mossy Cobblestone",
tiles = {"mossy_cobble.png"},
groups = {stone = 1, pathable = 1},
sounds = main.stoneSound(),
drop = {
max_items = 1,
items= {
{
rarity = 0,
tools = tool,
items = {"main:mossy_cobble"},
},
},
},
})
register_node("main:glass", {
description = "Glass",
tiles = {"glass.png"},
drawtype = "glasslike",
paramtype = "light",
sunlight_propagates = true,
is_ground_content = false,
groups = {glass = 1, pathable = 1},
sounds = main.stoneSound({
footstep = {name = "glass_footstep", gain = 0.4},
dug = {name = "break_glass", gain = 0.4},
}),
drop = "",
})
register_node("main:ice", {
description = "Ice",
tiles = {"ice.png"},
drawtype = "normal",
paramtype = "light",
sunlight_propagates = true,
is_ground_content = false,
groups = {glass = 1, pathable = 1,slippery=3},
sounds = main.stoneSound({
footstep = {name = "glass_footstep", gain = 0.4},
dug = {name = "break_glass", gain = 0.4},
}),
--use_texture_alpha = false,
--alpha = 100,
drop = "",
after_destruct = function(pos, oldnode)
set_node(pos, {name="main:water"})
end
})
register_node("main:ice_mapgen", {
description = "Ice",
tiles = {"ice.png"},
drawtype = "normal",
sunlight_propagates = true,
is_ground_content = false,
groups = {glass = 1, pathable = 1,slippery=3},
sounds = main.stoneSound({
footstep = {name = "glass_footstep", gain = 0.4},
dug = {name = "break_glass", gain = 0.4},
}),
use_texture_alpha = false,
drop = "",
})
local grass_react_min = 10
local grass_react_max = 120
local function get_grass_spread_timer()
return math_random(grass_react_min,grass_react_max) + math_random()
end
local function found_grass(pos)
return find_node_near(pos, 1, {"main:grass"}) ~= nil
end
local function dispatch_timers(pos)
for _,new_position in ipairs(find_nodes_in_area_under_air(vec_add(pos, -1), vec_add(pos, 1), {"main:dirt"})) do
local timer = get_node_timer(new_position)
if timer:is_started() then goto continue end
timer:start(get_grass_spread_timer())
::continue::
end
end
register_node("main:dirt", {
description = "Dirt",
tiles = {"dirt.png"},
groups = {dirt = 1, soil=1,pathable = 1, farm_tillable=1},
sounds = main.dirtSound(),
paramtype = "light",
on_construct = function(pos)
get_node_timer(pos):start(get_grass_spread_timer())
end,
after_destruct = function(pos)
dispatch_timers(pos)
end,
on_timer = function(pos)
if not found_grass(pos) then return end
if registered_nodes[get_node(vec_new(pos.x, pos.y+1,pos.z)).name].drawtype == "normal" then return end
set_node(pos, {name="main:grass"})
end
})
register_node("main:grass", {
description = "Grass",
tiles = {"grass.png"},
groups = {grass = 1, soil=1,pathable = 1, farm_tillable=1},
sounds = main.dirtSound(),
drop="main:dirt",
after_destruct = function(pos)
dispatch_timers(pos)
end,
on_timer = function(pos)
-- Grass dies when covered
if registered_nodes[get_node(vec_new(pos.x, pos.y+1,pos.z)).name].drawtype ~= "normal" then return end
set_node(pos, {name = "main:dirt"})
end
})
-- Turns grass back into dirt when covered
register_on_placenode(function(pos,newnode)
if not registered_nodes[newnode.name].drawtype == "normal" then return end
pos.y = pos.y - 1
if get_node(pos).name ~= "main:grass" then return end
local timer = get_node_timer(pos)
if timer:is_started() then return end
timer:start(get_grass_spread_timer() / 2)
end)
register_chatcommand("dirt", {
params = "<mob>",
description = "Debug for pushing falling entities to the extreme",
privs = {server = true},
func = function(name)
local player = get_player_by_name(name)
local pos = player:get_pos()
local queue = {}
for x = -120,120 do
for z = -120,120 do
table.insert(queue, vec_add(pos, vec_new(x,0,z)))
end
end
bulk_set_node(queue, {name = "main:dirt"})
end,
})
register_node("main:sand", {
description = "Sand",
tiles = {"sand.png"},
groups = {sand = 1, falling_node = 1,pathable = 1,soil=1},
sounds = main.sandSound(),
})
register_node("main:gravel", {
description = "Gravel",
tiles = {"gravel.png"},
groups = {sand = 1, falling_node = 1,pathable = 1},
sounds = main.dirtSound(),
drop = {
max_items = 1,
items= {
{
rarity = 10,
items = {"main:flint"},
},
{
rarity = 0,
items = {"main:gravel"},
},
}},
})
local acceptable_soil = {
["main:dirt"] = true,
["main:grass"] = true,
["aether:dirt"] = true,
["aether:grass"] = true,
}
register_node("main:tree", {
description = "Tree",
tiles = {"treeCore.png","treeCore.png","treeOut.png","treeOut.png","treeOut.png","treeOut.png"},
groups = {wood = 1, tree = 1, pathable = 1, flammable=1},
sounds = main.woodSound(),
--set metadata so treecapitator doesn't destroy houses
on_place = function(itemstack, placer, pointed_thing)
if not pointed_thing.type == "node" then
return
end
local sneak = placer:get_player_control().sneak
local noddef = registered_nodes[get_node(pointed_thing.under).name]
if not sneak and noddef.on_rightclick then
item_place(itemstack, placer, pointed_thing)
return
end
local pos = pointed_thing.above
item_place_node(itemstack, placer, pointed_thing)
local meta = get_meta(pos)
meta:set_string("placed", "true")
return(itemstack)
end,
--treecapitator - move treecapitator into own file using override
on_dig = function(pos, node, digger)
--bvav_create_vessel(pos,facedir_to_dir(dir_to_facedir(yaw_to_dir(digger:get_look_horizontal()+(math_pi/2)))))
--check if wielding axe?
--turn treecapitator into an enchantment?
local meta = get_meta(pos)
--local tool_meta = digger:get_wielded_item():get_meta()
--if tool_meta:get_int("treecapitator") > 0 then
if not meta:contains("placed") and string.match(digger:get_wielded_item():get_name(), "axe") then
local tool_capabilities = digger:get_wielded_item():get_tool_capabilities()
local wear = get_dig_params({wood=1}, tool_capabilities).wear
local wield_stack = digger:get_wielded_item()
--remove tree
for y = -6,6 do
local name = get_node(vec_new(pos.x,pos.y+y,pos.z)).name
if name == "main:tree" or name == "redstone:node_activated_tree" then
wield_stack:add_wear(wear)
node_dig(vec_new(pos.x,pos.y+y,pos.z), node, digger)
add_particlespawner({
amount = 30,
time = 0.0001,
minpos = {x=pos.x-0.5, y=pos.y-0.5+y, z=pos.z-0.5},
maxpos = {x=pos.x+0.5, y=pos.y+0.5+y, z=pos.z+0.5},
minvel = vec_new(-1,0,-1),
maxvel = vec_new(1,0,1),
minacc = {x=0, y=-9.81, z=0},
maxacc = {x=0, y=-9.81, z=0},
minexptime = 0.5,
maxexptime = 1.5,
minsize = 0,
maxsize = 0,
collisiondetection = true,
vertical = false,
node = {name= name},
})
local name2 = get_node(vec_new(pos.x,pos.y+y-1,pos.z)).name
if acceptable_soil[name2] then
set_node(vec_new(pos.x,pos.y+y,pos.z),{name="main:sapling"})
end
end
end
digger:set_wielded_item(wield_stack)
else
node_dig(pos, node, digger)
end
end
})
register_node("main:wood", {
description = "Wood",
tiles = {"wood.png"},
groups = {wood = 1, pathable = 1,flammable=1},
sounds = main.woodSound(),
})
register_node("main:leaves", {
description = "Leaves",
drawtype = "allfaces_optional",
waving = 1,
walkable = true,
paramtype = "light",
is_ground_content = false,
tiles = {"leaves.png"},
groups = {leaves = 1, leafdecay = 1,flammable=1},
sounds = main.grassSound(),
drop = {
max_items = 1,
items= {
{
tools = {"main:shears"},
items = {"main:dropped_leaves"},
},
{
rarity = 25,
items = {"main:apple"},
},
{
rarity = 20,
items = {"main:sapling"},
},
},
},
})
register_node("main:dropped_leaves", {
description = "Leaves",
drawtype = "allfaces_optional",
waving = 0,
walkable = false,
climbable = false,
paramtype = "light",
is_ground_content = false,
tiles = {"leaves.png"},
groups = {leaves = 1, flammable=1},
sounds = main.grassSound(),
drop = {
max_items = 1,
items= {
{
tools = {"main:shears"},
items = {"main:dropped_leaves"},
},
},
},
})
register_node("main:water", {
description = "Water Source",
drawtype = "liquid",
waving = 3,
tiles = {
{
name = "water_source.png",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 1,
},
},
{
name = "water_source.png",
backface_culling = true,
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 1,
},
},
},
alpha = 191,
paramtype = "light",
walkable = false,
pointable = false,
diggable = false,
buildable_to = true,
is_ground_content = false,
drop = "",
liquidtype = "source",
liquid_alternative_flowing = "main:waterflow",
liquid_alternative_source = "main:water",
move_resistance = 1,
liquid_viscosity = 0,
post_effect_color = {a = 103, r = 30, g = 60, b = 90},
groups = {water = 1, liquid = 1, cools_lava = 1, bucket = 1, source = 1,pathable = 1,drowning=1,disable_fall_damage=1,extinguish=1},
on_construct = function(pos)
local under = get_node(vec_new(pos.x,pos.y-1,pos.z)).name
if under == "nether:glowstone" then
remove_node(pos)
create_aether_portal(pos)
end
end,
})
register_node("main:waterflow", {
description = "Water Flow",
drawtype = "flowingliquid",
waving = 3,
tiles = {"water_static.png"},
special_tiles = {
{
name = "water_flow.png",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 0.5,
},
},
{
name = "water_flow.png",
backface_culling = true,
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 0.5,
},
},
},
selection_box = {
type = "fixed",
fixed = {
{0, 0, 0, 0, 0, 0},
},
},
alpha = 191,
paramtype = "light",
paramtype2 = "flowingliquid",
walkable = false,
pointable = false,
diggable = false,
buildable_to = true,
is_ground_content = false,
drop = "",
liquidtype = "flowing",
liquid_alternative_flowing = "main:waterflow",
liquid_alternative_source = "main:water",
move_resistance = 1,
liquid_viscosity = 0,
post_effect_color = {a = 103, r = 30, g = 60, b = 90},
groups = {water = 1, liquid = 1, notInCreative = 1, cools_lava = 1,pathable = 1,drowning=1,disable_fall_damage=1,extinguish=1},
})
register_node("main:lava", {
description = "Lava",
drawtype = "liquid",
tiles = {
{
name = "lava_source.png",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 2.0,
},
},
{
name = "lava_source.png",
backface_culling = true,
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 2.0,
},
},
},
paramtype = "light",
light_source = 13,
walkable = false,
pointable = false,
diggable = false,
buildable_to = true,
is_ground_content = false,
drop = "",
drowning = 1,
liquidtype = "source",
liquid_alternative_flowing = "main:lavaflow",
liquid_alternative_source = "main:lava",
move_resistance = 5,
liquid_viscosity = 7,
liquid_renewable = false,
post_effect_color = {a = 191, r = 255, g = 64, b = 0},
groups = {lava = 3, liquid = 2, igniter = 1, fire=1,hurt_inside=1},
})
register_node("main:lavaflow", {
description = "Flowing Lava",
drawtype = "flowingliquid",
tiles = {"lava_flow.png"},
special_tiles = {
{
name = "lava_flow.png",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 3.3,
},
},
{
name = "lava_flow.png",
backface_culling = true,
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 3.3,
},
},
},
selection_box = {
type = "fixed",
fixed = {
{0, 0, 0, 0, 0, 0},
},
},
paramtype = "light",
paramtype2 = "flowingliquid",
light_source = 13,
walkable = false,
pointable = false,
diggable = false,
buildable_to = true,
is_ground_content = false,
drop = "",
drowning = 1,
liquidtype = "flowing",
liquid_alternative_flowing = "main:lavaflow",
liquid_alternative_source = "main:lava",
move_resistance = 5,
liquid_viscosity = 7,
liquid_renewable = false,
liquid_range = 3,
post_effect_color = {a = 191, r = 255, g = 64, b = 0},
groups = {lava = 3, liquid = 2, igniter = 1, fire=1,hurt_inside=1},
})
register_node("main:ladder", {
description = "Ladder",
drawtype = "signlike",
tiles = {"ladder.png"},
inventory_image = "ladder.png",
wield_image = "ladder.png",
paramtype = "light",
paramtype2 = "wallmounted",
sunlight_propagates = true,
walkable = false,
climbable = true,
is_ground_content = false,
node_placement_prediction = "",
selection_box = {
type = "wallmounted",
},
groups = {wood = 1, flammable = 1, attached_node=1},
sounds = main.woodSound(),
on_place = function(itemstack, placer, pointed_thing)
--copy from torch
if pointed_thing.type ~= "node" then
return itemstack
end
local wdir = dir_to_wallmounted(vec_subtract(pointed_thing.under,pointed_thing.above))
local fakestack = itemstack
local retval = false
if wdir > 1 then
retval = fakestack:set_name("main:ladder")
else
return itemstack
end
if not retval then
return itemstack
end
itemstack, retval = item_place(fakestack, placer, pointed_thing, wdir)
if retval then
sound_play("wood", {pos=pointed_thing.above, gain = 1.0})
end
print(itemstack, retval)
itemstack:set_name("main:ladder")
return itemstack
end,
})