Don't apply player movement cheat detection in singleplayer
parent
8ecfd88d92
commit
491287c0af
|
@ -748,7 +748,7 @@ void LuaEntitySAO::sendPosition(bool do_interpolate, bool is_movement_end)
|
||||||
// No prototype, PlayerSAO does not need to be deserialized
|
// No prototype, PlayerSAO does not need to be deserialized
|
||||||
|
|
||||||
PlayerSAO::PlayerSAO(ServerEnvironment *env_, Player *player_, u16 peer_id_,
|
PlayerSAO::PlayerSAO(ServerEnvironment *env_, Player *player_, u16 peer_id_,
|
||||||
const std::set<std::string> &privs):
|
const std::set<std::string> &privs, bool is_singleplayer):
|
||||||
ServerActiveObject(env_, v3f(0,0,0)),
|
ServerActiveObject(env_, v3f(0,0,0)),
|
||||||
m_player(player_),
|
m_player(player_),
|
||||||
m_peer_id(peer_id_),
|
m_peer_id(peer_id_),
|
||||||
|
@ -761,6 +761,7 @@ PlayerSAO::PlayerSAO(ServerEnvironment *env_, Player *player_, u16 peer_id_,
|
||||||
m_armor_groups_sent(false),
|
m_armor_groups_sent(false),
|
||||||
m_properties_sent(true),
|
m_properties_sent(true),
|
||||||
m_privs(privs),
|
m_privs(privs),
|
||||||
|
m_is_singleplayer(is_singleplayer),
|
||||||
// public
|
// public
|
||||||
m_teleported(false),
|
m_teleported(false),
|
||||||
m_inventory_not_sent(false),
|
m_inventory_not_sent(false),
|
||||||
|
@ -866,6 +867,8 @@ void PlayerSAO::step(float dtime, bool send_recommended)
|
||||||
|
|
||||||
m_time_from_last_punch += dtime;
|
m_time_from_last_punch += dtime;
|
||||||
|
|
||||||
|
if(!m_is_singleplayer)
|
||||||
|
{
|
||||||
/*
|
/*
|
||||||
Check player movements
|
Check player movements
|
||||||
|
|
||||||
|
@ -911,6 +914,7 @@ void PlayerSAO::step(float dtime, bool send_recommended)
|
||||||
}
|
}
|
||||||
m_last_good_position_age = 0;
|
m_last_good_position_age = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(send_recommended == false)
|
if(send_recommended == false)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -106,7 +106,7 @@ class PlayerSAO : public ServerActiveObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PlayerSAO(ServerEnvironment *env_, Player *player_, u16 peer_id_,
|
PlayerSAO(ServerEnvironment *env_, Player *player_, u16 peer_id_,
|
||||||
const std::set<std::string> &privs);
|
const std::set<std::string> &privs, bool is_singleplayer);
|
||||||
~PlayerSAO();
|
~PlayerSAO();
|
||||||
u8 getType() const
|
u8 getType() const
|
||||||
{ return ACTIVEOBJECT_TYPE_PLAYER; }
|
{ return ACTIVEOBJECT_TYPE_PLAYER; }
|
||||||
|
@ -183,9 +183,11 @@ public:
|
||||||
m_time_from_last_punch = 0.0;
|
m_time_from_last_punch = 0.0;
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
void updatePrivileges(const std::set<std::string> &privs)
|
void updatePrivileges(const std::set<std::string> &privs,
|
||||||
|
bool is_singleplayer)
|
||||||
{
|
{
|
||||||
m_privs = privs;
|
m_privs = privs;
|
||||||
|
m_is_singleplayer = is_singleplayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -205,6 +207,7 @@ private:
|
||||||
struct ObjectProperties m_prop;
|
struct ObjectProperties m_prop;
|
||||||
// Cached privileges for enforcement
|
// Cached privileges for enforcement
|
||||||
std::set<std::string> m_privs;
|
std::set<std::string> m_privs;
|
||||||
|
bool m_is_singleplayer;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Some flags used by Server
|
// Some flags used by Server
|
||||||
|
|
|
@ -4323,7 +4323,8 @@ void Server::reportPrivsModified(const std::string &name)
|
||||||
return;
|
return;
|
||||||
SendPlayerPrivileges(player->peer_id);
|
SendPlayerPrivileges(player->peer_id);
|
||||||
player->getPlayerSAO()->updatePrivileges(
|
player->getPlayerSAO()->updatePrivileges(
|
||||||
getPlayerEffectivePrivs(name));
|
getPlayerEffectivePrivs(name),
|
||||||
|
isSingleplayer());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4527,7 +4528,8 @@ PlayerSAO* Server::emergePlayer(const char *name, u16 peer_id)
|
||||||
Create a new player active object
|
Create a new player active object
|
||||||
*/
|
*/
|
||||||
PlayerSAO *playersao = new PlayerSAO(m_env, player, peer_id,
|
PlayerSAO *playersao = new PlayerSAO(m_env, player, peer_id,
|
||||||
getPlayerEffectivePrivs(player->getName()));
|
getPlayerEffectivePrivs(player->getName()),
|
||||||
|
isSingleplayer());
|
||||||
|
|
||||||
/* Add object to environment */
|
/* Add object to environment */
|
||||||
m_env->addActiveObject(playersao);
|
m_env->addActiveObject(playersao);
|
||||||
|
|
Loading…
Reference in New Issue