set infotext after swapping node

This commit is contained in:
flux 2022-12-21 10:06:11 -08:00
parent d1093fe448
commit 9289a1ae9d
No known key found for this signature in database
GPG Key ID: 9333B27816848A15
1 changed files with 8 additions and 11 deletions

View File

@ -362,17 +362,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 = {};
@ -387,6 +376,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");