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