Add garnet and zoisite functions.

This commit is contained in:
Duane 2016-06-22 16:01:15 -05:00
parent f438090899
commit e6f482c9d5
4 changed files with 91 additions and 15 deletions

View file

@ -29,15 +29,91 @@ local function teleporter(user, area, power)
else
local newpos
if area == 'overworld' then
newpos = {x=(math.random(2)*2-3)*(math.random(math.floor(max_depth/6))+power*math.floor(max_depth/6)), y=120, z=(math.random(2)*2-3)*(math.random(math.floor(max_depth/6))+power*math.floor(max_depth/6))}
newpos = {
x = (math.random(2)*2-3)*(math.random(math.floor(max_depth/6))+power*math.floor(max_depth/6)),
y = 120,
z = (math.random(2)*2-3)*(math.random(math.floor(max_depth/6))+power*math.floor(max_depth/6))
}
elseif area == 'hell' then
newpos = {x=pos.x, y=fun_caves.underzones[({'Caina','Phlegethos','Dis','Minauros', 'Phlegethos','Styx'})[power+1]].ceiling-30, z=pos.z}
newpos = {
x = (math.random(2)*2-3)*(math.random(math.floor(max_depth/6))+power*math.floor(max_depth/6)),
y = fun_caves.underzones[({'Caina','Phlegethos','Dis','Minauros', 'Phlegethos','Styx'})[power+1]].ceiling-30,
z = (math.random(2)*2-3)*(math.random(math.floor(max_depth/6))+power*math.floor(max_depth/6))
}
elseif area == 'sky' then
newpos = {x=pos.x, y=({4368, 8768, 13168, 4368, 4368, 4368})[power+1]+76, z=pos.z}
newpos = {
x = (math.random(2)*2-3)*(math.random(math.floor(max_depth/6))+power*math.floor(max_depth/6)),
y = ({4368, 8768, 13168, 4368, 4368, 4368})[power+1]+76,
z = (math.random(2)*2-3)*(math.random(math.floor(max_depth/6))+power*math.floor(max_depth/6))
}
elseif area == 'dungeon' then
return
newpos = {}
local base_pos = table.copy(pos)
if power > 0 then
base_pos.y = fun_caves.underzones[({'Caina','Phlegethos','Dis','Minauros', 'Phlegethos','Styx'})[power]].lower_bound
end
-- check below the top level
base_pos.y = base_pos.y - (base_pos.y + 32) % 80 - 12
for i = 1, 1000 do
newpos = {
x = (math.random(2)*2-3)*(math.random(math.floor(max_depth/6))+power*math.floor(max_depth/6)),
y = base_pos.y - math.random(50) * 80,
z = (math.random(2)*2-3)*(math.random(math.floor(max_depth/6))+power*math.floor(max_depth/6))
}
-- avoid walls
if newpos.x % 16 == 0 then
newpos.x = newpos.x + 1
end
if newpos.z % 16 == 0 then
newpos.z = newpos.z + 1
end
if fun_caves.is_fortress(newpos) then
break
end
end
if not fun_caves.is_fortress(newpos) then
return
end
-- place on the top level
newpos.y = newpos.y + 10
elseif area == 'underworld' then
return
local good = false
local base_pos = table.copy(pos)
base_pos.y = -100
if power > 0 then
base_pos.y = fun_caves.underzones[({'Caina','Phlegethos','Dis','Minauros', 'Phlegethos','Styx'})[power]].lower_bound
end
local c1, c2
for i = 1, 1000 do
newpos = {
x = (math.random(2)*2-3)*(math.random(math.floor(max_depth/6))+power*math.floor(max_depth/6)),
y = base_pos.y - math.random(50) * 80,
z = (math.random(2)*2-3)*(math.random(math.floor(max_depth/6))+power*math.floor(max_depth/6))
}
c1 = minetest.get_perlin(fun_caves.cave_noise_1):get3d(newpos)
c2 = minetest.get_perlin(fun_caves.cave_noise_2):get3d(newpos)
if c1 * c2 > fun_caves.cave_width then
newpos.y = newpos.y - 1
c1 = minetest.get_perlin(fun_caves.cave_noise_1):get3d(newpos)
c2 = minetest.get_perlin(fun_caves.cave_noise_2):get3d(newpos)
if c1 * c2 > fun_caves.cave_width then
good = true
break
end
end
end
if not good then
return
end
else
return
end