From 5dacbe18a37bfe457eb0e518fda1707c5ab72a05 Mon Sep 17 00:00:00 2001 From: minjaesong Date: Sat, 3 Feb 2024 15:40:29 +0900 Subject: [PATCH] fix: pickaxe will constantly closing the tooltip while equipped --- .../terrarum/modulebasegame/gameitems/PickaxeGeneric.kt | 6 +++++- .../terrarum/modulebasegame/ui/UIItemInventoryCellBase.kt | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/net/torvald/terrarum/modulebasegame/gameitems/PickaxeGeneric.kt b/src/net/torvald/terrarum/modulebasegame/gameitems/PickaxeGeneric.kt index 371275e34..4279e435c 100644 --- a/src/net/torvald/terrarum/modulebasegame/gameitems/PickaxeGeneric.kt +++ b/src/net/torvald/terrarum/modulebasegame/gameitems/PickaxeGeneric.kt @@ -18,6 +18,7 @@ import net.torvald.terrarum.modulebasegame.TerrarumIngame import net.torvald.terrarum.modulebasegame.gameactors.DroppedItem import net.torvald.terrarum.modulebasegame.gameitems.PickaxeCore.BASE_MASS_AND_SIZE import net.torvald.terrarum.modulebasegame.gameitems.PickaxeCore.TOOL_DURABILITY_BASE +import net.torvald.terrarum.modulebasegame.ui.UIItemInventoryCellCommonRes.tooltipShowing import net.torvald.terrarum.worlddrawer.CreateTileAtlas.RenderTag import org.dyn4j.geometry.Vector2 import kotlin.math.roundToInt @@ -26,6 +27,8 @@ import kotlin.math.roundToInt * Created by minjaesong on 2019-03-10. */ object PickaxeCore { + private val hash = 10002L + /** * @param mx centre position of the digging * @param my centre position of the digging @@ -199,13 +202,14 @@ object PickaxeCore { Lang[ItemCodex[itemForOre]!!.originalName] else "???" INGAME.setTooltipMessage(tileName) + tooltipShowing[hash] = true tooltipSet = true } true // just a placeholder } - if (!tooltipSet) INGAME.setTooltipMessage(null) + if (!tooltipSet) tooltipShowing[hash] = false } } } diff --git a/src/net/torvald/terrarum/modulebasegame/ui/UIItemInventoryCellBase.kt b/src/net/torvald/terrarum/modulebasegame/ui/UIItemInventoryCellBase.kt index 12f93bf57..142dd1279 100644 --- a/src/net/torvald/terrarum/modulebasegame/ui/UIItemInventoryCellBase.kt +++ b/src/net/torvald/terrarum/modulebasegame/ui/UIItemInventoryCellBase.kt @@ -126,6 +126,7 @@ object UIItemInventoryCellCommonRes { /** * Special hash values: * - 10001: Encumbrance bar + * - 10002: Pickaxe */ val tooltipShowing = HashMap() // Long: `hash` field on UIItemInventoryItemGrid }