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