This commit is contained in:
SandPoot
2024-04-05 17:57:54 -03:00
parent bd7040a50d
commit 68fa21d602
34 changed files with 223 additions and 126 deletions
+26 -12
View File
@@ -81,13 +81,13 @@
var/list/ambitions
//ambition end
///What character we spawned in as- either at roundstart or latejoin, so we know for persistent scars if we ended as the same person or not
var/mob/original_character
///Weakref to the character we spawned in as- either at roundstart or latejoin, so we know for persistent scars if we ended as the same person or not
var/datum/weakref/original_character
/// A lazy list of statuses to add next to this mind in the traitor panel
var/list/special_statuses
/datum/mind/New(var/key)
/datum/mind/New(key)
skill_holder = new(src)
src.key = key
soulOwner = src
@@ -95,15 +95,29 @@
/datum/mind/Destroy()
SSticker.minds -= src
if(islist(antag_datums))
for(var/i in antag_datums)
var/datum/antagonist/antag_datum = i
if(antag_datum.delete_on_mind_deletion)
qdel(i)
antag_datums = null
QDEL_LIST(antag_datums)
QDEL_NULL(language_holder)
QDEL_NULL(skill_holder)
set_current(null)
soulOwner = null
return ..()
/datum/mind/proc/set_current(mob/new_current)
if(new_current && QDELETED(new_current))
CRASH("Tried to set a mind's current var to a qdeleted mob, what the fuck")
if(current)
UnregisterSignal(src, COMSIG_PARENT_QDELETING)
current = new_current
if(current)
RegisterSignal(src, COMSIG_PARENT_QDELETING, PROC_REF(clear_current))
/datum/mind/proc/clear_current(datum/source)
SIGNAL_HANDLER
set_current(null)
/datum/mind/proc/set_original_character(new_original_character)
original_character = WEAKREF(new_original_character)
/datum/mind/proc/get_language_holder()
if(!language_holder)
language_holder = new (src)
@@ -126,13 +140,13 @@
key = new_character.key
if(new_character.mind) //disassociate any mind currently in our new body's mind variable
new_character.mind.current = null
new_character.mind.set_current(null)
var/datum/atom_hud/antag/hud_to_transfer = antag_hud//we need this because leave_hud() will clear this list
var/mob/living/old_current = current
if(current)
current.transfer_observers_to(new_character) //transfer anyone observing the old character to the new one
current = new_character //associate ourself with our new body
set_current(new_character) //associate ourself with our new body
new_character.mind = src //and associate our new body with ourself
for(var/a in antag_datums) //Makes sure all antag datums effects are applied in the new body
var/datum/antagonist/A = a
@@ -1715,7 +1729,7 @@ GLOBAL_LIST(objective_choices)
SEND_SIGNAL(src, COMSIG_MOB_ON_NEW_MIND)
if(!mind.name)
mind.name = real_name
mind.current = src
mind.set_current(src)
mind.hide_ckey = client?.prefs?.hide_ckey
/mob/living/carbon/mind_initialize()