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