Fix naming of banner copies
[MineClone/MineClone2.git] / mods / ITEMS / mcl_farming / potatoes.lua
blobdb9a963eadee8e19edd57fd4e6ba89f774ed18af
1 -- Premature potato plants
3 for i=1, 7 do
4 local texture, selbox
5 if i < 3 then
6 texture = "mcl_farming_potatoes_stage_0.png"
7 selbox = { -0.5, -0.5, -0.5, 0.5, -5/16, 0.5 }
8 elseif i < 5 then
9 texture = "mcl_farming_potatoes_stage_1.png"
10 selbox = { -0.5, -0.5, -0.5, 0.5, -2/16, 0.5 }
11 else
12 texture = "mcl_farming_potatoes_stage_2.png"
13 selbox = { -0.5, -0.5, -0.5, 0.5, 2/16, 0.5 }
14 end
16 local create, name, longdesc
17 if i==1 then
18 create = true
19 name = "Premature Potato Plant"
20 longdesc = "Potato plants are plants which grow on farmland under sunlight in 8 stages, of which only 4 are actually visible. On hydrated farmland, they grow a bit faster. They can be harvested at any time but will only yield a profit when mature."
21 else
22 create = false
23 if minetest.get_modpath("doc") then
24 doc.add_entry_alias("nodes", "mcl_farming:potato_1", "nodes", "mcl_farming:potato_"..i)
25 end
26 end
28 minetest.register_node("mcl_farming:potato_"..i, {
29 description = string.format("Premature Potato Plant (Stage %d)", i),
30 _doc_items_create_entry = create,
31 _doc_items_entry_name = name,
32 _doc_items_longdesc = longdesc,
33 paramtype = "light",
34 paramtype2 = "meshoptions",
35 sunlight_propagates = true,
36 place_param2 = 3,
37 walkable = false,
38 drawtype = "plantlike",
39 drop = "mcl_farming:potato_item",
40 tiles = { texture },
41 selection_box = {
42 type = "fixed",
43 fixed = { selbox },
45 groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1},
46 sounds = mcl_sounds.node_sound_leaves_defaults(),
47 _mcl_blast_resistance = 0,
49 end
51 -- Mature plant
52 minetest.register_node("mcl_farming:potato", {
53 description = "Mature Potato Plant",
54 _doc_items_longdesc = "Mature potato plants are ready to be harvested for potatoes. They won't grow any further.",
55 paramtype = "light",
56 paramtype2 = "meshoptions",
57 sunlight_propagates = true,
58 place_param2 = 3,
59 walkable = false,
60 drawtype = "plantlike",
61 tiles = {"mcl_farming_potatoes_stage_3.png"},
62 drop = {
63 items = {
64 { items = {'mcl_farming:potato_item 1'} },
65 { items = {'mcl_farming:potato_item 1'}, rarity = 2 },
66 { items = {'mcl_farming:potato_item 1'}, rarity = 2 },
67 { items = {'mcl_farming:potato_item 1'}, rarity = 2 },
68 { items = {'mcl_farming:potato_item_poison 1'}, rarity = 50 }
71 selection_box = {
72 type = "fixed",
73 fixed = {
74 { -0.5, -0.5, -0.5, 0.5, 1/16, 0.5 }
77 groups = {dig_immediate=3, not_in_creative_inventory=1,plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1},
78 sounds = mcl_sounds.node_sound_leaves_defaults(),
79 _mcl_blast_resistance = 0,
82 minetest.register_craftitem("mcl_farming:potato_item", {
83 description = "Potato",
84 _doc_items_longdesc = "Potatoes are food items which can be eaten, cooked in the furnace and planted. Pigs like potatoes.",
85 _doc_items_usagehelp = "Hold it in your hand and rightclick to eat it. Place it on top of farmland to plant it. It grows in sunlight and grows faster on hydrated farmland. Rightclick an animal to feed it.",
86 inventory_image = "farming_potato.png",
87 groups = { food = 2, eatable = 1 },
88 _mcl_saturation = 0.6,
89 stack_max = 64,
90 on_secondary_use = minetest.item_eat(1),
91 on_place = function(itemstack, placer, pointed_thing)
92 local new = mcl_farming:place_seed(itemstack, placer, pointed_thing, "mcl_farming:potato_1")
93 if new ~= nil then
94 return new
95 else
96 return minetest.do_item_eat(1, nil, itemstack, placer, pointed_thing)
97 end
98 end,
101 minetest.register_craftitem("mcl_farming:potato_item_baked", {
102 description = "Baked Potato",
103 _doc_items_longdesc = "Baked potatoes are food items which are more filling than the unbaked ones.",
104 stack_max = 64,
105 inventory_image = "farming_potato_baked.png",
106 on_place = minetest.item_eat(5),
107 on_secondary_use = minetest.item_eat(5),
108 groups = { food = 2, eatable = 5 },
109 _mcl_saturation = 6.0,
112 minetest.register_craftitem("mcl_farming:potato_item_poison", {
113 description = "Poisonous Potato",
114 _doc_items_longdesc = "This potato doesn't look too healthy. You can eat it to restore hunger points, but there's a 60% chance it will poison you briefly.",
115 stack_max = 64,
116 inventory_image = "farming_potato_poison.png",
117 -- TODO: Cause status effects
118 on_place = minetest.item_eat(2),
119 on_secondary_use = minetest.item_eat(2),
120 groups = { food = 2, eatable = 2 },
121 _mcl_saturation = 1.2,
124 minetest.register_craft({
125 type = "cooking",
126 output = "mcl_farming:potato_item_baked",
127 recipe = "mcl_farming:potato_item",
128 cooktime = 10,
131 mcl_farming:add_plant("plant_potato", "mcl_farming:potato", {"mcl_farming:potato_1", "mcl_farming:potato_2", "mcl_farming:potato_3", "mcl_farming:potato_4", "mcl_farming:potato_5", "mcl_farming:potato_6", "mcl_farming:potato_7"}, 19.75, 20)