Randomly scatter items in chests

This commit is contained in:
Novatux 2013-09-28 19:03:49 +02:00
parent 57cd5c789c
commit 0b9f97dd14

View File

@ -689,7 +689,11 @@ minetest.register_on_generated(function(minp, maxp, seed)
stacksz = math.floor(items[ii]:get_count() / 2 ^ 8)
if pr:next(0, prob) == 0 then
stk = ItemStack({name=items[ii]:get_name(), count=stacksz, wear=items[ii]:get_count(), metadata=items[ii]:get_metadata()})
inv:add_item("main", stk)
local ind = pr:next(1, inv:get_size("main"))
while not inv:get_stack("main",ind):is_empty() do
ind = pr:next(1, inv:get_size("main"))
end
inv:set_stack("main", ind, stk)
end
end
end