durability meter: stack of (new) tools displayed as intended

- displaying NOT based on their stacks but their health
This commit is contained in:
Song Minjae
2017-04-25 17:24:56 +09:00
parent ab8f019109
commit 36a7983024
3 changed files with 7 additions and 5 deletions

View File

@@ -19,8 +19,7 @@ object AmmoMeterProxy {
}
else {
meter.vitalGetterVal = {
if (ItemCodex[currentItem.originalID].stackable) {
//println("[AmmoMeterProxy] currentItem: $currentItem")
if (currentItem.stackable && currentItem.maxDurability == InventoryItem.DURABILITY_NA) {
actor.inventory.getByDynamicID(currentItem.dynamicID)!!.amount.toFloat()
}
else
@@ -28,7 +27,7 @@ object AmmoMeterProxy {
}
meter.vitalGetterMax = {
if (ItemCodex[currentItem.originalID].stackable)
if (currentItem.stackable && currentItem.maxDurability == InventoryItem.DURABILITY_NA)
500f
else
currentItem.maxDurability.toFloat()

View File

@@ -42,7 +42,7 @@ object PlayerBuilderSigrid {
p.actorValue[AVKey.SPEEDBUFF] = 1.0
p.actorValue[AVKey.ACCEL] = ActorHumanoid.WALK_ACCEL_BASE
p.actorValue[AVKey.ACCELBUFF] = 1.0
p.actorValue[AVKey.JUMPPOWER] = 5.0
p.actorValue[AVKey.JUMPPOWER] = 5.2
p.actorValue[AVKey.BASEMASS] = 80.0
p.actorValue[AVKey.SCALEBUFF] = 1.0 // Constant 1.0 for player, meant to be used by random mobs

View File

@@ -108,7 +108,7 @@ abstract class InventoryItem : Comparable<InventoryItem>, Cloneable {
open var scale: Double = 1.0
/**
* Set to zero if durability not applicable
* Set to zero (InventoryItem.DURABILITY_NA) if durability not applicable
*/
open var maxDurability: Int = 0
@@ -255,6 +255,9 @@ abstract class InventoryItem : Comparable<InventoryItem>, Cloneable {
}
companion object {
val DURABILITY_NA = 0
fun generateUniqueDynamicID(inventory: ActorInventory): Int {
var ret: Int
do {