mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-21 16:13:12 +09:00
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:
1 parent
ce95f868fd
commit
946847c95d
3 files changed
+37
-2
No files matched your search
@@ -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");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user