This commit is contained in:
MihailRis
2024-02-05 22:30:23 +03:00
parent 62600318d7
commit 52e60c979b
3 changed files with 51 additions and 37 deletions
+4
View File
@@ -25,6 +25,7 @@ Engine* scripting::engine = nullptr;
lua::LuaState* scripting::state = nullptr;
Level* scripting::level = nullptr;
const Content* scripting::content = nullptr;
const ContentIndices* scripting::indices = nullptr;
BlocksController* scripting::blocks = nullptr;
void load_script(fs::path name) {
@@ -77,6 +78,7 @@ wstringconsumer scripting::create_wstring_consumer(
void scripting::on_world_load(Level* level, BlocksController* blocks) {
scripting::level = level;
scripting::content = level->content;
scripting::indices = level->content->getIndices();
scripting::blocks = blocks;
load_script("world.lua");
@@ -103,6 +105,7 @@ void scripting::on_world_quit() {
}
scripting::level = nullptr;
scripting::content = nullptr;
scripting::indices = nullptr;
}
void scripting::on_blocks_tick(const Block* block, int tps) {
@@ -224,5 +227,6 @@ void scripting::close() {
state = nullptr;
content = nullptr;
indices = nullptr;
level = nullptr;
}