Add name field to ContentFeatures

This commit is contained in:
Perttu Ahola 2011-11-16 09:36:19 +02:00
parent 6a417c538f
commit 50d63e4b0a
3 changed files with 49 additions and 10 deletions

@ -162,6 +162,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
i = CONTENT_STONE; i = CONTENT_STONE;
f = nodemgr->getModifiable(i); f = nodemgr->getModifiable(i);
f->name = "stone";
f->setAllTextures("stone.png"); f->setAllTextures("stone.png");
f->setInventoryTextureCube("stone.png", "stone.png", "stone.png"); f->setInventoryTextureCube("stone.png", "stone.png", "stone.png");
f->param_type = CPT_MINERAL; f->param_type = CPT_MINERAL;
@ -172,6 +173,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
i = CONTENT_GRASS; i = CONTENT_GRASS;
f = nodemgr->getModifiable(i); f = nodemgr->getModifiable(i);
f->name = "grass";
f->setAllTextures("mud.png^grass_side.png"); f->setAllTextures("mud.png^grass_side.png");
f->setTexture(0, "grass.png"); f->setTexture(0, "grass.png");
f->setTexture(1, "mud.png"); f->setTexture(1, "mud.png");
@ -182,6 +184,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
i = CONTENT_GRASS_FOOTSTEPS; i = CONTENT_GRASS_FOOTSTEPS;
f = nodemgr->getModifiable(i); f = nodemgr->getModifiable(i);
f->name = "grass_footsteps";
f->setAllTextures("mud.png^grass_side.png"); f->setAllTextures("mud.png^grass_side.png");
f->setTexture(0, "grass_footsteps.png"); f->setTexture(0, "grass_footsteps.png");
f->setTexture(1, "mud.png"); f->setTexture(1, "mud.png");
@ -192,6 +195,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
i = CONTENT_MUD; i = CONTENT_MUD;
f = nodemgr->getModifiable(i); f = nodemgr->getModifiable(i);
f->name = "dirt";
f->setAllTextures("mud.png"); f->setAllTextures("mud.png");
f->setInventoryTextureCube("mud.png", "mud.png", "mud.png"); f->setInventoryTextureCube("mud.png", "mud.png", "mud.png");
f->param_type = CPT_MINERAL; f->param_type = CPT_MINERAL;
@ -201,6 +205,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
i = CONTENT_SAND; i = CONTENT_SAND;
f = nodemgr->getModifiable(i); f = nodemgr->getModifiable(i);
f->name = "sand";
f->setAllTextures("sand.png"); f->setAllTextures("sand.png");
f->setInventoryTextureCube("sand.png", "sand.png", "sand.png"); f->setInventoryTextureCube("sand.png", "sand.png", "sand.png");
f->param_type = CPT_MINERAL; f->param_type = CPT_MINERAL;
@ -211,6 +216,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
i = CONTENT_GRAVEL; i = CONTENT_GRAVEL;
f = nodemgr->getModifiable(i); f = nodemgr->getModifiable(i);
f->name = "gravel";
f->setAllTextures("gravel.png"); f->setAllTextures("gravel.png");
f->setInventoryTextureCube("gravel.png", "gravel.png", "gravel.png"); f->setInventoryTextureCube("gravel.png", "gravel.png", "gravel.png");
f->param_type = CPT_MINERAL; f->param_type = CPT_MINERAL;
@ -220,6 +226,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
i = CONTENT_SANDSTONE; i = CONTENT_SANDSTONE;
f = nodemgr->getModifiable(i); f = nodemgr->getModifiable(i);
f->name = "sandstone";
f->setAllTextures("sandstone.png"); f->setAllTextures("sandstone.png");
f->setInventoryTextureCube("sandstone.png", "sandstone.png", "sandstone.png"); f->setInventoryTextureCube("sandstone.png", "sandstone.png", "sandstone.png");
f->param_type = CPT_MINERAL; f->param_type = CPT_MINERAL;
@ -229,6 +236,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
i = CONTENT_CLAY; i = CONTENT_CLAY;
f = nodemgr->getModifiable(i); f = nodemgr->getModifiable(i);
f->name = "clay";
f->setAllTextures("clay.png"); f->setAllTextures("clay.png");
f->setInventoryTextureCube("clay.png", "clay.png", "clay.png"); f->setInventoryTextureCube("clay.png", "clay.png", "clay.png");
f->param_type = CPT_MINERAL; f->param_type = CPT_MINERAL;
@ -238,6 +246,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
i = CONTENT_BRICK; i = CONTENT_BRICK;
f = nodemgr->getModifiable(i); f = nodemgr->getModifiable(i);
f->name = "brick";
f->setAllTextures("brick.png"); f->setAllTextures("brick.png");
f->setInventoryTextureCube("brick.png", "brick.png", "brick.png"); f->setInventoryTextureCube("brick.png", "brick.png", "brick.png");
f->param_type = CPT_MINERAL; f->param_type = CPT_MINERAL;
@ -247,6 +256,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
i = CONTENT_TREE; i = CONTENT_TREE;
f = nodemgr->getModifiable(i); f = nodemgr->getModifiable(i);
f->name = "tree";
f->setAllTextures("tree.png"); f->setAllTextures("tree.png");
f->setTexture(0, "tree_top.png"); f->setTexture(0, "tree_top.png");
f->setTexture(1, "tree_top.png"); f->setTexture(1, "tree_top.png");
@ -259,6 +269,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
i = CONTENT_JUNGLETREE; i = CONTENT_JUNGLETREE;
f = nodemgr->getModifiable(i); f = nodemgr->getModifiable(i);
f->name = "jungletree";
f->setAllTextures("jungletree.png"); f->setAllTextures("jungletree.png");
f->setTexture(0, "jungletree_top.png"); f->setTexture(0, "jungletree_top.png");
f->setTexture(1, "jungletree_top.png"); f->setTexture(1, "jungletree_top.png");
@ -269,6 +280,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
i = CONTENT_JUNGLEGRASS; i = CONTENT_JUNGLEGRASS;
f = nodemgr->getModifiable(i); f = nodemgr->getModifiable(i);
f->name = "junglegrass";
f->drawtype = NDT_PLANTLIKE; f->drawtype = NDT_PLANTLIKE;
f->visual_scale = 1.3; f->visual_scale = 1.3;
f->setAllTextures("junglegrass.png"); f->setAllTextures("junglegrass.png");
@ -283,6 +295,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
i = CONTENT_LEAVES; i = CONTENT_LEAVES;
f = nodemgr->getModifiable(i); f = nodemgr->getModifiable(i);
f->name = "leaves";
f->drawtype = NDT_ALLFACES_OPTIONAL; f->drawtype = NDT_ALLFACES_OPTIONAL;
f->setAllTextures("leaves.png"); f->setAllTextures("leaves.png");
//f->setAllTextures("[noalpha:leaves.png"); //f->setAllTextures("[noalpha:leaves.png");
@ -296,6 +309,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
i = CONTENT_CACTUS; i = CONTENT_CACTUS;
f = nodemgr->getModifiable(i); f = nodemgr->getModifiable(i);
f->name = "cactus";
f->setAllTextures("cactus_side.png"); f->setAllTextures("cactus_side.png");
f->setTexture(0, "cactus_top.png"); f->setTexture(0, "cactus_top.png");
f->setTexture(1, "cactus_top.png"); f->setTexture(1, "cactus_top.png");
@ -308,6 +322,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
i = CONTENT_PAPYRUS; i = CONTENT_PAPYRUS;
f = nodemgr->getModifiable(i); f = nodemgr->getModifiable(i);
f->name = "papyrus";
f->drawtype = NDT_PLANTLIKE; f->drawtype = NDT_PLANTLIKE;
f->setAllTextures("papyrus.png"); f->setAllTextures("papyrus.png");
f->setInventoryTexture("papyrus.png"); f->setInventoryTexture("papyrus.png");
@ -321,6 +336,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
i = CONTENT_BOOKSHELF; i = CONTENT_BOOKSHELF;
f = nodemgr->getModifiable(i); f = nodemgr->getModifiable(i);
f->name = "bookshelf";
f->setAllTextures("bookshelf.png"); f->setAllTextures("bookshelf.png");
f->setTexture(0, "wood.png"); f->setTexture(0, "wood.png");
f->setTexture(1, "wood.png"); f->setTexture(1, "wood.png");
@ -334,6 +350,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
i = CONTENT_GLASS; i = CONTENT_GLASS;
f = nodemgr->getModifiable(i); f = nodemgr->getModifiable(i);
f->name = "glass";
f->drawtype = NDT_GLASSLIKE; f->drawtype = NDT_GLASSLIKE;
f->setAllTextures("glass.png"); f->setAllTextures("glass.png");
f->light_propagates = true; f->light_propagates = true;
@ -346,6 +363,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
i = CONTENT_FENCE; i = CONTENT_FENCE;
f = nodemgr->getModifiable(i); f = nodemgr->getModifiable(i);
f->name = "fence";
f->drawtype = NDT_FENCELIKE; f->drawtype = NDT_FENCELIKE;
f->setInventoryTexture("fence.png"); f->setInventoryTexture("fence.png");
f->setTexture(0, "wood.png"); f->setTexture(0, "wood.png");
@ -362,6 +380,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
i = CONTENT_RAIL; i = CONTENT_RAIL;
f = nodemgr->getModifiable(i); f = nodemgr->getModifiable(i);
f->name = "rail";
f->drawtype = NDT_RAILLIKE; f->drawtype = NDT_RAILLIKE;
f->setInventoryTexture("rail.png"); f->setInventoryTexture("rail.png");
f->setTexture(0, "rail.png"); f->setTexture(0, "rail.png");
@ -380,6 +399,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
i = CONTENT_LADDER; i = CONTENT_LADDER;
f = nodemgr->getModifiable(i); f = nodemgr->getModifiable(i);
f->name = "ladder";
f->drawtype = NDT_SIGNLIKE; f->drawtype = NDT_SIGNLIKE;
f->setAllTextures("ladder.png"); f->setAllTextures("ladder.png");
f->setInventoryTexture("ladder.png"); f->setInventoryTexture("ladder.png");
@ -398,12 +418,14 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
// Deprecated // Deprecated
i = CONTENT_COALSTONE; i = CONTENT_COALSTONE;
f = nodemgr->getModifiable(i); f = nodemgr->getModifiable(i);
f->name = "coalstone";
f->setAllTextures("stone.png^mineral_coal.png"); f->setAllTextures("stone.png^mineral_coal.png");
f->is_ground_content = true; f->is_ground_content = true;
setStoneLikeMaterialProperties(f->material, 1.5); setStoneLikeMaterialProperties(f->material, 1.5);
i = CONTENT_WOOD; i = CONTENT_WOOD;
f = nodemgr->getModifiable(i); f = nodemgr->getModifiable(i);
f->name = "wood";
f->setAllTextures("wood.png"); f->setAllTextures("wood.png");
f->setInventoryTextureCube("wood.png", "wood.png", "wood.png"); f->setInventoryTextureCube("wood.png", "wood.png", "wood.png");
f->is_ground_content = true; f->is_ground_content = true;
@ -413,6 +435,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
i = CONTENT_MESE; i = CONTENT_MESE;
f = nodemgr->getModifiable(i); f = nodemgr->getModifiable(i);
f->name = "mese";
f->setAllTextures("mese.png"); f->setAllTextures("mese.png");
f->setInventoryTextureCube("mese.png", "mese.png", "mese.png"); f->setInventoryTextureCube("mese.png", "mese.png", "mese.png");
f->is_ground_content = true; f->is_ground_content = true;
@ -422,6 +445,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
i = CONTENT_CLOUD; i = CONTENT_CLOUD;
f = nodemgr->getModifiable(i); f = nodemgr->getModifiable(i);
f->name = "cloud";
f->setAllTextures("cloud.png"); f->setAllTextures("cloud.png");
f->setInventoryTextureCube("cloud.png", "cloud.png", "cloud.png"); f->setInventoryTextureCube("cloud.png", "cloud.png", "cloud.png");
f->is_ground_content = true; f->is_ground_content = true;
@ -429,6 +453,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
i = CONTENT_AIR; i = CONTENT_AIR;
f = nodemgr->getModifiable(i); f = nodemgr->getModifiable(i);
f->name = "air";
f->param_type = CPT_LIGHT; f->param_type = CPT_LIGHT;
f->light_propagates = true; f->light_propagates = true;
f->sunlight_propagates = true; f->sunlight_propagates = true;
@ -440,6 +465,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
i = CONTENT_WATER; i = CONTENT_WATER;
f = nodemgr->getModifiable(i); f = nodemgr->getModifiable(i);
f->name = "water_flowing";
f->drawtype = NDT_FLOWINGLIQUID; f->drawtype = NDT_FLOWINGLIQUID;
f->setAllTextures("water.png"); f->setAllTextures("water.png");
f->alpha = WATER_ALPHA; f->alpha = WATER_ALPHA;
@ -460,6 +486,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
i = CONTENT_WATERSOURCE; i = CONTENT_WATERSOURCE;
f = nodemgr->getModifiable(i); f = nodemgr->getModifiable(i);
f->name = "water_source";
f->drawtype = NDT_LIQUID; f->drawtype = NDT_LIQUID;
f->setAllTextures("water.png"); f->setAllTextures("water.png");
f->alpha = WATER_ALPHA; f->alpha = WATER_ALPHA;
@ -481,6 +508,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
i = CONTENT_LAVA; i = CONTENT_LAVA;
f = nodemgr->getModifiable(i); f = nodemgr->getModifiable(i);
f->name = "lava_flowing";
f->drawtype = NDT_FLOWINGLIQUID; f->drawtype = NDT_FLOWINGLIQUID;
f->setAllTextures("lava.png"); f->setAllTextures("lava.png");
f->setInventoryTextureCube("lava.png", "lava.png", "lava.png"); f->setInventoryTextureCube("lava.png", "lava.png", "lava.png");
@ -502,6 +530,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
i = CONTENT_LAVASOURCE; i = CONTENT_LAVASOURCE;
f = nodemgr->getModifiable(i); f = nodemgr->getModifiable(i);
f->name = "lava_source";
f->drawtype = NDT_LIQUID; f->drawtype = NDT_LIQUID;
f->setAllTextures("lava.png"); f->setAllTextures("lava.png");
f->setInventoryTextureCube("lava.png", "lava.png", "lava.png"); f->setInventoryTextureCube("lava.png", "lava.png", "lava.png");
@ -525,6 +554,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
i = CONTENT_TORCH; i = CONTENT_TORCH;
f = nodemgr->getModifiable(i); f = nodemgr->getModifiable(i);
f->name = "torch";
f->drawtype = NDT_TORCHLIKE; f->drawtype = NDT_TORCHLIKE;
f->setTexture(0, "torch_on_floor.png"); f->setTexture(0, "torch_on_floor.png");
f->setTexture(1, "torch_on_ceiling.png"); f->setTexture(1, "torch_on_ceiling.png");
@ -550,6 +580,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
i = CONTENT_SIGN_WALL; i = CONTENT_SIGN_WALL;
f = nodemgr->getModifiable(i); f = nodemgr->getModifiable(i);
f->name = "sign_wall";
f->drawtype = NDT_SIGNLIKE; f->drawtype = NDT_SIGNLIKE;
f->setAllTextures("sign_wall.png"); f->setAllTextures("sign_wall.png");
f->setInventoryTexture("sign_wall.png"); f->setInventoryTexture("sign_wall.png");
@ -568,6 +599,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
i = CONTENT_CHEST; i = CONTENT_CHEST;
f = nodemgr->getModifiable(i); f = nodemgr->getModifiable(i);
f->name = "chest";
f->param_type = CPT_FACEDIR_SIMPLE; f->param_type = CPT_FACEDIR_SIMPLE;
f->setAllTextures("chest_side.png"); f->setAllTextures("chest_side.png");
f->setTexture(0, "chest_top.png"); f->setTexture(0, "chest_top.png");
@ -583,6 +615,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
i = CONTENT_LOCKABLE_CHEST; i = CONTENT_LOCKABLE_CHEST;
f = nodemgr->getModifiable(i); f = nodemgr->getModifiable(i);
f->name = "locked_chest";
f->param_type = CPT_FACEDIR_SIMPLE; f->param_type = CPT_FACEDIR_SIMPLE;
f->setAllTextures("chest_side.png"); f->setAllTextures("chest_side.png");
f->setTexture(0, "chest_top.png"); f->setTexture(0, "chest_top.png");
@ -598,6 +631,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
i = CONTENT_FURNACE; i = CONTENT_FURNACE;
f = nodemgr->getModifiable(i); f = nodemgr->getModifiable(i);
f->name = "furnace";
f->param_type = CPT_FACEDIR_SIMPLE; f->param_type = CPT_FACEDIR_SIMPLE;
f->setAllTextures("furnace_side.png"); f->setAllTextures("furnace_side.png");
f->setTexture(5, "furnace_front.png"); // Z- f->setTexture(5, "furnace_front.png"); // Z-
@ -610,6 +644,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
i = CONTENT_COBBLE; i = CONTENT_COBBLE;
f = nodemgr->getModifiable(i); f = nodemgr->getModifiable(i);
f->name = "cobble";
f->setAllTextures("cobble.png"); f->setAllTextures("cobble.png");
f->setInventoryTextureCube("cobble.png", "cobble.png", "cobble.png"); f->setInventoryTextureCube("cobble.png", "cobble.png", "cobble.png");
f->param_type = CPT_NONE; f->param_type = CPT_NONE;
@ -620,6 +655,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
i = CONTENT_MOSSYCOBBLE; i = CONTENT_MOSSYCOBBLE;
f = nodemgr->getModifiable(i); f = nodemgr->getModifiable(i);
f->name = "mossycobble";
f->setAllTextures("mossycobble.png"); f->setAllTextures("mossycobble.png");
f->setInventoryTextureCube("mossycobble.png", "mossycobble.png", "mossycobble.png"); f->setInventoryTextureCube("mossycobble.png", "mossycobble.png", "mossycobble.png");
f->param_type = CPT_NONE; f->param_type = CPT_NONE;
@ -629,6 +665,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
i = CONTENT_STEEL; i = CONTENT_STEEL;
f = nodemgr->getModifiable(i); f = nodemgr->getModifiable(i);
f->name = "steelblock";
f->setAllTextures("steel_block.png"); f->setAllTextures("steel_block.png");
f->setInventoryTextureCube("steel_block.png", "steel_block.png", f->setInventoryTextureCube("steel_block.png", "steel_block.png",
"steel_block.png"); "steel_block.png");
@ -639,6 +676,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
i = CONTENT_NC; i = CONTENT_NC;
f = nodemgr->getModifiable(i); f = nodemgr->getModifiable(i);
f->name = "nyancat";
f->param_type = CPT_FACEDIR_SIMPLE; f->param_type = CPT_FACEDIR_SIMPLE;
f->setAllTextures("nc_side.png"); f->setAllTextures("nc_side.png");
f->setTexture(5, "nc_front.png"); // Z- f->setTexture(5, "nc_front.png"); // Z-
@ -650,6 +688,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
i = CONTENT_NC_RB; i = CONTENT_NC_RB;
f = nodemgr->getModifiable(i); f = nodemgr->getModifiable(i);
f->name = "nyancat_rainbow";
f->setAllTextures("nc_rb.png"); f->setAllTextures("nc_rb.png");
f->setInventoryTexture("nc_rb.png"); f->setInventoryTexture("nc_rb.png");
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1"; f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
@ -658,6 +697,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
i = CONTENT_SAPLING; i = CONTENT_SAPLING;
f = nodemgr->getModifiable(i); f = nodemgr->getModifiable(i);
f->name = "sapling";
f->drawtype = NDT_PLANTLIKE; f->drawtype = NDT_PLANTLIKE;
f->visual_scale = 1.0; f->visual_scale = 1.0;
f->setAllTextures("sapling.png"); f->setAllTextures("sapling.png");
@ -672,6 +712,7 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr)
i = CONTENT_APPLE; i = CONTENT_APPLE;
f = nodemgr->getModifiable(i); f = nodemgr->getModifiable(i);
f->name = "apple";
f->drawtype = NDT_PLANTLIKE; f->drawtype = NDT_PLANTLIKE;
f->visual_scale = 1.0; f->visual_scale = 1.0;
f->setAllTextures("apple.png"); f->setAllTextures("apple.png");

