Extra error checking.
This commit is contained in:
parent
aa999e2ed5
commit
bf26b8bee1
25 changed files with 897 additions and 314 deletions
15
decogen.lua
15
decogen.lua
|
@ -25,7 +25,11 @@ local plant_noise = {offset = 0.0, scale = 1.0, spread = {x = 200, y = 200, z =
|
|||
|
||||
|
||||
-- Air needs to be placed prior to decorations.
|
||||
fun_caves.decogen = function(minp, maxp, data, p2data, area, node, heightmap, biomemap, biome_ids, underzone, dis_map)
|
||||
fun_caves.decogen = function(minp, maxp, data, p2data, area, node, heightmap, biomemap, biome_ids, underzone)
|
||||
if not (minp and maxp and data and p2data and area and node and type(data) == 'table' and type(p2data) == 'table') then
|
||||
return
|
||||
end
|
||||
|
||||
csize = vector.add(vector.subtract(maxp, minp), 1)
|
||||
|
||||
local map_max = {x = csize.x, y = csize.y + 2, z = csize.z}
|
||||
|
@ -33,6 +37,9 @@ fun_caves.decogen = function(minp, maxp, data, p2data, area, node, heightmap, bi
|
|||
|
||||
local biome_n = minetest.get_perlin_map(biome_noise, map_max):get3dMap_flat(map_min)
|
||||
local plant_n = minetest.get_perlin_map(plant_noise, {x=csize.x, y=csize.z}):get2dMap_flat({x=minp.x, y=minp.z})
|
||||
if not (biome_n and plant_n) then
|
||||
return
|
||||
end
|
||||
|
||||
local math_random = math.random
|
||||
local dis_map = {}
|
||||
|
@ -350,7 +357,11 @@ fun_caves.decogen = function(minp, maxp, data, p2data, area, node, heightmap, bi
|
|||
pos.x = x
|
||||
pos.y = y
|
||||
pos.z = z
|
||||
local posm, count = minetest.find_nodes_in_area(pos, pos, desc.place_on)
|
||||
local posm = minetest.find_nodes_in_area(pos, pos, desc.place_on)
|
||||
if not (posm and type(posm) == 'table') then
|
||||
return
|
||||
end
|
||||
|
||||
if #posm > 0 then
|
||||
node_match_cache[desc.content_id][data[ivm]] = "good"
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue