Added trees conversion function for old worlds (F9)

This commit is contained in:
MihailRis 2023-12-05 20:22:38 +03:00
parent ca2f3cc649
commit 08701bca3c

View File

@ -32,6 +32,9 @@
#include "gui/panels.h"
#include "menu.h"
#include "../content/Content.h"
#include "../voxels/Block.h"
using std::string;
using std::wstring;
using glm::vec3;
@ -125,6 +128,23 @@ void LevelScreen::updateHotkeys() {
if (Events::jpressed(keycode::F5)) {
level->chunks->saveAndClear();
}
// TODO: remove in v0.16
if (Events::jpressed(keycode::F9)) {
blockid_t woodid = level->content->require("base:wood")->rt.id;
for (size_t i = 0; i < level->chunks->volume; i++){
Chunk* chunk = level->chunks->chunks[i].get();
if (chunk) {
for (uint i = 0; i < CHUNK_VOL; i++) {
auto& vox = chunk->voxels[i];
if (vox.id == woodid) {
vox.states = BLOCK_DIR_UP;
}
}
}
}
level->chunks->saveAndClear();
}
}
void LevelScreen::update(float delta) {