mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-14 23:24:52 +09:00
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:
1 parent
b8fb73f863
commit
892c803496
6 files changed
+46
-9
No files matched your search
@@ -10,6 +10,18 @@ api.events = {
|
||||
-- instance_id: The id of the instance.
|
||||
-- instance_name: the name of the instance.
|
||||
on_instance_updated = script.generate_event_name(),
|
||||
|
||||
-- Raised when the server is starting up
|
||||
-- This event serves as the stand-in for the on_init and
|
||||
-- on_configuration_changed events for modules. It is invoked as early
|
||||
-- as possible, before most but not all other events, every time the
|
||||
-- server is started up.
|
||||
|
||||
-- Use this event to initialize and and/or migrate the data structures
|
||||
-- you need. Keep in mind that Clusterio can switch from any version of
|
||||
-- your module to any version of your module so it should be able to
|
||||
-- handle both forwards and backwards migrations.
|
||||
on_server_startup = script.generate_event_name(),
|
||||
}
|
||||
|
||||
-- Send a table as json to Clusterio
|
||||
@@ -50,4 +62,3 @@ end
|
||||
|
||||
|
||||
return api
|
||||
|
||||
Reference in new issue
Block a user