forked from mtcontrib/replacer
changed storing of metadata; works again with latest MT
This commit is contained in:
parent
3f4ed7dc34
commit
b58252e397
12
init.lua
12
init.lua
@ -89,17 +89,13 @@ minetest.register_tool( "replacer:replacer",
|
|||||||
local node = minetest.env:get_node_or_nil( pos );
|
local node = minetest.env:get_node_or_nil( pos );
|
||||||
|
|
||||||
--minetest.chat_send_player( name, " Target node: "..minetest.serialize( node ).." at pos "..minetest.serialize( pos )..".");
|
--minetest.chat_send_player( name, " Target node: "..minetest.serialize( node ).." at pos "..minetest.serialize( pos )..".");
|
||||||
|
local metadata = "default:dirt 0 0";
|
||||||
local item = itemstack:to_table();
|
|
||||||
-- make sure metadata is always set
|
|
||||||
if( node ~= nil and node.name ) then
|
if( node ~= nil and node.name ) then
|
||||||
item[ "metadata" ] = node.name..' '..node.param1..' '..node.param2;
|
metadata = node.name..' '..node.param1..' '..node.param2;
|
||||||
else
|
|
||||||
item[ "metadata" ] = "default:dirt 0 0";
|
|
||||||
end
|
end
|
||||||
itemstack:replace( item );
|
itemstack:set_metadata( metadata );
|
||||||
|
|
||||||
minetest.chat_send_player( name, "Node replacement tool set to: '"..item[ "metadata" ].."'.");
|
minetest.chat_send_player( name, "Node replacement tool set to: '"..metadata.."'.");
|
||||||
|
|
||||||
return itemstack; -- nothing consumed but data changed
|
return itemstack; -- nothing consumed but data changed
|
||||||
end,
|
end,
|
||||||
|
Loading…
Reference in New Issue
Block a user