mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-13 03:54:06 +09:00
player now equips the item picked up, if said item did not exist in their inventory
This commit is contained in:
@@ -169,8 +169,15 @@ open class DroppedItem : ActorWithBody {
|
|||||||
|
|
||||||
fun onItemPickup(actor: ActorWithBody) {
|
fun onItemPickup(actor: ActorWithBody) {
|
||||||
flagDespawn = true
|
flagDespawn = true
|
||||||
|
val actorHadTheSameItem = (actor as Pocketed).inventory.contains(itemID)
|
||||||
(actor as Pocketed).inventory.add(itemID, itemCount)
|
(actor as Pocketed).inventory.add(itemID, itemCount)
|
||||||
Terrarum.ingame!!.sendItemPickupNoticelet(itemID, itemCount)
|
Terrarum.ingame!!.sendItemPickupNoticelet(itemID, itemCount)
|
||||||
ItemCodex[itemID]!!.effectOnPickup(actor)
|
ItemCodex[itemID]!!.effectOnPickup(actor)
|
||||||
|
|
||||||
|
// if actor did not have the same item AND holding nothing, equip it
|
||||||
|
val qs = actor.actorValue.getAsInt(AVKey.__PLAYER_QUICKSLOTSEL)
|
||||||
|
if (!actorHadTheSameItem && qs != null && (actor as Pocketed).inventory.getQuickslotItem(qs) == null) {
|
||||||
|
(actor as Pocketed).inventory.setQuickslotItem(qs, itemID)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user