forked from Mirrorlandia_minetest/minetest
Fixing ladders again
This commit is contained in:
parent
8e67f4c4e6
commit
267744a568
@ -1511,6 +1511,8 @@ void ClientEnvironment::step(float dtime)
|
|||||||
/*
|
/*
|
||||||
Get the speed the player is going
|
Get the speed the player is going
|
||||||
*/
|
*/
|
||||||
|
bool is_climbing = lplayer->is_climbing;
|
||||||
|
|
||||||
f32 player_speed = 0.001; // just some small value
|
f32 player_speed = 0.001; // just some small value
|
||||||
player_speed = lplayer->getSpeed().getLength();
|
player_speed = lplayer->getSpeed().getLength();
|
||||||
|
|
||||||
@ -1568,7 +1570,7 @@ void ClientEnvironment::step(float dtime)
|
|||||||
v3f lplayerpos = lplayer->getPosition();
|
v3f lplayerpos = lplayer->getPosition();
|
||||||
|
|
||||||
// Apply physics
|
// Apply physics
|
||||||
if(free_move == false)
|
if(free_move == false && is_climbing == false)
|
||||||
{
|
{
|
||||||
// Gravity
|
// Gravity
|
||||||
v3f speed = lplayer->getSpeed();
|
v3f speed = lplayer->getSpeed();
|
||||||
|
@ -382,8 +382,8 @@ void LocalPlayer::move(f32 dtime, Map &map, f32 pos_max_d,
|
|||||||
try {
|
try {
|
||||||
v3s16 pp = floatToInt(position + v3f(0,0.5*BS,0), BS);
|
v3s16 pp = floatToInt(position + v3f(0,0.5*BS,0), BS);
|
||||||
v3s16 pp2 = floatToInt(position + v3f(0,-0.2*BS,0), BS);
|
v3s16 pp2 = floatToInt(position + v3f(0,-0.2*BS,0), BS);
|
||||||
is_climbing = (content_features(map.getNode(pp).getContent()).climbable ||
|
is_climbing = ((content_features(map.getNode(pp).getContent()).climbable ||
|
||||||
content_features(map.getNode(pp2).getContent()).climbable);
|
content_features(map.getNode(pp2).getContent()).climbable) && !free_move);
|
||||||
}
|
}
|
||||||
catch(InvalidPositionException &e)
|
catch(InvalidPositionException &e)
|
||||||
{
|
{
|
||||||
@ -738,7 +738,7 @@ void LocalPlayer::applyControl(float dtime)
|
|||||||
bool fast_move = g_settings.getBool("fast_move");
|
bool fast_move = g_settings.getBool("fast_move");
|
||||||
bool continuous_forward = g_settings.getBool("continuous_forward");
|
bool continuous_forward = g_settings.getBool("continuous_forward");
|
||||||
|
|
||||||
if(free_move)
|
if(free_move || is_climbing)
|
||||||
{
|
{
|
||||||
v3f speed = getSpeed();
|
v3f speed = getSpeed();
|
||||||
speed.Y = 0;
|
speed.Y = 0;
|
||||||
@ -765,6 +765,12 @@ void LocalPlayer::applyControl(float dtime)
|
|||||||
speed.Y = -walkspeed_max;
|
speed.Y = -walkspeed_max;
|
||||||
setSpeed(speed);
|
setSpeed(speed);
|
||||||
}
|
}
|
||||||
|
else if(is_climbing)
|
||||||
|
{
|
||||||
|
v3f speed = getSpeed();
|
||||||
|
speed.Y = -3*BS;
|
||||||
|
setSpeed(speed);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// If not free movement but fast is allowed, aux1 is
|
// If not free movement but fast is allowed, aux1 is
|
||||||
@ -827,17 +833,10 @@ void LocalPlayer::applyControl(float dtime)
|
|||||||
setSpeed(speed);
|
setSpeed(speed);
|
||||||
swimming_up = true;
|
swimming_up = true;
|
||||||
}
|
}
|
||||||
}
|
else if(is_climbing)
|
||||||
|
{
|
||||||
if (is_climbing) {
|
|
||||||
if (control.up || control.left || control.right || control.down) {
|
|
||||||
v3f speed = getSpeed();
|
v3f speed = getSpeed();
|
||||||
speed.Y = 2.5*BS;
|
speed.Y = 3*BS;
|
||||||
setSpeed(speed);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
v3f speed = getSpeed();
|
|
||||||
speed.Y = -2*BS;
|
|
||||||
setSpeed(speed);
|
setSpeed(speed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user