Update and correct a bunch of comments

note that @module is outdated and should not be used
This commit is contained in:
Starbeamrainbowlabs 2023-07-04 22:45:02 +01:00
parent 365b491aa1
commit 6bc1987916
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
7 changed files with 31 additions and 22 deletions

View file

@ -1,7 +1,7 @@
--- WorldEditAdditions --- WorldEditAdditions
-- @module worldeditadditions -- @namespace worldeditadditions
-- @release 0.1 -- @release 1.13
-- @copyright 2018 Starbeamrainbowlabs -- @copyright 2023 Starbeamrainbowlabs
-- @license Mozilla Public License, 2.0 -- @license Mozilla Public License, 2.0
-- @author Starbeamrainbowlabs -- @author Starbeamrainbowlabs

View file

@ -2,11 +2,12 @@ local wea_c = worldeditadditions_core
local Vector3 = wea_c.Vector3 local Vector3 = wea_c.Vector3
--- Bonemeal command. --- Bonemeal command.
-- Applies bonemeal to all notes -- Applies bonemeal to all nodes with an air bloc above then.
-- @module worldeditadditions.overlay -- @param strength The strength to apply - see bonemeal:on_use
-- @param chance Positive integer that represents the chance bonemealing will occur
-- strength The strength to apply - see bonemeal:on_use -- @returns bool,number,number 1. Whether the command succeeded or not.
-- chance Positive integer that represents the chance bonemealing will occur -- 2. The number of nodes actually bonemealed
-- 3. The number of possible candidates we could have bonemealed
function worldeditadditions.bonemeal(pos1, pos2, strength, chance, nodename_list) function worldeditadditions.bonemeal(pos1, pos2, strength, chance, nodename_list)
if not nodename_list then nodename_list = {} end if not nodename_list then nodename_list = {} end
pos1, pos2 = Vector3.sort(pos1, pos2) pos1, pos2 = Vector3.sort(pos1, pos2)

View file

@ -1,8 +1,6 @@
local wea_c = worldeditadditions_core local wea_c = worldeditadditions_core
local Vector3 = wea_c.Vector3 local Vector3 = wea_c.Vector3
--- Copies a region to another location, potentially overwriting the exiting region.
-- @module worldeditadditions.copy
-- ██████ ██████ ██████ ██ ██ -- ██████ ██████ ██████ ██ ██
-- ██ ██ ██ ██ ██ ██ ██ -- ██ ██ ██ ██ ██ ██ ██
@ -10,6 +8,14 @@ local Vector3 = wea_c.Vector3
-- ██ ██ ██ ██ ██ -- ██ ██ ██ ██ ██
-- ██████ ██████ ██ ██ -- ██████ ██████ ██ ██
--- Copies a region to another location, potentially overwriting the exiting region.
-- @param source_pos1 Vector3 pos1 of the source region to copy.
-- @param source_pos2 Vector3 pos2 of the source region to copy.
-- @param target_pos1 Vector3 pos1 of the target region to copy to.
-- @param target_pos2 Vector3 pos2 of the target region to copy to.
-- @param airapply=false bool Whether to only replace target nodes that are air-like, leaving those that are not air-like. If false, then all target nodes are replaced regardless of whether they are air-like nodes or not.
-- @returns bool,numbers 1. Whether the copy operation was successful or not
-- 2. The total number of nodes copied.
function worldeditadditions.copy(source_pos1, source_pos2, target_pos1, target_pos2, airapply) function worldeditadditions.copy(source_pos1, source_pos2, target_pos1, target_pos2, airapply)
if airapply == nil then airapply = false end if airapply == nil then airapply = false end
source_pos1, source_pos2 = Vector3.sort(source_pos1, source_pos2) source_pos1, source_pos2 = Vector3.sort(source_pos1, source_pos2)
@ -27,7 +33,7 @@ function worldeditadditions.copy(source_pos1, source_pos2, target_pos1, target_p
local data_target = manip_target:get_data() local data_target = manip_target:get_data()
-- z y x is the preferred loop order (because CPU cache, since then we're iterating linearly through the data array backwards. This only holds true for little-endian machines however) -- z y x is the preferred loop order (because CPU cache, since then we're iterating linearly through the data array backwards. This only holds true for little-endian machines however)
local total_replaced = 0
for z = source_pos2.z, source_pos1.z, -1 do for z = source_pos2.z, source_pos1.z, -1 do
for y = source_pos2.y, source_pos1.y, -1 do for y = source_pos2.y, source_pos1.y, -1 do
for x = source_pos2.x, source_pos1.x, -1 do for x = source_pos2.x, source_pos1.x, -1 do
@ -42,6 +48,7 @@ function worldeditadditions.copy(source_pos1, source_pos2, target_pos1, target_p
end end
if should_replace then if should_replace then
data_target[target_i] = data_source[source_i] data_target[target_i] = data_source[source_i]
total_replaced = total_replaced + 1
end end
end end
end end
@ -50,5 +57,5 @@ function worldeditadditions.copy(source_pos1, source_pos2, target_pos1, target_p
-- Save the modified nodes back to disk & return -- Save the modified nodes back to disk & return
worldedit.manip_helpers.finish(manip_target, data_target) worldedit.manip_helpers.finish(manip_target, data_target)
return true, worldedit.volume(target_pos1, target_pos2) return true, total_replaced
end end

View file

@ -1,14 +1,19 @@
local wea_c = worldeditadditions_core local wea_c = worldeditadditions_core
local Vector3 = wea_c.Vector3 local Vector3 = wea_c.Vector3
--- Counts the nodes in a given area.
-- @module worldeditadditions.count
-- ██████ ██████ ██ ██ ███ ██ ████████ -- ██████ ██████ ██ ██ ███ ██ ████████
-- ██ ██ ██ ██ ██ ████ ██ ██ -- ██ ██ ██ ██ ██ ████ ██ ██
-- ██ ██ ██ ██ ██ ██ ██ ██ ██ -- ██ ██ ██ ██ ██ ██ ██ ██ ██
-- ██ ██ ██ ██ ██ ██ ██ ██ ██ -- ██ ██ ██ ██ ██ ██ ██ ██ ██
-- ██████ ██████ ██████ ██ ████ ██ -- ██████ ██████ ██████ ██ ████ ██
--- Counts the nodes in a given area.
-- @param pos1 Vector3 pos1 of the defined region to count nodes in.
-- @param pos2 Vector3 pos2 of the defined region to count nodes in.
-- @param do_human_counts bool Whether to return human-readable counts (as a string) instead of the raw numbers.
-- @returns bool,table<number,number>,number 1. Whether the operation was successful or not.
-- 2. A table mapping node ids to the number of that node id seen.
-- 3. The total number of nodes counted.
function worldeditadditions.count(pos1, pos2, do_human_counts) function worldeditadditions.count(pos1, pos2, do_human_counts)
pos1, pos2 = Vector3.sort(pos1, pos2) pos1, pos2 = Vector3.sort(pos1, pos2)
-- pos2 will always have the highest co-ordinates now -- pos2 will always have the highest co-ordinates now

View file

@ -1,5 +1,5 @@
--- WorldEditAdditions-ChatCommands --- WorldEditAdditions-ChatCommands
-- @module worldeditadditions_commands -- @namespace worldeditadditions_commands
-- @release 0.1 -- @release 0.1
-- @copyright 2018 Starbeamrainbowlabs -- @copyright 2018 Starbeamrainbowlabs
-- @license Mozilla Public License, 2.0 -- @license Mozilla Public License, 2.0

View file

@ -1,14 +1,10 @@
--- WorldEditAdditions-Core --- WorldEditAdditions-Core
-- @module worldeditadditions_core -- @namespace worldeditadditions_core
-- @release 1.13 -- @release 1.13
-- @copyright 2021 Starbeamrainbowlabs and VorTechnix -- @copyright 2021 Starbeamrainbowlabs and VorTechnix
-- @license Mozilla Public License, 2.0 -- @license Mozilla Public License, 2.0
-- @author Starbeamrainbowlabs and VorTechnix -- @author Starbeamrainbowlabs and VorTechnix
-- local temp = true
-- if temp then return end
-- This mod isn't finished yet, so it will not be executed for now.
local modpath = minetest.get_modpath("worldeditadditions_core") local modpath = minetest.get_modpath("worldeditadditions_core")

View file

@ -173,7 +173,7 @@ function Vector3.length(a)
return math.sqrt(a:length_squared()) return math.sqrt(a:length_squared())
end end
--- Calculates the volume of the region bounded by 1 points. --- Calculates the volume of the region bounded by 2 points.
-- @param a Vector3 The first point bounding the target region. -- @param a Vector3 The first point bounding the target region.
-- @param b Vector3 The second point bounding the target region. -- @param b Vector3 The second point bounding the target region.
-- @returns number The volume of the defined region. -- @returns number The volume of the defined region.