diff --git a/code/__defines/spaceman_dmm.dm b/code/__defines/spaceman_dmm.dm index e590a30ff99..247d28d359c 100644 --- a/code/__defines/spaceman_dmm.dm +++ b/code/__defines/spaceman_dmm.dm @@ -6,8 +6,24 @@ #define RETURN_TYPE(X) set SpacemanDMM_return_type = X #define SHOULD_CALL_PARENT(X) set SpacemanDMM_should_call_parent = X #define UNLINT(X) SpacemanDMM_unlint(X) + #define SHOULD_NOT_OVERRIDE(X) set SpacemanDMM_should_not_override = X + #define SHOULD_NOT_SLEEP(X) set SpacemanDMM_should_not_sleep = X + #define SHOULD_BE_PURE(X) set SpacemanDMM_should_be_pure = X + #define PRIVATE_PROC(X) set SpacemanDMM_private_proc = X + #define PROTECTED_PROC(X) set SpacemanDMM_protected_proc = X + #define VAR_FINAL var/SpacemanDMM_final + #define VAR_PRIVATE var/SpacemanDMM_private + #define VAR_PROTECTED var/SpacemanDMM_protected #else #define RETURN_TYPE(X) #define SHOULD_CALL_PARENT(X) #define UNLINT(X) X + #define SHOULD_NOT_OVERRIDE(X) + #define SHOULD_NOT_SLEEP(X) + #define SHOULD_BE_PURE(X) + #define PRIVATE_PROC(X) + #define PROTECTED_PROC(X) + #define VAR_FINAL var + #define VAR_PRIVATE var + #define VAR_PROTECTED var #endif diff --git a/code/datums/brain_damage/imaginary_friend.dm b/code/datums/brain_damage/imaginary_friend.dm index 7db417eb72b..5d7ae134877 100644 --- a/code/datums/brain_damage/imaginary_friend.dm +++ b/code/datums/brain_damage/imaginary_friend.dm @@ -53,7 +53,7 @@ var/mob/living/carbon/owner var/datum/brain_trauma/special/imaginary_friend/trauma -/mob/abstract/mental/friend/Login() +/mob/abstract/mental/friend/LateLogin() ..() to_chat(src, "You are the imaginary friend of [owner]!") to_chat(src, "You are absolutely loyal to your friend, no matter what.") diff --git a/code/datums/brain_damage/schizo.dm b/code/datums/brain_damage/schizo.dm index 6a1bcd543bd..83ffcb20564 100644 --- a/code/datums/brain_damage/schizo.dm +++ b/code/datums/brain_damage/schizo.dm @@ -135,7 +135,7 @@ ..() -/mob/living/mental/split_personality/Login() +/mob/living/mental/split_personality/LateLogin() ..() to_chat(src, "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.") @@ -209,7 +209,7 @@ var/objective var/codeword -/mob/living/mental/split_personality/traitor/Login() +/mob/living/mental/split_personality/traitor/LateLogin() ..() to_chat(src, "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.") to_chat(src, "Your activation codeword is: [codeword]") @@ -217,4 +217,4 @@ to_chat(src, "Your master left you an objective: [objective]. Follow it at all costs when in control.") #undef OWNER -#undef STRANGER \ No newline at end of file +#undef STRANGER diff --git a/code/modules/client/client defines.dm b/code/modules/client/client defines.dm index 05ec0b79cdb..7c25c5cddf7 100644 --- a/code/modules/client/client defines.dm +++ b/code/modules/client/client defines.dm @@ -75,3 +75,5 @@ var/obj/screen/plane_master/parallax_spacemaster/parallax_spacemaster = null var/authed = TRUE + + var/is_initialized = FALSE // Used to track whether the client has been initialized with InitClient. diff --git a/code/modules/client/client procs.dm b/code/modules/client/client procs.dm index 5017e029d19..83596fe2647 100644 --- a/code/modules/client/client procs.dm +++ b/code/modules/client/client procs.dm @@ -350,17 +350,18 @@ return 0 if(IsGuestKey(key) && config.external_auth) - //src.real_mob = ..() src.authed = FALSE var/mob/abstract/unauthed/m = new() m.client = src src.InitPrefs() //Init some default prefs + m.LateLogin() return m //Do auth shit else + . = ..() src.InitClient() src.InitPrefs() - . = ..() + mob.LateLogin() /client/proc/InitPrefs() //preferences datum - also holds some persistant data for the client (because we may as well keep these datums to a minimum) @@ -446,6 +447,8 @@ fetch_unacked_warning_count() + is_initialized = TRUE + ////////////// //DISCONNECT// ////////////// diff --git a/code/modules/mob/abstract/new_player/login.dm b/code/modules/mob/abstract/new_player/login.dm index 37fe2a15d4b..d73660d3b3d 100644 --- a/code/modules/mob/abstract/new_player/login.dm +++ b/code/modules/mob/abstract/new_player/login.dm @@ -24,7 +24,9 @@ /mob/abstract/new_player var/client/my_client // Need to keep track of this ourselves, since by the time Logout() is called the client has already been nulled -/mob/abstract/new_player/Login() +/mob/abstract/new_player/LateLogin() + ..() + update_Login_details() //handles setting lastKnownIP and computer_id for use by the ban systems as well as checking for multikeying to_chat(src, "
Game ID:
[game_id]
") diff --git a/code/modules/mob/abstract/observer/login.dm b/code/modules/mob/abstract/observer/login.dm index 9858113a3df..0794f6ccf06 100644 --- a/code/modules/mob/abstract/observer/login.dm +++ b/code/modules/mob/abstract/observer/login.dm @@ -1,4 +1,4 @@ -/mob/abstract/observer/Login() +/mob/abstract/observer/LateLogin() ..() if (ghostimage) ghostimage.icon_state = src.icon_state diff --git a/code/modules/mob/abstract/unauthed/login.dm b/code/modules/mob/abstract/unauthed/login.dm index fa4d4fa1bb2..f9a22c2826d 100644 --- a/code/modules/mob/abstract/unauthed/login.dm +++ b/code/modules/mob/abstract/unauthed/login.dm @@ -8,7 +8,9 @@ /mob/abstract/unauthed/New() verbs -= typesof(/mob/verb) -/mob/abstract/unauthed/Login() +/mob/abstract/unauthed/LateLogin() + SHOULD_CALL_PARENT(FALSE) + update_Login_details() to_chat(src, "You need to authenticate before you can continue.") token = md5("[client.ckey][client.computer_id][world.time][rand()]") @@ -34,11 +36,12 @@ if(!client) qdel(src) deltimer(timeout_timer) - var/client/c = client + var/client/c = client // so we don't lose the client in the current mob. + show_browser(src, null, "window=auth;") - client.verbs += typesof(/client/verb) // Let's return regular client verbs - client.authed = TRUE // We declare client as authed now - client.prefs = null //Null them so we can load them from the db again for the correct ckey + c.verbs += typesof(/client/verb) // Let's return regular client verbs + c.authed = TRUE // We declare client as authed now + c.prefs = null //Null them so we can load them from the db again for the correct ckey // Check for bans var/list/ban_data = world.IsBanned(ckey(newkey), c.address, c.computer_id, 1, TRUE) if(ban_data) @@ -47,14 +50,19 @@ to_chat(c, "Description: [ban_data["desc"]]") del(c) return - directory -= client.ckey + + directory -= c.ckey if(newkey) - client.key = newkey // Try seeting ckey + c.key = newkey // Try seeting ckey + // ^^^^ THIS INVOKES mob/Login()! + // and also modifies the c.mob to the actual mob they disconnected out of. + directory[c.ckey] = c // Init the client and give it a new_player mob. // Note that modifying the key variable does not invoke client/New() or client/Login() again. c.InitClient() c.InitPrefs() + c.mob.LateLogin() if(istype(c.mob, /mob/abstract/unauthed)) c.mob = new /mob/abstract/new_player() diff --git a/code/modules/mob/living/carbon/brain/login.dm b/code/modules/mob/living/carbon/brain/login.dm index 57c41cc659b..e3ba1888553 100644 --- a/code/modules/mob/living/carbon/brain/login.dm +++ b/code/modules/mob/living/carbon/brain/login.dm @@ -1,3 +1,3 @@ -/mob/living/carbon/brain/Login() +/mob/living/carbon/brain/LateLogin() ..() - sleeping = 0 \ No newline at end of file + sleeping = 0 diff --git a/code/modules/mob/living/carbon/human/login.dm b/code/modules/mob/living/carbon/human/login.dm index ea44d6d1680..66c0baa38a7 100644 --- a/code/modules/mob/living/carbon/human/login.dm +++ b/code/modules/mob/living/carbon/human/login.dm @@ -1,5 +1,5 @@ -/mob/living/carbon/human/Login() +/mob/living/carbon/human/LateLogin() ..() update_hud() if(species) species.handle_login_special(src) - return \ No newline at end of file + return diff --git a/code/modules/mob/living/carbon/human/logout.dm b/code/modules/mob/living/carbon/human/logout.dm index f449ce991ad..5332851ee2a 100644 --- a/code/modules/mob/living/carbon/human/logout.dm +++ b/code/modules/mob/living/carbon/human/logout.dm @@ -1,4 +1,4 @@ /mob/living/carbon/human/Logout() ..() - if(species) species.handle_logout_special(src) - return \ No newline at end of file + if(species) + species.handle_logout_special(src) diff --git a/code/modules/mob/living/carbon/slime/login.dm b/code/modules/mob/living/carbon/slime/login.dm index 26733a7c7ce..ddfce025cae 100644 --- a/code/modules/mob/living/carbon/slime/login.dm +++ b/code/modules/mob/living/carbon/slime/login.dm @@ -1,4 +1,4 @@ -/mob/living/carbon/slime/Login() +/mob/living/carbon/slime/LateLogin() ..() update_hud() - return \ No newline at end of file + return diff --git a/code/modules/mob/living/login.dm b/code/modules/mob/living/login.dm index b41baabef97..32835412c77 100644 --- a/code/modules/mob/living/login.dm +++ b/code/modules/mob/living/login.dm @@ -1,5 +1,5 @@ -/mob/living/Login() +/mob/living/LateLogin() ..() //Mind updates mind_initialize() //updates the mind (or creates and initializes one if one doesn't exist) diff --git a/code/modules/mob/living/parasite/meme.dm b/code/modules/mob/living/parasite/meme.dm index d3925bfea48..0c5a0b62344 100644 --- a/code/modules/mob/living/parasite/meme.dm +++ b/code/modules/mob/living/parasite/meme.dm @@ -23,7 +23,7 @@ var/controlling /mob/living/parasite var/mob/living/carbon/host // the host that this parasite occupies -/mob/living/parasite/Login() +/mob/living/parasite/LateLogin() ..() // make the client see through the host instead client.eye = host diff --git a/code/modules/mob/living/silicon/ai/login.dm b/code/modules/mob/living/silicon/ai/login.dm index 4304b1db552..3c4352c5c65 100644 --- a/code/modules/mob/living/silicon/ai/login.dm +++ b/code/modules/mob/living/silicon/ai/login.dm @@ -1,4 +1,4 @@ -/mob/living/silicon/ai/Login() //ThisIsDumb(TM) TODO: tidy this up ¬_¬ ~Carn +/mob/living/silicon/ai/LateLogin() //ThisIsDumb(TM) TODO: tidy this up ¬_¬ ~Carn // It's still dumb and not really tidied up. Enjoy! ..() regenerate_icons() flash = new /obj/screen() diff --git a/code/modules/mob/living/silicon/ai/logout.dm b/code/modules/mob/living/silicon/ai/logout.dm index 8b5079ef380..02bb6e3250a 100644 --- a/code/modules/mob/living/silicon/ai/logout.dm +++ b/code/modules/mob/living/silicon/ai/logout.dm @@ -7,4 +7,3 @@ client.eye = loc client.perspective = EYE_PERSPECTIVE src.view_core() - return diff --git a/code/modules/mob/living/silicon/login.dm b/code/modules/mob/living/silicon/login.dm index cee7c53d5e9..f9d4a1dce78 100644 --- a/code/modules/mob/living/silicon/login.dm +++ b/code/modules/mob/living/silicon/login.dm @@ -1,3 +1,3 @@ -/mob/living/silicon/Login() +/mob/living/silicon/LateLogin() sleeping = FALSE - ..() \ No newline at end of file + ..() diff --git a/code/modules/mob/living/silicon/pai/pai.dm b/code/modules/mob/living/silicon/pai/pai.dm index 6260893c9ba..0ca03aae6d6 100644 --- a/code/modules/mob/living/silicon/pai/pai.dm +++ b/code/modules/mob/living/silicon/pai/pai.dm @@ -166,7 +166,7 @@ id_card.registered_name = "" -/mob/living/silicon/pai/Login() +/mob/living/silicon/pai/LateLogin() greet() ..() diff --git a/code/modules/mob/living/silicon/robot/login.dm b/code/modules/mob/living/silicon/robot/login.dm index 5670dce50d2..100e010fc2e 100644 --- a/code/modules/mob/living/silicon/robot/login.dm +++ b/code/modules/mob/living/silicon/robot/login.dm @@ -1,4 +1,4 @@ -/mob/living/silicon/robot/Login() +/mob/living/silicon/robot/LateLogin() ..() regenerate_icons() show_laws(0) @@ -8,4 +8,4 @@ // Forces synths to select an icon relevant to their module if(module && !icon_selected) - choose_icon() \ No newline at end of file + choose_icon() diff --git a/code/modules/mob/living/simple_animal/borer/borer.dm b/code/modules/mob/living/simple_animal/borer/borer.dm index a6967c9fe91..5b15400ced1 100644 --- a/code/modules/mob/living/simple_animal/borer/borer.dm +++ b/code/modules/mob/living/simple_animal/borer/borer.dm @@ -38,7 +38,7 @@ /mob/living/simple_animal/borer/roundstart roundstart = TRUE -/mob/living/simple_animal/borer/Login() +/mob/living/simple_animal/borer/LateLogin() ..() if(mind) borers.add_antagonist(mind) @@ -158,4 +158,4 @@ G.request_player(src, "A cortical borer needs a player.") /mob/living/simple_animal/borer/cannot_use_vents() - return \ No newline at end of file + return diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index 9a4a257ea83..4cc5005f3a9 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -148,7 +148,7 @@ turns_since_move = turns_per_move ..() -/mob/living/simple_animal/Login() +/mob/living/simple_animal/LateLogin() if(src && src.client) src.client.screen = null ..() diff --git a/code/modules/mob/login.dm b/code/modules/mob/login.dm index dbbe6632bb5..fadc87d715b 100644 --- a/code/modules/mob/login.dm +++ b/code/modules/mob/login.dm @@ -23,7 +23,37 @@ message_admins("Notice: [key_name_admin(src)] has the same [matches] as [key_name_admin(M)] (no longer logged in). ", 1) log_access("Notice: [key_name(src)] has the same [matches] as [key_name(M)] (no longer logged in).",ckey=key_name(src)) +/** + * Currently marked as SHOULD_NOT_OVERRIDE. + * + * In the case of Aurora code, mob/Login is invoked BEFORE client initialization + * is completed, in order to permit remote authentication. + * + * This also invokes mob/proc/LateLogin in cases where the client has already been + * initialized. This is the case when a ckey is moved around from mob to mob during + * gameplay. + * + * Use /mob/proc/LateLogin() instead. + */ /mob/Login() + SHOULD_NOT_OVERRIDE(TRUE) + + ..() + + if (client.is_initialized) + LateLogin() + +/** + * \brief A function to replace most uses of mob/Login with. 99% of the time, you + * should implement an override of this function. + * + * This function is invoked AFTER client/proc/InitClient and client/proc/InitPrefs. + * It can expect the client.ckey to be properly populated with the client's final + * ckey. + */ +/mob/proc/LateLogin() + SHOULD_CALL_PARENT(TRUE) + player_list |= src update_Login_details() SSfeedback.update_status() @@ -38,7 +68,6 @@ next_move = 1 sight |= SEE_SELF disconnect_time = null - ..() player_age = client.player_age diff --git a/code/modules/mob/logout.dm b/code/modules/mob/logout.dm index a1725446e97..dfa518eef2f 100644 --- a/code/modules/mob/logout.dm +++ b/code/modules/mob/logout.dm @@ -1,4 +1,6 @@ /mob/Logout() + SHOULD_CALL_PARENT(TRUE) + SSnanoui.user_logout(src) // this is used to clean up (remove) this user's Nano UIs player_list -= src disconnect_time = world.realtime @@ -27,4 +29,3 @@ if (mob_thinks) MOB_START_THINKING(src) ..() - return 1 diff --git a/code/modules/psionics/mob/mob.dm b/code/modules/psionics/mob/mob.dm index a5edc218fec..5455c80dec1 100644 --- a/code/modules/psionics/mob/mob.dm +++ b/code/modules/psionics/mob/mob.dm @@ -1,8 +1,8 @@ /mob/living var/datum/psi_complexus/psi -/mob/living/Login() - . = ..() +/mob/living/LateLogin() + ..() if(psi) psi.update(TRUE) if(!psi.suppressed) diff --git a/code/modules/spell_system/spells/spells.dm b/code/modules/spell_system/spells/spells.dm index 9cd81ea40f2..5d8fd9a96ef 100644 --- a/code/modules/spell_system/spells/spells.dm +++ b/code/modules/spell_system/spells/spells.dm @@ -7,7 +7,7 @@ for(var/obj/screen/movable/spell_master/spell_master in spell_masters) spell_master.update_spells(0, src) -/mob/Login() +/mob/LateLogin() ..() if(spell_masters) for(var/obj/screen/movable/spell_master/spell_master in spell_masters) @@ -85,4 +85,4 @@ return for(var/obj/screen/movable/spell_master/spell_master in spell_masters) - spell_master.silence_spells(amount) \ No newline at end of file + spell_master.silence_spells(amount) diff --git a/code/modules/ventcrawl/ventcrawl.dm b/code/modules/ventcrawl/ventcrawl.dm index b50dad99ea2..4c8295e6c25 100644 --- a/code/modules/ventcrawl/ventcrawl.dm +++ b/code/modules/ventcrawl/ventcrawl.dm @@ -23,8 +23,8 @@ var/global/list/can_enter_vent_with = list( /mob/living/proc/can_ventcrawl() return 0 -/mob/living/Login() - . = ..() +/mob/living/LateLogin() + ..() //login during ventcrawl if(is_ventcrawling && istype(loc, /obj/machinery/atmospherics)) //attach us back into the pipes remove_ventcrawl() diff --git a/html/changelogs/skull132_fix-remote-auth.yml b/html/changelogs/skull132_fix-remote-auth.yml new file mode 100644 index 00000000000..eb7563da963 --- /dev/null +++ b/html/changelogs/skull132_fix-remote-auth.yml @@ -0,0 +1,5 @@ +author: Skull132 +delete-after: True + +changes: + - bugfix: "A bug fixed in remote auth where the HUD setup procs would crash during a reconnect." diff --git a/tools/Redirector/Redirector.dm b/tools/Redirector/Redirector.dm index 3ee103cdd79..d81dd631b34 100644 --- a/tools/Redirector/Redirector.dm +++ b/tools/Redirector/Redirector.dm @@ -29,7 +29,7 @@ world var/link = "" -mob/Login() +/mob/LateLogin() ..() var/list/weights = list()