Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+GNU Lesser General Public License for more details.
-You should have received a copy of the GNU General Public License along
+You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
{
public:
PlayerSAO(ServerEnvironment *env_, Player *player_, u16 peer_id_,
- const std::set<std::string> &privs);
+ const std::set<std::string> &privs, bool is_singleplayer);
~PlayerSAO();
u8 getType() const
{ return ACTIVEOBJECT_TYPE_PLAYER; }
void disconnected();
- void createCreativeInventory();
-
Player* getPlayer()
{
return m_player;
{
return m_peer_id;
}
+
+ // Cheat prevention
+
v3f getLastGoodPosition() const
{
return m_last_good_position;
m_time_from_last_punch = 0.0;
return r;
}
- void updatePrivileges(const std::set<std::string> &privs)
+ void noCheatDigStart(v3s16 p)
+ {
+ m_nocheat_dig_pos = p;
+ m_nocheat_dig_time = 0;
+ }
+ v3s16 getNoCheatDigPos()
+ {
+ return m_nocheat_dig_pos;
+ }
+ float getNoCheatDigTime()
+ {
+ return m_nocheat_dig_time;
+ }
+ void noCheatDigEnd()
+ {
+ m_nocheat_dig_pos = v3s16(32767, 32767, 32767);
+ }
+
+ // Other
+
+ void updatePrivileges(const std::set<std::string> &privs,
+ bool is_singleplayer)
{
m_privs = privs;
+ m_is_singleplayer = is_singleplayer;
}
private:
Player *m_player;
u16 m_peer_id;
Inventory *m_inventory;
+
+ // Cheat prevention
v3f m_last_good_position;
float m_last_good_position_age;
float m_time_from_last_punch;
+ v3s16 m_nocheat_dig_pos;
+ float m_nocheat_dig_time;
+
int m_wield_index;
bool m_position_not_sent;
ItemGroupList m_armor_groups;
struct ObjectProperties m_prop;
// Cached privileges for enforcement
std::set<std::string> m_privs;
+ bool m_is_singleplayer;
public:
// Some flags used by Server