forked from mtcontrib/chesttools
merged flux' PRs
This commit is contained in:
commit
7d32cb06c7
15
init.lua
15
init.lua
@ -95,7 +95,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
chesttools.may_use = function( pos, player )
|
chesttools.may_use = function( pos, player )
|
||||||
if( not( player ) or not(pos) or not(pos.x)) then
|
if not (pos and player and player.is_player and player:is_player() and not player.is_fake_player) then
|
||||||
return false;
|
return false;
|
||||||
end
|
end
|
||||||
local name = player:get_player_name();
|
local name = player:get_player_name();
|
||||||
@ -190,7 +190,7 @@ chesttools.on_receive_fields = function(pos, formname, fields, player)
|
|||||||
selected = 'main';
|
selected = 'main';
|
||||||
end
|
end
|
||||||
local inv_list = 'main';
|
local inv_list = 'main';
|
||||||
if( selected == 'main' ) then
|
if( selected == 'main' ) then
|
||||||
inv_list = 'main';
|
inv_list = 'main';
|
||||||
elseif( selected == 'craft' ) then
|
elseif( selected == 'craft' ) then
|
||||||
inv_list = 'craft';
|
inv_list = 'craft';
|
||||||
@ -457,7 +457,7 @@ chesttools.form_input_handler = function( player, formname, fields)
|
|||||||
chesttools.update_chest( pos, formname, fields, player);
|
chesttools.update_chest( pos, formname, fields, player);
|
||||||
return true; -- this function was responsible for handling the input
|
return true; -- this function was responsible for handling the input
|
||||||
end
|
end
|
||||||
|
|
||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -497,10 +497,11 @@ chesttools.register_chest = function(node_name, desc, name, paramtype2, palette,
|
|||||||
"listring[current_player;main]")
|
"listring[current_player;main]")
|
||||||
end,
|
end,
|
||||||
|
|
||||||
can_dig = function(pos,player)
|
can_dig = function(pos, player)
|
||||||
local meta = minetest.get_meta(pos);
|
local player_name = (player and player.get_player_name and player:get_player_name()) or ""
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
return inv:is_empty("main") and player and player:is_player() and player:get_player_name() == meta:get_string('owner');
|
return player_name and inv:is_empty("main") and not minetest.is_protected(pos, player_name)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
allow_metadata_inventory_move = function(pos, from_list, from_index,
|
allow_metadata_inventory_move = function(pos, from_list, from_index,
|
||||||
@ -601,7 +602,7 @@ chesttools.register_chest = function(node_name, desc, name, paramtype2, palette,
|
|||||||
formspec = 'size['..tostring(offset)..',6.5]'..formspec;
|
formspec = 'size['..tostring(offset)..',6.5]'..formspec;
|
||||||
-- only show the formspec if it really is a chest that can be updated
|
-- only show the formspec if it really is a chest that can be updated
|
||||||
if( can_be_upgraded ) then
|
if( can_be_upgraded ) then
|
||||||
minetest.show_formspec( name, "chesttools:update", formspec );
|
minetest.show_formspec( name, "chesttools:update", formspec );
|
||||||
end
|
end
|
||||||
return nil;
|
return nil;
|
||||||
end,
|
end,
|
||||||
|
Loading…
Reference in New Issue
Block a user