1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-13 16:45:20 +02:00

Add core.spawn_tree_on_vmanip (#15415)

This function works like `core.spawn_tree`, but spawns an L-system tree onto a VoxelManip object instead on the map.
This commit is contained in:
cx384
2024-12-08 20:27:22 +01:00
committed by GitHub
parent 8d43ad2522
commit c7fe2ee5c9
9 changed files with 110 additions and 10 deletions

View File

@@ -1307,11 +1307,7 @@ int ModApiEnv::l_spawn_tree(lua_State *L)
ServerMap *map = &env->getServerMap();
treegen::error e;
if ((e = treegen::spawn_ltree (map, p0, tree_def)) != treegen::SUCCESS) {
if (e == treegen::UNBALANCED_BRACKETS) {
luaL_error(L, "spawn_tree(): closing ']' has no matching opening bracket");
} else {
luaL_error(L, "spawn_tree(): unknown error");
}
throw LuaError("spawn_tree(): " + treegen::error_to_string(e));
}
lua_pushboolean(L, true);
@@ -1614,11 +1610,7 @@ int ModApiEnvVM::l_spawn_tree(lua_State *L)
treegen::error e;
if ((e = treegen::make_ltree(*vm, p0, tree_def)) != treegen::SUCCESS) {
if (e == treegen::UNBALANCED_BRACKETS) {
throw LuaError("spawn_tree(): closing ']' has no matching opening bracket");
} else {
throw LuaError("spawn_tree(): unknown error");
}
throw LuaError("spawn_tree(): " + treegen::error_to_string(e));
}
lua_pushboolean(L, true);