option to abort a project and start a new one
This commit is contained in:
parent
464f535195
commit
e8e2c4156e
@ -410,7 +410,11 @@ build_chest.update_formspec = function( pos, page, player, fields )
|
|||||||
if( backup_file and backup_file ~= "" ) then
|
if( backup_file and backup_file ~= "" ) then
|
||||||
local is_restore = meta:get_int('is_restore');
|
local is_restore = meta:get_int('is_restore');
|
||||||
local nodes_to_dig = meta:get_int( "nodes_to_dig" );
|
local nodes_to_dig = meta:get_int( "nodes_to_dig" );
|
||||||
if( not(is_restore) or is_restore ~= 1 ) then
|
if( fields.abort_project ) then
|
||||||
|
return formspec.."label[0,3;Abort this project and select a new one?]"..
|
||||||
|
"button[0,4;1.5,0.5;yes_abort_project;Yes]"..
|
||||||
|
"button[3,4;1.5,0.5;no_abort;No]";
|
||||||
|
elseif( not(is_restore) or is_restore ~= 1 ) then
|
||||||
return formspec.."button[0.5,3;4,0.5;proceed_with_scaffolding;Check project status/update]"..
|
return formspec.."button[0.5,3;4,0.5;proceed_with_scaffolding;Check project status/update]"..
|
||||||
"button[0.5,4;4,0.5;restore_backup;Restore original landscape]"..
|
"button[0.5,4;4,0.5;restore_backup;Restore original landscape]"..
|
||||||
"button[1,5;3,0.5;show_materials;Show materials used]"..
|
"button[1,5;3,0.5;show_materials;Show materials used]"..
|
||||||
@ -421,6 +425,7 @@ build_chest.update_formspec = function( pos, page, player, fields )
|
|||||||
return formspec.."button[0,3;5,0.5;restore_backup;Check landscape restauration state/update]"..
|
return formspec.."button[0,3;5,0.5;restore_backup;Check landscape restauration state/update]"..
|
||||||
"button[0,4;5,0.5;proceed_with_scaffolding;Switch back to planned project]"..
|
"button[0,4;5,0.5;proceed_with_scaffolding;Switch back to planned project]"..
|
||||||
"button[1,5;3,0.5;show_materials;Show materials used]"..
|
"button[1,5;3,0.5;show_materials;Show materials used]"..
|
||||||
|
"button[0,6;5,0.5;abort_project;Abort this project and select new]"..
|
||||||
"label[5,2.5;Materails needed to complete project:]"..
|
"label[5,2.5;Materails needed to complete project:]"..
|
||||||
"label[5,9;"..nodes_to_dig.." blocks need to be digged/removed]"..
|
"label[5,9;"..nodes_to_dig.." blocks need to be digged/removed]"..
|
||||||
"list[current_name;needed;5,3;8,6;]";
|
"list[current_name;needed;5,3;8,6;]";
|
||||||
@ -748,6 +753,23 @@ mirror = nil;
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- there has to be a way to abort a project and select another building/project elseif( fields.yes_abort_project ) then
|
||||||
|
elseif( fields.yes_abort_project ) then
|
||||||
|
local start_pos = minetest.deserialize( meta:get_string('start_pos'));
|
||||||
|
local end_pos = minetest.deserialize( meta:get_string('end_pos'));
|
||||||
|
-- find automaticly placed dig-here-indicators and scaffolding nodes
|
||||||
|
if( start_pos and end_pos and start_pos.x and end_pos.x) then
|
||||||
|
local nodes = minetest.find_nodes_in_area( start_pos, end_pos, {"handle_schematics:dig_here", "handle_schematics:support_setup"});
|
||||||
|
for i,v in ipairs( nodes ) do
|
||||||
|
minetest.set_node( v, { name = "air", param2 = 0 });
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- without existing backup it is possible to switch back in the menu
|
||||||
|
meta:set_string('backup', nil );
|
||||||
|
|
||||||
|
|
||||||
-- store a new end position
|
-- store a new end position
|
||||||
elseif( fields.set_end_pos ) then
|
elseif( fields.set_end_pos ) then
|
||||||
local node = minetest.get_node( pos );
|
local node = minetest.get_node( pos );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user