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->extra_dug_item = std::string("MaterialItem2 ")+itos(CONTENT_SAPLING)+" 1";
248 f->extra_dug_item_rarity = 20;
249 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
250 setWoodLikeDiggingProperties(f->digging_properties, 0.15);
253 f = &content_features(i);
254 f->setAllTextures("cactus_side.png");
255 f->setTexture(0, "cactus_top.png");
256 f->setTexture(1, "cactus_top.png");
257 f->setInventoryTextureCube("cactus_top.png", "cactus_side.png", "cactus_side.png");
258 f->param_type = CPT_MINERAL;
259 f->is_ground_content = true;
260 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
261 setWoodLikeDiggingProperties(f->digging_properties, 0.75);
264 f = &content_features(i);
265 f->setInventoryTexture("papyrus.png");
266 f->light_propagates = true;
267 f->param_type = CPT_LIGHT;
268 f->is_ground_content = true;
269 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
270 f->solidness = 0; // drawn separately, makes no faces
272 setWoodLikeDiggingProperties(f->digging_properties, 0.25);
274 i = CONTENT_BOOKSHELF;
275 f = &content_features(i);
276 f->setAllTextures("bookshelf.png");
277 f->setTexture(0, "wood.png");
278 f->setTexture(1, "wood.png");
279 // FIXME: setInventoryTextureCube() only cares for the first texture
280 f->setInventoryTextureCube("bookshelf.png", "bookshelf.png", "bookshelf.png");
281 //f->setInventoryTextureCube("wood.png", "bookshelf.png", "bookshelf.png");
282 f->param_type = CPT_MINERAL;
283 f->is_ground_content = true;
284 setWoodLikeDiggingProperties(f->digging_properties, 0.75);
287 f = &content_features(i);
288 f->light_propagates = true;
289 f->sunlight_propagates = true;
290 f->param_type = CPT_LIGHT;
291 f->is_ground_content = true;
292 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
293 f->solidness = 0; // drawn separately, makes no faces
294 f->visual_solidness = 1;
295 f->setAllTextures("glass.png");
296 f->setInventoryTextureCube("glass.png", "glass.png", "glass.png");
297 setWoodLikeDiggingProperties(f->digging_properties, 0.15);
300 f = &content_features(i);
301 f->light_propagates = true;
302 f->param_type = CPT_LIGHT;
303 f->is_ground_content = true;
304 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
305 f->solidness = 0; // drawn separately, makes no faces
306 f->air_equivalent = true; // grass grows underneath
307 f->setInventoryTexture("fence.png");
308 setWoodLikeDiggingProperties(f->digging_properties, 0.75);
311 f = &content_features(i);
312 f->setInventoryTexture("rail.png");
313 f->light_propagates = true;
314 f->param_type = CPT_LIGHT;
315 f->is_ground_content = true;
316 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
317 f->solidness = 0; // drawn separately, makes no faces
318 f->air_equivalent = true; // grass grows underneath
320 setDirtLikeDiggingProperties(f->digging_properties, 0.75);
323 f = &content_features(i);
324 f->setInventoryTexture("ladder.png");
325 f->light_propagates = true;
326 f->param_type = CPT_LIGHT;
327 f->is_ground_content = true;
328 f->dug_item = std::string("MaterialItem ")+itos(i)+" 1";
329 f->wall_mounted = true;
331 f->air_equivalent = true;
334 setWoodLikeDiggingProperties(f->digging_properties, 0.5);
337 i = CONTENT_COALSTONE;
338 f = &content_features(i);
339 f->setAllTextures("stone.png^mineral_coal.png");
340 f->is_ground_content = true;
341 setStoneLikeDiggingProperties(f->digging_properties, 1.5);
344 f = &content_features(i);
345 f->setAllTextures("wood.png");
346 f->setInventoryTextureCube("wood.png", "wood.png", "wood.png");
347 f->is_ground_content = true;
348 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
349 setWoodLikeDiggingProperties(f->digging_properties, 0.75);
352 f = &content_features(i);
353 f->setAllTextures("mese.png");
354 f->setInventoryTextureCube("mese.png", "mese.png", "mese.png");
355 f->is_ground_content = true;
356 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
357 setStoneLikeDiggingProperties(f->digging_properties, 0.5);
360 f = &content_features(i);
361 f->setAllTextures("cloud.png");
362 f->setInventoryTextureCube("cloud.png", "cloud.png", "cloud.png");
363 f->is_ground_content = true;
364 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
367 f = &content_features(i);
368 f->param_type = CPT_LIGHT;
369 f->light_propagates = true;
370 f->sunlight_propagates = true;
373 f->pointable = false;
375 f->buildable_to = true;
376 f->air_equivalent = true;
379 f = &content_features(i);
380 f->setInventoryTextureCube("water.png", "water.png", "water.png");
381 f->param_type = CPT_LIGHT;
382 f->light_propagates = true;
383 f->solidness = 0; // Drawn separately, makes no faces
384 f->visual_solidness = 1;
386 f->pointable = false;
388 f->buildable_to = true;
389 f->liquid_type = LIQUID_FLOWING;
390 f->liquid_alternative_flowing = CONTENT_WATER;
391 f->liquid_alternative_source = CONTENT_WATERSOURCE;
392 f->liquid_viscosity = WATER_VISC;
393 f->vertex_alpha = WATER_ALPHA;
394 f->post_effect_color = video::SColor(64, 100, 100, 200);
395 if(f->special_material == NULL && g_texturesource)
397 // Flowing water material
398 f->special_material = new video::SMaterial;
399 f->special_material->setFlag(video::EMF_LIGHTING, false);
400 f->special_material->setFlag(video::EMF_BACK_FACE_CULLING, false);
401 f->special_material->setFlag(video::EMF_BILINEAR_FILTER, false);
402 f->special_material->setFlag(video::EMF_FOG_ENABLE, true);
403 f->special_material->MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA;
404 AtlasPointer *pa_water1 = new AtlasPointer(g_texturesource->getTexture(
405 g_texturesource->getTextureId("water.png")));
406 f->special_material->setTexture(0, pa_water1->atlas);
407 f->special_atlas = pa_water1;
410 i = CONTENT_WATERSOURCE;
411 f = &content_features(i);
412 //f->setInventoryTexture("water.png");
413 f->setInventoryTextureCube("water.png", "water.png", "water.png");
416 f->solidness = 0; // drawn separately, makes no faces
424 t.texture = g_texturesource->getTexture("water.png");
426 t.alpha = WATER_ALPHA;
427 t.material_type = MATERIAL_ALPHA_VERTEX;
428 t.material_flags &= ~MATERIAL_FLAG_BACKFACE_CULLING;
431 f->param_type = CPT_LIGHT;
432 f->light_propagates = true;
434 f->pointable = false;
436 f->buildable_to = true;
437 f->liquid_type = LIQUID_SOURCE;
438 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
439 f->liquid_alternative_flowing = CONTENT_WATER;
440 f->liquid_alternative_source = CONTENT_WATERSOURCE;
441 f->liquid_viscosity = WATER_VISC;
442 f->vertex_alpha = WATER_ALPHA;
443 f->post_effect_color = video::SColor(64, 100, 100, 200);
444 if(f->special_material == NULL && g_texturesource)
446 // Flowing water material
447 f->special_material = new video::SMaterial;
448 f->special_material->setFlag(video::EMF_LIGHTING, false);
449 f->special_material->setFlag(video::EMF_BACK_FACE_CULLING, false);
450 f->special_material->setFlag(video::EMF_BILINEAR_FILTER, false);
451 f->special_material->setFlag(video::EMF_FOG_ENABLE, true);
452 f->special_material->MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA;
453 AtlasPointer *pa_water1 = new AtlasPointer(g_texturesource->getTexture(
454 g_texturesource->getTextureId("water.png")));
455 f->special_material->setTexture(0, pa_water1->atlas);
456 f->special_atlas = pa_water1;
460 f = &content_features(i);
461 f->setInventoryTextureCube("lava.png", "lava.png", "lava.png");
462 f->param_type = CPT_LIGHT;
463 f->light_propagates = false;
464 f->light_source = LIGHT_MAX-1;
465 f->solidness = 0; // Drawn separately, makes no faces
466 f->visual_solidness = 2;
468 f->pointable = false;
470 f->buildable_to = true;
471 f->liquid_type = LIQUID_FLOWING;
472 f->liquid_alternative_flowing = CONTENT_LAVA;
473 f->liquid_alternative_source = CONTENT_LAVASOURCE;
474 f->liquid_viscosity = LAVA_VISC;
475 f->damage_per_second = 4*2;
476 f->post_effect_color = video::SColor(192, 255, 64, 0);
477 if(f->special_material == NULL && g_texturesource)
479 // Flowing lava material
480 f->special_material = new video::SMaterial;
481 f->special_material->setFlag(video::EMF_LIGHTING, false);
482 f->special_material->setFlag(video::EMF_BACK_FACE_CULLING, false);
483 f->special_material->setFlag(video::EMF_BILINEAR_FILTER, false);
484 f->special_material->setFlag(video::EMF_FOG_ENABLE, true);
485 f->special_material->MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
486 AtlasPointer *pa_lava1 = new AtlasPointer(
487 g_texturesource->getTexture(
488 g_texturesource->getTextureId("lava.png")));
489 f->special_material->setTexture(0, pa_lava1->atlas);
490 f->special_atlas = pa_lava1;
493 i = CONTENT_LAVASOURCE;
494 f = &content_features(i);
495 f->setInventoryTextureCube("lava.png", "lava.png", "lava.png");
498 f->solidness = 0; // drawn separately, makes no faces
506 t.texture = g_texturesource->getTexture("lava.png");
509 //t.material_type = MATERIAL_ALPHA_VERTEX;
510 //t.material_flags &= ~MATERIAL_FLAG_BACKFACE_CULLING;
513 f->param_type = CPT_LIGHT;
514 f->light_propagates = false;
515 f->light_source = LIGHT_MAX-1;
517 f->pointable = false;
519 f->buildable_to = true;
520 f->liquid_type = LIQUID_SOURCE;
521 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
522 f->liquid_alternative_flowing = CONTENT_LAVA;
523 f->liquid_alternative_source = CONTENT_LAVASOURCE;
524 f->liquid_viscosity = LAVA_VISC;
525 f->damage_per_second = 4*2;
526 f->post_effect_color = video::SColor(192, 255, 64, 0);
527 if(f->special_material == NULL && g_texturesource)
529 // Flowing lava material
530 f->special_material = new video::SMaterial;
531 f->special_material->setFlag(video::EMF_LIGHTING, false);
532 f->special_material->setFlag(video::EMF_BACK_FACE_CULLING, false);
533 f->special_material->setFlag(video::EMF_BILINEAR_FILTER, false);
534 f->special_material->setFlag(video::EMF_FOG_ENABLE, true);
535 f->special_material->MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
536 AtlasPointer *pa_lava1 = new AtlasPointer(
537 g_texturesource->getTexture(
538 g_texturesource->getTextureId("lava.png")));
539 f->special_material->setTexture(0, pa_lava1->atlas);
540 f->special_atlas = pa_lava1;
544 f = &content_features(i);
545 f->setInventoryTexture("torch_on_floor.png");
546 f->param_type = CPT_LIGHT;
547 f->light_propagates = true;
548 f->sunlight_propagates = true;
549 f->solidness = 0; // drawn separately, makes no faces
551 f->wall_mounted = true;
552 f->air_equivalent = true;
553 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
554 f->light_source = LIGHT_MAX-1;
555 f->digging_properties.set("", DiggingProperties(true, 0.0, 0));
557 i = CONTENT_SIGN_WALL;
558 f = &content_features(i);
559 f->setInventoryTexture("sign_wall.png");
560 f->param_type = CPT_LIGHT;
561 f->light_propagates = true;
562 f->sunlight_propagates = true;
563 f->solidness = 0; // drawn separately, makes no faces
565 f->wall_mounted = true;
566 f->air_equivalent = true;
567 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
568 if(f->initial_metadata == NULL)
569 f->initial_metadata = new SignNodeMetadata("Some sign");
570 f->digging_properties.set("", DiggingProperties(true, 0.5, 0));
573 f = &content_features(i);
574 f->param_type = CPT_FACEDIR_SIMPLE;
575 f->setAllTextures("chest_side.png");
576 f->setTexture(0, "chest_top.png");
577 f->setTexture(1, "chest_top.png");
578 f->setTexture(5, "chest_front.png"); // Z-
579 f->setInventoryTexture("chest_top.png");
580 //f->setInventoryTextureCube("chest_top.png", "chest_side.png", "chest_side.png");
581 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
582 if(f->initial_metadata == NULL)
583 f->initial_metadata = new ChestNodeMetadata();
584 setWoodLikeDiggingProperties(f->digging_properties, 1.0);
586 i = CONTENT_LOCKABLE_CHEST;
587 f = &content_features(i);
588 f->param_type = CPT_FACEDIR_SIMPLE;
589 f->setAllTextures("chest_side.png");
590 f->setTexture(0, "chest_top.png");
591 f->setTexture(1, "chest_top.png");
592 f->setTexture(5, "chest_lock.png"); // Z-
593 f->setInventoryTexture("chest_lock.png");
594 //f->setInventoryTextureCube("chest_top.png", "chest_side.png", "chest_side.png");
595 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
596 if(f->initial_metadata == NULL)
597 f->initial_metadata = new LockingChestNodeMetadata();
598 setWoodLikeDiggingProperties(f->digging_properties, 1.0);
601 f = &content_features(i);
602 f->param_type = CPT_FACEDIR_SIMPLE;
603 f->setAllTextures("furnace_side.png");
604 f->setTexture(5, "furnace_front.png"); // Z-
605 f->setInventoryTexture("furnace_front.png");
606 //f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
607 f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_COBBLE)+" 6";
608 if(f->initial_metadata == NULL)
609 f->initial_metadata = new FurnaceNodeMetadata();
610 setStoneLikeDiggingProperties(f->digging_properties, 3.0);
613 f = &content_features(i);
614 f->setAllTextures("cobble.png");
615 f->setInventoryTextureCube("cobble.png", "cobble.png", "cobble.png");
616 f->param_type = CPT_NONE;
617 f->is_ground_content = true;
618 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
619 setStoneLikeDiggingProperties(f->digging_properties, 0.9);
621 i = CONTENT_MOSSYCOBBLE;
622 f = &content_features(i);
623 f->setAllTextures("mossycobble.png");
624 f->setInventoryTextureCube("mossycobble.png", "mossycobble.png", "mossycobble.png");
625 f->param_type = CPT_NONE;
626 f->is_ground_content = true;
627 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
628 setStoneLikeDiggingProperties(f->digging_properties, 0.8);
631 f = &content_features(i);
632 f->setAllTextures("steel_block.png");
633 f->setInventoryTextureCube("steel_block.png", "steel_block.png",
635 f->param_type = CPT_NONE;
636 f->is_ground_content = true;
637 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
638 setStoneLikeDiggingProperties(f->digging_properties, 5.0);
641 f = &content_features(i);
642 f->param_type = CPT_FACEDIR_SIMPLE;
643 f->setAllTextures("nc_side.png");
644 f->setTexture(5, "nc_front.png"); // Z-
645 f->setTexture(4, "nc_back.png"); // Z+
646 f->setInventoryTexture("nc_front.png");
647 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
648 setStoneLikeDiggingProperties(f->digging_properties, 3.0);
651 f = &content_features(i);
652 f->setAllTextures("nc_rb.png");
653 f->setInventoryTexture("nc_rb.png");
654 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
655 setStoneLikeDiggingProperties(f->digging_properties, 3.0);
658 f = &content_features(i);
659 f->param_type = CPT_LIGHT;
660 f->setAllTextures("sapling.png");
661 f->setInventoryTexture("sapling.png");
662 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
663 f->light_propagates = true;
664 f->air_equivalent = false;
665 f->solidness = 0; // drawn separately, makes no faces
667 f->digging_properties.set("", DiggingProperties(true, 0.0, 0));
670 f = &content_features(i);
671 f->setInventoryTexture("apple.png");
672 f->param_type = CPT_LIGHT;
673 f->light_propagates = true;
674 f->sunlight_propagates = true;
675 f->solidness = 0; // drawn separately, makes no faces
677 f->air_equivalent = true;
678 f->dug_item = std::string("CraftItem apple 1");
679 f->digging_properties.set("", DiggingProperties(true, 0.0, 0));
681 // NOTE: Remember to add frequently used stuff to the texture atlas in tile.cpp
685 Add MesePick to everything
687 for(u16 i=0; i<=MAX_CONTENT; i++)
689 content_features(i).digging_properties.set("MesePick",
690 DiggingProperties(true, 0.0, 65535./1337));
695 void setStoneLikeDiggingProperties(DiggingPropertiesList &list, float toughness)
698 DiggingProperties(true, 15.0*toughness, 0));
701 DiggingProperties(true, 1.3*toughness, 65535./30.*toughness));
703 DiggingProperties(true, 0.75*toughness, 65535./100.*toughness));
704 list.set("SteelPick",
705 DiggingProperties(true, 0.50*toughness, 65535./333.*toughness));
707 /*list.set("MesePick",
708 DiggingProperties(true, 0.0*toughness, 65535./20.*toughness));*/
711 void setDirtLikeDiggingProperties(DiggingPropertiesList &list, float toughness)
714 DiggingProperties(true, 0.75*toughness, 0));
717 DiggingProperties(true, 0.4*toughness, 65535./50.*toughness));
719 DiggingProperties(true, 0.2*toughness, 65535./150.*toughness));
720 list.set("SteelShovel",
721 DiggingProperties(true, 0.15*toughness, 65535./400.*toughness));
724 void setWoodLikeDiggingProperties(DiggingPropertiesList &list, float toughness)
727 DiggingProperties(true, 3.0*toughness, 0));
730 DiggingProperties(true, 1.5*toughness, 65535./30.*toughness));
732 DiggingProperties(true, 0.75*toughness, 65535./100.*toughness));
734 DiggingProperties(true, 0.5*toughness, 65535./333.*toughness));