contentpack removal feature + refactor

This commit is contained in:
MihailRis
2024-03-11 13:21:06 +03:00
parent 3f0c710a47
commit daaba374a3
24 changed files with 345 additions and 295 deletions
+3 -3
View File
@@ -10,7 +10,7 @@ class Chunks;
class Lighting;
class WorldGenerator;
/* ChunksController manages chunks dynamic loading/unloading */
/// @brief ChunksController manages chunks dynamic loading/unloading
class ChunksController {
private:
Level* level;
@@ -19,7 +19,7 @@ private:
uint padding;
std::unique_ptr<WorldGenerator> generator;
/* Process one chunk: load it or calculate lights for it */
/// @brief Process one chunk: load it or calculate lights for it
bool loadVisible();
bool buildLights(std::shared_ptr<Chunk> chunk);
void createChunk(int x, int y);
@@ -27,7 +27,7 @@ public:
ChunksController(Level* level, uint padding);
~ChunksController();
/* @param maxDuration milliseconds reserved for chunks loading */
/// @param maxDuration milliseconds reserved for chunks loading
void update(int64_t maxDuration);
};
+6 -1
View File
@@ -1,10 +1,13 @@
#include "LevelController.h"
#include "../world/Level.h"
#include "../world/World.h"
#include "../physics/Hitbox.h"
#include "scripting/scripting.h"
#include "../interfaces/Object.h"
#include <iostream>
LevelController::LevelController(EngineSettings& settings, Level* level)
: settings(settings), level(level),
blocks(std::make_unique<BlocksController>(level, settings.chunks.padding)),
@@ -42,8 +45,10 @@ void LevelController::update(float delta, bool input, bool pause) {
}
}
void LevelController::onWorldSave() {
void LevelController::saveWorld() {
std::cout << "-- writing world" << std::endl;
scripting::on_world_save();
level->getWorld()->write(level.get());
}
void LevelController::onWorldQuit() {
+2 -1
View File
@@ -31,7 +31,8 @@ public:
bool pause
);
void onWorldSave();
void saveWorld();
void onWorldQuit();
Level* getLevel();