2019-01-23 00:04:03 +01:00
|
|
|
/*
|
|
|
|
* =====================================================================================
|
|
|
|
*
|
2020-02-08 18:34:26 +09:00
|
|
|
* OpenMiner
|
2020-02-25 01:42:10 +09:00
|
|
|
*
|
2020-02-08 18:34:26 +09:00
|
|
|
* Copyright (C) 2018-2020 Unarelith, Quentin Bazin <openminer@unarelith.net>
|
2020-02-25 01:42:10 +09:00
|
|
|
* Copyright (C) 2019-2020 the OpenMiner contributors (see CONTRIBUTORS.md)
|
|
|
|
*
|
|
|
|
* This file is part of OpenMiner.
|
2019-01-23 00:04:03 +01:00
|
|
|
*
|
2020-02-25 01:42:10 +09:00
|
|
|
* OpenMiner is free software; you can redistribute it and/or
|
2020-02-08 18:34:26 +09:00
|
|
|
* modify 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.
|
2019-01-23 00:04:03 +01:00
|
|
|
*
|
2020-02-25 01:42:10 +09:00
|
|
|
* OpenMiner is distributed in the hope that it will be useful,
|
2020-02-08 18:34:26 +09:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2019-01-23 00:04:03 +01:00
|
|
|
*
|
2020-02-08 18:34:26 +09:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
2020-02-25 01:42:10 +09:00
|
|
|
* along with OpenMiner; if not, write to the Free Software Foundation, Inc.,
|
2020-02-08 18:34:26 +09:00
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
2019-01-23 00:04:03 +01:00
|
|
|
*
|
|
|
|
* =====================================================================================
|
|
|
|
*/
|
|
|
|
#ifndef PLAYER_HPP_
|
|
|
|
#define PLAYER_HPP_
|
|
|
|
|
2020-02-18 18:37:51 +09:00
|
|
|
#include <gk/core/Box.hpp>
|
|
|
|
|
2019-01-23 00:04:03 +01:00
|
|
|
#include "Inventory.hpp"
|
|
|
|
#include "ISerializable.hpp"
|
|
|
|
|
|
|
|
class Player : public ISerializable {
|
|
|
|
public:
|
2020-02-18 18:37:51 +09:00
|
|
|
Player();
|
|
|
|
|
2020-01-31 15:04:04 +09:00
|
|
|
void serialize(sf::Packet &packet) const override;
|
2019-01-23 00:04:03 +01:00
|
|
|
void deserialize(sf::Packet &packet) override;
|
|
|
|
|
2019-03-17 16:56:26 +01:00
|
|
|
s32 x() const { return m_x; }
|
|
|
|
s32 y() const { return m_y; }
|
2019-04-07 17:20:35 +02:00
|
|
|
s32 z() const { return m_z; }
|
2019-03-17 16:56:26 +01:00
|
|
|
|
2019-01-23 00:04:03 +01:00
|
|
|
Inventory &inventory() { return m_inventory; }
|
|
|
|
|
2019-04-08 15:29:19 +02:00
|
|
|
u16 clientID() const { return m_clientID; }
|
|
|
|
|
2019-04-07 17:20:35 +02:00
|
|
|
void setPosition(s32 x, s32 y, s32 z) { m_x = x; m_y = y; m_z = z; }
|
2019-04-08 15:29:19 +02:00
|
|
|
void setClientID(u16 clientID) { m_clientID = clientID; }
|
2019-04-07 17:20:35 +02:00
|
|
|
|
2020-02-18 18:37:51 +09:00
|
|
|
const gk::FloatBox &hitbox() const { return m_hitbox; }
|
|
|
|
|
2019-01-23 00:04:03 +01:00
|
|
|
protected:
|
2019-03-17 16:56:26 +01:00
|
|
|
s32 m_x = 0;
|
|
|
|
s32 m_y = 0;
|
2019-04-07 17:20:35 +02:00
|
|
|
s32 m_z = 0;
|
2019-03-17 16:56:26 +01:00
|
|
|
|
2019-04-08 15:29:19 +02:00
|
|
|
u16 m_clientID = 0;
|
|
|
|
|
2019-01-23 00:04:03 +01:00
|
|
|
Inventory m_inventory{9, 4};
|
2020-02-18 18:37:51 +09:00
|
|
|
|
|
|
|
gk::FloatBox m_hitbox;
|
2019-01-23 00:04:03 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // PLAYER_HPP_
|