mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
* TGUI Preferences Menu + total rewrite of the preferences backend (#17368) * It compiles * It opens * Sync 1 * Add asset caching * Sync 2 * It opens without dev now * Update a few packages * Sync 3 * Sync 4 keybind fix * start of dehardcoded species * Small fixes * Add more individual preferences * ASS sync * Automatic changelog generation #17368 [ci skip] * AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH * e * Fix some TS stuff * Sort quirks starting from good * Fix skin tone selector * Jamie Fixes * Update moth.dm * Fix latejoin menu + tweaks * Some fixes * Finally fix job selection * e * Ling * MORE * config * Convert pref: ooccolor * Convert pref: asay color * Convert pref: tooltips * Convert pref: ui style * Convert pref: buttons locked * Convert pref: hotkeys * Convert pref: tgui stuff * Convert pref: windowflashing * Convert pref: ghost stuff * Convert pref: map & antag * Convert pref: PDA stuff * Convert pref: credits & glasses 1 * Convert pref: name * Convert pref: appearances 1 * Convert pref: appearances 2 * Convert pref: jobless role * Convert pref: runechat * Convert pref: yogtoggles + tail wagging 1 * Convert pref: client fps * Convert pref: graphic settings * Convert pref: pda uplink & menuoptions * Convert pref: map & flare * Convert pref: Bar choice * Fix setup character button * Convert pref: alt announcer * Fix * Add cycle background button * Convert pref: disable balloon alert * fix * Clean savefile * Fix backpack pref * Fix underwear selection * Fixes some shit * Updates * Fix computer runtime * Fix pref names * Convert pref: donor item & hat * More computer fixes * Convert pref: borg hat * Convert pref: donor pda (broken) * Convert pref: purrbation * Convert pref: afreeze * Convert pref: accent * Various savefile improvements * Convert pref: persistent scars 1 * A few pref fixes * Some more fixes * Various SSoverlays improvements * Add IPC appearances * Add polysmorph appearances * No icons for ipc and polysmorph * Podpeople deserve death * Add plasmaman appearance * h * fix * fix2 * asdf * fsdf * aaaaa * FUCK MOTHS * Preternis color * e * e * Update human.dmi * icon fix * un snowflake * fix underwear icon * remove color from here * donor ree * aa * maybe * Restore a bunch of TGUI files * More TGUI fixes * test * Fix more errors * a * test * e? * a;lso this * maybe * Fix * Revert "maybe" This reverts commit14d044a7e3. * fuck off m8 * e * fak off m8 * e2? * AHHH * AHA * AHHH * fix linter 2 * debug * fix runtime * Update dynamic.json * Revert "debug" This reverts commit18681432bd. * 2 * who sleeps in an async? * Hack * e * Fix a few blocking calls * Oh bother * Stay dead * fuck * Update jobs.dm * move debugging * Update jobs.dm * Test * YEET * Revert "YEET" This reverts commit4082e3b133. * Update jobs.dm * Update jobs.dm * e * Fix sechailer runtime * Fix human hair color * d * Ports part of that job refactor * Convert latejoin to new departments * Fix ghost form * Quirk validation * Hopefully pod color fix * oops * Prayge job fix * test * Better unit test asset loading * Remove print * Add error just in case * Remove brief outfit and bypass centcom deadmin * Remove broadcast login/logout * Remove darkened flash * Remove fov darkness * Remove ghost lighting * Remove some tgui prefs * Typo fix * Small fixes * IPC name fix * IPC and pod colors * Jobless fix * Donor item fix * Oopsie * Quirk bandaid * Misc * Move new prefs to Preferences tab for now * Add skillcape * FUCK THIS SHIT * Remove /tg/ gamer cloak * Restrict some job related preferences to clean up UI * Remove useless client var * e * Small tweaks * Dont allow selecting mood quirks if mood is disabled * AHHH * Filter ckey-locked donor items * stupid jamie * AI core display fix * Move donor stuff back to the top * Remove TODOs * Clean up perks * Linter fixes * e * WORKS * LORE * Fix skillcape list * Backpack why * Fixes * Fix cargo console * Remove these * Add horns, frills and mark * Fix not applying all features * Add some missing mutant bodyparts * Update numberinput * Makes animatednumber cooler * Oops * Add default ghost orbit * Default to normal backpack * Fixes skillcapes not being filtered * Donor fix prayge * yep * Adds fallback latejoin menu * Rework donor stuff a bit * Fix donor tgui logic * Delete unused proc * Update FA * Un-yogify quirks * Better checking of quirks * Update tgfont * Fix quirk icons * Fix backup name * Fix donor stuff * A few runtime fixes * Fix another runtime * Give fallback latejoin verb upon connecting * Update AirAlarm interface * maybe this works * Test * Sentient * Remove AI core display preview icons * Fix resetting plasmaman helmet style * Equip plasman in preview * Fix plasmaman preview icon * fuck keybind fix * Extra keybind sanity --------- Co-authored-by: Yogbot-13 <admin@yogstation.net> Co-authored-by: Jamie D <993128+JamieD1@users.noreply.github.com> Co-authored-by: TheGamerdk <5618080+TheGamerdk@users.noreply.github.com> Co-authored-by: adamsong <adamsong@users.noreply.github.com>
130 lines
4.2 KiB
Plaintext
130 lines
4.2 KiB
Plaintext
//Used to process and handle roundstart quirks
|
|
// - Quirk strings are used for faster checking in code
|
|
// - Quirk datums are stored and hold different effects, as well as being a vector for applying trait string
|
|
PROCESSING_SUBSYSTEM_DEF(quirks)
|
|
name = "Quirks"
|
|
init_order = INIT_ORDER_QUIRKS
|
|
flags = SS_BACKGROUND
|
|
wait = 1 SECONDS
|
|
runlevels = RUNLEVEL_GAME
|
|
|
|
var/list/quirks = list() //Assoc. list of all roundstart quirk datum types; "name" = /path/
|
|
var/list/quirk_points = list() //Assoc. list of quirk names and their "point cost"; positive numbers are good traits, and negative ones are bad
|
|
var/list/quirk_objects = list() //A list of all quirk objects in the game, since some may process
|
|
var/list/quirk_blacklist = list() //A list a list of quirks that can not be used with each other. Format: list(quirk1,quirk2),list(quirk3,quirk4)
|
|
|
|
/datum/controller/subsystem/processing/quirks/Initialize(timeofday)
|
|
if(!quirks.len)
|
|
SetupQuirks()
|
|
|
|
quirk_blacklist = list(
|
|
list("Blind","Nearsighted"),
|
|
list("Jolly","Depression","Apathetic","Hypersensitive"),
|
|
list("Ageusia","Vegetarian","Deviant Tastes"),
|
|
list("Ananas Affinity","Ananas Aversion"),
|
|
list("Alcohol Tolerance","Light Drinker"),
|
|
list("Prosthetic Limb (Left Arm)","Prosthetic Limb"),
|
|
list("Prosthetic Limb (Right Arm)","Prosthetic Limb"),
|
|
list("Prosthetic Limb (Left Leg)","Prosthetic Limb"),
|
|
list("Prosthetic Limb (Right Leg)","Prosthetic Limb"),
|
|
list("Prosthetic Limb (Left Leg)","Paraplegic"),
|
|
list("Prosthetic Limb (Right Leg)","Paraplegic"),
|
|
list("Prosthetic Limb","Paraplegic")
|
|
)
|
|
return SS_INIT_SUCCESS
|
|
|
|
/datum/controller/subsystem/processing/quirks/proc/SetupQuirks()
|
|
// Sort by Positive, Negative, Neutral; and then by name
|
|
var/list/quirk_list = sortList(subtypesof(/datum/quirk), /proc/cmp_quirk_asc)
|
|
|
|
for(var/V in quirk_list)
|
|
var/datum/quirk/T = V
|
|
quirks[initial(T.name)] = T
|
|
quirk_points[initial(T.name)] = initial(T.value)
|
|
|
|
/datum/controller/subsystem/processing/quirks/proc/AssignQuirks(mob/living/user, client/cli, spawn_effects)
|
|
if(!checkquirks(user,cli)) return// Yogs -- part of Adding Mood as Preference
|
|
|
|
var/badquirk = FALSE
|
|
|
|
for(var/V in cli.prefs.all_quirks)
|
|
var/datum/quirk/Q = quirks[V]
|
|
if(Q)
|
|
user.add_quirk(Q, spawn_effects)
|
|
else
|
|
stack_trace("Invalid quirk \"[V]\" in client [cli.ckey] preferences")
|
|
cli.prefs.all_quirks -= V
|
|
badquirk = TRUE
|
|
if(badquirk)
|
|
cli.prefs.save_character()
|
|
|
|
/// Takes a list of quirk names and returns a new list of quirks that would
|
|
/// be valid.
|
|
/// If no changes need to be made, will return the same list.
|
|
/// Expects all quirk names to be unique, but makes no other expectations.
|
|
/datum/controller/subsystem/processing/quirks/proc/filter_invalid_quirks(list/quirks, client/C)
|
|
var/list/new_quirks = list()
|
|
var/list/positive_quirks = list()
|
|
var/balance = 0
|
|
|
|
// If moods are globally enabled, or this guy does indeed have his mood pref set to Enabled
|
|
var/ismoody = (!CONFIG_GET(flag/disable_human_mood) || (C.prefs.yogtoggles & PREF_MOOD))
|
|
|
|
for (var/quirk_name in quirks)
|
|
var/datum/quirk/quirk = SSquirks.quirks[quirk_name]
|
|
if (isnull(quirk))
|
|
continue
|
|
|
|
if (initial(quirk.mood_quirk) && !ismoody)
|
|
continue
|
|
|
|
// Returns error string, FALSE if quirk is okay to have
|
|
var/datum/quirk/quirk_obj = new quirk(no_init = TRUE)
|
|
if (quirk_obj?.check_quirk(C.prefs))
|
|
continue
|
|
qdel(quirk_obj)
|
|
|
|
var/blacklisted = FALSE
|
|
|
|
for (var/list/blacklist as anything in quirk_blacklist)
|
|
if (!(quirk in blacklist))
|
|
continue
|
|
|
|
for (var/other_quirk in blacklist)
|
|
if (other_quirk in new_quirks)
|
|
blacklisted = TRUE
|
|
break
|
|
|
|
if (blacklisted)
|
|
break
|
|
|
|
if (blacklisted)
|
|
continue
|
|
|
|
var/value = initial(quirk.value)
|
|
if (value > 0)
|
|
if (positive_quirks.len == MAX_QUIRKS)
|
|
continue
|
|
|
|
positive_quirks[quirk_name] = value
|
|
|
|
balance += value
|
|
new_quirks += quirk_name
|
|
|
|
if (balance > 0)
|
|
var/balance_left_to_remove = balance
|
|
|
|
for (var/positive_quirk in positive_quirks)
|
|
var/value = positive_quirks[positive_quirk]
|
|
balance_left_to_remove -= value
|
|
new_quirks -= positive_quirk
|
|
|
|
if (balance_left_to_remove <= 0)
|
|
break
|
|
|
|
// It is guaranteed that if no quirks are invalid, you can simply check through `==`
|
|
if (new_quirks.len == quirks.len)
|
|
return quirks
|
|
|
|
return new_quirks
|