From 69bc9224dbfb5609af140d8ec5c791763e3f4295 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Fri, 2 Dec 2011 12:12:07 +0200 Subject: [PATCH] Rename "NodeItem"/"ToolItem"/"CraftItem" to "node"/"tool"/"craft" --- data/builtin.lua | 78 ++++---- data/mods/bucket/init.lua | 14 +- data/mods/default/init.lua | 278 +++++++++++++------------- data/mods/experimental/init.lua | 28 +-- data/mods/give_initial_stuff/init.lua | 10 +- src/inventory.cpp | 6 +- src/inventory.h | 6 +- 7 files changed, 210 insertions(+), 210 deletions(-) diff --git a/data/builtin.lua b/data/builtin.lua index c3e426db..bfdb45d9 100644 --- a/data/builtin.lua +++ b/data/builtin.lua @@ -156,9 +156,9 @@ minetest.register_node("ignore", { -- -- stackstring manipulation functions --- example stackstring: 'CraftItem "apple" 4' --- example item: {type="CraftItem", name="apple"} --- example item: {type="ToolItem", name="SteelPick", wear="23272"} +-- example stackstring: 'craft "apple" 4' +-- example item: {type="craft", name="apple"} +-- example item: {type="tool", name="SteelPick", wear="23272"} -- function stackstring_take_item(stackstring) @@ -167,13 +167,13 @@ function stackstring_take_item(stackstring) end local stacktype = nil stacktype = string.match(stackstring, - '([%a%d]+Item[%a%d]*)') - if stacktype == "NodeItem" or stacktype == "CraftItem" then + '([%a%d]+)') + if stacktype == "node" or stacktype == "craft" then local itemtype = nil local itemname = nil local itemcount = nil itemtype, itemname, itemcount = string.match(stackstring, - '([%a%d]+Item[%a%d]*) "([^"]*)" (%d+)') + '([%a%d]+) "([^"]*)" (%d+)') itemcount = tonumber(itemcount) if itemcount == 0 then return '', nil @@ -183,12 +183,12 @@ function stackstring_take_item(stackstring) return itemtype.." \""..itemname.."\" "..(itemcount-1), {type=itemtype, name=itemname} end - elseif stacktype == "ToolItem" then + elseif stacktype == "tool" then local itemtype = nil local itemname = nil local itemwear = nil itemtype, itemname, itemwear = string.match(stackstring, - '([%a%d]+Item[%a%d]*) "([^"]*)" (%d+)') + '([%a%d]+) "([^"]*)" (%d+)') itemwear = tonumber(itemwear) return '', {type=itemtype, name=itemname, wear=itemwear} end @@ -201,17 +201,17 @@ function stackstring_put_item(stackstring, item) stackstring = stackstring or '' local stacktype = nil stacktype = string.match(stackstring, - '([%a%d]+Item[%a%d]*)') + '([%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 + if item.type == "node" or item.type == "craft" then local itemtype = nil local itemname = nil local itemcount = nil itemtype, itemname, itemcount = string.match(stackstring, - '([%a%d]+Item[%a%d]*) "([^"]*)" (%d+)') + '([%a%d]+) "([^"]*)" (%d+)') itemtype = itemtype or item.type itemname = itemname or item.name if itemcount == nil then @@ -219,7 +219,7 @@ function stackstring_put_item(stackstring, item) end itemcount = itemcount + 1 return itemtype.." \""..itemname.."\" "..itemcount, true - elseif item.type == "ToolItem" then + elseif item.type == "tool" then if stacktype ~= nil then return stackstring, false end @@ -227,7 +227,7 @@ function stackstring_put_item(stackstring, item) local itemname = nil local itemwear = nil itemtype, itemname, itemwear = string.match(stackstring, - '([%a%d]+Item[%a%d]*) "([^"]*)" (%d+)') + '([%a%d]+) "([^"]*)" (%d+)') itemwear = tonumber(itemwear) return itemtype.." \""..itemname.."\" "..itemwear, true end @@ -253,53 +253,53 @@ function test_stackstring() local item local success - stack, item = stackstring_take_item('NodeItem "TNT" 3') - assert(stack == 'NodeItem "TNT" 2') - assert(item.type == 'NodeItem') + stack, item = stackstring_take_item('node "TNT" 3') + assert(stack == 'node "TNT" 2') + assert(item.type == 'node') assert(item.name == 'TNT') - stack, item = stackstring_take_item('CraftItem "with spaces" 2') - assert(stack == 'CraftItem "with spaces" 1') - assert(item.type == 'CraftItem') + stack, item = stackstring_take_item('craft "with spaces" 2') + assert(stack == 'craft "with spaces" 1') + assert(item.type == 'craft') assert(item.name == 'with spaces') - stack, item = stackstring_take_item('CraftItem "with spaces" 1') + stack, item = stackstring_take_item('craft "with spaces" 1') assert(stack == '') - assert(item.type == 'CraftItem') + assert(item.type == 'craft') assert(item.name == 'with spaces') - stack, item = stackstring_take_item('CraftItem "s8df2kj3" 0') + stack, item = stackstring_take_item('craft "s8df2kj3" 0') assert(stack == '') assert(item == nil) - stack, item = stackstring_take_item('ToolItem "With Spaces" 32487') + stack, item = stackstring_take_item('tool "With Spaces" 32487') assert(stack == '') - assert(item.type == 'ToolItem') + assert(item.type == 'tool') 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') + stack, success = stackstring_put_item('node "With Spaces" 40', + {type='node', name='With Spaces'}) + assert(stack == 'node "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') + stack, success = stackstring_put_item('craft "With Spaces" 40', + {type='craft', name='With Spaces'}) + assert(stack == 'craft "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') + stack, success = stackstring_put_item('tool "With Spaces" 32487', + {type='tool', name='With Spaces'}) + assert(stack == 'tool "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') + stack, success = stackstring_put_item('node "With Spaces" 40', + {type='tool', name='With Spaces'}) + assert(stack == 'node "With Spaces" 40') assert(success == false) - assert(stackstring_put_stackstring('NodeItem "With Spaces" 2', - 'NodeItem "With Spaces" 1') == 'NodeItem "With Spaces" 3') + assert(stackstring_put_stackstring('node "With Spaces" 2', + 'node "With Spaces" 1') == 'node "With Spaces" 3') end test_stackstring() @@ -312,7 +312,7 @@ minetest.craftitem_place_item = function(item, placer, pos) --print("item: " .. dump(item)) --print("placer: " .. dump(placer)) --print("pos: " .. dump(pos)) - minetest.env:add_item(pos, 'CraftItem "' .. item .. '" 1') + minetest.env:add_item(pos, 'craft "' .. item .. '" 1') return true end diff --git a/data/mods/bucket/init.lua b/data/mods/bucket/init.lua index 013ff240..6d16c0cd 100644 --- a/data/mods/bucket/init.lua +++ b/data/mods/bucket/init.lua @@ -1,8 +1,8 @@ minetest.register_craft({ - output = 'CraftItem "bucket" 1', + output = 'craft "bucket" 1', recipe = { - {'CraftItem "steel_ingot"', '', 'CraftItem "steel_ingot"'}, - {'', 'CraftItem "steel_ingot"', ''}, + {'craft "steel_ingot"', '', 'craft "steel_ingot"'}, + {'', 'craft "steel_ingot"', ''}, } }) @@ -16,11 +16,11 @@ minetest.register_craftitem("bucket", { n = minetest.env:get_node(pointed_thing.under) if n.name == "water_source" then minetest.env:add_node(pointed_thing.under, {name="air"}) - player:add_to_inventory_later('CraftItem "bucket_water" 1') + player:add_to_inventory_later('craft "bucket_water" 1') return true elseif n.name == "lava_source" then minetest.env:add_node(pointed_thing.under, {name="air"}) - player:add_to_inventory_later('CraftItem "bucket_lava" 1') + player:add_to_inventory_later('craft "bucket_lava" 1') return true end end @@ -43,7 +43,7 @@ minetest.register_craftitem("bucket_water", { else minetest.env:add_node(pointed_thing.above, {name="water_source"}) end - player:add_to_inventory_later('CraftItem "bucket" 1') + player:add_to_inventory_later('craft "bucket" 1') return true end return false @@ -65,7 +65,7 @@ minetest.register_craftitem("bucket_lava", { else minetest.env:add_node(pointed_thing.above, {name="lava_source"}) end - player:add_to_inventory_later('CraftItem "bucket" 1') + player:add_to_inventory_later('craft "bucket" 1') return true end return false diff --git a/data/mods/default/init.lua b/data/mods/default/init.lua index 6788defa..6b313f6b 100644 --- a/data/mods/default/init.lua +++ b/data/mods/default/init.lua @@ -14,16 +14,16 @@ -- {x=num, y=num, z=num} -- -- stackstring/itemstring: A stack of items in serialized format. --- eg. 'NodeItem "dirt" 5' --- eg. 'ToolItem "WPick" 21323' --- eg. 'CraftItem "apple" 2' +-- eg. 'node "dirt" 5' +-- eg. 'tool "WPick" 21323' +-- eg. 'craft "apple" 2' -- -- item: A single item in Lua table format. --- eg. {type="NodeItem", name="dirt"} +-- eg. {type="node", name="dirt"} -- ^ a single dirt node --- eg. {type="ToolItem", name="WPick", wear=21323} +-- eg. {type="tool", name="WPick", wear=21323} -- ^ a wooden pick about 1/3 weared out --- eg. {type="CraftItem", name="apple"} +-- eg. {type="craft", name="apple"} -- ^ an apple. -- -- Global functions: @@ -235,11 +235,11 @@ -- -- Recipe: -- { --- 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"', ''}, -- } -- } -- @@ -444,270 +444,270 @@ minetest.register_tool("", { -- 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"', ''}, + {'', 'craft "steel_ingot"', ''}, + {'craft "steel_ingot"', 'craft "apple"', 'craft "steel_ingot"'}, + {'', 'craft "steel_ingot"', ''}, } }) @@ -800,7 +800,7 @@ minetest.register_node("stone", { 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", { @@ -808,7 +808,7 @@ minetest.register_node("dirt_with_grass", { 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", { @@ -816,7 +816,7 @@ minetest.register_node("dirt_with_grass_footsteps", { 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", { @@ -831,7 +831,7 @@ minetest.register_node("sand", { inventory_image = inventorycube("sand.png"), is_ground_content = true, material = digprop_dirtlike(1.0), - cookresult_item = 'NodeItem "glass" 1', + cookresult_item = 'node "glass" 1', }) minetest.register_node("gravel", { @@ -846,7 +846,7 @@ minetest.register_node("sandstone", { 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", { @@ -854,7 +854,7 @@ minetest.register_node("clay", { 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", { @@ -862,7 +862,7 @@ minetest.register_node("brick", { 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", { @@ -870,7 +870,7 @@ minetest.register_node("tree", { 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, }) @@ -879,7 +879,7 @@ minetest.register_node("jungletree", { 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, }) @@ -903,7 +903,7 @@ 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, }) @@ -1193,7 +1193,7 @@ 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), }) @@ -1248,7 +1248,7 @@ 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, }) @@ -1281,13 +1281,13 @@ minetest.register_craftitem("lump_of_coal", { minetest.register_craftitem("lump_of_iron", { image = "lump_of_iron.png", - cookresult_item = 'CraftItem "steel_ingot" 1', + cookresult_item = 'craft "steel_ingot" 1', on_place_on_ground = minetest.craftitem_place_item, }) minetest.register_craftitem("lump_of_clay", { image = "lump_of_clay.png", - cookresult_item = 'CraftItem "clay_brick" 1', + cookresult_item = 'craft "clay_brick" 1', on_place_on_ground = minetest.craftitem_place_item, }) @@ -1303,7 +1303,7 @@ minetest.register_craftitem("clay_brick", { 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 @@ -1312,7 +1312,7 @@ minetest.register_craftitem("rat", { minetest.register_craftitem("cooked_rat", { image = "cooked_rat.png", - cookresult_item = 'CraftItem "scorched_stuff" 1', + cookresult_item = 'craft "scorched_stuff" 1', on_place_on_ground = minetest.craftitem_place_item, on_use = minetest.craftitem_eat(6), }) diff --git a/data/mods/experimental/init.lua b/data/mods/experimental/init.lua index fdfc8a78..4b95a5fd 100644 --- a/data/mods/experimental/init.lua +++ b/data/mods/experimental/init.lua @@ -56,7 +56,7 @@ minetest.register_abm({ _, 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 + if fuelitem.type == "node" then local prop = minetest.registered_nodes[fuelitem.name] if prop == nil then return end if prop.furnace_burntime < 0 then return end @@ -64,7 +64,7 @@ minetest.register_abm({ return end local resultstack = nil - if srcitem.type == "NodeItem" then + if srcitem.type == "node" then local prop = minetest.registered_nodes[srcitem.name] if prop == nil then return end if prop.cookresult_item == "" then return end @@ -97,11 +97,11 @@ minetest.register_abm({ }) minetest.register_craft({ - output = 'NodeItem "luafurnace" 1', + output = 'node "luafurnace" 1', recipe = { - {'NodeItem "cobble"', '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"', 'node "cobble"'}, } }) @@ -126,9 +126,9 @@ minetest.register_tool("horribletool", { --]] minetest.register_craft({ - output = 'NodeItem "somenode" 4', + output = 'node "somenode" 4', recipe = { - {'CraftItem "Stick" 1'}, + {'craft "Stick" 1'}, } }) @@ -151,11 +151,11 @@ minetest.register_node("somenode", { -- minetest.register_craft({ - output = 'NodeItem "TNT" 4', + output = 'node "TNT" 4', recipe = { - {'NodeItem "wood" 1'}, - {'CraftItem "lump_of_coal" 1'}, - {'NodeItem "wood" 1'} + {'node "wood" 1'}, + {'craft "lump_of_coal" 1'}, + {'node "wood" 1'} } }) @@ -213,7 +213,7 @@ function TNT:on_punch(hitter) self.health = self.health - 1 if self.health <= 0 then self.object:remove() - hitter:add_to_inventory("NodeItem TNT 1") + hitter:add_to_inventory("node TNT 1") hitter:set_hp(hitter:get_hp() - 1) end end @@ -259,7 +259,7 @@ minetest.register_entity("testentity", { on_punch = function(self, hitter) self.object:remove() - hitter:add_to_inventory('CraftItem testobject1 1') + hitter:add_to_inventory('craft testobject1 1') end, }) diff --git a/data/mods/give_initial_stuff/init.lua b/data/mods/give_initial_stuff/init.lua index bc99e214..e52784d6 100644 --- a/data/mods/give_initial_stuff/init.lua +++ b/data/mods/give_initial_stuff/init.lua @@ -2,11 +2,11 @@ minetest.register_on_newplayer(function(player) print("on_newplayer") if minetest.setting_getbool("give_initial_stuff") then print("giving give_initial_stuff to player") - player:add_to_inventory('ToolItem "SteelPick" 0') - player:add_to_inventory('NodeItem "torch" 99') - player:add_to_inventory('ToolItem "SteelAxe" 0') - player:add_to_inventory('ToolItem "SteelShovel" 0') - player:add_to_inventory('NodeItem "cobble" 99') + player:add_to_inventory('tool "SteelPick" 0') + player:add_to_inventory('node "torch" 99') + player:add_to_inventory('tool "SteelAxe" 0') + player:add_to_inventory('tool "SteelShovel" 0') + player:add_to_inventory('node "cobble" 99') end end) diff --git a/src/inventory.cpp b/src/inventory.cpp index 645e02d9..1e1e27c8 100644 --- a/src/inventory.cpp +++ b/src/inventory.cpp @@ -99,7 +99,7 @@ InventoryItem* InventoryItem::deSerialize(std::istream &is, IGameDef *gamedef) throw SerializationError("Too large material number"); return new MaterialItem(gamedef, material, count); } - else if(name == "NodeItem" || name == "MaterialItem3") + else if(name == "node" || name == "NodeItem" || name == "MaterialItem3") { std::string all; std::getline(is, all, '\n'); @@ -126,7 +126,7 @@ InventoryItem* InventoryItem::deSerialize(std::istream &is, IGameDef *gamedef) std::getline(is, inventorystring, '|'); throw SerializationError("MBOItem not supported anymore"); } - else if(name == "CraftItem") + else if(name == "craft" || name == "CraftItem") { std::string all; std::getline(is, all, '\n'); @@ -148,7 +148,7 @@ InventoryItem* InventoryItem::deSerialize(std::istream &is, IGameDef *gamedef) count = 1; return new CraftItem(gamedef, subname, count); } - else if(name == "ToolItem") + else if(name == "tool" || name == "ToolItem") { std::string all; std::getline(is, all, '\n'); diff --git a/src/inventory.h b/src/inventory.h index 24591f33..93a29764 100644 --- a/src/inventory.h +++ b/src/inventory.h @@ -158,7 +158,7 @@ public: } virtual void serialize(std::ostream &os) const { - os<<"NodeItem"; + os<<"node"; os<<" \""; os<