Фикс выпадения ресурсов из травы #1

Merged
Reload merged 1 commits from Koldun/BBQ:grass_dropes into devel 2024-11-03 22:44:11 +03:00

View File

@ -64,25 +64,46 @@ end
--MAKE YEAST NATURALLY OCCURING
-------------------------------
for i = 1, 5 do
minetest.override_item("default:grass_"..i, {drop = {
max_items = 1,
items = {
{items = {'farming:seed_wheat'},rarity = 5},
{items = {'bbq:yeast'},rarity = 8},
{items = {'default:grass_1'}},
}
}})
local function append_drops(itemstring, items)
local def = minetest.registered_items[itemstring]
local newdrop
if type(def.drop) == "table" then
newdrop = {max_items = def.drop.max_items, items = {}}
local olditems = def.drop.items
local savedpos = nil
for i, it in ipairs(olditems) do
if it.rarity == nil then
savedpos = i
break
end
table.insert(newdrop.items, it)
end
for _, it in ipairs(items) do
table.insert(newdrop.items, it)
end
if savedpos ~= nil then
for i = savedpos, #olditems do
table.insert(newdrop.items, olditems[i])
end
end
else
newdrop = {max_items = 1, items = table.copy(items)}
if type(def.drop) == "string" then
table.insert(newdrop.items, {items = {def.drop}})
end
end
minetest.override_item(itemstring, {drop = newdrop})
end
minetest.override_item("default:junglegrass", {drop = {
max_items = 1,
items = {
{items = {'farming:seed_cotton'},rarity = 8},
{items = {'bbq:yeast'},rarity = 8},
{items = {'default:junglegrass'}},
}
}})
for i = 1, 5 do
append_drops("default:grass_"..i, {
{items = {"bbq:yeast"}, rarity = 8},
})
end
append_drops("default:junglegrass", {
{items = {"bbq:yeast"}, rarity = 8},
})
-----------------------------------------------
--MAKE VESSEL TYPE ITEMS WORK WITH VESSEL SHELF