fix: pickaxe will constantly closing the tooltip while equipped

This commit is contained in:
minjaesong
2024-02-03 15:40:29 +09:00
parent 559f5a9a9d
commit 5dacbe18a3
2 changed files with 6 additions and 1 deletions

View File

@@ -18,6 +18,7 @@ import net.torvald.terrarum.modulebasegame.TerrarumIngame
import net.torvald.terrarum.modulebasegame.gameactors.DroppedItem 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.BASE_MASS_AND_SIZE
import net.torvald.terrarum.modulebasegame.gameitems.PickaxeCore.TOOL_DURABILITY_BASE 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 net.torvald.terrarum.worlddrawer.CreateTileAtlas.RenderTag
import org.dyn4j.geometry.Vector2 import org.dyn4j.geometry.Vector2
import kotlin.math.roundToInt import kotlin.math.roundToInt
@@ -26,6 +27,8 @@ import kotlin.math.roundToInt
* Created by minjaesong on 2019-03-10. * Created by minjaesong on 2019-03-10.
*/ */
object PickaxeCore { object PickaxeCore {
private val hash = 10002L
/** /**
* @param mx centre position of the digging * @param mx centre position of the digging
* @param my centre position of the digging * @param my centre position of the digging
@@ -199,13 +202,14 @@ object PickaxeCore {
Lang[ItemCodex[itemForOre]!!.originalName] Lang[ItemCodex[itemForOre]!!.originalName]
else "???" else "???"
INGAME.setTooltipMessage(tileName) INGAME.setTooltipMessage(tileName)
tooltipShowing[hash] = true
tooltipSet = true tooltipSet = true
} }
true // just a placeholder true // just a placeholder
} }
if (!tooltipSet) INGAME.setTooltipMessage(null) if (!tooltipSet) tooltipShowing[hash] = false
} }
} }
} }

View File

@@ -126,6 +126,7 @@ object UIItemInventoryCellCommonRes {
/** /**
* Special hash values: * Special hash values:
* - 10001: Encumbrance bar * - 10001: Encumbrance bar
* - 10002: Pickaxe
*/ */
val tooltipShowing = HashMap<Long, Boolean>() // Long: `hash` field on UIItemInventoryItemGrid val tooltipShowing = HashMap<Long, Boolean>() // Long: `hash` field on UIItemInventoryItemGrid
} }