streamline dig/place code

This commit is contained in:
darkrose 2015-06-04 05:39:19 +10:00
parent c5db697264
commit c94024cf6e
13 changed files with 880 additions and 1172 deletions

View File

@ -38,6 +38,8 @@ struct CraftItemFeatures {
std::string cook_result;
// the fuel value of this item
float fuel_time;
// whether the item can be stacked in inventory
bool stackable;
// 0 if inedible, otherwise the value it improves hp by
s16 edible;
// the number dropped on right click, -1 for all
@ -51,6 +53,8 @@ struct CraftItemFeatures {
content_t thrown_item;
// used by arrows and such... things that are shot by a tool
content_t shot_item;
// when the item is Used, it should be replaced with this
content_t onuse_replace_item;
CraftItemFeatures():
content(CONTENT_IGNORE),
@ -59,12 +63,14 @@ struct CraftItemFeatures {
description(L""),
cook_result(""),
fuel_time(0.0),
stackable(false),
edible(0),
drop_count(-1),
teleports(-2),
drop_item(CONTENT_IGNORE),
thrown_item(CONTENT_IGNORE),
shot_item(CONTENT_IGNORE)
shot_item(CONTENT_IGNORE),
onuse_replace_item(CONTENT_IGNORE)
{}
};

View File

@ -399,6 +399,7 @@ void content_mapnode_init(bool repeat)
f->sound_step = "grass-step";
f->type = CMT_DIRT;
f->hardness = 1.0;
f->farm_ploughable = true;
lists::add("decrafting",i);
i = CONTENT_GRASS_FOOTSTEPS;
@ -413,6 +414,7 @@ void content_mapnode_init(bool repeat)
f->sound_step = "grass-step";
f->type = CMT_DIRT;
f->hardness = 1.0;
f->farm_ploughable = true;
i = CONTENT_MUDSNOW;
f = &content_features(i);
@ -440,6 +442,7 @@ void content_mapnode_init(bool repeat)
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
f->type = CMT_DIRT;
f->hardness = 1.0;
f->farm_ploughable = true;
lists::add("creative",i);
i = CONTENT_ASH;

View File

@ -469,6 +469,7 @@ void content_mapnode_circuit(bool repeat)
f->special_alternate_node = CONTENT_CIRCUIT_PISTON_ARM;
f->rotate_tile_with_nodebox = true;
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_CIRCUIT_PISTON_OFF)+" 1";
f->ondig_also_removes = v3s16(0,0,1);
f->setAllTextures("circuit_piston_active.png");
f->setTexture(0,"circuit_piston_active.png^[transformR90");
f->setTexture(1,"circuit_piston_active.png^[transformR270");
@ -495,6 +496,7 @@ void content_mapnode_circuit(bool repeat)
f->air_equivalent = true;
f->special_alternate_node = CONTENT_CIRCUIT_PISTON;
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_CIRCUIT_PISTON_OFF)+" 1";
f->ondig_also_removes = v3s16(0,0,-1);
f->setAllTextures("circuit_piston_arm.png");
f->setTexture(0,"circuit_piston_arm.png^[transformR90");
f->setTexture(1,"circuit_piston_arm.png^[transformR270");
@ -544,6 +546,7 @@ void content_mapnode_circuit(bool repeat)
f->setAllTextures("circuit_piston_active.png^[transformR270");
f->setTexture(0,"circuit_piston_top.png");
f->setTexture(1,"circuit_piston_bottom.png");
f->ondig_also_removes = v3s16(0,1,0);
content_nodebox_piston_up(f);
f->setInventoryTextureCube("circuit_piston_top.png", "circuit_piston.png^[transformR90", "circuit_piston.png");
f->type = CMT_STONE;
@ -565,6 +568,7 @@ void content_mapnode_circuit(bool repeat)
f->setAllTextures("circuit_piston_arm.png^[transformR270");
f->setTexture(0,"circuit_piston_arm_top.png");
f->setTexture(1,"circuit_piston_arm_bottom.png");
f->ondig_also_removes = v3s16(0,-1,0);
content_nodebox_pistonarm_up(f);
f->setInventoryTextureCube("circuit_piston_arm_top.png", "circuit_piston_arm.png", "circuit_piston_arm.png");
f->type = CMT_STONE;
@ -608,6 +612,7 @@ void content_mapnode_circuit(bool repeat)
f->setAllTextures("circuit_piston_active.png^[transformR90");
f->setTexture(0,"circuit_piston_bottom.png");
f->setTexture(1,"circuit_piston_top.png");
f->ondig_also_removes = v3s16(0,-1,0);
content_nodebox_piston_down(f);
f->setInventoryTextureCube("circuit_piston_top.png", "circuit_piston.png^[transformR90", "circuit_piston.png");
f->type = CMT_STONE;
@ -629,6 +634,7 @@ void content_mapnode_circuit(bool repeat)
f->setAllTextures("circuit_piston_arm.png^[transformR90");
f->setTexture(0,"circuit_piston_arm_bottom.png");
f->setTexture(1,"circuit_piston_arm_top.png");
f->ondig_also_removes = v3s16(0,1,0);
content_nodebox_pistonarm_down(f);
f->setInventoryTextureCube("circuit_piston_arm.png", "circuit_piston_arm_top.png", "circuit_piston_arm.png");
f->type = CMT_STONE;
@ -677,6 +683,7 @@ void content_mapnode_circuit(bool repeat)
f->special_alternate_node = CONTENT_CIRCUIT_STICKYPISTON_ARM;
f->rotate_tile_with_nodebox = true;
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_CIRCUIT_STICKYPISTON_OFF)+" 1";
f->ondig_also_removes = v3s16(0,0,1);
f->setAllTextures("circuit_piston_active.png");
f->setTexture(0,"circuit_piston_active.png^[transformR90");
f->setTexture(1,"circuit_piston_active.png^[transformR270");
@ -703,6 +710,7 @@ void content_mapnode_circuit(bool repeat)
f->rotate_tile_with_nodebox = true;
f->special_alternate_node = CONTENT_CIRCUIT_STICKYPISTON;
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_CIRCUIT_STICKYPISTON_OFF)+" 1";
f->ondig_also_removes = v3s16(0,0,-1);
f->setAllTextures("circuit_piston_arm.png");
f->setTexture(0,"circuit_piston_arm.png^[transformR90");
f->setTexture(1,"circuit_piston_arm.png^[transformR270");
@ -752,6 +760,7 @@ void content_mapnode_circuit(bool repeat)
f->setAllTextures("circuit_piston_active.png^[transformR270");
f->setTexture(0,"circuit_piston_top.png");
f->setTexture(1,"circuit_piston_bottom.png");
f->ondig_also_removes = v3s16(0,1,0);
content_nodebox_piston_up(f);
f->setInventoryTextureCube("circuit_piston_top.png", "circuit_piston.png^[transformR90", "circuit_piston.png");
f->type = CMT_STONE;
@ -773,6 +782,7 @@ void content_mapnode_circuit(bool repeat)
f->setAllTextures("circuit_piston_arm.png^[transformR270");
f->setTexture(0,"circuit_stickypiston_arm_top.png");
f->setTexture(1,"circuit_piston_arm_bottom.png");
f->ondig_also_removes = v3s16(0,-1,0);
content_nodebox_pistonarm_up(f);
f->setInventoryTextureCube("circuit_stickypiston_arm_top.png", "circuit_piston_arm.png", "circuit_piston_arm.png");
f->type = CMT_STONE;
@ -816,6 +826,7 @@ void content_mapnode_circuit(bool repeat)
f->setAllTextures("circuit_piston_active.png^[transformR90");
f->setTexture(0,"circuit_piston_bottom.png");
f->setTexture(1,"circuit_piston_top.png");
f->ondig_also_removes = v3s16(0,-1,0);
content_nodebox_piston_down(f);
f->setInventoryTextureCube("circuit_piston_top.png", "circuit_piston.png^[transformR90", "circuit_piston.png");
f->type = CMT_STONE;
@ -837,6 +848,7 @@ void content_mapnode_circuit(bool repeat)
f->setAllTextures("circuit_piston_arm.png^[transformR90");
f->setTexture(0,"circuit_piston_arm_bottom.png");
f->setTexture(1,"circuit_stickypiston_arm_top.png");
f->ondig_also_removes = v3s16(0,1,0);
content_nodebox_pistonarm_down(f);
f->setInventoryTextureCube("circuit_piston_arm.png", "circuit_stickypiston_arm_top.png", "circuit_piston_arm.png");
f->type = CMT_STONE;

