add test ore (coal)

This commit is contained in:
MihailRis
2024-09-25 00:13:59 +03:00
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);