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"
28 #define WATER_ALPHA 160
33 // TODO: Get rid of these and set up some attributes like toughness,
34 // fluffyness, and a funciton to calculate time and durability loss
35 // (and sound? and whatever else) from them
36 void setStoneLikeDiggingProperties(DiggingPropertiesList &list, float toughness);
37 void setDirtLikeDiggingProperties(DiggingPropertiesList &list, float toughness);
38 void setWoodLikeDiggingProperties(DiggingPropertiesList &list, float toughness);
41 A conversion table for backwards compatibility.
42 Maps <=v19 content types to current ones.
43 Should never be touched.
45 content_t trans_table_19[21][2] = {
49 {CONTENT_GRASS_FOOTSTEPS, 6},
53 {CONTENT_COALSTONE, 11},
59 {CONTENT_MOSSYCOBBLE, 22},
61 {CONTENT_SANDSTONE, 24},
65 {CONTENT_PAPYRUS, 28},
66 {CONTENT_BOOKSHELF, 29},
69 MapNode mapnode_translate_from_internal(MapNode n_from, u8 version)
71 MapNode result = n_from;
74 content_t c_from = n_from.getContent();
75 for(u32 i=0; i<sizeof(trans_table_19)/sizeof(trans_table_19[0]); i++)
77 if(trans_table_19[i][0] == c_from)
79 result.setContent(trans_table_19[i][1]);
86 MapNode mapnode_translate_to_internal(MapNode n_from, u8 version)
88 MapNode result = n_from;
91 content_t c_from = n_from.getContent();
92 for(u32 i=0; i<sizeof(trans_table_19)/sizeof(trans_table_19[0]); i++)
94 if(trans_table_19[i][1] == c_from)
96 result.setContent(trans_table_19[i][0]);
104 void content_mapnode_init()
106 // Read some settings
107 bool new_style_water = g_settings->getBool("new_style_water");
108 bool new_style_leaves = g_settings->getBool("new_style_leaves");
109 bool invisible_stone = g_settings->getBool("invisible_stone");
112 ContentFeatures *f = NULL;
115 f = &content_features(i);
116 f->setAllTextures("stone.png");
117 f->setInventoryTextureCube("stone.png", "stone.png", "stone.png");
118 f->param_type = CPT_MINERAL;
119 f->is_ground_content = true;
120 f->often_contains_mineral = true;
121 f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_COBBLE)+" 1";
122 setStoneLikeDiggingProperties(f->digging_properties, 1.0);
124 f->solidness = 0; // For debugging, hides regular stone
127 f = &content_features(i);
128 f->setAllTextures("mud.png^grass_side.png");
129 f->setTexture(0, "grass.png");
130 f->setTexture(1, "mud.png");
131 f->param_type = CPT_MINERAL;
132 f->is_ground_content = true;
133 f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_MUD)+" 1";
134 setDirtLikeDiggingProperties(f->digging_properties, 1.0);
136 i = CONTENT_GRASS_FOOTSTEPS;
137 f = &content_features(i);
138 f->setAllTextures("mud.png^grass_side.png");
139 f->setTexture(0, "grass_footsteps.png");
140 f->setTexture(1, "mud.png");
141 f->param_type = CPT_MINERAL;
142 f->is_ground_content = true;
143 f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_MUD)+" 1";
144 setDirtLikeDiggingProperties(f->digging_properties, 1.0);
147 f = &content_features(i);
148 f->setAllTextures("mud.png");
149 f->setInventoryTextureCube("mud.png", "mud.png", "mud.png");
150 f->param_type = CPT_MINERAL;
151 f->is_ground_content = true;
152 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
153 setDirtLikeDiggingProperties(f->digging_properties, 1.0);
156 f = &content_features(i);
157 f->setAllTextures("sand.png");
158 f->setInventoryTextureCube("sand.png", "sand.png", "sand.png");
159 f->param_type = CPT_MINERAL;
160 f->is_ground_content = true;
161 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
162 setDirtLikeDiggingProperties(f->digging_properties, 1.0);
165 f = &content_features(i);
166 f->setAllTextures("gravel.png");
167 f->setInventoryTextureCube("gravel.png", "gravel.png", "gravel.png");
168 f->param_type = CPT_MINERAL;
169 f->is_ground_content = true;
170 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
171 setDirtLikeDiggingProperties(f->digging_properties, 1.75);
173 i = CONTENT_SANDSTONE;
174 f = &content_features(i);
175 f->setAllTextures("sandstone.png");
176 f->setInventoryTextureCube("sandstone.png", "sandstone.png", "sandstone.png");
177 f->param_type = CPT_MINERAL;
178 f->is_ground_content = true;
179 f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_SAND)+" 1";
180 setDirtLikeDiggingProperties(f->digging_properties, 1.0);
183 f = &content_features(i);
184 f->setAllTextures("clay.png");
185 f->setInventoryTextureCube("clay.png", "clay.png", "clay.png");
186 f->param_type = CPT_MINERAL;
187 f->is_ground_content = true;
188 f->dug_item = std::string("CraftItem lump_of_clay 4");
189 setDirtLikeDiggingProperties(f->digging_properties, 1.0);
192 f = &content_features(i);
193 f->setAllTextures("brick.png");
194 f->setInventoryTextureCube("brick.png", "brick.png", "brick.png");
195 f->param_type = CPT_MINERAL;
196 f->is_ground_content = true;
197 f->dug_item = std::string("CraftItem clay_brick 4");
198 setStoneLikeDiggingProperties(f->digging_properties, 1.0);
201 f = &content_features(i);
202 f->setAllTextures("tree.png");
203 f->setTexture(0, "tree_top.png");
204 f->setTexture(1, "tree_top.png");
205 f->param_type = CPT_MINERAL;
206 f->is_ground_content = true;
207 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
208 setWoodLikeDiggingProperties(f->digging_properties, 1.0);
210 i = CONTENT_JUNGLETREE;
211 f = &content_features(i);
212 f->setAllTextures("jungletree.png");
213 f->setTexture(0, "jungletree_top.png");
214 f->setTexture(1, "jungletree_top.png");
215 f->param_type = CPT_MINERAL;
216 //f->is_ground_content = true;
217 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
218 setWoodLikeDiggingProperties(f->digging_properties, 1.0);
220 i = CONTENT_JUNGLEGRASS;
221 f = &content_features(i);
222 f->setInventoryTexture("junglegrass.png");
223 f->light_propagates = true;
224 f->param_type = CPT_LIGHT;
225 //f->is_ground_content = true;
226 f->air_equivalent = false; // grass grows underneath
227 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
228 f->solidness = 0; // drawn separately, makes no faces
230 setWoodLikeDiggingProperties(f->digging_properties, 0.10);
233 f = &content_features(i);
234 f->light_propagates = true;
235 //f->param_type = CPT_MINERAL;
236 f->param_type = CPT_LIGHT;
237 //f->is_ground_content = true;
240 f->solidness = 0; // drawn separately, makes no faces
241 f->visual_solidness = 1;
242 f->setAllTextures("leaves.png");
243 f->setInventoryTextureCube("leaves.png", "leaves.png", "leaves.png");
247 f->setAllTextures("[noalpha:leaves.png");
249 f->extra_dug_item = std::string("MaterialItem2 ")+itos(CONTENT_SAPLING)+" 1";
250 f->extra_dug_item_rarity = 20;
251 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
252 setWoodLikeDiggingProperties(f->digging_properties, 0.15);
255 f = &content_features(i);
256 f->setAllTextures("cactus_side.png");
257 f->setTexture(0, "cactus_top.png");
258 f->setTexture(1, "cactus_top.png");
259 f->setInventoryTextureCube("cactus_top.png", "cactus_side.png", "cactus_side.png");
260 f->param_type = CPT_MINERAL;
261 f->is_ground_content = true;
262 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
263 setWoodLikeDiggingProperties(f->digging_properties, 0.75);
266 f = &content_features(i);
267 f->setInventoryTexture("papyrus.png");
268 f->light_propagates = true;
269 f->param_type = CPT_LIGHT;
270 f->is_ground_content = true;
271 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
272 f->solidness = 0; // drawn separately, makes no faces
274 setWoodLikeDiggingProperties(f->digging_properties, 0.25);
276 i = CONTENT_BOOKSHELF;
277 f = &content_features(i);
278 f->setAllTextures("bookshelf.png");
279 f->setTexture(0, "wood.png");
280 f->setTexture(1, "wood.png");
281 // FIXME: setInventoryTextureCube() only cares for the first texture
282 f->setInventoryTextureCube("bookshelf.png", "bookshelf.png", "bookshelf.png");
283 //f->setInventoryTextureCube("wood.png", "bookshelf.png", "bookshelf.png");
284 f->param_type = CPT_MINERAL;
285 f->is_ground_content = true;
286 setWoodLikeDiggingProperties(f->digging_properties, 0.75);
289 f = &content_features(i);
290 f->light_propagates = true;
291 f->sunlight_propagates = true;
292 f->param_type = CPT_LIGHT;
293 f->is_ground_content = true;
294 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
295 f->solidness = 0; // drawn separately, makes no faces
296 f->visual_solidness = 1;
297 f->setAllTextures("glass.png");
298 f->setInventoryTextureCube("glass.png", "glass.png", "glass.png");
299 setWoodLikeDiggingProperties(f->digging_properties, 0.15);
302 f = &content_features(i);
303 f->light_propagates = true;
304 f->param_type = CPT_LIGHT;
305 f->is_ground_content = true;
306 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
307 f->solidness = 0; // drawn separately, makes no faces
308 f->air_equivalent = true; // grass grows underneath
309 f->setInventoryTexture("fence.png");
310 setWoodLikeDiggingProperties(f->digging_properties, 0.75);
313 f = &content_features(i);
314 f->setInventoryTexture("rail.png");
315 f->light_propagates = true;
316 f->param_type = CPT_LIGHT;
317 f->is_ground_content = true;
318 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
319 f->solidness = 0; // drawn separately, makes no faces
320 f->air_equivalent = true; // grass grows underneath
322 setDirtLikeDiggingProperties(f->digging_properties, 0.75);
325 f = &content_features(i);
326 f->setInventoryTexture("ladder.png");
327 f->light_propagates = true;
328 f->param_type = CPT_LIGHT;
329 f->is_ground_content = true;
330 f->dug_item = std::string("MaterialItem ")+itos(i)+" 1";
331 f->wall_mounted = true;
333 f->air_equivalent = true;
336 setWoodLikeDiggingProperties(f->digging_properties, 0.5);
339 i = CONTENT_COALSTONE;
340 f = &content_features(i);
341 f->setAllTextures("stone.png^mineral_coal.png");
342 f->is_ground_content = true;
343 setStoneLikeDiggingProperties(f->digging_properties, 1.5);
346 f = &content_features(i);
347 f->setAllTextures("wood.png");
348 f->setInventoryTextureCube("wood.png", "wood.png", "wood.png");
349 f->is_ground_content = true;
350 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
351 setWoodLikeDiggingProperties(f->digging_properties, 0.75);
354 f = &content_features(i);
355 f->setAllTextures("mese.png");
356 f->setInventoryTextureCube("mese.png", "mese.png", "mese.png");
357 f->is_ground_content = true;
358 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
359 setStoneLikeDiggingProperties(f->digging_properties, 0.5);
362 f = &content_features(i);
363 f->setAllTextures("cloud.png");
364 f->setInventoryTextureCube("cloud.png", "cloud.png", "cloud.png");
365 f->is_ground_content = true;
366 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
369 f = &content_features(i);
370 f->param_type = CPT_LIGHT;
371 f->light_propagates = true;
372 f->sunlight_propagates = true;
375 f->pointable = false;
377 f->buildable_to = true;
378 f->air_equivalent = true;
381 f = &content_features(i);
382 f->setInventoryTextureCube("water.png", "water.png", "water.png");
383 f->param_type = CPT_LIGHT;
384 f->light_propagates = true;
385 f->solidness = 0; // Drawn separately, makes no faces
386 f->visual_solidness = 1;
388 f->pointable = false;
390 f->buildable_to = true;
391 f->liquid_type = LIQUID_FLOWING;
392 f->liquid_alternative_flowing = CONTENT_WATER;
393 f->liquid_alternative_source = CONTENT_WATERSOURCE;
394 f->liquid_viscosity = WATER_VISC;
396 f->vertex_alpha = WATER_ALPHA;
397 f->post_effect_color = video::SColor(64, 100, 100, 200);
398 if(f->special_material == NULL && g_texturesource)
400 // Flowing water material
401 f->special_material = new video::SMaterial;
402 f->special_material->setFlag(video::EMF_LIGHTING, false);
403 f->special_material->setFlag(video::EMF_BACK_FACE_CULLING, false);
404 f->special_material->setFlag(video::EMF_BILINEAR_FILTER, false);
405 f->special_material->setFlag(video::EMF_FOG_ENABLE, true);
406 f->special_material->MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA;
407 AtlasPointer *pa_water1 = new AtlasPointer(g_texturesource->getTexture(
408 g_texturesource->getTextureId("water.png")));
409 f->special_material->setTexture(0, pa_water1->atlas);
410 f->special_atlas = pa_water1;
414 i = CONTENT_WATERSOURCE;
415 f = &content_features(i);
416 //f->setInventoryTexture("water.png");
417 f->setInventoryTextureCube("water.png", "water.png", "water.png");
420 f->solidness = 0; // drawn separately, makes no faces
428 t.texture = g_texturesource->getTexture("water.png");
430 t.alpha = WATER_ALPHA;
431 t.material_type = MATERIAL_ALPHA_VERTEX;
432 t.material_flags &= ~MATERIAL_FLAG_BACKFACE_CULLING;
436 f->param_type = CPT_LIGHT;
437 f->light_propagates = true;
439 f->pointable = false;
441 f->buildable_to = true;
442 f->liquid_type = LIQUID_SOURCE;
443 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
444 f->liquid_alternative_flowing = CONTENT_WATER;
445 f->liquid_alternative_source = CONTENT_WATERSOURCE;
446 f->liquid_viscosity = WATER_VISC;
448 f->vertex_alpha = WATER_ALPHA;
449 f->post_effect_color = video::SColor(64, 100, 100, 200);
450 if(f->special_material == NULL && g_texturesource)
452 // Flowing water material
453 f->special_material = new video::SMaterial;
454 f->special_material->setFlag(video::EMF_LIGHTING, false);
455 f->special_material->setFlag(video::EMF_BACK_FACE_CULLING, false);
456 f->special_material->setFlag(video::EMF_BILINEAR_FILTER, false);
457 f->special_material->setFlag(video::EMF_FOG_ENABLE, true);
458 f->special_material->MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA;
459 AtlasPointer *pa_water1 = new AtlasPointer(g_texturesource->getTexture(
460 g_texturesource->getTextureId("water.png")));
461 f->special_material->setTexture(0, pa_water1->atlas);
462 f->special_atlas = pa_water1;
467 f = &content_features(i);
468 f->setInventoryTextureCube("lava.png", "lava.png", "lava.png");
469 f->param_type = CPT_LIGHT;
470 f->light_propagates = false;
471 f->light_source = LIGHT_MAX-1;
472 f->solidness = 0; // Drawn separately, makes no faces
473 f->visual_solidness = 2;
475 f->pointable = false;
477 f->buildable_to = true;
478 f->liquid_type = LIQUID_FLOWING;
479 f->liquid_alternative_flowing = CONTENT_LAVA;
480 f->liquid_alternative_source = CONTENT_LAVASOURCE;
481 f->liquid_viscosity = LAVA_VISC;
482 f->damage_per_second = 4*2;
484 f->post_effect_color = video::SColor(192, 255, 64, 0);
485 if(f->special_material == NULL && g_texturesource)
487 // Flowing lava material
488 f->special_material = new video::SMaterial;
489 f->special_material->setFlag(video::EMF_LIGHTING, false);
490 f->special_material->setFlag(video::EMF_BACK_FACE_CULLING, false);
491 f->special_material->setFlag(video::EMF_BILINEAR_FILTER, false);
492 f->special_material->setFlag(video::EMF_FOG_ENABLE, true);
493 f->special_material->MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
494 AtlasPointer *pa_lava1 = new AtlasPointer(
495 g_texturesource->getTexture(
496 g_texturesource->getTextureId("lava.png")));
497 f->special_material->setTexture(0, pa_lava1->atlas);
498 f->special_atlas = pa_lava1;
502 i = CONTENT_LAVASOURCE;
503 f = &content_features(i);
504 f->setInventoryTextureCube("lava.png", "lava.png", "lava.png");
507 f->solidness = 0; // drawn separately, makes no faces
515 t.texture = g_texturesource->getTexture("lava.png");
518 //t.material_type = MATERIAL_ALPHA_VERTEX;
519 //t.material_flags &= ~MATERIAL_FLAG_BACKFACE_CULLING;
523 f->param_type = CPT_LIGHT;
524 f->light_propagates = false;
525 f->light_source = LIGHT_MAX-1;
527 f->pointable = false;
529 f->buildable_to = true;
530 f->liquid_type = LIQUID_SOURCE;
531 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
532 f->liquid_alternative_flowing = CONTENT_LAVA;
533 f->liquid_alternative_source = CONTENT_LAVASOURCE;
534 f->liquid_viscosity = LAVA_VISC;
535 f->damage_per_second = 4*2;
537 f->post_effect_color = video::SColor(192, 255, 64, 0);
538 if(f->special_material == NULL && g_texturesource)
540 // Flowing lava material
541 f->special_material = new video::SMaterial;
542 f->special_material->setFlag(video::EMF_LIGHTING, false);
543 f->special_material->setFlag(video::EMF_BACK_FACE_CULLING, false);
544 f->special_material->setFlag(video::EMF_BILINEAR_FILTER, false);
545 f->special_material->setFlag(video::EMF_FOG_ENABLE, true);
546 f->special_material->MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
547 AtlasPointer *pa_lava1 = new AtlasPointer(
548 g_texturesource->getTexture(
549 g_texturesource->getTextureId("lava.png")));
550 f->special_material->setTexture(0, pa_lava1->atlas);
551 f->special_atlas = pa_lava1;
556 f = &content_features(i);
557 f->setInventoryTexture("torch_on_floor.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 f->light_source = LIGHT_MAX-1;
567 f->digging_properties.set("", DiggingProperties(true, 0.0, 0));
569 i = CONTENT_SIGN_WALL;
570 f = &content_features(i);
571 f->setInventoryTexture("sign_wall.png");
572 f->param_type = CPT_LIGHT;
573 f->light_propagates = true;
574 f->sunlight_propagates = true;
575 f->solidness = 0; // drawn separately, makes no faces
577 f->wall_mounted = true;
578 f->air_equivalent = true;
579 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
580 if(f->initial_metadata == NULL)
581 f->initial_metadata = new SignNodeMetadata("Some sign");
582 f->digging_properties.set("", DiggingProperties(true, 0.5, 0));
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_front.png"); // Z-
591 f->setInventoryTexture("chest_top.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 ChestNodeMetadata();
596 setWoodLikeDiggingProperties(f->digging_properties, 1.0);
598 i = CONTENT_LOCKABLE_CHEST;
599 f = &content_features(i);
600 f->param_type = CPT_FACEDIR_SIMPLE;
601 f->setAllTextures("chest_side.png");
602 f->setTexture(0, "chest_top.png");
603 f->setTexture(1, "chest_top.png");
604 f->setTexture(5, "chest_lock.png"); // Z-
605 f->setInventoryTexture("chest_lock.png");
606 //f->setInventoryTextureCube("chest_top.png", "chest_side.png", "chest_side.png");
607 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
608 if(f->initial_metadata == NULL)
609 f->initial_metadata = new LockingChestNodeMetadata();
610 setWoodLikeDiggingProperties(f->digging_properties, 1.0);
613 f = &content_features(i);
614 f->param_type = CPT_FACEDIR_SIMPLE;
615 f->setAllTextures("furnace_side.png");
616 f->setTexture(5, "furnace_front.png"); // Z-
617 f->setInventoryTexture("furnace_front.png");
618 //f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
619 f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_COBBLE)+" 6";
620 if(f->initial_metadata == NULL)
621 f->initial_metadata = new FurnaceNodeMetadata();
622 setStoneLikeDiggingProperties(f->digging_properties, 3.0);
625 f = &content_features(i);
626 f->setAllTextures("cobble.png");
627 f->setInventoryTextureCube("cobble.png", "cobble.png", "cobble.png");
628 f->param_type = CPT_NONE;
629 f->is_ground_content = true;
630 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
631 setStoneLikeDiggingProperties(f->digging_properties, 0.9);
633 i = CONTENT_MOSSYCOBBLE;
634 f = &content_features(i);
635 f->setAllTextures("mossycobble.png");
636 f->setInventoryTextureCube("mossycobble.png", "mossycobble.png", "mossycobble.png");
637 f->param_type = CPT_NONE;
638 f->is_ground_content = true;
639 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
640 setStoneLikeDiggingProperties(f->digging_properties, 0.8);
643 f = &content_features(i);
644 f->setAllTextures("steel_block.png");
645 f->setInventoryTextureCube("steel_block.png", "steel_block.png",
647 f->param_type = CPT_NONE;
648 f->is_ground_content = true;
649 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
650 setStoneLikeDiggingProperties(f->digging_properties, 5.0);
653 f = &content_features(i);
654 f->param_type = CPT_FACEDIR_SIMPLE;
655 f->setAllTextures("nc_side.png");
656 f->setTexture(5, "nc_front.png"); // Z-
657 f->setTexture(4, "nc_back.png"); // Z+
658 f->setInventoryTexture("nc_front.png");
659 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
660 setStoneLikeDiggingProperties(f->digging_properties, 3.0);
663 f = &content_features(i);
664 f->setAllTextures("nc_rb.png");
665 f->setInventoryTexture("nc_rb.png");
666 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
667 setStoneLikeDiggingProperties(f->digging_properties, 3.0);
670 f = &content_features(i);
671 f->param_type = CPT_LIGHT;
672 f->setAllTextures("sapling.png");
673 f->setInventoryTexture("sapling.png");
674 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
675 f->light_propagates = true;
676 f->air_equivalent = false;
677 f->solidness = 0; // drawn separately, makes no faces
679 f->digging_properties.set("", DiggingProperties(true, 0.0, 0));
682 f = &content_features(i);
683 f->setInventoryTexture("apple.png");
684 f->param_type = CPT_LIGHT;
685 f->light_propagates = true;
686 f->sunlight_propagates = true;
687 f->solidness = 0; // drawn separately, makes no faces
689 f->air_equivalent = true;
690 f->dug_item = std::string("CraftItem apple 1");
691 f->digging_properties.set("", DiggingProperties(true, 0.0, 0));
693 // NOTE: Remember to add frequently used stuff to the texture atlas in tile.cpp
697 Add MesePick to everything
699 for(u16 i=0; i<=MAX_CONTENT; i++)
701 content_features(i).digging_properties.set("MesePick",
702 DiggingProperties(true, 0.0, 65535./1337));
707 void setStoneLikeDiggingProperties(DiggingPropertiesList &list, float toughness)
710 DiggingProperties(true, 15.0*toughness, 0));
713 DiggingProperties(true, 1.3*toughness, 65535./30.*toughness));
715 DiggingProperties(true, 0.75*toughness, 65535./100.*toughness));
716 list.set("SteelPick",
717 DiggingProperties(true, 0.50*toughness, 65535./333.*toughness));
719 /*list.set("MesePick",
720 DiggingProperties(true, 0.0*toughness, 65535./20.*toughness));*/
723 void setDirtLikeDiggingProperties(DiggingPropertiesList &list, float toughness)
726 DiggingProperties(true, 0.75*toughness, 0));
729 DiggingProperties(true, 0.4*toughness, 65535./50.*toughness));
731 DiggingProperties(true, 0.2*toughness, 65535./150.*toughness));
732 list.set("SteelShovel",
733 DiggingProperties(true, 0.15*toughness, 65535./400.*toughness));
736 void setWoodLikeDiggingProperties(DiggingPropertiesList &list, float toughness)
739 DiggingProperties(true, 3.0*toughness, 0));
742 DiggingProperties(true, 1.5*toughness, 65535./30.*toughness));
744 DiggingProperties(true, 0.75*toughness, 65535./100.*toughness));
746 DiggingProperties(true, 0.5*toughness, 65535./333.*toughness));