Arconomy: Amputating the Invisible Hand of Income. (#54161)

* Final Stage Capitalism.

* tweaks.

* Got overzelous in my fervor for blood

* well, this now has my full attention.

* Whoops missed a <<

* fixes issue because there were changes I missed

* Cobby: Departmental income is static.

* Whoops

* Various high cost premium prices and a few custom_prices have been adjusted to better suit the lack of income. Code cleanup on income so they're all in-line with cargo.

* First, this has been atomized out.

* UI is now fixed as god intended.

* Actually no, this is dynamic now. No more confusion.

* Conflicts fixed.

* Apply suggestions from code review

Co-authored-by: Jared-Fogle <35135081+Jared-Fogle@users.noreply.github.com>

* tgui recompile.

* Hopefully aquires that green checkmark.

* --fixes the spacing.

* var cleanup and departmental budget assignment cleanup.

* merge conflict fix

Co-authored-by: Jared-Fogle <35135081+Jared-Fogle@users.noreply.github.com>
This commit is contained in:
ArcaneMusic
2020-11-13 16:32:09 -05:00
committed by GitHub
co-authored by Jared-Fogle
parent d829eb6192
commit 816fe2e1e3
7 changed files with 27 additions and 112 deletions
+14 -102
View File
@@ -15,36 +15,8 @@ SUBSYSTEM_DEF(economy)
var/list/generated_accounts = list()
var/full_ancap = FALSE // Enables extra money charges for things that normally would be free, such as sleepers/cryo/cloning.
//Take care when enabling, as players will NOT respond well if the economy is set up for low cash flows.
var/alive_humans_bounty = 100
var/crew_safety_bounty = 1500
var/monster_bounty = 150
var/mood_bounty = 100
/// Departmental cash provided to science when a node is researched in specific configs.
var/techweb_bounty = 250
var/slime_bounty = list("grey" = 10,
// tier 1
"orange" = 100,
"metal" = 100,
"blue" = 100,
"purple" = 100,
// tier 2
"dark purple" = 500,
"dark blue" = 500,
"green" = 500,
"silver" = 500,
"gold" = 500,
"yellow" = 500,
"red" = 500,
"pink" = 500,
// tier 3
"cerulean" = 750,
"sepia" = 750,
"bluespace" = 750,
"pyrite" = 750,
"light pink" = 750,
"oil" = 750,
"adamantine" = 750,
// tier 4
"rainbow" = 1000)
/**
* List of normal (no department ones) accounts' identifiers with associated datum accounts, for big O performance.
* A list of sole account datums can be obtained with flatten_list(), another variable would be redundant rn.
@@ -73,16 +45,11 @@ SUBSYSTEM_DEF(economy)
/datum/controller/subsystem/economy/fire(resumed = 0)
var/temporary_total = 0
eng_payout() // Payout based on nothing. What will replace it? Surplus power, powered APC's, air alarms? Who knows.
sci_payout() // Payout based on slimes.
secmedsrv_payout() // Payout based on crew safety, health, and mood.
civ_payout() // Payout based on Effort and market ebb/flow.
car_payout() // Cargo's natural gain in the cash moneys.
departmental_payouts()
station_total = 0
station_target_buffer += STATION_TARGET_BUFFER
for(var/account in bank_accounts_by_id)
var/datum/bank_account/bank_account = bank_accounts_by_id[account]
bank_account.payday(1)
if(bank_account?.account_job)
temporary_total += (bank_account.account_job.paycheck * STARTING_PAYCHECKS)
if(!istype(bank_account, /datum/bank_account/department))
@@ -91,79 +58,24 @@ SUBSYSTEM_DEF(economy)
if(!market_crashing)
price_update()
/**
* 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)
if(D.department_id == dep_id)
return D
/datum/controller/subsystem/economy/proc/eng_payout()
var/engineering_cash = 3000
var/datum/bank_account/D = get_dep_account(ACCOUNT_ENG)
if(D)
D.adjust_money(engineering_cash)
/datum/controller/subsystem/economy/proc/car_payout()
var/cargo_cash = 500
var/datum/bank_account/D = get_dep_account(ACCOUNT_CAR)
if(D)
D.adjust_money(cargo_cash)
/datum/controller/subsystem/economy/proc/secmedsrv_payout()
var/crew
var/alive_crew
var/dead_monsters
var/cash_to_grant
for(var/mob/m in GLOB.mob_list)
if(isnewplayer(m))
/**
* Departmental income payments are kept static and linear for every department, and paid out once every 5 minutes, as determined by MAX_GRANT_DPT.
* Iterates over every department account for the same payment.
*/
/datum/controller/subsystem/economy/proc/departmental_payouts()
for(var/iteration in department_accounts)
var/datum/bank_account/dept_account = get_dep_account(iteration)
if(!dept_account)
continue
if(m.mind)
if(isbrain(m) || iscameramob(m))
continue
if(ishuman(m))
var/mob/living/carbon/human/H = m
crew++
if(H.stat != DEAD)
alive_crew++
var/datum/component/mood/mood = H.GetComponent(/datum/component/mood)
var/medical_cash = (H.health / H.maxHealth) * alive_humans_bounty
if(mood)
var/datum/bank_account/D = get_dep_account(ACCOUNT_SRV)
if(D)
var/mood_dosh = (mood.mood_level / 9) * mood_bounty
D.adjust_money(mood_dosh)
medical_cash *= (mood.sanity / 100)
var/datum/bank_account/D = get_dep_account(ACCOUNT_MED)
if(D)
D.adjust_money(medical_cash)
if(ishostile(m))
var/mob/living/simple_animal/hostile/H = m
if(H.stat == DEAD && (H.z in SSmapping.levels_by_trait(ZTRAIT_STATION)))
dead_monsters++
CHECK_TICK
var/living_ratio = alive_crew / crew
cash_to_grant = (crew_safety_bounty * living_ratio) + (monster_bounty * dead_monsters)
var/datum/bank_account/D = get_dep_account(ACCOUNT_SEC)
if(D)
D.adjust_money(min(cash_to_grant, MAX_GRANT_SECMEDSRV))
/datum/controller/subsystem/economy/proc/sci_payout()
var/science_bounty = 0
for(var/mob/living/simple_animal/slime/S in GLOB.mob_list)
if(S.stat == DEAD)
continue
science_bounty += slime_bounty[S.colour]
var/datum/bank_account/D = get_dep_account(ACCOUNT_SCI)
if(D)
D.adjust_money(min(science_bounty, MAX_GRANT_SCI))
/datum/controller/subsystem/economy/proc/civ_payout()
var/civ_cash = ((rand(1,5) + civ_bounty_tracker) * 500)
var/datum/bank_account/D = get_dep_account(ACCOUNT_CIV)
if(D)
D.adjust_money(min(civ_cash, MAX_GRANT_CIV))
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.