View File

@ -49,6 +49,7 @@ void content_mapnode_door(bool repeat)
f->solidness = 0; // drawn separately, makes no faces
f->is_ground_content = true;
f->dug_item = std::string("MaterialItem2 ")+itos(i+1)+" 1";
f->ondig_also_removes = v3s16(0,1,0);
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
f->fuel_time = 30;
content_nodebox_door(f);
@ -73,6 +74,8 @@ void content_mapnode_door(bool repeat)
f->solidness = 0; // drawn separately, makes no faces
f->is_ground_content = true;
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
f->onuse_replace_node = CONTENT_WOOD_DOOR_RT;
f->ondig_also_removes = v3s16(0,-1,0);
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
f->fuel_time = 30;
content_nodebox_door(f);
@ -81,7 +84,6 @@ void content_mapnode_door(bool repeat)
f->pressure_type = CST_SOLID;
f->suffocation_per_second = 0;
crafting::set1over1Recipe(CONTENT_WOOD_HATCH,CONTENT_WOOD_HATCH,CONTENT_WOOD_DOOR_LT);
crafting::set1To1Recipe(CONTENT_WOOD_DOOR_RT,CONTENT_WOOD_DOOR_LT);
lists::add("craftguide",i);
lists::add("creative",i);
@ -102,6 +104,7 @@ void content_mapnode_door(bool repeat)
f->solidness = 0; // drawn separately, makes no faces
f->is_ground_content = true;
f->dug_item = std::string("MaterialItem2 ")+itos(i+1)+" 1";
f->ondig_also_removes = v3s16(0,1,0);
content_nodebox_door(f);
f->type = CMT_STONE;
f->hardness = 5.0;
@ -127,6 +130,8 @@ void content_mapnode_door(bool repeat)
f->solidness = 0; // drawn separately, makes no faces
f->is_ground_content = true;
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
f->onuse_replace_node = CONTENT_STEEL_DOOR_RT;
f->ondig_also_removes = v3s16(0,-1,0);
content_nodebox_door(f);
f->type = CMT_STONE;
f->hardness = 5.0;
@ -136,7 +141,6 @@ void content_mapnode_door(bool repeat)
if (f->initial_metadata == NULL)
f->initial_metadata = new DoorNodeMetadata();
crafting::set1over1Recipe(CONTENT_STEEL_HATCH,CONTENT_STEEL_HATCH,CONTENT_STEEL_DOOR_LT);
crafting::set1To1Recipe(CONTENT_STEEL_DOOR_RT,CONTENT_STEEL_DOOR_LT);
lists::add("craftguide",i);
lists::add("creative",i);
@ -158,7 +162,7 @@ void content_mapnode_door(bool repeat)
f->solidness = 0; // drawn separately, makes no faces
f->is_ground_content = true;
f->dug_item = std::string("MaterialItem2 ")+itos(i+1)+" 1";
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
f->ondig_also_removes = v3s16(0,1,0);
content_nodebox_door(f);
f->type = CMT_GLASS;
f->hardness = 0.15;
@ -182,14 +186,14 @@ void content_mapnode_door(bool repeat)
f->solidness = 0; // drawn separately, makes no faces
f->is_ground_content = true;
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
f->onuse_replace_node = CONTENT_GLASS_DOOR_RT;
f->ondig_also_removes = v3s16(0,-1,0);
content_nodebox_door(f);
f->type = CMT_GLASS;
f->hardness = 0.15;
f->pressure_type = CST_SOLID;
f->suffocation_per_second = 0;
crafting::set1over1Recipe(CONTENT_GLASS_PANE,CONTENT_GLASS_PANE,CONTENT_GLASS_DOOR_LT);
crafting::set1To1Recipe(CONTENT_GLASS_DOOR_RT,CONTENT_GLASS_DOOR_LT);
lists::add("craftguide",i);
lists::add("creative",i);
@ -211,6 +215,7 @@ void content_mapnode_door(bool repeat)
f->solidness = 0; // drawn separately, makes no faces
f->is_ground_content = true;
f->dug_item = std::string("MaterialItem2 ")+itos(i+1)+" 1";
f->ondig_also_removes = v3s16(0,1,0);
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
f->fuel_time = 30;
content_nodebox_door(f);
@ -236,6 +241,8 @@ void content_mapnode_door(bool repeat)
f->solidness = 0; // drawn separately, makes no faces
f->is_ground_content = true;
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
f->onuse_replace_node = CONTENT_WOOD_W_DOOR_RT;
f->ondig_also_removes = v3s16(0,-1,0);
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
f->fuel_time = 30;
content_nodebox_doorw(f);
@ -245,7 +252,6 @@ void content_mapnode_door(bool repeat)
f->suffocation_per_second = 0;
crafting::set1over1Recipe(CONTENT_WOOD_W_HATCH,CONTENT_WOOD_HATCH,CONTENT_WOOD_W_DOOR_LT);
crafting::set1over1Recipe(CONTENT_GLASS,CONTENT_WOOD_DOOR_LT,CONTENT_WOOD_W_DOOR_LT);
crafting::set1To1Recipe(CONTENT_WOOD_W_DOOR_RT,CONTENT_WOOD_W_DOOR_LT);
lists::add("craftguide",i);
lists::add("creative",i);
@ -267,6 +273,7 @@ void content_mapnode_door(bool repeat)
f->solidness = 0; // drawn separately, makes no faces
f->is_ground_content = true;
f->dug_item = std::string("MaterialItem2 ")+itos(i+1)+" 1";
f->ondig_also_removes = v3s16(0,1,0);
content_nodebox_door(f);
f->type = CMT_STONE;
f->hardness = 5.0;
@ -293,6 +300,8 @@ void content_mapnode_door(bool repeat)
f->solidness = 0; // drawn separately, makes no faces
f->is_ground_content = true;
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
f->onuse_replace_node = CONTENT_STEEL_W_DOOR_RT;
f->ondig_also_removes = v3s16(0,-1,0);
content_nodebox_doorw(f);
f->type = CMT_STONE;
f->hardness = 5.0;
@ -303,7 +312,6 @@ void content_mapnode_door(bool repeat)
f->initial_metadata = new DoorNodeMetadata();
crafting::set1over1Recipe(CONTENT_STEEL_W_HATCH,CONTENT_STEEL_HATCH,CONTENT_STEEL_W_DOOR_LT);
crafting::set1over1Recipe(CONTENT_GLASS,CONTENT_STEEL_DOOR_LT,CONTENT_STEEL_W_DOOR_LT);
crafting::set1To1Recipe(CONTENT_STEEL_W_DOOR_RT,CONTENT_STEEL_W_DOOR_LT);
lists::add("craftguide",i);
lists::add("creative",i);
@ -325,6 +333,7 @@ void content_mapnode_door(bool repeat)
f->solidness = 0; // drawn separately, makes no faces
f->is_ground_content = true;
f->dug_item = std::string("MaterialItem2 ")+itos(i+1)+" 1";
f->ondig_also_removes = v3s16(0,1,0);
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
f->fuel_time = 30;
content_nodebox_door(f);
@ -349,6 +358,8 @@ void content_mapnode_door(bool repeat)
f->solidness = 0; // drawn separately, makes no faces
f->is_ground_content = true;
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
f->onuse_replace_node = CONTENT_WOOD_DOOR_LT;
f->ondig_also_removes = v3s16(0,-1,0);
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
f->fuel_time = 30;
content_nodebox_door(f);
@ -356,8 +367,6 @@ void content_mapnode_door(bool repeat)
f->hardness = 0.75;
f->pressure_type = CST_SOLID;
f->suffocation_per_second = 0;
crafting::set1To1Recipe(CONTENT_WOOD_DOOR_LT,CONTENT_WOOD_DOOR_RT);
lists::add("craftguide",i);
lists::add("creative",i);
i = CONTENT_GLASS_DOOR_RB;
@ -378,7 +387,7 @@ void content_mapnode_door(bool repeat)
f->solidness = 0; // drawn separately, makes no faces
f->is_ground_content = true;
f->dug_item = std::string("MaterialItem2 ")+itos(i+1)+" 1";
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
f->ondig_also_removes = v3s16(0,1,0);
f->fuel_time = 30;
content_nodebox_door(f);
f->type = CMT_GLASS;
@ -403,15 +412,14 @@ void content_mapnode_door(bool repeat)
f->solidness = 0; // drawn separately, makes no faces
f->is_ground_content = true;
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
f->onuse_replace_node = CONTENT_GLASS_DOOR_LT;
f->ondig_also_removes = v3s16(0,-1,0);
f->fuel_time = 30;
content_nodebox_door(f);
f->type = CMT_GLASS;
f->hardness = 0.15;
f->pressure_type = CST_SOLID;
f->suffocation_per_second = 0;
crafting::set1To1Recipe(CONTENT_GLASS_DOOR_LT,CONTENT_GLASS_DOOR_RT);
lists::add("craftguide",i);
lists::add("creative",i);
i = CONTENT_STEEL_DOOR_RB;
@ -431,6 +439,7 @@ void content_mapnode_door(bool repeat)
f->solidness = 0; // drawn separately, makes no faces
f->is_ground_content = true;
f->dug_item = std::string("MaterialItem2 ")+itos(i+1)+" 1";
f->ondig_also_removes = v3s16(0,1,0);
content_nodebox_door(f);
f->type = CMT_STONE;
f->hardness = 5.0;
@ -456,6 +465,8 @@ void content_mapnode_door(bool repeat)
f->solidness = 0; // drawn separately, makes no faces
f->is_ground_content = true;
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
f->onuse_replace_node = CONTENT_STEEL_DOOR_LT;
f->ondig_also_removes = v3s16(0,-1,0);
content_nodebox_door(f);
f->type = CMT_STONE;
f->hardness = 5.0;
@ -464,8 +475,6 @@ void content_mapnode_door(bool repeat)
f->energy_type = CET_CONDUCTIVE;
if (f->initial_metadata == NULL)
f->initial_metadata = new DoorNodeMetadata();
crafting::set1To1Recipe(CONTENT_GLASS_DOOR_LT,CONTENT_GLASS_DOOR_RT);
lists::add("craftguide",i);
lists::add("creative",i);
i = CONTENT_WOOD_W_DOOR_RB;
@ -486,6 +495,7 @@ void content_mapnode_door(bool repeat)
f->solidness = 0; // drawn separately, makes no faces
f->is_ground_content = true;
f->dug_item = std::string("MaterialItem2 ")+itos(i+1)+" 1";
f->ondig_also_removes = v3s16(0,1,0);
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
f->fuel_time = 30;
content_nodebox_door(f);
@ -511,6 +521,8 @@ void content_mapnode_door(bool repeat)
f->solidness = 0; // drawn separately, makes no faces
f->is_ground_content = true;
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
f->onuse_replace_node = CONTENT_WOOD_W_DOOR_LT;
f->ondig_also_removes = v3s16(0,-1,0);
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
f->fuel_time = 30;
content_nodebox_doorw(f);
@ -518,9 +530,6 @@ void content_mapnode_door(bool repeat)
f->hardness = 0.75;
f->pressure_type = CST_SOLID;
f->suffocation_per_second = 0;
crafting::set1To1Recipe(CONTENT_WOOD_W_DOOR_LT,CONTENT_WOOD_W_DOOR_RT);
crafting::set1over1Recipe(CONTENT_GLASS,CONTENT_WOOD_DOOR_RT,CONTENT_WOOD_W_DOOR_RT);
lists::add("craftguide",i);
lists::add("creative",i);
i = CONTENT_STEEL_W_DOOR_RB;
@ -541,6 +550,7 @@ void content_mapnode_door(bool repeat)
f->solidness = 0; // drawn separately, makes no faces
f->is_ground_content = true;
f->dug_item = std::string("MaterialItem2 ")+itos(i+1)+" 1";
f->ondig_also_removes = v3s16(0,1,0);
content_nodebox_door(f);
f->type = CMT_STONE;
f->hardness = 5.0;
@ -567,6 +577,8 @@ void content_mapnode_door(bool repeat)
f->solidness = 0; // drawn separately, makes no faces
f->is_ground_content = true;
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
f->onuse_replace_node = CONTENT_STEEL_W_DOOR_LT;
f->ondig_also_removes = v3s16(0,-1,0);
content_nodebox_doorw(f);
f->type = CMT_STONE;
f->hardness = 5.0;
@ -597,6 +609,7 @@ void content_mapnode_door(bool repeat)
f->solidness = 0; // drawn separately, makes no faces
f->is_ground_content = true;
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_WOOD_DOOR_LT)+" 1";
f->ondig_also_removes = v3s16(0,1,0);
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
f->fuel_time = 30;
content_nodebox_doorol(f);
@ -620,6 +633,7 @@ void content_mapnode_door(bool repeat)
f->solidness = 0; // drawn separately, makes no faces
f->is_ground_content = true;
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_WOOD_DOOR_LT)+" 1";
f->ondig_also_removes = v3s16(0,-1,0);
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
f->fuel_time = 30;
content_nodebox_doorol(f);
@ -644,7 +658,7 @@ void content_mapnode_door(bool repeat)
f->solidness = 0; // drawn separately, makes no faces
f->is_ground_content = true;
f->dug_item = std::string("MaterialItem2 ")+itos(i+1)+" 1";
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
f->ondig_also_removes = v3s16(0,1,0);
f->fuel_time = 30;
content_nodebox_doorol(f);
f->type = CMT_WOOD;
@ -667,7 +681,7 @@ void content_mapnode_door(bool repeat)
f->solidness = 0; // drawn separately, makes no faces
f->is_ground_content = true;
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
f->ondig_also_removes = v3s16(0,-1,0);
f->fuel_time = 30;
content_nodebox_doorol(f);
f->type = CMT_WOOD;
@ -691,6 +705,7 @@ void content_mapnode_door(bool repeat)
f->solidness = 0; // drawn separately, makes no faces
f->is_ground_content = true;
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_STEEL_DOOR_LT)+" 1";
f->ondig_also_removes = v3s16(0,1,0);
content_nodebox_doorol(f);
f->type = CMT_STONE;
f->hardness = 5.0;
@ -715,6 +730,7 @@ void content_mapnode_door(bool repeat)
f->solidness = 0; // drawn separately, makes no faces
f->is_ground_content = true;
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_STEEL_DOOR_LT)+" 1";
f->ondig_also_removes = v3s16(0,-1,0);
content_nodebox_doorol(f);
f->type = CMT_STONE;
f->hardness = 5.0;
@ -740,6 +756,7 @@ void content_mapnode_door(bool repeat)
f->solidness = 0; // drawn separately, makes no faces
f->is_ground_content = true;
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_WOOD_W_DOOR_LT)+" 1";
f->ondig_also_removes = v3s16(0,1,0);
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
f->fuel_time = 30;
content_nodebox_doorol(f);
@ -763,6 +780,7 @@ void content_mapnode_door(bool repeat)
f->solidness = 0; // drawn separately, makes no faces
f->is_ground_content = true;
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_WOOD_W_DOOR_LT)+" 1";
f->ondig_also_removes = v3s16(0,-1,0);
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
f->fuel_time = 30;
content_nodebox_doorwol(f);
@ -787,6 +805,7 @@ void content_mapnode_door(bool repeat)
f->solidness = 0; // drawn separately, makes no faces
f->is_ground_content = true;
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_STEEL_W_DOOR_LT)+" 1";
f->ondig_also_removes = v3s16(0,1,0);
content_nodebox_doorol(f);
f->type = CMT_STONE;
f->hardness = 5.0;
@ -811,6 +830,7 @@ void content_mapnode_door(bool repeat)
f->solidness = 0; // drawn separately, makes no faces
f->is_ground_content = true;
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_STEEL_W_DOOR_LT)+" 1";
f->ondig_also_removes = v3s16(0,-1,0);
content_nodebox_doorwol(f);
f->type = CMT_STONE;
f->hardness = 5.0;
@ -839,6 +859,7 @@ void content_mapnode_door(bool repeat)
f->solidness = 0; // drawn separately, makes no faces
f->is_ground_content = true;
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_WOOD_DOOR_RT)+" 1";
f->ondig_also_removes = v3s16(0,1,0);
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
f->fuel_time = 30;
content_nodebox_dooror(f);
@ -864,6 +885,7 @@ void content_mapnode_door(bool repeat)
f->solidness = 0; // drawn separately, makes no faces
f->is_ground_content = true;
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_WOOD_DOOR_RT)+" 1";
f->ondig_also_removes = v3s16(0,-1,0);
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
f->fuel_time = 30;
content_nodebox_dooror(f);
@ -890,7 +912,7 @@ void content_mapnode_door(bool repeat)
f->solidness = 0; // drawn separately, makes no faces
f->is_ground_content = true;
f->dug_item = std::string("MaterialItem2 ")+itos(i+1)+" 1";
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
f->ondig_also_removes = v3s16(0,1,0);
f->fuel_time = 30;
content_nodebox_dooror(f);
f->type = CMT_GLASS;
@ -915,7 +937,7 @@ void content_mapnode_door(bool repeat)
f->solidness = 0; // drawn separately, makes no faces
f->is_ground_content = true;
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
f->ondig_also_removes = v3s16(0,-1,0);
f->fuel_time = 30;
content_nodebox_dooror(f);
f->type = CMT_GLASS;
@ -941,6 +963,7 @@ void content_mapnode_door(bool repeat)
f->solidness = 0; // drawn separately, makes no faces
f->is_ground_content = true;
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_STEEL_DOOR_RT)+" 1";
f->ondig_also_removes = v3s16(0,1,0);
content_nodebox_dooror(f);
f->type = CMT_STONE;
f->hardness = 5.0;
@ -967,6 +990,7 @@ void content_mapnode_door(bool repeat)
f->solidness = 0; // drawn separately, makes no faces
f->is_ground_content = true;
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_STEEL_DOOR_RT)+" 1";
f->ondig_also_removes = v3s16(0,-1,0);
content_nodebox_dooror(f);
f->type = CMT_STONE;
f->hardness = 5.0;
@ -994,6 +1018,7 @@ void content_mapnode_door(bool repeat)
f->solidness = 0; // drawn separately, makes no faces
f->is_ground_content = true;
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_WOOD_W_DOOR_RT)+" 1";
f->ondig_also_removes = v3s16(0,1,0);
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
f->fuel_time = 30;
content_nodebox_dooror(f);
@ -1019,6 +1044,7 @@ void content_mapnode_door(bool repeat)
f->solidness = 0; // drawn separately, makes no faces
f->is_ground_content = true;
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_WOOD_W_DOOR_RT)+" 1";
f->ondig_also_removes = v3s16(0,-1,0);
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
f->fuel_time = 30;
content_nodebox_doorwor(f);
@ -1045,6 +1071,7 @@ void content_mapnode_door(bool repeat)
f->solidness = 0; // drawn separately, makes no faces
f->is_ground_content = true;
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_STEEL_W_DOOR_RT)+" 1";
f->ondig_also_removes = v3s16(0,1,0);
content_nodebox_dooror(f);
f->type = CMT_STONE;
f->hardness = 5.0;
@ -1071,6 +1098,7 @@ void content_mapnode_door(bool repeat)
f->solidness = 0; // drawn separately, makes no faces
f->is_ground_content = true;
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_STEEL_W_DOOR_RT)+" 1";
f->ondig_also_removes = v3s16(0,-1,0);
content_nodebox_doorwor(f);
f->type = CMT_STONE;
f->hardness = 5.0;

