mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-06 11:31:49 +00:00
added hud.lua script
This commit is contained in:
parent
33d14be71c
commit
dabf42162c
5 changed files with 76 additions and 10 deletions
|
|
@ -21,6 +21,7 @@
|
|||
#include "../objects/Player.h"
|
||||
#include "../logic/ChunksController.h"
|
||||
#include "../logic/LevelController.h"
|
||||
#include "../logic/scripting/scripting.h"
|
||||
#include "../logic/scripting/scripting_frontend.h"
|
||||
#include "../voxels/Chunks.h"
|
||||
#include "../voxels/Chunk.h"
|
||||
|
|
@ -97,11 +98,21 @@ LevelScreen::LevelScreen(Engine* engine, Level* level)
|
|||
|
||||
animator.reset(new TextureAnimator());
|
||||
animator->addAnimations(engine->getAssets()->getAnimations());
|
||||
|
||||
auto content = level->content;
|
||||
for (auto& pack : content->getPacks()) {
|
||||
const ContentPack& info = pack->getInfo();
|
||||
fs::path scriptFile = info.folder/fs::path("scripts/hud.lua");
|
||||
if (fs::is_regular_file(scriptFile)) {
|
||||
scripting::load_hud_script(pack->getEnvironment()->getId(), info.id, scriptFile);
|
||||
}
|
||||
}
|
||||
scripting::on_frontend_init(hud.get());
|
||||
}
|
||||
|
||||
LevelScreen::~LevelScreen() {
|
||||
std::cout << "-- writing world" << std::endl;
|
||||
scripting::on_frontend_close();
|
||||
controller->onWorldSave();
|
||||
auto world = level->getWorld();
|
||||
world->write(level.get());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue