NebulaModTeam / nebula

A multiplayer mod for the game Dyson Sphere Program
GNU General Public License v3.0
835 stars 124 forks source link

[Suggestion] Factorio-Like Load-Latest-Save startup parameter for Headless Client #587

Closed AlienXAXS closed 1 year ago

AlienXAXS commented 1 year ago

Hi, I am enjoying the use of the headless client but there is a feature that I would love to see if it's not at all that hard to implement.

Factorio has a command called --start-server-load-latest (for Nebula it could just be -load-latest) that will automatically load the latest save file found within the headless client's save directory based on Date Modified. This makes it much easier to reboot a headless client or possibly recover from a server crash/system halt.

A possible bug however:

Currently the headless client will save the following named files: 1) _autosave_x - Where x is the autosave slot number. 2) _lastexit_

The headless client does not seem to actually save the save file name given in the -load parameter. This causes the headless client to never load the last save file if the headless client is rebooted or the server crashes.

starfi5h commented 1 year ago

The headless client does not seem to actually save the save file name given in the -load parameter.

This is to prevent the original save file from getting overwritten. If somehow the save is corrupted during saving, the original save will be lost if there is no backup.
If you want to overwrite, you have to use chat commands. Just like in normal game you have to manually save and confirm to overwrite the original save file.
The -load-latest is a good suggestion, can be added in 0.8.12.