Make bedrock more robust

master
Wuzzy 2017-12-14 08:01:26 +01:00
parent a925526962
commit 50a9ec1706
1 changed files with 33 additions and 2 deletions

View File

@ -1,3 +1,5 @@
local BEDROCK_LAYER = -30912 -- determined as appropriate by experiment
minetest.register_ore({
ore_type = "scatter",
ore = "bedrock:bedrock",
@ -5,7 +7,7 @@ minetest.register_ore({
clust_scarcity = 1 * 1 * 1,
clust_num_ores = 5,
clust_size = 2,
y_min = -30912, -- Engine changes can modify this value.
y_min = BEDROCK_LAYER, -- Engine changes can modify this value.
y_max = -30656, -- This ensures the bottom of the world is not even loaded.
})
@ -23,9 +25,14 @@ minetest.register_ore({
minetest.register_node("bedrock:bedrock", {
description = "Bedrock",
tiles = {"bedrock_bedrock.png"},
drop = "",
groups = {unbreakable = 1, not_in_creative_inventory = 1}, -- For Map Tools' admin pickaxe.
sounds = default.node_sound_stone_defaults(),
is_ground_content = false,
on_blast = function() end,
on_destruct = function () end,
can_dig = function() return false end,
diggable = false,
drop = "",
})
minetest.register_node("bedrock:deepstone", {
@ -36,6 +43,30 @@ minetest.register_node("bedrock:deepstone", {
sounds = default.node_sound_stone_defaults(),
})
-- Generate a perfect bedrock layer at the world bottom
minetest.register_on_generated(function(minp, maxp)
if maxp.y >= BEDROCK_LAYER and minp.y <= BEDROCK_LAYER then
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
local data = vm:get_data()
local area = VoxelArea:new({MinEdge=emin, MaxEdge=emax})
local c_bedrock = minetest.get_content_id("bedrock:bedrock")
for x = minp.x, maxp.x do
for z = minp.z, maxp.z do
local p_pos = area:index(x, BEDROCK_LAYER, z)
data[p_pos] = c_bedrock
end
end
vm:set_data(data)
vm:calc_lighting()
vm:update_liquids()
vm:write_to_map()
end
end)
if minetest.setting_getbool("log_mods") then
minetest.log("action", "[bedrock] loaded.")
end