]> git.lizzy.rs Git - dragonfireclient.git/blob - src/content_mapnode.cpp
70f46513030f10321b4430119b3e19e247992739
[dragonfireclient.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->visual_solidness = 1;
240                 f->setAllTextures("leaves.png");
241                 f->setInventoryTextureCube("leaves.png", "leaves.png", "leaves.png");
242         }
243         else
244         {
245                 f->setAllTextures("[noalpha:leaves.png");
246         }
247         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
248         setWoodLikeDiggingProperties(f->digging_properties, 0.15);
249
250         i = CONTENT_CACTUS;
251         f = &content_features(i);
252         f->setAllTextures("cactus_side.png");
253         f->setTexture(0, "cactus_top.png");
254         f->setTexture(1, "cactus_top.png");
255         f->setInventoryTextureCube("cactus_top.png", "cactus_side.png", "cactus_side.png");
256         f->param_type = CPT_MINERAL;
257         f->is_ground_content = true;
258         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
259         setWoodLikeDiggingProperties(f->digging_properties, 0.75);
260
261         i = CONTENT_PAPYRUS;
262         f = &content_features(i);
263         f->setInventoryTexture("papyrus.png");
264         f->light_propagates = true;
265         f->param_type = CPT_LIGHT;
266         f->is_ground_content = true;
267         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
268         f->solidness = 0; // drawn separately, makes no faces
269         f->walkable = false;
270         setWoodLikeDiggingProperties(f->digging_properties, 0.25);
271
272         i = CONTENT_BOOKSHELF;
273         f = &content_features(i);
274         f->setAllTextures("bookshelf.png");
275         f->setTexture(0, "wood.png");
276         f->setTexture(1, "wood.png");
277         // FIXME: setInventoryTextureCube() only cares for the first texture
278         f->setInventoryTextureCube("bookshelf.png", "bookshelf.png", "bookshelf.png");
279         //f->setInventoryTextureCube("wood.png", "bookshelf.png", "bookshelf.png");
280         f->param_type = CPT_MINERAL;
281         f->is_ground_content = true;
282         setWoodLikeDiggingProperties(f->digging_properties, 0.75);
283
284         i = CONTENT_GLASS;
285         f = &content_features(i);
286         f->light_propagates = true;
287         f->sunlight_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->visual_solidness = 1;
293         f->setAllTextures("glass.png");
294         f->setInventoryTextureCube("glass.png", "glass.png", "glass.png");
295         setWoodLikeDiggingProperties(f->digging_properties, 0.15);
296
297         i = CONTENT_FENCE;
298         f = &content_features(i);
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->setInventoryTexture("fence.png");
306         setWoodLikeDiggingProperties(f->digging_properties, 0.75);
307
308         i = CONTENT_RAIL;
309         f = &content_features(i);
310         f->setInventoryTexture("rail.png");
311         f->light_propagates = true;
312         f->param_type = CPT_LIGHT;
313         f->is_ground_content = true;
314         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
315         f->solidness = 0; // drawn separately, makes no faces
316         f->air_equivalent = true; // grass grows underneath
317         f->walkable = false;
318         setDirtLikeDiggingProperties(f->digging_properties, 0.75);
319
320         i = CONTENT_LADDER;
321         f = &content_features(i);
322         f->setInventoryTexture("ladder.png");
323         f->light_propagates = true;
324         f->param_type = CPT_LIGHT;
325         f->is_ground_content = true;
326         f->dug_item = std::string("MaterialItem ")+itos(i)+" 1";
327         f->wall_mounted = true;
328         f->solidness = 0;
329         f->air_equivalent = true;
330         f->walkable = false;
331         f->climbable = true;
332         setWoodLikeDiggingProperties(f->digging_properties, 0.5);
333
334         // Deprecated
335         i = CONTENT_COALSTONE;
336         f = &content_features(i);
337         f->setAllTextures("stone.png^mineral_coal.png");
338         f->is_ground_content = true;
339         setStoneLikeDiggingProperties(f->digging_properties, 1.5);
340         
341         i = CONTENT_WOOD;
342         f = &content_features(i);
343         f->setAllTextures("wood.png");
344         f->setInventoryTextureCube("wood.png", "wood.png", "wood.png");
345         f->is_ground_content = true;
346         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
347         setWoodLikeDiggingProperties(f->digging_properties, 0.75);
348         
349         i = CONTENT_MESE;
350         f = &content_features(i);
351         f->setAllTextures("mese.png");
352         f->setInventoryTextureCube("mese.png", "mese.png", "mese.png");
353         f->is_ground_content = true;
354         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
355         setStoneLikeDiggingProperties(f->digging_properties, 0.5);
356         
357         i = CONTENT_CLOUD;
358         f = &content_features(i);
359         f->setAllTextures("cloud.png");
360         f->setInventoryTextureCube("cloud.png", "cloud.png", "cloud.png");
361         f->is_ground_content = true;
362         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
363         
364         i = CONTENT_AIR;
365         f = &content_features(i);
366         f->param_type = CPT_LIGHT;
367         f->light_propagates = true;
368         f->sunlight_propagates = true;
369         f->solidness = 0;
370         f->walkable = false;
371         f->pointable = false;
372         f->diggable = false;
373         f->buildable_to = true;
374         f->air_equivalent = true;
375         
376         i = CONTENT_WATER;
377         f = &content_features(i);
378         f->setInventoryTextureCube("water.png", "water.png", "water.png");
379         f->param_type = CPT_LIGHT;
380         f->light_propagates = true;
381         f->solidness = 0; // Drawn separately, makes no faces
382         f->visual_solidness = 1;
383         f->walkable = false;
384         f->pointable = false;
385         f->diggable = false;
386         f->buildable_to = true;
387         f->liquid_type = LIQUID_FLOWING;
388         f->liquid_alternative_flowing = CONTENT_WATER;
389         f->liquid_alternative_source = CONTENT_WATERSOURCE;
390         f->liquid_viscosity = WATER_VISC;
391         f->vertex_alpha = WATER_ALPHA;
392         f->post_effect_color = video::SColor(64, 100, 100, 200);
393         if(f->special_material == NULL && g_texturesource)
394         {
395                 // Flowing water material
396                 f->special_material = new video::SMaterial;
397                 f->special_material->setFlag(video::EMF_LIGHTING, false);
398                 f->special_material->setFlag(video::EMF_BACK_FACE_CULLING, false);
399                 f->special_material->setFlag(video::EMF_BILINEAR_FILTER, false);
400                 f->special_material->setFlag(video::EMF_FOG_ENABLE, true);
401                 f->special_material->MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA;
402                 AtlasPointer *pa_water1 = new AtlasPointer(g_texturesource->getTexture(
403                                 g_texturesource->getTextureId("water.png")));
404                 f->special_material->setTexture(0, pa_water1->atlas);
405                 f->special_atlas = pa_water1;
406         }
407         
408         i = CONTENT_WATERSOURCE;
409         f = &content_features(i);
410         //f->setInventoryTexture("water.png");
411         f->setInventoryTextureCube("water.png", "water.png", "water.png");
412         if(new_style_water)
413         {
414                 f->solidness = 0; // drawn separately, makes no faces
415         }
416         else // old style
417         {
418                 f->solidness = 1;
419
420                 TileSpec t;
421                 if(g_texturesource)
422                         t.texture = g_texturesource->getTexture("water.png");
423                 
424                 t.alpha = WATER_ALPHA;
425                 t.material_type = MATERIAL_ALPHA_VERTEX;
426                 t.material_flags &= ~MATERIAL_FLAG_BACKFACE_CULLING;
427                 f->setAllTiles(t);
428         }
429         f->param_type = CPT_LIGHT;
430         f->light_propagates = true;
431         f->walkable = false;
432         f->pointable = false;
433         f->diggable = false;
434         f->buildable_to = true;
435         f->liquid_type = LIQUID_SOURCE;
436         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
437         f->liquid_alternative_flowing = CONTENT_WATER;
438         f->liquid_alternative_source = CONTENT_WATERSOURCE;
439         f->liquid_viscosity = WATER_VISC;
440         f->vertex_alpha = WATER_ALPHA;
441         f->post_effect_color = video::SColor(64, 100, 100, 200);
442         if(f->special_material == NULL && g_texturesource)
443         {
444                 // Flowing water material
445                 f->special_material = new video::SMaterial;
446                 f->special_material->setFlag(video::EMF_LIGHTING, false);
447                 f->special_material->setFlag(video::EMF_BACK_FACE_CULLING, false);
448                 f->special_material->setFlag(video::EMF_BILINEAR_FILTER, false);
449                 f->special_material->setFlag(video::EMF_FOG_ENABLE, true);
450                 f->special_material->MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA;
451                 AtlasPointer *pa_water1 = new AtlasPointer(g_texturesource->getTexture(
452                                 g_texturesource->getTextureId("water.png")));
453                 f->special_material->setTexture(0, pa_water1->atlas);
454                 f->special_atlas = pa_water1;
455         }
456         
457         i = CONTENT_LAVA;
458         f = &content_features(i);
459         f->setInventoryTextureCube("lava.png", "lava.png", "lava.png");
460         f->param_type = CPT_LIGHT;
461         f->light_propagates = false;
462         f->light_source = LIGHT_MAX-1;
463         f->solidness = 0; // Drawn separately, makes no faces
464         f->visual_solidness = 2;
465         f->walkable = false;
466         f->pointable = false;
467         f->diggable = false;
468         f->buildable_to = true;
469         f->liquid_type = LIQUID_FLOWING;
470         f->liquid_alternative_flowing = CONTENT_LAVA;
471         f->liquid_alternative_source = CONTENT_LAVASOURCE;
472         f->liquid_viscosity = LAVA_VISC;
473         f->damage_per_second = 4*2;
474         f->post_effect_color = video::SColor(192, 255, 64, 0);
475         if(f->special_material == NULL && g_texturesource)
476         {
477                 // Flowing lava material
478                 f->special_material = new video::SMaterial;
479                 f->special_material->setFlag(video::EMF_LIGHTING, false);
480                 f->special_material->setFlag(video::EMF_BACK_FACE_CULLING, false);
481                 f->special_material->setFlag(video::EMF_BILINEAR_FILTER, false);
482                 f->special_material->setFlag(video::EMF_FOG_ENABLE, true);
483                 f->special_material->MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
484                 AtlasPointer *pa_lava1 = new AtlasPointer(
485                         g_texturesource->getTexture(
486                                 g_texturesource->getTextureId("lava.png")));
487                 f->special_material->setTexture(0, pa_lava1->atlas);
488                 f->special_atlas = pa_lava1;
489         }
490         
491         i = CONTENT_LAVASOURCE;
492         f = &content_features(i);
493         f->setInventoryTextureCube("lava.png", "lava.png", "lava.png");
494         if(new_style_water)
495         {
496                 f->solidness = 0; // drawn separately, makes no faces
497         }
498         else // old style
499         {
500                 f->solidness = 2;
501
502                 TileSpec t;
503                 if(g_texturesource)
504                         t.texture = g_texturesource->getTexture("lava.png");
505                 
506                 //t.alpha = 255;
507                 //t.material_type = MATERIAL_ALPHA_VERTEX;
508                 //t.material_flags &= ~MATERIAL_FLAG_BACKFACE_CULLING;
509                 f->setAllTiles(t);
510         }
511         f->param_type = CPT_LIGHT;
512         f->light_propagates = false;
513         f->light_source = LIGHT_MAX-1;
514         f->walkable = false;
515         f->pointable = false;
516         f->diggable = false;
517         f->buildable_to = true;
518         f->liquid_type = LIQUID_SOURCE;
519         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
520         f->liquid_alternative_flowing = CONTENT_LAVA;
521         f->liquid_alternative_source = CONTENT_LAVASOURCE;
522         f->liquid_viscosity = LAVA_VISC;
523         f->damage_per_second = 4*2;
524         f->post_effect_color = video::SColor(192, 255, 64, 0);
525         if(f->special_material == NULL && g_texturesource)
526         {
527                 // Flowing lava material
528                 f->special_material = new video::SMaterial;
529                 f->special_material->setFlag(video::EMF_LIGHTING, false);
530                 f->special_material->setFlag(video::EMF_BACK_FACE_CULLING, false);
531                 f->special_material->setFlag(video::EMF_BILINEAR_FILTER, false);
532                 f->special_material->setFlag(video::EMF_FOG_ENABLE, true);
533                 f->special_material->MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
534                 AtlasPointer *pa_lava1 = new AtlasPointer(
535                         g_texturesource->getTexture(
536                                 g_texturesource->getTextureId("lava.png")));
537                 f->special_material->setTexture(0, pa_lava1->atlas);
538                 f->special_atlas = pa_lava1;
539         }
540         
541         i = CONTENT_TORCH;
542         f = &content_features(i);
543         f->setInventoryTexture("torch_on_floor.png");
544         f->param_type = CPT_LIGHT;
545         f->light_propagates = true;
546         f->sunlight_propagates = true;
547         f->solidness = 0; // drawn separately, makes no faces
548         f->walkable = false;
549         f->wall_mounted = true;
550         f->air_equivalent = true;
551         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
552         f->light_source = LIGHT_MAX-1;
553         f->digging_properties.set("", DiggingProperties(true, 0.0, 0));
554         
555         i = CONTENT_SIGN_WALL;
556         f = &content_features(i);
557         f->setInventoryTexture("sign_wall.png");
558         f->param_type = CPT_LIGHT;
559         f->light_propagates = true;
560         f->sunlight_propagates = true;
561         f->solidness = 0; // drawn separately, makes no faces
562         f->walkable = false;
563         f->wall_mounted = true;
564         f->air_equivalent = true;
565         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
566         if(f->initial_metadata == NULL)
567                 f->initial_metadata = new SignNodeMetadata("Some sign");
568         f->digging_properties.set("", DiggingProperties(true, 0.5, 0));
569         
570         i = CONTENT_CHEST;
571         f = &content_features(i);
572         f->param_type = CPT_FACEDIR_SIMPLE;
573         f->setAllTextures("chest_side.png");
574         f->setTexture(0, "chest_top.png");
575         f->setTexture(1, "chest_top.png");
576         f->setTexture(5, "chest_front.png"); // Z-
577         f->setInventoryTexture("chest_top.png");
578         //f->setInventoryTextureCube("chest_top.png", "chest_side.png", "chest_side.png");
579         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
580         if(f->initial_metadata == NULL)
581                 f->initial_metadata = new ChestNodeMetadata();
582         setWoodLikeDiggingProperties(f->digging_properties, 1.0);
583         
584         i = CONTENT_FURNACE;
585         f = &content_features(i);
586         f->param_type = CPT_FACEDIR_SIMPLE;
587         f->setAllTextures("furnace_side.png");
588         f->setTexture(5, "furnace_front.png"); // Z-
589         f->setInventoryTexture("furnace_front.png");
590         //f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
591         f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_COBBLE)+" 6";
592         if(f->initial_metadata == NULL)
593                 f->initial_metadata = new FurnaceNodeMetadata();
594         setStoneLikeDiggingProperties(f->digging_properties, 3.0);
595         
596         i = CONTENT_COBBLE;
597         f = &content_features(i);
598         f->setAllTextures("cobble.png");
599         f->setInventoryTextureCube("cobble.png", "cobble.png", "cobble.png");
600         f->param_type = CPT_NONE;
601         f->is_ground_content = true;
602         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
603         setStoneLikeDiggingProperties(f->digging_properties, 0.9);
604
605         i = CONTENT_MOSSYCOBBLE;
606         f = &content_features(i);
607         f->setAllTextures("mossycobble.png");
608         f->setInventoryTextureCube("mossycobble.png", "mossycobble.png", "mossycobble.png");
609         f->param_type = CPT_NONE;
610         f->is_ground_content = true;
611         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
612         setStoneLikeDiggingProperties(f->digging_properties, 0.8);
613         
614         i = CONTENT_STEEL;
615         f = &content_features(i);
616         f->setAllTextures("steel_block.png");
617         f->setInventoryTextureCube("steel_block.png", "steel_block.png",
618                         "steel_block.png");
619         f->param_type = CPT_NONE;
620         f->is_ground_content = true;
621         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
622         setStoneLikeDiggingProperties(f->digging_properties, 5.0);
623         
624         i = CONTENT_NC;
625         f = &content_features(i);
626         f->param_type = CPT_FACEDIR_SIMPLE;
627         f->setAllTextures("nc_side.png");
628         f->setTexture(5, "nc_front.png"); // Z-
629         f->setTexture(4, "nc_back.png"); // Z+
630         f->setInventoryTexture("nc_front.png");
631         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
632         setStoneLikeDiggingProperties(f->digging_properties, 3.0);
633         
634         i = CONTENT_NC_RB;
635         f = &content_features(i);
636         f->setAllTextures("nc_rb.png");
637         f->setInventoryTexture("nc_rb.png");
638         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
639         setStoneLikeDiggingProperties(f->digging_properties, 3.0);
640         
641         // NOTE: Remember to add frequently used stuff to the texture atlas in tile.cpp
642         
643
644         /*
645                 Add MesePick to everything
646         */
647         for(u16 i=0; i<=MAX_CONTENT; i++)
648         {
649                 content_features(i).digging_properties.set("MesePick",
650                                 DiggingProperties(true, 0.0, 65535./1337));
651         }
652
653 }
654
655 void setStoneLikeDiggingProperties(DiggingPropertiesList &list, float toughness)
656 {
657         list.set("",
658                         DiggingProperties(true, 15.0*toughness, 0));
659         
660         list.set("WPick",
661                         DiggingProperties(true, 1.3*toughness, 65535./30.*toughness));
662         list.set("STPick",
663                         DiggingProperties(true, 0.75*toughness, 65535./100.*toughness));
664         list.set("SteelPick",
665                         DiggingProperties(true, 0.50*toughness, 65535./333.*toughness));
666
667         /*list.set("MesePick",
668                         DiggingProperties(true, 0.0*toughness, 65535./20.*toughness));*/
669 }
670
671 void setDirtLikeDiggingProperties(DiggingPropertiesList &list, float toughness)
672 {
673         list.set("",
674                         DiggingProperties(true, 0.75*toughness, 0));
675         
676         list.set("WShovel",
677                         DiggingProperties(true, 0.4*toughness, 65535./50.*toughness));
678         list.set("STShovel",
679                         DiggingProperties(true, 0.2*toughness, 65535./150.*toughness));
680         list.set("SteelShovel",
681                         DiggingProperties(true, 0.15*toughness, 65535./400.*toughness));
682 }
683
684 void setWoodLikeDiggingProperties(DiggingPropertiesList &list, float toughness)
685 {
686         list.set("",
687                         DiggingProperties(true, 3.0*toughness, 0));
688         
689         list.set("WAxe",
690                         DiggingProperties(true, 1.5*toughness, 65535./30.*toughness));
691         list.set("STAxe",
692                         DiggingProperties(true, 0.75*toughness, 65535./100.*toughness));
693         list.set("SteelAxe",
694                         DiggingProperties(true, 0.5*toughness, 65535./333.*toughness));
695 }
696
697