summaryrefslogtreecommitdiff
path: root/src/server.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server.cpp')
-rw-r--r--src/server.cpp29
1 files changed, 20 insertions, 9 deletions
diff --git a/src/server.cpp b/src/server.cpp
index 739698f16..02a832ca2 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -1854,6 +1854,7 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
0: start digging
1: place block
2: stop digging (all parameters ignored)
+ 3: digging completed
*/
u8 action = readU8(&data[2]);
v3s16 p_under;
@@ -1996,23 +1997,33 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
}
/*
- Add digged item to inventory
+ Add dug item to inventory
*/
InventoryItem *item = NULL;
if(mineral != MINERAL_NONE)
item = getDiggedMineralItem(mineral);
-
+
+ // If not mineral
if(item == NULL)
- item = new MaterialItem(material, 1);
-
- player->inventory.addItem("main", item);
+ {
+ std::string &dug_s = content_features(material).dug_item;
+ if(dug_s != "")
+ {
+ std::istringstream is(dug_s, std::ios::binary);
+ item = InventoryItem::deSerialize(is);
+ }
+ }
+
+ if(item != NULL)
+ {
+ // Add a item to inventory
+ player->inventory.addItem("main", item);
- /*
- Send inventory
- */
- SendInventory(player->peer_id);
+ // Send inventory
+ SendInventory(player->peer_id);
+ }
}
/*