Compare commits

...

10 Commits

4 changed files with 65 additions and 20 deletions

View File

@ -309,6 +309,31 @@ function mcl_autogroup.get_wear(toolname, diggroup)
return math.ceil(65535 / uses)
end
local GROUP_MAP = {
["choppy"] = "axey",
["oddly_breakable_by_hand"] = "handy",
["cracky"] = "pickaxey",
["crumbly"] = "shovely",
["snappy"] = "shearsy",
}
function mcl_autogroup.group_compatibility(groups)
local grouped = false
for name,old_group_value in pairs(groups) do
local new_group = GROUP_MAP[name]
if new_group then
groups[new_group] = old_group_value
end
if mcl_autogroup.registered_diggroups[name] then
grouped = true
end
end
if not grouped then
groups.handy = 1
end
end
local function overwrite()
-- Refresh, now that all groups are known.
hardness_values = get_hardness_values_for_groups()
@ -317,8 +342,22 @@ local function overwrite()
-- hardness_value. Used for quick lookup.
local hardness_lookup = get_hardness_lookup_for_groups(hardness_values)
local count = 0
for nname, ndef in pairs(minetest.registered_nodes) do
count = count + 1
local newgroups = table.copy(ndef.groups)
if not newgroups.unbreakable and not newgroups.indestructible then
ndef.diggable = true
mcl_autogroup.group_compatibility(newgroups)
if not ndef._mcl_hardness then
ndef._mcl_hardness = 0
end
end
-- Make sure compatibility groups are present for the below logic
ndef.groups = newgroups
if (nname ~= "ignore" and ndef.diggable) then
-- Automatically assign the "solid" group for solid nodes
if (ndef.walkable == nil or ndef.walkable == true)
@ -363,6 +402,7 @@ local function overwrite()
})
end
end
minetest.log("verbose","Total registered nodes: "..count)
for tname, tdef in pairs(minetest.registered_items) do
-- Assign groupcaps for digging the registered digging groups

View File

@ -1,28 +1,34 @@
# mcl_autogroup
# `mcl_autogroup`
This mod emulates digging times from MC.
## mcl_autogroup.can_harvest(nodename, toolname, player)
Return true if `nodename` can be dig with `toolname` by <player>.
* nodename: string, valid nodename
* toolname: (optional) string, valid toolname
* player: (optinal) ObjectRef, valid player
## `mcl_autogroup.can_harvest(nodename, toolname, player)`
Return true if `nodename` can be dug with `toolname` by `player`.
## mcl_autogroup.get_groupcaps(toolname, efficiency)
* `nodename`: string, valid nodename
* `toolname`: (optional) string, valid toolname
* `player`: (optinal) ObjectRef, valid player
## `mcl_autogroup.get_groupcaps(toolname, efficiency)`
This function is used to calculate diggroups for tools.
WARNING: This function can only be called after mod initialization.
* toolname: string, name of the tool being enchanted (like "mcl_tools:diamond_pickaxe")
* efficiency: (optional) integer, the efficiency level the tool is enchanted with (default 0)
* `toolname`: string, name of the tool being enchanted (like `"mcl_tools:diamond_pickaxe"`)
* `efficiency`: (optional) integer, the efficiency level the tool is enchanted with (default 0)
## mcl_autogroup.get_wear(toolname, diggroup)
## `mcl_autogroup.get_wear(toolname, diggroup)`
Return the max wear of `toolname` with `diggroup`
WARNING: This function can only be called after mod initialization.
* toolname: string, name of the tool used
* diggroup: string, the name of the diggroup the tool is used on
* `toolname`: string, name of the tool used
* `diggroup`: string, the name of the diggroup the tool is used on
## mcl_autogroup.register_diggroup(group, def)
* group: string, name of the group to register as a digging group
* def: (optional) table, table with information about the diggroup (defaults to {} if unspecified)
* level: (optional) string, if specified it is an array containing the names of the different digging levels the digging group supports
## `mcl_autogroup.register_diggroup(group, def)`
* `group`: string, name of the group to register as a digging group
* `def`: (optional) table, table with information about the diggroup (defaults to `{}` if unspecified)
* `level`: (optional) string, if specified it is an array containing the names of the different digging levels the digging group supports
## mcl_autogroup.registered_diggroups
## `mcl_autogroup.registered_diggroups`
List of registered diggroups, indexed by name.
## `mcl_autogroup.group_compatibility(groups, node_def)`
Adds VoxeLibre-equivalent groups to `node_def.groups`.
* `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.

View File

@ -1,6 +1,5 @@
# textdomain: mcl_bone_meal
Bone Meal=Farine d'Os
Bone meal is a white dye and also useful as a fertilizer to speed up the growth of many plants.=La farine d'os est une teinture blanche et est également utile comme engrais pour accélérer la croissance de nombreuses plantes.
Rightclick a sheep to turn its wool white. Rightclick a plant to speed up its growth. Note that not all plants can be fertilized like this. When you rightclick a grass block, tall grass and flowers will grow all over the place.=
Cliquez avec le bouton droit sur un mouton pour blanchir sa laine. Cliquez avec le bouton droit sur une plante pour accélérer sa croissance. Cependant, toutes les plantes ne peuvent pas être fertilisées de cette manière. Lorsque vous cliquez avec le bouton droit sur un bloc d'herbe, les hautes herbes et les fleurs poussent autour.
Rightclick a sheep to turn its wool white. Rightclick a plant to speed up its growth. Note that not all plants can be fertilized like this. When you rightclick a grass block, tall grass and flowers will grow all over the place.=Cliquez avec le bouton droit sur un mouton pour blanchir sa laine. Cliquez avec le bouton droit sur une plante pour accélérer sa croissance. Cependant, toutes les plantes ne peuvent pas être fertilisées de cette manière. Lorsque vous cliquez avec le bouton droit sur un bloc d'herbe, les hautes herbes et les fleurs poussent autour.
Speeds up plant growth=Accélère la croissance des plantes

View File

@ -728,7 +728,7 @@ minetest.register_node("mcl_core:bedrock", {
S("In the End dimension, starting a fire on this block will create an eternal fire."),
tiles = {"mcl_core_bedrock.png"},
stack_max = 64,
groups = {creative_breakable=1, building_block=1, material_stone=1},
groups = {creative_breakable=1, building_block=1, material_stone=1, unbreakable=1},
sounds = mcl_sounds.node_sound_stone_defaults(),
is_ground_content = false,
on_blast = function() end,