From 576351225ae6fc50c3b901b2a69a71439329b41b Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Sun, 10 May 2020 22:18:26 +0100 Subject: [PATCH] //maze[3d]: fix path dimension edge cases - value less than 1 - non-integer value (unconditionally math.floor(); comment added about this) --- worldeditadditions_commands/commands/maze.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/worldeditadditions_commands/commands/maze.lua b/worldeditadditions_commands/commands/maze.lua index 709be25..3267163 100644 --- a/worldeditadditions_commands/commands/maze.lua +++ b/worldeditadditions_commands/commands/maze.lua @@ -44,8 +44,18 @@ local function parse_params_maze(params_text, is_3d) if not replace_node then return false, "Error: Invalid node name for replace_node" end + if not path_length or path_length < 1 then + return false, "Error: Invalid path length (it must be a positive integer)" + end + if not path_width or path_width < 1 then + return false, "Error: Invalid path width (it must be a positive integer)" + end + if not path_depth or path_depth < 1 then + return false, "Error: Invalid path depth (it must be a positive integer)" + end - return true, replace_node, seed, path_length, path_width, path_depth + -- We unconditionally math.floor here because when we tried to test for it directly it was unreliable + return true, replace_node, seed, math.floor(path_length), math.floor(path_width), math.floor(path_depth) end worldedit.register_command("maze", {