2fce337fc190e37ac5c9182d1df3f1f4281a6b61
[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 #include "content_mapnode.h"
21
22 #include "irrlichttypes.h"
23 #include "mapnode.h"
24 #include "content_nodemeta.h"
25 #include "nodedef.h"
26 #include "utility.h"
27
28 #define WATER_ALPHA 160
29
30 #define WATER_VISC 1
31 #define LAVA_VISC 7
32
33 void setConstantMaterialProperties(MaterialProperties &mprop, float time)
34 {
35         mprop.diggability = DIGGABLE_CONSTANT;
36         mprop.constant_time = time;
37 }
38
39 void setStoneLikeMaterialProperties(MaterialProperties &mprop, float toughness)
40 {
41         mprop.diggability = DIGGABLE_NORMAL;
42         mprop.weight = 5.0 * toughness;
43         mprop.crackiness = 1.0;
44         mprop.crumbliness = -0.1;
45         mprop.cuttability = -0.2;
46 }
47
48 void setDirtLikeMaterialProperties(MaterialProperties &mprop, float toughness)
49 {
50         mprop.diggability = DIGGABLE_NORMAL;
51         mprop.weight = toughness * 1.2;
52         mprop.crackiness = 0;
53         mprop.crumbliness = 1.2;
54         mprop.cuttability = -0.4;
55 }
56
57 void setGravelLikeMaterialProperties(MaterialProperties &mprop, float toughness)
58 {
59         mprop.diggability = DIGGABLE_NORMAL;
60         mprop.weight = toughness * 2.0;
61         mprop.crackiness = 0.2;
62         mprop.crumbliness = 1.5;
63         mprop.cuttability = -1.0;
64 }
65
66 void setWoodLikeMaterialProperties(MaterialProperties &mprop, float toughness)
67 {
68         mprop.diggability = DIGGABLE_NORMAL;
69         mprop.weight = toughness * 1.0;
70         mprop.crackiness = 0.75;
71         mprop.crumbliness = -1.0;
72         mprop.cuttability = 1.5;
73 }
74
75 void setLeavesLikeMaterialProperties(MaterialProperties &mprop, float toughness)
76 {
77         mprop.diggability = DIGGABLE_NORMAL;
78         mprop.weight = -0.5 * toughness;
79         mprop.crackiness = 0;
80         mprop.crumbliness = 0;
81         mprop.cuttability = 2.0;
82 }
83
84 void setGlassLikeMaterialProperties(MaterialProperties &mprop, float toughness)
85 {
86         mprop.diggability = DIGGABLE_NORMAL;
87         mprop.weight = 0.1 * toughness;
88         mprop.crackiness = 2.0;
89         mprop.crumbliness = -1.0;
90         mprop.cuttability = -1.0;
91 }
92
93 /*
94         A conversion table for backwards compatibility.
95         Maps <=v19 content types to current ones.
96         Should never be touched.
97 */
98 content_t trans_table_19[21][2] = {
99         {CONTENT_GRASS, 1},
100         {CONTENT_TREE, 4},
101         {CONTENT_LEAVES, 5},
102         {CONTENT_GRASS_FOOTSTEPS, 6},
103         {CONTENT_MESE, 7},
104         {CONTENT_MUD, 8},
105         {CONTENT_CLOUD, 10},
106         {CONTENT_COALSTONE, 11},
107         {CONTENT_WOOD, 12},
108         {CONTENT_SAND, 13},
109         {CONTENT_COBBLE, 18},
110         {CONTENT_STEEL, 19},
111         {CONTENT_GLASS, 20},
112         {CONTENT_MOSSYCOBBLE, 22},
113         {CONTENT_GRAVEL, 23},
114         {CONTENT_SANDSTONE, 24},
115         {CONTENT_CACTUS, 25},
116         {CONTENT_BRICK, 26},
117         {CONTENT_CLAY, 27},
118         {CONTENT_PAPYRUS, 28},
119         {CONTENT_BOOKSHELF, 29},
120 };
121
122 MapNode mapnode_translate_from_internal(MapNode n_from, u8 version)
123 {
124         MapNode result = n_from;
125         if(version <= 19)
126         {
127                 content_t c_from = n_from.getContent();
128                 for(u32 i=0; i<sizeof(trans_table_19)/sizeof(trans_table_19[0]); i++)
129                 {
130                         if(trans_table_19[i][0] == c_from)
131                         {
132                                 result.setContent(trans_table_19[i][1]);
133                                 break;
134                         }
135                 }
136         }
137         return result;
138 }
139 MapNode mapnode_translate_to_internal(MapNode n_from, u8 version)
140 {
141         MapNode result = n_from;
142         if(version <= 19)
143         {
144                 content_t c_from = n_from.getContent();
145                 for(u32 i=0; i<sizeof(trans_table_19)/sizeof(trans_table_19[0]); i++)
146                 {
147                         if(trans_table_19[i][1] == c_from)
148                         {
149                                 result.setContent(trans_table_19[i][0]);
150                                 break;
151                         }
152                 }
153         }
154         return result;
155 }
156
157 // See header for description
158 void content_mapnode_init(IWritableNodeDefManager *nodemgr)
159 {
160         content_t i;
161         ContentFeatures *f = NULL;
162
163         i = CONTENT_STONE;
164         f = nodemgr->getModifiable(i);
165         f->setAllTextures("stone.png");
166         f->setInventoryTextureCube("stone.png", "stone.png", "stone.png");
167         f->param_type = CPT_MINERAL;
168         f->is_ground_content = true;
169         f->often_contains_mineral = true;
170         f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_COBBLE)+" 1";
171         setStoneLikeMaterialProperties(f->material, 1.0);
172         
173         i = CONTENT_GRASS;
174         f = nodemgr->getModifiable(i);
175         f->setAllTextures("mud.png^grass_side.png");
176         f->setTexture(0, "grass.png");
177         f->setTexture(1, "mud.png");
178         f->param_type = CPT_MINERAL;
179         f->is_ground_content = true;
180         f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_MUD)+" 1";
181         setDirtLikeMaterialProperties(f->material, 1.0);
182         
183         i = CONTENT_GRASS_FOOTSTEPS;
184         f = nodemgr->getModifiable(i);
185         f->setAllTextures("mud.png^grass_side.png");
186         f->setTexture(0, "grass_footsteps.png");
187         f->setTexture(1, "mud.png");
188         f->param_type = CPT_MINERAL;
189         f->is_ground_content = true;
190         f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_MUD)+" 1";
191         setDirtLikeMaterialProperties(f->material, 1.0);
192         
193         i = CONTENT_MUD;
194         f = nodemgr->getModifiable(i);
195         f->setAllTextures("mud.png");
196         f->setInventoryTextureCube("mud.png", "mud.png", "mud.png");
197         f->param_type = CPT_MINERAL;
198         f->is_ground_content = true;
199         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
200         setDirtLikeMaterialProperties(f->material, 1.0);
201         
202         i = CONTENT_SAND;
203         f = nodemgr->getModifiable(i);
204         f->setAllTextures("sand.png");
205         f->setInventoryTextureCube("sand.png", "sand.png", "sand.png");
206         f->param_type = CPT_MINERAL;
207         f->is_ground_content = true;
208         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
209         setDirtLikeMaterialProperties(f->material, 1.0);
210         
211         i = CONTENT_GRAVEL;
212         f = nodemgr->getModifiable(i);
213         f->setAllTextures("gravel.png");
214         f->setInventoryTextureCube("gravel.png", "gravel.png", "gravel.png");
215         f->param_type = CPT_MINERAL;
216         f->is_ground_content = true;
217         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
218         setGravelLikeMaterialProperties(f->material, 1.0);
219         
220         i = CONTENT_SANDSTONE;
221         f = nodemgr->getModifiable(i);
222         f->setAllTextures("sandstone.png");
223         f->setInventoryTextureCube("sandstone.png", "sandstone.png", "sandstone.png");
224         f->param_type = CPT_MINERAL;
225         f->is_ground_content = true;
226         f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_SAND)+" 1";
227         setDirtLikeMaterialProperties(f->material, 1.0);
228
229         i = CONTENT_CLAY;
230         f = nodemgr->getModifiable(i);
231         f->setAllTextures("clay.png");
232         f->setInventoryTextureCube("clay.png", "clay.png", "clay.png");
233         f->param_type = CPT_MINERAL;
234         f->is_ground_content = true;
235         f->dug_item = std::string("CraftItem lump_of_clay 4");
236         setDirtLikeMaterialProperties(f->material, 1.0);
237
238         i = CONTENT_BRICK;
239         f = nodemgr->getModifiable(i);
240         f->setAllTextures("brick.png");
241         f->setInventoryTextureCube("brick.png", "brick.png", "brick.png");
242         f->param_type = CPT_MINERAL;
243         f->is_ground_content = true;
244         f->dug_item = std::string("CraftItem clay_brick 4");
245         setStoneLikeMaterialProperties(f->material, 1.0);
246
247         i = CONTENT_TREE;
248         f = nodemgr->getModifiable(i);
249         f->setAllTextures("tree.png");
250         f->setTexture(0, "tree_top.png");
251         f->setTexture(1, "tree_top.png");
252         f->param_type = CPT_MINERAL;
253         f->is_ground_content = true;
254         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
255         setWoodLikeMaterialProperties(f->material, 1.0);
256         
257         i = CONTENT_JUNGLETREE;
258         f = nodemgr->getModifiable(i);
259         f->setAllTextures("jungletree.png");
260         f->setTexture(0, "jungletree_top.png");
261         f->setTexture(1, "jungletree_top.png");
262         f->param_type = CPT_MINERAL;
263         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
264         setWoodLikeMaterialProperties(f->material, 1.0);
265         
266         i = CONTENT_JUNGLEGRASS;
267         f = nodemgr->getModifiable(i);
268         f->drawtype = NDT_PLANTLIKE;
269         f->visual_scale = 1.3;
270         f->setAllTextures("junglegrass.png");
271         f->setInventoryTexture("junglegrass.png");
272         f->light_propagates = true;
273         f->param_type = CPT_LIGHT;
274         f->air_equivalent = false; // grass grows underneath
275         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
276         f->walkable = false;
277         setLeavesLikeMaterialProperties(f->material, 1.0);
278
279         i = CONTENT_LEAVES;
280         f = nodemgr->getModifiable(i);
281         f->drawtype = NDT_ALLFACES_OPTIONAL;
282         f->setAllTextures("leaves.png");
283         //f->setAllTextures("[noalpha:leaves.png");
284         f->light_propagates = true;
285         f->param_type = CPT_LIGHT;
286         f->extra_dug_item = std::string("MaterialItem2 ")+itos(CONTENT_SAPLING)+" 1";
287         f->extra_dug_item_rarity = 20;
288         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
289         setLeavesLikeMaterialProperties(f->material, 1.0);
290
291         i = CONTENT_CACTUS;
292         f = nodemgr->getModifiable(i);
293         f->setAllTextures("cactus_side.png");
294         f->setTexture(0, "cactus_top.png");
295         f->setTexture(1, "cactus_top.png");
296         f->setInventoryTextureCube("cactus_top.png", "cactus_side.png", "cactus_side.png");
297         f->param_type = CPT_MINERAL;
298         f->is_ground_content = true;
299         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
300         setWoodLikeMaterialProperties(f->material, 0.75);
301
302         i = CONTENT_PAPYRUS;
303         f = nodemgr->getModifiable(i);
304         f->drawtype = NDT_PLANTLIKE;
305         f->setAllTextures("papyrus.png");
306         f->setInventoryTexture("papyrus.png");
307         f->light_propagates = true;
308         f->param_type = CPT_LIGHT;
309         f->is_ground_content = true;
310         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
311         f->walkable = false;
312         setLeavesLikeMaterialProperties(f->material, 0.5);
313
314         i = CONTENT_BOOKSHELF;
315         f = nodemgr->getModifiable(i);
316         f->setAllTextures("bookshelf.png");
317         f->setTexture(0, "wood.png");
318         f->setTexture(1, "wood.png");
319         // FIXME: setInventoryTextureCube() only cares for the first texture
320         f->setInventoryTextureCube("bookshelf.png", "bookshelf.png", "bookshelf.png");
321         //f->setInventoryTextureCube("wood.png", "bookshelf.png", "bookshelf.png");
322         f->param_type = CPT_MINERAL;
323         f->is_ground_content = true;
324         setWoodLikeMaterialProperties(f->material, 0.75);
325
326         i = CONTENT_GLASS;
327         f = nodemgr->getModifiable(i);
328         f->drawtype = NDT_GLASSLIKE;
329         f->setAllTextures("glass.png");
330         f->light_propagates = true;
331         f->sunlight_propagates = true;
332         f->param_type = CPT_LIGHT;
333         f->is_ground_content = true;
334         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
335         f->setInventoryTextureCube("glass.png", "glass.png", "glass.png");
336         setGlassLikeMaterialProperties(f->material, 1.0);
337
338         i = CONTENT_FENCE;
339         f = nodemgr->getModifiable(i);
340         f->drawtype = NDT_FENCELIKE;
341         f->setInventoryTexture("fence.png");
342         f->setTexture(0, "wood.png");
343         f->light_propagates = true;
344         f->param_type = CPT_LIGHT;
345         f->is_ground_content = true;
346         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
347         f->air_equivalent = true; // grass grows underneath
348         f->selection_box.type = NODEBOX_FIXED;
349         f->selection_box.fixed = core::aabbox3d<f32>(
350                         -BS/7, -BS/2, -BS/7, BS/7, BS/2, BS/7);
351         setWoodLikeMaterialProperties(f->material, 0.75);
352
353         i = CONTENT_RAIL;
354         f = nodemgr->getModifiable(i);
355         f->drawtype = NDT_RAILLIKE;
356         f->setInventoryTexture("rail.png");
357         f->setTexture(0, "rail.png");
358         f->setTexture(1, "rail_curved.png");
359         f->setTexture(2, "rail_t_junction.png");
360         f->setTexture(3, "rail_crossing.png");
361         f->light_propagates = true;
362         f->param_type = CPT_LIGHT;
363         f->is_ground_content = true;
364         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
365         f->air_equivalent = true; // grass grows underneath
366         f->walkable = false;
367         f->selection_box.type = NODEBOX_FIXED;
368         setDirtLikeMaterialProperties(f->material, 0.75);
369
370         i = CONTENT_LADDER;
371         f = nodemgr->getModifiable(i);
372         f->drawtype = NDT_SIGNLIKE;
373         f->setAllTextures("ladder.png");
374         f->setInventoryTexture("ladder.png");
375         f->light_propagates = true;
376         f->param_type = CPT_LIGHT;
377         f->is_ground_content = true;
378         f->dug_item = std::string("MaterialItem ")+itos(i)+" 1";
379         f->wall_mounted = true;
380         f->air_equivalent = true;
381         f->walkable = false;
382         f->climbable = true;
383         f->selection_box.type = NODEBOX_WALLMOUNTED;
384         setWoodLikeMaterialProperties(f->material, 0.5);
385
386         // Deprecated
387         i = CONTENT_COALSTONE;
388         f = nodemgr->getModifiable(i);
389         f->setAllTextures("stone.png^mineral_coal.png");
390         f->is_ground_content = true;
391         setStoneLikeMaterialProperties(f->material, 1.5);
392         
393         i = CONTENT_WOOD;
394         f = nodemgr->getModifiable(i);
395         f->setAllTextures("wood.png");
396         f->setInventoryTextureCube("wood.png", "wood.png", "wood.png");
397         f->is_ground_content = true;
398         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
399         setWoodLikeMaterialProperties(f->material, 0.75);
400         
401         i = CONTENT_MESE;
402         f = nodemgr->getModifiable(i);
403         f->setAllTextures("mese.png");
404         f->setInventoryTextureCube("mese.png", "mese.png", "mese.png");
405         f->is_ground_content = true;
406         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
407         setStoneLikeMaterialProperties(f->material, 0.5);
408         
409         i = CONTENT_CLOUD;
410         f = nodemgr->getModifiable(i);
411         f->setAllTextures("cloud.png");
412         f->setInventoryTextureCube("cloud.png", "cloud.png", "cloud.png");
413         f->is_ground_content = true;
414         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
415         
416         i = CONTENT_AIR;
417         f = nodemgr->getModifiable(i);
418         f->param_type = CPT_LIGHT;
419         f->light_propagates = true;
420         f->sunlight_propagates = true;
421         f->walkable = false;
422         f->pointable = false;
423         f->diggable = false;
424         f->buildable_to = true;
425         f->air_equivalent = true;
426         
427         i = CONTENT_WATER;
428         f = nodemgr->getModifiable(i);
429         f->drawtype = NDT_FLOWINGLIQUID;
430         f->setAllTextures("water.png");
431         f->alpha = WATER_ALPHA;
432         f->setInventoryTextureCube("water.png", "water.png", "water.png");
433         f->param_type = CPT_LIGHT;
434         f->light_propagates = true;
435         f->walkable = false;
436         f->pointable = false;
437         f->diggable = false;
438         f->buildable_to = true;
439         f->liquid_type = LIQUID_FLOWING;
440         f->liquid_alternative_flowing = CONTENT_WATER;
441         f->liquid_alternative_source = CONTENT_WATERSOURCE;
442         f->liquid_viscosity = WATER_VISC;
443         f->post_effect_color = video::SColor(64, 100, 100, 200);
444         f->setSpecialMaterial(0, MaterialSpec("water.png", false));
445         f->setSpecialMaterial(1, MaterialSpec("water.png", true));
446
447         i = CONTENT_WATERSOURCE;
448         f = nodemgr->getModifiable(i);
449         f->drawtype = NDT_LIQUID;
450         f->setAllTextures("water.png");
451         f->alpha = WATER_ALPHA;
452         f->setInventoryTextureCube("water.png", "water.png", "water.png");
453         f->param_type = CPT_LIGHT;
454         f->light_propagates = true;
455         f->walkable = false;
456         f->pointable = false;
457         f->diggable = false;
458         f->buildable_to = true;
459         f->liquid_type = LIQUID_SOURCE;
460         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
461         f->liquid_alternative_flowing = CONTENT_WATER;
462         f->liquid_alternative_source = CONTENT_WATERSOURCE;
463         f->liquid_viscosity = WATER_VISC;
464         f->post_effect_color = video::SColor(64, 100, 100, 200);
465         // New-style water source material (mostly unused)
466         f->setSpecialMaterial(0, MaterialSpec("water.png", false));
467         
468         i = CONTENT_LAVA;
469         f = nodemgr->getModifiable(i);
470         f->drawtype = NDT_FLOWINGLIQUID;
471         f->setAllTextures("lava.png");
472         f->setInventoryTextureCube("lava.png", "lava.png", "lava.png");
473         f->param_type = CPT_LIGHT;
474         f->light_propagates = false;
475         f->light_source = LIGHT_MAX-1;
476         f->walkable = false;
477         f->pointable = false;
478         f->diggable = false;
479         f->buildable_to = true;
480         f->liquid_type = LIQUID_FLOWING;
481         f->liquid_alternative_flowing = CONTENT_LAVA;
482         f->liquid_alternative_source = CONTENT_LAVASOURCE;
483         f->liquid_viscosity = LAVA_VISC;
484         f->damage_per_second = 4*2;
485         f->post_effect_color = video::SColor(192, 255, 64, 0);
486         f->setSpecialMaterial(0, MaterialSpec("lava.png", false));
487         f->setSpecialMaterial(1, MaterialSpec("lava.png", true));
488         
489         i = CONTENT_LAVASOURCE;
490         f = nodemgr->getModifiable(i);
491         f->drawtype = NDT_LIQUID;
492         f->setAllTextures("lava.png");
493         f->setInventoryTextureCube("lava.png", "lava.png", "lava.png");
494         f->param_type = CPT_LIGHT;
495         f->light_propagates = false;
496         f->light_source = LIGHT_MAX-1;
497         f->walkable = false;
498         f->pointable = false;
499         f->diggable = false;
500         f->buildable_to = true;
501         f->liquid_type = LIQUID_SOURCE;
502         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
503         f->liquid_alternative_flowing = CONTENT_LAVA;
504         f->liquid_alternative_source = CONTENT_LAVASOURCE;
505         f->liquid_viscosity = LAVA_VISC;
506         f->damage_per_second = 4*2;
507         f->post_effect_color = video::SColor(192, 255, 64, 0);
508         // New-style lava source material (mostly unused)
509         f->setSpecialMaterial(0, MaterialSpec("lava.png", false));
510         
511         i = CONTENT_TORCH;
512         f = nodemgr->getModifiable(i);
513         f->drawtype = NDT_TORCHLIKE;
514         f->setTexture(0, "torch_on_floor.png");
515         f->setTexture(1, "torch_on_ceiling.png");
516         f->setTexture(2, "torch.png");
517         f->setInventoryTexture("torch_on_floor.png");
518         f->param_type = CPT_LIGHT;
519         f->light_propagates = true;
520         f->sunlight_propagates = true;
521         f->walkable = false;
522         f->wall_mounted = true;
523         f->air_equivalent = true;
524         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
525         f->light_source = LIGHT_MAX-1;
526         f->selection_box.type = NODEBOX_WALLMOUNTED;
527         f->selection_box.wall_top = core::aabbox3d<f32>(
528                         -BS/10, BS/2-BS/3.333*2, -BS/10, BS/10, BS/2, BS/10);
529         f->selection_box.wall_bottom = core::aabbox3d<f32>(
530                         -BS/10, -BS/2, -BS/10, BS/10, -BS/2+BS/3.333*2, BS/10);
531         f->selection_box.wall_side = core::aabbox3d<f32>(
532                         -BS/2, -BS/3.333, -BS/10, -BS/2+BS/3.333, BS/3.333, BS/10);
533         setConstantMaterialProperties(f->material, 0.0);
534         
535         i = CONTENT_SIGN_WALL;
536         f = nodemgr->getModifiable(i);
537         f->drawtype = NDT_SIGNLIKE;
538         f->setAllTextures("sign_wall.png");
539         f->setInventoryTexture("sign_wall.png");
540         f->param_type = CPT_LIGHT;
541         f->light_propagates = true;
542         f->sunlight_propagates = true;
543         f->walkable = false;
544         f->wall_mounted = true;
545         f->air_equivalent = true;
546         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
547         if(f->initial_metadata == NULL)
548                 f->initial_metadata = new SignNodeMetadata(NULL, "Some sign");
549         setConstantMaterialProperties(f->material, 0.5);
550         f->selection_box.type = NODEBOX_WALLMOUNTED;
551         
552         i = CONTENT_CHEST;
553         f = nodemgr->getModifiable(i);
554         f->param_type = CPT_FACEDIR_SIMPLE;
555         f->setAllTextures("chest_side.png");
556         f->setTexture(0, "chest_top.png");
557         f->setTexture(1, "chest_top.png");
558         f->setTexture(5, "chest_front.png"); // Z-
559         f->setInventoryTexture("chest_top.png");
560         //f->setInventoryTextureCube("chest_top.png", "chest_side.png", "chest_side.png");
561         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
562         if(f->initial_metadata == NULL)
563                 f->initial_metadata = new ChestNodeMetadata(NULL);
564         setWoodLikeMaterialProperties(f->material, 1.0);
565         
566         i = CONTENT_LOCKABLE_CHEST;
567         f = nodemgr->getModifiable(i);
568         f->param_type = CPT_FACEDIR_SIMPLE;
569         f->setAllTextures("chest_side.png");
570         f->setTexture(0, "chest_top.png");
571         f->setTexture(1, "chest_top.png");
572         f->setTexture(5, "chest_lock.png"); // Z-
573         f->setInventoryTexture("chest_lock.png");
574         //f->setInventoryTextureCube("chest_top.png", "chest_side.png", "chest_side.png");
575         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
576         if(f->initial_metadata == NULL)
577                 f->initial_metadata = new LockingChestNodeMetadata(NULL);
578         setWoodLikeMaterialProperties(f->material, 1.0);
579
580         i = CONTENT_FURNACE;
581         f = nodemgr->getModifiable(i);
582         f->param_type = CPT_FACEDIR_SIMPLE;
583         f->setAllTextures("furnace_side.png");
584         f->setTexture(5, "furnace_front.png"); // Z-
585         f->setInventoryTexture("furnace_front.png");
586         //f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
587         f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_COBBLE)+" 6";
588         if(f->initial_metadata == NULL)
589                 f->initial_metadata = new FurnaceNodeMetadata(NULL);
590         setStoneLikeMaterialProperties(f->material, 3.0);
591         
592         i = CONTENT_COBBLE;
593         f = nodemgr->getModifiable(i);
594         f->setAllTextures("cobble.png");
595         f->setInventoryTextureCube("cobble.png", "cobble.png", "cobble.png");
596         f->param_type = CPT_NONE;
597         f->is_ground_content = true;
598         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
599         setStoneLikeMaterialProperties(f->material, 0.9);
600
601         i = CONTENT_MOSSYCOBBLE;
602         f = nodemgr->getModifiable(i);
603         f->setAllTextures("mossycobble.png");
604         f->setInventoryTextureCube("mossycobble.png", "mossycobble.png", "mossycobble.png");
605         f->param_type = CPT_NONE;
606         f->is_ground_content = true;
607         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
608         setStoneLikeMaterialProperties(f->material, 0.8);
609         
610         i = CONTENT_STEEL;
611         f = nodemgr->getModifiable(i);
612         f->setAllTextures("steel_block.png");
613         f->setInventoryTextureCube("steel_block.png", "steel_block.png",
614                         "steel_block.png");
615         f->param_type = CPT_NONE;
616         f->is_ground_content = true;
617         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
618         setStoneLikeMaterialProperties(f->material, 5.0);
619         
620         i = CONTENT_NC;
621         f = nodemgr->getModifiable(i);
622         f->param_type = CPT_FACEDIR_SIMPLE;
623         f->setAllTextures("nc_side.png");
624         f->setTexture(5, "nc_front.png"); // Z-
625         f->setTexture(4, "nc_back.png"); // Z+
626         f->setInventoryTexture("nc_front.png");
627         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
628         setStoneLikeMaterialProperties(f->material, 3.0);
629         
630         i = CONTENT_NC_RB;
631         f = nodemgr->getModifiable(i);
632         f->setAllTextures("nc_rb.png");
633         f->setInventoryTexture("nc_rb.png");
634         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
635         setStoneLikeMaterialProperties(f->material, 3.0);
636
637         i = CONTENT_SAPLING;
638         f = nodemgr->getModifiable(i);
639         f->drawtype = NDT_PLANTLIKE;
640         f->visual_scale = 1.5;
641         f->setAllTextures("sapling.png");
642         f->setInventoryTexture("sapling.png");
643         f->param_type = CPT_LIGHT;
644         f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
645         f->light_propagates = true;
646         f->air_equivalent = false;
647         f->walkable = false;
648         setConstantMaterialProperties(f->material, 0.0);
649         
650         i = CONTENT_APPLE;
651         f = nodemgr->getModifiable(i);
652         f->drawtype = NDT_PLANTLIKE;
653         f->visual_scale = 1.0;
654         f->setAllTextures("apple.png");
655         f->setInventoryTexture("apple.png");
656         f->param_type = CPT_LIGHT;
657         f->light_propagates = true;
658         f->sunlight_propagates = true;
659         f->walkable = false;
660         f->air_equivalent = true;
661         f->dug_item = std::string("CraftItem apple 1");
662         setConstantMaterialProperties(f->material, 0.0);
663 }
664
665