diff --git a/src/net/torvald/terrarum/modulebasegame/ui/UIInventoryCells.kt b/src/net/torvald/terrarum/modulebasegame/ui/UIInventoryCells.kt index e21009021..da1e92b6d 100644 --- a/src/net/torvald/terrarum/modulebasegame/ui/UIInventoryCells.kt +++ b/src/net/torvald/terrarum/modulebasegame/ui/UIInventoryCells.kt @@ -97,7 +97,7 @@ internal class UIInventoryCells( INVENTORY_CELLS_OFFSET_X(), INVENTORY_CELLS_OFFSET_Y(), CELLS_HOR, CELLS_VRT, - keyDownFun = createInvCellGenericKeyDownFun(), + keyDownFun = createInvCellGenericKeyDownFun { rebuildList() }, touchDownFun = createInvCellGenericTouchDownFun { rebuildList() }, wheelFun = { _, _, _, _, _, _ -> }, ) diff --git a/src/net/torvald/terrarum/modulebasegame/ui/UIItemInventoryEquippedView.kt b/src/net/torvald/terrarum/modulebasegame/ui/UIItemInventoryEquippedView.kt index c2c9b2e66..c1e1899cf 100644 --- a/src/net/torvald/terrarum/modulebasegame/ui/UIItemInventoryEquippedView.kt +++ b/src/net/torvald/terrarum/modulebasegame/ui/UIItemInventoryEquippedView.kt @@ -54,7 +54,7 @@ class UIItemInventoryEquippedView( amount = UIItemInventoryElemWide.UNIQUE_ITEM_HAS_NO_AMOUNT, itemImage = null, drawBackOnNull = true, - keyDownFun = createInvCellGenericKeyDownFun(), + keyDownFun = { _, _, _, _, _ -> }, touchDownFun = createInvCellGenericTouchDownFun(inventoryListRebuildFun), // to "unselect" the equipped item and main item grid would "untick" accordingly wheelFun = { _, _, _, _, _, _ -> }, emptyCellIcon = equipPosIcon.get(cellToIcon[it], 1), diff --git a/src/net/torvald/terrarum/modulebasegame/ui/UIItemInventoryItemGrid.kt b/src/net/torvald/terrarum/modulebasegame/ui/UIItemInventoryItemGrid.kt index 2faa12223..579cb395e 100644 --- a/src/net/torvald/terrarum/modulebasegame/ui/UIItemInventoryItemGrid.kt +++ b/src/net/torvald/terrarum/modulebasegame/ui/UIItemInventoryItemGrid.kt @@ -114,7 +114,7 @@ open class UIItemInventoryItemGrid( fun getEstimatedW(horizontalCells: Int) = horizontalCells * UIItemInventoryElemSimple.height + (horizontalCells - 1) * listGap fun getEstimatedH(verticalCells: Int) = verticalCells * UIItemInventoryElemSimple.height + (verticalCells - 1) * listGap - fun createInvCellGenericKeyDownFun(): (GameItem?, Long, Int, Any?, UIItemInventoryCellBase) -> Unit { + fun createInvCellGenericKeyDownFun(listRebuildFun: () -> Unit): (GameItem?, Long, Int, Any?, UIItemInventoryCellBase) -> Unit { return { item: GameItem?, amount: Long, keycode: Int, _, _ -> if (item != null && Terrarum.ingame != null && keycode in Input.Keys.NUM_0..Input.Keys.NUM_9) { val player = (Terrarum.ingame!! as TerrarumIngame).actorNowPlaying @@ -139,6 +139,8 @@ open class UIItemInventoryItemGrid( inventory.setQuickslotItem(it, null) } } + + listRebuildFun() } } }