mirror of
https://github.com/FaceDeer/dfcaverns.git
synced 2025-01-12 11:10:28 +01:00
add some mapgen stuff
This commit is contained in:
parent
69aac15eb3
commit
bb6cb4efa1
@ -1,9 +1,19 @@
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
|
||||
if minetest.get_modpath("default") then
|
||||
df_dependencies.register_leafdecay = default.register_leafdecay
|
||||
df_dependencies.after_place_leaves = default.after_place_leaves
|
||||
else
|
||||
--TODO
|
||||
end
|
||||
|
||||
|
||||
df_dependencies.mods_required.bucket = true
|
||||
if minetest.get_modpath("bucket") then
|
||||
df_dependencies.bucket_register_liquid = bucket.register_liquid
|
||||
else
|
||||
-- TODO
|
||||
end
|
||||
|
||||
|
||||
-- Note that a circular table reference will result in a crash, TODO: guard against that.
|
||||
@ -21,6 +31,10 @@ local function deep_copy(table_in)
|
||||
return table_out
|
||||
end
|
||||
|
||||
df_dependencies.mods_required.stairs = true
|
||||
df_dependencies.mods_required.moreblocks = true
|
||||
df_dependencies.mods_required.doors = true
|
||||
|
||||
df_dependencies.register_all_stairs = function(name, override_def)
|
||||
local mod = minetest.get_current_modname()
|
||||
|
||||
@ -57,6 +71,7 @@ df_dependencies.register_all_fences = function (name, override_def)
|
||||
|
||||
local burntime = override_def.burntime
|
||||
|
||||
if minetest.get_modpath("default") then
|
||||
default.register_fence(material .. "_fence", {
|
||||
description = S("@1 Fence", node_def.description),
|
||||
texture = override_def.texture or node_def.tiles[1],
|
||||
@ -94,6 +109,9 @@ df_dependencies.register_all_fences = function (name, override_def)
|
||||
groups = deep_copy(node_def.groups or {}), -- the default register_fence_rail function modifies the groups table passed in, so send a copy instead to be on the safe side.
|
||||
sounds = node_def.sounds
|
||||
})
|
||||
else
|
||||
-- TODO
|
||||
end
|
||||
|
||||
if minetest.get_modpath("doors") then
|
||||
doors.register_fencegate(material .. "_fence_gate", {
|
||||
@ -111,5 +129,8 @@ df_dependencies.register_all_fences = function (name, override_def)
|
||||
burntime = burntime * 2, -- ignoring four sticks
|
||||
})
|
||||
end
|
||||
else
|
||||
-- TODO
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -1,7 +1,7 @@
|
||||
df_dependencies = {}
|
||||
local modpath = minetest.get_modpath(minetest.get_current_modname())
|
||||
|
||||
local mods_required = {}
|
||||
df_dependencies.mods_required = {}
|
||||
|
||||
df_dependencies.select_required = function(def)
|
||||
local count = 0
|
||||
@ -9,7 +9,7 @@ df_dependencies.select_required = function(def)
|
||||
local ret
|
||||
for mod, item in pairs(def) do
|
||||
total = total + 1
|
||||
mods_required[mod] = true
|
||||
df_dependencies.mods_required[mod] = true
|
||||
if minetest.get_modpath(mod) then
|
||||
count = count + 1
|
||||
ret = item
|
||||
@ -34,7 +34,7 @@ dofile(modpath.."/sounds.lua")
|
||||
dofile(modpath.."/helper_functions.lua")
|
||||
dofile(modpath.."/misc.lua")
|
||||
|
||||
minetest.debug(dump(mods_required))
|
||||
minetest.debug(dump(df_dependencies.mods_required))
|
||||
|
||||
-- This mod is meant to only exist at initialization time. Other mods should make copies of anything it points to for their own use.
|
||||
minetest.after(1, function() df_dependencies = nil end)
|
||||
|
@ -38,3 +38,52 @@ df_dependencies.texture_stone = select_required({default="default_stone.png", mc
|
||||
df_dependencies.texture_wood = select_required({default="default_wood.png", mcl_core="default_wood.png"})
|
||||
df_dependencies.texture_mineral_coal = select_required({default="default_mineral_coal.png", mcl_core="mcl_core_coal_ore.png"}) -- MCL's coal texture isn't transparent, but is only used with gas seeps and should work fine that way
|
||||
df_dependencies.texture_glass_bottle = select_required({vessels="vessels_glass_bottle.png", mcl_potions="mcl_potions_potion_bottle.png"})
|
||||
|
||||
df_dependencies.mods_required.mcl_vars = true
|
||||
df_dependencies.mods_required.mcl_worlds = true
|
||||
df_dependencies.mods_required.mcl_strongholds = true
|
||||
if minetest.get_modpath("mcl_vars") then
|
||||
local prefix = "dfcaverns_"
|
||||
-- NOTE: These defaults are from df_caverns' config. Update them if those change.
|
||||
|
||||
local lowest_elevation = tonumber(minetest.settings:get(prefix.."sunless_sea_min")) or -2512
|
||||
if minetest.settings:get_bool(prefix.."enable_oil_sea", true) then
|
||||
lowest_elevation = (tonumber(minetest.settings:get(prefix.."oil_sea_level")) or -2700)
|
||||
end
|
||||
if minetest.settings:get_bool(prefix.."enable_lava_sea", true) then
|
||||
lowest_elevation = (tonumber(minetest.settings:get(prefix.."lava_sea_level")) or -2900)
|
||||
end
|
||||
if minetest.settings:get_bool(prefix.."enable_underworld", true) then
|
||||
lowest_elevation = (tonumber(minetest.settings:get(prefix.."underworld_level")) or -3200)
|
||||
end
|
||||
if minetest.settings:get_bool(prefix.."enable_primordial", true) then
|
||||
lowest_elevation = (tonumber(minetest.settings:get(prefix.."primordial_min")) or -4032)
|
||||
end
|
||||
lowest_elevation = lowest_elevation - 193 -- add a little buffer space
|
||||
|
||||
local old_overworld_min = mcl_vars.mg_overworld_min -- rememeber this for weather control
|
||||
|
||||
mcl_vars.mg_overworld_min = lowest_elevation
|
||||
mcl_vars.mg_bedrock_overworld_min = mcl_vars.mg_overworld_min
|
||||
mcl_vars.mg_lava_overworld_max = mcl_vars.mg_overworld_min + 10
|
||||
mcl_vars.mg_end_max = mcl_vars.mg_overworld_min - 2000
|
||||
|
||||
-- Important note. This doesn't change the values for the various ores and mobs and biomes and whatnot that have already been registered.
|
||||
-- to keep things consistent, add dependencies to
|
||||
|
||||
if minetest.get_modpath("mcl_worlds") then
|
||||
mcl_worlds.has_weather = function(pos)
|
||||
-- Weather in the Overworld. No weather in the deep caverns
|
||||
return pos.y <= mcl_vars.mg_overworld_max and pos.y >= old_overworld_min
|
||||
end
|
||||
end
|
||||
|
||||
dofile(minetest.get_modpath(minetest.get_current_modname()).."/ores.lua")
|
||||
|
||||
-- never mind - add dependency on mcl_strongholds and these will get generated before overworld_min gets changed.
|
||||
--if minetest.get_modpath("mcl_structures") and minetest.get_modpath("mcl_strongholds") then
|
||||
-- local elevation_delta = old_overworld_min - lowest_elevation
|
||||
-- local strongholds = mcl_structures.get_structure_data("stronghold")
|
||||
-- mcl_structures.register_structure_data("stronghold", strongholds)
|
||||
--end
|
||||
end
|
||||
|
8
df_dependencies/ores.lua
Normal file
8
df_dependencies/ores.lua
Normal file
@ -0,0 +1,8 @@
|
||||
-- copied from mcl_mapgen_core with tweaked altitudes to cover the added depth
|
||||
|
||||
if minetest.settings:get_bool("mcl_generate_ores", true) then
|
||||
|
||||
|
||||
|
||||
|
||||
end
|
@ -3,6 +3,8 @@ local S = minetest.get_translator(minetest.get_current_modname())
|
||||
local select_required = df_dependencies.select_required
|
||||
local select_optional = df_dependencies.select_optional
|
||||
|
||||
df_dependencies.mods_required.mcl_sounds = true
|
||||
|
||||
if minetest.get_modpath("default") then
|
||||
df_dependencies.sound_dirt = default.node_sound_dirt_defaults
|
||||
df_dependencies.sound_glass = default.node_sound_glass_defaults
|
||||
|
Loading…
Reference in New Issue
Block a user