mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
Fixes Cash Machines not connecting to account on spawn and having omnidirectional interaction area
This commit is contained in:
@@ -21,12 +21,14 @@
|
|||||||
var/cash_stored = 0
|
var/cash_stored = 0
|
||||||
var/obj/item/confirm_item
|
var/obj/item/confirm_item
|
||||||
var/datum/money_account/linked_account
|
var/datum/money_account/linked_account
|
||||||
|
var/account_to_connect = null
|
||||||
|
|
||||||
|
|
||||||
// Claim machine ID
|
// Claim machine ID
|
||||||
/obj/machinery/cash_register/New()
|
/obj/machinery/cash_register/New()
|
||||||
machine_id = "[station_name()] RETAIL #[num_financial_terminals++]"
|
machine_id = "[station_name()] RETAIL #[num_financial_terminals++]"
|
||||||
cash_stored = rand(10, 70)*10
|
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)
|
/obj/machinery/cash_register/examine(mob/user as mob)
|
||||||
@@ -39,6 +41,9 @@
|
|||||||
|
|
||||||
|
|
||||||
/obj/machinery/cash_register/attack_hand(mob/user as mob)
|
/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_open)
|
||||||
if(cash_stored)
|
if(cash_stored)
|
||||||
spawn_money(cash_stored, loc, user)
|
spawn_money(cash_stored, loc, user)
|
||||||
@@ -278,8 +283,6 @@
|
|||||||
usr << "\icon[src]<span class='warning'>The cash box is open.</span>"
|
usr << "\icon[src]<span class='warning'>The cash box is open.</span>"
|
||||||
return
|
return
|
||||||
|
|
||||||
// Access account for transaction
|
|
||||||
if(check_account())
|
|
||||||
if(transaction_amount > SC.worth)
|
if(transaction_amount > SC.worth)
|
||||||
src.visible_message("\icon[src]<span class='warning'>Not enough money.</span>")
|
src.visible_message("\icon[src]<span class='warning'>Not enough money.</span>")
|
||||||
else
|
else
|
||||||
@@ -436,39 +439,33 @@
|
|||||||
cash_locked = 0
|
cash_locked = 0
|
||||||
open_cash_box()
|
open_cash_box()
|
||||||
|
|
||||||
|
|
||||||
//--Premades--//
|
//--Premades--//
|
||||||
|
|
||||||
/obj/machinery/cash_register/command
|
/obj/machinery/cash_register/command
|
||||||
New()
|
account_to_connect = "Command"
|
||||||
linked_account = department_accounts["Command"]
|
|
||||||
..()
|
..()
|
||||||
/obj/machinery/cash_register/medical
|
|
||||||
|
|
||||||
New()
|
/obj/machinery/cash_register/medical
|
||||||
linked_account = department_accounts["Medical"]
|
account_to_connect = "Medical"
|
||||||
..()
|
..()
|
||||||
|
|
||||||
/obj/machinery/cash_register/engineering
|
/obj/machinery/cash_register/engineering
|
||||||
New()
|
account_to_connect = "Engineering"
|
||||||
linked_account = department_accounts["Engineering"]
|
|
||||||
..()
|
..()
|
||||||
|
|
||||||
/obj/machinery/cash_register/science
|
/obj/machinery/cash_register/science
|
||||||
New()
|
account_to_connect = "Science"
|
||||||
linked_account = department_accounts["Science"]
|
|
||||||
..()
|
..()
|
||||||
|
|
||||||
/obj/machinery/cash_register/security
|
/obj/machinery/cash_register/security
|
||||||
New()
|
account_to_connect = "Security"
|
||||||
linked_account = department_accounts["Security"]
|
|
||||||
..()
|
..()
|
||||||
|
|
||||||
/obj/machinery/cash_register/cargo
|
/obj/machinery/cash_register/cargo
|
||||||
New()
|
account_to_connect = "Cargo"
|
||||||
linked_account = department_accounts["Cargo"]
|
|
||||||
..()
|
..()
|
||||||
|
|
||||||
/obj/machinery/cash_register/civilian
|
/obj/machinery/cash_register/civilian
|
||||||
New()
|
account_to_connect = "Civilian"
|
||||||
linked_account = department_accounts["Civilian"]
|
|
||||||
..()
|
..()
|
||||||
@@ -81,6 +81,7 @@ var/global/list/datum/money_account/department_accounts = list()
|
|||||||
var/global/num_financial_terminals = 1
|
var/global/num_financial_terminals = 1
|
||||||
var/global/next_account_number = 0
|
var/global/next_account_number = 0
|
||||||
var/global/list/all_money_accounts = list()
|
var/global/list/all_money_accounts = list()
|
||||||
|
var/global/list/transaction_devices = list()
|
||||||
var/global/economy_init = 0
|
var/global/economy_init = 0
|
||||||
|
|
||||||
/proc/setup_economy()
|
/proc/setup_economy()
|
||||||
@@ -102,6 +103,13 @@ var/global/economy_init = 0
|
|||||||
create_department_account("Vendor")
|
create_department_account("Vendor")
|
||||||
vendor_account = department_accounts["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]"
|
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
|
economy_init = 1
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
var/obj/item/confirm_item
|
var/obj/item/confirm_item
|
||||||
var/datum/money_account/linked_account
|
var/datum/money_account/linked_account
|
||||||
|
var/account_to_connect = null
|
||||||
|
|
||||||
|
|
||||||
// Claim machine ID
|
// Claim machine ID
|
||||||
@@ -24,6 +25,7 @@
|
|||||||
machine_id = "[station_name()] RETAIL #[num_financial_terminals++]"
|
machine_id = "[station_name()] RETAIL #[num_financial_terminals++]"
|
||||||
if(locate(/obj/structure/table) in loc)
|
if(locate(/obj/structure/table) in loc)
|
||||||
pixel_y = 3
|
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
|
// Always face the user when put on a table
|
||||||
@@ -315,36 +317,29 @@
|
|||||||
//--Premades--//
|
//--Premades--//
|
||||||
|
|
||||||
/obj/item/device/retail_scanner/command
|
/obj/item/device/retail_scanner/command
|
||||||
New()
|
account_to_connect = "Command"
|
||||||
linked_account = department_accounts["Command"]
|
|
||||||
..()
|
..()
|
||||||
/obj/item/device/retail_scanner/medical
|
|
||||||
|
|
||||||
New()
|
/obj/item/device/retail_scanner/medical
|
||||||
linked_account = department_accounts["Medical"]
|
account_to_connect = "Medical"
|
||||||
..()
|
..()
|
||||||
|
|
||||||
/obj/item/device/retail_scanner/engineering
|
/obj/item/device/retail_scanner/engineering
|
||||||
New()
|
account_to_connect = "Engineering"
|
||||||
linked_account = department_accounts["Engineering"]
|
|
||||||
..()
|
..()
|
||||||
|
|
||||||
/obj/item/device/retail_scanner/science
|
/obj/item/device/retail_scanner/science
|
||||||
New()
|
account_to_connect = "Science"
|
||||||
linked_account = department_accounts["Science"]
|
|
||||||
..()
|
..()
|
||||||
|
|
||||||
/obj/item/device/retail_scanner/security
|
/obj/item/device/retail_scanner/security
|
||||||
New()
|
account_to_connect = "Security"
|
||||||
linked_account = department_accounts["Security"]
|
|
||||||
..()
|
..()
|
||||||
|
|
||||||
/obj/item/device/retail_scanner/cargo
|
/obj/item/device/retail_scanner/cargo
|
||||||
New()
|
account_to_connect = "Cargo"
|
||||||
linked_account = department_accounts["Cargo"]
|
|
||||||
..()
|
..()
|
||||||
|
|
||||||
/obj/item/device/retail_scanner/civilian
|
/obj/item/device/retail_scanner/civilian
|
||||||
New()
|
account_to_connect = "Civilian"
|
||||||
linked_account = department_accounts["Civilian"]
|
|
||||||
..()
|
..()
|
||||||
Reference in New Issue
Block a user