View File

@ -1153,6 +1153,7 @@ void content_mapnode_furniture(bool repeat)
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
f->fuel_time = 30/32;
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
f->ondig_also_removes = v3s16(0,0,1);
content_nodebox_bed_head(f);
f->type = CMT_WOOD;
f->hardness = 0.25;
@ -1183,6 +1184,7 @@ void content_mapnode_furniture(bool repeat)
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
f->fuel_time = 30/32;
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_BED_HEAD)+" 1";
f->ondig_also_removes = v3s16(0,0,-1);
content_nodebox_bed_foot(f);
f->type = CMT_WOOD;
f->hardness = 0.25;
@ -1210,6 +1212,7 @@ void content_mapnode_furniture(bool repeat)
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
f->fuel_time = 30/32;
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
f->ondig_also_removes = v3s16(0,0,1);
content_nodebox_bed_head(f);
f->type = CMT_WOOD;
f->hardness = 0.25;
@ -1240,6 +1243,7 @@ void content_mapnode_furniture(bool repeat)
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
f->fuel_time = 30/32;
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_BED_BLUE_HEAD)+" 1";
f->ondig_also_removes = v3s16(0,0,-1);
content_nodebox_bed_foot(f);
f->type = CMT_WOOD;
f->hardness = 0.25;
@ -1267,6 +1271,7 @@ void content_mapnode_furniture(bool repeat)
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
f->fuel_time = 30/32;
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
f->ondig_also_removes = v3s16(0,0,1);
content_nodebox_bed_head(f);
f->type = CMT_WOOD;
f->hardness = 0.25;
@ -1297,6 +1302,7 @@ void content_mapnode_furniture(bool repeat)
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
f->fuel_time = 30/32;
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_BED_GREEN_HEAD)+" 1";
f->ondig_also_removes = v3s16(0,0,-1);
content_nodebox_bed_foot(f);
f->type = CMT_WOOD;
f->hardness = 0.25;
@ -1324,6 +1330,7 @@ void content_mapnode_furniture(bool repeat)
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
f->fuel_time = 30/32;
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
f->ondig_also_removes = v3s16(0,0,1);
content_nodebox_bed_head(f);
f->type = CMT_WOOD;
f->hardness = 0.25;
@ -1354,6 +1361,7 @@ void content_mapnode_furniture(bool repeat)
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
f->fuel_time = 30/32;
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_BED_ORANGE_HEAD)+" 1";
f->ondig_also_removes = v3s16(0,0,-1);
content_nodebox_bed_foot(f);
f->type = CMT_WOOD;
f->hardness = 0.25;
@ -1381,6 +1389,7 @@ void content_mapnode_furniture(bool repeat)
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
f->fuel_time = 30/32;
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
f->ondig_also_removes = v3s16(0,0,1);
content_nodebox_bed_head(f);
f->type = CMT_WOOD;
f->hardness = 0.25;
@ -1411,6 +1420,7 @@ void content_mapnode_furniture(bool repeat)
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
f->fuel_time = 30/32;
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_BED_PURPLE_HEAD)+" 1";
f->ondig_also_removes = v3s16(0,0,-1);
content_nodebox_bed_foot(f);
f->type = CMT_WOOD;
f->hardness = 0.25;
@ -1438,6 +1448,7 @@ void content_mapnode_furniture(bool repeat)
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
f->fuel_time = 30/32;
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
f->ondig_also_removes = v3s16(0,0,1);
content_nodebox_bed_head(f);
f->type = CMT_WOOD;
f->hardness = 0.25;
@ -1468,6 +1479,7 @@ void content_mapnode_furniture(bool repeat)
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
f->fuel_time = 30/32;
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_BED_RED_HEAD)+" 1";
f->ondig_also_removes = v3s16(0,0,-1);
content_nodebox_bed_foot(f);
f->type = CMT_WOOD;
f->hardness = 0.25;
@ -1495,6 +1507,7 @@ void content_mapnode_furniture(bool repeat)
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
f->fuel_time = 30/32;
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
f->ondig_also_removes = v3s16(0,0,1);
content_nodebox_bed_head(f);
f->type = CMT_WOOD;
f->hardness = 0.25;
@ -1525,6 +1538,7 @@ void content_mapnode_furniture(bool repeat)
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
f->fuel_time = 30/32;
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_BED_YELLOW_HEAD)+" 1";
f->ondig_also_removes = v3s16(0,0,-1);
content_nodebox_bed_foot(f);
f->type = CMT_WOOD;
f->hardness = 0.25;
@ -1552,6 +1566,7 @@ void content_mapnode_furniture(bool repeat)
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
f->fuel_time = 30/32;
f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1";
f->ondig_also_removes = v3s16(0,0,1);
content_nodebox_bed_head(f);
f->type = CMT_WOOD;
f->hardness = 0.25;
@ -1582,6 +1597,7 @@ void content_mapnode_furniture(bool repeat)
f->flammable = 1; // can be replaced by fire if the node under it is set on fire
f->fuel_time = 30/32;
f->dug_item = std::string("MaterialItem2 ")+itos(CONTENT_BED_BLACK_HEAD)+" 1";
f->ondig_also_removes = v3s16(0,0,-1);
content_nodebox_bed_foot(f);
f->type = CMT_WOOD;
f->hardness = 0.25;

