mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-12 03:24:06 +09:00
fixed a long bug where item would be used twice but discounted by only one on single click
This commit is contained in:
@@ -177,7 +177,9 @@ class ActorInventory(@Transient val actor: Pocketed, var maxCapacity: Int, var c
|
||||
false
|
||||
|
||||
|
||||
fun consumeItem(actor: Actor, item: GameItem) {
|
||||
fun consumeItem(item: GameItem) {
|
||||
val actor = this.actor as Actor
|
||||
|
||||
if (item.stackable && !item.isDynamic) {
|
||||
remove(item, 1)
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package net.torvald.terrarum.modulebasegame.gameactors
|
||||
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.gameactors.Actor
|
||||
import net.torvald.terrarum.itemproperties.GameItem
|
||||
import net.torvald.terrarum.itemproperties.ItemCodex
|
||||
import net.torvald.terrarum.itemproperties.ItemID
|
||||
@@ -79,15 +78,4 @@ interface Pocketed {
|
||||
fun hasItem(item: GameItem) = inventory.contains(item.dynamicID)
|
||||
fun hasItem(id: Int) = inventory.contains(id)
|
||||
|
||||
|
||||
fun consumePrimary(item: GameItem) {
|
||||
if (item.startPrimaryUse(AppLoader.UPDATE_RATE.toFloat())) {
|
||||
inventory.consumeItem(this as Actor, item) // consume on successful
|
||||
}
|
||||
}
|
||||
|
||||
fun consumeSecondary(item: GameItem) {
|
||||
if (item.startSecondaryUse(AppLoader.UPDATE_RATE.toFloat()))
|
||||
inventory.consumeItem(this as Actor, item) // consume on successful
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user