diff --git a/code/__DEFINES/economy.dm b/code/__DEFINES/economy.dm index 00cf6e0964dc..69627d127843 100644 --- a/code/__DEFINES/economy.dm +++ b/code/__DEFINES/economy.dm @@ -1,12 +1,12 @@ -#define STARTING_PAYCHECKS 7 +#define STARTING_PAYCHECKS 4 //Experimental change: These are subject to tweaking based on the /tg/ economy overhaul. //Current design direction: Higher paying jobs are vastly outnumbered by lower paying jobs, so anything above medium hurts inflation, common jobs help inflation #define PAYCHECK_RESOURCE 0 //Temp fix for making vendors dispense things for free? Couldn't find anything in the code, plus someone's already working on economy, so... -#define PAYCHECK_PRISONER 25 -#define PAYCHECK_ASSISTANT 50 -#define PAYCHECK_MINIMAL 55 -#define PAYCHECK_EASY 60 +#define PAYCHECK_PRISONER 1 +#define PAYCHECK_ASSISTANT 20 +#define PAYCHECK_MINIMAL 25 +#define PAYCHECK_EASY 50 #define PAYCHECK_MEDIUM 75 #define PAYCHECK_HARD 100 #define PAYCHECK_COMMAND 200 diff --git a/code/controllers/subsystem/economy.dm b/code/controllers/subsystem/economy.dm index 804dd170a264..055ab524a8f0 100644 --- a/code/controllers/subsystem/economy.dm +++ b/code/controllers/subsystem/economy.dm @@ -1,6 +1,6 @@ SUBSYSTEM_DEF(economy) name = "Economy" - wait = 5 MINUTES + wait = 10 MINUTES init_order = INIT_ORDER_ECONOMY runlevels = RUNLEVEL_GAME var/roundstart_paychecks = 5 @@ -41,6 +41,7 @@ SUBSYSTEM_DEF(economy) var/pack_price_modifier = 1 var/market_crashing = FALSE + /datum/controller/subsystem/economy/Initialize(timeofday) var/budget_to_hand_out = round(budget_pool / department_accounts.len) for(var/A in department_accounts) @@ -57,18 +58,23 @@ SUBSYSTEM_DEF(economy) departmental_payouts() station_total = 0 station_target_buffer += STATION_TARGET_BUFFER + EmployeePayout() + for(var/account in bank_accounts_by_id) var/datum/bank_account/bank_account = bank_accounts_by_id[account] if(bank_account?.account_job) temporary_total += (bank_account.account_job.paycheck * STARTING_PAYCHECKS) if(!istype(bank_account, /datum/bank_account/department)) station_total += bank_account.account_balance + station_target = max(round(temporary_total / max(bank_accounts_by_id.len * 2, 1)) + station_target_buffer, 1) // if(!market_crashing) // price_update() Fucks up Workshop, I'll figure out how to make it override soon:tm: - Kirie /** - * Handy proc for obtaining a department's bank account, given the department ID, AKA the define assigned for what department they're under. + * Handy proc for obtaining a department's bank account, + * given the department ID, AKA the define assigned for + * what department they're under. */ /datum/controller/subsystem/economy/proc/get_dep_account(dep_id) for(var/datum/bank_account/department/D in generated_accounts) @@ -76,7 +82,8 @@ SUBSYSTEM_DEF(economy) return D /** - * Departmental income payments are kept static and linear for every department, and paid out once every 5 minutes, as determined by MAX_GRANT_DPT. + * Departmental income payments are kept static and linear for + * every department, and paid out once every 10 minutes, as determined by MAX_GRANT_DPT. * Iterates over every department account for the same payment. */ /datum/controller/subsystem/economy/proc/departmental_payouts() @@ -87,9 +94,26 @@ SUBSYSTEM_DEF(economy) dept_account.adjust_money(MAX_GRANT_DPT) /** - * Updates the prices of all station vendors with the inflation_value, increasing/decreasing costs across the station, and alerts the crew. + * Pays all employee accounts. When this + * procc's the employee's bank account will + * ping and announce how much they got. + */ +/datum/controller/subsystem/economy/proc/EmployeePayout() + for(var/account in bank_accounts_by_id) + var/datum/bank_account/bank_account = bank_accounts_by_id[account] + if(istype(bank_account, /datum/bank_account/department)) + continue + if(bank_account?.account_job) + bank_account.payday(1, TRUE) + +/** + * Updates the prices of all station vendors with the + * inflation_value, increasing/decreasing costs across + * the station, and alerts the crew. * - * Iterates over the machines list for vending machines, resets their regular and premium product prices (Not contraband), and sends a message to the newscaster network. + * Iterates over the machines list for vending machines, + * resets their regular and premium product prices + * (Not contraband), and sends a message to the newscaster network. **/ /datum/controller/subsystem/economy/proc/price_update() for(var/obj/machinery/vending/V in GLOB.machines) diff --git a/code/modules/economy/account.dm b/code/modules/economy/account.dm index 4746297b192a..edca16aa12f1 100644 --- a/code/modules/economy/account.dm +++ b/code/modules/economy/account.dm @@ -59,6 +59,12 @@ if(account_balance < 0) account_balance = 0 +/** + * Returns TRUE if a bank account has more than or equal to the amount, amt. + * Otherwise returns false. + * Arguments: + * * amount - the quantity of credits that will be reconciled with the account balance. + */ /datum/bank_account/proc/has_money(amt) return account_balance >= amt @@ -77,19 +83,30 @@ return TRUE return FALSE -/datum/bank_account/proc/payday(amt_of_paychecks, free = FALSE) +/** + * This proc handles passive income gain for players, using their job's paycheck value. + * Funds are taken from the parent department account to hand out to players. This can result in payment brown-outs if too many people are in one department. + * Arguments: + * * amount_of_paychecks - literally the number of salaries, 1 for issuing one salary, 5 for issuing five salaries. + * * free - issuance of free funds, if TRUE then takes funds from the void, if FALSE (default) tries to send from the department's account. + */ +/datum/bank_account/proc/payday(amount_of_paychecks = 1, free = FALSE) if(!account_job) return - var/money_to_transfer = round(account_job.paycheck * payday_modifier * amt_of_paychecks) + var/money_to_transfer = round(account_job.paycheck * payday_modifier * amount_of_paychecks) + if(!money_to_transfer) + return FALSE if(free) adjust_money(money_to_transfer) SSblackbox.record_feedback("amount", "free_income", money_to_transfer) SSeconomy.station_target += money_to_transfer log_econ("[money_to_transfer] ahn were given to [src.account_holder]'s account from income.") + bank_card_talk("Payday processed, account now holds [account_balance] ahn.") + return TRUE else - var/datum/bank_account/D = SSeconomy.get_dep_account(account_job.paycheck_department) - if(D) - if(!transfer_money(D, money_to_transfer)) + var/datum/bank_account/department_account = SSeconomy.get_dep_account(account_job.paycheck_department) + if(department_account) + if(!transfer_money(department_account, money_to_transfer)) bank_card_talk("ERROR: Payday aborted, departmental funds insufficient.") return FALSE else @@ -98,6 +115,13 @@ bank_card_talk("ERROR: Payday aborted, unable to contact departmental account.") return FALSE +/** + * This sends a local chat message to the owner of a bank account, on all ID cards registered to the bank_account. + * If not held, sends out a message to all nearby players. + * Arguments: + * * message - text that will be sent to listeners after the id card icon + * * force - if TRUE ignore checks on client and client prefernces. + */ /datum/bank_account/proc/bank_card_talk(message, force) if(!message || !bank_cards.len) return diff --git a/code/modules/jobs/job_types/city/civilian.dm b/code/modules/jobs/job_types/city/civilian.dm index 801f52791902..e1830c15fea7 100644 --- a/code/modules/jobs/job_types/city/civilian.dm +++ b/code/modules/jobs/job_types/city/civilian.dm @@ -16,7 +16,7 @@ Civilian allow_bureaucratic_error = FALSE maptype = list("city", "fixers") - paycheck = 170 + paycheck = 250 var/static/list/possible_books = null /datum/job/civilian/equip(mob/living/carbon/human/H, visualsOnly = FALSE, announce = TRUE, latejoin = FALSE, datum/outfit/outfit_override = null, client/preference_source) diff --git a/code/modules/jobs/job_types/manager.dm b/code/modules/jobs/job_types/manager.dm index e322467ba172..1f372d1b8be5 100644 --- a/code/modules/jobs/job_types/manager.dm +++ b/code/modules/jobs/job_types/manager.dm @@ -7,6 +7,7 @@ supervisors = "the manager" selection_color = "#bcbcef" display_order = JOB_DISPLAY_ORDER_MANAGER + paycheck = PAYCHECK_MEDIUM exp_requirements = 720 exp_type = EXP_TYPE_CREW diff --git a/code/modules/jobs/job_types/rcorp/rabbit.dm b/code/modules/jobs/job_types/rcorp/rabbit.dm index 52b59730f1e1..cb89442e73c2 100644 --- a/code/modules/jobs/job_types/rcorp/rabbit.dm +++ b/code/modules/jobs/job_types/rcorp/rabbit.dm @@ -7,6 +7,7 @@ exp_requirements = 120 supervisors = "the rabbit team captain and the commander" selection_color = "#d9b555" + paycheck = 0 outfit = /datum/outfit/job/rabbit display_order = 9