1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-11-08 03:20:21 +01:00

update farming mod

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

View File

@ -13,6 +13,9 @@ This mod works by adding your new plant to the {growing=1} group and numbering t
Changelog:
1.22 - Added grape bushes at high climates which can be cultivated into grape vines using trellis (9 sticks).
1.21 - Added auto-refill code for planting crops (thanks crabman77), also fixed a few bugs
1.20b- Tidied code, made api compatible with new 0.4.13 changes and changed to soil texture overlays
1.20 - NEW growing routine added that allows crops to grow while player is away doing other things (thanks prestidigitator)
1.14 - Added Green Beans from Crops mod (thanks sofar), little bushels in the wild but need to be grown using beanpoles crafted with 4 sticks (2 either side)
1.13 - Fixed seed double-placement glitch. Mapgen now uses 0.4.12+ for plant generation

View File

@ -9,6 +9,7 @@ minetest.register_craftitem("farming:beans", {
inventory_image = "farming_beans.png",
on_use = minetest.item_eat(1),
on_place = function(itemstack, placer, pointed_thing)
if minetest.is_protected(pointed_thing.above, placer:get_player_name()) then return end
local nod = minetest.get_node_or_nil(pointed_thing.under)
if nod and nod.name == "farming:beanpole" then
minetest.set_node(pointed_thing.under, {name="farming:beanpole_1"})
@ -17,9 +18,15 @@ minetest.register_craftitem("farming:beans", {
end
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
if itemstack:get_count() == 0 then--MFF DEBUT crabman(26/08/2015) refill placed plant
minetest.after(0.20, farming.refill_plant, placer, "farming:beans", placer:get_wield_index())
end --MFF FIN
-- check for refill
if itemstack:get_count() == 0 then
minetest.after(0.20,
farming.refill_plant,
placer,
"farming:beans",
placer:get_wield_index()
)
end -- END refill
end
return itemstack
end
@ -57,6 +64,7 @@ minetest.register_node("farming:beanpole", {
},
sounds = default.node_sound_leaves_defaults(),
on_place = function(itemstack, placer, pointed_thing)
if minetest.is_protected(pointed_thing.above, placer:get_player_name()) then return end
local nod = minetest.get_node_or_nil(pointed_thing.under)
if nod and minetest.get_item_group(nod.name, "soil") < 2 then
return
@ -85,6 +93,12 @@ minetest.register_craft({
}
})
minetest.register_craft({
type = "fuel",
recipe = "farming:beanpole",
burntime = 10,
})
-- Define Green Bean growth stages
minetest.register_node("farming:beanpole_1", {
@ -221,4 +235,4 @@ minetest.register_node("farming:beanbush", {
not_in_creative_inventory=1
},
sounds = default.node_sound_leaves_defaults(),
})
})

View File

@ -22,7 +22,7 @@ function place_cocoa(itemstack, placer, pointed_thing, plantname)
end
-- add the node and remove 1 item from the itemstack
minetest.add_node(pt.above, {name = plantname})
minetest.set_node(pt.above, {name = plantname})
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
-- check for refill
@ -99,7 +99,7 @@ minetest.register_node("farming:cocoa_1", {
},
selection_box = {
type = "fixed",
fixed = {-0.27, -0.45, -0.27, 0.27, 0.45, 0.27}
fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3}
},
groups = {
snappy = 3, flammable = 2, plant = 1, growing = 1,

View File

@ -0,0 +1,295 @@
-- Grapes
minetest.register_craftitem("farming:grapes", {
description = "Grapes",
inventory_image = "farming_grapes.png",
on_use = minetest.item_eat(2),
on_place = function(itemstack, placer, pointed_thing)
if minetest.is_protected(pointed_thing.above, placer:get_player_name()) then return end
local nod = minetest.get_node_or_nil(pointed_thing.under)
if nod and nod.name == "farming:trellis" then
minetest.set_node(pointed_thing.under, {name="farming:grapes_1"})
else
return
end
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:grapes",
placer:get_wield_index()
)
end -- END refill
end
return itemstack
end
})
-- Grapes can be used for violet dye
minetest.register_craft({
output = "dye:violet",
recipe = {
{'farming:grapes'},
}
})
-- Trellis
minetest.register_node("farming:trellis", {
description = "Trellis (place on soil before planting grapes)",
drawtype = "plantlike",
tiles = {"farming_trellis.png"},
inventory_image = "farming_trellis.png",
visual_scale = 1.45,
paramtype = "light",
walkable = false,
buildable_to = true,
sunlight_propagates = true,
drop = {
items = {
{items = {'farming:trellis'}, rarity = 1},
}
},
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, attached_node = 1,
},
sounds = default.node_sound_leaves_defaults(),
on_place = function(itemstack, placer, pointed_thing)
if minetest.is_protected(pointed_thing.above, placer:get_player_name()) then return end
local nod = minetest.get_node_or_nil(pointed_thing.under)
if nod and minetest.get_item_group(nod.name, "soil") < 2 then
return
end
local top = {
x = pointed_thing.above.x,
y = pointed_thing.above.y + 1,
z = pointed_thing.above.z
}
nod = minetest.get_node_or_nil(top)
if nod and nod.name ~= "air" then return end
minetest.set_node(pointed_thing.above, {name = "farming:trellis"})
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
end
return itemstack
end
})
minetest.register_craft({
output = "farming:trellis",
recipe = {
{'default:stick', 'default:stick', 'default:stick'},
{'default:stick', 'default:stick', 'default:stick'},
{'default:stick', 'default:stick', 'default:stick'},
}
})
minetest.register_craft({
type = "fuel",
recipe = "farming:trellis",
burntime = 15,
})
-- Define Grapes growth stages
minetest.register_node("farming:grapes_1", {
drawtype = "plantlike",
tiles = {"farming_grapes_1.png"},
visual_scale = 1.45,
paramtype = "light",
walkable = false,
buildable_to = true,
sunlight_propagates = true,
drop = {
items = {
{items = {'farming:trellis'}, rarity = 1},
}
},
selection_box = farming.select,
groups = {
snappy = 3, flammable = 3, not_in_creative_inventory = 1,
attached_node = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("farming:grapes_2", {
drawtype = "plantlike",
tiles = {"farming_grapes_2.png"},
visual_scale = 1.45,
paramtype = "light",
walkable = false,
buildable_to = true,
sunlight_propagates = true,
drop = {
items = {
{items = {'farming:trellis'}, rarity = 1},
}
},
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("farming:grapes_3", {
drawtype = "plantlike",
tiles = {"farming_grapes_3.png"},
visual_scale = 1.45,
paramtype = "light",
walkable = false,
buildable_to = true,
sunlight_propagates = true,
drop = {
items = {
{items = {'farming:trellis'}, rarity = 1},
}
},
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("farming:grapes_4", {
drawtype = "plantlike",
tiles = {"farming_grapes_4.png"},
visual_scale = 1.45,
paramtype = "light",
walkable = false,
buildable_to = true,
sunlight_propagates = true,
drop = {
items = {
{items = {'farming:trellis'}, rarity = 1},
}
},
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("farming:grapes_5", {
drawtype = "plantlike",
tiles = {"farming_grapes_5.png"},
visual_scale = 1.45,
paramtype = "light",
walkable = false,
buildable_to = true,
sunlight_propagates = true,
drop = {
items = {
{items = {'farming:trellis'}, rarity = 1},
}
},
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("farming:grapes_6", {
drawtype = "plantlike",
tiles = {"farming_grapes_6.png"},
visual_scale = 1.45,
paramtype = "light",
walkable = false,
buildable_to = true,
sunlight_propagates = true,
drop = {
items = {
{items = {'farming:trellis'}, rarity = 1},
}
},
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("farming:grapes_7", {
drawtype = "plantlike",
tiles = {"farming_grapes_7.png"},
visual_scale = 1.45,
paramtype = "light",
walkable = false,
buildable_to = true,
sunlight_propagates = true,
drop = {
items = {
{items = {'farming:trellis'}, rarity = 1},
}
},
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- Last stage of growth does not have growing group so abm never checks these
minetest.register_node("farming:grapes_8", {
drawtype = "plantlike",
tiles = {"farming_grapes_8.png"},
visual_scale = 1.45,
paramtype = "light",
walkable = false,
buildable_to = true,
sunlight_propagates = true,
drop = {
items = {
{items = {'farming:trellis'}, rarity = 1},
{items = {'farming:grapes 3'}, rarity = 1},
{items = {'farming:grapes 1'}, rarity = 2},
{items = {'farming:grapes 1'}, rarity = 3},
}
},
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1
},
sounds = default.node_sound_leaves_defaults(),
})
-- Wild Grape Vine (this is what you find on the map)
minetest.register_node("farming:grapebush", {
drawtype = "plantlike",
tiles = {"farming_grapebush.png"},
paramtype = "light",
waving = 1,
walkable = false,
buildable_to = true,
sunlight_propagates = true,
drop = {
items = {
{items = {'farming:grapes 1'}, rarity = 1},
{items = {'farming:grapes 1'}, rarity = 2},
{items = {'farming:grapes 1'}, rarity = 3},
}
},
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory=1
},
sounds = default.node_sound_leaves_defaults(),
})

View File

@ -1,9 +1,9 @@
-- Override default grass and have it drop Wheat Seeds
for i=1,5 do
for i = 1, 5 do
minetest.override_item("default:grass_"..i, {
minetest.override_item("default:grass_" .. i, {
drop = {
max_items = 1,
items = {

View File

@ -76,7 +76,7 @@ function farming.hoe_on_use(itemstack, user, pointed_thing, uses)
return
end
local p = {x=pt.under.x, y=pt.under.y+1, z=pt.under.z}
local p = {x = pt.under.x, y = pt.under.y + 1, z = pt.under.z}
local above = minetest.get_node(p)
-- return if any of the nodes is not registered

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,

View File

@ -34,6 +34,7 @@ function farming.register_mgv6_decorations()
register_plant("rhubarb_3", 3, 15, "group:tree", 1)
register_plant("blueberry_4", 3, 10, "", -1)
register_plant("beanbush", 18, 35, "", -1)
register_plant("grapebush", 25, 45, "", -1)
end
-- v7 maps have a beach so plants growing near water is limited to 6- high
@ -51,6 +52,7 @@ function farming.register_mgv7_decorations()
register_plant("rhubarb_3", 3, 15, "group:tree", 1)
register_plant("blueberry_4", 3, 10, "", -1)
register_plant("beanbush", 18, 35, "", -1)
register_plant("grapebush", 25, 45, "", -1)
end
-- detect mapgen

View File

@ -1,23 +1,23 @@
-- normal soil
minetest.register_node("farming:soil", {
description = "Soil",
tiles = {"farming_soil.png", "default_dirt.png"},
tiles = {"default_dirt.png^farming_soil.png", "default_dirt.png"},
drop = "default:dirt",
groups = {crumbly = 3, not_in_creative_inventory = 1, soil = 2},
sounds = default.node_sound_dirt_defaults(),
})
-- sand is not soil, change existing sand-soil to use normal soil
minetest.register_alias("farming:desert_sand_soil", "farming:soil")
-- wet soil
minetest.register_node("farming:soil_wet", {
description = "Wet Soil",
tiles = {"farming_soil_wet.png", "farming_soil_wet_side.png"},
tiles = {"default_dirt.png^farming_soil_wet.png", "default_dirt.png^farming_soil_wet_side.png"},
drop = "default:dirt",
groups = {crumbly = 3, not_in_creative_inventory = 1, soil = 3},
sounds = default.node_sound_dirt_defaults(),
})
-- sand is not soil, change existing sand-soil to use normal soil
minetest.register_alias("farming:desert_sand_soil", "farming:soil")
minetest.register_alias("farming:desert_sand_soil_wet", "farming:soil_wet")
-- if water near soil then change to wet soil

Binary file not shown.

Before

Width:  |  Height:  |  Size: 116 B

After

Width:  |  Height:  |  Size: 110 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 141 B

After

Width:  |  Height:  |  Size: 120 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 162 B

After

Width:  |  Height:  |  Size: 144 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 198 B

After

Width:  |  Height:  |  Size: 150 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 226 B

After

Width:  |  Height:  |  Size: 159 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 290 B

After

Width:  |  Height:  |  Size: 164 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 319 B

After

Width:  |  Height:  |  Size: 170 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 289 B

After

Width:  |  Height:  |  Size: 196 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 271 B

After

Width:  |  Height:  |  Size: 150 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 204 B

After

Width:  |  Height:  |  Size: 159 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 175 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 255 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 290 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 307 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 330 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 347 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 358 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 350 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 713 B

After

Width:  |  Height:  |  Size: 706 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 659 B

After

Width:  |  Height:  |  Size: 677 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 721 B

After

Width:  |  Height:  |  Size: 96 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 799 B

After

Width:  |  Height:  |  Size: 892 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 563 B

After

Width:  |  Height:  |  Size: 241 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 127 B

After

Width:  |  Height:  |  Size: 120 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 164 B

After

Width:  |  Height:  |  Size: 142 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 203 B

After

Width:  |  Height:  |  Size: 172 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 230 B

After

Width:  |  Height:  |  Size: 191 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 298 B

After

Width:  |  Height:  |  Size: 218 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 396 B

After

Width:  |  Height:  |  Size: 234 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 479 B

After

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 582 B

After

Width:  |  Height:  |  Size: 310 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 338 B

After

Width:  |  Height:  |  Size: 141 B

View File

@ -79,7 +79,7 @@ minetest.register_craft({
minetest.register_craftitem("farming:bread", {
description = "Bread",
inventory_image = "farming_bread.png",
on_use = minetest.item_eat(4),
on_use = minetest.item_eat(4), --MFF 4
})
minetest.register_craft({