summaryrefslogtreecommitdiff
path: root/src/server.cpp
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2011-09-26 22:41:06 +0300
committerPerttu Ahola <celeron55@gmail.com>2011-09-26 22:41:06 +0300
commita7833cca22bbb923efbc01fd0f820318a613eca6 (patch)
treeb8da72d3e36b70f1cd018615ed38de5d009cfe57 /src/server.cpp
parent08ac3454ccb473156d39ebf543d617c1541588ca (diff)
parentbc01ae4cbd6e9ba2bcc0b75bab8ba5d99fcc4e34 (diff)
downloadminetest-a7833cca22bbb923efbc01fd0f820318a613eca6.tar.gz
minetest-a7833cca22bbb923efbc01fd0f820318a613eca6.tar.bz2
minetest-a7833cca22bbb923efbc01fd0f820318a613eca6.zip
Merge remote-tracking branch 'marktraceur/master'
Diffstat (limited to 'src/server.cpp')
-rw-r--r--src/server.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/server.cpp b/src/server.cpp
index 5395d7618..44889d67e 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -2748,6 +2748,34 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
UpdateCrafting(player->peer_id);
SendInventory(player->peer_id);
}
+
+ item = NULL;
+
+ if(mineral != MINERAL_NONE)
+ item = getDiggedMineralItem(mineral);
+
+ // If not mineral
+ if(item == NULL)
+ {
+ std::string &extra_dug_s = content_features(material).extra_dug_item;
+ s32 extra_rarity = content_features(material).extra_dug_item_rarity;
+ if(extra_dug_s != "" && extra_rarity != 0
+ && myrand() % extra_rarity == 0)
+ {
+ std::istringstream is(extra_dug_s, std::ios::binary);
+ item = InventoryItem::deSerialize(is);
+ }
+ }
+
+ if(item != NULL)
+ {
+ // Add a item to inventory
+ player->inventory.addItem("main", item);
+
+ // Send inventory
+ UpdateCrafting(player->peer_id);
+ SendInventory(player->peer_id);
+ }
}
/*