move test caves to base:demo
This commit is contained in:
@@ -1,3 +1,13 @@
|
||||
-- Get entry-point and filename from `entry-point:filename` path
|
||||
-- // TODO: move to stdmin
|
||||
function parse_path(path)
|
||||
local index = string.find(path, ':')
|
||||
if index == nil then
|
||||
error("invalid path syntax (':' missing)")
|
||||
end
|
||||
return string.sub(path, 1, index-1), string.sub(path, index+1, -1)
|
||||
end
|
||||
|
||||
local _, dir = parse_path(__DIR__)
|
||||
ores = file.read_combined_list(dir.."/ores.json")
|
||||
|
||||
@@ -26,6 +36,17 @@ end
|
||||
function place_structures(x, z, w, d, seed, hmap, chunk_height)
|
||||
local placements = {}
|
||||
place_ores(placements, x, z, w, d, seed, hmap, chunk_height)
|
||||
|
||||
if math.random() < 0.1 then -- generate caves
|
||||
local sy = math.random() * (chunk_height / 2)
|
||||
local ey = math.random() * (chunk_height / 2)
|
||||
local sx = x + math.random() * 20 - 10
|
||||
local ex = x + math.random() * 20 - 10
|
||||
local sz = z + math.random() * 20 - 10
|
||||
local ez = z + math.random() * 20 - 10
|
||||
table.insert(placements,
|
||||
{":line", 0, {sx - 10, sy, sz - 10}, {ex + 10, ey, ez + 10}, 3})
|
||||
end
|
||||
return placements
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user