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 Ore",
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 = "Diamond Ore",
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},
156 dug = {name="default_gravel_footstep", gain=1.0},
160 minetest.register_node("default:sandstone", {
161 description = "Sandstone",
162 tiles = {"default_sandstone.png"},
163 is_ground_content = true,
164 groups = {crumbly=2,cracky=3},
165 sounds = default.node_sound_stone_defaults(),
168 minetest.register_node("default:sandstonebrick", {
169 description = "Sandstone Brick",
170 tiles = {"default_sandstone_brick.png"},
171 is_ground_content = true,
173 sounds = default.node_sound_stone_defaults(),
176 minetest.register_node("default:clay", {
177 description = "Clay",
178 tiles = {"default_clay.png"},
179 is_ground_content = true,
180 groups = {crumbly=3},
181 drop = 'default:clay_lump 4',
182 sounds = default.node_sound_dirt_defaults(),
185 minetest.register_node("default:brick", {
186 description = "Brick Block",
187 tiles = {"default_brick.png"},
189 sounds = default.node_sound_stone_defaults(),
192 minetest.register_node("default:tree", {
193 description = "Tree",
194 tiles = {"default_tree_top.png", "default_tree_top.png", "default_tree.png"},
195 groups = {tree=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
196 sounds = default.node_sound_wood_defaults(),
199 minetest.register_node("default:jungletree", {
200 description = "Jungle Tree",
201 tiles = {"default_jungletree_top.png", "default_jungletree_top.png", "default_jungletree.png"},
202 groups = {tree=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
203 sounds = default.node_sound_wood_defaults(),
206 minetest.register_node("default:junglewood", {
207 description = "Junglewood Planks",
208 tiles = {"default_junglewood.png"},
209 groups = {choppy=2,oddly_breakable_by_hand=2,flammable=3,wood=1},
210 sounds = default.node_sound_wood_defaults(),
213 minetest.register_node("default:jungleleaves", {
214 description = "Jungle Leaves",
215 drawtype = "allfaces_optional",
217 tiles = {"default_jungleleaves.png"},
219 groups = {snappy=3, leafdecay=3, flammable=2, leaves=1},
224 -- player will get sapling with 1/20 chance
225 items = {'default:junglesapling'},
229 -- player will get leaves only if he get no saplings,
230 -- this is because max_items is 1
231 items = {'default:jungleleaves'},
235 sounds = default.node_sound_leaves_defaults(),
238 minetest.register_node("default:junglesapling", {
239 description = "Jungle Sapling",
240 drawtype = "plantlike",
242 tiles = {"default_junglesapling.png"},
243 inventory_image = "default_junglesapling.png",
244 wield_image = "default_junglesapling.png",
249 fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
251 groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1},
252 sounds = default.node_sound_leaves_defaults(),
254 -- aliases for tree growing abm in content_abm.cpp
255 minetest.register_alias("sapling", "default:sapling")
256 minetest.register_alias("junglesapling", "default:junglesapling")
258 minetest.register_node("default:junglegrass", {
259 description = "Jungle Grass",
260 drawtype = "plantlike",
262 tiles = {"default_junglegrass.png"},
263 inventory_image = "default_junglegrass.png",
264 wield_image = "default_junglegrass.png",
268 is_ground_content = true,
269 groups = {snappy=3,flammable=2,flora=1,attached_node=1},
270 sounds = default.node_sound_leaves_defaults(),
273 fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
277 minetest.register_node("default:leaves", {
278 description = "Leaves",
279 drawtype = "allfaces_optional",
281 tiles = {"default_leaves.png"},
283 groups = {snappy=3, leafdecay=3, flammable=2, leaves=1},
288 -- player will get sapling with 1/20 chance
289 items = {'default:sapling'},
293 -- player will get leaves only if he get no saplings,
294 -- this is because max_items is 1
295 items = {'default:leaves'},
299 sounds = default.node_sound_leaves_defaults(),
302 minetest.register_node("default:cactus", {
303 description = "Cactus",
304 tiles = {"default_cactus_top.png", "default_cactus_top.png", "default_cactus_side.png"},
305 is_ground_content = true,
306 groups = {snappy=1,choppy=3,flammable=2},
307 sounds = default.node_sound_wood_defaults(),
310 minetest.register_node("default:papyrus", {
311 description = "Papyrus",
312 drawtype = "plantlike",
313 tiles = {"default_papyrus.png"},
314 inventory_image = "default_papyrus.png",
315 wield_image = "default_papyrus.png",
318 is_ground_content = true,
321 fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3}
323 groups = {snappy=3,flammable=2},
324 sounds = default.node_sound_leaves_defaults(),
327 minetest.register_node("default:bookshelf", {
328 description = "Bookshelf",
329 tiles = {"default_wood.png", "default_wood.png", "default_bookshelf.png"},
330 groups = {choppy=3,oddly_breakable_by_hand=2,flammable=3},
331 sounds = default.node_sound_wood_defaults(),
334 minetest.register_node("default:glass", {
335 description = "Glass",
336 drawtype = "glasslike",
337 tiles = {"default_glass.png"},
338 inventory_image = minetest.inventorycube("default_glass.png"),
340 sunlight_propagates = true,
341 groups = {cracky=3,oddly_breakable_by_hand=3},
342 sounds = default.node_sound_glass_defaults(),
345 minetest.register_node("default:fence_wood", {
346 description = "Wooden Fence",
347 drawtype = "fencelike",
348 tiles = {"default_wood.png"},
349 inventory_image = "default_fence.png",
350 wield_image = "default_fence.png",
354 fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7},
356 groups = {choppy=2,oddly_breakable_by_hand=2,flammable=2},
357 sounds = default.node_sound_wood_defaults(),
360 minetest.register_node("default:rail", {
361 description = "Rail",
362 drawtype = "raillike",
363 tiles = {"default_rail.png", "default_rail_curved.png", "default_rail_t_junction.png", "default_rail_crossing.png"},
364 inventory_image = "default_rail.png",
365 wield_image = "default_rail.png",
370 -- but how to specify the dimensions for curved and sideways rails?
371 fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2},
373 groups = {bendy=2,dig_immediate=2,attached_node=1},
376 minetest.register_node("default:ladder", {
377 description = "Ladder",
378 drawtype = "signlike",
379 tiles = {"default_ladder.png"},
380 inventory_image = "default_ladder.png",
381 wield_image = "default_ladder.png",
383 paramtype2 = "wallmounted",
387 type = "wallmounted",
388 --wall_top = = <default>
389 --wall_bottom = = <default>
390 --wall_side = = <default>
392 groups = {choppy=2,oddly_breakable_by_hand=3,flammable=2},
393 legacy_wallmounted = true,
394 sounds = default.node_sound_wood_defaults(),
397 minetest.register_node("default:wood", {
398 description = "Wooden Planks",
399 tiles = {"default_wood.png"},
400 groups = {choppy=2,oddly_breakable_by_hand=2,flammable=3,wood=1},
401 sounds = default.node_sound_wood_defaults(),
404 minetest.register_node("default:cloud", {
405 description = "Cloud",
406 tiles = {"default_cloud.png"},
407 sounds = default.node_sound_defaults(),
408 groups = {not_in_creative_inventory=1},
411 minetest.register_node("default:water_flowing", {
412 description = "Flowing Water",
413 inventory_image = minetest.inventorycube("default_water.png"),
414 drawtype = "flowingliquid",
415 tiles = {"default_water.png"},
418 image="default_water_flowing_animated.png",
419 backface_culling=false,
420 animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=0.8}
423 image="default_water_flowing_animated.png",
424 backface_culling=true,
425 animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=0.8}
435 liquidtype = "flowing",
436 liquid_alternative_flowing = "default:water_flowing",
437 liquid_alternative_source = "default:water_source",
438 liquid_viscosity = WATER_VISC,
439 post_effect_color = {a=64, r=100, g=100, b=200},
440 groups = {water=3, liquid=3, puts_out_fire=1, not_in_creative_inventory=1},
443 minetest.register_node("default:water_source", {
444 description = "Water Source",
445 inventory_image = minetest.inventorycube("default_water.png"),
448 {name="default_water_source_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2.0}}
451 -- New-style water source material (mostly unused)
453 name="default_water_source_animated.png",
454 animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2.0},
455 backface_culling = false,
465 liquidtype = "source",
466 liquid_alternative_flowing = "default:water_flowing",
467 liquid_alternative_source = "default:water_source",
468 liquid_viscosity = WATER_VISC,
469 post_effect_color = {a=64, r=100, g=100, b=200},
470 groups = {water=3, liquid=3, puts_out_fire=1},
473 minetest.register_node("default:lava_flowing", {
474 description = "Flowing Lava",
475 inventory_image = minetest.inventorycube("default_lava.png"),
476 drawtype = "flowingliquid",
477 tiles = {"default_lava.png"},
480 image="default_lava_flowing_animated.png",
481 backface_culling=false,
482 animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.3}
485 image="default_lava_flowing_animated.png",
486 backface_culling=true,
487 animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.3}
491 light_source = LIGHT_MAX - 1,
497 liquidtype = "flowing",
498 liquid_alternative_flowing = "default:lava_flowing",
499 liquid_alternative_source = "default:lava_source",
500 liquid_viscosity = LAVA_VISC,
501 liquid_renewable = false,
502 damage_per_second = 4*2,
503 post_effect_color = {a=192, r=255, g=64, b=0},
504 groups = {lava=3, liquid=2, hot=3, igniter=1, not_in_creative_inventory=1},
507 minetest.register_node("default:lava_source", {
508 description = "Lava Source",
509 inventory_image = minetest.inventorycube("default_lava.png"),
512 {name="default_lava_source_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0}}
515 -- New-style lava source material (mostly unused)
517 name="default_lava_source_animated.png",
518 animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0},
519 backface_culling = false,
523 light_source = LIGHT_MAX - 1,
529 liquidtype = "source",
530 liquid_alternative_flowing = "default:lava_flowing",
531 liquid_alternative_source = "default:lava_source",
532 liquid_viscosity = LAVA_VISC,
533 liquid_renewable = false,
534 damage_per_second = 4*2,
535 post_effect_color = {a=192, r=255, g=64, b=0},
536 groups = {lava=3, liquid=2, hot=3, igniter=1},
539 minetest.register_node("default:torch", {
540 description = "Torch",
541 drawtype = "torchlike",
542 --tiles = {"default_torch_on_floor.png", "default_torch_on_ceiling.png", "default_torch.png"},
544 {name="default_torch_on_floor_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0}},
545 {name="default_torch_on_ceiling_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0}},
546 {name="default_torch_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0}}
548 inventory_image = "default_torch_on_floor.png",
549 wield_image = "default_torch_on_floor.png",
551 paramtype2 = "wallmounted",
552 sunlight_propagates = true,
554 light_source = LIGHT_MAX-1,
556 type = "wallmounted",
557 wall_top = {-0.1, 0.5-0.6, -0.1, 0.1, 0.5, 0.1},
558 wall_bottom = {-0.1, -0.5, -0.1, 0.1, -0.5+0.6, 0.1},
559 wall_side = {-0.5, -0.3, -0.1, -0.5+0.3, 0.3, 0.1},
561 groups = {choppy=2,dig_immediate=3,flammable=1,attached_node=1},
562 legacy_wallmounted = true,
563 sounds = default.node_sound_defaults(),
566 minetest.register_node("default:sign_wall", {
567 description = "Sign",
568 drawtype = "signlike",
569 tiles = {"default_sign_wall.png"},
570 inventory_image = "default_sign_wall.png",
571 wield_image = "default_sign_wall.png",
573 paramtype2 = "wallmounted",
574 sunlight_propagates = true,
577 type = "wallmounted",
578 --wall_top = <default>
579 --wall_bottom = <default>
580 --wall_side = <default>
582 groups = {choppy=2,dig_immediate=2,attached_node=1},
583 legacy_wallmounted = true,
584 sounds = default.node_sound_defaults(),
585 on_construct = function(pos)
586 --local n = minetest.get_node(pos)
587 local meta = minetest.get_meta(pos)
588 meta:set_string("formspec", "field[text;;${text}]")
589 meta:set_string("infotext", "\"\"")
591 on_receive_fields = function(pos, formname, fields, sender)
592 --print("Sign at "..minetest.pos_to_string(pos).." got "..dump(fields))
593 local meta = minetest.get_meta(pos)
594 fields.text = fields.text or ""
595 print((sender:get_player_name() or "").." wrote \""..fields.text..
596 "\" to sign at "..minetest.pos_to_string(pos))
597 meta:set_string("text", fields.text)
598 meta:set_string("infotext", '"'..fields.text..'"')
602 default.chest_formspec =
604 "list[current_name;main;0,0;8,4;]"..
605 "list[current_player;main;0,5;8,4;]"
607 function default.get_locked_chest_formspec(pos)
608 local spos = pos.x .. "," .. pos.y .. "," ..pos.z
611 "list[nodemeta:".. spos .. ";main;0,0;8,4;]"..
612 "list[current_player;main;0,5;8,4;]"
617 minetest.register_node("default:chest", {
618 description = "Chest",
619 tiles = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png",
620 "default_chest_side.png", "default_chest_side.png", "default_chest_front.png"},
621 paramtype2 = "facedir",
622 groups = {choppy=2,oddly_breakable_by_hand=2},
623 legacy_facedir_simple = true,
624 sounds = default.node_sound_wood_defaults(),
625 on_construct = function(pos)
626 local meta = minetest.get_meta(pos)
627 meta:set_string("formspec",default.chest_formspec)
628 meta:set_string("infotext", "Chest")
629 local inv = meta:get_inventory()
630 inv:set_size("main", 8*4)
632 can_dig = function(pos,player)
633 local meta = minetest.get_meta(pos);
634 local inv = meta:get_inventory()
635 return inv:is_empty("main")
637 on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
638 minetest.log("action", player:get_player_name()..
639 " moves stuff in chest at "..minetest.pos_to_string(pos))
641 on_metadata_inventory_put = function(pos, listname, index, stack, player)
642 minetest.log("action", player:get_player_name()..
643 " moves stuff to chest at "..minetest.pos_to_string(pos))
645 on_metadata_inventory_take = function(pos, listname, index, stack, player)
646 minetest.log("action", player:get_player_name()..
647 " takes stuff from chest at "..minetest.pos_to_string(pos))
651 local function has_locked_chest_privilege(meta, player)
652 if player:get_player_name() ~= meta:get_string("owner") then
658 minetest.register_node("default:chest_locked", {
659 description = "Locked Chest",
660 tiles = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png",
661 "default_chest_side.png", "default_chest_side.png", "default_chest_lock.png"},
662 paramtype2 = "facedir",
663 groups = {choppy=2,oddly_breakable_by_hand=2},
664 legacy_facedir_simple = true,
665 sounds = default.node_sound_wood_defaults(),
666 after_place_node = function(pos, placer)
667 local meta = minetest.get_meta(pos)
668 meta:set_string("owner", placer:get_player_name() or "")
669 meta:set_string("infotext", "Locked Chest (owned by "..
670 meta:get_string("owner")..")")
672 on_construct = function(pos)
673 local meta = minetest.get_meta(pos)
674 meta:set_string("infotext", "Locked Chest")
675 meta:set_string("owner", "")
676 local inv = meta:get_inventory()
677 inv:set_size("main", 8*4)
679 can_dig = function(pos,player)
680 local meta = minetest.get_meta(pos);
681 local inv = meta:get_inventory()
682 return inv:is_empty("main") and has_locked_chest_privilege(meta, player)
684 allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
685 local meta = minetest.get_meta(pos)
686 if not has_locked_chest_privilege(meta, player) then
687 minetest.log("action", player:get_player_name()..
688 " tried to access a locked chest belonging to "..
689 meta:get_string("owner").." at "..
690 minetest.pos_to_string(pos))
695 allow_metadata_inventory_put = function(pos, listname, index, stack, player)
696 local meta = minetest.get_meta(pos)
697 if not has_locked_chest_privilege(meta, player) then
698 minetest.log("action", player:get_player_name()..
699 " tried to access a locked chest belonging to "..
700 meta:get_string("owner").." at "..
701 minetest.pos_to_string(pos))
704 return stack:get_count()
706 allow_metadata_inventory_take = function(pos, listname, index, stack, player)
707 local meta = minetest.get_meta(pos)
708 if not has_locked_chest_privilege(meta, player) then
709 minetest.log("action", player:get_player_name()..
710 " tried to access a locked chest belonging to "..
711 meta:get_string("owner").." at "..
712 minetest.pos_to_string(pos))
715 return stack:get_count()
717 on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
718 minetest.log("action", player:get_player_name()..
719 " moves stuff in locked chest at "..minetest.pos_to_string(pos))
721 on_metadata_inventory_put = function(pos, listname, index, stack, player)
722 minetest.log("action", player:get_player_name()..
723 " moves stuff to locked chest at "..minetest.pos_to_string(pos))
725 on_metadata_inventory_take = function(pos, listname, index, stack, player)
726 minetest.log("action", player:get_player_name()..
727 " takes stuff from locked chest at "..minetest.pos_to_string(pos))
729 on_rightclick = function(pos, node, clicker)
730 local meta = minetest.get_meta(pos)
731 if has_locked_chest_privilege(meta, clicker) then
732 minetest.show_formspec(
733 clicker:get_player_name(),
734 "default:chest_locked",
735 default.get_locked_chest_formspec(pos)
741 function default.get_furnace_active_formspec(pos, percent)
744 "image[2,2;1,1;default_furnace_fire_bg.png^[lowpart:"..
745 (100-percent)..":default_furnace_fire_fg.png]"..
746 "list[current_name;fuel;2,3;1,1;]"..
747 "list[current_name;src;2,1;1,1;]"..
748 "list[current_name;dst;5,1;2,2;]"..
749 "list[current_player;main;0,5;8,4;]"
753 default.furnace_inactive_formspec =
755 "image[2,2;1,1;default_furnace_fire_bg.png]"..
756 "list[current_name;fuel;2,3;1,1;]"..
757 "list[current_name;src;2,1;1,1;]"..
758 "list[current_name;dst;5,1;2,2;]"..
759 "list[current_player;main;0,5;8,4;]"
761 minetest.register_node("default:furnace", {
762 description = "Furnace",
763 tiles = {"default_furnace_top.png", "default_furnace_bottom.png", "default_furnace_side.png",
764 "default_furnace_side.png", "default_furnace_side.png", "default_furnace_front.png"},
765 paramtype2 = "facedir",
767 legacy_facedir_simple = true,
768 sounds = default.node_sound_stone_defaults(),
769 on_construct = function(pos)
770 local meta = minetest.get_meta(pos)
771 meta:set_string("formspec", default.furnace_inactive_formspec)
772 meta:set_string("infotext", "Furnace")
773 local inv = meta:get_inventory()
774 inv:set_size("fuel", 1)
775 inv:set_size("src", 1)
776 inv:set_size("dst", 4)
778 can_dig = function(pos,player)
779 local meta = minetest.get_meta(pos);
780 local inv = meta:get_inventory()
781 if not inv:is_empty("fuel") then
783 elseif not inv:is_empty("dst") then
785 elseif not inv:is_empty("src") then
790 allow_metadata_inventory_put = function(pos, listname, index, stack, player)
791 local meta = minetest.get_meta(pos)
792 local inv = meta:get_inventory()
793 if listname == "fuel" then
794 if minetest.get_craft_result({method="fuel",width=1,items={stack}}).time ~= 0 then
795 if inv:is_empty("src") then
796 meta:set_string("infotext","Furnace is empty")
798 return stack:get_count()
802 elseif listname == "src" then
803 return stack:get_count()
804 elseif listname == "dst" then
808 allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
809 local meta = minetest.get_meta(pos)
810 local inv = meta:get_inventory()
811 local stack = inv:get_stack(from_list, from_index)
812 if to_list == "fuel" then
813 if minetest.get_craft_result({method="fuel",width=1,items={stack}}).time ~= 0 then
814 if inv:is_empty("src") then
815 meta:set_string("infotext","Furnace is empty")
821 elseif to_list == "src" then
823 elseif to_list == "dst" then
829 minetest.register_node("default:furnace_active", {
830 description = "Furnace",
831 tiles = {"default_furnace_top.png", "default_furnace_bottom.png", "default_furnace_side.png",
832 "default_furnace_side.png", "default_furnace_side.png", "default_furnace_front_active.png"},
833 paramtype2 = "facedir",
835 drop = "default:furnace",
836 groups = {cracky=2, not_in_creative_inventory=1},
837 legacy_facedir_simple = true,
838 sounds = default.node_sound_stone_defaults(),
839 on_construct = function(pos)
840 local meta = minetest.get_meta(pos)
841 meta:set_string("formspec", default.furnace_inactive_formspec)
842 meta:set_string("infotext", "Furnace");
843 local inv = meta:get_inventory()
844 inv:set_size("fuel", 1)
845 inv:set_size("src", 1)
846 inv:set_size("dst", 4)
848 can_dig = function(pos,player)
849 local meta = minetest.get_meta(pos);
850 local inv = meta:get_inventory()
851 if not inv:is_empty("fuel") then
853 elseif not inv:is_empty("dst") then
855 elseif not inv:is_empty("src") then
860 allow_metadata_inventory_put = function(pos, listname, index, stack, player)
861 local meta = minetest.get_meta(pos)
862 local inv = meta:get_inventory()
863 if listname == "fuel" then
864 if minetest.get_craft_result({method="fuel",width=1,items={stack}}).time ~= 0 then
865 if inv:is_empty("src") then
866 meta:set_string("infotext","Furnace is empty")
868 return stack:get_count()
872 elseif listname == "src" then
873 return stack:get_count()
874 elseif listname == "dst" then
878 allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
879 local meta = minetest.get_meta(pos)
880 local inv = meta:get_inventory()
881 local stack = inv:get_stack(from_list, from_index)
882 if to_list == "fuel" then
883 if minetest.get_craft_result({method="fuel",width=1,items={stack}}).time ~= 0 then
884 if inv:is_empty("src") then
885 meta:set_string("infotext","Furnace is empty")
891 elseif to_list == "src" then
893 elseif to_list == "dst" then
899 function hacky_swap_node(pos,name)
900 local node = minetest.get_node(pos)
901 local meta = minetest.get_meta(pos)
902 local meta0 = meta:to_table()
903 if node.name == name then
907 local meta0 = meta:to_table()
908 minetest.set_node(pos,node)
909 meta = minetest.get_meta(pos)
910 meta:from_table(meta0)
913 minetest.register_abm({
914 nodenames = {"default:furnace","default:furnace_active"},
917 action = function(pos, node, active_object_count, active_object_count_wider)
918 local meta = minetest.get_meta(pos)
919 for i, name in ipairs({
925 if meta:get_string(name) == "" then
926 meta:set_float(name, 0.0)
930 local inv = meta:get_inventory()
932 local srclist = inv:get_list("src")
937 cooked, aftercooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
940 local was_active = false
942 if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
944 meta:set_float("fuel_time", meta:get_float("fuel_time") + 1)
945 meta:set_float("src_time", meta:get_float("src_time") + 1)
946 if cooked and cooked.item and meta:get_float("src_time") >= cooked.time then
947 -- check if there's room for output in "dst" list
948 if inv:room_for_item("dst",cooked.item) then
949 -- Put result in "dst" list
950 inv:add_item("dst", cooked.item)
951 -- take stuff from "src" list
952 inv:set_stack("src", 1, aftercooked.items[1])
954 print("Could not insert '"..cooked.item:to_string().."'")
956 meta:set_string("src_time", 0)
960 if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
961 local percent = math.floor(meta:get_float("fuel_time") /
962 meta:get_float("fuel_totaltime") * 100)
963 meta:set_string("infotext","Furnace active: "..percent.."%")
964 hacky_swap_node(pos,"default:furnace_active")
965 meta:set_string("formspec",default.get_furnace_active_formspec(pos, percent))
972 local fuellist = inv:get_list("fuel")
973 local srclist = inv:get_list("src")
976 cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
979 fuel, afterfuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist})
982 if fuel.time <= 0 then
983 meta:set_string("infotext","Furnace out of fuel")
984 hacky_swap_node(pos,"default:furnace")
985 meta:set_string("formspec", default.furnace_inactive_formspec)
989 if cooked.item:is_empty() then
991 meta:set_string("infotext","Furnace is empty")
992 hacky_swap_node(pos,"default:furnace")
993 meta:set_string("formspec", default.furnace_inactive_formspec)
998 meta:set_string("fuel_totaltime", fuel.time)
999 meta:set_string("fuel_time", 0)
1001 inv:set_stack("fuel", 1, afterfuel.items[1])
1005 minetest.register_node("default:cobble", {
1006 description = "Cobblestone",
1007 tiles = {"default_cobble.png"},
1008 is_ground_content = true,
1009 groups = {cracky=3, stone=2},
1010 sounds = default.node_sound_stone_defaults(),
1013 minetest.register_node("default:mossycobble", {
1014 description = "Mossy Cobblestone",
1015 tiles = {"default_mossycobble.png"},
1016 is_ground_content = true,
1017 groups = {cracky=3},
1018 sounds = default.node_sound_stone_defaults(),
1021 minetest.register_node("default:coalblock", {
1022 description = "Coal Block",
1023 tiles = {"default_coal_block.png"},
1024 is_ground_content = true,
1025 groups = {cracky=3},
1026 sounds = default.node_sound_stone_defaults(),
1029 minetest.register_node("default:steelblock", {
1030 description = "Steel Block",
1031 tiles = {"default_steel_block.png"},
1032 is_ground_content = true,
1033 groups = {cracky=1,level=2},
1034 sounds = default.node_sound_stone_defaults(),
1037 minetest.register_node("default:copperblock", {
1038 description = "Copper Block",
1039 tiles = {"default_copper_block.png"},
1040 is_ground_content = true,
1041 groups = {cracky=1,level=2},
1042 sounds = default.node_sound_stone_defaults(),
1045 minetest.register_node("default:bronzeblock", {
1046 description = "Bronze Block",
1047 tiles = {"default_bronze_block.png"},
1048 is_ground_content = true,
1049 groups = {cracky=1,level=2},
1050 sounds = default.node_sound_stone_defaults(),
1053 minetest.register_node("default:mese", {
1054 description = "Mese Block",
1055 tiles = {"default_mese_block.png"},
1056 is_ground_content = true,
1057 groups = {cracky=1,level=2},
1058 sounds = default.node_sound_stone_defaults(),
1060 minetest.register_alias("default:mese_block", "default:mese")
1062 minetest.register_node("default:goldblock", {
1063 description = "Gold Block",
1064 tiles = {"default_gold_block.png"},
1065 is_ground_content = true,
1066 groups = {cracky=1},
1067 sounds = default.node_sound_stone_defaults(),
1070 minetest.register_node("default:diamondblock", {
1071 description = "Diamond Block",
1072 tiles = {"default_diamond_block.png"},
1073 is_ground_content = true,
1074 groups = {cracky=1,level=3},
1075 sounds = default.node_sound_stone_defaults(),
1078 minetest.register_node("default:obsidian_glass", {
1079 description = "Obsidian Glass",
1080 drawtype = "glasslike",
1081 tiles = {"default_obsidian_glass.png"},
1082 paramtype = "light",
1083 sunlight_propagates = true,
1084 sounds = default.node_sound_glass_defaults(),
1085 groups = {cracky=3,oddly_breakable_by_hand=3},
1088 minetest.register_node("default:obsidian", {
1089 description = "Obsidian",
1090 tiles = {"default_obsidian.png"},
1091 is_ground_content = true,
1092 sounds = default.node_sound_stone_defaults(),
1093 groups = {cracky=1,level=2},
1096 minetest.register_node("default:nyancat", {
1097 description = "Nyan Cat",
1098 tiles = {"default_nc_side.png", "default_nc_side.png", "default_nc_side.png",
1099 "default_nc_side.png", "default_nc_back.png", "default_nc_front.png"},
1100 paramtype2 = "facedir",
1101 groups = {cracky=2},
1102 legacy_facedir_simple = true,
1103 sounds = default.node_sound_defaults(),
1106 minetest.register_node("default:nyancat_rainbow", {
1107 description = "Nyan Cat Rainbow",
1108 tiles = {"default_nc_rb.png"},
1109 groups = {cracky=2},
1110 sounds = default.node_sound_defaults(),
1113 minetest.register_node("default:sapling", {
1114 description = "Sapling",
1115 drawtype = "plantlike",
1117 tiles = {"default_sapling.png"},
1118 inventory_image = "default_sapling.png",
1119 wield_image = "default_sapling.png",
1120 paramtype = "light",
1124 fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
1126 groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1},
1127 sounds = default.node_sound_leaves_defaults(),
1130 minetest.register_node("default:apple", {
1131 description = "Apple",
1132 drawtype = "plantlike",
1134 tiles = {"default_apple.png"},
1135 inventory_image = "default_apple.png",
1136 paramtype = "light",
1137 sunlight_propagates = true,
1141 fixed = {-0.2, -0.5, -0.2, 0.2, 0, 0.2}
1143 groups = {fleshy=3,dig_immediate=3,flammable=2,leafdecay=3,leafdecay_drop=1},
1144 on_use = minetest.item_eat(1),
1145 sounds = default.node_sound_leaves_defaults(),
1146 after_place_node = function(pos, placer, itemstack)
1147 if placer:is_player() then
1148 minetest.set_node(pos, {name="default:apple", param2=1})
1153 minetest.register_node("default:dry_shrub", {
1154 description = "Dry Shrub",
1155 drawtype = "plantlike",
1157 tiles = {"default_dry_shrub.png"},
1158 inventory_image = "default_dry_shrub.png",
1159 wield_image = "default_dry_shrub.png",
1160 paramtype = "light",
1162 buildable_to = true,
1163 groups = {snappy=3,flammable=3,attached_node=1},
1164 sounds = default.node_sound_leaves_defaults(),
1167 fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
1171 minetest.register_node("default:grass_1", {
1172 description = "Grass",
1173 drawtype = "plantlike",
1174 tiles = {"default_grass_1.png"},
1175 -- use a bigger inventory image
1176 inventory_image = "default_grass_3.png",
1177 wield_image = "default_grass_3.png",
1178 paramtype = "light",
1180 buildable_to = true,
1181 groups = {snappy=3,flammable=3,flora=1,attached_node=1},
1182 sounds = default.node_sound_leaves_defaults(),
1185 fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
1187 on_place = function(itemstack, placer, pointed_thing)
1188 -- place a random grass node
1189 local stack = ItemStack("default:grass_"..math.random(1,5))
1190 local ret = minetest.item_place(stack, placer, pointed_thing)
1191 return ItemStack("default:grass_1 "..itemstack:get_count()-(1-ret:get_count()))
1195 minetest.register_node("default:grass_2", {
1196 description = "Grass",
1197 drawtype = "plantlike",
1198 tiles = {"default_grass_2.png"},
1199 inventory_image = "default_grass_2.png",
1200 wield_image = "default_grass_2.png",
1201 paramtype = "light",
1203 buildable_to = true,
1204 is_ground_content = true,
1205 drop = "default:grass_1",
1206 groups = {snappy=3,flammable=3,flora=1,attached_node=1,not_in_creative_inventory=1},
1207 sounds = default.node_sound_leaves_defaults(),
1210 fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
1213 minetest.register_node("default:grass_3", {
1214 description = "Grass",
1215 drawtype = "plantlike",
1216 tiles = {"default_grass_3.png"},
1217 inventory_image = "default_grass_3.png",
1218 wield_image = "default_grass_3.png",
1219 paramtype = "light",
1221 buildable_to = true,
1222 is_ground_content = true,
1223 drop = "default:grass_1",
1224 groups = {snappy=3,flammable=3,flora=1,attached_node=1,not_in_creative_inventory=1},
1225 sounds = default.node_sound_leaves_defaults(),
1228 fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
1232 minetest.register_node("default:grass_4", {
1233 description = "Grass",
1234 drawtype = "plantlike",
1235 tiles = {"default_grass_4.png"},
1236 inventory_image = "default_grass_4.png",
1237 wield_image = "default_grass_4.png",
1238 paramtype = "light",
1240 buildable_to = true,
1241 is_ground_content = true,
1242 drop = "default:grass_1",
1243 groups = {snappy=3,flammable=3,flora=1,attached_node=1,not_in_creative_inventory=1},
1244 sounds = default.node_sound_leaves_defaults(),
1247 fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
1251 minetest.register_node("default:grass_5", {
1252 description = "Grass",
1253 drawtype = "plantlike",
1254 tiles = {"default_grass_5.png"},
1255 inventory_image = "default_grass_5.png",
1256 wield_image = "default_grass_5.png",
1257 paramtype = "light",
1259 buildable_to = true,
1260 is_ground_content = true,
1261 drop = "default:grass_1",
1262 groups = {snappy=3,flammable=3,flora=1,attached_node=1,not_in_creative_inventory=1},
1263 sounds = default.node_sound_leaves_defaults(),
1266 fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
1270 minetest.register_node("default:ice", {
1271 description = "Ice",
1272 tiles = {"default_ice.png"},
1273 is_ground_content = true,
1274 paramtype = "light",
1275 groups = {cracky=3},
1276 sounds = default.node_sound_glass_defaults(),
1279 minetest.register_node("default:snow", {
1280 description = "Snow",
1281 tiles = {"default_snow.png"},
1282 inventory_image = "default_snowball.png",
1283 wield_image = "default_snowball.png",
1284 is_ground_content = true,
1285 paramtype = "light",
1286 buildable_to = true,
1287 drawtype = "nodebox",
1291 {-0.5, -0.5, -0.5, 0.5, -0.5+2/16, 0.5},
1294 groups = {crumbly=3,falling_node=1},
1295 sounds = default.node_sound_dirt_defaults({
1296 footstep = {name="default_snow_footstep", gain=0.25},
1297 dug = {name="default_snow_footstep", gain=0.75},
1299 on_construct = function(pos)
1301 if minetest.get_node(pos).name == "default:dirt_with_grass" then
1302 minetest.set_node(pos, {name="default:dirt_with_snow"})
1306 minetest.register_alias("snow", "default:snow")
1308 minetest.register_node("default:snowblock", {
1309 description = "Snow Block",
1310 tiles = {"default_snow.png"},
1311 is_ground_content = true,
1312 groups = {crumbly=3},
1313 sounds = default.node_sound_dirt_defaults({
1314 footstep = {name="default_snow_footstep", gain=0.25},
1315 dug = {name="default_snow_footstep", gain=0.75},