summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAuke Kok <auke-jan.h.kok@intel.com>2015-05-06 00:58:07 -0700
committerAuke Kok <auke-jan.h.kok@intel.com>2015-05-06 00:58:07 -0700
commit896da8d1bec5c87d347890b12e22ee84fc323bdf (patch)
treec534bb612ba1ab54685a100b7d93c40a2ff72f02
parent342fd7881ea77fa59d4311f69c8ba9530e38d35c (diff)
dmg for polebean harvest
-rw-r--r--polebean.lua8
1 files 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"})