aboutsummaryrefslogtreecommitdiff
path: root/src/content_mapnode.cpp
diff options
context:
space:
mode:
authorNils Dagsson Moskopp <nils@dieweltistgarnichtso.net>2011-07-30 18:53:54 +0200
committerNils Dagsson Moskopp <nils@dieweltistgarnichtso.net>2011-07-30 18:55:43 +0200
commit4ef9c7675ada82961d83601712a47ebad78b67b5 (patch)
treecdfd863219a8dc1031e727740e7d895296c5855d /src/content_mapnode.cpp
parentf69123050b62ada635751b7155bb6822b0a97a9b (diff)
parentdbea511a6f877450cfd5adb86efa55a8f00cc9a1 (diff)
downloadminetest-4ef9c7675ada82961d83601712a47ebad78b67b5.tar.gz
minetest-4ef9c7675ada82961d83601712a47ebad78b67b5.tar.bz2
minetest-4ef9c7675ada82961d83601712a47ebad78b67b5.zip
Merge remote-tracking branch 'origin/upstream'
Diffstat (limited to 'src/content_mapnode.cpp')
-rw-r--r--src/content_mapnode.cpp86
1 files changed, 84 insertions, 2 deletions
diff --git a/src/content_mapnode.cpp b/src/content_mapnode.cpp
index 79e10fd61..db036ebd9 100644
--- a/src/content_mapnode.cpp
+++ b/src/content_mapnode.cpp
@@ -31,6 +31,65 @@ void setStoneLikeDiggingProperties(DiggingPropertiesList &list, float toughness)
void setDirtLikeDiggingProperties(DiggingPropertiesList &list, float toughness);
void setWoodLikeDiggingProperties(DiggingPropertiesList &list, float toughness);
+content_t trans_table_19[][2] = {
+ {CONTENT_GRASS, 1},
+ {CONTENT_TREE, 4},
+ {CONTENT_LEAVES, 5},
+ {CONTENT_GRASS_FOOTSTEPS, 6},
+ {CONTENT_MESE, 7},
+ {CONTENT_MUD, 8},
+ {CONTENT_CLOUD, 10},
+ {CONTENT_COALSTONE, 11},
+ {CONTENT_WOOD, 12},
+ {CONTENT_SAND, 13},
+ {CONTENT_COBBLE, 18},
+ {CONTENT_STEEL, 19},
+ {CONTENT_GLASS, 20},
+ {CONTENT_MOSSYCOBBLE, 22},
+ {CONTENT_GRAVEL, 23},
+ {CONTENT_SANDSTONE, 24},
+ {CONTENT_CACTUS, 25},
+ {CONTENT_BRICK, 26},
+ {CONTENT_CLAY, 27},
+ {CONTENT_PAPYRUS, 28},
+ {CONTENT_BOOKSHELF, 29},
+};
+
+MapNode mapnode_translate_from_internal(MapNode n_from, u8 version)
+{
+ MapNode result = n_from;
+ if(version <= 19)
+ {
+ content_t c_from = n_from.getContent();
+ for(u32 i=0; i<sizeof(trans_table_19)/sizeof(trans_table_19[0]); i++)
+ {
+ if(trans_table_19[i][0] == c_from)
+ {
+ result.setContent(trans_table_19[i][1]);
+ break;
+ }
+ }
+ }
+ return result;
+}
+MapNode mapnode_translate_to_internal(MapNode n_from, u8 version)
+{
+ MapNode result = n_from;
+ if(version <= 19)
+ {
+ content_t c_from = n_from.getContent();
+ for(u32 i=0; i<sizeof(trans_table_19)/sizeof(trans_table_19[0]); i++)
+ {
+ if(trans_table_19[i][1] == c_from)
+ {
+ result.setContent(trans_table_19[i][0]);
+ break;
+ }
+ }
+ }
+ return result;
+}
+
void content_mapnode_init()
{
// Read some settings
@@ -38,7 +97,7 @@ void content_mapnode_init()
bool new_style_leaves = g_settings.getBool("new_style_leaves");
bool invisible_stone = g_settings.getBool("invisible_stone");
- u8 i;
+ content_t i;
ContentFeatures *f = NULL;
i = CONTENT_STONE;
@@ -136,12 +195,34 @@ void content_mapnode_init()
f->dug_item = std::string("MaterialItem ")+itos(i)+" 1";
setWoodLikeDiggingProperties(f->digging_properties, 1.0);
+ i = CONTENT_JUNGLETREE;
+ f = &content_features(i);
+ f->setAllTextures("jungletree.png");
+ f->setTexture(0, "jungletree_top.png");
+ f->setTexture(1, "jungletree_top.png");
+ f->param_type = CPT_MINERAL;
+ //f->is_ground_content = true;
+ f->dug_item = std::string("MaterialItem ")+itos(i)+" 1";
+ setWoodLikeDiggingProperties(f->digging_properties, 1.0);
+
+ i = CONTENT_JUNGLEGRASS;
+ f = &content_features(i);
+ f->setInventoryTexture("junglegrass.png");
+ f->light_propagates = true;
+ f->param_type = CPT_LIGHT;
+ //f->is_ground_content = true;
+ f->air_equivalent = false; // grass grows underneath
+ f->dug_item = std::string("MaterialItem ")+itos(i)+" 1";
+ f->solidness = 0; // drawn separately, makes no faces
+ f->walkable = false;
+ setWoodLikeDiggingProperties(f->digging_properties, 0.10);
+
i = CONTENT_LEAVES;
f = &content_features(i);
f->light_propagates = true;
//f->param_type = CPT_MINERAL;
f->param_type = CPT_LIGHT;
- f->is_ground_content = true;
+ //f->is_ground_content = true;
if(new_style_leaves)
{
f->solidness = 0; // drawn separately, makes no faces
@@ -191,6 +272,7 @@ void content_mapnode_init()
i = CONTENT_GLASS;
f = &content_features(i);
f->light_propagates = true;
+ f->sunlight_propagates = true;
f->param_type = CPT_LIGHT;
f->is_ground_content = true;
f->dug_item = std::string("MaterialItem ")+itos(i)+" 1";