Quickbar: all working except for equip/unequip

This commit is contained in:
Song Minjae
2017-04-28 01:48:51 +09:00
parent 048f96b554
commit 55578ccc1e
8 changed files with 106 additions and 73 deletions

View File

@@ -93,9 +93,7 @@ object AVKey {
const val __PLAYER_QUICKSLOTSEL = "__quickslotselection"
/** SYNOPSIS: __qsitem1 .. __qsitem10
* contains tem ID; they are supposed to be unique. Indices must be ONE-BASED! */
const val __PLAYER_QSPREFIX = "__qsitem" // __qsitem1 .. __qsitem10 (NOT ZERO BASED!)
/** Double
* When using tool/arm/etc. how long action button is held, in milliseconds (Int)
* Or for NPCs, how long it has been waiting for next move

View File

@@ -3,6 +3,7 @@ package net.torvald.terrarum.gameactors
import com.jme3.math.FastMath
import net.torvald.terrarum.Terrarum
import net.torvald.terrarum.gameactors.faction.Faction
import net.torvald.terrarum.gamecontroller.Key
import net.torvald.terrarum.itemproperties.InventoryItem
import net.torvald.terrarum.itemproperties.Material
import net.torvald.terrarum.realestate.LandUtil
@@ -333,7 +334,9 @@ open class ActorHumanoid(birth: GameDate, death: GameDate? = null)
}
override fun keyPressed(key: Int, c: Char) {
if (key in Key.NUM_1..Key.NUM_0) {
actorValue[AVKey.__PLAYER_QUICKSLOTSEL] = key - Key.NUM_1
}
}
/**

View File

@@ -33,7 +33,7 @@ class ActorInventory(val actor: Pocketed, var maxCapacity: Int, var capacityMode
* Sorted by referenceID.
*/
private val itemList = ArrayList<InventoryPair>()
private val quickBar = Array<ItemID?>(10, { null })
private val quickBar = Array<ItemID?>(10, { null }) // 0: Slot 1, 9: Slot 10
init {
}