From ecf93da4b12fcd1c6e32443090c3f507c4add2db Mon Sep 17 00:00:00 2001 From: QuoteFox <49098813+quotefox@users.noreply.github.com> Date: Mon, 25 Jan 2021 10:47:15 +0000 Subject: [PATCH] Economy part 1 Economy part 1 --- code/__DEFINES/subsystems.dm | 1 + code/controllers/subsystem/job.dm | 5 + code/game/objects/items/cards_ids.dm | 2 +- code/game/objects/items/stacks/cash.dm | 2 +- code/modules/jobs/job_types/job.dm | 16 ++- .../mob/living/carbon/human/human_defines.dm | 2 +- .../mob/living/carbon/human/human_helpers.dm | 1 + hyperstation/code/__DEFINES/economy.dm | 35 ++++++ .../code/controllers/subsystem/economy.dm | 16 +++ hyperstation/code/modules/economy/account.dm | 26 ++++ hyperstation/code/obj/economy.dm | 115 ++++++++++++++++++ hyperstation/icons/obj/economy.dmi | Bin 0 -> 780 bytes hyperstation/icons/obj/genitals/belly.dmi | Bin 0 -> 945 bytes tgstation.dme | 4 + 14 files changed, 221 insertions(+), 4 deletions(-) create mode 100644 hyperstation/code/__DEFINES/economy.dm create mode 100644 hyperstation/code/controllers/subsystem/economy.dm create mode 100644 hyperstation/code/modules/economy/account.dm create mode 100644 hyperstation/code/obj/economy.dm create mode 100644 hyperstation/icons/obj/economy.dmi create mode 100644 hyperstation/icons/obj/genitals/belly.dmi diff --git a/code/__DEFINES/subsystems.dm b/code/__DEFINES/subsystems.dm index 2a57e7bb..f4e0c316 100644 --- a/code/__DEFINES/subsystems.dm +++ b/code/__DEFINES/subsystems.dm @@ -64,6 +64,7 @@ #define INIT_ORDER_TICKER 9 #define INIT_ORDER_MAPPING 8 #define INIT_ORDER_NETWORKS 7 +#define INIT_ORDER_ECONOMY 21 #define INIT_ORDER_ATOMS 6 #define INIT_ORDER_LANGUAGE 5 #define INIT_ORDER_MACHINES 4 diff --git a/code/controllers/subsystem/job.dm b/code/controllers/subsystem/job.dm index d027a3cf..494a6568 100644 --- a/code/controllers/subsystem/job.dm +++ b/code/controllers/subsystem/job.dm @@ -442,6 +442,11 @@ SUBSYSTEM_DEF(job) if(CONFIG_GET(number/minimal_access_threshold)) to_chat(M, "As this station was initially staffed with a [CONFIG_GET(flag/jobs_have_minimal_access) ? "full crew, only your job's necessities" : "skeleton crew, additional access may"] have been added to your ID card.") + if(ishuman(H)) + var/mob/living/carbon/human/wageslave = H + to_chat(M, "Your account ID is [wageslave.account_id].") + H.add_memory("Your account ID is [wageslave.account_id].") + if(job && H) if(job.dresscodecompliant)// CIT CHANGE - dress code compliance equip_loadout(N, H) // CIT CHANGE - allows players to spawn with loadout items diff --git a/code/game/objects/items/cards_ids.dm b/code/game/objects/items/cards_ids.dm index b366b571..5a1d0a43 100644 --- a/code/game/objects/items/cards_ids.dm +++ b/code/game/objects/items/cards_ids.dm @@ -170,7 +170,7 @@ 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 /obj/item/card/id/Initialize(mapload) diff --git a/code/game/objects/items/stacks/cash.dm b/code/game/objects/items/stacks/cash.dm index 94f6fca2..845fc433 100644 --- a/code/game/objects/items/stacks/cash.dm +++ b/code/game/objects/items/stacks/cash.dm @@ -19,7 +19,7 @@ /obj/item/stack/spacecash/proc/update_desc() var/total_worth = amount*value - desc = "It's worth [total_worth] credit[( total_worth > 1 ) ? "s" : ""]" + desc = "A outdated form of currency, It's worth [total_worth] credit[( total_worth > 1 ) ? "s" : ""]" /obj/item/stack/spacecash/merge(obj/item/stack/S) diff --git a/code/modules/jobs/job_types/job.dm b/code/modules/jobs/job_types/job.dm index 2f56fe25..5390f9f9 100644 --- a/code/modules/jobs/job_types/job.dm +++ b/code/modules/jobs/job_types/job.dm @@ -58,7 +58,7 @@ var/list/mind_traits // Traits added to the mind of the mob assigned this job var/list/blacklisted_quirks //list of quirk typepaths blacklisted. - + var/list/alt_titles = list() //Only override this proc @@ -90,6 +90,13 @@ if(!H) return FALSE + if(!visualsOnly) + var/datum/bank_account/bank_account = new(H.real_name, src) + bank_account.account_holder = H.real_name + bank_account.account_job = src + bank_account.account_id = rand(111111,999999) + H.account_id = bank_account.account_id + if(CONFIG_GET(flag/enforce_human_authority) && (title in GLOB.command_positions)) if(H.dna.species.id != "human") H.set_species(/datum/species/human) @@ -230,6 +237,13 @@ C.update_label(C.registered_name, preference_source.prefs.alt_titles_preferences[J.title]) else C.update_label() + + for(var/A in SSeconomy.bank_accounts) + var/datum/bank_account/B = A + if(B.account_id == H.account_id) + C.registered_account = B + B.bank_cards += C + break 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 ea25104c..b30f5ab6 100644 --- a/code/modules/mob/living/carbon/human/human_defines.dm +++ b/code/modules/mob/living/carbon/human/human_defines.dm @@ -68,5 +68,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" diff --git a/code/modules/mob/living/carbon/human/human_helpers.dm b/code/modules/mob/living/carbon/human/human_helpers.dm index 93c9ce32..5fa5046a 100644 --- a/code/modules/mob/living/carbon/human/human_helpers.dm +++ b/code/modules/mob/living/carbon/human/human_helpers.dm @@ -132,6 +132,7 @@ to_chat(src, "Use of ranged weaponry would bring dishonor to the clan.") return FALSE + /mob/living/carbon/human/can_see_reagents() . = ..() if(.) //No need to run through all of this if it's already true. diff --git a/hyperstation/code/__DEFINES/economy.dm b/hyperstation/code/__DEFINES/economy.dm new file mode 100644 index 00000000..428ea3a0 --- /dev/null +++ b/hyperstation/code/__DEFINES/economy.dm @@ -0,0 +1,35 @@ +#define STARTING_PAYCHECKS 5 + +#define PAYCHECK_ASSISTANT 25 +#define PAYCHECK_MINIMAL 75 +#define PAYCHECK_EASY 125 +#define PAYCHECK_MEDIUM 175 +#define PAYCHECK_HARD 200 +#define PAYCHECK_COMMAND 250 + +#define MAX_GRANT_CIV 2500 +#define MAX_GRANT_ENG 3000 +#define MAX_GRANT_SCI 5000 +#define MAX_GRANT_SECMEDSRV 3000 + +#define ACCOUNT_CIV "CIV" +#define ACCOUNT_CIV_NAME "Civil Budget" +#define ACCOUNT_ENG "ENG" +#define ACCOUNT_ENG_NAME "Engineering Budget" +#define ACCOUNT_SCI "SCI" +#define ACCOUNT_SCI_NAME "Scientific Budget" +#define ACCOUNT_MED "MED" +#define ACCOUNT_MED_NAME "Medical Budget" +#define ACCOUNT_SRV "SRV" +#define ACCOUNT_SRV_NAME "Service Budget" +#define ACCOUNT_CAR "CAR" +#define ACCOUNT_CAR_NAME "Cargo Budget" +#define ACCOUNT_SEC "SEC" +#define ACCOUNT_SEC_NAME "Defense Budget" + +#define NO_FREEBIES "commies go home" + +//ID bank account support defines. +#define ID_NO_BANK_ACCOUNT 0 +#define ID_FREE_BANK_ACCOUNT 1 +#define ID_LOCKED_BANK_ACCOUNT 2 \ No newline at end of file diff --git a/hyperstation/code/controllers/subsystem/economy.dm b/hyperstation/code/controllers/subsystem/economy.dm new file mode 100644 index 00000000..73e51dc2 --- /dev/null +++ b/hyperstation/code/controllers/subsystem/economy.dm @@ -0,0 +1,16 @@ +SUBSYSTEM_DEF(economy) + name = "Economy" + wait = 5 MINUTES + init_order = INIT_ORDER_ECONOMY + runlevels = RUNLEVEL_GAME + var/roundstart_paychecks = 5 + var/budget_pool = 35000 + var/list/department_accounts = list(ACCOUNT_CIV = ACCOUNT_CIV_NAME, + ACCOUNT_ENG = ACCOUNT_ENG_NAME, + ACCOUNT_SCI = ACCOUNT_SCI_NAME, + ACCOUNT_MED = ACCOUNT_MED_NAME, + ACCOUNT_SRV = ACCOUNT_SRV_NAME, + ACCOUNT_CAR = ACCOUNT_CAR_NAME, + ACCOUNT_SEC = ACCOUNT_SEC_NAME) + var/list/generated_accounts = list() + var/list/bank_accounts = list() //List of normal accounts (not department accounts) \ No newline at end of file diff --git a/hyperstation/code/modules/economy/account.dm b/hyperstation/code/modules/economy/account.dm new file mode 100644 index 00000000..23827cc8 --- /dev/null +++ b/hyperstation/code/modules/economy/account.dm @@ -0,0 +1,26 @@ +#define DUMPTIME 3000 + +/datum/bank_account + var/account_holder = "Rusty Venture" + var/account_balance = 0 + var/datum/job/account_job + var/list/bank_cards = list() + var/add_to_accounts = TRUE + var/transferable = TRUE + var/account_id + var/withdrawDelay = 0 + +/datum/bank_account/New(newname, job) + if(add_to_accounts) + if(!SSeconomy) + log_world("Wack") + SSeconomy.bank_accounts += src + account_holder = newname + account_job = job + account_id = rand(111111,999999) + +/datum/bank_account/Destroy() + if(add_to_accounts) + SSeconomy.bank_accounts -= src + return ..() + diff --git a/hyperstation/code/obj/economy.dm b/hyperstation/code/obj/economy.dm new file mode 100644 index 00000000..500e9069 --- /dev/null +++ b/hyperstation/code/obj/economy.dm @@ -0,0 +1,115 @@ +//Hyper station economy. Because coding it yourself is easier than port sometimes. + +/obj/machinery/atm + name = "automated teller machine" + desc = "a wall mounted electronic banking outlet for accessing your bank account." + icon = 'hyperstation/icons/obj/economy.dmi' + icon_state = "atm" + max_integrity = 250 + integrity_failure = 100 + armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 100, "rad" = 100, "fire" = 90, "acid" = 30) + use_power = IDLE_POWER_USE + idle_power_usage = 0 + active_power_usage = 0 + power_channel = ENVIRON + resistance_flags = FIRE_PROOF + var/obj/item/card/held_card + var/user = "" + light_power = 0 + light_range = 7 + light_color = "#ff3232" + +/obj/machinery/atm/ui_interact(mob/user) + . = ..() + var/dat = {""} + dat += "
" + dat += "

