mirror of
https://github.com/Splizard/minetest-mod-snow.git
synced 2024-12-28 23:40:17 +01:00
Disable mapgen by default, minetest has snow biomes now.
This commit is contained in:
parent
ee3b12c07d
commit
7f394447f1
@ -33,3 +33,6 @@ mapgen_rarity (Snow Biome Rarity %) float 18
|
|||||||
|
|
||||||
#size of the generated… (has an effect to the rarity, too)
|
#size of the generated… (has an effect to the rarity, too)
|
||||||
mapgen_size (Snow Biome Size) float 210
|
mapgen_size (Snow Biome Size) float 210
|
||||||
|
|
||||||
|
#Minetest finally has capable snow biomes by default, lets not mess it up with the old snowgen.
|
||||||
|
disable_mapgen (Disable mod-generated biomes) bool true
|
||||||
|
@ -12,21 +12,23 @@ saplings grow into trees. --]]
|
|||||||
|
|
||||||
-- Part 1: To disable the mapgen, add the *starting* comment under this line.
|
-- Part 1: To disable the mapgen, add the *starting* comment under this line.
|
||||||
|
|
||||||
|
if not snow.disable_mapgen then
|
||||||
|
print("[snow] Mapgen enabled!")
|
||||||
|
|
||||||
snow.mapgen = snow.mapgen or {}
|
snow.mapgen = snow.mapgen or {}
|
||||||
local mg = snow.mapgen
|
local mg = snow.mapgen
|
||||||
|
|
||||||
-- perlin noise "hills" are not peaks but looking like sinus curve
|
-- perlin noise "hills" are not peaks but looking like sinus curve
|
||||||
local function upper_rarity(rarity)
|
local function upper_rarity(rarity)
|
||||||
return math.sign(rarity)*math.sin(math.abs(rarity)*math.pi/2)
|
return math.sign(rarity)*math.sin(math.abs(rarity)*math.pi/2)
|
||||||
end
|
end
|
||||||
|
|
||||||
local rarity = snow.mapgen_rarity
|
local rarity = snow.mapgen_rarity
|
||||||
local size = snow.mapgen_size
|
local size = snow.mapgen_size
|
||||||
local smooth = snow.smooth_biomes
|
local smooth = snow.smooth_biomes
|
||||||
|
|
||||||
local nosmooth_rarity, perlin_scale
|
local nosmooth_rarity, perlin_scale
|
||||||
local function calc_values()
|
local function calc_values()
|
||||||
nosmooth_rarity = 1-rarity/50
|
nosmooth_rarity = 1-rarity/50
|
||||||
perlin_scale = size*100/rarity
|
perlin_scale = size*100/rarity
|
||||||
mg.perlin_scale = perlin_scale
|
mg.perlin_scale = perlin_scale
|
||||||
@ -39,10 +41,10 @@ local function calc_values()
|
|||||||
end
|
end
|
||||||
nosmooth_rarity = upper_rarity(nosmooth_rarity)
|
nosmooth_rarity = upper_rarity(nosmooth_rarity)
|
||||||
mg.nosmooth_rarity = nosmooth_rarity
|
mg.nosmooth_rarity = nosmooth_rarity
|
||||||
end
|
end
|
||||||
calc_values()
|
calc_values()
|
||||||
|
|
||||||
snow.register_on_configuring(function(name, v)
|
snow.register_on_configuring(function(name, v)
|
||||||
if name == "mapgen_rarity" then
|
if name == "mapgen_rarity" then
|
||||||
rarity = v
|
rarity = v
|
||||||
elseif name == "mapgen_size" then
|
elseif name == "mapgen_size" then
|
||||||
@ -54,21 +56,22 @@ snow.register_on_configuring(function(name, v)
|
|||||||
end
|
end
|
||||||
-- TODO: if e.g. size and rarity get changed at once, don't calculate the values more times
|
-- TODO: if e.g. size and rarity get changed at once, don't calculate the values more times
|
||||||
calc_values()
|
calc_values()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
--Identify the mapgen.
|
--Identify the mapgen.
|
||||||
local mgname = minetest.get_mapgen_setting"mg_name"
|
local mgname = minetest.get_mapgen_setting"mg_name"
|
||||||
if not mgname then
|
if not mgname then
|
||||||
minetest.log("error", "[MOD] Snow Biomes: WARNING! mapgen could not be identifyed!")
|
minetest.log("error", "[MOD] Snow Biomes: WARNING! mapgen could not be identifyed!")
|
||||||
end
|
end
|
||||||
local path = minetest.get_modpath"snow"
|
local path = minetest.get_modpath"snow"
|
||||||
if mgname == "v7" then
|
if mgname == "v7" then
|
||||||
--Load mapgen_v7 compatibility.
|
--Load mapgen_v7 compatibility.
|
||||||
dofile(path.."/src/mapgen_v7.lua")
|
dofile(path.."/src/mapgen_v7.lua")
|
||||||
else
|
else
|
||||||
--Load mapgen_v6 compatibility.
|
--Load mapgen_v6 compatibility.
|
||||||
dofile(path.."/src/mapgen_v6.lua")
|
dofile(path.."/src/mapgen_v6.lua")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- To complete the commenting-out add the *closing* comment under this line.
|
-- To complete the commenting-out add the *closing* comment under this line.
|
||||||
|
@ -142,10 +142,10 @@ local function define_contents()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local smooth = snow.smooth_biomes
|
local smooth = snow.smooth_biomes
|
||||||
local smooth_rarity_max = mg.smooth_rarity_max
|
local smooth_rarity_max = mg.smooth_rarity_max or 0
|
||||||
local smooth_rarity_min = mg.smooth_rarity_min
|
local smooth_rarity_min = mg.smooth_rarity_min or 0
|
||||||
local smooth_rarity_dif = mg.smooth_rarity_dif
|
local smooth_rarity_dif = mg.smooth_rarity_dif or 0
|
||||||
local nosmooth_rarity = mg.nosmooth_rarity
|
local nosmooth_rarity = mg.nosmooth_rarity or 0
|
||||||
|
|
||||||
snow.register_on_configuring(function(name, v)
|
snow.register_on_configuring(function(name, v)
|
||||||
if name == "debug" then
|
if name == "debug" then
|
||||||
@ -235,7 +235,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
for z = z0, z1 do
|
for z = z0, z1 do
|
||||||
for x = x0, x1 do
|
for x = x0, x1 do
|
||||||
local in_biome = false
|
local in_biome = false
|
||||||
local test
|
local test = 0
|
||||||
if nvals_default[ni] < 0.35 then
|
if nvals_default[ni] < 0.35 then
|
||||||
nvals_cold = nvals_cold or perlin_objs.cold:get2dMap_flat({x=x0, y=z0}, nbuf_cold)
|
nvals_cold = nvals_cold or perlin_objs.cold:get2dMap_flat({x=x0, y=z0}, nbuf_cold)
|
||||||
test = math.min(nvals_cold[ni], 1)
|
test = math.min(nvals_cold[ni], 1)
|
||||||
|
@ -12,6 +12,7 @@ snow = {
|
|||||||
min_height = tonumber(minetest.settings:get("min_height")) or 3,
|
min_height = tonumber(minetest.settings:get("min_height")) or 3,
|
||||||
mapgen_rarity = tonumber(minetest.settings:get("mapgen_rarity")) or 18,
|
mapgen_rarity = tonumber(minetest.settings:get("mapgen_rarity")) or 18,
|
||||||
mapgen_size = tonumber(minetest.settings:get("mapgen_size")) or 210,
|
mapgen_size = tonumber(minetest.settings:get("mapgen_size")) or 210,
|
||||||
|
disable_mapgen = minetest.settings:get_bool("disable_mapgen"),
|
||||||
}
|
}
|
||||||
|
|
||||||
-- functions for dynamically changing settings
|
-- functions for dynamically changing settings
|
||||||
|
Loading…
Reference in New Issue
Block a user