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 #define WATER_ALPHA 160
32 // TODO: Get rid of these and set up some attributes like toughness,
33 // fluffyness, and a funciton to calculate time and durability loss
34 // (and sound? and whatever else) from them
35 void setStoneLikeDiggingProperties(DiggingPropertiesList &list, float toughness);
36 void setDirtLikeDiggingProperties(DiggingPropertiesList &list, float toughness);
37 void setWoodLikeDiggingProperties(DiggingPropertiesList &list, float toughness);
40 A conversion table for backwards compatibility.
41 Maps <=v19 content types to current ones.
42 Should never be touched.
44 content_t trans_table_19[21][2] = {
48 {CONTENT_GRASS_FOOTSTEPS, 6},
52 {CONTENT_COALSTONE, 11},
58 {CONTENT_MOSSYCOBBLE, 22},
60 {CONTENT_SANDSTONE, 24},
64 {CONTENT_PAPYRUS, 28},
65 {CONTENT_BOOKSHELF, 29},
68 MapNode mapnode_translate_from_internal(MapNode n_from, u8 version)
70 MapNode result = n_from;
73 content_t c_from = n_from.getContent();
74 for(u32 i=0; i<sizeof(trans_table_19)/sizeof(trans_table_19[0]); i++)
76 if(trans_table_19[i][0] == c_from)
78 result.setContent(trans_table_19[i][1]);
85 MapNode mapnode_translate_to_internal(MapNode n_from, u8 version)
87 MapNode result = n_from;
90 content_t c_from = n_from.getContent();
91 for(u32 i=0; i<sizeof(trans_table_19)/sizeof(trans_table_19[0]); i++)
93 if(trans_table_19[i][1] == c_from)
95 result.setContent(trans_table_19[i][0]);
103 void content_mapnode_init()
105 // Read some settings
106 bool new_style_water = g_settings.getBool("new_style_water");
107 bool new_style_leaves = g_settings.getBool("new_style_leaves");
108 bool invisible_stone = g_settings.getBool("invisible_stone");
111 ContentFeatures *f = NULL;
114 f = &content_features(i);
115 f->setAllTextures("stone.png");
116 f->setInventoryTextureCube("stone.png", "stone.png", "stone.png");
117 f->param_type = CPT_MINERAL;
118 f->is_ground_content = true;
119 f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_COBBLE)+" 1";
120 setStoneLikeDiggingProperties(f->digging_properties, 1.0);
122 f->solidness = 0; // For debugging, hides regular stone
125 f = &content_features(i);
126 f->setAllTextures("mud.png^grass_side.png");
127 f->setTexture(0, "grass.png");
128 f->setTexture(1, "mud.png");
129 f->param_type = CPT_MINERAL;
130 f->is_ground_content = true;
131 f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_MUD)+" 1";
132 setDirtLikeDiggingProperties(f->digging_properties, 1.0);
134 i = CONTENT_GRASS_FOOTSTEPS;
135 f = &content_features(i);
136 f->setAllTextures("mud.png^grass_side.png");
137 f->setTexture(0, "grass_footsteps.png");
138 f->setTexture(1, "mud.png");
139 f->param_type = CPT_MINERAL;
140 f->is_ground_content = true;
141 f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_MUD)+" 1";
142 setDirtLikeDiggingProperties(f->digging_properties, 1.0);
145 f = &content_features(i);
146 f->setAllTextures("mud.png");
147 f->setInventoryTextureCube("mud.png", "mud.png", "mud.png");
148 f->param_type = CPT_MINERAL;
149 f->is_ground_content = true;
150 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
151 setDirtLikeDiggingProperties(f->digging_properties, 1.0);
154 f = &content_features(i);
155 f->setAllTextures("sand.png");
156 f->setInventoryTextureCube("sand.png", "sand.png", "sand.png");
157 f->param_type = CPT_MINERAL;
158 f->is_ground_content = true;
159 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
160 setDirtLikeDiggingProperties(f->digging_properties, 1.0);
163 f = &content_features(i);
164 f->setAllTextures("gravel.png");
165 f->setInventoryTextureCube("gravel.png", "gravel.png", "gravel.png");
166 f->param_type = CPT_MINERAL;
167 f->is_ground_content = true;
168 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
169 setDirtLikeDiggingProperties(f->digging_properties, 1.75);
171 i = CONTENT_SANDSTONE;
172 f = &content_features(i);
173 f->setAllTextures("sandstone.png");
174 f->setInventoryTextureCube("sandstone.png", "sandstone.png", "sandstone.png");
175 f->param_type = CPT_MINERAL;
176 f->is_ground_content = true;
177 f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_SAND)+" 1";
178 setDirtLikeDiggingProperties(f->digging_properties, 1.0);
181 f = &content_features(i);
182 f->setAllTextures("clay.png");
183 f->setInventoryTextureCube("clay.png", "clay.png", "clay.png");
184 f->param_type = CPT_MINERAL;
185 f->is_ground_content = true;
186 f->dug_item = std::string("CraftItem lump_of_clay 4");
187 setDirtLikeDiggingProperties(f->digging_properties, 1.0);
190 f = &content_features(i);
191 f->setAllTextures("brick.png");
192 f->setInventoryTextureCube("brick.png", "brick.png", "brick.png");
193 f->param_type = CPT_MINERAL;
194 f->is_ground_content = true;
195 f->dug_item = std::string("CraftItem clay_brick 4");
196 setStoneLikeDiggingProperties(f->digging_properties, 1.0);
199 f = &content_features(i);
200 f->setAllTextures("tree.png");
201 f->setTexture(0, "tree_top.png");
202 f->setTexture(1, "tree_top.png");
203 f->param_type = CPT_MINERAL;
204 f->is_ground_content = true;
205 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
206 setWoodLikeDiggingProperties(f->digging_properties, 1.0);
208 i = CONTENT_JUNGLETREE;
209 f = &content_features(i);
210 f->setAllTextures("jungletree.png");
211 f->setTexture(0, "jungletree_top.png");
212 f->setTexture(1, "jungletree_top.png");
213 f->param_type = CPT_MINERAL;
214 //f->is_ground_content = true;
215 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
216 setWoodLikeDiggingProperties(f->digging_properties, 1.0);
218 i = CONTENT_JUNGLEGRASS;
219 f = &content_features(i);
220 f->setInventoryTexture("junglegrass.png");
221 f->light_propagates = true;
222 f->param_type = CPT_LIGHT;
223 //f->is_ground_content = true;
224 f->air_equivalent = false; // grass grows underneath
225 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
226 f->solidness = 0; // drawn separately, makes no faces
228 setWoodLikeDiggingProperties(f->digging_properties, 0.10);
231 f = &content_features(i);
232 f->light_propagates = true;
233 //f->param_type = CPT_MINERAL;
234 f->param_type = CPT_LIGHT;
235 //f->is_ground_content = true;
238 f->solidness = 0; // drawn separately, makes no faces
239 f->visual_solidness = 1;
240 f->setAllTextures("leaves.png");
241 f->setInventoryTextureCube("leaves.png", "leaves.png", "leaves.png");
245 f->setAllTextures("[noalpha:leaves.png");
247 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
248 setWoodLikeDiggingProperties(f->digging_properties, 0.15);
251 f = &content_features(i);
252 f->setAllTextures("cactus_side.png");
253 f->setTexture(0, "cactus_top.png");
254 f->setTexture(1, "cactus_top.png");
255 f->setInventoryTextureCube("cactus_top.png", "cactus_side.png", "cactus_side.png");
256 f->param_type = CPT_MINERAL;
257 f->is_ground_content = true;
258 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
259 setWoodLikeDiggingProperties(f->digging_properties, 0.75);
262 f = &content_features(i);
263 f->setInventoryTexture("papyrus.png");
264 f->light_propagates = true;
265 f->param_type = CPT_LIGHT;
266 f->is_ground_content = true;
267 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
268 f->solidness = 0; // drawn separately, makes no faces
270 setWoodLikeDiggingProperties(f->digging_properties, 0.25);
272 i = CONTENT_BOOKSHELF;
273 f = &content_features(i);
274 f->setAllTextures("bookshelf.png");
275 f->setTexture(0, "wood.png");
276 f->setTexture(1, "wood.png");
277 // FIXME: setInventoryTextureCube() only cares for the first texture
278 f->setInventoryTextureCube("bookshelf.png", "bookshelf.png", "bookshelf.png");
279 //f->setInventoryTextureCube("wood.png", "bookshelf.png", "bookshelf.png");
280 f->param_type = CPT_MINERAL;
281 f->is_ground_content = true;
282 setWoodLikeDiggingProperties(f->digging_properties, 0.75);
285 f = &content_features(i);
286 f->light_propagates = true;
287 f->sunlight_propagates = true;
288 f->param_type = CPT_LIGHT;
289 f->is_ground_content = true;
290 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
291 f->solidness = 0; // drawn separately, makes no faces
292 f->visual_solidness = 1;
293 f->setAllTextures("glass.png");
294 f->setInventoryTextureCube("glass.png", "glass.png", "glass.png");
295 setWoodLikeDiggingProperties(f->digging_properties, 0.15);
298 f = &content_features(i);
299 f->light_propagates = true;
300 f->param_type = CPT_LIGHT;
301 f->is_ground_content = true;
302 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
303 f->solidness = 0; // drawn separately, makes no faces
304 f->air_equivalent = true; // grass grows underneath
305 f->setInventoryTexture("fence.png");
306 setWoodLikeDiggingProperties(f->digging_properties, 0.75);
309 f = &content_features(i);
310 f->setInventoryTexture("rail.png");
311 f->light_propagates = true;
312 f->param_type = CPT_LIGHT;
313 f->is_ground_content = true;
314 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
315 f->solidness = 0; // drawn separately, makes no faces
316 f->air_equivalent = true; // grass grows underneath
318 setDirtLikeDiggingProperties(f->digging_properties, 0.75);
321 f = &content_features(i);
322 f->setInventoryTexture("ladder.png");
323 f->light_propagates = true;
324 f->param_type = CPT_LIGHT;
325 f->is_ground_content = true;
326 f->dug_item = std::string("MaterialItem ")+itos(i)+" 1";
327 f->wall_mounted = true;
329 f->air_equivalent = true;
332 setWoodLikeDiggingProperties(f->digging_properties, 0.5);
335 i = CONTENT_COALSTONE;
336 f = &content_features(i);
337 f->setAllTextures("stone.png^mineral_coal.png");
338 f->is_ground_content = true;
339 setStoneLikeDiggingProperties(f->digging_properties, 1.5);
342 f = &content_features(i);
343 f->setAllTextures("wood.png");
344 f->setInventoryTextureCube("wood.png", "wood.png", "wood.png");
345 f->is_ground_content = true;
346 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
347 setWoodLikeDiggingProperties(f->digging_properties, 0.75);
350 f = &content_features(i);
351 f->setAllTextures("mese.png");
352 f->setInventoryTextureCube("mese.png", "mese.png", "mese.png");
353 f->is_ground_content = true;
354 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
355 setStoneLikeDiggingProperties(f->digging_properties, 0.5);
358 f = &content_features(i);
359 f->setAllTextures("cloud.png");
360 f->setInventoryTextureCube("cloud.png", "cloud.png", "cloud.png");
361 f->is_ground_content = true;
362 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
365 f = &content_features(i);
366 f->param_type = CPT_LIGHT;
367 f->light_propagates = true;
368 f->sunlight_propagates = true;
371 f->pointable = false;
373 f->buildable_to = true;
374 f->air_equivalent = true;
377 f = &content_features(i);
378 f->setInventoryTextureCube("water.png", "water.png", "water.png");
379 f->param_type = CPT_LIGHT;
380 f->light_propagates = true;
381 f->solidness = 0; // Drawn separately, makes no faces
382 f->visual_solidness = 1;
384 f->pointable = false;
386 f->buildable_to = true;
387 f->liquid_type = LIQUID_FLOWING;
388 f->liquid_alternative_flowing = CONTENT_WATER;
389 f->liquid_alternative_source = CONTENT_WATERSOURCE;
390 f->liquid_viscosity = WATER_VISC;
391 f->vertex_alpha = WATER_ALPHA;
392 f->post_effect_color = video::SColor(64, 100, 100, 200);
393 if(f->special_material == NULL && g_texturesource)
395 // Flowing water material
396 f->special_material = new video::SMaterial;
397 f->special_material->setFlag(video::EMF_LIGHTING, false);
398 f->special_material->setFlag(video::EMF_BACK_FACE_CULLING, false);
399 f->special_material->setFlag(video::EMF_BILINEAR_FILTER, false);
400 f->special_material->setFlag(video::EMF_FOG_ENABLE, true);
401 f->special_material->MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA;
402 AtlasPointer *pa_water1 = new AtlasPointer(g_texturesource->getTexture(
403 g_texturesource->getTextureId("water.png")));
404 f->special_material->setTexture(0, pa_water1->atlas);
405 f->special_atlas = pa_water1;
408 i = CONTENT_WATERSOURCE;
409 f = &content_features(i);
410 //f->setInventoryTexture("water.png");
411 f->setInventoryTextureCube("water.png", "water.png", "water.png");
414 f->solidness = 0; // drawn separately, makes no faces
422 t.texture = g_texturesource->getTexture("water.png");
424 t.alpha = WATER_ALPHA;
425 t.material_type = MATERIAL_ALPHA_VERTEX;
426 t.material_flags &= ~MATERIAL_FLAG_BACKFACE_CULLING;
429 f->param_type = CPT_LIGHT;
430 f->light_propagates = true;
432 f->pointable = false;
434 f->buildable_to = true;
435 f->liquid_type = LIQUID_SOURCE;
436 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
437 f->liquid_alternative_flowing = CONTENT_WATER;
438 f->liquid_alternative_source = CONTENT_WATERSOURCE;
439 f->liquid_viscosity = WATER_VISC;
440 f->vertex_alpha = WATER_ALPHA;
441 f->post_effect_color = video::SColor(64, 100, 100, 200);
442 if(f->special_material == NULL && g_texturesource)
444 // Flowing water material
445 f->special_material = new video::SMaterial;
446 f->special_material->setFlag(video::EMF_LIGHTING, false);
447 f->special_material->setFlag(video::EMF_BACK_FACE_CULLING, false);
448 f->special_material->setFlag(video::EMF_BILINEAR_FILTER, false);
449 f->special_material->setFlag(video::EMF_FOG_ENABLE, true);
450 f->special_material->MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA;
451 AtlasPointer *pa_water1 = new AtlasPointer(g_texturesource->getTexture(
452 g_texturesource->getTextureId("water.png")));
453 f->special_material->setTexture(0, pa_water1->atlas);
454 f->special_atlas = pa_water1;
458 f = &content_features(i);
459 f->setInventoryTextureCube("lava.png", "lava.png", "lava.png");
460 f->param_type = CPT_LIGHT;
461 f->light_propagates = false;
462 f->light_source = LIGHT_MAX-1;
463 f->solidness = 0; // Drawn separately, makes no faces
464 f->visual_solidness = 2;
466 f->pointable = false;
468 f->buildable_to = true;
469 f->liquid_type = LIQUID_FLOWING;
470 f->liquid_alternative_flowing = CONTENT_LAVA;
471 f->liquid_alternative_source = CONTENT_LAVASOURCE;
472 f->liquid_viscosity = LAVA_VISC;
473 f->damage_per_second = 4*2;
474 f->post_effect_color = video::SColor(192, 255, 64, 0);
475 if(f->special_material == NULL && g_texturesource)
477 // Flowing lava material
478 f->special_material = new video::SMaterial;
479 f->special_material->setFlag(video::EMF_LIGHTING, false);
480 f->special_material->setFlag(video::EMF_BACK_FACE_CULLING, false);
481 f->special_material->setFlag(video::EMF_BILINEAR_FILTER, false);
482 f->special_material->setFlag(video::EMF_FOG_ENABLE, true);
483 f->special_material->MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
484 AtlasPointer *pa_lava1 = new AtlasPointer(
485 g_texturesource->getTexture(
486 g_texturesource->getTextureId("lava.png")));
487 f->special_material->setTexture(0, pa_lava1->atlas);
488 f->special_atlas = pa_lava1;
491 i = CONTENT_LAVASOURCE;
492 f = &content_features(i);
493 f->setInventoryTextureCube("lava.png", "lava.png", "lava.png");
496 f->solidness = 0; // drawn separately, makes no faces
504 t.texture = g_texturesource->getTexture("lava.png");
507 //t.material_type = MATERIAL_ALPHA_VERTEX;
508 //t.material_flags &= ~MATERIAL_FLAG_BACKFACE_CULLING;
511 f->param_type = CPT_LIGHT;
512 f->light_propagates = false;
513 f->light_source = LIGHT_MAX-1;
515 f->pointable = false;
517 f->buildable_to = true;
518 f->liquid_type = LIQUID_SOURCE;
519 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
520 f->liquid_alternative_flowing = CONTENT_LAVA;
521 f->liquid_alternative_source = CONTENT_LAVASOURCE;
522 f->liquid_viscosity = LAVA_VISC;
523 f->damage_per_second = 4*2;
524 f->post_effect_color = video::SColor(192, 255, 64, 0);
525 if(f->special_material == NULL && g_texturesource)
527 // Flowing lava material
528 f->special_material = new video::SMaterial;
529 f->special_material->setFlag(video::EMF_LIGHTING, false);
530 f->special_material->setFlag(video::EMF_BACK_FACE_CULLING, false);
531 f->special_material->setFlag(video::EMF_BILINEAR_FILTER, false);
532 f->special_material->setFlag(video::EMF_FOG_ENABLE, true);
533 f->special_material->MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
534 AtlasPointer *pa_lava1 = new AtlasPointer(
535 g_texturesource->getTexture(
536 g_texturesource->getTextureId("lava.png")));
537 f->special_material->setTexture(0, pa_lava1->atlas);
538 f->special_atlas = pa_lava1;
542 f = &content_features(i);
543 f->setInventoryTexture("torch_on_floor.png");
544 f->param_type = CPT_LIGHT;
545 f->light_propagates = true;
546 f->sunlight_propagates = true;
547 f->solidness = 0; // drawn separately, makes no faces
549 f->wall_mounted = true;
550 f->air_equivalent = true;
551 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
552 f->light_source = LIGHT_MAX-1;
553 f->digging_properties.set("", DiggingProperties(true, 0.0, 0));
555 i = CONTENT_SIGN_WALL;
556 f = &content_features(i);
557 f->setInventoryTexture("sign_wall.png");
558 f->param_type = CPT_LIGHT;
559 f->light_propagates = true;
560 f->sunlight_propagates = true;
561 f->solidness = 0; // drawn separately, makes no faces
563 f->wall_mounted = true;
564 f->air_equivalent = true;
565 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
566 if(f->initial_metadata == NULL)
567 f->initial_metadata = new SignNodeMetadata("Some sign");
568 f->digging_properties.set("", DiggingProperties(true, 0.5, 0));
571 f = &content_features(i);
572 f->param_type = CPT_FACEDIR_SIMPLE;
573 f->setAllTextures("chest_side.png");
574 f->setTexture(0, "chest_top.png");
575 f->setTexture(1, "chest_top.png");
576 f->setTexture(5, "chest_front.png"); // Z-
577 f->setInventoryTexture("chest_top.png");
578 //f->setInventoryTextureCube("chest_top.png", "chest_side.png", "chest_side.png");
579 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
580 if(f->initial_metadata == NULL)
581 f->initial_metadata = new ChestNodeMetadata();
582 setWoodLikeDiggingProperties(f->digging_properties, 1.0);
584 i = CONTENT_LOCKABLE_CHEST;
585 f = &content_features(i);
586 f->param_type = CPT_FACEDIR_SIMPLE;
587 f->setAllTextures("chest_side.png");
588 f->setTexture(0, "chest_top.png");
589 f->setTexture(1, "chest_top.png");
590 f->setTexture(5, "chest_lock.png"); // Z-
591 f->setInventoryTexture("chest_lock.png");
592 //f->setInventoryTextureCube("chest_top.png", "chest_side.png", "chest_side.png");
593 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
594 if(f->initial_metadata == NULL)
595 f->initial_metadata = new LockingChestNodeMetadata();
596 setWoodLikeDiggingProperties(f->digging_properties, 1.0);
599 f = &content_features(i);
600 f->param_type = CPT_FACEDIR_SIMPLE;
601 f->setAllTextures("furnace_side.png");
602 f->setTexture(5, "furnace_front.png"); // Z-
603 f->setInventoryTexture("furnace_front.png");
604 //f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
605 f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_COBBLE)+" 6";
606 if(f->initial_metadata == NULL)
607 f->initial_metadata = new FurnaceNodeMetadata();
608 setStoneLikeDiggingProperties(f->digging_properties, 3.0);
611 f = &content_features(i);
612 f->setAllTextures("cobble.png");
613 f->setInventoryTextureCube("cobble.png", "cobble.png", "cobble.png");
614 f->param_type = CPT_NONE;
615 f->is_ground_content = true;
616 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
617 setStoneLikeDiggingProperties(f->digging_properties, 0.9);
619 i = CONTENT_MOSSYCOBBLE;
620 f = &content_features(i);
621 f->setAllTextures("mossycobble.png");
622 f->setInventoryTextureCube("mossycobble.png", "mossycobble.png", "mossycobble.png");
623 f->param_type = CPT_NONE;
624 f->is_ground_content = true;
625 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
626 setStoneLikeDiggingProperties(f->digging_properties, 0.8);
629 f = &content_features(i);
630 f->setAllTextures("steel_block.png");
631 f->setInventoryTextureCube("steel_block.png", "steel_block.png",
633 f->param_type = CPT_NONE;
634 f->is_ground_content = true;
635 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
636 setStoneLikeDiggingProperties(f->digging_properties, 5.0);
639 f = &content_features(i);
640 f->param_type = CPT_FACEDIR_SIMPLE;
641 f->setAllTextures("nc_side.png");
642 f->setTexture(5, "nc_front.png"); // Z-
643 f->setTexture(4, "nc_back.png"); // Z+
644 f->setInventoryTexture("nc_front.png");
645 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
646 setStoneLikeDiggingProperties(f->digging_properties, 3.0);
649 f = &content_features(i);
650 f->setAllTextures("nc_rb.png");
651 f->setInventoryTexture("nc_rb.png");
652 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
653 setStoneLikeDiggingProperties(f->digging_properties, 3.0);
656 f = &content_features(i);
657 f->setInventoryTexture("apple.png");
658 f->param_type = CPT_LIGHT;
659 f->light_propagates = true;
660 f->sunlight_propagates = true;
661 f->solidness = 0; // drawn separately, makes no faces
663 f->air_equivalent = true;
664 f->dug_item = std::string("CraftItem apple 1");
665 f->digging_properties.set("", DiggingProperties(true, 0.0, 0));
667 // NOTE: Remember to add frequently used stuff to the texture atlas in tile.cpp
671 Add MesePick to everything
673 for(u16 i=0; i<=MAX_CONTENT; i++)
675 content_features(i).digging_properties.set("MesePick",
676 DiggingProperties(true, 0.0, 65535./1337));
681 void setStoneLikeDiggingProperties(DiggingPropertiesList &list, float toughness)
684 DiggingProperties(true, 15.0*toughness, 0));
687 DiggingProperties(true, 1.3*toughness, 65535./30.*toughness));
689 DiggingProperties(true, 0.75*toughness, 65535./100.*toughness));
690 list.set("SteelPick",
691 DiggingProperties(true, 0.50*toughness, 65535./333.*toughness));
693 /*list.set("MesePick",
694 DiggingProperties(true, 0.0*toughness, 65535./20.*toughness));*/
697 void setDirtLikeDiggingProperties(DiggingPropertiesList &list, float toughness)
700 DiggingProperties(true, 0.75*toughness, 0));
703 DiggingProperties(true, 0.4*toughness, 65535./50.*toughness));
705 DiggingProperties(true, 0.2*toughness, 65535./150.*toughness));
706 list.set("SteelShovel",
707 DiggingProperties(true, 0.15*toughness, 65535./400.*toughness));
710 void setWoodLikeDiggingProperties(DiggingPropertiesList &list, float toughness)
713 DiggingProperties(true, 3.0*toughness, 0));
716 DiggingProperties(true, 1.5*toughness, 65535./30.*toughness));
718 DiggingProperties(true, 0.75*toughness, 65535./100.*toughness));
720 DiggingProperties(true, 0.5*toughness, 65535./333.*toughness));