add entity events: on_spawn, on_despawn

This commit is contained in:
MihailRis
2024-06-28 12:16:31 +03:00
parent e1eb652ef4
commit eb2be5e8b6
13 changed files with 116 additions and 22 deletions
+5
View File
@@ -321,6 +321,11 @@ void ContentLoader::loadEntity(EntityDef& def, const std::string& full, const st
auto folder = pack->folder;
auto configFile = folder/fs::path("entities/"+name+".json");
if (fs::exists(configFile)) loadEntity(def, full, configFile);
auto scriptfile = folder/fs::path("scripts/"+def.scriptName+".lua");
if (fs::is_regular_file(scriptfile)) {
scripting::load_entity_script(env, full, scriptfile, def.rt.funcsset);
}
}
void ContentLoader::loadBlock(Block& def, const std::string& full, const std::string& name) {