1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-12-25 02:00:37 +01:00

Updated farming

- Solves #238
This commit is contained in:
LeMagnesium 2015-08-24 16:44:20 +02:00
parent 645d3afa48
commit 96c5216e26
24 changed files with 696 additions and 573 deletions

View File

@ -1,28 +0,0 @@
farming.register_hoe(name, hoe definition)
-> Register a new hoe, see [hoe definition]
farming.register_plant(name, Plant definition)
-> Register a new growing plant, see [Plant definition]
Hoe Definition
{
description = "", -- Description for tooltip
inventory_image = "unknown_item.png", -- Image to be used as wield- and inventory image
max_uses = 30, -- Uses until destroyed
material = "", -- Material for recipes
recipe = { -- Craft recipe, if material isn't used
{"air", "air", "air"},
{"", "group:stick"},
{"", "group:stick"},
}
}
Plant definition
{
description = "", -- Description of seed item
inventory_image = "unknown_item.png", -- Image to be used as seed's wield- and inventory image
steps = 8, -- How many steps the plant has to grow, until it can be harvested
^ Always provide a plant texture for each step, format: modname_plantname_i.png (i = stepnumber)
minlight = 13, -- Minimum light to grow
maxlight = default.LIGHT_MAX -- Maximum light to grow
}

View File

@ -22,6 +22,14 @@ minetest.register_craftitem("farming:beans", {
end
})
-- Beans can be used for green dye
minetest.register_craft({
output = "dye:green",
recipe = {
{'farming:beans'},
}
})
-- Beanpole
minetest.register_node("farming:beanpole", {
@ -36,19 +44,28 @@ minetest.register_node("farming:beanpole", {
sunlight_propagates = true,
drop = {
items = {
{items = {'farming:beanpole'},rarity=1},
{items = {'farming:beanpole'}, rarity = 1},
}
},
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,not_in_creative_inventory=1,attached_node=1},
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, attached_node = 1,
not_in_creative_inventory = 1
},
sounds = default.node_sound_leaves_defaults(),
on_place = function(itemstack, placer, pointed_thing)
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}
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:beanpole"})
minetest.set_node(pointed_thing.above, {name = "farming:beanpole"})
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
end
@ -77,11 +94,14 @@ minetest.register_node("farming:beanpole_1", {
sunlight_propagates = true,
drop = {
items = {
{items = {'farming:beanpole'},rarity=1},
{items = {'farming:beanpole'}, rarity = 1},
}
},
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=3,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -95,11 +115,14 @@ minetest.register_node("farming:beanpole_2", {
sunlight_propagates = true,
drop = {
items = {
{items = {'farming:beanpole'},rarity=1},
{items = {'farming:beanpole'}, rarity = 1},
}
},
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -113,11 +136,14 @@ minetest.register_node("farming:beanpole_3", {
sunlight_propagates = true,
drop = {
items = {
{items = {'farming:beanpole'},rarity=1},
{items = {'farming:beanpole'}, rarity = 1},
}
},
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -132,35 +158,40 @@ minetest.register_node("farming:beanpole_4", {
sunlight_propagates = true,
drop = {
items = {
{items = {'farming:beanpole'},rarity=1},
{items = {'farming:beanpole'}, rarity = 1},
}
},
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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 Green Bean growth does not have growing=1 so abm never has to check these
-- Last stage of growth does not have growing group so abm never checks these
minetest.register_node("farming:beanpole_5", {
drawtype = "plantlike",
tiles = {"farming_beanpole_5.png"},
visual_scale = 1.45,
paramtype = "light",
waving = 1,
walkable = false,
buildable_to = true,
sunlight_propagates = true,
drop = {
items = {
{items = {'farming:beanpole'},rarity=1},
{items = {'farming:beans 3'},rarity=1},
{items = {'farming:beans 2'},rarity=2},
{items = {'farming:beans 2'},rarity=3},
{items = {'farming:beanpole'}, rarity = 1},
{items = {'farming:beans 3'}, rarity = 1},
{items = {'farming:beans 2'}, rarity = 2},
{items = {'farming:beans 2'}, rarity = 3},
}
},
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1},
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(),
})
@ -176,12 +207,15 @@ minetest.register_node("farming:beanbush", {
sunlight_propagates = true,
drop = {
items = {
{items = {'farming:beans 1'},rarity=1},
{items = {'farming:beans 1'},rarity=2},
{items = {'farming:beans 1'},rarity=3},
{items = {'farming:beans 1'}, rarity = 1},
{items = {'farming:beans 1'}, rarity = 2},
{items = {'farming:beans 1'}, rarity = 3},
}
},
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1},
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

@ -32,12 +32,14 @@ minetest.register_node("farming:blueberry_1", {
tiles = {"farming_blueberry_1.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -50,8 +52,11 @@ minetest.register_node("farming:blueberry_2", {
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -64,12 +69,15 @@ minetest.register_node("farming:blueberry_3", {
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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 Blueberry growth does not have growing=1 so abm never has to check these
-- Last stage of growth does not have growing group so abm never checks these
minetest.register_node("farming:blueberry_4", {
drawtype = "plantlike",
@ -79,15 +87,17 @@ minetest.register_node("farming:blueberry_4", {
waving = 1,
walkable = false,
buildable_to = true,
is_ground_content = true,
drop = {
items = {
{items = {'farming:blueberries 2'},rarity=1},
{items = {'farming:blueberries'},rarity=2},
{items = {'farming:blueberries'},rarity=3},
{items = {'farming:blueberries 2'}, rarity = 1},
{items = {'farming:blueberries'}, rarity = 2},
{items = {'farming:blueberries'}, rarity = 3},
}
},
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1},
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

@ -35,12 +35,14 @@ minetest.register_node("farming:carrot_1", {
tiles = {"farming_carrot_1.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -49,12 +51,14 @@ minetest.register_node("farming:carrot_2", {
tiles = {"farming_carrot_2.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -63,12 +67,14 @@ minetest.register_node("farming:carrot_3", {
tiles = {"farming_carrot_3.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -77,12 +83,14 @@ minetest.register_node("farming:carrot_4", {
tiles = {"farming_carrot_4.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -95,8 +103,11 @@ minetest.register_node("farming:carrot_5", {
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -109,8 +120,11 @@ minetest.register_node("farming:carrot_6", {
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -122,19 +136,21 @@ minetest.register_node("farming:carrot_7", {
waving = 1,
walkable = false,
buildable_to = true,
is_ground_content = true,
drop = {
items = {
{items = {'farming:carrot'},rarity=1},
{items = {'farming:carrot 2'},rarity=3},
{items = {'farming:carrot'}, rarity = 1},
{items = {'farming:carrot 2'}, rarity = 3},
}
},
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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 Carrot growth doesnnot have growing=1 so abm never has to check these
-- Last stage of growth does not have growing group so abm never checks these
minetest.register_node("farming:carrot_8", {
drawtype = "plantlike",
@ -144,14 +160,16 @@ minetest.register_node("farming:carrot_8", {
waving = 1,
walkable = false,
buildable_to = true,
is_ground_content = true,
drop = {
items = {
{items = {'farming:carrot 2'},rarity=1},
{items = {'farming:carrot 3'},rarity=2},
{items = {'farming:carrot 2'}, rarity = 1},
{items = {'farming:carrot 3'}, rarity = 2},
}
},
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1},
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

@ -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.add_node(pt.above, {name = plantname})
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
end
@ -85,12 +85,17 @@ minetest.register_node("farming:cocoa_1", {
walkable = true,
drop = {
items = {
{items = {'farming:cocoa_beans 1'},rarity=2},
{items = {'farming:cocoa_beans 1'}, rarity = 2},
}
},
selection_box = {type = "fixed",fixed = {-0.27, -0.45, -0.27, 0.27, 0.45, 0.27},},
-- MODIFICATION MADE FOR MFF ^
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,growing=1},
selection_box = {
type = "fixed",
fixed = {-0.27, -0.45, -0.27, 0.27, 0.45, 0.27}
},
groups = {
snappy = 3, flammable = 2, plant = 1, growing = 1,
not_in_creative_inventory=1, leafdecay = 1, leafdecay_drop = 1
},
sounds = default.node_sound_leaves_defaults(),
})
@ -101,11 +106,17 @@ minetest.register_node("farming:cocoa_2", {
walkable = true,
drop = {
items = {
{items = {'farming:cocoa_beans 1'},rarity=1},
{items = {'farming:cocoa_beans 1'}, rarity = 1},
}
},
selection_box = {type = "fixed",fixed = {-0.27, -0.45, -0.27, 0.27, 0.45, 0.27},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,growing=1},
selection_box = {
type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3}
},
groups = {
snappy = 3, flammable = 2, plant = 1, growing = 1,
not_in_creative_inventory=1, leafdecay = 1, leafdecay_drop = 1
},
sounds = default.node_sound_leaves_defaults(),
})
@ -118,12 +129,18 @@ minetest.register_node("farming:cocoa_3", {
walkable = true,
drop = {
items = {
{items = {'farming:cocoa_beans 2'},rarity=1},
{items = {'farming:cocoa_beans 1'},rarity=2},
{items = {'farming:cocoa_beans 2'}, rarity = 1},
{items = {'farming:cocoa_beans 1'}, rarity = 2},
}
},
selection_box = {type = "fixed",fixed = {-0.27, -0.45, -0.27, 0.27, 0.45, 0.27},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1},
selection_box = {
type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3}
},
groups = {
snappy = 3, flammable = 2, plant = 1,
not_in_creative_inventory = 1, leafdecay = 1, leafdecay_drop = 1
},
sounds = default.node_sound_leaves_defaults(),
})
@ -145,10 +162,15 @@ minetest.register_abm({
else return
end
if minetest.get_node(pos).name == "air" and minetest.get_node_light(pos) > 12 then
-- print ("COCOA", pos.x, pos.y, pos.z)
minetest.set_node(pos,{name="farming:cocoa_"..tostring(math.random(1,3))})
end
local nod = minetest.get_node_or_nil(pos)
if nod then nod = nod.name else return end
if nod == "air"
and minetest.get_node_light(pos) > 12 then
-- print ("COCOA", pos.x, pos.y, pos.z)
minetest.set_node(pos, {
name = "farming:cocoa_"..tostring(math.random(1, 3))
})
end
end,
})

View File

@ -27,7 +27,7 @@ minetest.register_node("farming:drinking_cup", {
type = "fixed",
fixed = {-0.25, -0.5, -0.25, 0.25, 0.25, 0.25}
},
groups = {vessel=1,dig_immediate=3,attached_node=1},
groups = {vessel = 1, dig_immediate = 3, attached_node = 1},
sounds = default.node_sound_glass_defaults(),
})
@ -58,7 +58,7 @@ minetest.register_node("farming:coffee_cup", {
type = "fixed",
fixed = {-0.25, -0.5, -0.25, 0.25, 0.25, 0.25}
},
groups = {vessel=1,dig_immediate=3,attached_node=1},
groups = {vessel = 1, dig_immediate = 3, attached_node = 1},
on_use = minetest.item_eat(2, "farming:drinking_cup"),
sounds = default.node_sound_glass_defaults(),
})
@ -99,7 +99,7 @@ minetest.register_node("farming:coffee_cup_hot", {
type = "fixed",
fixed = {-0.25, -0.5, -0.25, 0.25, 0.25, 0.25}
},
groups = {vessel=1,dig_immediate=3,attached_node=1},
groups = {vessel = 1, dig_immediate = 3, attached_node = 1},
on_use = minetest.item_eat(3, "farming:drinking_cup"),
sounds = default.node_sound_glass_defaults(),
})
@ -111,12 +111,14 @@ minetest.register_node("farming:coffee_1", {
tiles = {"farming_coffee_1.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -129,8 +131,11 @@ minetest.register_node("farming:coffee_2", {
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -143,8 +148,11 @@ minetest.register_node("farming:coffee_3", {
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -157,12 +165,15 @@ minetest.register_node("farming:coffee_4", {
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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 Coffee growth doesnnot have growing=1 so abm never has to check these
-- Last stage of growth doesn not have growing group so abm never checks these
minetest.register_node("farming:coffee_5", {
drawtype = "plantlike",
@ -172,15 +183,17 @@ minetest.register_node("farming:coffee_5", {
waving = 1,
walkable = false,
buildable_to = true,
is_ground_content = true,
drop = {
items = {
{items = {'farming:coffee_beans 2'},rarity=1},
{items = {'farming:coffee_beans 2'},rarity=2},
{items = {'farming:coffee_beans 2'},rarity=3},
{items = {'farming:coffee_beans 2'}, rarity = 1},
{items = {'farming:coffee_beans 2'}, rarity = 2},
{items = {'farming:coffee_beans 2'}, rarity = 3},
}
},
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1},
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

@ -58,8 +58,11 @@ minetest.register_node("farming:corn_1", {
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -71,8 +74,11 @@ minetest.register_node("farming:corn_2", {
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -85,8 +91,11 @@ minetest.register_node("farming:corn_3", {
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -99,8 +108,11 @@ minetest.register_node("farming:corn_4", {
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -108,12 +120,16 @@ minetest.register_node("farming:corn_5", {
drawtype = "plantlike",
tiles = {"farming_corn_5.png"},
paramtype = "light",
waving = 1,
sunlight_propagates = true,
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -122,12 +138,16 @@ minetest.register_node("farming:corn_6", {
tiles = {"farming_corn_6.png"},
visual_scale = 1.45,
paramtype = "light",
waving = 1,
sunlight_propagates = true,
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -136,22 +156,25 @@ minetest.register_node("farming:corn_7", {
tiles = {"farming_corn_7.png"},
visual_scale = 1.45,
paramtype = "light",
waving = 1,
walkable = false,
buildable_to = true,
is_ground_content = true,
drop = {
items = {
{items = {'farming:corn'},rarity=1},
{items = {'farming:corn'},rarity=2},
{items = {'farming:corn'},rarity=3},
{items = {'farming:corn'}, rarity = 1},
{items = {'farming:corn'}, rarity = 2},
{items = {'farming:corn'}, rarity = 3},
}
},
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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 Corn growth doesnnot have growing=1 so abm never has to check these
-- Last stage of growth doesn not have growing group so abm never checks these
minetest.register_node("farming:corn_8", {
drawtype = "plantlike",
@ -161,15 +184,17 @@ minetest.register_node("farming:corn_8", {
waving = 1,
walkable = false,
buildable_to = true,
is_ground_content = true,
drop = {
items = {
{items = {'farming:corn 2'},rarity=1},
{items = {'farming:corn 2'},rarity=2},
{items = {'farming:corn 2'},rarity=2},
{items = {'farming:corn 2'}, rarity = 1},
{items = {'farming:corn 2'}, rarity = 2},
{items = {'farming:corn 2'}, rarity = 2},
}
},
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1},
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

@ -19,7 +19,7 @@ minetest.register_node("farming:seed_cotton", {
paramtype2 = "wallmounted",
walkable = false,
sunlight_propagates = true,
selection_box = {type = "fixed", fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
selection_box = farming.select,
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:cotton_1")
end,
@ -39,10 +39,8 @@ minetest.register_alias("farming:string", "farming:cotton")
minetest.register_craft({
output = "wool:white",
recipe = {
{"farming:string", "farming:string", "farming:string"},
{"farming:string", "farming:string", "farming:string"},
{"farming:string", "farming:string", "farming:string"},
-- ^ /MFF (Mg|05/26/2015)
{"farming:string", "farming:string"},
{"farming:string", "farming:string"},
}
})
@ -53,12 +51,14 @@ minetest.register_node("farming:cotton_1", {
tiles = {"farming_cotton_1.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -67,12 +67,14 @@ minetest.register_node("farming:cotton_2", {
tiles = {"farming_cotton_2.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -85,8 +87,11 @@ minetest.register_node("farming:cotton_3", {
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -99,8 +104,11 @@ minetest.register_node("farming:cotton_4", {
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -114,11 +122,14 @@ minetest.register_node("farming:cotton_5", {
buildable_to = true,
drop = {
items = {
{items = {"farming:seed_cotton"},rarity=1},
{items = {"farming:seed_cotton"}, rarity = 1},
}
},
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -131,12 +142,15 @@ minetest.register_node("farming:cotton_6", {
buildable_to = true,
drop = {
items = {
{items = {"farming:cotton"},rarity=1},
{items = {"farming:cotton"},rarity=2},
{items = {"farming:cotton"}, rarity = 1},
{items = {"farming:cotton"}, rarity = 2},
}
},
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -149,18 +163,21 @@ minetest.register_node("farming:cotton_7", {
buildable_to = true,
drop = {
items = {
{items = {"farming:cotton"},rarity=1},
{items = {"farming:cotton"},rarity=2},
{items = {"farming:seed_cotton"},rarity=1},
{items = {"farming:seed_cotton"},rarity=2},
{items = {"farming:cotton"}, rarity = 1},
{items = {"farming:cotton"}, rarity = 2},
{items = {"farming:seed_cotton"}, rarity = 1},
{items = {"farming:seed_cotton"}, rarity = 2},
}
},
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
-- Define last stage of Cotton growth separate and without growing=1 so abm never has to check these
-- Last stage of growth does not have growing group so abm never checks these
minetest.register_node("farming:cotton_8", {
drawtype = "plantlike",
@ -171,15 +188,18 @@ minetest.register_node("farming:cotton_8", {
buildable_to = true,
drop = {
items = {
{items = {"farming:string"},rarity=1},
{items = {"farming:string"},rarity=2},
{items = {"farming:string"},rarity=3},
{items = {"farming:seed_cotton"},rarity=1},
{items = {"farming:seed_cotton"},rarity=2},
{items = {"farming:seed_cotton"},rarity=3},
{items = {"farming:string"}, rarity = 1},
{items = {"farming:string"}, rarity = 2},
{items = {"farming:string"}, rarity = 3},
{items = {"farming:seed_cotton"}, rarity = 1},
{items = {"farming:seed_cotton"}, rarity = 2},
{items = {"farming:seed_cotton"}, rarity = 3},
}
},
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1},
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

@ -17,12 +17,14 @@ minetest.register_node("farming:cucumber_1", {
drawtype = "plantlike",
tiles = {"farming_cucumber_1.png"},
paramtype = "light",
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -34,8 +36,11 @@ minetest.register_node("farming:cucumber_2", {
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -47,12 +52,15 @@ minetest.register_node("farming:cucumber_3", {
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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 Cucumber growth doesnnot have growing=1 so abm never has to check these
-- Last stage of growth does not have growing group so abm never checks these
minetest.register_node("farming:cucumber_4", {
drawtype = "plantlike",
@ -61,14 +69,16 @@ minetest.register_node("farming:cucumber_4", {
waving = 1,
walkable = false,
buildable_to = true,
is_ground_content = true,
drop = {
items = {
{items = {'farming:cucumber'},rarity=1},
{items = {'farming:cucumber 2'},rarity=2},
{items = {'farming:cucumber'}, rarity = 1},
{items = {'farming:cucumber 2'}, rarity = 2},
}
},
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1},
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

@ -7,7 +7,7 @@ for i=1,5 do
drop = {
max_items = 1,
items = {
{items = {'farming:seed_wheat'},rarity = 5},
{items = {'farming:seed_wheat'}, rarity = 5},
{items = {'default:grass_1'}},
}
},
@ -21,7 +21,7 @@ minetest.override_item("default:junglegrass", {
drop = {
max_items = 1,
items = {
{items = {'farming:seed_cotton'},rarity = 8},
{items = {'farming:seed_cotton'}, rarity = 8},
{items = {'default:junglegrass'}},
}
},

View File

@ -32,6 +32,7 @@ farming.register_hoe = function(name, def)
end
})
-- Register its recipe
-- Registration using material made for MFF
if def.material == nil then
minetest.register_craft({
output = name:sub(2),
@ -95,9 +96,8 @@ function farming.hoe_on_use(itemstack, user, pointed_thing, uses)
end
-- turn the node into soil, wear out item and play sound
minetest.set_node(pt.under, {name="farming:soil"})
minetest.sound_play("default_dig_crumbly", {pos = pt.under, gain = 0.5,})
minetest.set_node(pt.under, {name = "farming:soil"})
minetest.sound_play("default_dig_crumbly", {pos = pt.under, gain = 0.5})
if not minetest.setting_getbool("creative_mode") then --MFF DEBUT crabman(26/07/2015) not wearout if creative mod and invtweak refill break tools
local tool_name = itemstack:get_name()
itemstack:add_wear(65535/(uses-1))
@ -111,6 +111,7 @@ function farming.hoe_on_use(itemstack, user, pointed_thing, uses)
end
-- Define Hoes
-- Material fields added for MFF
farming.register_hoe(":farming:hoe_wood", {
description = "Wooden Hoe",

View File

@ -1,5 +1,5 @@
--[[
Minetest Farming Redo Mod 1.20 (20th May 2015)
Minetest Farming Redo Mod 1.20 (5th July 2015)
by TenPlus1
NEW growing routine by prestidigitator
]]
@ -8,6 +8,10 @@ farming = {}
farming.mod = "redo"
farming.path = minetest.get_modpath("farming")
farming.hoe_on_use = default.hoe_on_use
farming.select = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}
}
farming.DEBUG = false
-- farming.DEBUG = {} -- Uncomment to turn on profiling code/functions
@ -38,7 +42,6 @@ if farming.DEBUG then
timer_avg.."µs/run")
print("Total farming time: "..dt.."µs")
end
else
end
local statistics = dofile(farming.path.."/statistics.lua")
@ -68,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 nil
local function clamp(x, min, max)
return (x < min and min) or (x > max and max) or x
@ -214,7 +217,12 @@ local function reg_plant_stages(plant_name, stage, force_last)
local ns = reg_plant_stages(plant_name, stage + 1, true)
local stages_left = (ns and { ns.name, unpack(ns.stages_left) }) or {}
stages = { plant_name = plant_name, name = node_name, stage = stage, stages_left = stages_left }
stages = {
plant_name = plant_name,
name = node_name,
stage = stage,
stages_left = stages_left
}
if #stages_left > 0 then
local old_constr = node_def.on_construct
@ -237,7 +245,12 @@ local function reg_plant_stages(plant_name, stage, force_last)
})
end
elseif force_last then
stages = { plant_name = plant_name, name = node_name, stage = stage, stages_left = {} }
stages = {
plant_name = plant_name,
name = node_name,
stage = stage,
stages_left = {}
}
else
return nil
end
@ -334,7 +347,7 @@ function farming.plant_growth_timer(pos, elapsed, node_name)
local growth
local light_pos = { x = pos.x, y = pos.y + 1, z = pos.z }
local light_pos = { x = pos.x, y = pos.y, z = pos.z }
local lambda = elapsed / STAGE_LENGTH_AVG
if lambda < 0.1 then return true end
if max_growth == 1 or lambda < 2.0 then
@ -377,7 +390,6 @@ if farming.DEBUG then
end
end
-- Place Seeds on Soil
function farming.place_seed(itemstack, placer, pointed_thing, plantname)
@ -392,7 +404,7 @@ function farming.place_seed(itemstack, placer, pointed_thing, plantname)
local above = minetest.get_node(pt.above)
-- check if pointing at the top of the node
if pt.above.y ~= pt.under.y+1 then
if pt.above.y ~= pt.under.y + 1 then
return
end
@ -419,7 +431,6 @@ function farming.place_seed(itemstack, placer, pointed_thing, plantname)
end
end
-- Function to register plants (for compatibility)
farming.register_plant = function(name, def)
@ -449,7 +460,7 @@ farming.register_plant = function(name, def)
paramtype2 = "wallmounted",
walkable = false,
sunlight_propagates = true,
selection_box = {type = "fixed", fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
selection_box = farming.select,
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, mname .. ":"..pname.."_1")
end
@ -488,7 +499,7 @@ farming.register_plant = function(name, def)
buildable_to = true,
is_ground_content = true,
drop = drop,
selection_box = {type = "fixed", fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
selection_box = farming.select,
groups = g,
sounds = default.node_sound_leaves_defaults(),
})
@ -502,11 +513,7 @@ end
--[[ Cotton (example, is already registered in cotton.lua)
farming.register_plant("farming:cotton", {
description = "Cotton seed",
description = "Cotton2 seed",
inventory_image = "farming_cotton_seed.png",
steps = 8,
minlight = 13,
maxlight = default.LIGHT_MAX,
fertility = {"grassland", "desert"}
})
--]]
})]]

View File

@ -1,6 +1,4 @@
-- spawn new foods on map
-- decoration function
local function register_plant(name, min, max, spawnby, num)
minetest.register_decoration({
deco_type = "simple",
@ -9,14 +7,14 @@ local function register_plant(name, min, max, spawnby, num)
noise_params = {
offset = 0,
scale = 0.006,
spread = {x=100, y=100, z=100},
spread = {x = 100, y = 100, z = 100},
seed = 329,
octaves = 3,
persist = 0.6
},
y_min = min,
y_max = max,
decoration = "farming:"..name,
decoration = "farming:" .. name,
spawn_by = spawnby,
num_spawn_by = num,
})
@ -38,9 +36,26 @@ function farming.register_mgv6_decorations()
register_plant("beanbush", 18, 35, "", -1)
end
-- enable in mapgen v6 only
local mg_params = minetest.get_mapgen_params()
if mg_params.mgname == "v6" then
farming.register_mgv6_decorations()
-- v7 maps have a beach so plants growing near water is limited to 6- high
function farming.register_mgv7_decorations()
register_plant("potato_3", 15, 40, "", -1)
register_plant("tomato_7", 5, 20, "", -1)
register_plant("carrot_8", 1, 6, "", -1)
register_plant("cucumber_4", 1, 6, "", -1)
register_plant("corn_7", 12, 22, "", -1)
register_plant("corn_8", 10, 20, "", -1)
register_plant("coffee_5", 20, 45, "", -1)
register_plant("melon_8", 1, 6, "", -1)
register_plant("pumpkin_8", 1, 6, "", -1)
register_plant("raspberry_4", 3, 10, "", -1)
register_plant("rhubarb_3", 3, 15, "group:tree", 1)
register_plant("blueberry_4", 3, 10, "", -1)
register_plant("beanbush", 18, 35, "", -1)
end
-- detect mapgen
if minetest.get_mapgen_params().mgname == "v6" then
farming.register_mgv6_decorations()
else
farming.register_mgv7_decorations()
end

View File

@ -33,12 +33,14 @@ minetest.register_node("farming:melon_1", {
tiles = {"farming_melon_1.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -47,12 +49,14 @@ minetest.register_node("farming:melon_2", {
tiles = {"farming_melon_2.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -65,8 +69,11 @@ minetest.register_node("farming:melon_3", {
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -79,8 +86,11 @@ minetest.register_node("farming:melon_4", {
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -93,8 +103,11 @@ minetest.register_node("farming:melon_5", {
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -105,8 +118,11 @@ minetest.register_node("farming:melon_6", {
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -117,12 +133,15 @@ minetest.register_node("farming:melon_7", {
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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 Melon growth doesnnot have growing=1 so abm never has to check these
-- Last stage of growth does not have growing group so abm never checks these
minetest.register_node("farming:melon_8", {
--drawtype = "nodebox",
@ -130,12 +149,11 @@ minetest.register_node("farming:melon_8", {
tiles = {"farming_melon_top.png", "farming_melon_top.png", "farming_melon_side.png"},
paramtype = "light",
walkable = true,
is_ground_content = true,
drop = {
items = {
{items = {'farming:melon_slice 9'},rarity=1},
{items = {'farming:melon_slice 9'}, rarity = 1},
}
},
groups = {snappy=1,oddly_breakable_by_hand=1,flammable=2,plant=1},
groups = {snappy = 1, oddly_breakable_by_hand = 1, flammable = 2, plant = 1},
sounds = default.node_sound_wood_defaults(),
})

View File

@ -1,156 +0,0 @@
minetest.override_item("default:dirt", {
groups = {crumbly=3,soil=1},
soil = {
base = "default:dirt",
dry = "farming:soil",
wet = "farming:soil_wet"
}
})
minetest.override_item("default:dirt_with_grass", {
groups = {crumbly=3,soil=1},
soil = {
base = "default:dirt_with_grass",
dry = "farming:soil",
wet = "farming:soil_wet"
}
})
minetest.register_node("farming:soil", {
description = "Soil",
tiles = {"default_dirt.png^farming_soil.png", "default_dirt.png"},
drop = "default:dirt",
groups = {crumbly=3, not_in_creative_inventory=1, soil=2, grassland = 1, field = 1},
sounds = default.node_sound_dirt_defaults(),
soil = {
base = "default:dirt",
dry = "farming:soil",
wet = "farming:soil_wet"
}
})
minetest.register_node("farming:soil_wet", {
description = "Wet Soil",
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, wet = 1, grassland = 1, field = 1},
sounds = default.node_sound_dirt_defaults(),
soil = {
base = "default:dirt",
dry = "farming:soil",
wet = "farming:soil_wet"
}
})
minetest.override_item("default:desert_sand", {
groups = {crumbly=3, falling_node=1, sand=1, soil = 1},
soil = {
base = "default:desert_sand",
dry = "farming:desert_sand_soil",
wet = "farming:desert_sand_soil_wet"
}
})
minetest.register_node("farming:desert_sand_soil", {
description = "Desert Sand Soil",
drop = "default:desert_sand",
tiles = {"farming_desert_sand_soil.png", "default_desert_sand.png"},
groups = {crumbly=3, not_in_creative_inventory = 1, falling_node=1, sand=1, soil = 2, desert = 1, field = 1},
sounds = default.node_sound_sand_defaults(),
soil = {
base = "default:desert_sand",
dry = "farming:desert_sand_soil",
wet = "farming:desert_sand_soil_wet"
}
})
minetest.register_node("farming:desert_sand_soil_wet", {
description = "Wet Desert Sand Soil",
drop = "default:desert_sand",
tiles = {"farming_desert_sand_soil_wet.png", "farming_desert_sand_soil_wet_side.png"},
groups = {crumbly=3, falling_node=1, sand=1, not_in_creative_inventory=1, soil=3, wet = 1, desert = 1, field = 1},
sounds = default.node_sound_sand_defaults(),
soil = {
base = "default:desert_sand",
dry = "farming:desert_sand_soil",
wet = "farming:desert_sand_soil_wet"
}
})
minetest.register_node("farming:straw", {
description = "Straw",
tiles = {"farming_straw.png"},
is_ground_content = false,
groups = {snappy=3, flammable=4},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_abm({
nodenames = {"group:field"},
interval = 15,
chance = 4,
action = function(pos, node)
local n_def = minetest.registered_nodes[node.name] or nil
local wet = n_def.soil.wet or nil
local base = n_def.soil.base or nil
local dry = n_def.soil.dry or nil
if not n_def or not n_def.soil or not wet or not base or not dry then
return
end
pos.y = pos.y + 1
local nn = minetest.get_node_or_nil(pos)
if not nn or not nn.name then
return
end
local nn_def = minetest.registered_nodes[nn.name] or nil
pos.y = pos.y - 1
if nn_def and nn_def.walkable and minetest.get_item_group(nn.name, "plant") == 0 then
minetest.set_node(pos, {name = base})
return
end
-- check if there is water nearby
local wet_lvl = minetest.get_item_group(node.name, "wet")
if minetest.find_node_near(pos, 3, {"group:water"}) then
-- if it is dry soil and not base node, turn it into wet soil
if wet_lvl == 0 then
minetest.set_node(pos, {name = wet})
end
else
-- only turn back if there are no unloaded blocks (and therefore
-- possible water sources) nearby
if not minetest.find_node_near(pos, 3, {"ignore"}) then
-- turn it back into base if it is already dry
if wet_lvl == 0 then
-- only turn it back if there is no plant/seed on top of it
if minetest.get_item_group(nn.name, "plant") == 0 and minetest.get_item_group(nn.name, "seed") == 0 then
minetest.set_node(pos, {name = base})
end
-- if its wet turn it back into dry soil
elseif wet_lvl == 1 then
minetest.set_node(pos, {name = dry})
end
end
end
end,
})
for i = 1, 5 do
minetest.override_item("default:grass_"..i, {drop = {
max_items = 1,
items = {
{items = {'farming:seed_wheat'},rarity = 5},
{items = {'default:grass_1'}},
}
}})
end
minetest.override_item("default:junglegrass", {drop = {
max_items = 1,
items = {
{items = {'farming:seed_cotton'},rarity = 8},
{items = {'default:junglegrass'}},
}
}})

View File

@ -35,8 +35,11 @@ minetest.register_node("farming:potato_1", {
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -49,8 +52,11 @@ minetest.register_node("farming:potato_2", {
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -62,19 +68,21 @@ minetest.register_node("farming:potato_3", {
waving = 1,
walkable = false,
buildable_to = true,
is_ground_content = true,
drop = {
items = {
{items = {'farming:potato'},rarity=1},
{items = {'farming:potato'},rarity=3},
{items = {'farming:potato'}, rarity = 1},
{items = {'farming:potato'}, rarity = 3},
}
},
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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 Potato growth doesnnot have growing=1 so abm never has to check these
-- Last stage of growth does not have growing group so abm never checks these
minetest.register_node("farming:potato_4", {
drawtype = "plantlike",
@ -84,14 +92,16 @@ minetest.register_node("farming:potato_4", {
waving = 1,
walkable = false,
buildable_to = true,
is_ground_content = true,
drop = {
items = {
{items = {'farming:potato 2'},rarity=1},
{items = {'farming:potato 3'},rarity=2},
{items = {'farming:potato 2'}, rarity = 1},
{items = {'farming:potato 3'}, rarity = 2},
}
},
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1},
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

@ -3,11 +3,18 @@
minetest.register_node("farming:pumpkin", {
description = "Pumpkin",
tiles = {"farming_pumpkin_top.png", "farming_pumpkin_top.png", "farming_pumpkin_side.png"},
groups = {choppy=1,oddly_breakable_by_hand=1,flammable=2,plant=1},
tiles = {
"farming_pumpkin_top.png",
"farming_pumpkin_top.png",
"farming_pumpkin_side.png"
},
groups = {
choppy = 1, oddly_breakable_by_hand = 1,
flammable = 2, plant = 1
},
drop = {
items = {
{items = {'farming:pumpkin_slice 9'},rarity=1},
{items = {'farming:pumpkin_slice 9'}, rarity = 1},
}
},
sounds = default.node_sound_wood_defaults(),
@ -41,9 +48,16 @@ minetest.register_craft({
-- Jack 'O Lantern
minetest.register_node("farming:jackolantern", {
description = "Jack 'O Lantern",
tiles = {"farming_pumpkin_top.png", "farming_pumpkin_top.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_face_off.png"},
tiles = {
"farming_pumpkin_top.png",
"farming_pumpkin_top.png",
"farming_pumpkin_side.png",
"farming_pumpkin_side.png",
"farming_pumpkin_side.png",
"farming_pumpkin_face_off.png"
},
paramtype2 = "facedir",
groups = {choppy=1,oddly_breakable_by_hand=1,flammable=2},
groups = {choppy = 1, oddly_breakable_by_hand = 1, flammable = 2},
sounds = default.node_sound_wood_defaults(),
on_punch = function(pos, node, puncher)
node.name = "farming:jackolantern_on"
@ -53,10 +67,17 @@ minetest.register_node("farming:jackolantern", {
minetest.register_node("farming:jackolantern_on", {
description = "Jack 'O Lantern",
tiles = {"farming_pumpkin_top.png", "farming_pumpkin_top.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_face_on.png"},
light_source = 14,
tiles = {
"farming_pumpkin_top.png",
"farming_pumpkin_top.png",
"farming_pumpkin_side.png",
"farming_pumpkin_side.png",
"farming_pumpkin_side.png",
"farming_pumpkin_face_on.png"
},
light_source = default.LIGHT_MAX - 1,
paramtype2 = "facedir",
groups = {choppy=1,oddly_breakable_by_hand=1,flammable=2},
groups = {choppy = 1, oddly_breakable_by_hand = 1, flammable = 2},
sounds = default.node_sound_wood_defaults(),
drop = "farming:jackolantern",
on_punch = function(pos, node, puncher)
@ -110,8 +131,11 @@ minetest.register_node("farming:pumpkin_1", {
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -124,8 +148,11 @@ minetest.register_node("farming:pumpkin_2", {
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -138,8 +165,11 @@ minetest.register_node("farming:pumpkin_3", {
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -152,8 +182,11 @@ minetest.register_node("farming:pumpkin_4", {
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -166,8 +199,11 @@ minetest.register_node("farming:pumpkin_5", {
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -179,8 +215,11 @@ minetest.register_node("farming:pumpkin_6", {
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -191,12 +230,15 @@ minetest.register_node("farming:pumpkin_7", {
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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 Pumpkin growth does not have growing=1 so abm never has to check these
-- Last stage of growth does not have growing group so abm never checks these
minetest.register_node("farming:pumpkin_8", {
drawtype = "plantlike",
@ -204,13 +246,15 @@ minetest.register_node("farming:pumpkin_8", {
paramtype = "light",
walkable = false,
buildable_to = true,
is_ground_content = true,
drop = {
items = {
{items = {'farming:pumpkin_slice 9'},rarity=1},
{items = {'farming:pumpkin_slice 9'}, rarity = 1},
}
},
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1},
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1
},
sounds = default.node_sound_defaults(),
})

View File

@ -34,12 +34,14 @@ minetest.register_node("farming:raspberry_1", {
tiles = {"farming_raspberry_1.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -52,8 +54,11 @@ minetest.register_node("farming:raspberry_2", {
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -66,12 +71,15 @@ minetest.register_node("farming:raspberry_3", {
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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 Raspberry growth does not have growing=1 so abm never has to check these
-- Last stage of growth does not have growing group so abm never checks these
minetest.register_node("farming:raspberry_4", {
drawtype = "plantlike",
@ -81,15 +89,17 @@ minetest.register_node("farming:raspberry_4", {
waving = 1,
walkable = false,
buildable_to = true,
is_ground_content = true,
drop = {
items = {
{items = {'farming:raspberries 2'},rarity=1},
{items = {'farming:raspberries'},rarity=2},
{items = {'farming:raspberries'},rarity=3},
{items = {'farming:raspberries 2'}, rarity = 1},
{items = {'farming:raspberries'}, rarity = 2},
{items = {'farming:raspberries'}, rarity = 3},
}
},
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1},
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

@ -32,12 +32,14 @@ minetest.register_node("farming:rhubarb_1", {
tiles = {"farming_rhubarb_1.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -50,12 +52,15 @@ minetest.register_node("farming:rhubarb_2", {
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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 Rhubarb growth doesnnot have growing=1 so abm never has to check these
-- Last stage of growth does not have growing group so abm never checks these
minetest.register_node("farming:rhubarb_3", {
drawtype = "plantlike",
@ -65,15 +70,17 @@ minetest.register_node("farming:rhubarb_3", {
waving = 1,
walkable = false,
buildable_to = true,
is_ground_content = true,
drop = {
items = {
{items = {'farming:rhubarb 2'},rarity=1},
{items = {'farming:rhubarb'},rarity=2},
{items = {'farming:rhubarb'},rarity=3},
{items = {'farming:rhubarb 2'}, rarity = 1},
{items = {'farming:rhubarb'}, rarity = 2},
{items = {'farming:rhubarb'}, rarity = 3},
}
},
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1},
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

@ -3,8 +3,7 @@ minetest.register_node("farming:soil", {
description = "Soil",
tiles = {"farming_soil.png", "default_dirt.png"},
drop = "default:dirt",
is_ground_content = true,
groups = {crumbly=3, not_in_creative_inventory=1, soil=2},
groups = {crumbly = 3, not_in_creative_inventory = 1, soil = 2},
sounds = default.node_sound_dirt_defaults(),
})
@ -16,8 +15,7 @@ minetest.register_node("farming:soil_wet", {
description = "Wet Soil",
tiles = {"farming_soil_wet.png", "farming_soil_wet_side.png"},
drop = "default:dirt",
is_ground_content = true,
groups = {crumbly=3, not_in_creative_inventory=1, soil=3},
groups = {crumbly = 3, not_in_creative_inventory = 1, soil = 3},
sounds = default.node_sound_dirt_defaults(),
})
minetest.register_alias("farming:desert_sand_soil_wet", "farming:soil_wet")
@ -29,13 +27,17 @@ minetest.register_abm({
chance = 4,
action = function(pos, node)
local nn = minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z}).name
pos.y = pos.y + 1
local nn = minetest.get_node_or_nil(pos)
pos.y = pos.y - 1
if nn then nn = nn.name else return end
-- what's on top of soil, if solid/not plant change soil to dirt
if minetest.registered_nodes[nn]
and minetest.registered_nodes[nn].walkable
and minetest.get_item_group(nn, "plant") == 0 then
minetest.set_node(pos, {name="default:dirt"})
minetest.set_node(pos, {name = "default:dirt"})
return
end
@ -47,12 +49,12 @@ minetest.register_abm({
-- check if there is water nearby and change soil accordingly
if minetest.find_node_near(pos, 3, {"group:water"}) then
if node.name == "farming:soil" then
minetest.set_node(pos, {name="farming:soil_wet"})
minetest.set_node(pos, {name = "farming:soil_wet"})
end
elseif node.name == "farming:soil_wet" then
minetest.set_node(pos, {name="farming:soil"})
minetest.set_node(pos, {name = "farming:soil"})
elseif node.name == "farming:soil" then
minetest.set_node(pos, {name="default:dirt"})
minetest.set_node(pos, {name = "default:dirt"})
end
end,
})

View File

@ -16,7 +16,7 @@ erf = function(x)
if x == 0 then return 0; end
local xSq = x * x
local aXSq = A * xSq
local v = math.sqrt(1.0 - math.exp(-xSq * (B + aXSq)/(1.0 + aXSq)))
local v = math.sqrt(1.0 - math.exp(-xSq * (B + aXSq) / (1.0 + aXSq)))
return (x > 0 and v) or -v
end

View File

@ -12,4 +12,3 @@ minetest.register_craft({
output = "farming:sugar 2",
recipe = "default:papyrus",
})

View File

@ -18,12 +18,14 @@ minetest.register_node("farming:tomato_1", {
tiles = {"farming_tomato_1.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -32,12 +34,14 @@ minetest.register_node("farming:tomato_2", {
tiles = {"farming_tomato_2.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -50,8 +54,11 @@ minetest.register_node("farming:tomato_3", {
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -64,8 +71,11 @@ minetest.register_node("farming:tomato_4", {
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -78,8 +88,11 @@ minetest.register_node("farming:tomato_5", {
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -92,8 +105,11 @@ minetest.register_node("farming:tomato_6", {
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -104,19 +120,21 @@ minetest.register_node("farming:tomato_7", {
waving = 1,
walkable = false,
buildable_to = true,
is_ground_content = true,
drop = {
items = {
{items = {'farming:tomato'},rarity=1},
{items = {'farming:tomato'},rarity=3},
{items = {'farming:tomato'}, rarity = 1},
{items = {'farming:tomato'}, rarity = 3},
}
},
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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 Carrot growth doesnnot have growing=1 so abm never has to check these
-- Last stage of growth does not have growing group so abm never checks these
minetest.register_node("farming:tomato_8", {
drawtype = "plantlike",
@ -125,14 +143,16 @@ minetest.register_node("farming:tomato_8", {
waving = 1,
walkable = false,
buildable_to = true,
is_ground_content = true,
drop = {
items = {
{items = {'farming:tomato 3'},rarity=1},
{items = {'farming:tomato 3'},rarity=2},
{items = {'farming:tomato 3'}, rarity = 1},
{items = {'farming:tomato 3'}, rarity = 2},
}
},
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1},
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

@ -22,7 +22,7 @@ minetest.register_node("farming:seed_wheat", {
paramtype2 = "wallmounted",
walkable = false,
sunlight_propagates = true,
selection_box = {type = "fixed", fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
selection_box = farming.select,
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:wheat_1")
end,
@ -41,7 +41,7 @@ minetest.register_node("farming:straw", {
description = "Straw",
tiles = {"farming_straw.png"},
is_ground_content = false,
groups = {snappy=3, flammable=4},
groups = {snappy = 3, flammable = 4},
sounds = default.node_sound_leaves_defaults(),
})
@ -96,12 +96,14 @@ minetest.register_node("farming:wheat_1", {
tiles = {"farming_wheat_1.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -110,12 +112,14 @@ minetest.register_node("farming:wheat_2", {
tiles = {"farming_wheat_2.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -128,8 +132,11 @@ minetest.register_node("farming:wheat_3", {
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -142,8 +149,11 @@ minetest.register_node("farming:wheat_4", {
walkable = false,
buildable_to = true,
drop = "",
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -157,12 +167,15 @@ minetest.register_node("farming:wheat_5", {
buildable_to = true,
drop = {
items = {
{items = {'farming:wheat'},rarity=2},
{items = {'farming:seed_wheat'},rarity=2},
{items = {'farming:wheat'}, rarity = 2},
{items = {'farming:seed_wheat'}, rarity = 2},
}
},
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -176,12 +189,15 @@ minetest.register_node("farming:wheat_6", {
buildable_to = true,
drop = {
items = {
{items = {'farming:wheat'},rarity=2},
{items = {'farming:seed_wheat'},rarity=1},
{items = {'farming:wheat'}, rarity = 2},
{items = {'farming:seed_wheat'}, rarity = 1},
}
},
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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(),
})
@ -195,18 +211,21 @@ minetest.register_node("farming:wheat_7", {
buildable_to = true,
drop = {
items = {
{items = {'farming:wheat'},rarity=1},
{items = {'farming:wheat'},rarity=3},
{items = {'farming:seed_wheat'},rarity=1},
{items = {'farming:seed_wheat'},rarity=3},
{items = {'farming:wheat'}, rarity = 1},
{items = {'farming:wheat'}, rarity = 3},
{items = {'farming:seed_wheat'}, rarity = 1},
{items = {'farming:seed_wheat'}, rarity = 3},
}
},
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=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 Wheat growth doesnnot have growing=1 so abm never has to check these
-- Last stage of growth does not have growing group so abm never checks these
minetest.register_node("farming:wheat_8", {
drawtype = "plantlike",
@ -217,13 +236,16 @@ minetest.register_node("farming:wheat_8", {
buildable_to = true,
drop = {
items = {
{items = {'farming:wheat'},rarity=1},
{items = {'farming:wheat'},rarity=2},
{items = {'farming:seed_wheat'},rarity=1},
{items = {'farming:seed_wheat'},rarity=2},
{items = {'farming:wheat'}, rarity = 1},
{items = {'farming:wheat'}, rarity = 2},
{items = {'farming:seed_wheat'}, rarity = 1},
{items = {'farming:seed_wheat'}, rarity = 2},
}
},
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},},
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1},
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(),
})