added hud.lua script
This commit is contained in:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user