mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2025-01-25 16:31:08 +01:00
Add API documentation, change ndef to node_def to match documentation, change log message according to review comment
This commit is contained in:
parent
b5a05857eb
commit
28b5e00e37
2 changed files with 13 additions and 4 deletions
9
mods/CORE/_mcl_autogroup/API.md
Normal file
9
mods/CORE/_mcl_autogroup/API.md
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
### Functions
|
||||||
|
|
||||||
|
`mcl_autogroup.group_compatibility(groups, node_def)`
|
||||||
|
|
||||||
|
Adds VoxeLibre-equivalent groups to `node_def.groups`.
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
* `groups` - A list of groups to add compatiblity groups for. Normally this is a copy of `node_def.groups`.
|
||||||
|
* `node_def` - The node defintion to update groups for.
|
|
@ -317,13 +317,13 @@ local GROUP_MAP = {
|
||||||
["snappy"] = "shearsy",
|
["snappy"] = "shearsy",
|
||||||
}
|
}
|
||||||
|
|
||||||
function mcl_autogroup.mod_compatibility(groups, ndef)
|
function mcl_autogroup.group_compatibility(groups, node_def)
|
||||||
local grouped = false
|
local grouped = false
|
||||||
for name,_ in pairs(groups) do
|
for name,_ in pairs(groups) do
|
||||||
local new_group = GROUP_MAP[name]
|
local new_group = GROUP_MAP[name]
|
||||||
if new_group then
|
if new_group then
|
||||||
groups[new_group] = 1
|
groups[new_group] = 1
|
||||||
ndef.groups[new_group] = 1
|
node_def.groups[new_group] = 1
|
||||||
end
|
end
|
||||||
if mcl_autogroup.registered_diggroups[name] then
|
if mcl_autogroup.registered_diggroups[name] then
|
||||||
grouped = true
|
grouped = true
|
||||||
|
@ -350,7 +350,7 @@ local function overwrite()
|
||||||
|
|
||||||
if not newgroups.indestructable then
|
if not newgroups.indestructable then
|
||||||
ndef.diggable = true
|
ndef.diggable = true
|
||||||
mcl_autogroup.mod_compatibility(newgroups, ndef)
|
mcl_autogroup.group_compatibility(newgroups, ndef)
|
||||||
if not ndef._mcl_hardness then
|
if not ndef._mcl_hardness then
|
||||||
ndef._mcl_hardness = 0
|
ndef._mcl_hardness = 0
|
||||||
end
|
end
|
||||||
|
@ -400,7 +400,7 @@ local function overwrite()
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
minetest.log("verbose","Total registered blocks: "..tostring(count))
|
minetest.log("verbose","Total registered nodes: "..count)
|
||||||
|
|
||||||
for tname, tdef in pairs(minetest.registered_items) do
|
for tname, tdef in pairs(minetest.registered_items) do
|
||||||
-- Assign groupcaps for digging the registered digging groups
|
-- Assign groupcaps for digging the registered digging groups
|
||||||
|
|
Loading…
Reference in a new issue