good bye wooden tools

This commit is contained in:
darkrose 2015-10-08 19:55:56 +10:00
parent 3a0be833aa
commit 7980c37aa8
19 changed files with 110 additions and 39 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 402 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 443 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 428 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 260 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 296 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 346 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 269 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 168 B

View File

@ -214,6 +214,28 @@ void content_mapnode_init(bool repeat)
lists::add("creative",i);
lists::add("decrafting",i);
i = CONTENT_ROCK;
f = &content_features(i);
f->description = wgettext("Rock");
f->setAllTextures("stone.png");
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
f->type = CMT_DIRT;
f->hardness = 0.01;
f->param_type = CPT_LIGHT;
f->draw_type = CDT_NODEBOX;
f->light_propagates = true;
f->sunlight_propagates = true;
f->air_equivalent = true;
f->buildable_to = true;
f->solidness = 0; // drawn separately, makes no faces
f->suffocation_per_second = 0;
content_nodebox_rock(f);
f->setInventoryTextureNodeBox(i,"stone.png", "stone.png", "stone.png");
crafting::set1To2Recipe(CONTENT_STONE_KNOB,CONTENT_ROCK);
crafting::set1To2Recipe(CONTENT_ROUGHSTONE_KNOB,CONTENT_ROCK);
lists::add("craftguide",i);
lists::add("creative",i);
i = CONTENT_ICE;
f = &content_features(i);
f->description = wgettext("Ice");
@ -443,6 +465,8 @@ void content_mapnode_init(bool repeat)
f->draw_type = CDT_CUBELIKE;
f->is_ground_content = true;
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
f->extra_dug_item = std::string("MaterialItem2 ")+itos(CONTENT_ROCK)+" 1";
f->extra_dug_item_rarity = 5;
f->type = CMT_DIRT;
f->hardness = 1.0;
f->farm_ploughable = true;

View File

@ -49,7 +49,7 @@ MapNode mapnode_translate_to_internal(MapNode n_from, u8 version);
#define CONTENT_STONE 0x000
#define CONTENT_LIMESTONE 0x001
#define CONTENT_WATER 0x002
// FREE 0x003
#define CONTENT_ROCK 0x003
#define CONTENT_GLASSLIGHT 0x004
#define CONTENT_CHAIR 0x005
#define CONTENT_FORGE 0x006

View File

@ -50,7 +50,7 @@ void content_mapnode_plants(bool repeat)
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
f->cook_result = std::string("CraftItem lump_of_charcoal 1");
f->fuel_time = 30;
f->type = CMT_WOOD;
f->type = CMT_TREE;
f->hardness = 1.0;
f->ondig_special_drop = CONTENT_WOOD;
f->ondig_special_drop_count = 6;
@ -71,7 +71,7 @@ void content_mapnode_plants(bool repeat)
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
f->cook_result = std::string("CraftItem lump_of_charcoal 1");
f->fuel_time = 30;
f->type = CMT_WOOD;
f->type = CMT_TREE;
f->hardness = 1.0;
f->ondig_special_drop = CONTENT_WOOD;
f->ondig_special_drop_count = 6;
@ -92,7 +92,7 @@ void content_mapnode_plants(bool repeat)
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
f->cook_result = std::string("CraftItem lump_of_charcoal 1");
f->fuel_time = 30;
f->type = CMT_WOOD;
f->type = CMT_TREE;
f->hardness = 1.0;
f->ondig_special_drop = CONTENT_JUNGLEWOOD;
f->ondig_special_drop_count = 6;
@ -112,7 +112,7 @@ void content_mapnode_plants(bool repeat)
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
f->cook_result = std::string("CraftItem lump_of_charcoal 1");
f->fuel_time = 25;
f->type = CMT_WOOD;
f->type = CMT_TREE;
f->hardness = 0.8;
f->ondig_special_drop = CONTENT_WOOD_PINE;
f->ondig_special_drop_count = 6;
@ -136,7 +136,7 @@ void content_mapnode_plants(bool repeat)
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
f->special_alternate_node = CONTENT_LEAVES;
f->fuel_time = 20;
f->type = CMT_WOOD;
f->type = CMT_TREE;
f->hardness = 1.0;
f->suffocation_per_second = 0;
lists::add("creative",i);
@ -157,7 +157,7 @@ void content_mapnode_plants(bool repeat)
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
f->special_alternate_node = CONTENT_JUNGLELEAVES;
f->fuel_time = 20;
f->type = CMT_WOOD;
f->type = CMT_TREE;
f->hardness = 1.0;
f->suffocation_per_second = 0;
lists::add("creative",i);
@ -178,7 +178,7 @@ void content_mapnode_plants(bool repeat)
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
f->special_alternate_node = CONTENT_APPLE_LEAVES;
f->fuel_time = 20;
f->type = CMT_WOOD;
f->type = CMT_TREE;
f->hardness = 1.0;
f->suffocation_per_second = 0;
lists::add("creative",i);
@ -199,7 +199,7 @@ void content_mapnode_plants(bool repeat)
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
f->special_alternate_node = CONTENT_CONIFER_LEAVES;
f->fuel_time = 20;
f->type = CMT_WOOD;
f->type = CMT_TREE;
f->hardness = 1.0;
f->suffocation_per_second = 0;
lists::add("creative",i);