View File

@ -52,6 +52,9 @@ void content_mapnode_plants(bool repeat)
f->fuel_time = 30;
f->type = CMT_WOOD;
f->hardness = 1.0;
f->ondig_special_drop = CONTENT_WOOD;
f->ondig_special_drop_count = 6;
f->ondig_special_tool = TT_AXE;
lists::add("creative",i);
lists::add("cooking",i);
@ -70,6 +73,9 @@ void content_mapnode_plants(bool repeat)
f->fuel_time = 30;
f->type = CMT_WOOD;
f->hardness = 1.0;
f->ondig_special_drop = CONTENT_WOOD;
f->ondig_special_drop_count = 6;
f->ondig_special_tool = TT_AXE;
lists::add("creative",i);
lists::add("cooking",i);
@ -87,6 +93,9 @@ void content_mapnode_plants(bool repeat)
f->fuel_time = 30;
f->type = CMT_WOOD;
f->hardness = 1.0;
f->ondig_special_drop = CONTENT_JUNGLEWOOD;
f->ondig_special_drop_count = 6;
f->ondig_special_tool = TT_AXE;
lists::add("creative",i);
i = CONTENT_CONIFER_TREE;
@ -104,6 +113,9 @@ void content_mapnode_plants(bool repeat)
f->fuel_time = 25;
f->type = CMT_WOOD;
f->hardness = 0.8;
f->ondig_special_drop = CONTENT_WOOD_PINE;
f->ondig_special_drop_count = 6;
f->ondig_special_tool = TT_AXE;
lists::add("creative",i);
lists::add("cooking",i);

