Files
Bubberstation/code/datums/quirks/negative_quirks/indebted.dm
SkyratBot 8b12def86c [MIRROR] Datumizes pod types (#28986)
* Datumizes pod types (#85033)

## About The Pull Request

Changes supply pods to use datums instead of a massive nested list to
store data and index defines as styles. Complete feature parity.

## Why It's Good For The Game
this is nightmare fuel to work with

![image](https://github.com/user-attachments/assets/851ea009-508b-4958-996e-d46a758b2f62)

and this is a sin against nature and god

![image](https://github.com/user-attachments/assets/6b0cd374-1305-4fe6-9ab6-4912c9cb4461)

![image](https://github.com/user-attachments/assets/88c83f60-af9d-4ea9-af5f-c0810a6d9c66)
ends up as

![image](https://github.com/user-attachments/assets/2cb9e264-895d-49b9-b228-e04ac1353ba1)
which is ???

Using a nested list to store pod data is a very bad idea, it has
horrible formatting, is unreadable without having index defines open in
a second tab and is not extendable. And as you can see above, if someone
added another pod type before 14th everything would break because other
pod type lists **__only have 8 elements__** instead of 10 like the
seethrough one does.

## Changelog
🆑
refactor: Pod code now uses datums instead of being a huge nested list
/🆑

* Datumizes pod types

* [MIRROR] Datumizes pod types [MDB IGNORE] (#3917)

* Datumizes pod types (#85033)

## About The Pull Request

Changes supply pods to use datums instead of a massive nested list to
store data and index defines as styles. Complete feature parity.

## Why It's Good For The Game
this is nightmare fuel to work with

![image](https://github.com/user-attachments/assets/851ea009-508b-4958-996e-d46a758b2f62)

and this is a sin against nature and god

![image](https://github.com/user-attachments/assets/6b0cd374-1305-4fe6-9ab6-4912c9cb4461)

![image](https://github.com/user-attachments/assets/88c83f60-af9d-4ea9-af5f-c0810a6d9c66)
ends up as

![image](https://github.com/user-attachments/assets/2cb9e264-895d-49b9-b228-e04ac1353ba1)
which is ???

Using a nested list to store pod data is a very bad idea, it has
horrible formatting, is unreadable without having index defines open in
a second tab and is not extendable. And as you can see above, if someone
added another pod type before 14th everything would break because other
pod type lists **__only have 8 elements__** instead of 10 like the
seethrough one does.

## Changelog
🆑
refactor: Pod code now uses datums instead of being a huge nested list
/🆑

* Datumizes pod types

* modular updates

---------

Co-authored-by: SmArtKar <44720187+SmArtKar@users.noreply.github.com>
Co-authored-by: NovaBot13 <novasector13@gmail.com>
Co-authored-by: Fluffles <piecopresident@gmail.com>

---------

Co-authored-by: SmArtKar <44720187+SmArtKar@users.noreply.github.com>
Co-authored-by: NovaBot <154629622+NovaBot13@users.noreply.github.com>
Co-authored-by: NovaBot13 <novasector13@gmail.com>
Co-authored-by: Fluffles <piecopresident@gmail.com>
Co-authored-by: SpaceLoveSs13 <68121607+SpaceLoveSs13@users.noreply.github.com>
2024-07-27 19:57:36 +05:30

41 lines
1.8 KiB
Plaintext

/datum/quirk/indebted
name = "Indebted"
desc = "Bad life decisions, medical bills, student loans, whatever it may be, you've incurred quite the debt. A portion of all you receive will go towards extinguishing it."
icon = FA_ICON_DOLLAR
quirk_flags = QUIRK_HUMAN_ONLY|QUIRK_HIDE_FROM_SCAN
value = -2
medical_record_text = "Alas, the patient struggled to scrape together enough money to pay the checkup bill."
hardcore_value = 2
/datum/quirk/indebted/add_unique(client/client_source)
var/mob/living/carbon/human/human_holder = quirk_holder
if(!human_holder.account_id)
return
var/datum/bank_account/account = SSeconomy.bank_accounts_by_id["[human_holder.account_id]"]
var/debt = PAYCHECK_CREW * rand(275, 325)
account.account_debt += debt
RegisterSignal(account, COMSIG_BANK_ACCOUNT_DEBT_PAID, PROC_REF(on_debt_paid))
to_chat(client_source.mob, span_warning("You remember, you've a hefty, [debt] credits debt to pay..."))
///Once the debt is extinguished, award an achievement and a pin for actually taking care of it.
/datum/quirk/indebted/proc/on_debt_paid(datum/bank_account/source)
SIGNAL_HANDLER
if(source.account_debt)
return
UnregisterSignal(source, COMSIG_BANK_ACCOUNT_DEBT_PAID)
///The debt was extinguished while the quirk holder was logged out, so let's kindly award it once they come back.
if(!quirk_holder.client)
RegisterSignal(quirk_holder, COMSIG_MOB_LOGIN, PROC_REF(award_on_login))
else
quirk_holder.client.give_award(/datum/award/achievement/misc/debt_extinguished, quirk_holder)
podspawn(list(
"target" = get_turf(quirk_holder),
"style" = /datum/pod_style/advanced,
"spawn" = /obj/item/clothing/accessory/debt_payer_pin,
))
/datum/quirk/indebted/proc/award_on_login(mob/source)
SIGNAL_HANDLER
quirk_holder.client.give_award(/datum/award/achievement/misc/debt_extinguished, quirk_holder)
UnregisterSignal(source, COMSIG_MOB_LOGIN)