diff --git a/Chat-Command-Reference.md b/Chat-Command-Reference.md index 1c50145..fd040d2 100644 --- a/Chat-Command-Reference.md +++ b/Chat-Command-Reference.md @@ -357,6 +357,17 @@ Note that this isn't necessarily limited to executing WorldEdit / WorldEditAddit //many 100 //multi //1 //2 //outset 20 //set dirt ``` +### `//ellipsoidapply ` +Executes the given command, and then clips the result to the largest ellipsoid that will fit inside the defined region. The specified command must obviously take 2 positions - so for example `//set`, `//replacemix`, and `//maze3d` will work, but `//sphere`, `//torus`, and `//floodfill` won't. + +``` +//ellipsoidapply set dirt +//ellipsoidapply maze3d dirt 4 2 2 +//ellipsoidapply erode +//ellipsoidapply replacemix sand bakedclay:red bakedclay:orange +//ellipsoidapply layers desert_sand sand 2 desert_sandstone 4 sandstone 10 +``` + ### `//y` Confirms the execution of a command if it could potentially affect a large number of nodes and take a while. This is a regular WorldEdit command. diff --git a/README.md b/README.md index da9e25e..f4afb01 100644 --- a/README.md +++ b/README.md @@ -51,10 +51,13 @@ The detailed explanations have moved! Check them out [here](https://github.com/s ### Statistics - [`//count`](https://github.com/sbrl/Minetest-WorldEditAdditions/blob/master/Chat-Command-Reference.md#count) -### Extras +### Meta - [`//multi ....`](https://github.com/sbrl/Minetest-WorldEditAdditions/blob/master/Chat-Command-Reference.md#multi-command_a-command_b-command_c-) - [`//many `](https://github.com/sbrl/Minetest-WorldEditAdditions/blob/master/Chat-Command-Reference.md#many-times-command) (coming soon in v1.9!) - [`//subdivide `](https://github.com/sbrl/Minetest-WorldEditAdditions/blob/master/Chat-Command-Reference.md#subdivide-size_x-size_y-size_z-cmd_name-args) **experimental** + - [`//ellipsoidapply `](https://github.com/sbrl/Minetest-WorldEditAdditions/blob/master/Chat-Command-Reference.md#ellipsoidapply-command_name-args) + +### Extras - [`//y`](https://github.com/sbrl/Minetest-WorldEditAdditions/blob/master/Chat-Command-Reference.md#y) - [`//n`](https://github.com/sbrl/Minetest-WorldEditAdditions/blob/master/Chat-Command-Reference.md#n) diff --git a/worldeditadditions/lib/forest.lua b/worldeditadditions/lib/forest.lua index abee0a1..ce27f01 100644 --- a/worldeditadditions/lib/forest.lua +++ b/worldeditadditions/lib/forest.lua @@ -61,7 +61,7 @@ function worldeditadditions.forest(pos1, pos2, density_multiplier, sapling_weigh stats.placed[node_id] = 0 end stats.placed[node_id] = stats.placed[node_id] + 1 - print("incrementing id", node_id, "to", stats.placed[node_id]) + -- print("incrementing id", node_id, "to", stats.placed[node_id]) break end end diff --git a/worldeditadditions/lib/layers.lua b/worldeditadditions/lib/layers.lua index e302e58..78572b4 100644 --- a/worldeditadditions/lib/layers.lua +++ b/worldeditadditions/lib/layers.lua @@ -15,9 +15,9 @@ function worldeditadditions.layers(pos1, pos2, node_weights) -- minetest.log("action", "pos1: " .. worldeditadditions.vector.tostring(pos1)) -- minetest.log("action", "pos2: " .. worldeditadditions.vector.tostring(pos2)) - for i,v in ipairs(node_ids) do - print("[layer] i", i, "node id", v) - end + -- for i,v in ipairs(node_ids) do + -- print("[layer] i", i, "node id", v) + -- end -- z y x is the preferred loop order, but that isn't really possible here local changes = { replaced = 0, skipped_columns = 0 } diff --git a/worldeditadditions/utils/terrain.lua b/worldeditadditions/utils/terrain.lua index d4353b6..4032024 100644 --- a/worldeditadditions/utils/terrain.lua +++ b/worldeditadditions/utils/terrain.lua @@ -45,7 +45,7 @@ end -- @param heightmap_size int[] The size of the heightmap in the form [ z, x ] -- @return Vector[] The calculated normal map, in the same form as the input heightmap. Each element of the array is a 3D Vector (i.e. { x, y, z }) representing a normal. function worldeditadditions.calculate_normals(heightmap, heightmap_size) - print("heightmap_size: "..heightmap_size[1].."x"..heightmap_size[0]) + -- print("heightmap_size: "..heightmap_size[1].."x"..heightmap_size[0]) local result = {} for z = heightmap_size[0]-1, 0, -1 do for x = heightmap_size[1]-1, 0, -1 do diff --git a/worldeditadditions_commands/commands/meta/ellipsoidapply.lua b/worldeditadditions_commands/commands/meta/ellipsoidapply.lua index dced192..8a89dab 100644 --- a/worldeditadditions_commands/commands/meta/ellipsoidapply.lua +++ b/worldeditadditions_commands/commands/meta/ellipsoidapply.lua @@ -14,17 +14,18 @@ worldedit.register_command("ellipsoidapply", { local cmd_name, args_text = params_text:match("([^%s]+)%s+(.+)") if not cmd_name then - return false, "Error: Invalid syntax." + cmd_name = params_text + args_text = "" end - print("cmd_name", cmd_name, "args_text", args_text) + -- print("cmd_name", cmd_name, "args_text", args_text) -- Note that we search the worldedit commands here, not the minetest ones local cmd_we = worldedit.registered_commands[cmd_name] if cmd_we == nil then return false, "Error: "..cmd_name.." isn't a valid command." end - print("cmd require_pos", cmd_we.require_pos, "END") + -- print("cmd require_pos", cmd_we.require_pos, "END") if cmd_we.require_pos ~= 2 then return false, "Error: The command "..cmd_name.." exists, but doesn't take 2 positions and so can't be used with //ellipsoidapply." end @@ -53,7 +54,7 @@ worldedit.register_command("ellipsoidapply", { cmd.func(name, unpack(args_parsed)) end, args ) - local time_overhead = worldeditadditions.round((stats_time.fn / stats_time.all) * 100, 3) + local time_overhead = 100 - worldeditadditions.round((stats_time.fn / stats_time.all) * 100, 3) minetest.log("action", name.." used //ellipsoidapply at "..worldeditadditions.vector.tostring(worldedit.pos1[name]).." - "..worldeditadditions.vector.tostring(worldedit.pos2[name]).." in "..worldeditadditions.human_time(stats_time.all)) return true, "Complete in "..worldeditadditions.human_time(stats_time.all).." ("..worldeditadditions.human_time(stats_time.fn).." fn, "..time_overhead.."% ellipsoidapply overhead)" diff --git a/worldeditadditions_commands/commands/meta/many.lua b/worldeditadditions_commands/commands/meta/many.lua index 5aba3e7..f98225d 100644 --- a/worldeditadditions_commands/commands/meta/many.lua +++ b/worldeditadditions_commands/commands/meta/many.lua @@ -86,7 +86,7 @@ minetest.register_chatcommand("/many", { local count, cmd_name, args = params_text:match("^(%d+)%s([^%s]+)%s(.+)$") if not count then return false, "Error: Invalid syntax" end - print("[many] count", count, "cmd_name", cmd_name, "args", args) + -- print("[many] count", count, "cmd_name", cmd_name, "args", args) count = tonumber(count) cmd_name = trim(cmd_name):sub(2) -- Things start at 1, not 0 in Lua :-( diff --git a/worldeditadditions_commands/commands/meta/subdivide.lua b/worldeditadditions_commands/commands/meta/subdivide.lua index e9decbc..884d7f5 100644 --- a/worldeditadditions_commands/commands/meta/subdivide.lua +++ b/worldeditadditions_commands/commands/meta/subdivide.lua @@ -133,7 +133,7 @@ worldedit.register_command("subdivide", { local time_average = wea.average(time_chunks) local eta = (chunks_total - i) * time_average - print("eta", eta, "time_average", time_average, "chunks_left", chunks_total - i) + -- print("eta", eta, "time_average", time_average, "chunks_left", chunks_total - i) -- Send updates every 2 seconds, and after the first 3 chunks are done if worldeditadditions.get_ms_time() - time_last_msg > 2 * 1000 or i == 3 or i == chunks_total then