1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2025-06-28 06:11:47 +02:00

Update riesenpilz

And add a new dependency : vector_extras
This commit is contained in:
Ombridride
2014-12-14 23:54:40 +01:00
parent 7126d2af7f
commit 863a9bb1cb
15 changed files with 1017 additions and 184 deletions

View File

@ -6,10 +6,10 @@ function riesenpilz_circle(nam, pos, radius, rand, seed)
if math.floor( math.sqrt(i^2+j^2) +0.5) == radius then
random = PseudoRandom(ra)
p={x=pos.x+i, y=pos.y, z=pos.z+j}
if minetest.get_node(p).name == "air"
if minetest.env:get_node(p).name == "air"
and random:next(1,rand) == 1
and minetest.get_node({x=pos.x+i, y=pos.y-1, z=pos.z+j}).name ~= "air" then
minetest.add_node(p, {name=nam})
and minetest.env:get_node({x=pos.x+i, y=pos.y-1, z=pos.z+j}).name ~= "air" then
minetest.env:add_node(p, {name=nam})
end
ra = ra+1
end
@ -32,10 +32,10 @@ function riesenpilz_circle(nam, pos, radius, chance)
for i = -radius, radius, 1 do
for j = -radius, radius, 1 do
if math.floor( math.sqrt(i^2+j^2) +0.5) == radius
and minetest.get_node({x=pos.x+i, y=pos.y, z=pos.z+j}).name == "air"
and minetest.env:get_node({x=pos.x+i, y=pos.y, z=pos.z+j}).name == "air"
and math.random(1,chance) == 1
and minetest.get_node({x=pos.x+i, y=pos.y-1, z=pos.z+j}).name == "riesenpilz:ground" then
minetest.add_node({x=pos.x+i, y=pos.y, z=pos.z+j}, {name=nam})
and minetest.env:get_node({x=pos.x+i, y=pos.y-1, z=pos.z+j}).name == "riesenpilz:ground" then
minetest.env:add_node({x=pos.x+i, y=pos.y, z=pos.z+j}, {name=nam})
end
end
end
@ -43,7 +43,7 @@ end
local function find_ground(pos, nodes)
for _, evground in ipairs(nodes) do
if minetest.get_node(pos).name == evground then
if minetest.env:get_node(pos).name == evground then
return true
end
end
@ -55,8 +55,8 @@ USUAL_STUFF = {"default:leaves","default:apple","default:tree","default:cactus",
minetest.register_on_generated(function(minp, maxp, seed)
if maxp.y >= -10 then
local x0,z0,x1,z1 = minp.x,minp.z,maxp.x,maxp.z -- Assume X and Z lengths are equal
--local env = minetest.|env --Should make things a bit faster.
local perlin1 = minetest.get_perlin(11,3, 0.5, 200) --Get map specific perlin
local env = minetest.env --Should make things a bit faster.
local perlin1 = env:get_perlin(11,3, 0.5, 200) --Get map specific perlin
--[[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)
@ -77,9 +77,9 @@ minetest.register_on_generated(function(minp, maxp, seed)
local pr = PseudoRandom(seed+68)
--remove usual stuff
local trees = minetest.find_nodes_in_area(minp, maxp, USUAL_STUFF)
local trees = env:find_nodes_in_area(minp, maxp, USUAL_STUFF)
for i,v in pairs(trees) do
minetest.remove_node(v)
env:remove_node(v)
end
--Information:
@ -113,18 +113,18 @@ minetest.register_on_generated(function(minp, maxp, seed)
end
end
if ground_y then
minetest.add_node({x=x,y=ground_y,z=z}, {name="riesenpilz:ground"})
env:add_node({x=x,y=ground_y,z=z}, {name="riesenpilz:ground"})
for i = -1,-5,-1 do
local pos = {x=x,y=ground_y+i,z=z}
if minetest.get_node(pos).name == "default:desert_sand" then
minetest.add_node(pos, {name="default:dirt"})
if env:get_node(pos).name == "default:desert_sand" then
env:add_node(pos, {name="default:dirt"})
else
break
end
end
local boden = {x=x,y=ground_y+1,z=z}
if pr:next(1,15) == 1 then
minetest.add_node(boden, {name="default:dry_shrub"})
env:add_node(boden, {name="default:dry_shrub"})
elseif pr:next(1,80) == 1 then
riesenpilz_circle("riesenpilz:brown", boden, pr:next(3,4), 3)
elseif pr:next(1,90) == 1 then
@ -136,15 +136,15 @@ minetest.register_on_generated(function(minp, maxp, seed)
elseif pr:next(1,5000) == 1 then
riesenpilz_circle("riesenpilz:glowshroom", boden, 3, 3)
--[[elseif pr:next(1,80) == 1 then
minetest.add_node(boden, {name="riesenpilz:brown"})
env:add_node(boden, {name="riesenpilz:brown"})
elseif pr:next(1,90) == 1 then
minetest.add_node(boden, {name="riesenpilz:red"})
env:add_node(boden, {name="riesenpilz:red"})
elseif pr:next(1,100) == 1 then
minetest.add_node(boden, {name="riesenpilz:fly_agaric"})
env:add_node(boden, {name="riesenpilz:fly_agaric"})
elseif pr:next(1,4000) == 1 then
minetest.add_node(boden, {name="riesenpilz:lavashroom"})
env:add_node(boden, {name="riesenpilz:lavashroom"})
elseif pr:next(1,5000) == 1 then
minetest.add_node(boden, {name="riesenpilz:glowshroom"})]]
env:add_node(boden, {name="riesenpilz:glowshroom"})]]
elseif pr:next(1,380) == 1 then
riesenpilz_hybridpilz(boden)
elseif pr:next(1,340) == 10 then
@ -161,8 +161,8 @@ minetest.register_on_generated(function(minp, maxp, seed)
end
if maxp.y < -10 then
local x0,z0,x1,z1 = minp.x,minp.z,maxp.x,maxp.z -- Assume X and Z lengths are equal
--local env = minetest.|env --Should make things a bit faster.
local perlin1 = minetest.get_perlin(11,3, 0.5, 200) --Get map specific perlin
local env = minetest.env --Should make things a bit faster.
local perlin1 = env:get_perlin(11,3, 0.5, 200) --Get map specific perlin
--[[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)
@ -189,12 +189,12 @@ minetest.register_on_generated(function(minp, maxp, seed)
for y=minp.y,maxp.y,1 do
local pos = {x=x, y=y, z=z}
if minetest.get_node(pos).name == "air"
and minetest.get_node({x=x, y=y-1, z=z}).name == "default:stone"
if env:get_node(pos).name == "air"
and env:get_node({x=x, y=y-1, z=z}).name == "default:stone"
and pr:next(1,40) == 33
and minetest.find_node_near(pos, 4, "group:igniter")
and not minetest.find_node_near(pos, 3, "group:igniter") then
minetest.add_node(pos, {name="riesenpilz:lavashroom"})
and env:find_node_near(pos, 4, "group:igniter")
and not env:find_node_near(pos, 3, "group:igniter") then
env:add_node(pos, {name="riesenpilz:lavashroom"})
end
end
end