Is it possible to access the system time with Fatorio's LUA?

Place to get help with not working mods / modding interface.
Pickle

Is it possible to access the system time with Fatorio's LUA?

Post 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?
User avatar
rk84
Filter Inserter
Filter Inserter
Posts: 556
Joined: Wed Feb 13, 2013 9:15 am
Contact:

Re: Is it possible to access the system time with Fatorio's

Post 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. :lol:
Test mode
Searching Flashlight
[WIP]Fluid handling expansion
[WIP]PvP gamescript
[WIP]Rocket Express
Autofill: The torch has been pass to Nexela
kovarex
Factorio Staff
Factorio Staff
Posts: 8293
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: Is it possible to access the system time with Fatorio's

Post 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.
User avatar
Reygan
Fast Inserter
Fast Inserter
Posts: 177
Joined: Tue Jan 28, 2014 8:42 pm
Contact:

Re: Is it possible to access the system time with Fatorio's

Post 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?
Daniel V. Lenskiy
kovarex
Factorio Staff
Factorio Staff
Posts: 8293
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: Is it possible to access the system time with Fatorio's

Post by kovarex »

Shouldn't be.
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Is it possible to access the system time with Fatorio's

Post 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...
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
Post Reply

Return to “Modding help”