ID:263245
 
Code:
world/proc
SaveObjects()
var/savefile/F = new ("Objs.sav")
var/objs[0]
for(var/obj/item/furniture/o in world)
o.saved_x = o.x
o.saved_y = o.y
o.saved_z = o.z
objs.Add(o)
F["Objects"] << objs
LoadObjects()
var/savefile/F = new("Objs.sav")
var/objs[0]
world.log << "Loading Objects"
if(isnull(objs)) objs = new/list()
F["Objects"] >> objs
if(length(objs))
for(var/obj/item/furniture/o in objs)
o.loc = locate(o.saved_x, o.saved_y, o.saved_z)
objs.Remove(o)
objs.Cut()

Save_House_Layout()
var/savefile/F = new("List.sav")
world.log << "Saving House Layout"
for(var/turf/walls/SPwall/W in world)
W.saved_ic = W.icon_state
SPwall.Add(W)
F["House wall"] << SPwall
Load_House_Layout()
var/savefile/F = new("List.sav")
world.log << "Loading House Layout"
if(isnull(SPwall)) SPwall = new/list()
F["House wall"] >> SPwall
for(var/turf/walls/SPwall/W in world)
W.icon_state = W.saved_ic
if(W.icon_state == "Floor")
W.density = 0


Problem description:
Is there a more efficient way to save the House tile iconstates and save the objs, that will cause the least amount of lag? Because I need it to so I can have it save periodically.
Anyone know of a better way? This way lags far too much.
In response to Pyro_dragons
Why save it periodically? Make it so it saves one player's house instead of all of them then everytime a player logs out save their house/furniture. You could also save every player's houses before reboots and shutdowns as a just incase.

-Exophus
In response to Exophus
Because what if the server crashes? Then it's all lost. I already have it save when the server closes and reboots, but it still takes long amounts of time to save it all. I know there's a way to save it all with minimal lag, I've seen it on other games, But I've been unable to figure it out yet.