mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
feat: nameless worlds
This commit is contained in:
parent
b9707e11ca
commit
f772d527e2
3 changed files with 14 additions and 1 deletions
|
|
@ -108,6 +108,10 @@ void LevelController::update(float delta, bool pause) {
|
|||
|
||||
void LevelController::saveWorld() {
|
||||
auto world = level->getWorld();
|
||||
if (world->isNameless()) {
|
||||
logger.info() << "nameless world will not be saved";
|
||||
return;
|
||||
}
|
||||
logger.info() << "writing world '" << world->getName() << "'";
|
||||
world->wfile->createDirectories();
|
||||
scripting::on_world_save();
|
||||
|
|
|
|||
|
|
@ -94,7 +94,12 @@ std::unique_ptr<Level> World::create(
|
|||
content,
|
||||
packs
|
||||
);
|
||||
logger.info() << "created world '" << name << "' (" << directory.u8string() << ")";
|
||||
if (name.empty()) {
|
||||
logger.info() << "created nameless world";
|
||||
} else {
|
||||
logger.info() << "created world '" << name << "' ("
|
||||
<< directory.u8string() << ")";
|
||||
}
|
||||
logger.info() << "world seed: " << seed << " generator: " << generator;
|
||||
return std::make_unique<Level>(std::move(world), content, settings);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -140,6 +140,10 @@ public:
|
|||
/// @brief Get world generator id
|
||||
std::string getGenerator() const;
|
||||
|
||||
bool isNameless() const {
|
||||
return info.name.empty();
|
||||
}
|
||||
|
||||
WorldInfo& getInfo() {
|
||||
return info;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue