mirror of
https://github.com/FaceDeer/dfcaverns.git
synced 2024-12-26 19:00:36 +01:00
add an api to chasms to let other mods build bridges without them being chopped up
This commit is contained in:
parent
3d7c2b43a4
commit
b3525c98d5
@ -2,6 +2,13 @@ local data = {}
|
|||||||
|
|
||||||
chasms = {}
|
chasms = {}
|
||||||
|
|
||||||
|
local ignore = {}
|
||||||
|
|
||||||
|
-- Use this to set node types to be left alone by chasm-carving
|
||||||
|
chasms.register_ignore = function(node_name)
|
||||||
|
ignore[minetest.get_content_id(node_name)] = true
|
||||||
|
end
|
||||||
|
|
||||||
local maxy = tonumber(minetest.settings:get("chasms_maxy")) or -50
|
local maxy = tonumber(minetest.settings:get("chasms_maxy")) or -50
|
||||||
local miny = tonumber(minetest.settings:get("chasms_miny")) or -2500
|
local miny = tonumber(minetest.settings:get("chasms_miny")) or -2500
|
||||||
local falloff = tonumber(minetest.settings:get("chasms_falloff")) or 100
|
local falloff = tonumber(minetest.settings:get("chasms_falloff")) or 100
|
||||||
@ -129,6 +136,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
local waver = math.min(math.max(math.floor(waver_data[i]+0.5), -waver_strength), waver_strength)
|
local waver = math.min(math.max(math.floor(waver_data[i]+0.5), -waver_strength), waver_strength)
|
||||||
local intensity = get_intensity(y)
|
local intensity = get_intensity(y)
|
||||||
if chasm_data[chasm_area:index(x+waver, y, z)]*intensity > chasms_threshold then
|
if chasm_data[chasm_area:index(x+waver, y, z)]*intensity > chasms_threshold then
|
||||||
|
if not ignore[data[i]] then
|
||||||
if webs_present then
|
if webs_present then
|
||||||
webs = webs or calculate_web_array(minp, maxp) -- only calculate webs when we know we're in a chasm
|
webs = webs or calculate_web_array(minp, maxp) -- only calculate webs when we know we're in a chasm
|
||||||
if webs[y + z*z_displace] and math.random() < 0.85 then -- random holes in the web
|
if webs[y + z*z_displace] and math.random() < 0.85 then -- random holes in the web
|
||||||
@ -142,6 +150,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
vm:set_data(data)
|
vm:set_data(data)
|
||||||
vm:calc_lighting()
|
vm:calc_lighting()
|
||||||
|
Loading…
Reference in New Issue
Block a user