a console command to fill up inventory with every item

This commit is contained in:
minjaesong
2022-02-22 17:22:54 +09:00
parent df6950c0b8
commit 596cd9b102
5 changed files with 51 additions and 1 deletions

View File

@@ -0,0 +1,22 @@
package net.torvald.terrarum.modulebasegame.console
import net.torvald.terrarum.INGAME
import net.torvald.terrarum.console.ConsoleCommand
import net.torvald.terrarum.console.Echo
import net.torvald.terrarum.modulebasegame.gameactors.PlayerBuilderSigrid
/**
* Created by minjaesong on 2022-02-22.
*/
internal object DebugFillInventory : ConsoleCommand {
override fun execute(args: Array<String>) {
INGAME.actorNowPlaying?.let {
it.inventory.nuke()
PlayerBuilderSigrid.fillTestInventory(it.inventory)
}
}
override fun printUsage() {
Echo("Populates inventory of the currently playing actor with every item currently available. Will overwrite existing inventory.")
}
}

View File

@@ -119,5 +119,11 @@ class ActorInventory() : FixtureInventory() {
//println("[ActorInventory] consumed; ${item.durability}")
}
}
override fun nuke() {
super.nuke()
itemEquipped.fill(null)
quickSlot.fill(null)
}
}

View File

@@ -212,6 +212,10 @@ open class FixtureInventory() {
}
return -(low + 1) // key not found
}
open fun nuke() {
itemList.clear()
}
}
class InventoryPair : Comparable<InventoryPair> {