make quickslots work with dynamic items

This commit is contained in:
minjaesong
2020-02-13 15:08:59 +09:00
parent d29fed8da3
commit 9d51f419f5
10 changed files with 200 additions and 3 deletions

View File

@@ -202,6 +202,10 @@ class ActorInventory(@Transient val actor: Pocketed, var maxCapacity: Int, var c
add(newItem)
itemEquipped[newItem.equipPosition] = newItem.dynamicID //invSearchByDynamicID(newItem.dynamicID)!!.item // will test if some sketchy code is written. Test fail: kotlinNullpointerException
actor.actorValue.getAsInt(AVKey.__PLAYER_QUICKSLOTSEL)?.let {
setQuickBar(it, newItem.dynamicID)
}
// FIXME now damage meter (vital) is broken
}
else {

View File

@@ -84,7 +84,7 @@ object PlayerBuilderSigrid {
// item ids are defined in <module>/items/itemid.csv
inventory.add(8448) // copper pick
inventory.add(8448, 16) // copper pick
inventory.add(8449) // iron pick
inventory.add(8450) // steel pick
inventory.add(8466, 9995) // wire piece

View File

@@ -28,6 +28,14 @@ interface Pocketed {
}
inventory.itemEquipped[item.equipPosition] = null
// remove it from the quickslot
inventory.quickSlot.forEachIndexed { index, itemID ->
if (itemID == item.dynamicID) {
inventory.setQuickBar(index, null)
}
}
item.effectOnUnequip(AppLoader.UPDATE_RATE)
}