" + dat += "

ATM" + dat += "

Welcome to Hyper Station 13's Automated Bank Teller Service." + dat += "

" + if(!held_card) + dat += "

Welcome, please insert your ID to continue." + else + dat += "

Welcome user, [held_card ? user : "------"]

" + var/obj/item/card/id/idcard = held_card + if(idcard.registered_account) + dat += "

Account ID: ([idcard.registered_account.account_id])" + dat += "

Balance: $[idcard.registered_account.account_balance]" + dat += "

" + dat += "Withdraw" + dat += "Change Pin" + dat += "Account Settings" + dat += "Eject" + else + dat += "

Error, You don't seem to have a bank account with us." + dat += "

" + + dat += "

" + + + var/datum/browser/popup = new(user, "atm", "ATM") + popup.set_content(dat) + popup.set_title_image(user.browse_rsc_icon(icon, icon_state), 500,300) + + popup.open() + +/obj/machinery/atm/attackby(obj/item/I, mob/living/user) + if(istype(I, /obj/item/card)) + if(!held_card) + var/obj/item/card/id/idcard = I + if(!user.transferItemToLoc(I, src)) //check if you can put it in + return + held_card = idcard + user = idcard.registered_name + playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50, FALSE) + +/obj/machinery/atm/Topic(href, href_list) + . = ..() + if(..()) + return + + if(href_list["card"]) + if(held_card) + if(usr.CanReach(src)) + if(usr.put_in_hands(held_card)) + to_chat(usr, "You take the ID out of the slot.") + held_card = null + user = "" + else + to_chat(usr, "The machine drops the ID onto the floor!") + held_card = null + user = "" + if(href_list["withdraw"]) + if(held_card) + var/obj/item/card/id/idcard = held_card + if(idcard.registered_account) + var/ammount = input(user, "Choose ammount", "Withdraw") as num|null + if(ammount) + ammount = max(min( round(text2num(ammount)), idcard.registered_account.account_balance),0) + + + + src.ui_interact(usr) + + +//Money, Well, get back, I'm all right Jack, Keep your hands off of my stack. +//making our own currency, just to stop exploits (for now) + +/obj/item/stack/credits + name = "credits" + singular_name = "credit" + icon = 'hyperstation/icons/obj/economy.dmi' + icon_state = "cash" + amount = 1 + max_amount = 100 + throwforce = 0 + throw_speed = 2 + throw_range = 2 + w_class = WEIGHT_CLASS_TINY + full_w_class = WEIGHT_CLASS_TINY + resistance_flags = FLAMMABLE + var/value = 1 + +/obj/item/stack/spacecash/proc/update_desc() + var/total_worth = amount*value + desc = "Legal tender, It's worth [total_worth] credit[( total_worth > 1 ) ? "s" : ""]" \ No newline at end of file diff --git a/hyperstation/icons/obj/economy.dmi b/hyperstation/icons/obj/economy.dmi new file mode 100644 index 0000000000000000000000000000000000000000..6e6dec04dc64dd1425a4adc471ce201e05cc14fc GIT binary patch literal 780 zcmV+n1M~ceP)(s9>`11#-&tQ!PUW4v_Xw zb8v=X&a&SoL_!=6JAe_3e&BiDfM4}*P(6VyPrx?7;)4Iqhmp%H@>eHhz4knhhji6r3`5BRe<3eC=<#< zaDD}Cy;2}17*(8aVDO<_g4_Y!qdgpr<9OT@aNZl=$4i_{r<0~Fz+TKB)!#_>=o}mN zxR?Kfe{w=;Qb7}Xyn`)IATy()7}nC$lSAA*d%vuWx3y zJg>OLJ4h{hUNHw)ELZc@azW|cJ-`E4^}GUM*E<{zhr{tNSZ8@Acq}r>rgsNTv!Y;I zRzB@mMYd_1fIFy~TlOq;xo7!HmjKj3&u47=TE4xP`@AUfPAkwl==nvR-!TAnFyyoH zV^=bk=iR=6)QmG@0CiCG2GcSCxA;M~4sbXezsNTVP+gqkyt97*0000< KMNUMnLSTY*FIwCH literal 0 HcmV?d00001 diff --git a/hyperstation/icons/obj/genitals/belly.dmi b/hyperstation/icons/obj/genitals/belly.dmi new file mode 100644 index 0000000000000000000000000000000000000000..1e6798de2585aab6a23b26eff4d1914dd5ae2815 GIT binary patch literal 945 zcmV;i15W&jP)1Sad{Xb7OL8aCB*JZU6vyoKseCa&`CgQ*iP1 zHq(1L9(3(3)ouL_C-u5?aUz@ zgD@90gdx8Z0BFTc1-RXAmV%4lBch=I$Oa4r7rst{>h*b+7E?JDCgNl8eag(|76dqm(V)jvS0K|eQ%usnm56=V% zgrQ2n>;!y<@&j}Xq=%Ph;53yytuX*nU<2}uGX$y-*mxm8Qey=CdgSltBcwwNJbd>c z>r@yZMcPhrX0;=Mjf)Vw08t}|OWY5U|2_~n_~rtt1j|CZ0a}&=frA$%K74uCs?~@) z5v(zuL!~WwcowOqd-YFu#~53N_~Om?&GvclxOZfLT<<$Fz$2m*^j`KU=E;-#d5{|tS@V4>flT-M z_?`wq;3Q<*>e(EUA>VYM~L)1S|_^}`$C|4 z@ZJv^2%;=nN}lffK@$P$N3f6YCkaTBD1n}(tpq%nB=augy&s%r0Q<6}F^gDUV3#6j z?b#kdy9h&Pg4DI)2tjubx)Qvg?-{(PbH^Ox{g5F;h74IH-~Vf1-XB^C^#75p`@Q_53#8x7zPd5VZUMvOl!j=Tp!I7vA13a3C1>|GYn3Krm#;kjv!