View File

@ -1607,3 +1607,19 @@ void content_nodebox_incinerator(ContentFeatures *f)
-0.25*BS,-0.5*BS,-0.4375*BS,0.25*BS,-0.0625*BS,-0.375*BS
));
}
void content_nodebox_rock(ContentFeatures *f)
{
f->setNodeBox(NodeBox(
-0.125*BS,-0.5*BS,-0.125*BS,0.125*BS,-0.3125*BS,0.1875*BS
));
f->addNodeBox(NodeBox(
-0.1875*BS,-0.4375*BS,-0.0625*BS,-0.0625*BS,-0.375*BS,0.25*BS
));
f->addNodeBox(NodeBox(
0.125*BS,-0.5*BS,-0.125*BS,0.1875*BS,-0.4375*BS,0.1875*BS
));
f->addNodeBox(NodeBox(
-0.0625*BS,-0.5*BS,-0.25*BS,0.1875*BS,-0.375*BS,-0.125*BS
));
}

View File

@ -71,5 +71,6 @@ void content_nodebox_forge(ContentFeatures *f);
void content_nodebox_furnace(ContentFeatures *f);
void content_nodebox_lockedfurnace(ContentFeatures *f);
void content_nodebox_incinerator(ContentFeatures *f);
void content_nodebox_rock(ContentFeatures *f);
#endif

View File

@ -1469,9 +1469,12 @@ u16 MobSAO::punch(content_t punch_item, v3f dir, const std::string &playername)
if (f.type == TT_SWORD) {
amount = 4*((f.hardness/100)+1);
wear = 65535/f.hardness;
}else if (f.type == TT_SPEAR) {
}else if (f.type == TT_CLUB) {
amount = 2*((f.hardness/100)+1);
wear = 65535/f.hardness;
}else if (f.type == TT_SPEAR) {
amount = 3*((f.hardness/100)+1);
wear = 65535/f.hardness;
}else if (f.type == TT_AXE || f.type == TT_PICK) {
amount = ((f.hardness/200)+1);
}

View File

