Merge branch 'enchant_bugnet' into enchant_api

This commit is contained in:
Wuzzy 2024-12-02 02:28:11 +01:00
commit 2c426f53f6
2 changed files with 16 additions and 2 deletions

View File

@ -11,6 +11,9 @@ local STEEL_HOE_USES = 500
-- Modifier of the steel hoe uses for the enchanted steel hoe
local STEEL_HOE_USES_MODIFIER = 2.2
-- Modifier of the bug net uses for the enchanted bug net
local BUG_NET_USES_MODIFIER = 5
-- Multiplies by much faster the fast hammer repairs
local HAMMER_FAST_MODIFIER = 1.3
@ -39,6 +42,15 @@ for m=1, #materials do
end
end
-- Register enchantment for bug net
xdecor.register_enchantable_tool("fireflies:bug_net", {
enchants = { "durable" },
dig_group = "catchable",
bonuses = {
uses = BUG_NET_USES_MODIFIER,
}
})
-- Register enchanted steel hoe (more durability)
if farming.register_hoe then
local percent = math.round((STEEL_HOE_USES_MODIFIER - 1) * 100)

View File

@ -315,10 +315,10 @@ function enchanting:register_tool(original_tool_name, def)
local original_desc = toolitem:get_short_description() or original_tool_name
for _, enchant in ipairs(def.enchants) do
local groupcaps = table.copy(original_groupcaps)
local fleshy = original_damage_groups.fleshy
local full_punch_interval = original_toolcaps.full_punch_interval
local max_drop_level = original_toolcaps.max_drop_level
local dig_group = def.dig_group
local fleshy
if not def.bonuses then
def.bonuses = {}
@ -337,6 +337,7 @@ function enchanting:register_tool(original_tool_name, def)
groupcaps[dig_group].times[i] = time - bonus_defs.times
end
elseif enchant == "sharp" then
fleshy = original_damage_groups.fleshy
fleshy = fleshy + bonus_defs.damages
else
minetest.log("error", "[xdecor] Called enchanting:register_tool with unsupported enchant: "..tostring(enchant))
@ -365,7 +366,8 @@ function enchanting:register_tool(original_tool_name, def)
groupcaps = groupcaps, damage_groups = {fleshy = fleshy},
full_punch_interval = full_punch_interval,
max_drop_level = max_drop_level
}
},
pointabilities = original_tool.pointabilities,
})
if minetest.get_modpath("toolranks") then
toolranks.add_tool(enchantedTool)