forked from VoxeLibre/VoxeLibre
Merge pull request 'elytra_animation_fix' (#2805) from elytra_animation_fix into master
Reviewed-on: MineClone2/MineClone2#2805 Reviewed-by: cora <cora@noreply.git.minetest.land>
This commit is contained in:
commit
4e4bd8f978
|
@ -234,6 +234,8 @@ minetest.register_globalstep(function(dtime)
|
||||||
-- 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 mcl_playerplus.elytra[player] and mcl_playerplus.elytra[player].active then
|
||||||
|
player_set_animation(player, "stand")
|
||||||
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
|
||||||
|
|
|
@ -196,6 +196,10 @@ minetest.register_globalstep(function(dtime)
|
||||||
elytra.speed = 0
|
elytra.speed = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if not elytra.last_yaw then
|
||||||
|
elytra.last_yaw = player:get_look_horizontal()
|
||||||
|
end
|
||||||
|
|
||||||
local is_just_jumped = control.jump and not mcl_playerplus.is_pressing_jump[name] and not elytra.active
|
local is_just_jumped = control.jump and not mcl_playerplus.is_pressing_jump[name] and not elytra.active
|
||||||
mcl_playerplus.is_pressing_jump[name] = control.jump
|
mcl_playerplus.is_pressing_jump[name] = control.jump
|
||||||
if is_just_jumped and not elytra.active then
|
if is_just_jumped and not elytra.active then
|
||||||
|
@ -314,7 +318,7 @@ minetest.register_globalstep(function(dtime)
|
||||||
|
|
||||||
if elytra.active then
|
if elytra.active then
|
||||||
-- set head pitch and yaw when flying
|
-- set head pitch and yaw when flying
|
||||||
set_bone_position_conditional(player,"Head_Control", vector.new(0,6.3,0), vector.new(pitch-degrees(dir_to_pitch(player_velocity)),player_vel_yaw - yaw,0))
|
set_bone_position_conditional(player,"Head_Control", vector.new(0,6.3,0), vector.new(pitch-degrees(dir_to_pitch(player_velocity))+50,player_vel_yaw - yaw,0))
|
||||||
-- sets eye height, and nametag color accordingly
|
-- sets eye height, and nametag color accordingly
|
||||||
set_properties_conditional(player,{collisionbox = {-0.35,0,-0.35,0.35,0.8,0.35}, eye_height = 0.5, nametag_color = { r = 225, b = 225, a = 225, g = 225 }})
|
set_properties_conditional(player,{collisionbox = {-0.35,0,-0.35,0.35,0.8,0.35}, eye_height = 0.5, nametag_color = { r = 225, b = 225, a = 225, g = 225 }})
|
||||||
-- control body bone when flying
|
-- control body bone when flying
|
||||||
|
@ -349,6 +353,7 @@ minetest.register_globalstep(function(dtime)
|
||||||
set_bone_position_conditional(player,"Body_Control", vector.new(0,6.3,0), vector.new(0, -player_vel_yaw + yaw, 0))
|
set_bone_position_conditional(player,"Body_Control", vector.new(0,6.3,0), vector.new(0, -player_vel_yaw + yaw, 0))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
elytra.last_yaw = player:get_look_horizontal()
|
||||||
-- Update jump status immediately since we need this info in real time.
|
-- Update jump status immediately since we need this info in real time.
|
||||||
-- WARNING: This section is HACKY as hell since it is all just based on heuristics.
|
-- WARNING: This section is HACKY as hell since it is all just based on heuristics.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue