SMAPI - Stardew Modding API

SMAPI - Stardew Modding API

971k Downloads

Pre and Post SaveGame.Save() Events

ThatNorthernMonkey opened this issue ยท 5 comments

commented

To get around the game crashing on save (XML serialization problem) the only real option is to serialise and delete all your objects before saving, and deserialise / recreate your objects after saving. Could you please implement these events so we have something to hook into? Thanks!

commented

Yes, the serialization issue has been a major impediment for me. And on another relevant topic, any chance we could get an event that triggers when the player goes to sleep at night? Currently I have to abuse MenuEvents.MenuChanged in order to determine this. Ty in advance.

commented

I use TimeEvents.DayOfMonthChanged to run my code at night.

commented

@AdvizeGH That's correct. Unfortunately SMAPI doesn't have any easy way of hooking into game functions, so this feature might need to wait until the rewrite which does include hooking.

commented

I'm fairly positive that event happens after the night is over and a new day begins.

commented

TimeEvents.OnNewDay - "Occurs when Game1.newDay changes. True directly before saving, and False directly after."
There is no way to directly hook the saving event using SMAPI.
Will be implemented in next release build.
Will close at that time.