From 85f119e1e6cc958a54eaf8468f2a302aa8c60dbe Mon Sep 17 00:00:00 2001 From: Mark Holmquist Date: Tue, 16 Aug 2011 02:14:49 -0700 Subject: Adding (most) of the sapling functionality. It has yet to work, since MEET_OTHER was not implemented at the time of this commit. Hopefully it will work when merged with celeron's latest. --- src/server.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'src/server.cpp') diff --git a/src/server.cpp b/src/server.cpp index a04417074..04a23b777 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -2735,6 +2735,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); + } } /* -- cgit v1.2.3