diff --git a/src/net/torvald/terrarum/UIItemInventoryElem.kt b/src/net/torvald/terrarum/UIItemInventoryElem.kt index cc0ee9cac..f56b5fff5 100644 --- a/src/net/torvald/terrarum/UIItemInventoryElem.kt +++ b/src/net/torvald/terrarum/UIItemInventoryElem.kt @@ -11,6 +11,7 @@ import net.torvald.terrarum.modulebasegame.Ingame import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull import net.torvald.terrarum.modulebasegame.ui.UIItemInventoryCellBase import net.torvald.terrarum.modulebasegame.ui.UIItemInventoryCellCommonRes +import net.torvald.terrarum.modulebasegame.ui.UIItemInventoryCellCommonRes.toItemCountText import net.torvald.terrarum.ui.UIItemTextButton /*** @@ -90,6 +91,8 @@ class UIItemInventoryElem( if (item != null && itemImage != null) { + val amountString = amount.toItemCountText() + blendNormal(batch) // item image @@ -103,7 +106,7 @@ class UIItemInventoryElem( if (AppLoader.IS_DEVELOPMENT_BUILD) { Terrarum.fontGame.draw(batch, // print static id, dynamic id, and count - "${item!!.originalID}/${item!!.dynamicID}" + (if (amount > 0 && item!!.stackable) "$fwsp($amount)" else if (amount != 1) "$fwsp!!$amount!!" else ""), + "${item!!.originalID}/${item!!.dynamicID}" + (if (amount > 0 && item!!.stackable) "$fwsp($amountString)" else if (amount != 1) "$fwsp!!$amountString!!" else ""), posX + textOffsetX, posY + textOffsetY ) @@ -111,7 +114,7 @@ class UIItemInventoryElem( else { Terrarum.fontGame.draw(batch, // print name and amount in parens - item!!.name + (if (amount > 0 && item!!.stackable) "$fwsp($amount)" else if (amount != 1) "$fwsp!!$amount!!" else "") + + item!!.name + (if (amount > 0 && item!!.stackable) "$fwsp($amountString)" else if (amount != 1) "$fwsp!!$amountString!!" else "") + // TEMPORARY print eqipped slot info as well (if (equippedSlot != null) " ${0xE081.toChar()}\$$equippedSlot" else ""), diff --git a/src/net/torvald/terrarum/UIItemInventoryElemSimple.kt b/src/net/torvald/terrarum/UIItemInventoryElemSimple.kt index 29019729d..e704b8ae9 100644 --- a/src/net/torvald/terrarum/UIItemInventoryElemSimple.kt +++ b/src/net/torvald/terrarum/UIItemInventoryElemSimple.kt @@ -11,6 +11,7 @@ import net.torvald.terrarum.modulebasegame.Ingame import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull import net.torvald.terrarum.modulebasegame.ui.UIItemInventoryCellBase import net.torvald.terrarum.modulebasegame.ui.UIItemInventoryCellCommonRes +import net.torvald.terrarum.modulebasegame.ui.UIItemInventoryCellCommonRes.toItemCountText import net.torvald.terrarum.ui.UIItemTextButton /** @@ -107,7 +108,7 @@ class UIItemInventoryElemSimple( } // draw item count when applicable else if (item!!.stackable) { - val amountString = amount.toString() + val amountString = amount.toItemCountText() // highlight item count (blocks/walls) if the item is equipped if (equippedSlot != null) { diff --git a/src/net/torvald/terrarum/modulebasegame/gameactors/FixtureBase.kt b/src/net/torvald/terrarum/modulebasegame/gameactors/FixtureBase.kt index 18fb149eb..2619fbc1f 100644 --- a/src/net/torvald/terrarum/modulebasegame/gameactors/FixtureBase.kt +++ b/src/net/torvald/terrarum/modulebasegame/gameactors/FixtureBase.kt @@ -66,6 +66,8 @@ open class FixtureBase(blockBox0: BlockBox, val blockBoxProps: BlockBoxProps = B return true // TODO for the tests' sake, just get fucking spawned + + // FIXME has "roundworld anomaly" } /** diff --git a/src/net/torvald/terrarum/modulebasegame/gameactors/PlayerBuilderSigrid.kt b/src/net/torvald/terrarum/modulebasegame/gameactors/PlayerBuilderSigrid.kt index 76bba53ca..8418a97ec 100644 --- a/src/net/torvald/terrarum/modulebasegame/gameactors/PlayerBuilderSigrid.kt +++ b/src/net/torvald/terrarum/modulebasegame/gameactors/PlayerBuilderSigrid.kt @@ -88,7 +88,7 @@ object PlayerBuilderSigrid { inventory.add(8449) // iron pick inventory.add(8450) // steel pick inventory.add(8466, 9995) // wire piece - inventory.add(8467, 9995) // test tiki torch + inventory.add(8467, 385930603) // test tiki torch inventory.add(9000) // TEST water bucket inventory.add(9001) // TEST lava bucket } diff --git a/src/net/torvald/terrarum/modulebasegame/ui/UIItemInventoryCellBase.kt b/src/net/torvald/terrarum/modulebasegame/ui/UIItemInventoryCellBase.kt index 301d55ae3..bb86a8816 100644 --- a/src/net/torvald/terrarum/modulebasegame/ui/UIItemInventoryCellBase.kt +++ b/src/net/torvald/terrarum/modulebasegame/ui/UIItemInventoryCellBase.kt @@ -6,6 +6,7 @@ import com.badlogic.gdx.graphics.Color import com.badlogic.gdx.graphics.g2d.SpriteBatch import com.badlogic.gdx.graphics.g2d.TextureRegion import net.torvald.terrarum.GdxColorMap +import net.torvald.terrarum.abs import net.torvald.terrarum.gameitem.GameItem import net.torvald.terrarum.ui.UIItem import kotlin.math.roundToInt @@ -45,6 +46,17 @@ object UIItemInventoryCellCommonRes { meterColourMap[scale.times(meterColourMap.width - 1).roundToInt()] } } - + fun getHealthMeterColour(value: Int, start: Int, end: Int) = getHealthMeterColour(value.toFloat(), start.toFloat(), end.toFloat()) + + fun Int.toItemCountText() = (if (this < 0) "-" else "") + when (this.abs()) { + in 0..999999 -> "$this" + in 1_000_000..999_999_999 -> "${this / 1_000_000}.${this.rem(1_000_000) / 10_000}M" + else -> "${this / 1_000_000_000}.${this.rem(1_000_000_000) / 10_000_000}B" + + // 1 000 000 000 + // 2 147 483 647 + + // -2.14B + } } \ No newline at end of file diff --git a/work_files/graphics/items/dye64.psd b/work_files/graphics/items/dye64.psd new file mode 100644 index 000000000..24bbe887a --- /dev/null +++ b/work_files/graphics/items/dye64.psd @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2b52e9142d2c8a67c889d591e9e4649217baf7a521615b72544f5f0907e04953 +size 164210 diff --git a/work_files/graphics/items/items.psd b/work_files/graphics/items/items.psd index 5203630fa..3b632e602 100755 --- a/work_files/graphics/items/items.psd +++ b/work_files/graphics/items/items.psd @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5f88daac2886df89b319564ee4284d503d6710000fac01d6fefb73c0f45744d6 -size 720942 +oid sha256:8de1e7c4d2e883ebbc95c1648de603b206552e2b793d1d02bb4884d1062513b0 +size 722354