1
0
mirror of https://github.com/Sokomine/replacer.git synced 2024-11-15 06:10:21 +01:00

added support for dropped items; their receipe is now shown as well

This commit is contained in:
Sokomine 2014-10-02 17:48:33 +02:00
parent e64758aa0a
commit 464d343604

View File

@ -37,6 +37,10 @@ replacer.inspect = function( itemstack, user, pointed_thing, mode, show_receipe
return nil;
end
local name = user:get_player_name();
local keys = user:get_player_control();
if( keys["sneak"] ) then
show_receipe = true;
end
if( pointed_thing.type == 'object' ) then
local text = 'This is ';
@ -54,6 +58,9 @@ replacer.inspect = function( itemstack, user, pointed_thing, mode, show_receipe
sdata = minetest.deserialize( sdata );
if( sdata.itemstring ) then
text = text..' ['..tostring( sdata.itemstring )..']';
if( show_receipe ) then
replacer.inspect_show_crafting( name, sdata.itemstring, nil );
end
end
if( sdata.age ) then
text = text..', dropped '..tostring( math.floor( sdata.age/60 ))..' minutes ago';