}
//playerspeed.stop();
+ /*
+ Maximum position increment
+ */
+ //f32 position_max_increment = 0.05*BS;
+ f32 position_max_increment = 0.1*BS;
+
// Maximum time increment (for collision detection etc)
- // Allow 0.1 blocks per increment
// time = distance / speed
- f32 dtime_max_increment = 0.1*BS / maximum_player_speed;
+ f32 dtime_max_increment = position_max_increment / maximum_player_speed;
// Maximum time increment is 10ms or lower
if(dtime_max_increment > 0.01)
dtime_max_increment = 0.01;
v3f playerpos = player->getPosition();
// Apply physics to local player
- bool haxmode = g_settings.getBool("haxmode");
- if(player->isLocal() && haxmode == false)
+ bool free_move = g_settings.getBool("free_move");
+ if(player->isLocal() && free_move == false)
{
// Apply gravity to local player
v3f speed = player->getSpeed();
/*
Apply water resistance
*/
- if(player->in_water)
+ if(player->in_water_stable || player->in_water)
{
- f32 max_down = 1.0*BS;
+ f32 max_down = 2.0*BS;
if(speed.Y < -max_down) speed.Y = -max_down;
f32 max = 2.5*BS;
Move the player.
For local player, this also calculates collision detection.
*/
- player->move(dtime_part, *m_map);
+ player->move(dtime_part, *m_map, position_max_increment);
/*
Update lighting on remote players on client
/*
Add footsteps to grass
*/
- // Get node that is at BS/4 under player
- v3s16 bottompos = floatToInt(playerpos + v3f(0,-BS/4,0));
- try{
- MapNode n = m_map->getNode(bottompos);
- if(n.d == CONTENT_GRASS)
- {
- n.d = CONTENT_GRASS_FOOTSTEPS;
- m_map->setNode(bottompos, n);
-#ifndef SERVER
- // Update mesh on client
- if(m_map->mapType() == MAPTYPE_CLIENT)
+ if(g_settings.getBool("footprints"))
+ {
+ // Get node that is at BS/4 under player
+ v3s16 bottompos = floatToInt(playerpos + v3f(0,-BS/4,0));
+ try{
+ MapNode n = m_map->getNode(bottompos);
+ if(n.d == CONTENT_GRASS)
{
- v3s16 p_blocks = getNodeBlockPos(bottompos);
- MapBlock *b = m_map->getBlockNoCreate(p_blocks);
- b->updateMesh(m_daynight_ratio);
- }
+ n.d = CONTENT_GRASS_FOOTSTEPS;
+ m_map->setNode(bottompos, n);
+#ifndef SERVER
+ // Update mesh on client
+ if(m_map->mapType() == MAPTYPE_CLIENT)
+ {
+ v3s16 p_blocks = getNodeBlockPos(bottompos);
+ MapBlock *b = m_map->getBlockNoCreate(p_blocks);
+ b->updateMesh(m_daynight_ratio);
+ }
#endif
+ }
+ }
+ catch(InvalidPositionException &e)
+ {
}
- }
- catch(InvalidPositionException &e)
- {
}
}
}