-
-enum ContentParamType
-{
- CPT_NONE,
- CPT_LIGHT,
- CPT_MINERAL,
- // Direction for chests and furnaces and such
- CPT_FACEDIR_SIMPLE
-};
-
-enum LiquidType
-{
- LIQUID_NONE,
- LIQUID_FLOWING,
- LIQUID_SOURCE
-};
-
-class MapNode;
-class NodeMetadata;
-
-struct ContentFeatures
-{
- // If non-NULL, content is translated to this when deserialized
- MapNode *translate_to;
-
- // Type of MapNode::param
- ContentParamType param_type;
-
- /*
- 0: up
- 1: down
- 2: right
- 3: left
- 4: back
- 5: front
- */
- TileSpec tiles[6];
-
- video::ITexture *inventory_texture;
-
- bool is_ground_content;
- bool light_propagates;
- bool sunlight_propagates;
- u8 solidness; // Used when choosing which face is drawn
- // This is used for collision detection.
- // Also for general solidness queries.
- bool walkable;
- // Player can point to these
- bool pointable;
- // Player can dig these
- bool diggable;
- // Player can build on these
- bool buildable_to;
- // Whether the node has no liquid, source liquid or flowing liquid
- enum LiquidType liquid_type;
- // If true, param2 is set to direction when placed. Used for torches.
- // NOTE: the direction format is quite inefficient and should be changed
- bool wall_mounted;
- // If true, node is equivalent to air. Torches are, air is. Water is not.
- // Is used for example to check whether a mud block can have grass on.
- bool air_equivalent;
-
- // Inventory item string as which the node appears in inventory when dug.
- // Mineral overrides this.
- std::string dug_item;
-
- // Initial metadata is cloned from this
- NodeMetadata *initial_metadata;
-
- //TODO: Move more properties here
-
- ContentFeatures()
- {
- translate_to = NULL;
- param_type = CPT_NONE;
- inventory_texture = NULL;
- is_ground_content = false;
- light_propagates = false;
- sunlight_propagates = false;
- solidness = 2;
- walkable = true;
- pointable = true;
- diggable = true;
- buildable_to = false;
- liquid_type = LIQUID_NONE;
- wall_mounted = false;
- air_equivalent = false;
- dug_item = "";
- initial_metadata = NULL;
- }
-
- ~ContentFeatures();
-
- /*
- Quickhands for simple materials
- */
-
- void setTexture(u16 i, std::string name, u8 alpha=255);
-
- void setAllTextures(std::string name, u8 alpha=255)
- {
- for(u16 i=0; i<6; i++)
- {
- setTexture(i, name, alpha);
- }
- }
-
- void setTile(u16 i, const TileSpec &tile)
- {
- tiles[i] = tile;
- }
- void setAllTiles(const TileSpec &tile)
- {
- for(u16 i=0; i<6; i++)
- {
- setTile(i, tile);
- }
- }
-
- void setInventoryTexture(std::string imgname);
-
- void setInventoryTextureCube(std::string top,
- std::string left, std::string right);
-};