- v3f m_position;
-
-public:
-
-};
-
-/*
- Player on the server
-*/
-
-#include "serverobject.h"
-#include "content_object.h" // Object type IDs
-
-class ServerRemotePlayer : public Player, public ServerActiveObject
-{
-public:
- ServerRemotePlayer(ServerEnvironment *env);
- ServerRemotePlayer(ServerEnvironment *env, v3f pos_, u16 peer_id_,
- const char *name_);
-
- virtual ~ServerRemotePlayer();
-
- virtual bool isLocal() const
- { return false; }
-
- virtual void move(f32 dtime, Map &map, f32 pos_max_d)
- {
- }
-
- virtual void setPosition(const v3f &position)
- {
- Player::setPosition(position);
- ServerActiveObject::setBasePosition(position);
- }
-
- /* ServerActiveObject interface */
-
- u8 getType() const
- {return ACTIVEOBJECT_TYPE_PLAYER;}
-
- virtual void setPos(v3f pos)
- {
- setPosition(pos);
- // Movement caused by this command is always valid
- m_last_good_position = pos;
- m_last_good_position_age = 0;
- }
- virtual void moveTo(v3f pos, bool continuous)
- {
- setPosition(pos);
- // Movement caused by this command is always valid
- m_last_good_position = pos;
- m_last_good_position_age = 0;
- }
-
- virtual std::string getDescription(){return getName();}
- // Returns a reference
- virtual InventoryItem* getWieldedItem();
- virtual void damageWieldedItem(u16 amount);
- // If all fits, eats item and returns true. Otherwise returns false.
- virtual bool addToInventory(InventoryItem *item);
- virtual void addToInventoryLater(InventoryItem *item);
- void clearAddToInventoryLater();
- void completeAddToInventoryLater(u16 preferred_index);
- virtual void setHP(s16 hp_);
- virtual s16 getHP();
-
- v3f m_last_good_position;
- float m_last_good_position_age;
- std::vector<InventoryItem*> m_additional_items;
- bool m_inventory_not_sent;
- bool m_hp_not_sent;
-
-private:
-};
-
-#ifndef SERVER
-
-/*
- All the other players on the client are these
-*/
-
-class RemotePlayer : public Player, public scene::ISceneNode
-{
-public:
- RemotePlayer(
- IGameDef *gamedef,
- scene::ISceneNode* parent=NULL,
- IrrlichtDevice *device=NULL,
- s32 id=0);
-
- virtual ~RemotePlayer();
-
- /*
- ISceneNode methods
- */
-
- virtual void OnRegisterSceneNode()
- {
- if (IsVisible)
- SceneManager->registerNodeForRendering(this);
-
- ISceneNode::OnRegisterSceneNode();
- }
-
- virtual void render()
- {
- // Do nothing
- }
-
- virtual const core::aabbox3d<f32>& getBoundingBox() const
- {
- return m_box;
- }
-
- void setPosition(const v3f &position)
- {
- m_oldpos = m_showpos;
-
- if(m_pos_animation_time < 0.001 || m_pos_animation_time > 1.0)
- m_pos_animation_time = m_pos_animation_time_counter;
- else
- m_pos_animation_time = m_pos_animation_time * 0.9
- + m_pos_animation_time_counter * 0.1;
- m_pos_animation_time_counter = 0;
- m_pos_animation_counter = 0;
-
- Player::setPosition(position);
- //ISceneNode::setPosition(position);
- }
-
- virtual void setYaw(f32 yaw)
- {
- Player::setYaw(yaw);
- ISceneNode::setRotation(v3f(0, -yaw, 0));
- }
-
- bool isLocal() const
- {
- return false;
- }
-
- void updateName(const char *name);
-
- virtual void updateLight(u8 light_at_pos)
- {
- Player::updateLight(light_at_pos);
-
- if(m_node == NULL)
- return;
-
- u8 li = decode_light(light_at_pos);
- video::SColor color(255,li,li,li);
- setMeshVerticesColor(m_node->getMesh(), color);
- }
-
- void move(f32 dtime, Map &map, f32 pos_max_d);