mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
bug-fixin'
This commit is contained in:
parent
25a7fabed8
commit
dd9e82f5bc
24 changed files with 347 additions and 178 deletions
|
@ -30,7 +30,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
Player::Player():
|
||||
touching_ground(false),
|
||||
in_water(false),
|
||||
in_water_stable(false),
|
||||
swimming_up(false),
|
||||
peer_id(PEER_ID_INEXISTENT),
|
||||
m_pitch(0),
|
||||
m_yaw(0),
|
||||
m_speed(0,0,0),
|
||||
m_position(0,0,0)
|
||||
{
|
||||
|
@ -275,11 +279,10 @@ void LocalPlayer::move(f32 dtime, Map &map)
|
|||
position += m_speed * dtime;
|
||||
|
||||
bool free_move = g_settings.getBool("free_move");
|
||||
bool terrain_viewer = g_settings.getBool("terrain_viewer");
|
||||
|
||||
// Skip collision detection if player is non-local or
|
||||
// a special movement mode is used
|
||||
if(isLocal() == false || free_move || terrain_viewer)
|
||||
if(isLocal() == false || free_move)
|
||||
{
|
||||
setPosition(position);
|
||||
return;
|
||||
|
@ -292,7 +295,7 @@ void LocalPlayer::move(f32 dtime, Map &map)
|
|||
v3s16 pos_i = floatToInt(position);
|
||||
|
||||
/*
|
||||
Check if player is in water
|
||||
Check if player is in water (the oscillating value)
|
||||
*/
|
||||
try{
|
||||
if(in_water)
|
||||
|
@ -311,6 +314,18 @@ void LocalPlayer::move(f32 dtime, Map &map)
|
|||
in_water = false;
|
||||
}
|
||||
|
||||
/*
|
||||
Check if player is in water (the stable value)
|
||||
*/
|
||||
try{
|
||||
v3s16 pp = floatToInt(position + v3f(0,0,0));
|
||||
in_water_stable = content_liquid(map.getNode(pp).d);
|
||||
}
|
||||
catch(InvalidPositionException &e)
|
||||
{
|
||||
in_water_stable = false;
|
||||
}
|
||||
|
||||
// The frame length is limited to the player going 0.1*BS per call
|
||||
f32 d = (float)BS * 0.15;
|
||||
|
||||
|
@ -526,10 +541,12 @@ void LocalPlayer::applyControl(float dtime)
|
|||
speed.Y = 6.5*BS;
|
||||
setSpeed(speed);
|
||||
}
|
||||
// Use the oscillating value for getting out of water
|
||||
// (so that the player doesn't fly on the surface)
|
||||
else if(in_water)
|
||||
{
|
||||
v3f speed = getSpeed();
|
||||
speed.Y = 2.0*BS;
|
||||
speed.Y = 1.5*BS;
|
||||
setSpeed(speed);
|
||||
swimming_up = true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue