#include "connection.h"
#include "constants.h"
#include "utility.h"
-
+#ifndef SERVER
+#include <ITextSceneNode.h>
+#endif
+#include "settings.h"
Player::Player():
touching_ground(false),
in_water(false),
in_water_stable(false),
+ is_climbing(false),
swimming_up(false),
+ is_frozen(false),
inventory_backup(NULL),
craftresult_is_preview(true),
hp(20),
/*
Calculate new position
*/
- position += m_speed * dtime;
+ if(is_frozen) {
+ // Still move very slowly so as not to feel all completely stuck
+ position += m_speed * dtime * 0.001;
+ }
+ else {
+ position += m_speed * dtime;
+ }
+
+ /*
+ If the player enters an unloaded chunk this is set to true.
+ */
+ is_frozen = false;
// Skip collision detection if a special movement mode is used
- bool free_move = g_settings.getBool("free_move");
+ bool free_move = g_settings->getBool("free_move");
if(free_move)
{
setPosition(position);
}
catch(InvalidPositionException &e)
{
- // Doing nothing here will block the player from
- // walking over map borders
+ if(!is_frozen) {
+ // freeze when entering unloaded areas
+ is_frozen = true;
+ }
+ continue;
}
core::aabbox3d<f32> nodebox = getNodeBox(v3s16(x,y,z), BS);
v3f speed = v3f(0,0,0);
- bool free_move = g_settings.getBool("free_move");
- bool fast_move = g_settings.getBool("fast_move");
- bool continuous_forward = g_settings.getBool("continuous_forward");
+ bool free_move = g_settings->getBool("free_move");
+ bool fast_move = g_settings->getBool("fast_move");
+ bool continuous_forward = g_settings->getBool("continuous_forward");
if(free_move || is_climbing)
{