forked from LizzyFleckenstein03/Memeclone
Knockback
This commit is contained in:
parent
2b55dac7d2
commit
cdafb1a07e
|
@ -219,7 +219,7 @@ mcl_enchanting.enchantments.infinity = {
|
|||
requires_tool = false,
|
||||
}
|
||||
|
||||
-- unimplemented
|
||||
-- implemented via minetest.calculate_knockback
|
||||
mcl_enchanting.enchantments.knockback = {
|
||||
name = "Knockback",
|
||||
max_level = 2,
|
||||
|
@ -234,6 +234,16 @@ mcl_enchanting.enchantments.knockback = {
|
|||
requires_tool = false,
|
||||
}
|
||||
|
||||
local old_calculate_knockback = minetest.calculate_knockback
|
||||
function minetest.calculate_knockback(player, hitter, time_from_last_punch, tool_capabilities, dir, distance, damage)
|
||||
local knockback = old_calculate_knockback(player, hitter, time_from_last_punch, tool_capabilities, dir, distance, damage)
|
||||
if hitter and hitter:is_player() then
|
||||
local wielditem = hitter:get_wielded_item()
|
||||
knockback = knockback + 3 * mcl_enchanting.get_enchantment(wielditem, "knockback")
|
||||
end
|
||||
return knockback
|
||||
end
|
||||
|
||||
-- unimplemented
|
||||
mcl_enchanting.enchantments.looting = {
|
||||
name = "Looting",
|
||||
|
|
Loading…
Reference in New Issue