worldedit → worldeditadditions

This commit is contained in:
Starbeamrainbowlabs 2020-05-10 23:29:49 +01:00
parent e4df5af008
commit 70f7e64371
No known key found for this signature in database
GPG Key ID: 1BE5172E637709C2
8 changed files with 11 additions and 10 deletions

@ -1,7 +1,7 @@
--- Overlap command. Places a specified node on top of --- Overlap command. Places a specified node on top of
-- @module worldeditadditions.overlay -- @module worldeditadditions.overlay
function worldedit.ellipsoid(position, radius, target_node, hollow) function worldeditadditions.ellipsoid(position, radius, target_node, hollow)
-- position = { x, y, z } -- position = { x, y, z }
local hollow_inner_radius = { local hollow_inner_radius = {
x = radius.x - 1, x = radius.x - 1,

@ -43,7 +43,7 @@ end
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
function worldedit.floodfill(start_pos, radius, replace_node) function worldeditadditions.floodfill(start_pos, radius, replace_node)
-- Calculate the area we want to modify -- Calculate the area we want to modify
local pos1 = vector.add(start_pos, { x = radius, y = 0, z = radius }) local pos1 = vector.add(start_pos, { x = radius, y = 0, z = radius })
local pos2 = vector.subtract(start_pos, { x = radius, y = radius, z = radius }) local pos2 = vector.subtract(start_pos, { x = radius, y = radius, z = radius })

@ -12,8 +12,8 @@ function worldeditadditions.overlay(pos1, pos2, target_node)
local node_id_air = minetest.get_content_id("air") local node_id_air = minetest.get_content_id("air")
local node_id_target = minetest.get_content_id(target_node) local node_id_target = minetest.get_content_id(target_node)
minetest.log("action", "pos1: " .. worldeditadditions.vector.tostring(pos1)) -- minetest.log("action", "pos1: " .. worldeditadditions.vector.tostring(pos1))
minetest.log("action", "pos2: " .. worldeditadditions.vector.tostring(pos2)) -- minetest.log("action", "pos2: " .. worldeditadditions.vector.tostring(pos2))
-- z y x is the preferred loop order, but that isn't really possible here -- z y x is the preferred loop order, but that isn't really possible here

@ -1,7 +1,7 @@
--- Overlap command. Places a specified node on top of --- Overlap command. Places a specified node on top of
-- @module worldeditadditions.overlay -- @module worldeditadditions.overlay
function worldedit.torus(position, major_radius, minor_radius, target_node, hollow) function worldeditadditions.torus(position, major_radius, minor_radius, target_node, hollow)
-- position = { x, y, z } -- position = { x, y, z }
local total_radius = major_radius + minor_radius local total_radius = major_radius + minor_radius
local inner_minor_radius = minor_radius - 2 local inner_minor_radius = minor_radius - 2

@ -44,7 +44,7 @@ worldedit.register_command("ellipsoid", {
end, end,
func = function(name, target_node, radius) func = function(name, target_node, radius)
local start_time = os.clock() local start_time = os.clock()
local replaced = worldedit.ellipsoid(worldedit.pos1[name], radius, target_node, false) local replaced = worldeditadditions.ellipsoid(worldedit.pos1[name], radius, target_node, false)
local time_taken = os.clock() - start_time local time_taken = os.clock() - start_time
minetest.log("action", name .. " used //ellipsoid at " .. worldeditadditions.vector.tostring(worldedit.pos1[name]) .. ", replacing " .. replaced .. " nodes in " .. time_taken .. "s") minetest.log("action", name .. " used //ellipsoid at " .. worldeditadditions.vector.tostring(worldedit.pos1[name]) .. ", replacing " .. replaced .. " nodes in " .. time_taken .. "s")
@ -67,7 +67,7 @@ worldedit.register_command("hollowellipsoid", {
end, end,
func = function(name, target_node, radius) func = function(name, target_node, radius)
local start_time = os.clock() local start_time = os.clock()
local replaced = worldedit.ellipsoid(worldedit.pos1[name], radius, target_node, true) local replaced = worldeditadditions.ellipsoid(worldedit.pos1[name], radius, target_node, true)
local time_taken = os.clock() - start_time local time_taken = os.clock() - start_time
minetest.log("action", name .. " used //hollowellipsoid at " .. worldeditadditions.vector.tostring(worldedit.pos1[name]) .. ", replacing " .. replaced .. " nodes in " .. time_taken .. "s") minetest.log("action", name .. " used //hollowellipsoid at " .. worldeditadditions.vector.tostring(worldedit.pos1[name]) .. ", replacing " .. replaced .. " nodes in " .. time_taken .. "s")

@ -36,7 +36,7 @@ worldedit.register_command("floodfill", {
end, end,
func = function(name, replace_node, radius) func = function(name, replace_node, radius)
local start_time = os.clock() local start_time = os.clock()
local nodes_replaced = worldedit.floodfill(worldedit.pos1[name], radius, replace_node) local nodes_replaced = worldeditadditions.floodfill(worldedit.pos1[name], radius, replace_node)
local time_taken = os.clock() - start_time local time_taken = os.clock() - start_time
if nodes_replaced == false then if nodes_replaced == false then

@ -42,7 +42,7 @@ worldedit.register_command("torus", {
end, end,
func = function(name, target_node, major_radius, minor_radius) func = function(name, target_node, major_radius, minor_radius)
local start_time = os.clock() local start_time = os.clock()
local replaced = worldedit.torus(worldedit.pos1[name], major_radius, minor_radius, target_node, false) local replaced = worldeditadditions.torus(worldedit.pos1[name], major_radius, minor_radius, target_node, false)
local time_taken = os.clock() - start_time local time_taken = os.clock() - start_time
minetest.log("action", name .. " used //torus at " .. worldeditadditions.vector.tostring(worldedit.pos1[name]) .. ", replacing " .. replaced .. " nodes in " .. time_taken .. "s") minetest.log("action", name .. " used //torus at " .. worldeditadditions.vector.tostring(worldedit.pos1[name]) .. ", replacing " .. replaced .. " nodes in " .. time_taken .. "s")
@ -65,7 +65,7 @@ worldedit.register_command("hollowtorus", {
end, end,
func = function(name, target_node, major_radius, minor_radius) func = function(name, target_node, major_radius, minor_radius)
local start_time = os.clock() local start_time = os.clock()
local replaced = worldedit.torus(worldedit.pos1[name], major_radius, minor_radius, target_node, true) local replaced = worldeditadditions.torus(worldedit.pos1[name], major_radius, minor_radius, target_node, true)
local time_taken = os.clock() - start_time local time_taken = os.clock() - start_time
minetest.log("action", name .. " used //hollowtorus at " .. worldeditadditions.vector.tostring(worldedit.pos1[name]) .. ", replacing " .. replaced .. " nodes in " .. time_taken .. "s") minetest.log("action", name .. " used //hollowtorus at " .. worldeditadditions.vector.tostring(worldedit.pos1[name]) .. ", replacing " .. replaced .. " nodes in " .. time_taken .. "s")

@ -1,3 +1,4 @@
worldeditadditions worldeditadditions
worldedit_commands worldedit_commands
worldedit worldedit
bonemeal?