1 -- mods/default/nodes.lua
3 minetest.register_node("default:stone", {
5 tiles = {"default_stone.png"},
6 is_ground_content = true,
7 groups = {cracky=3, stone=1},
8 drop = 'default:cobble',
10 sounds = default.node_sound_stone_defaults(),
13 minetest.register_node("default:desert_stone", {
14 description = "Desert Stone",
15 tiles = {"default_desert_stone.png"},
16 is_ground_content = true,
17 groups = {cracky=3, stone=1},
18 drop = 'default:desert_stone',
19 legacy_mineral = true,
20 sounds = default.node_sound_stone_defaults(),
23 minetest.register_node("default:stone_with_coal", {
24 description = "Coal Ore",
25 tiles = {"default_stone.png^default_mineral_coal.png"},
26 is_ground_content = true,
28 drop = 'default:coal_lump',
29 sounds = default.node_sound_stone_defaults(),
32 minetest.register_node("default:stone_with_iron", {
33 description = "Iron Ore",
34 tiles = {"default_stone.png^default_mineral_iron.png"},
35 is_ground_content = true,
37 drop = 'default:iron_lump',
38 sounds = default.node_sound_stone_defaults(),
41 minetest.register_node("default:stone_with_copper", {
42 description = "Copper Ore",
43 tiles = {"default_stone.png^default_mineral_copper.png"},
44 is_ground_content = true,
46 drop = 'default:copper_lump',
47 sounds = default.node_sound_stone_defaults(),
50 minetest.register_node("default:stone_with_mese", {
51 description = "Mese Crystals in Stone",
52 tiles = {"default_stone.png^default_mineral_mese.png"},
53 is_ground_content = true,
55 drop = "default:mese_crystal",
56 sounds = default.node_sound_stone_defaults(),
59 minetest.register_node("default:stone_with_gold", {
60 description = "Gold Ore",
61 tiles = {"default_stone.png^default_mineral_gold.png"},
62 is_ground_content = true,
64 drop = "default:gold_lump",
65 sounds = default.node_sound_stone_defaults(),
68 minetest.register_node("default:stone_with_diamond", {
69 description = "Diamonds in Stone",
70 tiles = {"default_stone.png^default_mineral_diamond.png"},
71 is_ground_content = true,
73 drop = "default:diamond",
74 sounds = default.node_sound_stone_defaults(),
77 minetest.register_node("default:stonebrick", {
78 description = "Stone Brick",
79 tiles = {"default_stone_brick.png"},
80 groups = {cracky=2, stone=1},
81 sounds = default.node_sound_stone_defaults(),
84 minetest.register_node("default:desert_stonebrick", {
85 description = "Desert Stone Brick",
86 tiles = {"default_desert_stone_brick.png"},
87 groups = {cracky=2, stone=1},
88 sounds = default.node_sound_stone_defaults(),
91 minetest.register_node("default:dirt_with_grass", {
92 description = "Dirt with Grass",
93 tiles = {"default_grass.png", "default_dirt.png", "default_dirt.png^default_grass_side.png"},
94 is_ground_content = true,
95 groups = {crumbly=3,soil=1},
96 drop = 'default:dirt',
97 sounds = default.node_sound_dirt_defaults({
98 footstep = {name="default_grass_footstep", gain=0.25},
102 minetest.register_node("default:dirt_with_grass_footsteps", {
103 description = "Dirt with Grass and Footsteps",
104 tiles = {"default_grass_footsteps.png", "default_dirt.png", "default_dirt.png^default_grass_side.png"},
105 is_ground_content = true,
106 groups = {crumbly=3,soil=1,not_in_creative_inventory=1},
107 drop = 'default:dirt',
108 sounds = default.node_sound_dirt_defaults({
109 footstep = {name="default_grass_footstep", gain=0.25},
113 minetest.register_node("default:dirt_with_snow", {
114 description = "Dirt with Snow",
115 tiles = {"default_snow.png", "default_dirt.png", "default_dirt.png^default_snow_side.png"},
116 is_ground_content = true,
117 groups = {crumbly=3},
118 drop = 'default:dirt',
119 sounds = default.node_sound_dirt_defaults({
120 footstep = {name="default_snow_footstep", gain=0.25},
123 minetest.register_alias("dirt_with_snow", "default:dirt_with_snow")
125 minetest.register_node("default:dirt", {
126 description = "Dirt",
127 tiles = {"default_dirt.png"},
128 is_ground_content = true,
129 groups = {crumbly=3,soil=1},
130 sounds = default.node_sound_dirt_defaults(),
133 minetest.register_node("default:sand", {
134 description = "Sand",
135 tiles = {"default_sand.png"},
136 is_ground_content = true,
137 groups = {crumbly=3, falling_node=1, sand=1},
138 sounds = default.node_sound_sand_defaults(),
141 minetest.register_node("default:desert_sand", {
142 description = "Desert Sand",
143 tiles = {"default_desert_sand.png"},
144 is_ground_content = true,
145 groups = {crumbly=3, falling_node=1, sand=1},
146 sounds = default.node_sound_sand_defaults(),
149 minetest.register_node("default:gravel", {
150 description = "Gravel",
151 tiles = {"default_gravel.png"},
152 is_ground_content = true,
153 groups = {crumbly=2, falling_node=1},
154 sounds = default.node_sound_dirt_defaults({
155 footstep = {name="default_gravel_footstep", gain=0.5},
159 minetest.register_node("default:sandstone", {
160 description = "Sandstone",
161 tiles = {"default_sandstone.png"},
162 is_ground_content = true,
163 groups = {crumbly=2,cracky=3},
164 sounds = default.node_sound_stone_defaults(),
167 minetest.register_node("default:sandstonebrick", {
168 description = "Sandstone Brick",
169 tiles = {"default_sandstone_brick.png"},
170 is_ground_content = true,
172 sounds = default.node_sound_stone_defaults(),
175 minetest.register_node("default:clay", {
176 description = "Clay",
177 tiles = {"default_clay.png"},
178 is_ground_content = true,
179 groups = {crumbly=3},
180 drop = 'default:clay_lump 4',
181 sounds = default.node_sound_dirt_defaults(),
184 minetest.register_node("default:brick", {
185 description = "Brick Block",
186 tiles = {"default_brick.png"},
188 sounds = default.node_sound_stone_defaults(),
191 minetest.register_node("default:tree", {
192 description = "Tree",
193 tiles = {"default_tree_top.png", "default_tree_top.png", "default_tree.png"},
194 groups = {tree=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
195 sounds = default.node_sound_wood_defaults(),
198 minetest.register_node("default:jungletree", {
199 description = "Jungle Tree",
200 tiles = {"default_jungletree_top.png", "default_jungletree_top.png", "default_jungletree.png"},
201 groups = {tree=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
202 sounds = default.node_sound_wood_defaults(),
205 minetest.register_node("default:junglewood", {
206 description = "Junglewood Planks",
207 tiles = {"default_junglewood.png"},
208 groups = {choppy=2,oddly_breakable_by_hand=2,flammable=3,wood=1},
209 sounds = default.node_sound_wood_defaults(),
212 minetest.register_node("default:jungleleaves", {
213 description = "Jungle Leaves",
214 drawtype = "allfaces_optional",
216 tiles = {"default_jungleleaves.png"},
218 groups = {snappy=3, leafdecay=3, flammable=2, leaves=1},
223 -- player will get sapling with 1/20 chance
224 items = {'default:junglesapling'},
228 -- player will get leaves only if he get no saplings,
229 -- this is because max_items is 1
230 items = {'default:jungleleaves'},
234 sounds = default.node_sound_leaves_defaults(),
237 minetest.register_node("default:junglesapling", {
238 description = "Jungle Sapling",
239 drawtype = "plantlike",
241 tiles = {"default_junglesapling.png"},
242 inventory_image = "default_junglesapling.png",
243 wield_image = "default_junglesapling.png",
248 fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
250 groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1},
251 sounds = default.node_sound_leaves_defaults(),
253 -- aliases for tree growing abm in content_abm.cpp
254 minetest.register_alias("sapling", "default:sapling")
255 minetest.register_alias("junglesapling", "default:junglesapling")
257 minetest.register_node("default:junglegrass", {
258 description = "Jungle Grass",
259 drawtype = "plantlike",
261 tiles = {"default_junglegrass.png"},
262 inventory_image = "default_junglegrass.png",
263 wield_image = "default_junglegrass.png",
267 is_ground_content = true,
268 groups = {snappy=3,flammable=2,flora=1,attached_node=1},
269 sounds = default.node_sound_leaves_defaults(),
272 fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
276 minetest.register_node("default:leaves", {
277 description = "Leaves",
278 drawtype = "allfaces_optional",
280 tiles = {"default_leaves.png"},
282 groups = {snappy=3, leafdecay=3, flammable=2, leaves=1},
287 -- player will get sapling with 1/20 chance
288 items = {'default:sapling'},
292 -- player will get leaves only if he get no saplings,
293 -- this is because max_items is 1
294 items = {'default:leaves'},
298 sounds = default.node_sound_leaves_defaults(),
301 minetest.register_node("default:cactus", {
302 description = "Cactus",
303 tiles = {"default_cactus_top.png", "default_cactus_top.png", "default_cactus_side.png"},
304 is_ground_content = true,
305 groups = {snappy=1,choppy=3,flammable=2},
306 sounds = default.node_sound_wood_defaults(),
309 minetest.register_node("default:papyrus", {
310 description = "Papyrus",
311 drawtype = "plantlike",
312 tiles = {"default_papyrus.png"},
313 inventory_image = "default_papyrus.png",
314 wield_image = "default_papyrus.png",
317 is_ground_content = true,
320 fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3}
322 groups = {snappy=3,flammable=2},
323 sounds = default.node_sound_leaves_defaults(),
326 minetest.register_node("default:bookshelf", {
327 description = "Bookshelf",
328 tiles = {"default_wood.png", "default_wood.png", "default_bookshelf.png"},
329 groups = {choppy=3,oddly_breakable_by_hand=2,flammable=3},
330 sounds = default.node_sound_wood_defaults(),
333 minetest.register_node("default:glass", {
334 description = "Glass",
335 drawtype = "glasslike",
336 tiles = {"default_glass.png"},
337 inventory_image = minetest.inventorycube("default_glass.png"),
339 sunlight_propagates = true,
340 groups = {cracky=3,oddly_breakable_by_hand=3},
341 sounds = default.node_sound_glass_defaults(),
344 minetest.register_node("default:fence_wood", {
345 description = "Wooden Fence",
346 drawtype = "fencelike",
347 tiles = {"default_wood.png"},
348 inventory_image = "default_fence.png",
349 wield_image = "default_fence.png",
353 fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7},
355 groups = {choppy=2,oddly_breakable_by_hand=2,flammable=2},
356 sounds = default.node_sound_wood_defaults(),
359 minetest.register_node("default:rail", {
360 description = "Rail",
361 drawtype = "raillike",
362 tiles = {"default_rail.png", "default_rail_curved.png", "default_rail_t_junction.png", "default_rail_crossing.png"},
363 inventory_image = "default_rail.png",
364 wield_image = "default_rail.png",
369 -- but how to specify the dimensions for curved and sideways rails?
370 fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2},
372 groups = {bendy=2,dig_immediate=2,attached_node=1},
375 minetest.register_node("default:ladder", {
376 description = "Ladder",
377 drawtype = "signlike",
378 tiles = {"default_ladder.png"},
379 inventory_image = "default_ladder.png",
380 wield_image = "default_ladder.png",
382 paramtype2 = "wallmounted",
386 type = "wallmounted",
387 --wall_top = = <default>
388 --wall_bottom = = <default>
389 --wall_side = = <default>
391 groups = {choppy=2,oddly_breakable_by_hand=3,flammable=2},
392 legacy_wallmounted = true,
393 sounds = default.node_sound_wood_defaults(),
396 minetest.register_node("default:wood", {
397 description = "Wooden Planks",
398 tiles = {"default_wood.png"},
399 groups = {choppy=2,oddly_breakable_by_hand=2,flammable=3,wood=1},
400 sounds = default.node_sound_wood_defaults(),
403 minetest.register_node("default:cloud", {
404 description = "Cloud",
405 tiles = {"default_cloud.png"},
406 sounds = default.node_sound_defaults(),
407 groups = {not_in_creative_inventory=1},
410 minetest.register_node("default:water_flowing", {
411 description = "Flowing Water",
412 inventory_image = minetest.inventorycube("default_water.png"),
413 drawtype = "flowingliquid",
414 tiles = {"default_water.png"},
417 image="default_water_flowing_animated.png",
418 backface_culling=false,
419 animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=0.8}
422 image="default_water_flowing_animated.png",
423 backface_culling=true,
424 animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=0.8}
434 liquidtype = "flowing",
435 liquid_alternative_flowing = "default:water_flowing",
436 liquid_alternative_source = "default:water_source",
437 liquid_viscosity = WATER_VISC,
438 post_effect_color = {a=64, r=100, g=100, b=200},
439 groups = {water=3, liquid=3, puts_out_fire=1, not_in_creative_inventory=1},
442 minetest.register_node("default:water_source", {
443 description = "Water Source",
444 inventory_image = minetest.inventorycube("default_water.png"),
447 {name="default_water_source_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2.0}}
450 -- New-style water source material (mostly unused)
452 name="default_water_source_animated.png",
453 animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2.0},
454 backface_culling = false,
464 liquidtype = "source",
465 liquid_alternative_flowing = "default:water_flowing",
466 liquid_alternative_source = "default:water_source",
467 liquid_viscosity = WATER_VISC,
468 post_effect_color = {a=64, r=100, g=100, b=200},
469 groups = {water=3, liquid=3, puts_out_fire=1},
472 minetest.register_node("default:lava_flowing", {
473 description = "Flowing Lava",
474 inventory_image = minetest.inventorycube("default_lava.png"),
475 drawtype = "flowingliquid",
476 tiles = {"default_lava.png"},
479 image="default_lava_flowing_animated.png",
480 backface_culling=false,
481 animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.3}
484 image="default_lava_flowing_animated.png",
485 backface_culling=true,
486 animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.3}
490 light_source = LIGHT_MAX - 1,
496 liquidtype = "flowing",
497 liquid_alternative_flowing = "default:lava_flowing",
498 liquid_alternative_source = "default:lava_source",
499 liquid_viscosity = LAVA_VISC,
500 liquid_renewable = false,
501 damage_per_second = 4*2,
502 post_effect_color = {a=192, r=255, g=64, b=0},
503 groups = {lava=3, liquid=2, hot=3, igniter=1, not_in_creative_inventory=1},
506 minetest.register_node("default:lava_source", {
507 description = "Lava Source",
508 inventory_image = minetest.inventorycube("default_lava.png"),
511 {name="default_lava_source_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0}}
514 -- New-style lava source material (mostly unused)
516 name="default_lava_source_animated.png",
517 animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0},
518 backface_culling = false,
522 light_source = LIGHT_MAX - 1,
528 liquidtype = "source",
529 liquid_alternative_flowing = "default:lava_flowing",
530 liquid_alternative_source = "default:lava_source",
531 liquid_viscosity = LAVA_VISC,
532 liquid_renewable = false,
533 damage_per_second = 4*2,
534 post_effect_color = {a=192, r=255, g=64, b=0},
535 groups = {lava=3, liquid=2, hot=3, igniter=1},
538 minetest.register_node("default:torch", {
539 description = "Torch",
540 drawtype = "torchlike",
541 --tiles = {"default_torch_on_floor.png", "default_torch_on_ceiling.png", "default_torch.png"},
543 {name="default_torch_on_floor_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0}},
544 {name="default_torch_on_ceiling_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0}},
545 {name="default_torch_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0}}
547 inventory_image = "default_torch_on_floor.png",
548 wield_image = "default_torch_on_floor.png",
550 paramtype2 = "wallmounted",
551 sunlight_propagates = true,
553 light_source = LIGHT_MAX-1,
555 type = "wallmounted",
556 wall_top = {-0.1, 0.5-0.6, -0.1, 0.1, 0.5, 0.1},
557 wall_bottom = {-0.1, -0.5, -0.1, 0.1, -0.5+0.6, 0.1},
558 wall_side = {-0.5, -0.3, -0.1, -0.5+0.3, 0.3, 0.1},
560 groups = {choppy=2,dig_immediate=3,flammable=1,attached_node=1},
561 legacy_wallmounted = true,
562 sounds = default.node_sound_defaults(),
565 minetest.register_node("default:sign_wall", {
566 description = "Sign",
567 drawtype = "signlike",
568 tiles = {"default_sign_wall.png"},
569 inventory_image = "default_sign_wall.png",
570 wield_image = "default_sign_wall.png",
572 paramtype2 = "wallmounted",
573 sunlight_propagates = true,
576 type = "wallmounted",
577 --wall_top = <default>
578 --wall_bottom = <default>
579 --wall_side = <default>
581 groups = {choppy=2,dig_immediate=2,attached_node=1},
582 legacy_wallmounted = true,
583 sounds = default.node_sound_defaults(),
584 on_construct = function(pos)
585 --local n = minetest.get_node(pos)
586 local meta = minetest.get_meta(pos)
587 meta:set_string("formspec", "field[text;;${text}]")
588 meta:set_string("infotext", "\"\"")
590 on_receive_fields = function(pos, formname, fields, sender)
591 --print("Sign at "..minetest.pos_to_string(pos).." got "..dump(fields))
592 local meta = minetest.get_meta(pos)
593 fields.text = fields.text or ""
594 print((sender:get_player_name() or "").." wrote \""..fields.text..
595 "\" to sign at "..minetest.pos_to_string(pos))
596 meta:set_string("text", fields.text)
597 meta:set_string("infotext", '"'..fields.text..'"')
601 default.chest_formspec =
603 "list[current_name;main;0,0;8,4;]"..
604 "list[current_player;main;0,5;8,4;]"
606 function default.get_locked_chest_formspec(pos)
607 local spos = pos.x .. "," .. pos.y .. "," ..pos.z
610 "list[nodemeta:".. spos .. ";main;0,0;8,4;]"..
611 "list[current_player;main;0,5;8,4;]"
616 minetest.register_node("default:chest", {
617 description = "Chest",
618 tiles = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png",
619 "default_chest_side.png", "default_chest_side.png", "default_chest_front.png"},
620 paramtype2 = "facedir",
621 groups = {choppy=2,oddly_breakable_by_hand=2},
622 legacy_facedir_simple = true,
623 sounds = default.node_sound_wood_defaults(),
624 on_construct = function(pos)
625 local meta = minetest.get_meta(pos)
626 meta:set_string("formspec",default.chest_formspec)
627 meta:set_string("infotext", "Chest")
628 local inv = meta:get_inventory()
629 inv:set_size("main", 8*4)
631 can_dig = function(pos,player)
632 local meta = minetest.get_meta(pos);
633 local inv = meta:get_inventory()
634 return inv:is_empty("main")
636 on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
637 minetest.log("action", player:get_player_name()..
638 " moves stuff in chest at "..minetest.pos_to_string(pos))
640 on_metadata_inventory_put = function(pos, listname, index, stack, player)
641 minetest.log("action", player:get_player_name()..
642 " moves stuff to chest at "..minetest.pos_to_string(pos))
644 on_metadata_inventory_take = function(pos, listname, index, stack, player)
645 minetest.log("action", player:get_player_name()..
646 " takes stuff from chest at "..minetest.pos_to_string(pos))
650 local function has_locked_chest_privilege(meta, player)
651 if player:get_player_name() ~= meta:get_string("owner") then
657 minetest.register_node("default:chest_locked", {
658 description = "Locked Chest",
659 tiles = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png",
660 "default_chest_side.png", "default_chest_side.png", "default_chest_lock.png"},
661 paramtype2 = "facedir",
662 groups = {choppy=2,oddly_breakable_by_hand=2},
663 legacy_facedir_simple = true,
664 sounds = default.node_sound_wood_defaults(),
665 after_place_node = function(pos, placer)
666 local meta = minetest.get_meta(pos)
667 meta:set_string("owner", placer:get_player_name() or "")
668 meta:set_string("infotext", "Locked Chest (owned by "..
669 meta:get_string("owner")..")")
671 on_construct = function(pos)
672 local meta = minetest.get_meta(pos)
673 meta:set_string("infotext", "Locked Chest")
674 meta:set_string("owner", "")
675 local inv = meta:get_inventory()
676 inv:set_size("main", 8*4)
678 can_dig = function(pos,player)
679 local meta = minetest.get_meta(pos);
680 local inv = meta:get_inventory()
681 return inv:is_empty("main") and has_locked_chest_privilege(meta, player)
683 allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
684 local meta = minetest.get_meta(pos)
685 if not has_locked_chest_privilege(meta, player) then
686 minetest.log("action", player:get_player_name()..
687 " tried to access a locked chest belonging to "..
688 meta:get_string("owner").." at "..
689 minetest.pos_to_string(pos))
694 allow_metadata_inventory_put = function(pos, listname, index, stack, player)
695 local meta = minetest.get_meta(pos)
696 if not has_locked_chest_privilege(meta, player) then
697 minetest.log("action", player:get_player_name()..
698 " tried to access a locked chest belonging to "..
699 meta:get_string("owner").." at "..
700 minetest.pos_to_string(pos))
703 return stack:get_count()
705 allow_metadata_inventory_take = function(pos, listname, index, stack, player)
706 local meta = minetest.get_meta(pos)
707 if not has_locked_chest_privilege(meta, player) then
708 minetest.log("action", player:get_player_name()..
709 " tried to access a locked chest belonging to "..
710 meta:get_string("owner").." at "..
711 minetest.pos_to_string(pos))
714 return stack:get_count()
716 on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
717 minetest.log("action", player:get_player_name()..
718 " moves stuff in locked chest at "..minetest.pos_to_string(pos))
720 on_metadata_inventory_put = function(pos, listname, index, stack, player)
721 minetest.log("action", player:get_player_name()..
722 " moves stuff to locked chest at "..minetest.pos_to_string(pos))
724 on_metadata_inventory_take = function(pos, listname, index, stack, player)
725 minetest.log("action", player:get_player_name()..
726 " takes stuff from locked chest at "..minetest.pos_to_string(pos))
728 on_rightclick = function(pos, node, clicker)
729 local meta = minetest.get_meta(pos)
730 if has_locked_chest_privilege(meta, clicker) then
731 minetest.show_formspec(
732 clicker:get_player_name(),
733 "default:chest_locked",
734 default.get_locked_chest_formspec(pos)
740 function default.get_furnace_active_formspec(pos, percent)
743 "image[2,2;1,1;default_furnace_fire_bg.png^[lowpart:"..
744 (100-percent)..":default_furnace_fire_fg.png]"..
745 "list[current_name;fuel;2,3;1,1;]"..
746 "list[current_name;src;2,1;1,1;]"..
747 "list[current_name;dst;5,1;2,2;]"..
748 "list[current_player;main;0,5;8,4;]"
752 default.furnace_inactive_formspec =
754 "image[2,2;1,1;default_furnace_fire_bg.png]"..
755 "list[current_name;fuel;2,3;1,1;]"..
756 "list[current_name;src;2,1;1,1;]"..
757 "list[current_name;dst;5,1;2,2;]"..
758 "list[current_player;main;0,5;8,4;]"
760 minetest.register_node("default:furnace", {
761 description = "Furnace",
762 tiles = {"default_furnace_top.png", "default_furnace_bottom.png", "default_furnace_side.png",
763 "default_furnace_side.png", "default_furnace_side.png", "default_furnace_front.png"},
764 paramtype2 = "facedir",
766 legacy_facedir_simple = true,
767 sounds = default.node_sound_stone_defaults(),
768 on_construct = function(pos)
769 local meta = minetest.get_meta(pos)
770 meta:set_string("formspec", default.furnace_inactive_formspec)
771 meta:set_string("infotext", "Furnace")
772 local inv = meta:get_inventory()
773 inv:set_size("fuel", 1)
774 inv:set_size("src", 1)
775 inv:set_size("dst", 4)
777 can_dig = function(pos,player)
778 local meta = minetest.get_meta(pos);
779 local inv = meta:get_inventory()
780 if not inv:is_empty("fuel") then
782 elseif not inv:is_empty("dst") then
784 elseif not inv:is_empty("src") then
789 allow_metadata_inventory_put = function(pos, listname, index, stack, player)
790 local meta = minetest.get_meta(pos)
791 local inv = meta:get_inventory()
792 if listname == "fuel" then
793 if minetest.get_craft_result({method="fuel",width=1,items={stack}}).time ~= 0 then
794 if inv:is_empty("src") then
795 meta:set_string("infotext","Furnace is empty")
797 return stack:get_count()
801 elseif listname == "src" then
802 return stack:get_count()
803 elseif listname == "dst" then
807 allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
808 local meta = minetest.get_meta(pos)
809 local inv = meta:get_inventory()
810 local stack = inv:get_stack(from_list, from_index)
811 if to_list == "fuel" then
812 if minetest.get_craft_result({method="fuel",width=1,items={stack}}).time ~= 0 then
813 if inv:is_empty("src") then
814 meta:set_string("infotext","Furnace is empty")
820 elseif to_list == "src" then
822 elseif to_list == "dst" then
828 minetest.register_node("default:furnace_active", {
829 description = "Furnace",
830 tiles = {"default_furnace_top.png", "default_furnace_bottom.png", "default_furnace_side.png",
831 "default_furnace_side.png", "default_furnace_side.png", "default_furnace_front_active.png"},
832 paramtype2 = "facedir",
834 drop = "default:furnace",
835 groups = {cracky=2, not_in_creative_inventory=1},
836 legacy_facedir_simple = true,
837 sounds = default.node_sound_stone_defaults(),
838 on_construct = function(pos)
839 local meta = minetest.get_meta(pos)
840 meta:set_string("formspec", default.furnace_inactive_formspec)
841 meta:set_string("infotext", "Furnace");
842 local inv = meta:get_inventory()
843 inv:set_size("fuel", 1)
844 inv:set_size("src", 1)
845 inv:set_size("dst", 4)
847 can_dig = function(pos,player)
848 local meta = minetest.get_meta(pos);
849 local inv = meta:get_inventory()
850 if not inv:is_empty("fuel") then
852 elseif not inv:is_empty("dst") then
854 elseif not inv:is_empty("src") then
859 allow_metadata_inventory_put = function(pos, listname, index, stack, player)
860 local meta = minetest.get_meta(pos)
861 local inv = meta:get_inventory()
862 if listname == "fuel" then
863 if minetest.get_craft_result({method="fuel",width=1,items={stack}}).time ~= 0 then
864 if inv:is_empty("src") then
865 meta:set_string("infotext","Furnace is empty")
867 return stack:get_count()
871 elseif listname == "src" then
872 return stack:get_count()
873 elseif listname == "dst" then
877 allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
878 local meta = minetest.get_meta(pos)
879 local inv = meta:get_inventory()
880 local stack = inv:get_stack(from_list, from_index)
881 if to_list == "fuel" then
882 if minetest.get_craft_result({method="fuel",width=1,items={stack}}).time ~= 0 then
883 if inv:is_empty("src") then
884 meta:set_string("infotext","Furnace is empty")
890 elseif to_list == "src" then
892 elseif to_list == "dst" then
898 function hacky_swap_node(pos,name)
899 local node = minetest.get_node(pos)
900 local meta = minetest.get_meta(pos)
901 local meta0 = meta:to_table()
902 if node.name == name then
906 local meta0 = meta:to_table()
907 minetest.set_node(pos,node)
908 meta = minetest.get_meta(pos)
909 meta:from_table(meta0)
912 minetest.register_abm({
913 nodenames = {"default:furnace","default:furnace_active"},
916 action = function(pos, node, active_object_count, active_object_count_wider)
917 local meta = minetest.get_meta(pos)
918 for i, name in ipairs({
924 if meta:get_string(name) == "" then
925 meta:set_float(name, 0.0)
929 local inv = meta:get_inventory()
931 local srclist = inv:get_list("src")
936 cooked, aftercooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
939 local was_active = false
941 if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
943 meta:set_float("fuel_time", meta:get_float("fuel_time") + 1)
944 meta:set_float("src_time", meta:get_float("src_time") + 1)
945 if cooked and cooked.item and meta:get_float("src_time") >= cooked.time then
946 -- check if there's room for output in "dst" list
947 if inv:room_for_item("dst",cooked.item) then
948 -- Put result in "dst" list
949 inv:add_item("dst", cooked.item)
950 -- take stuff from "src" list
951 inv:set_stack("src", 1, aftercooked.items[1])
953 print("Could not insert '"..cooked.item:to_string().."'")
955 meta:set_string("src_time", 0)
959 if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
960 local percent = math.floor(meta:get_float("fuel_time") /
961 meta:get_float("fuel_totaltime") * 100)
962 meta:set_string("infotext","Furnace active: "..percent.."%")
963 hacky_swap_node(pos,"default:furnace_active")
964 meta:set_string("formspec",default.get_furnace_active_formspec(pos, percent))
971 local fuellist = inv:get_list("fuel")
972 local srclist = inv:get_list("src")
975 cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
978 fuel, afterfuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist})
981 if fuel.time <= 0 then
982 meta:set_string("infotext","Furnace out of fuel")
983 hacky_swap_node(pos,"default:furnace")
984 meta:set_string("formspec", default.furnace_inactive_formspec)
988 if cooked.item:is_empty() then
990 meta:set_string("infotext","Furnace is empty")
991 hacky_swap_node(pos,"default:furnace")
992 meta:set_string("formspec", default.furnace_inactive_formspec)
997 meta:set_string("fuel_totaltime", fuel.time)
998 meta:set_string("fuel_time", 0)
1000 inv:set_stack("fuel", 1, afterfuel.items[1])
1004 minetest.register_node("default:cobble", {
1005 description = "Cobblestone",
1006 tiles = {"default_cobble.png"},
1007 is_ground_content = true,
1008 groups = {cracky=3, stone=2},
1009 sounds = default.node_sound_stone_defaults(),
1012 minetest.register_node("default:mossycobble", {
1013 description = "Mossy Cobblestone",
1014 tiles = {"default_mossycobble.png"},
1015 is_ground_content = true,
1016 groups = {cracky=3},
1017 sounds = default.node_sound_stone_defaults(),
1020 minetest.register_node("default:coalblock", {
1021 description = "Coal Block",
1022 tiles = {"default_coal_block.png"},
1023 is_ground_content = true,
1024 groups = {cracky=3},
1025 sounds = default.node_sound_stone_defaults(),
1028 minetest.register_node("default:steelblock", {
1029 description = "Steel Block",
1030 tiles = {"default_steel_block.png"},
1031 is_ground_content = true,
1032 groups = {cracky=1,level=2},
1033 sounds = default.node_sound_stone_defaults(),
1036 minetest.register_node("default:copperblock", {
1037 description = "Copper Block",
1038 tiles = {"default_copper_block.png"},
1039 is_ground_content = true,
1040 groups = {cracky=1,level=2},
1041 sounds = default.node_sound_stone_defaults(),
1044 minetest.register_node("default:bronzeblock", {
1045 description = "Bronze Block",
1046 tiles = {"default_bronze_block.png"},
1047 is_ground_content = true,
1048 groups = {cracky=1,level=2},
1049 sounds = default.node_sound_stone_defaults(),
1052 minetest.register_node("default:mese", {
1053 description = "Mese Block",
1054 tiles = {"default_mese_block.png"},
1055 is_ground_content = true,
1056 groups = {cracky=1,level=2},
1057 sounds = default.node_sound_stone_defaults(),
1059 minetest.register_alias("default:mese_block", "default:mese")
1061 minetest.register_node("default:goldblock", {
1062 description = "Gold Block",
1063 tiles = {"default_gold_block.png"},
1064 is_ground_content = true,
1065 groups = {cracky=1},
1066 sounds = default.node_sound_stone_defaults(),
1069 minetest.register_node("default:diamondblock", {
1070 description = "Diamond Block",
1071 tiles = {"default_diamond_block.png"},
1072 is_ground_content = true,
1073 groups = {cracky=1,level=3},
1074 sounds = default.node_sound_stone_defaults(),
1077 minetest.register_node("default:obsidian_glass", {
1078 description = "Obsidian Glass",
1079 drawtype = "glasslike",
1080 tiles = {"default_obsidian_glass.png"},
1081 paramtype = "light",
1082 sunlight_propagates = true,
1083 sounds = default.node_sound_glass_defaults(),
1084 groups = {cracky=3,oddly_breakable_by_hand=3},
1087 minetest.register_node("default:obsidian", {
1088 description = "Obsidian",
1089 tiles = {"default_obsidian.png"},
1090 is_ground_content = true,
1091 sounds = default.node_sound_stone_defaults(),
1092 groups = {cracky=1,level=2},
1095 minetest.register_node("default:nyancat", {
1096 description = "Nyan Cat",
1097 tiles = {"default_nc_side.png", "default_nc_side.png", "default_nc_side.png",
1098 "default_nc_side.png", "default_nc_back.png", "default_nc_front.png"},
1099 paramtype2 = "facedir",
1100 groups = {cracky=2},
1101 legacy_facedir_simple = true,
1102 sounds = default.node_sound_defaults(),
1105 minetest.register_node("default:nyancat_rainbow", {
1106 description = "Nyan Cat Rainbow",
1107 tiles = {"default_nc_rb.png"},
1108 groups = {cracky=2},
1109 sounds = default.node_sound_defaults(),
1112 minetest.register_node("default:sapling", {
1113 description = "Sapling",
1114 drawtype = "plantlike",
1116 tiles = {"default_sapling.png"},
1117 inventory_image = "default_sapling.png",
1118 wield_image = "default_sapling.png",
1119 paramtype = "light",
1123 fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
1125 groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1},
1126 sounds = default.node_sound_leaves_defaults(),
1129 minetest.register_node("default:apple", {
1130 description = "Apple",
1131 drawtype = "plantlike",
1133 tiles = {"default_apple.png"},
1134 inventory_image = "default_apple.png",
1135 paramtype = "light",
1136 sunlight_propagates = true,
1140 fixed = {-0.2, -0.5, -0.2, 0.2, 0, 0.2}
1142 groups = {fleshy=3,dig_immediate=3,flammable=2,leafdecay=3,leafdecay_drop=1},
1143 on_use = minetest.item_eat(1),
1144 sounds = default.node_sound_leaves_defaults(),
1145 after_place_node = function(pos, placer, itemstack)
1146 if placer:is_player() then
1147 minetest.set_node(pos, {name="default:apple", param2=1})
1152 minetest.register_node("default:dry_shrub", {
1153 description = "Dry Shrub",
1154 drawtype = "plantlike",
1156 tiles = {"default_dry_shrub.png"},
1157 inventory_image = "default_dry_shrub.png",
1158 wield_image = "default_dry_shrub.png",
1159 paramtype = "light",
1161 groups = {snappy=3,flammable=3,attached_node=1},
1162 sounds = default.node_sound_leaves_defaults(),
1165 fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
1169 minetest.register_node("default:grass_1", {
1170 description = "Grass",
1171 drawtype = "plantlike",
1172 tiles = {"default_grass_1.png"},
1173 -- use a bigger inventory image
1174 inventory_image = "default_grass_3.png",
1175 wield_image = "default_grass_3.png",
1176 paramtype = "light",
1178 buildable_to = true,
1179 groups = {snappy=3,flammable=3,flora=1,attached_node=1},
1180 sounds = default.node_sound_leaves_defaults(),
1183 fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
1185 on_place = function(itemstack, placer, pointed_thing)
1186 -- place a random grass node
1187 local stack = ItemStack("default:grass_"..math.random(1,5))
1188 local ret = minetest.item_place(stack, placer, pointed_thing)
1189 return ItemStack("default:grass_1 "..itemstack:get_count()-(1-ret:get_count()))
1193 minetest.register_node("default:grass_2", {
1194 description = "Grass",
1195 drawtype = "plantlike",
1196 tiles = {"default_grass_2.png"},
1197 inventory_image = "default_grass_2.png",
1198 wield_image = "default_grass_2.png",
1199 paramtype = "light",
1201 buildable_to = true,
1202 is_ground_content = true,
1203 drop = "default:grass_1",
1204 groups = {snappy=3,flammable=3,flora=1,attached_node=1,not_in_creative_inventory=1},
1205 sounds = default.node_sound_leaves_defaults(),
1208 fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
1211 minetest.register_node("default:grass_3", {
1212 description = "Grass",
1213 drawtype = "plantlike",
1214 tiles = {"default_grass_3.png"},
1215 inventory_image = "default_grass_3.png",
1216 wield_image = "default_grass_3.png",
1217 paramtype = "light",
1219 buildable_to = true,
1220 is_ground_content = true,
1221 drop = "default:grass_1",
1222 groups = {snappy=3,flammable=3,flora=1,attached_node=1,not_in_creative_inventory=1},
1223 sounds = default.node_sound_leaves_defaults(),
1226 fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
1230 minetest.register_node("default:grass_4", {
1231 description = "Grass",
1232 drawtype = "plantlike",
1233 tiles = {"default_grass_4.png"},
1234 inventory_image = "default_grass_4.png",
1235 wield_image = "default_grass_4.png",
1236 paramtype = "light",
1238 buildable_to = true,
1239 is_ground_content = true,
1240 drop = "default:grass_1",
1241 groups = {snappy=3,flammable=3,flora=1,attached_node=1,not_in_creative_inventory=1},
1242 sounds = default.node_sound_leaves_defaults(),
1245 fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
1249 minetest.register_node("default:grass_5", {
1250 description = "Grass",
1251 drawtype = "plantlike",
1252 tiles = {"default_grass_5.png"},
1253 inventory_image = "default_grass_5.png",
1254 wield_image = "default_grass_5.png",
1255 paramtype = "light",
1257 buildable_to = true,
1258 is_ground_content = true,
1259 drop = "default:grass_1",
1260 groups = {snappy=3,flammable=3,flora=1,attached_node=1,not_in_creative_inventory=1},
1261 sounds = default.node_sound_leaves_defaults(),
1264 fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
1268 minetest.register_node("default:ice", {
1269 description = "Ice",
1270 tiles = {"default_ice.png"},
1271 is_ground_content = true,
1272 paramtype = "light",
1273 groups = {cracky=3},
1274 sounds = default.node_sound_glass_defaults(),
1277 minetest.register_node("default:snow", {
1278 description = "Snow",
1279 tiles = {"default_snow.png"},
1280 inventory_image = "default_snowball.png",
1281 wield_image = "default_snowball.png",
1282 is_ground_content = true,
1283 paramtype = "light",
1284 buildable_to = true,
1285 drawtype = "nodebox",
1289 {-0.5, -0.5, -0.5, 0.5, -0.5+2/16, 0.5},
1292 groups = {crumbly=3,falling_node=1},
1293 sounds = default.node_sound_dirt_defaults({
1294 footstep = {name="default_snow_footstep", gain=0.25},
1296 on_construct = function(pos)
1298 if minetest.get_node(pos).name == "default:dirt_with_grass" then
1299 minetest.set_node(pos, {name="default:dirt_with_snow"})
1303 minetest.register_alias("snow", "default:snow")
1305 minetest.register_node("default:snowblock", {
1306 description = "Snow Block",
1307 tiles = {"default_snow.png"},
1308 is_ground_content = true,
1309 groups = {crumbly=3},
1310 sounds = default.node_sound_dirt_defaults({
1311 footstep = {name="default_snow_footstep", gain=0.25},