forked from mtcontrib/chesttools
Merge pull request #4 from fluxionary/infotext_tweak
set infotext after swapping node
This commit is contained in:
commit
543144c693
19
init.lua
19
init.lua
@ -388,17 +388,6 @@ chesttools.update_chest = function(pos, formname, fields, player)
|
||||
player_inv:add_item( 'main', old_price_item..' '..tostring(old_price_amount));
|
||||
end
|
||||
|
||||
-- set the owner field
|
||||
meta:set_string( 'owner', pname );
|
||||
|
||||
if( fields.locked ) then
|
||||
meta:set_string("infotext", "Locked Chest (owned by "..meta:get_string("owner")..")")
|
||||
elseif( fields.shared ) then
|
||||
meta:set_string("infotext", "Shared Chest (owned by "..meta:get_string("owner")..")")
|
||||
else
|
||||
meta:set_string("infotext", "Chest")
|
||||
end
|
||||
|
||||
-- copy the old inventory
|
||||
local inv = meta:get_inventory();
|
||||
local main_inv = {};
|
||||
@ -413,6 +402,14 @@ chesttools.update_chest = function(pos, formname, fields, player)
|
||||
-- make sure the player owns the new chest
|
||||
meta:set_string("owner", pname);
|
||||
|
||||
if( fields.locked ) then
|
||||
meta:set_string("infotext", "Locked Chest (owned by "..pname..")")
|
||||
elseif( fields.shared ) then
|
||||
meta:set_string("infotext", "Shared Chest (owned by "..pname..")")
|
||||
else
|
||||
meta:set_string("infotext", "Chest")
|
||||
end
|
||||
|
||||
-- put the inventory back
|
||||
local new_inv = meta:get_inventory();
|
||||
local new_inv_size = inv:get_size("main");
|
||||
|
Loading…
Reference in New Issue
Block a user