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