View File

@ -1056,6 +1056,7 @@ void content_mapnode_special(bool repeat)
f->hardness = 0.1;
f->pressure_type = CST_CRUSHABLE;
f->suffocation_per_second = 0;
f->alternate_lockstate_node = CONTENT_LOCKABLE_SIGN_WALL;
content_nodebox_sign_wall(f);
f->setFaceText(5,FaceText(0.05,0.3,0.95,0.7));
@ -1083,6 +1084,7 @@ void content_mapnode_special(bool repeat)
f->hardness = 0.1;
f->pressure_type = CST_CRUSHABLE;
f->suffocation_per_second = 0;
f->alternate_lockstate_node = CONTENT_LOCKABLE_SIGN;
content_nodebox_sign(f);
f->setFaceText(5,FaceText(0.05,0.0675,0.95,0.55));
f->setInventoryTextureNodeBox(i,"sign.png", "sign_front.png", "sign.png");
@ -1116,6 +1118,7 @@ void content_mapnode_special(bool repeat)
f->hardness = 0.1;
f->pressure_type = CST_CRUSHABLE;
f->suffocation_per_second = 0;
f->alternate_lockstate_node = CONTENT_LOCKABLE_SIGN_UD;
content_nodebox_sign_ud(f);
f->setFaceText(5,FaceText(0.05,0.45,0.95,0.8875));
f->setInventoryTextureNodeBox(i,"sign.png", "sign_front.png", "sign.png");
@ -1146,6 +1149,7 @@ void content_mapnode_special(bool repeat)
f->hardness = 0.1;
f->pressure_type = CST_CRUSHABLE;
f->suffocation_per_second = 0;
f->alternate_lockstate_node = CONTENT_SIGN_WALL;
content_nodebox_sign_wall(f);
f->setFaceText(4,FaceText(0.05,0.3,0.95,0.7,FTT_OWNER));
f->setFaceText(5,FaceText(0.05,0.3,0.95,0.7));
@ -1174,6 +1178,7 @@ void content_mapnode_special(bool repeat)
f->hardness = 0.1;
f->pressure_type = CST_CRUSHABLE;
f->suffocation_per_second = 0;
f->alternate_lockstate_node = CONTENT_SIGN;
content_nodebox_sign(f);
f->setFaceText(4,FaceText(0.05,0.0675,0.95,0.55,FTT_OWNER));
f->setFaceText(5,FaceText(0.05,0.0675,0.95,0.55));
@ -1206,6 +1211,7 @@ void content_mapnode_special(bool repeat)
f->hardness = 0.1;
f->pressure_type = CST_CRUSHABLE;
f->suffocation_per_second = 0;
f->alternate_lockstate_node = CONTENT_SIGN_UD;
content_nodebox_sign_ud(f);
f->setFaceText(4,FaceText(0.05,0.45,0.95,0.8875,FTT_OWNER));
f->setFaceText(5,FaceText(0.05,0.45,0.95,0.8875));
@ -1229,6 +1235,7 @@ void content_mapnode_special(bool repeat)
f->type = CMT_WOOD;
f->hardness = 1.0;
f->pressure_type = CST_SOLID;
f->alternate_lockstate_node = CONTENT_LOCKABLE_CHEST;
crafting::setRoundRecipe(CONTENT_WOOD,CONTENT_CHEST);
crafting::setRoundRecipe(CONTENT_JUNGLEWOOD,CONTENT_CHEST);
lists::add("craftguide",i);
@ -1273,6 +1280,7 @@ void content_mapnode_special(bool repeat)
f->type = CMT_WOOD;
f->hardness = 1.0;
f->pressure_type = CST_SOLID;
f->alternate_lockstate_node = CONTENT_CHEST;
crafting::setFilledRoundRecipe(CONTENT_WOOD,CONTENT_CRAFTITEM_STEEL_INGOT,CONTENT_LOCKABLE_CHEST);
crafting::setFilledRoundRecipe(CONTENT_JUNGLEWOOD,CONTENT_CRAFTITEM_STEEL_INGOT,CONTENT_LOCKABLE_CHEST);
crafting::set1Any2Recipe(CONTENT_CHEST,CONTENT_CRAFTITEM_STEEL_INGOT,CONTENT_LOCKABLE_CHEST);
@ -1323,6 +1331,7 @@ void content_mapnode_special(bool repeat)
f->type = CMT_STONE;
f->hardness = 3.0;
f->pressure_type = CST_SOLID;
f->alternate_lockstate_node = CONTENT_LOCKABLE_FURNACE;
crafting::setRoundRecipe(CONTENT_ROUGHSTONE,CONTENT_FURNACE);
lists::add("craftguide",i);
lists::add("creative",i);
@ -1362,6 +1371,7 @@ void content_mapnode_special(bool repeat)
f->type = CMT_STONE;
f->hardness = 3.0;
f->pressure_type = CST_SOLID;
f->alternate_lockstate_node = CONTENT_FURNACE;
crafting::setFilledRoundRecipe(CONTENT_ROUGHSTONE,CONTENT_CRAFTITEM_STEEL_INGOT,CONTENT_LOCKABLE_FURNACE);
crafting::set1Any2Recipe(CONTENT_FURNACE,CONTENT_CRAFTITEM_STEEL_INGOT,CONTENT_LOCKABLE_FURNACE);
lists::add("craftguide",i);

