mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-22 07:23:00 +00:00
fixup
This commit is contained in:
parent
5ec877f2b7
commit
9dc8165464
4 changed files with 13 additions and 12 deletions
|
@ -37,6 +37,7 @@ When actually implementing stuff, here are a few guidelines that I recommend to
|
||||||
-- ██ ██ ██ ██ ██ ██ ██ ██ ██
|
-- ██ ██ ██ ██ ██ ██ ██ ██ ██
|
||||||
-- ██ ████ ██ ██ ██ ██ ███████
|
-- ██ ████ ██ ██ ██ ██ ███████
|
||||||
local wea = worldeditadditions
|
local wea = worldeditadditions
|
||||||
|
local wea_c = worldeditadditions_core
|
||||||
worldeditadditions_core.register_command("{name}", {
|
worldeditadditions_core.register_command("{name}", {
|
||||||
params = "<argument> <argument=default> <option1|option2|...> [<optional_argument> <optional_argument2> ...] | [<optional_argument> [<optional_argument2>]]",
|
params = "<argument> <argument=default> <option1|option2|...> [<optional_argument> <optional_argument2> ...] | [<optional_argument> [<optional_argument2>]]",
|
||||||
description = "A **brief** description of what this command does",
|
description = "A **brief** description of what this command does",
|
||||||
|
@ -51,14 +52,14 @@ worldeditadditions_core.register_command("{name}", {
|
||||||
end,
|
end,
|
||||||
func = function(name, param1, param2)
|
func = function(name, param1, param2)
|
||||||
-- Start a timer
|
-- Start a timer
|
||||||
local start_time = wea.get_ms_time()
|
local start_time = wea_c.get_ms_time()
|
||||||
-- Do stuff
|
-- Do stuff
|
||||||
|
|
||||||
-- Finish timer
|
-- Finish timer
|
||||||
local time_taken = wea.get_ms_time() - start_time
|
local time_taken = wea_c.get_ms_time() - start_time
|
||||||
|
|
||||||
minetest.log("This is a logged message!")
|
minetest.log("This is a logged message!")
|
||||||
return true, "Completed command in " .. wea.format.human_time(time_taken)
|
return true, "Completed command in " .. wea_c.format.human_time(time_taken)
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
|
@ -74,9 +74,9 @@ function wea.convolve(pos1, pos2, kernel, kernel_size)
|
||||||
)
|
)
|
||||||
|
|
||||||
-- print("original")
|
-- print("original")
|
||||||
-- wea.format.array_2d(heightmap, (pos2.z - pos1.z) + 1)
|
-- wea_c.format.array_2d(heightmap, (pos2.z - pos1.z) + 1)
|
||||||
-- print("transformed")
|
-- print("transformed")
|
||||||
-- wea.format.array_2d(heightmap_conv, (pos2.z - pos1.z) + 1)
|
-- wea_c.format.array_2d(heightmap_conv, (pos2.z - pos1.z) + 1)
|
||||||
|
|
||||||
wea_c.terrain.apply_heightmap_changes(
|
wea_c.terrain.apply_heightmap_changes(
|
||||||
pos1, pos2, area, data,
|
pos1, pos2, area, data,
|
||||||
|
|
|
@ -42,14 +42,14 @@ function worldeditadditions.layers(pos1, pos2, node_weights, min_slope, max_slop
|
||||||
manip, area, data
|
manip, area, data
|
||||||
)
|
)
|
||||||
local slopemap = wea_c.terrain.calculate_slopes(heightmap, heightmap_size)
|
local slopemap = wea_c.terrain.calculate_slopes(heightmap, heightmap_size)
|
||||||
-- worldeditadditions.format.array_2d(heightmap, heightmap_size.x)
|
-- wea_c.format.array_2d(heightmap, heightmap_size.x)
|
||||||
-- print_slopes(slopemap, heightmap_size.x)
|
-- print_slopes(slopemap, heightmap_size.x)
|
||||||
--luacheck:ignore 311
|
--luacheck:ignore 311
|
||||||
heightmap = nil -- Just in case Lua wants to garbage collect it
|
heightmap = nil -- Just in case Lua wants to garbage collect it
|
||||||
|
|
||||||
|
|
||||||
-- minetest.log("action", "pos1: " .. wea.vector.tostring(pos1))
|
-- minetest.log("action", "pos1: " .. pos1)
|
||||||
-- minetest.log("action", "pos2: " .. wea.vector.tostring(pos2))
|
-- minetest.log("action", "pos2: " .. pos2)
|
||||||
-- for i,v in ipairs(node_ids) do
|
-- for i,v in ipairs(node_ids) do
|
||||||
-- print("[layer] i", i, "node id", v)
|
-- print("[layer] i", i, "node id", v)
|
||||||
-- end
|
-- end
|
||||||
|
|
|
@ -93,13 +93,13 @@ worldeditadditions_core.register_command("hollowtorus", {
|
||||||
require_pos = 1,
|
require_pos = 1,
|
||||||
parse = function(params_text)
|
parse = function(params_text)
|
||||||
local values = {parse_params_torus(params_text)}
|
local values = {parse_params_torus(params_text)}
|
||||||
return worldeditadditions.table.unpack(values)
|
return wea_c.table.unpack(values)
|
||||||
end,
|
end,
|
||||||
nodes_needed = function(name, target_node, major_radius, minor_radius)
|
nodes_needed = function(name, target_node, major_radius, minor_radius)
|
||||||
return math.ceil(2 * math.pi*math.pi * major_radius * minor_radius*minor_radius)
|
return math.ceil(2 * math.pi*math.pi * major_radius * minor_radius*minor_radius)
|
||||||
end,
|
end,
|
||||||
func = function(name, target_node, major_radius, minor_radius, axes)
|
func = function(name, target_node, major_radius, minor_radius, axes)
|
||||||
local start_time = worldeditadditions.get_ms_time()
|
local start_time = wea_c.get_ms_time()
|
||||||
local pos1 = Vector3.clone(worldedit.pos1[name])
|
local pos1 = Vector3.clone(worldedit.pos1[name])
|
||||||
local replaced = worldeditadditions.torus(
|
local replaced = worldeditadditions.torus(
|
||||||
pos1,
|
pos1,
|
||||||
|
@ -108,9 +108,9 @@ worldeditadditions_core.register_command("hollowtorus", {
|
||||||
axes,
|
axes,
|
||||||
true -- hollow
|
true -- hollow
|
||||||
)
|
)
|
||||||
local time_taken = worldeditadditions.get_ms_time() - start_time
|
local time_taken = wea_c.get_ms_time() - start_time
|
||||||
|
|
||||||
minetest.log("action", name .. " used //hollowtorus at "..pos1..", replacing " .. replaced .. " nodes in " .. time_taken .. "s")
|
minetest.log("action", name .. " used //hollowtorus at "..pos1..", replacing " .. replaced .. " nodes in " .. time_taken .. "s")
|
||||||
return true, replaced .. " nodes replaced in " .. worldeditadditions.format.human_time(time_taken)
|
return true, replaced .. " nodes replaced in " .. wea_c.format.human_time(time_taken)
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue