From ade641b896b8e044ded70c9e2444f6d13817501d Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Thu, 13 Aug 2020 05:23:33 +0200 Subject: [PATCH] Adds the Account Registration Machine. (#52745) (#326) This adds the Account Registration Machine to the game, it's obtained at the computerized recordkeeping tech (Rather far in to the tech tree) and only obtained from the security lathe to prevent access from being too widespread, because I don't trust players have access to this until at LEAST half the shift has gone by. What this enables you to do is to create new accounts for blank IDs. The accounts won't have a parent payment account until actually assigned a job by a card console, but for all intents and purposes they'll act and interact like a standard, station bank account. Co-authored-by: ArcaneMusic <41715314+ArcaneMusic@users.noreply.github.com> --- code/game/machinery/accounting.dm | 71 +++++++++++++++++++ .../circuitboards/machine_circuitboards.dm | 9 +++ code/modules/economy/account.dm | 2 + .../research/designs/machine_designs.dm | 8 +++ code/modules/research/techweb/all_nodes.dm | 2 +- tgstation.dme | 3 +- 6 files changed, 93 insertions(+), 2 deletions(-) create mode 100644 code/game/machinery/accounting.dm diff --git a/code/game/machinery/accounting.dm b/code/game/machinery/accounting.dm new file mode 100644 index 00000000000..90e074285bf --- /dev/null +++ b/code/game/machinery/accounting.dm @@ -0,0 +1,71 @@ +/obj/machinery/accounting + name = "account registration device" + desc = "A machine that allows heads of staff to create a new bank account after inserting an ID." + icon = 'icons/obj/stationobjs.dmi' + icon_state = "recharger" + circuit = /obj/item/circuitboard/machine/accounting + pass_flags = PASSTABLE + req_one_access = list(ACCESS_HEADS, ACCESS_CHANGE_IDS) + var/obj/item/card/id/inserted_id + +/obj/machinery/accounting/Destroy() + . = ..() + if(inserted_id) + remove_card() + +/obj/machinery/accounting/attackby(obj/item/I, mob/living/user, params) + if(isidcard(I)) + var/obj/item/card/id/new_id = I + if(inserted_id) + to_chat(user, "[src] already has a card inserted!") + return + if(new_id.registered_account) + to_chat(user, "[src] already has a bank account!") + return + if(!anchored || !user.transferItemToLoc(I,src)) + to_chat(user, "\the [src] blinks red as you try to insert the ID Card!") + return + inserted_id = new_id + RegisterSignal(inserted_id, COMSIG_PARENT_QDELETING, .proc/remove_card) + var/datum/bank_account/bank_account = new /datum/bank_account(inserted_id.registered_name) + inserted_id.registered_account = bank_account + playsound(loc, 'sound/machines/synth_yes.ogg', 30 , TRUE) + update_icon() + return + return ..() + + +/obj/machinery/accounting/attack_hand(mob/user) + . = ..() + if(.) + return + if(!inserted_id) + return + + user.put_in_hands(inserted_id) + inserted_id.add_fingerprint(user) + user.visible_message("[user] removes [inserted_id] from \the [src].", "You remove [inserted_id] from \the [src].") + remove_card() + +///Used to clean up variables after the card has been removed, unregisters the removal signal, sets inserted ID to null, and updates the icon. +/obj/machinery/accounting/proc/remove_card() + UnregisterSignal(inserted_id, COMSIG_PARENT_QDELETING) + inserted_id = null + update_icon() + +/obj/machinery/accounting/update_overlays() + . = ..() + SSvis_overlays.remove_vis_overlay(src, managed_vis_overlays) + luminosity = 0 + if(machine_stat & (NOPOWER|BROKEN) || !anchored) + return + if(panel_open) + SSvis_overlays.add_vis_overlay(src, icon, "recharger-open", layer, plane, dir, alpha) + return + luminosity = 1 + if(inserted_id) + SSvis_overlays.add_vis_overlay(src, icon, "recharger-full", layer, plane, dir, alpha) + SSvis_overlays.add_vis_overlay(src, icon, "recharger-full", EMISSIVE_LAYER, EMISSIVE_PLANE, dir, alpha) + else + SSvis_overlays.add_vis_overlay(src, icon, "recharger-empty", layer, plane, dir, alpha) + SSvis_overlays.add_vis_overlay(src, icon, "recharger-empty", EMISSIVE_LAYER, EMISSIVE_PLANE, dir, alpha) diff --git a/code/game/objects/items/circuitboards/machine_circuitboards.dm b/code/game/objects/items/circuitboards/machine_circuitboards.dm index bb941a1cf03..583632d581b 100644 --- a/code/game/objects/items/circuitboards/machine_circuitboards.dm +++ b/code/game/objects/items/circuitboards/machine_circuitboards.dm @@ -587,6 +587,15 @@ /obj/item/stock_parts/micro_laser = 1 ) +/obj/item/circuitboard/machine/accounting + name = "Account Registration Device (Machine Board)" + icon_state = "command" + build_path = /obj/machinery/accounting + req_components = list( + /obj/item/stock_parts/card_reader = 1, + /obj/item/stock_parts/scanning_module = 1 + ) + //Medical /obj/item/circuitboard/machine/chem_dispenser diff --git a/code/modules/economy/account.dm b/code/modules/economy/account.dm index 3fc9115f403..68033c71d6a 100644 --- a/code/modules/economy/account.dm +++ b/code/modules/economy/account.dm @@ -52,6 +52,8 @@ return FALSE /datum/bank_account/proc/payday(amt_of_paychecks, free = FALSE) + if(!account_job) + return var/money_to_transfer = account_job.paycheck * payday_modifier * amt_of_paychecks if(free) adjust_money(money_to_transfer) diff --git a/code/modules/research/designs/machine_designs.dm b/code/modules/research/designs/machine_designs.dm index ed90b28e523..7b4df5f02c3 100644 --- a/code/modules/research/designs/machine_designs.dm +++ b/code/modules/research/designs/machine_designs.dm @@ -646,3 +646,11 @@ build_path = /obj/item/circuitboard/machine/skill_station category = list ("Misc. Machinery") departmental_flags = DEPARTMENTAL_FLAG_SCIENCE | DEPARTMENTAL_FLAG_CARGO | DEPARTMENTAL_FLAG_ENGINEERING | DEPARTMENTAL_FLAG_SERVICE + +/datum/design/board/accounting + name = "Machine Design (Account Registration Device)" + desc = "The circuit board for a Account Registration Device." + id = "accounting" + departmental_flags = DEPARTMENTAL_FLAG_SECURITY + build_path = /obj/item/circuitboard/machine/accounting + category = list ("Misc. Machinery") diff --git a/code/modules/research/techweb/all_nodes.dm b/code/modules/research/techweb/all_nodes.dm index 48642bbfed7..3c605f85eb3 100644 --- a/code/modules/research/techweb/all_nodes.dm +++ b/code/modules/research/techweb/all_nodes.dm @@ -418,7 +418,7 @@ display_name = "Computerized Recordkeeping" description = "Organized record databases and how they're used." prereq_ids = list("comptech") - design_ids = list("secdata", "med_data", "prisonmanage", "vendor", "automated_announcement") + design_ids = list("secdata", "med_data", "prisonmanage", "vendor", "automated_announcement", "accounting") research_costs = list(TECHWEB_POINT_TYPE_GENERIC = 1000) export_price = 2000 diff --git a/tgstation.dme b/tgstation.dme index 2e50066afdf..ca63926c201 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -179,8 +179,8 @@ #include "code\_globalvars\lists\achievements.dm" #include "code\_globalvars\lists\admin.dm" #include "code\_globalvars\lists\client.dm" -#include "code\_globalvars\lists\construction.dm" #include "code\_globalvars\lists\color.dm" +#include "code\_globalvars\lists\construction.dm" #include "code\_globalvars\lists\flavor_misc.dm" #include "code\_globalvars\lists\keybindings.dm" #include "code\_globalvars\lists\maintenance_loot.dm" @@ -729,6 +729,7 @@ #include "code\game\gamemodes\traitor\traitor.dm" #include "code\game\gamemodes\wizard\wizard.dm" #include "code\game\machinery\_machinery.dm" +#include "code\game\machinery\accounting.dm" #include "code\game\machinery\ai_slipper.dm" #include "code\game\machinery\airlock_control.dm" #include "code\game\machinery\announcement_system.dm"