ID:146569
 
Code:
area
shelter
Entered(mob/pc/M)
if(M.client)
M.see_invisible = 0
M.shelter = 1
Exited(mob/pc/M)
if(M.client)
M.see_invisible = 1
M.shelter = 0


Problem description:
The basic idea is that when a mob/pc enters the sheltered areas their sheltered variable flicks, affecting the amount of water loss every step (it's a desert survival game). It all works fine, except, when a player logs out and in while standing on shelter, their shelter variable turns to zero despite the fact that they're indoors. The only way I can think of getting around this is to change the save proc so that location isn't stored and instead they go to some sorta starting area, but that would suck. Can anyone tell me what's going wrong?

mob/proc/Save_Shelter()
var/savefile/F=new("/players/[src.name]/sheltervar") //define the var F
F["shelter"]<<src.shelter //Save the players shelter var

mob/proc/Load_Shelter()
var/savefile/F=new("/players/[src.name]/sheltervar")
if(fexists("/players/[src.name]/sheltervar")) //if the file exists
F["shelter"]>>src.shelter //load the file

mob/Login()
src.Load_Shelter() //Calls Load Shelter() proc
..()

mob/Logout()
src.Save_Shelter() //Calls Save Shelter() proc
..()



I think this will work.
In response to Mega fart cannon
What he could just do is on a mob's Login() proc to check if the tile he is on is of type /turf/shelter. And set it then. This would be more efficient I figure, as if there ever is a glitch with it, it'll know whether or not it really is in shelter.