diff --git a/worldeditadditions_commands/commands/extra/saplingaliases.lua b/worldeditadditions_commands/commands/extra/saplingaliases.lua index 1c48f57..5dad0d0 100644 --- a/worldeditadditions_commands/commands/extra/saplingaliases.lua +++ b/worldeditadditions_commands/commands/extra/saplingaliases.lua @@ -1,3 +1,5 @@ +local wea_c = worldeditadditions_core + -- ███████ █████ ██████ ██ ██ ███ ██ ██████ █████ ██ ██ █████ ███████ ███████ ███████ -- ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ -- ███████ ███████ ██████ ██ ██ ██ ██ ██ ██ ███ ███████ ██ ██ ███████ ███████ █████ ███████ @@ -17,15 +19,15 @@ minetest.register_chatcommand("/saplingaliases", { if params_text == "aliases" then table.insert(msg, "Currently registered aliases:\n") - local aliases = worldeditadditions.get_all_sapling_aliases() + local aliases = wea_c.get_all_sapling_aliases() local display = {} for node_name, alias in pairs(aliases) do table.insert(display, { node_name, alias }) end table.sort(display, function(a, b) return a[2] < b[2] end) - table.insert(msg, worldeditadditions.format.make_ascii_table(display)) + table.insert(msg, wea_c.format.make_ascii_table(display)) elseif params_text == "all_saplings" then - local results = worldeditadditions.registered_nodes_by_group("sapling") + local results = wea_c.registered_nodes_by_group("sapling") table.insert(msg, "Sapling-like nodes:\n") local str = table.concat(results, "\n") table.insert(msg, str) diff --git a/worldeditadditions_commands/commands/extra/sculptlist.lua b/worldeditadditions_commands/commands/extra/sculptlist.lua index 690aeb7..1d0dad8 100644 --- a/worldeditadditions_commands/commands/extra/sculptlist.lua +++ b/worldeditadditions_commands/commands/extra/sculptlist.lua @@ -1,4 +1,5 @@ local wea = worldeditadditions +local wea_c = worldeditadditions_core -- ███████ ██████ ██ ██ ██ ██████ ████████ ██ ██ ███████ ████████ -- ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ @@ -12,7 +13,7 @@ minetest.register_chatcommand("/sculptlist", { func = function(name, params_text) if name == nil then return end if not params_text then params_text = "" end - params_text = wea.trim(params_text) + params_text = wea_c.trim(params_text) local msg = {} @@ -49,7 +50,7 @@ minetest.register_chatcommand("/sculptlist", { -- Sort by brush name table.sort(display, function(a, b) return a[1] < b[1] end) - table.insert(msg, worldeditadditions.format.make_ascii_table(display)) + table.insert(msg, wea_c.format.make_ascii_table(display)) end worldedit.player_notify(name, table.concat(msg)) diff --git a/worldeditadditions_commands/commands/measure/init.lua b/worldeditadditions_commands/commands/measure/init.lua index 126e1ec..39d4f33 100644 --- a/worldeditadditions_commands/commands/measure/init.lua +++ b/worldeditadditions_commands/commands/measure/init.lua @@ -6,9 +6,9 @@ -- Chat commands that measure things. -local we_cm = worldeditadditions_commands.modpath .. "/commands/measure/" +local subpath = worldeditadditions_commands.modpath .. "/commands/measure/" -dofile(we_cm.."mface.lua") -dofile(we_cm.."midpos.lua") -dofile(we_cm.."msize.lua") -dofile(we_cm.."mtrig.lua") +dofile(subpath.."mface.lua") +dofile(subpath.."midpos.lua") +dofile(subpath.."msize.lua") +dofile(subpath.."mtrig.lua") diff --git a/worldeditadditions_commands/commands/measure/mface.lua b/worldeditadditions_commands/commands/measure/mface.lua index 983a402..6ccd84d 100644 --- a/worldeditadditions_commands/commands/measure/mface.lua +++ b/worldeditadditions_commands/commands/measure/mface.lua @@ -3,7 +3,7 @@ -- ██ ████ ██ █████ ███████ ██ █████ -- ██ ██ ██ ██ ██ ██ ██ ██ -- ██ ██ ██ ██ ██ ██████ ███████ -local wea = worldeditadditions + worldeditadditions_core.register_command("mface", { params = "", description = "Return player facing axis.", diff --git a/worldeditadditions_commands/commands/measure/midpos.lua b/worldeditadditions_commands/commands/measure/midpos.lua index 705f550..e035c68 100644 --- a/worldeditadditions_commands/commands/measure/midpos.lua +++ b/worldeditadditions_commands/commands/measure/midpos.lua @@ -1,9 +1,12 @@ +local wea_c = worldeditadditions_core +local Vector3 = wea_c.Vector3 + + -- ███ ███ ██ ██████ ██████ ██████ ███████ -- ████ ████ ██ ██ ██ ██ ██ ██ ██ ██ -- ██ ████ ██ ██ ██ ██ ██████ ██ ██ ███████ -- ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ -- ██ ██ ██ ██████ ██ ██████ ███████ -local wea = worldeditadditions worldeditadditions_core.register_command("midpos", { params = "", description = "Return the mid point of current selection.", @@ -14,8 +17,13 @@ worldeditadditions_core.register_command("midpos", { end, func = function(name, params_text) local str = "The centre of the current selection is at " - local vec = wea.vector.mean(worldedit.pos1[name],worldedit.pos2[name]) - return true, str .. wea.table.tostring(vec) + local pos1 = Vector3.new(worldedit.pos1[name]) + local pos2 = Vector3.new(worldedit.pos2[name]) + + + local vec = wea_c.vector.mean(pos1, pos2) + + return true, str .. wea_c.table.tostring(vec) end, }) diff --git a/worldeditadditions_commands/commands/measure/msize.lua b/worldeditadditions_commands/commands/measure/msize.lua index df651f5..7809cdf 100644 --- a/worldeditadditions_commands/commands/measure/msize.lua +++ b/worldeditadditions_commands/commands/measure/msize.lua @@ -1,9 +1,13 @@ +local wea_c = worldeditadditions_core +local Vector3 = wea_c.Vector3 + + -- ███ ███ ███████ ██ ███████ ███████ -- ████ ████ ██ ██ ███ ██ -- ██ ████ ██ ███████ ██ ███ █████ -- ██ ██ ██ ██ ██ ███ ██ -- ██ ██ ███████ ██ ███████ ███████ -local wea = worldeditadditions + worldeditadditions_core.register_command("msize", { params = "", description = "Return the length of each axis of current selection.", @@ -14,8 +18,11 @@ worldeditadditions_core.register_command("msize", { end, func = function(name, params_text) local str = "The dimensions of the current selection are " - local vec = vector.subtract(worldedit.pos2[name],worldedit.pos1[name]) - wea.vector.abs(vec) + + local pos1 = Vector3.new(worldedit.pos1[name]) + local pos2 = Vector3.new(worldedit.pos2[name]) + + local vec = (pos2 - pos1):abs() return true, str .. "x: " .. vec.x .. ", y: " .. vec.y .. ", z: " .. vec.z end, diff --git a/worldeditadditions_commands/commands/measure/mtrig.lua b/worldeditadditions_commands/commands/measure/mtrig.lua index a13a669..c2e561d 100644 --- a/worldeditadditions_commands/commands/measure/mtrig.lua +++ b/worldeditadditions_commands/commands/measure/mtrig.lua @@ -1,10 +1,13 @@ +local wea_c = worldeditadditions_core +local v3 = wea_c.Vector3 + + -- ███ ███ ████████ ██████ ██ ██████ -- ████ ████ ██ ██ ██ ██ ██ -- ██ ████ ██ ██ ██████ ██ ██ ███ -- ██ ██ ██ ██ ██ ██ ██ ██ ██ -- ██ ██ ██ ██ ██ ██ ██████ -local wea = worldeditadditions -local v3 = worldeditadditions.Vector3 + worldeditadditions_core.register_command("mtrig", { params = "", description = "Return the length of and angles of an imginary line between pos1 and pos2 in the selection.", @@ -15,11 +18,17 @@ worldeditadditions_core.register_command("mtrig", { end, func = function(name, params_text) local str = "The measurements of the line from pos1 to pos2 are Length (D): " - local vec = v3.subtract(worldedit.pos2[name],worldedit.pos1[name]):abs() + + local pos1 = v3.new(worldedit.pos2[name]) + local pos2 = v3.new(worldedit.pos1[name]) + + local vec = (pos2 - pos1):abs() local len = vec:length() - str = str..wea.round(len, 4)..", ∠XZ: ".. - wea.round(math.deg(math.atan(vec.z/vec.x)), 4).."°, ∠DY: ".. - wea.round(math.deg(math.asin(vec.y/len)), 4).."°" + + str = str..wea_c.round(len, 4)..", ∠XZ: ".. + wea_c.round(math.deg(math.atan(vec.z/vec.x)), 4).."°, ∠DY: ".. + wea_c.round(math.deg(math.asin(vec.y/len)), 4).."°" + return true, str end, })