generalised things so that they would work outside of ingame.world; title screen wip

This commit is contained in:
minjaesong
2017-07-21 19:59:51 +09:00
parent 78b09b2790
commit c67c79ed85
68 changed files with 1141 additions and 328 deletions

View File

@@ -129,7 +129,7 @@ class UIItemInventoryElem(
override fun keyDown(keycode: Int): Boolean {
if (item != null && Terrarum.ingame != null && keycode in Input.Keys.NUM_1..Input.Keys.NUM_0) {
val inventory = Terrarum.ingame!!.player?.inventory
val inventory = Terrarum.ingame!!.player.inventory
val slot = if (keycode == Input.Keys.NUM_0) 9 else keycode - Input.Keys.NUM_1
val currentSlotItem = inventory?.getQuickBar(slot)
@@ -161,11 +161,11 @@ class UIItemInventoryElem(
val itemEquipSlot = item!!.equipPosition
val player = Terrarum.ingame!!.player
if (item != player?.inventory?.itemEquipped?.get(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!!)
}
}