mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-06 19:41:51 +00:00
add test ore (coal)
This commit is contained in:
parent
36eed38b4c
commit
d534207deb
9 changed files with 31 additions and 10 deletions
|
|
@ -79,6 +79,7 @@ public:
|
|||
}
|
||||
|
||||
std::vector<StructurePlacement> placeStructures(
|
||||
const GeneratorDef& def,
|
||||
const glm::ivec2& offset, const glm::ivec2& size, uint64_t seed,
|
||||
const std::shared_ptr<Heightmap>& heightmap
|
||||
) override {
|
||||
|
|
@ -98,7 +99,15 @@ public:
|
|||
lua::rawgeti(L, i);
|
||||
|
||||
lua::rawgeti(L, 1);
|
||||
int structIndex = lua::tointeger(L, -1);
|
||||
int structIndex = 0;
|
||||
if (lua::isstring(L, -1)) {
|
||||
const auto& found = def.structuresIndices.find(lua::require_string(L, -1));
|
||||
if (found != def.structuresIndices.end()) {
|
||||
structIndex = found->second;
|
||||
}
|
||||
} else {
|
||||
structIndex = lua::tointeger(L, -1);
|
||||
}
|
||||
lua::pop(L);
|
||||
|
||||
lua::rawgeti(L, 2);
|
||||
|
|
|
|||
|
|
@ -135,6 +135,7 @@ public:
|
|||
const glm::ivec2& offset, const glm::ivec2& size, uint64_t seed) = 0;
|
||||
|
||||
virtual std::vector<StructurePlacement> placeStructures(
|
||||
const GeneratorDef& def,
|
||||
const glm::ivec2& offset, const glm::ivec2& size, uint64_t seed,
|
||||
const std::shared_ptr<Heightmap>& heightmap) = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ void WorldGenerator::generateStructures(
|
|||
const auto& heightmap = prototype.heightmap;
|
||||
|
||||
util::concat(prototype.structures, def.script->placeStructures(
|
||||
{chunkX * CHUNK_W, chunkZ * CHUNK_D}, {CHUNK_W, CHUNK_D}, seed,
|
||||
def, {chunkX * CHUNK_W, chunkZ * CHUNK_D}, {CHUNK_W, CHUNK_D}, seed,
|
||||
heightmap
|
||||
));
|
||||
for (const auto& placement : prototype.structures) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue