client
Del()
for(var/obj/Seclusion_Cushion/C in view())
if(usr.trainingprep)
usr.starttime = worldage
usr.offlinetraining = 1
usr.KarmaSave()
usr.Save()
del(src)
mob
proc
PermaDeath()
src << "<b><font color=#FF0000>You feel your eyelids shut heavily for the last time...</b></font>"
if(fdel("./save/[ckey]"))
src << "save deleted"
else
src << "try again"
winset(src,null,"command=.reconnect")
Problem description:
I used to have the first bit under mob/Logout() but it didn't work properly, and started working as intended when I switched to client/Del. However, after doing so the PermaDeath proc stopped working properly. When it runs, the player ends up in an infinite loop of seeing the death message and just reconnecting with their savefile intact.
I think the issue is that after deleting the savefile, the Del proc immediately makes a new one when the player is disconnected, but I have no clue how to make it so Del only functions when the player logs out normally rather than being disconnected by the PermaDeath proc. Does anyone know how I could accomplish this?
However we were curious why you decided to go the route of forcing a reconnect instead of just wiping the save and jettisoning the player to the title screen or starting page (or however you handle initial connection). If possible, consider going that route as it would probably feel more fluid to the player to be naturally brought to where they need to be instead of utilizing reconnect trickery, and as a bonus you wouldn't have to add any additional logic to your client's Del() override.
Thematically, you could also cause a fade-to-black during permadeath to add to the "Yeah, you're character's gone forever" feeling, though that's probably beyond the scope of what you were looking for with this thread.