[MIRROR] Refactors some trauma code, fixes some trauma heals not working (#5955)
* Refactors some trauma code, fixes some trauma heals not working (#36093) * Refactors some trauma code, fixes some trauma heals not working * that too * fix indent * antur comments * Refactors some trauma code, fixes some trauma heals not working
This commit is contained in:
committed by
Poojawa
parent
31d988344a
commit
0bf1f7ce14
@@ -12,14 +12,6 @@
|
||||
var/can_gain = TRUE //can this be gained through random traumas?
|
||||
var/resilience = TRAUMA_RESILIENCE_BASIC //how hard is this to cure?
|
||||
|
||||
/datum/brain_trauma/New(obj/item/organ/brain/B, _resilience)
|
||||
brain = B
|
||||
owner = B.owner
|
||||
if(_resilience)
|
||||
resilience = _resilience
|
||||
if(owner)
|
||||
on_gain()
|
||||
|
||||
/datum/brain_trauma/Destroy()
|
||||
brain.traumas -= src
|
||||
if(owner)
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
var/list/trigger_turfs
|
||||
var/list/trigger_species
|
||||
|
||||
/datum/brain_trauma/mild/phobia/New(mob/living/carbon/C, _permanent, specific_type)
|
||||
/datum/brain_trauma/mild/phobia/New(specific_type)
|
||||
phobia_type = specific_type
|
||||
if(!phobia_type)
|
||||
phobia_type = pick(SStraumas.phobia_types)
|
||||
|
||||
@@ -1026,7 +1026,7 @@
|
||||
to_chat(usr, "This can only be done to instances of type /mob/living/carbon")
|
||||
return
|
||||
|
||||
C.cure_all_traumas(TRUE, TRAUMA_RESILIENCE_ABSOLUTE)
|
||||
C.cure_all_traumas(TRAUMA_RESILIENCE_ABSOLUTE)
|
||||
|
||||
href_list["datumrefresh"] = href_list["curetraumas"]
|
||||
|
||||
|
||||
@@ -236,16 +236,26 @@
|
||||
item_state = "foilhat"
|
||||
armor = list("melee" = 0, "bullet" = 0, "laser" = -5,"energy" = 0, "bomb" = 0, "bio" = 0, "rad" = -5, "fire" = 0, "acid" = 0)
|
||||
equip_delay_other = 140
|
||||
var/datum/brain_trauma/mild/phobia/paranoia
|
||||
|
||||
/obj/item/clothing/head/foilhat/equipped(mob/living/carbon/human/user, slot)
|
||||
..()
|
||||
if(slot == slot_head)
|
||||
user.gain_trauma(/datum/brain_trauma/mild/phobia, FALSE, "conspiracies")
|
||||
if(paranoia)
|
||||
QDEL_NULL(paranoia)
|
||||
paranoia = new()
|
||||
user.gain_trauma(paranoia, TRAUMA_RESILIENCE_MAGIC, "conspiracies")
|
||||
to_chat(user, "<span class='warning'>As you don the foiled hat, an entire world of conspiracy theories and seemingly insane ideas suddenly rush into your mind. What you once thought unbelievable suddenly seems.. undeniable. Everything is connected and nothing happens just by accident. You know too much and now they're out to get you. </span>")
|
||||
|
||||
/obj/item/clothing/head/foilhat/dropped(mob/user)
|
||||
..()
|
||||
if(paranoia)
|
||||
QDEL_NULL(paranoia)
|
||||
|
||||
/obj/item/clothing/head/foilhat/attack_hand(mob/user)
|
||||
if(iscarbon(user))
|
||||
var/mob/living/carbon/C = user
|
||||
if(src == C.head)
|
||||
to_chat(user, "<span class='userdanger'>Why would you want to take this off? Do you want them to get into your mind?!</span>")
|
||||
to_chat(user, "<span class='userdanger'>Why would you want to take this off? Do you want them to get into your mind?!</span>")
|
||||
return
|
||||
..()
|
||||
|
||||
@@ -222,16 +222,21 @@
|
||||
/obj/item/organ/brain/proc/gain_trauma(datum/brain_trauma/trauma, resilience, list/arguments)
|
||||
if(!can_gain_trauma(trauma, resilience))
|
||||
return
|
||||
var/trauma_type
|
||||
if(ispath(trauma))
|
||||
trauma_type = trauma
|
||||
SSblackbox.record_feedback("tally", "traumas", 1, trauma_type)
|
||||
traumas += new trauma_type(arglist(list(src, resilience) + arguments))
|
||||
trauma = new(arglist(arguments))
|
||||
else
|
||||
SSblackbox.record_feedback("tally", "traumas", 1, trauma.type)
|
||||
traumas += trauma
|
||||
if(resilience)
|
||||
trauma.resilience = resilience
|
||||
if(trauma.brain) //we don't accept used traumas here
|
||||
WARNING("gain_trauma was given an already active trauma.")
|
||||
return
|
||||
|
||||
traumas += trauma
|
||||
trauma.brain = src
|
||||
if(owner)
|
||||
trauma.owner = owner
|
||||
trauma.on_gain()
|
||||
if(resilience)
|
||||
trauma.resilience = resilience
|
||||
SSblackbox.record_feedback("tally", "traumas", 1, trauma.type)
|
||||
|
||||
//Add a random trauma of a certain subtype
|
||||
/obj/item/organ/brain/proc/gain_trauma_type(brain_trauma_type = /datum/brain_trauma, resilience)
|
||||
|
||||
@@ -789,7 +789,7 @@
|
||||
update_handcuffed()
|
||||
if(reagents)
|
||||
reagents.addiction_list = list()
|
||||
cure_all_traumas(TRUE, TRAUMA_RESILIENCE_MAGIC)
|
||||
cure_all_traumas(TRAUMA_RESILIENCE_MAGIC)
|
||||
..()
|
||||
// heal ears after healing traits, since ears check TRAIT_DEAF trait
|
||||
// when healing.
|
||||
|
||||
@@ -264,6 +264,7 @@
|
||||
overdose_threshold = 20
|
||||
addiction_threshold = 10
|
||||
taste_description = "salt" // because they're bathsalts?
|
||||
var/datum/brain_trauma/special/psychotic_brawling/bath_salts/rage
|
||||
|
||||
/datum/reagent/drug/bath_salts/on_mob_add(mob/M)
|
||||
..()
|
||||
@@ -273,17 +274,16 @@
|
||||
L.add_trait(TRAIT_SLEEPIMMUNE, id)
|
||||
if(iscarbon(L))
|
||||
var/mob/living/carbon/C = L
|
||||
C.gain_trauma(/datum/brain_trauma/special/psychotic_brawling/bath_salts, TRAUMA_RESILIENCE_ABSOLUTE)
|
||||
rage = new()
|
||||
C.gain_trauma(rage, TRAUMA_RESILIENCE_ABSOLUTE)
|
||||
|
||||
/datum/reagent/drug/bath_salts/on_mob_delete(mob/M)
|
||||
if(isliving(M))
|
||||
var/mob/living/L = M
|
||||
L.remove_trait(TRAIT_STUNIMMUNE, id)
|
||||
L.remove_trait(TRAIT_SLEEPIMMUNE, id)
|
||||
if(iscarbon(L))
|
||||
var/mob/living/carbon/C = L
|
||||
for(var/datum/brain_trauma/special/psychotic_brawling/bath_salts/T in C.get_traumas())
|
||||
qdel(T)
|
||||
if(rage)
|
||||
QDEL_NULL(rage)
|
||||
..()
|
||||
|
||||
/datum/reagent/drug/bath_salts/on_mob_life(mob/living/M)
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
M.confused = 0
|
||||
M.SetSleeping(0, 0)
|
||||
M.jitteriness = 0
|
||||
M.cure_all_traumas(TRUE, TRAUMA_RESILIENCE_MAGIC)
|
||||
M.cure_all_traumas(TRAUMA_RESILIENCE_MAGIC)
|
||||
for(var/thing in M.diseases)
|
||||
var/datum/disease/D = thing
|
||||
if(D.severity == DISEASE_SEVERITY_POSITIVE)
|
||||
|
||||
Reference in New Issue
Block a user