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