mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-08 04:21:50 +00:00
add test.close_world(bool)
This commit is contained in:
parent
9b4dd8f65e
commit
d3f74b56fa
8 changed files with 30 additions and 11 deletions
|
|
@ -54,8 +54,9 @@ void LevelController::update(float delta, bool input, bool pause) {
|
|||
}
|
||||
|
||||
void LevelController::saveWorld() {
|
||||
level->getWorld()->wfile->createDirectories();
|
||||
logger.info() << "writing world";
|
||||
auto world = level->getWorld();
|
||||
logger.info() << "writing world '" << world->getName() << "'";
|
||||
world->wfile->createDirectories();
|
||||
scripting::on_world_save();
|
||||
level->onSave();
|
||||
level->getWorld()->write(level.get());
|
||||
|
|
|
|||
|
|
@ -69,10 +69,7 @@ static int l_close_world(lua::State* L) {
|
|||
if (save_world) {
|
||||
controller->saveWorld();
|
||||
}
|
||||
// destroy LevelScreen and run quit callbacks
|
||||
engine->setScreen(nullptr);
|
||||
// create and go to menu screen
|
||||
engine->setScreen(std::make_shared<MenuScreen>(engine));
|
||||
engine->onWorldClosed();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue