From b911ef98bb01b199f62a5ec65f66d41b770df92a Mon Sep 17 00:00:00 2001 From: Anuken Date: Mon, 25 Jun 2018 19:37:04 -0400 Subject: [PATCH] Fixed units without an inventory being able to withdraw items --- core/src/io/anuke/mindustry/entities/UnitInventory.java | 2 +- .../io/anuke/mindustry/ui/fragments/BlockInventoryFragment.java | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/core/src/io/anuke/mindustry/entities/UnitInventory.java b/core/src/io/anuke/mindustry/entities/UnitInventory.java index cc861744e6..f4739bf99b 100644 --- a/core/src/io/anuke/mindustry/entities/UnitInventory.java +++ b/core/src/io/anuke/mindustry/entities/UnitInventory.java @@ -123,7 +123,7 @@ public class UnitInventory implements Saveable{ } public boolean canAcceptItem(Item type){ - return !hasItem() || (item.item == type && unit.getItemCapacity() - item.amount > 0); + return (!hasItem() && 1 <= unit.getItemCapacity()) || (item.item == type && unit.getItemCapacity() - item.amount > 0); } public boolean canAcceptItem(Item type, int amount){ diff --git a/core/src/io/anuke/mindustry/ui/fragments/BlockInventoryFragment.java b/core/src/io/anuke/mindustry/ui/fragments/BlockInventoryFragment.java index 84c135fed6..4fa22c449d 100644 --- a/core/src/io/anuke/mindustry/ui/fragments/BlockInventoryFragment.java +++ b/core/src/io/anuke/mindustry/ui/fragments/BlockInventoryFragment.java @@ -112,7 +112,6 @@ public class BlockInventoryFragment implements Fragment { if(!canPick.get() || items[f] == 0) return; int amount = Math.min(Inputs.keyDown("item_withdraw") ? items[f] : 1, player.inventory.itemCapacityUsed(item)); CallBlocks.requestItem(player, tile, item, amount); - }); table.add(image);