]> git.lizzy.rs Git - Crafter.git/blob - mods/farming/registers.lua
Complete farming api, add pumpkins, pumpkin pie, melon slices,pumpkin and melon seeds...
[Crafter.git] / mods / farming / registers.lua
1 minetest.register_plant("cactus", {
2         description = "Cactus",
3         
4         tiles = {"cactus_top.png", "cactus_bottom.png", "cactus_side.png"},
5         
6         groups = {dig_immediate=1,flammable=1,touch_hurt=1},
7         
8         sounds = main.dirtSound(),
9         
10         paramtype = "light",
11         
12         sunlight_propagates = true,
13         
14         drawtype = "nodebox",
15         
16         buildable_to = false,
17         
18         waving            = 0,
19         --inventory_image   = def.inventory_image,
20         --walkable          = def.walkable,
21         --climbable         = def.climbable,
22         --paramtype2        = def.paramtype2,
23         --buildable_to      = def.buildable_to,
24         --selection_box     = def.selection_box,
25         --drop              = def.drop,
26         grows             = "up",
27         node_box = {
28                 type = "fixed",
29                 fixed = {
30                         {-7/16, -8/16, -7/16,  7/16, 8/16,  7/16}, -- Main body
31                         {-8/16, -8/16, -7/16,  8/16, 8/16, -7/16}, -- Spikes
32                         {-8/16, -8/16,  7/16,  8/16, 8/16,  7/16}, -- Spikes
33                         {-7/16, -8/16, -8/16, -7/16, 8/16,  8/16}, -- Spikes
34                         {7/16,  -8/16,  8/16,  7/16, 8/16, -8/16}, -- Spikes
35                 },
36         },
37 })
38
39 minetest.register_plant("sugarcane", {
40         description = "Sugarcane",
41         
42         inventory_image = "sugarcane.png",
43         
44         tiles = {"sugarcane.png"},
45         
46         groups = {dig_immediate=1,flammable=1},
47         
48         sounds = main.grassSound(),
49         
50         paramtype = "light",
51         
52         sunlight_propagates = true,
53         
54         drawtype = "plantlike",
55         
56         buildable_to = false,
57         
58         waving = 1,
59         
60         walkable = false,
61         --inventory_image   = def.inventory_image,
62         --walkable          = def.walkable,
63         --climbable         = def.climbable,
64         --paramtype2        = def.paramtype2,
65         --buildable_to      = def.buildable_to,
66         --selection_box     = def.selection_box,
67         --drop              = def.drop,
68         grows             = "up",
69         selection_box = {
70                 type = "fixed",
71                 fixed = {-7 / 16, -0.5, -7 / 16, 7 / 16, 0.5, 7 / 16}
72         },
73 })
74
75 minetest.register_plant("grass", {
76     description = "Tall Grass",
77     drawtype = "plantlike",
78         waving = 1,
79         inventory_image = "tallgrass.png",
80         walkable = false,
81         climbable = false,
82         paramtype = "light",
83         is_ground_content = false,
84     tiles = {"tallgrass.png"},
85     paramtype2 = "degrotate",
86     buildable_to = true,
87     sunlight_propagates = true,
88     groups = {dig_immediate=1,attached_node=1,flammable=1},
89     sounds = main.grassSound(),
90     selection_box = {
91                 type = "fixed",
92                 fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 4 / 16, 4 / 16}
93         },
94         drop =  {
95                 max_items = 1,
96                 items= {
97                 {
98                         rarity = 10,
99                         items = {"farming:melon_seeds"},
100                 },
101                 --{
102                 --      rarity = 10,
103                 --      items = {"farming:pumpkin_seeds"},
104                 --},
105                 },
106         },
107 })
108
109 minetest.register_plant("wheat", {
110             description = "Wheat",
111             drawtype = "plantlike",
112                 waving = 1,
113                 walkable = false,
114                 climbable = false,
115                 paramtype = "light",
116                 is_ground_content = false,      
117             tiles = {"wheat_stage"}, --automatically adds _X.png
118             paramtype2 = "degrotate",
119             buildable_to = false,
120             grow_stage = i,
121             groups = {leaves = 1, plant = 1, axe = 1, hand = 0,dig_immediate=1,attached_node=1,crops=1},
122             sounds = main.grassSound(),
123             sunlight_propagates = true,
124             selection_box = {
125                         type = "fixed",
126                         fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, -6 / 16, 6 / 16}
127                 },
128                 grows = "in_place",
129                 stages = 7,
130                 --[[
131                 drop = {
132                         max_items = 2,
133                         items= {
134                          {
135                                 -- Only drop if using a tool whose name is identical to one
136                                 -- of these.
137                                 --rarity = 10,
138                                 items = {"farming:wheat"},
139                                 -- Whether all items in the dropped item list inherit the
140                                 -- hardware coloring palette color from the dug node.
141                                 -- Default is 'false'.
142                                 --inherit_color = true,
143                         },
144                         {
145                                 -- Only drop if using a tool whose name is identical to one
146                                 -- of these.
147                                 rarity = 2,
148                                 items = {"farming:seeds"},
149                                 -- Whether all items in the dropped item list inherit the
150                                 -- hardware coloring palette color from the dug node.
151                                 -- Default is 'false'.
152                                 --inherit_color = true,
153                         },
154                         },
155                         },
156                 ]]--
157         })
158
159 minetest.register_plant("melon_stem", {
160             description = "Melon Stem",
161             drawtype = "plantlike",
162                 waving = 1,
163                 walkable = false,
164                 climbable = false,
165                 paramtype = "light",
166                 sunlight_propagates = true,
167                 is_ground_content = false,      
168             tiles = {"melon_stage"}, --automatically adds _X.png
169             buildable_to = false,
170             groups = {leaves = 1,plant=1, stem = 1, axe = 1, hand = 0,dig_immediate=1,attached_node=1,crops=1},
171             sounds = main.grassSound(),
172             selection_box = {
173                         type = "fixed",
174                         fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, -6 / 16, 6 / 16}
175                 },
176                 grows = "in_place_yields",
177                 grown_node="farming:melon",
178                 stages = 7,
179                 --stem stage complete definition (fully grown and budding)
180                 stem_description = "",
181                 stem_tiles = {"nothing.png","nothing.png","melon_stage_complete.png^[transformFX","melon_stage_complete.png","nothing.png","nothing.png",},
182                 stem_drawtype = "nodebox",
183                 stem_walkable = false,
184                 stem_sunlight_propagates = true,
185                 stem_paramtype = "light",
186                 stem_node_box = {
187                         type = "fixed",
188                         fixed = {
189                                 {-0/16, -8/16, -7/16,  0/16, 8/16,  7/16}
190                         },
191                 },
192                 stem_selection_box = {
193                         type = "fixed",
194                         fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, -6 / 16, 6 / 16}
195                 },
196                 stem_drop = {
197                         max_items = 2,
198                         items= {
199                         {
200                                 items = {"farming:melon_seeds"},
201                         },
202                         {
203                                 rarity = 2,
204                                 items = {"farming:melon_seeds"},
205                         },
206                         },
207                 },
208             stem_groups = {plant=1,dig_immediate=1,attached_node=1,crops=1},
209             stem_sounds = main.woodSound(),
210             
211             --fruit definition (what the stem creates)
212             fruit_name        = "melon",
213             fruit_description = "Melon",
214             fruit_tiles = {"melon_top.png","melon_top.png","melon_side.png","melon_side.png","melon_side.png","melon_side.png"},
215             fruit_groups = {pathable = 1,wood=1,flammable=1},
216             fruit_sounds = main.woodSound(),
217             fruit_drop  = {
218                         max_items = 6,
219                         items= {
220                                 {
221                                         items = {"farming:melon_slice"},
222                                 },
223                                 {
224                                         items = {"farming:melon_slice"},
225                                 },
226                                 {
227                                         items = {"farming:melon_slice"},
228                                 },
229                                 {
230                                         items = {"farming:melon_slice"},
231                                 },
232                                 {
233                                         rarity = 5,
234                                         items = {"farming:melon_slice"},
235                                 },
236                                 {
237                                         rarity = 15,
238                                         items = {"farming:melon_seeds"},
239                                 },
240                         },
241                 },
242                 
243                 --seed definition
244                 --"farming:wheat_1"
245                 seed_name = "melon",
246                 seed_description = "Melon Seeds",
247                 seed_inventory_image = "melon_seeds.png",
248                 seed_plants = "farming:melon_stem_1",
249 })
250 minetest.register_craftitem("farming:melon_slice", {
251         description = "Melon Slice",
252         inventory_image = "melon_slice.png",
253         groups = {satiation=1,hunger=2},
254 })
255
256
257
258 minetest.register_plant("pumpkin_stem", {
259             description = "Pumpkin Stem",
260             drawtype = "plantlike",
261                 waving = 1,
262                 walkable = false,
263                 climbable = false,
264                 paramtype = "light",
265                 sunlight_propagates = true,
266                 is_ground_content = false,      
267             tiles = {"melon_stage"}, --automatically adds _X.png
268             buildable_to = false,
269             groups = {leaves = 1,plant=1, stem = 1, axe = 1, hand = 0,dig_immediate=1,attached_node=1,crops=1},
270             sounds = main.grassSound(),
271             selection_box = {
272                         type = "fixed",
273                         fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, -6 / 16, 6 / 16}
274                 },
275                 grows = "in_place_yields",
276                 grown_node="farming:pumpkin",
277                 stages = 7,
278                 
279                 --stem stage complete definition (fully grown and budding)
280                 stem_description = "",
281                 stem_tiles = {"nothing.png","nothing.png","melon_stage_complete.png^[transformFX","melon_stage_complete.png","nothing.png","nothing.png",},
282                 stem_drawtype = "nodebox",
283                 stem_walkable = false,
284                 stem_sunlight_propagates = true,
285                 stem_paramtype = "light",
286                 stem_node_box = {
287                         type = "fixed",
288                         fixed = {
289                                 {-0/16, -8/16, -7/16,  0/16, 8/16,  7/16}
290                         },
291                 },
292                 stem_selection_box = {
293                         type = "fixed",
294                         fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, -6 / 16, 6 / 16}
295                 },
296                 stem_drop = {
297                         max_items = 2,
298                         items= {
299                         {
300                                 items = {"farming:pumpkin_seeds"},
301                         },
302                         {
303                                 rarity = 2,
304                                 items = {"farming:pumpkin_seeds"},
305                         },
306                         },
307                 },
308             stem_groups = {plant=1,dig_immediate=1,attached_node=1,crops=1},
309             stem_sounds = main.woodSound(),
310             
311             --fruit definition (what the stem creates)
312             fruit_name        = "pumpkin",
313             fruit_description = "Pumpkin",
314             fruit_tiles = {"pumpkin_top.png","pumpkin_top.png","pumpkin_side.png","pumpkin_side.png","pumpkin_side.png","pumpkin_side.png"},
315             fruit_groups = {pathable = 1,wood=1,flammable=1},
316             fruit_sounds = main.woodSound(),
317                 --seed definition
318                 --"farming:wheat_1"
319                 seed_name = "pumpkin",
320                 seed_description = "Pumpkin Seeds",
321                 seed_inventory_image = "pumpkin_seeds.png",
322                 seed_plants = "farming:pumpkin_stem_1",
323 })
324
325 minetest.register_craft({
326         type = "shapeless",
327         output = "farming:pumpkin_seeds",
328         recipe = {"farming:pumpkin"},
329 })
330 minetest.register_craft({
331         type = "fuel",
332         recipe = "farming:pumpkin",
333         burntime = 3,
334 })
335 minetest.register_craft({
336         type = "cooking",
337         output = "farming:pumpkin_pie",
338         recipe = "farming:pumpkin",
339         cooktime = 2,
340 })
341 minetest.register_craftitem("farming:pumpkin_pie", {
342         description = "Pumpkin Pie",
343         inventory_image = "pumpkin_pie.png",
344         groups = {satiation=4,hunger=3},
345 })
346
347
348 minetest.register_decoration({
349         name = "farming:sugarcane",
350         deco_type = "simple",
351         place_on = {"main:dirt","main:grass","main:sand"},
352         sidelen = 16,
353         noise_params = {
354                 offset = -0.3,
355                 scale = 0.7,
356                 spread = {x = 100, y = 100, z = 100},
357                 seed = 354,
358                 octaves = 3,
359                 persist = 0.7
360         },
361         y_max = 1,
362         y_min = 1,
363         decoration = "farming:sugarcane",
364         height = 2,
365         height_max = 5,
366         spawn_by = "main:water",
367         num_spawn_by = 1,
368 })
369
370
371 minetest.register_decoration({
372                 name = "farming:cactus",
373                 deco_type = "simple",
374                 place_on = {"main:sand"},
375                 sidelen = 16,
376                 noise_params = {
377                         offset = -0.012,
378                         scale = 0.024,
379                         spread = {x = 100, y = 100, z = 100},
380                         seed = 230,
381                         octaves = 3,
382                         persist = 0.6
383                 },
384                 y_max = 30,
385                 y_min = 0,
386                 decoration = "farming:cactus",
387                 height = 3,
388                 height_max = 4,
389         })
390
391
392 minetest.register_decoration({
393         deco_type = "simple",
394         place_on = "main:grass",
395         sidelen = 16,
396         fill_ratio = 0.5,
397         --biomes = {"grassland"},
398         decoration = "farming:grass",
399         height = 1,
400 })