Quirks send on_gain messages in fewer contexts (#91867)

## About The Pull Request

Quirks only send their on_gain text when given midround, such as by an
admin

## Why It's Good For The Game

Spams the hell out of you for no reason - in very few contexts are these
messages important (randomized allergies come to mind), but there are
other avenues to figure out (such as dogtags)


![image](https://github.com/user-attachments/assets/a1abb43b-edd0-4a08-8085-319ee216917a)

## Changelog

🆑 Melbert
qol: Quirks spam you less on roundstart or latejoin
/🆑
This commit is contained in:
MrMelbert
2025-06-29 12:42:59 -05:00
committed by GitHub
parent 5fb3d24f85
commit 08045236ca
17 changed files with 21 additions and 18 deletions

View File

@@ -90,6 +90,6 @@ GLOBAL_PROTECT(duplicate_forbidden_vars)
copied_implant.implant(made_copy, silent = TRUE, force = TRUE)
//transfer quirks, we do this because transfering the original's quirks keeps the 'owner' as the original.
for(var/datum/quirk/original_quirks as anything in original_living.quirks)
copied_living.add_quirk(original_quirks.type)
copied_living.add_quirk(original_quirks.type, announce = FALSE)
return made_copy

View File

@@ -94,7 +94,7 @@ PROCESSING_SUBSYSTEM_DEF(quirks)
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))
if(user.add_quirk(quirk_type, override_client = applied_client, announce = FALSE))
SSblackbox.record_feedback("tally", "quirks_taken", 1, "[quirk_name]")
else
stack_trace("Invalid quirk \"[quirk_name]\" in client [applied_client.ckey] preferences")

View File

@@ -66,7 +66,7 @@
* * new_holder - The mob to add this quirk to.
* * quirk_transfer - If this is being added to the holder as part of a quirk transfer. Quirks can use this to decide not to spawn new items or apply any other one-time effects.
*/
/datum/quirk/proc/add_to_holder(mob/living/new_holder, quirk_transfer = FALSE, client/client_source, unique = TRUE)
/datum/quirk/proc/add_to_holder(mob/living/new_holder, quirk_transfer = FALSE, client/client_source, unique = TRUE, announce = TRUE)
if(!new_holder)
CRASH("Quirk attempted to be added to null mob.")
@@ -98,7 +98,7 @@
START_PROCESSING(SSquirks, src)
if(!quirk_transfer)
if(gain_text)
if(gain_text && announce)
to_chat(quirk_holder, gain_text)
if (unique)
add_unique(client_source)
@@ -222,7 +222,7 @@
* * default_location - If the item isn't possible to equip in a valid slot, this is a description of where the item was spawned.
* * notify_player - If TRUE, adds strings to where_items_spawned list to be output to the player in [/datum/quirk/item_quirk/post_add()]
*/
/datum/quirk/item_quirk/proc/give_item_to_holder(obj/item/quirk_item, list/valid_slots, flavour_text = null, default_location = "at your feet", notify_player = TRUE)
/datum/quirk/item_quirk/proc/give_item_to_holder(obj/item/quirk_item, list/valid_slots, flavour_text = null, default_location = "at your feet", notify_player = FALSE)
if(ispath(quirk_item))
quirk_item = new quirk_item(get_turf(quirk_holder))

View File

@@ -39,7 +39,7 @@
var/mob/living/carbon/human/human_holder = quirk_holder
var/obj/item/clothing/accessory/dogtag/allergy/dogtag = new(get_turf(human_holder), allergy_string)
give_item_to_holder(dogtag, list(LOCATION_BACKPACK, LOCATION_HANDS), flavour_text = "Make sure medical staff can see this...")
give_item_to_holder(dogtag, list(LOCATION_BACKPACK, LOCATION_HANDS), flavour_text = "Make sure medical staff can see this...", notify_player = TRUE)
/datum/quirk/item_quirk/allergic/post_add()
quirk_holder.add_mob_memory(/datum/memory/key/quirk_allergy, allergy_string = allergy_string)

View File

@@ -26,6 +26,7 @@
LOCATION_HANDS,
),
flavour_text = "These will keep you alive until you can secure a supply of medication. Don't rely on them too much!",
notify_player = TRUE,
)
/datum/quirk/item_quirk/brainproblems/process(seconds_per_tick)

View File

@@ -14,5 +14,5 @@
quirk_holder.ForceContractDisease(hms)
/datum/quirk/item_quirk/chronic_illness/add_unique(client/client_source)
give_item_to_holder(/obj/item/storage/pill_bottle/sansufentanyl, list(LOCATION_BACKPACK), flavour_text = "You've been provided with medication to help manage your condition. Take it regularly to avoid complications.")
give_item_to_holder(/obj/item/storage/pill_bottle/sansufentanyl, list(LOCATION_BACKPACK), flavour_text = "You've been provided with medication to help manage your condition. Take it regularly to avoid complications.", notify_player = TRUE)
give_item_to_holder(/obj/item/healthanalyzer/simple/disease, list(LOCATION_BACKPACK))

View File

@@ -40,6 +40,7 @@
LOCATION_HANDS,
),
flavour_text = "This is a precious family heirloom, passed down from generation to generation. Keep it safe!",
notify_player = TRUE,
)
/datum/quirk/item_quirk/family_heirloom/post_add()

View File

@@ -46,4 +46,4 @@ GLOBAL_LIST_INIT(possible_food_allergies, list(
to_chat(client_source.mob, span_info("You are allergic to [what_are_we_actually_killed_by]. Watch what you eat!"))
var/obj/item/clothing/accessory/dogtag/allergy/dogtag = new(quirk_holder, what_are_we_actually_killed_by)
give_item_to_holder(dogtag, list(LOCATION_BACKPACK, LOCATION_HANDS), flavour_text = "Keep it close around the kitchen.")
give_item_to_holder(dogtag, list(LOCATION_BACKPACK, LOCATION_HANDS), flavour_text = "Keep it close around the kitchen.", notify_player = TRUE)

View File

@@ -24,6 +24,7 @@
LOCATION_HANDS,
),
flavour_text = "Given to you to aid in staying awake this shift...",
notify_player = TRUE,
)
/datum/quirk/item_quirk/narcolepsy/remove()

View File

@@ -21,7 +21,7 @@
associated_typepath = /datum/quirk/chipped
customization_options = list(/datum/preference/choiced/chipped)
/datum/quirk/chipped/add_to_holder(mob/living/new_holder, quirk_transfer, client/client_source, unique = TRUE)
/datum/quirk/chipped/add_to_holder(mob/living/new_holder, quirk_transfer, client/client_source, unique = TRUE, announce = FALSE)
var/chip_pref = client_source?.prefs?.read_preference(/datum/preference/choiced/chipped)
if(isnull(chip_pref))

View File

@@ -70,7 +70,7 @@
dna.copy_dna(subject.dna, COPY_DNA_SE|COPY_DNA_SPECIES)
for (var/quirk_type as anything in quirks)
subject.add_quirk(quirk_type, add_unique = FALSE)
subject.add_quirk(quirk_type, add_unique = FALSE, announce = FALSE)
for (var/trauma_type as anything in brain_traumas)
subject.gain_trauma(trauma_type)

View File

@@ -112,8 +112,8 @@
addObjectives()
addMemories()
equip_space_ninja(owner.current)
owner.current.add_quirk(/datum/quirk/freerunning)
owner.current.add_quirk(/datum/quirk/light_step)
owner.current.add_quirk(/datum/quirk/freerunning, announce = FALSE)
owner.current.add_quirk(/datum/quirk/light_step, announce = FALSE)
owner.current.mind.set_assigned_role(SSjob.get_job_type(/datum/job/space_ninja))
return ..()

View File

@@ -84,7 +84,7 @@ GLOBAL_LIST_EMPTY(wizard_spellbook_purchases_by_key)
CRASH("Wizard datum with no owner.")
assign_ritual()
equip_wizard()
owner.current.add_quirk(/datum/quirk/introvert)
owner.current.add_quirk(/datum/quirk/introvert, announce = FALSE)
if(give_objectives)
create_objectives()
if(move_to_lair)

View File

@@ -8,7 +8,7 @@
var/datum/quirk/quirk
/datum/corpse_flavor/quirk/apply_flavor(mob/living/carbon/human/working_dead, list/job_gear, list/datum/callback/on_revive_and_player_occupancy)
working_dead.add_quirk(quirk)
working_dead.add_quirk(quirk, announce = FALSE)
/datum/corpse_flavor/quirk/prosthetic_limb
quirk = /datum/quirk/prosthetic_limb

View File

@@ -124,6 +124,6 @@
var/datum/quirk/quirk_type = SSquirks.quirks[quirk_name]
if(!(initial(quirk_type.quirk_flags) & QUIRK_CHANGES_APPEARANCE))
continue
mannequin.add_quirk(quirk_type, parent)
mannequin.add_quirk(quirk_type, parent, announce = FALSE)
return mannequin.appearance

View File

@@ -299,7 +299,7 @@
clone.dress_up_as_job(SSjob.get_job(job))
for(var/datum/quirk/original_quircks as anything in quirks)
clone.add_quirk(original_quircks.type, override_client = client)
clone.add_quirk(original_quircks.type, override_client = client, announce = FALSE)
clone.updateappearance(mutcolor_update = TRUE, mutations_overlay_update = TRUE)

View File

@@ -450,14 +450,14 @@
*
* Returns TRUE on success, FALSE on failure (already has the quirk, etc)
*/
/mob/living/proc/add_quirk(datum/quirk/quirktype, client/override_client, add_unique = TRUE)
/mob/living/proc/add_quirk(datum/quirk/quirktype, client/override_client, add_unique = TRUE, announce = TRUE)
if(has_quirk(quirktype))
return FALSE
var/qname = initial(quirktype.name)
if(!SSquirks || !SSquirks.quirks[qname])
return FALSE
var/datum/quirk/quirk = new quirktype()
if(quirk.add_to_holder(new_holder = src, client_source = override_client, unique = add_unique))
if(quirk.add_to_holder(new_holder = src, client_source = override_client, unique = add_unique, announce = announce))
return TRUE
qdel(quirk)
return FALSE