mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 12:21:52 +09:00
setting up the inventory using builder (during init) requires ingame.player to be nullable, lateinit won't work
This commit is contained in:
@@ -138,11 +138,11 @@ class UIItemInventoryElem(
|
||||
val itemEquipSlot = item!!.equipPosition
|
||||
val player = Terrarum.ingame!!.player
|
||||
|
||||
if (item != player.inventory.itemEquipped[itemEquipSlot]) { // if this item is unequipped, equip it
|
||||
player.equipItem(item!!)
|
||||
if (item != player?.inventory?.itemEquipped?.get(itemEquipSlot)) { // if this item is unequipped, equip it
|
||||
player?.equipItem(item!!)
|
||||
}
|
||||
else { // if not, unequip it
|
||||
player.unequipItem(item!!)
|
||||
player?.unequipItem(item!!)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user