Revert "(CONFIG CHANGE) Updating Economy: Adding Paychecks, and makes Bank Accounts easier to work with"

This commit is contained in:
Dahlular
2022-07-06 16:38:30 -06:00
committed by GitHub
parent f6f3a63b4e
commit eaaca202a6
60 changed files with 187 additions and 431 deletions
@@ -1,62 +1,10 @@
SUBSYSTEM_DEF(economy)
name = "Economy"
wait = 5 MINUTES
priority = FIRE_PRIORITY_ECONOMY
init_order = INIT_ORDER_ECONOMY
runlevels = RUNLEVEL_GAME | RUNLEVEL_POSTGAME
/// How many "paychecks" someone gets at the creation of the bank account
runlevels = RUNLEVEL_GAME
flags = SS_NO_FIRE //Let's not forget this. This subsystem does not use fire and was needlessly using CPU.
var/roundstart_paychecks = 5
var/budget_pool = 35000
var/list/generated_accounts = list()
var/list/bank_accounts = list() //List of normal accounts (not department accounts)
var/static/list/prices_by_type
/// Updates the prices from the config. Assorted into this individual proc instead of Initialize() so testers can change the config mid-round
/// without having to initialize the economy SS again
/datum/controller/subsystem/economy/proc/UpdatePrices()
roundstart_paychecks
prices_by_type = list()
prices_by_type += CONFIG_GET(number/economy_price_default) //ECONOMY_PRICE_DEFAULT.. 1
prices_by_type += CONFIG_GET(number/economy_price_low) //ECONOMY_PRICE_LOW.. 2
prices_by_type += CONFIG_GET(number/economy_price_high)
prices_by_type += CONFIG_GET(number/economy_price_erotic)
prices_by_type += CONFIG_GET(number/economy_price_expensive)
prices_by_type += CONFIG_GET(number/economy_price_expensive_af)
prices_by_type += 0 //ECONOMY_PRICE_FORCED_FREE.. 7
/datum/controller/subsystem/economy/Initialize()
roundstart_paychecks = CONFIG_GET(number/economy_base_pay_ratio)
if(!prices_by_type)
UpdatePrices()
return ..()
/datum/controller/subsystem/economy/fire()
for(var/datum/bank_account/account as anything in bank_accounts)
account.GivePaycheck(GetPaycheck(account, account.account_job))
/**
* Returns a value of the amount of money a bank account would be getting. It's just some simple multiplication.
* Both the bank account and job is allowed to be null here.
*
* Thanks to the ultimate nature of byond, colon accessors, :, get the default values of the bank account and
* job datums if the respective one is null. You can pass zero arguments here and you'd get the "default" amount of a paycheck.
*/
/datum/controller/subsystem/economy/proc/GetPaycheck(datum/bank_account/account, datum/job/job, multiplier=1)
return FLOOR(account:base_pay * job:base_paycheck_multiplier * multiplier, 1)
/**
* Returns a price value from a subtype of an /obj/item, assuming it was compiled to use money.
* Otherwise, returns null if it does not use economy
*/
/datum/controller/subsystem/economy/proc/GetPrice(obj/item/costly_item)
var/economy_type
var/price_multiplier
if(istype(costly_item))
economy_type = costly_item.economy_type
price_multiplier = costly_item.economy_price_mul
else
economy_type = initial(costly_item.economy_type)
price_multiplier = initial(costly_item.economy_price_mul)
if(!economy_type)
return
return FLOOR(prices_by_type[economy_type] * price_multiplier, 1)
@@ -7,9 +7,8 @@
icon_state = "nailcap"
item_state = "nailpolish"
w_class = WEIGHT_CLASS_SMALL
economy_type = ECONOMY_PRICE_LOW
economy_price_mul = 1.25
var/paint = "black"
price = 5
var/mutable_appearance/bottle //show the colour on the bottle.
/obj/item/nailpolish/red
@@ -1,4 +1,4 @@
/*
/*
lover's dice: based off a really funny yakuza gif i saw on tumblr years ago
these give suggestions for sex acts to perform. it's stupid but fun.
@@ -12,8 +12,7 @@ sarcoph mar 2022
desc = "Contains all the intimate ideas you'll ever need. A game that everyone wins!"
icon = 'hyperstation/icons/obj/toy.dmi'
icon_state = "lovedicebag"
economy_type = ECONOMY_PRICE_EROTIC
economy_price_mul = 0.5
price = 1
/obj/item/storage/pill_bottle/lovedice/Initialize()
. = ..()
+21 -37
View File
@@ -1,45 +1,29 @@
/datum/bank_account
/// The name of whoever owns this account
var/account_holder = "Some pleboid"
/// The balance, in credits!
var/balance = 0
/// 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 = 80
/// 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
#define DUMPTIME 3000
/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
/datum/bank_account
var/account_holder = "Some pleb"
var/account_balance = 0
var/account_offstation_balance = 0
var/account_pin = 0
var/account_dna = ""
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
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.")
return
base_pay = CONFIG_GET(number/economy_base_payment)
SSeconomy.bank_accounts += src
balance += SSeconomy.GetPaycheck(src, job, SSeconomy.roundstart_paychecks)
/// Helper for whenever a paycheck gets processed into this account from the economy SS. Simply adds an amount to the account balance and notifies the user.
/datum/bank_account/proc/GivePaycheck(amount, silent=FALSE)
balance += amount
if(associated_id && !silent)
var/local_turf = get_turf(associated_id)
for(var/mob/M in get_hearers_in_view(1, local_turf))
M.playsound_local(local_turf, 'sound/machines/twobeep_high.ogg', 50, vary = TRUE)
to_chat(M, "<span class='notice'>[icon2html(associated_id, M)] Paycheck processed, your account now holds [balance] credits.</span>")
/datum/bank_account/Destroy()
if(SSeconomy)
if(add_to_accounts)
SSeconomy.bank_accounts -= src
return ..()
+2 -2
View File
@@ -7,9 +7,9 @@
icon = 'hyperstation/icons/obj/condom.dmi'
throwforce = 0
icon_state = "b_condom_wrapped"
var/unwrapped = 0
var/unwrapped = 0
w_class = WEIGHT_CLASS_TINY
economy_type = ECONOMY_PRICE_LOW
price = 1
obj/item/condom/Initialize()
create_reagents(300, DRAWABLE|NO_REACT)
+12 -13
View File
@@ -18,7 +18,6 @@
light_power = 0
light_range = 7
light_color = COLOR_VIVID_RED
var/pin = 0
/obj/machinery/atm/ui_interact(mob/user)
@@ -40,7 +39,7 @@
if(idcard.registered_account)
if(!idcard.registered_account.account_pin || pin == idcard.registered_account.account_pin)
dat += "<p>Balance: <b>$[idcard.registered_account.balance]</b>"
dat += "<p>Balance: <b>$[idcard.registered_account.account_balance]</b>"
//dat += "<p>Offstation Balance: <b()</b>"
dat += "<p>"
dat += "<a href='byond://?src=[REF(src)];withdraw=1'>Withdraw</A>"
@@ -73,15 +72,15 @@
user = idcard.registered_name
pin = ""
playsound(src, 'sound/machines/button.ogg', 50, FALSE)
ui_interact(usr)
src.ui_interact(usr)
if(istype(I, /obj/item/stack/credits)) //feed money back into the machine! dont need a pin to donate stuff.
if(held_card)
var/obj/item/stack/credits/cred = I
var/obj/item/card/id/idcard = held_card
idcard.registered_account.balance = (idcard.registered_account.balance+cred.amount)
idcard.registered_account.account_balance = (idcard.registered_account.account_balance+cred.amount)
to_chat(usr, "<span class='notice'>You insert [cred] into the ATM.</span>")
ui_interact(usr)
src.ui_interact(usr)
del(cred)
/obj/machinery/atm/Topic(href, href_list)
@@ -107,29 +106,29 @@
var/pininput = input(user, "Input pin", "Pin Number") as num|null
if(pininput)
if(pininput > 9999 || pininput < 1000)
to_chat(usr, "<span class='notice'>[src] buzzes, you must input a 4 digit number between 1000 and 9999.</span>")
to_chat(usr, "<span class='notice'>[src.name] buzzes, you must input a 4 digit number between 1000 and 9999.</span>")
return
pin = max(min( round(text2num(pininput)), 9999),1000) //4 numbers or less.
var/obj/item/card/id/idcard = held_card
if(pin == idcard.registered_account.account_pin)
to_chat(usr, "<span class='notice'>[src] beeps, accepting the pin.</span>")
to_chat(usr, "<span class='notice'>[src.name] beeps, accepting the pin.</span>")
else
to_chat(usr, "<span class='notice'>[src] buzzes, denying the pin.</span>")
to_chat(usr, "<span class='notice'>[src.name] buzzes, denying the pin.</span>")
if(href_list["changepin"])
playsound(src, get_sfx("terminal_type"), 25, 1)
var/pinchange = input(user, "Input pin", "Pin Number") as num|null
if(pinchange > 9999 || pinchange < 1000)
to_chat(usr, "<span class='warning'>[src], you must have a 4 digit number for a pin and be between 1000 and 9999.</span>")
to_chat(usr, "<span class='warning'>[src.name], you must have a 4 digit number for a pin and be between 1000 and 9999.</span>")
return
if(pinchange)
var/pinchange2 = input(user, "Confirm pin", "Confirm pin") as num|null //time to confirm!
if(pinchange == pinchange2)
var/obj/item/card/id/idcard = held_card
idcard.registered_account.account_pin = pinchange
to_chat(usr, "<span class='notice'>[src] beeps, your pin has been changed to [pinchange]!.</span>")
to_chat(usr, "<span class='notice'>[src.name] beeps, your pin has been changed to [pinchange]!.</span>")
else
to_chat(usr, "<span class='warning'>[src] buzzes, your pins did not match!</span>")
to_chat(usr, "<span class='warning'>[src.name] buzzes, your pins did not match!</span>")
pin = ""
if(href_list["withdraw"])
@@ -139,9 +138,9 @@
if(idcard.registered_account)
var/amount = input(user, "Choose amount", "Withdraw") as num|null
if(amount>0)
amount = max(min( round(text2num(amount)), idcard.registered_account.balance),0) //make sure they aint taking out more then what they have
amount = max(min( round(text2num(amount)), idcard.registered_account.account_balance),0) //make sure they aint taking out more then what they have
to_chat(usr, "<span class='notice'>The machine prints out [amount] credits.</span>")
idcard.registered_account.balance = (idcard.registered_account.balance-amount) //subtract the amount they took out.
idcard.registered_account.account_balance = (idcard.registered_account.account_balance-amount) //subtract the amount they took out.
var/obj/item/stack/credits/C = new /obj/item/stack/credits/(loc)
C.amount = amount
if(usr.put_in_hands(C))
+10 -13
View File
@@ -10,11 +10,10 @@
icon_state = "fleshlight_base"
item_state = "fleshlight"
w_class = WEIGHT_CLASS_SMALL
economy_type = ECONOMY_PRICE_EROTIC
economy_price_mul = 0.95
var/inuse = 0
var/sleevecolor = "#ffcbd4" //pink
price = 8
var/mutable_appearance/sleeve
var/inuse = 0
/obj/item/fleshlight/examine(mob/user)
. = ..()
@@ -79,11 +78,10 @@
icon_state = "unpaired"
item_state = "fleshlight"
w_class = WEIGHT_CLASS_SMALL
economy_type = ECONOMY_PRICE_EROTIC
economy_price_mul = 1.2
var/partnercolor = "#ffcbd4"
var/partnerbase = "normal"
var/partnerorgan = "portal_vag"
price = 20
var/mutable_appearance/sleeve
var/mutable_appearance/organ
var/inuse = 0
@@ -98,7 +96,7 @@
else
. += "<span class='notice'>The device is paired, and awaiting input. </span>"
/obj/item/portallight/attack(mob/living/carbon/user, mob/living/holder)
/obj/item/portallight/attack(mob/living/carbon/user, mob/living/holder)
if(inuse) //just to stop stacking and causing people to cum instantly
return
if(!UpdateUsability())
@@ -113,8 +111,8 @@
if(option == "Fuck" && !P.is_exposed())
to_chat(holder, "<span class='notice'>You don't see anywhere to use this on.</span>")
return
/*
WARMUP START - prevents spam/instant climax
/*
WARMUP START - prevents spam/instant climax
*/
inuse = TRUE
if(user != holder)
@@ -124,8 +122,8 @@
inuse = FALSE
return
inuse = FALSE
/*
WARMUP END - proceed with the action
/*
WARMUP END - proceed with the action
*/
switch(option)
if("Fuck")
@@ -142,7 +140,7 @@
user.adjustArousalLoss(20)
target.adjustArousalLoss(20)
target.do_jitter_animation()
if(target.can_orgasm() && prob(5))
if(target.can_orgasm() && prob(5))
target.mob_climax_outside(target_genital, spillage=target_genital.is_exposed())
if(user.can_orgasm())
var/mob/living/carbon/human/O = user
@@ -278,8 +276,7 @@
icon = 'hyperstation/icons/obj/fleshlight.dmi'
desc = "A small silver box with Silver Love Co embossed."
icon_state = "box"
economy_type = ECONOMY_PRICE_EROTIC
economy_price_mul = 1.5
price = 15
// portal fleshlight box
/obj/item/storage/box/portallight/PopulateContents()
+4 -8
View File
@@ -6,16 +6,14 @@
icon = 'hyperstation/icons/obj/clothing/gloves.dmi'
alternate_worn_icon = 'hyperstation/icons/mobs/gloves.dmi'
mutantrace_variation = NO_MUTANTRACE_VARIATION
economy_type = ECONOMY_PRICE_EROTIC
economy_price_mul = 0.75
price = 5
/obj/item/clothing/gloves/latexsleeves/security
name = "security sleeves"
desc = "A pair of latex sleeves, with a band of red above the elbows denoting that the wearer is part of the security team."
icon_state = "latexsec"
item_state = "latexsec"
economy_type = ECONOMY_PRICE_EROTIC
economy_price_mul = 0.75
price = 5
/obj/item/clothing/head/dominatrixcap
name = "dominatrix cap"
@@ -47,8 +45,7 @@ obj/item/clothing/neck/stole
w_class = WEIGHT_CLASS_SMALL
icon_state = "stole"
item_state = "" //no inhands
economy_type = ECONOMY_PRICE_EXPENSIVE
economy_price_mul = 0.75
price = 3
obj/item/clothing/neck/stole/black
name = "black boa"
@@ -58,8 +55,7 @@ obj/item/clothing/neck/stole/black
icon_state = "stole"
item_state = "" //no inhands
color = "#3d3d3d"
economy_type = ECONOMY_PRICE_EXPENSIVE
economy_price_mul = 0.75
price = 3
/obj/item/clothing/suit/fluffyhalfcrop
name = "fluffy half-crop jacket"
+1 -2
View File
@@ -10,8 +10,7 @@
item_state = "rope" //This sprite is in restraints.dmi until I figure out how to refrence somewhere else
cuffsound = 'sound/weapons/cablecuff.ogg'
armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 0, "acid" = 0)
economy_type = ECONOMY_PRICE_LOW
economy_price_mul = 1.25
price = 2
/mob/living/proc/rope_add(source) //Check to see if the rope is on, and then add effects
var/mob/living/carbon/M = source
+2 -2
View File
@@ -4,9 +4,9 @@
icon = 'hyperstation/icons/obj/sounding.dmi'
throwforce = 0
icon_state = "sounding_wrapped"
var/unwrapped = 0
var/unwrapped = 0
w_class = WEIGHT_CLASS_TINY
economy_type = ECONOMY_PRICE_LOW
price = 1
/obj/item/sounding/attack_self(mob/user)
if(!istype(user))
+1 -1
View File
@@ -13,7 +13,7 @@
var/style = "long"
var/inside = FALSE
var/last = 0
economy_type = ECONOMY_PRICE_EROTIC
price = 3
/obj/item/electropack/vibrator/Initialize() //give the device its own code
. = ..()