From: Thomas--S Date: Wed, 8 Feb 2017 23:59:25 +0000 (+0100) Subject: Make drop logic work better for non-8-step-plants. (#1544) X-Git-Tag: 0.4.16~92 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=c88c0a98fdef2ada6f886ff6543380025e726337;p=oweals%2Fminetest_game.git Make drop logic work better for non-8-step-plants. (#1544) Using @paramat's formula. --- diff --git a/mods/farming/api.lua b/mods/farming/api.lua index 182e1b20..b6e3ee3e 100644 --- a/mods/farming/api.lua +++ b/mods/farming/api.lua @@ -330,12 +330,16 @@ farming.register_plant = function(name, def) -- Register growing steps for i = 1, def.steps do + local base_rarity = 1 + if def.steps ~= 1 then + base_rarity = 8 - (i - 1) * 7 / (def.steps - 1) + end local drop = { items = { - {items = {mname .. ":" .. pname}, rarity = 9 - i}, - {items = {mname .. ":" .. pname}, rarity= 18 - i * 2}, - {items = {mname .. ":seed_" .. pname}, rarity = 9 - i}, - {items = {mname .. ":seed_" .. pname}, rarity = 18 - i * 2}, + {items = {mname .. ":" .. pname}, rarity = base_rarity}, + {items = {mname .. ":" .. pname}, rarity = base_rarity * 2}, + {items = {mname .. ":seed_" .. pname}, rarity = base_rarity}, + {items = {mname .. ":seed_" .. pname}, rarity = base_rarity * 2}, } } local nodegroups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1}