Fix a very rare bug, add rubber tree if moretrees is there.

This commit is contained in:
Novatux 2013-10-30 09:58:38 +01:00
parent f3f38ba23c
commit 66562f5c49
3 changed files with 22 additions and 1 deletions

View File

@ -2,3 +2,4 @@ default
farming farming
wool wool
stairs stairs
moretrees?

View File

@ -200,3 +200,23 @@ mg.register_tree({
end end
end end
}) })
function mg.get_spawn_tree_func(treedef)
return function(data, a, x, y, z, minp, maxp, pr)
if minp.y <= y and y <= maxp.y then
minetest.after(0, minetest.spawn_tree, {x=x, y=y, z=z}, treedef)
end
end
end
if minetest.get_modpath("moretrees") then
mg.register_tree({
min_humidity = 0,
min_temperature = 0.2,
min_height = 1,
max_height = 5,
grows_on = c_grass,
chance = 800,
grow = mg.get_spawn_tree_func(moretrees.rubber_tree_model)
})
end

View File

@ -34,7 +34,7 @@ local function choose_building(l, pr)
while true do while true do
local p = pr:next(1, 3000) local p = pr:next(1, 3000)
for b, i in ipairs(buildings) do for b, i in ipairs(buildings) do
if i.max_weight > p then if i.max_weight >= p then
btype = b btype = b
break break
end end