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->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_COBBLE)+" 1";
121 setStoneLikeDiggingProperties(f->digging_properties, 1.0);
123 f->solidness = 0; // For debugging, hides regular stone
126 f = &content_features(i);
127 f->setAllTextures("mud.png^grass_side.png");
128 f->setTexture(0, "grass.png");
129 f->setTexture(1, "mud.png");
130 f->param_type = CPT_MINERAL;
131 f->is_ground_content = true;
132 f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_MUD)+" 1";
133 setDirtLikeDiggingProperties(f->digging_properties, 1.0);
135 i = CONTENT_GRASS_FOOTSTEPS;
136 f = &content_features(i);
137 f->setAllTextures("mud.png^grass_side.png");
138 f->setTexture(0, "grass_footsteps.png");
139 f->setTexture(1, "mud.png");
140 f->param_type = CPT_MINERAL;
141 f->is_ground_content = true;
142 f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_MUD)+" 1";
143 setDirtLikeDiggingProperties(f->digging_properties, 1.0);
146 f = &content_features(i);
147 f->setAllTextures("mud.png");
148 f->setInventoryTextureCube("mud.png", "mud.png", "mud.png");
149 f->param_type = CPT_MINERAL;
150 f->is_ground_content = true;
151 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
152 setDirtLikeDiggingProperties(f->digging_properties, 1.0);
155 f = &content_features(i);
156 f->setAllTextures("sand.png");
157 f->setInventoryTextureCube("sand.png", "sand.png", "sand.png");
158 f->param_type = CPT_MINERAL;
159 f->is_ground_content = true;
160 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
161 setDirtLikeDiggingProperties(f->digging_properties, 1.0);
164 f = &content_features(i);
165 f->setAllTextures("gravel.png");
166 f->setInventoryTextureCube("gravel.png", "gravel.png", "gravel.png");
167 f->param_type = CPT_MINERAL;
168 f->is_ground_content = true;
169 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
170 setDirtLikeDiggingProperties(f->digging_properties, 1.75);
172 i = CONTENT_SANDSTONE;
173 f = &content_features(i);
174 f->setAllTextures("sandstone.png");
175 f->setInventoryTextureCube("sandstone.png", "sandstone.png", "sandstone.png");
176 f->param_type = CPT_MINERAL;
177 f->is_ground_content = true;
178 f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_SAND)+" 1";
179 setDirtLikeDiggingProperties(f->digging_properties, 1.0);
182 f = &content_features(i);
183 f->setAllTextures("clay.png");
184 f->setInventoryTextureCube("clay.png", "clay.png", "clay.png");
185 f->param_type = CPT_MINERAL;
186 f->is_ground_content = true;
187 f->dug_item = std::string("CraftItem lump_of_clay 4");
188 setDirtLikeDiggingProperties(f->digging_properties, 1.0);
191 f = &content_features(i);
192 f->setAllTextures("brick.png");
193 f->setInventoryTextureCube("brick.png", "brick.png", "brick.png");
194 f->param_type = CPT_MINERAL;
195 f->is_ground_content = true;
196 f->dug_item = std::string("CraftItem clay_brick 4");
197 setStoneLikeDiggingProperties(f->digging_properties, 1.0);
200 f = &content_features(i);
201 f->setAllTextures("tree.png");
202 f->setTexture(0, "tree_top.png");
203 f->setTexture(1, "tree_top.png");
204 f->param_type = CPT_MINERAL;
205 f->is_ground_content = true;
206 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
207 setWoodLikeDiggingProperties(f->digging_properties, 1.0);
209 i = CONTENT_JUNGLETREE;
210 f = &content_features(i);
211 f->setAllTextures("jungletree.png");
212 f->setTexture(0, "jungletree_top.png");
213 f->setTexture(1, "jungletree_top.png");
214 f->param_type = CPT_MINERAL;
215 //f->is_ground_content = true;
216 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
217 setWoodLikeDiggingProperties(f->digging_properties, 1.0);
219 i = CONTENT_JUNGLEGRASS;
220 f = &content_features(i);
221 f->setInventoryTexture("junglegrass.png");
222 f->light_propagates = true;
223 f->param_type = CPT_LIGHT;
224 //f->is_ground_content = true;
225 f->air_equivalent = false; // grass grows underneath
226 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
227 f->solidness = 0; // drawn separately, makes no faces
229 setWoodLikeDiggingProperties(f->digging_properties, 0.10);
232 f = &content_features(i);
233 f->light_propagates = true;
234 //f->param_type = CPT_MINERAL;
235 f->param_type = CPT_LIGHT;
236 //f->is_ground_content = true;
239 f->solidness = 0; // drawn separately, makes no faces
240 f->visual_solidness = 1;
241 f->setAllTextures("leaves.png");
242 f->setInventoryTextureCube("leaves.png", "leaves.png", "leaves.png");
246 f->setAllTextures("[noalpha:leaves.png");
248 f->extra_dug_item = std::string("MaterialItem2 ")+itos(CONTENT_SAPLING)+" 1";
249 f->extra_dug_item_rarity = 20;
250 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
251 setWoodLikeDiggingProperties(f->digging_properties, 0.15);
254 f = &content_features(i);
255 f->setAllTextures("cactus_side.png");
256 f->setTexture(0, "cactus_top.png");
257 f->setTexture(1, "cactus_top.png");
258 f->setInventoryTextureCube("cactus_top.png", "cactus_side.png", "cactus_side.png");
259 f->param_type = CPT_MINERAL;
260 f->is_ground_content = true;
261 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
262 setWoodLikeDiggingProperties(f->digging_properties, 0.75);
265 f = &content_features(i);
266 f->setInventoryTexture("papyrus.png");
267 f->light_propagates = true;
268 f->param_type = CPT_LIGHT;
269 f->is_ground_content = true;
270 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
271 f->solidness = 0; // drawn separately, makes no faces
273 setWoodLikeDiggingProperties(f->digging_properties, 0.25);
275 i = CONTENT_BOOKSHELF;
276 f = &content_features(i);
277 f->setAllTextures("bookshelf.png");
278 f->setTexture(0, "wood.png");
279 f->setTexture(1, "wood.png");
280 // FIXME: setInventoryTextureCube() only cares for the first texture
281 f->setInventoryTextureCube("bookshelf.png", "bookshelf.png", "bookshelf.png");
282 //f->setInventoryTextureCube("wood.png", "bookshelf.png", "bookshelf.png");
283 f->param_type = CPT_MINERAL;
284 f->is_ground_content = true;
285 setWoodLikeDiggingProperties(f->digging_properties, 0.75);
288 f = &content_features(i);
289 f->light_propagates = true;
290 f->sunlight_propagates = true;
291 f->param_type = CPT_LIGHT;
292 f->is_ground_content = true;
293 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
294 f->solidness = 0; // drawn separately, makes no faces
295 f->visual_solidness = 1;
296 f->setAllTextures("glass.png");
297 f->setInventoryTextureCube("glass.png", "glass.png", "glass.png");
298 setWoodLikeDiggingProperties(f->digging_properties, 0.15);
301 f = &content_features(i);
302 f->light_propagates = true;
303 f->param_type = CPT_LIGHT;
304 f->is_ground_content = true;
305 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
306 f->solidness = 0; // drawn separately, makes no faces
307 f->air_equivalent = true; // grass grows underneath
308 f->setInventoryTexture("fence.png");
309 setWoodLikeDiggingProperties(f->digging_properties, 0.75);
312 f = &content_features(i);
313 f->setInventoryTexture("rail.png");
314 f->light_propagates = true;
315 f->param_type = CPT_LIGHT;
316 f->is_ground_content = true;
317 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
318 f->solidness = 0; // drawn separately, makes no faces
319 f->air_equivalent = true; // grass grows underneath
321 setDirtLikeDiggingProperties(f->digging_properties, 0.75);
324 f = &content_features(i);
325 f->setInventoryTexture("ladder.png");
326 f->light_propagates = true;
327 f->param_type = CPT_LIGHT;
328 f->is_ground_content = true;
329 f->dug_item = std::string("MaterialItem ")+itos(i)+" 1";
330 f->wall_mounted = true;
332 f->air_equivalent = true;
335 setWoodLikeDiggingProperties(f->digging_properties, 0.5);
338 i = CONTENT_COALSTONE;
339 f = &content_features(i);
340 f->setAllTextures("stone.png^mineral_coal.png");
341 f->is_ground_content = true;
342 setStoneLikeDiggingProperties(f->digging_properties, 1.5);
345 f = &content_features(i);
346 f->setAllTextures("wood.png");
347 f->setInventoryTextureCube("wood.png", "wood.png", "wood.png");
348 f->is_ground_content = true;
349 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
350 setWoodLikeDiggingProperties(f->digging_properties, 0.75);
353 f = &content_features(i);
354 f->setAllTextures("mese.png");
355 f->setInventoryTextureCube("mese.png", "mese.png", "mese.png");
356 f->is_ground_content = true;
357 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
358 setStoneLikeDiggingProperties(f->digging_properties, 0.5);
361 f = &content_features(i);
362 f->setAllTextures("cloud.png");
363 f->setInventoryTextureCube("cloud.png", "cloud.png", "cloud.png");
364 f->is_ground_content = true;
365 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
368 f = &content_features(i);
369 f->param_type = CPT_LIGHT;
370 f->light_propagates = true;
371 f->sunlight_propagates = true;
374 f->pointable = false;
376 f->buildable_to = true;
377 f->air_equivalent = true;
380 f = &content_features(i);
381 f->setInventoryTextureCube("water.png", "water.png", "water.png");
382 f->param_type = CPT_LIGHT;
383 f->light_propagates = true;
384 f->solidness = 0; // Drawn separately, makes no faces
385 f->visual_solidness = 1;
387 f->pointable = false;
389 f->buildable_to = true;
390 f->liquid_type = LIQUID_FLOWING;
391 f->liquid_alternative_flowing = CONTENT_WATER;
392 f->liquid_alternative_source = CONTENT_WATERSOURCE;
393 f->liquid_viscosity = WATER_VISC;
395 f->vertex_alpha = WATER_ALPHA;
396 f->post_effect_color = video::SColor(64, 100, 100, 200);
397 if(f->special_material == NULL && g_texturesource)
399 // Flowing water material
400 f->special_material = new video::SMaterial;
401 f->special_material->setFlag(video::EMF_LIGHTING, false);
402 f->special_material->setFlag(video::EMF_BACK_FACE_CULLING, false);
403 f->special_material->setFlag(video::EMF_BILINEAR_FILTER, false);
404 f->special_material->setFlag(video::EMF_FOG_ENABLE, true);
405 f->special_material->MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA;
406 AtlasPointer *pa_water1 = new AtlasPointer(g_texturesource->getTexture(
407 g_texturesource->getTextureId("water.png")));
408 f->special_material->setTexture(0, pa_water1->atlas);
409 f->special_atlas = pa_water1;
413 i = CONTENT_WATERSOURCE;
414 f = &content_features(i);
415 //f->setInventoryTexture("water.png");
416 f->setInventoryTextureCube("water.png", "water.png", "water.png");
419 f->solidness = 0; // drawn separately, makes no faces
427 t.texture = g_texturesource->getTexture("water.png");
429 t.alpha = WATER_ALPHA;
430 t.material_type = MATERIAL_ALPHA_VERTEX;
431 t.material_flags &= ~MATERIAL_FLAG_BACKFACE_CULLING;
435 f->param_type = CPT_LIGHT;
436 f->light_propagates = true;
438 f->pointable = false;
440 f->buildable_to = true;
441 f->liquid_type = LIQUID_SOURCE;
442 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
443 f->liquid_alternative_flowing = CONTENT_WATER;
444 f->liquid_alternative_source = CONTENT_WATERSOURCE;
445 f->liquid_viscosity = WATER_VISC;
447 f->vertex_alpha = WATER_ALPHA;
448 f->post_effect_color = video::SColor(64, 100, 100, 200);
449 if(f->special_material == NULL && g_texturesource)
451 // Flowing water material
452 f->special_material = new video::SMaterial;
453 f->special_material->setFlag(video::EMF_LIGHTING, false);
454 f->special_material->setFlag(video::EMF_BACK_FACE_CULLING, false);
455 f->special_material->setFlag(video::EMF_BILINEAR_FILTER, false);
456 f->special_material->setFlag(video::EMF_FOG_ENABLE, true);
457 f->special_material->MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA;
458 AtlasPointer *pa_water1 = new AtlasPointer(g_texturesource->getTexture(
459 g_texturesource->getTextureId("water.png")));
460 f->special_material->setTexture(0, pa_water1->atlas);
461 f->special_atlas = pa_water1;
466 f = &content_features(i);
467 f->setInventoryTextureCube("lava.png", "lava.png", "lava.png");
468 f->param_type = CPT_LIGHT;
469 f->light_propagates = false;
470 f->light_source = LIGHT_MAX-1;
471 f->solidness = 0; // Drawn separately, makes no faces
472 f->visual_solidness = 2;
474 f->pointable = false;
476 f->buildable_to = true;
477 f->liquid_type = LIQUID_FLOWING;
478 f->liquid_alternative_flowing = CONTENT_LAVA;
479 f->liquid_alternative_source = CONTENT_LAVASOURCE;
480 f->liquid_viscosity = LAVA_VISC;
481 f->damage_per_second = 4*2;
483 f->post_effect_color = video::SColor(192, 255, 64, 0);
484 if(f->special_material == NULL && g_texturesource)
486 // Flowing lava material
487 f->special_material = new video::SMaterial;
488 f->special_material->setFlag(video::EMF_LIGHTING, false);
489 f->special_material->setFlag(video::EMF_BACK_FACE_CULLING, false);
490 f->special_material->setFlag(video::EMF_BILINEAR_FILTER, false);
491 f->special_material->setFlag(video::EMF_FOG_ENABLE, true);
492 f->special_material->MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
493 AtlasPointer *pa_lava1 = new AtlasPointer(
494 g_texturesource->getTexture(
495 g_texturesource->getTextureId("lava.png")));
496 f->special_material->setTexture(0, pa_lava1->atlas);
497 f->special_atlas = pa_lava1;
501 i = CONTENT_LAVASOURCE;
502 f = &content_features(i);
503 f->setInventoryTextureCube("lava.png", "lava.png", "lava.png");
506 f->solidness = 0; // drawn separately, makes no faces
514 t.texture = g_texturesource->getTexture("lava.png");
517 //t.material_type = MATERIAL_ALPHA_VERTEX;
518 //t.material_flags &= ~MATERIAL_FLAG_BACKFACE_CULLING;
522 f->param_type = CPT_LIGHT;
523 f->light_propagates = false;
524 f->light_source = LIGHT_MAX-1;
526 f->pointable = false;
528 f->buildable_to = true;
529 f->liquid_type = LIQUID_SOURCE;
530 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
531 f->liquid_alternative_flowing = CONTENT_LAVA;
532 f->liquid_alternative_source = CONTENT_LAVASOURCE;
533 f->liquid_viscosity = LAVA_VISC;
534 f->damage_per_second = 4*2;
536 f->post_effect_color = video::SColor(192, 255, 64, 0);
537 if(f->special_material == NULL && g_texturesource)
539 // Flowing lava material
540 f->special_material = new video::SMaterial;
541 f->special_material->setFlag(video::EMF_LIGHTING, false);
542 f->special_material->setFlag(video::EMF_BACK_FACE_CULLING, false);
543 f->special_material->setFlag(video::EMF_BILINEAR_FILTER, false);
544 f->special_material->setFlag(video::EMF_FOG_ENABLE, true);
545 f->special_material->MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
546 AtlasPointer *pa_lava1 = new AtlasPointer(
547 g_texturesource->getTexture(
548 g_texturesource->getTextureId("lava.png")));
549 f->special_material->setTexture(0, pa_lava1->atlas);
550 f->special_atlas = pa_lava1;
555 f = &content_features(i);
556 f->setInventoryTexture("torch_on_floor.png");
557 f->param_type = CPT_LIGHT;
558 f->light_propagates = true;
559 f->sunlight_propagates = true;
560 f->solidness = 0; // drawn separately, makes no faces
562 f->wall_mounted = true;
563 f->air_equivalent = true;
564 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
565 f->light_source = LIGHT_MAX-1;
566 f->digging_properties.set("", DiggingProperties(true, 0.0, 0));
568 i = CONTENT_SIGN_WALL;
569 f = &content_features(i);
570 f->setInventoryTexture("sign_wall.png");
571 f->param_type = CPT_LIGHT;
572 f->light_propagates = true;
573 f->sunlight_propagates = true;
574 f->solidness = 0; // drawn separately, makes no faces
576 f->wall_mounted = true;
577 f->air_equivalent = true;
578 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
579 if(f->initial_metadata == NULL)
580 f->initial_metadata = new SignNodeMetadata("Some sign");
581 f->digging_properties.set("", DiggingProperties(true, 0.5, 0));
584 f = &content_features(i);
585 f->param_type = CPT_FACEDIR_SIMPLE;
586 f->setAllTextures("chest_side.png");
587 f->setTexture(0, "chest_top.png");
588 f->setTexture(1, "chest_top.png");
589 f->setTexture(5, "chest_front.png"); // Z-
590 f->setInventoryTexture("chest_top.png");
591 //f->setInventoryTextureCube("chest_top.png", "chest_side.png", "chest_side.png");
592 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
593 if(f->initial_metadata == NULL)
594 f->initial_metadata = new ChestNodeMetadata();
595 setWoodLikeDiggingProperties(f->digging_properties, 1.0);
597 i = CONTENT_LOCKABLE_CHEST;
598 f = &content_features(i);
599 f->param_type = CPT_FACEDIR_SIMPLE;
600 f->setAllTextures("chest_side.png");
601 f->setTexture(0, "chest_top.png");
602 f->setTexture(1, "chest_top.png");
603 f->setTexture(5, "chest_lock.png"); // Z-
604 f->setInventoryTexture("chest_lock.png");
605 //f->setInventoryTextureCube("chest_top.png", "chest_side.png", "chest_side.png");
606 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
607 if(f->initial_metadata == NULL)
608 f->initial_metadata = new LockingChestNodeMetadata();
609 setWoodLikeDiggingProperties(f->digging_properties, 1.0);
612 f = &content_features(i);
613 f->param_type = CPT_FACEDIR_SIMPLE;
614 f->setAllTextures("furnace_side.png");
615 f->setTexture(5, "furnace_front.png"); // Z-
616 f->setInventoryTexture("furnace_front.png");
617 //f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
618 f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_COBBLE)+" 6";
619 if(f->initial_metadata == NULL)
620 f->initial_metadata = new FurnaceNodeMetadata();
621 setStoneLikeDiggingProperties(f->digging_properties, 3.0);
624 f = &content_features(i);
625 f->setAllTextures("cobble.png");
626 f->setInventoryTextureCube("cobble.png", "cobble.png", "cobble.png");
627 f->param_type = CPT_NONE;
628 f->is_ground_content = true;
629 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
630 setStoneLikeDiggingProperties(f->digging_properties, 0.9);
632 i = CONTENT_MOSSYCOBBLE;
633 f = &content_features(i);
634 f->setAllTextures("mossycobble.png");
635 f->setInventoryTextureCube("mossycobble.png", "mossycobble.png", "mossycobble.png");
636 f->param_type = CPT_NONE;
637 f->is_ground_content = true;
638 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
639 setStoneLikeDiggingProperties(f->digging_properties, 0.8);
642 f = &content_features(i);
643 f->setAllTextures("steel_block.png");
644 f->setInventoryTextureCube("steel_block.png", "steel_block.png",
646 f->param_type = CPT_NONE;
647 f->is_ground_content = true;
648 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
649 setStoneLikeDiggingProperties(f->digging_properties, 5.0);
652 f = &content_features(i);
653 f->param_type = CPT_FACEDIR_SIMPLE;
654 f->setAllTextures("nc_side.png");
655 f->setTexture(5, "nc_front.png"); // Z-
656 f->setTexture(4, "nc_back.png"); // Z+
657 f->setInventoryTexture("nc_front.png");
658 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
659 setStoneLikeDiggingProperties(f->digging_properties, 3.0);
662 f = &content_features(i);
663 f->setAllTextures("nc_rb.png");
664 f->setInventoryTexture("nc_rb.png");
665 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
666 setStoneLikeDiggingProperties(f->digging_properties, 3.0);
669 f = &content_features(i);
670 f->param_type = CPT_LIGHT;
671 f->setAllTextures("sapling.png");
672 f->setInventoryTexture("sapling.png");
673 f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
674 f->light_propagates = true;
675 f->air_equivalent = false;
676 f->solidness = 0; // drawn separately, makes no faces
678 f->digging_properties.set("", DiggingProperties(true, 0.0, 0));
681 f = &content_features(i);
682 f->setInventoryTexture("apple.png");
683 f->param_type = CPT_LIGHT;
684 f->light_propagates = true;
685 f->sunlight_propagates = true;
686 f->solidness = 0; // drawn separately, makes no faces
688 f->air_equivalent = true;
689 f->dug_item = std::string("CraftItem apple 1");
690 f->digging_properties.set("", DiggingProperties(true, 0.0, 0));
692 // NOTE: Remember to add frequently used stuff to the texture atlas in tile.cpp
696 Add MesePick to everything
698 for(u16 i=0; i<=MAX_CONTENT; i++)
700 content_features(i).digging_properties.set("MesePick",
701 DiggingProperties(true, 0.0, 65535./1337));
706 void setStoneLikeDiggingProperties(DiggingPropertiesList &list, float toughness)
709 DiggingProperties(true, 15.0*toughness, 0));
712 DiggingProperties(true, 1.3*toughness, 65535./30.*toughness));
714 DiggingProperties(true, 0.75*toughness, 65535./100.*toughness));
715 list.set("SteelPick",
716 DiggingProperties(true, 0.50*toughness, 65535./333.*toughness));
718 /*list.set("MesePick",
719 DiggingProperties(true, 0.0*toughness, 65535./20.*toughness));*/
722 void setDirtLikeDiggingProperties(DiggingPropertiesList &list, float toughness)
725 DiggingProperties(true, 0.75*toughness, 0));
728 DiggingProperties(true, 0.4*toughness, 65535./50.*toughness));
730 DiggingProperties(true, 0.2*toughness, 65535./150.*toughness));
731 list.set("SteelShovel",
732 DiggingProperties(true, 0.15*toughness, 65535./400.*toughness));
735 void setWoodLikeDiggingProperties(DiggingPropertiesList &list, float toughness)
738 DiggingProperties(true, 3.0*toughness, 0));
741 DiggingProperties(true, 1.5*toughness, 65535./30.*toughness));
743 DiggingProperties(true, 0.75*toughness, 65535./100.*toughness));
745 DiggingProperties(true, 0.5*toughness, 65535./333.*toughness));