From 896da8d1bec5c87d347890b12e22ee84fc323bdf Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Wed, 6 May 2015 00:58:07 -0700 Subject: dmg for polebean harvest --- polebean.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/polebean.lua b/polebean.lua index cd3d055..b2804d9 100644 --- a/polebean.lua +++ b/polebean.lua @@ -89,8 +89,12 @@ local function crops_beanpole_on_dig(pos, node, digger) minetest.set_node(top, { name = "crops:beanpole_top"}) elseif bottom_n.name == "crops:beanpole_plant_base_5" and top_n.name == "crops:beanpole_plant_top_3" then -- ripe beanpole - -- FIXME dmg - for i = 1,math.random(3,7) do + local meta = minetest.get_meta(bottom) + local damage = meta:get_int("crops_damage") + -- 0 - 3-7 + -- 50 - 2-4 + -- 100 - 1-1 + for i = 1,math.random(3 - (2 * (damage / 100)),7 - (6 * (damage / 100))) do table.insert(drops, "crops:green_bean") end minetest.set_node(bottom, { name = "crops:beanpole_plant_base_6"}) -- cgit v1.2.3