Skip to content

Commit

Permalink
shift qol on inventory stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Kade-github committed May 17, 2024
1 parent 8848f36 commit 9c20da2
Showing 1 changed file with 45 additions and 2 deletions.
47 changes: 45 additions & 2 deletions src/Game/Objects/Base/UI/Inventory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ void Inventory::UpdateInventory(bool dontRemoveOutput)

Data::InventoryItem out = CraftingManager::GetInstance()->Craft(stored_crafting);

output = out;
output = out;
}
else
{
Expand Down Expand Up @@ -721,8 +721,51 @@ void Inventory::MouseClick(int button, glm::vec2 pos)
return;


if (sSlot.id == 90 && output.type != Data::ItemType::ITEM_NULL)
if (sSlot.id == 90)
{
UpdateTable();
// if shift click, move to inventory

bool shift = glfwGetKey(Game::instance->GetWindow(), GLFW_KEY_LEFT_SHIFT) == GLFW_PRESS;

if (shift)
{
if (!isFurnace)
{
// craft until we can't anymore

Data::InventoryItem i = output;

while (i.type != Data::ItemType::ITEM_NULL)
{
if (!player->playerData.GiveItem(i)) // inventory full, so we stop
break;

i = CraftingManager::GetInstance()->Craft(stored_crafting);
UpdateTable();
SetCrafting();
}

output = i;
UpdateInventory();
return;
}
else
{
// instant take

if (output.type != Data::ItemType::ITEM_NULL)
{
if (player->playerData.GiveItem(output)) // inventory full, so we do nothing
{
output = {};
UpdateInventory();
}
return;
}
}
}
}

// check if we are dragging a crafting ingredient

Expand Down

0 comments on commit 9c20da2

Please sign in to comment.