Add garnet and zoisite functions.
This commit is contained in:
parent
f438090899
commit
e6f482c9d5
4 changed files with 91 additions and 15 deletions
12
cavegen.lua
12
cavegen.lua
|
@ -1,9 +1,9 @@
|
||||||
local cave_width = 0.05 -- figurative width
|
fun_caves.cave_width = 0.05 -- figurative width
|
||||||
local max_depth = 31000
|
local max_depth = 31000
|
||||||
|
|
||||||
|
|
||||||
local cave_noise_1 = {offset = 0, scale = 1, seed = 3901, spread = {x = 40, y = 10, z = 40}, octaves = 3, persist = 1, lacunarity = 2}
|
fun_caves.cave_noise_1 = {offset = 0, scale = 1, seed = 3901, spread = {x = 40, y = 10, z = 40}, octaves = 3, persist = 1, lacunarity = 2}
|
||||||
local cave_noise_2 = {offset = 0, scale = 1, seed = -8402, spread = {x = 40, y = 20, z = 40}, octaves = 3, persist = 1, lacunarity = 2}
|
fun_caves.cave_noise_2 = {offset = 0, scale = 1, seed = -8402, spread = {x = 40, y = 20, z = 40}, octaves = 3, persist = 1, lacunarity = 2}
|
||||||
local cave_noise_3 = {offset = 15, scale = 10, seed = 3721, spread = {x = 40, y = 40, z = 40}, octaves = 3, persist = 1, lacunarity = 2}
|
local cave_noise_3 = {offset = 15, scale = 10, seed = 3721, spread = {x = 40, y = 40, z = 40}, octaves = 3, persist = 1, lacunarity = 2}
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,8 +13,8 @@ fun_caves.cavegen = function(minp, maxp, data, area, node, heightmap, underzone)
|
||||||
local map_min = {x = minp.x, y = minp.y - 1, z = minp.z}
|
local map_min = {x = minp.x, y = minp.y - 1, z = minp.z}
|
||||||
--local noise_area = VoxelArea:new({MinEdge=map_min, MaxEdge={x=maxp.x,y=maxp.y+1,z=maxp.z}})
|
--local noise_area = VoxelArea:new({MinEdge=map_min, MaxEdge={x=maxp.x,y=maxp.y+1,z=maxp.z}})
|
||||||
|
|
||||||
local cave_1 = minetest.get_perlin_map(cave_noise_1, map_max):get3dMap_flat(map_min)
|
local cave_1 = minetest.get_perlin_map(fun_caves.cave_noise_1, map_max):get3dMap_flat(map_min)
|
||||||
local cave_2 = minetest.get_perlin_map(cave_noise_2, map_max):get3dMap_flat(map_min)
|
local cave_2 = minetest.get_perlin_map(fun_caves.cave_noise_2, map_max):get3dMap_flat(map_min)
|
||||||
local cave_3 = minetest.get_perlin_map(cave_noise_3, {x=csize.x, y=csize.z}):get2dMap_flat({x=minp.x, y=minp.z})
|
local cave_3 = minetest.get_perlin_map(cave_noise_3, {x=csize.x, y=csize.z}):get2dMap_flat({x=minp.x, y=minp.z})
|
||||||
|
|
||||||
local write = false
|
local write = false
|
||||||
|
@ -66,7 +66,7 @@ fun_caves.cavegen = function(minp, maxp, data, area, node, heightmap, underzone)
|
||||||
write = true
|
write = true
|
||||||
elseif underzone and (y < underzone.ceiling + 10 - (underzone.vary and cave_3[index] or 0) and y > underzone.floor - 10 + (underzone.vary and cave_3[index] or 0)) then
|
elseif underzone and (y < underzone.ceiling + 10 - (underzone.vary and cave_3[index] or 0) and y > underzone.floor - 10 + (underzone.vary and cave_3[index] or 0)) then
|
||||||
-- nop
|
-- nop
|
||||||
elseif ((y <= maxp.y and y >= minp.y) or (data[ivm] == node['default:stone'])) and y < height - cave_3[index] and cave_1[index3d] * cave_2[index3d] > cave_width then
|
elseif ((y <= maxp.y and y >= minp.y) or (data[ivm] == node['default:stone'])) and y < height - cave_3[index] and cave_1[index3d] * cave_2[index3d] > fun_caves.cave_width then
|
||||||
if y <= fun_caves.underzones['Styx'].sealevel then
|
if y <= fun_caves.underzones['Styx'].sealevel then
|
||||||
data[ivm] = node["default:water_source"]
|
data[ivm] = node["default:water_source"]
|
||||||
else
|
else
|
||||||
|
|
|
@ -38,11 +38,12 @@ end
|
||||||
-- end
|
-- end
|
||||||
--end
|
--end
|
||||||
|
|
||||||
fun_caves.is_fortress = function(pos, cs, debug)
|
fun_caves.is_fortress = function(pos, cs)
|
||||||
-- Fix this to get csize, somehow.
|
-- Fix this to get csize, somehow.
|
||||||
-- Remember that this function may be called
|
-- Remember that this function may be called
|
||||||
-- before any chunks are generated.
|
-- before any chunks are generated.
|
||||||
|
|
||||||
|
pos = vector.round(pos)
|
||||||
local cs = cs or {x=80, y=80, z=80}
|
local cs = cs or {x=80, y=80, z=80}
|
||||||
local offset = math.floor(cs.y / 2) - 8 + 1
|
local offset = math.floor(cs.y / 2) - 8 + 1
|
||||||
|
|
||||||
|
@ -59,10 +60,8 @@ fun_caves.is_fortress = function(pos, cs, debug)
|
||||||
|
|
||||||
local n = minetest.get_perlin(fortress_noise):get3d({x=x, y=y, z=z})
|
local n = minetest.get_perlin(fortress_noise):get3d({x=x, y=y, z=z})
|
||||||
if fun_caves.DEBUG and math.floor((n * 10000) % 4) == 1 then
|
if fun_caves.DEBUG and math.floor((n * 10000) % 4) == 1 then
|
||||||
--print('fortress ('..x..','..y..','..z..')')
|
|
||||||
return true
|
return true
|
||||||
end
|
elseif math.floor((n * 10000) % 19) == 1 then
|
||||||
if math.floor((n * 10000) % 19) == 1 then
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
1
mobs.lua
1
mobs.lua
|
@ -183,6 +183,7 @@ if minetest.registered_entities["dmobs:fox"] then
|
||||||
|
|
||||||
local m = table.copy(minetest.registered_entities["dmobs:fox"])
|
local m = table.copy(minetest.registered_entities["dmobs:fox"])
|
||||||
m.name = 'fun_caves:fire_fox'
|
m.name = 'fun_caves:fire_fox'
|
||||||
|
m.type = 'monster'
|
||||||
m.damage = 3
|
m.damage = 3
|
||||||
m.hp_min = 8
|
m.hp_min = 8
|
||||||
m.hp_max = 24
|
m.hp_max = 24
|
||||||
|
|
|
@ -29,15 +29,91 @@ local function teleporter(user, area, power)
|
||||||
else
|
else
|
||||||
local newpos
|
local newpos
|
||||||
if area == 'overworld' then
|
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
|
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
|
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
|
elseif area == 'dungeon' then
|
||||||
|
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
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- place on the top level
|
||||||
|
newpos.y = newpos.y + 10
|
||||||
elseif area == 'underworld' then
|
elseif area == 'underworld' then
|
||||||
|
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
|
return
|
||||||
|
end
|
||||||
else
|
else
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue