Make onions farmable.

This commit is contained in:
Duane 2016-07-11 05:28:28 -05:00
parent 34ffc77540
commit a5906f635b
4 changed files with 60 additions and 6 deletions

View file

@ -314,12 +314,6 @@ if mobs and mobs.mod == "redo" then
recipe = "fun_caves:meat_pie_uncooked"
})
minetest.register_craftitem("fun_caves:onion", {
description = "Onion",
inventory_image = "fun_caves_onion.png",
on_use = minetest.item_eat(2),
})
minetest.register_craftitem("fun_caves:meat_pie_slice", {
description = "Meat Pie Slice",
inventory_image = "fun_caves_meat_pie_slice.png",
@ -335,6 +329,66 @@ if mobs and mobs.mod == "redo" then
})
end
farming.register_plant("fun_caves:onion", {
description = "Onion",
inventory_image = "fun_caves_onion.png",
steps = 3,
minlight = 13,
maxlight = default.LIGHT_MAX,
fertility = {"grassland"}
})
minetest.registered_items['fun_caves:seed_onion'] = nil
minetest.registered_nodes['fun_caves:seed_onion'] = nil
minetest.registered_craftitems['fun_caves:seed_onion'] = nil
minetest.register_alias('fun_caves:seed_onion', 'fun_caves:onion')
for i = 1, 3 do
local onion = minetest.registered_items['fun_caves:onion_'..i]
if onion then
onion.drop = {
max_items = i,
items = {
{ items = {'fun_caves:onion'}, rarity = 4 - i, },
{ items = {'fun_caves:onion'}, rarity = (4 - i) * 3, },
{ items = {'fun_caves:onion'}, rarity = (4 - i) * 6, },
},
}
end
end
minetest.register_node("fun_caves:onion", {
description = "Onion",
drawtype = "plantlike",
visual_scale = 0.75,
tiles = {"fun_caves_onion.png"},
inventory_image = "fun_caves_onion.png",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
is_ground_content = false,
selection_box = {
type = "fixed",
fixed = {-0.2, -0.5, -0.2, 0.2, 0, 0.2}
},
fertility = {'grassland'},
groups = {seed = 1, fleshy = 3, dig_immediate = 3, flammable = 2},
on_use = minetest.item_eat(2),
sounds = default.node_sound_leaves_defaults(),
next_plant = 'fun_caves:onion_1',
on_timer = farming.grow_plant,
minlight = 10,
maxlight = 15,
on_place = function(itemstack, placer, pointed_thing)
local stack = farming.place_seed(itemstack, placer, pointed_thing, 'fun_caves:onion')
if stack then
return stack
end
return minetest.item_place(itemstack, placer, pointed_thing)
end,
})
minetest.register_craft({
output = 'fun_caves:apple_pie_uncooked',
type = 'shapeless',

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB