remove generator script load_structures function
This commit is contained in:
parent
806ed4b155
commit
983a24bd05
@ -62,17 +62,6 @@ biomes = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function load_structures()
|
|
||||||
local structures = {}
|
|
||||||
local names = {"tree0", "tree1", "tree2", "tower"}
|
|
||||||
for i, name in ipairs(names) do
|
|
||||||
local filename = "core:default/"..name
|
|
||||||
debug.log("loading structure "..filename)
|
|
||||||
table.insert(structures, generation.load_structure(filename))
|
|
||||||
end
|
|
||||||
return structures
|
|
||||||
end
|
|
||||||
|
|
||||||
function place_structures(x, z, w, d, seed, hmap)
|
function place_structures(x, z, w, d, seed, hmap)
|
||||||
local placements = {}
|
local placements = {}
|
||||||
return placements
|
return placements
|
||||||
|
|||||||
@ -32,27 +32,6 @@ public:
|
|||||||
seaLevel(seaLevel)
|
seaLevel(seaLevel)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
std::vector<std::shared_ptr<VoxelFragment>> loadStructures() override {
|
|
||||||
std::vector<std::shared_ptr<VoxelFragment>> structures;
|
|
||||||
|
|
||||||
auto L = lua::get_main_thread();
|
|
||||||
lua::pushenv(L, *env);
|
|
||||||
if (lua::getfield(L, "load_structures")) {
|
|
||||||
if (lua::call_nothrow(L, 0, 1)) {
|
|
||||||
for (int i = 1; i <= lua::objlen(L, -1); i++) {
|
|
||||||
lua::rawgeti(L, i);
|
|
||||||
if (auto lstruct =
|
|
||||||
lua::touserdata<lua::LuaVoxelStructure>(L, -1)) {
|
|
||||||
structures.push_back(lstruct->getStructure());
|
|
||||||
}
|
|
||||||
lua::pop(L);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
lua::pop(L);
|
|
||||||
return structures;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::shared_ptr<Heightmap> generateHeightmap(
|
std::shared_ptr<Heightmap> generateHeightmap(
|
||||||
const glm::ivec2& offset, const glm::ivec2& size, uint64_t seed
|
const glm::ivec2& offset, const glm::ivec2& size, uint64_t seed
|
||||||
) override {
|
) override {
|
||||||
|
|||||||
@ -123,9 +123,6 @@ class GeneratorScript {
|
|||||||
public:
|
public:
|
||||||
virtual ~GeneratorScript() = default;
|
virtual ~GeneratorScript() = default;
|
||||||
|
|
||||||
/// @brief Load all structures
|
|
||||||
virtual std::vector<std::shared_ptr<VoxelFragment>> loadStructures() = 0;
|
|
||||||
|
|
||||||
/// @brief Generates a heightmap with values in range 0..1
|
/// @brief Generates a heightmap with values in range 0..1
|
||||||
/// @param offset position of the heightmap in the world
|
/// @param offset position of the heightmap in the world
|
||||||
/// @param size size of the heightmap
|
/// @param size size of the heightmap
|
||||||
|
|||||||
@ -48,7 +48,6 @@ WorldGenerator::WorldGenerator(
|
|||||||
surroundMap.setLevelCallback(4, [this](int const x, int const z) {
|
surroundMap.setLevelCallback(4, [this](int const x, int const z) {
|
||||||
generateStructures(requirePrototype(x, z), x, z);
|
generateStructures(requirePrototype(x, z), x, z);
|
||||||
});
|
});
|
||||||
|
|
||||||
for (int i = 0; i < def.structures.size(); i++) {
|
for (int i = 0; i < def.structures.size(); i++) {
|
||||||
// pre-calculate rotated structure variants
|
// pre-calculate rotated structure variants
|
||||||
def.structures[i]->fragments[0]->prepare(*content);
|
def.structures[i]->fragments[0]->prepare(*content);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user