update
This commit is contained in:
parent
331a53bda6
commit
820499cebb
@ -138,4 +138,5 @@ minetest.register_abm({
|
|||||||
,})
|
,})
|
||||||
|
|
||||||
--function anti_generate(node, surfaces, minp, maxp, height_min, height_max, spread, habitat_size, habitat_nodes)
|
--function anti_generate(node, surfaces, minp, maxp, height_min, height_max, spread, habitat_size, habitat_nodes)
|
||||||
--habitat:generate("sumpf:birk", {"default:dirt_with_grass"}, minp, maxp, 20, 25, 100, 500, {"default:water_source"},30,{"default:desert_sand"})
|
minetest.register_on_generated(function(minp, maxp, seed)
|
||||||
|
generate("sumpf:birk", {"default:dirt_with_grass"}, minp, maxp, 20, 25, 100, 500, {"default:water_source"},30,{"default:desert_sand"})end)
|
||||||
|
4
init.lua
4
init.lua
@ -87,7 +87,7 @@ minetest.register_node("sumpf:dirtywater_flowing", {
|
|||||||
liquid_alternative_flowing = "sumpf:dirtywater_flowing",
|
liquid_alternative_flowing = "sumpf:dirtywater_flowing",
|
||||||
liquid_alternative_source = "sumpf:dirtywater_source",
|
liquid_alternative_source = "sumpf:dirtywater_source",
|
||||||
liquid_viscosity = WATER_VISC,
|
liquid_viscosity = WATER_VISC,
|
||||||
post_effect_color = {a=64, r=100, g=100, b=200},
|
post_effect_color = {a=64, r=70, g=90, b=120},
|
||||||
groups = {water=3, liquid=3, puts_out_fire=1, not_in_creative_inventory=1},
|
groups = {water=3, liquid=3, puts_out_fire=1, not_in_creative_inventory=1},
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ minetest.register_node("sumpf:dirtywater_source", {
|
|||||||
liquid_alternative_flowing = "sumpf:dirtywater_flowing",
|
liquid_alternative_flowing = "sumpf:dirtywater_flowing",
|
||||||
liquid_alternative_source = "sumpf:dirtywater_source",
|
liquid_alternative_source = "sumpf:dirtywater_source",
|
||||||
liquid_viscosity = WATER_VISC,
|
liquid_viscosity = WATER_VISC,
|
||||||
post_effect_color = {a=64, r=100, g=100, b=200},
|
post_effect_color = {a=64, r=70, g=90, b=120},
|
||||||
groups = {water=3, liquid=3, puts_out_fire=1},
|
groups = {water=3, liquid=3, puts_out_fire=1},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
224
mapgen.lua
224
mapgen.lua
@ -1,26 +1,80 @@
|
|||||||
--[[local function generate_kohle(minp, maxp, seed, chunks_per_volume, chunk_size, ore_per_chunk, height_min, height_max)
|
local function generate_ore(name, wherein, minp, maxp, seed, chunks_per_volume, ore_per_chunk, height_min, height_max)
|
||||||
default.generate_ore(
|
if maxp.y < height_min or minp.y > height_max then
|
||||||
"sumpf:kohle", "sumpf:junglestone", minp, maxp, seed, chunks_per_volume, chunk_size, ore_per_chunk, height_min, height_max
|
return
|
||||||
)
|
end
|
||||||
|
local y_min = math.max(minp.y, height_min)
|
||||||
|
local y_max = math.min(maxp.y, height_max)
|
||||||
|
local volume = (maxp.x-minp.x+1)*(y_max-y_min+1)*(maxp.z-minp.z+1)
|
||||||
|
local pr = PseudoRandom(seed)
|
||||||
|
local num_chunks = math.floor(chunks_per_volume * volume)
|
||||||
|
local chunk_size = 3
|
||||||
|
if ore_per_chunk <= 4 then
|
||||||
|
chunk_size = 2
|
||||||
|
end
|
||||||
|
local inverse_chance = math.floor(chunk_size*chunk_size*chunk_size / ore_per_chunk)
|
||||||
|
--print("generate_ore num_chunks: "..dump(num_chunks))
|
||||||
|
for i=1,num_chunks do
|
||||||
|
if (y_max-chunk_size+1 <= y_min) then return end
|
||||||
|
local y0 = pr:next(y_min, y_max-chunk_size+1)
|
||||||
|
if y0 >= height_min and y0 <= height_max then
|
||||||
|
local x0 = pr:next(minp.x, maxp.x-chunk_size+1)
|
||||||
|
local z0 = pr:next(minp.z, maxp.z-chunk_size+1)
|
||||||
|
local p0 = {x=x0, y=y0, z=z0}
|
||||||
|
for x1=0,chunk_size-1 do
|
||||||
|
for y1=0,chunk_size-1 do
|
||||||
|
for z1=0,chunk_size-1 do
|
||||||
|
if pr:next(1,inverse_chance) == 1 then
|
||||||
|
local x2 = x0+x1
|
||||||
|
local y2 = y0+y1
|
||||||
|
local z2 = z0+z1
|
||||||
|
local p2 = {x=x2, y=y2, z=z2}
|
||||||
|
if minetest.env:get_node(p2).name == wherein then
|
||||||
|
minetest.env:set_node(p2, {name=name})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
--print("generate_ore done")
|
||||||
end
|
end
|
||||||
|
|
||||||
local function generate_eisen(minp, maxp, seed, chunks_per_volume, chunk_size, ore_per_chunk, height_min, height_max)
|
local function generate_kohle(minp, maxp, seed, chunks_per_volume, chunk_size, height_min, height_max)
|
||||||
default.generate_ore(
|
generate_ore("sumpf:kohle", "sumpf:junglestone", minp, maxp, seed, chunks_per_volume, chunk_size, height_min, height_max)
|
||||||
"sumpf:eisen", "sumpf:junglestone", minp, maxp, seed, chunks_per_volume, chunk_size, ore_per_chunk, height_min, height_max
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
]]
|
|
||||||
|
local function generate_eisen(minp, maxp, seed, chunks_per_volume, chunk_size, height_min, height_max)
|
||||||
|
generate_ore("sumpf:eisen", "sumpf:junglestone", minp, maxp, seed, chunks_per_volume, chunk_size, height_min, height_max)
|
||||||
|
end
|
||||||
|
|
||||||
minetest.register_alias("sumpf:pilz", "riesenpilz:brown")
|
minetest.register_alias("sumpf:pilz", "riesenpilz:brown")
|
||||||
|
|
||||||
|
local function avoid_nearby_node(pos, node)
|
||||||
|
if minetest.env:get_node({x=pos.x-1, y=pos.y, z=pos.z}).name == node then return false end
|
||||||
|
if minetest.env:get_node({x=pos.x+1, y=pos.y, z=pos.z}).name == node then return false end
|
||||||
|
if minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z-1}).name == node then return false end
|
||||||
|
if minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z+1}).name == node then return false end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
local function find_ground(pos, nodes)
|
||||||
|
for _, evground in ipairs(nodes) do
|
||||||
|
if minetest.env:get_node(pos).name == evground then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
SUMPFGROUND = {"default:dirt_with_grass","default:dirt","default:sand","default:desert_sand"}
|
SUMPFGROUND = {"default:dirt_with_grass","default:dirt","default:sand","default:desert_sand"}
|
||||||
EVSUMPFGROUND = {"default:dirt_with_grass","default:dirt","default:sand","default:desert_sand", "default:water_source"}
|
EVSUMPFGROUND = {"default:dirt_with_grass","default:dirt","default:sand","default:desert_sand", "default:water_source"}
|
||||||
|
USUAL_STUFF = {"default:leaves","default:apple","default:tree","default:dry_shrub","default:cactus","default:papyrus"}
|
||||||
minetest.register_on_generated(function(minp, maxp, seed)
|
minetest.register_on_generated(function(minp, maxp, seed)
|
||||||
if maxp.y >= -10 then
|
if maxp.y >= -10 then
|
||||||
-- Assume X and Z lengths are equal
|
local x0,z0,x1,z1 = minp.x,minp.z,maxp.x,maxp.z -- Assume X and Z lengths are equal
|
||||||
local divs = (maxp.x-minp.x);
|
local env = minetest.env --Should make things a bit faster.
|
||||||
local x0,z0,x1,z1,env = minp.x,minp.z,maxp.x,maxp.z,minetest.env
|
local perlin1 = env:get_perlin(11,3, 0.5, 200) --Get map specific perlin
|
||||||
local perlin1 = env:get_perlin(11,3, 0.5, 200)
|
|
||||||
pr = PseudoRandom(seed+68)
|
|
||||||
|
|
||||||
--[[if not (perlin1:get2d({x=x0, y=z0}) > 0.53) and not (perlin1:get2d({x=x1, y=z1}) > 0.53)
|
--[[if not (perlin1:get2d({x=x0, y=z0}) > 0.53) and not (perlin1:get2d({x=x1, y=z1}) > 0.53)
|
||||||
and not (perlin1:get2d({x=x0, y=z1}) > 0.53) and not (perlin1:get2d({x=x1, y=z0}) > 0.53)
|
and not (perlin1:get2d({x=x0, y=z1}) > 0.53) and not (perlin1:get2d({x=x1, y=z0}) > 0.53)
|
||||||
@ -37,9 +91,11 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
print("abortsumpf")
|
print("abortsumpf")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
local divs = (maxp.x-minp.x);
|
||||||
|
local pr = PseudoRandom(seed+68)
|
||||||
|
|
||||||
--remove usual stuff
|
--remove usual stuff
|
||||||
local trees = env:find_nodes_in_area(minp, maxp, {"default:leaves","default:tree"})
|
local trees = env:find_nodes_in_area(minp, maxp, USUAL_STUFF)
|
||||||
for i,v in pairs(trees) do
|
for i,v in pairs(trees) do
|
||||||
env:remove_node(v)
|
env:remove_node(v)
|
||||||
end
|
end
|
||||||
@ -50,7 +106,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
minetest.chat_send_all(geninfo)
|
minetest.chat_send_all(geninfo)
|
||||||
|
|
||||||
local smooth = sumpf.smooth
|
local smooth = sumpf.smooth
|
||||||
local bi = pr:next(1,2) == 1
|
local swampwater = sumpf.swampwater
|
||||||
|
|
||||||
for j=0,divs do
|
for j=0,divs do
|
||||||
for i=0,divs do
|
for i=0,divs do
|
||||||
@ -69,77 +125,85 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
if in_biome then
|
if in_biome then
|
||||||
|
|
||||||
local ground_y = nil --Definition des Bodens:
|
local ground_y = nil --Definition des Bodens:
|
||||||
for _, evground in ipairs(EVSUMPFGROUND) do
|
for y=maxp.y,0,-1 do
|
||||||
for y=maxp.y,0,-1 do
|
if find_ground({x=x,y=y,z=z}, EVSUMPFGROUND) then
|
||||||
if env:get_node({x=x,y=y,z=z}).name == evground then
|
ground_y = y
|
||||||
ground_y = y
|
break
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
for _, ground in ipairs(SUMPFGROUND) do
|
end
|
||||||
if ground_y
|
local ground = {x=x,y=ground_y,z=z}
|
||||||
and env:get_node({x=x,y=ground_y,z=z}).name == ground then
|
if ground_y
|
||||||
if bi then --Pflanzen (und Pilz):
|
and find_ground({x=x,y=ground_y,z=z}, SUMPFGROUND) then --Pflanzen (und Pilz):
|
||||||
if pr:next(1,40) == 1 then
|
local boden = {x=x,y=ground_y+1,z=z}
|
||||||
mache_birke({x=x,y=ground_y+1,z=z})
|
if pr:next(1,80) == 1 then
|
||||||
elseif pr:next(1,10) == 1 then
|
mache_birke(boden)
|
||||||
env:add_node({x=x,y=ground_y+1,z=z}, {name="jungletree:sapling"})
|
elseif pr:next(1,20) == 1 then
|
||||||
elseif pr:next(1,25) == 1 then
|
env:add_node(boden, {name="jungletree:sapling"})
|
||||||
env:add_node({x=x,y=ground_y+1,z=z}, {name="riesenpilz:brown"})
|
elseif pr:next(1,50) == 1 then
|
||||||
elseif pr:next(1,50) == 1 then
|
env:add_node(boden, {name="riesenpilz:brown"})
|
||||||
env:add_node({x=x,y=ground_y+1,z=z}, {name="riesenpilz:red"})
|
elseif pr:next(1,100) == 1 then
|
||||||
elseif pr:next(1,100) == 1 then
|
env:add_node(boden, {name="riesenpilz:red"})
|
||||||
env:add_node({x=x,y=ground_y+1,z=z}, {name="riesenpilz:fly_agaric"})
|
elseif pr:next(1,200) == 1 then
|
||||||
elseif pr:next(1,2) == 1 then
|
env:add_node(boden, {name="riesenpilz:fly_agaric"})
|
||||||
env:add_node({x=x,y=ground_y+1,z=z}, {name="sumpf:gras"})
|
elseif pr:next(1,4) == 1 then
|
||||||
elseif pr:next(1,3) == 1 then
|
env:add_node(boden, {name="sumpf:gras"})
|
||||||
env:add_node({x=x,y=ground_y+1,z=z}, {name="default:junglegrass"})
|
elseif pr:next(1,6) == 1 then
|
||||||
end
|
env:add_node(boden, {name="default:junglegrass"})
|
||||||
end --Sumpfwasser:
|
end --Sumpfwasser:
|
||||||
if pr:next(1,4) == 1
|
if swampwater
|
||||||
and env:get_node({x=x+1,y=ground_y,z=z}).name ~= "air"
|
and pr:next(1,2) == 2
|
||||||
and env:get_node({x=x-1,y=ground_y,z=z}).name ~= "air"
|
and avoid_nearby_node(ground, "air")
|
||||||
and env:get_node({x=x,y=ground_y,z=z+1}).name ~= "air"
|
and avoid_nearby_node(ground, "default:junglegrass")
|
||||||
and env:get_node({x=x,y=ground_y,z=z-1}).name ~= "air" then
|
and avoid_nearby_node(ground, "sumpf:gras")
|
||||||
for s=0,-30,-1 do
|
and avoid_nearby_node(ground, "riesenpilz:brown")
|
||||||
env:add_node({x=x,y=ground_y+s,z=z}, {name="sumpf:dirtywater_source"})
|
and avoid_nearby_node(ground, "riesenpilz:red")
|
||||||
env:add_node({x=x,y=ground_y+1,z=z}, {name="air"}) --because of the plants
|
and avoid_nearby_node(ground, "riesenpilz:fly_agaric")
|
||||||
end
|
and avoid_nearby_node(ground, "ignore")
|
||||||
else --Sumpfboden:
|
and env:get_node(boden).name == "air" then
|
||||||
for i=-3,-30,-1 do
|
for s=0,-20-pr:next(1,9),-1 do
|
||||||
for l=-1,0,1 do
|
local pos = {x=x,y=ground_y+s,z=z}
|
||||||
if env:get_node({x=x,y=ground_y+i,z=z}).name ~= "air" then
|
if env:get_node(pos).name ~= "air" then
|
||||||
env:add_node({x=x,y=ground_y+l,z=z}, {name="sumpf:sumpf"})
|
env:add_node(pos, {name="sumpf:dirtywater_source"})
|
||||||
env:add_node({x=x,y=ground_y-2,z=z}, {name="sumpf:sumpf2"})
|
else
|
||||||
env:add_node({x=x,y=ground_y+i,z=z}, {name="sumpf:junglestone"})
|
break
|
||||||
else break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end --Dreckseen:
|
|
||||||
elseif ground_y
|
|
||||||
and env:get_node({x=x,y=ground_y,z=z}).name == "default:water_source"
|
|
||||||
and env:find_node_near({x=x,y=ground_y,z=z}, 2+math.random(3), "group:crumbly") then
|
|
||||||
for y=0,-30,-1 do
|
|
||||||
if env:get_node({x=x,y=ground_y+y,z=z}).name == "default:water_source" then
|
|
||||||
env:add_node({x=x,y=ground_y+y,z=z}, {name="sumpf:dirtywater_source"})
|
|
||||||
else
|
|
||||||
env:add_node({x=x,y=ground_y+y,z=z}, {name="sumpf:peat"})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
else --Sumpfboden:
|
||||||
|
for l=-1,0,1 do
|
||||||
|
env:add_node({x=x,y=ground_y+l,z=z}, {name="sumpf:sumpf"})
|
||||||
|
end
|
||||||
|
env:add_node({x=x,y=ground_y-2,z=z}, {name="sumpf:sumpf2"})
|
||||||
|
for i=-3,-30,-1 do
|
||||||
|
local pos = {x=x,y=ground_y+i,z=z}
|
||||||
|
if env:get_node(pos).name ~= "air" then
|
||||||
|
env:add_node(pos, {name="sumpf:junglestone"})
|
||||||
|
else
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end --Dreckseen:
|
||||||
|
elseif ground_y
|
||||||
|
and env:get_node(ground).name == "default:water_source"
|
||||||
|
and env:find_node_near(ground, 2+math.random(3), "group:crumbly") then
|
||||||
|
for y=0,-30,-1 do
|
||||||
|
local pos = {x=x,y=ground_y+y,z=z}
|
||||||
|
if env:get_node(pos).name == "default:water_source" then
|
||||||
|
env:add_node(pos, {name="sumpf:dirtywater_source"})
|
||||||
|
else
|
||||||
|
env:add_node(pos, {name="sumpf:peat"})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
--[[ Generate ores
|
-- Generate ores
|
||||||
generate_kohle(minp, maxp, seed+0, 1/8/8/8, 3, 8, -31000, 64)
|
generate_kohle(minp, maxp, seed+0, 1/8/8/8, 3, -31000, 64)
|
||||||
generate_eisen(minp, maxp, seed+1, 1/12/12/12, 2, 3, -15, 2)
|
generate_eisen(minp, maxp, seed+1, 1/12/12/12, 2, -15, 2)
|
||||||
generate_eisen(minp, maxp, seed+2, 1/9/9/9, 3, 5, -63, -16)
|
generate_eisen(minp, maxp, seed+2, 1/9/9/9, 3, -63, -16)
|
||||||
generate_eisen(minp, maxp, seed+3, 1/7/7/7, 3, 5, -31000, -64)
|
generate_eisen(minp, maxp, seed+3, 1/7/7/7, 3, -31000, -64)
|
||||||
|
|
||||||
generate_kohle(minp, maxp, seed+7, 1/24/24/24, 6,27, -31000, 0)
|
generate_kohle(minp, maxp, seed+7, 1/24/24/24, 6, -31000, 0)
|
||||||
generate_eisen(minp, maxp, seed+6, 1/24/24/24, 6,27, -31000, -64)]]
|
generate_eisen(minp, maxp, seed+6, 1/24/24/24, 6, -31000, -64)
|
||||||
end)
|
end)
|
||||||
|
@ -5,3 +5,6 @@ sumpf.enable_mapgen = true
|
|||||||
|
|
||||||
--Enables smooth transition of biomes.
|
--Enables smooth transition of biomes.
|
||||||
sumpf.smooth = true
|
sumpf.smooth = true
|
||||||
|
|
||||||
|
--Enables swampwater - be careful, it doesn't work right.
|
||||||
|
sumpf.swampwater = false
|
||||||
|
Loading…
x
Reference in New Issue
Block a user