mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-12-28 00:07:30 +01:00
port everything else
phew!
This commit is contained in:
parent
41e3ebc7dd
commit
2af1226b49
@ -1,3 +1,4 @@
|
||||
local wea_c = worldeditadditions_core
|
||||
--[[
|
||||
This file contains sapling alias definitions for a number of different mods.
|
||||
If your mod is not listed here, please open a pull request to add it :-)
|
||||
@ -7,15 +8,16 @@ This mod's repository can be found here: https://github.com/sbrl/Minetest-WorldE
|
||||
Adding support for your mod is a 2 step process:
|
||||
|
||||
1. Update this file with your definitions
|
||||
2. Update depends.txt to add a soft dependency on your mod. Find that file here: https://github.com/sbrl/Minetest-WorldEditAdditions/blob/master/worldeditadditions/depends.txt - for example, add something line "my_awesome_mod?" (note the question mark at the end) on a new line(without quotes).
|
||||
2. Update depends.txt to add a soft dependency on your mod. Find that file here: https://github.com/sbrl/Minetest-WorldEditAdditions/blob/main/worldeditadditions/depends.txt - for example, add something line "my_awesome_mod?" (note the question mark at the end) on a new line(without quotes).
|
||||
|
||||
Alternatively, you can register support in your mod directly. Do that by adding a soft dependency on worldeditadditions, and then calling worldeditadditions.normalise_saplingname if worldeditadditions is loaded.
|
||||
Alternatively, you can register support in your mod directly. Do that by adding a soft dependency on worldeditadditions_core, and then calling worldeditadditions_core.normalise_saplingname if worldeditadditions is loaded.
|
||||
]]--
|
||||
|
||||
-- worldeditadditions.register_sapling_alias("")
|
||||
-- TODO: MOVE register_sapling_alias & register_sapling_alias_many back to worldeditadditions from worldeditadditions_core!!!!
|
||||
-- wea_c.register_sapling_alias("")
|
||||
|
||||
if minetest.get_modpath("default") then
|
||||
worldeditadditions.register_sapling_alias_many({
|
||||
wea_c.register_sapling_alias_many({
|
||||
{ "default:sapling", "apple" },
|
||||
{ "default:bush_sapling", "bush" },
|
||||
{ "default:pine_sapling", "pine" },
|
||||
@ -31,7 +33,7 @@ if minetest.get_modpath("default") then
|
||||
end
|
||||
|
||||
if minetest.get_modpath("moretrees") then
|
||||
worldeditadditions.register_sapling_alias_many({
|
||||
wea_c.register_sapling_alias_many({
|
||||
{ "moretrees:spruce_sapling_ongen", "spruce" },
|
||||
{ "moretrees:rubber_tree_sapling_ongen", "rubber" },
|
||||
{ "moretrees:beech_sapling_ongen", "beech" },
|
||||
@ -51,7 +53,7 @@ if minetest.get_modpath("moretrees") then
|
||||
end
|
||||
|
||||
if minetest.get_modpath("ethereal") then
|
||||
worldeditadditions.register_sapling_alias_many({
|
||||
wea_c.register_sapling_alias_many({
|
||||
{ "ethereal:mushroom_sapling", "mushroom" },
|
||||
{ "ethereal:sakura_sapling", "sakura" },
|
||||
{ "ethereal:birch_sapling", "birch" },
|
||||
@ -75,56 +77,56 @@ end
|
||||
-- ██████ ██████ ██████ ███████ ███████ ██ ██ ██ ███████ ███████ ███████
|
||||
|
||||
if minetest.get_modpath("lemontree") then
|
||||
worldeditadditions.register_sapling_alias("lemontree:sapling", "lemon")
|
||||
wea_c.register_sapling_alias("lemontree:sapling", "lemon")
|
||||
end
|
||||
if minetest.get_modpath("pineapple") then
|
||||
worldeditadditions.register_sapling_alias("pineapple:sapling", "pineapple")
|
||||
wea_c.register_sapling_alias("pineapple:sapling", "pineapple")
|
||||
end
|
||||
if minetest.get_modpath("baldcypress") then
|
||||
worldeditadditions.register_sapling_alias("baldcypress:sapling", "baldcypress")
|
||||
wea_c.register_sapling_alias("baldcypress:sapling", "baldcypress")
|
||||
end
|
||||
if minetest.get_modpath("bamboo") then
|
||||
worldeditadditions.register_sapling_alias("bamboo:sprout", "bamboo")
|
||||
wea_c.register_sapling_alias("bamboo:sprout", "bamboo")
|
||||
end
|
||||
if minetest.get_modpath("birch") then
|
||||
worldeditadditions.register_sapling_alias("birch:sapling", "birch")
|
||||
wea_c.register_sapling_alias("birch:sapling", "birch")
|
||||
end
|
||||
if minetest.get_modpath("cherrytree") then
|
||||
worldeditadditions.register_sapling_alias("cherrytree:sapling", "cherry")
|
||||
wea_c.register_sapling_alias("cherrytree:sapling", "cherry")
|
||||
end
|
||||
if minetest.get_modpath("clementinetree") then
|
||||
worldeditadditions.register_sapling_alias("clementinetree:sapling", "clementine")
|
||||
wea_c.register_sapling_alias("clementinetree:sapling", "clementine")
|
||||
end
|
||||
if minetest.get_modpath("ebony") then
|
||||
worldeditadditions.register_sapling_alias("ebony:sapling", "ebony")
|
||||
wea_c.register_sapling_alias("ebony:sapling", "ebony")
|
||||
end
|
||||
if minetest.get_modpath("jacaranda") then
|
||||
worldeditadditions.register_sapling_alias("jacaranda:sapling", "jacaranda")
|
||||
wea_c.register_sapling_alias("jacaranda:sapling", "jacaranda")
|
||||
end
|
||||
if minetest.get_modpath("larch") then
|
||||
worldeditadditions.register_sapling_alias("larch:sapling", "larch")
|
||||
wea_c.register_sapling_alias("larch:sapling", "larch")
|
||||
end
|
||||
if minetest.get_modpath("maple") then
|
||||
worldeditadditions.register_sapling_alias("maple:sapling", "maple")
|
||||
wea_c.register_sapling_alias("maple:sapling", "maple")
|
||||
end
|
||||
if minetest.get_modpath("palm") then
|
||||
worldeditadditions.register_sapling_alias("palm:sapling", "palm")
|
||||
wea_c.register_sapling_alias("palm:sapling", "palm")
|
||||
end
|
||||
if minetest.get_modpath("plumtree") then
|
||||
worldeditadditions.register_sapling_alias("plumtree:sapling", "plum")
|
||||
wea_c.register_sapling_alias("plumtree:sapling", "plum")
|
||||
end
|
||||
if minetest.get_modpath("hollytree") then
|
||||
worldeditadditions.register_sapling_alias("hollytree:sapling", "holly")
|
||||
wea_c.register_sapling_alias("hollytree:sapling", "holly")
|
||||
end
|
||||
if minetest.get_modpath("pomegranate") then
|
||||
worldeditadditions.register_sapling_alias("pomegranate:sapling", "pomegranate")
|
||||
wea_c.register_sapling_alias("pomegranate:sapling", "pomegranate")
|
||||
end
|
||||
if minetest.get_modpath("willow") then
|
||||
worldeditadditions.register_sapling_alias("willow:sapling", "willow")
|
||||
wea_c.register_sapling_alias("willow:sapling", "willow")
|
||||
end
|
||||
if minetest.get_modpath("mahogany") then
|
||||
worldeditadditions.register_sapling_alias("mahogany:sapling", "mahogany")
|
||||
wea_c.register_sapling_alias("mahogany:sapling", "mahogany")
|
||||
end
|
||||
if minetest.get_modpath("chestnuttree") then
|
||||
worldeditadditions.register_sapling_alias("chestnuttree:sapling", "chestnut")
|
||||
wea_c.register_sapling_alias("chestnuttree:sapling", "chestnut")
|
||||
end
|
||||
|
@ -1,5 +1,6 @@
|
||||
local wea = worldeditadditions
|
||||
local Vector3 = wea.Vector3
|
||||
local wea_c = worldeditadditions_core
|
||||
local Vector3 = wea_c.Vector3
|
||||
|
||||
wea.conv = {}
|
||||
|
||||
@ -62,8 +63,8 @@ function wea.convolve(pos1, pos2, kernel, kernel_size)
|
||||
|
||||
local node_id_air = minetest.get_content_id("air")
|
||||
|
||||
local heightmap, heightmap_size = wea.terrain.make_heightmap(pos1, pos2, manip, area, data)
|
||||
local heightmap_conv = wea.table.shallowcopy(heightmap)
|
||||
local heightmap, heightmap_size = wea_c.terrain.make_heightmap(pos1, pos2, manip, area, data)
|
||||
local heightmap_conv = wea_c.table.shallowcopy(heightmap)
|
||||
|
||||
wea.conv.convolve(
|
||||
heightmap_conv,
|
||||
@ -77,7 +78,7 @@ function wea.convolve(pos1, pos2, kernel, kernel_size)
|
||||
-- print("transformed")
|
||||
-- wea.format.array_2d(heightmap_conv, (pos2.z - pos1.z) + 1)
|
||||
|
||||
wea.terrain.apply_heightmap_changes(
|
||||
wea_c.terrain.apply_heightmap_changes(
|
||||
pos1, pos2, area, data,
|
||||
heightmap, heightmap_conv, heightmap_size
|
||||
)
|
||||
|
@ -1,5 +1,5 @@
|
||||
local wea = worldeditadditions
|
||||
local Vector3 = wea.Vector3
|
||||
local wea_c = worldeditadditions_core
|
||||
local Vector3 = wea_c.Vector3
|
||||
--[[
|
||||
Convolves over a given 2D heightmap with a given matrix.
|
||||
Note that this *mutates* the given heightmap.
|
||||
@ -17,7 +17,7 @@ function worldeditadditions.conv.convolve(heightmap, heightmap_size, matrix, mat
|
||||
-- We need to reference a *copy* of the heightmap when convolving
|
||||
-- This is because we need the original values when we perform a
|
||||
-- convolution on a given pixel
|
||||
local heightmap_copy = wea.table.shallowcopy(heightmap)
|
||||
local heightmap_copy = wea_c.table.shallowcopy(heightmap)
|
||||
|
||||
local border_size = Vector3.new(
|
||||
(matrix_size.x-1) / 2, -- x = height
|
||||
|
@ -1,3 +1,4 @@
|
||||
local wea_c = worldeditadditions_core
|
||||
-- Ported from Javascript by Starbeamrainbowlabs
|
||||
-- Original source: https://github.com/sidorares/gaussian-convolution-kernel/
|
||||
-- From
|
||||
@ -27,7 +28,7 @@ function worldeditadditions.conv.kernel_gaussian(dimension, sigma)
|
||||
local sum = 0
|
||||
for i = 0, dimension-1 do
|
||||
for j = 0, dimension-1 do
|
||||
local distance = worldeditadditions.hypotenuse(i, j, centre, centre)
|
||||
local distance = wea_c.hypotenuse(i, j, centre, centre)
|
||||
|
||||
-- The following is an algorithm that came from the gaussian blur
|
||||
-- wikipedia page [1].
|
||||
|
@ -1,4 +1,5 @@
|
||||
local wea = worldeditadditions
|
||||
local wea_c = worldeditadditions_core
|
||||
wea.erode = {}
|
||||
|
||||
dofile(wea.modpath.."/lib/erode/snowballs.lua")
|
||||
@ -18,12 +19,12 @@ function wea.erode.run(pos1, pos2, algorithm, params)
|
||||
|
||||
local region_height = (pos2.y - pos1.y) + 1
|
||||
|
||||
local heightmap = wea.terrain.make_heightmap(pos1, pos2, manip, area, data)
|
||||
local heightmap_eroded = wea.table.shallowcopy(heightmap)
|
||||
local heightmap = wea_c.terrain.make_heightmap(pos1, pos2, manip, area, data)
|
||||
local heightmap_eroded = wea_c.table.shallowcopy(heightmap)
|
||||
|
||||
-- print("[erode.run] algorithm: "..algorithm..", params:");
|
||||
-- print(wea.format.map(params))
|
||||
-- wea.format.array_2d(heightmap, heightmap_size.x)
|
||||
-- print(wea_c.format.map(params))
|
||||
-- wea_c.format.array_2d(heightmap, heightmap_size.x)
|
||||
local success, msg, stats
|
||||
if algorithm == "snowballs" then
|
||||
success, msg = wea.erode.snowballs(
|
||||
@ -49,7 +50,7 @@ function wea.erode.run(pos1, pos2, algorithm, params)
|
||||
return false, "Error: Unknown algorithm '"..algorithm.."'. Currently implemented algorithms: snowballs (2d; hydraulic-like), river (2d; cellular automata-like; fills potholes and lowers towers). Ideas for algorithms to implement are welcome!"
|
||||
end
|
||||
|
||||
success, stats = wea.terrain.apply_heightmap_changes(
|
||||
success, stats = wea_c.terrain.apply_heightmap_changes(
|
||||
pos1, pos2, area, data,
|
||||
heightmap, heightmap_eroded, heightmap_size
|
||||
)
|
||||
|
@ -1,12 +1,13 @@
|
||||
local wea = worldeditadditions
|
||||
local wea_c = worldeditadditions_core
|
||||
|
||||
--- Parses a comma-separated side numbers list out into a list of numbers.
|
||||
-- @param list string The command separated list to parse.
|
||||
-- @returns number[] A list of side numbers.
|
||||
local function parse_sides_list(list)
|
||||
list = list:gsub("%s", "") -- Spaces are not permitted
|
||||
return wea.table.unique(wea.table.map(
|
||||
wea.split(list, ","),
|
||||
return wea_c.table.unique(wea_c.table.map(
|
||||
wea_c.split(list, ","),
|
||||
function(value) return tonumber(value) end
|
||||
))
|
||||
end
|
||||
@ -20,7 +21,7 @@ function worldeditadditions.erode.river(heightmap_initial, heightmap, heightmap_
|
||||
dolower = true -- Whether to do lower operations or not
|
||||
}
|
||||
-- Apply the custom settings
|
||||
wea.table.apply(params_custom, params)
|
||||
wea_c.table.apply(params_custom, params)
|
||||
|
||||
params.lower_sides = parse_sides_list(params.lower_sides)
|
||||
params.raise_sides = parse_sides_list(params.raise_sides)
|
||||
@ -30,8 +31,8 @@ function worldeditadditions.erode.river(heightmap_initial, heightmap, heightmap_
|
||||
local removed = 0
|
||||
for i=1,params.steps do
|
||||
-- print("[DEBUG:river] step ", i)
|
||||
-- wea.format.array_2d(heightmap, heightmap_size.x)
|
||||
local time_start = wea.get_ms_time()
|
||||
-- wea_c.format.array_2d(heightmap, heightmap_size.x)
|
||||
local time_start = wea_c.get_ms_time()
|
||||
|
||||
-- Store up changes to make and make them at the end of the step
|
||||
-- This is important, because decisions
|
||||
@ -105,7 +106,7 @@ function worldeditadditions.erode.river(heightmap_initial, heightmap, heightmap_
|
||||
removed = removed + 1
|
||||
end
|
||||
-- print("[DEBUG:river] sides_higher", sides_higher, "sides_lower", sides_lower, "action", action)
|
||||
-- wea.format.array_2d(heightmap, heightmap_size.x)
|
||||
-- wea_c.format.array_2d(heightmap, heightmap_size.x)
|
||||
end
|
||||
end
|
||||
|
||||
@ -116,8 +117,8 @@ function worldeditadditions.erode.river(heightmap_initial, heightmap, heightmap_
|
||||
heightmap[hi] = heightmap[hi] - 1
|
||||
end
|
||||
|
||||
table.insert(timings, wea.get_ms_time() - time_start)
|
||||
table.insert(timings, wea_c.get_ms_time() - time_start)
|
||||
end
|
||||
|
||||
return true, params.steps.." steps made, raising "..filled.." and lowering "..removed.." columns in "..wea.format.human_time(wea.sum(timings)).." (~"..wea.format.human_time(wea.average(timings)).." per step)"
|
||||
return true, params.steps.." steps made, raising "..filled.." and lowering "..removed.." columns in "..wea_c.format.human_time(wea_c.sum(timings)).." (~"..wea_c.format.human_time(wea_c.average(timings)).." per step)"
|
||||
end
|
||||
|
@ -1,16 +1,19 @@
|
||||
local wea = worldeditadditions
|
||||
local Vector3 = wea.Vector3
|
||||
local wea_c = worldeditadditions_core
|
||||
local Vector3 = wea_c.Vector3
|
||||
|
||||
|
||||
-- Test command: //multi //fp set1 1313 6 5540 //fp set2 1338 17 5521 //erode snowballs
|
||||
|
||||
local function snowball(heightmap, normalmap, heightmap_size, startpos, params)
|
||||
local sediment = 0
|
||||
local pos = { x = startpos.x, z = startpos.z }
|
||||
local pos_prev = { x = pos.x, z = pos.z }
|
||||
local velocity = {
|
||||
x = (math.random() * 2 - 1) * params.init_velocity,
|
||||
z = (math.random() * 2 - 1) * params.init_velocity
|
||||
}
|
||||
local pos = Vector3.new(startpos.x, 0, startpos.z) -- X/Z
|
||||
local pos_prev = Vector3.new(pos.x, 0, pos.z) -- X/Z
|
||||
local velocity = Vector3.new(
|
||||
(math.random() * 2 - 1) * params.init_velocity,
|
||||
0,
|
||||
(math.random() * 2 - 1) * params.init_velocity
|
||||
) -- X/Z
|
||||
local heightmap_length = #heightmap
|
||||
|
||||
-- print("[snowball] startpos ("..pos.x..", "..pos.z.."), velocity: ("..velocity.x..", "..velocity.z..")")
|
||||
@ -29,7 +32,7 @@ local function snowball(heightmap, normalmap, heightmap_size, startpos, params)
|
||||
end
|
||||
|
||||
if #hist_velocity > 0 and i > 5
|
||||
and wea.average(hist_velocity) < 0.03 then
|
||||
and wea_c.average(hist_velocity) < 0.03 then
|
||||
-- print("[snowball] It looks like we've stopped")
|
||||
return true, i
|
||||
end
|
||||
@ -50,13 +53,13 @@ local function snowball(heightmap, normalmap, heightmap_size, startpos, params)
|
||||
end
|
||||
|
||||
velocity.x = params.friction * velocity.x + normalmap[hi].x * params.speed
|
||||
velocity.y = 0 -- Just in case
|
||||
velocity.z = params.friction * velocity.z + normalmap[hi].y * params.speed
|
||||
|
||||
-- print("[snowball] now at ("..x..", "..z..") velocity "..wea.vector.lengthsquared(velocity)..", sediment "..sediment)
|
||||
local new_vel_sq = wea.vector.lengthsquared(velocity)
|
||||
local new_vel_sq = velocity:length_squared()
|
||||
if new_vel_sq > 1 then
|
||||
-- print("[snowball] velocity squared over 1, normalising")
|
||||
velocity = wea.vector.normalize(velocity)
|
||||
velocity = velocity:normalise()
|
||||
end
|
||||
table.insert(hist_velocity, new_vel_sq)
|
||||
if #hist_velocity > params.velocity_hist_count then table.remove(hist_velocity, 1) end
|
||||
@ -89,12 +92,12 @@ function wea.erode.snowballs(heightmap_initial, heightmap, heightmap_size, regio
|
||||
count = 25000
|
||||
}
|
||||
-- Apply the custom settings
|
||||
wea.table.apply(params_custom, params)
|
||||
wea_c.table.apply(params_custom, params)
|
||||
|
||||
-- print("[erode/snowballs] params: ")
|
||||
-- print(wea.format.map(params))
|
||||
-- print(wea_c.format.map(params))
|
||||
|
||||
local normals = wea.terrain.calculate_normals(heightmap, heightmap_size)
|
||||
local normals = wea_c.terrain.calculate_normals(heightmap, heightmap_size)
|
||||
|
||||
local stats_steps = {}
|
||||
for i = 1, params.count do
|
||||
@ -142,5 +145,5 @@ function wea.erode.snowballs(heightmap_initial, heightmap, heightmap_size, regio
|
||||
)
|
||||
end
|
||||
|
||||
return true, ""..#stats_steps.." snowballs simulated, max "..params.max_steps.." steps (averaged ~"..wea.average(stats_steps).." steps)"
|
||||
return true, ""..#stats_steps.." snowballs simulated, max "..params.max_steps.." steps (averaged ~"..wea_c.average(stats_steps).." steps)"
|
||||
end
|
||||
|
@ -1,5 +1,7 @@
|
||||
local wea = worldeditadditions
|
||||
local Vector3 = wea.Vector3
|
||||
local wea_c = worldeditadditions_core
|
||||
local Vector3 = wea_c.Vector3
|
||||
|
||||
|
||||
|
||||
local metaballdata = {}
|
||||
|
||||
@ -9,7 +11,7 @@ local metaballdata = {}
|
||||
-- @param radius number The radius of the metaball.
|
||||
-- @returns bool,number The number of metaballs now defined for the given player.
|
||||
local function add(player_name, pos, radius)
|
||||
local pos = Vector3.clone(pos)
|
||||
pos = Vector3.clone(pos)
|
||||
|
||||
if type(player_name) ~= "string" then
|
||||
return false, "Error: Invalid player name specified."
|
||||
@ -63,7 +65,7 @@ local function list_pretty(player_name)
|
||||
})
|
||||
end
|
||||
|
||||
return true, wea.format.make_ascii_table(rows).."\n---------------------------\nTotal "..tostring(#metaball_list).." metaballs"
|
||||
return true, wea_c.format.make_ascii_table(rows).."\n---------------------------\nTotal "..tostring(#metaball_list).." metaballs"
|
||||
end
|
||||
|
||||
--- Removes the metaball with the specified index for a given player.
|
||||
|
@ -1,5 +1,6 @@
|
||||
local wea = worldeditadditions
|
||||
local Vector3 = wea.Vector3
|
||||
local wea_c = worldeditadditions_core
|
||||
local Vector3 = wea_c.Vector3
|
||||
|
||||
|
||||
-- ███ ███ ███████ ████████ █████ ██████ █████ ██ ██ ███████
|
||||
-- ████ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
|
||||
|
@ -1,9 +1,10 @@
|
||||
local wea = worldeditadditions
|
||||
local wea_c = worldeditadditions_core
|
||||
|
||||
|
||||
--- Applies the given noise field to the given heightmap.
|
||||
-- Mutates the given heightmap.
|
||||
-- @param heightmap number[] A table of ZERO indexed numbers representing the heghtmap - see worldeditadditions.terrain.make_heightmap().
|
||||
-- @param heightmap number[] A table of ZERO indexed numbers representing the heghtmap - see wea_c.terrain.make_heightmap().
|
||||
-- @param noise number[] An table identical in structure to the heightmap containing the noise values to apply.
|
||||
-- @param heightmap_size {x:number,z:number} A 2d vector representing the size of the heightmap.
|
||||
-- @param region_height number The height of the defined region.
|
||||
@ -18,7 +19,7 @@ function wea.noise.apply_2d(heightmap, noise, heightmap_size, pos1, pos2, apply_
|
||||
|
||||
|
||||
-- print("NOISE APPLY_2D\n")
|
||||
wea.format.array_2d(noise, heightmap_size.x)
|
||||
wea_c.format.array_2d(noise, heightmap_size.x)
|
||||
|
||||
|
||||
local height = tonumber(apply_mode)
|
||||
@ -29,15 +30,15 @@ function wea.noise.apply_2d(heightmap, noise, heightmap_size, pos1, pos2, apply_
|
||||
local i = (z * heightmap_size.x) + x
|
||||
|
||||
if apply_mode == "add" then
|
||||
heightmap[i] = wea.round(heightmap[i] + noise[i])
|
||||
heightmap[i] = wea_c.round(heightmap[i] + noise[i])
|
||||
elseif apply_mode == "multiply" then
|
||||
heightmap[i] = wea.round(heightmap[i] * noise[i])
|
||||
heightmap[i] = wea_c.round(heightmap[i] * noise[i])
|
||||
elseif height then
|
||||
-- Rescale from 0 - 1 to -1 - +1
|
||||
local rescaled = (noise[i] * 2) - 1
|
||||
-- Rescale to match the height specified
|
||||
rescaled = rescaled * height
|
||||
rescaled = math.floor(wea.clamp(
|
||||
rescaled = math.floor(wea_c.clamp(
|
||||
heightmap[i] + rescaled,
|
||||
0, region_height
|
||||
))
|
||||
@ -54,7 +55,7 @@ function wea.noise.apply_2d(heightmap, noise, heightmap_size, pos1, pos2, apply_
|
||||
-- end
|
||||
|
||||
-- print("HEIGHTMAP\n")
|
||||
-- worldeditadditions.format.array_2d(heightmap, heightmap_size.x)
|
||||
-- wea_c.format.array_2d(heightmap, heightmap_size.x)
|
||||
|
||||
|
||||
return true
|
||||
|
@ -1,4 +1,6 @@
|
||||
local wea = worldeditadditions
|
||||
local wea_c = worldeditadditions_core
|
||||
local Vector3 = wea_c.Vector3
|
||||
|
||||
local White = dofile(wea.modpath.."/lib/noise/engines/white.lua")
|
||||
|
||||
@ -25,7 +27,7 @@ function Infrared:noise( x, y, z )
|
||||
end
|
||||
end
|
||||
end
|
||||
return wea.average(values)
|
||||
return wea_c.average(values)
|
||||
end
|
||||
|
||||
return Infrared
|
||||
|
@ -1,4 +1,6 @@
|
||||
local wea = worldeditadditions
|
||||
local wea_c = worldeditadditions_core
|
||||
local Vector3 = wea_c.Vector3
|
||||
|
||||
--- Perlin noise generation engine.
|
||||
-- Original code by Ken Perlin: http://mrl.nyu.edu/~perlin/noise/
|
||||
@ -58,9 +60,9 @@ end
|
||||
function Perlin:noise( x, y, z )
|
||||
y = y or 0
|
||||
z = z or 0
|
||||
local xi = wea.bit.band(math.floor(x), 255)
|
||||
local yi = wea.bit.band(math.floor(y), 255)
|
||||
local zi = wea.bit.band(math.floor(z), 255)
|
||||
local xi = wea_c.bit.band(math.floor(x), 255)
|
||||
local yi = wea_c.bit.band(math.floor(y), 255)
|
||||
local zi = wea_c.bit.band(math.floor(z), 255)
|
||||
|
||||
-- print("x", x, "y", y, "z", z, "xi", xi, "yi", yi, "zi", zi)
|
||||
-- print("p[xi]", self.p[xi])
|
||||
@ -118,7 +120,7 @@ function Perlin:lerp(t, a, b)
|
||||
end
|
||||
|
||||
function Perlin:grad(hash, x, y, z)
|
||||
local h = wea.bit.band(hash, 15)
|
||||
local h = wea_c.bit.band(hash, 15)
|
||||
local u = h < 8 and x or y
|
||||
local v = h < 4 and y or ((h == 12 or h == 14) and x or z)
|
||||
return ((h and 1) == 0 and u or - u) + ((h and 2) == 0 and v or - v)
|
||||
|
@ -1,4 +1,5 @@
|
||||
local wea = worldeditadditions
|
||||
local wea_c = worldeditadditions_core
|
||||
local Vector3 = wea_c.Vector3
|
||||
|
||||
|
||||
local PerlinMT = {}
|
||||
@ -25,7 +26,7 @@ function PerlinMT.new(seed, params)
|
||||
end
|
||||
|
||||
function PerlinMT:noise( x, y, z )
|
||||
local value = self.engine:get_3d(wea.Vector3.new(x, y, z))
|
||||
local value = self.engine:get_3d(Vector3.new(x, y, z))
|
||||
return value
|
||||
end
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
local wea = worldeditadditions
|
||||
local wea_c = worldeditadditions_core
|
||||
|
||||
local White = dofile(wea.modpath.."/lib/noise/engines/white.lua")
|
||||
|
||||
@ -33,7 +34,7 @@ function Red:noise( x, y, z )
|
||||
self.white:noise(x + 1, y + 1, z),
|
||||
self.white:noise(x + 1, y + 1, z + 1),
|
||||
}
|
||||
return wea.average(values)
|
||||
return wea_c.average(values)
|
||||
end
|
||||
|
||||
return Red
|
||||
|
@ -1,5 +1,3 @@
|
||||
local wea = worldeditadditions
|
||||
|
||||
|
||||
local Sin = {}
|
||||
Sin.__index = Sin
|
||||
|
@ -1,4 +1,3 @@
|
||||
local wea = worldeditadditions
|
||||
|
||||
|
||||
local White = {}
|
||||
|
@ -1,10 +1,11 @@
|
||||
local wea = worldeditadditions
|
||||
local wea_c = worldeditadditions_core
|
||||
|
||||
-- ███ ███ █████ ██ ██ ███████ ██████ ██████
|
||||
-- ████ ████ ██ ██ ██ ██ ██ ██ ██ ██
|
||||
-- ██ ████ ██ ███████ █████ █████ █████ ██ ██
|
||||
-- ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
|
||||
-- ██ ██ ██ ██ ██ ██ ███████ ███████ ███████ ██████
|
||||
local wea = worldeditadditions
|
||||
|
||||
-- Generate a flat array of 2D noise.
|
||||
-- Written with help from https://www.redblobgames.com/maps/terrain-from-noise/
|
||||
@ -55,7 +56,7 @@ function worldeditadditions.noise.make_2d(size, start_pos, params)
|
||||
|
||||
|
||||
print("NOISE MAKE_2D\n")
|
||||
worldeditadditions.format.array_2d(result, size.x)
|
||||
wea_c.format.array_2d(result, size.x)
|
||||
|
||||
|
||||
-- We don't round here, because otherwise when we apply it it'll be inaccurate
|
||||
|
@ -1,4 +1,6 @@
|
||||
local wea = worldeditadditions
|
||||
local wea_c = worldeditadditions_core
|
||||
local Vector3 = wea_c.Vector3
|
||||
|
||||
--- Makes sure that the default settings are all present in the given params table.
|
||||
-- This way not all params have to be specified by the user.
|
||||
@ -15,9 +17,9 @@ function worldeditadditions.noise.params_apply_default(params)
|
||||
-- The backend noise algorithm to use
|
||||
algorithm = "perlinmt",
|
||||
-- Zooms in and out
|
||||
scale = wea.Vector3.new(1, 1, 1),
|
||||
scale = Vector3.new(1, 1, 1),
|
||||
-- Offset the generated noise by this vector.
|
||||
offset = wea.Vector3.new(0, 0, 0),
|
||||
offset = Vector3.new(0, 0, 0),
|
||||
-- Apply this exponent to the resulting noise value
|
||||
exponent = 1,
|
||||
-- Multiply the resulting noise value by this number. Changes the "strength" of the noise
|
||||
@ -34,7 +36,7 @@ function worldeditadditions.noise.params_apply_default(params)
|
||||
-- If params[1] is thing, this is a list of params
|
||||
-- This might be a thing if we're dealing with multiple octaves
|
||||
for i,params_el in ipairs(params) do
|
||||
local default_copy = wea.table.shallowcopy(params_default)
|
||||
local default_copy = wea_c.table.shallowcopy(params_default)
|
||||
|
||||
-- Keyword support
|
||||
for _i, keyword in ipairs(wea.noise.engines.available) do
|
||||
@ -44,7 +46,7 @@ function worldeditadditions.noise.params_apply_default(params)
|
||||
end
|
||||
|
||||
-- Apply this table to fill in the gaps
|
||||
wea.table.apply(
|
||||
wea_c.table.apply(
|
||||
params_el,
|
||||
default_copy
|
||||
)
|
||||
|
@ -1,7 +1,10 @@
|
||||
local wea = worldeditadditions
|
||||
local wea_c = worldeditadditions_core
|
||||
local Vector3 = wea_c.Vector3
|
||||
|
||||
--- Applies a layer of 2D noise over the terrain in the defined region.
|
||||
-- @module worldeditadditions.noise2d
|
||||
|
||||
local wea = worldeditadditions
|
||||
|
||||
-- ███ ██ ██████ ██ ███████ ███████ ██████ ██████
|
||||
-- ████ ██ ██ ██ ██ ██ ██ ██ ██ ██
|
||||
@ -13,24 +16,24 @@ local wea = worldeditadditions
|
||||
-- @param pos2 Vector pos2 of the defined region
|
||||
-- @param noise_params table A noise parameters table.
|
||||
function wea.noise.run2d(pos1, pos2, noise_params)
|
||||
pos1, pos2 = worldedit.sort_pos(pos1, pos2)
|
||||
pos1, pos2 = Vector3.sort(pos1, pos2)
|
||||
-- pos2 will always have the highest co-ordinates now
|
||||
|
||||
-- Fill in the default params
|
||||
-- print("DEBUG noise_params_custom ", wea.format.map(noise_params))
|
||||
-- print("DEBUG noise_params_custom ", wea_c.format.map(noise_params))
|
||||
noise_params = wea.noise.params_apply_default(noise_params)
|
||||
-- print("DEBUG noise_params[1] ", wea.format.map(noise_params[1]))
|
||||
-- print("DEBUG noise_params[1] ", wea_c.format.map(noise_params[1]))
|
||||
|
||||
-- Fetch the nodes in the specified area
|
||||
local manip, area = worldedit.manip_helpers.init(pos1, pos2)
|
||||
local data = manip:get_data()
|
||||
|
||||
local heightmap_old, heightmap_size = wea.terrain.make_heightmap(
|
||||
local heightmap_old, heightmap_size = wea_c.terrain.make_heightmap(
|
||||
pos1, pos2,
|
||||
manip, area,
|
||||
data
|
||||
)
|
||||
local heightmap_new = wea.table.shallowcopy(heightmap_old)
|
||||
local heightmap_new = wea_c.table.shallowcopy(heightmap_old)
|
||||
|
||||
local success, noisemap = wea.noise.make_2d(
|
||||
heightmap_size,
|
||||
@ -49,7 +52,7 @@ function wea.noise.run2d(pos1, pos2, noise_params)
|
||||
if not success then return success, message end
|
||||
|
||||
local stats
|
||||
success, stats = wea.terrain.apply_heightmap_changes(
|
||||
success, stats = wea_c.terrain.apply_heightmap_changes(
|
||||
pos1, pos2,
|
||||
area, data,
|
||||
heightmap_old, heightmap_new,
|
||||
|
@ -1,5 +1,6 @@
|
||||
local wea = worldeditadditions
|
||||
local Vector3 = wea.Vector3
|
||||
local wea_c = worldeditadditions_core
|
||||
local Vector3 = wea_c.Vector3
|
||||
|
||||
--- Applies the given brush with the given height and size to the given position.
|
||||
-- @param pos1 Vector3 The position at which to apply the brush.
|
||||
@ -36,12 +37,12 @@ local function apply(pos1, brush_name, height, brush_size)
|
||||
local manip, area = worldedit.manip_helpers.init(pos1_compute, pos2_compute)
|
||||
local data = manip:get_data()
|
||||
|
||||
local heightmap, heightmap_size = wea.terrain.make_heightmap(
|
||||
local heightmap, heightmap_size = wea_c.terrain.make_heightmap(
|
||||
pos1_compute, pos2_compute,
|
||||
manip, area,
|
||||
data
|
||||
)
|
||||
local heightmap_orig = wea.table.shallowcopy(heightmap)
|
||||
local heightmap_orig = wea_c.table.shallowcopy(heightmap)
|
||||
|
||||
local success2, added, removed = wea.sculpt.apply_heightmap(
|
||||
brush, brush_size_actual,
|
||||
@ -52,7 +53,7 @@ local function apply(pos1, brush_name, height, brush_size)
|
||||
if not success2 then return success2, added end
|
||||
|
||||
-- 3: Save back to disk & return
|
||||
local success3, stats = wea.terrain.apply_heightmap_changes(
|
||||
local success3, stats = wea_c.terrain.apply_heightmap_changes(
|
||||
pos1_compute, pos2_compute,
|
||||
area, data,
|
||||
heightmap_orig, heightmap,
|
||||
|
@ -1,5 +1,5 @@
|
||||
local wea = worldeditadditions
|
||||
local Vector3 = wea.Vector3
|
||||
local wea_c = worldeditadditions_core
|
||||
local Vector3 = wea_c.Vector3
|
||||
|
||||
--- Applies the given brush at the given x/z position to the given heightmap.
|
||||
-- Important: Where a Vector3 is mentioned in the parameter list, it reall MUST
|
||||
@ -26,6 +26,7 @@ local function apply_heightmap(brush, brush_size, height, position, heightmap, h
|
||||
|
||||
local added = 0
|
||||
local removed = 0
|
||||
-- TODO: Make the strength of the brush depend on the height of the nodes in the heightmap?
|
||||
|
||||
-- Iterate over the heightmap and apply the brush
|
||||
-- Note that we do not iterate over the brush, because we don't know if the
|
||||
|
@ -1,20 +1,22 @@
|
||||
local wea = worldeditadditions
|
||||
local Vector3 = wea.Vector3
|
||||
local wea_c = worldeditadditions
|
||||
local Vector3 = wea_c.Vector3
|
||||
|
||||
--- Returns a smooth gaussian brush.
|
||||
-- @param size Vector3 The target size of the brush. Note that the actual size of the brush will be different, as the gaussian function has some limitations.
|
||||
-- @param sigma=2 number The 'smoothness' of the brush. Higher values are more smooth.
|
||||
return function(size, sigma)
|
||||
local size = math.min(size.x, size.y)
|
||||
if size % 2 == 0 then size = size - 1 end
|
||||
size = math.min(size.x, size.y)
|
||||
if size % 2 == 0 then size = size - 1 end -- Gaussian runs on odd numbers
|
||||
if size < 1 then
|
||||
return false, "Error: Invalid brush size."
|
||||
return false, "Error: Invalid brush size (brushes must be at least 1 node in size)."
|
||||
end
|
||||
|
||||
local success, gaussian = wea.conv.kernel_gaussian(size, sigma)
|
||||
|
||||
-- Normalise values to fill the range 0 - 1
|
||||
-- By default, wea.conv.kernel_gaussian values add up to 1 in total
|
||||
local max = wea.max(gaussian)
|
||||
local max = wea_c.max(gaussian)
|
||||
for i=0,size*size-1 do
|
||||
gaussian[i] = gaussian[i] / max
|
||||
end
|
||||
|
@ -1,7 +1,9 @@
|
||||
local wea = worldeditadditions
|
||||
local Vector3 = wea.Vector3
|
||||
|
||||
local wea_c = worldeditadditions_core
|
||||
local Vector3 = wea_c.Vector3
|
||||
|
||||
--- Makes a circle brush of a given size.
|
||||
-- @param size Vector3 The desired sizez of the brush (only X and Y are considered; Z is ignored).
|
||||
-- @returns bool,brush,Vector3 Success bool, then the brush, then finally the actual size of the brush generated.
|
||||
return function(size)
|
||||
local brush = {}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
local wea = worldeditadditions
|
||||
local Vector3 = wea.Vector3
|
||||
local wea_c = worldeditadditions_core
|
||||
local Vector3 = wea_c.Vector3
|
||||
|
||||
|
||||
return function(size)
|
||||
@ -30,14 +31,14 @@ return function(size)
|
||||
local success, kernel = wea.conv.kernel_gaussian(kernel_size, 2)
|
||||
if not success then return success, kernel end
|
||||
|
||||
local success2, msg = worldeditadditions.conv.convolve(
|
||||
local success2, msg = wea.conv.convolve(
|
||||
brush, Vector3.new(size.x, 0, size.y),
|
||||
kernel, Vector3.new(kernel_size, 0, kernel_size)
|
||||
)
|
||||
if not success2 then return success2, msg end
|
||||
|
||||
-- Rescale to be between 0 and 1
|
||||
local max_value = wea.max(brush)
|
||||
local max_value = wea_c.max(brush)
|
||||
for i,value in pairs(brush) do
|
||||
brush[i] = brush[i] / max_value
|
||||
end
|
||||
|
@ -1,5 +1,4 @@
|
||||
local wea = worldeditadditions
|
||||
local Vector3 = wea.Vector3
|
||||
|
||||
local parse_static = dofile(wea.modpath.."/lib/sculpt/parse_static.lua")
|
||||
|
||||
@ -8,8 +7,9 @@ local parse_static = dofile(wea.modpath.."/lib/sculpt/parse_static.lua")
|
||||
-- @returns true,table,Vector3|false,string A success boolean, followed either by an error message as a string or the brush (as a table) and it's size (as an X/Y Vector3)
|
||||
return function(filepath)
|
||||
local handle = io.open(filepath)
|
||||
|
||||
if not handle then
|
||||
handle:close()
|
||||
if handle ~= nil then handle:close() end
|
||||
return false, "Error: Failed to open the static brush file at '"..filepath.."'."
|
||||
end
|
||||
|
||||
|
@ -12,7 +12,6 @@ local sculpt = {
|
||||
make_brush = dofile(wea.modpath.."/lib/sculpt/make_brush.lua"),
|
||||
make_preview = dofile(wea.modpath.."/lib/sculpt/make_preview.lua"),
|
||||
preview_brush = dofile(wea.modpath.."/lib/sculpt/preview_brush.lua"),
|
||||
read_brush_static = dofile(wea.modpath.."/lib/sculpt/read_brush_static.lua"),
|
||||
apply_heightmap = dofile(wea.modpath.."/lib/sculpt/apply_heightmap.lua"),
|
||||
apply = dofile(wea.modpath.."/lib/sculpt/apply.lua"),
|
||||
scan_static = dofile(wea.modpath.."/lib/sculpt/scan_static.lua"),
|
||||
|
@ -1,5 +1,4 @@
|
||||
local wea = worldeditadditions
|
||||
local Vector3 = wea.Vector3
|
||||
|
||||
local make_brush = dofile(wea.modpath.."/lib/sculpt/make_brush.lua")
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
local wea = worldeditadditions
|
||||
local Vector3 = wea.Vector3
|
||||
local wea_c = worldeditadditions_core
|
||||
local Vector3 = wea_c.Vector3
|
||||
|
||||
--- Parses a static brush definition.
|
||||
-- @param source string The source string that contains the static brush, formatted as TSV.
|
||||
@ -11,12 +12,12 @@ return function(source)
|
||||
|
||||
-- Parse out the TSV into a table of tables, while also parsing values as numbers
|
||||
-- Also keeps track of the maximum/minimum values found for rescaling later.
|
||||
local values = wea.table.map(
|
||||
wea.split(source, "\n", false),
|
||||
local values = wea_c.table.map(
|
||||
wea_c.split(source, "\n", false),
|
||||
function(line)
|
||||
local row = wea.split(line, "%s+", false)
|
||||
local row = wea_c.split(line, "%s+", false)
|
||||
width = math.max(width, #row)
|
||||
return wea.table.map(
|
||||
return wea_c.table.map(
|
||||
row,
|
||||
function(pixel)
|
||||
local value = tonumber(pixel)
|
||||
|
@ -1,5 +1,6 @@
|
||||
local wea = worldeditadditions
|
||||
local Vector3 = wea.Vector3
|
||||
local wea_c = worldeditadditions_core
|
||||
local Vector3 = wea_c.Vector3
|
||||
|
||||
local make_brush = dofile(wea.modpath.."/lib/sculpt/make_brush.lua")
|
||||
local make_preview = dofile(wea.modpath.."/lib/sculpt/make_preview.lua")
|
||||
|
@ -1,11 +0,0 @@
|
||||
|
||||
return function(filepath)
|
||||
local brush_size = { x = 0, y = 0 }
|
||||
local brush = { }
|
||||
|
||||
-- TODO: Import brush here
|
||||
|
||||
return false, "Error: Not implemented yet"
|
||||
|
||||
-- return true, brush, brush_size
|
||||
end
|
@ -1,5 +1,6 @@
|
||||
local wea = worldeditadditions
|
||||
local Vector3 = wea.Vector3
|
||||
local wea_c = worldeditadditions_core
|
||||
local Vector3 = wea_c.Vector3
|
||||
|
||||
local import_static = dofile(wea.modpath.."/lib/sculpt/import_static.lua")
|
||||
|
||||
@ -25,14 +26,14 @@ end
|
||||
-- @returns bool,loaded,errors A success boolean, followed by the number of brushes loaded, followed by the number of errors encountered while loading brushes (errors are logged as warnings with Minetest)
|
||||
return function(dirpath, overwrite_existing)
|
||||
if overwrite_existing == nil then overwrite_existing = false end
|
||||
local files = wea.io.scandir_files(dirpath)
|
||||
local files = wea_c.io.scandir_files(dirpath)
|
||||
|
||||
local brushes_loaded = 0
|
||||
local errors = 0
|
||||
|
||||
|
||||
for i, filename in pairs(files) do
|
||||
if wea.str_ends(filename, ".brush.tsv") then
|
||||
if wea_c.str_ends(filename, ".brush.tsv") then
|
||||
local filepath = dirpath.."/"..filename
|
||||
local name = filename:gsub(".brush.tsv", "")
|
||||
|
||||
|
@ -1,3 +1,6 @@
|
||||
local wea_c = worldeditadditions_core
|
||||
local Vector3 = wea_c.Vector3
|
||||
|
||||
-- ██████ ██████ ██████ ███ ██ ███████ ██████ ███████ ███████ ████████
|
||||
-- ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██
|
||||
-- ██ ██ ██ ██████ ██ ██ ██ █████ ██████ ███████ █████ ██
|
||||
@ -5,21 +8,21 @@
|
||||
-- ██████ ██████ ██ ██ ██ ████ ███████ ██ ██ ███████ ███████ ██
|
||||
|
||||
--- Puts a node at each corner of selection box.
|
||||
-- @param {Position} pos1 The 1st position defining the WorldEdit selection
|
||||
-- @param {Position} pos2 The 2nd positioon defining the WorldEdit selection
|
||||
-- @param {string} node Name of the node to place
|
||||
function worldeditadditions.corner_set(pos1,pos2,node)
|
||||
|
||||
-- z y x is the preferred loop order (because CPU cache I'd guess, since then we're iterating linearly through the data array)
|
||||
local counts = { replaced = 0 }
|
||||
for i,z in pairs({pos1.z,pos2.z}) do
|
||||
for j,y in pairs({pos1.y,pos2.y}) do
|
||||
for k,x in pairs({pos1.x,pos2.x}) do
|
||||
minetest.set_node(vector.new(x,y,z), {name=node})
|
||||
counts.replaced = counts.replaced + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return true, counts.replaced
|
||||
-- @param pos1 Vector3 The 1st position defining the WorldEdit selection
|
||||
-- @param pos2 Vector3 The 2nd positioon defining the WorldEdit selection
|
||||
-- @param node string Name of the node to place
|
||||
function worldeditadditions.corner_set(pos1, pos2, node)
|
||||
|
||||
-- z y x is the preferred loop order (because CPU cache I'd guess, since then we're iterating linearly through the data array)
|
||||
local counts = {replaced = 0}
|
||||
for i, z in pairs({pos1.z, pos2.z}) do
|
||||
for j, y in pairs({pos1.y, pos2.y}) do
|
||||
for k, x in pairs({pos1.x, pos2.x}) do
|
||||
minetest.set_node(Vector3.new(x, y, z), {name = node})
|
||||
counts.replaced = counts.replaced + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return true, counts.replaced
|
||||
end
|
||||
|
@ -1,3 +1,6 @@
|
||||
local wea_c = worldeditadditions_core
|
||||
local Vector3 = wea_c.Vector3
|
||||
|
||||
-- ███ ███ █████ ██ ██ ███████ ██████ ██████ ███ ███ ██████ █████ ███████ ███████
|
||||
-- ████ ████ ██ ██ ██ ██ ██ ██ ██ ██ ████ ████ ██ ██ ██ ██ ██ ██
|
||||
-- ██ ████ ██ ███████ █████ █████ ██ ██ ██ ██ ████ ██ ██████ ███████ ███████ ███████
|
||||
@ -9,20 +12,20 @@
|
||||
-- @param {string} node1 Name of the node to place
|
||||
-- @param {string} node2 Name of the node of the bead
|
||||
function worldeditadditions.make_compass(pos1,node1,node2)
|
||||
|
||||
minetest.set_node(vector.add(pos1,vector.new(0,1,3)), {name=node2})
|
||||
pos1 = Vector3.clone(pos1)
|
||||
minetest.set_node(pos1 + Vector3.new(0,1,3), { name = node2 })
|
||||
local counts = { replaced = 1 }
|
||||
|
||||
-- z y x is the preferred loop order (because CPU cache I'd guess, since then we're iterating linearly through the data array)
|
||||
for z = -3,3 do
|
||||
if z ~= 0 then
|
||||
for k,x in pairs({math.floor(-3/math.abs(z)),0,math.ceil(3/math.abs(z))}) do
|
||||
minetest.set_node(vector.new(pos1.x+x,pos1.y,pos1.z+z), {name=node1})
|
||||
minetest.set_node(Vector3.new(pos1.x+x,pos1.y,pos1.z+z), {name=node1})
|
||||
counts.replaced = counts.replaced + 1
|
||||
end
|
||||
else
|
||||
for x = -3,3 do
|
||||
minetest.set_node(vector.new(pos1.x+x,pos1.y,pos1.z), {name=node1})
|
||||
minetest.set_node(Vector3.new(pos1.x+x,pos1.y,pos1.z), {name=node1})
|
||||
counts.replaced = counts.replaced + 1
|
||||
end
|
||||
end
|
||||
|
@ -1,3 +1,5 @@
|
||||
local v3 = worldeditadditions_core.Vector3
|
||||
|
||||
-- ██ ██ ██ ██████ ███████ ██████ ██████ ██ ██
|
||||
-- ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
|
||||
-- ██ █ ██ ██ ██████ █████ ██████ ██ ██ ███
|
||||
@ -8,7 +10,6 @@
|
||||
-- @param {Position} pos1 The 1st position defining the WorldEdit selection
|
||||
-- @param {Position} pos2 The 2nd positioon defining the WorldEdit selection
|
||||
-- @param {string} node Name of the node to place
|
||||
local v3 = worldeditadditions.Vector3
|
||||
function worldeditadditions.wire_box(pos1,pos2,node)
|
||||
local node_id_replace = minetest.get_content_id(node)
|
||||
local ps1, ps2 = v3.sort(pos1,pos2)
|
||||
|
@ -56,7 +56,7 @@ worldeditadditions_core.register_command("convolve", {
|
||||
func = function(name, kernel_name, kernel_width, kernel_height, sigma)
|
||||
local start_time = wea_c.get_ms_time()
|
||||
|
||||
local success, kernel = wea_c.get_conv_kernel(
|
||||
local success, kernel = wea.get_conv_kernel(
|
||||
kernel_name,
|
||||
kernel_width, kernel_height,
|
||||
sigma
|
||||
|
Loading…
Reference in New Issue
Block a user