mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-21 23:13: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_c = worldeditadditions_core
|
||||
worldeditadditions_core.register_command("{name}", {
|
||||
params = "<argument> <argument=default> <option1|option2|...> [<optional_argument> <optional_argument2> ...] | [<optional_argument> [<optional_argument2>]]",
|
||||
description = "A **brief** description of what this command does",
|
||||
|
@ -51,14 +52,14 @@ worldeditadditions_core.register_command("{name}", {
|
|||
end,
|
||||
func = function(name, param1, param2)
|
||||
-- Start a timer
|
||||
local start_time = wea.get_ms_time()
|
||||
local start_time = wea_c.get_ms_time()
|
||||
-- Do stuff
|
||||
|
||||
-- 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!")
|
||||
return true, "Completed command in " .. wea.format.human_time(time_taken)
|
||||
return true, "Completed command in " .. wea_c.format.human_time(time_taken)
|
||||
end
|
||||
})
|
||||
```
|
||||
|
|
|
@ -74,9 +74,9 @@ function wea.convolve(pos1, pos2, kernel, kernel_size)
|
|||
)
|
||||
|
||||
-- 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")
|
||||
-- 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(
|
||||
pos1, pos2, area, data,
|
||||
|
|
|
@ -42,14 +42,14 @@ function worldeditadditions.layers(pos1, pos2, node_weights, min_slope, max_slop
|
|||
manip, area, data
|
||||
)
|
||||
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)
|
||||
--luacheck:ignore 311
|
||||
heightmap = nil -- Just in case Lua wants to garbage collect it
|
||||
|
||||
|
||||
-- minetest.log("action", "pos1: " .. wea.vector.tostring(pos1))
|
||||
-- minetest.log("action", "pos2: " .. wea.vector.tostring(pos2))
|
||||
-- minetest.log("action", "pos1: " .. pos1)
|
||||
-- minetest.log("action", "pos2: " .. pos2)
|
||||
-- for i,v in ipairs(node_ids) do
|
||||
-- print("[layer] i", i, "node id", v)
|
||||
-- end
|
||||
|
|
|
@ -93,13 +93,13 @@ worldeditadditions_core.register_command("hollowtorus", {
|
|||
require_pos = 1,
|
||||
parse = function(params_text)
|
||||
local values = {parse_params_torus(params_text)}
|
||||
return worldeditadditions.table.unpack(values)
|
||||
return wea_c.table.unpack(values)
|
||||
end,
|
||||
nodes_needed = function(name, target_node, major_radius, minor_radius)
|
||||
return math.ceil(2 * math.pi*math.pi * major_radius * minor_radius*minor_radius)
|
||||
end,
|
||||
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 replaced = worldeditadditions.torus(
|
||||
pos1,
|
||||
|
@ -108,9 +108,9 @@ worldeditadditions_core.register_command("hollowtorus", {
|
|||
axes,
|
||||
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")
|
||||
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
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue