Disable some debug prints, and update docs

This commit is contained in:
Starbeamrainbowlabs 2020-09-20 22:07:47 +01:00
parent d943d7ac78
commit 130524a7d0
No known key found for this signature in database
GPG Key ID: 1BE5172E637709C2
8 changed files with 27 additions and 12 deletions

@ -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 <command_name> <args>`
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.

@ -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 <command_a> <command_b> ....`](https://github.com/sbrl/Minetest-WorldEditAdditions/blob/master/Chat-Command-Reference.md#multi-command_a-command_b-command_c-)
- [`//many <times> <command>`](https://github.com/sbrl/Minetest-WorldEditAdditions/blob/master/Chat-Command-Reference.md#many-times-command) (coming soon in v1.9!)
- [`//subdivide <size_x> <size_y> <size_z> <cmd_name> <args>`](https://github.com/sbrl/Minetest-WorldEditAdditions/blob/master/Chat-Command-Reference.md#subdivide-size_x-size_y-size_z-cmd_name-args) **experimental**
- [`//ellipsoidapply <command_name> <args>`](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)

@ -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

@ -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 }

@ -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

@ -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)"

@ -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 :-(

@ -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