Page 1 of 1
Is it possible to access the system time with Fatorio's LUA?
Posted: Tue Feb 25, 2014 7:28 am
by Pickle
I would like to make a mod that adds a real world clock to the HUD. Can Fatorio's LUA use os.time or something similar to get the current time on the user's PC?
Re: Is it possible to access the system time with Fatorio's
Posted: Tue Feb 25, 2014 10:52 am
by rk84
I though there was "game.time", but seems like there wasn't. os is most likely disabled for security reasons, but mayby they can add lua interface for time.
There is "game.tick" and I noticed you can overwrite it. So you could set it to real time, but you would have to do it everytime you start or load a game and it could cause bad/wierd game behavior. So mayby its not good idea.

Re: Is it possible to access the system time with Fatorio's
Posted: Wed Mar 12, 2014 1:32 pm
by kovarex
The time isn't accessible (as any function that reads from the outside world, as files etc), to avoid desynrchonisation in replays/multiplayer.
Re: Is it possible to access the system time with Fatorio's
Posted: Wed Mar 19, 2014 9:19 pm
by Reygan
kovarex wrote:The time isn't accessible (as any function that reads from the outside world, as files etc), to avoid desynrchonisation in replays/multiplayer.
By the way, are other system lua functions accessible through factorio?
Re: Is it possible to access the system time with Fatorio's
Posted: Thu Mar 20, 2014 9:51 am
by kovarex
Shouldn't be.
Re: Is it possible to access the system time with Fatorio's
Posted: Thu Mar 20, 2014 3:18 pm
by ssilk
Hm. It could be added, if it would be an event, like any other. Instead of "LMB pressed" a "Systime has changed". Every client sends his events every minute or so, the time between could be estimated by a function call...