diff --git a/worldeditadditions_commands/commands/bonemeal.lua b/worldeditadditions_commands/commands/bonemeal.lua index 214d4c5..84e97d6 100644 --- a/worldeditadditions_commands/commands/bonemeal.lua +++ b/worldeditadditions_commands/commands/bonemeal.lua @@ -69,11 +69,11 @@ worldeditadditions_core.register_command("bonemeal", { if not success then return success, nodes_bonemealed end local percentage = wea_c.round((nodes_bonemealed / candidates)*100, 2) - local time_taken = wea_c.get_ms_time() - start_time + local time_taken = wea_c.format.human_time(wea_c.get_ms_time() - start_time) -- Avoid nan% - since if there aren't any candidates then nodes_bonemealed will be 0 too if candidates == 0 then percentage = 0 end - minetest.log("action", name .. " used //bonemeal at "..pos1.." - "..pos2..", bonemealing " .. nodes_bonemealed.." nodes (out of "..candidates.." nodes) at strength "..strength.." in "..time_taken.."s") - return true, nodes_bonemealed.." out of "..candidates.." (~"..percentage.."%) candidates bonemealed in "..wea_c.format.human_time(time_taken) + minetest.log("action", name .. " used //bonemeal at "..pos1.." - "..pos2..", bonemealing " .. nodes_bonemealed.." nodes (out of "..candidates.." nodes) at strength "..strength.." in "..time_taken) + return true, nodes_bonemealed.." out of "..candidates.." (~"..percentage.."%) candidates bonemealed in "..time_taken end }) diff --git a/worldeditadditions_commands/commands/wireframe/init.lua b/worldeditadditions_commands/commands/wireframe/init.lua index 337a710..643a276 100644 --- a/worldeditadditions_commands/commands/wireframe/init.lua +++ b/worldeditadditions_commands/commands/wireframe/init.lua @@ -6,8 +6,8 @@ -- 2d and 3d outlines of shapes. -local we_cm = worldeditadditions_commands.modpath .. "/commands/wireframe/" +local wea_cmd = worldeditadditions_commands.modpath .. "/commands/wireframe/" -dofile(we_cm.."wbox.lua") -dofile(we_cm.."wcompass.lua") -dofile(we_cm.."wcorner.lua") +dofile(wea_cmd.."wbox.lua") +dofile(wea_cmd.."wcompass.lua") +dofile(wea_cmd.."wcorner.lua") diff --git a/worldeditadditions_commands/commands/wireframe/wbox.lua b/worldeditadditions_commands/commands/wireframe/wbox.lua index d600bba..88c7ef1 100644 --- a/worldeditadditions_commands/commands/wireframe/wbox.lua +++ b/worldeditadditions_commands/commands/wireframe/wbox.lua @@ -1,10 +1,14 @@ +local wea = worldeditadditions +local wea_c = worldeditadditions +local Vector3 = worldeditadditions.Vector3 + + -- ██ ██ ██████ ██████ ██ ██ -- ██ ██ ██ ██ ██ ██ ██ ██ -- ██ █ ██ ██████ ██ ██ ███ -- ██ ███ ██ ██ ██ ██ ██ ██ ██ -- ███ ███ ██████ ██████ ██ ██ -local wea = worldeditadditions -local v3 = worldeditadditions.Vector3 + worldeditadditions_core.register_command("wbox", { params = "", description = "Sets the edges of the current selection to ", @@ -21,7 +25,7 @@ worldeditadditions_core.register_command("wbox", { return true, node end, nodes_needed = function(name) - local delta = v3.subtract(worldedit.pos2[name], worldedit.pos1[name]):abs():add(1) + local delta = Vector3.subtract(worldedit.pos2[name], worldedit.pos1[name]):abs():add(1) local total, mult, axes = 1, 4, {"x","y","z"} for k,v in pairs(axes) do if worldedit.pos1[name] ~= worldedit.pos2[name] then total = total*2 @@ -33,7 +37,16 @@ worldeditadditions_core.register_command("wbox", { return total end, func = function(name, node) - local _, count = wea.wire_box(worldedit.pos1[name], worldedit.pos2[name], node) - return _, count .. " nodes set" + local start_time = wea_c.get_ms_time() + + local pos1, pos2 = Vector3.sort(worldedit.pos1[name], worldedit.pos2[name]) + local success, count = wea.wire_box(pos1, pos2, node) + if not success then return success, count end + + local time_taken = wea_c.format.human_time(wea_c.get_ms_time() - start_time) + + + minetest.log("action", name.." used //wbox at "..pos1.." - "..pos2..", taking "..time_taken) + return true, count .. " nodes set in "..time_taken end, }) diff --git a/worldeditadditions_commands/commands/wireframe/wcompass.lua b/worldeditadditions_commands/commands/wireframe/wcompass.lua index a54af4d..bfc9c08 100644 --- a/worldeditadditions_commands/commands/wireframe/wcompass.lua +++ b/worldeditadditions_commands/commands/wireframe/wcompass.lua @@ -1,16 +1,20 @@ +local wea = worldeditadditions +local wea_c = worldeditadditions_core +local Vector3 = wea_c.Vector3 + -- ██ ██ ██████ ██████ ███ ███ ██████ █████ ███████ ███████ -- ██ ██ ██ ██ ██ ████ ████ ██ ██ ██ ██ ██ ██ -- ██ █ ██ ██ ██ ██ ██ ████ ██ ██████ ███████ ███████ ███████ -- ██ ███ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ -- ███ ███ ██████ ██████ ██ ██ ██ ██ ██ ███████ ███████ -local wea = worldeditadditions + worldeditadditions_core.register_command("wcompass", { params = " []", description = "Creates a compass around pos1 with a single node bead pointing north (+Z).", privs = {worldedit=true}, require_pos = 1, parse = function(params_text) - local parts = wea.split(params_text," ",true) + local parts = wea_c.split(params_text," ",true) if not parts[1] then return false, "Error: too few arguments! Expected: \" []\"" elseif not parts[2] then @@ -29,7 +33,17 @@ worldeditadditions_core.register_command("wcompass", { return 26 end, func = function(name, node1, node2) - local _, count = wea.make_compass(worldedit.pos1[name], node1, node2) - return _, count .. " nodes set" + local start_time = wea_c.get_ms_time() + + local pos1 = Vector3.clone(worldedit.pos1[name]) + local success, count = wea.make_compass(pos1, node1, node2) + if not success then return success, count end + + local time_taken = wea_c.format.human_time(wea_c.get_ms_time() - start_time) + + + minetest.log("action", name.." used //wcompass at "..pos1..", taking "..time_taken) + return true, count .. " nodes set in "..time_taken + end, }) diff --git a/worldeditadditions_commands/commands/wireframe/wcorner.lua b/worldeditadditions_commands/commands/wireframe/wcorner.lua index 67440b6..c8b4699 100644 --- a/worldeditadditions_commands/commands/wireframe/wcorner.lua +++ b/worldeditadditions_commands/commands/wireframe/wcorner.lua @@ -1,9 +1,13 @@ +local wea_c = worldeditadditions +local wea = worldeditadditions +local Vector3 = wea_c.Vector3 + -- ██ ██ ██████ ██████ ██████ ███ ██ ███████ ██████ -- ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ -- ██ █ ██ ██ ██ ██ ██████ ██ ██ ██ █████ ██████ -- ██ ███ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ -- ███ ███ ██████ ██████ ██ ██ ██ ████ ███████ ██ ██ -local wea = worldeditadditions + worldeditadditions_core.register_command("wcorner", { params = "", description = "Set the corners of the current selection to ", @@ -24,7 +28,18 @@ worldeditadditions_core.register_command("wcorner", { return total end, func = function(name, node) - local _, count = wea.corner_set(worldedit.pos1[name], worldedit.pos2[name], node) - return _, count .. " nodes set" + + local start_time = wea_c.get_ms_time() + + local pos1, pos2 = Vector3.sort(worldedit.pos1[name], worldedit.pos2[name]) + local success, count = wea.corner_set(pos1, pos2, node) + if not success then return success, count end + + local time_taken = wea_c.format.human_time(wea_c.get_ms_time() - start_time) + + + + minetest.log("action", name.." used //wcorner at "..pos1.." - "..pos2..", taking "..time_taken) + return true, count .. " nodes set in "..time_taken end, })