wire connectivity wip

This commit is contained in:
minjaesong
2022-07-07 01:06:43 +09:00
parent 84158319d1
commit db0be9e088
10 changed files with 138 additions and 34 deletions

View File

@@ -66,11 +66,13 @@ class ActorInventory() : FixtureInventory() {
fun getQuickslotItem(slot: Int): InventoryPair? = searchByID(quickSlot[slot])
fun consumeItem(item: GameItem) {
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 (item.stackable && !item.isDynamic) {
remove(item, 1)
remove(item, amount)
}
else if (item.isUnique) {
return // don't consume a bike!

View File

@@ -49,7 +49,8 @@ open class FixtureInventory() {
// other invalid values
if (count == 0L)
throw IllegalArgumentException("[${this.javaClass.canonicalName}] Item count is zero.")
// throw IllegalArgumentException("[${this.javaClass.canonicalName}] Item count is zero.")
return
if (count < 0L)
throw IllegalArgumentException("Item count is negative number. If you intended removing items, use remove()\n" +
"These commands are NOT INTERCHANGEABLE; they handle things differently according to the context.")
@@ -94,7 +95,8 @@ open class FixtureInventory() {
println("[ActorInventory] remove $item, $count")
if (count == 0L)
throw IllegalArgumentException("[${this.javaClass.canonicalName}] Item count is zero.")
// throw IllegalArgumentException("[${this.javaClass.canonicalName}] Item count is zero.")
return
if (count < 0L)
throw IllegalArgumentException("[${this.javaClass.canonicalName}] Item count is negative number. If you intended adding items, use add()" +
"These commands are NOT INTERCHANGEABLE; they handle things differently according to the context.")