@ -59,7 +59,11 @@ DiggingProperties getDiggingProperties(content_t content, content_t tool, u16 da
wear = 65535/t_features.hardness*c_features.hardness;
bool diggable = true;
bool type_match = false;
if ((tool&CONTENT_CLOTHESITEM_MASK) == CONTENT_CLOTHESITEM_MASK || (c_features.type == CMT_STONE && t_features.type != TT_PICK)) {
if (
(tool&CONTENT_CLOTHESITEM_MASK) == CONTENT_CLOTHESITEM_MASK
|| (c_features.type == CMT_STONE && t_features.type != TT_PICK)
|| (c_features.type == CMT_TREE && t_features.type == TT_NONE)
) {
diggable = false;
}else{
switch (t_features.type) {
@ -70,7 +74,7 @@ DiggingProperties getDiggingProperties(content_t content, content_t tool, u16 da
if (c_features.type == CMT_PLANT) {
time *= 2.;
type_match = true;
}else if (c_features.type != CMT_WOOD && c_features.type != CMT_GLASS) {
}else if (c_features.type != CMT_WOOD && c_features.type != CMT_TREE && c_features.type != CMT_GLASS) {
time *= 10.;
}else{
type_match = true;
@ -181,6 +185,7 @@ std::string toolitem_overlay(content_t content, std::string ol)
base += "spear_";
break;
case TT_SPECIAL:
case TT_CLUB:
case TT_NONE:
default:
return "";
@ -199,18 +204,26 @@ void content_toolitem_init()
content_t i;
ToolItemFeatures *f = NULL;
i = CONTENT_TOOLITEM_WPICK;
i = CONTENT_TOOLITEM_SMALL_PICK;
f = &g_content_toolitem_features[i];
f->content = i;
f->texture = "tool_woodpick.png";
f->texture = "tool_smallpick.png";
f->name = "WPick";
f->description = wgettext("Wooden Pick");
f->description = wgettext("Small Stone Pick");
f->type = TT_PICK;
f->hardness = 30.;
f->hardness = 20.;
f->dig_time = 1.5;
f->level = 1;
crafting::setPickRecipe(CONTENT_WOOD,CONTENT_TOOLITEM_WPICK);
crafting::setPickRecipe(CONTENT_JUNGLEWOOD,CONTENT_TOOLITEM_WPICK);
{
content_t r[9] = {
CONTENT_ROCK, CONTENT_ROCK, CONTENT_ROCK,
CONTENT_IGNORE, CONTENT_CRAFTITEM_WOOD_PLANK, CONTENT_IGNORE,
CONTENT_IGNORE, CONTENT_IGNORE, CONTENT_IGNORE
};
crafting::setRecipe(r,i,1);
r[4] = CONTENT_CRAFTITEM_JUNGLE_PLANK;
crafting::setRecipe(r,i,1);
}
lists::add("craftguide",i);
lists::add("creative",i);
@ -270,17 +283,16 @@ void content_toolitem_init()
lists::add("player-creative",i);
lists::add("creative",i);
i = CONTENT_TOOLITEM_WSHOVEL;
i = CONTENT_TOOLITEM_TROWEL;
f = &g_content_toolitem_features[i];
f->content = i;
f->texture = "tool_woodshovel.png";
f->texture = "tool_trowel.png";
f->name = "WShovel";
f->description = wgettext("Wooden Shovel");
f->description = wgettext("Stone Trowel");
f->type = TT_SHOVEL;
f->hardness = 50.;
f->dig_time = 0.4;
crafting::setShovelRecipe(CONTENT_WOOD,CONTENT_TOOLITEM_WSHOVEL);
crafting::setShovelRecipe(CONTENT_JUNGLEWOOD,CONTENT_TOOLITEM_WSHOVEL);
crafting::set1over1Recipe(CONTENT_ROCK,CONTENT_CRAFTITEM_STICK,i);
lists::add("craftguide",i);
lists::add("creative",i);
@ -325,17 +337,23 @@ void content_toolitem_init()
lists::add("craftguide",i);
lists::add("creative",i);
i = CONTENT_TOOLITEM_WAXE;
i = CONTENT_TOOLITEM_SMALL_AXE;
f = &g_content_toolitem_features[i];
f->content = i;
f->texture = "tool_woodaxe.png";
f->texture = "tool_smallaxe.png";
f->name = "WAxe";
f->description = wgettext("Wooden Axe");
f->description = wgettext("Small Stone Axe");
f->type = TT_AXE;
f->hardness = 30.;
f->dig_time = 1.5;
crafting::setAxeRecipe(CONTENT_WOOD,CONTENT_TOOLITEM_WAXE);
crafting::setAxeRecipe(CONTENT_JUNGLEWOOD,CONTENT_TOOLITEM_WAXE);
{
content_t r[9] = {
CONTENT_ROCK, CONTENT_ROCK, CONTENT_IGNORE,
CONTENT_IGNORE, CONTENT_CRAFTITEM_STICK, CONTENT_IGNORE,
CONTENT_IGNORE, CONTENT_IGNORE, CONTENT_IGNORE
};
crafting::setRecipe(r,i,1);
}
lists::add("craftguide",i);
lists::add("creative",i);
@ -380,17 +398,17 @@ void content_toolitem_init()
lists::add("craftguide",i);
lists::add("creative",i);
i = CONTENT_TOOLITEM_WSWORD;
i = CONTENT_TOOLITEM_CLUB;
f = &g_content_toolitem_features[i];
f->content = i;
f->texture = "tool_woodsword.png";
f->texture = "tool_woodclub.png";
f->name = "WSword";
f->description = wgettext("Wooden Sword");
f->type = TT_SWORD;
f->description = wgettext("Wooden Club");
f->type = TT_CLUB;
f->hardness = 120.;
f->dig_time = 1.5;
crafting::setSwordRecipe(CONTENT_WOOD,CONTENT_TOOLITEM_WSWORD);
crafting::setSwordRecipe(CONTENT_JUNGLEWOOD,CONTENT_TOOLITEM_WSWORD);
crafting::setCol1Recipe(CONTENT_CRAFTITEM_WOOD_PLANK,i);
crafting::setCol1Recipe(CONTENT_CRAFTITEM_JUNGLE_PLANK,i);
lists::add("craftguide",i);
lists::add("creative",i);
@ -428,6 +446,7 @@ void content_toolitem_init()
f->name = "FShears";
f->description = wgettext("Flint Shears");
f->type = TT_SHEAR;
f->level = 2;
f->hardness = 200.;
f->dig_time = 0.7;
crafting::setShearsRecipe(CONTENT_CRAFTITEM_FLINT,CONTENT_TOOLITEM_FLINTSHEARS);

View File

@ -14,7 +14,8 @@ enum ToolType {
TT_SHEAR,
TT_BUCKET,
TT_SWORD,
TT_SPEAR
TT_SPEAR,
TT_CLUB
};
struct ToolItemFeatures {
@ -114,17 +115,17 @@ void content_toolitem_init();
ToolItemFeatures & content_toolitem_features(content_t i);
ToolItemFeatures & content_toolitem_features(std::string subname);
#define CONTENT_TOOLITEM_WPICK (CONTENT_TOOLITEM_MASK | 0x01)
#define CONTENT_TOOLITEM_SMALL_PICK (CONTENT_TOOLITEM_MASK | 0x01)
#define CONTENT_TOOLITEM_STPICK (CONTENT_TOOLITEM_MASK | 0x02)
#define CONTENT_TOOLITEM_STEELPICK (CONTENT_TOOLITEM_MASK | 0x03)
#define CONTENT_TOOLITEM_CREATIVEPICK (CONTENT_TOOLITEM_MASK | 0x04)
#define CONTENT_TOOLITEM_WSHOVEL (CONTENT_TOOLITEM_MASK | 0x05)
#define CONTENT_TOOLITEM_TROWEL (CONTENT_TOOLITEM_MASK | 0x05)
#define CONTENT_TOOLITEM_STSHOVEL (CONTENT_TOOLITEM_MASK | 0x06)
#define CONTENT_TOOLITEM_STEELSHOVEL (CONTENT_TOOLITEM_MASK | 0x07)
#define CONTENT_TOOLITEM_WAXE (CONTENT_TOOLITEM_MASK | 0x08)
#define CONTENT_TOOLITEM_SMALL_AXE (CONTENT_TOOLITEM_MASK | 0x08)
#define CONTENT_TOOLITEM_STAXE (CONTENT_TOOLITEM_MASK | 0x09)
#define CONTENT_TOOLITEM_STEELAXE (CONTENT_TOOLITEM_MASK | 0x0A)
#define CONTENT_TOOLITEM_WSWORD (CONTENT_TOOLITEM_MASK | 0x0B)
#define CONTENT_TOOLITEM_CLUB (CONTENT_TOOLITEM_MASK | 0x0B)
#define CONTENT_TOOLITEM_STSWORD (CONTENT_TOOLITEM_MASK | 0x0C)
#define CONTENT_TOOLITEM_STEELSWORD (CONTENT_TOOLITEM_MASK | 0x0D)
#define CONTENT_TOOLITEM_STEELSHEARS (CONTENT_TOOLITEM_MASK | 0x0E)

View File

@ -155,6 +155,7 @@ enum LiquidType
enum ContentMaterialType {
CMT_AIR,
CMT_WOOD,
CMT_TREE,
CMT_STONE,
CMT_LIQUID,
CMT_PLANT,

View File

@ -3340,6 +3340,10 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
}else if (
selected_node_features.ondig_special_drop != CONTENT_IGNORE
&& selected_node_features.ondig_special_tool == wielded_tool_features.type
&& (
selected_node_features.liquid_type != LIQUID_NONE
|| wielded_tool_features.level > 1
)
) {
if (selected_node_features.ondig_special_tool_append != "") {
std::string dug_s = std::string("ToolItem ");

View File

@ -166,6 +166,7 @@ void sound_playStep(Map *map, v3f pos, int foot, float gain)
case CMT_LIQUID:
snd = "liquid-step";
break;
case CMT_TREE:
case CMT_WOOD:
snd = "wood-step";
break;
@ -214,6 +215,7 @@ void sound_playDig(content_t c, v3f pos)
case CMT_LIQUID:
g_sound->playSoundAt("liquid-dig",false,pos);
break;
case CMT_TREE:
case CMT_WOOD:
g_sound->playSoundAt("wood-dig",false,pos);
break;