Fix Swim toggling
This commit is contained in:
parent
d4401a6c3e
commit
8c1444a1a8
|
@ -158,10 +158,8 @@ minetest.register_globalstep(function(dtime)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- ask if player should be crawling
|
|
||||||
local block_in_head = minetest.registered_nodes[mcl_playerinfo[name].node_head]
|
|
||||||
-- ask if player is swiming
|
-- ask if player is swiming
|
||||||
local standing_on_water = minetest.get_item_group(mcl_playerinfo[name].node_head, "water") ~= 0
|
local head_in_water = minetest.get_item_group(mcl_playerinfo[name].node_head, "water") ~= 0
|
||||||
-- ask if player is sprinting
|
-- ask if player is sprinting
|
||||||
local is_sprinting = mcl_sprint.is_sprinting(name)
|
local is_sprinting = mcl_sprint.is_sprinting(name)
|
||||||
|
|
||||||
|
@ -173,32 +171,32 @@ minetest.register_globalstep(function(dtime)
|
||||||
player_anim[name] = nil
|
player_anim[name] = nil
|
||||||
player_sneak[name] = controls.sneak
|
player_sneak[name] = controls.sneak
|
||||||
end
|
end
|
||||||
if controls.LMB and not controls.sneak and standing_on_water and is_sprinting == true or block_in_head.walkable and controls.LMB then
|
if controls.LMB and not controls.sneak and head_in_water and is_sprinting == true then
|
||||||
player_set_animation(player, "swim_walk_mine", animation_speed_mod)
|
player_set_animation(player, "swim_walk_mine", animation_speed_mod)
|
||||||
elseif not controls.sneak and standing_on_water and is_sprinting == true or block_in_head.walkable then
|
elseif not controls.sneak and head_in_water and is_sprinting == true then
|
||||||
player_set_animation(player, "swim_walk", animation_speed_mod)
|
player_set_animation(player, "swim_walk", animation_speed_mod)
|
||||||
elseif is_sprinting == true and controls.LMB and not controls.sneak and not standing_on_water then
|
elseif is_sprinting == true and controls.LMB and not controls.sneak and not head_in_water then
|
||||||
player_set_animation(player, "run_walk_mine", animation_speed_mod)
|
player_set_animation(player, "run_walk_mine", animation_speed_mod)
|
||||||
elseif controls.LMB and not controls.sneak then
|
elseif controls.LMB and not controls.sneak then
|
||||||
player_set_animation(player, "walk_mine", animation_speed_mod)
|
player_set_animation(player, "walk_mine", animation_speed_mod)
|
||||||
elseif controls.LMB and controls.sneak and is_sprinting ~= true then
|
elseif controls.LMB and controls.sneak and is_sprinting ~= true then
|
||||||
player_set_animation(player, "sneak_walk_mine", animation_speed_mod)
|
player_set_animation(player, "sneak_walk_mine", animation_speed_mod)
|
||||||
elseif is_sprinting == true and not controls.sneak and not standing_on_water then
|
elseif is_sprinting == true and not controls.sneak and not head_in_water then
|
||||||
player_set_animation(player, "run_walk", animation_speed_mod)
|
player_set_animation(player, "run_walk", animation_speed_mod)
|
||||||
elseif controls.sneak and not controls.LMB then
|
elseif controls.sneak and not controls.LMB then
|
||||||
player_set_animation(player, "sneak_walk", animation_speed_mod)
|
player_set_animation(player, "sneak_walk", animation_speed_mod)
|
||||||
else
|
else
|
||||||
player_set_animation(player, "walk", animation_speed_mod)
|
player_set_animation(player, "walk", animation_speed_mod)
|
||||||
end
|
end
|
||||||
elseif controls.LMB and not controls.sneak and standing_on_water and is_sprinting == true or controls.LMB and block_in_head.walkable then
|
elseif controls.LMB and not controls.sneak and head_in_water and is_sprinting == true then
|
||||||
player_set_animation(player, "swim_mine")
|
player_set_animation(player, "swim_mine")
|
||||||
elseif not controls.LMB and not controls.sneak and standing_on_water and is_sprinting == true then
|
elseif not controls.LMB and not controls.sneak and head_in_water and is_sprinting == true then
|
||||||
player_set_animation(player, "swim_stand")
|
player_set_animation(player, "swim_stand")
|
||||||
elseif controls.LMB and not controls.sneak then
|
elseif controls.LMB and not controls.sneak then
|
||||||
player_set_animation(player, "mine")
|
player_set_animation(player, "mine")
|
||||||
elseif controls.LMB and controls.sneak then
|
elseif controls.LMB and controls.sneak then
|
||||||
player_set_animation(player, "sneak_mine")
|
player_set_animation(player, "sneak_mine")
|
||||||
elseif not controls.sneak and standing_on_water and is_sprinting == true then
|
elseif not controls.sneak and head_in_water and is_sprinting == true then
|
||||||
player_set_animation(player, "swim_stand", animation_speed_mod)
|
player_set_animation(player, "swim_stand", animation_speed_mod)
|
||||||
elseif not controls.sneak then
|
elseif not controls.sneak then
|
||||||
player_set_animation(player, "stand", animation_speed_mod)
|
player_set_animation(player, "stand", animation_speed_mod)
|
||||||
|
|
|
@ -42,9 +42,6 @@ minetest.register_globalstep(function(dtime)
|
||||||
player_vel_yaw = degrees(minetest.dir_to_yaw(player_velocity))
|
player_vel_yaw = degrees(minetest.dir_to_yaw(player_velocity))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local node_in_head = minetest.registered_nodes[mcl_playerinfo[name].node_head]
|
|
||||||
|
|
||||||
-- controls right and left arms pitch when shooting a bow or punching
|
-- controls right and left arms pitch when shooting a bow or punching
|
||||||
if string.find(player:get_wielded_item():get_name(), "mcl_bows:bow") and controls.RMB and not controls.LMB and not controls.up and not controls.down and not controls.left and not controls.right then
|
if string.find(player:get_wielded_item():get_name(), "mcl_bows:bow") and controls.RMB and not controls.LMB and not controls.up and not controls.down and not controls.left and not controls.right then
|
||||||
player:set_bone_position("Arm_Right_Pitch_Control", vector.new(-3,5.785,0), vector.new(pitch+90,-30,pitch * -1 * .35))
|
player:set_bone_position("Arm_Right_Pitch_Control", vector.new(-3,5.785,0), vector.new(pitch+90,-30,pitch * -1 * .35))
|
||||||
|
@ -64,7 +61,7 @@ minetest.register_globalstep(function(dtime)
|
||||||
player:set_properties({collisionbox = {-0.35,0,-0.35,0.35,1.8,0.35}, eye_height = 1.35, nametag_color = { r = 225, b = 225, a = 0, g = 225 }})
|
player:set_properties({collisionbox = {-0.35,0,-0.35,0.35,1.8,0.35}, eye_height = 1.35, nametag_color = { r = 225, b = 225, a = 0, g = 225 }})
|
||||||
-- sneaking body conrols
|
-- sneaking body conrols
|
||||||
player:set_bone_position("Body_Control", vector.new(0,6.3,0), vector.new(0,0,0))
|
player:set_bone_position("Body_Control", vector.new(0,6.3,0), vector.new(0,0,0))
|
||||||
elseif minetest.get_item_group(mcl_playerinfo[name].node_head, "water") ~= 0 and player:get_attach() == nil and mcl_sprint.is_sprinting(name) == true or node_in_head and node_in_head.walkable then
|
elseif minetest.get_item_group(mcl_playerinfo[name].node_head, "water") ~= 0 and player:get_attach() == nil and mcl_sprint.is_sprinting(name) == true then
|
||||||
-- set head pitch and yaw when swimming
|
-- set head pitch and yaw when swimming
|
||||||
player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch+90-degrees(dir_to_pitch(player_velocity)),yaw - player_vel_yaw * -1,0))
|
player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch+90-degrees(dir_to_pitch(player_velocity)),yaw - player_vel_yaw * -1,0))
|
||||||
-- sets eye height, and nametag color accordingly
|
-- sets eye height, and nametag color accordingly
|
||||||
|
|
Loading…
Reference in New Issue