mirror of
				https://github.com/FaceDeer/dfcaverns.git
				synced 2025-11-04 10:05:29 +01:00 
			
		
		
		
	reuse chasm's ignore list
This commit is contained in:
		@@ -9,6 +9,10 @@ chasms.register_ignore = function(node_name)
 | 
				
			|||||||
	ignore[minetest.get_content_id(node_name)] = true
 | 
						ignore[minetest.get_content_id(node_name)] = true
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					chasms.ignore_content_id = function(content_id)
 | 
				
			||||||
 | 
						return ignore[content_id]
 | 
				
			||||||
 | 
					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
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -28,6 +28,13 @@ if minetest.get_modpath("default") then
 | 
				
			|||||||
	end
 | 
						end
 | 
				
			||||||
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 water_level = tonumber(minetest.get_mapgen_setting("water_level"))
 | 
				
			||||||
local mapgen_seed = tonumber(minetest.get_mapgen_setting("seed")) % 2^16
 | 
					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)
 | 
						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
 | 
						for vi, x, y, z in area:iterp_xyz(emin, emax) do
 | 
				
			||||||
		local distance_perturbation = (nvals_perlin[vi]+1)*10
 | 
							if not (ignore and ignore(data[vi])) then
 | 
				
			||||||
		local distance = vector.distance({x=x, y=y, z=z}, {x=location_x, y=y, z=location_z}) - distance_perturbation
 | 
								local distance_perturbation = (nvals_perlin[vi]+1)*10
 | 
				
			||||||
		local taper_min = top - 40
 | 
								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
 | 
								if y < top and y > depth then
 | 
				
			||||||
		
 | 
									if y > top - 40 then
 | 
				
			||||||
			-- taper the top end
 | 
										-- taper the top end
 | 
				
			||||||
			if y > top - 40 then
 | 
										distance = distance - ((taper_min - y)/2)
 | 
				
			||||||
				distance = distance - ((taper_min - y)/2)
 | 
									end
 | 
				
			||||||
			end
 | 
					 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
			if distance < pit_radius then
 | 
									if distance < pit_radius then
 | 
				
			||||||
				if y < depth + 20 and data[vi] ~= c_air then
 | 
										if y < depth + 20 and data[vi] ~= c_air then
 | 
				
			||||||
					data[vi] = c_gravel
 | 
											data[vi] = c_gravel
 | 
				
			||||||
				else
 | 
										else
 | 
				
			||||||
					data[vi] = c_air
 | 
											data[vi] = c_air
 | 
				
			||||||
 | 
										end
 | 
				
			||||||
				end
 | 
									end
 | 
				
			||||||
			end
 | 
								end
 | 
				
			||||||
		end
 | 
							end
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
name = pit_caves
 | 
					name = pit_caves
 | 
				
			||||||
description = Inserts very tall "pit" caves underground
 | 
					description = Inserts very tall "pit" caves underground
 | 
				
			||||||
depends =
 | 
					depends =
 | 
				
			||||||
optional_depends = mapgen_helper, default
 | 
					optional_depends = mapgen_helper, default, chasms
 | 
				
			||||||
		Reference in New Issue
	
	Block a user