]> git.lizzy.rs Git - Crafter.git/blob - mods/farming/registers.lua
Add part 1 of farming overhaul with register_plant
[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     groups = {dig_immediate=1,attached_node=1,flammable=1},
88     sounds = main.grassSound(),
89     selection_box = {
90                 type = "fixed",
91                 fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 4 / 16, 4 / 16}
92         },
93         drop =  {
94                 max_items = 1,
95                 items= {
96                  {
97                         rarity = 10,
98                         items = {"farming:seeds"},
99                 },
100                 },
101         },
102 })
103
104 minetest.register_plant("wheat", {
105             description = "Wheat",
106             drawtype = "plantlike",
107                 waving = 1,
108                 walkable = false,
109                 climbable = false,
110                 paramtype = "light",
111                 is_ground_content = false,      
112             tiles = {"wheat_stage"}, --automatically adds _X.png
113             paramtype2 = "degrotate",
114             buildable_to = true,
115             grow_stage = i,
116             groups = {leaves = 1, plant = 1, axe = 1, hand = 0,dig_immediate=1,attached_node=1,crops=1},
117             sounds = main.grassSound(),
118             selection_box = {
119                         type = "fixed",
120                         fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 4 / 16, 4 / 16}
121                 },
122                 grows = "in_place",
123                 stages = 7,
124                 drop = {
125                         max_items = 2,
126                         items= {
127                          {
128                                 -- Only drop if using a tool whose name is identical to one
129                                 -- of these.
130                                 --rarity = 10,
131                                 items = {"farming:wheat"},
132                                 -- Whether all items in the dropped item list inherit the
133                                 -- hardware coloring palette color from the dug node.
134                                 -- Default is 'false'.
135                                 --inherit_color = true,
136                         },
137                         {
138                                 -- Only drop if using a tool whose name is identical to one
139                                 -- of these.
140                                 rarity = 2,
141                                 items = {"farming:seeds"},
142                                 -- Whether all items in the dropped item list inherit the
143                                 -- hardware coloring palette color from the dug node.
144                                 -- Default is 'false'.
145                                 --inherit_color = true,
146                         },
147                         },
148                         },
149         })
150
151 minetest.register_decoration({
152         name = "farming:sugarcane",
153         deco_type = "simple",
154         place_on = {"main:dirt","main:grass","main:sand"},
155         sidelen = 16,
156         noise_params = {
157                 offset = -0.3,
158                 scale = 0.7,
159                 spread = {x = 100, y = 100, z = 100},
160                 seed = 354,
161                 octaves = 3,
162                 persist = 0.7
163         },
164         y_max = 1,
165         y_min = 1,
166         decoration = "farming:sugarcane",
167         height = 2,
168         height_max = 5,
169         spawn_by = "main:water",
170         num_spawn_by = 1,
171 })
172
173
174 minetest.register_decoration({
175                 name = "farming:cactus",
176                 deco_type = "simple",
177                 place_on = {"main:sand"},
178                 sidelen = 16,
179                 noise_params = {
180                         offset = -0.012,
181                         scale = 0.024,
182                         spread = {x = 100, y = 100, z = 100},
183                         seed = 230,
184                         octaves = 3,
185                         persist = 0.6
186                 },
187                 y_max = 30,
188                 y_min = 0,
189                 decoration = "farming:cactus",
190                 height = 3,
191                 height_max = 4,
192         })
193
194
195 minetest.register_decoration({
196         deco_type = "simple",
197         place_on = "main:grass",
198         sidelen = 16,
199         fill_ratio = 0.5,
200         --biomes = {"grassland"},
201         decoration = "farming:grass",
202         height = 1,
203 })