MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / upgradeTable

Method upgradeTable

source/frontend/StarCraftingInterface.cpp:203–225  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

201}
202
203void CraftingPane::upgradeTable() {
204 if (m_sourceEntityId != NullEntityId) {
205 // Checks that the upgrade path exists
206 if (m_upgradeRecipe) {
207 if (m_player->isAdmin() || ItemDatabase::canMakeRecipe(*m_upgradeRecipe, m_player->inventory()->availableItems(), m_player->inventory()->availableCurrencies())) {
208 if (!m_player->isAdmin())
209 consumeIngredients(*m_upgradeRecipe, 1);
210
211 // upgrade the old table
212 m_worldClient->sendEntityMessage(m_sourceEntityId, "requestUpgrade");
213
214 // unlock any recipes specified
215 if (auto recipeUnlocks = m_settings.opt("upgradeRecipeUnlocks")) {
216 for (String itemName : jsonToStringList(*recipeUnlocks))
217 m_player->addBlueprint(ItemDescriptor(itemName));
218 }
219
220 // this closes the interface window
221 dismiss();
222 }
223 }
224 }
225}
226
227size_t CraftingPane::itemCount(List<ItemPtr> const& store, ItemDescriptor const& item) {
228 auto itemDb = Root::singleton().itemDatabase();

Callers

nothing calls this directly

Calls 9

jsonToStringListFunction · 0.85
ItemDescriptorClass · 0.85
availableItemsMethod · 0.80
inventoryMethod · 0.80
availableCurrenciesMethod · 0.80
addBlueprintMethod · 0.80
isAdminMethod · 0.45
sendEntityMessageMethod · 0.45
optMethod · 0.45

Tested by

no test coverage detected