Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix quirks not processing #5223

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 22 additions & 4 deletions code/datums/quirks/_quirk.dm
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,18 @@
/// The base weight for the each quirk's mail goodies list to be selected is 5
/// then the item selected is determined by pick(selected_quirk.mail_goodies)
var/list/mail_goodies = list() //Monkestation Edit BLOOD_DATUM: Why? this is already a list all this does is mess confuse us.
/// The minimum stat where this quirk can process (if it has QUIRK_PROCESSES)
var/minimum_process_stat = HARD_CRIT
/// The maximum stat below which this quirk can process (if it has QUIRK_PROCESSES), and above which it stops.
var/maximum_process_stat = HARD_CRIT
/// A list of additional signals to register with update_process()
var/list/process_update_signals
/// A list of traits that should stop this quirk from processing.
/// Signals for adding and removing this trait will automatically be added to `process_update_signals`.
var/list/no_process_traits

/datum/quirk/New()
. = ..()
for(var/trait in no_process_traits)
LAZYADD(process_update_signals, list(SIGNAL_ADDTRAIT(trait), SIGNAL_REMOVETRAIT(trait)))

/datum/quirk/Destroy()
if(quirk_holder)
Expand Down Expand Up @@ -81,7 +89,8 @@
add(client_source)

if(quirk_flags & QUIRK_PROCESSES)
RegisterSignal(quirk_holder, COMSIG_MOB_STATCHANGE, PROC_REF(on_stat_changed))
if(!isnull(maximum_process_stat))
RegisterSignal(quirk_holder, COMSIG_MOB_STATCHANGE, PROC_REF(on_stat_changed))
if(process_update_signals)
RegisterSignals(quirk_holder, process_update_signals, PROC_REF(update_process))
if(should_process())
Expand Down Expand Up @@ -161,7 +170,16 @@
/datum/quirk/proc/should_process()
SHOULD_CALL_PARENT(TRUE)
SHOULD_BE_PURE(TRUE)
return (quirk_flags & QUIRK_PROCESSES) && !QDELETED(quirk_holder) && quirk_holder.stat <= minimum_process_stat
if(QDELETED(quirk_holder))
return FALSE
if(!(quirk_flags & QUIRK_PROCESSES))
return FALSE
if(!isnull(maximum_process_stat) && quirk_holder.stat >= maximum_process_stat)
return FALSE
for(var/trait in no_process_traits)
if(HAS_TRAIT(quirk_holder, trait))
return FALSE
return TRUE

/// Checks to see if the quirk should be processing, and starts/stops it.
/datum/quirk/proc/update_process()
Expand Down
8 changes: 1 addition & 7 deletions code/datums/quirks/negative_quirks/allergic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@
hardcore_value = 3
quirk_flags = QUIRK_HUMAN_ONLY | QUIRK_PROCESSES
mail_goodies = list(/obj/item/reagent_containers/hypospray/medipen) // epinephrine medipen stops allergic reactions
process_update_signals = list(
SIGNAL_ADDTRAIT(TRAIT_STASIS),
SIGNAL_REMOVETRAIT(TRAIT_STASIS),
)
no_process_traits = list(TRAIT_STASIS)
var/list/allergies = list()
var/list/blacklist = list(
/datum/reagent/medicine/c2,
Expand Down Expand Up @@ -64,6 +61,3 @@
if(SPT_PROB(10, seconds_per_tick))
carbon_quirk_holder.vomit()
carbon_quirk_holder.adjustOrganLoss(pick(ORGAN_SLOT_BRAIN,ORGAN_SLOT_APPENDIX,ORGAN_SLOT_LUNGS,ORGAN_SLOT_HEART,ORGAN_SLOT_LIVER,ORGAN_SLOT_STOMACH),10)

/datum/quirk/item_quirk/allergic/should_process()
return iscarbon(quirk_holder) && ..() && !HAS_TRAIT(quirk_holder, TRAIT_STASIS)
8 changes: 1 addition & 7 deletions code/datums/quirks/negative_quirks/brain_problems.dm
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@
hardcore_value = 12
quirk_flags = QUIRK_HUMAN_ONLY | QUIRK_PROCESSES | QUIRK_DONT_CLONE // monkestation edit: QUIRK_DONT_CLONE (the cloner isn't gonna clone ur tumor lol)
mail_goodies = list(/obj/item/storage/pill_bottle/mannitol/braintumor)
process_update_signals = list(
SIGNAL_ADDTRAIT(TRAIT_TUMOR_SUPPRESSED),
SIGNAL_REMOVETRAIT(TRAIT_TUMOR_SUPPRESSED),
)
no_process_traits = list(TRAIT_TUMOR_SUPPRESSED)

/datum/quirk/item_quirk/brainproblems/add_unique(client/client_source)
give_item_to_holder(
Expand All @@ -33,6 +30,3 @@

/datum/quirk/item_quirk/brainproblems/process(seconds_per_tick)
quirk_holder.adjustOrganLoss(ORGAN_SLOT_BRAIN, 0.2 * seconds_per_tick)

/datum/quirk/item_quirk/brainproblems/should_process()
return ..() && !HAS_TRAIT(quirk_holder, TRAIT_TUMOR_SUPPRESSED)
10 changes: 2 additions & 8 deletions code/datums/quirks/negative_quirks/claustrophobia.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,9 @@
medical_record_text = "Patient demonstrates a fear of tight spaces."
hardcore_value = 5
quirk_flags = QUIRK_HUMAN_ONLY | QUIRK_PROCESSES
minimum_process_stat = CONSCIOUS
maximum_process_stat = SOFT_CRIT
mail_goodies = list(/obj/item/reagent_containers/syringe/convermol) // to help breathing
process_update_signals = list(
SIGNAL_ADDTRAIT(TRAIT_FEARLESS),
SIGNAL_REMOVETRAIT(TRAIT_FEARLESS),
)
no_process_traits = list(TRAIT_FEARLESS)

/datum/quirk/claustrophobia/remove()
quirk_holder.clear_mood_event("claustrophobia")
Expand All @@ -36,9 +33,6 @@
else
to_chat(quirk_holder, span_warning("You feel trapped! Must escape... can't breathe..."))

/datum/quirk/claustrophobia/should_process()
return ..() && !HAS_TRAIT(quirk_holder, TRAIT_FEARLESS)

///investigates whether possible_saint_nick possesses a high level of christmas cheer
/datum/quirk/claustrophobia/proc/evaluate_jolly_levels(mob/living/carbon/human/possible_saint_nick)
if(!istype(possible_saint_nick))
Expand Down
8 changes: 1 addition & 7 deletions code/datums/quirks/negative_quirks/junkie.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@
hardcore_value = 4
quirk_flags = QUIRK_HUMAN_ONLY | QUIRK_PROCESSES | QUIRK_DONT_CLONE
mail_goodies = list(/obj/effect/spawner/random/contraband/narcotics)
process_update_signals = list(
SIGNAL_ADDTRAIT(TRAIT_LIVERLESS_METABOLISM),
SIGNAL_REMOVETRAIT(TRAIT_LIVERLESS_METABOLISM),
)
no_process_traits = list(TRAIT_LIVERLESS_METABOLISM)
var/drug_list = list(/datum/reagent/drug/blastoff, /datum/reagent/drug/krokodil, /datum/reagent/medicine/painkiller/morphine, /datum/reagent/drug/happiness, /datum/reagent/drug/methamphetamine) //List of possible IDs
var/datum/reagent/reagent_type //!If this is defined, reagent_id will be unused and the defined reagent type will be instead.
var/datum/reagent/reagent_instance //! actual instanced version of the reagent
Expand Down Expand Up @@ -86,9 +83,6 @@
for(var/addiction in reagent_instance.addiction_types)
human_holder.last_mind?.add_addiction_points(addiction, 1000) ///Max that shit out

/datum/quirk/item_quirk/junkie/should_process()
return ..() && !HAS_TRAIT(quirk_holder, TRAIT_LIVERLESS_METABOLISM)

/datum/quirk/item_quirk/junkie/smoker
name = "Smoker"
desc = "Sometimes you just really want a smoke. Probably not great for your lungs."
Expand Down
2 changes: 1 addition & 1 deletion code/datums/quirks/positive_quirks/drunk_healing.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
lose_text = span_danger("You no longer feel like drinking would ease your pain.")
medical_record_text = "Patient has unusually efficient liver metabolism and can slowly regenerate wounds by drinking alcoholic beverages."
quirk_flags = QUIRK_HUMAN_ONLY | QUIRK_PROCESSES
minimum_process_stat = DEAD // it processed before while dead, so I'm keeping it that way
maximum_process_stat = DEAD // it processed before while dead, so I'm keeping it that way
mail_goodies = list(/obj/effect/spawner/random/food_or_drink/booze)

/datum/quirk/drunkhealing/process(seconds_per_tick)
Expand Down
Loading