Some sneaking changes; fix glitch ladders :-D

This commit is contained in:
Calinou 2013-01-06 13:13:38 +01:00
parent ae898a3b9e
commit 15f81d3c99
1 changed files with 9 additions and 9 deletions

View File

@ -153,7 +153,7 @@ void LocalPlayer::move(f32 dtime, Map &map, f32 pos_max_d,
float player_height = BS*1.55; float player_height = BS*1.55;
// Maximum distance over border for sneaking // Maximum distance over border for sneaking
f32 sneak_max = BS*0.4; f32 sneak_max = BS*0.3;
/* /*
If sneaking, keep in range from the last walked node and don't If sneaking, keep in range from the last walked node and don't
@ -267,8 +267,8 @@ void LocalPlayer::move(f32 dtime, Map &map, f32 pos_max_d,
// The node to be sneaked on has to be walkable // The node to be sneaked on has to be walkable
if(nodemgr->get(map.getNode(p)).walkable == false) if(nodemgr->get(map.getNode(p)).walkable == false)
continue; continue;
// And the node above it has to be nonwalkable // And the two nodes above it have to be non-walkable
if(nodemgr->get(map.getNode(p+v3s16(0,1,0))).walkable == true) if(nodemgr->get(map.getNode(p+v3s16(0,1,0))).walkable == true || nodemgr->get(map.getNode(p+v3s16(0,2,0))).walkable == true)
continue; continue;
} }
catch(InvalidPositionException &e) catch(InvalidPositionException &e)
@ -284,7 +284,7 @@ void LocalPlayer::move(f32 dtime, Map &map, f32 pos_max_d,
m_sneak_node = new_sneak_node; m_sneak_node = new_sneak_node;
m_sneak_node_exists = sneak_node_found; m_sneak_node_exists = sneak_node_found;
/* /*
If sneaking, the player's collision box can be in air, so If sneaking, the player's collision box can be in air, so
this has to be set explicitly this has to be set explicitly
@ -302,7 +302,7 @@ void LocalPlayer::move(f32 dtime, Map &map, f32 pos_max_d,
Report collisions Report collisions
*/ */
bool bouncy_jump = false; bool bouncy_jump = false;
// Dont report if flying // Don't report if flying
if(collision_info && !(g_settings->getBool("free_move") && fly_allowed)) if(collision_info && !(g_settings->getBool("free_move") && fly_allowed))
{ {
for(size_t i=0; i<result.collisions.size(); i++){ for(size_t i=0; i<result.collisions.size(); i++){
@ -336,7 +336,7 @@ void LocalPlayer::move(f32 dtime, Map &map, f32 pos_max_d,
} }
} }
} }
/* /*
Update the node last under the player Update the node last under the player
*/ */
@ -369,7 +369,7 @@ void LocalPlayer::applyControl(float dtime)
setPitch(control.pitch); setPitch(control.pitch);
setYaw(control.yaw); setYaw(control.yaw);
// Nullify speed and don't run positioning code if the player is attached // Nullify speed and don't run positioning code if the player is attached
if(isAttached) if(isAttached)
{ {
@ -434,7 +434,7 @@ void LocalPlayer::applyControl(float dtime)
} }
} }
} }
// New minecraft-like descend control // New Minecraft-like descend control
else else
{ {
// Auxiliary button 1 (E) // Auxiliary button 1 (E)
@ -550,7 +550,7 @@ void LocalPlayer::applyControl(float dtime)
if(superspeed) if(superspeed)
speed = speed.normalize() * walkspeed_max * 5.0; speed = speed.normalize() * walkspeed_max * 5.0;
else if(control.sneak && !free_move) else if(control.sneak && !free_move)
speed = speed.normalize() * walkspeed_max / 3.0; speed = speed.normalize() * walkspeed_max / 2.0;
else else
speed = speed.normalize() * walkspeed_max; speed = speed.normalize() * walkspeed_max;