mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 11:01:49 +00:00
Added trees conversion function for old worlds (F9)
This commit is contained in:
parent
ca2f3cc649
commit
08701bca3c
1 changed files with 20 additions and 0 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue