Skip to content

Commit c7ce337

Browse files
authored
[s] Fixes ANOTHER monkecoin dupe (#6418)
1 parent d3f2a97 commit c7ce337

File tree

1 file changed

+9
-2
lines changed
  • monkestation/code/modules/store/atm

1 file changed

+9
-2
lines changed

monkestation/code/modules/store/atm/_atm.dm

+9-2
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,17 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/atm, 30)
198198
*/
199199
if(istype(attacking_item, /obj/item/stack/monkecoin))
200200
var/obj/item/stack/monkecoin/attacked_coins = attacking_item
201-
if(!user.client.prefs.adjust_metacoins(user.client.ckey, attacked_coins.amount, "Deposited coins to an ATM", donator_multiplier = FALSE))
202-
say("Error accepting coins, please try again later.")
201+
var/coin_amount = attacked_coins.amount
202+
if(QDELETED(attacked_coins) || !user.temporarilyRemoveItemFromInventory(attacked_coins, force = TRUE))
203203
return
204+
if(attacked_coins.amount != coin_amount)
205+
stack_trace("Monkecoin stack amount somehow changed while removing from inventory (from [coin_amount] to [attacked_coins.amount])")
204206
qdel(attacked_coins)
207+
var/ckey = user.client?.ckey
208+
if(!user.client?.prefs?.adjust_metacoins(ckey, coin_amount, "Deposited coins to an ATM", donator_multiplier = FALSE))
209+
say("Error accepting coins, please try again later.")
210+
user.put_in_hands(new /obj/item/stack/monkecoin(drop_location(), coin_amount, FALSE), merge_stacks = FALSE)
211+
return
205212
say("Coins deposited to your account, have a nice day.")
206213

207214
else if(istype(attacking_item, /obj/item/stack/spacecash))

0 commit comments

Comments
 (0)