3 Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #ifndef SERVERREMOTEPLAYER_HEADER
21 #define SERVERREMOTEPLAYER_HEADER
24 #include "serverobject.h"
25 #include "content_object.h" // Object type IDs
31 class ServerRemotePlayer : public Player, public ServerActiveObject
34 ServerRemotePlayer(ServerEnvironment *env);
35 ServerRemotePlayer(ServerEnvironment *env, v3f pos_, u16 peer_id_,
38 virtual ~ServerRemotePlayer();
40 virtual bool isLocal() const
43 virtual void move(f32 dtime, Map &map, f32 pos_max_d)
47 virtual void setPosition(const v3f &position);
49 /* ServerActiveObject interface */
52 {return ACTIVEOBJECT_TYPE_PLAYER;}
54 // Called after id has been set and has been inserted in environment
55 void addedToEnvironment();
56 // Called before removing from environment
57 void removingFromEnvironment();
59 bool environmentDeletes() const
62 virtual bool unlimitedTransferDistance() const;
64 bool isStaticAllowed() const
67 void step(float dtime, bool send_recommended);
68 std::string getClientInitializationData();
69 std::string getStaticData();
71 const ToolCapabilities *toolcap,
72 ServerActiveObject *puncher,
73 float time_from_last_punch);
74 void rightClick(ServerActiveObject *clicker);
76 void moveTo(v3f pos, bool continuous);
77 virtual std::string getDescription()
78 {return std::string("player ")+getName();}
80 virtual Inventory* getInventory();
81 virtual const Inventory* getInventory() const;
82 virtual InventoryLocation getInventoryLocation() const;
83 virtual void setInventoryModified();
84 virtual std::string getWieldList() const;
85 virtual int getWieldIndex() const;
86 virtual void setWieldIndex(int i);
88 virtual void setHP(s16 hp_);
91 v3f m_last_good_position;
92 float m_last_good_position_age;
94 bool m_inventory_not_sent;
96 bool m_is_in_environment;
97 // Incremented by step(), read and reset by Server
98 float m_time_from_last_punch;
101 bool m_position_not_sent;