allow player animations hit by mobs
parent
b7eda10054
commit
c3425a69b1
|
@ -128,8 +128,7 @@ mcl_enchanting.enchantments.fire_aspect = {
|
||||||
}
|
}
|
||||||
|
|
||||||
minetest.register_on_punchplayer(function(player, hitter, time_from_last_punch, tool_capabilities, dir, damage)
|
minetest.register_on_punchplayer(function(player, hitter, time_from_last_punch, tool_capabilities, dir, damage)
|
||||||
if hitter and hitter:is_player() then
|
if hitter then
|
||||||
local wielditem = hitter:get_wielded_item()
|
|
||||||
local p = player:get_pos()
|
local p = player:get_pos()
|
||||||
if time_from_last_punch > 0.5 then
|
if time_from_last_punch > 0.5 then
|
||||||
local yy=0
|
local yy=0
|
||||||
|
@ -141,9 +140,17 @@ minetest.register_on_punchplayer(function(player, hitter, time_from_last_punch,
|
||||||
player:get_meta():set_string("punched", "0")
|
player:get_meta():set_string("punched", "0")
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local d = hitter:get_look_dir()
|
local d = vector.new()
|
||||||
|
if hitter:is_player() then
|
||||||
|
d = hitter:get_look_dir()
|
||||||
|
elseif hitter:get_luaentity() then
|
||||||
|
d = minetest.yaw_to_dir(hitter:get_yaw())
|
||||||
|
end
|
||||||
player:add_velocity({x=d.x*4,y=yy,z=d.z*4})
|
player:add_velocity({x=d.x*4,y=yy,z=d.z*4})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if hitter:is_player() then
|
||||||
|
local wielditem = hitter:get_wielded_item()
|
||||||
if wielditem then
|
if wielditem then
|
||||||
local fire_aspect_level = mcl_enchanting.get_enchantment(wielditem, "fire_aspect")
|
local fire_aspect_level = mcl_enchanting.get_enchantment(wielditem, "fire_aspect")
|
||||||
if fire_aspect_level > 0 then
|
if fire_aspect_level > 0 then
|
||||||
|
@ -151,6 +158,7 @@ minetest.register_on_punchplayer(function(player, hitter, time_from_last_punch,
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
mcl_enchanting.enchantments.flame = {
|
mcl_enchanting.enchantments.flame = {
|
||||||
|
|
Loading…
Reference in New Issue