3 #define MATERIAL_PROPERTIES_COUNT 256
5 // These correspond to the CONTENT_* constants
6 MaterialProperties g_material_properties[MATERIAL_PROPERTIES_COUNT];
8 bool g_material_properties_initialized = false;
10 void setStoneLikeDiggingProperties(u8 material, float toughness)
12 g_material_properties[material].setDiggingProperties("",
13 DiggingProperties(true, 15.0*toughness, 0));
14 g_material_properties[material].setDiggingProperties("WPick",
15 DiggingProperties(true, 2.0*toughness, 65535./20.*toughness));
16 g_material_properties[material].setDiggingProperties("STPick",
17 DiggingProperties(true, 1.0*toughness, 65535./50.*toughness));
20 void initializeMaterialProperties()
23 Now, the g_material_properties array is already initialized
24 by the constructors to such that no digging is possible.
26 Add some digging properties to them.
29 setStoneLikeDiggingProperties(CONTENT_STONE, 1.0);
31 g_material_properties[CONTENT_GRASS].setDiggingProperties("",
32 DiggingProperties(true, 0.5, 0));
34 g_material_properties[CONTENT_TORCH].setDiggingProperties("",
35 DiggingProperties(true, 0.0, 0));
37 g_material_properties[CONTENT_TREE].setDiggingProperties("",
38 DiggingProperties(true, 1.5, 0));
40 g_material_properties[CONTENT_LEAVES].setDiggingProperties("",
41 DiggingProperties(true, 0.5, 0));
43 g_material_properties[CONTENT_GRASS_FOOTSTEPS].setDiggingProperties("",
44 DiggingProperties(true, 0.5, 0));
46 setStoneLikeDiggingProperties(CONTENT_MESE, 0.5);
48 g_material_properties[CONTENT_MUD].setDiggingProperties("",
49 DiggingProperties(true, 0.5, 0));
51 setStoneLikeDiggingProperties(CONTENT_COALSTONE, 1.5);
53 g_material_properties[CONTENT_WOOD].setDiggingProperties("",
54 DiggingProperties(true, 1.0, 0));
57 g_material_properties_initialized = true;
60 MaterialProperties * getMaterialProperties(u8 material)
62 assert(g_material_properties_initialized);
63 return &g_material_properties[material];
66 DiggingProperties getDiggingProperties(u8 material, const std::string &tool)
68 MaterialProperties *mprop = getMaterialProperties(material);
71 return DiggingProperties();
73 return mprop->getDiggingProperties(tool);