forked from Minetest/dynamic_liquid
add mapgen prefill feature for water
parent
67fed9944f
commit
eff43b5993
36
init.lua
36
init.lua
|
@ -329,4 +329,40 @@ if springs then
|
|||
end
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
local mapgen_prefill = minetest.setting_getbool("dynamic_liquid_mapgen_prefill")
|
||||
mapgen_prefill = mapgen_prefill or mapgen_prefill == nil -- default true
|
||||
|
||||
if mapgen_prefill then
|
||||
local c_water = minetest.get_content_id("default:water_source")
|
||||
local c_air = minetest.get_content_id("air")
|
||||
local water_level = minetest.get_mapgen_params().water_level
|
||||
|
||||
minetest.register_on_generated(function(minp, maxp, seed)
|
||||
if minp.y >= water_level then
|
||||
return
|
||||
end
|
||||
|
||||
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
|
||||
local area = VoxelArea:new{MinEdge=emin, MaxEdge=emax}
|
||||
vm:get_data(data)
|
||||
|
||||
local filling = false
|
||||
for z = minp.z, maxp.z do
|
||||
for x = minp.x, maxp.x do
|
||||
for y = maxp.y, minp.y, -1 do
|
||||
local vi = area:index(x,y,z)
|
||||
if data[vi] == c_water then
|
||||
filling = true
|
||||
elseif data[vi] == c_air and filling == true then
|
||||
data[vi] = c_water
|
||||
else filling = false end
|
||||
end
|
||||
filling = false
|
||||
end
|
||||
end
|
||||
vm:set_data(data)
|
||||
vm:write_to_map()
|
||||
end)
|
||||
end
|
|
@ -24,6 +24,15 @@ dynamic_liquid_springs (Springs) bool true
|
|||
#"flow_through"
|
||||
dynamic_liquid_flow_through (Flow-through) bool true
|
||||
|
||||
#During map generation, this mod can attempt to "pre-fill" underwater cave
|
||||
#entrances by replacing air directly below water with additional water blocks.
|
||||
#This process is only attempted below "sea level" and is not perfect - it will
|
||||
#only fill down to the bottom of the map block being generated and it won't
|
||||
#fill out openings to the sides. But it should hopefully reduce the magnitude
|
||||
#of the whirlpools that form over cave entrances and the load on the active
|
||||
#block modifier in these situations.
|
||||
dynamic_liquid_mapgen_prefill (Mapgen water prefill) bool true
|
||||
|
||||
[Flow Rates]
|
||||
|
||||
#Sets the probability of water flow per block per second.
|
||||
|
|
Loading…
Reference in New Issue