Converts Economy to a Subsystem (#5253)

Converts Economy to a Subsystem and cleans it up a bit
This commit is contained in:
Werner
2018-11-03 14:34:22 +01:00
committed by Erki
parent 866da21d57
commit a42e6a118b
19 changed files with 361 additions and 327 deletions

View File

@@ -86,7 +86,7 @@
var/transaction_amount = order_details["price_customer"];
var/transaction_purpose = "Cargo Order #[order_details["order_id"]]";
var/datum/money_account/D = get_account(id_card.associated_account_number)
var/datum/money_account/D = SSeconomy.get_account(id_card.associated_account_number)
if(!D)
status_message = "Unable to access account. Check security settings and try again."
return 1
@@ -94,7 +94,7 @@
if(D.security_level)
attempt_pin = input("Enter pin code", "EFTPOS transaction") as num
D = null
D = attempt_account_access(id_card.associated_account_number, attempt_pin, 2)
D = SSeconomy.attempt_account_access(id_card.associated_account_number, attempt_pin, 2)
if(D)
if(!D.suspended)
if(transaction_amount <= D.money)
@@ -113,18 +113,18 @@
else
T.amount = "[transaction_amount]"
T.source_terminal = "Modular Computer #[program.computer.network_card.identification_id]"
T.date = current_date_string
T.date = worlddate2text()
T.time = worldtime2text()
D.transaction_log.Add(T)
SSeconomy.add_transaction_log(D,T)
//
T = new()
T.target_name = D.owner_name
T.purpose = transaction_purpose
T.amount = "[transaction_amount]"
T.source_terminal = "Modular Computer #[program.computer.network_card.identification_id]"
T.date = current_date_string
T.date = worlddate2text()
T.time = worldtime2text()
SScargo.supply_account.transaction_log.Add(T)
SSeconomy.add_transaction_log(SScargo.supply_account,T)
//Check if we have delivered it aswell or only paid
if(order_details["status"] == "shipped")

View File

@@ -297,14 +297,14 @@ obj/machinery/lapvend/attackby(obj/item/weapon/W as obj, mob/user as mob)
else
visible_message("<span class='info'>\The [usr] swipes \the [ID_container] through \the [src].</span>")
if(I)
var/datum/money_account/customer_account = get_account(I.associated_account_number)
var/datum/money_account/customer_account = SSeconomy.get_account(I.associated_account_number)
if (!customer_account || customer_account.suspended)
ping("Connection error. Unable to connect to account.")
return 0
if(customer_account.security_level != 0) //If card requires pin authentication (ie seclevel 1 or 2)
var/attempt_pin = input("Enter pin code", "Vendor transaction") as num
customer_account = attempt_account_access(I.associated_account_number, attempt_pin, 2)
customer_account = SSeconomy.attempt_account_access(I.associated_account_number, attempt_pin, 2)
if(!customer_account)
ping("Unable to access account: incorrect credentials.")
@@ -320,9 +320,9 @@ obj/machinery/lapvend/attackby(obj/item/weapon/W as obj, mob/user as mob)
T.purpose = "Purchase of [(devtype == 1) ? "laptop computer" : "tablet microcomputer"]."
T.amount = total_price
T.source_terminal = src.name
T.date = current_date_string
T.date = worlddate2text()
T.time = worldtime2text()
customer_account.transaction_log.Add(T)
SSeconomy.add_transaction_log(customer_account,T)
return 1
else if(S)
if(total_price > S.worth)