Skip to content

Commit 35b68c4

Browse files
committedJan 5, 2016
Fixed dropdown menus in the WorldEdit GUI (closes #78, thanks to @sponce)
1 parent 51158ec commit 35b68c4

File tree

1 file changed

+53
-3
lines changed

1 file changed

+53
-3
lines changed
 

Diff for: ‎worldedit_gui/functionality.lua

+53-3
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,11 @@ worldedit.register_gui_handler("worldedit_gui_cylinder", function(name, fields)
280280
end
281281
return true
282282
end
283+
if fields.worldedit_gui_cylinder_axis then
284+
gui_axis1[name] = axis_indices[fields.worldedit_gui_cylinder_axis]
285+
worldedit.show_page(name, "worldedit_gui_cylinder")
286+
return true
287+
end
283288
return false
284289
end)
285290

@@ -310,6 +315,11 @@ worldedit.register_gui_handler("worldedit_gui_pyramid", function(name, fields)
310315
end
311316
return true
312317
end
318+
if fields.worldedit_gui_pyramid_axis then
319+
gui_axis1[name] = axis_indices[fields.worldedit_gui_pyramid_axis]
320+
worldedit.show_page(name, "worldedit_gui_pyramid")
321+
return true
322+
end
313323
return false
314324
end)
315325

@@ -370,6 +380,11 @@ worldedit.register_gui_handler("worldedit_gui_copy_move", function(name, fields)
370380
end
371381
return true
372382
end
383+
if fields.worldedit_gui_copy_move_axis then
384+
gui_axis1[name] = axis_indices[fields.worldedit_gui_copy_move_axis] or 4
385+
worldedit.show_page(name, "worldedit_gui_copy_move")
386+
return true
387+
end
373388
return false
374389
end)
375390

@@ -392,6 +407,11 @@ worldedit.register_gui_handler("worldedit_gui_stack", function(name, fields)
392407
minetest.chatcommands["/stack"].func(name, string.format("%s %s", axis_values[gui_axis1[name]], gui_count1[name]))
393408
return true
394409
end
410+
if fields.worldedit_gui_stack_axis then
411+
gui_axis1[name] = axis_indices[fields.worldedit_gui_stack_axis]
412+
worldedit.show_page(name, "worldedit_gui_stack")
413+
return true
414+
end
395415
return false
396416
end)
397417

@@ -438,13 +458,23 @@ worldedit.register_gui_handler("worldedit_gui_transpose", function(name, fields)
438458
minetest.chatcommands["/transpose"].func(name, string.format("%s %s", axis_values[gui_axis1[name]], axis_values[gui_axis2[name]]))
439459
return true
440460
end
461+
if fields.worldedit_gui_transpose_axis1 then
462+
gui_axis1[name] = axis_indices[fields.worldedit_gui_transpose_axis1]
463+
worldedit.show_page(name, "worldedit_gui_transpose")
464+
return true
465+
end
466+
if fields.worldedit_gui_transpose_axis2 then
467+
gui_axis2[name] = axis_indices[fields.worldedit_gui_transpose_axis2]
468+
worldedit.show_page(name, "worldedit_gui_transpose")
469+
return true
470+
end
441471
return false
442472
end)
443473

444474
worldedit.register_gui_function("worldedit_gui_flip", {
445475
name = "Flip", privs = minetest.chatcommands["/flip"].privs,
446476
get_formspec = function(name)
447-
local axis = gui_axis2[name]
477+
local axis = gui_axis1[name]
448478
return "size[5,3]" .. worldedit.get_formspec_header("worldedit_gui_flip") ..
449479
string.format("dropdown[0,1;2.5;worldedit_gui_flip_axis;X axis,Y axis,Z axis,Look direction;%d]", axis) ..
450480
"button_exit[0,2.5;3,0.8;worldedit_gui_flip_submit;Flip]"
@@ -453,9 +483,14 @@ worldedit.register_gui_function("worldedit_gui_flip", {
453483

454484
worldedit.register_gui_handler("worldedit_gui_flip", function(name, fields)
455485
if fields.worldedit_gui_flip_submit then
456-
gui_axis2[name] = axis_indices[fields.worldedit_gui_flip_axis]
486+
gui_axis1[name] = axis_indices[fields.worldedit_gui_flip_axis]
487+
worldedit.show_page(name, "worldedit_gui_flip")
488+
minetest.chatcommands["/flip"].func(name, axis_values[gui_axis1[name]])
489+
return true
490+
end
491+
if fields.worldedit_gui_flip_axis then
492+
gui_axis1[name] = axis_indices[fields.worldedit_gui_flip_axis]
457493
worldedit.show_page(name, "worldedit_gui_flip")
458-
minetest.chatcommands["/flip"].func(name, axis_values[gui_axis2[name]])
459494
return true
460495
end
461496
return false
@@ -480,6 +515,16 @@ worldedit.register_gui_handler("worldedit_gui_rotate", function(name, fields)
480515
minetest.chatcommands["/rotate"].func(name, string.format("%s %s", axis_values[gui_axis1[name]], angle_values[gui_angle[name]]))
481516
return true
482517
end
518+
if fields.worldedit_gui_rotate_axis then
519+
gui_axis1[name] = axis_indices[fields.worldedit_gui_rotate_axis]
520+
worldedit.show_page(name, "worldedit_gui_rotate")
521+
return true
522+
end
523+
if fields.worldedit_gui_rotate_angle then
524+
gui_angle[name] = angle_indices[fields.worldedit_gui_rotate_angle]
525+
worldedit.show_page(name, "worldedit_gui_rotate")
526+
return true
527+
end
483528
return false
484529
end)
485530

@@ -500,6 +545,11 @@ worldedit.register_gui_handler("worldedit_gui_orient", function(name, fields)
500545
minetest.chatcommands["/orient"].func(name, tostring(angle_values[gui_angle[name]]))
501546
return true
502547
end
548+
if fields.worldedit_gui_orient_angle then
549+
gui_angle[name] = angle_indices[fields.worldedit_gui_orient_angle]
550+
worldedit.show_page(name, "worldedit_gui_orient")
551+
return true
552+
end
503553
return false
504554
end)
505555

0 commit comments

Comments
 (0)