diff --git a/code/modules/economy/cash_register.dm b/code/modules/economy/cash_register.dm
index d2f0f9dbdf..c07fcca660 100644
--- a/code/modules/economy/cash_register.dm
+++ b/code/modules/economy/cash_register.dm
@@ -21,12 +21,14 @@
var/cash_stored = 0
var/obj/item/confirm_item
var/datum/money_account/linked_account
+ var/account_to_connect = null
// Claim machine ID
/obj/machinery/cash_register/New()
machine_id = "[station_name()] RETAIL #[num_financial_terminals++]"
cash_stored = rand(10, 70)*10
+ transaction_devices += src // Global reference list to be properly set up by /proc/setup_economy()
/obj/machinery/cash_register/examine(mob/user as mob)
@@ -39,6 +41,9 @@
/obj/machinery/cash_register/attack_hand(mob/user as mob)
+ // Don't be accessible from the wrong side of the machine
+ if(get_dir(src, user) & reverse_dir[src.dir]) return
+
if(cash_open)
if(cash_stored)
spawn_money(cash_stored, loc, user)
@@ -278,26 +283,24 @@
usr << "\icon[src]The cash box is open."
return
- // Access account for transaction
- if(check_account())
- if(transaction_amount > SC.worth)
- src.visible_message("\icon[src]Not enough money.")
- else
- // Insert cash into magical slot
- SC.worth -= transaction_amount
- SC.update_icon()
- if(!SC.worth)
- if(ishuman(SC.loc))
- var/mob/living/carbon/human/H = SC.loc
- H.drop_from_inventory(SC)
- qdel(SC)
- cash_stored += transaction_amount
+ if(transaction_amount > SC.worth)
+ src.visible_message("\icon[src]Not enough money.")
+ else
+ // Insert cash into magical slot
+ SC.worth -= transaction_amount
+ SC.update_icon()
+ if(!SC.worth)
+ if(ishuman(SC.loc))
+ var/mob/living/carbon/human/H = SC.loc
+ H.drop_from_inventory(SC)
+ qdel(SC)
+ cash_stored += transaction_amount
- // Save log
- add_transaction_log("n/A", "Cash", transaction_amount)
+ // Save log
+ add_transaction_log("n/A", "Cash", transaction_amount)
- // Confirm and reset
- transaction_complete()
+ // Confirm and reset
+ transaction_complete()
/obj/machinery/cash_register/proc/scan_item_price(obj/O)
@@ -436,39 +439,33 @@
cash_locked = 0
open_cash_box()
+
//--Premades--//
/obj/machinery/cash_register/command
- New()
- linked_account = department_accounts["Command"]
- ..()
- /obj/machinery/cash_register/medical
+ account_to_connect = "Command"
+ ..()
- New()
- linked_account = department_accounts["Medical"]
- ..()
+/obj/machinery/cash_register/medical
+ account_to_connect = "Medical"
+ ..()
/obj/machinery/cash_register/engineering
- New()
- linked_account = department_accounts["Engineering"]
- ..()
+ account_to_connect = "Engineering"
+ ..()
/obj/machinery/cash_register/science
- New()
- linked_account = department_accounts["Science"]
- ..()
+ account_to_connect = "Science"
+ ..()
/obj/machinery/cash_register/security
- New()
- linked_account = department_accounts["Security"]
- ..()
+ account_to_connect = "Security"
+ ..()
/obj/machinery/cash_register/cargo
- New()
- linked_account = department_accounts["Cargo"]
- ..()
+ account_to_connect = "Cargo"
+ ..()
/obj/machinery/cash_register/civilian
- New()
- linked_account = department_accounts["Civilian"]
- ..()
\ No newline at end of file
+ account_to_connect = "Civilian"
+ ..()
\ No newline at end of file
diff --git a/code/modules/economy/economy_misc.dm b/code/modules/economy/economy_misc.dm
index 7b82c1662c..0d7f8439d5 100644
--- a/code/modules/economy/economy_misc.dm
+++ b/code/modules/economy/economy_misc.dm
@@ -81,6 +81,7 @@ var/global/list/datum/money_account/department_accounts = list()
var/global/num_financial_terminals = 1
var/global/next_account_number = 0
var/global/list/all_money_accounts = list()
+var/global/list/transaction_devices = list()
var/global/economy_init = 0
/proc/setup_economy()
@@ -102,6 +103,13 @@ var/global/economy_init = 0
create_department_account("Vendor")
vendor_account = department_accounts["Vendor"]
+ for(var/obj/machinery/cash_register/RS in transaction_devices)
+ if(RS.account_to_connect)
+ RS.linked_account = department_accounts[RS.account_to_connect]
+ for(var/obj/machinery/cash_register/CR in transaction_devices)
+ if(CR.account_to_connect)
+ CR.linked_account = department_accounts[CR.linked_account]
+
current_date_string = "[num2text(rand(1,31))] [pick("January","February","March","April","May","June","July","August","September","October","November","December")], [game_year]"
economy_init = 1
diff --git a/code/modules/economy/retail_scanner.dm b/code/modules/economy/retail_scanner.dm
index 84503099c0..0bfd326f81 100644
--- a/code/modules/economy/retail_scanner.dm
+++ b/code/modules/economy/retail_scanner.dm
@@ -17,6 +17,7 @@
var/obj/item/confirm_item
var/datum/money_account/linked_account
+ var/account_to_connect = null
// Claim machine ID
@@ -24,6 +25,7 @@
machine_id = "[station_name()] RETAIL #[num_financial_terminals++]"
if(locate(/obj/structure/table) in loc)
pixel_y = 3
+ transaction_devices += src // Global reference list to be properly set up by /proc/setup_economy()
// Always face the user when put on a table
@@ -315,36 +317,29 @@
//--Premades--//
/obj/item/device/retail_scanner/command
- New()
- linked_account = department_accounts["Command"]
- ..()
- /obj/item/device/retail_scanner/medical
+ account_to_connect = "Command"
+ ..()
- New()
- linked_account = department_accounts["Medical"]
- ..()
+/obj/item/device/retail_scanner/medical
+ account_to_connect = "Medical"
+ ..()
/obj/item/device/retail_scanner/engineering
- New()
- linked_account = department_accounts["Engineering"]
- ..()
+ account_to_connect = "Engineering"
+ ..()
/obj/item/device/retail_scanner/science
- New()
- linked_account = department_accounts["Science"]
- ..()
+ account_to_connect = "Science"
+ ..()
/obj/item/device/retail_scanner/security
- New()
- linked_account = department_accounts["Security"]
- ..()
+ account_to_connect = "Security"
+ ..()
/obj/item/device/retail_scanner/cargo
- New()
- linked_account = department_accounts["Cargo"]
- ..()
+ account_to_connect = "Cargo"
+ ..()
/obj/item/device/retail_scanner/civilian
- New()
- linked_account = department_accounts["Civilian"]
- ..()
\ No newline at end of file
+ account_to_connect = "Civilian"
+ ..()
\ No newline at end of file