I just spent a few hours looking into factorio modding, and I was trying to make a tiny mod that would simply log certain game events into a nice timestamped log file.
(I want these so that I can hook up factorio to my custom "game statistics" web page thingy that I have been using for Minecraft and Terraria.)
Unfortunately I hit a brick wall in that the io, and more importantly, the os module/library have been disabled in Factorio's Lua. So this means that I can't get the system time nor nicely format it :/
So would it be possible to add nicely formatted logging for "interesting game events", preferably in a separate log file that doesn't have the other verbose, and for this purpose, unnecessary noise that the server console normally has?
Interesting game events for my purposes would include:
- server start
- server stop
- player join
- player quit
- player death
- rocket launched
Code: Select all
2017-03-24 18:15:24 +0200 [INFO] Server started
2017-03-24 18:15:24 +0200 [INFO] Player masa joined the game
2017-03-24 18:15:24 +0200 [INFO] Player masa died
2017-03-24 18:15:24 +0200 [INFO] Player masa left the game
2017-03-24 18:15:24 +0200 [INFO] A rocket was launched
2017-03-24 18:15:24 +0200 [INFO] Server stopped
If this is out of scope for the game, then could I at least request that the relevant time functions from the os library be made available via the game's API?
For me it would include, at the very least, the following functions:
Code: Select all
os.time()
os.difftime()
os.date()
Also, are there any relevant events I could use to log the server start and stop events? If not, could those events be added as well?