mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-06 19:41:51 +00:00
fix: pack environment not passed to components
This commit is contained in:
parent
c0d326061e
commit
69cf4c1c04
4 changed files with 19 additions and 4 deletions
|
|
@ -1,6 +1,7 @@
|
|||
#include "libentity.hpp"
|
||||
|
||||
#include "content/Content.hpp"
|
||||
#include "content/ContentPack.hpp"
|
||||
#include "engine/Engine.hpp"
|
||||
#include "engine/EnginePaths.hpp"
|
||||
#include "objects/Entities.hpp"
|
||||
|
|
@ -236,7 +237,14 @@ static int l_reload_component(lua::State* L) {
|
|||
}
|
||||
auto filename = name.substr(0, pos + 1) + "scripts/components/" +
|
||||
name.substr(pos + 1) + ".lua";
|
||||
scripting::load_entity_component(name, filename, filename);
|
||||
auto prefix = name.substr(0, pos);
|
||||
auto runtime = content->getPackRuntime(prefix);
|
||||
if (runtime == nullptr) {
|
||||
throw std::runtime_error("pack '" + prefix + "' content is not loaded");
|
||||
}
|
||||
scripting::load_entity_component(
|
||||
runtime->getEnvironment(), name, filename, filename
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue