Skip to content

Commit 77e43eb

Browse files
authored
code_imp: Set key wrapper (#6492)
* 1 * comsig mob login * fix
1 parent 0e1e29e commit 77e43eb

File tree

4 files changed

+23
-19
lines changed

4 files changed

+23
-19
lines changed

code/datums/components/pref_holder.dm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
src.preferences = preferences || forge_preferences()
1616

1717
/datum/component/pref_holder/RegisterWithParent()
18-
RegisterSignal(parent, COMSIG_BODY_TRANSFER_TO, PROC_REF(on_mind_transfer))
18+
RegisterSignal(parent, COMSIG_MOB_LOGIN, PROC_REF(handle_transfer))
1919

2020
/datum/component/pref_holder/UnregisterFromParent()
21-
UnregisterSignal(parent, COMSIG_BODY_TRANSFER_TO)
21+
UnregisterSignal(parent, COMSIG_MOB_LOGIN)
2222

23-
/datum/component/pref_holder/proc/on_mind_transfer(mob/source)
23+
/datum/component/pref_holder/proc/handle_transfer(mob/source)
2424
SIGNAL_HANDLER
2525

2626
preferences = forge_preferences()

code/datums/mind.dm

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -151,22 +151,22 @@
151151
if(!istype(new_character))
152152
stack_trace("transfer_to(): Some idiot has tried to transfer_to() a non mob/living mob.")
153153

154-
var/datum/atom_hud/antag/hud_to_transfer = antag_hud //we need this because leave_hud() will clear this list
154+
var/datum/atom_hud/antag/hud_to_transfer = antag_hud // we need this because leave_hud() will clear this list
155155
var/mob/living/old_current = current
156156

157-
if(current) //remove ourself from our old body's mind variable
157+
if(current) // remove ourself from our old body's mind variable
158158
current.mind = null
159-
leave_all_huds() //leave all the huds in the old body, so it won't get huds if somebody else enters it
159+
leave_all_huds() // leave all the huds in the old body, so it won't get huds if somebody else enters it
160160

161161
SStgui.on_transfer(current, new_character)
162162

163-
if(new_character.mind) //remove any mind currently in our new body's mind variable
163+
if(new_character.mind) // remove any mind currently in our new body's mind variable
164164
new_character.mind.current = null
165165

166-
current = new_character //link ourself to our new body
167-
new_character.mind = src //and link our new body to ourself
166+
current = new_character // link ourself to our new body
167+
new_character.mind = src // and link our new body to ourself
168168

169-
transfer_antag_huds(hud_to_transfer) //inherit the antag HUD
169+
transfer_antag_huds(hud_to_transfer) // inherit the antag HUD
170170
transfer_actions(new_character, old_current)
171171

172172
if(martial_art)
@@ -177,11 +177,11 @@
177177
if(!MA.temporary)
178178
MA.teach(current)
179179

180-
for(var/datum/antagonist/antag in antag_datums) //Makes sure all antag datums effects are applied in the new body
180+
for(var/datum/antagonist/antag in antag_datums) // Makes sure all antag datums effects are applied in the new body
181181
antag.on_body_transfer(old_current, current)
182182

183183
if(active)
184-
new_character.key = key //now transfer the key to link the client to our new body
184+
new_character.set_key(key) // now transfer the key to link the client to our new body
185185

186186
// essential mob updates
187187
new_character.update_blind_effects()

code/modules/mob/mob.dm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1219,4 +1219,5 @@ GLOBAL_LIST_INIT(holy_areas, typecacheof(list(
12191219
add_misc_logs(src, "Z-TRACKING: [src] of type [src.type] has a Z-registration despite not having a client.")
12201220
update_z(null)
12211221

1222-
1222+
/mob/proc/set_key(key)
1223+
src.key = key

code/modules/mob/new_player/new_player.dm

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@
610610
popup.open(0) // 0 is passed to open so that it doesn't use the onclose() proc
611611

612612
/mob/new_player/proc/create_character()
613-
spawning = 1
613+
spawning = TRUE
614614
close_spawn_windows()
615615

616616
check_prefs_are_sane()
@@ -627,19 +627,22 @@
627627

628628

629629
if(mind)
630-
mind.active = 0 //we wish to transfer the key manually
631-
if(mind.assigned_role == JOB_TITLE_CLOWN) //give them a clownname if they are a clown
632-
new_character.real_name = pick(GLOB.clown_names) //I hate this being here of all places but unfortunately dna is based on real_name!
630+
mind.active = FALSE // we wish to transfer the key manually
631+
632+
if(mind.assigned_role == JOB_TITLE_CLOWN) // give them a clownname if they are a clown
633+
new_character.real_name = pick(GLOB.clown_names) // I hate this being here of all places but unfortunately dna is based on real_name!
633634
new_character.rename_self(JOB_TITLE_CLOWN)
635+
634636
else if(mind.assigned_role == JOB_TITLE_MIME)
635637
new_character.real_name = pick(GLOB.mime_names)
636638
new_character.rename_self(JOB_TITLE_MIME)
639+
637640
mind.set_original_mob(new_character)
638-
mind.transfer_to(new_character) //won't transfer key since the mind is not active
641+
mind.transfer_to(new_character) // won't transfer key since the mind is not active
639642
GLOB.human_names_list += new_character.real_name
640643

641644

642-
new_character.key = key // Manually transfer the key to log them in
645+
new_character.set_key(key) // Manually transfer the key to log them in
643646

644647
return new_character
645648

0 commit comments

Comments
 (0)