Send save list update after manual save

Trigger a save list update in the event an admin manually saves the game
with the /server-save command.
This commit is contained in:
Hornwitser committed 2022-03-25 23:15:07 +01:00
1 parent ce95f868fd
commit 946847c95d
3 files changed
+37 -2

No files matched your search

+3
View File
@@ -409,6 +409,7 @@ const outputHeuristics = [
* - game-ready - invoked when the server is finished starting up
* - autosave-start - invoked when the server starts an autosave
* - autosave-fnished - invoked when the autosave finished
* - save-finished - invoked when the server has finished a manual save
* - exit - invoked when the sterver has exited
* @extends events.EventEmitter
* @memberof module:lib/factorio
@@ -500,6 +501,8 @@ class FactorioServer extends events.EventEmitter {
if (this._runningAutosave) {
this.emit("autosave-finished", this._runningAutosave);
this._runningAutosave = null;
} else {
this.emit("save-finished");
}
});
}
+6
View File
@@ -199,6 +199,12 @@ class Instance extends libLink.Link {
});
});
this.server.on("save-finished", () => {
this.sendSaveListUpdate().catch(err => {
this.logger.error(`Error handling save-finished in instance ${this.name}:\n${err.stack}`);
});
});
this.server.on("ipc-player_event", event => {
libLink.messages.playerEvent.send(this, {
instance_id: this.id,