mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
add block.materials table
This commit is contained in:
parent
a641099d36
commit
8543be87df
3 changed files with 23 additions and 0 deletions
|
|
@ -160,6 +160,18 @@ void scripting::process_post_runnables() {
|
|||
void scripting::on_content_load(Content* content) {
|
||||
scripting::content = content;
|
||||
scripting::indices = content->getIndices();
|
||||
|
||||
auto L = lua::get_main_state();
|
||||
if (lua::getglobal(L, "block")) {
|
||||
const auto& materials = content->getBlockMaterials();
|
||||
lua::createtable(L, 0, materials.size());
|
||||
for (const auto& [name, material] : materials) {
|
||||
lua::pushvalue(L, material->serialize());
|
||||
lua::setfield(L, name);
|
||||
}
|
||||
lua::setfield(L, "materials");
|
||||
lua::pop(L);
|
||||
}
|
||||
}
|
||||
|
||||
void scripting::on_world_load(LevelController* controller) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue