worldeditadditions: add core @module defs, correct comment formatting errors

This commit is contained in:
Starbeamrainbowlabs 2024-01-02 16:59:51 +00:00
parent 15a52deea1
commit d0e59b4cd7
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
37 changed files with 148 additions and 27 deletions

View file

@ -1,6 +1,9 @@
local wea_c = worldeditadditions_core
local Vector3 = wea_c.Vector3
---
-- @module worldeditadditions
-- █████ ██ ██████
-- ██ ██ ██ ██ ██
-- ███████ ██ ██████
@ -16,9 +19,9 @@ local Vector3 = wea_c.Vector3
--- Like ellipsoidapply, but only keeps changes that replace airlike nodes, and discards any other changes made.
-- Takes a backup copy of the defined region, runs the given function, and then
-- restores the bits around the edge that aren't inside the largest ellipsoid that will fit inside the defined region.
-- @param {Position} pos1 The 1st position defining the region boundary
-- @param {Position} pos2 The 2nd positioon defining the region boundary
-- @param {Function} func The function to call that performs the action in question. It is expected that the given function will accept no arguments.
-- @param pos1 Position The 1st position defining the region boundary
-- @param pos2 Position The 2nd positioon defining the region boundary
-- @param func function The function to call that performs the action in question. It is expected that the given function will accept no arguments.
function worldeditadditions.airapply(pos1, pos2, func)
local time_taken_all = wea_c.get_ms_time()
pos1, pos2 = Vector3.sort(pos1, pos2)

View file

@ -1,10 +1,13 @@
local wea_c = worldeditadditions_core
local Vector3 = wea_c.Vector3
---
-- @module worldeditadditions
--- Bonemeal command.
-- Applies bonemeal to all nodes with an air bloc above then.
-- @param strength The strength to apply - see bonemeal:on_use
-- @param chance Positive integer that represents the chance bonemealing will occur
-- @param strength number The strength to apply - see bonemeal:on_use
-- @param chance number Positive integer that represents the chance bonemealing will occur
-- @returns bool,number,number 1. Whether the command succeeded or not.
-- 2. The number of nodes actually bonemealed
-- 3. The number of possible candidates we could have bonemealed

View file

@ -1,6 +1,9 @@
local wea_c = worldeditadditions_core
local Vector3 = wea_c.Vector3
---
-- @module worldeditadditions
-- ██████ ██████ ██████ ██ ██
-- ██ ██ ██ ██ ██ ██ ██

View file

@ -1,6 +1,9 @@
local wea_c = worldeditadditions_core
local Vector3 = wea_c.Vector3
---
-- @module worldeditadditions
-- ██████ ██████ ██ ██ ███ ██ ████████
-- ██ ██ ██ ██ ██ ████ ██ ██
-- ██ ██ ██ ██ ██ ██ ██ ██ ██

View file

@ -1,6 +1,9 @@
local wea_c = worldeditadditions_core
local Vector3 = wea_c.Vector3
---
-- @module worldeditadditions
-- ██████ ██████ ███ ███ ███████
-- ██ ██ ██ ██ ████ ████ ██
-- ██ ██ ██ ██ ██ ████ ██ █████

View file

@ -1,6 +1,9 @@
local wea_c = worldeditadditions_core
local Vector3 = wea_c.Vector3
---
-- @module worldeditadditions
-- ███████ ██ ██ ██ ██████ ███████ ███████
-- ██ ██ ██ ██ ██ ██ ██ ██
-- █████ ██ ██ ██ ██████ ███████ █████

View file

@ -1,6 +1,9 @@
local wea_c = worldeditadditions_core
local Vector3 = wea_c.Vector3
---
-- @module worldeditadditions
-- ███████ ██ ██ ██ ██████ ███████ ███████
-- ██ ██ ██ ██ ██ ██ ██ ██
-- █████ ██ ██ ██ ██████ ███████ █████

View file

