mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-11-24 20:03:45 +01:00
Merge pull request 'elytra_animation_fix' (#2805) from elytra_animation_fix into master
Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/2805 Reviewed-by: cora <cora@noreply.git.minetest.land>
This commit is contained in:
commit
4e4bd8f978
@ -91,7 +91,7 @@ local function update_player_textures(player)
|
||||
end
|
||||
|
||||
player:set_properties({ textures = textures })
|
||||
|
||||
|
||||
-- Delay calling the callbacks because mods (including mcl_player)
|
||||
-- need to fully initialize player data from minetest.register_on_joinplayer
|
||||
-- before callbacks run
|
||||
@ -234,6 +234,8 @@ minetest.register_globalstep(function(dtime)
|
||||
-- Apply animations based on what the player is doing
|
||||
if player:get_hp() == 0 then
|
||||
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
|
||||
or walking and velocity.x < -0.35
|
||||
or walking and velocity.z > 0.35
|
||||
|
@ -196,6 +196,10 @@ minetest.register_globalstep(function(dtime)
|
||||
elytra.speed = 0
|
||||
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
|
||||
mcl_playerplus.is_pressing_jump[name] = control.jump
|
||||
if is_just_jumped and not elytra.active then
|
||||
@ -314,7 +318,7 @@ minetest.register_globalstep(function(dtime)
|
||||
|
||||
if elytra.active then
|
||||
-- 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
|
||||
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
|
||||
@ -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))
|
||||
end
|
||||
|
||||
elytra.last_yaw = player:get_look_horizontal()
|
||||
-- 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.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user