bugfix: back from preview works now
This commit is contained in:
parent
2430963d06
commit
a057a4328e
@ -430,6 +430,7 @@ build_chest.update_formspec = function( pos, page, player, fields )
|
|||||||
end
|
end
|
||||||
|
|
||||||
if( fields.preview and building_name ) then
|
if( fields.preview and building_name ) then
|
||||||
|
meta:set_string('preview',fields.preview); -- just so that we know what to do when the back-button is hit
|
||||||
return formspec..build_chest.preview_image_formspec( building_name,
|
return formspec..build_chest.preview_image_formspec( building_name,
|
||||||
build_chest.replacements_get_current( meta, village_id ), fields.preview);
|
build_chest.replacements_get_current( meta, village_id ), fields.preview);
|
||||||
end
|
end
|
||||||
@ -578,6 +579,10 @@ build_chest.on_receive_fields = function(pos, formname, fields, player)
|
|||||||
-- back button selected
|
-- back button selected
|
||||||
if( fields.back ) then
|
if( fields.back ) then
|
||||||
|
|
||||||
|
local preview = meta:get_string('preview');
|
||||||
|
if( preview and preview ~= "" ) then
|
||||||
|
meta:set_string('preview',"");
|
||||||
|
else
|
||||||
local current_path = minetest.deserialize( meta:get_string( 'current_path' ) or 'return {}' );
|
local current_path = minetest.deserialize( meta:get_string( 'current_path' ) or 'return {}' );
|
||||||
|
|
||||||
table.remove( current_path ); -- revert latest selection
|
table.remove( current_path ); -- revert latest selection
|
||||||
@ -586,6 +591,7 @@ build_chest.on_receive_fields = function(pos, formname, fields, player)
|
|||||||
meta:set_int( 'replace_row', 0 );
|
meta:set_int( 'replace_row', 0 );
|
||||||
meta:set_int( 'page_nr', 0 );
|
meta:set_int( 'page_nr', 0 );
|
||||||
meta:set_string( 'saved_as_filename', nil);
|
meta:set_string( 'saved_as_filename', nil);
|
||||||
|
end
|
||||||
|
|
||||||
-- menu entry selected
|
-- menu entry selected
|
||||||
elseif( fields.selection ) then
|
elseif( fields.selection ) then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user