bedrock support

This commit is contained in:
Thomas Rudin 2018-06-01 13:30:40 +02:00
parent 8abb03f670
commit 6755bdc945
2 changed files with 13 additions and 3 deletions

View File

@ -1,3 +1,4 @@
default
vacuum?
technic_worldgen?
bedrock?

View File

@ -1,5 +1,6 @@
local has_technic_mod = minetest.get_modpath("technic")
local has_vacuum_mod = minetest.get_modpath("vacuum")
local has_bedrock_mod = minetest.get_modpath("bedrock")
-- http://dev.minetest.net/PerlinNoiseMap
-- TODO: https://github.com/Calinou/bedrock
@ -28,6 +29,7 @@ local c_base = minetest.get_content_id("default:stone")
local c_air = minetest.get_content_id("air")
local c_ignore = minetest.get_content_id("ignore")
local c_vacuum
local c_bedrock
local ores = {}
local min_chance = 1 -- everything below is stone
@ -37,6 +39,10 @@ local register_ore = function(def)
min_chance = math.min(def.chance, min_chance)
end
if has_bedrock_mod then
c_bedrock = minetest.get_content_id("bedrock:bedrock")
end
if has_vacuum_mod then
c_vacuum = minetest.get_content_id("vacuum:vacuum")
@ -148,12 +154,15 @@ minetest.register_on_generated(function(minp, maxp, seed)
local index = area:index(x,y,z)
-- higher elevation = lower chance
local chance = (y-minp.y) / side_length
if y >= 5000 and y < 5010 and has_bedrock_mod then
data[index] = c_bedrock
if data[index] == c_air or data[index] == c_vacuum or data[index] == c_ignore then
elseif data[index] == c_air or data[index] == c_vacuum or data[index] == c_ignore then
-- unpopulated node
-- higher elevation = lower chance
local chance = (y-minp.y) / side_length
local base_n = base_perlin_map[i]
local ore_n = ore_perlin_map[i]