mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-22 10:31:06 +01:00
Make swimming a bit smoother
This commit is contained in:
parent
30b1d58e67
commit
98f6e05cdc
2 changed files with 11 additions and 7 deletions
|
@ -156,10 +156,12 @@ minetest.register_globalstep(function(dtime)
|
||||||
animation_speed_mod = animation_speed_mod / 2
|
animation_speed_mod = animation_speed_mod / 2
|
||||||
end
|
end
|
||||||
|
|
||||||
-- ask if player is in a place which he should crawl
|
|
||||||
local node_in_feet = minetest.registered_nodes[mcl_playerinfo[name].node_feet]
|
|
||||||
|
-- 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_feet, "water") ~= 0
|
local standing_on_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)
|
||||||
|
|
||||||
|
@ -171,9 +173,9 @@ 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 then
|
if controls.LMB and not controls.sneak and standing_on_water and is_sprinting == true or block_in_head.walkable and controls.LMB 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 then
|
elseif not controls.sneak and standing_on_water and is_sprinting == true or block_in_head.walkable 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 standing_on_water then
|
||||||
player_set_animation(player, "run_walk_mine", animation_speed_mod)
|
player_set_animation(player, "run_walk_mine", animation_speed_mod)
|
||||||
|
@ -188,8 +190,10 @@ minetest.register_globalstep(function(dtime)
|
||||||
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 then
|
elseif controls.LMB and not controls.sneak and standing_on_water and is_sprinting == true or controls.LMB and block_in_head.walkable 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 or not controls.LMB and block_in_head.walkable then
|
||||||
|
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
|
||||||
|
|
|
@ -45,7 +45,7 @@ minetest.register_globalstep(function(dtime)
|
||||||
-- sets eye height, and nametag color accordingly
|
-- sets eye height, and nametag color accordingly
|
||||||
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 }})
|
||||||
|
|
||||||
elseif minetest.get_item_group(mcl_playerinfo[name].node_feet, "water") ~= 0 and player:get_attach() == nil and mcl_sprint.is_sprinting(name) == true 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 or minetest.registered_nodes[mcl_playerinfo[name].node_head].walkable then
|
||||||
-- controls head pitch when swiming
|
-- controls head pitch when swiming
|
||||||
player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch+90,0,0))
|
player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch+90,0,0))
|
||||||
-- sets eye height, and nametag color accordingly
|
-- sets eye height, and nametag color accordingly
|
||||||
|
|
Loading…
Reference in a new issue