fix: fixture pickup mess with quickslots and needed empty hands

This commit is contained in:
minjaesong
2026-01-17 20:50:26 +09:00
parent a4df761359
commit 104481a7d5

View File

@@ -795,16 +795,27 @@ open class TerrarumIngame(batch: FlippingSpriteBatch) : IngameInstance(batch) {
val itemOnGrip = ItemCodex[(actor as Pocketed).inventory.itemEquipped.get(GameItem.EquipPosition.HAND_GRIP)] val itemOnGrip = ItemCodex[(actor as Pocketed).inventory.itemEquipped.get(GameItem.EquipPosition.HAND_GRIP)]
if (!worldSecondaryClickLatch) { if (!worldSecondaryClickLatch) {
// #1. Perform item's secondaryUse // #1. Try to pick up the fixture or dropped item first (if in range and there's something to pick up)
val consumptionSuccessful = itemOnGrip?.startSecondaryUse(actor, delta) ?: -1 val pickupSuccessful = mouseInInteractableRange(actor) { mwx, mwy, mtx, mty ->
if (consumptionSuccessful > -1) val actorsUnderMouse = getActorsUnderMouse(mwx, mwy)
(actor as Pocketed).inventory.consumeItem(itemOnGrip!!, consumptionSuccessful) val hasPickupableActor = actorsUnderMouse.any {
// #2. If #1 failed, try to pick up the fixture (it is FixtureBase && it.canBeDespawned && System.nanoTime() - it.spawnRequestedTime > 50000000) || // give freshly spawned fixtures 0.05 seconds of immunity
else { (it is DroppedItem && it.noAutoPickup)
mouseInInteractableRange(actor) { mwx, mwy, mtx, mty -> }
pickupFixtureOrDroppedItem(actor, delta, mwx, mwy, mtx, mty) if (hasPickupableActor) {
pickupFixtureOrDroppedItem(actor, delta, mwx, mwy, mtx, mty, assignToQuickslot = (itemOnGrip == null))
0L 0L
} }
else {
-1L
}
}
// #2. If pickup didn't happen, try to perform item's secondaryUse
if (pickupSuccessful < 0) {
val consumptionSuccessful = itemOnGrip?.startSecondaryUse(actor, delta) ?: -1
if (consumptionSuccessful > -1)
(actor as Pocketed).inventory.consumeItem(itemOnGrip!!, consumptionSuccessful)
} }
worldSecondaryClickLatch = true worldSecondaryClickLatch = true