return false\r
end)\r
\r
+worldedit.register_gui_function("worldedit_gui_cube", {\r
+ name = "Cuboid", -- technically the command is misnamed, I know...\r
+ privs = combine_we_privs({"hollowcube", "cube"}),\r
+ get_formspec = function(name)\r
+ local width, height, length = gui_distance1[name], gui_distance2[name], gui_distance3[name]\r
+ local node = gui_nodename1[name]\r
+ local nodename = worldedit.normalize_nodename(node)\r
+ return "size[6.5,4]" .. worldedit.get_formspec_header("worldedit_gui_cube") ..\r
+ string.format("field[0.5,1.5;4,0.8;worldedit_gui_cube_node;Name;%s]", minetest.formspec_escape(node)) ..\r
+ "button[4,1.18;1.5,0.8;worldedit_gui_cube_search;Search]" ..\r
+ formspec_node("5.5,1.1", nodename) ..\r
+ string.format("field[0.5,2.5;1,0.8;worldedit_gui_cube_width;Width;%s]", minetest.formspec_escape(width)) ..\r
+ string.format("field[1.5,2.5;1,0.8;worldedit_gui_cube_height;Height;%s]", minetest.formspec_escape(height)) ..\r
+ string.format("field[2.5,2.5;1,0.8;worldedit_gui_cube_length;Length;%s]", minetest.formspec_escape(length)) ..\r
+ "button_exit[0,3.5;3,0.8;worldedit_gui_cube_submit_hollow;Hollow Cuboid]" ..\r
+ "button_exit[3.5,3.5;3,0.8;worldedit_gui_cube_submit_solid;Solid Cuboid]"\r
+ end,\r
+})\r
+\r
+worldedit.register_gui_handler("worldedit_gui_cube", function(name, fields)\r
+ if fields.worldedit_gui_cube_search\r
+ or fields.worldedit_gui_cube_submit_hollow or fields.worldedit_gui_cube_submit_solid then\r
+ gui_nodename1[name] = tostring(fields.worldedit_gui_cube_node)\r
+ gui_distance1[name] = tostring(fields.worldedit_gui_cube_width)\r
+ gui_distance2[name] = tostring(fields.worldedit_gui_cube_height)\r
+ gui_distance3[name] = tostring(fields.worldedit_gui_cube_length)\r
+ worldedit.show_page(name, "worldedit_gui_cube")\r
+\r
+ local submit = nil\r
+ if fields.worldedit_gui_cube_submit_hollow then\r
+ submit = "hollowcube"\r
+ elseif fields.worldedit_gui_cube_submit_solid then\r
+ submit = "cube"\r
+ end\r
+ if submit then\r
+ local n = worldedit.normalize_nodename(gui_nodename1[name])\r
+ if n then\r
+ local args = string.format("%s %s %s %s", gui_distance1[name], gui_distance2[name], gui_distance3[name], n)\r
+ minetest.chatcommands["/"..submit].func(name, args)\r
+ end\r
+ end\r
+ return true\r
+ end\r
+ return false\r
+end)\r
+\r
worldedit.register_gui_function("worldedit_gui_clearobjects", {\r
name = "Clear Objects",\r
privs = we_privs("clearobjects"),\r