Access autosave settings?

Place to get help with not working mods / modding interface.
hoylemd
Inserter
Inserter
Posts: 29
Joined: Tue Apr 17, 2018 2:14 am
Contact:

Access autosave settings?

Post by hoylemd »

Hi factorio modding folks!

A few years ago I made a little mod called autosave-alert (https://mods.factorio.com/mod/autosave-alert). I'm looking at updating it for 2.0, and was hoping the modding API might allow it to be a little better integrated. Right now, the user has to input their autosave interval setting separately in the mod's settings, and there no guarantee that will actually stay synchronized with the game's actual autosave time (since mods that let the game pause can cause it to get out of sync)

What I'm hoping is for a way to access the actual autosave interval setting from the game, so the player doesn't have to input it separately for the mod. Is there a way to access that setting from a mod? I see there's an autosave_enabled setting available (https://lua-api.factorio.com/latest/cla ... ve_enabled).

The other thing I wanted to try to fix was that some other mods allow the game to be paused, so the tick clock doesn't advance. but whatever click the autosave feature uses seems to be separate from that. Right now, my mod uses `on_nth_tick` to schedule the warning messages, I'm wondering if there's some way to get the wall clock time of the map, separate from ticks so that mod-pausing doesn't desync the warnings.

Any suggestions would be helpful! The main objective is to get the mod to provide warnings shortly before autosave (kind of like how satisfactory does) in as convenient a way as possible, so if my overall approach is flawed, I'd love to hear alternatives.

Thanks!
Rseding91
Factorio Staff
Factorio Staff
Posts: 16078
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Access autosave settings?

Post by Rseding91 »

There is no way for mods to know if an autosave is going to happen as it’s not a deterministic event and so not something mods can read. If it was readable, it being non-deterministic, it would cause desyncs when used by mods.
If you want to get ahold of me I'm almost always on Discord.
hoylemd
Inserter
Inserter
Posts: 29
Joined: Tue Apr 17, 2018 2:14 am
Contact:

Re: Access autosave settings?

Post by hoylemd »

that's unfortunate, I didn't think of autosave as non-deterministic, but I guess a lot of that process is outside the control of the game.

would it be possible to somehow expose the autosave interval setting, the same way the general autosave toggle is (or even just a readonly way)? my mod doesn't *have* to be perfectly accurate, it just needs to alert the user a little before the autosave happens, or the time to next autosave or something? internally, the game must have some kind of clock or scheduling for that, or... well, autosave wouldn't exist. if so, I could submit it as an api request in that forum, but if it's inherently nonfeasible i'll have to find some other workaround.
eugenekay
Filter Inserter
Filter Inserter
Posts: 692
Joined: Tue May 15, 2018 2:14 am
Contact:

Re: Access autosave settings?

Post by eugenekay »

hoylemd wrote: Sat Aug 23, 2025 7:12 pm that's unfortunate, I didn't think of autosave as non-deterministic, but I guess a lot of that process is outside the control of the game.

would it be possible to somehow expose the autosave interval setting, the same way the general autosave toggle is (or even just a readonly way)? my mod doesn't *have* to be perfectly accurate, it just needs to alert the user a little before the autosave happens, or the time to next autosave or something? internally, the game must have some kind of clock or scheduling for that, or... well, autosave wouldn't exist. if so, I could submit it as an api request in that forum, but if it's inherently nonfeasible i'll have to find some other workaround.
Never gonna happen: this setting is outside the sandbox of the game engine, and will return a different value on the Server than each Client which connects. There is (intentionally) no way to cross this boundary, or else you would Desync every time it is used.

The save function “pauses” the game sandbox portion in order to run the Save - in C++ realm, not in Lua land.
Post Reply

Return to “Modding help”