View File

@ -177,6 +177,7 @@ void content_toolitem_init()
f->type = TT_PICK;
f->hardness = 1337.;
f->dig_time = 0.;
f->has_punch_effect = false;
crafting::setPickRecipe(CONTENT_MESE,CONTENT_TOOLITEM_MESEPICK);
lists::add("craftguide",i);
lists::add("player-creative",i);
@ -364,6 +365,7 @@ void content_toolitem_init()
f->type = TT_BUCKET;
f->hardness = 30.;
f->dig_time = 0.0;
f->damaging_nodes_diggable = false;
crafting::setURecipe(CONTENT_CRAFTITEM_JUNGLE_PLANK,CONTENT_TOOLITEM_WBUCKET);
crafting::setURecipe(CONTENT_CRAFTITEM_WOOD_PLANK,CONTENT_TOOLITEM_WBUCKET);
lists::add("craftguide",i);
@ -379,6 +381,7 @@ void content_toolitem_init()
f->type = TT_BUCKET;
f->hardness = 50.;
f->dig_time = 0.0;
f->damaging_nodes_diggable = false;
crafting::setURecipe(CONTENT_CRAFTITEM_TIN_INGOT,CONTENT_TOOLITEM_TINBUCKET);
lists::add("craftguide",i);
lists::add("creative",i);
@ -390,6 +393,8 @@ void content_toolitem_init()
f->name = "WBucket_water";
f->description = wgettext("Wooden Bucket of Water");
f->type = TT_SPECIAL;
f->onplace_node = CONTENT_WATERSOURCE;
f->onplace_replace_item = CONTENT_TOOLITEM_WBUCKET;
lists::add("creative",i);
i = CONTENT_TOOLITEM_TINBUCKET_WATER;
@ -399,6 +404,8 @@ void content_toolitem_init()
f->name = "TinBucket_water";
f->description = wgettext("Tin Bucket of Water");
f->type = TT_SPECIAL;
f->onplace_node = CONTENT_WATERSOURCE;
f->onplace_replace_item = CONTENT_TOOLITEM_TINBUCKET;
lists::add("creative",i);
i = CONTENT_TOOLITEM_STEELBUCKET;
@ -422,6 +429,8 @@ void content_toolitem_init()
f->name = "SteelBucket_water";
f->description = wgettext("Steel Bucket of Water");
f->type = TT_SPECIAL;
f->onplace_node = CONTENT_WATERSOURCE;
f->onplace_replace_item = CONTENT_TOOLITEM_STEELBUCKET;
lists::add("creative",i);
i = CONTENT_TOOLITEM_STEELBUCKET_LAVA;
@ -430,6 +439,8 @@ void content_toolitem_init()
f->texture = "tool_steelbucket_lava.png";
f->name = "SteelBucket_lava";
f->description = wgettext("Steel Bucket of Lava");
f->onplace_node = CONTENT_LAVASOURCE;
f->onplace_replace_item = CONTENT_TOOLITEM_STEELBUCKET;
f->fuel_time = 80;
f->type = TT_SPECIAL;
lists::add("creative",i);
@ -442,6 +453,7 @@ void content_toolitem_init()
f->description = wgettext("Fire Starter");
f->liquids_pointable = true;
f->type = TT_SPECIAL;
f->has_fire_effect = true;
crafting::set1Any2Recipe(CONTENT_CRAFTITEM_FLINT,CONTENT_CRAFTITEM_STEEL_INGOT,CONTENT_TOOLITEM_FIRESTARTER);
lists::add("craftguide",i);
lists::add("creative",i);
@ -453,6 +465,7 @@ void content_toolitem_init()
f->name = "crowbar";
f->description = wgettext("Crowbar");
f->type = TT_SPECIAL;
f->has_rotate_effect = true;
crafting::set1over1Recipe(CONTENT_CRAFTITEM_STEEL_INGOT,CONTENT_CRAFTITEM_STEEL_INGOT,CONTENT_TOOLITEM_CROWBAR);
lists::add("craftguide",i);
lists::add("creative",i);
@ -464,6 +477,7 @@ void content_toolitem_init()
f->name = "key";
f->description = wgettext("Key");
f->type = TT_SPECIAL;
f->has_unlock_effect = true;
crafting::set1To1Recipe(CONTENT_CRAFTITEM_GOLD_INGOT,CONTENT_TOOLITEM_KEY);
lists::add("craftguide",i);

