From bbbb50dfe03fea8efe6d61bb5ff185ecf57d19b0 Mon Sep 17 00:00:00 2001 From: DragonTrance Date: Wed, 8 Jun 2022 17:54:15 -0400 Subject: [PATCH] limits ID cards to one account --- code/controllers/subsystem/job.dm | 10 ++++----- code/game/machinery/computer/card.dm | 2 +- code/game/objects/items/cards_ids.dm | 7 +++++-- code/modules/jobs/job_types/job.dm | 13 +++--------- .../mob/living/carbon/human/human_defines.dm | 1 - hyperstation/code/modules/economy/account.dm | 21 ++++++++++++------- hyperstation/code/obj/economy.dm | 3 --- 7 files changed, 28 insertions(+), 29 deletions(-) diff --git a/code/controllers/subsystem/job.dm b/code/controllers/subsystem/job.dm index 03c4b69da..3f9efb275 100644 --- a/code/controllers/subsystem/job.dm +++ b/code/controllers/subsystem/job.dm @@ -331,7 +331,7 @@ SUBSYSTEM_DEF(job) if((job.title in GLOB.silly_positions) && (player.client.prefs.sillyroles == FALSE)) JobDebug("DO is not whitelisted, Player: [player], Job:[job.title]") - continue + continue if(!job.player_old_enough(player.client)) JobDebug("DO player not old enough, Player: [player], Job:[job.title]") @@ -473,10 +473,10 @@ SUBSYSTEM_DEF(job) //Account ID. ID is handled by human initialization if(ishuman(H)) var/mob/living/carbon/human/wageslave = H - to_chat(M, "Your account ID is [wageslave.account_id]") - to_chat(M, "You do not have a pin, can set your pin at an ATM.") - if(H.mind) - H.mind.memory += "Your account ID is [wageslave.account_id].
" + if(wageslave.wear_id) + var/obj/item/card/id/id_card = wageslave.wear_id + to_chat(M, "Your account ID is [id_card.registered_account.account_id]") + to_chat(M, "You do not have a pin, can set your pin at an ATM.") return H diff --git a/code/game/machinery/computer/card.dm b/code/game/machinery/computer/card.dm index 99b7c577c..b005761b1 100644 --- a/code/game/machinery/computer/card.dm +++ b/code/game/machinery/computer/card.dm @@ -255,7 +255,7 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0) else if(mode == 4) dat += {"Return "} - for(var/datum/bank_account/account in SSeconomy.bank_accounts) + for(var/datum/bank_account/account as anything in SSeconomy.bank_accounts) dat += {"" dat += "" diff --git a/code/game/objects/items/cards_ids.dm b/code/game/objects/items/cards_ids.dm index 8a9f62229..dd30eb26e 100644 --- a/code/game/objects/items/cards_ids.dm +++ b/code/game/objects/items/cards_ids.dm @@ -171,10 +171,10 @@ var/registered_name = null // The name registered_name on the card var/assignment = null var/access_txt // mapping aid - var/datum/bank_account/registered_account var/uses_overlays = TRUE var/uses_assignment = TRUE var/icon/cached_flat_icon + var/datum/bank_account/registered_account /obj/item/card/id/Initialize(mapload) . = ..() @@ -200,6 +200,9 @@ if(mining_points) . += "There's [mining_points] mining equipment redemption point\s loaded onto this card." +/obj/item/card/id/proc/create_bank_account(owner, job_assignment) + registered_account = new/datum/bank_account(owner, job_assignment, src) + /obj/item/card/id/GetAccess() return access @@ -643,7 +646,7 @@ icon_state = "retrosci" uses_overlays = FALSE uses_assignment = FALSE - + /obj/item/card/id/away/snowdin/med name = "Arctic Station Doctor's ID card" desc = "A faded Arctic Station ID card. You can make out the rank \"Doctor\"." diff --git a/code/modules/jobs/job_types/job.dm b/code/modules/jobs/job_types/job.dm index eadf53fdc..13a9f7338 100644 --- a/code/modules/jobs/job_types/job.dm +++ b/code/modules/jobs/job_types/job.dm @@ -119,7 +119,7 @@ /// Generates a bank account for the person who's getting this job datum /datum/job/proc/generate_bank_account(mob/living/carbon/human/reciever) - return new/datum/bank_account(reciever, src) + return /datum/job/proc/get_access() if(!config) //Needed for robots. @@ -246,15 +246,8 @@ else C.update_label() - for(var/datum/bank_account/account as anything in SSeconomy.bank_accounts) - if(account.account_id == H.account_id) - C.registered_account = account - account.bank_cards += C - //Todo: remove bank_cards, have accounts for everyone who knows the pin to an ID. monkey go ook ook (he's rich) - //one card should have one account, sorta like how real cards work - //ping cyanosis if bank_cards is still here - account.associated_id = C //Also make this better to work with - break + C.create_bank_account(H, J) + H.sec_hud_set_ID() var/obj/item/pda/PDA = H.get_item_by_slot(pda_slot) diff --git a/code/modules/mob/living/carbon/human/human_defines.dm b/code/modules/mob/living/carbon/human/human_defines.dm index 486e6583c..7225f0c28 100644 --- a/code/modules/mob/living/carbon/human/human_defines.dm +++ b/code/modules/mob/living/carbon/human/human_defines.dm @@ -79,6 +79,5 @@ var/static/list/can_ride_typecache = typecacheof(list(/mob/living/carbon/human, /mob/living/simple_animal/slime, /mob/living/simple_animal/parrot)) var/lastpuke = 0 var/last_fire_update - var/account_id can_be_held = "micro" appearance_flags = KEEP_TOGETHER|TILE_BOUND|PIXEL_SCALE|LONG_GLIDE \ No newline at end of file diff --git a/hyperstation/code/modules/economy/account.dm b/hyperstation/code/modules/economy/account.dm index 2caab9c8f..a244ed0eb 100644 --- a/hyperstation/code/modules/economy/account.dm +++ b/hyperstation/code/modules/economy/account.dm @@ -1,17 +1,24 @@ /datum/bank_account + /// The name of whoever owns this account var/account_holder = "Some pleboid" + /// The balance, in credits! var/balance = 0 - var/account_pin = 0 - var/datum/job/account_job - var/obj/item/card/id/associated_id - var/list/bank_cards = list() - var/account_id = 1 + /// Fluff for the ID of this card. Purely cosmetic, but unique for every account + var/account_id = 0 + /// The pin number that the owner wanted. Not set by default, so anyone can just steal your ID if you don't remember to set it + var/account_pin + /// The base amount of pay you get per paycheck var/base_pay = 60 + /// The linked job datum for this bank account, for calculating unique base payment for each job + var/datum/job/account_job + /// The associated ID, for letting the card-holder know when a paycheck is processed + var/obj/item/card/id/associated_id -/datum/bank_account/New(mob/living/carbon/human/new_holder, datum/job/job) +/datum/bank_account/New(mob/living/carbon/human/new_holder, datum/job/job, obj/item/card/id/id_card) account_holder = new_holder.real_name account_job = job - new_holder.account_id = account_id = rand(111111,999999) + associated_id = id_card + account_id = rand(111111,999999) if(!SSeconomy || !SSeconomy.initialized) stack_trace("A new bank account was made without the economy subsystem being initialized first. If this is an issue, change the subsystem's init_order.") diff --git a/hyperstation/code/obj/economy.dm b/hyperstation/code/obj/economy.dm index 2e438ef73..6ee1ece2e 100644 --- a/hyperstation/code/obj/economy.dm +++ b/hyperstation/code/obj/economy.dm @@ -15,9 +15,6 @@ resistance_flags = FIRE_PROOF var/obj/item/card/held_card var/user = "" - light_power = 0 - light_range = 7 - light_color = "#ff3232" var/pin = 0 /obj/machinery/atm/ui_interact(mob/user)
Bank Accounts
[account.account_holder] - [account.account_id]"} dat += "Assign to ID