Files
Bubberstation/code/modules/client/preferences/heterochromatic.dm
MrMelbert 717e4f435c Quirks are passed an incoming client when applied, allowing quirks to read preferences in add and add_unique. Renders visual quirks on the preference menu dummy. (#72158)
## About The Pull Request

Closes #72141

Roundstart humans weren't in control of their mob by the time
`AssignQuirks` was called.
The call chain for roundstart goes `create_characters` ->
`equip_characters` -> `AssignQuirks` -> `transfer_characters`.
For latejoin, `create_character` -> `transfer_character` ->
`AssignQuirks`.

I could simply move around the call chain, but that feels much more
fragile and more liable to cause other issues to me. So instead, I
simply allowed add quirk to be passed a client, so that a client's
quirks can be applied to a mob they are not currently inhabiting.

In doing this, it became possible to show visual quirks on the prefs
dummy, like nearsighted glasses and heterochromia. So I put in a little
work to accomplish that as well.


![image](https://user-images.githubusercontent.com/51863163/209030560-58396d43-6ac2-40c5-b13f-1178dc8962fd.png)

Along side, some refactoring and documentation for quirk datums. 

## Why It's Good For The Game

People get what they expect on roundstart. 

## Changelog

🆑 Melbert
qol: The preview dummy in the preferences menu now shows some visual
quirks, like Heterochromia or nearsighted.
fix: Fixed some quirks which read a preference roundstart not applying
the preference.
refactor: Refactored some bits of quirk datums and the quirk application
process.
/🆑

Co-authored-by: Time-Green <timkoster1@hotmail.com>
2022-12-24 12:32:13 +00:00

15 lines
564 B
Plaintext

/datum/preference/color/heterochromatic
category = PREFERENCE_CATEGORY_SECONDARY_FEATURES
savefile_key = "heterochromatic"
savefile_identifier = PREFERENCE_CHARACTER
/datum/preference/color/heterochromatic/is_accessible(datum/preferences/preferences)
if (!..(preferences))
return FALSE
return "Heterochromatic" in preferences.all_quirks
/datum/preference/color/heterochromatic/apply_to_human(mob/living/carbon/human/target, value)
var/datum/quirk/heterochromatic/hetero_quirk = locate() in target.quirks
hetero_quirk?.apply_heterochromatic_eyes(value)