View File

@ -6,7 +6,7 @@
#define CONTENT_TOOLITEM_MASK 0x4000
enum ToolType {
TT_NONE, // used only when checking against an item that isn't a tool
TT_NONE = 0, // used only when checking against an item that isn't a tool
TT_SPECIAL, // special toolitems cannot dig
TT_AXE,
TT_PICK,
@ -34,6 +34,16 @@ struct ToolItemFeatures {
s16 drop_count;
// whether this tool can point at liquid nodes
bool liquids_pointable;
// whether this tool should die when trying to pick up damaging nodes
bool damaging_nodes_diggable;
// whether this tool has a punch effect, such as open doors
bool has_punch_effect;
// whether this tool can lock/unlock nodes
bool has_unlock_effect;
// whether this tool can rotate nodes
bool has_rotate_effect;
// whether this tool can start fires
bool has_fire_effect;
// the type of this tool
ToolType type;
// the hardness of this tool
@ -42,6 +52,10 @@ struct ToolItemFeatures {
f32 dig_time;
// used for eg. bows throwing an arrow
content_t thrown_item;
// when this item is placed, it should be replaced by this in inventory
content_t onplace_replace_item;
// when this item is placed, it should place this node instead
content_t onplace_node;
ToolItemFeatures():
content(CONTENT_IGNORE),
@ -53,10 +67,17 @@ struct ToolItemFeatures {
edible(0),
drop_count(-1),
liquids_pointable(false),
damaging_nodes_diggable(true),
has_punch_effect(true),
has_unlock_effect(false),
has_rotate_effect(false),
has_fire_effect(false),
type(TT_NONE),
hardness(0.),
dig_time(3.),
thrown_item(CONTENT_IGNORE)
thrown_item(CONTENT_IGNORE),
onplace_replace_item(CONTENT_IGNORE),
onplace_node(CONTENT_IGNORE)
{}
};
struct DiggingProperties

View File

@ -181,6 +181,15 @@ float MaterialItem::getFuelTime() const
return content_features(m_content).fuel_time;
}
bool MaterialItem::use(ServerEnvironment *env, Player *player)
{
content_t n = content_features(m_content).onuse_replace_node;
if (n != CONTENT_IGNORE) {
m_content = n;
}
return false;
}
/*
CraftItem
*/
@ -247,10 +256,11 @@ float CraftItem::getFuelTime() const
return content_craftitem_features(m_content).fuel_time;
}
/* TODO: rewrite, completely, pretty much */
bool CraftItem::use(ServerEnvironment *env, Player *player)
{
u16 count = getCount();
if (content_craftitem_features(m_content).edible) {
u16 result_count = getCount() - 1; // Eat one at a time
s16 hp_change = content_craftitem_features(m_content).edible;
if (hp_change) {
if (player->hunger < 20) {
@ -271,9 +281,15 @@ bool CraftItem::use(ServerEnvironment *env, Player *player)
}
}
if (result_count < 1)
return true;
setCount(result_count);
if (content_craftitem_features(m_content).onuse_replace_item == CONTENT_IGNORE) {
count --;
if (count < 1)
return true;
setCount(count);
}
}
if (content_craftitem_features(m_content).onuse_replace_item != CONTENT_IGNORE) {
m_content = content_craftitem_features(m_content).onuse_replace_item;
}
return false;
}

View File

@ -214,6 +214,9 @@ public:
InventoryItem *createCookResult() const;
virtual bool isFuel() const;
virtual float getFuelTime() const;
bool use(ServerEnvironment *env, Player *player);
/*
Special methods
*/

View File

@ -361,17 +361,24 @@ struct ContentFeatures
bool destructive_mob_safe;
// Whether punching with fertilizer advances the growth rate of the node
bool fertilizer_affects;
// when dug with a shovel near water, turns to farm dirt
bool farm_ploughable;
// Inventory item string as which the node appears in inventory when dug.
// Mineral overrides this.
std::string dug_item;
// Extra dug item and its rarity
std::string extra_dug_item;
s32 extra_dug_item_rarity;
// when dug, this node will replace the dug node
content_t ondig_replace_node;
// the above replacement will only occur if this node is nearby (3 node radius)
content_t ondig_replace_node_requires;
// drop this instead of dug_item when the special tooltype is used
content_t ondig_special_drop;
u16 ondig_special_drop_count;
u16 ondig_special_tool;
// when punched, this node will replace the punched node
content_t onpunch_replace_node;
@ -385,6 +392,15 @@ struct ContentFeatures
// walls connecting to blocks, or seeds growing to plants
content_t special_alternate_node;
// if this node is locked/unlocked, replace with this
content_t alternate_lockstate_node;
// if the item is wielded and Use is pressed, the node is swapped with this
content_t onuse_replace_node;
// when dug, also remove this
v3s16 ondig_also_removes;
// when energised, replace with this node
content_t powered_node;
// when unenergised, replace with this node
@ -503,15 +519,23 @@ struct ContentFeatures
often_contains_mineral = false;
destructive_mob_safe = false;
fertilizer_affects = false;
farm_ploughable = false;
dug_item = "";
extra_dug_item = "";
extra_dug_item_rarity = 2;
ondig_replace_node = CONTENT_IGNORE;
ondig_replace_node_requires = CONTENT_IGNORE;
ondig_special_drop = CONTENT_IGNORE;
ondig_special_drop_count = 1;
ondig_special_tool = 0;
onpunch_replace_node = CONTENT_IGNORE;
wallmount_alternate_node = CONTENT_IGNORE;
floormount_alternate_node = CONTENT_IGNORE;
roofmount_alternate_node = CONTENT_IGNORE;
special_alternate_node = CONTENT_IGNORE;
alternate_lockstate_node = CONTENT_IGNORE;
onuse_replace_node = CONTENT_IGNORE;
ondig_also_removes = v3s16(0,0,0);
powered_node = CONTENT_IGNORE;
unpowered_node = CONTENT_IGNORE;
cook_result = "";

File diff suppressed because it is too large Load Diff