Add Minauros and zombies (only there).
This commit is contained in:
parent
d22195be27
commit
10bb057f61
19 changed files with 5781 additions and 56 deletions
83
decogen.lua
83
decogen.lua
|
@ -26,8 +26,61 @@ local min = math.min
|
|||
local log = math.log
|
||||
local floor = math.floor
|
||||
local find_nodes_in_area = minetest.find_nodes_in_area
|
||||
local csize
|
||||
|
||||
|
||||
local function place_schematic(minp, maxp, data, p2data, area, node, pos, schem, center)
|
||||
local rot = rand(4) - 1
|
||||
local yslice = {}
|
||||
if schem.yslice_prob then
|
||||
for _, ys in pairs(schem.yslice_prob) do
|
||||
yslice[ys.ypos] = ys.prob
|
||||
end
|
||||
end
|
||||
|
||||
if center then
|
||||
pos.x = pos.x - floor(schem.size.x / 2)
|
||||
pos.z = pos.z - floor(schem.size.z / 2)
|
||||
end
|
||||
|
||||
for z1 = 0, schem.size.z - 1 do
|
||||
for x1 = 0, schem.size.x - 1 do
|
||||
local x, z
|
||||
if rot == 0 then
|
||||
x, z = x1, z1
|
||||
elseif rot == 1 then
|
||||
x, z = schem.size.z - z1 - 1, x1
|
||||
elseif rot == 2 then
|
||||
x, z = schem.size.x - x1 - 1, schem.size.z - z1 - 1
|
||||
elseif rot == 3 then
|
||||
x, z = z1, schem.size.x - x1 - 1
|
||||
end
|
||||
local dz = pos.z - minp.z + z
|
||||
local dx = pos.x - minp.x + x
|
||||
if pos.x + x > minp.x and pos.x + x < maxp.x and pos.z + z > minp.z and pos.z + z < maxp.z then
|
||||
local ivm = area:index(pos.x + x, pos.y, pos.z + z)
|
||||
local isch = z1 * schem.size.y * schem.size.x + x1 + 1
|
||||
for y = 0, schem.size.y - 1 do
|
||||
local dy = pos.y - minp.y + y
|
||||
--if math.min(dx, csize.x - dx) + math.min(dy, csize.y - dy) + math.min(dz, csize.z - dz) > bevel then
|
||||
if yslice[y] or 255 >= rand(255) then
|
||||
local prob = schem.data[isch].prob or schem.data[isch].param1 or 255
|
||||
if prob >= rand(255) and schem.data[isch].name ~= "air" then
|
||||
data[ivm] = node[schem.data[isch].name]
|
||||
end
|
||||
local param2 = schem.data[isch].param2 or 0
|
||||
p2data[ivm] = param2
|
||||
end
|
||||
--end
|
||||
|
||||
ivm = ivm + area.ystride
|
||||
isch = isch + schem.size.x
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function surround(node, data, area, ivm)
|
||||
-- Check to make sure that a plant root is fully surrounded.
|
||||
-- This is due to the kludgy way you have to make water plants
|
||||
|
@ -55,7 +108,7 @@ 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, biome_ids, underzone, dis_map)
|
||||
local csize = vector.add(vector.subtract(maxp, minp), 1)
|
||||
csize = vector.add(vector.subtract(maxp, minp), 1)
|
||||
local biomemap = minetest.get_mapgen_object("biomemap")
|
||||
local map_max = {x = csize.x, y = csize.y + 2, z = csize.z}
|
||||
local map_min = {x = minp.x, y = minp.y - 1, z = minp.z}
|
||||
|
@ -106,6 +159,12 @@ fun_caves.decogen = function(minp, maxp, data, p2data, area, node, heightmap, bi
|
|||
elseif underzone == 3 then
|
||||
stone_type = node["fun_caves:hot_brass"]
|
||||
stone_depth = 1
|
||||
elseif underzone == 4 and y % 4960 <= 145 then
|
||||
stone_type = node["fun_caves:polluted_dirt"]
|
||||
stone_depth = 2
|
||||
elseif underzone == 4 and y % 4960 > 145 then
|
||||
stone_type = node["fun_caves:black_sand"]
|
||||
stone_depth = 2
|
||||
elseif underzone == 6 then
|
||||
stone_type = node["default:dirt"]
|
||||
stone_depth = 2
|
||||
|
@ -268,6 +327,10 @@ fun_caves.decogen = function(minp, maxp, data, p2data, area, node, heightmap, bi
|
|||
data[ivm] = node["default:lava_source"]
|
||||
write = true
|
||||
break
|
||||
elseif node_below == node["fun_caves:polluted_dirt"] and rand(400) == 1 then
|
||||
data[ivm] = node["fun_caves:water_poison_source"]
|
||||
write = true
|
||||
break
|
||||
elseif node_below == node["fun_caves:stone_with_moss"] and rand(300) == 1 then
|
||||
data[ivm] = node["default:water_source"]
|
||||
write = true
|
||||
|
@ -302,6 +365,24 @@ fun_caves.decogen = function(minp, maxp, data, p2data, area, node, heightmap, bi
|
|||
break
|
||||
|
||||
-- vegetation
|
||||
elseif node_below == node["fun_caves:polluted_dirt"] then
|
||||
if rand(10) == 1 then
|
||||
data[ivm] = node["default:dry_shrub"]
|
||||
write = true
|
||||
break
|
||||
elseif rand(50) == 1 then
|
||||
local air_count = 0
|
||||
local j
|
||||
for i = 1, 9 do
|
||||
j = ivm + area.ystride * i
|
||||
if j <= #data and data[j] == node["air"] then
|
||||
air_count = air_count + 1
|
||||
end
|
||||
end
|
||||
if air_count > 6 then
|
||||
place_schematic(minp, maxp, data, p2data, area, node, {x=x,y=y,z=z}, fun_caves.schematics['decaying_tree'], true)
|
||||
end
|
||||
end
|
||||
elseif node_below == node["default:dirt"] and (stone_type == node["fun_caves:stone_with_lichen"] or stone_type == node["fun_caves:stone_with_algae"]) and biome_val >= -0.5 then
|
||||
if rand(10) == 1 then
|
||||
data[ivm] = node["flowers:mushroom_red"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue