mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-19 15:04:05 +09:00
quickslot works, new event for actor "actorValueChanged"
- "unpacking" fresh new tool would un-register quickslot desig. - priority issue on "equipped by quickslot change" and "equipped by inventory UI"
This commit is contained in:
@@ -14,7 +14,9 @@ interface Pocketed {
|
||||
/**
|
||||
* Equips an item. If the item is not in the inventory, an error will be thrown.
|
||||
*/
|
||||
fun unequipItem(item: InventoryItem) {
|
||||
fun unequipItem(item: InventoryItem?) {
|
||||
if (item == null) return
|
||||
|
||||
if (item.equipPosition == InventoryItem.EquipPosition.NULL)
|
||||
throw Error("Unequipping the item that cannot be equipped in the first place")
|
||||
|
||||
@@ -28,6 +30,14 @@ interface Pocketed {
|
||||
item.effectOnUnequip(Terrarum.appgc, Terrarum.delta)
|
||||
}
|
||||
|
||||
// no need for equipSlot(Int)
|
||||
fun unequipSlot(slot: Int) {
|
||||
if (slot < 0 || slot > InventoryItem.EquipPosition.INDEX_MAX)
|
||||
throw IllegalArgumentException("Slot index out of range: $slot")
|
||||
|
||||
unequipItem(inventory.itemEquipped[slot])
|
||||
}
|
||||
|
||||
/**
|
||||
* Equips an item. If the item is not in the inventory, adds the item first.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user