collect generator voxel fragments to directory

This commit is contained in:
MihailRis 2024-09-26 01:30:55 +03:00
parent 788ad1f6a6
commit d839da7dab
8 changed files with 5 additions and 3 deletions

View File

@ -55,7 +55,7 @@ class ContentLoader {
public:
ContentLoader(ContentPack* pack, ContentBuilder& builder);
bool fixPackIndices(
static bool fixPackIndices(
const fs::path& folder,
dv::value& indicesRoot,
const std::string& contentSection

View File

@ -22,7 +22,7 @@ static VoxelStructureMeta load_structure_meta(
static std::vector<std::unique_ptr<GeneratingVoxelStructure>> load_structures(
const fs::path& structuresFile
) {
auto structuresDir = structuresFile.parent_path();
auto structuresDir = structuresFile.parent_path() / fs::path("fragments");
auto map = files::read_json(structuresFile);
std::vector<std::unique_ptr<GeneratingVoxelStructure>> structures;

View File

@ -180,12 +180,14 @@ static int l_get_default_generator(lua::State* L) {
/// @brief Get a list of all world generators
/// @return A table with the IDs of all world generators
static int l_get_generators(lua::State* L) {
if (content == nullptr) {
throw std::runtime_error("content is not initialized");
}
const auto& generators = content->generators.getDefs();
lua::createtable(L, generators.size(), 0);
int i = 0;
for (auto& [name, _] : generators) {
std::cout << name << std::endl;
lua::pushstring(L, name);
lua::rawseti(L, i + 1);
i++;