world
New()
log = file("error.txt")
..()
spawn(14)
spawn()autosave()
Del()
for(var/mob/M in world)
if(M.client)del M.client
del M
..()
proc
autosave()
set background=1
sleep(1800)
for(var/mob/player/M in world)
if(M.client)
M.client.SaveMob()
autosave()
Just out of curiosity, this is a stupid way to save right? autosave() is taking up a lot of processing. I should just do something like this right:
mob
player
Login()
spawn(10)
src.client.saveMob()
return ..()
Del()
src.client.saveMob()
return ..()
You don't need the return ..(), because that already happens by default unless ..() is called manually earlier.
Saving on mob deletion is fine, but why would you need to save the player 1 second after it logs in?
Saving only really needs to be done on Logout() typically, but you can add manual save calls for significant gameplay achievements just to make sure they're absolutely saved.
Another thing you may want to look into is keeping lists, such as all players logged in, that way you don't have to loop through world when looking for a small number of specific entities.