add test ore (coal)
This commit is contained in:
parent
36eed38b4c
commit
d534207deb
3
res/content/base/blocks/coal_ore.json
Normal file
3
res/content/base/blocks/coal_ore.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"texture": "coal_ore"
|
||||||
|
}
|
||||||
@ -1,8 +1,6 @@
|
|||||||
{
|
{
|
||||||
"entities": [
|
"items": [
|
||||||
"drop",
|
"bazalt_breaker"
|
||||||
"player",
|
|
||||||
"falling_block"
|
|
||||||
],
|
],
|
||||||
"blocks": [
|
"blocks": [
|
||||||
"dirt",
|
"dirt",
|
||||||
@ -28,9 +26,12 @@
|
|||||||
"pipe",
|
"pipe",
|
||||||
"lightbulb",
|
"lightbulb",
|
||||||
"torch",
|
"torch",
|
||||||
"wooden_door"
|
"wooden_door",
|
||||||
|
"coal_ore"
|
||||||
],
|
],
|
||||||
"items": [
|
"entities": [
|
||||||
"bazalt_breaker"
|
"drop",
|
||||||
|
"player",
|
||||||
|
"falling_block"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
BIN
res/content/base/textures/blocks/coal_ore.png
Normal file
BIN
res/content/base/textures/blocks/coal_ore.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.3 KiB |
@ -8,6 +8,12 @@ biomes = json.parse(file.read("core:generators/default/biomes.json"))
|
|||||||
|
|
||||||
function place_structures(x, z, w, d, seed, hmap)
|
function place_structures(x, z, w, d, seed, hmap)
|
||||||
local placements = {}
|
local placements = {}
|
||||||
|
for i=1,10 do
|
||||||
|
local sx = math.random() * w
|
||||||
|
local sz = math.random() * d
|
||||||
|
local sy = math.random() * hmap:at(sx, sz)*256 - 6
|
||||||
|
table.insert(placements, {"coal_ore0", {sx, sy, sz}, math.random()*4})
|
||||||
|
end
|
||||||
return placements
|
return placements
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
BIN
res/generators/default/coal_ore0.vox
Normal file
BIN
res/generators/default/coal_ore0.vox
Normal file
Binary file not shown.
@ -2,5 +2,6 @@
|
|||||||
"tree0": {},
|
"tree0": {},
|
||||||
"tree1": {},
|
"tree1": {},
|
||||||
"tree2": {},
|
"tree2": {},
|
||||||
"tower": {}
|
"tower": {},
|
||||||
|
"coal_ore0": {}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -79,6 +79,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::vector<StructurePlacement> placeStructures(
|
std::vector<StructurePlacement> placeStructures(
|
||||||
|
const GeneratorDef& def,
|
||||||
const glm::ivec2& offset, const glm::ivec2& size, uint64_t seed,
|
const glm::ivec2& offset, const glm::ivec2& size, uint64_t seed,
|
||||||
const std::shared_ptr<Heightmap>& heightmap
|
const std::shared_ptr<Heightmap>& heightmap
|
||||||
) override {
|
) override {
|
||||||
@ -98,7 +99,15 @@ public:
|
|||||||
lua::rawgeti(L, i);
|
lua::rawgeti(L, i);
|
||||||
|
|
||||||
lua::rawgeti(L, 1);
|
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::pop(L);
|
||||||
|
|
||||||
lua::rawgeti(L, 2);
|
lua::rawgeti(L, 2);
|
||||||
|
|||||||
@ -135,6 +135,7 @@ public:
|
|||||||
const glm::ivec2& offset, const glm::ivec2& size, uint64_t seed) = 0;
|
const glm::ivec2& offset, const glm::ivec2& size, uint64_t seed) = 0;
|
||||||
|
|
||||||
virtual std::vector<StructurePlacement> placeStructures(
|
virtual std::vector<StructurePlacement> placeStructures(
|
||||||
|
const GeneratorDef& def,
|
||||||
const glm::ivec2& offset, const glm::ivec2& size, uint64_t seed,
|
const glm::ivec2& offset, const glm::ivec2& size, uint64_t seed,
|
||||||
const std::shared_ptr<Heightmap>& heightmap) = 0;
|
const std::shared_ptr<Heightmap>& heightmap) = 0;
|
||||||
|
|
||||||
|
|||||||
@ -175,7 +175,7 @@ void WorldGenerator::generateStructures(
|
|||||||
const auto& heightmap = prototype.heightmap;
|
const auto& heightmap = prototype.heightmap;
|
||||||
|
|
||||||
util::concat(prototype.structures, def.script->placeStructures(
|
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
|
heightmap
|
||||||
));
|
));
|
||||||
for (const auto& placement : prototype.structures) {
|
for (const auto& placement : prototype.structures) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user