mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-16 16:11:06 +01:00
Knockback fixes
This commit is contained in:
parent
e29654a0f6
commit
24ffd64cad
4 changed files with 10 additions and 6 deletions
|
@ -719,12 +719,12 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir)
|
|||
end
|
||||
if hitter and is_player then
|
||||
local wielditem = hitter:get_wielded_item()
|
||||
kb = kb + 9 * mcl_enchanting.get_enchantment(wielditem, "knockback")
|
||||
-- add player velocity to mob knockback
|
||||
local hv = hitter:get_velocity()
|
||||
local dir_dot = (hv.x * dir.x) + (hv.z * dir.z)
|
||||
local player_mag = math.sqrt((hv.x * hv.x) + (hv.z * hv.z))
|
||||
local mob_mag = math.sqrt((v.x * v.x) + (v.z * v.z))
|
||||
kb = kb + 9 * mcl_enchanting.get_enchantment(wielditem, "knockback")
|
||||
-- add player velocity to mob knockback
|
||||
if dir_dot > 0 and mob_mag <= player_mag * 0.625 then
|
||||
kb = kb + ((math.abs(hv.x) + math.abs(hv.z)) * r)
|
||||
end
|
||||
|
|
|
@ -156,7 +156,6 @@ mcl_death_messages = {
|
|||
plain = "@1 died a sweet death",
|
||||
assist = "@1 was poked to death by a sweet berry bush whilst trying to escape @2",
|
||||
},
|
||||
-- Missing snowballs: The Minecraft wiki mentions them but the MC source code does not.
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -278,7 +278,13 @@ function minetest.calculate_knockback(player, hitter, time_from_last_punch, tool
|
|||
end
|
||||
if hitter and hitter:is_player() then
|
||||
local wielditem = hitter:get_wielded_item()
|
||||
knockback = knockback + 3 * mcl_enchanting.get_enchantment(wielditem, "knockback")
|
||||
knockback = knockback + 5 * mcl_enchanting.get_enchantment(wielditem, "knockback")
|
||||
-- add player velocity to knockback
|
||||
local hv = hitter:get_velocity()
|
||||
local dir_dot = (hv.x * dir.x) + (hv.z * dir.z)
|
||||
if dir_dot > 0 then
|
||||
knockback = knockback + dir_dot * 2
|
||||
end
|
||||
elseif luaentity and luaentity._knockback then
|
||||
knockback = knockback + luaentity._knockback
|
||||
end
|
||||
|
|
|
@ -23,8 +23,7 @@ mcl_damage.register_modifier(function(obj, damage, reason)
|
|||
texture = "mcl_particles_crit.png^[colorize:#bc7a57:127",
|
||||
})
|
||||
minetest.sound_play("mcl_criticals_hit", {object = obj})
|
||||
-- the minecraft wiki is actually wrong about a crit dealing 150% damage, see minecraft source code
|
||||
return damage + math.random(0, math.floor(damage * 1.5 + 2))
|
||||
return damage * math.random(1.5, 2.5)
|
||||
end
|
||||
end
|
||||
end, -100)
|
||||
|
|
Loading…
Reference in a new issue