3 Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
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.
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.
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.
23 #include "content_mapnode.h"
25 #include "content_nodemeta.h"
27 #include "mapnode_contentfeatures.h"
29 #define WATER_ALPHA 160
34 // TODO: Get rid of these and set up some attributes like toughness,
35 // fluffyness, and a funciton to calculate time and durability loss
36 // (and sound? and whatever else) from them
37 void setStoneLikeDiggingProperties(DiggingPropertiesList &list, float toughness);
38 void setDirtLikeDiggingProperties(DiggingPropertiesList &list, float toughness);
39 void setWoodLikeDiggingProperties(DiggingPropertiesList &list, float toughness);
42 A conversion table for backwards compatibility.
43 Maps <=v19 content types to current ones.
44 Should never be touched.
46 content_t trans_table_19[21][2] = {
50 {CONTENT_GRASS_FOOTSTEPS, 6},
54 {CONTENT_COALSTONE, 11},
60 {CONTENT_MOSSYCOBBLE, 22},
62 {CONTENT_SANDSTONE, 24},
66 {CONTENT_PAPYRUS, 28},
67 {CONTENT_BOOKSHELF, 29},
70 MapNode mapnode_translate_from_internal(MapNode n_from, u8 version)
72 MapNode result = n_from;
75 content_t c_from = n_from.getContent();
76 for(u32 i=0; i<sizeof(trans_table_19)/sizeof(trans_table_19[0]); i++)
78 if(trans_table_19[i][0] == c_from)
80 result.setContent(trans_table_19[i][1]);
87 MapNode mapnode_translate_to_internal(MapNode n_from, u8 version)
89 MapNode result = n_from;
92 content_t c_from = n_from.getContent();
93 for(u32 i=0; i<sizeof(trans_table_19)/sizeof(trans_table_19[0]); i++)
95 if(trans_table_19[i][1] == c_from)
97 result.setContent(trans_table_19[i][0]);
105 // See header for description
106 void content_mapnode_init()
108 if(g_texturesource == NULL)
109 dstream<<"INFO: Initial run of content_mapnode_init with "
110 "g_texturesource=NULL. If this segfaults, "
111 "there is a bug with something not checking for "
112 "the NULL value."<<std::endl;
114 dstream<<"INFO: Full run of content_mapnode_init with "
115 "g_texturesource!=NULL"<<std::endl;
117 // Read some settings
118 bool new_style_water = g_settings->getBool("new_style_water");
119 bool new_style_leaves = g_settings->getBool("new_style_leaves");
120 bool invisible_stone = g_settings->getBool("invisible_stone");
121 bool opaque_water = g_settings->getBool("opaque_water");
124 ContentFeatures *f = NULL;
127 f = &content_features(i);
128 f->setAllTextures("stone.png");
129 f->setInventoryTextureCube("stone.png", "stone.png", "stone.png");
130 f->param_type = CPT_MINERAL;
131 f->is_ground_content = true;
132 f->often_contains_mineral = true;
133 f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_COBBLE)+" 1";
134 setStoneLikeDiggingProperties(f->digging_properties, 1.0);
136 f->solidness = 0; // For debugging, hides regular stone
139 f = &content_features(i);
140 f->setAllTextures("mud.png^grass_side.png");
141 f->setTexture(0, "grass.png");
142 f->setTexture(1, "mud.png");
143 f->param_type = CPT_MINERAL;
144 f->is_ground_content = true;
145 f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_MUD)+" 1";
146 setDirtLikeDiggingProperties(f->digging_properties, 1.0);
148 i = CONTENT_GRASS_FOOTSTEPS;
149 f = &content_features(i);
150 f->setAllTextures("mud.png^grass_side.png");
151 f->setTexture(0, "grass_footsteps.png");
152 f->setTexture(1, "mud.png");
153 f->param_type = CPT_MINERAL;
154 f->is_ground_content = true;
155 f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_MUD)+" 1";
156 setDirtLikeDiggingProperties(f->digging_properties, 1.0);
159 f = &content_features(i);
160 f->setAllTextures("mud.png");
161 f->setInventoryTextureCube("mud.png", "mud.png", "mud.png");
162 f->param_type = CPT_MINERAL;
163 f->is_ground_content = true;
164 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
165 setDirtLikeDiggingProperties(f->digging_properties, 1.0);
168 f = &content_features(i);
169 f->setAllTextures("sand.png");
170 f->setInventoryTextureCube("sand.png", "sand.png", "sand.png");
171 f->param_type = CPT_MINERAL;
172 f->is_ground_content = true;
173 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
174 setDirtLikeDiggingProperties(f->digging_properties, 1.0);
177 f = &content_features(i);
178 f->setAllTextures("gravel.png");
179 f->setInventoryTextureCube("gravel.png", "gravel.png", "gravel.png");
180 f->param_type = CPT_MINERAL;
181 f->is_ground_content = true;
182 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
183 setDirtLikeDiggingProperties(f->digging_properties, 1.75);
185 i = CONTENT_SANDSTONE;
186 f = &content_features(i);
187 f->setAllTextures("sandstone.png");
188 f->setInventoryTextureCube("sandstone.png", "sandstone.png", "sandstone.png");
189 f->param_type = CPT_MINERAL;
190 f->is_ground_content = true;
191 f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_SAND)+" 1";
192 setDirtLikeDiggingProperties(f->digging_properties, 1.0);
195 f = &content_features(i);
196 f->setAllTextures("clay.png");
197 f->setInventoryTextureCube("clay.png", "clay.png", "clay.png");
198 f->param_type = CPT_MINERAL;
199 f->is_ground_content = true;
200 f->dug_item = std::string("CraftItem lump_of_clay 4");
201 setDirtLikeDiggingProperties(f->digging_properties, 1.0);
204 f = &content_features(i);
205 f->setAllTextures("brick.png");
206 f->setInventoryTextureCube("brick.png", "brick.png", "brick.png");
207 f->param_type = CPT_MINERAL;
208 f->is_ground_content = true;
209 f->dug_item = std::string("CraftItem clay_brick 4");
210 setStoneLikeDiggingProperties(f->digging_properties, 1.0);
213 f = &content_features(i);
214 f->setAllTextures("tree.png");
215 f->setTexture(0, "tree_top.png");
216 f->setTexture(1, "tree_top.png");
217 f->param_type = CPT_MINERAL;
218 f->is_ground_content = true;
219 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
220 setWoodLikeDiggingProperties(f->digging_properties, 1.0);
222 i = CONTENT_JUNGLETREE;
223 f = &content_features(i);
224 f->setAllTextures("jungletree.png");
225 f->setTexture(0, "jungletree_top.png");
226 f->setTexture(1, "jungletree_top.png");
227 f->param_type = CPT_MINERAL;
228 //f->is_ground_content = true;
229 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
230 setWoodLikeDiggingProperties(f->digging_properties, 1.0);
232 i = CONTENT_JUNGLEGRASS;
233 f = &content_features(i);
234 f->setInventoryTexture("junglegrass.png");
235 f->used_texturenames["junglegrass.png"] = true;
236 f->light_propagates = true;
237 f->param_type = CPT_LIGHT;
238 //f->is_ground_content = true;
239 f->air_equivalent = false; // grass grows underneath
240 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
241 f->solidness = 0; // drawn separately, makes no faces
243 setWoodLikeDiggingProperties(f->digging_properties, 0.10);
246 f = &content_features(i);
247 f->light_propagates = true;
248 //f->param_type = CPT_MINERAL;
249 f->param_type = CPT_LIGHT;
250 //f->is_ground_content = true;
253 f->solidness = 0; // drawn separately, makes no faces
254 f->visual_solidness = 1;
255 f->setAllTextures("leaves.png");
256 f->setInventoryTextureCube("leaves.png", "leaves.png", "leaves.png");
260 f->setAllTextures("[noalpha:leaves.png");
262 f->extra_dug_item = std::string("MaterialItem2 ")+itos(CONTENT_SAPLING)+" 1";
263 f->extra_dug_item_rarity = 20;
264 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
265 setWoodLikeDiggingProperties(f->digging_properties, 0.15);
268 f = &content_features(i);
269 f->setAllTextures("cactus_side.png");
270 f->setTexture(0, "cactus_top.png");
271 f->setTexture(1, "cactus_top.png");
272 f->setInventoryTextureCube("cactus_top.png", "cactus_side.png", "cactus_side.png");
273 f->param_type = CPT_MINERAL;
274 f->is_ground_content = true;
275 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
276 setWoodLikeDiggingProperties(f->digging_properties, 0.75);
279 f = &content_features(i);
280 f->setInventoryTexture("papyrus.png");
281 f->used_texturenames["papyrus.png"] = true;
282 f->light_propagates = true;
283 f->param_type = CPT_LIGHT;
284 f->is_ground_content = true;
285 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
286 f->solidness = 0; // drawn separately, makes no faces
288 setWoodLikeDiggingProperties(f->digging_properties, 0.25);
290 i = CONTENT_BOOKSHELF;
291 f = &content_features(i);
292 f->setAllTextures("bookshelf.png");
293 f->setTexture(0, "wood.png");
294 f->setTexture(1, "wood.png");
295 // FIXME: setInventoryTextureCube() only cares for the first texture
296 f->setInventoryTextureCube("bookshelf.png", "bookshelf.png", "bookshelf.png");
297 //f->setInventoryTextureCube("wood.png", "bookshelf.png", "bookshelf.png");
298 f->param_type = CPT_MINERAL;
299 f->is_ground_content = true;
300 setWoodLikeDiggingProperties(f->digging_properties, 0.75);
303 f = &content_features(i);
304 f->light_propagates = true;
305 f->sunlight_propagates = true;
306 f->param_type = CPT_LIGHT;
307 f->is_ground_content = true;
308 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
309 f->solidness = 0; // drawn separately, makes no faces
310 f->visual_solidness = 1;
311 f->setAllTextures("glass.png");
312 f->setInventoryTextureCube("glass.png", "glass.png", "glass.png");
313 setWoodLikeDiggingProperties(f->digging_properties, 0.15);
316 f = &content_features(i);
317 f->light_propagates = true;
318 f->param_type = CPT_LIGHT;
319 f->is_ground_content = true;
320 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
321 f->solidness = 0; // drawn separately, makes no faces
322 f->air_equivalent = true; // grass grows underneath
323 f->setInventoryTexture("fence.png");
324 f->used_texturenames["fence.png"] = true;
325 setWoodLikeDiggingProperties(f->digging_properties, 0.75);
328 f = &content_features(i);
329 f->setInventoryTexture("rail.png");
330 f->used_texturenames["rail.png"] = true;
331 f->light_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->solidness = 0; // drawn separately, makes no faces
336 f->air_equivalent = true; // grass grows underneath
338 setDirtLikeDiggingProperties(f->digging_properties, 0.75);
341 f = &content_features(i);
342 f->setInventoryTexture("ladder.png");
343 f->used_texturenames["ladder.png"] = true;
344 f->light_propagates = true;
345 f->param_type = CPT_LIGHT;
346 f->is_ground_content = true;
347 f->dug_item = std::string("MaterialItem ")+itos(i)+" 1";
348 f->wall_mounted = true;
350 f->air_equivalent = true;
353 setWoodLikeDiggingProperties(f->digging_properties, 0.5);
356 i = CONTENT_COALSTONE;
357 f = &content_features(i);
358 f->setAllTextures("stone.png^mineral_coal.png");
359 f->is_ground_content = true;
360 setStoneLikeDiggingProperties(f->digging_properties, 1.5);
363 f = &content_features(i);
364 f->setAllTextures("wood.png");
365 f->setInventoryTextureCube("wood.png", "wood.png", "wood.png");
366 f->is_ground_content = true;
367 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
368 setWoodLikeDiggingProperties(f->digging_properties, 0.75);
371 f = &content_features(i);
372 f->setAllTextures("mese.png");
373 f->setInventoryTextureCube("mese.png", "mese.png", "mese.png");
374 f->is_ground_content = true;
375 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
376 setStoneLikeDiggingProperties(f->digging_properties, 0.5);
379 f = &content_features(i);
380 f->setAllTextures("cloud.png");
381 f->setInventoryTextureCube("cloud.png", "cloud.png", "cloud.png");
382 f->is_ground_content = true;
383 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
386 f = &content_features(i);
387 f->param_type = CPT_LIGHT;
388 f->light_propagates = true;
389 f->sunlight_propagates = true;
392 f->pointable = false;
394 f->buildable_to = true;
395 f->air_equivalent = true;
398 f = &content_features(i);
399 f->setInventoryTextureCube("water.png", "water.png", "water.png");
400 f->param_type = CPT_LIGHT;
401 f->light_propagates = true;
402 f->solidness = 0; // Drawn separately, makes no faces
403 f->visual_solidness = 1;
405 f->pointable = false;
407 f->buildable_to = true;
408 f->liquid_type = LIQUID_FLOWING;
409 f->liquid_alternative_flowing = CONTENT_WATER;
410 f->liquid_alternative_source = CONTENT_WATERSOURCE;
411 f->liquid_viscosity = WATER_VISC;
414 f->vertex_alpha = WATER_ALPHA;
415 f->post_effect_color = video::SColor(64, 100, 100, 200);
416 if(f->special_material == NULL && g_texturesource)
418 // Flowing water material
419 f->special_material = new video::SMaterial;
420 f->special_material->setFlag(video::EMF_LIGHTING, false);
421 f->special_material->setFlag(video::EMF_BACK_FACE_CULLING, false);
422 f->special_material->setFlag(video::EMF_BILINEAR_FILTER, false);
423 f->special_material->setFlag(video::EMF_FOG_ENABLE, true);
425 f->special_material->MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA;
426 AtlasPointer *pa_water1 = new AtlasPointer(g_texturesource->getTexture(
427 g_texturesource->getTextureId("water.png")));
428 f->special_material->setTexture(0, pa_water1->atlas);
430 // Flowing water material, backface culled
431 f->special_material2 = new video::SMaterial;
432 *f->special_material2 = *f->special_material;
433 f->special_material2->setFlag(video::EMF_BACK_FACE_CULLING, true);
435 f->special_atlas = pa_water1;
439 i = CONTENT_WATERSOURCE;
440 f = &content_features(i);
441 //f->setInventoryTexture("water.png");
442 f->setInventoryTextureCube("water.png", "water.png", "water.png");
445 f->solidness = 0; // drawn separately, makes no faces
453 t.texture = g_texturesource->getTexture("water.png");
456 t.alpha = WATER_ALPHA;
457 t.material_type = MATERIAL_ALPHA_VERTEX;
459 t.material_flags &= ~MATERIAL_FLAG_BACKFACE_CULLING;
463 f->param_type = CPT_LIGHT;
464 f->light_propagates = true;
466 f->pointable = false;
468 f->buildable_to = true;
469 f->liquid_type = LIQUID_SOURCE;
470 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
471 f->liquid_alternative_flowing = CONTENT_WATER;
472 f->liquid_alternative_source = CONTENT_WATERSOURCE;
473 f->liquid_viscosity = WATER_VISC;
476 f->vertex_alpha = WATER_ALPHA;
477 f->post_effect_color = video::SColor(64, 100, 100, 200);
478 if(f->special_material == NULL && g_texturesource)
480 // New-style water source material (mostly unused)
481 f->special_material = new video::SMaterial;
482 f->special_material->setFlag(video::EMF_LIGHTING, false);
483 f->special_material->setFlag(video::EMF_BACK_FACE_CULLING, false);
484 f->special_material->setFlag(video::EMF_BILINEAR_FILTER, false);
485 f->special_material->setFlag(video::EMF_FOG_ENABLE, true);
486 f->special_material->MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA;
487 AtlasPointer *pa_water1 = new AtlasPointer(g_texturesource->getTexture(
488 g_texturesource->getTextureId("water.png")));
489 f->special_material->setTexture(0, pa_water1->atlas);
490 f->special_atlas = pa_water1;
495 f = &content_features(i);
496 f->setInventoryTextureCube("lava.png", "lava.png", "lava.png");
497 f->used_texturenames["lava.png"] = true;
498 f->param_type = CPT_LIGHT;
499 f->light_propagates = false;
500 f->light_source = LIGHT_MAX-1;
501 f->solidness = 0; // Drawn separately, makes no faces
502 f->visual_solidness = 1; // Does not completely cover block boundaries
504 f->pointable = false;
506 f->buildable_to = true;
507 f->liquid_type = LIQUID_FLOWING;
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;
513 f->post_effect_color = video::SColor(192, 255, 64, 0);
514 if(f->special_material == NULL && g_texturesource)
516 // Flowing lava material
517 f->special_material = new video::SMaterial;
518 f->special_material->setFlag(video::EMF_LIGHTING, false);
519 f->special_material->setFlag(video::EMF_BACK_FACE_CULLING, false);
520 f->special_material->setFlag(video::EMF_BILINEAR_FILTER, false);
521 f->special_material->setFlag(video::EMF_FOG_ENABLE, true);
522 f->special_material->MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
524 AtlasPointer *pa_lava1 = new AtlasPointer(
525 g_texturesource->getTexture(
526 g_texturesource->getTextureId("lava.png")));
527 f->special_material->setTexture(0, pa_lava1->atlas);
529 // Flowing lava material, backface culled
530 f->special_material2 = new video::SMaterial;
531 *f->special_material2 = *f->special_material;
532 f->special_material2->setFlag(video::EMF_BACK_FACE_CULLING, true);
534 f->special_atlas = pa_lava1;
538 i = CONTENT_LAVASOURCE;
539 f = &content_features(i);
540 f->setInventoryTextureCube("lava.png", "lava.png", "lava.png");
541 f->used_texturenames["ladder.png"] = true;
544 f->solidness = 0; // drawn separately, makes no faces
552 t.texture = g_texturesource->getTexture("lava.png");
555 //t.material_type = MATERIAL_ALPHA_VERTEX;
556 //t.material_flags &= ~MATERIAL_FLAG_BACKFACE_CULLING;
560 f->param_type = CPT_LIGHT;
561 f->light_propagates = false;
562 f->light_source = LIGHT_MAX-1;
564 f->pointable = false;
566 f->buildable_to = true;
567 f->liquid_type = LIQUID_SOURCE;
568 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
569 f->liquid_alternative_flowing = CONTENT_LAVA;
570 f->liquid_alternative_source = CONTENT_LAVASOURCE;
571 f->liquid_viscosity = LAVA_VISC;
572 f->damage_per_second = 4*2;
574 f->post_effect_color = video::SColor(192, 255, 64, 0);
575 if(f->special_material == NULL && g_texturesource)
577 // New-style lava source material (mostly unused)
578 f->special_material = new video::SMaterial;
579 f->special_material->setFlag(video::EMF_LIGHTING, false);
580 f->special_material->setFlag(video::EMF_BACK_FACE_CULLING, false);
581 f->special_material->setFlag(video::EMF_BILINEAR_FILTER, false);
582 f->special_material->setFlag(video::EMF_FOG_ENABLE, true);
583 f->special_material->MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
584 AtlasPointer *pa_lava1 = new AtlasPointer(
585 g_texturesource->getTexture(
586 g_texturesource->getTextureId("lava.png")));
587 f->special_material->setTexture(0, pa_lava1->atlas);
589 f->special_atlas = pa_lava1;
594 f = &content_features(i);
595 f->setInventoryTexture("torch_on_floor.png");
596 f->used_texturenames["torch_on_floor.png"] = true;
597 f->used_texturenames["torch_on_ceiling.png"] = true;
598 f->used_texturenames["torch_on_floor.png"] = true;
599 f->used_texturenames["torch.png"] = true;
600 f->param_type = CPT_LIGHT;
601 f->light_propagates = true;
602 f->sunlight_propagates = true;
603 f->solidness = 0; // drawn separately, makes no faces
605 f->wall_mounted = true;
606 f->air_equivalent = true;
607 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
608 f->light_source = LIGHT_MAX-1;
609 f->digging_properties.set("", DiggingProperties(true, 0.0, 0));
611 i = CONTENT_SIGN_WALL;
612 f = &content_features(i);
613 f->setInventoryTexture("sign_wall.png");
614 f->used_texturenames["sign_wall.png"] = true;
615 f->param_type = CPT_LIGHT;
616 f->light_propagates = true;
617 f->sunlight_propagates = true;
618 f->solidness = 0; // drawn separately, makes no faces
620 f->wall_mounted = true;
621 f->air_equivalent = true;
622 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
623 if(f->initial_metadata == NULL)
624 f->initial_metadata = new SignNodeMetadata("Some sign");
625 f->digging_properties.set("", DiggingProperties(true, 0.5, 0));
628 f = &content_features(i);
629 f->param_type = CPT_FACEDIR_SIMPLE;
630 f->setAllTextures("chest_side.png");
631 f->setTexture(0, "chest_top.png");
632 f->setTexture(1, "chest_top.png");
633 f->setTexture(5, "chest_front.png"); // Z-
634 f->setInventoryTexture("chest_top.png");
635 //f->setInventoryTextureCube("chest_top.png", "chest_side.png", "chest_side.png");
636 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
637 if(f->initial_metadata == NULL)
638 f->initial_metadata = new ChestNodeMetadata();
639 setWoodLikeDiggingProperties(f->digging_properties, 1.0);
641 i = CONTENT_LOCKABLE_CHEST;
642 f = &content_features(i);
643 f->param_type = CPT_FACEDIR_SIMPLE;
644 f->setAllTextures("chest_side.png");
645 f->setTexture(0, "chest_top.png");
646 f->setTexture(1, "chest_top.png");
647 f->setTexture(5, "chest_lock.png"); // Z-
648 f->setInventoryTexture("chest_lock.png");
649 //f->setInventoryTextureCube("chest_top.png", "chest_side.png", "chest_side.png");
650 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
651 if(f->initial_metadata == NULL)
652 f->initial_metadata = new LockingChestNodeMetadata();
653 setWoodLikeDiggingProperties(f->digging_properties, 1.0);
656 f = &content_features(i);
657 f->param_type = CPT_FACEDIR_SIMPLE;
658 f->setAllTextures("furnace_side.png");
659 f->setTexture(5, "furnace_front.png"); // Z-
660 f->setInventoryTexture("furnace_front.png");
661 //f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
662 f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_COBBLE)+" 6";
663 if(f->initial_metadata == NULL)
664 f->initial_metadata = new FurnaceNodeMetadata();
665 setStoneLikeDiggingProperties(f->digging_properties, 3.0);
668 f = &content_features(i);
669 f->setAllTextures("cobble.png");
670 f->setInventoryTextureCube("cobble.png", "cobble.png", "cobble.png");
671 f->param_type = CPT_NONE;
672 f->is_ground_content = true;
673 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
674 setStoneLikeDiggingProperties(f->digging_properties, 0.9);
676 i = CONTENT_MOSSYCOBBLE;
677 f = &content_features(i);
678 f->setAllTextures("mossycobble.png");
679 f->setInventoryTextureCube("mossycobble.png", "mossycobble.png", "mossycobble.png");
680 f->param_type = CPT_NONE;
681 f->is_ground_content = true;
682 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
683 setStoneLikeDiggingProperties(f->digging_properties, 0.8);
686 f = &content_features(i);
687 f->setAllTextures("steel_block.png");
688 f->setInventoryTextureCube("steel_block.png", "steel_block.png",
690 f->param_type = CPT_NONE;
691 f->is_ground_content = true;
692 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
693 setStoneLikeDiggingProperties(f->digging_properties, 5.0);
696 f = &content_features(i);
697 f->param_type = CPT_FACEDIR_SIMPLE;
698 f->setAllTextures("nc_side.png");
699 f->setTexture(5, "nc_front.png"); // Z-
700 f->setTexture(4, "nc_back.png"); // Z+
701 f->setInventoryTexture("nc_front.png");
702 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
703 setStoneLikeDiggingProperties(f->digging_properties, 3.0);
706 f = &content_features(i);
707 f->setAllTextures("nc_rb.png");
708 f->setInventoryTexture("nc_rb.png");
709 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
710 setStoneLikeDiggingProperties(f->digging_properties, 3.0);
713 f = &content_features(i);
714 f->param_type = CPT_LIGHT;
715 f->setAllTextures("sapling.png");
716 f->setInventoryTexture("sapling.png");
717 f->used_texturenames["sapling.png"] = true;
718 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
719 f->light_propagates = true;
720 f->air_equivalent = false;
721 f->solidness = 0; // drawn separately, makes no faces
723 f->digging_properties.set("", DiggingProperties(true, 0.0, 0));
726 f = &content_features(i);
727 f->setInventoryTexture("apple.png");
728 f->used_texturenames["apple.png"] = true;
729 f->param_type = CPT_LIGHT;
730 f->light_propagates = true;
731 f->sunlight_propagates = true;
732 f->solidness = 0; // drawn separately, makes no faces
734 f->air_equivalent = true;
735 f->dug_item = std::string("CraftItem apple 1");
736 f->digging_properties.set("", DiggingProperties(true, 0.0, 0));
738 // NOTE: Remember to add frequently used stuff to the texture atlas in tile.cpp
742 Add MesePick to everything
744 for(u16 i=0; i<=MAX_CONTENT; i++)
746 content_features(i).digging_properties.set("MesePick",
747 DiggingProperties(true, 0.0, 65535./1337));
752 void setStoneLikeDiggingProperties(DiggingPropertiesList &list, float toughness)
755 DiggingProperties(true, 15.0*toughness, 0));
758 DiggingProperties(true, 1.3*toughness, 65535./30.*toughness));
760 DiggingProperties(true, 0.75*toughness, 65535./100.*toughness));
761 list.set("SteelPick",
762 DiggingProperties(true, 0.50*toughness, 65535./333.*toughness));
764 /*list.set("MesePick",
765 DiggingProperties(true, 0.0*toughness, 65535./20.*toughness));*/
768 void setDirtLikeDiggingProperties(DiggingPropertiesList &list, float toughness)
771 DiggingProperties(true, 0.75*toughness, 0));
774 DiggingProperties(true, 0.4*toughness, 65535./50.*toughness));
776 DiggingProperties(true, 0.2*toughness, 65535./150.*toughness));
777 list.set("SteelShovel",
778 DiggingProperties(true, 0.15*toughness, 65535./400.*toughness));
781 void setWoodLikeDiggingProperties(DiggingPropertiesList &list, float toughness)
784 DiggingProperties(true, 3.0*toughness, 0));
787 DiggingProperties(true, 1.5*toughness, 65535./30.*toughness));
789 DiggingProperties(true, 0.75*toughness, 65535./100.*toughness));
791 DiggingProperties(true, 0.5*toughness, 65535./333.*toughness));