feat: nameless worlds
This commit is contained in:
parent
b9707e11ca
commit
f772d527e2
@ -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…
x
Reference in New Issue
Block a user