Event: on_pre_save - to interact before a save state is finalized

Ideas that are too old (too many things have changed since) and ones which won't be implemented for certain reasons or if there are obviously better suggestions.

Moderator: ickputzdirwech

Post Reply
Theis
Inserter
Inserter
Posts: 27
Joined: Tue Sep 13, 2022 9:57 am
Contact:

Event: on_pre_save - to interact before a save state is finalized

Post by Theis »

TL;DR
Give mods the option to manipulate LUA::global before a Save
The opposite of on_load.
What ?
Fire an event either on:
  1. on_save
  2. on_pre_save
Where mods gets a chance to prepare the save state in some way.
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.

User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 2250
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: Event: on_pre_save - to interact before a save state is finalized

Post by boskid »

No. 104337

Post Reply

Return to “Outdated/Not implemented”