1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-11-07 19:10:23 +01:00

added refill for cocoa and fix bug

This commit is contained in:
crabman77 2015-08-30 19:05:50 +02:00
parent 12a4679290
commit 3e9d26e28d
2 changed files with 12 additions and 3 deletions

View File

@ -25,6 +25,15 @@ function place_cocoa(itemstack, placer, pointed_thing, plantname)
minetest.add_node(pt.above, {name = plantname}) minetest.add_node(pt.above, {name = plantname})
if not minetest.setting_getbool("creative_mode") then if not minetest.setting_getbool("creative_mode") then
itemstack:take_item() 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 end
return itemstack return itemstack
end end

View File

@ -71,7 +71,7 @@ dofile(farming.path.."/compatibility.lua") -- Farming Plus compatibility
-- Utility Functions -- Utility Functions
local time_speed = tonumber(minetest.setting_get("time_speed")) or 72 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) local function clamp(x, min, max)
return (x < min and min) or (x > max and max) or x return (x < min and min) or (x > max and max) or x