Sort loot registration into respective mods (#2602)
[oweals/minetest_game.git] / mods / farming / init.lua
1 -- farming/init.lua
2
3 -- Load support for MT game translation.
4 local S = minetest.get_translator("farming")
5
6 -- Global farming namespace
7
8 farming = {}
9 farming.path = minetest.get_modpath("farming")
10 farming.get_translator = S
11
12 -- Load files
13
14 dofile(farming.path .. "/api.lua")
15 dofile(farming.path .. "/nodes.lua")
16 dofile(farming.path .. "/hoes.lua")
17
18
19 -- WHEAT
20
21 farming.register_plant("farming:wheat", {
22         description = S("Wheat Seed"),
23         harvest_description = S("Wheat"),
24         paramtype2 = "meshoptions",
25         inventory_image = "farming_wheat_seed.png",
26         steps = 8,
27         minlight = 13,
28         maxlight = default.LIGHT_MAX,
29         fertility = {"grassland"},
30         groups = {food_wheat = 1, flammable = 4},
31         place_param2 = 3,
32 })
33
34 minetest.register_craftitem("farming:flour", {
35         description = S("Flour"),
36         inventory_image = "farming_flour.png",
37         groups = {food_flour = 1, flammable = 1},
38 })
39
40 minetest.register_craftitem("farming:bread", {
41         description = S("Bread"),
42         inventory_image = "farming_bread.png",
43         on_use = minetest.item_eat(5),
44         groups = {food_bread = 1, flammable = 2},
45 })
46
47 minetest.register_craft({
48         type = "shapeless",
49         output = "farming:flour",
50         recipe = {"farming:wheat", "farming:wheat", "farming:wheat", "farming:wheat"}
51 })
52
53 minetest.register_craft({
54         type = "cooking",
55         cooktime = 15,
56         output = "farming:bread",
57         recipe = "farming:flour"
58 })
59
60
61 -- Cotton
62
63 farming.register_plant("farming:cotton", {
64         description = S("Cotton Seed"),
65         harvest_description = S("Cotton"),
66         inventory_image = "farming_cotton_seed.png",
67         steps = 8,
68         minlight = 13,
69         maxlight = default.LIGHT_MAX,
70         fertility = {"grassland", "desert"},
71         groups = {flammable = 4},
72 })
73
74 minetest.register_craftitem("farming:string", {
75         description = S("String"),
76         inventory_image = "farming_string.png",
77         groups = {flammable = 2},
78 })
79
80 minetest.register_craft({
81         output = "wool:white",
82         recipe = {
83                 {"farming:cotton", "farming:cotton"},
84                 {"farming:cotton", "farming:cotton"},
85         }
86 })
87
88 minetest.register_craft({
89         output = "farming:string 2",
90         recipe = {
91                 {"farming:cotton"},
92                 {"farming:cotton"},
93         }
94 })
95
96
97 -- Straw
98
99 minetest.register_craft({
100         output = "farming:straw 3",
101         recipe = {
102                 {"farming:wheat", "farming:wheat", "farming:wheat"},
103                 {"farming:wheat", "farming:wheat", "farming:wheat"},
104                 {"farming:wheat", "farming:wheat", "farming:wheat"},
105         }
106 })
107
108 minetest.register_craft({
109         output = "farming:wheat 3",
110         recipe = {
111                 {"farming:straw"},
112         }
113 })
114
115
116 -- Fuels
117
118 minetest.register_craft({
119         type = "fuel",
120         recipe = "farming:straw",
121         burntime = 3,
122 })
123
124 minetest.register_craft({
125         type = "fuel",
126         recipe = "farming:wheat",
127         burntime = 1,
128 })
129
130 minetest.register_craft({
131         type = "fuel",
132         recipe = "farming:cotton",
133         burntime = 1,
134 })
135
136 minetest.register_craft({
137         type = "fuel",
138         recipe = "farming:string",
139         burntime = 1,
140 })
141
142 minetest.register_craft({
143         type = "fuel",
144         recipe = "farming:hoe_wood",
145         burntime = 5,
146 })
147
148 -- Register farming items as dungeon loot
149 if minetest.global_exists("dungeon_loot") then
150         dungeon_loot.register({
151                 {name = "farming:string", chance = 0.5, count = {1, 8}},
152                 {name = "farming:wheat", chance = 0.5, count = {2, 5}},
153                 {name = "farming:seed_cotton", chance = 0.4, count = {1, 4},
154                         types = {"normal"}},
155         })
156 end