Fix instance exit notification

Fix improper notification on Factorio server exit causing plugins and
the instance tracking to fail.
This commit is contained in:
Hornwitser committed 2020-04-04 15:14:23 +02:00
1 parent 99ac8f4f33
commit 75cd6d38db
6 files changed
+33 -32

No files matched your search

+3 -2
View File
@@ -419,7 +419,7 @@ const outputHeuristics = [
* output - invoked with parsed output from Factorio
* rcon-ready - invoked when the RCON client has connected
* game-ready - invoked when the server is finished starting up
* stopped - invoked when the sterver has exited
* exit - invoked when the sterver has exited
*/
class FactorioServer extends events.EventEmitter {
/**
@@ -636,7 +636,7 @@ class FactorioServer extends events.EventEmitter {
this._gameReady = false;
this._unexpected = [];
this.emit('stopped');
this.emit("exit");
});
}
@@ -678,6 +678,7 @@ class FactorioServer extends events.EventEmitter {
);
this._attachStdio();
this._server.once("exit", () => this.emit("exit"));
try {
let [code, signal] = await events.once(this._server, 'exit');
+5
View File
@@ -484,6 +484,11 @@ class Event {
}
}
messages.instanceStopped = new Event({
type: 'instance_stopped',
links: ['instance-slave'],
});
messages.updateInstances = new Event({
type: 'update_instances',
links: ['slave-master'],
+2 -2
View File
@@ -72,9 +72,9 @@ class BaseInstancePlugin {
async onStop() { }
/**
* Called when the instance is shutting down
* Called when the Factorio server exited
*/
async onExit() { }
onExit() { }
/**
* Called when the Factorio outputs a line