@ -114,10 +114,10 @@ void ContentFeatures::reset()
backface_culling = true; backface_culling = true;
#endif #endif
used_texturenames.clear(); used_texturenames.clear();
modified = true; // NodeDefManager explicitly sets to false
/* /*
Actual data Actual data
*/ */
name = "";
drawtype = NDT_NORMAL; drawtype = NDT_NORMAL;
visual_scale = 1.0; visual_scale = 1.0;
for(u32 i=0; i<6; i++) for(u32 i=0; i<6; i++)
@ -159,6 +159,7 @@ void ContentFeatures::reset()
void ContentFeatures::serialize(std::ostream &os) void ContentFeatures::serialize(std::ostream &os)
{ {
writeU8(os, 0); // version writeU8(os, 0); // version
os<<serializeString(name);
writeU8(os, drawtype); writeU8(os, drawtype);
writeF1000(os, visual_scale); writeF1000(os, visual_scale);
writeU8(os, 6); writeU8(os, 6);
@ -213,6 +214,7 @@ void ContentFeatures::deSerialize(std::istream &is, IGameDef *gamedef)
int version = readU8(is); int version = readU8(is);
if(version != 0) if(version != 0)
throw SerializationError("unsupported ContentFeatures version"); throw SerializationError("unsupported ContentFeatures version");
name = deSerializeString(is);
drawtype = (enum NodeDrawType)readU8(is); drawtype = (enum NodeDrawType)readU8(is);
visual_scale = readF1000(is); visual_scale = readF1000(is);
if(readU8(is) != 6) if(readU8(is) != 6)
@ -320,13 +322,11 @@ public:
{ {
ContentFeatures *f = &m_content_features[i]; ContentFeatures *f = &m_content_features[i];
f->reset(); // Reset to defaults f->reset(); // Reset to defaults
f->modified = false; // Not changed from default
if(i == CONTENT_IGNORE || i == CONTENT_AIR){ if(i == CONTENT_IGNORE || i == CONTENT_AIR){
f->drawtype = NDT_AIRLIKE; f->drawtype = NDT_AIRLIKE;
continue; continue;
} }
f->setAllTextures("unknown_block.png"); f->setAllTextures("unknown_block.png");
//f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
} }
#ifndef SERVER #ifndef SERVER
// Make CONTENT_IGNORE to not block the view when occlusion culling // Make CONTENT_IGNORE to not block the view when occlusion culling
@ -361,14 +361,14 @@ public:
// Writable // Writable
virtual void set(content_t c, const ContentFeatures &def) virtual void set(content_t c, const ContentFeatures &def)
{ {
infostream<<"registerNode: registering content \""<<c<<"\""<<std::endl; infostream<<"registerNode: registering content id \""<<c
<<"\": name=\""<<def.name<<"\""<<std::endl;
assert(c <= MAX_CONTENT); assert(c <= MAX_CONTENT);
m_content_features[c] = def; m_content_features[c] = def;
} }
virtual ContentFeatures* getModifiable(content_t c) virtual ContentFeatures* getModifiable(content_t c)
{ {
assert(c <= MAX_CONTENT); assert(c <= MAX_CONTENT);
m_content_features[c].modified = true; // Assume it is modified
return &m_content_features[c]; return &m_content_features[c];
} }
virtual void updateTextures(ITextureSource *tsrc) virtual void updateTextures(ITextureSource *tsrc)
@ -500,7 +500,7 @@ public:
for(u16 i=0; i<=MAX_CONTENT; i++) for(u16 i=0; i<=MAX_CONTENT; i++)
{ {
ContentFeatures *f = &m_content_features[i]; ContentFeatures *f = &m_content_features[i];
if(!f->modified) if(f->name == "")
continue; continue;
writeU16(tmp_os, i); writeU16(tmp_os, i);
f->serialize(tmp_os); f->serialize(tmp_os);
@ -523,7 +523,6 @@ public:
} }
ContentFeatures *f = &m_content_features[i]; ContentFeatures *f = &m_content_features[i];
f->deSerialize(tmp_is, gamedef); f->deSerialize(tmp_is, gamedef);
f->modified = true;
} }
} }
private: private:

@ -138,13 +138,12 @@ struct ContentFeatures
// the texture atlas // the texture atlas
std::set<std::string> used_texturenames; std::set<std::string> used_texturenames;
// True if this actually contains non-default data
bool modified;
/* /*
Actual data Actual data
*/ */
std::string name; // "" = undefined node
// Visual definition // Visual definition
enum NodeDrawType drawtype; enum NodeDrawType drawtype;
float visual_scale; // Misc. scale parameter float visual_scale; // Misc. scale parameter