diff options
Diffstat (limited to 'worldedit_gui/functionality.lua')
-rw-r--r-- | worldedit_gui/functionality.lua | 66 |
1 files changed, 58 insertions, 8 deletions
diff --git a/worldedit_gui/functionality.lua b/worldedit_gui/functionality.lua index d3b78f6..7010b14 100644 --- a/worldedit_gui/functionality.lua +++ b/worldedit_gui/functionality.lua @@ -280,6 +280,11 @@ worldedit.register_gui_handler("worldedit_gui_cylinder", function(name, fields) end
return true
end
+ if fields.worldedit_gui_cylinder_axis then
+ gui_axis1[name] = axis_indices[fields.worldedit_gui_cylinder_axis]
+ worldedit.show_page(name, "worldedit_gui_cylinder")
+ return true
+ end
return false
end)
@@ -313,6 +318,11 @@ worldedit.register_gui_handler("worldedit_gui_pyramid", function(name, fields) end
return true
end
+ if fields.worldedit_gui_pyramid_axis then
+ gui_axis1[name] = axis_indices[fields.worldedit_gui_pyramid_axis]
+ worldedit.show_page(name, "worldedit_gui_pyramid")
+ return true
+ end
return false
end)
@@ -373,6 +383,11 @@ worldedit.register_gui_handler("worldedit_gui_copy_move", function(name, fields) end
return true
end
+ if fields.worldedit_gui_copy_move_axis then
+ gui_axis1[name] = axis_indices[fields.worldedit_gui_copy_move_axis] or 4
+ worldedit.show_page(name, "worldedit_gui_copy_move")
+ return true
+ end
return false
end)
@@ -395,6 +410,11 @@ worldedit.register_gui_handler("worldedit_gui_stack", function(name, fields) minetest.chatcommands["/stack"].func(name, string.format("%s %s", axis_values[gui_axis1[name]], gui_count1[name]))
return true
end
+ if fields.worldedit_gui_stack_axis then
+ gui_axis1[name] = axis_indices[fields.worldedit_gui_stack_axis]
+ worldedit.show_page(name, "worldedit_gui_stack")
+ return true
+ end
return false
end)
@@ -441,13 +461,23 @@ worldedit.register_gui_handler("worldedit_gui_transpose", function(name, fields) minetest.chatcommands["/transpose"].func(name, string.format("%s %s", axis_values[gui_axis1[name]], axis_values[gui_axis2[name]]))
return true
end
+ if fields.worldedit_gui_transpose_axis1 then
+ gui_axis1[name] = axis_indices[fields.worldedit_gui_transpose_axis1]
+ worldedit.show_page(name, "worldedit_gui_transpose")
+ return true
+ end
+ if fields.worldedit_gui_transpose_axis2 then
+ gui_axis2[name] = axis_indices[fields.worldedit_gui_transpose_axis2]
+ worldedit.show_page(name, "worldedit_gui_transpose")
+ return true
+ end
return false
end)
worldedit.register_gui_function("worldedit_gui_flip", {
name = "Flip", privs = minetest.chatcommands["/flip"].privs,
get_formspec = function(name)
- local axis = gui_axis2[name]
+ local axis = gui_axis1[name]
return "size[5,3]" .. worldedit.get_formspec_header("worldedit_gui_flip") ..
string.format("dropdown[0,1;2.5;worldedit_gui_flip_axis;X axis,Y axis,Z axis,Look direction;%d]", axis) ..
"button_exit[0,2.5;3,0.8;worldedit_gui_flip_submit;Flip]"
@@ -456,9 +486,14 @@ worldedit.register_gui_function("worldedit_gui_flip", { worldedit.register_gui_handler("worldedit_gui_flip", function(name, fields)
if fields.worldedit_gui_flip_submit then
- gui_axis2[name] = axis_indices[fields.worldedit_gui_flip_axis]
+ gui_axis1[name] = axis_indices[fields.worldedit_gui_flip_axis]
+ worldedit.show_page(name, "worldedit_gui_flip")
+ minetest.chatcommands["/flip"].func(name, axis_values[gui_axis1[name]])
+ return true
+ end
+ if fields.worldedit_gui_flip_axis then
+ gui_axis1[name] = axis_indices[fields.worldedit_gui_flip_axis]
worldedit.show_page(name, "worldedit_gui_flip")
- minetest.chatcommands["/flip"].func(name, axis_values[gui_axis2[name]])
return true
end
return false
@@ -483,6 +518,16 @@ worldedit.register_gui_handler("worldedit_gui_rotate", function(name, fields) minetest.chatcommands["/rotate"].func(name, string.format("%s %s", axis_values[gui_axis1[name]], angle_values[gui_angle[name]]))
return true
end
+ if fields.worldedit_gui_rotate_axis then
+ gui_axis1[name] = axis_indices[fields.worldedit_gui_rotate_axis]
+ worldedit.show_page(name, "worldedit_gui_rotate")
+ return true
+ end
+ if fields.worldedit_gui_rotate_angle then
+ gui_angle[name] = angle_indices[fields.worldedit_gui_rotate_angle]
+ worldedit.show_page(name, "worldedit_gui_rotate")
+ return true
+ end
return false
end)
@@ -500,7 +545,12 @@ worldedit.register_gui_handler("worldedit_gui_orient", function(name, fields) if fields.worldedit_gui_orient_submit then
gui_angle[name] = angle_indices[fields.worldedit_gui_orient_angle]
worldedit.show_page(name, "worldedit_gui_orient")
- minetest.chatcommands["/orient"].func(name, angle_values[gui_angle[name]])
+ minetest.chatcommands["/orient"].func(name, tostring(angle_values[gui_angle[name]]))
+ return true
+ end
+ if fields.worldedit_gui_orient_angle then
+ gui_angle[name] = angle_indices[fields.worldedit_gui_orient_angle]
+ worldedit.show_page(name, "worldedit_gui_orient")
return true
end
return false
@@ -591,9 +641,9 @@ worldedit.register_gui_function("worldedit_gui_save_load", { end,
})
-worldedit.register_gui_handler("worldedit_gui_save", function(name, fields)
- if fields.worldedit_gui_save_load_submit_save or worldedit_gui_save_load_submit_allocate or worldedit_gui_save_load_submit_load then
- gui_filename[name] = tostring(fields.worldedit_gui_save_axis)
+worldedit.register_gui_handler("worldedit_gui_save_load", function(name, fields)
+ if fields.worldedit_gui_save_load_submit_save or fields.worldedit_gui_save_load_submit_allocate or fields.worldedit_gui_save_load_submit_load then
+ gui_filename[name] = tostring(fields.worldedit_gui_save_filename)
worldedit.show_page(name, "worldedit_gui_save_load")
if fields.worldedit_gui_save_load_submit_save then
minetest.chatcommands["/save"].func(name, gui_filename[name])
@@ -620,7 +670,7 @@ worldedit.register_gui_function("worldedit_gui_lua", { worldedit.register_gui_handler("worldedit_gui_lua", function(name, fields)
if fields.worldedit_gui_lua_run or fields.worldedit_gui_lua_transform then
- gui_code[name] = fields.worldedit_gui_lua_value
+ gui_code[name] = fields.worldedit_gui_lua_code
worldedit.show_page(name, "worldedit_gui_lua")
if fields.worldedit_gui_lua_run then
minetest.chatcommands["/lua"].func(name, gui_code[name])
|