Merge branch 'main' into animation

This commit is contained in:
MihailRis 2026-07-27 23:09:14 +03:00
commit a5b1259c5b
24 changed files with 111 additions and 28 deletions

View file

@ -311,6 +311,10 @@ static int l_world_raycast(lua::State* L) {
entityRaycast.entityFilterExcludeMode = lua::toboolean(L, -1);
lua::pop(L);
}
if (lua::getfield(L, "nonselect_entities", 1)) {
entityRaycast.includeNonSelectable = lua::toboolean(L, -1);
lua::pop(L);
}
if (lua::getfield(L, "filter_blocks", 1)) {
load_blocks_filter(L, -1, filteredBlocks);
blocksRaycast.filter = &filteredBlocks;

View file

@ -744,9 +744,10 @@ void scripting::load_entity_component(
const io::path& file,
const std::string& fileName
) {
logger.info() << "script (component) " << file.string();
auto L = lua::get_main_state();
std::string src = io::read_string(file);
logger.info() << "script (component) " << file.string();
lua::loadbuffer(L, *env, src, fileName);
lua::store_in_registry(L, lua::CHUNKS_TABLE, name);
}

View file

@ -153,7 +153,12 @@ void scripting::on_entity_spawn(
lua::call(L, 1);
}
for (auto& component : components) {
create_component(L, -1, *component, args, saved);
try {
create_component(L, -1, *component, args, saved);
} catch (const std::runtime_error& err) {
logger.error() << "could not to initialize user component "
<< component->name << ": " << err.what();
}
}
for (auto& [packid, pack] : content->getPacks()) {
@ -171,6 +176,9 @@ static void process_entity_callback(
const std::string& name,
std::function<int(lua::State*)> args
) {
if (env == nullptr) {
return;
}
auto L = lua::get_main_state();
lua::pushenv(L, *env);
if (lua::hasfield(L, "__disabled")) {