Remove accidental stupid naming in craftitem example
[oweals/minetest.git] / data / mods / default / init.lua
index a8e3b7ba781be784eb84f2048636f397c25f5b43..ae917a03637a6ecf4901914cbb77e6db7fd97928 100644 (file)
@@ -2,17 +2,57 @@
 -- dump2(obj, name="_", dumped={})
 -- dump(obj, dumped={})
 --
--- Textures:
--- Mods should prefix their textures with modname_, eg. given the mod
--- name "foomod", a texture could be called "foomod_superfurnace.png"
+-- Naming convention for registered textual names
+-- ----------------------------------------------
+-- "modname_<whatever>"
+--
+-- This is to prevent conflicting names from corrupting maps and is
+-- enforced by the mod loader.
+--
+-- Example: mod "experimental", ideal item/node/entity name "tnt":
+--          -> the name should be "experimental_tnt".
+--
+-- Enforcement can be overridden by prefixing the name with ":". This can
+-- be used for overriding the registrations of some other mod.
+--
+-- Default mod uses ":" for maintaining backwards compatibility.
+--
+-- Textures
+-- --------
+-- Mods should generally prefix their textures with modname_, eg. given
+-- the mod name "foomod", a texture could be called "foomod_superfurnace.png"
+--
+-- This is not crucial and a conflicting name will not corrupt maps.
+--
+-- Representations of simple things
+-- --------------------------------
+--
+-- MapNode representation:
+-- {name="name", param1=num, param2=num}
+--
+-- Position representation:
+-- {x=num, y=num, z=num}
+--
+-- stackstring/itemstring: A stack of items in serialized format.
+-- eg. 'node "dirt" 5'
+-- eg. 'tool "WPick" 21323'
+-- eg. 'craft "apple" 2'
+--
+-- item: A single item in Lua table format.
+-- eg. {type="node", name="dirt"} 
+--     ^ a single dirt node
+-- eg. {type="tool", name="WPick", wear=21323}
+--     ^ a wooden pick about 1/3 weared out
+-- eg. {type="craft", name="apple"}
+--     ^ an apple.
 --
 -- Global functions:
--- minetest.register_entity(name, prototype_table)
--- minetest.register_tool(name, {lots of stuff})
--- minetest.register_node(name, {lots of stuff})
--- minetest.register_craftitem(name, {lots of stuff})
--- minetest.register_craft({output=item, recipe={...})
--- minetest.register_globalstep(func)
+-- minetest.register_entity(name, prototype table)
+-- minetest.register_tool(name, tool definition)
+-- minetest.register_node(name, node definition)
+-- minetest.register_craftitem(name, craftitem definition)
+-- minetest.register_craft(recipe)
+-- minetest.register_globalstep(func(dtime))
 -- minetest.register_on_placenode(func(pos, newnode, placer))
 -- minetest.register_on_dignode(func(pos, oldnode, digger))
 -- minetest.register_on_punchnode(func(pos, node, puncher))
 -- minetest.register_on_respawnplayer(func(ObjectRef))
 -- ^ return true in func to disable regular player placement
 -- minetest.register_on_chat_message(func(name, message))
--- minetest.setting_get(name)
--- minetest.setting_getbool(name)
+-- minetest.add_to_creative_inventory(itemstring)
+-- minetest.setting_get(name) -> string or nil
+-- minetest.setting_getbool(name) -> boolean value or nil
 -- minetest.chat_send_all(text)
 -- minetest.chat_send_player(name, text)
+-- minetest.get_player_privs(name) -> set of privs
+-- stackstring_take_item(stackstring) -> stackstring, item
+-- stackstring_put_item(stackstring, item) -> stackstring, success
+-- stackstring_put_stackstring(stackstring, stackstring) -> stackstring, success
 --
 -- Global objects:
 -- minetest.env - environment reference
@@ -51,6 +96,7 @@
 -- - add_rat(pos)
 -- - add_firefly(pos)
 -- - get_meta(pos) -- Get a NodeMetaRef at that position
+-- - get_player_by_name(name) -- Get an ObjectRef to a player
 --
 -- NodeMetaRef
 -- - get_type()
 -- - set_text(text) -- eg. set the text of a sign
 -- - get_text()
 -- - get_owner()
+-- Generic node metadata specific:
 -- - set_infotext(infotext)
 -- - inventory_set_list(name, {item1, item2, ...})
 -- - inventory_get_list(name)
 -- ObjectRef is basically ServerActiveObject.
 -- ObjectRef methods:
 -- - remove(): remove object (after returning from Lua)
--- - getpos(): returns {x=num, y=num, z=num}
+-- - getpos() -> {x=num, y=num, z=num}
 -- - setpos(pos); pos={x=num, y=num, z=num}
 -- - moveto(pos, continuous=false): interpolated move
--- - add_to_inventory(itemstring): add an item to object inventory
+-- - punch(puncher, time_from_last_punch)
+--   ^ puncher = an another ObjectRef,
+--   ^ time_from_last_punch = time since last punch action of the puncher
+-- - right_click(clicker); clicker = an another ObjectRef
+-- - get_wield_digging_properties() -> digging property table
 -- - add_to_inventory_later(itemstring): like above, but after callback returns (only allowed for craftitem callbacks)
 -- - get_hp(): returns number of hitpoints (2 * number of hearts)
 -- - set_hp(hp): set number of hitpoints (2 * number of hearts)
+-- LuaEntitySAO-only:
+-- - setvelocity({x=num, y=num, z=num})
+-- - setacceleration({x=num, y=num, z=num})
+-- - getacceleration() -> {x=num, y=num, z=num}
 -- - settexturemod(mod)
 -- - setsprite(p={x=0,y=0}, num_frames=1, framelength=0.2,
 -- -           select_horiz_by_yawpitch=false)
+-- Player-only:
+-- - get_player_name(): will return nil if is not a player
+-- - inventory_set_list(name, {item1, item2, ...})
+-- - inventory_get_list(name) -> {item1, item2, ...}
+-- - damage_wielded_item(num) (item damage/wear range is 0-65535)
+-- - add_to_inventory(itemstring): add an item to object inventory
 --
 -- Registered entities:
 -- - Functions receive a "luaentity" as self:
 --   - on_step(self, dtime)
 --   - on_punch(self, hitter)
 --   - on_rightclick(self, clicker)
---   - get_staticdata(self): return string
+--   - get_staticdata(self)
+--     ^ return string that will be passed to on_activate when the object
+--       is created next time
 --
--- MapNode representation:
--- {name="name", param1=num, param2=num}
+-- Entity prototype table:
+-- {
+--     physical = true,
+--     collisionbox = {-0.5,-0.5,-0.5, 0.5,0.5,0.5},
+--     visual = "cube",
+--     textures = {texture,texture,texture,texture,texture,texture},
+--     on_activate = function(self, staticdata),
+--     on_step = function(self, dtime),
+--     on_punch = function(self, hitter),
+--     on_rightclick = function(self, clicker),
+--     get_staticdata = function(self),
+--     # Also you can define arbitrary member variables here
+--     myvariable = whatever,
+-- }
 --
--- Position representation:
--- {x=num, y=num, z=num}
+-- Tool definition:
+-- {
+--     image = "tool_steelaxe.png",
+--     full_punch_interval = 1.0,
+--     basetime = 1.0,
+--     dt_weight = 0.5,
+--     dt_crackiness = -0.2,
+--     dt_crumbliness = 1,
+--     dt_cuttability = -0.5,
+--     basedurability = 330,
+--     dd_weight = 0,
+--     dd_crackiness = 0,
+--     dd_crumbliness = 0,
+--     dd_cuttability = 0,
+-- }
+--
+-- Node definition options:
+-- {
+--     name = "somenode",
+--     drawtype = "normal",
+--     visual_scale = 1.0,
+--     tile_images = {"unknown_block.png"},
+--     inventory_image = "unknown_block.png",
+--     special_materials = {
+--         {image="", backface_culling=true},
+--         {image="", backface_culling=true},
+--     },
+--     alpha = 255,
+--     post_effect_color = {a=0, r=0, g=0, b=0},
+--     paramtype = "none",
+--     is_ground_content = false,
+--     light_propagates = false,
+--     sunlight_propagates = false,
+--     walkable = true,
+--     pointable = true,
+--     diggable = true,
+--     climbable = false,
+--     buildable_to = false,
+--     wall_mounted = false,
+--     often_contains_mineral = false,
+--     dug_item = "",
+--     extra_dug_item = "",
+--     extra_dug_item_rarity = 2,
+--     metadata_name = "",
+--     liquidtype = "none",
+--     liquid_alternative_flowing = "",
+--     liquid_alternative_source = "",
+--     liquid_viscosity = 0,
+--     light_source = 0,
+--     damage_per_second = 0,
+--     selection_box = {type="regular"},
+--     material = {
+--         diggablity = "normal",
+--         weight = 0,
+--         crackiness = 0,
+--         crumbliness = 0,
+--         cuttability = 0,
+--         flammability = 0,
+--     },
+--     cookresult_item = "", -- Cannot be cooked
+--     furnace_cooktime = 3.0,
+--     furnace_burntime = -1, -- Cannot be used as fuel
+-- }
+--
+-- Craftitem definition options:
+-- minetest.register_craftitem("modname_name", {
+--     image = "image.png",
+--     stack_max = <maximum number of items in stack>,
+--     cookresult_item = itemstring (result of cooking),
+--     furnace_cooktime = <cooking time>,
+--     furnace_burntime = <time to burn as fuel in furnace>,
+--     usable = <uh... some boolean value>,
+--     dropcount = <amount of items to drop using drop action>
+--     liquids_pointable = <whether can point liquids>,
+--     on_drop = func(item, dropper, pos),
+--     on_place_on_ground = func(item, placer, pos),
+--     on_use = func(item, player, pointed_thing),
+-- })
+-- 
+-- Recipe:
+-- {
+--     output = 'tool "STPick"',
+--     recipe = {
+--         {'node "cobble"', 'node "cobble"', 'node "cobble"'},
+--         {'', 'craft "Stick"', ''},
+--         {'', 'craft "Stick"', ''},
+--     }
+-- }
 --
 
 -- print("minetest dump: "..dump(minetest))
@@ -115,7 +276,7 @@ LIGHT_MAX = 14
 -- Tool definition
 --
 
-minetest.register_tool("WPick", {
+minetest.register_tool(":WPick", {
        image = "tool_woodpick.png",
        basetime = 2.0,
        dt_weight = 0,
@@ -128,7 +289,7 @@ minetest.register_tool("WPick", {
        dd_crumbliness = 0,
        dd_cuttability = 0,
 })
-minetest.register_tool("STPick", {
+minetest.register_tool(":STPick", {
        image = "tool_stonepick.png",
        basetime = 1.5,
        dt_weight = 0,
@@ -141,7 +302,7 @@ minetest.register_tool("STPick", {
        dd_crumbliness = 0,
        dd_cuttability = 0,
 })
-minetest.register_tool("SteelPick", {
+minetest.register_tool(":SteelPick", {
        image = "tool_steelpick.png",
        basetime = 1.0,
        dt_weight = 0,
@@ -154,7 +315,7 @@ minetest.register_tool("SteelPick", {
        dd_crumbliness = 0,
        dd_cuttability = 0,
 })
-minetest.register_tool("MesePick", {
+minetest.register_tool(":MesePick", {
        image = "tool_mesepick.png",
        basetime = 0,
        dt_weight = 0,
@@ -167,7 +328,7 @@ minetest.register_tool("MesePick", {
        dd_crumbliness = 0,
        dd_cuttability = 0,
 })
-minetest.register_tool("WShovel", {
+minetest.register_tool(":WShovel", {
        image = "tool_woodshovel.png",
        basetime = 2.0,
        dt_weight = 0.5,
@@ -180,7 +341,7 @@ minetest.register_tool("WShovel", {
        dd_crumbliness = 0,
        dd_cuttability = 0,
 })
-minetest.register_tool("STShovel", {
+minetest.register_tool(":STShovel", {
        image = "tool_stoneshovel.png",
        basetime = 1.5,
        dt_weight = 0.5,
@@ -193,7 +354,7 @@ minetest.register_tool("STShovel", {
        dd_crumbliness = 0,
        dd_cuttability = 0,
 })
-minetest.register_tool("SteelShovel", {
+minetest.register_tool(":SteelShovel", {
        image = "tool_steelshovel.png",
        basetime = 1.0,
        dt_weight = 0.5,
@@ -206,7 +367,7 @@ minetest.register_tool("SteelShovel", {
        dd_crumbliness = 0,
        dd_cuttability = 0,
 })
-minetest.register_tool("WAxe", {
+minetest.register_tool(":WAxe", {
        image = "tool_woodaxe.png",
        basetime = 2.0,
        dt_weight = 0.5,
@@ -219,7 +380,7 @@ minetest.register_tool("WAxe", {
        dd_crumbliness = 0,
        dd_cuttability = 0,
 })
-minetest.register_tool("STAxe", {
+minetest.register_tool(":STAxe", {
        image = "tool_stoneaxe.png",
        basetime = 1.5,
        dt_weight = 0.5,
@@ -232,7 +393,7 @@ minetest.register_tool("STAxe", {
        dd_crumbliness = 0,
        dd_cuttability = 0,
 })
-minetest.register_tool("SteelAxe", {
+minetest.register_tool(":SteelAxe", {
        image = "tool_steelaxe.png",
        basetime = 1.0,
        dt_weight = 0.5,
@@ -245,7 +406,7 @@ minetest.register_tool("SteelAxe", {
        dd_crumbliness = 0,
        dd_cuttability = 0,
 })
-minetest.register_tool("WSword", {
+minetest.register_tool(":WSword", {
        image = "tool_woodsword.png",
        basetime = 3.0,
        dt_weight = 3,
@@ -258,7 +419,7 @@ minetest.register_tool("WSword", {
        dd_crumbliness = 0,
        dd_cuttability = 0,
 })
-minetest.register_tool("STSword", {
+minetest.register_tool(":STSword", {
        image = "tool_stonesword.png",
        basetime = 2.5,
        dt_weight = 3,
@@ -271,7 +432,7 @@ minetest.register_tool("STSword", {
        dd_crumbliness = 0,
        dd_cuttability = 0,
 })
-minetest.register_tool("SteelSword", {
+minetest.register_tool(":SteelSword", {
        image = "tool_steelsword.png",
        basetime = 2.0,
        dt_weight = 3,
@@ -284,7 +445,8 @@ minetest.register_tool("SteelSword", {
        dd_crumbliness = 0,
        dd_cuttability = 0,
 })
-minetest.register_tool("", {
+-- The hand
+minetest.register_tool(":", {
        image = "",
        basetime = 0.5,
        dt_weight = 1,
@@ -298,307 +460,275 @@ minetest.register_tool("", {
        dd_cuttability = 0,
 })
 
---[[
-minetest.register_tool("horribletool", {
-       image = "lava.png",
-       basetime = 2.0
-       dt_weight = 0.2
-       dt_crackiness = 0.2
-       dt_crumbliness = 0.2
-       dt_cuttability = 0.2
-       basedurability = 50
-       dd_weight = -5
-       dd_crackiness = -5
-       dd_crumbliness = -5
-       dd_cuttability = -5
-})
---]]
-
 --
 -- Crafting definition
 --
 
 minetest.register_craft({
-       output = 'NodeItem "wood" 4',
+       output = 'node "wood" 4',
        recipe = {
-               {'NodeItem "tree"'},
+               {'node "tree"'},
        }
 })
 
 minetest.register_craft({
-       output = 'CraftItem "Stick" 4',
+       output = 'craft "Stick" 4',
        recipe = {
-               {'NodeItem "wood"'},
+               {'node "wood"'},
        }
 })
 
 minetest.register_craft({
-       output = 'NodeItem "wooden_fence" 2',
+       output = 'node "wooden_fence" 2',
        recipe = {
-               {'CraftItem "Stick"', 'CraftItem "Stick"', 'CraftItem "Stick"'},
-               {'CraftItem "Stick"', 'CraftItem "Stick"', 'CraftItem "Stick"'},
+               {'craft "Stick"', 'craft "Stick"', 'craft "Stick"'},
+               {'craft "Stick"', 'craft "Stick"', 'craft "Stick"'},
        }
 })
 
 minetest.register_craft({
-       output = 'NodeItem "sign_wall" 1',
+       output = 'node "sign_wall" 1',
        recipe = {
-               {'NodeItem "wood"', 'NodeItem "wood"', 'NodeItem "wood"'},
-               {'NodeItem "wood"', 'NodeItem "wood"', 'NodeItem "wood"'},
-               {'', 'CraftItem "Stick"', ''},
+               {'node "wood"', 'node "wood"', 'node "wood"'},
+               {'node "wood"', 'node "wood"', 'node "wood"'},
+               {'', 'craft "Stick"', ''},
        }
 })
 
 minetest.register_craft({
-       output = 'NodeItem "torch" 4',
+       output = 'node "torch" 4',
        recipe = {
-               {'CraftItem "lump_of_coal"'},
-               {'CraftItem "Stick"'},
+               {'craft "lump_of_coal"'},
+               {'craft "Stick"'},
        }
 })
 
 minetest.register_craft({
-       output = 'ToolItem "WPick"',
+       output = 'tool "WPick"',
        recipe = {
-               {'NodeItem "wood"', 'NodeItem "wood"', 'NodeItem "wood"'},
-               {'', 'CraftItem "Stick"', ''},
-               {'', 'CraftItem "Stick"', ''},
+               {'node "wood"', 'node "wood"', 'node "wood"'},
+               {'', 'craft "Stick"', ''},
+               {'', 'craft "Stick"', ''},
        }
 })
 
 minetest.register_craft({
-       output = 'ToolItem "STPick"',
+       output = 'tool "STPick"',
        recipe = {
-               {'NodeItem "cobble"', 'NodeItem "cobble"', 'NodeItem "cobble"'},
-               {'', 'CraftItem "Stick"', ''},
-               {'', 'CraftItem "Stick"', ''},
+               {'node "cobble"', 'node "cobble"', 'node "cobble"'},
+               {'', 'craft "Stick"', ''},
+               {'', 'craft "Stick"', ''},
        }
 })
 
 minetest.register_craft({
-       output = 'ToolItem "SteelPick"',
+       output = 'tool "SteelPick"',
        recipe = {
-               {'CraftItem "steel_ingot"', 'CraftItem "steel_ingot"', 'CraftItem "steel_ingot"'},
-               {'', 'CraftItem "Stick"', ''},
-               {'', 'CraftItem "Stick"', ''},
+               {'craft "steel_ingot"', 'craft "steel_ingot"', 'craft "steel_ingot"'},
+               {'', 'craft "Stick"', ''},
+               {'', 'craft "Stick"', ''},
        }
 })
 
 minetest.register_craft({
-       output = 'ToolItem "MesePick"',
+       output = 'tool "MesePick"',
        recipe = {
-               {'NodeItem "mese"', 'NodeItem "mese"', 'NodeItem "mese"'},
-               {'', 'CraftItem "Stick"', ''},
-               {'', 'CraftItem "Stick"', ''},
+               {'node "mese"', 'node "mese"', 'node "mese"'},
+               {'', 'craft "Stick"', ''},
+               {'', 'craft "Stick"', ''},
        }
 })
 
 minetest.register_craft({
-       output = 'ToolItem "WShovel"',
+       output = 'tool "WShovel"',
        recipe = {
-               {'NodeItem "wood"'},
-               {'CraftItem "Stick"'},
-               {'CraftItem "Stick"'},
+               {'node "wood"'},
+               {'craft "Stick"'},
+               {'craft "Stick"'},
        }
 })
 
 minetest.register_craft({
-       output = 'ToolItem "STShovel"',
+       output = 'tool "STShovel"',
        recipe = {
-               {'NodeItem "cobble"'},
-               {'CraftItem "Stick"'},
-               {'CraftItem "Stick"'},
+               {'node "cobble"'},
+               {'craft "Stick"'},
+               {'craft "Stick"'},
        }
 })
 
 minetest.register_craft({
-       output = 'ToolItem "SteelShovel"',
+       output = 'tool "SteelShovel"',
        recipe = {
-               {'CraftItem "steel_ingot"'},
-               {'CraftItem "Stick"'},
-               {'CraftItem "Stick"'},
+               {'craft "steel_ingot"'},
+               {'craft "Stick"'},
+               {'craft "Stick"'},
        }
 })
 
 minetest.register_craft({
-       output = 'ToolItem "WAxe"',
+       output = 'tool "WAxe"',
        recipe = {
-               {'NodeItem "wood"', 'NodeItem "wood"'},
-               {'NodeItem "wood"', 'CraftItem "Stick"'},
-               {'', 'CraftItem "Stick"'},
+               {'node "wood"', 'node "wood"'},
+               {'node "wood"', 'craft "Stick"'},
+               {'', 'craft "Stick"'},
        }
 })
 
 minetest.register_craft({
-       output = 'ToolItem "STAxe"',
+       output = 'tool "STAxe"',
        recipe = {
-               {'NodeItem "cobble"', 'NodeItem "cobble"'},
-               {'NodeItem "cobble"', 'CraftItem "Stick"'},
-               {'', 'CraftItem "Stick"'},
+               {'node "cobble"', 'node "cobble"'},
+               {'node "cobble"', 'craft "Stick"'},
+               {'', 'craft "Stick"'},
        }
 })
 
 minetest.register_craft({
-       output = 'ToolItem "SteelAxe"',
+       output = 'tool "SteelAxe"',
        recipe = {
-               {'CraftItem "steel_ingot"', 'CraftItem "steel_ingot"'},
-               {'CraftItem "steel_ingot"', 'CraftItem "Stick"'},
-               {'', 'CraftItem "Stick"'},
+               {'craft "steel_ingot"', 'craft "steel_ingot"'},
+               {'craft "steel_ingot"', 'craft "Stick"'},
+               {'', 'craft "Stick"'},
        }
 })
 
 minetest.register_craft({
-       output = 'ToolItem "WSword"',
+       output = 'tool "WSword"',
        recipe = {
-               {'NodeItem "wood"'},
-               {'NodeItem "wood"'},
-               {'CraftItem "Stick"'},
+               {'node "wood"'},
+               {'node "wood"'},
+               {'craft "Stick"'},
        }
 })
 
 minetest.register_craft({
-       output = 'ToolItem "STSword"',
+       output = 'tool "STSword"',
        recipe = {
-               {'NodeItem "cobble"'},
-               {'NodeItem "cobble"'},
-               {'CraftItem "Stick"'},
+               {'node "cobble"'},
+               {'node "cobble"'},
+               {'craft "Stick"'},
        }
 })
 
 minetest.register_craft({
-       output = 'ToolItem "SteelSword"',
+       output = 'tool "SteelSword"',
        recipe = {
-               {'CraftItem "steel_ingot"'},
-               {'CraftItem "steel_ingot"'},
-               {'CraftItem "Stick"'},
+               {'craft "steel_ingot"'},
+               {'craft "steel_ingot"'},
+               {'craft "Stick"'},
        }
 })
 
 minetest.register_craft({
-       output = 'NodeItem "rail" 15',
+       output = 'node "rail" 15',
        recipe = {
-               {'CraftItem "steel_ingot"', '', 'CraftItem "steel_ingot"'},
-               {'CraftItem "steel_ingot"', 'CraftItem "Stick"', 'CraftItem "steel_ingot"'},
-               {'CraftItem "steel_ingot"', '', 'CraftItem "steel_ingot"'},
+               {'craft "steel_ingot"', '', 'craft "steel_ingot"'},
+               {'craft "steel_ingot"', 'craft "Stick"', 'craft "steel_ingot"'},
+               {'craft "steel_ingot"', '', 'craft "steel_ingot"'},
        }
 })
 
 minetest.register_craft({
-       output = 'NodeItem "chest" 1',
+       output = 'node "chest" 1',
        recipe = {
-               {'NodeItem "wood"', 'NodeItem "wood"', 'NodeItem "wood"'},
-               {'NodeItem "wood"', '', 'NodeItem "wood"'},
-               {'NodeItem "wood"', 'NodeItem "wood"', 'NodeItem "wood"'},
+               {'node "wood"', 'node "wood"', 'node "wood"'},
+               {'node "wood"', '', 'node "wood"'},
+               {'node "wood"', 'node "wood"', 'node "wood"'},
        }
 })
 
 minetest.register_craft({
-       output = 'NodeItem "locked_chest" 1',
+       output = 'node "locked_chest" 1',
        recipe = {
-               {'NodeItem "wood"', 'NodeItem "wood"', 'NodeItem "wood"'},
-               {'NodeItem "wood"', 'CraftItem "steel_ingot"', 'NodeItem "wood"'},
-               {'NodeItem "wood"', 'NodeItem "wood"', 'NodeItem "wood"'},
+               {'node "wood"', 'node "wood"', 'node "wood"'},
+               {'node "wood"', 'craft "steel_ingot"', 'node "wood"'},
+               {'node "wood"', 'node "wood"', 'node "wood"'},
        }
 })
 
 minetest.register_craft({
-       output = 'NodeItem "furnace" 1',
+       output = 'node "furnace" 1',
        recipe = {
-               {'NodeItem "cobble"', 'NodeItem "cobble"', 'NodeItem "cobble"'},
-               {'NodeItem "cobble"', '', 'NodeItem "cobble"'},
-               {'NodeItem "cobble"', 'NodeItem "cobble"', 'NodeItem "cobble"'},
+               {'node "cobble"', 'node "cobble"', 'node "cobble"'},
+               {'node "cobble"', '', 'node "cobble"'},
+               {'node "cobble"', 'node "cobble"', 'node "cobble"'},
        }
 })
 
 minetest.register_craft({
-       output = 'NodeItem "steelblock" 1',
+       output = 'node "steelblock" 1',
        recipe = {
-               {'CraftItem "steel_ingot"', 'CraftItem "steel_ingot"', 'CraftItem "steel_ingot"'},
-               {'CraftItem "steel_ingot"', 'CraftItem "steel_ingot"', 'CraftItem "steel_ingot"'},
-               {'CraftItem "steel_ingot"', 'CraftItem "steel_ingot"', 'CraftItem "steel_ingot"'},
+               {'craft "steel_ingot"', 'craft "steel_ingot"', 'craft "steel_ingot"'},
+               {'craft "steel_ingot"', 'craft "steel_ingot"', 'craft "steel_ingot"'},
+               {'craft "steel_ingot"', 'craft "steel_ingot"', 'craft "steel_ingot"'},
        }
 })
 
 minetest.register_craft({
-       output = 'NodeItem "sandstone" 1',
+       output = 'node "sandstone" 1',
        recipe = {
-               {'NodeItem "sand"', 'NodeItem "sand"'},
-               {'NodeItem "sand"', 'NodeItem "sand"'},
+               {'node "sand"', 'node "sand"'},
+               {'node "sand"', 'node "sand"'},
        }
 })
 
 minetest.register_craft({
-       output = 'NodeItem "clay" 1',
+       output = 'node "clay" 1',
        recipe = {
-               {'CraftItem "lump_of_clay"', 'CraftItem "lump_of_clay"'},
-               {'CraftItem "lump_of_clay"', 'CraftItem "lump_of_clay"'},
+               {'craft "lump_of_clay"', 'craft "lump_of_clay"'},
+               {'craft "lump_of_clay"', 'craft "lump_of_clay"'},
        }
 })
 
 minetest.register_craft({
-       output = 'NodeItem "brick" 1',
+       output = 'node "brick" 1',
        recipe = {
-               {'CraftItem "clay_brick"', 'CraftItem "clay_brick"'},
-               {'CraftItem "clay_brick"', 'CraftItem "clay_brick"'},
+               {'craft "clay_brick"', 'craft "clay_brick"'},
+               {'craft "clay_brick"', 'craft "clay_brick"'},
        }
 })
 
 minetest.register_craft({
-       output = 'CraftItem "paper" 1',
+       output = 'craft "paper" 1',
        recipe = {
-               {'NodeItem "papyrus"', 'NodeItem "papyrus"', 'NodeItem "papyrus"'},
+               {'node "papyrus"', 'node "papyrus"', 'node "papyrus"'},
        }
 })
 
 minetest.register_craft({
-       output = 'CraftItem "book" 1',
+       output = 'craft "book" 1',
        recipe = {
-               {'CraftItem "paper"'},
-               {'CraftItem "paper"'},
-               {'CraftItem "paper"'},
+               {'craft "paper"'},
+               {'craft "paper"'},
+               {'craft "paper"'},
        }
 })
 
 minetest.register_craft({
-       output = 'NodeItem "bookshelf" 1',
+       output = 'node "bookshelf" 1',
        recipe = {
-               {'NodeItem "wood"', 'NodeItem "wood"', 'NodeItem "wood"'},
-               {'CraftItem "book"', 'CraftItem "book"', 'CraftItem "book"'},
-               {'NodeItem "wood"', 'NodeItem "wood"', 'NodeItem "wood"'},
+               {'node "wood"', 'node "wood"', 'node "wood"'},
+               {'craft "book"', 'craft "book"', 'craft "book"'},
+               {'node "wood"', 'node "wood"', 'node "wood"'},
        }
 })
 
 minetest.register_craft({
-       output = 'NodeItem "ladder" 1',
+       output = 'node "ladder" 1',
        recipe = {
-               {'CraftItem "Stick"', '', 'CraftItem "Stick"'},
-               {'CraftItem "Stick"', 'CraftItem "Stick"', 'CraftItem "Stick"'},
-               {'CraftItem "Stick"', '', 'CraftItem "Stick"'},
+               {'craft "Stick"', '', 'craft "Stick"'},
+               {'craft "Stick"', 'craft "Stick"', 'craft "Stick"'},
+               {'craft "Stick"', '', 'craft "Stick"'},
        }
 })
 
 minetest.register_craft({
-       output = 'CraftItem "apple_iron" 1',
+       output = 'craft "apple_iron" 1',
        recipe = {
-               {'', 'CraftItem "steel_ingot"', ''},
-               {'CraftItem "steel_ingot"', 'CraftItem "apple"', 'CraftItem "steel_ingot"'},
-               {'', 'CraftItem "steel_ingot"', ''},
-       }
-})
-
-minetest.register_craft({
-       output = 'NodeItem "TNT" 4',
-       recipe = {
-               {'NodeItem "wood" 1'},
-               {'CraftItem "lump_of_coal" 1'},
-               {'NodeItem "wood" 1'}
-       }
-})
-
-minetest.register_craft({
-       output = 'NodeItem "somenode" 4',
-       recipe = {
-               {'CraftItem "Stick" 1'},
+               {'', 'craft "steel_ingot"', ''},
+               {'craft "steel_ingot"', 'craft "apple"', 'craft "steel_ingot"'},
+               {'', 'craft "steel_ingot"', ''},
        }
 })
 
@@ -684,96 +814,97 @@ end
 
 -- Legacy nodes
 
-minetest.register_node("stone", {
+minetest.register_node(":stone", {
        tile_images = {"stone.png"},
        inventory_image = inventorycube("stone.png"),
        paramtype = "mineral",
        is_ground_content = true,
        often_contains_mineral = true, -- Texture atlas hint
        material = digprop_stonelike(1.0),
-       dug_item = 'NodeItem "cobble" 1',
+       dug_item = 'node "cobble" 1',
 })
 
-minetest.register_node("dirt_with_grass", {
+minetest.register_node(":dirt_with_grass", {
        tile_images = {"grass.png", "mud.png", "mud.png^grass_side.png"},
        inventory_image = inventorycube("mud.png^grass_side.png"),
        is_ground_content = true,
        material = digprop_dirtlike(1.0),
-       dug_item = 'NodeItem "dirt" 1',
+       dug_item = 'node "dirt" 1',
 })
 
-minetest.register_node("dirt_with_grass_footsteps", {
+minetest.register_node(":dirt_with_grass_footsteps", {
        tile_images = {"grass_footsteps.png", "mud.png", "mud.png^grass_side.png"},
        inventory_image = "grass_footsteps.png",
        is_ground_content = true,
        material = digprop_dirtlike(1.0),
-       dug_item = 'NodeItem "dirt" 1',
+       dug_item = 'node "dirt" 1',
 })
 
-minetest.register_node("dirt", {
+minetest.register_node(":dirt", {
        tile_images = {"mud.png"},
        inventory_image = inventorycube("mud.png"),
        is_ground_content = true,
        material = digprop_dirtlike(1.0),
 })
 
-minetest.register_node("sand", {
+minetest.register_node(":sand", {
        tile_images = {"sand.png"},
        inventory_image = inventorycube("sand.png"),
        is_ground_content = true,
        material = digprop_dirtlike(1.0),
+       cookresult_item = 'node "glass" 1',
 })
 
-minetest.register_node("gravel", {
+minetest.register_node(":gravel", {
        tile_images = {"gravel.png"},
        inventory_image = inventorycube("gravel.png"),
        is_ground_content = true,
        material = digprop_gravellike(1.0),
 })
 
-minetest.register_node("sandstone", {
+minetest.register_node(":sandstone", {
        tile_images = {"sandstone.png"},
        inventory_image = inventorycube("sandstone.png"),
        is_ground_content = true,
        material = digprop_dirtlike(1.0),  -- FIXME should this be stonelike?
-       dug_item = 'NodeItem "sand" 1',  -- FIXME is this intentional?
+       dug_item = 'node "sand" 1',  -- FIXME is this intentional?
 })
 
-minetest.register_node("clay", {
+minetest.register_node(":clay", {
        tile_images = {"clay.png"},
        inventory_image = inventorycube("clay.png"),
        is_ground_content = true,
        material = digprop_dirtlike(1.0),
-       dug_item = 'CraftItem "lump_of_clay" 4',
+       dug_item = 'craft "lump_of_clay" 4',
 })
 
-minetest.register_node("brick", {
+minetest.register_node(":brick", {
        tile_images = {"brick.png"},
        inventory_image = inventorycube("brick.png"),
        is_ground_content = true,
        material = digprop_stonelike(1.0),
-       dug_item = 'CraftItem "clay_brick" 4',
+       dug_item = 'craft "clay_brick" 4',
 })
 
-minetest.register_node("tree", {
+minetest.register_node(":tree", {
        tile_images = {"tree_top.png", "tree_top.png", "tree.png"},
        inventory_image = inventorycube("tree_top.png", "tree.png", "tree.png"),
        is_ground_content = true,
        material = digprop_woodlike(1.0),
-       cookresult_item = 'CraftItem "lump_of_coal" 1',
+       cookresult_item = 'craft "lump_of_coal" 1',
        furnace_burntime = 30,
 })
 
-minetest.register_node("jungletree", {
+minetest.register_node(":jungletree", {
        tile_images = {"jungletree_top.png", "jungletree_top.png", "jungletree.png"},
        inventory_image = inventorycube("jungletree_top.png", "jungletree.png", "jungletree.png"),
        is_ground_content = true,
        material = digprop_woodlike(1.0),
-       cookresult_item = 'CraftItem "lump_of_coal" 1',
+       cookresult_item = 'craft "lump_of_coal" 1',
        furnace_burntime = 30,
 })
 
-minetest.register_node("junglegrass", {
+minetest.register_node(":junglegrass", {
        drawtype = "plantlike",
        visual_scale = 1.3,
        tile_images = {"junglegrass.png"},
@@ -785,7 +916,7 @@ minetest.register_node("junglegrass", {
        furnace_burntime = 2,
 })
 
-minetest.register_node("leaves", {
+minetest.register_node(":leaves", {
        drawtype = "allfaces_optional",
        visual_scale = 1.3,
        tile_images = {"leaves.png"},
@@ -793,12 +924,12 @@ minetest.register_node("leaves", {
        light_propagates = true,
        paramtype = "light",
        material = digprop_leaveslike(1.0),
-       extra_dug_item = 'NodeItem "sapling" 1',
+       extra_dug_item = 'node "sapling" 1',
        extra_dug_item_rarity = 20,
        furnace_burntime = 1,
 })
 
-minetest.register_node("cactus", {
+minetest.register_node(":cactus", {
        tile_images = {"cactus_top.png", "cactus_top.png", "cactus_side.png"},
        inventory_image = inventorycube("cactus_top.png", "cactus_side.png", "cactus_side.png"),
        is_ground_content = true,
@@ -806,7 +937,7 @@ minetest.register_node("cactus", {
        furnace_burntime = 15,
 })
 
-minetest.register_node("papyrus", {
+minetest.register_node(":papyrus", {
        drawtype = "plantlike",
        tile_images = {"papyrus.png"},
        inventory_image = "papyrus.png",
@@ -818,7 +949,7 @@ minetest.register_node("papyrus", {
        furnace_burntime = 1,
 })
 
-minetest.register_node("bookshelf", {
+minetest.register_node(":bookshelf", {
        tile_images = {"wood.png", "wood.png", "bookshelf.png"},
        -- FIXME: inventorycube only cares for the first texture
        --inventory_image = inventorycube("wood.png", "bookshelf.png", "bookshelf.png")
@@ -828,7 +959,7 @@ minetest.register_node("bookshelf", {
        furnace_burntime = 30,
 })
 
-minetest.register_node("glass", {
+minetest.register_node(":glass", {
        drawtype = "glasslike",
        tile_images = {"glass.png"},
        inventory_image = inventorycube("glass.png"),
@@ -839,7 +970,7 @@ minetest.register_node("glass", {
        material = digprop_glasslike(1.0),
 })
 
-minetest.register_node("wooden_fence", {
+minetest.register_node(":wooden_fence", {
        drawtype = "fencelike",
        tile_images = {"wood.png"},
        inventory_image = "fence.png",
@@ -854,7 +985,7 @@ minetest.register_node("wooden_fence", {
        material = digprop_woodlike(0.75),
 })
 
-minetest.register_node("rail", {
+minetest.register_node(":rail", {
        drawtype = "raillike",
        tile_images = {"rail.png", "rail_curved.png", "rail_t_junction.png", "rail_crossing.png"},
        inventory_image = "rail.png",
@@ -869,7 +1000,7 @@ minetest.register_node("rail", {
        material = digprop_dirtlike(0.75),
 })
 
-minetest.register_node("ladder", {
+minetest.register_node(":ladder", {
        drawtype = "signlike",
        tile_images = {"ladder.png"},
        inventory_image = "ladder.png",
@@ -889,14 +1020,14 @@ minetest.register_node("ladder", {
        material = digprop_woodlike(0.5),
 })
 
-minetest.register_node("coalstone", {
+minetest.register_node(":coalstone", {
        tile_images = {"stone.png^mineral_coal.png"},
        inventory_image = "stone.png^mineral_coal.png",
        is_ground_content = true,
        material = digprop_stonelike(1.5),
 })
 
-minetest.register_node("wood", {
+minetest.register_node(":wood", {
        tile_images = {"wood.png"},
        inventory_image = inventorycube("wood.png"),
        is_ground_content = true,
@@ -904,7 +1035,7 @@ minetest.register_node("wood", {
        material = digprop_woodlike(0.75),
 })
 
-minetest.register_node("mese", {
+minetest.register_node(":mese", {
        tile_images = {"mese.png"},
        inventory_image = inventorycube("mese.png"),
        is_ground_content = true,
@@ -912,13 +1043,13 @@ minetest.register_node("mese", {
        material = digprop_stonelike(0.5),
 })
 
-minetest.register_node("cloud", {
+minetest.register_node(":cloud", {
        tile_images = {"cloud.png"},
        inventory_image = inventorycube("cloud.png"),
        is_ground_content = true,
 })
 
-minetest.register_node("water_flowing", {
+minetest.register_node(":water_flowing", {
        drawtype = "flowingliquid",
        tile_images = {"water.png"},
        alpha = WATER_ALPHA,
@@ -940,7 +1071,7 @@ minetest.register_node("water_flowing", {
        },
 })
 
-minetest.register_node("water_source", {
+minetest.register_node(":water_source", {
        drawtype = "liquid",
        tile_images = {"water.png"},
        alpha = WATER_ALPHA,
@@ -962,7 +1093,7 @@ minetest.register_node("water_source", {
        },
 })
 
-minetest.register_node("lava_flowing", {
+minetest.register_node(":lava_flowing", {
        drawtype = "flowingliquid",
        tile_images = {"lava.png"},
        inventory_image = inventorycube("lava.png"),
@@ -985,7 +1116,7 @@ minetest.register_node("lava_flowing", {
        },
 })
 
-minetest.register_node("lava_source", {
+minetest.register_node(":lava_source", {
        drawtype = "liquid",
        tile_images = {"lava.png"},
        inventory_image = inventorycube("lava.png"),
@@ -1009,7 +1140,7 @@ minetest.register_node("lava_source", {
        furnace_burntime = 60,
 })
 
-minetest.register_node("torch", {
+minetest.register_node(":torch", {
        drawtype = "torchlike",
        tile_images = {"torch_on_floor.png", "torch_on_ceiling.png", "torch.png"},
        inventory_image = "torch_on_floor.png",
@@ -1029,7 +1160,7 @@ minetest.register_node("torch", {
        furnace_burntime = 4,
 })
 
-minetest.register_node("sign_wall", {
+minetest.register_node(":sign_wall", {
        drawtype = "signlike",
        tile_images = {"sign_wall.png"},
        inventory_image = "sign_wall.png",
@@ -1049,7 +1180,7 @@ minetest.register_node("sign_wall", {
        furnace_burntime = 10,
 })
 
-minetest.register_node("chest", {
+minetest.register_node(":chest", {
        tile_images = {"chest_top.png", "chest_top.png", "chest_side.png",
                "chest_side.png", "chest_side.png", "chest_front.png"},
        inventory_image = "chest_top.png",
@@ -1060,7 +1191,7 @@ minetest.register_node("chest", {
        furnace_burntime = 30,
 })
 
-minetest.register_node("locked_chest", {
+minetest.register_node(":locked_chest", {
        tile_images = {"chest_top.png", "chest_top.png", "chest_side.png",
                "chest_side.png", "chest_side.png", "chest_lock.png"},
        inventory_image = "chest_lock.png",
@@ -1070,7 +1201,7 @@ minetest.register_node("locked_chest", {
        furnace_burntime = 30,
 })
 
-minetest.register_node("furnace", {
+minetest.register_node(":furnace", {
        tile_images = {"furnace_side.png", "furnace_side.png", "furnace_side.png",
                "furnace_side.png", "furnace_side.png", "furnace_front.png"},
        inventory_image = "furnace_front.png",
@@ -1079,29 +1210,29 @@ minetest.register_node("furnace", {
        material = digprop_stonelike(3.0),
 })
 
-minetest.register_node("cobble", {
+minetest.register_node(":cobble", {
        tile_images = {"cobble.png"},
        inventory_image = inventorycube("cobble.png"),
        is_ground_content = true,
-       cookresult_item = 'NodeItem "stone" 1',
+       cookresult_item = 'node "stone" 1',
        material = digprop_stonelike(0.9),
 })
 
-minetest.register_node("mossycobble", {
+minetest.register_node(":mossycobble", {
        tile_images = {"mossycobble.png"},
        inventory_image = inventorycube("mossycobble.png"),
        is_ground_content = true,
        material = digprop_stonelike(0.8),
 })
 
-minetest.register_node("steelblock", {
+minetest.register_node(":steelblock", {
        tile_images = {"steel_block.png"},
        inventory_image = inventorycube("steel_block.png"),
        is_ground_content = true,
        material = digprop_stonelike(5.0),
 })
 
-minetest.register_node("nyancat", {
+minetest.register_node(":nyancat", {
        tile_images = {"nc_side.png", "nc_side.png", "nc_side.png",
                "nc_side.png", "nc_back.png", "nc_front.png"},
        inventory_image = "nc_front.png",
@@ -1110,14 +1241,14 @@ minetest.register_node("nyancat", {
        furnace_burntime = 1,
 })
 
-minetest.register_node("nyancat_rainbow", {
+minetest.register_node(":nyancat_rainbow", {
        tile_images = {"nc_rb.png"},
        inventory_image = "nc_rb.png",
        material = digprop_stonelike(3.0),
        furnace_burntime = 1,
 })
 
-minetest.register_node("sapling", {
+minetest.register_node(":sapling", {
        drawtype = "plantlike",
        visual_scale = 1.0,
        tile_images = {"sapling.png"},
@@ -1129,7 +1260,7 @@ minetest.register_node("sapling", {
        furnace_burntime = 10,
 })
 
-minetest.register_node("apple", {
+minetest.register_node(":apple", {
        drawtype = "plantlike",
        visual_scale = 1.0,
        tile_images = {"apple.png"},
@@ -1138,126 +1269,81 @@ minetest.register_node("apple", {
        light_propagates = true,
        sunlight_propagates = true,
        walkable = false,
-       dug_item = 'CraftItem "apple" 1',
+       dug_item = 'craft "apple" 1',
        material = digprop_constanttime(0.0),
        furnace_burntime = 3,
 })
 
--- New nodes
-
-minetest.register_node("somenode", {
-       tile_images = {"lava.png", "mese.png", "stone.png", "grass.png", "cobble.png", "tree_top.png"},
-       inventory_image = "treeprop.png",
-       material = {
-               diggability = "normal",
-               weight = 0,
-               crackiness = 0,
-               crumbliness = 0,
-               cuttability = 0,
-               flammability = 0
-       },
-       metadata_name = "chest",
-})
-
-minetest.register_node("TNT", {
-       tile_images = {"tnt_top.png", "tnt_bottom.png", "tnt_side.png", "tnt_side.png", "tnt_side.png", "tnt_side.png"},
-       inventory_image = "tnt_side.png",
-       dug_item = '', -- Get nothing
-       material = {
-               diggability = "not",
-       },
-})
-
 --
 -- Crafting items
 --
 
-local craftitem_place_item = function(item, placer, pos)
-       --print("craftitem_place_item")
-       print("item: " .. dump(item))
-       print("placer: " .. dump(placer))
-       print("pos: " .. dump(pos))
-       minetest.env:add_item(pos, 'CraftItem "' .. item .. '" 1')
-       return true
-end
-
-local craftitem_eat = function(hp_change)
-       return function(item, user, pointed_thing)  -- closure
-               --print("craftitem_eat(" .. hp_change .. ")")
-               --print("item: " .. dump(item))
-               --print("user: " .. dump(user))
-               --print("pointed_thing: " .. dump(pointed_thing))
-               user:set_hp(user:get_hp() + hp_change)
-               return true
-       end
-end
-
-minetest.register_craftitem("Stick", {
+minetest.register_craftitem(":Stick", {
        image = "stick.png",
        --furnace_burntime = ...,
-       on_place_on_ground = craftitem_place_item,
+       on_place_on_ground = minetest.craftitem_place_item,
 })
 
-minetest.register_craftitem("paper", {
+minetest.register_craftitem(":paper", {
        image = "paper.png",
-       on_place_on_ground = craftitem_place_item,
+       on_place_on_ground = minetest.craftitem_place_item,
 })
 
-minetest.register_craftitem("book", {
+minetest.register_craftitem(":book", {
        image = "book.png",
-       on_place_on_ground = craftitem_place_item,
+       on_place_on_ground = minetest.craftitem_place_item,
 })
 
-minetest.register_craftitem("lump_of_coal", {
+minetest.register_craftitem(":lump_of_coal", {
        image = "lump_of_coal.png",
        furnace_burntime = 40;
-       on_place_on_ground = craftitem_place_item,
+       on_place_on_ground = minetest.craftitem_place_item,
 })
 
-minetest.register_craftitem("lump_of_iron", {
+minetest.register_craftitem(":lump_of_iron", {
        image = "lump_of_iron.png",
-       cookresult_item = 'CraftItem "steel_ingot" 1',
-       on_place_on_ground = craftitem_place_item,
+       cookresult_item = 'craft "steel_ingot" 1',
+       on_place_on_ground = minetest.craftitem_place_item,
 })
 
-minetest.register_craftitem("lump_of_clay", {
+minetest.register_craftitem(":lump_of_clay", {
        image = "lump_of_clay.png",
-       cookresult_item = 'CraftItem "clay_brick" 1',
-       on_place_on_ground = craftitem_place_item,
+       cookresult_item = 'craft "clay_brick" 1',
+       on_place_on_ground = minetest.craftitem_place_item,
 })
 
-minetest.register_craftitem("steel_ingot", {
+minetest.register_craftitem(":steel_ingot", {
        image = "steel_ingot.png",
-       on_place_on_ground = craftitem_place_item,
+       on_place_on_ground = minetest.craftitem_place_item,
 })
 
-minetest.register_craftitem("clay_brick", {
+minetest.register_craftitem(":clay_brick", {
        image = "clay_brick.png",
-       on_place_on_ground = craftitem_place_item,
+       on_place_on_ground = minetest.craftitem_place_item,
 })
 
-minetest.register_craftitem("rat", {
+minetest.register_craftitem(":rat", {
        image = "rat.png",
-       cookresult_item = 'CraftItem "cooked_rat" 1',
+       cookresult_item = 'craft "cooked_rat" 1',
        on_drop = function(item, dropper, pos)
                minetest.env:add_rat(pos)
                return true
        end,
 })
 
-minetest.register_craftitem("cooked_rat", {
+minetest.register_craftitem(":cooked_rat", {
        image = "cooked_rat.png",
-       cookresult_item = 'CraftItem "scorched_stuff" 1',
-       on_place_on_ground = craftitem_place_item,
-       on_use = craftitem_eat(6),
+       cookresult_item = 'craft "scorched_stuff" 1',
+       on_place_on_ground = minetest.craftitem_place_item,
+       on_use = minetest.craftitem_eat(6),
 })
 
-minetest.register_craftitem("scorched_stuff", {
+minetest.register_craftitem(":scorched_stuff", {
        image = "scorched_stuff.png",
-       on_place_on_ground = craftitem_place_item,
+       on_place_on_ground = minetest.craftitem_place_item,
 })
 
-minetest.register_craftitem("firefly", {
+minetest.register_craftitem(":firefly", {
        image = "firefly.png",
        on_drop = function(item, dropper, pos)
                minetest.env:add_firefly(pos)
@@ -1265,20 +1351,52 @@ minetest.register_craftitem("firefly", {
        end,
 })
 
-minetest.register_craftitem("apple", {
+minetest.register_craftitem(":apple", {
        image = "apple.png",
-       on_place_on_ground = craftitem_place_item,
-       on_use = craftitem_eat(4),
+       on_place_on_ground = minetest.craftitem_place_item,
+       on_use = minetest.craftitem_eat(4),
 })
 
-minetest.register_craftitem("apple_iron", {
+minetest.register_craftitem(":apple_iron", {
        image = "apple_iron.png",
-       on_place_on_ground = craftitem_place_item,
-       on_use = craftitem_eat(8),
+       on_place_on_ground = minetest.craftitem_place_item,
+       on_use = minetest.craftitem_eat(8),
 })
 
 print(dump(minetest.registered_craftitems))
 
+--
+-- Creative inventory
+--
+
+minetest.add_to_creative_inventory('tool MesePick 0')
+minetest.add_to_creative_inventory('tool SteelPick 0')
+minetest.add_to_creative_inventory('tool SteelAxe 0')
+minetest.add_to_creative_inventory('tool SteelShovel 0')
+
+minetest.add_to_creative_inventory('node torch 0')
+minetest.add_to_creative_inventory('node cobble 0')
+minetest.add_to_creative_inventory('node dirt 0')
+minetest.add_to_creative_inventory('node stone 0')
+minetest.add_to_creative_inventory('node sand 0')
+minetest.add_to_creative_inventory('node sandstone 0')
+minetest.add_to_creative_inventory('node clay 0')
+minetest.add_to_creative_inventory('node brick 0')
+minetest.add_to_creative_inventory('node tree 0')
+minetest.add_to_creative_inventory('node leaves 0')
+minetest.add_to_creative_inventory('node cactus 0')
+minetest.add_to_creative_inventory('node papyrus 0')
+minetest.add_to_creative_inventory('node bookshelf 0')
+minetest.add_to_creative_inventory('node glass 0')
+minetest.add_to_creative_inventory('node fence 0')
+minetest.add_to_creative_inventory('node rail 0')
+minetest.add_to_creative_inventory('node mese 0')
+minetest.add_to_creative_inventory('node chest 0')
+minetest.add_to_creative_inventory('node furnace 0')
+minetest.add_to_creative_inventory('node sign_wall 0')
+minetest.add_to_creative_inventory('node water_source 0')
+minetest.add_to_creative_inventory('node lava_source 0')
+minetest.add_to_creative_inventory('node ladder 0')
 
 --
 -- Some common functions
@@ -1291,7 +1409,7 @@ function nodeupdate_single(p)
                n_bottom = minetest.env:get_node(p_bottom)
                if n_bottom.name == "air" then
                        minetest.env:remove_node(p)
-                       minetest.env:add_luaentity(p, "falling_"..n.name)
+                       minetest.env:add_luaentity(p, "default_falling_"..n.name)
                        nodeupdate(p)
                end
        end
@@ -1308,108 +1426,12 @@ function nodeupdate(p)
        end
 end
 
---
--- TNT (not functional)
---
-
-local TNT = {
-       -- Static definition
-       physical = true, -- Collides with things
-       -- weight = 5,
-       collisionbox = {-0.5,-0.5,-0.5, 0.5,0.5,0.5},
-       visual = "cube",
-       textures = {"tnt_top.png","tnt_bottom.png","tnt_side.png","tnt_side.png","tnt_side.png","tnt_side.png"},
-       -- Initial value for our timer
-       timer = 0,
-       -- Number of punches required to defuse
-       health = 1,
-       blinktimer = 0,
-       blinkstatus = true,
-}
-
--- Called when a TNT object is created
-function TNT:on_activate(staticdata)
-       print("TNT:on_activate()")
-       self.object:setvelocity({x=0, y=4, z=0})
-       self.object:setacceleration({x=0, y=-10, z=0})
-       self.object:settexturemod("^[brighten")
-end
-
--- Called periodically
-function TNT:on_step(dtime)
-       --print("TNT:on_step()")
-       self.timer = self.timer + dtime
-       self.blinktimer = self.blinktimer + dtime
-       if self.blinktimer > 0.5 then
-               self.blinktimer = self.blinktimer - 0.5
-               if self.blinkstatus then
-                       self.object:settexturemod("")
-               else
-                       self.object:settexturemod("^[brighten")
-               end
-               self.blinkstatus = not self.blinkstatus
-       end
-end
-
--- Called when object is punched
-function TNT:on_punch(hitter)
-       print("TNT:on_punch()")
-       self.health = self.health - 1
-       if self.health <= 0 then
-               self.object:remove()
-               hitter:add_to_inventory("NodeItem TNT 1")
-               hitter:set_hp(hitter:get_hp() - 1)
-       end
-end
-
--- Called when object is right-clicked
-function TNT:on_rightclick(clicker)
-       --pos = self.object:getpos()
-       --pos = {x=pos.x, y=pos.y+0.1, z=pos.z}
-       --self.object:moveto(pos, false)
-end
-
-print("TNT dump: "..dump(TNT))
-
-print("Registering TNT");
-minetest.register_entity("TNT", TNT)
-
-
-minetest.register_entity("testentity", {
-       -- Static definition
-       physical = true, -- Collides with things
-       -- weight = 5,
-       collisionbox = {-0.7,-1.35,-0.7, 0.7,1.0,0.7},
-       --collisionbox = {-0.5,-0.5,-0.5, 0.5,0.5,0.5},
-       visual = "sprite",
-       visual_size = {x=2, y=3},
-       textures = {"dungeon_master.png^[makealpha:128,0,0^[makealpha:128,128,0"},
-       spritediv = {x=6, y=5},
-       initial_sprite_basepos = {x=0, y=0},
-
-       on_activate = function(self, staticdata)
-               print("testentity.on_activate")
-               self.object:setsprite({x=0,y=0}, 1, 0, true)
-               --self.object:setsprite({x=0,y=0}, 4, 0.3, true)
-
-               -- Set gravity
-               self.object:setacceleration({x=0, y=-10, z=0})
-               -- Jump a bit upwards
-               self.object:setvelocity({x=0, y=10, z=0})
-       end,
-
-       on_punch = function(self, hitter)
-               self.object:remove()
-               hitter:add_to_inventory('CraftItem testobject1 1')
-       end,
-})
-
 --
 -- Falling stuff
 --
 
 function register_falling_node(nodename, texture)
-       minetest.register_entity("falling_"..nodename, {
+       minetest.register_entity("default_falling_"..nodename, {
                -- Static definition
                physical = true,
                collisionbox = {-0.5,-0.5,-0.5, 0.5,0.5,0.5},
@@ -1450,413 +1472,87 @@ end
 minetest.register_globalstep(on_step)
 
 function on_placenode(p, node)
-       print("on_placenode")
+       --print("on_placenode")
        nodeupdate(p)
 end
 minetest.register_on_placenode(on_placenode)
 
 function on_dignode(p, node)
-       print("on_dignode")
+       --print("on_dignode")
        nodeupdate(p)
 end
 minetest.register_on_dignode(on_dignode)
 
 function on_punchnode(p, node)
-       print("on_punchnode")
-       if node.name == "TNT" then
-               minetest.env:remove_node(p)
-               minetest.env:add_luaentity(p, "TNT")
-               --minetest.env:add_luaentity(p, "testentity")
-               --minetest.env:add_firefly(p)
-               nodeupdate(p)
-       end
 end
 minetest.register_on_punchnode(on_punchnode)
 
-minetest.register_on_respawnplayer(function(player)
-       print("on_respawnplayer")
-       -- player:setpos({x=0, y=30, z=0})
-       -- return true
-end)
-
-minetest.register_on_generated(function(minp, maxp)
-       --print("on_generated: minp="..dump(minp).." maxp="..dump(maxp))
-       --cp = {x=(minp.x+maxp.x)/2, y=(minp.y+maxp.y)/2, z=(minp.z+maxp.z)/2}
-       --minetest.env:add_node(cp, {name="sand"})
-end)
-
--- Example setting get
-print("setting max_users = " .. dump(minetest.setting_get("max_users")))
-print("setting asdf = " .. dump(minetest.setting_get("asdf")))
-
 minetest.register_on_chat_message(function(name, message)
-       print("on_chat_message: name="..dump(name).." message="..dump(message))
-       local cmd = "/testcommand"
-       if message:sub(0, #cmd) == cmd then
-               print(cmd.." invoked")
-               return true
-       end
-       local cmd = "/help"
+       --print("default on_chat_message: name="..dump(name).." message="..dump(message))
+       local cmd = "/giveme"
        if message:sub(0, #cmd) == cmd then
-               print("script-overridden help command")
-               minetest.chat_send_all("script-overridden help command")
-               return true
-       end
-end)
-
--- Grow papyrus on TNT every 10 seconds
-minetest.register_abm({
-       nodenames = {"TNT"},
-       interval = 10.0,
-       chance = 1,
-       action = function(pos, node, active_object_count, active_object_count_wider)
-               print("TNT ABM action")
-               pos.y = pos.y + 1
-               minetest.env:add_node(pos, {name="papyrus"})
-       end,
-})
-
--- Replace texts of alls signs with "foo" every 10 seconds
---[[minetest.register_abm({
-       nodenames = {"sign_wall"},
-       interval = 10.0,
-       chance = 1,
-       action = function(pos, node, active_object_count, active_object_count_wider)
-               print("ABM: Sign text changed")
-               local meta = minetest.env:get_meta(pos)
-               meta:set_text("foo")
-       end,
-})]]
-
---[[local ncpos = nil
-local ncq = 1
-local ncstuff = {
-    {2, 1, 0, 3}, {3, 0, 1, 2}, {4, -1, 0, 1}, {5, -1, 0, 1}, {6, 0, -1, 0},
-    {7, 0, -1, 0}, {8, 1, 0, 3}, {9, 1, 0, 3}, {10, 1, 0, 3}, {11, 0, 1, 2},
-    {12, 0, 1, 2}, {13, 0, 1, 2}, {14, -1, 0, 1}, {15, -1, 0, 1}, {16, -1, 0, 1},
-    {17, -1, 0, 1}, {18, 0, -1, 0}, {19, 0, -1, 0}, {20, 0, -1, 0}, {21, 0, -1, 0},
-    {22, 1, 0, 3}, {23, 1, 0, 3}, {24, 1, 0, 3}, {25, 1, 0, 3}, {10, 0, 1, 2}
-}
-local ncold = {}
-local nctime = nil
-
-minetest.register_abm({
-    nodenames = {"dirt_with_grass"},
-    interval = 100000.0,
-    chance = 1,
-    action = function(pos, node, active_object_count, active_object_count_wider)
-        if ncpos ~= nil then
-            return
-        end
-       
-        if pos.x % 16 ~= 8 or pos.z % 16 ~= 8 then
-            return
-        end
-       
-        pos.y = pos.y + 1
-        n = minetest.env:get_node(pos)
-        print(dump(n))
-        if n.name ~= "air" then
-            return
-        end
-
-        pos.y = pos.y + 2
-        ncpos = pos
-        nctime = os.clock()
-        minetest.env:add_node(ncpos, {name="nyancat"})
-    end
-})
-
-minetest.register_abm({
-    nodenames = {"nyancat"},
-    interval = 1.0,
-    chance = 1,
-    action = function(pos, node, active_object_count, active_object_count_wider)
-        if ncpos == nil then
-            return
-        end
-        if pos.x == ncpos.x and pos.y == ncpos.y and pos.z == ncpos.z then
-            clock = os.clock()
-            if clock - nctime < 0.1 then
-                return
-            end
-            nctime = clock
-           
-            s0 = ncstuff[ncq]
-            ncq = s0[1]
-            s1 = ncstuff[ncq]
-            p0 = pos
-            p1 = {x = p0.x + s0[2], y = p0.y, z = p0.z + s0[3]}
-            p2 = {x = p1.x + s1[2], y = p1.y, z = p1.z + s1[3]}
-            table.insert(ncold, 1, p0)
-            while #ncold >= 10 do
-                minetest.env:add_node(ncold[#ncold], {name="air"})
-                table.remove(ncold, #ncold)
-            end
-            minetest.env:add_node(p0, {name="nyancat_rainbow"})
-            minetest.env:add_node(p1, {name="nyancat", param1=s0[4]})
-            minetest.env:add_node(p2, {name="air"})
-            ncpos = p1
-        end
-    end,
-})--]]
-
--- LuaNodeMetadata should support something like this
---meta.setvar("somevariable", {x=0, y=0, z=0})
---meta.getvar("somevariable") -> {x=0, y=0, z=0}
-
---
--- Random stuff
---
-
-minetest.register_node("luafurnace", {
-       tile_images = {"lava.png", "furnace_side.png", "furnace_side.png",
-               "furnace_side.png", "furnace_side.png", "furnace_front.png"},
-       --inventory_image = "furnace_front.png",
-       inventory_image = inventorycube("furnace_front.png"),
-       paramtype = "facedir_simple",
-       metadata_name = "generic",
-       material = digprop_stonelike(3.0),
-})
-
-minetest.register_on_placenode(function(pos, newnode, placer)
-       if newnode.name == "luafurnace" then
-               print("get_meta");
-               local meta = minetest.env:get_meta(pos)
-               print("inventory_set_list");
-               meta:inventory_set_list("fuel", {""})
-               print("inventory_set_list");
-               meta:inventory_set_list("src", {""})
-               print("inventory_set_list");
-               meta:inventory_set_list("dst", {"","","",""})
-               print("set_inventory_draw_spec");
-               meta:set_inventory_draw_spec(
-                       "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 total_cooked = 0;
-               print("set_string")
-               meta:set_string("total_cooked", total_cooked)
-               print("set_infotext");
-               meta:set_infotext("Lua Furnace: total cooked: "..total_cooked)
-       end
-end)
-
-function stackstring_take_item(stackstring)
-       if stackstring == nil then
-               return '', nil
-       end
-       local stacktype = nil
-       stacktype = string.match(stackstring,
-                       '([%a%d]+Item[%a%d]*)')
-       if stacktype == "NodeItem" or stacktype == "CraftItem" then
-               local itemtype = nil
-               local itemname = nil
-               local itemcount = nil
-               itemtype, itemname, itemcount = string.match(stackstring,
-                               '([%a%d]+Item[%a%d]*) "([^"]*)" (%d+)')
-               itemcount = tonumber(itemcount)
-               if itemcount == 0 then
-                       return '', nil
-               elseif itemcount == 1 then
-                       return '', {type=itemtype, name=itemname}
-               else
-                       return itemtype.." \""..itemname.."\" "..(itemcount-1),
-                                       {type=itemtype, name=itemname}
+               if not minetest.get_player_privs(name)["give"] then
+                       minetest.chat_send_player(name, "you don't have permission to give")
+                       return true -- Handled chat message
                end
-       elseif stacktype == "ToolItem" then
-               local itemtype = nil
-               local itemname = nil
-               local itemwear = nil
-               itemtype, itemname, itemwear = string.match(stackstring,
-                               '([%a%d]+Item[%a%d]*) "([^"]*)" (%d+)')
-               itemwear = tonumber(itemwear)
-               return '', {type=itemtype, name=itemname, wear=itemwear}
-       end
-end
-
-function stackstring_put_item(stackstring, item)
-       if item == nil then
-               return stackstring, false
-       end
-       stackstring = stackstring or ''
-       local stacktype = nil
-       stacktype = string.match(stackstring,
-                       '([%a%d]+Item[%a%d]*)')
-       stacktype = stacktype or ''
-       if stacktype ~= '' and stacktype ~= item.type then
-               return stackstring, false
-       end
-       if item.type == "NodeItem" or item.type == "CraftItem" then
-               local itemtype = nil
-               local itemname = nil
-               local itemcount = nil
-               itemtype, itemname, itemcount = string.match(stackstring,
-                               '([%a%d]+Item[%a%d]*) "([^"]*)" (%d+)')
-               itemtype = itemtype or item.type
-               itemname = itemname or item.name
-               if itemcount == nil then
-                       itemcount = 0
+               local stackstring = string.match(message, cmd.." (.*)")
+               if stackstring == nil then
+                       minetest.chat_send_player(name, 'usage: '..cmd..' stackstring')
+                       return true -- Handled chat message
                end
-               itemcount = itemcount + 1
-               return itemtype.." \""..itemname.."\" "..itemcount, true
-       elseif item.type == "ToolItem" then
-               if stacktype ~= nil then
-                       return stackstring, false
+               print(cmd..' invoked, stackstring="'..stackstring..'"')
+               local player = minetest.env:get_player_by_name(name)
+               if player == nil then
+                       minetest.chat_send_player(name, name2..' is not a known player')
+                       return true -- Handled chat message
                end
-               local itemtype = nil
-               local itemname = nil
-               local itemwear = nil
-               itemtype, itemname, itemwear = string.match(stackstring,
-                               '([%a%d]+Item[%a%d]*) "([^"]*)" (%d+)')
-               itemwear = tonumber(itemwear)
-               return itemtype.." \""..itemname.."\" "..itemwear, true
-       end
-       return stackstring, false
-end
-
-function stackstring_put_stackstring(stackstring, src)
-       while src ~= '' do
-               --print("src="..dump(src))
-               src, item = stackstring_take_item(src)
-               --print("src="..dump(src).." item="..dump(item))
-               local success
-               stackstring, success = stackstring_put_item(stackstring, item)
-               if not success then
-                       return stackstring, false
+               local added, error_msg = player:add_to_inventory(stackstring)
+               if added then
+                       minetest.chat_send_player(name, '"'..stackstring
+                                       ..'" added to inventory.');
+               else
+                       minetest.chat_send_player(name, 'Could not give "'..stackstring
+                                       ..'": '..error_msg);
                end
+               return true -- Handled chat message
        end
-       return stackstring, true
-end
-
-function test_stack()
-       local stack
-       local item
-       local success
-
-       stack, item = stackstring_take_item('NodeItem "TNT" 3')
-       assert(stack == 'NodeItem "TNT" 2')
-       assert(item.type == 'NodeItem')
-       assert(item.name == 'TNT')
-
-       stack, item = stackstring_take_item('CraftItem "with spaces" 2')
-       assert(stack == 'CraftItem "with spaces" 1')
-       assert(item.type == 'CraftItem')
-       assert(item.name == 'with spaces')
-
-       stack, item = stackstring_take_item('CraftItem "with spaces" 1')
-       assert(stack == '')
-       assert(item.type == 'CraftItem')
-       assert(item.name == 'with spaces')
-
-       stack, item = stackstring_take_item('CraftItem "s8df2kj3" 0')
-       assert(stack == '')
-       assert(item == nil)
-
-       stack, item = stackstring_take_item('ToolItem "With Spaces" 32487')
-       assert(stack == '')
-       assert(item.type == 'ToolItem')
-       assert(item.name == 'With Spaces')
-       assert(item.wear == 32487)
-
-       stack, success = stackstring_put_item('NodeItem "With Spaces" 40',
-                       {type='NodeItem', name='With Spaces'})
-       assert(stack == 'NodeItem "With Spaces" 41')
-       assert(success == true)
-
-       stack, success = stackstring_put_item('CraftItem "With Spaces" 40',
-                       {type='CraftItem', name='With Spaces'})
-       assert(stack == 'CraftItem "With Spaces" 41')
-       assert(success == true)
-
-       stack, success = stackstring_put_item('ToolItem "With Spaces" 32487',
-                       {type='ToolItem', name='With Spaces'})
-       assert(stack == 'ToolItem "With Spaces" 32487')
-       assert(success == false)
-
-       stack, success = stackstring_put_item('NodeItem "With Spaces" 40',
-                       {type='ToolItem', name='With Spaces'})
-       assert(stack == 'NodeItem "With Spaces" 40')
-       assert(success == false)
-       
-       assert(stackstring_put_stackstring('NodeItem "With Spaces" 2',
-                       'NodeItem "With Spaces" 1') == 'NodeItem "With Spaces" 3')
-end
-test_stack()
-
-minetest.register_abm({
-       nodenames = {"luafurnace"},
-       interval = 1.0,
-       chance = 1,
-       action = function(pos, node, active_object_count, active_object_count_wider)
-               local meta = minetest.env:get_meta(pos)
-               local fuellist = meta:inventory_get_list("fuel")
-               local srclist = meta:inventory_get_list("src")
-               local dstlist = meta:inventory_get_list("dst")
-               if fuellist == nil or srclist == nil or dstlist == nil then
-                       return
-               end
-               _, srcitem = stackstring_take_item(srclist[1])
-               _, fuelitem = stackstring_take_item(fuellist[1])
-               if not srcitem or not fuelitem then return end
-               if fuelitem.type == "NodeItem" then
-                       local prop = minetest.registered_nodes[fuelitem.name]
-                       if prop == nil then return end
-                       if prop.furnace_burntime < 0 then return end
-               else
-                       return
+       local cmd = "/give"
+       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 give")
+                       return true -- Handled chat message
                end
-               local resultstack = nil
-               if srcitem.type == "NodeItem" then
-                       local prop = minetest.registered_nodes[srcitem.name]
-                       if prop == nil then return end
-                       if prop.cookresult_item == "" then return end
-                       resultstack = prop.cookresult_item
-               else
-                       return
+               local name2, stackstring = string.match(message, cmd.." ([%a%d_-]+) (.*)")
+               if name == nil or stackstring == nil then
+                       minetest.chat_send_player(name, 'usage: '..cmd..' name stackstring')
+                       return true -- Handled chat message
                end
-
-               if resultstack == nil then
-                       return
+               print(cmd..' invoked, name2="'..name2
+                               ..'" stackstring="'..stackstring..'"')
+               local player = minetest.env:get_player_by_name(name2)
+               if player == nil then
+                       minetest.chat_send_player(name, name2..' is not a known player')
+                       return true -- Handled chat message
                end
-
-               dstlist[1], success = stackstring_put_stackstring(dstlist[1], resultstack)
-               if not success then
-                       return
+               local added, error_msg = player:add_to_inventory(stackstring)
+               if added then
+                       minetest.chat_send_player(name, '"'..stackstring
+                                       ..'" added to '..name2..'\'s inventory.');
+                       minetest.chat_send_player(name2, '"'..stackstring
+                                       ..'" added to inventory.');
+               else
+                       minetest.chat_send_player(name, 'Could not give "'..stackstring
+                                       ..'": '..error_msg);
                end
-
-               fuellist[1], _ = stackstring_take_item(fuellist[1])
-               srclist[1], _ = stackstring_take_item(srclist[1])
-
-               meta:inventory_set_list("fuel", fuellist)
-               meta:inventory_set_list("src", srclist)
-               meta:inventory_set_list("dst", dstlist)
-
-               local total_cooked = meta:get_string("total_cooked")
-               total_cooked = tonumber(total_cooked) + 1
-               meta:set_string("total_cooked", total_cooked)
-               meta:set_infotext("Lua Furnace: total cooked: "..total_cooked)
-       end,
-})
-
-minetest.register_craft({
-       output = 'NodeItem "luafurnace" 1',
-       recipe = {
-               {'NodeItem "cobble"', 'NodeItem "cobble"', 'NodeItem "cobble"'},
-               {'NodeItem "cobble"', 'NodeItem "cobble"', 'NodeItem "cobble"'},
-               {'NodeItem "cobble"', 'NodeItem "cobble"', 'NodeItem "cobble"'},
-       }
-})
+               return true -- Handled chat message
+       end
+end)
 
 --
 -- Done, print some random stuff
 --
 
-print("minetest.registered_entities:")
-dump2(minetest.registered_entities)
+--print("minetest.registered_entities:")
+--dump2(minetest.registered_entities)
 
 -- END