Pull the LineSplitter class out of lib/factorio to its own stream module
and refactor it to be based on stream.Transform. This allows composing
with other streams by piping it around.
Add options to pass map seed, map exchange string, map gen settings
and/or map settings when creating a save either through the create save
request or the load scenario request.
Add readMapExchangeString to lib/factorio which parses and decodes the
data in Map Exchange into a format suitable for giving to the Factorio
server command line.
If the server decides to exit on its own during the stop operation to
the FactorioServer class after the operation has started but before the
signal is sent to the process then the exit handler will have wiped the
server child process and cause the kill call to fail. This in turn
would let the hang timer running which would bring down the Node.js
process due to an unhandled error for the same reason.
Fix by making sure the stop operation watches for the server exiting and
returning early if the server already quit before getting to the send
stop signal part.
Add winston based logger for master, slave, ctl, lib, and web_ui code.
Logging done from slaves and instances are sent to the master server and
tagged with the instance and/or slave it originated from. This allows
for example error messages to propagate back to the source that iniated
the action. The master server also stores the log to allow it to be
queried at a later point. For slaves a copy of the slave's log is also
stored locally.
Detect and colour the Script and Verbose levels. The format of the
source file for the Script level is slightly different and needs an
update to the output parsing.
Use lib* prefix for the modules impored from the lib package to help
distinguish them more from ordinary variables. Fix up the naming
convention for files to be consistently lowercase_underscore for
JavaScript files.
Split up codebase into the packages @clsterio/lib, @clusterio/master,
@clusterio/slave, and @clusterio/ctl using lerna to manage them. This
will allow deployment to use only the parts needed reducing install
size, and better separate the code into shared library, master, slave
and control.
Allow the factorio_directory specified in the slave config to contain
multiple Factorio installs and add factior.version instance option to
select which install to use for the given instance.
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.
Change module loading to use a module.json file describing the module
and patch in all files in a directory path passed to the patcher instead
of having to pass the files names and their content. This allows the
specification of which files should be passed to the event_handler lib
and an easy implementation of loading stand alone modules.
Remove Hotpatch and implement a save patcher in its place. The save
patcher takes a normal Factorio save and adds modules to it that's
loaded by a generated control.lua file. This greatly reduces the
difficulty of adding an existing game to Clusterio and using scenario
code in plugins.
The mechanism for selecting what code to patch into the saves from
plugins is temorary and expected to change with #220.
Move getFactorioLocale to the new lib/factorio namespace and refactor it
to use async functions instead of callbacks. Split tests into
integration with factorio and testing of the function itself.
Also removes the cacheing from the function itself as this breaks the
isolated testing of it.
Break out the server process management to a new FactorioServer class in
lib/factorio. This class takes responsibility for managing a factorio
server, communicating with it and handling the stopping of it. It also
replaces the previous effort to do this in lib/factorioServer.
This change also updates the version of rcon-client, and since the
author of it has updated it to use UTF-8 the fork is no longer
necessary. It also removes the messageInterface implementation
in favor of just calling the rcon-client library directly since
this has rate limiting logic built in.
The lib/factorio library is intended to abstract all the interfacing
that happens with Factorio.