1
0
Fork 0

Disable cocoa generator for non v6 mapgens

This commit is contained in:
Wuzzy 2017-05-27 00:55:56 +02:00
parent f132bc78a3
commit 077242efa4
1 changed files with 43 additions and 42 deletions

View File

@ -184,51 +184,52 @@ crop_def.selection_box = {
crop_def.drop = "mcl_dye:brown 3"
minetest.register_node("mcl_cocoas:cocoa_3", table.copy(crop_def))
-- Add random cocoa pods to jungle trees
-- Add random cocoa pods to jungle trees (v6 only)
-- TODO: Do this more efficiently, with LuaVoxelManip
minetest.register_on_generated(function(minp, maxp)
if maxp.y < 0 then
return
end
local pos, treepos, dir
local cocoa = minetest.find_nodes_in_area(minp, maxp, "mcl_core:jungletree")
for n = 1, #cocoa do
pos = cocoa[n]
treepos = table.copy(pos)
if minetest.find_node_near(pos, 1, {"mcl_core:jungleleaves"}) then
dir = math.random(1, 40)
if dir == 1 then
pos.z = pos.z + 1
elseif dir == 2 then
pos.z = pos.z - 1
elseif dir == 3 then
pos.x = pos.x + 1
elseif dir == 4 then
pos.x = pos.x -1
end
local nn = minetest.get_node(pos).name
if dir < 5
and nn == "air"
and minetest.get_node_light(pos) > 12 then
minetest.swap_node(pos, {
name = "mcl_cocoas:cocoa_" .. tostring(math.random(1, 3)),
param2 = minetest.dir_to_facedir(vector.subtract(treepos, pos))
})
end
if minetest.get_mapgen_setting("mg_name") == "v6" then
minetest.register_on_generated(function(minp, maxp)
if maxp.y < 0 then
return
end
end
end)
local pos, treepos, dir
local cocoa = minetest.find_nodes_in_area(minp, maxp, "mcl_core:jungletree")
for n = 1, #cocoa do
pos = cocoa[n]
treepos = table.copy(pos)
if minetest.find_node_near(pos, 1, {"mcl_core:jungleleaves"}) then
dir = math.random(1, 40)
if dir == 1 then
pos.z = pos.z + 1
elseif dir == 2 then
pos.z = pos.z - 1
elseif dir == 3 then
pos.x = pos.x + 1
elseif dir == 4 then
pos.x = pos.x -1
end
local nn = minetest.get_node(pos).name
if dir < 5
and nn == "air"
and minetest.get_node_light(pos) > 12 then
minetest.swap_node(pos, {
name = "mcl_cocoas:cocoa_" .. tostring(math.random(1, 3)),
param2 = minetest.dir_to_facedir(vector.subtract(treepos, pos))
})
end
end
end
end)
end
minetest.register_abm({
label = "Cocoa growth",