mob/verb
//Return To Login Screen
TestVerb()
var/mob/LoggingIn/returner = new()
winset(usr, null, "_default.macro=Login; _default.child_default.left=panes_Login")
usr.client.mob = returner
mob/player/Logout()
//do things like Save(), remove from lists, tell the world they've logged out etc.
world<<"[src] logged out"
src.stamina.value = 69
//src.client.Save()
..()
del(src)
Problem description:
This was my attempt, but as the reference points out Logout() makes src.client == null.
Everything above works how I want it to except for saving. I see two options, I'm hoping there's a third.
Option 1) Call usr.client.Save() in the verb before switching mobs.
Option 2) Create a specific mob/proc/Save(args) proc to handle mob/Logout() saving
Option 3) Do something easy and call src.client.______() from mob/Logout()
If you want to switch mobs safely, You shouldn't rely on the client for saving. If your game doesn't require mob-switching, you are fine to keep Save() on the client. If your game does require mob-switching, it is not safe to keep Save() on the client.