Better apple tree generation
[oweals/minetest.git] / src / content_mapnode.cpp
1 /*
2 Minetest-c55
3 Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 // For g_settings
21 #include "main.h"
22
23 #include "content_mapnode.h"
24 #include "mapnode.h"
25 #include "content_nodemeta.h"
26
27 #define WATER_ALPHA 160
28
29 #define WATER_VISC 1
30 #define LAVA_VISC 7
31
32 // TODO: Get rid of these and set up some attributes like toughness,
33 //       fluffyness, and a funciton to calculate time and durability loss
34 //       (and sound? and whatever else) from them
35 void setStoneLikeDiggingProperties(DiggingPropertiesList &list, float toughness);
36 void setDirtLikeDiggingProperties(DiggingPropertiesList &list, float toughness);
37 void setWoodLikeDiggingProperties(DiggingPropertiesList &list, float toughness);
38
39 /*
40         A conversion table for backwards compatibility.
41         Maps <=v19 content types to current ones.
42         Should never be touched.
43 */
44 content_t trans_table_19[21][2] = {
45         {CONTENT_GRASS, 1},
46         {CONTENT_TREE, 4},
47         {CONTENT_LEAVES, 5},
48         {CONTENT_GRASS_FOOTSTEPS, 6},
49         {CONTENT_MESE, 7},
50         {CONTENT_MUD, 8},
51         {CONTENT_CLOUD, 10},
52         {CONTENT_COALSTONE, 11},
53         {CONTENT_WOOD, 12},
54         {CONTENT_SAND, 13},
55         {CONTENT_COBBLE, 18},
56         {CONTENT_STEEL, 19},
57         {CONTENT_GLASS, 20},
58         {CONTENT_MOSSYCOBBLE, 22},
59         {CONTENT_GRAVEL, 23},
60         {CONTENT_SANDSTONE, 24},
61         {CONTENT_CACTUS, 25},
62         {CONTENT_BRICK, 26},
63         {CONTENT_CLAY, 27},
64         {CONTENT_PAPYRUS, 28},
65         {CONTENT_BOOKSHELF, 29},
66 };
67
68 MapNode mapnode_translate_from_internal(MapNode n_from, u8 version)
69 {
70         MapNode result = n_from;
71         if(version <= 19)
72         {
73                 content_t c_from = n_from.getContent();
74                 for(u32 i=0; i<sizeof(trans_table_19)/sizeof(trans_table_19[0]); i++)
75                 {
76                         if(trans_table_19[i][0] == c_from)
77                         {
78                                 result.setContent(trans_table_19[i][1]);
79                                 break;
80                         }
81                 }
82         }
83         return result;
84 }
85 MapNode mapnode_translate_to_internal(MapNode n_from, u8 version)
86 {
87         MapNode result = n_from;
88         if(version <= 19)
89         {
90                 content_t c_from = n_from.getContent();
91                 for(u32 i=0; i<sizeof(trans_table_19)/sizeof(trans_table_19[0]); i++)
92                 {
93                         if(trans_table_19[i][1] == c_from)
94                         {
95                                 result.setContent(trans_table_19[i][0]);
96                                 break;
97                         }
98                 }
99         }
100         return result;
101 }
102
103 void content_mapnode_init()
104 {
105         // Read some settings
106         bool new_style_water = g_settings.getBool("new_style_water");
107         bool new_style_leaves = g_settings.getBool("new_style_leaves");
108         bool invisible_stone = g_settings.getBool("invisible_stone");
109
110         content_t i;
111         ContentFeatures *f = NULL;
112
113         i = CONTENT_STONE;
114         f = &content_features(i);
115         f->setAllTextures("stone.png");
116         f->setInventoryTextureCube("stone.png", "stone.png", "stone.png");
117         f->param_type = CPT_MINERAL;
118         f->is_ground_content = true;
119         f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_COBBLE)+" 1";
120         setStoneLikeDiggingProperties(f->digging_properties, 1.0);
121         if(invisible_stone)
122                 f->solidness = 0; // For debugging, hides regular stone
123         
124         i = CONTENT_GRASS;
125         f = &content_features(i);
126         f->setAllTextures("mud.png^grass_side.png");
127         f->setTexture(0, "grass.png");
128         f->setTexture(1, "mud.png");
129         f->param_type = CPT_MINERAL;
130         f->is_ground_content = true;
131         f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_MUD)+" 1";
132         setDirtLikeDiggingProperties(f->digging_properties, 1.0);
133         
134         i = CONTENT_GRASS_FOOTSTEPS;
135         f = &content_features(i);
136         f->setAllTextures("mud.png^grass_side.png");
137         f->setTexture(0, "grass_footsteps.png");
138         f->setTexture(1, "mud.png");
139         f->param_type = CPT_MINERAL;
140         f->is_ground_content = true;
141         f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_MUD)+" 1";
142         setDirtLikeDiggingProperties(f->digging_properties, 1.0);
143         
144         i = CONTENT_MUD;
145         f = &content_features(i);
146         f->setAllTextures("mud.png");
147         f->setInventoryTextureCube("mud.png", "mud.png", "mud.png");
148         f->param_type = CPT_MINERAL;
149         f->is_ground_content = true;
150         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
151         setDirtLikeDiggingProperties(f->digging_properties, 1.0);
152         
153         i = CONTENT_SAND;
154         f = &content_features(i);
155         f->setAllTextures("sand.png");
156         f->setInventoryTextureCube("sand.png", "sand.png", "sand.png");
157         f->param_type = CPT_MINERAL;
158         f->is_ground_content = true;
159         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
160         setDirtLikeDiggingProperties(f->digging_properties, 1.0);
161         
162         i = CONTENT_GRAVEL;
163         f = &content_features(i);
164         f->setAllTextures("gravel.png");
165         f->setInventoryTextureCube("gravel.png", "gravel.png", "gravel.png");
166         f->param_type = CPT_MINERAL;
167         f->is_ground_content = true;
168         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
169         setDirtLikeDiggingProperties(f->digging_properties, 1.75);
170         
171         i = CONTENT_SANDSTONE;
172         f = &content_features(i);
173         f->setAllTextures("sandstone.png");
174         f->setInventoryTextureCube("sandstone.png", "sandstone.png", "sandstone.png");
175         f->param_type = CPT_MINERAL;
176         f->is_ground_content = true;
177         f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_SAND)+" 1";
178         setDirtLikeDiggingProperties(f->digging_properties, 1.0);
179
180         i = CONTENT_CLAY;
181         f = &content_features(i);
182         f->setAllTextures("clay.png");
183         f->setInventoryTextureCube("clay.png", "clay.png", "clay.png");
184         f->param_type = CPT_MINERAL;
185         f->is_ground_content = true;
186         f->dug_item = std::string("CraftItem lump_of_clay 4");
187         setDirtLikeDiggingProperties(f->digging_properties, 1.0);
188
189         i = CONTENT_BRICK;
190         f = &content_features(i);
191         f->setAllTextures("brick.png");
192         f->setInventoryTextureCube("brick.png", "brick.png", "brick.png");
193         f->param_type = CPT_MINERAL;
194         f->is_ground_content = true;
195         f->dug_item = std::string("CraftItem clay_brick 4");
196         setStoneLikeDiggingProperties(f->digging_properties, 1.0);
197
198         i = CONTENT_TREE;
199         f = &content_features(i);
200         f->setAllTextures("tree.png");
201         f->setTexture(0, "tree_top.png");
202         f->setTexture(1, "tree_top.png");
203         f->param_type = CPT_MINERAL;
204         f->is_ground_content = true;
205         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
206         setWoodLikeDiggingProperties(f->digging_properties, 1.0);
207         
208         i = CONTENT_JUNGLETREE;
209         f = &content_features(i);
210         f->setAllTextures("jungletree.png");
211         f->setTexture(0, "jungletree_top.png");
212         f->setTexture(1, "jungletree_top.png");
213         f->param_type = CPT_MINERAL;
214         //f->is_ground_content = true;
215         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
216         setWoodLikeDiggingProperties(f->digging_properties, 1.0);
217         
218         i = CONTENT_JUNGLEGRASS;
219         f = &content_features(i);
220         f->setInventoryTexture("junglegrass.png");
221         f->light_propagates = true;
222         f->param_type = CPT_LIGHT;
223         //f->is_ground_content = true;
224         f->air_equivalent = false; // grass grows underneath
225         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
226         f->solidness = 0; // drawn separately, makes no faces
227         f->walkable = false;
228         setWoodLikeDiggingProperties(f->digging_properties, 0.10);
229
230         i = CONTENT_LEAVES;
231         f = &content_features(i);
232         f->light_propagates = true;
233         //f->param_type = CPT_MINERAL;
234         f->param_type = CPT_LIGHT;
235         //f->is_ground_content = true;
236         if(new_style_leaves)
237         {
238                 f->solidness = 0; // drawn separately, makes no faces
239                 f->setInventoryTextureCube("leaves.png", "leaves.png", "leaves.png");
240         }
241         else
242         {
243                 f->setAllTextures("[noalpha:leaves.png");
244         }
245         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
246         setWoodLikeDiggingProperties(f->digging_properties, 0.15);
247
248         i = CONTENT_CACTUS;
249         f = &content_features(i);
250         f->setAllTextures("cactus_side.png");
251         f->setTexture(0, "cactus_top.png");
252         f->setTexture(1, "cactus_top.png");
253         f->setInventoryTextureCube("cactus_top.png", "cactus_side.png", "cactus_side.png");
254         f->param_type = CPT_MINERAL;
255         f->is_ground_content = true;
256         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
257         setWoodLikeDiggingProperties(f->digging_properties, 0.75);
258
259         i = CONTENT_PAPYRUS;
260         f = &content_features(i);
261         f->setInventoryTexture("papyrus.png");
262         f->light_propagates = true;
263         f->param_type = CPT_LIGHT;
264         f->is_ground_content = true;
265         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
266         f->solidness = 0; // drawn separately, makes no faces
267         f->walkable = false;
268         setWoodLikeDiggingProperties(f->digging_properties, 0.25);
269
270         i = CONTENT_BOOKSHELF;
271         f = &content_features(i);
272         f->setAllTextures("bookshelf.png");
273         f->setTexture(0, "wood.png");
274         f->setTexture(1, "wood.png");
275         // FIXME: setInventoryTextureCube() only cares for the first texture
276         f->setInventoryTextureCube("bookshelf.png", "bookshelf.png", "bookshelf.png");
277         //f->setInventoryTextureCube("wood.png", "bookshelf.png", "bookshelf.png");
278         f->param_type = CPT_MINERAL;
279         f->is_ground_content = true;
280         setWoodLikeDiggingProperties(f->digging_properties, 0.75);
281
282         i = CONTENT_GLASS;
283         f = &content_features(i);
284         f->light_propagates = true;
285         f->sunlight_propagates = true;
286         f->param_type = CPT_LIGHT;
287         f->is_ground_content = true;
288         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
289         f->solidness = 0; // drawn separately, makes no faces
290         f->setInventoryTextureCube("glass.png", "glass.png", "glass.png");
291         setWoodLikeDiggingProperties(f->digging_properties, 0.15);
292
293         i = CONTENT_FENCE;
294         f = &content_features(i);
295         f->light_propagates = true;
296         f->param_type = CPT_LIGHT;
297         f->is_ground_content = true;
298         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
299         f->solidness = 0; // drawn separately, makes no faces
300         f->air_equivalent = true; // grass grows underneath
301         f->setInventoryTexture("fence.png");
302         setWoodLikeDiggingProperties(f->digging_properties, 0.75);
303
304         i = CONTENT_RAIL;
305         f = &content_features(i);
306         f->setInventoryTexture("rail.png");
307         f->light_propagates = true;
308         f->param_type = CPT_LIGHT;
309         f->is_ground_content = true;
310         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
311         f->solidness = 0; // drawn separately, makes no faces
312         f->air_equivalent = true; // grass grows underneath
313         f->walkable = false;
314         setDirtLikeDiggingProperties(f->digging_properties, 0.75);
315
316         i = CONTENT_LADDER;
317         f = &content_features(i);
318         f->setInventoryTexture("ladder.png");
319         f->light_propagates = true;
320         f->param_type = CPT_LIGHT;
321         f->is_ground_content = true;
322         f->dug_item = std::string("MaterialItem ")+itos(i)+" 1";
323         f->wall_mounted = true;
324         f->solidness = 0;
325         f->air_equivalent = true;
326         f->walkable = false;
327         f->climbable = true;
328         setWoodLikeDiggingProperties(f->digging_properties, 0.5);
329
330         // Deprecated
331         i = CONTENT_COALSTONE;
332         f = &content_features(i);
333         f->setAllTextures("stone.png^mineral_coal.png");
334         f->is_ground_content = true;
335         setStoneLikeDiggingProperties(f->digging_properties, 1.5);
336         
337         i = CONTENT_WOOD;
338         f = &content_features(i);
339         f->setAllTextures("wood.png");
340         f->setInventoryTextureCube("wood.png", "wood.png", "wood.png");
341         f->is_ground_content = true;
342         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
343         setWoodLikeDiggingProperties(f->digging_properties, 0.75);
344         
345         i = CONTENT_MESE;
346         f = &content_features(i);
347         f->setAllTextures("mese.png");
348         f->setInventoryTextureCube("mese.png", "mese.png", "mese.png");
349         f->is_ground_content = true;
350         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
351         setStoneLikeDiggingProperties(f->digging_properties, 0.5);
352         
353         i = CONTENT_CLOUD;
354         f = &content_features(i);
355         f->setAllTextures("cloud.png");
356         f->setInventoryTextureCube("cloud.png", "cloud.png", "cloud.png");
357         f->is_ground_content = true;
358         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
359         
360         i = CONTENT_AIR;
361         f = &content_features(i);
362         f->param_type = CPT_LIGHT;
363         f->light_propagates = true;
364         f->sunlight_propagates = true;
365         f->solidness = 0;
366         f->walkable = false;
367         f->pointable = false;
368         f->diggable = false;
369         f->buildable_to = true;
370         f->air_equivalent = true;
371         
372         i = CONTENT_WATER;
373         f = &content_features(i);
374         f->setInventoryTextureCube("water.png", "water.png", "water.png");
375         f->param_type = CPT_LIGHT;
376         f->light_propagates = true;
377         f->solidness = 0; // Drawn separately, makes no faces
378         f->visual_solidness = 1;
379         f->walkable = false;
380         f->pointable = false;
381         f->diggable = false;
382         f->buildable_to = true;
383         f->liquid_type = LIQUID_FLOWING;
384         f->liquid_alternative_flowing = CONTENT_WATER;
385         f->liquid_alternative_source = CONTENT_WATERSOURCE;
386         f->liquid_viscosity = WATER_VISC;
387         f->vertex_alpha = WATER_ALPHA;
388         if(f->special_material == NULL && g_texturesource)
389         {
390                 // Flowing water material
391                 f->special_material = new video::SMaterial;
392                 f->special_material->setFlag(video::EMF_LIGHTING, false);
393                 f->special_material->setFlag(video::EMF_BACK_FACE_CULLING, false);
394                 f->special_material->setFlag(video::EMF_BILINEAR_FILTER, false);
395                 f->special_material->setFlag(video::EMF_FOG_ENABLE, true);
396                 f->special_material->MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA;
397                 AtlasPointer *pa_water1 = new AtlasPointer(g_texturesource->getTexture(
398                                 g_texturesource->getTextureId("water.png")));
399                 f->special_material->setTexture(0, pa_water1->atlas);
400                 f->special_atlas = pa_water1;
401         }
402         
403         i = CONTENT_WATERSOURCE;
404         f = &content_features(i);
405         //f->setInventoryTexture("water.png");
406         f->setInventoryTextureCube("water.png", "water.png", "water.png");
407         if(new_style_water)
408         {
409                 f->solidness = 0; // drawn separately, makes no faces
410         }
411         else // old style
412         {
413                 f->solidness = 1;
414
415                 TileSpec t;
416                 if(g_texturesource)
417                         t.texture = g_texturesource->getTexture("water.png");
418                 
419                 t.alpha = WATER_ALPHA;
420                 t.material_type = MATERIAL_ALPHA_VERTEX;
421                 t.material_flags &= ~MATERIAL_FLAG_BACKFACE_CULLING;
422                 f->setAllTiles(t);
423         }
424         f->param_type = CPT_LIGHT;
425         f->light_propagates = true;
426         f->walkable = false;
427         f->pointable = false;
428         f->diggable = false;
429         f->buildable_to = true;
430         f->liquid_type = LIQUID_SOURCE;
431         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
432         f->liquid_alternative_flowing = CONTENT_WATER;
433         f->liquid_alternative_source = CONTENT_WATERSOURCE;
434         f->liquid_viscosity = WATER_VISC;
435         f->vertex_alpha = WATER_ALPHA;
436         if(f->special_material == NULL && g_texturesource)
437         {
438                 // Flowing water material
439                 f->special_material = new video::SMaterial;
440                 f->special_material->setFlag(video::EMF_LIGHTING, false);
441                 f->special_material->setFlag(video::EMF_BACK_FACE_CULLING, false);
442                 f->special_material->setFlag(video::EMF_BILINEAR_FILTER, false);
443                 f->special_material->setFlag(video::EMF_FOG_ENABLE, true);
444                 f->special_material->MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA;
445                 AtlasPointer *pa_water1 = new AtlasPointer(g_texturesource->getTexture(
446                                 g_texturesource->getTextureId("water.png")));
447                 f->special_material->setTexture(0, pa_water1->atlas);
448                 f->special_atlas = pa_water1;
449         }
450         
451         i = CONTENT_LAVA;
452         f = &content_features(i);
453         f->setInventoryTextureCube("lava.png", "lava.png", "lava.png");
454         f->param_type = CPT_LIGHT;
455         f->light_propagates = false;
456         f->light_source = LIGHT_MAX-1;
457         f->solidness = 0; // Drawn separately, makes no faces
458         f->visual_solidness = 2;
459         f->walkable = false;
460         f->pointable = false;
461         f->diggable = false;
462         f->buildable_to = true;
463         f->liquid_type = LIQUID_FLOWING;
464         f->liquid_alternative_flowing = CONTENT_LAVA;
465         f->liquid_alternative_source = CONTENT_LAVASOURCE;
466         f->liquid_viscosity = LAVA_VISC;
467         f->damage_per_second = 4*2;
468         if(f->special_material == NULL && g_texturesource)
469         {
470                 // Flowing lava material
471                 f->special_material = new video::SMaterial;
472                 f->special_material->setFlag(video::EMF_LIGHTING, false);
473                 f->special_material->setFlag(video::EMF_BACK_FACE_CULLING, false);
474                 f->special_material->setFlag(video::EMF_BILINEAR_FILTER, false);
475                 f->special_material->setFlag(video::EMF_FOG_ENABLE, true);
476                 f->special_material->MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
477                 AtlasPointer *pa_lava1 = new AtlasPointer(
478                         g_texturesource->getTexture(
479                                 g_texturesource->getTextureId("lava.png")));
480                 f->special_material->setTexture(0, pa_lava1->atlas);
481                 f->special_atlas = pa_lava1;
482         }
483         
484         i = CONTENT_LAVASOURCE;
485         f = &content_features(i);
486         f->setInventoryTextureCube("lava.png", "lava.png", "lava.png");
487         if(new_style_water)
488         {
489                 f->solidness = 0; // drawn separately, makes no faces
490         }
491         else // old style
492         {
493                 f->solidness = 2;
494
495                 TileSpec t;
496                 if(g_texturesource)
497                         t.texture = g_texturesource->getTexture("lava.png");
498                 
499                 //t.alpha = 255;
500                 //t.material_type = MATERIAL_ALPHA_VERTEX;
501                 //t.material_flags &= ~MATERIAL_FLAG_BACKFACE_CULLING;
502                 f->setAllTiles(t);
503         }
504         f->param_type = CPT_LIGHT;
505         f->light_propagates = false;
506         f->light_source = LIGHT_MAX-1;
507         f->walkable = false;
508         f->pointable = false;
509         f->diggable = false;
510         f->buildable_to = true;
511         f->liquid_type = LIQUID_SOURCE;
512         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
513         f->liquid_alternative_flowing = CONTENT_LAVA;
514         f->liquid_alternative_source = CONTENT_LAVASOURCE;
515         f->liquid_viscosity = LAVA_VISC;
516         f->damage_per_second = 4*2;
517         if(f->special_material == NULL && g_texturesource)
518         {
519                 // Flowing lava material
520                 f->special_material = new video::SMaterial;
521                 f->special_material->setFlag(video::EMF_LIGHTING, false);
522                 f->special_material->setFlag(video::EMF_BACK_FACE_CULLING, false);
523                 f->special_material->setFlag(video::EMF_BILINEAR_FILTER, false);
524                 f->special_material->setFlag(video::EMF_FOG_ENABLE, true);
525                 f->special_material->MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
526                 AtlasPointer *pa_lava1 = new AtlasPointer(
527                         g_texturesource->getTexture(
528                                 g_texturesource->getTextureId("lava.png")));
529                 f->special_material->setTexture(0, pa_lava1->atlas);
530                 f->special_atlas = pa_lava1;
531         }
532         
533         i = CONTENT_TORCH;
534         f = &content_features(i);
535         f->setInventoryTexture("torch_on_floor.png");
536         f->param_type = CPT_LIGHT;
537         f->light_propagates = true;
538         f->sunlight_propagates = true;
539         f->solidness = 0; // drawn separately, makes no faces
540         f->walkable = false;
541         f->wall_mounted = true;
542         f->air_equivalent = true;
543         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
544         f->light_source = LIGHT_MAX-1;
545         f->digging_properties.set("", DiggingProperties(true, 0.0, 0));
546         
547         i = CONTENT_SIGN_WALL;
548         f = &content_features(i);
549         f->setInventoryTexture("sign_wall.png");
550         f->param_type = CPT_LIGHT;
551         f->light_propagates = true;
552         f->sunlight_propagates = true;
553         f->solidness = 0; // drawn separately, makes no faces
554         f->walkable = false;
555         f->wall_mounted = true;
556         f->air_equivalent = true;
557         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
558         if(f->initial_metadata == NULL)
559                 f->initial_metadata = new SignNodeMetadata("Some sign");
560         f->digging_properties.set("", DiggingProperties(true, 0.5, 0));
561         
562         i = CONTENT_CHEST;
563         f = &content_features(i);
564         f->param_type = CPT_FACEDIR_SIMPLE;
565         f->setAllTextures("chest_side.png");
566         f->setTexture(0, "chest_top.png");
567         f->setTexture(1, "chest_top.png");
568         f->setTexture(5, "chest_front.png"); // Z-
569         f->setInventoryTexture("chest_top.png");
570         //f->setInventoryTextureCube("chest_top.png", "chest_side.png", "chest_side.png");
571         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
572         if(f->initial_metadata == NULL)
573                 f->initial_metadata = new ChestNodeMetadata();
574         setWoodLikeDiggingProperties(f->digging_properties, 1.0);
575         
576         i = CONTENT_FURNACE;
577         f = &content_features(i);
578         f->param_type = CPT_FACEDIR_SIMPLE;
579         f->setAllTextures("furnace_side.png");
580         f->setTexture(5, "furnace_front.png"); // Z-
581         f->setInventoryTexture("furnace_front.png");
582         //f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
583         f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_COBBLE)+" 6";
584         if(f->initial_metadata == NULL)
585                 f->initial_metadata = new FurnaceNodeMetadata();
586         setStoneLikeDiggingProperties(f->digging_properties, 3.0);
587         
588         i = CONTENT_COBBLE;
589         f = &content_features(i);
590         f->setAllTextures("cobble.png");
591         f->setInventoryTextureCube("cobble.png", "cobble.png", "cobble.png");
592         f->param_type = CPT_NONE;
593         f->is_ground_content = true;
594         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
595         setStoneLikeDiggingProperties(f->digging_properties, 0.9);
596
597         i = CONTENT_MOSSYCOBBLE;
598         f = &content_features(i);
599         f->setAllTextures("mossycobble.png");
600         f->setInventoryTextureCube("mossycobble.png", "mossycobble.png", "mossycobble.png");
601         f->param_type = CPT_NONE;
602         f->is_ground_content = true;
603         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
604         setStoneLikeDiggingProperties(f->digging_properties, 0.8);
605         
606         i = CONTENT_STEEL;
607         f = &content_features(i);
608         f->setAllTextures("steel_block.png");
609         f->setInventoryTextureCube("steel_block.png", "steel_block.png",
610                         "steel_block.png");
611         f->param_type = CPT_NONE;
612         f->is_ground_content = true;
613         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
614         setStoneLikeDiggingProperties(f->digging_properties, 5.0);
615         
616         i = CONTENT_NC;
617         f = &content_features(i);
618         f->param_type = CPT_FACEDIR_SIMPLE;
619         f->setAllTextures("nc_side.png");
620         f->setTexture(5, "nc_front.png"); // Z-
621         f->setTexture(4, "nc_back.png"); // Z+
622         f->setInventoryTexture("nc_front.png");
623         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
624         setStoneLikeDiggingProperties(f->digging_properties, 3.0);
625         
626         i = CONTENT_NC_RB;
627         f = &content_features(i);
628         f->setAllTextures("nc_rb.png");
629         f->setInventoryTexture("nc_rb.png");
630         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
631         setStoneLikeDiggingProperties(f->digging_properties, 3.0);
632         
633         i = CONTENT_APPLE;
634         f = &content_features(i);
635         f->setInventoryTexture("apple.png");
636         f->param_type = CPT_LIGHT;
637         f->light_propagates = true;
638         f->sunlight_propagates = true;
639         f->solidness = 0; // drawn separately, makes no faces
640         f->walkable = false;
641         f->air_equivalent = true;
642         f->dug_item = std::string("CraftItem apple 1");
643         f->digging_properties.set("", DiggingProperties(true, 0.0, 0));
644         
645         // NOTE: Remember to add frequently used stuff to the texture atlas in tile.cpp
646         
647
648         /*
649                 Add MesePick to everything
650         */
651         for(u16 i=0; i<=MAX_CONTENT; i++)
652         {
653                 content_features(i).digging_properties.set("MesePick",
654                                 DiggingProperties(true, 0.0, 65535./1337));
655         }
656
657 }
658
659 void setStoneLikeDiggingProperties(DiggingPropertiesList &list, float toughness)
660 {
661         list.set("",
662                         DiggingProperties(true, 15.0*toughness, 0));
663         
664         list.set("WPick",
665                         DiggingProperties(true, 1.3*toughness, 65535./30.*toughness));
666         list.set("STPick",
667                         DiggingProperties(true, 0.75*toughness, 65535./100.*toughness));
668         list.set("SteelPick",
669                         DiggingProperties(true, 0.50*toughness, 65535./333.*toughness));
670
671         /*list.set("MesePick",
672                         DiggingProperties(true, 0.0*toughness, 65535./20.*toughness));*/
673 }
674
675 void setDirtLikeDiggingProperties(DiggingPropertiesList &list, float toughness)
676 {
677         list.set("",
678                         DiggingProperties(true, 0.75*toughness, 0));
679         
680         list.set("WShovel",
681                         DiggingProperties(true, 0.4*toughness, 65535./50.*toughness));
682         list.set("STShovel",
683                         DiggingProperties(true, 0.2*toughness, 65535./150.*toughness));
684         list.set("SteelShovel",
685                         DiggingProperties(true, 0.15*toughness, 65535./400.*toughness));
686 }
687
688 void setWoodLikeDiggingProperties(DiggingPropertiesList &list, float toughness)
689 {
690         list.set("",
691                         DiggingProperties(true, 3.0*toughness, 0));
692         
693         list.set("WAxe",
694                         DiggingProperties(true, 1.5*toughness, 65535./30.*toughness));
695         list.set("STAxe",
696                         DiggingProperties(true, 0.75*toughness, 65535./100.*toughness));
697         list.set("SteelAxe",
698                         DiggingProperties(true, 0.5*toughness, 65535./333.*toughness));
699 }
700
701