]> git.lizzy.rs Git - worldedit.git/commitdiff
WorldEdit GUI support for new //cylinder functionality
authorsfan5 <sfan5@live.de>
Thu, 31 Aug 2017 14:46:57 +0000 (16:46 +0200)
committersfan5 <sfan5@live.de>
Thu, 31 Aug 2017 14:46:57 +0000 (16:46 +0200)
worldedit_gui/functionality.lua

index 17a8a79b618da18c2862cf1516bb6bba9b40fc26..d957c123d3e77342f4d51091a7dfd692fb69522f 100644 (file)
@@ -292,17 +292,21 @@ worldedit.register_gui_function("worldedit_gui_cylinder", {
        name = "Cylinder",\r
        privs = combine_we_privs({"hollowcylinder", "cylinder"}),\r
        get_formspec = function(name)\r
-               local node, axis, length, radius = gui_nodename1[name], gui_axis1[name], gui_distance1[name], gui_distance2[name]\r
+               local node, axis, length = gui_nodename1[name], gui_axis1[name], gui_distance1[name]\r
+               local radius1, radius2 = gui_distance2[name], gui_distance3[name]\r
                local nodename = worldedit.normalize_nodename(node)\r
-               return "size[6.5,5]" .. worldedit.get_formspec_header("worldedit_gui_cylinder") ..\r
+               return "size[6.5,6]" .. worldedit.get_formspec_header("worldedit_gui_cylinder") ..\r
                        string.format("field[0.5,1.5;4,0.8;worldedit_gui_cylinder_node;Name;%s]", minetest.formspec_escape(node)) ..\r
                        "button[4,1.18;1.5,0.8;worldedit_gui_cylinder_search;Search]" ..\r
                        formspec_node("5.5,1.1", nodename) ..\r
                        string.format("field[0.5,2.5;4,0.8;worldedit_gui_cylinder_length;Length;%s]", minetest.formspec_escape(length)) ..\r
                        string.format("dropdown[4,2.18;2.5;worldedit_gui_cylinder_axis;X axis,Y axis,Z axis,Look direction;%d]", axis) ..\r
-                       string.format("field[0.5,3.5;4,0.8;worldedit_gui_cylinder_radius;Radius;%s]", minetest.formspec_escape(radius)) ..\r
-                       "button_exit[0,4.5;3,0.8;worldedit_gui_cylinder_submit_hollow;Hollow Cylinder]" ..\r
-                       "button_exit[3.5,4.5;3,0.8;worldedit_gui_cylinder_submit_solid;Solid Cylinder]"\r
+                       string.format("field[0.5,3.5;2,0.8;worldedit_gui_cylinder_radius1;Base Radius;%s]", minetest.formspec_escape(radius1)) ..\r
+                       string.format("field[2.5,3.5;2,0.8;worldedit_gui_cylinder_radius2;Top Radius;%s]", minetest.formspec_escape(radius2)) ..\r
+                       "label[0.25,4;Equal base and top radius creates a cylinder,\n"..\r
+                               "zero top radius creates a cone.\nConsult documentation for more information.]"..\r
+                       "button_exit[0,5.5;3,0.8;worldedit_gui_cylinder_submit_hollow;Hollow Cylinder]" ..\r
+                       "button_exit[3.5,5.5;3,0.8;worldedit_gui_cylinder_submit_solid;Solid Cylinder]"\r
        end,\r
 })\r
 \r
@@ -312,7 +316,8 @@ worldedit.register_gui_handler("worldedit_gui_cylinder", function(name, fields)
                gui_nodename1[name] = tostring(fields.worldedit_gui_cylinder_node)\r
                gui_axis1[name] = axis_indices[fields.worldedit_gui_cylinder_axis]\r
                gui_distance1[name] = tostring(fields.worldedit_gui_cylinder_length)\r
-               gui_distance2[name] = tostring(fields.worldedit_gui_cylinder_radius)\r
+               gui_distance2[name] = tostring(fields.worldedit_gui_cylinder_radius1)\r
+               gui_distance3[name] = tostring(fields.worldedit_gui_cylinder_radius2)\r
                worldedit.show_page(name, "worldedit_gui_cylinder")\r
 \r
                local submit = nil\r
@@ -324,7 +329,8 @@ worldedit.register_gui_handler("worldedit_gui_cylinder", function(name, fields)
                if submit then\r
                        local n = worldedit.normalize_nodename(gui_nodename1[name])\r
                        if n then\r
-                               minetest.chatcommands["/"..submit].func(name, string.format("%s %s %s %s", axis_values[gui_axis1[name]], gui_distance1[name], gui_distance2[name], n))\r
+                               local args = string.format("%s %s %s %s %s", axis_values[gui_axis1[name]], 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