/*
Ok. These two functions change how stuff is saved.
Their purpose if to prevent saving references to mobs.
The reason is that doing so can cause strange errors, like random rollbacks of players.
*/
var/list/unsaved_vars = list("loc") //any non-tmp vars that you do NOT want saved go here.
datum/Write(savefile/F)
//modifed softcode for default writing
//original version from DM guide
//modified to fix the infamous 'rollback' bug
var/V
for(V in vars)
if(issaved(vars[V]) && !(V in unsaved_vars))
if(ismob(vars[V]) && vars[V] != src)
world.log << "[src] attempted to save mob into [V]."
else
if(initial(vars[V]) == vars[V])
F.dir.Remove(V) //just in case
else
var/temp = vars[V]
if(istype(vars[V], /list))
for(var/O in vars[V])
if(ismob(O) && O != src)
world.log << "[src] attempted to save mob into list [V]."
temp -= O
F[V] << temp //write variable
datum/Read(savefile/F)
//modifed softcode for default reading
//original version from DM guide
//modified to fix the infamous 'rollback' bug
var/V
for(V in vars)
if(issaved(vars[V]) && !(V in unsaved_vars))
if(V in F.dir)
var/temp
F[V] >> temp //read variable
if(istype(vars[V], /list))
for(var/O in vars[V])
if(ismob(O) && O != src)
world.log << "[src] attempted to load saved mob from list [V]."
temp -= O
if(!ismob(vars[V]) || vars[V] == src)
vars[V] = temp
else
world.log << "[src] attempted to load saved mob from [V]."
Problem description:
Well, the game where this is used on laggs continuously and freezes like 2 times per minute.
I don't know how to solve this, we're sure it's in this code.
Could any of you help me?
Edit: we get a lot of world.loc << "" messages, too many of them.
And of course you get those messages, they're right there in the code... do you even know basic coding? You can't remove the messages?