ID:138293
 
So in Living & Dead I encountered this problem, which rears its head in my new weekend project (more on that later!) --

When you are frequently loading objects from savefiles, you discover that putting all of your initialization code in New() is no longer practical.

Let's say that your mob.New() proc sets the mob's health to its maximum possible value, which may vary depending on what items the mob is wearing and such.

Now after a big fight, while bleeding half to death, the player logs out and you save their mob to a file.

They log in again and you read the mob back in -- and the health gets set to maximum when mob.New() is called, even though it was supposed to stay at the health level saved.

My solution is Initialize() vs. New(). That is, I add an Initialize() function which must be called anytime a new mob is created that is NOT being read from a savefile.

Any thoughts on this?