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

Method swapSlot

source/frontend/StarContainerInterface.cpp:224–237  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

222}
223
224void ContainerPane::swapSlot(ItemGridWidget* grid) {
225 auto inv = m_player->inventory();
226 if (context()->shiftHeld()) {
227 auto containerItem = grid->selectedItem();
228 if (containerItem && inv->itemsCanFit(containerItem) >= containerItem->count()) {
229 m_containerInteractor->swapInContainer(grid->selectedIndex(), {});
230 m_expectingSwap = ExpectingSwap::Inventory;
231 }
232 } else {
233 m_containerInteractor->swapInContainer(grid->selectedIndex(), inv->swapSlotItem());
234 inv->setSwapSlotItem({});
235 m_expectingSwap = ExpectingSwap::SwapSlot;
236 }
237}
238
239void ContainerPane::startCrafting() {
240 m_containerInteractor->startCraftingInContainer();

Callers

nothing calls this directly

Calls 9

inventoryMethod · 0.80
shiftHeldMethod · 0.80
swapInContainerMethod · 0.80
selectedIndexMethod · 0.80
swapSlotItemMethod · 0.80
setSwapSlotItemMethod · 0.80
selectedItemMethod · 0.45
itemsCanFitMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected