Add set_world_depth
parent
c23c5adce6
commit
67b4ac9310
2
API.md
2
API.md
|
@ -271,7 +271,7 @@ this.
|
|||
In case you wish to do a few other operations, here's a few other functions
|
||||
that might be helpful to you:
|
||||
|
||||
- `noordstar_caves.set_world_height(h)` Set the world's height to a given number.
|
||||
- `noordstar_caves.set_world_depth(h)` Set the world's depth to a given number.
|
||||
|
||||
This feature is currently only supported in VoxeLibre. Contributions that help
|
||||
change the world depth in other games, are very welcome.
|
||||
|
|
61
init.lua
61
init.lua
|
@ -28,6 +28,7 @@ local internal =
|
|||
, wall = 4
|
||||
, ceiling = 5
|
||||
, floor_deco = 6
|
||||
, ceiling_deco = 7
|
||||
}
|
||||
|
||||
-- Point that can be used for generating Voronoi graphs
|
||||
|
@ -53,6 +54,10 @@ local internal =
|
|||
-- Average blob size of verticality noise params
|
||||
, vrtcl_blob = { x = 100, y = 250, z = 100 }
|
||||
|
||||
-- Barrier showing the world where areas should be considered as caves
|
||||
-- when determining the weather.
|
||||
, weather_y = 0
|
||||
|
||||
-- If another mod doesn't override this value, we will assume that this is
|
||||
-- the world's depth.
|
||||
, world_depth = -60
|
||||
|
@ -144,10 +149,64 @@ end
|
|||
|
||||
-- Override the world's depth
|
||||
function noordstar_caves.set_world_depth(h)
|
||||
if type(h) ~= "number" then
|
||||
return
|
||||
end
|
||||
h = math.round(h)
|
||||
|
||||
internal.world_depth = h
|
||||
|
||||
if mcl_vars then
|
||||
-- internal.weather_y = mcl_vars.mg_overworld_min
|
||||
|
||||
mcl_vars.mg_overworld_min = h
|
||||
mcl_vars.mg_bedrock_overworld_min = h
|
||||
mcl_vars.mg_bedrock_overworld_max = h + 4
|
||||
mcl_vars.mg_lava_overworld_max = h + 10
|
||||
mcl_vars.mg_end_max = h - 2000
|
||||
mcl_vars.mg_realm_barrier_overworld_end_max = mcl_vars.mg_end_max
|
||||
mcl_vars.mg_realm_barrier_overworld_end_min = mcl_vars.mg_end_max - 11
|
||||
|
||||
mcl_vars.mg_lava = false
|
||||
end
|
||||
|
||||
if mcl_mapgen then
|
||||
-- internal.weather_y = mcl_mapgen.overworld.min
|
||||
|
||||
mcl_mapgen.overworld.min = h
|
||||
mcl_mapgen.overworld.bedrock_min = h
|
||||
mcl_mapgen.overworld.bedrock_max = mcl_mapgen.overworld.bedrock_min + (mcl_mapgen.bedrock_is_rough and 4 or h)
|
||||
mcl_mapgen.overworld.lava_max = h + 6
|
||||
mcl_mapgen.overworld.railcorridors_height_min = -50
|
||||
mcl_mapgen.overworld.railcorridors_height_max = -2
|
||||
|
||||
mcl_mapgen.end_.max = h - 2000
|
||||
mcl_mapgen.realm_barrier_overworld_end_max = mcl_mapgen.end_.max
|
||||
mcl_mapgen.realm_barrier_overworld_end_min = mcl_mapgen.end_.max - 11
|
||||
|
||||
if mcl_mapgen.on_settings_changed then
|
||||
mcl_mapgen.on_settings_changed()
|
||||
else
|
||||
minetest.log("error", "The installed version of the mcl_mapgen mod (part of Mineclone 5) "
|
||||
.."does not have an mcl_mapgen.on_settings_changed method. This will likely result in "
|
||||
.."altitudes below the original bedrock being inaccessible to players.")
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
noordstar_caves.set_world_depth(internal.world_depth)
|
||||
|
||||
if mcl_worlds then
|
||||
local old_has_weather = mcl_worlds.has_weather
|
||||
mcl_worlds.has_weather = function(pos)
|
||||
-- No weather in the deep caverns
|
||||
if pos.y >= internal.world_depth and pos.y <= internal.weather_y then
|
||||
return false
|
||||
end
|
||||
return old_has_weather(pos)
|
||||
end
|
||||
end
|
||||
|
||||
-- Remove a specific registered cave biome
|
||||
function noordstar_caves.unregister_biome(name)
|
||||
noordstar_caves.registered_biomes[name] = nil
|
||||
|
@ -1413,3 +1472,5 @@ noordstar_caves.register_decoration({
|
|||
rotation = "random",
|
||||
-- place_offset_y = 5,
|
||||
})
|
||||
|
||||
noordstar_caves.set_world_depth(-993)
|
||||
|
|
Loading…
Reference in New Issue