1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2025-07-20 00:20:24 +02:00

update farming mod

This commit is contained in:
2015-10-26 23:43:06 +01:00
parent f13e394c4d
commit 2fb116685c
45 changed files with 351 additions and 28 deletions

View File

@ -1,7 +1,8 @@
--[[
Minetest Farming Redo Mod 1.20 (5th July 2015)
Minetest Farming Redo Mod 1.22 (26th October 2015)
by TenPlus1
NEW growing routine by prestidigitator
auto-refill by crabman77
]]
farming = {}
@ -64,6 +65,7 @@ dofile(farming.path.."/raspberry.lua")
dofile(farming.path.."/blueberry.lua")
dofile(farming.path.."/rhubarb.lua")
dofile(farming.path.."/beanpole.lua")
dofile(farming.path.."/grapes.lua")
dofile(farming.path.."/donut.lua")
dofile(farming.path.."/mapgen.lua")
dofile(farming.path.."/compatibility.lua") -- Farming Plus compatibility
@ -390,7 +392,7 @@ if farming.DEBUG then
end
end
--MFF DEBUT1 crabman(26/08/2015) refill placed plant
-- refill placed plant by crabman (26/08/2015)
local can_refill_plant = {
["farming:blueberry_1"] = "farming:blueberries",
["farming:carrot_1"] = "farming:carrot",
@ -405,7 +407,7 @@ local can_refill_plant = {
["farming:rhubarb_1"] = "farming:rhubarb",
["farming:tomato_1"] = "farming:tomato",
["farming:wheat_1"] = "farming:seed_wheat"
}
}
function farming.refill_plant(player, plantname, index)
local inv = player:get_inventory()
@ -420,7 +422,7 @@ function farming.refill_plant(player, plantname, index)
return
end
end
end --MFF FIN1
end -- END refill
-- Place Seeds on Soil
@ -428,7 +430,7 @@ function farming.place_seed(itemstack, placer, pointed_thing, plantname)
local pt = pointed_thing
-- check if pointing at a node
if not pt and pt.type ~= "node" then
if not pt or pt.type ~= "node" then
return
end
@ -449,18 +451,26 @@ function farming.place_seed(itemstack, placer, pointed_thing, plantname)
-- can I replace above node, and am I pointing at soil
if not minetest.registered_nodes[above.name].buildable_to
or minetest.get_item_group(under.name, "soil") < 2
or minetest.get_item_group(above.name, "plant") ~= 0 then -- ADDED this line for multiple seed placement bug
-- avoid multiple seed placement bug
or minetest.get_item_group(above.name, "plant") ~= 0 then
return
end
-- add the node and remove 1 item from the itemstack
-- if not protected then add node and remove 1 item from the itemstack
if not minetest.is_protected(pt.above, placer:get_player_name()) then
minetest.add_node(pt.above, {name=plantname})
minetest.set_node(pt.above, {name = plantname, param2 = 1})
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
if itemstack:get_count() == 0 and can_refill_plant[plantname] then--MFF DEBUT2 crabman(26/08/2015) refill placed plant
minetest.after(0.10, farming.refill_plant, placer, can_refill_plant[plantname], placer:get_wield_index())
end --MFF FIN2
-- check for refill
if itemstack:get_count() == 0
and can_refill_plant[plantname] then
minetest.after(0.10,
farming.refill_plant,
placer,
can_refill_plant[plantname],
placer:get_wield_index()
)
end -- END refill
end
return itemstack
end
@ -508,7 +518,7 @@ farming.register_plant = function(name, def)
})
-- Register growing steps
for i=1,def.steps do
for i = 1, def.steps do
local drop = {
items = {
{items = {mname .. ":" .. pname}, rarity = 9 - i},
@ -532,7 +542,6 @@ farming.register_plant = function(name, def)
paramtype = "light",
walkable = false,
buildable_to = true,
is_ground_content = true,
drop = drop,
selection_box = farming.select,
groups = g,