fixed a bug where blocks are still consumend even if there is a block already under the cursor

This commit is contained in:
minjaesong
2022-07-14 17:07:59 +09:00
parent 69c5ceb61f
commit 23c2d86c27
3 changed files with 13 additions and 13 deletions

View File

@@ -69,7 +69,7 @@ class ActorInventory() : FixtureInventory() {
fun consumeItem(item: GameItem, amount: Long = 1L) {
val actor = this.actor as Actor
if (item.isDynamic && amount != 1L) throw IllegalArgumentException("Dynamic item must be consumed 'once' (expected 1, got $amount)")
if (amount < 0) throw IllegalArgumentException("Consuming negative amount of an item (expected >=0, got $amount)")
if (item.stackable && !item.isDynamic) {
remove(item, amount)