cleanup with luacheck, remove old depends and description files
This commit is contained in:
parent
e5f8457e93
commit
7d0b7e3d4b
@ -1,3 +0,0 @@
|
||||
default
|
||||
intllib?
|
||||
mapgen_helper
|
@ -1 +0,0 @@
|
||||
A mod that creates vast underground caverns and allows biomes to be defined for them
|
16
features.lua
16
features.lua
@ -153,8 +153,8 @@ end
|
||||
-- Builds very large stalactites and stalagmites
|
||||
|
||||
--giant stalagmite spawner
|
||||
function subterrane.big_stalagmite(vi, area, data, min_height, max_height, base_material, root_material, shaft_material)
|
||||
local pos = area:position(vi)
|
||||
function subterrane.big_stalagmite(vi_spawn, area, data, min_height, max_height, base_material, root_material, shaft_material)
|
||||
local pos = area:position(vi_spawn)
|
||||
local x = pos.x
|
||||
local y = pos.y
|
||||
local z = pos.z
|
||||
@ -188,8 +188,8 @@ function subterrane.big_stalagmite(vi, area, data, min_height, max_height, base_
|
||||
end
|
||||
|
||||
--giant stalactite spawner
|
||||
function subterrane.big_stalactite(vi, area, data, min_height, max_height, base_material, root_material, shaft_material)
|
||||
local pos = area:position(vi)
|
||||
function subterrane.big_stalactite(vi_spawn, area, data, min_height, max_height, base_material, root_material, shaft_material)
|
||||
local pos = area:position(vi_spawn)
|
||||
local x = pos.x
|
||||
local y = pos.y
|
||||
local z = pos.z
|
||||
@ -227,15 +227,15 @@ end
|
||||
|
||||
--function to create giant 'shrooms. Cap radius works well from about 2-6
|
||||
--if ignore_bounds is true this function will place the mushroom even if it overlaps the edge of the voxel area.
|
||||
function subterrane.giant_mushroom(vi, area, data, stem_material, cap_material, gill_material, stem_height, cap_radius, ignore_bounds)
|
||||
function subterrane.giant_mushroom(vi_spawn, area, data, stem_material, cap_material, gill_material, stem_height, cap_radius, ignore_bounds)
|
||||
|
||||
if not ignore_bounds and
|
||||
not (area:containsi(vi - cap_radius - area.zstride*cap_radius) and
|
||||
area:containsi(vi + cap_radius + stem_height*area.ystride + area.zstride*cap_radius)) then
|
||||
not (area:containsi(vi_spawn - cap_radius - area.zstride*cap_radius) and
|
||||
area:containsi(vi_spawn + cap_radius + stem_height*area.ystride + area.zstride*cap_radius)) then
|
||||
return false -- mushroom overlaps the bounds of the voxel area, abort.
|
||||
end
|
||||
|
||||
local pos = area:position(vi)
|
||||
local pos = area:position(vi_spawn)
|
||||
local x = pos.x
|
||||
local y = pos.y
|
||||
local z = pos.z
|
||||
|
7
init.lua
7
init.lua
@ -16,7 +16,6 @@ local c_desert_stone = minetest.get_content_id(subterrane.dependencies.desert_st
|
||||
local c_sandstone = minetest.get_content_id(subterrane.dependencies.sandstone)
|
||||
|
||||
local c_air = minetest.get_content_id("air")
|
||||
local c_water = minetest.get_content_id(subterrane.dependencies.water)
|
||||
|
||||
local c_obsidian = minetest.get_content_id(subterrane.dependencies.obsidian)
|
||||
|
||||
@ -88,8 +87,8 @@ disable_mapgen_caverns()
|
||||
|
||||
local grid_size = mapgen_helper.block_size * 4
|
||||
|
||||
subterrane.get_column_points = function(minp, maxp, column_def)
|
||||
local grids = mapgen_helper.get_nearest_regions(minp, grid_size)
|
||||
subterrane.get_column_points = function(minp_param, maxp_param, column_def)
|
||||
local grids = mapgen_helper.get_nearest_regions(minp_param, grid_size)
|
||||
local points = {}
|
||||
for _, grid in ipairs(grids) do
|
||||
--The y value of the returned point will be the radius of the column
|
||||
@ -388,7 +387,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
||||
local nvals_warrens
|
||||
|
||||
local previous_y = emin.y
|
||||
local previous_node_state = outside_region
|
||||
local previous_node_state
|
||||
local this_node_state = outside_region
|
||||
|
||||
local column_points = nil
|
||||
|
@ -69,8 +69,6 @@ end
|
||||
|
||||
--FUNCTIONS--
|
||||
|
||||
local grid_size = mapgen_helper.block_size * 4
|
||||
|
||||
function subterrane:vertically_consistent_randomp(pos)
|
||||
local next_seed = math.floor(math.random() * 2^31)
|
||||
math.randomseed(minetest.hash_node_position({x=pos.x, y=0, z=pos.z}))
|
||||
|
@ -4,39 +4,12 @@ local snap_to_minp = function(ydepth)
|
||||
return ydepth - (ydepth+32) % sidelen -- put ydepth at the minp.y of mapblocks
|
||||
end
|
||||
|
||||
function subterrane:register_cave_spawn(cave_layer_def, start_depth)
|
||||
minetest.register_on_newplayer(function(player)
|
||||
local ydepth = snap_to_minp(start_depth or cave_layer_def.y_max)
|
||||
local spawned = false
|
||||
while spawned ~= true do
|
||||
spawned = spawnplayer(cave_layer_def, player, ydepth)
|
||||
ydepth = ydepth - sidelen
|
||||
if ydepth < cave_layer_def.y_min then
|
||||
ydepth = snap_to_minp(cave_layer_def.y_max)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
minetest.register_on_respawnplayer(function(player)
|
||||
local ydepth = snap_to_minp(start_depth or cave_layer_def.y_max)
|
||||
local spawned = false
|
||||
while spawned ~= true do
|
||||
spawned = spawnplayer(cave_layer_def, player, ydepth)
|
||||
ydepth = ydepth - sidelen
|
||||
if ydepth < cave_layer_def.y_min then
|
||||
ydepth = snap_to_minp(cave_layer_def.y_max)
|
||||
end
|
||||
end
|
||||
return true
|
||||
end)
|
||||
end
|
||||
|
||||
local outside_region = 0
|
||||
local inside_ground = 1
|
||||
local inside_cavern = 2
|
||||
|
||||
-- Spawn player underground in a giant cavern
|
||||
function spawnplayer(cave_layer_def, player, ydepth)
|
||||
local function spawnplayer(cave_layer_def, player, ydepth)
|
||||
subterrane.set_defaults(cave_layer_def)
|
||||
|
||||
local YMIN = cave_layer_def.y_min
|
||||
@ -99,7 +72,7 @@ function spawnplayer(cave_layer_def, player, ydepth)
|
||||
-- inside a giant cavern
|
||||
if cave_value > cave_local_threshold then
|
||||
local column_value = 0
|
||||
local inside_column = false
|
||||
local inside_column
|
||||
if column_def then
|
||||
if column_points == nil then
|
||||
column_points = subterrane.get_column_points(minp, maxp, column_def)
|
||||
@ -107,7 +80,7 @@ function spawnplayer(cave_layer_def, player, ydepth)
|
||||
end
|
||||
column_value = subterrane.get_column_value({x=x, y=y, z=z}, column_points)
|
||||
end
|
||||
inside_column = column_value > 0 and cave_value - column_value * column_weight < cave_local_threshold
|
||||
inside_column = column_value > 0 and cave_value - column_value * column_weight < cave_local_threshold
|
||||
if previous_node_state == inside_ground and not inside_column then
|
||||
-- we just entered the cavern from below. Do a quick check for head space.
|
||||
local val_above = nvals_cave[vi+cave_area.ystride]
|
||||
@ -139,3 +112,30 @@ function spawnplayer(cave_layer_def, player, ydepth)
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function subterrane:register_cave_spawn(cave_layer_def, start_depth)
|
||||
minetest.register_on_newplayer(function(player)
|
||||
local ydepth = snap_to_minp(start_depth or cave_layer_def.y_max)
|
||||
local spawned = false
|
||||
while spawned ~= true do
|
||||
spawned = spawnplayer(cave_layer_def, player, ydepth)
|
||||
ydepth = ydepth - sidelen
|
||||
if ydepth < cave_layer_def.y_min then
|
||||
ydepth = snap_to_minp(cave_layer_def.y_max)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
minetest.register_on_respawnplayer(function(player)
|
||||
local ydepth = snap_to_minp(start_depth or cave_layer_def.y_max)
|
||||
local spawned = false
|
||||
while spawned ~= true do
|
||||
spawned = spawnplayer(cave_layer_def, player, ydepth)
|
||||
ydepth = ydepth - sidelen
|
||||
if ydepth < cave_layer_def.y_min then
|
||||
ydepth = snap_to_minp(cave_layer_def.y_max)
|
||||
end
|
||||
end
|
||||
return true
|
||||
end)
|
||||
end
|
@ -10,7 +10,6 @@ subterrane.is_in_cavern = function(pos)
|
||||
local YMAX = cave_layer_def.y_max
|
||||
local y = pos.y
|
||||
if y <= YMAX and y >= YMIN then
|
||||
local block_size = mapgen_helper.block_size
|
||||
local BLEND = math.min(cave_layer_def.boundary_blend_range, (YMAX-YMIN)/2)
|
||||
local TCAVE = cave_layer_def.cave_threshold
|
||||
local np_cave = cave_layer_def.perlin_cave
|
||||
@ -51,13 +50,8 @@ subterrane.get_cavern_value = function(name, pos)
|
||||
return nil
|
||||
end
|
||||
|
||||
local block_size = mapgen_helper.block_size
|
||||
local BLEND = math.min(cave_layer_def.boundary_blend_range, (YMAX-YMIN)/2)
|
||||
local TCAVE = cave_layer_def.cave_threshold
|
||||
local np_cave = cave_layer_def.perlin_cave
|
||||
local np_wave = cave_layer_def.perlin_wave
|
||||
local y_blend_min = YMIN + BLEND * 1.5
|
||||
local y_blend_max = YMAX - BLEND * 1.5
|
||||
local nval_cave = minetest.get_perlin(np_cave):get_3d(pos) --cave noise for structure
|
||||
local nval_wave = minetest.get_perlin(np_wave):get_3d(pos) --wavy structure of cavern ceilings and floors
|
||||
nval_cave = (nval_cave + nval_wave)/2
|
||||
|
Loading…
x
Reference in New Issue
Block a user