@@ -166,7 +166,10 @@ worldedit.register_gui_handler("worldedit_gui_set", function(name, fields)
166
166
gui_nodename1 [name ] = tostring (fields .worldedit_gui_set_node )
167
167
worldedit .show_page (name , " worldedit_gui_set" )
168
168
if fields .worldedit_gui_set_submit then
169
- minetest .chatcommands [" /set" ].func (name , gui_nodename1 [name ])
169
+ local n = worldedit .normalize_nodename (gui_nodename1 [name ])
170
+ if n then
171
+ minetest .chatcommands [" /set" ].func (name , n )
172
+ end
170
173
end
171
174
return true
172
175
end
@@ -198,10 +201,19 @@ worldedit.register_gui_handler("worldedit_gui_replace", function(name, fields)
198
201
gui_nodename1 [name ] = tostring (fields .worldedit_gui_replace_search )
199
202
gui_nodename2 [name ] = tostring (fields .worldedit_gui_replace_replace )
200
203
worldedit .show_page (name , " worldedit_gui_replace" )
204
+
205
+ local submit = nil
201
206
if fields .worldedit_gui_replace_submit then
202
- minetest . chatcommands [ " /replace " ]. func ( name , string.format ( " %s %s " , gui_nodename1 [ name ], gui_nodename2 [ name ]))
207
+ submit = " replace "
203
208
elseif fields .worldedit_gui_replace_submit_inverse then
204
- minetest .chatcommands [" /replaceinverse" ].func (name , string.format (" %s %s" , gui_nodename1 [name ], gui_nodename2 [name ]))
209
+ submit = " replaceinverse"
210
+ end
211
+ if submit then
212
+ local n1 = worldedit .normalize_nodename (gui_nodename1 [name ])
213
+ local n2 = worldedit .normalize_nodename (gui_nodename2 [name ])
214
+ if n1 and n2 then
215
+ minetest .chatcommands [" /" .. submit ].func (name , string.format (" %s %s" , n1 , n2 ))
216
+ end
205
217
end
206
218
return true
207
219
end
@@ -233,14 +245,22 @@ worldedit.register_gui_handler("worldedit_gui_sphere_dome", function(name, field
233
245
gui_nodename1 [name ] = tostring (fields .worldedit_gui_sphere_dome_node )
234
246
gui_distance2 [name ] = tostring (fields .worldedit_gui_sphere_dome_radius )
235
247
worldedit .show_page (name , " worldedit_gui_sphere_dome" )
248
+
249
+ local submit = nil
236
250
if fields .worldedit_gui_sphere_dome_submit_hollow then
237
- minetest . chatcommands [ " /hollowsphere " ]. func ( name , string.format ( " %s %s " , gui_distance2 [ name ], gui_nodename1 [ name ]))
251
+ submit = " hollowsphere "
238
252
elseif fields .worldedit_gui_sphere_dome_submit_solid then
239
- minetest . chatcommands [ " /sphere " ]. func ( name , string.format ( " %s %s " , gui_distance2 [ name ], gui_nodename1 [ name ]))
253
+ submit = " sphere "
240
254
elseif fields .worldedit_gui_sphere_dome_submit_hollow_dome then
241
- minetest . chatcommands [ " /hollowdome " ]. func ( name , string.format ( " %s %s " , gui_distance2 [ name ], gui_nodename1 [ name ]))
255
+ submit = " hollowdome "
242
256
elseif fields .worldedit_gui_sphere_dome_submit_solid_dome then
243
- minetest .chatcommands [" /dome" ].func (name , string.format (" %s %s" , gui_distance2 [name ], gui_nodename1 [name ]))
257
+ submit = " dome"
258
+ end
259
+ if submit then
260
+ local n = worldedit .normalize_nodename (gui_nodename1 [name ])
261
+ if n then
262
+ minetest .chatcommands [" /" .. submit ].func (name , string.format (" %s %s" , gui_distance2 [name ], n ))
263
+ end
244
264
end
245
265
return true
246
266
end
@@ -273,10 +293,18 @@ worldedit.register_gui_handler("worldedit_gui_cylinder", function(name, fields)
273
293
gui_distance1 [name ] = tostring (fields .worldedit_gui_cylinder_length )
274
294
gui_distance2 [name ] = tostring (fields .worldedit_gui_cylinder_radius )
275
295
worldedit .show_page (name , " worldedit_gui_cylinder" )
296
+
297
+ local submit = nil
276
298
if fields .worldedit_gui_cylinder_submit_hollow then
277
- minetest . chatcommands [ " /hollowcylinder " ]. func ( name , string.format ( " %s %s %s %s " , axis_values [ gui_axis1 [ name ]], gui_distance1 [ name ], gui_distance2 [ name ], gui_nodename1 [ name ]))
299
+ submit = " hollowcylinder "
278
300
elseif fields .worldedit_gui_cylinder_submit_solid then
279
- minetest .chatcommands [" /cylinder" ].func (name , string.format (" %s %s %s %s" , axis_values [gui_axis1 [name ]], gui_distance1 [name ], gui_distance2 [name ], gui_nodename1 [name ]))
301
+ submit = " cylinder"
302
+ end
303
+ if submit then
304
+ local n = worldedit .normalize_nodename (gui_nodename1 [name ])
305
+ if n then
306
+ minetest .chatcommands [" /" .. submit ].func (name , string.format (" %s %s %s %s" , axis_values [gui_axis1 [name ]], gui_distance1 [name ], gui_distance2 [name ], n ))
307
+ end
280
308
end
281
309
return true
282
310
end
@@ -311,10 +339,18 @@ worldedit.register_gui_handler("worldedit_gui_pyramid", function(name, fields)
311
339
gui_axis1 [name ] = axis_indices [fields .worldedit_gui_pyramid_axis ]
312
340
gui_distance1 [name ] = tostring (fields .worldedit_gui_pyramid_length )
313
341
worldedit .show_page (name , " worldedit_gui_pyramid" )
342
+
343
+ local submit = nil
314
344
if fields .worldedit_gui_pyramid_submit_solid then
315
- minetest . chatcommands [ " /pyramid " ]. func ( name , string.format ( " %s %s %s " , axis_values [ gui_axis1 [ name ]], gui_distance1 [ name ], gui_nodename1 [ name ]))
345
+ submit = " pyramid "
316
346
elseif fields .worldedit_gui_pyramid_submit_hollow then
317
- minetest .chatcommands [" /hollowpyramid" ].func (name , string.format (" %s %s %s" , axis_values [gui_axis1 [name ]], gui_distance1 [name ], gui_nodename1 [name ]))
347
+ submit = " hollowpyramid"
348
+ end
349
+ if submit then
350
+ local n = worldedit .normalize_nodename (gui_nodename1 [name ])
351
+ if n then
352
+ minetest .chatcommands [" /" .. submit ].func (name , string.format (" %s %s %s" , axis_values [gui_axis1 [name ]], gui_distance1 [name ], n ))
353
+ end
318
354
end
319
355
return true
320
356
end
@@ -351,7 +387,10 @@ worldedit.register_gui_handler("worldedit_gui_spiral", function(name, fields)
351
387
gui_distance3 [name ] = tostring (fields .worldedit_gui_spiral_space )
352
388
worldedit .show_page (name , " worldedit_gui_spiral" )
353
389
if fields .worldedit_gui_spiral_submit then
354
- minetest .chatcommands [" /spiral" ].func (name , string.format (" %s %s %s %s" , gui_distance1 [name ], gui_distance2 [name ], gui_distance3 [name ], gui_nodename1 [name ]))
390
+ local n = worldedit .normalize_nodename (gui_nodename1 [name ])
391
+ if n then
392
+ minetest .chatcommands [" /spiral" ].func (name , string.format (" %s %s %s %s" , gui_distance1 [name ], gui_distance2 [name ], gui_distance3 [name ], n ))
393
+ end
355
394
end
356
395
return true
357
396
end
@@ -456,7 +495,6 @@ worldedit.register_gui_function("worldedit_gui_transpose", {
456
495
worldedit .register_gui_handler (" worldedit_gui_transpose" , function (name , fields )
457
496
if fields .worldedit_gui_transpose_submit then
458
497
gui_axis1 [name ] = axis_indices [fields .worldedit_gui_transpose_axis1 ]
459
- gui_axis2 [name ] = axis_indices [fields .worldedit_gui_transpose_axis2 ]
460
498
worldedit .show_page (name , " worldedit_gui_transpose" )
461
499
minetest .chatcommands [" /transpose" ].func (name , string.format (" %s %s" , axis_values [gui_axis1 [name ]], axis_values [gui_axis2 [name ]]))
462
500
return true
@@ -589,7 +627,10 @@ worldedit.register_gui_handler("worldedit_gui_suppress", function(name, fields)
589
627
gui_nodename1 [name ] = tostring (fields .worldedit_gui_suppress_node )
590
628
worldedit .show_page (name , " worldedit_gui_suppress" )
591
629
if fields .worldedit_gui_suppress_submit then
592
- minetest .chatcommands [" /suppress" ].func (name , gui_nodename1 [name ])
630
+ local n = worldedit .normalize_nodename (gui_nodename1 [name ])
631
+ if n then
632
+ minetest .chatcommands [" /suppress" ].func (name , n )
633
+ end
593
634
end
594
635
return true
595
636
end
@@ -615,7 +656,10 @@ worldedit.register_gui_handler("worldedit_gui_highlight", function(name, fields)
615
656
gui_nodename1 [name ] = tostring (fields .worldedit_gui_highlight_node )
616
657
worldedit .show_page (name , " worldedit_gui_highlight" )
617
658
if fields .worldedit_gui_highlight_submit then
618
- minetest .chatcommands [" /highlight" ].func (name , gui_nodename1 [name ])
659
+ local n = worldedit .normalize_nodename (gui_nodename1 [name ])
660
+ if n then
661
+ minetest .chatcommands [" /highlight" ].func (name , n )
662
+ end
619
663
end
620
664
return true
621
665
end
0 commit comments