feat: add world and player tab item

This commit is contained in:
2026-04-25 18:36:13 +08:00
parent 8b5717a655
commit a95ad796ce
10 changed files with 260 additions and 38 deletions

View File

@@ -6,6 +6,7 @@
#include <Cubed/tools/cubed_assert.hpp>
#include <Cubed/tools/cubed_hash.hpp>
#include <Cubed/tools/math_tools.hpp>
#include <Cubed/tools/perlin_noise.hpp>
#include <execution>
@@ -671,4 +672,27 @@ void World::hot_reload() {
need_gen();
}
void World::rebuild_world() {
if (m_is_rebuilding) {
return;
}
m_is_rebuilding = true;
stop_gen_thread();
{
std::scoped_lock lk(m_chunks_mutex, m_new_chunk_queue_mutex);
m_chunks.clear();
m_new_chunk_queue.clear();
}
m_could_gen = true;
PerlinNoise::reload();
start_gen_thread();
need_gen();
m_is_rebuilding = false;
for (auto& player : m_players) {
player.second.set_player_pos({0.0f, 255.0f, 0.0f});
}
}
}