forked from VoxeLibre/VoxeLibre
Compare commits
4 Commits
master
...
pvp_knockb
Author | SHA1 | Date |
---|---|---|
|
b90ff44f73 | |
|
3557f02b8f | |
|
c3425a69b1 | |
|
b7eda10054 |
|
@ -292,7 +292,7 @@ mcl_mobs:register_mob("mobs_mc:enderman", {
|
||||||
random = {name="mobs_mc_enderman_random", gain=0.5},
|
random = {name="mobs_mc_enderman_random", gain=0.5},
|
||||||
distance = 16,
|
distance = 16,
|
||||||
},
|
},
|
||||||
walk_velocity = 0.2,
|
walk_velocity = 2.5,
|
||||||
run_velocity = 3.4,
|
run_velocity = 3.4,
|
||||||
damage = 7,
|
damage = 7,
|
||||||
reach = 2,
|
reach = 2,
|
||||||
|
|
|
@ -128,12 +128,34 @@ 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()
|
||||||
if wielditem then
|
if time_from_last_punch > 0.5 then
|
||||||
local fire_aspect_level = mcl_enchanting.get_enchantment(wielditem, "fire_aspect")
|
local yy=0
|
||||||
if fire_aspect_level > 0 then
|
if math.abs(player:get_velocity().y) < 0.1 then
|
||||||
mcl_burning.set_on_fire(player, fire_aspect_level * 4)
|
yy=4
|
||||||
|
end
|
||||||
|
player:get_meta():set_string("punched", tostring(minetest.get_gametime()))
|
||||||
|
minetest.after(0.4, function()
|
||||||
|
player:get_meta():set_string("punched", "0")
|
||||||
|
end)
|
||||||
|
|
||||||
|
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})
|
||||||
|
end
|
||||||
|
|
||||||
|
if hitter:is_player() then
|
||||||
|
local wielditem = hitter:get_wielded_item()
|
||||||
|
if wielditem then
|
||||||
|
local fire_aspect_level = mcl_enchanting.get_enchantment(wielditem, "fire_aspect")
|
||||||
|
if fire_aspect_level > 0 then
|
||||||
|
mcl_burning.set_on_fire(player, fire_aspect_level * 4)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -231,13 +231,18 @@ minetest.register_globalstep(function(dtime)
|
||||||
|
|
||||||
local velocity = player:get_velocity() or player:get_player_velocity()
|
local velocity = player:get_velocity() or player:get_player_velocity()
|
||||||
|
|
||||||
|
local mod_speed = 5
|
||||||
-- Apply animations based on what the player is doing
|
-- Apply animations based on what the player is doing
|
||||||
if player:get_hp() == 0 then
|
if player:get_hp() == 0 then
|
||||||
player_set_animation(player, "die")
|
player_set_animation(player, "die")
|
||||||
|
elseif player:get_meta():get("punched") and tonumber(player:get_meta():get("punched")) > 0 then
|
||||||
|
player_set_animation(player, "run_walk", animation_speed_mod)
|
||||||
|
player:set_animation_frame_speed((math.abs(velocity.x)+math.abs(velocity.z))*mod_speed)
|
||||||
elseif walking and velocity.x > 0.35
|
elseif walking and velocity.x > 0.35
|
||||||
or walking and velocity.x < -0.35
|
or walking and velocity.x < -0.35
|
||||||
or walking and velocity.z > 0.35
|
or walking and velocity.z > 0.35
|
||||||
or walking and velocity.z < -0.35 then
|
or walking and velocity.z < -0.35 then
|
||||||
|
player:set_animation_frame_speed((math.abs(velocity.x)+math.abs(velocity.z))*mod_speed)
|
||||||
local wielded_itemname = player:get_wielded_item():get_name()
|
local wielded_itemname = player:get_wielded_item():get_name()
|
||||||
local no_arm_moving = string.find(wielded_itemname, "mcl_bows:bow") or mcl_shields.wielding_shield(player, 1) or mcl_shields.wielding_shield(player, 2)
|
local no_arm_moving = string.find(wielded_itemname, "mcl_bows:bow") or mcl_shields.wielding_shield(player, 1) or mcl_shields.wielding_shield(player, 2)
|
||||||
if player_sneak[name] ~= controls.sneak then
|
if player_sneak[name] ~= controls.sneak then
|
||||||
|
|
Loading…
Reference in New Issue