From 212afae02783e4951acd1a9372d376e936cef307 Mon Sep 17 00:00:00 2001 From: minjaesong Date: Thu, 12 Sep 2024 21:11:53 +0900 Subject: [PATCH] better fix of 4a0f740e03bd92c33f7ba6118204e204f85413ae --- .../terrarum/modulebasegame/gameactors/ActorInventory.kt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/net/torvald/terrarum/modulebasegame/gameactors/ActorInventory.kt b/src/net/torvald/terrarum/modulebasegame/gameactors/ActorInventory.kt index 871d55b25..c7650dc43 100644 --- a/src/net/torvald/terrarum/modulebasegame/gameactors/ActorInventory.kt +++ b/src/net/torvald/terrarum/modulebasegame/gameactors/ActorInventory.kt @@ -74,12 +74,13 @@ class ActorInventory() : FixtureInventory() { * e.g. re-assign after this operation */ override fun remove(item: GameItem, count: Long): Long { return super.remove(item, count) { existingItem -> - // unequip, if applicable actor.unequipItem(existingItem.itm) - // also unequip on the quickslot - actor.actorValue.getAsInt(AVKey.__PLAYER_QUICKSLOTSEL)?.let { - if (quickSlot[it] != null && quickSlot[it] == existingItem.itm) + // unregister from the quickslot + // if the item is removed and crafted again, the item reappears if you've not equipped the item, + // but they don't if you did; unregistering disables the reappearing so that the behaviour would remain consistent + quickSlot.indexOfFirst { it == existingItem.itm }.let { + if (it >= 0) setQuickslotItem(it, null) } }