fix: pack environment not passed to components
This commit is contained in:
@@ -492,6 +492,7 @@ void ContentLoader::loadScripts(Content& content) {
|
||||
load_scripts(content, content.items);
|
||||
|
||||
for (const auto& [packid, runtime] : content.getPacks()) {
|
||||
auto env = runtime->getEnvironment();
|
||||
const auto& pack = runtime->getInfo();
|
||||
const auto& folder = pack.folder;
|
||||
|
||||
@@ -500,9 +501,10 @@ void ContentLoader::loadScripts(Content& content) {
|
||||
|
||||
// Load entity components
|
||||
io::path componentsDir = folder / "scripts/components";
|
||||
foreach_file(componentsDir, [&pack](const io::path& file) {
|
||||
foreach_file(componentsDir, [&pack, env](const io::path& file) {
|
||||
auto name = pack.id + ":" + file.stem();
|
||||
scripting::load_entity_component(
|
||||
env,
|
||||
name,
|
||||
file,
|
||||
pack.id + ":scripts/components/" + file.name()
|
||||
|
||||
Reference in New Issue
Block a user