TL;DR
Give mods the option to manipulate LUA::global before a SaveThe opposite of on_load.
What ?
Fire an event either on:- on_save
- on_pre_save
With the potential event-data:
- player_index::uint? - if saved for one player, the index of that player
- name::defines.events -Identifier of the event
- tick::uint - Tick the event was generated.
- is_server_save::boolean
- is_auto_save::boolean
- save_name::string - The name of the new save or the name of currently-running save, where the game is saved to.
Why ?
This has at least 2 uses: It allows mods to prepare the game for a save; It allows mods to prepare themselves for save-state.Preparing the game for a save could be interesting for modders, if they for instance wanted to punish people that saved frequently by making the biters more aggressive.
Preparing the mod for the save-state, means that mods can use LUA::local variables throughout and only store/load LUA::global when an event is fired. Since then both on_save & on_load would be covered.