mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-13 03:54:06 +09:00
better fix of 4a0f740e03
This commit is contained in:
@@ -74,12 +74,13 @@ class ActorInventory() : FixtureInventory() {
|
|||||||
* e.g. re-assign after this operation */
|
* e.g. re-assign after this operation */
|
||||||
override fun remove(item: GameItem, count: Long): Long {
|
override fun remove(item: GameItem, count: Long): Long {
|
||||||
return super.remove(item, count) { existingItem ->
|
return super.remove(item, count) { existingItem ->
|
||||||
|
|
||||||
// unequip, if applicable
|
// unequip, if applicable
|
||||||
actor.unequipItem(existingItem.itm)
|
actor.unequipItem(existingItem.itm)
|
||||||
// also unequip on the quickslot
|
// unregister from the quickslot
|
||||||
actor.actorValue.getAsInt(AVKey.__PLAYER_QUICKSLOTSEL)?.let {
|
// if the item is removed and crafted again, the item reappears if you've not equipped the item,
|
||||||
if (quickSlot[it] != null && quickSlot[it] == existingItem.itm)
|
// 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)
|
setQuickslotItem(it, null)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user