add Players

This commit is contained in:
MihailRis
2024-11-23 05:14:12 +03:00
parent 5f496eecb2
commit 7027bd6f28
8 changed files with 125 additions and 68 deletions
+3 -10
View File
@@ -7,10 +7,6 @@
#include "typedefs.hpp"
inline constexpr float DEF_PLAYER_Y = 100.0f;
inline constexpr float DEF_PLAYER_SPEED = 4.0f;
inline constexpr int DEF_PLAYER_INVENTORY_SIZE = 40;
class Content;
class World;
class Chunks;
@@ -21,7 +17,7 @@ class Lighting;
class PhysicsSolver;
class ChunksStorage;
class Camera;
class Player;
class Players;
struct EngineSettings;
/// @brief A level, contains chunks and objects
@@ -29,7 +25,7 @@ class Level {
std::unique_ptr<World> world;
public:
const Content* const content;
std::unordered_map<int64_t, std::unique_ptr<Player>> players;
std::unique_ptr<Chunks> chunks;
std::unique_ptr<ChunksStorage> chunksStorage;
std::unique_ptr<Inventories> inventories;
@@ -38,6 +34,7 @@ public:
std::unique_ptr<Lighting> lighting;
std::unique_ptr<LevelEvents> events;
std::unique_ptr<Entities> entities;
std::unique_ptr<Players> players;
std::vector<std::shared_ptr<Camera>> cameras; // move somewhere?
const EngineSettings& settings;
@@ -55,10 +52,6 @@ public:
const World* getWorld() const;
void addPlayer(std::unique_ptr<Player> player);
Player* getPlayer(int64_t id) const;
void onSave();
std::shared_ptr<Camera> getCamera(const std::string& name);