From 3e9d26e28de4147677a8ba2d6d2ee6f999123c04 Mon Sep 17 00:00:00 2001 From: crabman77 Date: Sun, 30 Aug 2015 19:05:50 +0200 Subject: [PATCH] added refill for cocoa and fix bug --- minetestforfun_game/mods/farming/cocoa.lua | 11 ++++++++++- minetestforfun_game/mods/farming/init.lua | 4 ++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/minetestforfun_game/mods/farming/cocoa.lua b/minetestforfun_game/mods/farming/cocoa.lua index 5a1cfb49..a1301831 100755 --- a/minetestforfun_game/mods/farming/cocoa.lua +++ b/minetestforfun_game/mods/farming/cocoa.lua @@ -25,6 +25,15 @@ function place_cocoa(itemstack, placer, pointed_thing, plantname) minetest.add_node(pt.above, {name = plantname}) if not minetest.setting_getbool("creative_mode") then itemstack:take_item() + -- check for refill + if itemstack:get_count() == 0 then + minetest.after(0.20, + farming.refill_plant, + placer, + "farming:cocoa_beans", + placer:get_wield_index() + ) + end -- END refill end return itemstack end @@ -173,4 +182,4 @@ minetest.register_abm({ }) end end, -}) \ No newline at end of file +}) diff --git a/minetestforfun_game/mods/farming/init.lua b/minetestforfun_game/mods/farming/init.lua index 84293e4c..f22b38b3 100755 --- a/minetestforfun_game/mods/farming/init.lua +++ b/minetestforfun_game/mods/farming/init.lua @@ -71,7 +71,7 @@ dofile(farming.path.."/compatibility.lua") -- Farming Plus compatibility -- Utility Functions local time_speed = tonumber(minetest.setting_get("time_speed")) or 72 -local SECS_PER_CYCLE = (time_speed > 0 and 24 * 60 * 60 / time_speed) or nil +local SECS_PER_CYCLE = (time_speed > 0 and 24 * 60 * 60 / time_speed) or 0 --nil local function clamp(x, min, max) return (x < min and min) or (x > max and max) or x @@ -551,4 +551,4 @@ farming.register_plant("farming:cotton", { description = "Cotton2 seed", inventory_image = "farming_cotton_seed.png", steps = 8, -})]] \ No newline at end of file +})]]