[MIRROR] Client DC Checking for new_player [MDB IGNORE] (#18786)

* Client DC Checking for new_player (#72606)

## About The Pull Request

Don't you love seeing this
```
[2023-01-08 19:43:47.400] runtime error: Cannot execute null.set db player flags().
 - proc name: Login (/mob/dead/new_player/Login)
 -   source file: login.dm,7
 -   usr: (src)
 -   src: xxx (/mob/dead/new_player)
 -   src.loc: null
 -   call stack:
 - xxx (/mob/dead/new_player): Login()
 -
[2023-01-08 19:43:47.453] runtime error: Cannot execute null.set db player flags().
 - proc name: Login (/mob/dead/new_player/Login)
 -   source file: login.dm,7
 -   usr: (src)
 -   src: xxx (/mob/dead/new_player)
 -   src.loc: null
 -   call stack:
 - xxx (/mob/dead/new_player): Login()
 -
[2023-01-08 19:43:47.573] runtime error: Tried to set a mind's current var to a qdeleted mob, what the fuck
 - proc name: set current (/datum/mind/proc/set_current)
 -   source file: _mind.dm,140
 -   usr: xxx (/mob/dead/new_player)
 -   src: /datum/mind (/datum/mind)
 -   usr.loc: null
 -   call stack:
 - /datum/mind (/datum/mind): set current(Phaseu (/mob/dead/new_player))
 - xxx (/mob/dead/new_player): Login()
 -
[2023-01-08 19:43:47.573] runtime error: Cannot read null.holder
 - proc name: Login (/mob/dead/new_player/Login)
 -   source file: login.dm,14
 -   usr: (src)
 -   src: xxx (/mob/dead/new_player)
 -   src.loc: null
 -   call stack:
 - xxx (/mob/dead/new_player): Login()
```
I dont.
## Why It's Good For The Game

Less runtimes.
## Changelog

* Client DC Checking for new_player

Co-authored-by: Zephyr <12817816+ZephyrTFA@users.noreply.github.com>
This commit is contained in:
SkyratBot
2023-01-18 05:30:56 +01:00
committed by GitHub
parent f5d58b7234
commit 7dfd57634d
2 changed files with 11 additions and 3 deletions
+8 -2
View File
@@ -3,8 +3,12 @@
return
if(CONFIG_GET(flag/use_exp_tracking))
client.set_exp_from_db()
client.set_db_player_flags()
client?.set_exp_from_db()
client?.set_db_player_flags()
if(!client)
// client disconnected during one of the db queries
return FALSE
if(!mind)
mind = new /datum/mind(key)
mind.active = TRUE
@@ -44,6 +48,8 @@
var/datum/asset/asset_datum = get_asset_datum(/datum/asset/simple/lobby)
asset_datum.send(client)
if(!client) // client disconnected during asset transit
return FALSE
// The parent call for Login() may do a bunch of stuff, like add verbs.
// Delaying the register_for_interview until the very end makes sure it can clean everything up
+3 -1
View File
@@ -1,5 +1,7 @@
/**
* Run when a client is put in this mob or reconnets to byond and their client was on this mob
* Run when a client is put in this mob or reconnets to byond and their client was on this mob.
* Anything that sleeps can result in the client reference being dropped, due to byond using that sleep to handle a client disconnect.
* You can save a lot of headache if you make Login use SHOULD_NOT_SLEEP, but that would require quite a bit of refactoring how Login code works.
*
* Things it does:
* * Adds player to player_list