forked from mtcontrib/farming
tidy and tweak code
This commit is contained in:
105
crops/barley.lua
Normal file
105
crops/barley.lua
Normal file
@ -0,0 +1,105 @@
|
||||
|
||||
local S = farming.intllib
|
||||
|
||||
-- barley seeds
|
||||
minetest.register_node("farming:seed_barley", {
|
||||
description = S("Barley Seed"),
|
||||
tiles = {"farming_barley_seed.png"},
|
||||
inventory_image = "farming_barley_seed.png",
|
||||
wield_image = "farming_barley_seed.png",
|
||||
drawtype = "signlike",
|
||||
groups = {seed = 1, snappy = 3, attached_node = 1},
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
walkable = false,
|
||||
sunlight_propagates = true,
|
||||
selection_box = farming.select,
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return farming.place_seed(itemstack, placer, pointed_thing, "farming:barley_1")
|
||||
end,
|
||||
})
|
||||
|
||||
-- harvested barley
|
||||
minetest.register_craftitem("farming:barley", {
|
||||
description = S("Barley"),
|
||||
inventory_image = "farming_barley.png",
|
||||
groups = {food_barley = 1, flammable = 2},
|
||||
})
|
||||
|
||||
-- flour
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "farming:flour",
|
||||
recipe = {
|
||||
"farming:barley", "farming:barley", "farming:barley",
|
||||
"farming:barley", "farming:mortar_pestle"
|
||||
},
|
||||
replacements = {{"group:food_mortar_pestle", "farming:mortar_pestle"}},
|
||||
})
|
||||
|
||||
-- barley definition
|
||||
local crop_def = {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_barley_1.png"},
|
||||
paramtype = "light",
|
||||
paramtype2 = "meshoptions",
|
||||
place_param2 = 3,
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
drop = "",
|
||||
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()
|
||||
}
|
||||
|
||||
-- stage 1
|
||||
minetest.register_node("farming:barley_1", table.copy(crop_def))
|
||||
|
||||
-- stage 2
|
||||
crop_def.tiles = {"farming_barley_2.png"}
|
||||
minetest.register_node("farming:barley_2", table.copy(crop_def))
|
||||
|
||||
-- stage 3
|
||||
crop_def.tiles = {"farming_barley_3.png"}
|
||||
minetest.register_node("farming:barley_3", table.copy(crop_def))
|
||||
|
||||
-- stage 4
|
||||
crop_def.tiles = {"farming_barley_4.png"}
|
||||
minetest.register_node("farming:barley_4", table.copy(crop_def))
|
||||
|
||||
-- stage 5
|
||||
crop_def.tiles = {"farming_barley_5.png"}
|
||||
crop_def.drop = {
|
||||
items = {
|
||||
{items = {'farming:barley'}, rarity = 2},
|
||||
{items = {'farming:seed_barley'}, rarity = 2},
|
||||
}
|
||||
}
|
||||
minetest.register_node("farming:barley_5", table.copy(crop_def))
|
||||
|
||||
-- stage 6
|
||||
crop_def.tiles = {"farming_barley_6.png"}
|
||||
crop_def.drop = {
|
||||
items = {
|
||||
{items = {'farming:barley'}, rarity = 2},
|
||||
{items = {'farming:seed_barley'}, rarity = 1},
|
||||
}
|
||||
}
|
||||
minetest.register_node("farming:barley_6", table.copy(crop_def))
|
||||
|
||||
-- stage 7 (final)
|
||||
crop_def.tiles = {"farming_barley_7.png"}
|
||||
crop_def.groups.growing = 0
|
||||
crop_def.drop = {
|
||||
items = {
|
||||
{items = {'farming:barley'}, rarity = 1},
|
||||
{items = {'farming:barley'}, rarity = 3},
|
||||
{items = {'farming:seed_barley'}, rarity = 1},
|
||||
{items = {'farming:seed_barley'}, rarity = 3},
|
||||
}
|
||||
}
|
||||
minetest.register_node("farming:barley_7", table.copy(crop_def))
|
246
crops/beans.lua
Normal file
246
crops/beans.lua
Normal file
@ -0,0 +1,246 @@
|
||||
--[[
|
||||
All textures by
|
||||
(C) Auke Kok <sofar@foo-projects.org>
|
||||
CC-BY-SA-3.0
|
||||
]]
|
||||
|
||||
local S = farming.intllib
|
||||
|
||||
-- place beans
|
||||
local function place_beans(itemstack, placer, pointed_thing, plantname)
|
||||
|
||||
local pt = pointed_thing
|
||||
|
||||
-- check if pointing at a node
|
||||
if not pt or pt.type ~= "node" then
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
local under = minetest.get_node(pt.under)
|
||||
|
||||
-- return if any of the nodes are not registered
|
||||
if not minetest.registered_nodes[under.name] then
|
||||
return
|
||||
end
|
||||
|
||||
-- am I right-clicking on something that has a custom on_place set?
|
||||
-- thanks to Krock for helping with this issue :)
|
||||
local def = minetest.registered_nodes[under.name]
|
||||
if def and def.on_rightclick then
|
||||
return def.on_rightclick(pt.under, under, placer, itemstack)
|
||||
end
|
||||
|
||||
-- check for protection
|
||||
if minetest.is_protected(pt.under, placer:get_player_name()) then
|
||||
return
|
||||
end
|
||||
|
||||
-- check if pointing at bean pole
|
||||
if under.name ~= "farming:beanpole" then
|
||||
return
|
||||
end
|
||||
|
||||
-- add the node and remove 1 item from the itemstack
|
||||
minetest.set_node(pt.under, {name = plantname})
|
||||
|
||||
minetest.sound_play("default_place_node", {pos = pt.under, gain = 1.0})
|
||||
|
||||
if not farming.is_creative(placer:get_player_name()) then
|
||||
|
||||
itemstack:take_item()
|
||||
|
||||
-- check for refill
|
||||
if itemstack:get_count() == 0 then
|
||||
|
||||
minetest.after(0.20,
|
||||
farming.refill_plant,
|
||||
placer,
|
||||
"farming:beans",
|
||||
placer:get_wield_index()
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
return itemstack
|
||||
end
|
||||
|
||||
-- beans
|
||||
minetest.register_craftitem("farming:beans", {
|
||||
description = S("Green Beans"),
|
||||
inventory_image = "farming_beans.png",
|
||||
groups = {food_beans = 1, flammable = 2},
|
||||
on_use = minetest.item_eat(1),
|
||||
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return place_beans(itemstack, placer, pointed_thing, "farming:beanpole_1")
|
||||
end,
|
||||
})
|
||||
|
||||
-- beans can be used for green dye
|
||||
minetest.register_craft({
|
||||
output = "dye:green",
|
||||
recipe = {
|
||||
{'farming:beans'},
|
||||
}
|
||||
})
|
||||
|
||||
-- beanpole
|
||||
minetest.register_node("farming:beanpole", {
|
||||
description = S("Bean Pole (place on soil before planting beans)"),
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_beanpole.png"},
|
||||
inventory_image = "farming_beanpole.png",
|
||||
visual_scale = 1.90, -- 1.45,
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
sunlight_propagates = true,
|
||||
drop = "farming:beanpole",
|
||||
selection_box = farming.select,
|
||||
groups = {snappy = 3, flammable = 2, attached_node = 1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
|
||||
local pt = pointed_thing
|
||||
|
||||
-- check if pointing at a node
|
||||
if not pt or pt.type ~= "node" then
|
||||
return
|
||||
end
|
||||
|
||||
local under = minetest.get_node(pt.under)
|
||||
|
||||
-- return if any of the nodes are not registered
|
||||
if not minetest.registered_nodes[under.name] then
|
||||
return
|
||||
end
|
||||
|
||||
-- am I right-clicking on something that has a custom on_place set?
|
||||
-- thanks to Krock for helping with this issue :)
|
||||
local def = minetest.registered_nodes[under.name]
|
||||
if def and def.on_rightclick then
|
||||
return def.on_rightclick(pt.under, under, placer, itemstack)
|
||||
end
|
||||
|
||||
if minetest.is_protected(pt.above, placer:get_player_name()) then
|
||||
return
|
||||
end
|
||||
|
||||
local nodename = under.name
|
||||
|
||||
if minetest.get_item_group(nodename, "soil") < 2 then
|
||||
return
|
||||
end
|
||||
|
||||
local top = {
|
||||
x = pointed_thing.above.x,
|
||||
y = pointed_thing.above.y + 1,
|
||||
z = pointed_thing.above.z
|
||||
}
|
||||
|
||||
nodename = minetest.get_node(top).name
|
||||
|
||||
if nodename ~= "air" then
|
||||
return
|
||||
end
|
||||
|
||||
minetest.set_node(pointed_thing.above, {name = "farming:beanpole"})
|
||||
|
||||
if not farming.is_creative(placer:get_player_name()) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
|
||||
return itemstack
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:beanpole",
|
||||
recipe = {
|
||||
{'', '', ''},
|
||||
{'default:stick', '', 'default:stick'},
|
||||
{'default:stick', '', 'default:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "farming:beanpole",
|
||||
burntime = 10,
|
||||
})
|
||||
|
||||
-- green bean definition
|
||||
local crop_def = {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_beanpole_1.png"},
|
||||
visual_scale = 1.90, -- 1.45,
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
sunlight_propagates = true,
|
||||
drop = {
|
||||
items = {
|
||||
{items = {'farming:beanpole'}, rarity = 1},
|
||||
}
|
||||
},
|
||||
selection_box = farming.select,
|
||||
groups = {
|
||||
snappy = 3, flammable = 3, not_in_creative_inventory = 1,
|
||||
attached_node = 1, growing = 1
|
||||
},
|
||||
sounds = default.node_sound_leaves_defaults()
|
||||
}
|
||||
|
||||
-- stage 1
|
||||
minetest.register_node("farming:beanpole_1", table.copy(crop_def))
|
||||
|
||||
-- stage2
|
||||
crop_def.tiles = {"farming_beanpole_2.png"}
|
||||
minetest.register_node("farming:beanpole_2", table.copy(crop_def))
|
||||
|
||||
-- stage 3
|
||||
crop_def.tiles = {"farming_beanpole_3.png"}
|
||||
minetest.register_node("farming:beanpole_3", table.copy(crop_def))
|
||||
|
||||
-- stage 4
|
||||
crop_def.tiles = {"farming_beanpole_4.png"}
|
||||
minetest.register_node("farming:beanpole_4", table.copy(crop_def))
|
||||
|
||||
-- stage 5 (final)
|
||||
crop_def.tiles = {"farming_beanpole_5.png"}
|
||||
crop_def.groups.growing = 0
|
||||
crop_def.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},
|
||||
}
|
||||
}
|
||||
minetest.register_node("farming:beanpole_5", table.copy(crop_def))
|
||||
|
||||
-- wild green bean bush (this is what you find on the map)
|
||||
minetest.register_node("farming:beanbush", {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_beanbush.png"},
|
||||
paramtype = "light",
|
||||
waving = 1,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
sunlight_propagates = true,
|
||||
drop = {
|
||||
items = {
|
||||
{items = {'farming:beans 1'}, rarity = 1},
|
||||
{items = {'farming:beans 1'}, rarity = 2},
|
||||
{items = {'farming:beans 1'}, rarity = 3},
|
||||
}
|
||||
},
|
||||
selection_box = farming.select,
|
||||
groups = {
|
||||
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
|
||||
not_in_creative_inventory=1
|
||||
},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
85
crops/beetroot.lua
Normal file
85
crops/beetroot.lua
Normal file
@ -0,0 +1,85 @@
|
||||
|
||||
local S = farming.intllib
|
||||
|
||||
-- beetroot
|
||||
minetest.register_craftitem("farming:beetroot", {
|
||||
description = S("Beetroot"),
|
||||
inventory_image = "farming_beetroot.png",
|
||||
groups = {food_beetroot = 1, flammable = 2},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return farming.place_seed(itemstack, placer, pointed_thing, "farming:beetroot_1")
|
||||
end,
|
||||
on_use = minetest.item_eat(1),
|
||||
})
|
||||
|
||||
-- beetroot soup
|
||||
minetest.register_craftitem("farming:beetroot_soup", {
|
||||
description = S("Beetroot Soup"),
|
||||
inventory_image = "farming_beetroot_soup.png",
|
||||
groups = {flammable = 2},
|
||||
on_use = minetest.item_eat(6, "farming:bowl"),
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "farming:beetroot_soup",
|
||||
recipe = {
|
||||
"group:food_beetroot", "group:food_beetroot",
|
||||
"group:food_beetroot", "group:food_beetroot",
|
||||
"group:food_beetroot", "group:food_beetroot","group:food_bowl"
|
||||
}
|
||||
})
|
||||
|
||||
-- red dye
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "dye:red",
|
||||
recipe = {"group:food_beetroot"},
|
||||
})
|
||||
|
||||
local crop_def = {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_beetroot_1.png"},
|
||||
paramtype = "light",
|
||||
-- paramtype2 = "meshoptions",
|
||||
-- place_param2 = 3,
|
||||
sunlight_propagates = true,
|
||||
waving = 1,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
drop = "",
|
||||
selection_box = farming.select,
|
||||
groups = {
|
||||
snappy = 3, flammable = 2, flora = 1, attached_node = 1,
|
||||
not_in_creative_inventory = 1, growing = 1
|
||||
},
|
||||
sounds = default.node_sound_leaves_defaults()
|
||||
}
|
||||
|
||||
-- stage 1
|
||||
minetest.register_node("farming:beetroot_1", table.copy(crop_def))
|
||||
|
||||
-- stage 2
|
||||
crop_def.tiles = {"farming_beetroot_2.png"}
|
||||
minetest.register_node("farming:beetroot_2", table.copy(crop_def))
|
||||
|
||||
-- stage 3
|
||||
crop_def.tiles = {"farming_beetroot_3.png"}
|
||||
minetest.register_node("farming:beetroot_3", table.copy(crop_def))
|
||||
|
||||
-- stage 4
|
||||
crop_def.tiles = {"farming_beetroot_4.png"}
|
||||
minetest.register_node("farming:beetroot_4", table.copy(crop_def))
|
||||
|
||||
-- stage 5
|
||||
crop_def.tiles = {"farming_beetroot_5.png"}
|
||||
crop_def.groups.growing = 0
|
||||
crop_def.drop = {
|
||||
max_items = 4, items = {
|
||||
{items = {'farming:beetroot'}, rarity = 1},
|
||||
{items = {'farming:beetroot'}, rarity = 2},
|
||||
{items = {'farming:beetroot'}, rarity = 3},
|
||||
{items = {'farming:beetroot'}, rarity = 4},
|
||||
}
|
||||
}
|
||||
minetest.register_node("farming:beetroot_5", table.copy(crop_def))
|
85
crops/blueberry.lua
Normal file
85
crops/blueberry.lua
Normal file
@ -0,0 +1,85 @@
|
||||
|
||||
local S = farming.intllib
|
||||
|
||||
-- blueberries
|
||||
minetest.register_craftitem("farming:blueberries", {
|
||||
description = S("Blueberries"),
|
||||
inventory_image = "farming_blueberries.png",
|
||||
groups = {food_blueberries = 1, flammable = 2},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return farming.place_seed(itemstack, placer, pointed_thing, "farming:blueberry_1")
|
||||
end,
|
||||
on_use = minetest.item_eat(1),
|
||||
})
|
||||
|
||||
-- blueberry muffin (thanks to sosogirl123 @ deviantart.com for muffin image)
|
||||
|
||||
minetest.register_craftitem("farming:muffin_blueberry", {
|
||||
description = S("Blueberry Muffin"),
|
||||
inventory_image = "farming_blueberry_muffin.png",
|
||||
on_use = minetest.item_eat(2),
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:muffin_blueberry 2",
|
||||
recipe = {
|
||||
{"group:food_blueberries", "group:food_bread", "group:food_blueberries"},
|
||||
}
|
||||
})
|
||||
|
||||
-- Blueberry Pie
|
||||
|
||||
minetest.register_craftitem("farming:blueberry_pie", {
|
||||
description = S("Blueberry Pie"),
|
||||
inventory_image = "farming_blueberry_pie.png",
|
||||
on_use = minetest.item_eat(6),
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:blueberry_pie",
|
||||
type = "shapeless",
|
||||
recipe = {
|
||||
"group:food_flour", "group:food_sugar",
|
||||
"group:food_blueberries", "group:food_baking_tray"
|
||||
},
|
||||
})
|
||||
|
||||
-- blueberry definition
|
||||
local crop_def = {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_blueberry_1.png"},
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
drop = "",
|
||||
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()
|
||||
}
|
||||
|
||||
-- stage 1
|
||||
minetest.register_node("farming:blueberry_1", table.copy(crop_def))
|
||||
|
||||
-- stage 2
|
||||
crop_def.tiles = {"farming_blueberry_2.png"}
|
||||
minetest.register_node("farming:blueberry_2", table.copy(crop_def))
|
||||
|
||||
-- stage 3
|
||||
crop_def.tiles = {"farming_blueberry_3.png"}
|
||||
minetest.register_node("farming:blueberry_3", table.copy(crop_def))
|
||||
|
||||
-- stage 4 (final)
|
||||
crop_def.tiles = {"farming_blueberry_4.png"}
|
||||
crop_def.groups.growing = 0
|
||||
crop_def.drop = {
|
||||
items = {
|
||||
{items = {'farming:blueberries 2'}, rarity = 1},
|
||||
{items = {'farming:blueberries'}, rarity = 2},
|
||||
{items = {'farming:blueberries'}, rarity = 3},
|
||||
}
|
||||
}
|
||||
minetest.register_node("farming:blueberry_4", table.copy(crop_def))
|
96
crops/carrot.lua
Normal file
96
crops/carrot.lua
Normal file
@ -0,0 +1,96 @@
|
||||
|
||||
--[[
|
||||
Original textures from PixelBox texture pack
|
||||
https://forum.minetest.net/viewtopic.php?id=4990
|
||||
]]
|
||||
|
||||
local S = farming.intllib
|
||||
|
||||
-- carrot
|
||||
minetest.register_craftitem("farming:carrot", {
|
||||
description = S("Carrot"),
|
||||
inventory_image = "farming_carrot.png",
|
||||
groups = {food_carrot = 1, flammable = 2},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return farming.place_seed(itemstack, placer, pointed_thing, "farming:carrot_1")
|
||||
end,
|
||||
on_use = minetest.item_eat(4),
|
||||
})
|
||||
|
||||
-- golden carrot
|
||||
minetest.register_craftitem("farming:carrot_gold", {
|
||||
description = S("Golden Carrot"),
|
||||
inventory_image = "farming_carrot_gold.png",
|
||||
on_use = minetest.item_eat(6),
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:carrot_gold",
|
||||
recipe = {
|
||||
{"", "default:gold_lump", ""},
|
||||
{"default:gold_lump", "group:food_carrot", "default:gold_lump"},
|
||||
{"", "default:gold_lump", ""},
|
||||
}
|
||||
})
|
||||
|
||||
-- carrot definition
|
||||
local crop_def = {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_carrot_1.png"},
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
drop = "",
|
||||
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()
|
||||
}
|
||||
|
||||
|
||||
-- stage 1
|
||||
minetest.register_node("farming:carrot_1", table.copy(crop_def))
|
||||
|
||||
-- stage 2
|
||||
crop_def.tiles = {"farming_carrot_2.png"}
|
||||
minetest.register_node("farming:carrot_2", table.copy(crop_def))
|
||||
|
||||
-- stage 3
|
||||
crop_def.tiles = {"farming_carrot_3.png"}
|
||||
minetest.register_node("farming:carrot_3", table.copy(crop_def))
|
||||
|
||||
-- stage 4
|
||||
crop_def.tiles = {"farming_carrot_4.png"}
|
||||
minetest.register_node("farming:carrot_4", table.copy(crop_def))
|
||||
|
||||
-- stage 5
|
||||
crop_def.tiles = {"farming_carrot_5.png"}
|
||||
minetest.register_node("farming:carrot_5", table.copy(crop_def))
|
||||
|
||||
-- stage 6
|
||||
crop_def.tiles = {"farming_carrot_6.png"}
|
||||
minetest.register_node("farming:carrot_6", table.copy(crop_def))
|
||||
|
||||
-- stage 7
|
||||
crop_def.tiles = {"farming_carrot_7.png"}
|
||||
crop_def.drop = {
|
||||
items = {
|
||||
{items = {'farming:carrot'}, rarity = 1},
|
||||
{items = {'farming:carrot 2'}, rarity = 3},
|
||||
}
|
||||
}
|
||||
minetest.register_node("farming:carrot_7", table.copy(crop_def))
|
||||
|
||||
-- stage 8 (final)
|
||||
crop_def.tiles = {"farming_carrot_8.png"}
|
||||
crop_def.groups.growing = 0
|
||||
crop_def.drop = {
|
||||
items = {
|
||||
{items = {'farming:carrot 2'}, rarity = 1},
|
||||
{items = {'farming:carrot 3'}, rarity = 2},
|
||||
}
|
||||
}
|
||||
minetest.register_node("farming:carrot_8", table.copy(crop_def))
|
92
crops/chili.lua
Normal file
92
crops/chili.lua
Normal file
@ -0,0 +1,92 @@
|
||||
|
||||
local S = farming.intllib
|
||||
|
||||
-- chili pepper
|
||||
minetest.register_craftitem("farming:chili_pepper", {
|
||||
description = S("Chili Pepper"),
|
||||
inventory_image = "farming_chili_pepper.png",
|
||||
groups = {food_chili_pepper = 1, flammable = 4},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return farming.place_seed(itemstack, placer, pointed_thing, "farming:chili_1")
|
||||
end,
|
||||
on_use = minetest.item_eat(2),
|
||||
})
|
||||
|
||||
-- bowl of chili
|
||||
minetest.register_craftitem("farming:chili_bowl", {
|
||||
description = S("Bowl of Chili"),
|
||||
inventory_image = "farming_chili_bowl.png",
|
||||
on_use = minetest.item_eat(8, "farming:bowl"),
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "farming:chili_bowl",
|
||||
recipe = {
|
||||
"group:food_chili_pepper", "group:food_barley",
|
||||
"group:food_tomato", "group:food_beans", "group:food_bowl"
|
||||
},
|
||||
})
|
||||
|
||||
-- chili can be used for red dye
|
||||
minetest.register_craft({
|
||||
output = "dye:red",
|
||||
recipe = {
|
||||
{'farming:chili_pepper'},
|
||||
}
|
||||
})
|
||||
|
||||
-- chili definition
|
||||
local crop_def = {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_chili_1.png"},
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
drop = "",
|
||||
selection_box = farming.select,
|
||||
groups = {
|
||||
snappy = 3, flammable = 4, plant = 1, attached_node = 1,
|
||||
not_in_creative_inventory = 1, growing = 1
|
||||
},
|
||||
sounds = default.node_sound_leaves_defaults()
|
||||
}
|
||||
|
||||
-- stage 1
|
||||
minetest.register_node("farming:chili_1", table.copy(crop_def))
|
||||
|
||||
-- stage 2
|
||||
crop_def.tiles = {"farming_chili_2.png"}
|
||||
minetest.register_node("farming:chili_2", table.copy(crop_def))
|
||||
|
||||
-- stage 3
|
||||
crop_def.tiles = {"farming_chili_3.png"}
|
||||
minetest.register_node("farming:chili_3", table.copy(crop_def))
|
||||
|
||||
-- stage 4
|
||||
crop_def.tiles = {"farming_chili_4.png"}
|
||||
minetest.register_node("farming:chili_4", table.copy(crop_def))
|
||||
|
||||
-- stage 5
|
||||
crop_def.tiles = {"farming_chili_5.png"}
|
||||
minetest.register_node("farming:chili_5", table.copy(crop_def))
|
||||
|
||||
-- stage 6
|
||||
crop_def.tiles = {"farming_chili_6.png"}
|
||||
minetest.register_node("farming:chili_6", table.copy(crop_def))
|
||||
|
||||
-- stage 7
|
||||
crop_def.tiles = {"farming_chili_7.png"}
|
||||
minetest.register_node("farming:chili_7", table.copy(crop_def))
|
||||
|
||||
-- stage 8 (final)
|
||||
crop_def.tiles = {"farming_chili_8.png"}
|
||||
crop_def.groups.growing = 0
|
||||
crop_def.drop = {
|
||||
items = {
|
||||
{items = {'farming:chili_pepper 3'}, rarity = 1},
|
||||
{items = {'farming:chili_pepper 2'}, rarity = 2},
|
||||
}
|
||||
}
|
||||
minetest.register_node("farming:chili_8", table.copy(crop_def))
|
200
crops/cocoa.lua
Normal file
200
crops/cocoa.lua
Normal file
@ -0,0 +1,200 @@
|
||||
|
||||
local S = farming.intllib
|
||||
|
||||
-- place cocoa
|
||||
local function place_cocoa(itemstack, placer, pointed_thing, plantname)
|
||||
|
||||
local pt = pointed_thing
|
||||
|
||||
-- check if pointing at a node
|
||||
if not pt or pt.type ~= "node" then
|
||||
return
|
||||
end
|
||||
|
||||
local under = minetest.get_node(pt.under)
|
||||
|
||||
-- return if any of the nodes are not registered
|
||||
if not minetest.registered_nodes[under.name] then
|
||||
return
|
||||
end
|
||||
|
||||
-- am I right-clicking on something that has a custom on_place set?
|
||||
-- thanks to Krock for helping with this issue :)
|
||||
local def = minetest.registered_nodes[under.name]
|
||||
if def and def.on_rightclick then
|
||||
return def.on_rightclick(pt.under, under, placer, itemstack)
|
||||
end
|
||||
|
||||
-- check if pointing at jungletree
|
||||
if under.name ~= "default:jungletree"
|
||||
or minetest.get_node(pt.above).name ~= "air" then
|
||||
return
|
||||
end
|
||||
|
||||
-- check for protection
|
||||
if minetest.is_protected(pt.above, placer:get_player_name()) then
|
||||
return
|
||||
end
|
||||
|
||||
-- add the node and remove 1 item from the itemstack
|
||||
minetest.set_node(pt.above, {name = plantname})
|
||||
|
||||
minetest.sound_play("default_place_node", {pos = pt.above, gain = 1.0})
|
||||
|
||||
if not farming.is_creative(placer:get_player_name()) then
|
||||
|
||||
itemstack:take_item()
|
||||
|
||||
-- check for refill
|
||||
if itemstack:get_count() == 0 then
|
||||
|
||||
minetest.after(0.20,
|
||||
farming.refill_plant,
|
||||
placer,
|
||||
"farming:cocoa_beans",
|
||||
placer:get_wield_index()
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
return itemstack
|
||||
end
|
||||
|
||||
-- cocoa beans
|
||||
minetest.register_craftitem("farming:cocoa_beans", {
|
||||
description = S("Cocoa Beans"),
|
||||
inventory_image = "farming_cocoa_beans.png",
|
||||
groups = {food_cocoa = 1, flammable = 2},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return place_cocoa(itemstack, placer, pointed_thing, "farming:cocoa_1")
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craft( {
|
||||
output = "dye:brown 2",
|
||||
recipe = {
|
||||
{ "farming:cocoa_beans" },
|
||||
}
|
||||
})
|
||||
|
||||
-- chocolate cookie
|
||||
minetest.register_craftitem("farming:cookie", {
|
||||
description = S("Cookie"),
|
||||
inventory_image = "farming_cookie.png",
|
||||
on_use = minetest.item_eat(2),
|
||||
})
|
||||
|
||||
minetest.register_craft( {
|
||||
output = "farming:cookie 8",
|
||||
recipe = {
|
||||
{"group:food_wheat", "group:food_cocoa", "group:food_wheat" },
|
||||
}
|
||||
})
|
||||
|
||||
-- bar of dark chocolate (thanks to Ice Pandora for her deviantart.com chocolate tutorial)
|
||||
minetest.register_craftitem("farming:chocolate_dark", {
|
||||
description = S("Bar of Dark Chocolate"),
|
||||
inventory_image = "farming_chocolate_dark.png",
|
||||
on_use = minetest.item_eat(3),
|
||||
})
|
||||
|
||||
minetest.register_craft( {
|
||||
output = "farming:chocolate_dark",
|
||||
recipe = {
|
||||
{"group:food_cocoa", "group:food_cocoa", "group:food_cocoa"},
|
||||
}
|
||||
})
|
||||
|
||||
-- cocoa definition
|
||||
local crop_def = {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_cocoa_1.png"},
|
||||
paramtype = "light",
|
||||
walkable = true,
|
||||
drop = {
|
||||
items = {
|
||||
{items = {'farming:cocoa_beans 1'}, rarity = 2},
|
||||
}
|
||||
},
|
||||
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()
|
||||
}
|
||||
|
||||
-- stage 1
|
||||
minetest.register_node("farming:cocoa_1", table.copy(crop_def))
|
||||
|
||||
-- stage 2
|
||||
crop_def.tiles = {"farming_cocoa_2.png"}
|
||||
minetest.register_node("farming:cocoa_2", table.copy(crop_def))
|
||||
|
||||
-- stage3
|
||||
crop_def.tiles = {"farming_cocoa_3.png"}
|
||||
crop_def.drop = {
|
||||
items = {
|
||||
{items = {'farming:cocoa_beans 1'}, rarity = 1},
|
||||
}
|
||||
}
|
||||
minetest.register_node("farming:cocoa_3", table.copy(crop_def))
|
||||
|
||||
-- stage 4 (final)
|
||||
crop_def.tiles = {"farming_cocoa_4.png"}
|
||||
crop_def.groups.growing = 0
|
||||
crop_def.drop = {
|
||||
items = {
|
||||
{items = {'farming:cocoa_beans 2'}, rarity = 1},
|
||||
{items = {'farming:cocoa_beans 1'}, rarity = 2},
|
||||
{items = {'farming:cocoa_beans 1'}, rarity = 4},
|
||||
}
|
||||
}
|
||||
minetest.register_node("farming:cocoa_4", table.copy(crop_def))
|
||||
|
||||
-- add random cocoa pods to jungle tree's
|
||||
minetest.register_on_generated(function(minp, maxp)
|
||||
|
||||
if maxp.y < 0 then
|
||||
return
|
||||
end
|
||||
|
||||
local pos, dir
|
||||
local cocoa = minetest.find_nodes_in_area(minp, maxp, "default:jungletree")
|
||||
|
||||
for n = 1, #cocoa do
|
||||
|
||||
pos = cocoa[n]
|
||||
|
||||
if minetest.find_node_near(pos, 1,
|
||||
{"default:jungleleaves", "moretrees:jungletree_leaves_green"}) then
|
||||
|
||||
dir = math.random(1, 80)
|
||||
|
||||
if dir == 1 then
|
||||
pos.x = pos.x + 1
|
||||
elseif dir == 2 then
|
||||
pos.x = pos.x - 1
|
||||
elseif dir == 3 then
|
||||
pos.z = pos.z + 1
|
||||
elseif dir == 4 then
|
||||
pos.z = pos.z -1
|
||||
end
|
||||
|
||||
if dir < 5
|
||||
and minetest.get_node(pos).name == "air"
|
||||
and minetest.get_node_light(pos) > 12 then
|
||||
|
||||
--print ("Cocoa Pod added at " .. minetest.pos_to_string(pos))
|
||||
|
||||
minetest.swap_node(pos, {
|
||||
name = "farming:cocoa_" .. tostring(math.random(1, 4))
|
||||
})
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end)
|
133
crops/coffee.lua
Normal file
133
crops/coffee.lua
Normal file
@ -0,0 +1,133 @@
|
||||
|
||||
local S = farming.intllib
|
||||
|
||||
-- coffee
|
||||
minetest.register_craftitem("farming:coffee_beans", {
|
||||
description = S("Coffee Beans"),
|
||||
inventory_image = "farming_coffee_beans.png",
|
||||
groups = {food_coffee = 1, flammable = 2},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return farming.place_seed(itemstack, placer, pointed_thing, "farming:coffee_1")
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
-- drinking cup
|
||||
minetest.register_node("farming:drinking_cup", {
|
||||
description = S("Drinking Cup (empty)"),
|
||||
drawtype = "plantlike",
|
||||
tiles = {"vessels_drinking_cup.png"},
|
||||
inventory_image = "vessels_drinking_cup.png",
|
||||
wield_image = "vessels_drinking_cup.png",
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.25, -0.5, -0.25, 0.25, 0.25, 0.25}
|
||||
},
|
||||
groups = {vessel = 1, dig_immediate = 3, attached_node = 1},
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_craft( {
|
||||
output = "farming:drinking_cup 5",
|
||||
recipe = {
|
||||
{ "default:glass", "", "default:glass" },
|
||||
{"", "default:glass",""},
|
||||
}
|
||||
})
|
||||
|
||||
-- cold cup of coffee
|
||||
minetest.register_node("farming:coffee_cup", {
|
||||
description = S("Cold Cup of Coffee"),
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_coffee_cup.png"},
|
||||
inventory_image = "farming_coffee_cup.png",
|
||||
wield_image = "farming_coffee_cup.png",
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.25, -0.5, -0.25, 0.25, 0.25, 0.25}
|
||||
},
|
||||
groups = {vessel = 1, dig_immediate = 3, attached_node = 1},
|
||||
on_use = minetest.item_eat(2, "farming:drinking_cup"),
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_craft( {
|
||||
output = "farming:coffee_cup",
|
||||
recipe = {
|
||||
{"farming:drinking_cup", "group:food_coffee","bucket:bucket_water"},
|
||||
},
|
||||
replacements = {{"bucket:bucket_water", "bucket:bucket_empty"}}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
cooktime = 5,
|
||||
output = "farming:coffee_cup_hot",
|
||||
recipe = "farming:coffee_cup"
|
||||
})
|
||||
|
||||
-- hot cup of coffee
|
||||
minetest.register_node("farming:coffee_cup_hot", {
|
||||
description = S("Hot Cup of Coffee"),
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_coffee_cup_hot.png"},
|
||||
inventory_image = "farming_coffee_cup_hot.png",
|
||||
wield_image = "farming_coffee_cup_hot.png",
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.25, -0.5, -0.25, 0.25, 0.25, 0.25}
|
||||
},
|
||||
groups = {vessel = 1, dig_immediate = 3, attached_node = 1},
|
||||
on_use = minetest.item_eat(3, "farming:drinking_cup"),
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
})
|
||||
|
||||
-- coffee definition
|
||||
local crop_def = {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_coffee_1.png"},
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
drop = "",
|
||||
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()
|
||||
}
|
||||
|
||||
-- stage 1
|
||||
minetest.register_node("farming:coffee_1", table.copy(crop_def))
|
||||
|
||||
-- stage 2
|
||||
crop_def.tiles = {"farming_coffee_2.png"}
|
||||
minetest.register_node("farming:coffee_2", table.copy(crop_def))
|
||||
|
||||
-- stage 3
|
||||
crop_def.tiles = {"farming_coffee_3.png"}
|
||||
minetest.register_node("farming:coffee_3", table.copy(crop_def))
|
||||
|
||||
-- stage 4
|
||||
crop_def.tiles = {"farming_coffee_4.png"}
|
||||
minetest.register_node("farming:coffee_4", table.copy(crop_def))
|
||||
|
||||
-- stage 5 (final)
|
||||
crop_def.tiles = {"farming_coffee_5.png"}
|
||||
crop_def.groups.growing = 0
|
||||
crop_def.drop = {
|
||||
items = {
|
||||
{items = {'farming:coffee_beans 2'}, rarity = 1},
|
||||
{items = {'farming:coffee_beans 2'}, rarity = 2},
|
||||
{items = {'farming:coffee_beans 2'}, rarity = 3},
|
||||
}
|
||||
}
|
||||
minetest.register_node("farming:coffee_5", table.copy(crop_def))
|
149
crops/corn.lua
Normal file
149
crops/corn.lua
Normal file
@ -0,0 +1,149 @@
|
||||
|
||||
--[[
|
||||
Original textures from GeMinecraft
|
||||
http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/wip-mods/1440575-1-2-5-generation-minecraft-beta-1-2-farming-and
|
||||
]]
|
||||
|
||||
local S = farming.intllib
|
||||
|
||||
-- corn
|
||||
minetest.register_craftitem("farming:corn", {
|
||||
description = S("Corn"),
|
||||
inventory_image = "farming_corn.png",
|
||||
groups = {food_corn = 1, flammable = 2},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return farming.place_seed(itemstack, placer, pointed_thing, "farming:corn_1")
|
||||
end,
|
||||
on_use = minetest.item_eat(3),
|
||||
})
|
||||
|
||||
-- corn on the cob (texture by TenPlus1)
|
||||
minetest.register_craftitem("farming:corn_cob", {
|
||||
description = S("Corn on the Cob"),
|
||||
inventory_image = "farming_corn_cob.png",
|
||||
groups = {food_corn_cooked = 1, flammable = 2},
|
||||
on_use = minetest.item_eat(5),
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
cooktime = 10,
|
||||
output = "farming:corn_cob",
|
||||
recipe = "group:food_corn"
|
||||
})
|
||||
|
||||
-- cornstarch
|
||||
minetest.register_craftitem("farming:cornstarch", {
|
||||
description = S("Cornstarch"),
|
||||
inventory_image = "farming_cornstarch.png",
|
||||
groups = {food_cornstarch = 1, flammable = 2},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:cornstarch",
|
||||
recipe = {
|
||||
{"group:food_mortar_pestle", "group:food_corn_cooked", "group:food_baking_tray"},
|
||||
{"", "group:food_bowl", ""},
|
||||
},
|
||||
replacements = {
|
||||
{"group:food_mortar_pestle", "farming:mortar_pestle"},
|
||||
{"group:food_baking_tray", "farming:baking_tray"},
|
||||
}
|
||||
})
|
||||
|
||||
-- ethanol (thanks to JKMurray for this idea)
|
||||
minetest.register_node("farming:bottle_ethanol", {
|
||||
description = S("Bottle of Ethanol"),
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_bottle_ethanol.png"},
|
||||
inventory_image = "farming_bottle_ethanol.png",
|
||||
wield_image = "farming_bottle_ethanol.png",
|
||||
paramtype = "light",
|
||||
is_ground_content = false,
|
||||
walkable = false,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25}
|
||||
},
|
||||
groups = {vessel = 1, dig_immediate = 3, attached_node = 1},
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_craft( {
|
||||
output = "farming:bottle_ethanol",
|
||||
recipe = {
|
||||
{ "vessels:glass_bottle", "group:food_corn", "group:food_corn"},
|
||||
{ "group:food_corn", "group:food_corn", "group:food_corn"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "farming:bottle_ethanol",
|
||||
burntime = 80, --240,
|
||||
replacements = {{ "farming:bottle_ethanol", "vessels:glass_bottle"}}
|
||||
})
|
||||
|
||||
-- corn definition
|
||||
local crop_def = {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_corn_1.png"},
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
drop = "",
|
||||
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()
|
||||
}
|
||||
|
||||
-- stage 1
|
||||
minetest.register_node("farming:corn_1", table.copy(crop_def))
|
||||
|
||||
-- stage 2
|
||||
crop_def.tiles = {"farming_corn_2.png"}
|
||||
minetest.register_node("farming:corn_2", table.copy(crop_def))
|
||||
|
||||
-- stage 3
|
||||
crop_def.tiles = {"farming_corn_3.png"}
|
||||
minetest.register_node("farming:corn_3", table.copy(crop_def))
|
||||
|
||||
-- stage 4
|
||||
crop_def.tiles = {"farming_corn_4.png"}
|
||||
minetest.register_node("farming:corn_4", table.copy(crop_def))
|
||||
|
||||
-- stage 5
|
||||
crop_def.tiles = {"farming_corn_5.png"}
|
||||
minetest.register_node("farming:corn_5", table.copy(crop_def))
|
||||
|
||||
-- stage 6
|
||||
crop_def.tiles = {"farming_corn_6.png"}
|
||||
crop_def.visual_scale = 1.9 -- 1.45
|
||||
minetest.register_node("farming:corn_6", table.copy(crop_def))
|
||||
|
||||
-- stage 7
|
||||
crop_def.tiles = {"farming_corn_7.png"}
|
||||
crop_def.drop = {
|
||||
items = {
|
||||
{items = {'farming:corn'}, rarity = 1},
|
||||
{items = {'farming:corn'}, rarity = 2},
|
||||
{items = {'farming:corn'}, rarity = 3},
|
||||
}
|
||||
}
|
||||
minetest.register_node("farming:corn_7", table.copy(crop_def))
|
||||
|
||||
-- stage 8 (final)
|
||||
crop_def.tiles = {"farming_corn_8.png"}
|
||||
crop_def.groups.growing = 0
|
||||
crop_def.drop = {
|
||||
items = {
|
||||
{items = {'farming:corn 2'}, rarity = 1},
|
||||
{items = {'farming:corn 2'}, rarity = 2},
|
||||
{items = {'farming:corn 2'}, rarity = 2},
|
||||
}
|
||||
}
|
||||
minetest.register_node("farming:corn_8", table.copy(crop_def))
|
151
crops/cotton.lua
Normal file
151
crops/cotton.lua
Normal file
@ -0,0 +1,151 @@
|
||||
|
||||
local S = farming.intllib
|
||||
|
||||
-- cotton seeds
|
||||
minetest.register_node("farming:seed_cotton", {
|
||||
description = S("Cotton Seed"),
|
||||
tiles = {"farming_cotton_seed.png"},
|
||||
inventory_image = "farming_cotton_seed.png",
|
||||
wield_image = "farming_cotton_seed.png",
|
||||
drawtype = "signlike",
|
||||
groups = {seed = 1, snappy = 3, attached_node = 1, flammable = 4},
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
walkable = false,
|
||||
sunlight_propagates = true,
|
||||
selection_box = farming.select,
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return farming.place_seed(itemstack, placer, pointed_thing, "farming:cotton_1")
|
||||
end,
|
||||
})
|
||||
|
||||
-- cotton / string
|
||||
|
||||
minetest.register_craftitem("farming:cotton", {
|
||||
description = S("Cotton"),
|
||||
inventory_image = "farming_cotton.png",
|
||||
groups = {flammable = 4},
|
||||
})
|
||||
|
||||
minetest.register_craftitem("farming:string", {
|
||||
description = S("String"),
|
||||
inventory_image = "farming_string.png",
|
||||
groups = {flammable = 2},
|
||||
})
|
||||
|
||||
-- cotton to wool
|
||||
minetest.register_craft({
|
||||
output = "wool:white",
|
||||
recipe = {
|
||||
{"farming:cotton", "farming:cotton"},
|
||||
{"farming:cotton", "farming:cotton"},
|
||||
}
|
||||
})
|
||||
|
||||
-- cotton to string
|
||||
minetest.register_craft({
|
||||
output = "farming:string 2",
|
||||
recipe = {
|
||||
{"farming:cotton"},
|
||||
{"farming:cotton"},
|
||||
}
|
||||
})
|
||||
|
||||
-- can be used as fuel
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "farming:string",
|
||||
burntime = 1,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "farming:cotton",
|
||||
burntime = 1,
|
||||
})
|
||||
|
||||
-- cotton definition
|
||||
local crop_def = {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_cotton_1.png"},
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
drop = "",
|
||||
selection_box = farming.select,
|
||||
groups = {
|
||||
snappy = 3, flammable = 4, plant = 1, attached_node = 1,
|
||||
not_in_creative_inventory = 1, growing = 1
|
||||
},
|
||||
sounds = default.node_sound_leaves_defaults()
|
||||
}
|
||||
|
||||
-- stage 1
|
||||
minetest.register_node("farming:cotton_1", table.copy(crop_def))
|
||||
|
||||
-- stage 2
|
||||
crop_def.tiles = {"farming_cotton_2.png"}
|
||||
minetest.register_node("farming:cotton_2", table.copy(crop_def))
|
||||
|
||||
-- stage 3
|
||||
crop_def.tiles = {"farming_cotton_3.png"}
|
||||
minetest.register_node("farming:cotton_3", table.copy(crop_def))
|
||||
|
||||
-- stage 4
|
||||
crop_def.tiles = {"farming_cotton_4.png"}
|
||||
minetest.register_node("farming:cotton_4", table.copy(crop_def))
|
||||
|
||||
-- stage 5
|
||||
crop_def.tiles = {"farming_cotton_5.png"}
|
||||
crop_def.drop = {
|
||||
items = {
|
||||
{items = {"farming:seed_cotton"}, rarity = 1},
|
||||
}
|
||||
}
|
||||
minetest.register_node("farming:cotton_5", table.copy(crop_def))
|
||||
|
||||
-- stage 6
|
||||
crop_def.tiles = {"farming_cotton_6.png"}
|
||||
crop_def.drop = {
|
||||
items = {
|
||||
{items = {"farming:cotton"}, rarity = 1},
|
||||
{items = {"farming:cotton"}, rarity = 2},
|
||||
}
|
||||
}
|
||||
minetest.register_node("farming:cotton_6", table.copy(crop_def))
|
||||
|
||||
-- stage 7
|
||||
crop_def.tiles = {"farming_cotton_7.png"}
|
||||
crop_def.drop = {
|
||||
items = {
|
||||
{items = {"farming:cotton"}, rarity = 1},
|
||||
{items = {"farming:cotton"}, rarity = 2},
|
||||
{items = {"farming:seed_cotton"}, rarity = 1},
|
||||
{items = {"farming:seed_cotton"}, rarity = 2},
|
||||
}
|
||||
}
|
||||
minetest.register_node("farming:cotton_7", table.copy(crop_def))
|
||||
|
||||
-- stage 8 (final)
|
||||
crop_def.tiles = {"farming_cotton_8.png"}
|
||||
crop_def.groups.growing = 0
|
||||
crop_def.drop = {
|
||||
items = {
|
||||
{items = {"farming:cotton"}, rarity = 1},
|
||||
{items = {"farming:cotton"}, rarity = 2},
|
||||
{items = {"farming:cotton"}, rarity = 3},
|
||||
{items = {"farming:seed_cotton"}, rarity = 1},
|
||||
{items = {"farming:seed_cotton"}, rarity = 2},
|
||||
{items = {"farming:seed_cotton"}, rarity = 3},
|
||||
}
|
||||
}
|
||||
minetest.register_node("farming:cotton_8", table.copy(crop_def))
|
||||
|
||||
--[[ Cotton (example, is already registered in cotton.lua)
|
||||
farming.register_plant("farming:cotton", {
|
||||
description = "Cotton seed",
|
||||
inventory_image = "farming_cotton_seed.png",
|
||||
groups = {flammable = 2},
|
||||
steps = 8,
|
||||
})]]
|
56
crops/cucumber.lua
Normal file
56
crops/cucumber.lua
Normal file
@ -0,0 +1,56 @@
|
||||
|
||||
--[[
|
||||
Original textures from DocFarming mod
|
||||
https://forum.minetest.net/viewtopic.php?id=3948
|
||||
]]
|
||||
|
||||
local S = farming.intllib
|
||||
|
||||
-- cucumber
|
||||
minetest.register_craftitem("farming:cucumber", {
|
||||
description = S("Cucumber"),
|
||||
inventory_image = "farming_cucumber.png",
|
||||
groups = {food_cucumber = 1, flammable = 2},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return farming.place_seed(itemstack, placer, pointed_thing, "farming:cucumber_1")
|
||||
end,
|
||||
on_use = minetest.item_eat(4),
|
||||
})
|
||||
|
||||
-- cucumber definition
|
||||
local crop_def = {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_cucumber_1.png"},
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
drop = "",
|
||||
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()
|
||||
}
|
||||
|
||||
-- stage 1
|
||||
minetest.register_node("farming:cucumber_1", table.copy(crop_def))
|
||||
|
||||
-- stage 2
|
||||
crop_def.tiles = {"farming_cucumber_2.png"}
|
||||
minetest.register_node("farming:cucumber_2", table.copy(crop_def))
|
||||
|
||||
-- stage 3
|
||||
crop_def.tiles = {"farming_cucumber_3.png"}
|
||||
minetest.register_node("farming:cucumber_3", table.copy(crop_def))
|
||||
|
||||
-- stage 4 (final)
|
||||
crop_def.tiles = {"farming_cucumber_4.png"}
|
||||
crop_def.groups.growing = 0
|
||||
crop_def.drop = {
|
||||
items = {
|
||||
{items = {'farming:cucumber 2'}, rarity = 1},
|
||||
{items = {'farming:cucumber 2'}, rarity = 2},
|
||||
}
|
||||
}
|
||||
minetest.register_node("farming:cucumber_4", table.copy(crop_def))
|
129
crops/garlic.lua
Normal file
129
crops/garlic.lua
Normal file
@ -0,0 +1,129 @@
|
||||
|
||||
--[[
|
||||
Original textures from Crops Plus mod
|
||||
Copyright (C) 2018 Grizzly Adam
|
||||
https://forum.minetest.net/viewtopic.php?f=9&t=19488
|
||||
]]
|
||||
|
||||
local S = farming.intllib
|
||||
|
||||
-- potato
|
||||
minetest.register_craftitem("farming:garlic_clove", {
|
||||
description = S("Garlic clove"),
|
||||
inventory_image = "crops_garlic_clove.png",
|
||||
groups = {food_garlic_clove = 1, flammable = 3},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return farming.place_seed(itemstack, placer, pointed_thing, "farming:garlic_1")
|
||||
end,
|
||||
})
|
||||
|
||||
-- garlic bulb
|
||||
minetest.register_craftitem("farming:garlic", {
|
||||
description = S("Garlic"),
|
||||
inventory_image = "crops_garlic.png",
|
||||
on_use = minetest.item_eat(1),
|
||||
groups = {food_garlic = 1, flammable = 3},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "farming:garlic_clove 9",
|
||||
recipe = { "farming:garlic" }
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:garlic",
|
||||
recipe = {
|
||||
{"farming:garlic_clove", "farming:garlic_clove", "farming:garlic_clove"},
|
||||
{"farming:garlic_clove", "farming:garlic_clove", "farming:garlic_clove"},
|
||||
{"farming:garlic_clove", "farming:garlic_clove", "farming:garlic_clove"}
|
||||
}
|
||||
})
|
||||
|
||||
-- garlic braid
|
||||
minetest.register_node("farming:garlic_braid", {
|
||||
description = S("Garlic Braid"),
|
||||
inventory_image = "crops_garlic_braid.png",
|
||||
wield_image = "crops_garlic_braid.png",
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
tiles = {
|
||||
"crops_garlic_braid_side.png","crops_garlic_braid.png",
|
||||
"crops_garlic_braid_side.png^[transformFx","crops_garlic_braid_side.png",
|
||||
"crops_garlic_braid.png","crops_garlic_braid.png"
|
||||
},
|
||||
groups = {vessel = 1, dig_immediate = 3, flammable = 3},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.13, -0.45, 0.5, 0.13, 0.45, 0.24,
|
||||
},
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:garlic_braid",
|
||||
recipe = {
|
||||
{"farming:garlic", "farming:garlic", "farming:garlic"},
|
||||
{"farming:garlic", "farming:garlic", "farming:garlic"},
|
||||
{"farming:garlic", "farming:garlic", "farming:garlic"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "farming:garlic 9",
|
||||
recipe = { "farming:garlic_braid" }
|
||||
})
|
||||
|
||||
-- crop definition
|
||||
local crop_def = {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"crops_garlic_plant_1.png"},
|
||||
paramtype = "light",
|
||||
paramtype2 = "meshoptions",
|
||||
place_param2 = 3,
|
||||
sunlight_propagates = true,
|
||||
waving = 1,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
drop = "",
|
||||
selection_box = farming.select,
|
||||
groups = {
|
||||
snappy = 3, flammable = 3, flora = 1, attached_node = 1,
|
||||
not_in_creative_inventory = 1, growing = 1
|
||||
},
|
||||
sounds = default.node_sound_leaves_defaults()
|
||||
}
|
||||
|
||||
-- stage 1
|
||||
minetest.register_node("farming:garlic_1", table.copy(crop_def))
|
||||
|
||||
-- stage 2
|
||||
crop_def.tiles = {"crops_garlic_plant_2.png"}
|
||||
minetest.register_node("farming:garlic_2", table.copy(crop_def))
|
||||
|
||||
-- stage 3
|
||||
crop_def.tiles = {"crops_garlic_plant_3.png"}
|
||||
minetest.register_node("farming:garlic_3", table.copy(crop_def))
|
||||
|
||||
-- stage 4
|
||||
crop_def.tiles = {"crops_garlic_plant_4.png"}
|
||||
minetest.register_node("farming:garlic_4", table.copy(crop_def))
|
||||
|
||||
-- stage 5
|
||||
crop_def.tiles = {"crops_garlic_plant_5.png"}
|
||||
crop_def.groups.growing = 0
|
||||
crop_def.drop = {
|
||||
max_items = 5, items = {
|
||||
{items = {'farming:garlic'}, rarity = 1},
|
||||
{items = {'farming:garlic'}, rarity = 1},
|
||||
{items = {'farming:garlic'}, rarity = 1},
|
||||
{items = {'farming:garlic'}, rarity = 2},
|
||||
{items = {'farming:garlic'}, rarity = 5},
|
||||
}
|
||||
}
|
||||
minetest.register_node("farming:garlic_5", table.copy(crop_def))
|
253
crops/grapes.lua
Normal file
253
crops/grapes.lua
Normal file
@ -0,0 +1,253 @@
|
||||
|
||||
local S = farming.intllib
|
||||
|
||||
-- place trellis
|
||||
local function place_grapes(itemstack, placer, pointed_thing, plantname)
|
||||
|
||||
local pt = pointed_thing
|
||||
|
||||
-- check if pointing at a node
|
||||
if not pt or pt.type ~= "node" then
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
local under = minetest.get_node(pt.under)
|
||||
|
||||
-- return if any of the nodes are not registered
|
||||
if not minetest.registered_nodes[under.name] then
|
||||
return
|
||||
end
|
||||
|
||||
-- am I right-clicking on something that has a custom on_place set?
|
||||
-- thanks to Krock for helping with this issue :)
|
||||
local def = minetest.registered_nodes[under.name]
|
||||
if def and def.on_rightclick then
|
||||
return def.on_rightclick(pt.under, under, placer, itemstack)
|
||||
end
|
||||
|
||||
-- check for protection
|
||||
if minetest.is_protected(pt.under, placer:get_player_name()) then
|
||||
return
|
||||
end
|
||||
|
||||
-- check if pointing at trellis
|
||||
if under.name ~= "farming:trellis" then
|
||||
return
|
||||
end
|
||||
|
||||
-- add the node and remove 1 item from the itemstack
|
||||
minetest.set_node(pt.under, {name = plantname})
|
||||
|
||||
minetest.sound_play("default_place_node", {pos = pt.under, gain = 1.0})
|
||||
|
||||
if not farming.is_creative(placer:get_player_name()) then
|
||||
|
||||
itemstack:take_item()
|
||||
|
||||
-- check for refill
|
||||
if itemstack:get_count() == 0 then
|
||||
|
||||
minetest.after(0.20,
|
||||
farming.refill_plant,
|
||||
placer,
|
||||
"farming:grapes",
|
||||
placer:get_wield_index()
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
return itemstack
|
||||
end
|
||||
|
||||
-- grapes
|
||||
minetest.register_craftitem("farming:grapes", {
|
||||
description = S("Grapes"),
|
||||
inventory_image = "farming_grapes.png",
|
||||
on_use = minetest.item_eat(2),
|
||||
groups = {food_grapes = 1, flammable = 3},
|
||||
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return place_grapes(itemstack, placer, pointed_thing, "farming:grapes_1")
|
||||
end,
|
||||
})
|
||||
|
||||
-- grapes can be used for violet dye
|
||||
minetest.register_craft({
|
||||
output = "dye:violet",
|
||||
recipe = {
|
||||
{'farming:grapes'},
|
||||
}
|
||||
})
|
||||
|
||||
-- trellis
|
||||
minetest.register_node("farming:trellis", {
|
||||
description = S("Trellis (place on soil before planting grapes)"),
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_trellis.png"},
|
||||
inventory_image = "farming_trellis.png",
|
||||
visual_scale = 1.9, -- 1.45,
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
sunlight_propagates = true,
|
||||
drop = "farming:trellis",
|
||||
selection_box = farming.select,
|
||||
groups = {snappy = 3, flammable = 2, attached_node = 1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
|
||||
local pt = pointed_thing
|
||||
|
||||
-- check if pointing at a node
|
||||
if not pt or pt.type ~= "node" then
|
||||
return
|
||||
end
|
||||
|
||||
local under = minetest.get_node(pt.under)
|
||||
|
||||
-- return if any of the nodes are not registered
|
||||
if not minetest.registered_nodes[under.name] then
|
||||
return
|
||||
end
|
||||
|
||||
-- am I right-clicking on something that has a custom on_place set?
|
||||
-- thanks to Krock for helping with this issue :)
|
||||
local def = minetest.registered_nodes[under.name]
|
||||
if def and def.on_rightclick then
|
||||
return def.on_rightclick(pt.under, under, placer, itemstack)
|
||||
end
|
||||
|
||||
if minetest.is_protected(pt.above, placer:get_player_name()) then
|
||||
return
|
||||
end
|
||||
|
||||
local nodename = under.name
|
||||
|
||||
if minetest.get_item_group(nodename, "soil") < 2 then
|
||||
return
|
||||
end
|
||||
|
||||
local top = {
|
||||
x = pointed_thing.above.x,
|
||||
y = pointed_thing.above.y + 1,
|
||||
z = pointed_thing.above.z
|
||||
}
|
||||
|
||||
nodename = minetest.get_node(top).name
|
||||
|
||||
if nodename ~= "air" then
|
||||
return
|
||||
end
|
||||
|
||||
minetest.set_node(pointed_thing.above, {name = "farming:trellis"})
|
||||
|
||||
if not farming.is_creative(placer:get_player_name()) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
|
||||
return itemstack
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:trellis",
|
||||
recipe = {
|
||||
{'default:stick', 'default:stick', 'default:stick'},
|
||||
{'default:stick', 'default:stick', 'default:stick'},
|
||||
{'default:stick', 'default:stick', 'default:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "farming:trellis",
|
||||
burntime = 15,
|
||||
})
|
||||
|
||||
-- grapes definition
|
||||
local crop_def = {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_grapes_1.png"},
|
||||
visual_scale = 1.9, -- 1.45,
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
sunlight_propagates = true,
|
||||
drop = {
|
||||
items = {
|
||||
{items = {'farming:trellis'}, rarity = 1},
|
||||
}
|
||||
},
|
||||
selection_box = farming.select,
|
||||
groups = {
|
||||
snappy = 3, flammable = 3, not_in_creative_inventory = 1,
|
||||
attached_node = 1, growing = 1
|
||||
},
|
||||
sounds = default.node_sound_leaves_defaults()
|
||||
}
|
||||
|
||||
-- stage 1
|
||||
minetest.register_node("farming:grapes_1", table.copy(crop_def))
|
||||
|
||||
-- stage2
|
||||
crop_def.tiles = {"farming_grapes_2.png"}
|
||||
minetest.register_node("farming:grapes_2", table.copy(crop_def))
|
||||
|
||||
-- stage 3
|
||||
crop_def.tiles = {"farming_grapes_3.png"}
|
||||
minetest.register_node("farming:grapes_3", table.copy(crop_def))
|
||||
|
||||
-- stage 4
|
||||
crop_def.tiles = {"farming_grapes_4.png"}
|
||||
minetest.register_node("farming:grapes_4", table.copy(crop_def))
|
||||
|
||||
-- stage 5
|
||||
crop_def.tiles = {"farming_grapes_5.png"}
|
||||
minetest.register_node("farming:grapes_5", table.copy(crop_def))
|
||||
|
||||
-- stage 6
|
||||
crop_def.tiles = {"farming_grapes_6.png"}
|
||||
minetest.register_node("farming:grapes_6", table.copy(crop_def))
|
||||
|
||||
-- stage 7
|
||||
crop_def.tiles = {"farming_grapes_7.png"}
|
||||
minetest.register_node("farming:grapes_7", table.copy(crop_def))
|
||||
|
||||
-- stage 8 (final)
|
||||
crop_def.tiles = {"farming_grapes_8.png"}
|
||||
crop_def.groups.growing = 0
|
||||
crop_def.drop = {
|
||||
items = {
|
||||
{items = {'farming:trellis'}, rarity = 1},
|
||||
{items = {'farming:grapes 3'}, rarity = 1},
|
||||
{items = {'farming:grapes 1'}, rarity = 2},
|
||||
{items = {'farming:grapes 1'}, rarity = 3},
|
||||
}
|
||||
}
|
||||
minetest.register_node("farming:grapes_8", table.copy(crop_def))
|
||||
|
||||
-- wild grape vine (this is what you find on the map)
|
||||
minetest.register_node("farming:grapebush", {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_grapebush.png"},
|
||||
paramtype = "light",
|
||||
waving = 1,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
sunlight_propagates = true,
|
||||
drop = {
|
||||
items = {
|
||||
{items = {'farming:grapes 1'}, rarity = 1},
|
||||
{items = {'farming:grapes 1'}, rarity = 2},
|
||||
{items = {'farming:grapes 1'}, rarity = 3},
|
||||
}
|
||||
},
|
||||
selection_box = farming.select,
|
||||
groups = {
|
||||
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
|
||||
not_in_creative_inventory=1
|
||||
},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
230
crops/hemp.lua
Normal file
230
crops/hemp.lua
Normal file
@ -0,0 +1,230 @@
|
||||
|
||||
local S = farming.intllib
|
||||
|
||||
-- hemp seeds
|
||||
minetest.register_node("farming:seed_hemp", {
|
||||
description = S("Hemp Seed"),
|
||||
tiles = {"farming_hemp_seed.png"},
|
||||
inventory_image = "farming_hemp_seed.png",
|
||||
wield_image = "farming_hemp_seed.png",
|
||||
drawtype = "signlike",
|
||||
groups = {seed = 1, snappy = 3, attached_node = 1},
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
walkable = false,
|
||||
sunlight_propagates = true,
|
||||
selection_box = farming.select,
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return farming.place_seed(itemstack, placer, pointed_thing, "farming:hemp_1")
|
||||
end,
|
||||
})
|
||||
|
||||
-- harvested hemp
|
||||
minetest.register_craftitem("farming:hemp_leaf", {
|
||||
description = S("Hemp Leaf"),
|
||||
inventory_image = "farming_hemp_leaf.png",
|
||||
})
|
||||
|
||||
-- hemp oil
|
||||
minetest.register_node("farming:hemp_oil", {
|
||||
description = S("Bottle of Hemp Oil"),
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_hemp_oil.png"},
|
||||
inventory_image = "farming_hemp_oil.png",
|
||||
wield_image = "farming_hemp_oil.png",
|
||||
paramtype = "light",
|
||||
is_ground_content = false,
|
||||
walkable = false,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25}
|
||||
},
|
||||
groups = {food_oil = 1, vessel = 1, dig_immediate = 3, attached_node = 1},
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_craft( {
|
||||
output = "farming:hemp_oil",
|
||||
recipe = {
|
||||
{"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"},
|
||||
{"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"},
|
||||
{"", "vessels:glass_bottle", ""}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft( {
|
||||
output = "farming:hemp_oil",
|
||||
recipe = {
|
||||
{"farming:seed_hemp", "farming:seed_hemp", "farming:seed_hemp"},
|
||||
{"farming:seed_hemp", "farming:seed_hemp", "farming:seed_hemp"},
|
||||
{"farming:seed_hemp", "vessels:glass_bottle", "farming:seed_hemp"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "farming:hemp_oil",
|
||||
burntime = 20,
|
||||
replacements = {{ "farming:hemp_oil", "vessels:glass_bottle"}}
|
||||
})
|
||||
|
||||
-- hemp fibre
|
||||
minetest.register_craftitem("farming:hemp_fibre", {
|
||||
description = S("Hemp Fibre"),
|
||||
inventory_image = "farming_hemp_fibre.png",
|
||||
})
|
||||
|
||||
minetest.register_craft( {
|
||||
output = "farming:hemp_fibre 8",
|
||||
recipe = {
|
||||
{"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"},
|
||||
{"farming:hemp_leaf", "bucket:bucket_water", "farming:hemp_leaf"},
|
||||
{"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"}
|
||||
},
|
||||
replacements = {{ "bucket:bucket_water", "bucket:bucket_empty"}}
|
||||
})
|
||||
|
||||
minetest.register_craft( {
|
||||
output = "farming:hemp_fibre 8",
|
||||
recipe = {
|
||||
{"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"},
|
||||
{"farming:hemp_leaf", "bucket:bucket_river_water", "farming:hemp_leaf"},
|
||||
{"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"}
|
||||
},
|
||||
replacements = {{ "bucket:bucket_river_water", "bucket:bucket_empty"}}
|
||||
})
|
||||
|
||||
-- hemp block
|
||||
minetest.register_node("farming:hemp_block", {
|
||||
description = S("Hemp Block"),
|
||||
tiles = {"farming_hemp_block.png"},
|
||||
paramtype = "light",
|
||||
groups = {snappy = 1, oddly_breakable_by_hand = 1, flammable = 2}
|
||||
})
|
||||
|
||||
minetest.register_craft( {
|
||||
output = "farming:hemp_block",
|
||||
recipe = {
|
||||
{"farming:hemp_fibre", "farming:hemp_fibre", "farming:hemp_fibre"},
|
||||
{"farming:hemp_fibre", "farming:hemp_fibre", "farming:hemp_fibre"},
|
||||
{"farming:hemp_fibre", "farming:hemp_fibre", "farming:hemp_fibre"}
|
||||
},
|
||||
})
|
||||
|
||||
-- paper
|
||||
minetest.register_craft( {
|
||||
output = "default:paper",
|
||||
recipe = {
|
||||
{"farming:hemp_fibre", "farming:hemp_fibre", "farming:hemp_fibre"},
|
||||
}
|
||||
})
|
||||
|
||||
-- string
|
||||
minetest.register_craft( {
|
||||
output = "farming:cotton",
|
||||
recipe = {
|
||||
{"farming:hemp_fibre"},
|
||||
{"farming:hemp_fibre"},
|
||||
{"farming:hemp_fibre"},
|
||||
}
|
||||
})
|
||||
|
||||
-- hemp rope
|
||||
minetest.register_node("farming:hemp_rope", {
|
||||
description = S("Hemp Rope"),
|
||||
walkable = false,
|
||||
climbable = true,
|
||||
sunlight_propagates = true,
|
||||
paramtype = "light",
|
||||
tiles = {"farming_hemp_rope.png"},
|
||||
wield_image = "farming_hemp_rope.png",
|
||||
inventory_image = "farming_hemp_rope.png",
|
||||
drawtype = "plantlike",
|
||||
groups = {flammable = 2, choppy = 3, oddly_breakable_by_hand = 3},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7},
|
||||
},
|
||||
})
|
||||
|
||||
-- string
|
||||
minetest.register_craft( {
|
||||
output = "farming:hemp_rope 6",
|
||||
recipe = {
|
||||
{"farming:hemp_fibre", "farming:hemp_fibre", "farming:hemp_fibre"},
|
||||
{"farming:cotton", "farming:cotton", "farming:cotton"},
|
||||
{"farming:hemp_fibre", "farming:hemp_fibre", "farming:hemp_fibre"},
|
||||
}
|
||||
})
|
||||
|
||||
-- hemp definition
|
||||
local crop_def = {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_hemp_1.png"},
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
drop = "",
|
||||
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()
|
||||
}
|
||||
|
||||
-- stage 1
|
||||
minetest.register_node("farming:hemp_1", table.copy(crop_def))
|
||||
|
||||
-- stage 2
|
||||
crop_def.tiles = {"farming_hemp_2.png"}
|
||||
minetest.register_node("farming:hemp_2", table.copy(crop_def))
|
||||
|
||||
-- stage 3
|
||||
crop_def.tiles = {"farming_hemp_3.png"}
|
||||
minetest.register_node("farming:hemp_3", table.copy(crop_def))
|
||||
|
||||
-- stage 4
|
||||
crop_def.tiles = {"farming_hemp_4.png"}
|
||||
minetest.register_node("farming:hemp_4", table.copy(crop_def))
|
||||
|
||||
-- stage 5
|
||||
crop_def.tiles = {"farming_hemp_5.png"}
|
||||
minetest.register_node("farming:hemp_5", table.copy(crop_def))
|
||||
|
||||
-- stage 6
|
||||
crop_def.tiles = {"farming_hemp_6.png"}
|
||||
crop_def.drop = {
|
||||
items = {
|
||||
{items = {'farming:hemp_leaf'}, rarity = 2},
|
||||
{items = {'farming:seed_hemp'}, rarity = 1},
|
||||
}
|
||||
}
|
||||
minetest.register_node("farming:hemp_6", table.copy(crop_def))
|
||||
|
||||
-- stage 7
|
||||
crop_def.tiles = {"farming_hemp_7.png"}
|
||||
crop_def.drop = {
|
||||
items = {
|
||||
{items = {'farming:hemp_leaf'}, rarity = 1},
|
||||
{items = {'farming:hemp_leaf'}, rarity = 3},
|
||||
{items = {'farming:seed_hemp'}, rarity = 1},
|
||||
{items = {'farming:seed_hemp'}, rarity = 3},
|
||||
}
|
||||
}
|
||||
minetest.register_node("farming:hemp_7", table.copy(crop_def))
|
||||
|
||||
-- stage 8 (final)
|
||||
crop_def.tiles = {"farming_hemp_8.png"}
|
||||
crop_def.groups.growing = 0
|
||||
crop_def.drop = {
|
||||
items = {
|
||||
{items = {'farming:hemp_leaf 2'}, rarity = 1},
|
||||
{items = {'farming:hemp_leaf'}, rarity = 2},
|
||||
{items = {'farming:seed_hemp'}, rarity = 1},
|
||||
{items = {'farming:seed_hemp'}, rarity = 2},
|
||||
}
|
||||
}
|
||||
minetest.register_node("farming:hemp_8", table.copy(crop_def))
|
86
crops/melon.lua
Normal file
86
crops/melon.lua
Normal file
@ -0,0 +1,86 @@
|
||||
|
||||
local S = farming.intllib
|
||||
|
||||
-- melon
|
||||
minetest.register_craftitem("farming:melon_slice", {
|
||||
description = S("Melon Slice"),
|
||||
inventory_image = "farming_melon_slice.png",
|
||||
groups = {food_melon_slice = 1, flammable = 3},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return farming.place_seed(itemstack, placer, pointed_thing, "farming:melon_1")
|
||||
end,
|
||||
on_use = minetest.item_eat(2),
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:melon_8",
|
||||
recipe = {
|
||||
{"farming:melon_slice", "farming:melon_slice", "farming:melon_slice"},
|
||||
{"farming:melon_slice", "farming:melon_slice", "farming:melon_slice"},
|
||||
{"farming:melon_slice", "farming:melon_slice", "farming:melon_slice"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:melon_slice 9",
|
||||
recipe = {
|
||||
{"", "farming:melon_8", ""},
|
||||
}
|
||||
})
|
||||
|
||||
-- melon definition
|
||||
local crop_def = {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_melon_1.png"},
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
drop = "",
|
||||
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()
|
||||
}
|
||||
|
||||
-- stage 1
|
||||
minetest.register_node("farming:melon_1", table.copy(crop_def))
|
||||
|
||||
-- stage 2
|
||||
crop_def.tiles = {"farming_melon_2.png"}
|
||||
minetest.register_node("farming:melon_2", table.copy(crop_def))
|
||||
|
||||
-- stage 3
|
||||
crop_def.tiles = {"farming_melon_3.png"}
|
||||
minetest.register_node("farming:melon_3", table.copy(crop_def))
|
||||
|
||||
-- stage 4
|
||||
crop_def.tiles = {"farming_melon_4.png"}
|
||||
minetest.register_node("farming:melon_4", table.copy(crop_def))
|
||||
|
||||
-- stage 5
|
||||
crop_def.tiles = {"farming_melon_5.png"}
|
||||
minetest.register_node("farming:melon_5", table.copy(crop_def))
|
||||
|
||||
-- stage 6
|
||||
crop_def.tiles = {"farming_melon_6.png"}
|
||||
minetest.register_node("farming:melon_6", table.copy(crop_def))
|
||||
|
||||
-- stage 7
|
||||
crop_def.tiles = {"farming_melon_7.png"}
|
||||
minetest.register_node("farming:melon_7", table.copy(crop_def))
|
||||
|
||||
-- stage 8 (final)
|
||||
crop_def.drawtype = "nodebox"
|
||||
crop_def.description = S("Melon")
|
||||
crop_def.tiles = {"farming_melon_top.png", "farming_melon_top.png", "farming_melon_side.png"}
|
||||
crop_def.selection_box = {-.5, -.5, -.5, .5, .5, .5}
|
||||
crop_def.walkable = true
|
||||
crop_def.groups = {
|
||||
food_melon = 1, snappy = 1, oddly_breakable_by_hand = 1,
|
||||
flammable = 2, plant = 1
|
||||
}
|
||||
crop_def.drop = "farming:melon_slice 9"
|
||||
minetest.register_node("farming:melon_8", table.copy(crop_def))
|
68
crops/onion.lua
Normal file
68
crops/onion.lua
Normal file
@ -0,0 +1,68 @@
|
||||
|
||||
--[[
|
||||
Original textures from Crops Plus mod
|
||||
Copyright (C) 2018 Grizzly Adam
|
||||
https://forum.minetest.net/viewtopic.php?f=9&t=19488
|
||||
]]
|
||||
|
||||
local S = farming.intllib
|
||||
|
||||
-- potato
|
||||
minetest.register_craftitem("farming:onion", {
|
||||
description = S("Onion"),
|
||||
inventory_image = "crops_onion.png",
|
||||
groups = {food_onion = 1, flammable = 3},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return farming.place_seed(itemstack, placer, pointed_thing, "farming:onion_1")
|
||||
end,
|
||||
on_use = minetest.item_eat(1),
|
||||
})
|
||||
|
||||
-- crop definition
|
||||
local crop_def = {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"crops_onion_plant_1.png"},
|
||||
paramtype = "light",
|
||||
paramtype2 = "meshoptions",
|
||||
place_param2 = 3,
|
||||
sunlight_propagates = true,
|
||||
waving = 1,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
drop = "",
|
||||
selection_box = farming.select,
|
||||
groups = {
|
||||
snappy = 3, flammable = 3, flora = 1, attached_node = 1,
|
||||
not_in_creative_inventory = 1, growing = 1
|
||||
},
|
||||
sounds = default.node_sound_leaves_defaults()
|
||||
}
|
||||
|
||||
-- stage 1
|
||||
minetest.register_node("farming:onion_1", table.copy(crop_def))
|
||||
|
||||
-- stage 2
|
||||
crop_def.tiles = {"crops_onion_plant_2.png"}
|
||||
minetest.register_node("farming:onion_2", table.copy(crop_def))
|
||||
|
||||
-- stage 3
|
||||
crop_def.tiles = {"crops_onion_plant_3.png"}
|
||||
minetest.register_node("farming:onion_3", table.copy(crop_def))
|
||||
|
||||
-- stage 4
|
||||
crop_def.tiles = {"crops_onion_plant_4.png"}
|
||||
minetest.register_node("farming:onion_4", table.copy(crop_def))
|
||||
|
||||
-- stage 5
|
||||
crop_def.tiles = {"crops_onion_plant_5.png"}
|
||||
crop_def.groups.growing = 0
|
||||
crop_def.drop = {
|
||||
max_items = 5, items = {
|
||||
{items = {'farming:onion'}, rarity = 1},
|
||||
{items = {'farming:onion'}, rarity = 1},
|
||||
{items = {'farming:onion'}, rarity = 2},
|
||||
{items = {'farming:onion'}, rarity = 2},
|
||||
{items = {'farming:onion'}, rarity = 5},
|
||||
}
|
||||
}
|
||||
minetest.register_node("farming:onion_5", table.copy(crop_def))
|
89
crops/peas.lua
Normal file
89
crops/peas.lua
Normal file
@ -0,0 +1,89 @@
|
||||
|
||||
local S = farming.intllib
|
||||
|
||||
-- Textures for Pea crop and Peas were done by Andrey01
|
||||
|
||||
-- pea pod
|
||||
minetest.register_craftitem("farming:pea_pod", {
|
||||
description = S("Pea Pod"),
|
||||
inventory_image = "farming_pea_pod.png",
|
||||
groups = {food_pea_pod = 1, flammable = 2},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return farming.place_seed(itemstack, placer, pointed_thing, "farming:pea_1")
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_craftitem("farming:peas", {
|
||||
description = S("Peas"),
|
||||
inventory_image = "farming_pea_peas.png",
|
||||
groups = {food_peas = 1, flammable = 2},
|
||||
on_use = minetest.item_eat(1)
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "farming:peas",
|
||||
recipe = {"farming:pea_pod"}
|
||||
})
|
||||
|
||||
-- pea soup
|
||||
minetest.register_craftitem("farming:pea_soup", {
|
||||
description = S("Pea Soup"),
|
||||
inventory_image = "farming_pea_soup.png",
|
||||
groups = {flammable = 2},
|
||||
on_use = minetest.item_eat(4, "farming:bowl"),
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "farming:pea_soup",
|
||||
recipe = {"group:food_peas", "group:food_peas", "group:food_bowl"}
|
||||
})
|
||||
|
||||
local crop_def = {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_pea_1.png"},
|
||||
paramtype = "light",
|
||||
paramtype2 = "meshoptions",
|
||||
place_param2 = 3,
|
||||
sunlight_propagates = true,
|
||||
waving = 1,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
drop = "",
|
||||
selection_box = farming.select,
|
||||
groups = {
|
||||
snappy = 3, flammable = 2, flora = 1, attached_node = 1,
|
||||
not_in_creative_inventory = 1, growing = 1
|
||||
},
|
||||
sounds = default.node_sound_leaves_defaults()
|
||||
}
|
||||
|
||||
-- stage 1
|
||||
minetest.register_node("farming:pea_1", table.copy(crop_def))
|
||||
|
||||
-- stage 2
|
||||
crop_def.tiles = {"farming_pea_2.png"}
|
||||
minetest.register_node("farming:pea_2", table.copy(crop_def))
|
||||
|
||||
-- stage 3
|
||||
crop_def.tiles = {"farming_pea_3.png"}
|
||||
minetest.register_node("farming:pea_3", table.copy(crop_def))
|
||||
|
||||
-- stage 4
|
||||
crop_def.tiles = {"farming_pea_4.png"}
|
||||
minetest.register_node("farming:pea_4", table.copy(crop_def))
|
||||
|
||||
-- stage 5
|
||||
crop_def.tiles = {"farming_pea_5.png"}
|
||||
crop_def.groups.growing = 0
|
||||
crop_def.drop = {
|
||||
max_items = 5, items = {
|
||||
{items = {'farming:pea_pod'}, rarity = 1},
|
||||
{items = {'farming:pea_pod'}, rarity = 2},
|
||||
{items = {'farming:pea_pod'}, rarity = 3},
|
||||
{items = {'farming:pea_pod'}, rarity = 4},
|
||||
{items = {'farming:pea_pod'}, rarity = 5},
|
||||
}
|
||||
}
|
||||
minetest.register_node("farming:pea_5", table.copy(crop_def))
|
106
crops/pepper.lua
Normal file
106
crops/pepper.lua
Normal file
@ -0,0 +1,106 @@
|
||||
|
||||
--[[
|
||||
Original textures from Crops Plus mod
|
||||
Copyright (C) 2018 Grizzly Adam
|
||||
https://forum.minetest.net/viewtopic.php?f=9&t=19488
|
||||
]]
|
||||
|
||||
local S = farming.intllib
|
||||
|
||||
-- peppercorn (seed)
|
||||
minetest.register_craftitem("farming:peppercorn", {
|
||||
description = S("Peppercorn"),
|
||||
inventory_image = "crops_peppercorn.png",
|
||||
groups = {food_peppercorn = 1, flammable = 3},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return farming.place_seed(itemstack, placer, pointed_thing, "farming:pepper_1")
|
||||
end,
|
||||
})
|
||||
|
||||
-- green pepper
|
||||
minetest.register_craftitem("farming:pepper", {
|
||||
description = S("Pepper"),
|
||||
inventory_image = "crops_pepper.png",
|
||||
on_use = minetest.item_eat(2),
|
||||
groups = {food_pepper = 1, flammable = 3},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "farming:peppercorn",
|
||||
recipe = {"farming:pepper"}
|
||||
})
|
||||
|
||||
-- ground pepper
|
||||
minetest.register_node("farming:pepper_ground", {
|
||||
description = ("Ground Pepper"),
|
||||
inventory_image = "crops_pepper_ground.png",
|
||||
wield_image = "crops_pepper_ground.png",
|
||||
drawtype = "plantlike",
|
||||
visual_scale = 0.8,
|
||||
paramtype = "light",
|
||||
tiles = {"crops_pepper_ground.png"},
|
||||
groups = {
|
||||
vessel = 1, food_pepper_ground = 1,
|
||||
dig_immediate = 3, attached_node = 1
|
||||
},
|
||||
sounds = default.node_sound_defaults(),
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25}
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft( {
|
||||
output = "farming:pepper_ground",
|
||||
type = "shapeless",
|
||||
recipe = {"group:food_peppercorn", "vessels:glass_bottle", "farming:mortar_pestle"},
|
||||
replacements = {{"group:food_mortar_pestle", "farming:mortar_pestle"}},
|
||||
})
|
||||
|
||||
-- crop definition
|
||||
local crop_def = {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"crops_pepper_plant_1.png"},
|
||||
paramtype = "light",
|
||||
paramtype2 = "meshoptions",
|
||||
place_param2 = 1,
|
||||
sunlight_propagates = true,
|
||||
waving = 1,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
drop = "",
|
||||
selection_box = farming.select,
|
||||
groups = {
|
||||
snappy = 3, flammable = 3, flora = 1, attached_node = 1,
|
||||
not_in_creative_inventory = 1, growing = 1
|
||||
},
|
||||
sounds = default.node_sound_leaves_defaults()
|
||||
}
|
||||
|
||||
-- stage 1
|
||||
minetest.register_node("farming:pepper_1", table.copy(crop_def))
|
||||
|
||||
-- stage 2
|
||||
crop_def.tiles = {"crops_pepper_plant_2.png"}
|
||||
minetest.register_node("farming:pepper_2", table.copy(crop_def))
|
||||
|
||||
-- stage 3
|
||||
crop_def.tiles = {"crops_pepper_plant_3.png"}
|
||||
minetest.register_node("farming:pepper_3", table.copy(crop_def))
|
||||
|
||||
-- stage 4
|
||||
crop_def.tiles = {"crops_pepper_plant_4.png"}
|
||||
minetest.register_node("farming:pepper_4", table.copy(crop_def))
|
||||
|
||||
-- stage 5
|
||||
crop_def.tiles = {"crops_pepper_plant_5.png"}
|
||||
crop_def.groups.growing = 0
|
||||
crop_def.drop = {
|
||||
max_items = 2, items = {
|
||||
{items = {'farming:pepper 2'}, rarity = 1},
|
||||
{items = {'farming:pepper'}, rarity = 2},
|
||||
{items = {'farming:pepper'}, rarity = 3},
|
||||
}
|
||||
}
|
||||
minetest.register_node("farming:pepper_5", table.copy(crop_def))
|
129
crops/pineapple.lua
Normal file
129
crops/pineapple.lua
Normal file
@ -0,0 +1,129 @@
|
||||
|
||||
local S = farming.intllib
|
||||
|
||||
-- pineapple top
|
||||
minetest.register_craftitem("farming:pineapple_top", {
|
||||
description = S("Pineapple Top"),
|
||||
inventory_image = "farming_pineapple_top.png",
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return farming.place_seed(itemstack, placer, pointed_thing, "farming:pineapple_1")
|
||||
end,
|
||||
})
|
||||
|
||||
-- pineapple
|
||||
minetest.register_node("farming:pineapple", {
|
||||
description = S("Pineapple"),
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_pineapple.png"},
|
||||
inventory_image = "farming_pineapple.png",
|
||||
wield_image = "farming_pineapple.png",
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.27, -0.37, -0.27, 0.27, 0.44, 0.27}
|
||||
},
|
||||
groups = {food_pineapple = 1, fleshy = 3, dig_immediate = 3, flammable = 2},
|
||||
})
|
||||
|
||||
-- pineapple
|
||||
minetest.register_craftitem("farming:pineapple_ring", {
|
||||
description = S("Pineapple Ring"),
|
||||
inventory_image = "farming_pineapple_ring.png",
|
||||
groups = {food_pineapple_ring = 1, flammable = 2},
|
||||
on_use = minetest.item_eat(1),
|
||||
})
|
||||
|
||||
minetest.register_craft( {
|
||||
output = "farming:pineapple_ring 5",
|
||||
type = "shapeless",
|
||||
recipe = {"group:food_pineapple"},
|
||||
replacements = {{"farming:pineapple", "farming:pineapple_top"}}
|
||||
})
|
||||
|
||||
-- pineapple juice
|
||||
minetest.register_craftitem("farming:pineapple_juice", {
|
||||
description = S("Pineapple Juice"),
|
||||
inventory_image = "farming_pineapple_juice.png",
|
||||
on_use = minetest.item_eat(4, "vessels:drinking_glass"),
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:pineapple_juice",
|
||||
type = "shapeless",
|
||||
recipe = {"vessels:drinking_glass", "group:food_pineapple_ring",
|
||||
"group:food_pineapple_ring", "group:food_pineapple_ring",
|
||||
"farming:juicer"},
|
||||
replacements = {
|
||||
{"group:food_juicer", "farming:juicer"},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:pineapple_juice 2",
|
||||
type = "shapeless",
|
||||
recipe = {
|
||||
"vessels:drinking_glass", "vessels:drinking_glass",
|
||||
"group:food_pineapple", "farming:juicer"
|
||||
},
|
||||
replacements = {
|
||||
{"group:food_juicer", "farming:juicer"},
|
||||
},
|
||||
})
|
||||
|
||||
-- crop definition
|
||||
local crop_def = {
|
||||
drawtype = "plantlike",
|
||||
visual_scale = 1.5,
|
||||
tiles = {"farming_pineapple_1.png"},
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
drop = "",
|
||||
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()
|
||||
}
|
||||
|
||||
-- stage 1
|
||||
minetest.register_node("farming:pineapple_1", table.copy(crop_def))
|
||||
|
||||
-- stage 2
|
||||
crop_def.tiles = {"farming_pineapple_2.png"}
|
||||
minetest.register_node("farming:pineapple_2", table.copy(crop_def))
|
||||
|
||||
-- stage 3
|
||||
crop_def.tiles = {"farming_pineapple_3.png"}
|
||||
minetest.register_node("farming:pineapple_3", table.copy(crop_def))
|
||||
|
||||
-- stage 4
|
||||
crop_def.tiles = {"farming_pineapple_4.png"}
|
||||
minetest.register_node("farming:pineapple_4", table.copy(crop_def))
|
||||
|
||||
-- stage 5
|
||||
crop_def.tiles = {"farming_pineapple_5.png"}
|
||||
minetest.register_node("farming:pineapple_5", table.copy(crop_def))
|
||||
|
||||
-- stage 6
|
||||
crop_def.tiles = {"farming_pineapple_6.png"}
|
||||
minetest.register_node("farming:pineapple_6", table.copy(crop_def))
|
||||
|
||||
-- stage 7
|
||||
crop_def.tiles = {"farming_pineapple_7.png"}
|
||||
minetest.register_node("farming:pineapple_7", table.copy(crop_def))
|
||||
|
||||
-- stage 8 (final)
|
||||
crop_def.tiles = {"farming_pineapple_8.png"}
|
||||
crop_def.groups.growing = 0
|
||||
crop_def.drop = {
|
||||
items = {
|
||||
{items = {'farming:pineapple'}, rarity = 1},
|
||||
{items = {'farming:pineapple'}, rarity = 15},
|
||||
}
|
||||
}
|
||||
minetest.register_node("farming:pineapple_8", table.copy(crop_def))
|
94
crops/potato.lua
Normal file
94
crops/potato.lua
Normal file
@ -0,0 +1,94 @@
|
||||
|
||||
--[[
|
||||
Original textures from DocFarming mod
|
||||
https://forum.minetest.net/viewtopic.php?id=3948
|
||||
]]
|
||||
|
||||
local S = farming.intllib
|
||||
|
||||
-- potato
|
||||
minetest.register_craftitem("farming:potato", {
|
||||
description = S("Potato"),
|
||||
inventory_image = "farming_potato.png",
|
||||
groups = {food_potato = 1, flammable = 2},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return farming.place_seed(itemstack, placer, pointed_thing, "farming:potato_1")
|
||||
end,
|
||||
on_use = minetest.item_eat(1),
|
||||
})
|
||||
|
||||
-- baked potato
|
||||
minetest.register_craftitem("farming:baked_potato", {
|
||||
description = S("Baked Potato"),
|
||||
inventory_image = "farming_baked_potato.png",
|
||||
on_use = minetest.item_eat(6),
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
cooktime = 10,
|
||||
output = "farming:baked_potato",
|
||||
recipe = "group:food_potato"
|
||||
})
|
||||
|
||||
-- Potato and cucumber Salad
|
||||
minetest.register_craftitem("farming:potato_salad", {
|
||||
description = S("Cucumber and Potato Salad"),
|
||||
inventory_image = "farming_potato_salad.png",
|
||||
on_use = minetest.item_eat(10, "farming:bowl"),
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:potato_salad",
|
||||
recipe = {
|
||||
{"group:food_cucumber"},
|
||||
{"farming:baked_potato"},
|
||||
{"group:food_bowl"},
|
||||
}
|
||||
})
|
||||
|
||||
-- potato definition
|
||||
local crop_def = {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_potato_1.png"},
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
waving = 1,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
drop = "",
|
||||
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()
|
||||
}
|
||||
|
||||
-- stage 1
|
||||
minetest.register_node("farming:potato_1", table.copy(crop_def))
|
||||
|
||||
-- stage 2
|
||||
crop_def.tiles = {"farming_potato_2.png"}
|
||||
minetest.register_node("farming:potato_2", table.copy(crop_def))
|
||||
|
||||
-- stage 3
|
||||
crop_def.tiles = {"farming_potato_3.png"}
|
||||
crop_def.drop = {
|
||||
items = {
|
||||
{items = {'farming:potato'}, rarity = 1},
|
||||
{items = {'farming:potato'}, rarity = 3},
|
||||
}
|
||||
}
|
||||
minetest.register_node("farming:potato_3", table.copy(crop_def))
|
||||
|
||||
-- stage 4
|
||||
crop_def.tiles = {"farming_potato_4.png"}
|
||||
crop_def.groups.growing = 0
|
||||
crop_def.drop = {
|
||||
items = {
|
||||
{items = {'farming:potato 2'}, rarity = 1},
|
||||
{items = {'farming:potato 3'}, rarity = 2},
|
||||
}
|
||||
}
|
||||
minetest.register_node("farming:potato_4", table.copy(crop_def))
|
211
crops/pumpkin.lua
Normal file
211
crops/pumpkin.lua
Normal file
@ -0,0 +1,211 @@
|
||||
|
||||
--[[
|
||||
Big thanks to PainterlyPack.net for allowing me to use these textures
|
||||
]]
|
||||
|
||||
local S = farming.intllib
|
||||
|
||||
-- pumpkin
|
||||
minetest.register_node("farming:pumpkin", {
|
||||
description = S("Pumpkin"),
|
||||
tiles = {
|
||||
"farming_pumpkin_top.png",
|
||||
"farming_pumpkin_top.png",
|
||||
"farming_pumpkin_side.png"
|
||||
},
|
||||
groups = {
|
||||
food_pumpkin = 1, choppy = 1, oddly_breakable_by_hand = 1,
|
||||
flammable = 2, plant = 1
|
||||
},
|
||||
drop = {
|
||||
items = {
|
||||
{items = {'farming:pumpkin_slice 9'}, rarity = 1},
|
||||
}
|
||||
},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
|
||||
-- pumpkin slice
|
||||
minetest.register_craftitem("farming:pumpkin_slice", {
|
||||
description = S("Pumpkin Slice"),
|
||||
inventory_image = "farming_pumpkin_slice.png",
|
||||
groups = {food_pumpkin_slice = 1, flammable = 2},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return farming.place_seed(itemstack, placer, pointed_thing, "farming:pumpkin_1")
|
||||
end,
|
||||
on_use = minetest.item_eat(2),
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:pumpkin",
|
||||
recipe = {
|
||||
{"farming:pumpkin_slice", "farming:pumpkin_slice", "farming:pumpkin_slice"},
|
||||
{"farming:pumpkin_slice", "farming:pumpkin_slice", "farming:pumpkin_slice"},
|
||||
{"farming:pumpkin_slice", "farming:pumpkin_slice", "farming:pumpkin_slice"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:pumpkin_slice 9",
|
||||
recipe = {
|
||||
{"", "farming:pumpkin", ""},
|
||||
}
|
||||
})
|
||||
|
||||
-- jack 'o lantern
|
||||
minetest.register_node("farming:jackolantern", {
|
||||
description = S("Jack 'O Lantern (punch to turn on and off)"),
|
||||
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},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
on_punch = function(pos, node, puncher)
|
||||
node.name = "farming:jackolantern_on"
|
||||
minetest.swap_node(pos, node)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node("farming:jackolantern_on", {
|
||||
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,
|
||||
not_in_creative_inventory = 1
|
||||
},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
drop = "farming:jackolantern",
|
||||
on_punch = function(pos, node, puncher)
|
||||
node.name = "farming:jackolantern"
|
||||
minetest.swap_node(pos, node)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:jackolantern",
|
||||
recipe = {
|
||||
{"default:torch"},
|
||||
{"group:food_pumpkin"},
|
||||
}
|
||||
})
|
||||
|
||||
--- wooden scarecrow base
|
||||
minetest.register_node("farming:scarecrow_bottom", {
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
paramtype2 = "facedir",
|
||||
tiles = {"default_wood.png"},
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-1/16, -8/16, -1/16, 1/16, 8/16, 1/16},
|
||||
{-12/16, 4/16, -1/16, 12/16, 2/16, 1/16},
|
||||
},
|
||||
},
|
||||
groups = {snappy = 3, flammable = 2},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:scarecrow_bottom",
|
||||
recipe = {
|
||||
{"", "group:stick", "",},
|
||||
{"group:stick", "group:stick", "group:stick",},
|
||||
{"", "group:stick", "",}
|
||||
}
|
||||
})
|
||||
|
||||
-- pumpkin bread
|
||||
minetest.register_craftitem("farming:pumpkin_bread", {
|
||||
description = S("Pumpkin Bread"),
|
||||
inventory_image = "farming_pumpkin_bread.png",
|
||||
on_use = minetest.item_eat(8),
|
||||
groups = {food_bread = 1, flammable = 2},
|
||||
})
|
||||
|
||||
minetest.register_craftitem("farming:pumpkin_dough", {
|
||||
description = S("Pumpkin Dough"),
|
||||
inventory_image = "farming_pumpkin_dough.png",
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:pumpkin_dough",
|
||||
type = "shapeless",
|
||||
recipe = {"group:food_flour", "group:food_pumpkin_slice", "group:food_pumpkin_slice"}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "farming:pumpkin_bread",
|
||||
recipe = "farming:pumpkin_dough",
|
||||
cooktime = 10
|
||||
})
|
||||
|
||||
-- pumpkin definition
|
||||
local crop_def = {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_pumpkin_1.png"},
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
waving = 1,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
drop = "",
|
||||
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()
|
||||
}
|
||||
|
||||
-- stage 1
|
||||
minetest.register_node("farming:pumpkin_1", table.copy(crop_def))
|
||||
|
||||
-- stage 2
|
||||
crop_def.tiles = {"farming_pumpkin_2.png"}
|
||||
minetest.register_node("farming:pumpkin_2", table.copy(crop_def))
|
||||
|
||||
-- stage 3
|
||||
crop_def.tiles = {"farming_pumpkin_3.png"}
|
||||
minetest.register_node("farming:pumpkin_3", table.copy(crop_def))
|
||||
|
||||
-- stage 4
|
||||
crop_def.tiles = {"farming_pumpkin_4.png"}
|
||||
minetest.register_node("farming:pumpkin_4", table.copy(crop_def))
|
||||
|
||||
-- stage 5
|
||||
crop_def.tiles = {"farming_pumpkin_5.png"}
|
||||
minetest.register_node("farming:pumpkin_5", table.copy(crop_def))
|
||||
|
||||
-- stage 6
|
||||
crop_def.tiles = {"farming_pumpkin_6.png"}
|
||||
minetest.register_node("farming:pumpkin_6", table.copy(crop_def))
|
||||
|
||||
-- stage 7
|
||||
crop_def.tiles = {"farming_pumpkin_7.png"}
|
||||
minetest.register_node("farming:pumpkin_7", table.copy(crop_def))
|
||||
|
||||
-- stage 8 (final)
|
||||
crop_def.tiles = {"farming_pumpkin_8.png"}
|
||||
crop_def.groups.growing = 0
|
||||
crop_def.drop = {
|
||||
items = {
|
||||
{items = {'farming:pumpkin_slice 9'}, rarity = 1},
|
||||
}
|
||||
}
|
||||
minetest.register_node("farming:pumpkin_8", table.copy(crop_def))
|
69
crops/raspberry.lua
Normal file
69
crops/raspberry.lua
Normal file
@ -0,0 +1,69 @@
|
||||
|
||||
local S = farming.intllib
|
||||
|
||||
-- raspberries
|
||||
minetest.register_craftitem("farming:raspberries", {
|
||||
description = S("Raspberries"),
|
||||
inventory_image = "farming_raspberries.png",
|
||||
groups = {food_raspberries = 1, flammable = 2},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return farming.place_seed(itemstack, placer, pointed_thing, "farming:raspberry_1")
|
||||
end,
|
||||
on_use = minetest.item_eat(1),
|
||||
})
|
||||
|
||||
-- raspberry smoothie
|
||||
minetest.register_craftitem("farming:smoothie_raspberry", {
|
||||
description = S("Raspberry Smoothie"),
|
||||
inventory_image = "farming_raspberry_smoothie.png",
|
||||
on_use = minetest.item_eat(2, "vessels:drinking_glass"),
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:smoothie_raspberry",
|
||||
recipe = {
|
||||
{"default:snow"},
|
||||
{"group:food_raspberries"},
|
||||
{"vessels:drinking_glass"},
|
||||
}
|
||||
})
|
||||
|
||||
-- raspberries definition
|
||||
local crop_def = {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_raspberry_1.png"},
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
drop = "",
|
||||
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()
|
||||
}
|
||||
|
||||
-- stage 1
|
||||
minetest.register_node("farming:raspberry_1", table.copy(crop_def))
|
||||
|
||||
-- stage 2
|
||||
crop_def.tiles = {"farming_raspberry_2.png"}
|
||||
minetest.register_node("farming:raspberry_2", table.copy(crop_def))
|
||||
|
||||
-- stage 3
|
||||
crop_def.tiles = {"farming_raspberry_3.png"}
|
||||
minetest.register_node("farming:raspberry_3", table.copy(crop_def))
|
||||
|
||||
-- stage 4 (final)
|
||||
crop_def.tiles = {"farming_raspberry_4.png"}
|
||||
crop_def.groups.growing = 0
|
||||
crop_def.drop = {
|
||||
items = {
|
||||
{items = {'farming:raspberries 2'}, rarity = 1},
|
||||
{items = {'farming:raspberries'}, rarity = 2},
|
||||
{items = {'farming:raspberries'}, rarity = 3},
|
||||
}
|
||||
}
|
||||
minetest.register_node("farming:raspberry_4", table.copy(crop_def))
|
66
crops/rhubarb.lua
Normal file
66
crops/rhubarb.lua
Normal file
@ -0,0 +1,66 @@
|
||||
|
||||
local S = farming.intllib
|
||||
|
||||
-- rhubarb
|
||||
minetest.register_craftitem("farming:rhubarb", {
|
||||
description = S("Rhubarb"),
|
||||
inventory_image = "farming_rhubarb.png",
|
||||
groups = {food_rhubarb = 1, flammable = 2},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return farming.place_seed(itemstack, placer, pointed_thing, "farming:rhubarb_1")
|
||||
end,
|
||||
on_use = minetest.item_eat(1),
|
||||
})
|
||||
|
||||
-- rhubarb pie
|
||||
minetest.register_craftitem("farming:rhubarb_pie", {
|
||||
description = S("Rhubarb Pie"),
|
||||
inventory_image = "farming_rhubarb_pie.png",
|
||||
on_use = minetest.item_eat(6),
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:rhubarb_pie",
|
||||
recipe = {
|
||||
{"farming:baking_tray", "group:food_sugar", ""},
|
||||
{"group:food_rhubarb", "group:food_rhubarb", "group:food_rhubarb"},
|
||||
{"group:food_wheat", "group:food_wheat", "group:food_wheat"},
|
||||
},
|
||||
replacements = {{"group:food_baking_tray", "farming:baking_tray"}}
|
||||
})
|
||||
|
||||
-- rhubarb definition
|
||||
local crop_def = {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_rhubarb_1.png"},
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
drop = "",
|
||||
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()
|
||||
}
|
||||
|
||||
-- stage 1
|
||||
minetest.register_node("farming:rhubarb_1", table.copy(crop_def))
|
||||
|
||||
-- stage2
|
||||
crop_def.tiles = {"farming_rhubarb_2.png"}
|
||||
minetest.register_node("farming:rhubarb_2", table.copy(crop_def))
|
||||
|
||||
-- stage 3 (final)
|
||||
crop_def.tiles = {"farming_rhubarb_3.png"}
|
||||
crop_def.groups.growing = 0
|
||||
crop_def.drop = {
|
||||
items = {
|
||||
{items = {'farming:rhubarb 2'}, rarity = 1},
|
||||
{items = {'farming:rhubarb'}, rarity = 2},
|
||||
{items = {'farming:rhubarb'}, rarity = 3},
|
||||
}
|
||||
}
|
||||
minetest.register_node("farming:rhubarb_3", table.copy(crop_def))
|
79
crops/tomato.lua
Normal file
79
crops/tomato.lua
Normal file
@ -0,0 +1,79 @@
|
||||
|
||||
--[[
|
||||
Textures edited from:
|
||||
http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/1288375-food-plus-mod-more-food-than-you-can-imagine-v2-9)
|
||||
]]
|
||||
|
||||
local S = farming.intllib
|
||||
|
||||
-- tomato
|
||||
minetest.register_craftitem("farming:tomato", {
|
||||
description = S("Tomato"),
|
||||
inventory_image = "farming_tomato.png",
|
||||
groups = {food_tomato = 1, flammable = 2},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return farming.place_seed(itemstack, placer, pointed_thing, "farming:tomato_1")
|
||||
end,
|
||||
on_use = minetest.item_eat(4),
|
||||
})
|
||||
|
||||
-- tomato definition
|
||||
local crop_def = {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_tomato_1.png"},
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
drop = "",
|
||||
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()
|
||||
}
|
||||
|
||||
-- stage 1
|
||||
minetest.register_node("farming:tomato_1", table.copy(crop_def))
|
||||
|
||||
-- stage2
|
||||
crop_def.tiles = {"farming_tomato_2.png"}
|
||||
minetest.register_node("farming:tomato_2", table.copy(crop_def))
|
||||
|
||||
-- stage 3
|
||||
crop_def.tiles = {"farming_tomato_3.png"}
|
||||
minetest.register_node("farming:tomato_3", table.copy(crop_def))
|
||||
|
||||
-- stage 4
|
||||
crop_def.tiles = {"farming_tomato_4.png"}
|
||||
minetest.register_node("farming:tomato_4", table.copy(crop_def))
|
||||
|
||||
-- stage 5
|
||||
crop_def.tiles = {"farming_tomato_5.png"}
|
||||
minetest.register_node("farming:tomato_5", table.copy(crop_def))
|
||||
|
||||
-- stage 6
|
||||
crop_def.tiles = {"farming_tomato_6.png"}
|
||||
minetest.register_node("farming:tomato_6", table.copy(crop_def))
|
||||
|
||||
-- stage 7
|
||||
crop_def.tiles = {"farming_tomato_7.png"}
|
||||
crop_def.drop = {
|
||||
items = {
|
||||
{items = {'farming:tomato'}, rarity = 1},
|
||||
{items = {'farming:tomato'}, rarity = 3},
|
||||
}
|
||||
}
|
||||
minetest.register_node("farming:tomato_7", table.copy(crop_def))
|
||||
|
||||
-- stage 8 (final)
|
||||
crop_def.tiles = {"farming_tomato_8.png"}
|
||||
crop_def.groups.growing = 0
|
||||
crop_def.drop = {
|
||||
items = {
|
||||
{items = {'farming:tomato 3'}, rarity = 1},
|
||||
{items = {'farming:tomato 3'}, rarity = 2},
|
||||
}
|
||||
}
|
||||
minetest.register_node("farming:tomato_8", table.copy(crop_def))
|
223
crops/wheat.lua
Normal file
223
crops/wheat.lua
Normal file
@ -0,0 +1,223 @@
|
||||
|
||||
local S = farming.intllib
|
||||
|
||||
-- wheat seeds
|
||||
minetest.register_node("farming:seed_wheat", {
|
||||
description = S("Wheat Seed"),
|
||||
tiles = {"farming_wheat_seed.png"},
|
||||
inventory_image = "farming_wheat_seed.png",
|
||||
wield_image = "farming_wheat_seed.png",
|
||||
drawtype = "signlike",
|
||||
groups = {seed = 1, snappy = 3, attached_node = 1, flammable = 4},
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
walkable = false,
|
||||
sunlight_propagates = true,
|
||||
selection_box = farming.select,
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
return farming.place_seed(itemstack, placer, pointed_thing, "farming:wheat_1")
|
||||
end,
|
||||
})
|
||||
|
||||
-- harvested wheat
|
||||
minetest.register_craftitem("farming:wheat", {
|
||||
description = S("Wheat"),
|
||||
inventory_image = "farming_wheat.png",
|
||||
groups = {food_wheat = 1, flammable = 4},
|
||||
})
|
||||
|
||||
-- straw
|
||||
minetest.register_node("farming:straw", {
|
||||
description = S("Straw"),
|
||||
tiles = {"farming_straw.png"},
|
||||
is_ground_content = false,
|
||||
groups = {snappy = 3, flammable = 4, fall_damage_add_percent = -30},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:straw 3",
|
||||
recipe = {
|
||||
{"farming:wheat", "farming:wheat", "farming:wheat"},
|
||||
{"farming:wheat", "farming:wheat", "farming:wheat"},
|
||||
{"farming:wheat", "farming:wheat", "farming:wheat"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:wheat 3",
|
||||
recipe = {
|
||||
{"farming:straw"},
|
||||
}
|
||||
})
|
||||
|
||||
-- flour
|
||||
minetest.register_craftitem("farming:flour", {
|
||||
description = S("Flour"),
|
||||
inventory_image = "farming_flour.png",
|
||||
groups = {food_flour = 1, flammable = 1},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "farming:flour",
|
||||
recipe = {
|
||||
"farming:wheat", "farming:wheat", "farming:wheat",
|
||||
"farming:wheat", "farming:mortar_pestle"
|
||||
},
|
||||
replacements = {{"group:food_mortar_pestle", "farming:mortar_pestle"}},
|
||||
})
|
||||
|
||||
-- bread
|
||||
minetest.register_craftitem("farming:bread", {
|
||||
description = S("Bread"),
|
||||
inventory_image = "farming_bread.png",
|
||||
on_use = minetest.item_eat(5),
|
||||
groups = {food_bread = 1, flammable = 2},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
cooktime = 15,
|
||||
output = "farming:bread",
|
||||
recipe = "farming:flour"
|
||||
})
|
||||
|
||||
-- sliced bread
|
||||
minetest.register_craftitem("farming:bread_slice", {
|
||||
description = S("Sliced Bread"),
|
||||
inventory_image = "farming_bread_slice.png",
|
||||
on_use = minetest.item_eat(1),
|
||||
groups = {food_bread_slice = 1, flammable = 2},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "farming:bread_slice 5",
|
||||
recipe = {"farming:bread", "group:food_cutting_board"},
|
||||
replacements = {{"group:food_cutting_board", "farming:cutting_board"}},
|
||||
})
|
||||
|
||||
-- toast
|
||||
minetest.register_craftitem("farming:toast", {
|
||||
description = S("Toast"),
|
||||
inventory_image = "farming_toast.png",
|
||||
on_use = minetest.item_eat(1),
|
||||
groups = {food_toast = 1, flammable = 2},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
cooktime = 3,
|
||||
output = "farming:toast",
|
||||
recipe = "farming:bread_slice"
|
||||
})
|
||||
|
||||
-- toast sandwich
|
||||
minetest.register_craftitem("farming:toast_sandwich", {
|
||||
description = S("Toast Sandwich"),
|
||||
inventory_image = "farming_toast_sandwich.png",
|
||||
on_use = minetest.item_eat(4),
|
||||
groups = {flammable = 2},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:toast_sandwich",
|
||||
recipe = {
|
||||
{"farming:bread_slice"},
|
||||
{"farming:toast"},
|
||||
{"farming:bread_slice"},
|
||||
}
|
||||
})
|
||||
|
||||
-- wheat definition
|
||||
local crop_def = {
|
||||
drawtype = "plantlike",
|
||||
tiles = {"farming_wheat_1.png"},
|
||||
paramtype = "light",
|
||||
paramtype2 = "meshoptions",
|
||||
place_param2 = 3,
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
drop = "",
|
||||
selection_box = farming.select,
|
||||
groups = {
|
||||
snappy = 3, flammable = 4, plant = 1, attached_node = 1,
|
||||
not_in_creative_inventory = 1, growing = 1
|
||||
},
|
||||
sounds = default.node_sound_leaves_defaults()
|
||||
}
|
||||
|
||||
-- stage 1
|
||||
minetest.register_node("farming:wheat_1", table.copy(crop_def))
|
||||
|
||||
-- stage 2
|
||||
crop_def.tiles = {"farming_wheat_2.png"}
|
||||
minetest.register_node("farming:wheat_2", table.copy(crop_def))
|
||||
|
||||
-- stage 3
|
||||
crop_def.tiles = {"farming_wheat_3.png"}
|
||||
minetest.register_node("farming:wheat_3", table.copy(crop_def))
|
||||
|
||||
-- stage 4
|
||||
crop_def.tiles = {"farming_wheat_4.png"}
|
||||
minetest.register_node("farming:wheat_4", table.copy(crop_def))
|
||||
|
||||
-- stage 5
|
||||
crop_def.tiles = {"farming_wheat_5.png"}
|
||||
crop_def.drop = {
|
||||
items = {
|
||||
{items = {'farming:wheat'}, rarity = 2},
|
||||
{items = {'farming:seed_wheat'}, rarity = 2},
|
||||
}
|
||||
}
|
||||
minetest.register_node("farming:wheat_5", table.copy(crop_def))
|
||||
|
||||
-- stage 6
|
||||
crop_def.tiles = {"farming_wheat_6.png"}
|
||||
crop_def.drop = {
|
||||
items = {
|
||||
{items = {'farming:wheat'}, rarity = 2},
|
||||
{items = {'farming:seed_wheat'}, rarity = 1},
|
||||
}
|
||||
}
|
||||
minetest.register_node("farming:wheat_6", table.copy(crop_def))
|
||||
|
||||
-- stage 7
|
||||
crop_def.tiles = {"farming_wheat_7.png"}
|
||||
crop_def.drop = {
|
||||
items = {
|
||||
{items = {'farming:wheat'}, rarity = 1},
|
||||
{items = {'farming:wheat'}, rarity = 3},
|
||||
{items = {'farming:seed_wheat'}, rarity = 1},
|
||||
{items = {'farming:seed_wheat'}, rarity = 3},
|
||||
}
|
||||
}
|
||||
minetest.register_node("farming:wheat_7", table.copy(crop_def))
|
||||
|
||||
-- stage 8 (final)
|
||||
crop_def.tiles = {"farming_wheat_8.png"}
|
||||
crop_def.groups.growing = 0
|
||||
crop_def.drop = {
|
||||
items = {
|
||||
{items = {'farming:wheat'}, rarity = 1},
|
||||
{items = {'farming:wheat'}, rarity = 3},
|
||||
{items = {'farming:seed_wheat'}, rarity = 1},
|
||||
{items = {'farming:seed_wheat'}, rarity = 3},
|
||||
}
|
||||
}
|
||||
minetest.register_node("farming:wheat_8", table.copy(crop_def))
|
||||
|
||||
-- fuels
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "farming:straw",
|
||||
burntime = 3,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "farming:wheat",
|
||||
burntime = 1,
|
||||
})
|
Reference in New Issue
Block a user