1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-11-15 23:10:31 +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 end
}) })
-- Beans can be used for green dye
minetest.register_craft({
output = "dye:green",
recipe = {
{'farming:beans'},
}
})
-- Beanpole -- Beanpole
minetest.register_node("farming:beanpole", { minetest.register_node("farming:beanpole", {
@ -39,13 +47,22 @@ minetest.register_node("farming:beanpole", {
{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},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,not_in_creative_inventory=1,attached_node=1}, groups = {
snappy = 3, flammable = 2, attached_node = 1,
not_in_creative_inventory = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
local nod = minetest.get_node_or_nil(pointed_thing.under) local nod = minetest.get_node_or_nil(pointed_thing.under)
if nod and minetest.get_item_group(nod.name, "soil") < 2 then return end if nod and minetest.get_item_group(nod.name, "soil") < 2 then
local top = {x=pointed_thing.above.x, y=pointed_thing.above.y+1, z=pointed_thing.above.z} 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) nod = minetest.get_node_or_nil(top)
if nod and nod.name ~= "air" then return end 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"})
@ -80,8 +97,11 @@ minetest.register_node("farming:beanpole_1", {
{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},}, selection_box = farming.select,
groups = {snappy=3,flammable=3,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 3, not_in_creative_inventory = 1,
attached_node = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -98,8 +118,11 @@ minetest.register_node("farming:beanpole_2", {
{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},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -116,8 +139,11 @@ minetest.register_node("farming:beanpole_3", {
{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},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -135,19 +161,21 @@ minetest.register_node("farming:beanpole_4", {
{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},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), 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", { minetest.register_node("farming:beanpole_5", {
drawtype = "plantlike", drawtype = "plantlike",
tiles = {"farming_beanpole_5.png"}, tiles = {"farming_beanpole_5.png"},
visual_scale = 1.45, visual_scale = 1.45,
paramtype = "light", paramtype = "light",
waving = 1,
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
sunlight_propagates = true, sunlight_propagates = true,
@ -159,8 +187,11 @@ minetest.register_node("farming:beanpole_5", {
{items = {'farming:beans 2'}, rarity = 3}, {items = {'farming:beans 2'}, rarity = 3},
} }
}, },
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -181,7 +212,10 @@ minetest.register_node("farming:beanbush", {
{items = {'farming:beans 1'}, rarity = 3}, {items = {'farming:beans 1'}, rarity = 3},
} }
}, },
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory=1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })

View File

@ -32,12 +32,14 @@ minetest.register_node("farming:blueberry_1", {
tiles = {"farming_blueberry_1.png"}, tiles = {"farming_blueberry_1.png"},
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
waving = 1,
walkable = false, walkable = false,
buildable_to = true, buildable_to = 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 = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -50,8 +52,11 @@ minetest.register_node("farming:blueberry_2", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = 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 = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -64,12 +69,15 @@ minetest.register_node("farming:blueberry_3", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = 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 = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), 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", { minetest.register_node("farming:blueberry_4", {
drawtype = "plantlike", drawtype = "plantlike",
@ -79,7 +87,6 @@ minetest.register_node("farming:blueberry_4", {
waving = 1, waving = 1,
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
is_ground_content = true,
drop = { drop = {
items = { items = {
{items = {'farming:blueberries 2'}, rarity = 1}, {items = {'farming:blueberries 2'}, rarity = 1},
@ -87,7 +94,10 @@ minetest.register_node("farming:blueberry_4", {
{items = {'farming:blueberries'}, rarity = 3}, {items = {'farming:blueberries'}, rarity = 3},
} }
}, },
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory=1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })

View File

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

View File

@ -88,9 +88,14 @@ minetest.register_node("farming:cocoa_1", {
{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},}, selection_box = {
-- MODIFICATION MADE FOR MFF ^ type = "fixed",
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,growing=1}, 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(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -104,8 +109,14 @@ minetest.register_node("farming:cocoa_2", {
{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},}, selection_box = {
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,growing=1}, 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(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -122,8 +133,14 @@ minetest.register_node("farming:cocoa_3", {
{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},}, selection_box = {
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1}, 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(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -145,10 +162,15 @@ minetest.register_abm({
else return else return
end end
if minetest.get_node(pos).name == "air" and minetest.get_node_light(pos) > 12 then local nod = minetest.get_node_or_nil(pos)
-- print ("COCOA", pos.x, pos.y, pos.z) if nod then nod = nod.name else return end
minetest.set_node(pos,{name="farming:cocoa_"..tostring(math.random(1,3))})
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, end,
}) })

View File

@ -111,12 +111,14 @@ minetest.register_node("farming:coffee_1", {
tiles = {"farming_coffee_1.png"}, tiles = {"farming_coffee_1.png"},
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
waving = 1,
walkable = false, walkable = false,
buildable_to = true, buildable_to = 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 = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -129,8 +131,11 @@ minetest.register_node("farming:coffee_2", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = 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 = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -143,8 +148,11 @@ minetest.register_node("farming:coffee_3", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = 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 = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -157,12 +165,15 @@ minetest.register_node("farming:coffee_4", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = 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 = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), 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", { minetest.register_node("farming:coffee_5", {
drawtype = "plantlike", drawtype = "plantlike",
@ -172,7 +183,6 @@ minetest.register_node("farming:coffee_5", {
waving = 1, waving = 1,
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
is_ground_content = true,
drop = { drop = {
items = { items = {
{items = {'farming:coffee_beans 2'}, rarity = 1}, {items = {'farming:coffee_beans 2'}, rarity = 1},
@ -180,7 +190,10 @@ minetest.register_node("farming:coffee_5", {
{items = {'farming:coffee_beans 2'}, rarity = 3}, {items = {'farming:coffee_beans 2'}, rarity = 3},
} }
}, },
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory=1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })

View File

@ -58,8 +58,11 @@ minetest.register_node("farming:corn_1", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = 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 = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -71,8 +74,11 @@ minetest.register_node("farming:corn_2", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = 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 = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -85,8 +91,11 @@ minetest.register_node("farming:corn_3", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = 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 = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -99,8 +108,11 @@ minetest.register_node("farming:corn_4", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = 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 = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -108,12 +120,16 @@ minetest.register_node("farming:corn_5", {
drawtype = "plantlike", drawtype = "plantlike",
tiles = {"farming_corn_5.png"}, tiles = {"farming_corn_5.png"},
paramtype = "light", paramtype = "light",
waving = 1,
sunlight_propagates = true, sunlight_propagates = true,
walkable = false, walkable = false,
buildable_to = true, buildable_to = 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 = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -122,12 +138,16 @@ minetest.register_node("farming:corn_6", {
tiles = {"farming_corn_6.png"}, tiles = {"farming_corn_6.png"},
visual_scale = 1.45, visual_scale = 1.45,
paramtype = "light", paramtype = "light",
waving = 1,
sunlight_propagates = true, sunlight_propagates = true,
walkable = false, walkable = false,
buildable_to = true, buildable_to = 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 = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -136,9 +156,9 @@ minetest.register_node("farming:corn_7", {
tiles = {"farming_corn_7.png"}, tiles = {"farming_corn_7.png"},
visual_scale = 1.45, visual_scale = 1.45,
paramtype = "light", paramtype = "light",
waving = 1,
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
is_ground_content = true,
drop = { drop = {
items = { items = {
{items = {'farming:corn'}, rarity = 1}, {items = {'farming:corn'}, rarity = 1},
@ -146,12 +166,15 @@ minetest.register_node("farming:corn_7", {
{items = {'farming:corn'}, rarity = 3}, {items = {'farming:corn'}, rarity = 3},
} }
}, },
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), 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", { minetest.register_node("farming:corn_8", {
drawtype = "plantlike", drawtype = "plantlike",
@ -161,7 +184,6 @@ minetest.register_node("farming:corn_8", {
waving = 1, waving = 1,
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
is_ground_content = true,
drop = { drop = {
items = { items = {
{items = {'farming:corn 2'}, rarity = 1}, {items = {'farming:corn 2'}, rarity = 1},
@ -169,7 +191,10 @@ minetest.register_node("farming:corn_8", {
{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},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })

View File

@ -19,7 +19,7 @@ minetest.register_node("farming:seed_cotton", {
paramtype2 = "wallmounted", paramtype2 = "wallmounted",
walkable = false, walkable = false,
sunlight_propagates = true, 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) on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:cotton_1") return farming.place_seed(itemstack, placer, pointed_thing, "farming:cotton_1")
end, end,
@ -39,10 +39,8 @@ minetest.register_alias("farming:string", "farming:cotton")
minetest.register_craft({ minetest.register_craft({
output = "wool:white", output = "wool:white",
recipe = { recipe = {
{"farming:string", "farming:string", "farming:string"}, {"farming:string", "farming:string"},
{"farming:string", "farming:string", "farming:string"}, {"farming:string", "farming:string"},
{"farming:string", "farming:string", "farming:string"},
-- ^ /MFF (Mg|05/26/2015)
} }
}) })
@ -53,12 +51,14 @@ minetest.register_node("farming:cotton_1", {
tiles = {"farming_cotton_1.png"}, tiles = {"farming_cotton_1.png"},
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
waving = 1,
walkable = false, walkable = false,
buildable_to = true, buildable_to = 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 = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -67,12 +67,14 @@ minetest.register_node("farming:cotton_2", {
tiles = {"farming_cotton_2.png"}, tiles = {"farming_cotton_2.png"},
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
waving = 1,
walkable = false, walkable = false,
buildable_to = true, buildable_to = 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 = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -85,8 +87,11 @@ minetest.register_node("farming:cotton_3", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = 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 = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -99,8 +104,11 @@ minetest.register_node("farming:cotton_4", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = 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 = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -117,8 +125,11 @@ minetest.register_node("farming:cotton_5", {
{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},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -135,8 +146,11 @@ minetest.register_node("farming:cotton_6", {
{items = {"farming:cotton"}, rarity = 2}, {items = {"farming:cotton"}, rarity = 2},
} }
}, },
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -155,12 +169,15 @@ minetest.register_node("farming:cotton_7", {
{items = {"farming:seed_cotton"}, rarity = 2}, {items = {"farming:seed_cotton"}, rarity = 2},
} }
}, },
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), 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", { minetest.register_node("farming:cotton_8", {
drawtype = "plantlike", drawtype = "plantlike",
@ -179,7 +196,10 @@ minetest.register_node("farming:cotton_8", {
{items = {"farming:seed_cotton"}, rarity = 3}, {items = {"farming:seed_cotton"}, rarity = 3},
} }
}, },
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })

View File

@ -17,12 +17,14 @@ minetest.register_node("farming:cucumber_1", {
drawtype = "plantlike", drawtype = "plantlike",
tiles = {"farming_cucumber_1.png"}, tiles = {"farming_cucumber_1.png"},
paramtype = "light", paramtype = "light",
waving = 1,
walkable = false, walkable = false,
buildable_to = true, buildable_to = 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 = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -34,8 +36,11 @@ minetest.register_node("farming:cucumber_2", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = 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 = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -47,12 +52,15 @@ minetest.register_node("farming:cucumber_3", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = 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 = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), 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", { minetest.register_node("farming:cucumber_4", {
drawtype = "plantlike", drawtype = "plantlike",
@ -61,14 +69,16 @@ minetest.register_node("farming:cucumber_4", {
waving = 1, waving = 1,
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
is_ground_content = true,
drop = { drop = {
items = { items = {
{items = {'farming:cucumber'}, rarity = 1}, {items = {'farming:cucumber'}, rarity = 1},
{items = {'farming:cucumber 2'}, rarity = 2}, {items = {'farming:cucumber 2'}, rarity = 2},
} }
}, },
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })

View File

@ -32,6 +32,7 @@ farming.register_hoe = function(name, def)
end end
}) })
-- Register its recipe -- Register its recipe
-- Registration using material made for MFF
if def.material == nil then if def.material == nil then
minetest.register_craft({ minetest.register_craft({
output = name:sub(2), output = name:sub(2),
@ -96,8 +97,7 @@ function farming.hoe_on_use(itemstack, user, pointed_thing, uses)
-- turn the node into soil, wear out item and play sound -- turn the node into soil, wear out item and play sound
minetest.set_node(pt.under, {name = "farming:soil"}) minetest.set_node(pt.under, {name = "farming:soil"})
minetest.sound_play("default_dig_crumbly", {pos = pt.under, gain = 0.5,}) 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 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() local tool_name = itemstack:get_name()
itemstack:add_wear(65535/(uses-1)) itemstack:add_wear(65535/(uses-1))
@ -111,6 +111,7 @@ function farming.hoe_on_use(itemstack, user, pointed_thing, uses)
end end
-- Define Hoes -- Define Hoes
-- Material fields added for MFF
farming.register_hoe(":farming:hoe_wood", { farming.register_hoe(":farming:hoe_wood", {
description = "Wooden Hoe", 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 by TenPlus1
NEW growing routine by prestidigitator NEW growing routine by prestidigitator
]] ]]
@ -8,6 +8,10 @@ farming = {}
farming.mod = "redo" farming.mod = "redo"
farming.path = minetest.get_modpath("farming") farming.path = minetest.get_modpath("farming")
farming.hoe_on_use = default.hoe_on_use 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 = false
-- farming.DEBUG = {} -- Uncomment to turn on profiling code/functions -- farming.DEBUG = {} -- Uncomment to turn on profiling code/functions
@ -38,7 +42,6 @@ if farming.DEBUG then
timer_avg.."µs/run") timer_avg.."µs/run")
print("Total farming time: "..dt.."µs") print("Total farming time: "..dt.."µs")
end end
else
end end
local statistics = dofile(farming.path.."/statistics.lua") local statistics = dofile(farming.path.."/statistics.lua")
@ -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 ns = reg_plant_stages(plant_name, stage + 1, true)
local stages_left = (ns and { ns.name, unpack(ns.stages_left) }) or {} 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 if #stages_left > 0 then
local old_constr = node_def.on_construct local old_constr = node_def.on_construct
@ -237,7 +245,12 @@ local function reg_plant_stages(plant_name, stage, force_last)
}) })
end end
elseif force_last then 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 else
return nil return nil
end end
@ -334,7 +347,7 @@ function farming.plant_growth_timer(pos, elapsed, node_name)
local growth 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 local lambda = elapsed / STAGE_LENGTH_AVG
if lambda < 0.1 then return true end if lambda < 0.1 then return true end
if max_growth == 1 or lambda < 2.0 then if max_growth == 1 or lambda < 2.0 then
@ -377,7 +390,6 @@ if farming.DEBUG then
end end
end end
-- Place Seeds on Soil -- Place Seeds on Soil
function farming.place_seed(itemstack, placer, pointed_thing, plantname) function farming.place_seed(itemstack, placer, pointed_thing, plantname)
@ -419,7 +431,6 @@ function farming.place_seed(itemstack, placer, pointed_thing, plantname)
end end
end end
-- Function to register plants (for compatibility) -- Function to register plants (for compatibility)
farming.register_plant = function(name, def) farming.register_plant = function(name, def)
@ -449,7 +460,7 @@ farming.register_plant = function(name, def)
paramtype2 = "wallmounted", paramtype2 = "wallmounted",
walkable = false, walkable = false,
sunlight_propagates = true, 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) on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, mname .. ":"..pname.."_1") return farming.place_seed(itemstack, placer, pointed_thing, mname .. ":"..pname.."_1")
end end
@ -488,7 +499,7 @@ farming.register_plant = function(name, def)
buildable_to = true, buildable_to = true,
is_ground_content = true, is_ground_content = true,
drop = drop, 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, groups = g,
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -502,11 +513,7 @@ end
--[[ Cotton (example, is already registered in cotton.lua) --[[ Cotton (example, is already registered in cotton.lua)
farming.register_plant("farming:cotton", { farming.register_plant("farming:cotton", {
description = "Cotton seed", description = "Cotton2 seed",
inventory_image = "farming_cotton_seed.png", inventory_image = "farming_cotton_seed.png",
steps = 8, steps = 8,
minlight = 13, })]]
maxlight = default.LIGHT_MAX,
fertility = {"grassland", "desert"}
})
--]]

View File

@ -1,6 +1,4 @@
-- decoration function
-- spawn new foods on map
local function register_plant(name, min, max, spawnby, num) local function register_plant(name, min, max, spawnby, num)
minetest.register_decoration({ minetest.register_decoration({
deco_type = "simple", deco_type = "simple",
@ -38,9 +36,26 @@ function farming.register_mgv6_decorations()
register_plant("beanbush", 18, 35, "", -1) register_plant("beanbush", 18, 35, "", -1)
end end
-- enable in mapgen v6 only -- v7 maps have a beach so plants growing near water is limited to 6- high
function farming.register_mgv7_decorations()
local mg_params = minetest.get_mapgen_params() register_plant("potato_3", 15, 40, "", -1)
if mg_params.mgname == "v6" then register_plant("tomato_7", 5, 20, "", -1)
farming.register_mgv6_decorations() 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 end

View File

@ -33,12 +33,14 @@ minetest.register_node("farming:melon_1", {
tiles = {"farming_melon_1.png"}, tiles = {"farming_melon_1.png"},
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
waving = 1,
walkable = false, walkable = false,
buildable_to = true, buildable_to = 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 = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -47,12 +49,14 @@ minetest.register_node("farming:melon_2", {
tiles = {"farming_melon_2.png"}, tiles = {"farming_melon_2.png"},
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
waving = 1,
walkable = false, walkable = false,
buildable_to = true, buildable_to = 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 = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -65,8 +69,11 @@ minetest.register_node("farming:melon_3", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = 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 = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -79,8 +86,11 @@ minetest.register_node("farming:melon_4", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = 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 = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -93,8 +103,11 @@ minetest.register_node("farming:melon_5", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = 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 = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -105,8 +118,11 @@ minetest.register_node("farming:melon_6", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = 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 = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -117,12 +133,15 @@ minetest.register_node("farming:melon_7", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = 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 = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), 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", { minetest.register_node("farming:melon_8", {
--drawtype = "nodebox", --drawtype = "nodebox",
@ -130,7 +149,6 @@ minetest.register_node("farming:melon_8", {
tiles = {"farming_melon_top.png", "farming_melon_top.png", "farming_melon_side.png"}, tiles = {"farming_melon_top.png", "farming_melon_top.png", "farming_melon_side.png"},
paramtype = "light", paramtype = "light",
walkable = true, walkable = true,
is_ground_content = true,
drop = { drop = {
items = { items = {
{items = {'farming:melon_slice 9'}, rarity = 1}, {items = {'farming:melon_slice 9'}, rarity = 1},

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, walkable = false,
buildable_to = true, buildable_to = 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 = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -49,8 +52,11 @@ minetest.register_node("farming:potato_2", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = 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 = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -62,19 +68,21 @@ minetest.register_node("farming:potato_3", {
waving = 1, waving = 1,
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
is_ground_content = true,
drop = { drop = {
items = { items = {
{items = {'farming:potato'}, rarity = 1}, {items = {'farming:potato'}, rarity = 1},
{items = {'farming:potato'}, rarity = 3}, {items = {'farming:potato'}, rarity = 3},
} }
}, },
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), 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", { minetest.register_node("farming:potato_4", {
drawtype = "plantlike", drawtype = "plantlike",
@ -84,14 +92,16 @@ minetest.register_node("farming:potato_4", {
waving = 1, waving = 1,
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
is_ground_content = true,
drop = { drop = {
items = { items = {
{items = {'farming:potato 2'}, rarity = 1}, {items = {'farming:potato 2'}, rarity = 1},
{items = {'farming:potato 3'}, rarity = 2}, {items = {'farming:potato 3'}, rarity = 2},
} }
}, },
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory=1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })

View File

@ -3,8 +3,15 @@
minetest.register_node("farming:pumpkin", { minetest.register_node("farming:pumpkin", {
description = "Pumpkin", description = "Pumpkin",
tiles = {"farming_pumpkin_top.png", "farming_pumpkin_top.png", "farming_pumpkin_side.png"}, tiles = {
groups = {choppy=1,oddly_breakable_by_hand=1,flammable=2,plant=1}, "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 = { drop = {
items = { items = {
{items = {'farming:pumpkin_slice 9'}, rarity = 1}, {items = {'farming:pumpkin_slice 9'}, rarity = 1},
@ -41,7 +48,14 @@ minetest.register_craft({
-- Jack 'O Lantern -- Jack 'O Lantern
minetest.register_node("farming:jackolantern", { minetest.register_node("farming:jackolantern", {
description = "Jack 'O Lantern", 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", 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(), sounds = default.node_sound_wood_defaults(),
@ -53,8 +67,15 @@ minetest.register_node("farming:jackolantern", {
minetest.register_node("farming:jackolantern_on", { minetest.register_node("farming:jackolantern_on", {
description = "Jack 'O Lantern", 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"}, tiles = {
light_source = 14, "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", 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(), sounds = default.node_sound_wood_defaults(),
@ -110,8 +131,11 @@ minetest.register_node("farming:pumpkin_1", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = 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 = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -124,8 +148,11 @@ minetest.register_node("farming:pumpkin_2", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = 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 = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory =1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -138,8 +165,11 @@ minetest.register_node("farming:pumpkin_3", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = 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 = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -152,8 +182,11 @@ minetest.register_node("farming:pumpkin_4", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = 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 = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -166,8 +199,11 @@ minetest.register_node("farming:pumpkin_5", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = 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 = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -179,8 +215,11 @@ minetest.register_node("farming:pumpkin_6", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = 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 = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -191,12 +230,15 @@ minetest.register_node("farming:pumpkin_7", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = 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 = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), 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", { minetest.register_node("farming:pumpkin_8", {
drawtype = "plantlike", drawtype = "plantlike",
@ -204,13 +246,15 @@ minetest.register_node("farming:pumpkin_8", {
paramtype = "light", paramtype = "light",
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
is_ground_content = true,
drop = { drop = {
items = { 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},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1
},
sounds = default.node_sound_defaults(), sounds = default.node_sound_defaults(),
}) })

View File

@ -34,12 +34,14 @@ minetest.register_node("farming:raspberry_1", {
tiles = {"farming_raspberry_1.png"}, tiles = {"farming_raspberry_1.png"},
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
waving = 1,
walkable = false, walkable = false,
buildable_to = true, buildable_to = 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 = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -52,8 +54,11 @@ minetest.register_node("farming:raspberry_2", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = 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 = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -66,12 +71,15 @@ minetest.register_node("farming:raspberry_3", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = 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 = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), 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", { minetest.register_node("farming:raspberry_4", {
drawtype = "plantlike", drawtype = "plantlike",
@ -81,7 +89,6 @@ minetest.register_node("farming:raspberry_4", {
waving = 1, waving = 1,
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
is_ground_content = true,
drop = { drop = {
items = { items = {
{items = {'farming:raspberries 2'}, rarity = 1}, {items = {'farming:raspberries 2'}, rarity = 1},
@ -89,7 +96,10 @@ minetest.register_node("farming:raspberry_4", {
{items = {'farming:raspberries'}, rarity = 3}, {items = {'farming:raspberries'}, rarity = 3},
} }
}, },
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })

View File

@ -32,12 +32,14 @@ minetest.register_node("farming:rhubarb_1", {
tiles = {"farming_rhubarb_1.png"}, tiles = {"farming_rhubarb_1.png"},
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
waving = 1,
walkable = false, walkable = false,
buildable_to = true, buildable_to = 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 = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -50,12 +52,15 @@ minetest.register_node("farming:rhubarb_2", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = 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 = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), 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", { minetest.register_node("farming:rhubarb_3", {
drawtype = "plantlike", drawtype = "plantlike",
@ -65,7 +70,6 @@ minetest.register_node("farming:rhubarb_3", {
waving = 1, waving = 1,
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
is_ground_content = true,
drop = { drop = {
items = { items = {
{items = {'farming:rhubarb 2'}, rarity = 1}, {items = {'farming:rhubarb 2'}, rarity = 1},
@ -73,7 +77,10 @@ minetest.register_node("farming:rhubarb_3", {
{items = {'farming:rhubarb'}, rarity = 3}, {items = {'farming:rhubarb'}, rarity = 3},
} }
}, },
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })

View File

@ -3,7 +3,6 @@ minetest.register_node("farming:soil", {
description = "Soil", description = "Soil",
tiles = {"farming_soil.png", "default_dirt.png"}, tiles = {"farming_soil.png", "default_dirt.png"},
drop = "default:dirt", 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(), sounds = default.node_sound_dirt_defaults(),
}) })
@ -16,7 +15,6 @@ minetest.register_node("farming:soil_wet", {
description = "Wet Soil", description = "Wet Soil",
tiles = {"farming_soil_wet.png", "farming_soil_wet_side.png"}, tiles = {"farming_soil_wet.png", "farming_soil_wet_side.png"},
drop = "default:dirt", 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(), sounds = default.node_sound_dirt_defaults(),
}) })
@ -29,7 +27,11 @@ minetest.register_abm({
chance = 4, chance = 4,
action = function(pos, node) 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 -- what's on top of soil, if solid/not plant change soil to dirt
if minetest.registered_nodes[nn] if minetest.registered_nodes[nn]

View File

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

View File

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

View File

@ -22,7 +22,7 @@ minetest.register_node("farming:seed_wheat", {
paramtype2 = "wallmounted", paramtype2 = "wallmounted",
walkable = false, walkable = false,
sunlight_propagates = true, 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) on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:wheat_1") return farming.place_seed(itemstack, placer, pointed_thing, "farming:wheat_1")
end, end,
@ -96,12 +96,14 @@ minetest.register_node("farming:wheat_1", {
tiles = {"farming_wheat_1.png"}, tiles = {"farming_wheat_1.png"},
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
waving = 1,
walkable = false, walkable = false,
buildable_to = true, buildable_to = 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 = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing=1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -110,12 +112,14 @@ minetest.register_node("farming:wheat_2", {
tiles = {"farming_wheat_2.png"}, tiles = {"farming_wheat_2.png"},
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
waving = 1,
walkable = false, walkable = false,
buildable_to = true, buildable_to = 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 = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -128,8 +132,11 @@ minetest.register_node("farming:wheat_3", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = 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 = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -142,8 +149,11 @@ minetest.register_node("farming:wheat_4", {
walkable = false, walkable = false,
buildable_to = true, buildable_to = 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 = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -161,8 +171,11 @@ minetest.register_node("farming:wheat_5", {
{items = {'farming:seed_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},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -180,8 +193,11 @@ minetest.register_node("farming:wheat_6", {
{items = {'farming:seed_wheat'}, rarity = 1}, {items = {'farming:seed_wheat'}, rarity = 1},
} }
}, },
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -201,12 +217,15 @@ minetest.register_node("farming:wheat_7", {
{items = {'farming:seed_wheat'}, rarity = 3}, {items = {'farming:seed_wheat'}, rarity = 3},
} }
}, },
selection_box = {type = "fixed",fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1,growing=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults(), 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", { minetest.register_node("farming:wheat_8", {
drawtype = "plantlike", drawtype = "plantlike",
@ -223,7 +242,10 @@ minetest.register_node("farming:wheat_8", {
{items = {'farming:seed_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},}, selection_box = farming.select,
groups = {snappy=3,flammable=2,plant=1,not_in_creative_inventory=1,attached_node=1}, groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1
},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })