-- Load other files
dofile(minetest.get_modpath("default").."/mapgen.lua")
+-- Set a noticeable inventory formspec for players
+minetest.register_on_joinplayer(function(player)
+ local cb = function(player)
+ minetest.chat_send_player(player:get_player_name(), "This is the [minimal] \"Minimal Development Test\" game. Use [minetest_game] for the real thing.")
+ end
+ minetest.after(2.0, cb, player)
+end)
+
--
-- Tool definition
--
}
})
---
--- Crafting (tool repair)
---
+-- Tool repair
minetest.register_craft({
type = "toolrepair",
additional_wear = -0.02,
recipe = "default:tree",
})
-minetest.register_craft({
- type = "cooking",
- output = "default:coal_lump",
- recipe = "default:jungletree",
-})
-
minetest.register_craft({
type = "cooking",
output = "default:stone",
burntime = 30,
})
-minetest.register_craft({
- type = "fuel",
- recipe = "default:jungletree",
- burntime = 30,
-})
-
minetest.register_craft({
type = "fuel",
recipe = "default:junglegrass",
{name="", gain=0.5}
--table.dug = table.dug or
-- {name="default_dirt_break", gain=0.5}
+ table.place = table.place or
+ {name="default_grass_footstep", gain=0.5}
default.node_sound_defaults(table)
return table
end
return table
end
---
+-- Register nodes
minetest.register_node("default:stone", {
description = "Stone",
- tile_images = {"default_stone.png"},
- is_ground_content = true,
+ tiles ={"default_stone.png"},
groups = {cracky=3},
drop = 'default:cobble',
legacy_mineral = true,
minetest.register_node("default:stone_with_coal", {
description = "Stone with coal",
- tile_images = {"default_stone.png^default_mineral_coal.png"},
- is_ground_content = true,
+ tiles ={"default_stone.png^default_mineral_coal.png"},
groups = {cracky=3},
drop = 'default:coal_lump',
sounds = default.node_sound_stone_defaults(),
minetest.register_node("default:stone_with_iron", {
description = "Stone with iron",
- tile_images = {"default_stone.png^default_mineral_iron.png"},
- is_ground_content = true,
+ tiles ={"default_stone.png^default_mineral_iron.png"},
groups = {cracky=3},
drop = 'default:iron_lump',
sounds = default.node_sound_stone_defaults(),
minetest.register_node("default:dirt_with_grass", {
description = "Dirt with grass",
- tile_images = {"default_grass.png", "default_dirt.png", "default_dirt.png^default_grass_side.png"},
- is_ground_content = true,
- groups = {crumbly=3},
+ tiles ={"default_grass.png", "default_dirt.png",
+ {name = "default_dirt.png^default_grass_side.png",
+ tileable_vertical = false}},
+ groups = {crumbly=3, soil=1},
drop = 'default:dirt',
sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.4},
minetest.register_node("default:dirt_with_grass_footsteps", {
description = "Dirt with grass and footsteps",
- tile_images = {"default_grass_footsteps.png", "default_dirt.png", "default_dirt.png^default_grass_side.png"},
- is_ground_content = true,
- groups = {crumbly=3},
+ tiles ={"default_grass_footsteps.png", "default_dirt.png",
+ {name = "default_dirt.png^default_grass_side.png",
+ tileable_vertical = false}},
+ groups = {crumbly=3, soil=1},
drop = 'default:dirt',
sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.4},
minetest.register_node("default:dirt", {
description = "Dirt",
- tile_images = {"default_dirt.png"},
- is_ground_content = true,
- groups = {crumbly=3},
+ tiles ={"default_dirt.png"},
+ groups = {crumbly=3, soil=1},
sounds = default.node_sound_dirt_defaults(),
})
minetest.register_node("default:sand", {
description = "Sand",
- tile_images = {"default_sand.png"},
- is_ground_content = true,
- groups = {crumbly=3},
+ tiles ={"default_sand.png"},
+ groups = {crumbly=3, falling_node=1},
sounds = default.node_sound_sand_defaults(),
})
minetest.register_node("default:gravel", {
description = "Gravel",
- tile_images = {"default_gravel.png"},
- is_ground_content = true,
- groups = {crumbly=2},
+ tiles ={"default_gravel.png"},
+ groups = {crumbly=2, falling_node=1},
sounds = default.node_sound_dirt_defaults({
footstep = {name="default_gravel_footstep", gain=0.45},
}),
minetest.register_node("default:sandstone", {
description = "Sandstone",
- tile_images = {"default_sandstone.png"},
- is_ground_content = true,
+ tiles ={"default_sandstone.png"},
groups = {crumbly=2,cracky=2},
drop = 'default:sand',
sounds = default.node_sound_stone_defaults(),
minetest.register_node("default:clay", {
description = "Clay",
- tile_images = {"default_clay.png"},
- is_ground_content = true,
+ tiles ={"default_clay.png"},
groups = {crumbly=3},
drop = 'default:clay_lump 4',
sounds = default.node_sound_dirt_defaults({
minetest.register_node("default:brick", {
description = "Brick",
- tile_images = {"default_brick.png"},
- is_ground_content = true,
+ tiles ={"default_brick.png"},
+ is_ground_content = false,
groups = {cracky=3},
drop = 'default:clay_brick 4',
sounds = default.node_sound_stone_defaults(),
minetest.register_node("default:tree", {
description = "Tree",
- tile_images = {"default_tree_top.png", "default_tree_top.png", "default_tree.png"},
- is_ground_content = true,
- groups = {snappy=2,choppy=2,oddly_breakable_by_hand=1},
- sounds = default.node_sound_wood_defaults(),
-})
-
-minetest.register_node("default:jungletree", {
- description = "Jungle Tree",
- tile_images = {"default_jungletree_top.png", "default_jungletree_top.png", "default_jungletree.png"},
- is_ground_content = true,
+ tiles ={"default_tree_top.png", "default_tree_top.png", "default_tree.png"},
+ is_ground_content = false,
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=1},
sounds = default.node_sound_wood_defaults(),
})
description = "Jungle Grass",
drawtype = "plantlike",
visual_scale = 1.3,
- tile_images = {"default_junglegrass.png"},
+ tiles ={"default_junglegrass.png"},
inventory_image = "default_junglegrass.png",
wield_image = "default_junglegrass.png",
paramtype = "light",
walkable = false,
- groups = {snappy=3},
+ groups = {snappy=3,attached_node=1},
sounds = default.node_sound_leaves_defaults(),
})
description = "Leaves",
drawtype = "allfaces_optional",
visual_scale = 1.3,
- tile_images = {"default_leaves.png"},
+ tiles ={"default_leaves.png"},
paramtype = "light",
+ is_ground_content = false,
groups = {snappy=3},
drop = {
max_items = 1,
minetest.register_node("default:cactus", {
description = "Cactus",
- tile_images = {"default_cactus_top.png", "default_cactus_top.png", "default_cactus_side.png"},
- is_ground_content = true,
+ tiles ={"default_cactus_top.png", "default_cactus_top.png", "default_cactus_side.png"},
groups = {snappy=2,choppy=3},
sounds = default.node_sound_wood_defaults(),
})
minetest.register_node("default:papyrus", {
description = "Papyrus",
drawtype = "plantlike",
- tile_images = {"default_papyrus.png"},
+ tiles ={"default_papyrus.png"},
inventory_image = "default_papyrus.png",
wield_image = "default_papyrus.png",
paramtype = "light",
- is_ground_content = true,
walkable = false,
groups = {snappy=3},
sounds = default.node_sound_leaves_defaults(),
minetest.register_node("default:bookshelf", {
description = "Bookshelf",
- tile_images = {"default_wood.png", "default_wood.png", "default_bookshelf.png"},
- is_ground_content = true,
+ tiles ={"default_wood.png", "default_wood.png", "default_bookshelf.png"},
+ is_ground_content = false,
groups = {snappy=2,choppy=3,oddly_breakable_by_hand=2},
sounds = default.node_sound_wood_defaults(),
})
minetest.register_node("default:glass", {
description = "Glass",
drawtype = "glasslike",
- tile_images = {"default_glass.png"},
- inventory_image = minetest.inventorycube("default_glass.png"),
+ tiles ={"default_glass.png"},
paramtype = "light",
+ is_ground_content = false,
sunlight_propagates = true,
- is_ground_content = true,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
sounds = default.node_sound_glass_defaults(),
})
minetest.register_node("default:fence_wood", {
description = "Wooden Fence",
drawtype = "fencelike",
- tile_images = {"default_wood.png"},
+ tiles ={"default_wood.png"},
inventory_image = "default_fence.png",
wield_image = "default_fence.png",
paramtype = "light",
- is_ground_content = true,
+ is_ground_content = false,
selection_box = {
type = "fixed",
fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7},
minetest.register_node("default:rail", {
description = "Rail",
drawtype = "raillike",
- tile_images = {"default_rail.png", "default_rail_curved.png", "default_rail_t_junction.png", "default_rail_crossing.png"},
+ tiles ={"default_rail.png", "default_rail_curved.png", "default_rail_t_junction.png", "default_rail_crossing.png"},
inventory_image = "default_rail.png",
wield_image = "default_rail.png",
paramtype = "light",
- is_ground_content = true,
+ is_ground_content = false,
walkable = false,
selection_box = {
type = "fixed",
- --fixed = <default>
+ fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2},
},
groups = {bendy=2,snappy=1,dig_immediate=2},
})
minetest.register_node("default:ladder", {
description = "Ladder",
drawtype = "signlike",
- tile_images = {"default_ladder.png"},
+ tiles ={"default_ladder.png"},
inventory_image = "default_ladder.png",
wield_image = "default_ladder.png",
paramtype = "light",
paramtype2 = "wallmounted",
- is_ground_content = true,
+ is_ground_content = false,
walkable = false,
climbable = true,
selection_box = {
minetest.register_node("default:wood", {
description = "Wood",
- tile_images = {"default_wood.png"},
- is_ground_content = true,
+ tiles ={"default_wood.png"},
+ is_ground_content = false,
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
sounds = default.node_sound_wood_defaults(),
})
minetest.register_node("default:mese", {
description = "Mese",
- tile_images = {"default_mese.png"},
- is_ground_content = true,
+ tiles ={"default_mese.png"},
groups = {cracky=1,level=2},
sounds = default.node_sound_defaults(),
})
minetest.register_node("default:cloud", {
description = "Cloud",
- tile_images = {"default_cloud.png"},
- is_ground_content = true,
+ tiles ={"default_cloud.png"},
+ is_ground_content = false,
sounds = default.node_sound_defaults(),
})
description = "Water (flowing)",
inventory_image = minetest.inventorycube("default_water.png"),
drawtype = "flowingliquid",
- tile_images = {"default_water.png"},
+ tiles ={"default_water.png"},
+ special_tiles = {
+ {name="default_water.png", backface_culling=false},
+ {name="default_water.png", backface_culling=true},
+ },
alpha = WATER_ALPHA,
paramtype = "light",
walkable = false,
pointable = false,
diggable = false,
buildable_to = true,
+ is_ground_content = false,
+ drowning = 1,
liquidtype = "flowing",
liquid_alternative_flowing = "default:water_flowing",
liquid_alternative_source = "default:water_source",
liquid_viscosity = WATER_VISC,
post_effect_color = {a=64, r=100, g=100, b=200},
- special_materials = {
- {image="default_water.png", backface_culling=false},
- {image="default_water.png", backface_culling=true},
- },
groups = {water=3, liquid=3},
})
description = "Water",
inventory_image = minetest.inventorycube("default_water.png"),
drawtype = "liquid",
- tile_images = {"default_water.png"},
+ tiles ={"default_water.png"},
+ special_tiles = {
+ -- New-style water source material (mostly unused)
+ {name="default_water.png", backface_culling=false},
+ },
alpha = WATER_ALPHA,
paramtype = "light",
walkable = false,
pointable = false,
diggable = false,
buildable_to = true,
+ is_ground_content = false,
+ drowning = 1,
liquidtype = "source",
liquid_alternative_flowing = "default:water_flowing",
liquid_alternative_source = "default:water_source",
liquid_viscosity = WATER_VISC,
post_effect_color = {a=64, r=100, g=100, b=200},
- special_materials = {
- -- New-style water source material (mostly unused)
- {image="default_water.png", backface_culling=false},
- },
groups = {water=3, liquid=3},
})
description = "Lava (flowing)",
inventory_image = minetest.inventorycube("default_lava.png"),
drawtype = "flowingliquid",
- tile_images = {"default_lava.png"},
+ tiles ={"default_lava.png"},
+ special_tiles = {
+ {
+ image="default_lava_flowing_animated.png",
+ backface_culling=false,
+ animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.3}
+ },
+ {
+ image="default_lava_flowing_animated.png",
+ backface_culling=true,
+ animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.3}
+ },
+ },
paramtype = "light",
light_source = LIGHT_MAX - 1,
walkable = false,
pointable = false,
diggable = false,
buildable_to = true,
+ is_ground_content = false,
+ drowning = 1,
liquidtype = "flowing",
liquid_alternative_flowing = "default:lava_flowing",
liquid_alternative_source = "default:lava_source",
liquid_viscosity = LAVA_VISC,
damage_per_second = 4*2,
post_effect_color = {a=192, r=255, g=64, b=0},
- special_materials = {
- {image="default_lava.png", backface_culling=false},
- {image="default_lava.png", backface_culling=true},
- },
groups = {lava=3, liquid=2, hot=3},
})
description = "Lava",
inventory_image = minetest.inventorycube("default_lava.png"),
drawtype = "liquid",
- tile_images = {"default_lava.png"},
+ --tiles ={"default_lava.png"},
+ tiles ={
+ {name="default_lava_source_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0}}
+ },
+ special_tiles = {
+ -- New-style lava source material (mostly unused)
+ {name="default_lava.png", backface_culling=false},
+ },
paramtype = "light",
light_source = LIGHT_MAX - 1,
walkable = false,
pointable = false,
diggable = false,
buildable_to = true,
+ is_ground_content = false,
+ drowning = 1,
liquidtype = "source",
liquid_alternative_flowing = "default:lava_flowing",
liquid_alternative_source = "default:lava_source",
liquid_viscosity = LAVA_VISC,
damage_per_second = 4*2,
post_effect_color = {a=192, r=255, g=64, b=0},
- special_materials = {
- -- New-style lava source material (mostly unused)
- {image="default_lava.png", backface_culling=false},
- },
groups = {lava=3, liquid=2, hot=3},
})
minetest.register_node("default:torch", {
description = "Torch",
drawtype = "torchlike",
- tile_images = {"default_torch_on_floor.png", "default_torch_on_ceiling.png", "default_torch.png"},
+ tiles ={"default_torch_on_floor.png", "default_torch_on_ceiling.png", "default_torch.png"},
inventory_image = "default_torch_on_floor.png",
wield_image = "default_torch_on_floor.png",
paramtype = "light",
paramtype2 = "wallmounted",
sunlight_propagates = true,
+ is_ground_content = false,
walkable = false,
light_source = LIGHT_MAX-1,
selection_box = {
wall_bottom = {-0.1, -0.5, -0.1, 0.1, -0.5+0.6, 0.1},
wall_side = {-0.5, -0.3, -0.1, -0.5+0.3, 0.3, 0.1},
},
- groups = {choppy=2,dig_immediate=3},
+ groups = {choppy=2,dig_immediate=3,attached_node=1},
legacy_wallmounted = true,
sounds = default.node_sound_defaults(),
})
minetest.register_node("default:sign_wall", {
description = "Sign",
drawtype = "signlike",
- tile_images = {"default_sign_wall.png"},
+ tiles ={"default_sign_wall.png"},
inventory_image = "default_sign_wall.png",
wield_image = "default_sign_wall.png",
paramtype = "light",
paramtype2 = "wallmounted",
sunlight_propagates = true,
+ is_ground_content = false,
walkable = false,
- metadata_name = "sign",
selection_box = {
type = "wallmounted",
--wall_top = <default>
--wall_bottom = <default>
--wall_side = <default>
},
- groups = {choppy=2,dig_immediate=2},
+ groups = {choppy=2,dig_immediate=2,attached_node=1},
legacy_wallmounted = true,
sounds = default.node_sound_defaults(),
on_construct = function(pos)
- --local n = minetest.env:get_node(pos)
- local meta = minetest.env:get_meta(pos)
- meta:set_string("formspec", "hack:sign_text_input")
+ --local n = minetest.get_node(pos)
+ local meta = minetest.get_meta(pos)
+ meta:set_string("formspec", "field[text;;${text}]")
meta:set_string("infotext", "\"\"")
end,
on_receive_fields = function(pos, formname, fields, sender)
--print("Sign at "..minetest.pos_to_string(pos).." got "..dump(fields))
- local meta = minetest.env:get_meta(pos)
+ local meta = minetest.get_meta(pos)
fields.text = fields.text or ""
print((sender:get_player_name() or "").." wrote \""..fields.text..
"\" to sign at "..minetest.pos_to_string(pos))
minetest.register_node("default:chest", {
description = "Chest",
- tile_images = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png",
+ tiles ={"default_chest_top.png", "default_chest_top.png", "default_chest_side.png",
"default_chest_side.png", "default_chest_side.png", "default_chest_front.png"},
paramtype2 = "facedir",
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
legacy_facedir_simple = true,
+ is_ground_content = false,
sounds = default.node_sound_wood_defaults(),
on_construct = function(pos)
- local meta = minetest.env:get_meta(pos)
+ local meta = minetest.get_meta(pos)
meta:set_string("formspec",
- "invsize[8,9;]"..
+ "size[8,9]"..
"list[current_name;main;0,0;8,4;]"..
- "list[current_player;main;0,5;8,4;]")
+ "list[current_player;main;0,5;8,4;]" ..
+ "listring[]")
meta:set_string("infotext", "Chest")
local inv = meta:get_inventory()
inv:set_size("main", 8*4)
end,
- on_metadata_inventory_move = function(pos, from_list, from_index,
- to_list, to_index, count, player)
- minetest.log("action", player:get_player_name()..
- " moves stuff in chest at "..minetest.pos_to_string(pos))
- return minetest.node_metadata_inventory_move_allow_all(
- pos, from_list, from_index, to_list, to_index, count, player)
- end,
- on_metadata_inventory_offer = function(pos, listname, index, stack, player)
- minetest.log("action", player:get_player_name()..
- " moves stuff to chest at "..minetest.pos_to_string(pos))
- return minetest.node_metadata_inventory_offer_allow_all(
- pos, listname, index, stack, player)
- end,
- on_metadata_inventory_take = function(pos, listname, index, count, player)
- minetest.log("action", player:get_player_name()..
- " takes stuff from chest at "..minetest.pos_to_string(pos))
- return minetest.node_metadata_inventory_take_allow_all(
- pos, listname, index, count, player)
+ can_dig = function(pos,player)
+ local meta = minetest.get_meta(pos);
+ local inv = meta:get_inventory()
+ return inv:is_empty("main")
end,
})
minetest.register_node("default:chest_locked", {
description = "Locked Chest",
- tile_images = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png",
+ tiles ={"default_chest_top.png", "default_chest_top.png", "default_chest_side.png",
"default_chest_side.png", "default_chest_side.png", "default_chest_lock.png"},
paramtype2 = "facedir",
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
legacy_facedir_simple = true,
+ is_ground_content = false,
sounds = default.node_sound_wood_defaults(),
after_place_node = function(pos, placer)
- local meta = minetest.env:get_meta(pos)
+ local meta = minetest.get_meta(pos)
meta:set_string("owner", placer:get_player_name() or "")
meta:set_string("infotext", "Locked Chest (owned by "..
meta:get_string("owner")..")")
end,
on_construct = function(pos)
- local meta = minetest.env:get_meta(pos)
+ local meta = minetest.get_meta(pos)
meta:set_string("formspec",
- "invsize[8,9;]"..
+ "size[8,9]"..
"list[current_name;main;0,0;8,4;]"..
- "list[current_player;main;0,5;8,4;]")
+ "list[current_player;main;0,5;8,4;]" ..
+ "listring[]")
meta:set_string("infotext", "Locked Chest")
meta:set_string("owner", "")
local inv = meta:get_inventory()
inv:set_size("main", 8*4)
end,
- on_metadata_inventory_move = function(pos, from_list, from_index,
- to_list, to_index, count, player)
- local meta = minetest.env:get_meta(pos)
+ can_dig = function(pos,player)
+ local meta = minetest.get_meta(pos);
+ local inv = meta:get_inventory()
+ return inv:is_empty("main")
+ end,
+ allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
+ local meta = minetest.get_meta(pos)
if not has_locked_chest_privilege(meta, player) then
minetest.log("action", player:get_player_name()..
" tried to access a locked chest belonging to "..
meta:get_string("owner").." at "..
minetest.pos_to_string(pos))
- return
+ return 0
end
- minetest.log("action", player:get_player_name()..
- " moves stuff in locked chest at "..minetest.pos_to_string(pos))
- return minetest.node_metadata_inventory_move_allow_all(
- pos, from_list, from_index, to_list, to_index, count, player)
+ return count
end,
- on_metadata_inventory_offer = function(pos, listname, index, stack, player)
- local meta = minetest.env:get_meta(pos)
+ allow_metadata_inventory_put = function(pos, listname, index, stack, player)
+ local meta = minetest.get_meta(pos)
if not has_locked_chest_privilege(meta, player) then
minetest.log("action", player:get_player_name()..
" tried to access a locked chest belonging to "..
meta:get_string("owner").." at "..
minetest.pos_to_string(pos))
- return
+ return 0
end
- minetest.log("action", player:get_player_name()..
- " moves stuff to locked chest at "..minetest.pos_to_string(pos))
- return minetest.node_metadata_inventory_offer_allow_all(
- pos, listname, index, stack, player)
+ return stack:get_count()
end,
- on_metadata_inventory_take = function(pos, listname, index, count, player)
- local meta = minetest.env:get_meta(pos)
+ allow_metadata_inventory_take = function(pos, listname, index, stack, player)
+ local meta = minetest.get_meta(pos)
if not has_locked_chest_privilege(meta, player) then
minetest.log("action", player:get_player_name()..
" tried to access a locked chest belonging to "..
meta:get_string("owner").." at "..
minetest.pos_to_string(pos))
- return
+ return 0
end
+ return stack:get_count()
+ end,
+ on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
+ minetest.log("action", player:get_player_name()..
+ " moves stuff in locked chest at "..minetest.pos_to_string(pos))
+ end,
+ on_metadata_inventory_put = function(pos, listname, index, stack, player)
+ minetest.log("action", player:get_player_name()..
+ " moves stuff to locked chest at "..minetest.pos_to_string(pos))
+ end,
+ on_metadata_inventory_take = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name()..
" takes stuff from locked chest at "..minetest.pos_to_string(pos))
- return minetest.node_metadata_inventory_take_allow_all(
- pos, listname, index, count, player)
end,
})
+default.furnace_inactive_formspec =
+ "size[8,9]"..
+ "image[2,2;1,1;default_furnace_fire_bg.png]"..
+ "list[current_name;fuel;2,3;1,1;]"..
+ "list[current_name;src;2,1;1,1;]"..
+ "list[current_name;dst;5,1;2,2;]"..
+ "list[current_player;main;0,5;8,4;]" ..
+ "listring[current_name;dst]" ..
+ "listring[current_player;main]" ..
+ "listring[current_name;src]" ..
+ "listring[current_player;main]"
+
minetest.register_node("default:furnace", {
description = "Furnace",
- tile_images = {"default_furnace_side.png", "default_furnace_side.png", "default_furnace_side.png",
+ tiles ={"default_furnace_side.png", "default_furnace_side.png", "default_furnace_side.png",
"default_furnace_side.png", "default_furnace_side.png", "default_furnace_front.png"},
paramtype2 = "facedir",
groups = {cracky=2},
legacy_facedir_simple = true,
+ is_ground_content = false,
sounds = default.node_sound_stone_defaults(),
on_construct = function(pos)
- local meta = minetest.env:get_meta(pos)
- meta:set_string("formspec",
- "invsize[8,9;]"..
- "list[current_name;fuel;2,3;1,1;]"..
- "list[current_name;src;2,1;1,1;]"..
- "list[current_name;dst;5,1;2,2;]"..
- "list[current_player;main;0,5;8,4;]")
+ local meta = minetest.get_meta(pos)
+ meta:set_string("formspec", default.furnace_inactive_formspec)
meta:set_string("infotext", "Furnace")
local inv = meta:get_inventory()
inv:set_size("fuel", 1)
inv:set_size("src", 1)
inv:set_size("dst", 4)
end,
+ can_dig = function(pos,player)
+ local meta = minetest.get_meta(pos);
+ local inv = meta:get_inventory()
+ if not inv:is_empty("fuel") then
+ return false
+ elseif not inv:is_empty("dst") then
+ return false
+ elseif not inv:is_empty("src") then
+ return false
+ end
+ return true
+ end,
})
minetest.register_node("default:furnace_active", {
description = "Furnace",
- tile_images = {"default_furnace_side.png", "default_furnace_side.png", "default_furnace_side.png",
+ tiles ={"default_furnace_side.png", "default_furnace_side.png", "default_furnace_side.png",
"default_furnace_side.png", "default_furnace_side.png", "default_furnace_front_active.png"},
paramtype2 = "facedir",
light_source = 8,
drop = "default:furnace",
groups = {cracky=2},
legacy_facedir_simple = true,
+ is_ground_content = false,
sounds = default.node_sound_stone_defaults(),
on_construct = function(pos)
- local meta = minetest.env:get_meta(pos)
- meta:set_string("formspec",
- "invsize[8,9;]"..
- "list[current_name;fuel;2,3;1,1;]"..
- "list[current_name;src;2,1;1,1;]"..
- "list[current_name;dst;5,1;2,2;]"..
- "list[current_player;main;0,5;8,4;]")
+ local meta = minetest.get_meta(pos)
+ meta:set_string("formspec", default.furnace_inactive_formspec)
meta:set_string("infotext", "Furnace");
local inv = meta:get_inventory()
inv:set_size("fuel", 1)
inv:set_size("src", 1)
inv:set_size("dst", 4)
end,
+ can_dig = function(pos,player)
+ local meta = minetest.get_meta(pos);
+ local inv = meta:get_inventory()
+ if not inv:is_empty("fuel") then
+ return false
+ elseif not inv:is_empty("dst") then
+ return false
+ elseif not inv:is_empty("src") then
+ return false
+ end
+ return true
+ end,
})
-function hacky_swap_node(pos,name)
- local node = minetest.env:get_node(pos)
- local meta = minetest.env:get_meta(pos)
- local meta0 = meta:to_table()
+function swap_node(pos,name)
+ local node = minetest.get_node(pos)
if node.name == name then
return
end
node.name = name
- local meta0 = meta:to_table()
- minetest.env:set_node(pos,node)
- meta = minetest.env:get_meta(pos)
- meta:from_table(meta0)
+ minetest.swap_node(pos, node)
end
minetest.register_abm({
interval = 1.0,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
- local meta = minetest.env:get_meta(pos)
+ local meta = minetest.get_meta(pos)
for i, name in ipairs({
"fuel_totaltime",
"fuel_time",
was_active = true
meta:set_float("fuel_time", meta:get_float("fuel_time") + 1)
meta:set_float("src_time", meta:get_float("src_time") + 1)
- if cooked and cooked.item and meta:get_float("src_time") >= 3 then
+ if cooked and cooked.item and meta:get_float("src_time") >= cooked.time then
-- check if there's room for output in "dst" list
if inv:room_for_item("dst",cooked.item) then
-- Put result in "dst" list
srcstack:take_item()
inv:set_stack("src", 1, srcstack)
else
- print("Could not insert '"..cooked.item.."'")
+ print("Could not insert '"..cooked.item:to_string().."'")
end
meta:set_string("src_time", 0)
end
end
if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
- meta:set_string("infotext","Furnace active: "..(meta:get_float("fuel_time")/meta:get_float("fuel_totaltime")*100).."%")
- hacky_swap_node(pos,"default:furnace_active")
+ local percent = math.floor(meta:get_float("fuel_time") /
+ meta:get_float("fuel_totaltime") * 100)
+ meta:set_string("infotext","Furnace active: "..percent.."%")
+ swap_node(pos,"default:furnace_active")
+ meta:set_string("formspec",
+ "size[8,9]"..
+ "image[2,2;1,1;default_furnace_fire_bg.png^[lowpart:"..
+ (100-percent)..":default_furnace_fire_fg.png]"..
+ "list[current_name;fuel;2,3;1,1;]"..
+ "list[current_name;src;2,1;1,1;]"..
+ "list[current_name;dst;5,1;2,2;]"..
+ "list[current_player;main;0,5;8,4;]" ..
+ "listring[current_name;dst]" ..
+ "listring[current_player;main]" ..
+ "listring[current_name;src]" ..
+ "listring[current_player;main]")
return
end
if fuel.time <= 0 then
meta:set_string("infotext","Furnace out of fuel")
- hacky_swap_node(pos,"default:furnace")
+ swap_node(pos,"default:furnace")
+ meta:set_string("formspec", default.furnace_inactive_formspec)
return
end
if cooked.item:is_empty() then
if was_active then
meta:set_string("infotext","Furnace is empty")
- hacky_swap_node(pos,"default:furnace")
+ swap_node(pos,"default:furnace")
+ meta:set_string("formspec", default.furnace_inactive_formspec)
end
return
end
minetest.register_node("default:cobble", {
description = "Cobble",
- tile_images = {"default_cobble.png"},
- is_ground_content = true,
+ tiles ={"default_cobble.png"},
+ is_ground_content = false,
groups = {cracky=3},
sounds = default.node_sound_stone_defaults(),
})
minetest.register_node("default:mossycobble", {
description = "Mossy Cobble",
- tile_images = {"default_mossycobble.png"},
- is_ground_content = true,
+ tiles ={"default_mossycobble.png"},
+ is_ground_content = false,
groups = {cracky=3},
sounds = default.node_sound_stone_defaults(),
})
minetest.register_node("default:steelblock", {
description = "Steel Block",
- tile_images = {"default_steel_block.png"},
- is_ground_content = true,
+ tiles ={"default_steel_block.png"},
+ is_ground_content = false,
groups = {snappy=1,bendy=2},
sounds = default.node_sound_stone_defaults(),
})
minetest.register_node("default:nyancat", {
description = "Nyancat",
- tile_images = {"default_nc_side.png", "default_nc_side.png", "default_nc_side.png",
+ tiles ={"default_nc_side.png", "default_nc_side.png", "default_nc_side.png",
"default_nc_side.png", "default_nc_back.png", "default_nc_front.png"},
inventory_image = "default_nc_front.png",
paramtype2 = "facedir",
groups = {cracky=2},
legacy_facedir_simple = true,
+ is_ground_content = false,
sounds = default.node_sound_defaults(),
})
minetest.register_node("default:nyancat_rainbow", {
description = "Nyancat Rainbow",
- tile_images = {"default_nc_rb.png"},
+ tiles ={"default_nc_rb.png"},
inventory_image = "default_nc_rb.png",
+ is_ground_content = false,
groups = {cracky=2},
sounds = default.node_sound_defaults(),
})
description = "Sapling",
drawtype = "plantlike",
visual_scale = 1.0,
- tile_images = {"default_sapling.png"},
+ tiles ={"default_sapling.png"},
inventory_image = "default_sapling.png",
wield_image = "default_sapling.png",
paramtype = "light",
walkable = false,
- groups = {snappy=2,dig_immediate=3},
+ groups = {snappy=2,dig_immediate=3,attached_node=1},
sounds = default.node_sound_defaults(),
})
description = "Apple",
drawtype = "plantlike",
visual_scale = 1.0,
- tile_images = {"default_apple.png"},
+ tiles ={"default_apple.png"},
inventory_image = "default_apple.png",
paramtype = "light",
+ is_ground_content = false,
sunlight_propagates = true,
walkable = false,
groups = {fleshy=3,dig_immediate=3},
sounds = default.node_sound_defaults(),
})
+--
+-- Grow tree function
+--
+
+local c_air = minetest.get_content_id("air")
+local c_ignore = minetest.get_content_id("ignore")
+local c_tree = minetest.get_content_id("default:tree")
+local c_leaves = minetest.get_content_id("default:leaves")
+local c_apple = minetest.get_content_id("default:apple")
+function default.grow_tree(data, a, pos, is_apple_tree, seed)
+ --[[
+ NOTE: Tree-placing code is currently duplicated in the engine
+ and in games that have saplings; both are deprecated but not
+ replaced yet
+ ]]--
+ local pr = PseudoRandom(seed)
+ local th = pr:next(4, 5)
+ local x, y, z = pos.x, pos.y, pos.z
+ for yy = y, y+th-1 do
+ local vi = a:index(x, yy, z)
+ if a:contains(x, yy, z) and (data[vi] == c_air or yy == y) then
+ data[vi] = c_tree
+ end
+ end
+ y = y+th-1 -- (x, y, z) is now last piece of trunk
+ local leaves_a = VoxelArea:new{MinEdge={x=-2, y=-1, z=-2}, MaxEdge={x=2, y=2, z=2}}
+ local leaves_buffer = {}
+
+ -- Force leaves near the trunk
+ local d = 1
+ for xi = -d, d do
+ for yi = -d, d do
+ for zi = -d, d do
+ leaves_buffer[leaves_a:index(xi, yi, zi)] = true
+ end
+ end
+ end
+
+ -- Add leaves randomly
+ for iii = 1, 8 do
+ local d = 1
+ local xx = pr:next(leaves_a.MinEdge.x, leaves_a.MaxEdge.x - d)
+ local yy = pr:next(leaves_a.MinEdge.y, leaves_a.MaxEdge.y - d)
+ local zz = pr:next(leaves_a.MinEdge.z, leaves_a.MaxEdge.z - d)
+
+ for xi = 0, d do
+ for yi = 0, d do
+ for zi = 0, d do
+ leaves_buffer[leaves_a:index(xx+xi, yy+yi, zz+zi)] = true
+ end
+ end
+ end
+ end
+
+ -- Add the leaves
+ for xi = leaves_a.MinEdge.x, leaves_a.MaxEdge.x do
+ for yi = leaves_a.MinEdge.y, leaves_a.MaxEdge.y do
+ for zi = leaves_a.MinEdge.z, leaves_a.MaxEdge.z do
+ if a:contains(x+xi, y+yi, z+zi) then
+ local vi = a:index(x+xi, y+yi, z+zi)
+ if data[vi] == c_air or data[vi] == c_ignore then
+ if leaves_buffer[leaves_a:index(xi, yi, zi)] then
+ if is_apple_tree and pr:next(1, 100) <= 10 then
+ data[vi] = c_apple
+ else
+ data[vi] = c_leaves
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+end
+
+--
+-- ABMs
+--
+
+minetest.register_abm({
+ nodenames = {"default:sapling"},
+ interval = 10,
+ chance = 50,
+ action = function(pos, node)
+ if minetest.get_item_group(minetest.get_node(
+ {x = pos.x, y = pos.y - 1, z = pos.z}).name, "soil") == 0 then
+ return
+ end
+ print("A sapling grows into a tree at "..minetest.pos_to_string(pos))
+ local vm = minetest.get_voxel_manip()
+ local minp, maxp = vm:read_from_map({x=pos.x-16, y=pos.y, z=pos.z-16}, {x=pos.x+16, y=pos.y+16, z=pos.z+16})
+ local a = VoxelArea:new{MinEdge=minp, MaxEdge=maxp}
+ local data = vm:get_data()
+ default.grow_tree(data, a, pos, math.random(1, 4) == 1, math.random(1,100000))
+ vm:set_data(data)
+ vm:write_to_map(data)
+ vm:update_map()
+ end
+})
+
+minetest.register_abm({
+ nodenames = {"default:dirt"},
+ interval = 2,
+ chance = 200,
+ action = function(pos, node)
+ local above = {x=pos.x, y=pos.y+1, z=pos.z}
+ local name = minetest.get_node(above).name
+ local nodedef = minetest.registered_nodes[name]
+ if nodedef and (nodedef.sunlight_propagates or nodedef.paramtype == "light")
+ and nodedef.liquidtype == "none"
+ and (minetest.get_node_light(above) or 0) >= 13 then
+ if name == "default:snow" or name == "default:snowblock" then
+ minetest.set_node(pos, {name = "default:dirt_with_snow"})
+ else
+ minetest.set_node(pos, {name = "default:dirt_with_grass"})
+ end
+ end
+ end
+})
+
+minetest.register_abm({
+ nodenames = {"default:dirt_with_grass"},
+ interval = 2,
+ chance = 20,
+ action = function(pos, node)
+ local above = {x=pos.x, y=pos.y+1, z=pos.z}
+ local name = minetest.get_node(above).name
+ local nodedef = minetest.registered_nodes[name]
+ if name ~= "ignore" and nodedef
+ and not ((nodedef.sunlight_propagates or nodedef.paramtype == "light")
+ and nodedef.liquidtype == "none") then
+ minetest.set_node(pos, {name = "default:dirt"})
+ end
+ end
+})
+
--
-- Crafting items
--
})
--
--- Creative inventory
---
-
-minetest.add_to_creative_inventory('default:pick_mese')
-minetest.add_to_creative_inventory('default:pick_steel')
-minetest.add_to_creative_inventory('default:axe_steel')
-minetest.add_to_creative_inventory('default:shovel_steel')
-
-minetest.add_to_creative_inventory('default:torch')
-minetest.add_to_creative_inventory('default:cobble')
-minetest.add_to_creative_inventory('default:dirt')
-minetest.add_to_creative_inventory('default:stone')
-minetest.add_to_creative_inventory('default:sand')
-minetest.add_to_creative_inventory('default:sandstone')
-minetest.add_to_creative_inventory('default:clay')
-minetest.add_to_creative_inventory('default:brick')
-minetest.add_to_creative_inventory('default:tree')
-minetest.add_to_creative_inventory('default:wood')
-minetest.add_to_creative_inventory('default:leaves')
-minetest.add_to_creative_inventory('default:cactus')
-minetest.add_to_creative_inventory('default:papyrus')
-minetest.add_to_creative_inventory('default:bookshelf')
-minetest.add_to_creative_inventory('default:glass')
-minetest.add_to_creative_inventory('default:fence_wood')
-minetest.add_to_creative_inventory('default:rail')
-minetest.add_to_creative_inventory('default:mese')
-minetest.add_to_creative_inventory('default:chest')
-minetest.add_to_creative_inventory('default:furnace')
-minetest.add_to_creative_inventory('default:sign_wall')
-minetest.add_to_creative_inventory('default:water_source')
-minetest.add_to_creative_inventory('default:lava_source')
-minetest.add_to_creative_inventory('default:ladder')
-
---
--- Aliases for the current map generator outputs
---
-
-minetest.register_alias("mapgen_air", "air")
-minetest.register_alias("mapgen_stone", "default:stone")
-minetest.register_alias("mapgen_tree", "default:tree")
-minetest.register_alias("mapgen_leaves", "default:leaves")
-minetest.register_alias("mapgen_apple", "default:apple")
-minetest.register_alias("mapgen_water_source", "default:water_source")
-minetest.register_alias("mapgen_dirt", "default:dirt")
-minetest.register_alias("mapgen_sand", "default:sand")
-minetest.register_alias("mapgen_gravel", "default:gravel")
-minetest.register_alias("mapgen_clay", "default:clay")
-minetest.register_alias("mapgen_lava_source", "default:lava_source")
-minetest.register_alias("mapgen_cobble", "default:cobble")
-minetest.register_alias("mapgen_mossycobble", "default:mossycobble")
-minetest.register_alias("mapgen_dirt_with_grass", "default:dirt_with_grass")
-minetest.register_alias("mapgen_junglegrass", "default:junglegrass")
-minetest.register_alias("mapgen_stone_with_coal", "default:stone_with_coal")
-minetest.register_alias("mapgen_stone_with_iron", "default:stone_with_iron")
-minetest.register_alias("mapgen_mese", "default:mese")
-
---
--- Some common functions
+-- Support old code
--
-default.falling_node_names = {}
-
-function nodeupdate_single(p)
- n = minetest.env:get_node(p)
- if default.falling_node_names[n.name] ~= nil then
- p_bottom = {x=p.x, y=p.y-1, z=p.z}
- n_bottom = minetest.env:get_node(p_bottom)
- if n_bottom.name == "air" then
- minetest.env:remove_node(p)
- minetest.env:add_entity(p, "default:falling_"..n.name)
- nodeupdate(p)
- end
- end
-end
-
-function nodeupdate(p)
- for x = -1,1 do
- for y = -1,1 do
- for z = -1,1 do
- p2 = {x=p.x+x, y=p.y+y, z=p.z+z}
- nodeupdate_single(p2)
- end
- end
- end
+function default.spawn_falling_node(p, nodename)
+ spawn_falling_node(p, nodename)
end
---
--- Falling stuff
---
-
+-- Horrible crap to support old code
+-- Don't use this and never do what this does, it's completely wrong!
+-- (More specifically, the client and the C++ code doesn't get the group)
function default.register_falling_node(nodename, texture)
- default.falling_node_names[nodename] = true
- -- Override naming conventions for stuff like :default:falling_default:sand
- minetest.register_entity(":default:falling_"..nodename, {
- -- Static definition
- physical = true,
- collisionbox = {-0.5,-0.5,-0.5, 0.5,0.5,0.5},
- visual = "cube",
- textures = {texture,texture,texture,texture,texture,texture},
- -- State
- -- Methods
- on_step = function(self, dtime)
- -- Set gravity
- self.object:setacceleration({x=0, y=-10, z=0})
- -- Turn to actual sand when collides to ground or just move
- local pos = self.object:getpos()
- local bcp = {x=pos.x, y=pos.y-0.7, z=pos.z} -- Position of bottom center point
- local bcn = minetest.env:get_node(bcp)
- if bcn.name ~= "air" then
- -- Turn to a sand node
- local np = {x=bcp.x, y=bcp.y+1, z=bcp.z}
- minetest.env:add_node(np, {name=nodename})
- self.object:remove()
- else
- -- Do nothing
- end
- end
- })
+ minetest.log("error", debug.traceback())
+ minetest.log('error', "WARNING: default.register_falling_node is deprecated")
+ if minetest.registered_nodes[nodename] then
+ minetest.registered_nodes[nodename].groups.falling_node = 1
+ end
end
-default.register_falling_node("default:sand", "default_sand.png")
-default.register_falling_node("default:gravel", "default_gravel.png")
-
--
-- Global callbacks
--
function on_placenode(p, node)
--print("on_placenode")
- nodeupdate(p)
end
minetest.register_on_placenode(on_placenode)
function on_dignode(p, node)
--print("on_dignode")
- nodeupdate(p)
end
minetest.register_on_dignode(on_dignode)
end
minetest.register_on_punchnode(on_punchnode)
-local function handle_give_command(cmd, giver, receiver, stackstring)
- if not minetest.get_player_privs(giver)["give"] then
- minetest.chat_send_player(giver, "error: you don't have permission to give")
- return
- end
- minetest.debug("DEBUG: "..cmd..' invoked, stackstring="'..stackstring..'"')
- minetest.log(cmd..' invoked, stackstring="'..stackstring..'"')
- local itemstack = ItemStack(stackstring)
- if itemstack:is_empty() then
- minetest.chat_send_player(giver, 'error: cannot give an empty item')
- return
- elseif not itemstack:is_known() then
- minetest.chat_send_player(giver, 'error: cannot give an unknown item')
- return
- end
- local receiverref = minetest.env:get_player_by_name(receiver)
- if receiverref == nil then
- minetest.chat_send_player(giver, receiver..' is not a known player')
- return
- end
- local leftover = receiverref:get_inventory():add_item("main", itemstack)
- if leftover:is_empty() then
- partiality = ""
- elseif leftover:get_count() == itemstack:get_count() then
- partiality = "could not be "
- else
- partiality = "partially "
- end
- -- The actual item stack string may be different from what the "giver"
- -- entered (e.g. big numbers are always interpreted as 2^16-1).
- stackstring = itemstack:to_string()
- if giver == receiver then
- minetest.chat_send_player(giver, '"'..stackstring
- ..'" '..partiality..'added to inventory.');
- else
- minetest.chat_send_player(giver, '"'..stackstring
- ..'" '..partiality..'added to '..receiver..'\'s inventory.');
- minetest.chat_send_player(receiver, '"'..stackstring
- ..'" '..partiality..'added to inventory.');
- end
-end
-
-minetest.register_on_chat_message(function(name, message)
- --print("default on_chat_message: name="..dump(name).." message="..dump(message))
- local cmd = "/giveme"
- if message:sub(0, #cmd) == cmd then
- local stackstring = string.match(message, cmd.." (.*)")
- if stackstring == nil then
- minetest.chat_send_player(name, 'usage: '..cmd..' stackstring')
- return true -- Handled chat message
- end
- handle_give_command(cmd, name, name, stackstring)
- return true
- end
- local cmd = "/give"
- if message:sub(0, #cmd) == cmd then
- local receiver, stackstring = string.match(message, cmd.." ([%a%d_-]+) (.*)")
- if receiver == nil or stackstring == nil then
- minetest.chat_send_player(name, 'usage: '..cmd..' name stackstring')
- return true -- Handled chat message
- end
- handle_give_command(cmd, name, receiver, stackstring)
- return true
- end
- local cmd = "/spawnentity"
- if message:sub(0, #cmd) == cmd then
- if not minetest.get_player_privs(name)["give"] then
- minetest.chat_send_player(name, "you don't have permission to spawn (give)")
- return true -- Handled chat message
- end
- if not minetest.get_player_privs(name)["interact"] then
- minetest.chat_send_player(name, "you don't have permission to interact")
- return true -- Handled chat message
- end
- local entityname = string.match(message, cmd.." (.*)")
- if entityname == nil then
- minetest.chat_send_player(name, 'usage: '..cmd..' entityname')
- return true -- Handled chat message
- end
- print(cmd..' invoked, entityname="'..entityname..'"')
- local player = minetest.env:get_player_by_name(name)
- if player == nil then
- print("Unable to spawn entity, player is nil")
- return true -- Handled chat message
- end
- local p = player:getpos()
- p.y = p.y + 1
- minetest.env:add_entity(p, entityname)
- minetest.chat_send_player(name, '"'..entityname
- ..'" spawned.');
- return true -- Handled chat message
- end
- local cmd = "/pulverize"
- if message:sub(0, #cmd) == cmd then
- local player = minetest.env:get_player_by_name(name)
- if player == nil then
- print("Unable to pulverize, player is nil")
- return true -- Handled chat message
- end
- if player:get_wielded_item():is_empty() then
- minetest.chat_send_player(name, 'Unable to pulverize, no item in hand.')
- else
- player:set_wielded_item(nil)
- minetest.chat_send_player(name, 'An item was pulverized.')
- end
- return true
- end
-end)
-
--
-- Test some things
--
local function test_get_craft_result()
- print("test_get_craft_result()")
+ minetest.log("info", "test_get_craft_result()")
-- normal
local input = {
method = "normal",
width = 2,
items = {"", "default:coal_lump", "", "default:stick"}
}
- print("torch crafting input: "..dump(input))
+ minetest.log("info", "torch crafting input: "..dump(input))
local output, decremented_input = minetest.get_craft_result(input)
- print("torch crafting output: "..dump(output))
- print("torch crafting decremented input: "..dump(decremented_input))
+ minetest.log("info", "torch crafting output: "..dump(output))
+ minetest.log("info", "torch crafting decremented input: "..dump(decremented_input))
assert(output.item)
- print("torch crafting output.item:to_table(): "..dump(output.item:to_table()))
+ minetest.log("info", "torch crafting output.item:to_table(): "..dump(output.item:to_table()))
assert(output.item:get_name() == "default:torch")
assert(output.item:get_count() == 4)
-- fuel
width = 1,
items = {"default:coal_lump"}
}
- print("coal fuel input: "..dump(input))
+ minetest.log("info", "coal fuel input: "..dump(input))
local output, decremented_input = minetest.get_craft_result(input)
- print("coal fuel output: "..dump(output))
- print("coal fuel decremented input: "..dump(decremented_input))
+ minetest.log("info", "coal fuel output: "..dump(output))
+ minetest.log("info", "coal fuel decremented input: "..dump(decremented_input))
assert(output.time)
assert(output.time > 0)
-- cook
width = 1,
items = {"default:cobble"}
}
- print("cobble cooking input: "..dump(output))
+ minetest.log("info", "cobble cooking input: "..dump(output))
local output, decremented_input = minetest.get_craft_result(input)
- print("cobble cooking output: "..dump(output))
- print("cobble cooking decremented input: "..dump(decremented_input))
+ minetest.log("info", "cobble cooking output: "..dump(output))
+ minetest.log("info", "cobble cooking decremented input: "..dump(decremented_input))
assert(output.time)
assert(output.time > 0)
assert(output.item)
- print("cobble cooking output.item:to_table(): "..dump(output.item:to_table()))
+ minetest.log("info", "cobble cooking output.item:to_table(): "..dump(output.item:to_table()))
assert(output.item:get_name() == "default:stone")
assert(output.item:get_count() == 1)
end
--dump2(minetest.registered_entities)
-- END
+