small changes

This commit is contained in:
HybridDog
2015-08-16 13:20:12 +02:00
parent 54b6d9976c
commit e4e856dd7f

View File

@ -118,13 +118,11 @@ minetest.register_ore({
})
-- Sulfur
minetest.register_on_generated(function(minp, maxp, seed)
minetest.register_on_generated(function(minp, maxp)
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
local a = VoxelArea:new{
MinEdge = {x = emin.x, y = emin.y, z = emin.z},
MaxEdge = {x = emax.x, y = emax.y, z = emax.z},
}
local data = vm:get_data()
local a = VoxelArea:new{MinEdge=emin, MaxEdge=emax}
local pr = PseudoRandom(17 * minp.x + 42 * minp.y + 101 * minp.z)
local noise = minetest.get_perlin(9876, 3, 0.5, 100)
@ -138,12 +136,14 @@ minetest.register_on_generated(function(minp, maxp, seed)
for y = minp.y + math.floor(grid_size / 2), maxp.y, grid_size do
for z = minp.z + math.floor(grid_size / 2), maxp.z, grid_size do
local c = data[a:index(x, y, z)]
if (c == c_lava or c == c_lava_flowing) and noise:get3d({x = x, y = z, z = z}) >= 0.4 then
if (c == c_lava or c == c_lava_flowing)
and noise:get3d({x = x, y = z, z = z}) >= 0.4 then
for xx = math.max(minp.x, x - grid_size), math.min(maxp.x, x + grid_size) do
for yy = math.max(minp.y, y - grid_size), math.min(maxp.y, y + grid_size) do
for zz = math.max(minp.z, z - grid_size), math.min(maxp.z, z + grid_size) do
local i = a:index(xx, yy, zz)
if data[i] == c_stone and pr:next(1, 10) <= 7 then
if data[i] == c_stone
and pr:next(1, 10) <= 7 then
data[i] = c_sulfur
end
end
@ -188,4 +188,3 @@ minetest.register_ore({
noise_params = {offset=0, scale=15, spread={x=130, y=130, z=130}, seed=24, octaves=3, persist=0.70}
})
end