mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-12 15:04:52 +09:00
allow FactorioServer.version to return undefined
This commit is contained in:
1 parent
8a57d9b5f6
commit
dc2f86dcf3
4 files changed
+9
-10
No files matched your search
@@ -667,7 +667,7 @@ export default class Host extends lib.Link {
|
||||
instanceId,
|
||||
instanceConnection ? instanceConnection.instance.status : "stopped",
|
||||
instanceConnection ? instanceConnection.instance.server.gamePort : this.gamePort(instanceId),
|
||||
instanceConnection ? instanceConnection.instance.server.version ?? undefined : undefined,
|
||||
instanceConnection ? instanceConnection.instance.server.version : undefined,
|
||||
)
|
||||
);
|
||||
|
||||
@@ -1061,7 +1061,7 @@ export default class Host extends lib.Link {
|
||||
instanceInfo.config.toRemote("controller"),
|
||||
instanceConnection ? instanceConnection.instance.status : "stopped",
|
||||
instanceConnection ? instanceConnection.instance.server.gamePort : this.gamePort(instanceId),
|
||||
instanceConnection ? instanceConnection.instance.server.version ?? undefined : undefined,
|
||||
instanceConnection ? instanceConnection.instance.server.version : undefined,
|
||||
));
|
||||
}
|
||||
await this.send(new lib.InstancesUpdateRequest(list));
|
||||
|
||||
@@ -453,8 +453,7 @@ rcon.print(game.table_to_json(players))`.replace(/\r?\n/g, " ");
|
||||
this.id,
|
||||
status,
|
||||
this.server.gamePort,
|
||||
// server.version can be null before server is initialized
|
||||
this.server.version ?? undefined,
|
||||
this.server.version,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ async function generateExportMod(server: FactorioServer) {
|
||||
sourceDir: path.join(__dirname, "..", "..", "..", "lua", "export"),
|
||||
outputDir: server.writePath("mods"),
|
||||
bumpPatch: false,
|
||||
factorioVersion: server.version.replace(/\.\d+$/, ""),
|
||||
factorioVersion: server.version?.replace(/\.\d+$/, ""),
|
||||
dependencies,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -725,12 +725,12 @@ export class FactorioServer extends events.EventEmitter {
|
||||
}
|
||||
|
||||
/**
|
||||
* The version of Factorio in use. This will be the actual version if
|
||||
* "latest" (the default) was specified as `factorioVersion` to the
|
||||
* constructor.
|
||||
* The version of Factorio in use. This will be the actual version if
|
||||
* "latest" (the default) was specified as `factorioVersion` to the constructor.
|
||||
* This will be undefined before the server is initialized, or if init failed.
|
||||
*/
|
||||
get version() {
|
||||
return this._version!;
|
||||
get version(): string | undefined {
|
||||
return this._version ?? undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user