Brain Traumas

This commit is contained in:
XDTM
2017-12-06 19:04:17 +01:00
committed by CitadelStationBot
parent e7e9a4cc9b
commit 988dbe87da
73 changed files with 1622 additions and 105 deletions
+49
View File
@@ -0,0 +1,49 @@
//Brain Traumas are the new actual brain damage. Brain damage itself acts as a way to acquire traumas: every time brain damage is dealt, there's a chance of receiving a trauma.
//This chance gets higher the higher the mob's brainloss is. Removing traumas is a separate thing from removing brain damage: you can get restored to full brain operativity,
//but keep the quirks, until repaired by mannitol (for mild/special ones) or brain surgery (for severe ones).
/datum/brain_trauma
var/name = "Brain Trauma"
var/desc = "A trauma caused by brain damage, which causes issues to the patient."
var/scan_desc = "a generic brain trauma" //description when detected by a health scanner
var/mob/living/carbon/owner //the poor bastard
var/obj/item/organ/brain/brain //the poor bastard's brain
var/gain_text = "<span class='notice'>You feel traumatized.</span>"
var/lose_text = "<span class='notice'>You no longer feel traumatized.</span>"
var/can_gain = TRUE //can this be gained through random traumas?
var/permanent = FALSE //can this be cured?
/datum/brain_trauma/New(obj/item/organ/brain/B, _permanent)
brain = B
owner = B.owner
permanent = _permanent
if(owner)
on_gain()
/datum/brain_trauma/Destroy()
brain.traumas -= src
if(owner)
on_lose()
brain = null
owner = null
return ..()
//Called on life ticks
/datum/brain_trauma/proc/on_life()
return
//Called when given to a mob
/datum/brain_trauma/proc/on_gain()
to_chat(owner, gain_text)
//Called when removed from a mob
/datum/brain_trauma/proc/on_lose(silent)
if(!silent)
to_chat(owner, lose_text)
//Called when hearing a spoken message
/datum/brain_trauma/proc/on_hear(message, speaker, message_language, raw_message, radio_freq)
return message
//Called when speaking
/datum/brain_trauma/proc/on_say(message)
return message
+135
View File
@@ -0,0 +1,135 @@
//Mild traumas are the most common; they are generally minor annoyances.
//They can be cured with mannitol and patience, although brain surgery still works.
//Most of the old brain damage effects have been transferred to the dumbness trauma.
/datum/brain_trauma/mild
/datum/brain_trauma/mild/hallucinations
name = "Hallucinations"
desc = "Patient suffers constant hallucinations."
scan_desc = "schizophrenia"
gain_text = "<span class='warning'>You feel your grip on reality slipping...</span>"
lose_text = "<span class='notice'>You feel more grounded.</span>"
/datum/brain_trauma/mild/hallucinations/on_life()
owner.hallucination = min(owner.hallucination + 10, 50)
..()
/datum/brain_trauma/mild/hallucinations/on_lose()
owner.hallucination = 0
..()
/datum/brain_trauma/mild/stuttering
name = "Stuttering"
desc = "Patient can't speak properly."
scan_desc = "reduced mouth coordination"
gain_text = "<span class='warning'>Speaking clearly is getting harder.</span>"
lose_text = "<span class='notice'>You feel in control of your speech.</span>"
/datum/brain_trauma/mild/stuttering/on_life()
owner.stuttering = min(owner.stuttering + 5, 25)
..()
/datum/brain_trauma/mild/stuttering/on_lose()
owner.stuttering = 0
..()
/datum/brain_trauma/mild/dumbness
name = "Dumbness"
desc = "Patient has reduced brain activity, making them less intelligent."
scan_desc = "reduced brain activity"
gain_text = "<span class='warning'>You feel dumber.</span>"
lose_text = "<span class='notice'>You feel smart again.</span>"
/datum/brain_trauma/mild/dumbness/on_gain()
owner.disabilities |= DUMB
..()
/datum/brain_trauma/mild/dumbness/on_life()
owner.derpspeech = min(owner.derpspeech + 5, 25)
if(prob(3))
owner.emote("drool")
else if(owner.stat == CONSCIOUS && prob(3))
owner.say(pick_list_replacements(BRAIN_DAMAGE_FILE, "brain_damage"))
..()
/datum/brain_trauma/mild/dumbness/on_lose()
owner.disabilities &= ~DUMB
owner.derpspeech = 0
..()
/datum/brain_trauma/mild/speech_impediment
name = "Speech Impediment"
desc = "Patient is unable to form coherent sentences."
scan_desc = "communication disorder"
gain_text = "" //mutation will handle the text
lose_text = ""
/datum/brain_trauma/mild/speech_impediment/on_gain()
owner.dna.add_mutation(UNINTELLIGIBLE)
..()
//no fiddling with genetics to get out of this one
/datum/brain_trauma/mild/speech_impediment/on_life()
if(!(GLOB.mutations_list[UNINTELLIGIBLE] in owner.dna.mutations))
on_gain()
..()
/datum/brain_trauma/mild/speech_impediment/on_lose()
owner.dna.remove_mutation(UNINTELLIGIBLE)
..()
/datum/brain_trauma/mild/concussion
name = "Concussion"
desc = "Patient's brain is concussed."
scan_desc = "a concussion"
gain_text = "<span class='warning'>Your head hurts!</span>"
lose_text = "<span class='notice'>The pressure inside your head starts fading.</span>"
/datum/brain_trauma/mild/concussion/on_life()
if(prob(5))
switch(rand(1,11))
if(1)
owner.vomit()
if(2,3)
owner.dizziness += 10
if(4,5)
owner.confused += 10
owner.blur_eyes(10)
if(6 to 9)
owner.slurring += 30
if(10)
to_chat(owner, "<span class='notice'>You forget for a moment what you were doing.</span>")
owner.Stun(20)
if(11)
to_chat(owner, "<span class='warning'>You faint.</span>")
owner.Unconscious(80)
..()
/datum/brain_trauma/mild/muscle_weakness
name = "Muscle Weakness"
desc = "Patient experiences occasional bouts of muscle weakness."
scan_desc = "weak motor nerve signal"
gain_text = "<span class='warning'>Your muscles feel oddly faint.</span>"
lose_text = "<span class='notice'>You feel in control of your muscles again.</span>"
/datum/brain_trauma/mild/muscle_weakness/on_life()
var/fall_chance = 1
if(owner.m_intent == MOVE_INTENT_RUN)
fall_chance += 2
if(prob(fall_chance) && !owner.lying && !owner.buckled)
to_chat(owner, "<span class='warning'>Your leg gives out!</span>")
owner.Knockdown(35)
else if(owner.get_active_held_item())
var/drop_chance = 1
var/obj/item/I = owner.get_active_held_item()
drop_chance += I.w_class
if(prob(drop_chance) && owner.dropItemToGround(I))
to_chat(owner, "<span class='warning'>You drop [I]!</span>")
else if(prob(3))
to_chat(owner, "<span class='warning'>You feel a sudden weakness in your muscles!</span>")
owner.adjustStaminaLoss(50)
..()
+115
View File
@@ -0,0 +1,115 @@
/datum/brain_trauma/mild/phobia
name = "Phobia"
desc = "Patient is unreasonably afraid of something."
scan_desc = "phobia"
gain_text = ""
lose_text = ""
var/phobia_type
var/next_check = 0
var/next_scare = 0
var/list/trigger_words
//instead of cycling every atom, only cycle the relevant types
var/list/trigger_mobs
var/list/trigger_objs //also checked in mob equipment
var/list/trigger_turfs
var/list/trigger_species
/datum/brain_trauma/mild/phobia/New(mob/living/carbon/C, _permanent, specific_type)
phobia_type = specific_type
if(!phobia_type)
phobia_type = pick(SStraumas.phobia_types)
gain_text = "<span class='warning'>You start finding [phobia_type] very unnerving...</span>"
lose_text = "<span class='notice'>You no longer feel afraid of [phobia_type].</span>"
scan_desc += " of [phobia_type]"
trigger_words = SStraumas.phobia_words[phobia_type]
trigger_mobs = SStraumas.phobia_mobs[phobia_type]
trigger_objs = SStraumas.phobia_objs[phobia_type]
trigger_turfs = SStraumas.phobia_turfs[phobia_type]
trigger_species = SStraumas.phobia_species[phobia_type]
..()
/datum/brain_trauma/mild/phobia/on_life()
..()
if(owner.eye_blind)
return
if(world.time > next_check && world.time > next_scare)
next_check = world.time + 50
var/list/seen_atoms = view(7, owner)
if(LAZYLEN(trigger_objs))
for(var/obj/O in seen_atoms)
if(is_type_in_typecache(O, trigger_objs))
freak_out(O)
return
if(LAZYLEN(trigger_turfs))
for(var/turf/T in seen_atoms)
if(is_type_in_typecache(T, trigger_turfs))
freak_out(T)
return
if(LAZYLEN(trigger_mobs) || LAZYLEN(trigger_objs))
for(var/mob/M in seen_atoms)
if(is_type_in_typecache(M, trigger_mobs))
freak_out(M)
return
else if(ishuman(M)) //check their equipment for trigger items
var/mob/living/carbon/human/H = M
if(LAZYLEN(trigger_species) && H.dna && H.dna.species && is_type_in_typecache(H.dna.species, trigger_species))
freak_out(H)
for(var/X in H.get_all_slots() | H.held_items)
var/obj/I = X
if(!QDELETED(I) && is_type_in_typecache(I, trigger_objs))
freak_out(I)
return
/datum/brain_trauma/mild/phobia/on_hear(message, speaker, message_language, raw_message, radio_freq)
if(owner.disabilities & DEAF || world.time < next_scare) //words can't trigger you if you can't hear them *taps head*
return message
for(var/word in trigger_words)
if(findtext(message, word))
addtimer(CALLBACK(src, .proc/freak_out, null, word), 10) //to react AFTER the chat message
break
return message
/datum/brain_trauma/mild/phobia/on_say(message)
for(var/word in trigger_words)
if(findtext(message, word))
to_chat(owner, "<span class='warning'>You can't bring yourself to say the word \"[word]\"!</span>")
return ""
return message
/datum/brain_trauma/mild/phobia/proc/freak_out(atom/reason, trigger_word)
next_scare = world.time + 120
var/message = pick("spooks you to the bone", "shakes you up", "terrifies you", "sends you into a panic", "sends chills down your spine")
if(reason)
to_chat(owner, "<span class='userdanger'>Seeing [reason] [message]!</span>")
else if(trigger_word)
to_chat(owner, "<span class='userdanger'>Hearing \"[trigger_word]\" [message]!</span>")
else
to_chat(owner, "<span class='userdanger'>Something [message]!</span>")
var/reaction = rand(1,4)
switch(reaction)
if(1)
to_chat(owner, "<span class='warning'>You are paralyzed with fear!</span>")
owner.Stun(70)
owner.Jitter(8)
if(2)
owner.emote("scream")
owner.Jitter(5)
owner.say("AAAAH!!")
if(reason)
owner.pointed(reason)
if(3)
to_chat(owner, "<span class='warning'>You shut your eyes in terror!</span>")
owner.Jitter(5)
owner.blind_eyes(10)
if(4)
owner.dizziness += 10
owner.confused += 10
owner.Jitter(10)
owner.stuttering += 10
+179
View File
@@ -0,0 +1,179 @@
//Severe traumas, when your brain gets abused way too much.
//These range from very annoying to completely debilitating.
//They cannot be cured with chemicals, and require brain surgery to solve.
/datum/brain_trauma/severe
/datum/brain_trauma/severe/mute
name = "Mutism"
desc = "Patient is completely unable to speak."
scan_desc = "extensive damage to the brain's language center"
gain_text = "<span class='warning'>You forget how to speak!</span>"
lose_text = "<span class='notice'>You suddenly remember how to speak.</span>"
/datum/brain_trauma/severe/mute/on_gain()
owner.disabilities |= MUTE
..()
//no fiddling with genetics to get out of this one
/datum/brain_trauma/severe/mute/on_life()
if(!(owner.disabilities & MUTE))
on_gain()
..()
/datum/brain_trauma/severe/mute/on_lose()
owner.disabilities &= ~MUTE
..()
/datum/brain_trauma/severe/blindness
name = "Cerebral Blindness"
desc = "Patient's brain is no longer connected to its eyes."
scan_desc = "extensive damage to the brain's frontal lobe"
gain_text = "<span class='warning'>You can't see!</span>"
lose_text = "<span class='notice'>Your vision returns.</span>"
/datum/brain_trauma/severe/blindness/on_gain()
owner.become_blind()
..()
//no fiddling with genetics to get out of this one
/datum/brain_trauma/severe/blindness/on_life()
if(!(owner.disabilities & BLIND))
on_gain()
..()
/datum/brain_trauma/severe/blindness/on_lose()
owner.cure_blind()
..()
/datum/brain_trauma/severe/paralysis
name = "Paralysis"
desc = "Patient's brain can no longer control its motor functions."
scan_desc = "cerebral paralysis"
gain_text = "<span class='warning'>You can't feel your body anymore!</span>"
lose_text = "<span class='notice'>You can feel your limbs again!</span>"
/datum/brain_trauma/severe/paralysis/on_life()
owner.Knockdown(200, ignore_canknockdown = TRUE)
..()
/datum/brain_trauma/severe/paralysis/on_lose()
owner.SetKnockdown(0)
..()
/datum/brain_trauma/severe/narcolepsy
name = "Narcolepsy"
desc = "Patient may involuntarily fall asleep during normal activities."
scan_desc = "traumatic narcolepsy"
gain_text = "<span class='warning'>You have a constant feeling of drowsiness...</span>"
lose_text = "<span class='notice'>You feel awake and aware again.</span>"
/datum/brain_trauma/severe/narcolepsy/on_life()
..()
if(owner.IsSleeping())
return
var/sleep_chance = 1
if(owner.m_intent == MOVE_INTENT_RUN)
sleep_chance += 2
if(owner.drowsyness)
sleep_chance += 3
if(prob(sleep_chance))
to_chat(owner, "<span class='warning'>You fall asleep.</span>")
owner.Sleeping(60)
else if(!owner.drowsyness && prob(sleep_chance * 2))
to_chat(owner, "<span class='warning'>You feel tired...</span>")
owner.drowsyness += 10
/datum/brain_trauma/severe/monophobia
name = "Monophobia"
desc = "Patient feels sick and distressed when not around other people, leading to potentially lethal levels of stress."
scan_desc = "severe monophobia"
gain_text = ""
lose_text = "<span class='notice'>You feel like you could be safe on your own.</span>"
var/stress = 0
/datum/brain_trauma/severe/monophobia/on_gain()
..()
if(check_alone())
to_chat(owner, "<span class='warning'>You feel really lonely...</span>")
else
to_chat(owner, "<span class='notice'>You feel safe, as long as you have people around you.</span>")
/datum/brain_trauma/severe/monophobia/on_life()
..()
if(check_alone())
stress = min(stress + 0.5, 100)
if(stress > 10 && (prob(5)))
stress_reaction()
else
stress -= 4
/datum/brain_trauma/severe/monophobia/proc/check_alone()
if(owner.disabilities & BLIND)
return TRUE
for(var/mob/M in oview(owner, 7))
if(!isliving(M)) //ghosts ain't people
continue
if((istype(M, /mob/living/simple_animal/pet)) || M.ckey)
return FALSE
return TRUE
/datum/brain_trauma/severe/monophobia/proc/stress_reaction()
if(owner.stat != CONSCIOUS)
return
var/high_stress = (stress > 60) //things get psychosomatic from here on
switch(rand(1,6))
if(1)
if(!high_stress)
to_chat(owner, "<span class='warning'>You feel sick...</span>")
else
to_chat(owner, "<span class='warning'>You feel really sick at the thought of being alone!</span>")
addtimer(CALLBACK(owner, /mob/living/carbon.proc/vomit, high_stress), 50) //blood vomit if high stress
if(2)
if(!high_stress)
to_chat(owner, "<span class='warning'>You can't stop shaking...</span>")
owner.dizziness += 20
owner.confused += 20
owner.Jitter(20)
else
to_chat(owner, "<span class='warning'>You feel weak and scared! If only you weren't alone...</span>")
owner.dizziness += 20
owner.confused += 20
owner.Jitter(20)
owner.adjustStaminaLoss(50)
if(3, 4)
if(!high_stress)
to_chat(owner, "<span class='warning'>You feel really lonely...</span>")
else
to_chat(owner, "<span class='warning'>You're going mad with loneliness!</span>")
owner.hallucination += 20
if(5)
if(!high_stress)
to_chat(owner, "<span class='warning'>Your heart skips a beat.</span>")
owner.adjustOxyLoss(8)
else
if(prob(15) && ishuman(owner))
var/mob/living/carbon/human/H = owner
H.set_heartattack(TRUE)
to_chat(H, "<span class='userdanger'>You feel a stabbing pain in your heart!</span>")
else
to_chat(owner, "<span class='userdanger'>You feel your heart lurching in your chest...</span>")
owner.adjustOxyLoss(8)
/datum/brain_trauma/severe/discoordination
name = "Discoordination"
desc = "Patient is unable to use complex tools or machinery."
scan_desc = "extreme discoordination"
gain_text = "<span class='warning'>You can barely control your hands!</span>"
lose_text = "<span class='notice'>You feel in control of your hands again.</span>"
/datum/brain_trauma/severe/discoordination/on_gain()
owner.disabilities |= MONKEYLIKE
..()
/datum/brain_trauma/severe/discoordination/on_lose()
owner.disabilities &= ~MONKEYLIKE
..()
+114
View File
@@ -0,0 +1,114 @@
//Brain traumas that are rare and/or somewhat beneficial;
//they are the easiest to cure, which means that if you want
//to keep them, you can't cure your other traumas
/datum/brain_trauma/special
/datum/brain_trauma/special/godwoken
name = "Godwoken Syndrome"
desc = "Patient occasionally and uncontrollably channels an eldritch god when speaking."
scan_desc = "god delusion"
gain_text = "<span class='notice'>You feel a higher power inside your mind...</span>"
lose_text = "<span class='warning'>The divine presence leaves your head, no longer interested.</span>"
var/next_speech = 0
/datum/brain_trauma/special/godwoken/on_say(message)
if(world.time > next_speech && prob(10))
playsound(get_turf(owner), 'sound/magic/clockwork/invoke_general.ogg', 300, 1, 5)
var/cooldown = voice_of_god(message, owner, list("colossus","yell"), 2)
cooldown *= 0.33
next_speech = world.time + cooldown
return ""
else
return message
/datum/brain_trauma/special/bluespace_prophet
name = "Bluespace Prophecy"
desc = "Patient can sense the bob and weave of bluespace around them, showing them passageways no one else can see."
scan_desc = "bluespace attunement"
gain_text = "<span class='notice'>You feel the bluespace pulsing around you...</span>"
lose_text = "<span class='warning'>The faint pulsing of bluespace fades into silence.</span>"
var/next_portal = 0
/datum/brain_trauma/special/bluespace_prophet/on_life()
if(world.time > next_portal)
next_portal = world.time + 100
var/list/turf/possible_turfs = list()
for(var/turf/T in range(owner, 8))
if(!T.density)
var/clear = TRUE
for(var/obj/O in T)
if(O.density)
clear = FALSE
break
if(clear)
possible_turfs += T
if(!LAZYLEN(possible_turfs))
return
var/turf/first_turf = pick(possible_turfs)
if(!first_turf)
return
possible_turfs -= (possible_turfs & range(first_turf, 3))
var/turf/second_turf = pick(possible_turfs)
if(!second_turf)
return
var/obj/effect/hallucination/simple/bluespace_stream/first = new(first_turf, owner)
var/obj/effect/hallucination/simple/bluespace_stream/second = new(second_turf, owner)
first.linked_to = second
second.linked_to = first
first.seer = owner
second.seer = owner
/obj/effect/hallucination/simple/bluespace_stream
name = "bluespace stream"
desc = "You see a hidden pathway through bluespace..."
image_icon = 'icons/effects/effects.dmi'
image_state = "bluestream"
image_layer = ABOVE_MOB_LAYER
var/obj/effect/hallucination/simple/bluespace_stream/linked_to
var/mob/living/carbon/seer
/obj/effect/hallucination/simple/bluespace_stream/Initialize()
. = ..()
QDEL_IN(src, 300)
/obj/effect/hallucination/simple/bluespace_stream/attack_hand(mob/user)
if(user != seer || !linked_to)
return
var/slip_in_message = pick("slides sideways in an odd way, and disappears", "jumps into an unseen dimension",\
"sticks one leg straight out, wiggles [user.p_their()] foot, and is suddenly gone", "stops, then blinks out of reality", \
"is pulled into an invisible vortex, vanishing from sight")
var/slip_out_message = pick("silently fades in", "leaps out of thin air","appears", "walks out of an invisible doorway",\
"slides out of a fold in spacetime")
to_chat(user, "<span class='notice'>You try to align with the bluespace stream...</span>")
if(do_after(user, 20, target = src))
new /obj/effect/temp_visual/bluespace_fissure(get_turf(src))
new /obj/effect/temp_visual/bluespace_fissure(get_turf(linked_to))
user.forceMove(get_turf(linked_to))
user.visible_message("<span class='warning'>[user] [slip_in_message].</span>", ignored_mob = user)
user.visible_message("<span class='warning'>[user] [slip_out_message].</span>", "<span class='notice'>...and find your way to the other side.</span>")
/datum/brain_trauma/special/psychotic_brawling
name = "Violent Psychosis"
desc = "Patient fights in unpredictable ways, ranging from helping his target to hitting them with brutal strength."
scan_desc = "violent psychosis"
gain_text = "<span class='warning'>You feel unhinged...</span>"
lose_text = "<span class='notice'>You feel more balanced.</span>"
var/datum/martial_art/psychotic_brawling/psychotic_brawling
/datum/brain_trauma/special/psychotic_brawling/on_gain()
..()
psychotic_brawling = new(null)
if(!psychotic_brawling.teach(owner, TRUE))
to_chat(owner, "<span class='notice'>But your martial knowledge keeps you grounded.</span>")
qdel(src)
/datum/brain_trauma/special/psychotic_brawling/on_lose()
..()
psychotic_brawling.remove(owner)
QDEL_NULL(psychotic_brawling)
@@ -0,0 +1,218 @@
#define OWNER 0
#define STRANGER 1
/datum/brain_trauma/severe/split_personality
name = "Split Personality"
desc = "Patient's brain is split into two personalities, which randomly switch control of the body."
scan_desc = "complete lobe separation"
gain_text = "<span class='warning'>You feel like your mind was split in two.</span>"
lose_text = "<span class='notice'>You feel alone again.</span>"
var/current_controller = OWNER
var/initialized = FALSE //to prevent personalities deleting themselves while we wait for ghosts
var/mob/living/split_personality/stranger_backseat //there's two so they can swap without overwriting
var/mob/living/split_personality/owner_backseat
/datum/brain_trauma/severe/split_personality/on_gain()
..()
make_backseats()
get_ghost()
/datum/brain_trauma/severe/split_personality/proc/make_backseats()
stranger_backseat = new(owner, src)
owner_backseat = new(owner, src)
/datum/brain_trauma/severe/split_personality/proc/get_ghost()
set waitfor = FALSE
var/list/mob/dead/observer/candidates = pollCandidatesForMob("Do you want to play as [owner]'s split personality?", null, null, null, 75, stranger_backseat)
if(LAZYLEN(candidates))
var/client/C = pick(candidates)
stranger_backseat.key = C.key
else
qdel(src)
/datum/brain_trauma/severe/split_personality/on_life()
if(owner.stat == DEAD)
if(current_controller != OWNER)
switch_personalities()
qdel(src)
else if(prob(3))
switch_personalities()
..()
/datum/brain_trauma/severe/split_personality/on_lose()
if(current_controller != OWNER) //it would be funny to cure a guy only to be left with the other personality, but it seems too cruel
switch_personalities()
QDEL_NULL(stranger_backseat)
QDEL_NULL(owner_backseat)
..()
/datum/brain_trauma/severe/split_personality/proc/switch_personalities()
if(QDELETED(owner) || owner.stat == DEAD || QDELETED(stranger_backseat) || QDELETED(owner_backseat))
return
var/mob/living/split_personality/current_backseat
var/mob/living/split_personality/free_backseat
if(current_controller == OWNER)
current_backseat = stranger_backseat
free_backseat = owner_backseat
else
current_backseat = owner_backseat
free_backseat = stranger_backseat
log_game("[current_backseat]/([current_backseat.ckey]) assumed control of [owner]/([owner.ckey] due to [src]. (Original owner: [current_controller == OWNER ? owner.ckey : current_backseat.ckey])")
to_chat(owner, "<span class='userdanger'>You feel your control being taken away... your other personality is in charge now!</span>")
to_chat(current_backseat, "<span class='userdanger'>You manage to take control of your body!</span>")
//Body to backseat
var/h2b_id = owner.computer_id
var/h2b_ip= owner.lastKnownIP
owner.computer_id = null
owner.lastKnownIP = null
free_backseat.ckey = owner.ckey
free_backseat.name = owner.name
if(owner.mind)
free_backseat.mind = owner.mind
if(!free_backseat.computer_id)
free_backseat.computer_id = h2b_id
if(!free_backseat.lastKnownIP)
free_backseat.lastKnownIP = h2b_ip
//Backseat to body
var/s2h_id = current_backseat.computer_id
var/s2h_ip= current_backseat.lastKnownIP
current_backseat.computer_id = null
current_backseat.lastKnownIP = null
owner.ckey = current_backseat.ckey
owner.mind = current_backseat.mind
if(!owner.computer_id)
owner.computer_id = s2h_id
if(!owner.lastKnownIP)
owner.lastKnownIP = s2h_ip
current_controller = !current_controller
/mob/living/split_personality
name = "split personality"
real_name = "unknown conscience"
var/mob/living/carbon/body
var/datum/brain_trauma/severe/split_personality/trauma
/mob/living/split_personality/Initialize(mapload, _trauma)
if(iscarbon(loc))
body = loc
name = body.real_name
real_name = body.real_name
trauma = _trauma
return ..()
/mob/living/split_personality/Life()
if(QDELETED(body))
qdel(src) //in case trauma deletion doesn't already do it
if((body.stat == DEAD && trauma.owner_backseat == src))
trauma.switch_personalities()
qdel(trauma)
//if one of the two ghosts, the other one stays permanently
if(!body.client && trauma.initialized)
trauma.switch_personalities()
qdel(trauma)
..()
/mob/living/split_personality/Login()
..()
to_chat(src, "<span class='notice'>As a split personality, you cannot do anything but observe. However, you will eventually gain control of your body, switching places with the current personality.</span>")
/mob/living/split_personality/say(message)
to_chat(src, "<span class='warning'>You cannot speak, your other self is controlling your body!</span>")
return FALSE
/mob/living/split_personality/emote(message)
return
///////////////BRAINWASHING////////////////////
/datum/brain_trauma/severe/split_personality/brainwashing
name = "Split Personality"
desc = "Patient's brain is split into two personalities, which randomly switch control of the body."
scan_desc = "complete lobe separation"
gain_text = ""
lose_text = "<span class='notice'>You are free of your brainwashing.</span>"
can_gain = FALSE
var/codeword
var/objective
/datum/brain_trauma/severe/split_personality/brainwashing/New(obj/item/organ/brain/B, _permanent, _codeword, _objective)
..()
if(_codeword)
codeword = _codeword
else
codeword = pick(strings("ion_laws.json", "ionabstract")\
| strings("ion_laws.json", "ionobjects")\
| strings("ion_laws.json", "ionadjectives")\
| strings("ion_laws.json", "ionthreats")\
| strings("ion_laws.json", "ionfood")\
| strings("ion_laws.json", "iondrinks"))
/datum/brain_trauma/severe/split_personality/brainwashing/on_gain()
..()
var/mob/living/split_personality/traitor/traitor_backseat = stranger_backseat
traitor_backseat.codeword = codeword
traitor_backseat.objective = objective
/datum/brain_trauma/severe/split_personality/brainwashing/make_backseats()
stranger_backseat = new /mob/living/split_personality/traitor(owner, src, codeword, objective)
owner_backseat = new(owner, src)
/datum/brain_trauma/severe/split_personality/brainwashing/get_ghost()
set waitfor = FALSE
var/list/mob/dead/observer/candidates = pollCandidatesForMob("Do you want to play as [owner]'s brainwashed mind?", null, null, null, 75, stranger_backseat)
if(LAZYLEN(candidates))
var/client/C = pick(candidates)
stranger_backseat.key = C.key
else
qdel(src)
/datum/brain_trauma/severe/split_personality/brainwashing/on_life()
return //no random switching
/datum/brain_trauma/severe/split_personality/brainwashing/on_hear(message, speaker, message_language, raw_message, radio_freq)
if(owner.disabilities & DEAF || owner == speaker)
return message
if(findtext(message, codeword))
message = replacetext(message, codeword, "<span class='warning'>[codeword]</span>")
addtimer(CALLBACK(src, /datum/brain_trauma/severe/split_personality.proc/switch_personalities), 10)
return message
/datum/brain_trauma/severe/split_personality/brainwashing/on_say(message)
if(findtext(message, codeword))
return "" //oh hey did you want to tell people about the secret word to bring you back?
return message
/mob/living/split_personality/traitor
name = "split personality"
real_name = "unknown conscience"
var/objective
var/codeword
/mob/living/split_personality/traitor/Login()
..()
to_chat(src, "<span class='notice'>As a brainwashed personality, you cannot do anything yet but observe. However, you may gain control of your body if you hear the special codeword, switching places with the current personality.</span>")
to_chat(src, "<span class='notice'>Your activation codeword is: <b>[codeword]</b></span>")
if(objective)
to_chat(src, "<span class='notice'>Your master left you an objective: <b>[objective]</b>. Follow it at all costs when in control.</span>")
#undef OWNER
#undef STRANGER