fix: pack environment not passed to components

This commit is contained in:
MihailRis
2025-12-08 19:21:49 +03:00
committed by ShiftyX1
parent 59df377fde
commit 5ae34c2dc2
4 changed files with 19 additions and 4 deletions
+3 -1
View File
@@ -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()