@ -1,6 +1,9 @@
local wea_c = worldeditadditions_core
local Vector3 = wea_c.Vector3
---
-- @module worldeditadditions
-- ███████ ██ ██ ██ ██████ ███████ ██████ ██ ██████
-- ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
-- █████ ██ ██ ██ ██████ ███████ ██ ██ ██ ██ ██
@ -16,9 +19,9 @@ local Vector3 = wea_c.Vector3
--- Similar to cubeapply, except that it takes 2 positions and only keeps an ellipsoid-shaped area defined by the boundaries of the defined region.
-- Takes a backup copy of the defined region, runs the given function, and then
-- restores the bits around the edge that aren't inside the largest ellipsoid that will fit inside the defined region.
-- @param {Position} pos1 The 1st position defining the region boundary
-- @param {Position} pos2 The 2nd positioon defining the region boundary
-- @param {Function} func The function to call that performs the action in question. It is expected that the given function will accept no arguments.
-- @param pos1 Vector3 The 1st position defining the region boundary
-- @param pos2 Vector3 The 2nd positioon defining the region boundary
-- @param func function The function to call that performs the action in question. It is expected that the given function will accept no arguments.
function worldeditadditions.ellipsoidapply(pos1, pos2, func)
local time_taken_all = wea_c.get_ms_time()
pos1, pos2 = Vector3.sort(pos1, pos2)

View file

@ -1,6 +1,9 @@
local wea_c = worldeditadditions_core
local Vector3 = wea_c.Vector3
---
-- @module worldeditadditions
--- Fill caves command. Fills underneath non-air nodes in the defined region.
-- @param pos1 Vector3 pos1 of the defined region to fill caves in.
-- @param pos2 Vector3 pos2 of the defined region to fill caves in.

View file

@ -1,6 +1,9 @@
local wea_c = worldeditadditions_core
local Vector3 = wea_c.Vector3
---
-- @module worldeditadditions
--- Flood-fill command for complex lakes etc.
-- @param start_pos Vector3 The position to start floodfilling from.

View file

@ -1,6 +1,9 @@
local wea_c = worldeditadditions_core
local Vector3 = wea_c.Vector3
---
-- @module worldeditadditions
--- Places saplings and bonemeals them automatically to create a forest.
-- Note that the defined region is *the region that saplings are placed in*, so nodes may ultimately end up being replaced outside the defined region depending on the size of the tree that grows.
-- @param pos1 Vector3 pos1 of the defined region to place saplings in.

View file

@ -1,6 +1,9 @@
local wea_c = worldeditadditions_core
local Vector3 = wea_c.Vector3
---
-- @module worldeditadditions
-- ██ ██ ██████ ██ ██ ██████ ██ ██
-- ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
-- ███████ ██ ██ ██ ██ ██ ██ ██ █ ██

View file

@ -1,6 +1,9 @@
local wea_c = worldeditadditions_core
local Vector3 = wea_c.Vector3
---
-- @module worldeditadditions
-- ██ █████ ██ ██ ███████ ██████ ███████
-- ██ ██ ██ ██ ██ ██ ██ ██ ██
-- ██ ███████ ████ █████ ██████ ███████

View file

@ -1,6 +1,9 @@
local wea_c = worldeditadditions_core
local Vector3 = wea_c.Vector3
---
-- @module worldeditadditions
-- ██ ██ ███ ██ ███████
-- ██ ██ ████ ██ ██

View file

@ -1,6 +1,9 @@
local wea_c = worldeditadditions_core
local Vector3 = wea_c.Vector3
---
-- @module worldeditadditions
----------------------------------
-- function to print out the world

View file

@ -1,6 +1,9 @@
local wea_c = worldeditadditions_core
local Vector3 = wea_c.Vector3
---
-- @module worldeditadditions
----------------------------------
-- function to print out the world
----------------------------------

View file

@ -2,6 +2,9 @@
local wea_c = worldeditadditions_core
local Vector3 = wea_c.Vector3
---
-- @module worldeditadditions
-- ███ ███ ██████ ██ ██ ███████
-- ████ ████ ██ ██ ██ ██ ██
-- ██ ████ ██ ██ ██ ██ ██ █████

View file

@ -2,6 +2,8 @@ local wea_c = worldeditadditions_core
local Vector3 = wea_c.Vector3
local NodeListMatcher = wea_c.NodeListMatcher
---
-- @module worldeditadditions
-- ███ ██ ██████ ██████ ███████

View file

@ -1,6 +1,9 @@
local wea_c = worldeditadditions_core
local Vector3 = wea_c.Vector3
---
-- @module worldeditadditions
-- ███ ██ ██████ ██ ███████ ███████ █████ ██████ ██████ ██ ██ ██ ██████ ██████
-- ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
-- ██ ██ ██ ██ ██ ██ ███████ █████ ███████ ██████ ██████ ██ ████ █████ ██ ██
@ -9,10 +12,10 @@ local Vector3 = wea_c.Vector3
--- Similar to cubeapply, except that it takes 2 positions and randomly keeps changes based on a noise pattern.
-- Takes a backup copy of the defined region, runs the given function, and then
-- restores the bits that aren't above the nosie threshold.
-- @param {Position} pos1 The 1st position defining the region boundary
-- @param {Position} pos2 The 2nd positioon defining the region boundary
-- @param {Function} func The function to call that performs the action in question. It is expected that the given function will accept no arguments.
-- restores the bits that aren't above the noise threshold.
-- @param pos1 Vector3 The 1st position defining the region boundary
-- @param pos2 Vector3 The 2nd positioon defining the region boundary
-- @param func function The function to call that performs the action in question. It is expected that the given function will accept no arguments.
function worldeditadditions.noiseapply2d(pos1, pos2, threshold, scale, func)
local time_taken_all = wea_c.get_ms_time()
pos1, pos2 = Vector3.sort(pos1, pos2)

View file

@ -1,6 +1,9 @@
local wea_c = worldeditadditions_core
local Vector3 = wea_c.Vector3
---
-- @module worldeditadditions
--- Overlap command. Places a specified node on top of each column.
-- @param pos1 Vector3 pos1 of the defined region to perform the overlay operation in.
-- @param pos2 Vector3 pos2 of the defined region to perform the overlay operation in.

View file

@ -1,6 +1,9 @@
local wea_c = worldeditadditions_core
local Vector3 = wea_c.Vector3
---
-- @module worldeditadditions
-- ██████ ███████ ██████ ██ █████ ██████ ███████ ███ ███ ██ ██ ██
-- ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ████ ██ ██ ██

View file

@ -1,6 +1,9 @@
local wea_c = worldeditadditions_core
local Vector3 = wea_c.Vector3
---
-- @module worldeditadditions
-- ██████ ███████ ██ ██ ██████ ██ ██ ██ ███████
-- ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
-- ██████ █████ ██ ██ ██ ██ ██ ██ ██ █████

View file

@ -1,6 +1,9 @@
local weac = worldeditadditions_core
local Vector3 = weac.Vector3
---
-- @module worldeditadditions
-- ██████ ██████ ████████ █████ ████████ ███████
-- ██ ██ ██ ██ ██ ██ ██ ██ ██
-- ██████ ██ ██ ██ ███████ ██ █████

View file

@ -1,6 +1,9 @@
local wea_c = worldeditadditions_core
local Vector3 = wea_c.Vector3
---
-- @module worldeditadditions
--- Scales the defined region by the given scale factor in the given anchors.
-- Scale factor vectors containing both scale up and scale down operations are
-- split into 2 different scale operations automatically.

View file

@ -1,6 +1,9 @@
local wea_c = worldeditadditions_core
local Vector3 = wea_c.Vector3
---
-- @module worldeditadditions
-- ███████ ██████ █████ ██ ███████ ██████ ██████ ██ ██ ███ ██
-- ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██
-- ███████ ██ ███████ ██ █████ ██ ██ ██ ██ ██ █ ██ ██ ██ ██
@ -8,6 +11,7 @@ local Vector3 = wea_c.Vector3
-- ███████ ██████ ██ ██ ███████ ███████ ███████ ██████ ██████ ███ ███ ██ ████
--- Scales the defined region down by the given scale factor in the given directions.
-- You probably want worldeditadditions.scale, which scales in both directions.
-- @param pos1 Vector Position 1 of the defined region,
-- @param pos2 Vector Position 2 of the defined region.
-- @param scale Vector The scale factor - as a vector - by which to scale down.

View file

@ -1,6 +1,9 @@
local wea_c = worldeditadditions_core
local Vector3 = wea_c.Vector3
---
-- @module worldeditadditions
-- ███████ ██████ █████ ██ ███████ ██ ██ ██████
-- ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
@ -8,7 +11,8 @@ local Vector3 = wea_c.Vector3
-- ██ ██ ██ ██ ██ ██ ██ ██ ██
-- ███████ ██████ ██ ██ ███████ ███████ ███████ ██████ ██
--- Scales the defined region down by the given scale factor in the given directions.
--- Scales the defined region up by the given scale factor in the given directions.
-- You probably want worldeditadditions.scale, which scales in both directions.
-- @param pos1 Vector Position 1 of the defined region,
-- @param pos2 Vector Position 2 of the defined region.
-- @param scale Vector The scale factor - as a vector - by which to scale down.

View file

@ -1,5 +1,11 @@
local wea_c = worldeditadditions_core
local Vector3 = wea_c.Vector3
--- Functions for handling selections of the defined pos1/pos2 region.
--
-- These functions primarily back the [cloud wand](https://worldeditadditions.mooncarrot.space/Reference/#cloud). To manipulate positions directly, see the [`worldeditadditions_core.pos`]() namespace.
-- @namespace worldeditadditions.selection
-- ███████ ███████ ██ ███████ ██████ ████████ ██ ██████ ███ ██
-- ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██
-- ███████ █████ ██ █████ ██ ██ ██ ██ ██ ██ ██ ██
@ -13,6 +19,7 @@ local selection = {}
-- makes a selection from the provided point.
-- @param name string Player name.
-- @param pos vector The position to include.
-- @returns void
function selection.add_point(name, newpos)
if newpos ~= nil then
-- print("DEBUG:selection.add_point newpos", newpos)
@ -64,6 +71,7 @@ end
--- Clears current selection, *but only pos1 and pos2!
-- @param name string Player name.
-- @returns void
function selection.clear_points(name)
wea_c.pos.clear(name)
-- worldedit.marker_update(name)

View file

@ -2,6 +2,7 @@ local wea_c = worldeditadditions_core
local Vector3 = wea_c.Vector3
--- Holds the per-user selection stacks.
-- @namespace
worldeditadditions.sstack = {}
local sstack_max = 100

View file

@ -1,6 +1,9 @@
local wea_c = worldeditadditions_core
local Vector3 = wea_c.Vector3
---
-- @module worldeditadditions
-- ███████ ██████ ██ ██████ █████ ██
-- ██ ██ ██ ██ ██ ██ ██ ██ ██
-- ███████ ██████ ██ ██████ ███████ ██

View file

@ -1,6 +1,9 @@
local wea_c = worldeditadditions_core
local Vector3 = wea_c.Vector3
---
-- @module worldeditadditions
-- ███████ ██████ ██ ██████ █████ ██
-- ██ ██ ██ ██ ██ ██ ██ ██ ██
-- ███████ ██████ ██ ██████ ███████ ██

View file

@ -1,6 +1,9 @@
local wea_c = worldeditadditions_core
local Vector3 = wea_c.Vector3
---
-- @module worldeditadditions
-- ███████ ██████ ██ ██ ███ ██ ███████
-- ██ ██ ██ ██ ██ ████ ██ ██
-- ███████ ██████ ██ ██ ██ ██ ██ █████

View file

@ -1,15 +1,24 @@
local wea_c = worldeditadditions_core
local wea = worldeditadditions
local Vector3 = wea_c.Vector3
---
-- @module worldeditadditions
-- ███████ ██ ██ ██████ ██████ ██ ██ ██ ██ ██████ ███████
-- ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
-- ███████ ██ ██ ██████ ██ ██ ██ ██ ██ ██ ██ ██ █████
-- ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
-- ███████ ██████ ██████ ██████ ██ ████ ██ ██████ ███████
local wea_c = worldeditadditions_core
local wea = worldeditadditions
local Vector3 = wea_c.Vector3
-- NOTE this isn't a trip dash --- 'cause it's local-only to this file
-- Counts the number of chunks in the given area.
-- Maths is now done properly. Values from this new implementation were tested
-- with 1000 random pos1, pos2, and chunk_size combinations and found to be identical.
-- @internal
-- @param pos1 Vector3 Position 1 of the defined region.
-- @param pos2 Vector3 Position 2 of the defined region.
-- @param chunk_size Vector3 Size of the chunks to subdivide into..
local function count_chunks(pos1, pos2, chunk_size)
-- Assume pos1 & pos2 are sorted
local dimensions = Vector3.new(
@ -136,11 +145,11 @@ end
-- The emerge property contains a table that holds a running total of statistics
-- about what Minetest did to emerge the requested blocks in the world.
-- callback_complete is called at the end of the process, and pos1 + pos2 will be set to that of the entire region.
-- @param {Vector} pos1 The first position defining the area to emerge.
-- @param {Vector} pos2 The second position defining the area to emerge.
-- @param {Vector} chunk_size The size of the chunks to subdivide into.
-- @param {function} callback The callback to call for each block.
-- @param {function} callback The callback to call upon completion.
-- @param pos1 Vector The first position defining the area to emerge.
-- @param pos2 Vector The second position defining the area to emerge.
-- @param chunk_size Vector The size of the chunks to subdivide into.
-- @param callback function The callback to call for each block.
-- @param callback function The callback to call upon completion.
function worldeditadditions.subdivide(pos1, pos2, chunk_size, callback_subblock, callback_complete)
pos1, pos2 = worldedit.sort_pos(pos1, pos2)
local chunks_total = count_chunks(pos1, pos2, chunk_size)

View file

@ -1,6 +1,9 @@
local wea_c = worldeditadditions_core
local Vector3 = wea_c.Vector3
---
-- @module worldeditadditions
--- Generates a torus shape at the given position with the given parameters.
-- @param position Vector The position at which to generate the torus.
-- @param major_radius number The major radius of the torus - i.e. the distance from the middle to the ring.

View file

@ -1,6 +1,9 @@
local wea_c = worldeditadditions_core
local Vector3 = wea_c.Vector3
---
-- @module worldeditadditions
-- ██ ██ █████ ██ ██ ███████
-- ██ ██ ██ ██ ██ ██ ██
-- ██ █ ██ ███████ ██ ██ ███████

View file

@ -1,6 +1,9 @@
local wea_c = worldeditadditions_core
local Vector3 = wea_c.Vector3
---
-- @module worldeditadditions
-- ██████ ██████ ██████ ███ ██ ███████ ██████ ███████ ███████ ████████
-- ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██
-- ██ ██ ██ ██████ ██ ██ ██ █████ ██████ ███████ █████ ██

View file

@ -1,6 +1,9 @@
local wea_c = worldeditadditions_core
local Vector3 = wea_c.Vector3
---
-- @module worldeditadditions
-- ███ ███ █████ ██ ██ ███████ ██████ ██████ ███ ███ ██████ █████ ███████ ███████
-- ████ ████ ██ ██ ██ ██ ██ ██ ██ ██ ████ ████ ██ ██ ██ ██ ██ ██
-- ██ ████ ██ ███████ █████ █████ ██ ██ ██ ██ ████ ██ ██████ ███████ ███████ ███████
@ -8,9 +11,9 @@ local Vector3 = wea_c.Vector3
-- ██ ██ ██ ██ ██ ██ ███████ ██████ ██████ ██ ██ ██ ██ ██ ███████ ███████
--- Makes a compass with a bead pointing north (+Z).
-- @param {Position} pos1 The 1st position defining the WorldEdit selection
-- @param {string} node1 Name of the node to place
-- @param {string} node2 Name of the node of the bead
-- @param pos1 Vector3 The 1st position defining the WorldEdit selection
-- @param node1 string Name of the node to place
-- @param node2 string Name of the node of the bead
function worldeditadditions.make_compass(pos1,node1,node2)
pos1 = Vector3.clone(pos1)
minetest.set_node(pos1 + Vector3.new(0,1,3), { name = node2 })

View file

@ -1,5 +1,8 @@
local v3 = worldeditadditions_core.Vector3
---
-- @module worldeditadditions
-- ██ ██ ██ ██████ ███████ ██████ ██████ ██ ██
-- ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
-- ██ █ ██ ██ ██████ █████ ██████ ██ ██ ███
@ -7,9 +10,9 @@ local v3 = worldeditadditions_core.Vector3
-- ███ ███ ██ ██ ██ ███████ ██████ ██████ ██ ██
--- Fills the edges of the selection box with nodes.
-- @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
-- @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.wire_box(pos1,pos2,node)
local node_id_replace = minetest.get_content_id(node)
local ps1, ps2 = v3.sort(pos1,pos2)