Add on_server_startup event

Add startup event to the Clusterio module API which is raised at startup
of a Factorio server.  This is to server as a replacement for the
on_init and on_configuration_changed events which cannot be used in
modules.

Adds clusterio_patch_number global from the patcher in order to
implement this.  This is a number that's incremented every time the save
is patched.
This commit is contained in:
Hornwitser committed 2020-01-05 23:19:34 +01:00
1 parent b8fb73f863
commit 892c803496
6 files changed
+46 -9

No files matched your search

+2
View File
@@ -52,6 +52,7 @@ describe("lib/factorio", function() {
let reference = [
'-- Auto generated scenario module loader created by Clusterio',
'-- Modifications to this file will be lost when loaded in Clusterio',
'clusterio_patch_number = 1',
'',
'local event_handler = require("event_handler")',
'',
@@ -64,6 +65,7 @@ describe("lib/factorio", function() {
'',
].join('\n');
let patchInfo = {
"patch_number": 1,
"scenario": { "modules": ["foo"] },
"modules": [{
"name": "spam",