mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-14 09:35:30 +01:00
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.  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>
This commit is contained in:
@@ -61,19 +61,19 @@ PROCESSING_SUBSYSTEM_DEF(quirks)
|
||||
continue
|
||||
hardcore_quirks[quirk_type] += hardcore_value
|
||||
|
||||
/datum/controller/subsystem/processing/quirks/proc/AssignQuirks(mob/living/user, client/cli)
|
||||
/datum/controller/subsystem/processing/quirks/proc/AssignQuirks(mob/living/user, client/applied_client)
|
||||
var/badquirk = FALSE
|
||||
for(var/quirk_name in cli.prefs.all_quirks)
|
||||
var/datum/quirk/Q = quirks[quirk_name]
|
||||
if(Q)
|
||||
if(user.add_quirk(Q))
|
||||
for(var/quirk_name in applied_client.prefs.all_quirks)
|
||||
var/datum/quirk/quirk_type = quirks[quirk_name]
|
||||
if(ispath(quirk_type))
|
||||
if(user.add_quirk(quirk_type, override_client = applied_client))
|
||||
SSblackbox.record_feedback("nested tally", "quirks_taken", 1, list("[quirk_name]"))
|
||||
else
|
||||
stack_trace("Invalid quirk \"[quirk_name]\" in client [cli.ckey] preferences")
|
||||
cli.prefs.all_quirks -= quirk_name
|
||||
stack_trace("Invalid quirk \"[quirk_name]\" in client [applied_client.ckey] preferences")
|
||||
applied_client.prefs.all_quirks -= quirk_name
|
||||
badquirk = TRUE
|
||||
if(badquirk)
|
||||
cli.prefs.save_character()
|
||||
applied_client.prefs.save_character()
|
||||
|
||||
/*
|
||||
*Randomises the quirks for a specified mob
|
||||
@@ -154,7 +154,7 @@ PROCESSING_SUBSYSTEM_DEF(quirks)
|
||||
if (isnull(quirk))
|
||||
continue
|
||||
|
||||
if (initial(quirk.mood_quirk) && CONFIG_GET(flag/disable_human_mood))
|
||||
if ((initial(quirk.quirk_flags) & QUIRK_MOODLET_BASED) && CONFIG_GET(flag/disable_human_mood))
|
||||
continue
|
||||
|
||||
var/blacklisted = FALSE
|
||||
|
||||
Reference in New Issue
Block a user