reuse chasm's ignore list

This commit is contained in:
FaceDeer 2021-05-07 00:16:21 -06:00
parent 1ca21e797f
commit 718955a75a
3 changed files with 27 additions and 15 deletions

View File

@ -9,6 +9,10 @@ chasms.register_ignore = function(node_name)
ignore[minetest.get_content_id(node_name)] = true
end
chasms.ignore_content_id = function(content_id)
return ignore[content_id]
end
local maxy = tonumber(minetest.settings:get("chasms_maxy")) or -50
local miny = tonumber(minetest.settings:get("chasms_miny")) or -2500
local falloff = tonumber(minetest.settings:get("chasms_falloff")) or 100

View File

@ -28,6 +28,13 @@ if minetest.get_modpath("default") then
end
end
local ignore
if minetest.get_modpath("chasms") then
-- the chasms mod already sets up a method to allow chasms to avoid overwriting stalactites and whatnot,
-- hijack that.
ignore = chasms.ignore_content_id
end
local water_level = tonumber(minetest.get_mapgen_setting("water_level"))
local mapgen_seed = tonumber(minetest.get_mapgen_setting("seed")) % 2^16
@ -114,22 +121,23 @@ minetest.register_on_generated(function(minp, maxp, seed)
local nvals_perlin = mapgen_helper.perlin3d("pit_caves:pit", emin, emax, perlin_params)
for vi, x, y, z in area:iterp_xyz(emin, emax) do
local distance_perturbation = (nvals_perlin[vi]+1)*10
local distance = vector.distance({x=x, y=y, z=z}, {x=location_x, y=y, z=location_z}) - distance_perturbation
local taper_min = top - 40
if not (ignore and ignore(data[vi])) then
local distance_perturbation = (nvals_perlin[vi]+1)*10
local distance = vector.distance({x=x, y=y, z=z}, {x=location_x, y=y, z=location_z}) - distance_perturbation
local taper_min = top - 40
if y < top and y > depth then
-- taper the top end
if y > top - 40 then
distance = distance - ((taper_min - y)/2)
end
if y < top and y > depth then
if y > top - 40 then
-- taper the top end
distance = distance - ((taper_min - y)/2)
end
if distance < pit_radius then
if y < depth + 20 and data[vi] ~= c_air then
data[vi] = c_gravel
else
data[vi] = c_air
if distance < pit_radius then
if y < depth + 20 and data[vi] ~= c_air then
data[vi] = c_gravel
else
data[vi] = c_air
end
end
end
end

View File

@ -1,4 +1,4 @@
name = pit_caves
description = Inserts very tall "pit" caves underground
depends =
optional_depends = mapgen_helper, default
optional_depends = mapgen_helper, default, chasms