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));
15 g_material_properties[material].setDiggingProperties("WPick",
16 DiggingProperties(true, 1.5*toughness, 65535./30.*toughness));
17 g_material_properties[material].setDiggingProperties("STPick",
18 DiggingProperties(true, 0.7*toughness, 65535./100.*toughness));
20 /*g_material_properties[material].setDiggingProperties("MesePick",
21 DiggingProperties(true, 0.0*toughness, 65535./20.*toughness));*/
24 void initializeMaterialProperties()
27 Now, the g_material_properties array is already initialized
28 by the constructors to such that no digging is possible.
30 Add some digging properties to them.
33 setStoneLikeDiggingProperties(CONTENT_STONE, 1.0);
35 g_material_properties[CONTENT_GRASS].setDiggingProperties("",
36 DiggingProperties(true, 0.5, 0));
38 g_material_properties[CONTENT_TORCH].setDiggingProperties("",
39 DiggingProperties(true, 0.0, 0));
41 g_material_properties[CONTENT_TREE].setDiggingProperties("",
42 DiggingProperties(true, 1.5, 0));
44 g_material_properties[CONTENT_LEAVES].setDiggingProperties("",
45 DiggingProperties(true, 0.5, 0));
47 g_material_properties[CONTENT_GRASS_FOOTSTEPS].setDiggingProperties("",
48 DiggingProperties(true, 0.5, 0));
50 setStoneLikeDiggingProperties(CONTENT_MESE, 0.5);
52 g_material_properties[CONTENT_MUD].setDiggingProperties("",
53 DiggingProperties(true, 0.5, 0));
55 setStoneLikeDiggingProperties(CONTENT_COALSTONE, 1.5);
57 g_material_properties[CONTENT_WOOD].setDiggingProperties("",
58 DiggingProperties(true, 1.0, 0));
61 Add MesePick to everything
63 for(u16 i=0; i<MATERIAL_PROPERTIES_COUNT; i++)
65 g_material_properties[i].setDiggingProperties("MesePick",
66 DiggingProperties(true, 0.0, 65535./1337));
69 g_material_properties_initialized = true;
72 MaterialProperties * getMaterialProperties(u8 material)
74 assert(g_material_properties_initialized);
75 return &g_material_properties[material];
78 DiggingProperties getDiggingProperties(u8 material, const std::string &tool)
80 MaterialProperties *mprop = getMaterialProperties(material);
83 return DiggingProperties();
85 return mprop->getDiggingProperties(tool);