1 -- Premature potato plants
6 texture
= "mcl_farming_potatoes_stage_0.png"
7 selbox
= { -0.5, -0.5, -0.5, 0.5, -5/16, 0.5 }
9 texture
= "mcl_farming_potatoes_stage_1.png"
10 selbox
= { -0.5, -0.5, -0.5, 0.5, -2/16, 0.5 }
12 texture
= "mcl_farming_potatoes_stage_2.png"
13 selbox
= { -0.5, -0.5, -0.5, 0.5, 2/16, 0.5 }
16 local create
, name
, longdesc
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."
23 if minetest
.get_modpath("doc") then
24 doc
.add_entry_alias("nodes", "mcl_farming:potato_1", "nodes", "mcl_farming:potato_"..i
)
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
,
34 paramtype2
= "meshoptions",
35 sunlight_propagates
= true,
38 drawtype
= "plantlike",
39 drop
= "mcl_farming:potato_item",
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,
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.",
56 paramtype2
= "meshoptions",
57 sunlight_propagates
= true,
60 drawtype
= "plantlike",
61 tiles
= {"mcl_farming_potatoes_stage_3.png"},
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 }
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,
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")
96 return minetest
.do_item_eat(1, nil, itemstack
, placer
, pointed_thing
)
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.",
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.",
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({
126 output
= "mcl_farming:potato_item_baked",
127 recipe
= "mcl_farming:potato_item",
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)