Dirt transformation
Changed the ABM that converts dirt into lawn Now it detects the climate and changes the dirt accordingly Added setting dry_dirt_threshold that is the highest humidity on which the dirt is converted to dry lawn.
This commit is contained in:
parent
38576ef7b7
commit
7565d2971e
@ -119,6 +119,7 @@ local average_stone_level = vmg.define("average_stone_level", 180)
|
||||
local dirt_reduction = math.sqrt(average_stone_level) / (vmg.noises[7].offset - 0.5) -- Calculate dirt_reduction such as v7 - sqrt(average_stone_level) / dirt_reduction = 0.5 on average. This means that, on average at y = average_stone_level, dirt_thickness = 0.5 (half of the surface is bare stone)
|
||||
local average_snow_level = vmg.define("average_snow_level", 100)
|
||||
local snow_threshold = vmg.noises[17].offset * 0.5 ^ (average_snow_level / altitude_chill)
|
||||
local dry_dirt_threshold = vmg.define("dry_dirt_threshold", 0.6)
|
||||
|
||||
local player_max_distance = vmg.define("player_max_distance", 450)
|
||||
|
||||
@ -662,6 +663,10 @@ function vmg.get_humidity(pos)
|
||||
return soil_humidity * (1 + water)
|
||||
end
|
||||
|
||||
function vmg.test_dry(pos)
|
||||
return vmg.get_humidity(pos) <= dry_dirt_threshold
|
||||
end
|
||||
|
||||
function vmg.get_temperature(pos)
|
||||
local v12 = vmg.get_noise(pos, 12) + 1 -- Lava noise for underground
|
||||
local v17 = vmg.get_noise(pos, 17) -- Climate noise
|
||||
@ -673,6 +678,10 @@ function vmg.get_temperature(pos)
|
||||
end
|
||||
end
|
||||
|
||||
function vmg.test_snow(pos)
|
||||
return vmg.get_temperature(pos) <= snow_threshold
|
||||
end
|
||||
|
||||
function vmg.get_noise(pos, i)
|
||||
local n = vmg.noises[i]
|
||||
local noise = minetest.get_perlin(n.seed, n.octaves, n.persist, 1)
|
||||
|
@ -85,6 +85,8 @@ local function register_dirts(readname)
|
||||
}),
|
||||
})
|
||||
|
||||
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {itemstr_dirt},
|
||||
interval = 2,
|
||||
@ -96,8 +98,10 @@ local function register_dirts(readname)
|
||||
if nodedef and (nodedef.sunlight_propagates or nodedef.paramtype == "light")
|
||||
and nodedef.liquidtype == "none"
|
||||
and (minetest.get_node_light(above) or 0) >= 13 then
|
||||
if name == "default:snow" or name == "default:snowblock" then
|
||||
if name == "default:snow" or name == "default:snowblock" or (vmg.test_snow and vmg.test_snow(pos)) then
|
||||
minetest.set_node(pos, {name = itemstr_snow})
|
||||
elseif vmg.test_dry and vmg.test_dry(pos) then
|
||||
minetest.set_node(pos, {name = itemstr_dry})
|
||||
else
|
||||
minetest.set_node(pos, {name = itemstr_lawn})
|
||||
end
|
||||
@ -106,7 +110,7 @@ local function register_dirts(readname)
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {itemstr_lawn},
|
||||
nodenames = {itemstr_lawn, itemstr_dry},
|
||||
interval = 2,
|
||||
chance = 20,
|
||||
action = function(pos, node)
|
||||
|
@ -75,6 +75,9 @@ vmg_dirt_threshold (Normal dirt threshold) float 0.5
|
||||
# height at which the half of the surface is covered by snow.
|
||||
vmg_average_snow_level (Average snow level) int 100
|
||||
|
||||
# if humidity is below this value, make dry dirt instead of lawn
|
||||
vmg_dry_dirt_threshold (Dry dirt threshold) float 0.6
|
||||
|
||||
[*Rivers]
|
||||
# Simply the depth of the rivers
|
||||
vmg_river_depth (River depth) int 3
|
||||
|
Loading…
x
Reference in New Issue
Block a user