#include "common_irrlicht.h"
#include "mapnode.h"
+#ifndef SERVER
#include "tile.h"
+#endif
#include "porting.h"
#include <string>
#include "mineral.h"
ContentFeatures::~ContentFeatures()
{
- if(initial_metadata)
- delete initial_metadata;
+ delete initial_metadata;
+#ifndef SERVER
+ delete special_material;
+ delete special_atlas;
+#endif
}
+#ifndef SERVER
void ContentFeatures::setTexture(u16 i, std::string name, u8 alpha)
{
+ used_texturenames[name] = true;
+
if(g_texturesource)
{
tiles[i].texture = g_texturesource->getTexture(name);
imgname_full += right;
inventory_texture = g_texturesource->getTextureRaw(imgname_full);
}
+#endif
struct ContentFeatures g_content_features[MAX_CONTENT+1];
/*
Initialize content feature table
*/
-
+
+#ifndef SERVER
/*
Set initial material type to same in all tiles, so that the
same material can be used in more stuff.
for(u16 j=0; j<6; j++)
f->tiles[j].material_type = initial_material_type;
}
+#endif
/*
Initially set every block to be shown as an unknown block.
continue;
ContentFeatures *f = &g_content_features[i];
f->setAllTextures("unknown_block.png");
- f->dug_item = std::string("MaterialItem ")+itos(i)+" 1";
+ f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
}
+ // Make CONTENT_IGNORE to not block the view when occlusion culling
+ content_features(CONTENT_IGNORE).solidness = 0;
+
/*
Initialize mapnode content
*/
}
+/*
+ Nodes make a face if contents differ and solidness differs.
+ Return value:
+ 0: No face
+ 1: Face uses m1's content
+ 2: Face uses m2's content
+ equivalent: Whether the blocks share the same face (eg. water and glass)
+*/
+u8 face_contents(content_t m1, content_t m2, bool *equivalent)
+{
+ *equivalent = false;
+
+ if(m1 == CONTENT_IGNORE || m2 == CONTENT_IGNORE)
+ return 0;
+
+ bool contents_differ = (m1 != m2);
+
+ // Contents don't differ for different forms of same liquid
+ if(content_liquid(m1) && content_liquid(m2)
+ && make_liquid_flowing(m1) == make_liquid_flowing(m2))
+ contents_differ = false;
+
+ u8 c1 = content_solidness(m1);
+ u8 c2 = content_solidness(m2);
+
+ bool solidness_differs = (c1 != c2);
+ bool makes_face = contents_differ && solidness_differs;
+
+ if(makes_face == false)
+ return 0;
+
+ if(c1 == 0)
+ c1 = content_features(m1).visual_solidness;
+ if(c2 == 0)
+ c2 = content_features(m2).visual_solidness;
+
+ if(c1 == c2){
+ *equivalent = true;
+ // If same solidness, liquid takes precense
+ if(content_features(m1).liquid_type != LIQUID_NONE)
+ return 1;
+ if(content_features(m2).liquid_type != LIQUID_NONE)
+ return 2;
+ }
+
+ if(c1 > c2)
+ return 1;
+ else
+ return 2;
+}
+
v3s16 facedir_rotate(u8 facedir, v3s16 dir)
{
/*
return newdir;
}
+#ifndef SERVER
TileSpec MapNode::getTile(v3s16 dir)
{
if(content_features(*this).param_type == CPT_FACEDIR_SIMPLE)
return spec;
}
+#endif
u8 MapNode::getMineral()
{