diff --git a/code/game/objects/items/cards_ids.dm b/code/game/objects/items/cards_ids.dm
index 4a0849d9545..2beb8a4938f 100644
--- a/code/game/objects/items/cards_ids.dm
+++ b/code/game/objects/items/cards_ids.dm
@@ -134,15 +134,13 @@
return ..()
/obj/item/card/id/proc/insert_money(obj/item/I, mob/user, physical_currency)
+ if(!registered_account)
+ to_chat(user, "[src] doesn't have a linked account to deposit [I] into!")
+ return
var/cash_money = I.get_item_credit_value()
if(!cash_money)
to_chat(user, "[I] doesn't seem to be worth anything!")
return
-
- if(!registered_account)
- to_chat(user, "[src] doesn't have a linked account to deposit [I] into!")
- return
-
registered_account.adjust_money(cash_money)
SSblackbox.record_feedback("amount", "credits_inserted", cash_money)
log_econ("[cash_money] credits were inserted into [src] owned by [src.registered_name]")
@@ -155,17 +153,20 @@
qdel(I)
/obj/item/card/id/proc/mass_insert_money(list/money, mob/user)
+ if(!registered_account)
+ to_chat(user, "[src] doesn't have a linked account to deposit into!")
+ return FALSE
+
if (!money || !money.len)
return FALSE
var/total = 0
for (var/obj/item/physical_money in money)
- var/cash_money = physical_money.get_item_credit_value()
+ total += physical_money.get_item_credit_value()
+ CHECK_TICK
- total += cash_money
-
- registered_account.adjust_money(cash_money)
+ registered_account.adjust_money(total)
SSblackbox.record_feedback("amount", "credits_inserted", total)
log_econ("[total] credits were inserted into [src] owned by [src.registered_name]")
QDEL_LIST(money)
diff --git a/code/modules/mining/mint.dm b/code/modules/mining/mint.dm
index 2aba9a82dc5..847ac624f87 100644
--- a/code/modules/mining/mint.dm
+++ b/code/modules/mining/mint.dm
@@ -10,7 +10,7 @@
ui_x = 300
ui_y = 250
needs_item_input = TRUE
-
+ var/obj/item/storage/bag/money/bag_to_use
var/produced_coins = 0 // how many coins the machine has made in it's last cycle
var/processing = FALSE
var/chosen = /datum/material/iron //which material will be used to make coins
@@ -65,6 +65,7 @@
for(var/coin_to_make in 1 to 5)
create_coins()
produced_coins++
+ CHECK_TICK
else
var/found_new = FALSE
for(var/datum/material/inserted_material in materials.materials)
@@ -138,10 +139,10 @@
temp_list[chosen] = 400
if(T)
var/obj/item/O = new /obj/item/coin(src)
- var/obj/item/storage/bag/money/B = locate(/obj/item/storage/bag/money, T)
O.set_custom_materials(temp_list)
- if(!B)
- B = new /obj/item/storage/bag/money(src)
- unload_mineral(B)
- O.forceMove(B)
+ if(QDELETED(bag_to_use) || (bag_to_use.loc != T) || !SEND_SIGNAL(bag_to_use, COMSIG_TRY_STORAGE_INSERT, O, null, TRUE)) //important to send the signal so we don't overfill the bag.
+ bag_to_use = new(src) //make a new bag if we can't find or use the old one.
+ unload_mineral(bag_to_use) //just forcemove memes.
+ O.forceMove(bag_to_use) //don't bother sending the signal, the new bag is empty and all that.
+
SSblackbox.record_feedback("amount", "coins_minted", 1)