mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 19:11:50 +00:00
add 'on_block_removed' event
This commit is contained in:
parent
b3e5f2a1c0
commit
f721731ecc
12 changed files with 61 additions and 16 deletions
|
|
@ -27,7 +27,8 @@ LevelController::LevelController(
|
|||
: settings(engine->getSettings()),
|
||||
level(std::move(levelPtr)),
|
||||
chunks(std::make_unique<ChunksController>(*level)),
|
||||
playerTickClock(20, 3) {
|
||||
playerTickClock(20, 3),
|
||||
localPlayer(clientPlayer) {
|
||||
|
||||
level->events->listen(LevelEventType::CHUNK_PRESENT, [](auto, Chunk* chunk) {
|
||||
scripting::on_chunk_present(*chunk, chunk->flags.loaded);
|
||||
|
|
@ -121,6 +122,13 @@ void LevelController::update(float delta, bool pause) {
|
|||
level->entities->clean();
|
||||
}
|
||||
|
||||
void LevelController::processBeforeQuit() {
|
||||
if (localPlayer) {
|
||||
localPlayer->chunks->saveAndClear();
|
||||
}
|
||||
scripting::process_before_quit();
|
||||
}
|
||||
|
||||
void LevelController::saveWorld() {
|
||||
auto world = level->getWorld();
|
||||
if (world->isNameless()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue