fixture pickup and mining works except for the dropping of a mined fixture

This commit is contained in:
minjaesong
2022-01-21 14:01:37 +09:00
parent 48e68137d6
commit 75afcaede3
13 changed files with 107 additions and 50 deletions

View File

@@ -106,10 +106,10 @@ class UIItemInventoryItemGrid(
if (player != null) {
val inventory = player.inventory
val slot = if (keycode == Input.Keys.NUM_0) 9 else keycode - Input.Keys.NUM_1
val currentSlotItem = inventory.getQuickslot(slot)
val currentSlotItem = inventory.getQuickslotItem(slot)
inventory.setQuickBar(
inventory.setQuickslotItem(
slot,
if (currentSlotItem?.itm != item.dynamicID)
item.dynamicID // register
@@ -120,8 +120,8 @@ class UIItemInventoryItemGrid(
// search for duplicates in the quickbar, except mine
// if there is, unregister the other
(0..9).minus(slot).forEach {
if (inventory.getQuickslot(it)?.itm == item.dynamicID) {
inventory.setQuickBar(it, null)
if (inventory.getQuickslotItem(it)?.itm == item.dynamicID) {
inventory.setQuickslotItem(it, null)
}
}
}
@@ -145,7 +145,7 @@ class UIItemInventoryItemGrid(
// also equip on the quickslot
player.actorValue.getAsInt(AVKey.__PLAYER_QUICKSLOTSEL)?.let {
player.inventory.setQuickBar(it, item.dynamicID)
player.inventory.setQuickslotItem(it, item.dynamicID)
}
}
else { // if not, unequip it
@@ -153,7 +153,7 @@ class UIItemInventoryItemGrid(
// also unequip on the quickslot
player.actorValue.getAsInt(AVKey.__PLAYER_QUICKSLOTSEL)?.let {
player.inventory.setQuickBar(it, null)
player.inventory.setQuickslotItem(it, null)
}
}
}
@@ -415,7 +415,7 @@ class UIItemInventoryItemGrid(
val ainv = getInventory() as ActorInventory
for (qs in 1..UIQuickslotBar.SLOT_COUNT) {
if (sortListItem.itm == ainv.getQuickslot(qs - 1)?.itm) {
if (sortListItem.itm == ainv.getQuickslotItem(qs - 1)?.itm) {
items[k].quickslot = qs % 10 // 10 -> 0, 1..9 -> 1..9
break
}

View File

@@ -82,7 +82,7 @@ class UIQuickslotBar : UICanvas() {
(Terrarum.ingame!! as TerrarumIngame).actorNowPlaying?.let { actor ->
for (i in 0..SLOT_COUNT - 1) {
val item = ItemCodex[actor.inventory.getQuickslot(i)?.itm]
val item = ItemCodex[actor.inventory.getQuickslotItem(i)?.itm]
val image = if (i == selection)
ItemSlotImageFactory.produceLarge(false, (i + 1) % SLOT_COUNT, item)
@@ -101,7 +101,7 @@ class UIQuickslotBar : UICanvas() {
if (nameShowupAlpha > 0f) {
val selection = actor.actorValue.getAsInt(AVKey.__PLAYER_QUICKSLOTSEL) ?: return
actor.inventory.getQuickslot(selection)?.let {
actor.inventory.getQuickslotItem(selection)?.let {
val item = ItemCodex[it.itm]
val quantity = it.qty
val text = "${item?.name}" + (if (item?.isUnique == true) "" else " ($quantity)")

View File

@@ -65,7 +65,7 @@ class UIQuickslotPie : UICanvas() {
override fun renderUI(batch: SpriteBatch, camera: Camera) {
// draw radial thingies
for (i in 0..slotCount - 1) {
val item = ItemCodex[(Terrarum.ingame!! as TerrarumIngame).actorNowPlaying?.inventory?.getQuickslot(i)?.itm]
val item = ItemCodex[(Terrarum.ingame!! as TerrarumIngame).actorNowPlaying?.inventory?.getQuickslotItem(i)?.itm]
// set position
val angle = Math.PI * 2.0 * (i.toDouble() / slotCount) + Math.PI // 180 deg monitor-wise